From e1ddf8f3ed1f0b5ba60855b411be6953b4dfaa7b Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 28 Jun 2023 15:56:40 +0200 Subject: [PATCH 01/86] Ovn init --- Cargo.toml | 1 + ovn/Cargo.toml | 15 +++++++++++++++ ovn/src/ovn.rs | 8 ++++++++ 3 files changed, 24 insertions(+) create mode 100644 ovn/Cargo.toml create mode 100644 ovn/src/ovn.rs diff --git a/Cargo.toml b/Cargo.toml index 4e06422..867021f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,4 +23,5 @@ members = [ "pasta", "halo2", "weierstrass-curves", + "ovn", ] diff --git a/ovn/Cargo.toml b/ovn/Cargo.toml new file mode 100644 index 0000000..5099192 --- /dev/null +++ b/ovn/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "hacspec-ovn" +version = "0.1.0" +authors = ["Lasse Letager Hanse "] +edition = "2018" + +[lib] +path = "src/ovn.rs" + +[dependencies] +hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } + +[dev-dependencies] +criterion = "0.4" +rand = "0.8" diff --git a/ovn/src/ovn.rs b/ovn/src/ovn.rs new file mode 100644 index 0000000..a151bd1 --- /dev/null +++ b/ovn/src/ovn.rs @@ -0,0 +1,8 @@ +use hacspec_lib::*; + +pub trait Hasher: Clone { + type Hash: Copy + PartialEq + Into> + TryFrom>; + fn hash(data: &[u8]) -> Self::Hash; + fn concat_and_hash(left: &Self::Hash, right: Option<&Self::Hash>) -> Self::Hash; + fn hash_size() -> usize ; +} From 5e5a6afb88be264e0735add63602cb4887b6c717 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 18 Jul 2023 18:58:48 +0200 Subject: [PATCH 02/86] OVN files --- .../Hacspec_ovn.Schnorr.Random_oracle.fst | 3740 +++++++++++++++++ .../fstar/extraction/Hacspec_ovn.Schnorr.fst | 3704 ++++++++++++++++ ovn/proofs/fstar/extraction/Hacspec_ovn.fst | 9 + ovn/proofs/ssprove/extraction/.Core.aux | 2 + .../ssprove/extraction/.Hacspec_lib.aux | 5 + .../ssprove/extraction/.Hacspec_ovn.aux | 1 + ovn/proofs/ssprove/extraction/.Makefile.d | 9 + ovn/proofs/ssprove/extraction/Core.glob | 877 ++++ ovn/proofs/ssprove/extraction/Core.v | 213 + ovn/proofs/ssprove/extraction/Core.vo | Bin 0 -> 199240 bytes ovn/proofs/ssprove/extraction/Core.vok | 0 ovn/proofs/ssprove/extraction/Core.vos | 0 .../ssprove/extraction/Hacspec_lib.glob | 747 ++++ ovn/proofs/ssprove/extraction/Hacspec_lib.v | 362 ++ ovn/proofs/ssprove/extraction/Hacspec_lib.vo | Bin 0 -> 123685 bytes ovn/proofs/ssprove/extraction/Hacspec_lib.vok | 0 ovn/proofs/ssprove/extraction/Hacspec_lib.vos | 0 .../extraction/Hacspec_ovn.Random_oracle.v | 1834 ++++++++ .../Hacspec_ovn.Schnorr.Random_oracle.v | 1838 ++++++++ .../ssprove/extraction/Hacspec_ovn.Schnorr.v | 83 + .../ssprove/extraction/Hacspec_ovn.glob | 1104 +++++ ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 72 + ovn/proofs/ssprove/extraction/Makefile | 924 ++++ ovn/proofs/ssprove/extraction/Makefile.conf | 63 + ovn/proofs/ssprove/extraction/_CoqProject | 7 + ovn/proofs/ssprove/extraction/ovn_by_hand.v | 211 + ovn/proofs/ssprove/extraction/ovn_helpers.txt | 40 + ovn/src/Schnorr.rs | 0 ovn/src/ovn.rs | 143 +- ovn/src/ovn_old.rs | 284 ++ ovn/src/random_oracle.rs | 0 ovn/src/schnorr.rs | 109 + ovn/src/schnorr/random_oracle.rs | 72 + 33 files changed, 16448 insertions(+), 5 deletions(-) create mode 100644 ovn/proofs/fstar/extraction/Hacspec_ovn.Schnorr.Random_oracle.fst create mode 100644 ovn/proofs/fstar/extraction/Hacspec_ovn.Schnorr.fst create mode 100644 ovn/proofs/fstar/extraction/Hacspec_ovn.fst create mode 100644 ovn/proofs/ssprove/extraction/.Core.aux create mode 100644 ovn/proofs/ssprove/extraction/.Hacspec_lib.aux create mode 100644 ovn/proofs/ssprove/extraction/.Hacspec_ovn.aux create mode 100644 ovn/proofs/ssprove/extraction/.Makefile.d create mode 100644 ovn/proofs/ssprove/extraction/Core.glob create mode 100644 ovn/proofs/ssprove/extraction/Core.v create mode 100644 ovn/proofs/ssprove/extraction/Core.vo create mode 100644 ovn/proofs/ssprove/extraction/Core.vok create mode 100644 ovn/proofs/ssprove/extraction/Core.vos create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_lib.glob create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_lib.v create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_lib.vo create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_lib.vok create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_lib.vos create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn.Random_oracle.v create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn.Schnorr.Random_oracle.v create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn.Schnorr.v create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn.glob create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn.v create mode 100644 ovn/proofs/ssprove/extraction/Makefile create mode 100644 ovn/proofs/ssprove/extraction/Makefile.conf create mode 100644 ovn/proofs/ssprove/extraction/_CoqProject create mode 100644 ovn/proofs/ssprove/extraction/ovn_by_hand.v create mode 100644 ovn/proofs/ssprove/extraction/ovn_helpers.txt create mode 100644 ovn/src/Schnorr.rs create mode 100644 ovn/src/ovn_old.rs create mode 100644 ovn/src/random_oracle.rs create mode 100644 ovn/src/schnorr.rs create mode 100644 ovn/src/schnorr/random_oracle.rs diff --git a/ovn/proofs/fstar/extraction/Hacspec_ovn.Schnorr.Random_oracle.fst b/ovn/proofs/fstar/extraction/Hacspec_ovn.Schnorr.Random_oracle.fst new file mode 100644 index 0000000..dc01cd2 --- /dev/null +++ b/ovn/proofs/fstar/extraction/Hacspec_ovn.Schnorr.Random_oracle.fst @@ -0,0 +1,3740 @@ +module Hacspec_ovn.Schnorr.Random_oracle +#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" +open Core + +let random_oracle_init (_: Prims.unit) : Prims.unit = () + +type t_QueryCanvas = { + f_b:array u8 48sz; + f_sign:Num_bigint.Bigint.t_Sign; + f_signed:bool +} + +let max_under_impl_16: Core.Ops.Arith.Sub.t_Output = + ((Core.Convert.From.from 1ul <: Num_bigint.Bigint.t_BigInt) >>. 384l <: Core.Ops.Bit.Shl.t_Output) -. + (Num_traits.Identities.One.one <: Num_bigint.Bigint.t_BigInt) + +let max_value_under_impl_16: t_QueryCanvas = + Core.Convert.From.from (max_under_impl_16 <: Num_bigint.Bigint.t_BigInt) + +let hex_string_to_bytes_under_impl_16 (s: string) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = + let s:Alloc.String.t_String = + if ((Core.Str.len_under_impl s <: usize) %. 2sz <: usize) <>. 0sz + then + let x:Alloc.String.t_String = Alloc.String.ToString.to_string "0" in + let x:Alloc.String.t_String = Alloc.String.push_str_under_impl x s in + x + else Alloc.String.ToString.to_string s + in + let _:Prims.unit = + if ~.(((Alloc.String.len_under_impl s <: usize) %. 2sz <: usize) =. 0sz <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["length of hex string "; ": "] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [ + Core.Fmt.Rt.new_display_under_impl_1 s <: Core.Fmt.Rt.t_Argument; + Core.Fmt.Rt.new_display_under_impl_1 (Alloc.String.len_under_impl s + <: + usize) + <: + Core.Fmt.Rt.t_Argument + ] + in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let + (b: Core.Result.t_Result (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) Core.Num.Error.t_ParseIntError):Core.Result.t_Result + (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) Core.Num.Error.t_ParseIntError = + Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map (Core.Iter.Traits.Iterator.Iterator.step_by + ({ + Core.Ops.Range.Range.f_start = 0sz; + Core.Ops.Range.Range.f_end = Alloc.String.len_under_impl s <: usize + }) + 2sz + <: + Core.Iter.Adapters.Step_by.t_StepBy (Core.Ops.Range.t_Range usize)) + (fun i -> + Core.Num.from_str_radix_under_impl_6 (s.[ { + Core.Ops.Range.Range.f_start = i; + Core.Ops.Range.Range.f_end = i +. 2sz <: usize + } ] + <: + string) + 16ul + <: + Core.Result.t_Result u8 Core.Num.Error.t_ParseIntError) + <: + Core.Iter.Adapters.Map.t_Map + (Core.Iter.Adapters.Step_by.t_StepBy (Core.Ops.Range.t_Range usize)) + (usize -> Core.Result.t_Result u8 Core.Num.Error.t_ParseIntError)) + in + Core.Result.expect_under_impl b "Error parsing hex string" + +let from_literal_under_impl_16 (x: u128) : t_QueryCanvas = + let big_x:Num_bigint.Bigint.t_BigInt = Core.Convert.From.from x in + let _:Prims.unit = + if + big_x >. + (Core.Convert.Into.into (max_under_impl_16 <: Num_bigint.Bigint.t_BigInt) + <: + Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["literal "; " too big for type QueryCanvas"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Core.Convert.Into.into big_x + +let from_signed_literal_under_impl_16 (x: i128) : t_QueryCanvas = + let big_x:Num_bigint.Bigint.t_BigInt = Core.Convert.From.from (cast x) in + let _:Prims.unit = + if + big_x >. + (Core.Convert.Into.into (max_under_impl_16 <: Num_bigint.Bigint.t_BigInt) + <: + Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["literal "; " too big for type QueryCanvas"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Core.Convert.Into.into big_x + +let pow2_under_impl_16 (x: usize) : t_QueryCanvas = + Core.Convert.Into.into ((Core.Convert.From.from 1ul <: Num_bigint.Bigint.t_BigInt) >>. x + <: + Core.Ops.Bit.Shl.t_Output) + +let bit_under_impl_16 (self: t_QueryCanvas) (i: usize) : bool = + let _:Prims.unit = + if + ~.(i <. + ((Core.Slice.len_under_impl (Rust_primitives.unsize self + .Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_b + <: + slice u8) + <: + usize) *. + 8sz + <: + usize) + <: + bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = + [ + "the bit queried should be lower than the size of the integer representation: "; + " < " + ] + in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [ + Core.Fmt.Rt.new_display_under_impl_1 i <: Core.Fmt.Rt.t_Argument; + Core.Fmt.Rt.new_display_under_impl_1 ((Core.Slice.len_under_impl (Rust_primitives.unsize + self.Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_b + <: + slice u8) + <: + usize) *. + 8sz + <: + usize) + <: + Core.Fmt.Rt.t_Argument + ] + in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let (bigint: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (tmp: Num_bigint.Bigint.t_BigInt):Core.Ops.Bit.Shr.t_Output = bigint <<. i in + ((Num_bigint.Bigint.to_bytes_le_under_impl_24 (tmp &. + (Num_traits.Identities.One.one <: Num_bigint.Bigint.t_BigInt) + <: + Num_bigint.Bigint.t_BigInt) + <: + (Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global)) + ._2.[ 0sz ] + <: + u8) =. + 1uy + +let impl: Core.Convert.t_From t_QueryCanvas Num_bigint.Biguint.t_BigUint = + { + from + = + fun (x: Num_bigint.Biguint.t_BigUint) -> + Core.Convert.From.from (Core.Convert.From.from x <: Num_bigint.Bigint.t_BigInt) + } + +let impl: Core.Convert.t_From t_QueryCanvas Num_bigint.Bigint.t_BigInt = + { + from + = + fun (x: Num_bigint.Bigint.t_BigInt) -> + let max_value:Num_bigint.Bigint.t_BigInt = max_under_impl_16 in + let _:Prims.unit = + if ~.(x <=. max_value <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = + [""; " is too large for type QueryCanvas!"] + in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let sign, repr:(Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) = + Num_bigint.Bigint.to_bytes_be_under_impl_24 x + in + let _:Prims.unit = + if Prims.op_AmpAmp (sign =. Num_bigint.Bigint.Sign_Minus) ~.false + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "Trying to convert a negative number into an unsigned integer!" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + let _:Prims.unit = + if (Alloc.Vec.len_under_impl_1 repr <: usize) >. ((384sz +. 7sz <: usize) /. 8sz <: usize) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = [""; " is too large for type QueryCanvas"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let out:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in + let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize out <: slice u8) in + let lower:usize = upper -. (Alloc.Vec.len_under_impl_1 repr <: usize) in + let _:Prims.unit = + Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" + "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (out),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(core::ops::deref::Deref::deref(&(deref(&(repr)))))),\n )" + + in + { + Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_b = out; + Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_sign = sign; + Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_signed = false + } + } + +let impl: Core.Default.t_Default t_QueryCanvas = + { + default + = + fun -> + { + Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_b = Rust_primitives.Hax.repeat 0uy 48sz; + Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_sign = Num_bigint.Bigint.Sign_Plus; + Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_signed = false + } + } + +let impl: Core.Convert.t_Into t_QueryCanvas Num_bigint.Bigint.t_BigInt = + { + into + = + fun (self: t_QueryCanvas) -> + Num_bigint.Bigint.from_bytes_be_under_impl_24 self + .Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_sign + (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_b <: slice u8) + } + +let impl: Core.Convert.t_Into t_QueryCanvas Num_bigint.Biguint.t_BigUint = + { + into + = + fun (self: t_QueryCanvas) -> + Num_bigint.Biguint.from_bytes_be_under_impl_18 (Rust_primitives.unsize self + .Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_b + <: + slice u8) + } + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +let from_hex_under_impl_15 (s: string) : t_QueryCanvas = + Core.Convert.Into.into (Num_bigint.Bigint.from_bytes_be_under_impl_24 Num_bigint.Bigint.Sign_Plus + (Core.Ops.Deref.Deref.deref (hex_string_to_bytes_under_impl_16 s + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + Num_bigint.Bigint.t_BigInt) + +let from_be_bytes_under_impl_15 (v: slice u8) : t_QueryCanvas = + let _:Prims.unit = + if true + then + let _:Prims.unit = + if + ~.((Core.Slice.len_under_impl v <: usize) <=. ((384sz +. 7sz <: usize) /. 8sz <: usize) + <: + bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + () + in + let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in + let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize repr <: slice u8) in + let lower:usize = upper -. (Core.Slice.len_under_impl v <: usize) in + let _:Prims.unit = + Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" + "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(deref(&(v)))),\n )" + + in + { + Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_b = repr; + Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_sign = Num_bigint.Bigint.Sign_Plus; + Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_signed = false + } + +let from_le_bytes_under_impl_15 (v: slice u8) : t_QueryCanvas = + let _:Prims.unit = + if true + then + let _:Prims.unit = + if + ~.((Core.Slice.len_under_impl v <: usize) <=. ((384sz +. 7sz <: usize) /. 8sz <: usize) + <: + bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + () + in + let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in + let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize repr <: slice u8) in + let lower:usize = upper -. (Core.Slice.len_under_impl v <: usize) in + let _:Prims.unit = + Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" + "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(deref(&(v)))),\n )" + + in + Core.Convert.Into.into (Num_bigint.Bigint.from_bytes_le_under_impl_24 Num_bigint.Bigint.Sign_Plus + (Rust_primitives.unsize repr <: slice u8) + <: + Num_bigint.Bigint.t_BigInt) + +let to_be_bytes_under_impl_15 (self: t_QueryCanvas) : array u8 48sz = + self.Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_b + +let to_le_bytes_under_impl_15 (self: t_QueryCanvas) : array u8 48sz = + let x:Num_bigint.Bigint.t_BigInt = + Num_bigint.Bigint.from_bytes_be_under_impl_24 Num_bigint.Bigint.Sign_Plus + (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_b <: slice u8) + in + let _, x_s:(Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) = + Num_bigint.Bigint.to_bytes_le_under_impl_24 x + in + let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in + let _:Prims.unit = + Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" + "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: 0,\n f_end: alloc::vec::len_under_impl_1(&(x_s)),\n },\n ))),\n &(deref(core::ops::deref::Deref::deref(&(deref(&(x_s)))))),\n )" + + in + repr + +let comp_eq_under_impl_15 (self rhs: t_QueryCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a =. b + then + let one:t_QueryCanvas = from_literal_under_impl_16 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_ne_under_impl_15 (self rhs: t_QueryCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a <>. b + then + let one:t_QueryCanvas = from_literal_under_impl_16 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_gte_under_impl_15 (self rhs: t_QueryCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a >=. b + then + let one:t_QueryCanvas = from_literal_under_impl_16 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_gt_under_impl_15 (self rhs: t_QueryCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a >. b + then + let one:t_QueryCanvas = from_literal_under_impl_16 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_lte_under_impl_15 (self rhs: t_QueryCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a <=. b + then + let one:t_QueryCanvas = from_literal_under_impl_16 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_lt_under_impl_15 (self rhs: t_QueryCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a <. b + then + let one:t_QueryCanvas = from_literal_under_impl_16 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let inv_under_impl_27 (self modval: t_QueryCanvas) : t_QueryCanvas = + let (biguintmodval: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into modval + in + let m:Core.Ops.Arith.Sub.t_Output = + biguintmodval -. (Core.Convert.From.from 2ul <: Num_bigint.Bigint.t_BigInt) + in + let (s: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + Core.Convert.Into.into (Num_bigint.Bigint.modpow_under_impl_24 s m biguintmodval + <: + Num_bigint.Bigint.t_BigInt) + +let pow_felem_under_impl_27 (self exp modval: t_QueryCanvas) : t_QueryCanvas = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into exp in + let (m: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into modval in + let (c: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Num_bigint.Bigint.modpow_under_impl_24 a b m + in + Core.Convert.Into.into c + +let pow_under_impl_27 (self: t_QueryCanvas) (exp: u128) (modval: t_QueryCanvas) : t_QueryCanvas = + pow_felem_under_impl_27 self + (Core.Convert.Into.into (Core.Convert.From.from exp <: Num_bigint.Bigint.t_BigInt) + <: + t_QueryCanvas) + modval + +let rem_under_impl_27 (self n: t_QueryCanvas) : Core.Ops.Arith.Rem.t_Output = self %. n + +let impl: Core.Ops.Arith.t_Add t_QueryCanvas t_QueryCanvas = + { + output = t_QueryCanvas; + add + = + fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let c:Core.Ops.Arith.Add.t_Output = a +. b in + let _:Prims.unit = + if c >. (max_under_impl_16 <: Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = + ["bounded addition overflow for type QueryCanvas"] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Arith.t_Sub t_QueryCanvas t_QueryCanvas = + { + output = t_QueryCanvas; + sub + = + fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let c:Core.Ops.Arith.Sub.t_Output = + if self.Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_signed + then a -. b + else + Core.Option.unwrap_or_else_under_impl (Num_bigint.Bigint.checked_sub_under_impl_24 a b + <: + Core.Option.t_Option Num_bigint.Bigint.t_BigInt) + (fun -> + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = + ["bounded substraction underflow for type QueryCanvas"] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + <: + Num_bigint.Bigint.t_BigInt) + in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Arith.t_Mul t_QueryCanvas t_QueryCanvas = + { + output = t_QueryCanvas; + mul + = + fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let c:Core.Ops.Arith.Mul.t_Output = a *. b in + let _:Prims.unit = + if c >. (max_under_impl_16 <: Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = + ["bounded multiplication overflow for type QueryCanvas"] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Arith.t_Div t_QueryCanvas t_QueryCanvas = + { + output = t_QueryCanvas; + div + = + fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let _:Prims.unit = + if b =. (Num_traits.Identities.Zero.zero <: Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = ["dividing by zero in type QueryCanvas"] in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let c:Core.Ops.Arith.Div.t_Output = a /. b in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Arith.t_Rem t_QueryCanvas t_QueryCanvas = + { + output = t_QueryCanvas; + rem + = + fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let _:Prims.unit = + if b =. (Num_traits.Identities.Zero.zero <: Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = ["dividing by zero in type QueryCanvas"] in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let c:Core.Ops.Arith.Rem.t_Output = a %. b in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Bit.t_Not t_QueryCanvas = + { + output = t_QueryCanvas; + not + = + fun (self: t_QueryCanvas) -> + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "not implemented" + <: + Rust_primitives.Hax.t_Never) + } + +let impl: Core.Ops.Bit.t_BitOr t_QueryCanvas t_QueryCanvas = + { + output = t_QueryCanvas; + bitor + = + fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a |. b <: Core.Ops.Bit.BitOr.t_Output) + } + +let impl: Core.Ops.Bit.t_BitXor t_QueryCanvas t_QueryCanvas = + { + output = t_QueryCanvas; + bitxor + = + fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a ^. b <: Core.Ops.Bit.BitXor.t_Output) + } + +let impl: Core.Ops.Bit.t_BitAnd t_QueryCanvas t_QueryCanvas = + { + output = t_QueryCanvas; + bitand + = + fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a &. b <: Core.Ops.Bit.BitAnd.t_Output) + } + +let impl: Core.Ops.Bit.t_Shr t_QueryCanvas usize = + { + output = t_QueryCanvas; + shr + = + fun (self: t_QueryCanvas) (rhs: usize) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let b:usize = rhs in + Core.Convert.Into.into (a <<. b <: Core.Ops.Bit.Shr.t_Output) + } + +let impl: Core.Ops.Bit.t_Shl t_QueryCanvas usize = + { + output = t_QueryCanvas; + shl + = + fun (self: t_QueryCanvas) (rhs: usize) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let b:usize = rhs in + Core.Convert.Into.into (a >>. b <: Core.Ops.Bit.Shl.t_Output) + } + +let impl: Core.Cmp.t_PartialEq t_QueryCanvas t_QueryCanvas = + { + eq + = + fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + a =. b + } + +let impl: Core.Cmp.t_Eq t_QueryCanvas = { } + +let impl: Core.Cmp.t_PartialOrd t_QueryCanvas t_QueryCanvas = + { + partial_cmp + = + fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into other + in + Core.Cmp.PartialOrd.partial_cmp a b + } + +let impl: Core.Cmp.t_Ord t_QueryCanvas = + { + cmp + = + fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> + Core.Option.unwrap_under_impl (Core.Cmp.PartialOrd.partial_cmp self other + <: + Core.Option.t_Option Core.Cmp.t_Ordering) + } + +let from_byte_seq_be_under_impl_8 (s: a) : t_QueryCanvas = + from_be_bytes_under_impl_15 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (Secret_integers.t_U8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + +let from_public_byte_seq_be_under_impl_8 (s: a) : t_QueryCanvas = + from_be_bytes_under_impl_15 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> x) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + +let to_byte_seq_be_under_impl_8 (self: t_QueryCanvas) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map + (Core.Slice.iter_under_impl (Rust_primitives.unsize (to_be_bytes_under_impl_15 self + <: + array u8 48sz) + <: + slice u8) + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) + <: + Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) + +let impl: Hacspec_lib.Traits.t_NumericCopy t_QueryCanvas = { } + +let impl: Hacspec_lib.Traits.t_UnsignedInteger t_QueryCanvas = { } + +let impl: Hacspec_lib.Traits.t_UnsignedIntegerCopy t_QueryCanvas = { } + +let impl: Hacspec_lib.Traits.t_Integer t_QueryCanvas = + { + nUM_BITS = (fun -> 384sz); + zERO = (fun -> from_literal_under_impl_16 (pub_u128 0sz)); + oNE = (fun -> from_literal_under_impl_16 (pub_u128 1sz)); + tWO = (fun -> from_literal_under_impl_16 (pub_u128 2sz)); + from_literal = (fun (v_val: u128) -> from_literal_under_impl_16 v_val); + from_hex_string + = + (fun (s: Alloc.String.t_String) -> + from_hex_under_impl_15 (Core.Ops.Deref.Deref.deref (Alloc.Str.replace_under_impl_5 (Core.Ops.Deref.Deref.deref + s + <: + string) + "0x" + "" + <: + Alloc.String.t_String) + <: + string)); + get_bit + = + (fun (self: t_QueryCanvas) (i: usize) -> + (self <<. i <: Core.Ops.Bit.Shr.t_Output) &. + (Hacspec_lib.Traits.Integer.v_ONE <: t_QueryCanvas)); + set_bit + = + (fun (self: t_QueryCanvas) (b: t_QueryCanvas) (i: usize) -> + let _:Prims.unit = + if true + then + let _:Prims.unit = + if + ~.(Prims.op_BarBar (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b + <: + t_QueryCanvas) + (Hacspec_lib.Traits.Integer.v_ONE <: t_QueryCanvas) + <: + bool) + (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b <: t_QueryCanvas) + (Hacspec_lib.Traits.Integer.v_ZERO <: t_QueryCanvas) + <: + bool)) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO())" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + () + in + let tmp1:t_QueryCanvas = + from_literal_under_impl_16 (~.(pub_u128 1sz >>. i <: u128) <: u128) + in + let tmp2:Core.Ops.Bit.Shl.t_Output = b >>. i in + (self &. tmp1 <: Core.Ops.Bit.BitAnd.t_Output) |. tmp2); + set + = + (fun (self: t_QueryCanvas) (pos: usize) (y: t_QueryCanvas) (yi: usize) -> + let b:t_QueryCanvas = Hacspec_lib.Traits.Integer.get_bit y yi in + Hacspec_lib.Traits.Integer.set_bit self b pos); + rotate_left + = + (fun (self: t_QueryCanvas) (n: usize) -> + let _:Prims.unit = + if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + ((Core.Clone.Clone.clone self <: t_QueryCanvas) >>. n <: Core.Ops.Bit.Shl.t_Output) |. + (self <<. + (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. + (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) + <: + usize) + <: + Core.Ops.Bit.Shr.t_Output)); + rotate_right + = + fun (self: t_QueryCanvas) (n: usize) -> + let _:Prims.unit = + if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + ((Core.Clone.Clone.clone self <: t_QueryCanvas) <<. n <: Core.Ops.Bit.Shr.t_Output) |. + (self >>. + (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. + (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) + <: + usize) + <: + Core.Ops.Bit.Shl.t_Output) + } + +let impl: Hacspec_lib.Traits.t_ModNumeric t_QueryCanvas = + { + sub_mod + = + (fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) (n: t_QueryCanvas) -> + (self -. rhs <: Core.Ops.Arith.Sub.t_Output) %. n); + add_mod + = + (fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) (n: t_QueryCanvas) -> + (self +. rhs <: Core.Ops.Arith.Add.t_Output) %. n); + mul_mod + = + (fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) (n: t_QueryCanvas) -> + (self *. rhs <: Core.Ops.Arith.Mul.t_Output) %. n); + pow_mod + = + (fun (self: t_QueryCanvas) (exp: t_QueryCanvas) (n: t_QueryCanvas) -> + pow_felem_under_impl_27 self exp n); + modulo = (fun (self: t_QueryCanvas) (n: t_QueryCanvas) -> self %. n); + signed_modulo + = + (fun (self: t_QueryCanvas) (n: t_QueryCanvas) -> Hacspec_lib.Traits.ModNumeric.modulo self n); + absolute = fun (self: t_QueryCanvas) -> self + } + +let impl: Hacspec_lib.Traits.t_Numeric t_QueryCanvas = + { + max_val = (fun -> max_value_under_impl_16); + wrap_add = (fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> self +. rhs); + wrap_sub = (fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> self -. rhs); + wrap_mul = (fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> self *. rhs); + wrap_div = (fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> self /. rhs); + exp + = + (fun (self: t_QueryCanvas) (exp: u32) -> + pow_under_impl_27 self + (Core.Convert.Into.into exp <: u128) + (Hacspec_lib.Traits.Numeric.max_val <: t_QueryCanvas)); + pow_self + = + (fun (self: t_QueryCanvas) (exp: t_QueryCanvas) -> + pow_felem_under_impl_27 self + (Core.Convert.Into.into exp <: t_QueryCanvas) + (Hacspec_lib.Traits.Numeric.max_val <: t_QueryCanvas)); + divide = (fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> self /. rhs); + inv = (fun (self: t_QueryCanvas) (n: t_QueryCanvas) -> inv_under_impl_27 self n); + equal = (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> self =. other); + greater_than = (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> self >. other); + greater_than_or_equal = (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> self >=. other); + less_than = (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> self <. other); + less_than_or_equal = (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> self >=. other); + not_equal_bm + = + (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> + if ~.(Hacspec_lib.Traits.Numeric.equal self other <: bool) + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_16 (pub_u128 0sz)); + equal_bm + = + (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> + if Hacspec_lib.Traits.Numeric.equal self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_16 (pub_u128 0sz)); + greater_than_bm + = + (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> + if Hacspec_lib.Traits.Numeric.greater_than self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_16 (pub_u128 0sz)); + greater_than_or_equal_bm + = + (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> + if Hacspec_lib.Traits.Numeric.greater_than_or_equal self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_16 (pub_u128 0sz)); + less_than_bm + = + (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> + if Hacspec_lib.Traits.Numeric.less_than self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_16 (pub_u128 0sz)); + less_than_or_equal_bm + = + fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> + if Hacspec_lib.Traits.Numeric.less_than_or_equal self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_16 (pub_u128 0sz) + } + +type t_Query = | Query : t_QueryCanvas -> t_Query + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +let impl: Core.Convert.t_From t_Query t_QueryCanvas = + { + from + = + fun (x: t_QueryCanvas) -> + Query + (rem_under_impl_27 x + (from_hex_under_impl_15 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_QueryCanvas)) + } + +let impl: Core.Convert.t_Into t_Query t_QueryCanvas = + { into = fun (self: t_Query) -> self.Hacspec_ovn.Schnorr.Random_oracle.Query.0 } + +let from_canvas_under_impl_64 (x: t_QueryCanvas) : t_Query = + Query + (rem_under_impl_27 x + (from_hex_under_impl_15 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_QueryCanvas)) + +let into_canvas_under_impl_64 (self: t_Query) : t_QueryCanvas = + self.Hacspec_ovn.Schnorr.Random_oracle.Query.0 + +let max_under_impl_64: t_QueryCanvas = + from_hex_under_impl_15 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + +let declassify_under_impl_64 (self: t_Query) : Num_bigint.Bigint.t_BigInt = + let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into a + +let from_hex_under_impl_64 (s: string) : t_Query = + Core.Convert.Into.into (from_hex_under_impl_15 s <: t_QueryCanvas) + +let from_be_bytes_under_impl_64 (v: slice u8) : t_Query = + Core.Convert.Into.into (from_be_bytes_under_impl_15 v <: t_QueryCanvas) + +let to_be_bytes_under_impl_64 (self: t_Query) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = + Alloc.Slice.to_vec_under_impl (Rust_primitives.unsize (to_be_bytes_under_impl_15 (Core.Convert.Into.into + self + <: + t_QueryCanvas) + <: + array u8 48sz) + <: + slice u8) + +let from_le_bytes_under_impl_64 (v: slice u8) : t_Query = + Core.Convert.Into.into (from_le_bytes_under_impl_15 v <: t_QueryCanvas) + +let to_le_bytes_under_impl_64 (self: t_Query) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = + Alloc.Slice.to_vec_under_impl (Rust_primitives.unsize (to_le_bytes_under_impl_15 (Core.Convert.Into.into + self + <: + t_QueryCanvas) + <: + array u8 48sz) + <: + slice u8) + +let bit_under_impl_64 (self: t_Query) (i: usize) : bool = + bit_under_impl_16 (Core.Convert.Into.into self <: t_QueryCanvas) i + +let from_literal_under_impl_64 (x: u128) : t_Query = + let big_x:Num_bigint.Biguint.t_BigUint = Core.Convert.From.from x in + let _:Prims.unit = + if + big_x >. + (Core.Convert.Into.into (max_under_impl_64 <: t_QueryCanvas) <: Num_bigint.Biguint.t_BigUint) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["literal "; " too big for type Query"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Query (Core.Convert.Into.into big_x) + +let from_signed_literal_under_impl_64 (x: i128) : t_Query = + let big_x:Num_bigint.Biguint.t_BigUint = Core.Convert.From.from (cast x) in + let _:Prims.unit = + if + big_x >. + (Core.Convert.Into.into (max_under_impl_64 <: t_QueryCanvas) <: Num_bigint.Biguint.t_BigUint) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["literal "; " too big for type Query"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Query (Core.Convert.Into.into big_x) + +let comp_eq_under_impl_64 (self rhs: t_Query) : t_Query = + let (x: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_eq_under_impl_15 x (Core.Convert.Into.into rhs <: t_QueryCanvas) + <: + t_QueryCanvas) + +let comp_ne_under_impl_64 (self rhs: t_Query) : t_Query = + let (x: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_ne_under_impl_15 x (Core.Convert.Into.into rhs <: t_QueryCanvas) + <: + t_QueryCanvas) + +let comp_gte_under_impl_64 (self rhs: t_Query) : t_Query = + let (x: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_gte_under_impl_15 x (Core.Convert.Into.into rhs <: t_QueryCanvas) + <: + t_QueryCanvas) + +let comp_gt_under_impl_64 (self rhs: t_Query) : t_Query = + let (x: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_gt_under_impl_15 x (Core.Convert.Into.into rhs <: t_QueryCanvas) + <: + t_QueryCanvas) + +let comp_lte_under_impl_64 (self rhs: t_Query) : t_Query = + let (x: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_lte_under_impl_15 x (Core.Convert.Into.into rhs <: t_QueryCanvas) + <: + t_QueryCanvas) + +let comp_lt_under_impl_64 (self rhs: t_Query) : t_Query = + let (x: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_lt_under_impl_15 x (Core.Convert.Into.into rhs <: t_QueryCanvas) + <: + t_QueryCanvas) + +let neg_under_impl_64 (self: t_Query) : t_Query = + let (mod_val: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into (from_hex_under_impl_15 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_QueryCanvas) + in + let (s: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + let (s: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into s in + let (result: t_QueryCanvas):t_QueryCanvas = + Core.Convert.Into.into (mod_val -. s <: Core.Ops.Arith.Sub.t_Output) + in + Core.Convert.Into.into result + +let impl: Core.Cmp.t_PartialOrd t_Query t_Query = + { + partial_cmp + = + fun (self: t_Query) (other: t_Query) -> Core.Option.Option_Some (Core.Cmp.Ord.cmp self other) + } + +let impl: Core.Cmp.t_Ord t_Query = + { + cmp + = + fun (self: t_Query) (other: t_Query) -> + Core.Cmp.Ord.cmp self.Hacspec_ovn.Schnorr.Random_oracle.Query.0 + other.Hacspec_ovn.Schnorr.Random_oracle.Query.0 + } + +let impl: Core.Cmp.t_PartialEq t_Query t_Query = + { + eq + = + fun (self: t_Query) (other: t_Query) -> + self.Hacspec_ovn.Schnorr.Random_oracle.Query.0 =. + other.Hacspec_ovn.Schnorr.Random_oracle.Query.0 + } + +let impl: Core.Cmp.t_Eq t_Query = { } + +let impl: Core.Ops.Arith.t_Add t_Query t_Query = + { + output = t_Query; + add + = + fun (self: t_Query) (rhs: t_Query) -> + let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + let (b: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into rhs in + let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into a + in + let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into b + in + let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Add.t_Output = a +. b in + let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into (from_hex_under_impl_15 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_QueryCanvas) + in + let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in + let (d: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into d in + Core.Convert.Into.into d + } + +let impl: Core.Ops.Arith.t_Sub t_Query t_Query = + { + output = t_Query; + sub + = + fun (self: t_Query) (rhs: t_Query) -> + let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + let (b: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into rhs in + let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into a + in + let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into b + in + let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into (from_hex_under_impl_15 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_QueryCanvas) + in + let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Add.t_Output = + if b >. a + then + ((Core.Clone.Clone.clone max <: Num_bigint.Biguint.t_BigUint) -. b + <: + Core.Ops.Arith.Sub.t_Output) +. + a + else a -. b + in + let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in + let (d: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into d in + Core.Convert.Into.into d + } + +let impl: Core.Ops.Arith.t_Mul t_Query t_Query = + { + output = t_Query; + mul + = + fun (self: t_Query) (rhs: t_Query) -> + let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + let (b: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into rhs in + let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into a + in + let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into b + in + let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Mul.t_Output = a *. b in + let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into (from_hex_under_impl_15 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_QueryCanvas) + in + let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in + let (d: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into d in + Core.Convert.Into.into d + } + +let impl: Core.Ops.Arith.t_Div t_Query t_Query = + { + output = t_Query; + div = fun (self: t_Query) (rhs: t_Query) -> self *. (inv_under_impl_58 rhs <: t_Query) + } + +let impl: Core.Ops.Arith.t_Rem t_Query t_Query = + { + output = t_Query; + rem + = + fun (self: t_Query) (rhs: t_Query) -> + let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + let (b: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into rhs in + let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into a + in + let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into b + in + let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = a %. b in + let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into (from_hex_under_impl_15 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_QueryCanvas) + in + let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in + let (d: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into d in + Core.Convert.Into.into d + } + +let impl: Core.Ops.Bit.t_Not t_Query = + { + output = t_Query; + not + = + fun (self: t_Query) -> + let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (~.a <: Core.Ops.Bit.Not.t_Output) + } + +let impl: Core.Ops.Bit.t_BitOr t_Query t_Query = + { + output = t_Query; + bitor + = + fun (self: t_Query) (rhs: t_Query) -> + let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + let (b: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a |. b <: Core.Ops.Bit.BitOr.t_Output) + } + +let impl: Core.Ops.Bit.t_BitXor t_Query t_Query = + { + output = t_Query; + bitxor + = + fun (self: t_Query) (rhs: t_Query) -> + let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + let (b: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a ^. b <: Core.Ops.Bit.BitXor.t_Output) + } + +let impl: Core.Ops.Bit.t_BitAnd t_Query t_Query = + { + output = t_Query; + bitand + = + fun (self: t_Query) (rhs: t_Query) -> + let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + let (b: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a &. b <: Core.Ops.Bit.BitAnd.t_Output) + } + +let impl: Core.Ops.Bit.t_Shr t_Query usize = + { + output = t_Query; + shr + = + fun (self: t_Query) (rhs: usize) -> + let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (a <<. rhs <: Core.Ops.Bit.Shr.t_Output) + } + +let impl: Core.Ops.Bit.t_Shl t_Query usize = + { + output = t_Query; + shl + = + fun (self: t_Query) (rhs: usize) -> + let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (a >>. rhs <: Core.Ops.Bit.Shl.t_Output) + } + +let inv_under_impl_58 (self: t_Query) : t_Query = + let (base: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (inv_under_impl_27 base (max_under_impl_64 <: t_QueryCanvas) + <: + t_QueryCanvas) + +let pow_felem_under_impl_58 (self exp: t_Query) : t_Query = + let (base: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (pow_felem_under_impl_27 base + (Core.Convert.Into.into exp <: t_QueryCanvas) + (max_under_impl_64 <: t_QueryCanvas) + <: + t_QueryCanvas) + +let pow_under_impl_58 (self: t_Query) (exp: u128) : t_Query = + let (base: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (pow_under_impl_27 base exp (max_under_impl_64 <: t_QueryCanvas) + <: + t_QueryCanvas) + +let pow2_under_impl_58 (x: usize) : t_Query = + Core.Convert.Into.into (pow2_under_impl_16 x <: t_QueryCanvas) + +let from_byte_seq_be_under_impl_1 (s: a) : t_Query = + Core.Convert.Into.into (from_be_bytes_under_impl_15 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (Secret_integers.t_U8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + t_QueryCanvas) + +let from_public_byte_seq_be_under_impl_1 (s: a) : t_Query = + Core.Convert.Into.into (from_be_bytes_under_impl_15 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> x) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + t_QueryCanvas) + +let to_byte_seq_be_under_impl_1 (self: t_Query) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map + (Core.Slice.iter_under_impl (Core.Ops.Deref.Deref.deref (to_be_bytes_under_impl_64 self + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) + <: + Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) + +let to_public_byte_seq_be_under_impl_1 (self: t_Query) : Hacspec_lib.Seq.t_Seq u8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (to_be_bytes_under_impl_64 self + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + +let from_byte_seq_le_under_impl_1 (s: a) : t_Query = + Core.Convert.Into.into (from_le_bytes_under_impl_15 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (Secret_integers.t_U8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + t_QueryCanvas) + +let from_public_byte_seq_le_under_impl_1 (s: a) : t_Query = + Core.Convert.Into.into (from_le_bytes_under_impl_15 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> x) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + t_QueryCanvas) + +let to_byte_seq_le_under_impl_1 (self: t_Query) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map + (Core.Slice.iter_under_impl (Core.Ops.Deref.Deref.deref (to_le_bytes_under_impl_64 self + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) + <: + Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) + +let to_public_byte_seq_le_under_impl_1 (self: t_Query) : Hacspec_lib.Seq.t_Seq u8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (to_le_bytes_under_impl_64 self + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + +let from_secret_literal_under_impl_1 (x: Secret_integers.t_U128) : t_Query = + Core.Convert.Into.into (from_literal_under_impl_16 (Secret_integers.declassify_under_impl_126 x + <: + u128) + <: + t_QueryCanvas) + +let impl: Hacspec_lib.Traits.t_NumericCopy t_Query = { } + +let impl: Hacspec_lib.Traits.t_UnsignedInteger t_Query = { } + +let impl: Hacspec_lib.Traits.t_UnsignedIntegerCopy t_Query = { } + +let impl: Hacspec_lib.Traits.t_Integer t_Query = + { + nUM_BITS = (fun -> 384sz); + zERO = (fun -> from_literal_under_impl_64 (pub_u128 0sz)); + oNE = (fun -> from_literal_under_impl_64 (pub_u128 1sz)); + tWO = (fun -> from_literal_under_impl_64 (pub_u128 2sz)); + from_literal = (fun (v_val: u128) -> from_literal_under_impl_64 v_val); + from_hex_string + = + (fun (s: Alloc.String.t_String) -> + from_hex_under_impl_64 (Core.Ops.Deref.Deref.deref (Alloc.Str.replace_under_impl_5 (Core.Ops.Deref.Deref.deref + s + <: + string) + "0x" + "" + <: + Alloc.String.t_String) + <: + string)); + get_bit + = + (fun (self: t_Query) (i: usize) -> + (self <<. i <: Core.Ops.Bit.Shr.t_Output) &. (Hacspec_lib.Traits.Integer.v_ONE <: t_Query)); + set_bit + = + (fun (self: t_Query) (b: t_Query) (i: usize) -> + let _:Prims.unit = + if true + then + let _:Prims.unit = + if + ~.(Prims.op_BarBar (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b + <: + t_Query) + (Hacspec_lib.Traits.Integer.v_ONE <: t_Query) + <: + bool) + (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b <: t_Query) + (Hacspec_lib.Traits.Integer.v_ZERO <: t_Query) + <: + bool)) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO())" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + () + in + let tmp1:t_Query = from_literal_under_impl_64 (~.(pub_u128 1sz >>. i <: u128) <: u128) in + let tmp2:Core.Ops.Bit.Shl.t_Output = b >>. i in + (self &. tmp1 <: Core.Ops.Bit.BitAnd.t_Output) |. tmp2); + set + = + (fun (self: t_Query) (pos: usize) (y: t_Query) (yi: usize) -> + let b:t_Query = Hacspec_lib.Traits.Integer.get_bit y yi in + Hacspec_lib.Traits.Integer.set_bit self b pos); + rotate_left + = + (fun (self: t_Query) (n: usize) -> + let _:Prims.unit = + if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + ((Core.Clone.Clone.clone self <: t_Query) >>. n <: Core.Ops.Bit.Shl.t_Output) |. + (self <<. + (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. + (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) + <: + usize) + <: + Core.Ops.Bit.Shr.t_Output)); + rotate_right + = + fun (self: t_Query) (n: usize) -> + let _:Prims.unit = + if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + ((Core.Clone.Clone.clone self <: t_Query) <<. n <: Core.Ops.Bit.Shr.t_Output) |. + (self >>. + (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. + (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) + <: + usize) + <: + Core.Ops.Bit.Shl.t_Output) + } + +let impl: Hacspec_lib.Traits.t_ModNumeric t_Query = + { + sub_mod = (fun (self: t_Query) (rhs: t_Query) (n: t_Query) -> self -. rhs); + add_mod = (fun (self: t_Query) (rhs: t_Query) (n: t_Query) -> self +. rhs); + mul_mod = (fun (self: t_Query) (rhs: t_Query) (n: t_Query) -> self *. rhs); + pow_mod = (fun (self: t_Query) (exp: t_Query) (n: t_Query) -> pow_felem_under_impl_58 self exp); + modulo = (fun (self: t_Query) (n: t_Query) -> self %. n); + signed_modulo + = + (fun (self: t_Query) (n: t_Query) -> Hacspec_lib.Traits.ModNumeric.modulo self n); + absolute = fun (self: t_Query) -> self + } + +let impl: Hacspec_lib.Traits.t_Numeric t_Query = + { + max_val + = + (fun -> + Core.Convert.Into.into ((max_under_impl_64 <: t_QueryCanvas) -. + (from_literal_under_impl_16 (pub_u128 1sz) <: t_QueryCanvas) + <: + Core.Ops.Arith.Sub.t_Output)); + wrap_add = (fun (self: t_Query) (rhs: t_Query) -> self +. rhs); + wrap_sub = (fun (self: t_Query) (rhs: t_Query) -> self -. rhs); + wrap_mul = (fun (self: t_Query) (rhs: t_Query) -> self *. rhs); + wrap_div = (fun (self: t_Query) (rhs: t_Query) -> self /. rhs); + exp + = + (fun (self: t_Query) (exp: u32) -> pow_under_impl_58 self (Core.Convert.Into.into exp <: u128)); + pow_self = (fun (self: t_Query) (exp: t_Query) -> pow_felem_under_impl_58 self exp); + divide = (fun (self: t_Query) (rhs: t_Query) -> self /. rhs); + inv = (fun (self: t_Query) (n: t_Query) -> inv_under_impl_58 self); + equal = (fun (self: t_Query) (other: t_Query) -> self =. other); + greater_than = (fun (self: t_Query) (other: t_Query) -> self >. other); + greater_than_or_equal = (fun (self: t_Query) (other: t_Query) -> self >=. other); + less_than = (fun (self: t_Query) (other: t_Query) -> self <. other); + less_than_or_equal = (fun (self: t_Query) (other: t_Query) -> self <=. other); + not_equal_bm + = + (fun (self: t_Query) (other: t_Query) -> + if self <>. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_Query) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_Query) + else Hacspec_lib.Traits.Integer.v_ZERO); + equal_bm + = + (fun (self: t_Query) (other: t_Query) -> + if self =. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_Query) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_Query) + else Hacspec_lib.Traits.Integer.v_ZERO); + greater_than_bm + = + (fun (self: t_Query) (other: t_Query) -> + if self >. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_Query) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_Query) + else Hacspec_lib.Traits.Integer.v_ZERO); + greater_than_or_equal_bm + = + (fun (self: t_Query) (other: t_Query) -> + if self >=. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_Query) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_Query) + else Hacspec_lib.Traits.Integer.v_ZERO); + less_than_bm + = + (fun (self: t_Query) (other: t_Query) -> + if self <. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_Query) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_Query) + else Hacspec_lib.Traits.Integer.v_ZERO); + less_than_or_equal_bm + = + fun (self: t_Query) (other: t_Query) -> + if self <=. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_Query) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_Query) + else Hacspec_lib.Traits.Integer.v_ZERO + } + +type t_RandomCanvas = { + f_b:array u8 48sz; + f_sign:Num_bigint.Bigint.t_Sign; + f_signed:bool +} + +let max_under_impl_83: Core.Ops.Arith.Sub.t_Output = + ((Core.Convert.From.from 1ul <: Num_bigint.Bigint.t_BigInt) >>. 384l <: Core.Ops.Bit.Shl.t_Output) -. + (Num_traits.Identities.One.one <: Num_bigint.Bigint.t_BigInt) + +let max_value_under_impl_83: t_RandomCanvas = + Core.Convert.From.from (max_under_impl_83 <: Num_bigint.Bigint.t_BigInt) + +let hex_string_to_bytes_under_impl_83 (s: string) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = + let s:Alloc.String.t_String = + if ((Core.Str.len_under_impl s <: usize) %. 2sz <: usize) <>. 0sz + then + let x:Alloc.String.t_String = Alloc.String.ToString.to_string "0" in + let x:Alloc.String.t_String = Alloc.String.push_str_under_impl x s in + x + else Alloc.String.ToString.to_string s + in + let _:Prims.unit = + if ~.(((Alloc.String.len_under_impl s <: usize) %. 2sz <: usize) =. 0sz <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["length of hex string "; ": "] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [ + Core.Fmt.Rt.new_display_under_impl_1 s <: Core.Fmt.Rt.t_Argument; + Core.Fmt.Rt.new_display_under_impl_1 (Alloc.String.len_under_impl s + <: + usize) + <: + Core.Fmt.Rt.t_Argument + ] + in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let + (b: Core.Result.t_Result (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) Core.Num.Error.t_ParseIntError):Core.Result.t_Result + (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) Core.Num.Error.t_ParseIntError = + Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map (Core.Iter.Traits.Iterator.Iterator.step_by + ({ + Core.Ops.Range.Range.f_start = 0sz; + Core.Ops.Range.Range.f_end = Alloc.String.len_under_impl s <: usize + }) + 2sz + <: + Core.Iter.Adapters.Step_by.t_StepBy (Core.Ops.Range.t_Range usize)) + (fun i -> + Core.Num.from_str_radix_under_impl_6 (s.[ { + Core.Ops.Range.Range.f_start = i; + Core.Ops.Range.Range.f_end = i +. 2sz <: usize + } ] + <: + string) + 16ul + <: + Core.Result.t_Result u8 Core.Num.Error.t_ParseIntError) + <: + Core.Iter.Adapters.Map.t_Map + (Core.Iter.Adapters.Step_by.t_StepBy (Core.Ops.Range.t_Range usize)) + (usize -> Core.Result.t_Result u8 Core.Num.Error.t_ParseIntError)) + in + Core.Result.expect_under_impl b "Error parsing hex string" + +let from_literal_under_impl_83 (x: u128) : t_RandomCanvas = + let big_x:Num_bigint.Bigint.t_BigInt = Core.Convert.From.from x in + let _:Prims.unit = + if + big_x >. + (Core.Convert.Into.into (max_under_impl_83 <: Num_bigint.Bigint.t_BigInt) + <: + Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["literal "; " too big for type RandomCanvas"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Core.Convert.Into.into big_x + +let from_signed_literal_under_impl_83 (x: i128) : t_RandomCanvas = + let big_x:Num_bigint.Bigint.t_BigInt = Core.Convert.From.from (cast x) in + let _:Prims.unit = + if + big_x >. + (Core.Convert.Into.into (max_under_impl_83 <: Num_bigint.Bigint.t_BigInt) + <: + Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["literal "; " too big for type RandomCanvas"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Core.Convert.Into.into big_x + +let pow2_under_impl_83 (x: usize) : t_RandomCanvas = + Core.Convert.Into.into ((Core.Convert.From.from 1ul <: Num_bigint.Bigint.t_BigInt) >>. x + <: + Core.Ops.Bit.Shl.t_Output) + +let bit_under_impl_83 (self: t_RandomCanvas) (i: usize) : bool = + let _:Prims.unit = + if + ~.(i <. + ((Core.Slice.len_under_impl (Rust_primitives.unsize self + .Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_b + <: + slice u8) + <: + usize) *. + 8sz + <: + usize) + <: + bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = + [ + "the bit queried should be lower than the size of the integer representation: "; + " < " + ] + in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [ + Core.Fmt.Rt.new_display_under_impl_1 i <: Core.Fmt.Rt.t_Argument; + Core.Fmt.Rt.new_display_under_impl_1 ((Core.Slice.len_under_impl (Rust_primitives.unsize + self.Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_b + <: + slice u8) + <: + usize) *. + 8sz + <: + usize) + <: + Core.Fmt.Rt.t_Argument + ] + in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let (bigint: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (tmp: Num_bigint.Bigint.t_BigInt):Core.Ops.Bit.Shr.t_Output = bigint <<. i in + ((Num_bigint.Bigint.to_bytes_le_under_impl_24 (tmp &. + (Num_traits.Identities.One.one <: Num_bigint.Bigint.t_BigInt) + <: + Num_bigint.Bigint.t_BigInt) + <: + (Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global)) + ._2.[ 0sz ] + <: + u8) =. + 1uy + +let impl: Core.Convert.t_From t_RandomCanvas Num_bigint.Biguint.t_BigUint = + { + from + = + fun (x: Num_bigint.Biguint.t_BigUint) -> + Core.Convert.From.from (Core.Convert.From.from x <: Num_bigint.Bigint.t_BigInt) + } + +let impl: Core.Convert.t_From t_RandomCanvas Num_bigint.Bigint.t_BigInt = + { + from + = + fun (x: Num_bigint.Bigint.t_BigInt) -> + let max_value:Num_bigint.Bigint.t_BigInt = max_under_impl_83 in + let _:Prims.unit = + if ~.(x <=. max_value <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = + [""; " is too large for type RandomCanvas!"] + in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let sign, repr:(Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) = + Num_bigint.Bigint.to_bytes_be_under_impl_24 x + in + let _:Prims.unit = + if Prims.op_AmpAmp (sign =. Num_bigint.Bigint.Sign_Minus) ~.false + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "Trying to convert a negative number into an unsigned integer!" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + let _:Prims.unit = + if (Alloc.Vec.len_under_impl_1 repr <: usize) >. ((384sz +. 7sz <: usize) /. 8sz <: usize) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = + [""; " is too large for type RandomCanvas"] + in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let out:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in + let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize out <: slice u8) in + let lower:usize = upper -. (Alloc.Vec.len_under_impl_1 repr <: usize) in + let _:Prims.unit = + Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" + "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (out),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(core::ops::deref::Deref::deref(&(deref(&(repr)))))),\n )" + + in + { + Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_b = out; + Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_sign = sign; + Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_signed = false + } + } + +let impl: Core.Default.t_Default t_RandomCanvas = + { + default + = + fun -> + { + Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_b = Rust_primitives.Hax.repeat 0uy 48sz; + Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_sign = Num_bigint.Bigint.Sign_Plus; + Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_signed = false + } + } + +let impl: Core.Convert.t_Into t_RandomCanvas Num_bigint.Bigint.t_BigInt = + { + into + = + fun (self: t_RandomCanvas) -> + Num_bigint.Bigint.from_bytes_be_under_impl_24 self + .Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_sign + (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_b <: slice u8) + } + +let impl: Core.Convert.t_Into t_RandomCanvas Num_bigint.Biguint.t_BigUint = + { + into + = + fun (self: t_RandomCanvas) -> + Num_bigint.Biguint.from_bytes_be_under_impl_18 (Rust_primitives.unsize self + .Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_b + <: + slice u8) + } + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +let from_hex_under_impl_82 (s: string) : t_RandomCanvas = + Core.Convert.Into.into (Num_bigint.Bigint.from_bytes_be_under_impl_24 Num_bigint.Bigint.Sign_Plus + (Core.Ops.Deref.Deref.deref (hex_string_to_bytes_under_impl_83 s + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + Num_bigint.Bigint.t_BigInt) + +let from_be_bytes_under_impl_82 (v: slice u8) : t_RandomCanvas = + let _:Prims.unit = + if true + then + let _:Prims.unit = + if + ~.((Core.Slice.len_under_impl v <: usize) <=. ((384sz +. 7sz <: usize) /. 8sz <: usize) + <: + bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + () + in + let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in + let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize repr <: slice u8) in + let lower:usize = upper -. (Core.Slice.len_under_impl v <: usize) in + let _:Prims.unit = + Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" + "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(deref(&(v)))),\n )" + + in + { + Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_b = repr; + Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_sign = Num_bigint.Bigint.Sign_Plus; + Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_signed = false + } + +let from_le_bytes_under_impl_82 (v: slice u8) : t_RandomCanvas = + let _:Prims.unit = + if true + then + let _:Prims.unit = + if + ~.((Core.Slice.len_under_impl v <: usize) <=. ((384sz +. 7sz <: usize) /. 8sz <: usize) + <: + bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + () + in + let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in + let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize repr <: slice u8) in + let lower:usize = upper -. (Core.Slice.len_under_impl v <: usize) in + let _:Prims.unit = + Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" + "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(deref(&(v)))),\n )" + + in + Core.Convert.Into.into (Num_bigint.Bigint.from_bytes_le_under_impl_24 Num_bigint.Bigint.Sign_Plus + (Rust_primitives.unsize repr <: slice u8) + <: + Num_bigint.Bigint.t_BigInt) + +let to_be_bytes_under_impl_82 (self: t_RandomCanvas) : array u8 48sz = + self.Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_b + +let to_le_bytes_under_impl_82 (self: t_RandomCanvas) : array u8 48sz = + let x:Num_bigint.Bigint.t_BigInt = + Num_bigint.Bigint.from_bytes_be_under_impl_24 Num_bigint.Bigint.Sign_Plus + (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_b <: slice u8) + in + let _, x_s:(Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) = + Num_bigint.Bigint.to_bytes_le_under_impl_24 x + in + let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in + let _:Prims.unit = + Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" + "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: 0,\n f_end: alloc::vec::len_under_impl_1(&(x_s)),\n },\n ))),\n &(deref(core::ops::deref::Deref::deref(&(deref(&(x_s)))))),\n )" + + in + repr + +let comp_eq_under_impl_82 (self rhs: t_RandomCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a =. b + then + let one:t_RandomCanvas = from_literal_under_impl_83 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_ne_under_impl_82 (self rhs: t_RandomCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a <>. b + then + let one:t_RandomCanvas = from_literal_under_impl_83 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_gte_under_impl_82 (self rhs: t_RandomCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a >=. b + then + let one:t_RandomCanvas = from_literal_under_impl_83 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_gt_under_impl_82 (self rhs: t_RandomCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a >. b + then + let one:t_RandomCanvas = from_literal_under_impl_83 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_lte_under_impl_82 (self rhs: t_RandomCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a <=. b + then + let one:t_RandomCanvas = from_literal_under_impl_83 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_lt_under_impl_82 (self rhs: t_RandomCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a <. b + then + let one:t_RandomCanvas = from_literal_under_impl_83 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let inv_under_impl_94 (self modval: t_RandomCanvas) : t_RandomCanvas = + let (biguintmodval: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into modval + in + let m:Core.Ops.Arith.Sub.t_Output = + biguintmodval -. (Core.Convert.From.from 2ul <: Num_bigint.Bigint.t_BigInt) + in + let (s: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + Core.Convert.Into.into (Num_bigint.Bigint.modpow_under_impl_24 s m biguintmodval + <: + Num_bigint.Bigint.t_BigInt) + +let pow_felem_under_impl_94 (self exp modval: t_RandomCanvas) : t_RandomCanvas = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into exp in + let (m: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into modval in + let (c: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Num_bigint.Bigint.modpow_under_impl_24 a b m + in + Core.Convert.Into.into c + +let pow_under_impl_94 (self: t_RandomCanvas) (exp: u128) (modval: t_RandomCanvas) : t_RandomCanvas = + pow_felem_under_impl_94 self + (Core.Convert.Into.into (Core.Convert.From.from exp <: Num_bigint.Bigint.t_BigInt) + <: + t_RandomCanvas) + modval + +let rem_under_impl_94 (self n: t_RandomCanvas) : Core.Ops.Arith.Rem.t_Output = self %. n + +let impl: Core.Ops.Arith.t_Add t_RandomCanvas t_RandomCanvas = + { + output = t_RandomCanvas; + add + = + fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let c:Core.Ops.Arith.Add.t_Output = a +. b in + let _:Prims.unit = + if c >. (max_under_impl_83 <: Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = + ["bounded addition overflow for type RandomCanvas"] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Arith.t_Sub t_RandomCanvas t_RandomCanvas = + { + output = t_RandomCanvas; + sub + = + fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let c:Core.Ops.Arith.Sub.t_Output = + if self.Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_signed + then a -. b + else + Core.Option.unwrap_or_else_under_impl (Num_bigint.Bigint.checked_sub_under_impl_24 a b + <: + Core.Option.t_Option Num_bigint.Bigint.t_BigInt) + (fun -> + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = + ["bounded substraction underflow for type RandomCanvas"] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + <: + Num_bigint.Bigint.t_BigInt) + in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Arith.t_Mul t_RandomCanvas t_RandomCanvas = + { + output = t_RandomCanvas; + mul + = + fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let c:Core.Ops.Arith.Mul.t_Output = a *. b in + let _:Prims.unit = + if c >. (max_under_impl_83 <: Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = + ["bounded multiplication overflow for type RandomCanvas"] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Arith.t_Div t_RandomCanvas t_RandomCanvas = + { + output = t_RandomCanvas; + div + = + fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let _:Prims.unit = + if b =. (Num_traits.Identities.Zero.zero <: Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = ["dividing by zero in type RandomCanvas"] in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let c:Core.Ops.Arith.Div.t_Output = a /. b in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Arith.t_Rem t_RandomCanvas t_RandomCanvas = + { + output = t_RandomCanvas; + rem + = + fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let _:Prims.unit = + if b =. (Num_traits.Identities.Zero.zero <: Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = ["dividing by zero in type RandomCanvas"] in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let c:Core.Ops.Arith.Rem.t_Output = a %. b in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Bit.t_Not t_RandomCanvas = + { + output = t_RandomCanvas; + not + = + fun (self: t_RandomCanvas) -> + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "not implemented" + <: + Rust_primitives.Hax.t_Never) + } + +let impl: Core.Ops.Bit.t_BitOr t_RandomCanvas t_RandomCanvas = + { + output = t_RandomCanvas; + bitor + = + fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a |. b <: Core.Ops.Bit.BitOr.t_Output) + } + +let impl: Core.Ops.Bit.t_BitXor t_RandomCanvas t_RandomCanvas = + { + output = t_RandomCanvas; + bitxor + = + fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a ^. b <: Core.Ops.Bit.BitXor.t_Output) + } + +let impl: Core.Ops.Bit.t_BitAnd t_RandomCanvas t_RandomCanvas = + { + output = t_RandomCanvas; + bitand + = + fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a &. b <: Core.Ops.Bit.BitAnd.t_Output) + } + +let impl: Core.Ops.Bit.t_Shr t_RandomCanvas usize = + { + output = t_RandomCanvas; + shr + = + fun (self: t_RandomCanvas) (rhs: usize) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let b:usize = rhs in + Core.Convert.Into.into (a <<. b <: Core.Ops.Bit.Shr.t_Output) + } + +let impl: Core.Ops.Bit.t_Shl t_RandomCanvas usize = + { + output = t_RandomCanvas; + shl + = + fun (self: t_RandomCanvas) (rhs: usize) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let b:usize = rhs in + Core.Convert.Into.into (a >>. b <: Core.Ops.Bit.Shl.t_Output) + } + +let impl: Core.Cmp.t_PartialEq t_RandomCanvas t_RandomCanvas = + { + eq + = + fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + a =. b + } + +let impl: Core.Cmp.t_Eq t_RandomCanvas = { } + +let impl: Core.Cmp.t_PartialOrd t_RandomCanvas t_RandomCanvas = + { + partial_cmp + = + fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into other + in + Core.Cmp.PartialOrd.partial_cmp a b + } + +let impl: Core.Cmp.t_Ord t_RandomCanvas = + { + cmp + = + fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> + Core.Option.unwrap_under_impl (Core.Cmp.PartialOrd.partial_cmp self other + <: + Core.Option.t_Option Core.Cmp.t_Ordering) + } + +let from_byte_seq_be_under_impl_75 (s: a) : t_RandomCanvas = + from_be_bytes_under_impl_82 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (Secret_integers.t_U8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + +let from_public_byte_seq_be_under_impl_75 (s: a) : t_RandomCanvas = + from_be_bytes_under_impl_82 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> x) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + +let to_byte_seq_be_under_impl_75 (self: t_RandomCanvas) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map + (Core.Slice.iter_under_impl (Rust_primitives.unsize (to_be_bytes_under_impl_82 self + <: + array u8 48sz) + <: + slice u8) + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) + <: + Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) + +let impl: Hacspec_lib.Traits.t_NumericCopy t_RandomCanvas = { } + +let impl: Hacspec_lib.Traits.t_UnsignedInteger t_RandomCanvas = { } + +let impl: Hacspec_lib.Traits.t_UnsignedIntegerCopy t_RandomCanvas = { } + +let impl: Hacspec_lib.Traits.t_Integer t_RandomCanvas = + { + nUM_BITS = (fun -> 384sz); + zERO = (fun -> from_literal_under_impl_83 (pub_u128 0sz)); + oNE = (fun -> from_literal_under_impl_83 (pub_u128 1sz)); + tWO = (fun -> from_literal_under_impl_83 (pub_u128 2sz)); + from_literal = (fun (v_val: u128) -> from_literal_under_impl_83 v_val); + from_hex_string + = + (fun (s: Alloc.String.t_String) -> + from_hex_under_impl_82 (Core.Ops.Deref.Deref.deref (Alloc.Str.replace_under_impl_5 (Core.Ops.Deref.Deref.deref + s + <: + string) + "0x" + "" + <: + Alloc.String.t_String) + <: + string)); + get_bit + = + (fun (self: t_RandomCanvas) (i: usize) -> + (self <<. i <: Core.Ops.Bit.Shr.t_Output) &. + (Hacspec_lib.Traits.Integer.v_ONE <: t_RandomCanvas)); + set_bit + = + (fun (self: t_RandomCanvas) (b: t_RandomCanvas) (i: usize) -> + let _:Prims.unit = + if true + then + let _:Prims.unit = + if + ~.(Prims.op_BarBar (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b + <: + t_RandomCanvas) + (Hacspec_lib.Traits.Integer.v_ONE <: t_RandomCanvas) + <: + bool) + (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b <: t_RandomCanvas) + (Hacspec_lib.Traits.Integer.v_ZERO <: t_RandomCanvas) + <: + bool)) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO())" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + () + in + let tmp1:t_RandomCanvas = + from_literal_under_impl_83 (~.(pub_u128 1sz >>. i <: u128) <: u128) + in + let tmp2:Core.Ops.Bit.Shl.t_Output = b >>. i in + (self &. tmp1 <: Core.Ops.Bit.BitAnd.t_Output) |. tmp2); + set + = + (fun (self: t_RandomCanvas) (pos: usize) (y: t_RandomCanvas) (yi: usize) -> + let b:t_RandomCanvas = Hacspec_lib.Traits.Integer.get_bit y yi in + Hacspec_lib.Traits.Integer.set_bit self b pos); + rotate_left + = + (fun (self: t_RandomCanvas) (n: usize) -> + let _:Prims.unit = + if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + ((Core.Clone.Clone.clone self <: t_RandomCanvas) >>. n <: Core.Ops.Bit.Shl.t_Output) |. + (self <<. + (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. + (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) + <: + usize) + <: + Core.Ops.Bit.Shr.t_Output)); + rotate_right + = + fun (self: t_RandomCanvas) (n: usize) -> + let _:Prims.unit = + if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + ((Core.Clone.Clone.clone self <: t_RandomCanvas) <<. n <: Core.Ops.Bit.Shr.t_Output) |. + (self >>. + (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. + (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) + <: + usize) + <: + Core.Ops.Bit.Shl.t_Output) + } + +let impl: Hacspec_lib.Traits.t_ModNumeric t_RandomCanvas = + { + sub_mod + = + (fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) (n: t_RandomCanvas) -> + (self -. rhs <: Core.Ops.Arith.Sub.t_Output) %. n); + add_mod + = + (fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) (n: t_RandomCanvas) -> + (self +. rhs <: Core.Ops.Arith.Add.t_Output) %. n); + mul_mod + = + (fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) (n: t_RandomCanvas) -> + (self *. rhs <: Core.Ops.Arith.Mul.t_Output) %. n); + pow_mod + = + (fun (self: t_RandomCanvas) (exp: t_RandomCanvas) (n: t_RandomCanvas) -> + pow_felem_under_impl_94 self exp n); + modulo = (fun (self: t_RandomCanvas) (n: t_RandomCanvas) -> self %. n); + signed_modulo + = + (fun (self: t_RandomCanvas) (n: t_RandomCanvas) -> Hacspec_lib.Traits.ModNumeric.modulo self n); + absolute = fun (self: t_RandomCanvas) -> self + } + +let impl: Hacspec_lib.Traits.t_Numeric t_RandomCanvas = + { + max_val = (fun -> max_value_under_impl_83); + wrap_add = (fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> self +. rhs); + wrap_sub = (fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> self -. rhs); + wrap_mul = (fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> self *. rhs); + wrap_div = (fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> self /. rhs); + exp + = + (fun (self: t_RandomCanvas) (exp: u32) -> + pow_under_impl_94 self + (Core.Convert.Into.into exp <: u128) + (Hacspec_lib.Traits.Numeric.max_val <: t_RandomCanvas)); + pow_self + = + (fun (self: t_RandomCanvas) (exp: t_RandomCanvas) -> + pow_felem_under_impl_94 self + (Core.Convert.Into.into exp <: t_RandomCanvas) + (Hacspec_lib.Traits.Numeric.max_val <: t_RandomCanvas)); + divide = (fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> self /. rhs); + inv = (fun (self: t_RandomCanvas) (n: t_RandomCanvas) -> inv_under_impl_94 self n); + equal = (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> self =. other); + greater_than = (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> self >. other); + greater_than_or_equal = (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> self >=. other); + less_than = (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> self <. other); + less_than_or_equal = (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> self >=. other); + not_equal_bm + = + (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> + if ~.(Hacspec_lib.Traits.Numeric.equal self other <: bool) + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_83 (pub_u128 0sz)); + equal_bm + = + (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> + if Hacspec_lib.Traits.Numeric.equal self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_83 (pub_u128 0sz)); + greater_than_bm + = + (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> + if Hacspec_lib.Traits.Numeric.greater_than self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_83 (pub_u128 0sz)); + greater_than_or_equal_bm + = + (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> + if Hacspec_lib.Traits.Numeric.greater_than_or_equal self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_83 (pub_u128 0sz)); + less_than_bm + = + (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> + if Hacspec_lib.Traits.Numeric.less_than self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_83 (pub_u128 0sz)); + less_than_or_equal_bm + = + fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> + if Hacspec_lib.Traits.Numeric.less_than_or_equal self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_83 (pub_u128 0sz) + } + +type t_Random = | Random : t_RandomCanvas -> t_Random + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +let impl: Core.Convert.t_From t_Random t_RandomCanvas = + { + from + = + fun (x: t_RandomCanvas) -> + Random + (rem_under_impl_94 x + (from_hex_under_impl_82 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_RandomCanvas)) + } + +let impl: Core.Convert.t_Into t_Random t_RandomCanvas = + { into = fun (self: t_Random) -> self.Hacspec_ovn.Schnorr.Random_oracle.Random.0 } + +let from_canvas_under_impl_131 (x: t_RandomCanvas) : t_Random = + Random + (rem_under_impl_94 x + (from_hex_under_impl_82 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_RandomCanvas)) + +let into_canvas_under_impl_131 (self: t_Random) : t_RandomCanvas = + self.Hacspec_ovn.Schnorr.Random_oracle.Random.0 + +let max_under_impl_131: t_RandomCanvas = + from_hex_under_impl_82 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + +let declassify_under_impl_131 (self: t_Random) : Num_bigint.Bigint.t_BigInt = + let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into a + +let from_hex_under_impl_131 (s: string) : t_Random = + Core.Convert.Into.into (from_hex_under_impl_82 s <: t_RandomCanvas) + +let from_be_bytes_under_impl_131 (v: slice u8) : t_Random = + Core.Convert.Into.into (from_be_bytes_under_impl_82 v <: t_RandomCanvas) + +let to_be_bytes_under_impl_131 (self: t_Random) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = + Alloc.Slice.to_vec_under_impl (Rust_primitives.unsize (to_be_bytes_under_impl_82 (Core.Convert.Into.into + self + <: + t_RandomCanvas) + <: + array u8 48sz) + <: + slice u8) + +let from_le_bytes_under_impl_131 (v: slice u8) : t_Random = + Core.Convert.Into.into (from_le_bytes_under_impl_82 v <: t_RandomCanvas) + +let to_le_bytes_under_impl_131 (self: t_Random) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = + Alloc.Slice.to_vec_under_impl (Rust_primitives.unsize (to_le_bytes_under_impl_82 (Core.Convert.Into.into + self + <: + t_RandomCanvas) + <: + array u8 48sz) + <: + slice u8) + +let bit_under_impl_131 (self: t_Random) (i: usize) : bool = + bit_under_impl_83 (Core.Convert.Into.into self <: t_RandomCanvas) i + +let from_literal_under_impl_131 (x: u128) : t_Random = + let big_x:Num_bigint.Biguint.t_BigUint = Core.Convert.From.from x in + let _:Prims.unit = + if + big_x >. + (Core.Convert.Into.into (max_under_impl_131 <: t_RandomCanvas) <: Num_bigint.Biguint.t_BigUint + ) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["literal "; " too big for type Random"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Random (Core.Convert.Into.into big_x) + +let from_signed_literal_under_impl_131 (x: i128) : t_Random = + let big_x:Num_bigint.Biguint.t_BigUint = Core.Convert.From.from (cast x) in + let _:Prims.unit = + if + big_x >. + (Core.Convert.Into.into (max_under_impl_131 <: t_RandomCanvas) <: Num_bigint.Biguint.t_BigUint + ) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["literal "; " too big for type Random"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Random (Core.Convert.Into.into big_x) + +let comp_eq_under_impl_131 (self rhs: t_Random) : t_Random = + let (x: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_eq_under_impl_82 x (Core.Convert.Into.into rhs <: t_RandomCanvas) + <: + t_RandomCanvas) + +let comp_ne_under_impl_131 (self rhs: t_Random) : t_Random = + let (x: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_ne_under_impl_82 x (Core.Convert.Into.into rhs <: t_RandomCanvas) + <: + t_RandomCanvas) + +let comp_gte_under_impl_131 (self rhs: t_Random) : t_Random = + let (x: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_gte_under_impl_82 x (Core.Convert.Into.into rhs <: t_RandomCanvas) + <: + t_RandomCanvas) + +let comp_gt_under_impl_131 (self rhs: t_Random) : t_Random = + let (x: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_gt_under_impl_82 x (Core.Convert.Into.into rhs <: t_RandomCanvas) + <: + t_RandomCanvas) + +let comp_lte_under_impl_131 (self rhs: t_Random) : t_Random = + let (x: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_lte_under_impl_82 x (Core.Convert.Into.into rhs <: t_RandomCanvas) + <: + t_RandomCanvas) + +let comp_lt_under_impl_131 (self rhs: t_Random) : t_Random = + let (x: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_lt_under_impl_82 x (Core.Convert.Into.into rhs <: t_RandomCanvas) + <: + t_RandomCanvas) + +let neg_under_impl_131 (self: t_Random) : t_Random = + let (mod_val: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into (from_hex_under_impl_82 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_RandomCanvas) + in + let (s: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + let (s: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into s in + let (result: t_RandomCanvas):t_RandomCanvas = + Core.Convert.Into.into (mod_val -. s <: Core.Ops.Arith.Sub.t_Output) + in + Core.Convert.Into.into result + +let impl: Core.Cmp.t_PartialOrd t_Random t_Random = + { + partial_cmp + = + fun (self: t_Random) (other: t_Random) -> Core.Option.Option_Some (Core.Cmp.Ord.cmp self other) + } + +let impl: Core.Cmp.t_Ord t_Random = + { + cmp + = + fun (self: t_Random) (other: t_Random) -> + Core.Cmp.Ord.cmp self.Hacspec_ovn.Schnorr.Random_oracle.Random.0 + other.Hacspec_ovn.Schnorr.Random_oracle.Random.0 + } + +let impl: Core.Cmp.t_PartialEq t_Random t_Random = + { + eq + = + fun (self: t_Random) (other: t_Random) -> + self.Hacspec_ovn.Schnorr.Random_oracle.Random.0 =. + other.Hacspec_ovn.Schnorr.Random_oracle.Random.0 + } + +let impl: Core.Cmp.t_Eq t_Random = { } + +let impl: Core.Ops.Arith.t_Add t_Random t_Random = + { + output = t_Random; + add + = + fun (self: t_Random) (rhs: t_Random) -> + let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + let (b: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into rhs in + let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into a + in + let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into b + in + let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Add.t_Output = a +. b in + let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into (from_hex_under_impl_82 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_RandomCanvas) + in + let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in + let (d: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into d in + Core.Convert.Into.into d + } + +let impl: Core.Ops.Arith.t_Sub t_Random t_Random = + { + output = t_Random; + sub + = + fun (self: t_Random) (rhs: t_Random) -> + let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + let (b: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into rhs in + let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into a + in + let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into b + in + let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into (from_hex_under_impl_82 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_RandomCanvas) + in + let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Add.t_Output = + if b >. a + then + ((Core.Clone.Clone.clone max <: Num_bigint.Biguint.t_BigUint) -. b + <: + Core.Ops.Arith.Sub.t_Output) +. + a + else a -. b + in + let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in + let (d: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into d in + Core.Convert.Into.into d + } + +let impl: Core.Ops.Arith.t_Mul t_Random t_Random = + { + output = t_Random; + mul + = + fun (self: t_Random) (rhs: t_Random) -> + let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + let (b: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into rhs in + let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into a + in + let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into b + in + let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Mul.t_Output = a *. b in + let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into (from_hex_under_impl_82 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_RandomCanvas) + in + let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in + let (d: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into d in + Core.Convert.Into.into d + } + +let impl: Core.Ops.Arith.t_Div t_Random t_Random = + { + output = t_Random; + div = fun (self: t_Random) (rhs: t_Random) -> self *. (inv_under_impl_125 rhs <: t_Random) + } + +let impl: Core.Ops.Arith.t_Rem t_Random t_Random = + { + output = t_Random; + rem + = + fun (self: t_Random) (rhs: t_Random) -> + let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + let (b: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into rhs in + let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into a + in + let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into b + in + let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = a %. b in + let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into (from_hex_under_impl_82 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_RandomCanvas) + in + let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in + let (d: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into d in + Core.Convert.Into.into d + } + +let impl: Core.Ops.Bit.t_Not t_Random = + { + output = t_Random; + not + = + fun (self: t_Random) -> + let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (~.a <: Core.Ops.Bit.Not.t_Output) + } + +let impl: Core.Ops.Bit.t_BitOr t_Random t_Random = + { + output = t_Random; + bitor + = + fun (self: t_Random) (rhs: t_Random) -> + let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + let (b: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a |. b <: Core.Ops.Bit.BitOr.t_Output) + } + +let impl: Core.Ops.Bit.t_BitXor t_Random t_Random = + { + output = t_Random; + bitxor + = + fun (self: t_Random) (rhs: t_Random) -> + let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + let (b: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a ^. b <: Core.Ops.Bit.BitXor.t_Output) + } + +let impl: Core.Ops.Bit.t_BitAnd t_Random t_Random = + { + output = t_Random; + bitand + = + fun (self: t_Random) (rhs: t_Random) -> + let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + let (b: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a &. b <: Core.Ops.Bit.BitAnd.t_Output) + } + +let impl: Core.Ops.Bit.t_Shr t_Random usize = + { + output = t_Random; + shr + = + fun (self: t_Random) (rhs: usize) -> + let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (a <<. rhs <: Core.Ops.Bit.Shr.t_Output) + } + +let impl: Core.Ops.Bit.t_Shl t_Random usize = + { + output = t_Random; + shl + = + fun (self: t_Random) (rhs: usize) -> + let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (a >>. rhs <: Core.Ops.Bit.Shl.t_Output) + } + +let inv_under_impl_125 (self: t_Random) : t_Random = + let (base: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (inv_under_impl_94 base (max_under_impl_131 <: t_RandomCanvas) + <: + t_RandomCanvas) + +let pow_felem_under_impl_125 (self exp: t_Random) : t_Random = + let (base: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (pow_felem_under_impl_94 base + (Core.Convert.Into.into exp <: t_RandomCanvas) + (max_under_impl_131 <: t_RandomCanvas) + <: + t_RandomCanvas) + +let pow_under_impl_125 (self: t_Random) (exp: u128) : t_Random = + let (base: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (pow_under_impl_94 base exp (max_under_impl_131 <: t_RandomCanvas) + <: + t_RandomCanvas) + +let pow2_under_impl_125 (x: usize) : t_Random = + Core.Convert.Into.into (pow2_under_impl_83 x <: t_RandomCanvas) + +let from_byte_seq_be_under_impl_68 (s: a) : t_Random = + Core.Convert.Into.into (from_be_bytes_under_impl_82 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (Secret_integers.t_U8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + t_RandomCanvas) + +let from_public_byte_seq_be_under_impl_68 (s: a) : t_Random = + Core.Convert.Into.into (from_be_bytes_under_impl_82 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> x) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + t_RandomCanvas) + +let to_byte_seq_be_under_impl_68 (self: t_Random) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map + (Core.Slice.iter_under_impl (Core.Ops.Deref.Deref.deref (to_be_bytes_under_impl_131 self + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) + <: + Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) + +let to_public_byte_seq_be_under_impl_68 (self: t_Random) : Hacspec_lib.Seq.t_Seq u8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (to_be_bytes_under_impl_131 self + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + +let from_byte_seq_le_under_impl_68 (s: a) : t_Random = + Core.Convert.Into.into (from_le_bytes_under_impl_82 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (Secret_integers.t_U8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + t_RandomCanvas) + +let from_public_byte_seq_le_under_impl_68 (s: a) : t_Random = + Core.Convert.Into.into (from_le_bytes_under_impl_82 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> x) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + t_RandomCanvas) + +let to_byte_seq_le_under_impl_68 (self: t_Random) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map + (Core.Slice.iter_under_impl (Core.Ops.Deref.Deref.deref (to_le_bytes_under_impl_131 self + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) + <: + Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) + +let to_public_byte_seq_le_under_impl_68 (self: t_Random) : Hacspec_lib.Seq.t_Seq u8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (to_le_bytes_under_impl_131 self + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + +let from_secret_literal_under_impl_68 (x: Secret_integers.t_U128) : t_Random = + Core.Convert.Into.into (from_literal_under_impl_83 (Secret_integers.declassify_under_impl_126 x + <: + u128) + <: + t_RandomCanvas) + +let impl: Hacspec_lib.Traits.t_NumericCopy t_Random = { } + +let impl: Hacspec_lib.Traits.t_UnsignedInteger t_Random = { } + +let impl: Hacspec_lib.Traits.t_UnsignedIntegerCopy t_Random = { } + +let impl: Hacspec_lib.Traits.t_Integer t_Random = + { + nUM_BITS = (fun -> 384sz); + zERO = (fun -> from_literal_under_impl_131 (pub_u128 0sz)); + oNE = (fun -> from_literal_under_impl_131 (pub_u128 1sz)); + tWO = (fun -> from_literal_under_impl_131 (pub_u128 2sz)); + from_literal = (fun (v_val: u128) -> from_literal_under_impl_131 v_val); + from_hex_string + = + (fun (s: Alloc.String.t_String) -> + from_hex_under_impl_131 (Core.Ops.Deref.Deref.deref (Alloc.Str.replace_under_impl_5 (Core.Ops.Deref.Deref.deref + s + <: + string) + "0x" + "" + <: + Alloc.String.t_String) + <: + string)); + get_bit + = + (fun (self: t_Random) (i: usize) -> + (self <<. i <: Core.Ops.Bit.Shr.t_Output) &. (Hacspec_lib.Traits.Integer.v_ONE <: t_Random)); + set_bit + = + (fun (self: t_Random) (b: t_Random) (i: usize) -> + let _:Prims.unit = + if true + then + let _:Prims.unit = + if + ~.(Prims.op_BarBar (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b + <: + t_Random) + (Hacspec_lib.Traits.Integer.v_ONE <: t_Random) + <: + bool) + (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b <: t_Random) + (Hacspec_lib.Traits.Integer.v_ZERO <: t_Random) + <: + bool)) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO())" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + () + in + let tmp1:t_Random = from_literal_under_impl_131 (~.(pub_u128 1sz >>. i <: u128) <: u128) in + let tmp2:Core.Ops.Bit.Shl.t_Output = b >>. i in + (self &. tmp1 <: Core.Ops.Bit.BitAnd.t_Output) |. tmp2); + set + = + (fun (self: t_Random) (pos: usize) (y: t_Random) (yi: usize) -> + let b:t_Random = Hacspec_lib.Traits.Integer.get_bit y yi in + Hacspec_lib.Traits.Integer.set_bit self b pos); + rotate_left + = + (fun (self: t_Random) (n: usize) -> + let _:Prims.unit = + if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + ((Core.Clone.Clone.clone self <: t_Random) >>. n <: Core.Ops.Bit.Shl.t_Output) |. + (self <<. + (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. + (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) + <: + usize) + <: + Core.Ops.Bit.Shr.t_Output)); + rotate_right + = + fun (self: t_Random) (n: usize) -> + let _:Prims.unit = + if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + ((Core.Clone.Clone.clone self <: t_Random) <<. n <: Core.Ops.Bit.Shr.t_Output) |. + (self >>. + (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. + (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) + <: + usize) + <: + Core.Ops.Bit.Shl.t_Output) + } + +let impl: Hacspec_lib.Traits.t_ModNumeric t_Random = + { + sub_mod = (fun (self: t_Random) (rhs: t_Random) (n: t_Random) -> self -. rhs); + add_mod = (fun (self: t_Random) (rhs: t_Random) (n: t_Random) -> self +. rhs); + mul_mod = (fun (self: t_Random) (rhs: t_Random) (n: t_Random) -> self *. rhs); + pow_mod + = + (fun (self: t_Random) (exp: t_Random) (n: t_Random) -> pow_felem_under_impl_125 self exp); + modulo = (fun (self: t_Random) (n: t_Random) -> self %. n); + signed_modulo + = + (fun (self: t_Random) (n: t_Random) -> Hacspec_lib.Traits.ModNumeric.modulo self n); + absolute = fun (self: t_Random) -> self + } + +let impl: Hacspec_lib.Traits.t_Numeric t_Random = + { + max_val + = + (fun -> + Core.Convert.Into.into ((max_under_impl_131 <: t_RandomCanvas) -. + (from_literal_under_impl_83 (pub_u128 1sz) <: t_RandomCanvas) + <: + Core.Ops.Arith.Sub.t_Output)); + wrap_add = (fun (self: t_Random) (rhs: t_Random) -> self +. rhs); + wrap_sub = (fun (self: t_Random) (rhs: t_Random) -> self -. rhs); + wrap_mul = (fun (self: t_Random) (rhs: t_Random) -> self *. rhs); + wrap_div = (fun (self: t_Random) (rhs: t_Random) -> self /. rhs); + exp + = + (fun (self: t_Random) (exp: u32) -> pow_under_impl_125 self (Core.Convert.Into.into exp <: u128) + ); + pow_self = (fun (self: t_Random) (exp: t_Random) -> pow_felem_under_impl_125 self exp); + divide = (fun (self: t_Random) (rhs: t_Random) -> self /. rhs); + inv = (fun (self: t_Random) (n: t_Random) -> inv_under_impl_125 self); + equal = (fun (self: t_Random) (other: t_Random) -> self =. other); + greater_than = (fun (self: t_Random) (other: t_Random) -> self >. other); + greater_than_or_equal = (fun (self: t_Random) (other: t_Random) -> self >=. other); + less_than = (fun (self: t_Random) (other: t_Random) -> self <. other); + less_than_or_equal = (fun (self: t_Random) (other: t_Random) -> self <=. other); + not_equal_bm + = + (fun (self: t_Random) (other: t_Random) -> + if self <>. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_Random) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_Random) + else Hacspec_lib.Traits.Integer.v_ZERO); + equal_bm + = + (fun (self: t_Random) (other: t_Random) -> + if self =. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_Random) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_Random) + else Hacspec_lib.Traits.Integer.v_ZERO); + greater_than_bm + = + (fun (self: t_Random) (other: t_Random) -> + if self >. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_Random) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_Random) + else Hacspec_lib.Traits.Integer.v_ZERO); + greater_than_or_equal_bm + = + (fun (self: t_Random) (other: t_Random) -> + if self >=. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_Random) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_Random) + else Hacspec_lib.Traits.Integer.v_ZERO); + less_than_bm + = + (fun (self: t_Random) (other: t_Random) -> + if self <. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_Random) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_Random) + else Hacspec_lib.Traits.Integer.v_ZERO); + less_than_or_equal_bm + = + fun (self: t_Random) (other: t_Random) -> + if self <=. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_Random) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_Random) + else Hacspec_lib.Traits.Integer.v_ZERO + } + +let sample_uniform: t_Random = Hacspec_lib.Traits.Integer.v_ONE + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +let random_oracle_query + (v_QUERIES: + Std.Collections.Hash.Map.t_HashMap t_Query t_Random Std.Collections.Hash.Map.t_RandomState + ) + (q: t_Query) + : (Std.Collections.Hash.Map.t_HashMap t_Query t_Random Std.Collections.Hash.Map.t_RandomState & + t_Random) = + match Std.Collections.Hash.Map.get_under_impl_2 v_QUERIES q with + | Core.Option.Option_Some r -> Core.Clone.Clone.clone v_QUERIES, Core.Clone.Clone.clone r + | Core.Option.Option_None -> + let r:t_Random = sample_uniform in + let todo_fresh_var, v_QUERIES_temp:(Core.Option.t_Option t_Random & + Std.Collections.Hash.Map.t_HashMap t_Query t_Random Std.Collections.Hash.Map.t_RandomState) = + Std.Collections.Hash.Map.insert_under_impl_2 v_QUERIES q r + in + let v_QUERIES:Std.Collections.Hash.Map.t_HashMap t_Query + t_Random + Std.Collections.Hash.Map.t_RandomState = + v_QUERIES_temp + in + let _:Core.Option.t_Option t_Random = todo_fresh_var in + v_QUERIES, r \ No newline at end of file diff --git a/ovn/proofs/fstar/extraction/Hacspec_ovn.Schnorr.fst b/ovn/proofs/fstar/extraction/Hacspec_ovn.Schnorr.fst new file mode 100644 index 0000000..45c65e8 --- /dev/null +++ b/ovn/proofs/fstar/extraction/Hacspec_ovn.Schnorr.fst @@ -0,0 +1,3704 @@ +module Hacspec_ovn.Schnorr +#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" +open Core + +type t_GCanvas = { + f_b:array u8 48sz; + f_sign:Num_bigint.Bigint.t_Sign; + f_signed:bool +} + +let max_under_impl_15: Core.Ops.Arith.Sub.t_Output = + ((Core.Convert.From.from 1ul <: Num_bigint.Bigint.t_BigInt) >>. 384l <: Core.Ops.Bit.Shl.t_Output) -. + (Num_traits.Identities.One.one <: Num_bigint.Bigint.t_BigInt) + +let max_value_under_impl_15: t_GCanvas = + Core.Convert.From.from (max_under_impl_15 <: Num_bigint.Bigint.t_BigInt) + +let hex_string_to_bytes_under_impl_15 (s: string) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = + let s:Alloc.String.t_String = + if ((Core.Str.len_under_impl s <: usize) %. 2sz <: usize) <>. 0sz + then + let x:Alloc.String.t_String = Alloc.String.ToString.to_string "0" in + let x:Alloc.String.t_String = Alloc.String.push_str_under_impl x s in + x + else Alloc.String.ToString.to_string s + in + let _:Prims.unit = + if ~.(((Alloc.String.len_under_impl s <: usize) %. 2sz <: usize) =. 0sz <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["length of hex string "; ": "] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [ + Core.Fmt.Rt.new_display_under_impl_1 s <: Core.Fmt.Rt.t_Argument; + Core.Fmt.Rt.new_display_under_impl_1 (Alloc.String.len_under_impl s + <: + usize) + <: + Core.Fmt.Rt.t_Argument + ] + in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let + (b: Core.Result.t_Result (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) Core.Num.Error.t_ParseIntError):Core.Result.t_Result + (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) Core.Num.Error.t_ParseIntError = + Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map (Core.Iter.Traits.Iterator.Iterator.step_by + ({ + Core.Ops.Range.Range.f_start = 0sz; + Core.Ops.Range.Range.f_end = Alloc.String.len_under_impl s <: usize + }) + 2sz + <: + Core.Iter.Adapters.Step_by.t_StepBy (Core.Ops.Range.t_Range usize)) + (fun i -> + Core.Num.from_str_radix_under_impl_6 (s.[ { + Core.Ops.Range.Range.f_start = i; + Core.Ops.Range.Range.f_end = i +. 2sz <: usize + } ] + <: + string) + 16ul + <: + Core.Result.t_Result u8 Core.Num.Error.t_ParseIntError) + <: + Core.Iter.Adapters.Map.t_Map + (Core.Iter.Adapters.Step_by.t_StepBy (Core.Ops.Range.t_Range usize)) + (usize -> Core.Result.t_Result u8 Core.Num.Error.t_ParseIntError)) + in + Core.Result.expect_under_impl b "Error parsing hex string" + +let from_literal_under_impl_15 (x: u128) : t_GCanvas = + let big_x:Num_bigint.Bigint.t_BigInt = Core.Convert.From.from x in + let _:Prims.unit = + if + big_x >. + (Core.Convert.Into.into (max_under_impl_15 <: Num_bigint.Bigint.t_BigInt) + <: + Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["literal "; " too big for type GCanvas"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Core.Convert.Into.into big_x + +let from_signed_literal_under_impl_15 (x: i128) : t_GCanvas = + let big_x:Num_bigint.Bigint.t_BigInt = Core.Convert.From.from (cast x) in + let _:Prims.unit = + if + big_x >. + (Core.Convert.Into.into (max_under_impl_15 <: Num_bigint.Bigint.t_BigInt) + <: + Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["literal "; " too big for type GCanvas"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Core.Convert.Into.into big_x + +let pow2_under_impl_15 (x: usize) : t_GCanvas = + Core.Convert.Into.into ((Core.Convert.From.from 1ul <: Num_bigint.Bigint.t_BigInt) >>. x + <: + Core.Ops.Bit.Shl.t_Output) + +let bit_under_impl_15 (self: t_GCanvas) (i: usize) : bool = + let _:Prims.unit = + if + ~.(i <. + ((Core.Slice.len_under_impl (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.GCanvas.f_b + <: + slice u8) + <: + usize) *. + 8sz + <: + usize) + <: + bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = + [ + "the bit queried should be lower than the size of the integer representation: "; + " < " + ] + in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [ + Core.Fmt.Rt.new_display_under_impl_1 i <: Core.Fmt.Rt.t_Argument; + Core.Fmt.Rt.new_display_under_impl_1 ((Core.Slice.len_under_impl (Rust_primitives.unsize + self.Hacspec_ovn.Schnorr.GCanvas.f_b + <: + slice u8) + <: + usize) *. + 8sz + <: + usize) + <: + Core.Fmt.Rt.t_Argument + ] + in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let (bigint: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (tmp: Num_bigint.Bigint.t_BigInt):Core.Ops.Bit.Shr.t_Output = bigint <<. i in + ((Num_bigint.Bigint.to_bytes_le_under_impl_24 (tmp &. + (Num_traits.Identities.One.one <: Num_bigint.Bigint.t_BigInt) + <: + Num_bigint.Bigint.t_BigInt) + <: + (Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global)) + ._2.[ 0sz ] + <: + u8) =. + 1uy + +let impl: Core.Convert.t_From t_GCanvas Num_bigint.Biguint.t_BigUint = + { + from + = + fun (x: Num_bigint.Biguint.t_BigUint) -> + Core.Convert.From.from (Core.Convert.From.from x <: Num_bigint.Bigint.t_BigInt) + } + +let impl: Core.Convert.t_From t_GCanvas Num_bigint.Bigint.t_BigInt = + { + from + = + fun (x: Num_bigint.Bigint.t_BigInt) -> + let max_value:Num_bigint.Bigint.t_BigInt = max_under_impl_15 in + let _:Prims.unit = + if ~.(x <=. max_value <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = [""; " is too large for type GCanvas!"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let sign, repr:(Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) = + Num_bigint.Bigint.to_bytes_be_under_impl_24 x + in + let _:Prims.unit = + if Prims.op_AmpAmp (sign =. Num_bigint.Bigint.Sign_Minus) ~.false + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "Trying to convert a negative number into an unsigned integer!" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + let _:Prims.unit = + if (Alloc.Vec.len_under_impl_1 repr <: usize) >. ((384sz +. 7sz <: usize) /. 8sz <: usize) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = [""; " is too large for type GCanvas"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let out:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in + let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize out <: slice u8) in + let lower:usize = upper -. (Alloc.Vec.len_under_impl_1 repr <: usize) in + let _:Prims.unit = + Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" + "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (out),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(core::ops::deref::Deref::deref(&(deref(&(repr)))))),\n )" + + in + { + Hacspec_ovn.Schnorr.GCanvas.f_b = out; + Hacspec_ovn.Schnorr.GCanvas.f_sign = sign; + Hacspec_ovn.Schnorr.GCanvas.f_signed = false + } + } + +let impl: Core.Default.t_Default t_GCanvas = + { + default + = + fun -> + { + Hacspec_ovn.Schnorr.GCanvas.f_b = Rust_primitives.Hax.repeat 0uy 48sz; + Hacspec_ovn.Schnorr.GCanvas.f_sign = Num_bigint.Bigint.Sign_Plus; + Hacspec_ovn.Schnorr.GCanvas.f_signed = false + } + } + +let impl: Core.Convert.t_Into t_GCanvas Num_bigint.Bigint.t_BigInt = + { + into + = + fun (self: t_GCanvas) -> + Num_bigint.Bigint.from_bytes_be_under_impl_24 self.Hacspec_ovn.Schnorr.GCanvas.f_sign + (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.GCanvas.f_b <: slice u8) + } + +let impl: Core.Convert.t_Into t_GCanvas Num_bigint.Biguint.t_BigUint = + { + into + = + fun (self: t_GCanvas) -> + Num_bigint.Biguint.from_bytes_be_under_impl_18 (Rust_primitives.unsize self + .Hacspec_ovn.Schnorr.GCanvas.f_b + <: + slice u8) + } + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +let from_hex_under_impl_14 (s: string) : t_GCanvas = + Core.Convert.Into.into (Num_bigint.Bigint.from_bytes_be_under_impl_24 Num_bigint.Bigint.Sign_Plus + (Core.Ops.Deref.Deref.deref (hex_string_to_bytes_under_impl_15 s + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + Num_bigint.Bigint.t_BigInt) + +let from_be_bytes_under_impl_14 (v: slice u8) : t_GCanvas = + let _:Prims.unit = + if true + then + let _:Prims.unit = + if + ~.((Core.Slice.len_under_impl v <: usize) <=. ((384sz +. 7sz <: usize) /. 8sz <: usize) + <: + bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + () + in + let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in + let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize repr <: slice u8) in + let lower:usize = upper -. (Core.Slice.len_under_impl v <: usize) in + let _:Prims.unit = + Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" + "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(deref(&(v)))),\n )" + + in + { + Hacspec_ovn.Schnorr.GCanvas.f_b = repr; + Hacspec_ovn.Schnorr.GCanvas.f_sign = Num_bigint.Bigint.Sign_Plus; + Hacspec_ovn.Schnorr.GCanvas.f_signed = false + } + +let from_le_bytes_under_impl_14 (v: slice u8) : t_GCanvas = + let _:Prims.unit = + if true + then + let _:Prims.unit = + if + ~.((Core.Slice.len_under_impl v <: usize) <=. ((384sz +. 7sz <: usize) /. 8sz <: usize) + <: + bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + () + in + let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in + let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize repr <: slice u8) in + let lower:usize = upper -. (Core.Slice.len_under_impl v <: usize) in + let _:Prims.unit = + Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" + "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(deref(&(v)))),\n )" + + in + Core.Convert.Into.into (Num_bigint.Bigint.from_bytes_le_under_impl_24 Num_bigint.Bigint.Sign_Plus + (Rust_primitives.unsize repr <: slice u8) + <: + Num_bigint.Bigint.t_BigInt) + +let to_be_bytes_under_impl_14 (self: t_GCanvas) : array u8 48sz = + self.Hacspec_ovn.Schnorr.GCanvas.f_b + +let to_le_bytes_under_impl_14 (self: t_GCanvas) : array u8 48sz = + let x:Num_bigint.Bigint.t_BigInt = + Num_bigint.Bigint.from_bytes_be_under_impl_24 Num_bigint.Bigint.Sign_Plus + (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.GCanvas.f_b <: slice u8) + in + let _, x_s:(Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) = + Num_bigint.Bigint.to_bytes_le_under_impl_24 x + in + let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in + let _:Prims.unit = + Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" + "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: 0,\n f_end: alloc::vec::len_under_impl_1(&(x_s)),\n },\n ))),\n &(deref(core::ops::deref::Deref::deref(&(deref(&(x_s)))))),\n )" + + in + repr + +let comp_eq_under_impl_14 (self rhs: t_GCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a =. b + then + let one:t_GCanvas = from_literal_under_impl_15 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_ne_under_impl_14 (self rhs: t_GCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a <>. b + then + let one:t_GCanvas = from_literal_under_impl_15 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_gte_under_impl_14 (self rhs: t_GCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a >=. b + then + let one:t_GCanvas = from_literal_under_impl_15 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_gt_under_impl_14 (self rhs: t_GCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a >. b + then + let one:t_GCanvas = from_literal_under_impl_15 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_lte_under_impl_14 (self rhs: t_GCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a <=. b + then + let one:t_GCanvas = from_literal_under_impl_15 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_lt_under_impl_14 (self rhs: t_GCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a <. b + then + let one:t_GCanvas = from_literal_under_impl_15 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let inv_under_impl_26 (self modval: t_GCanvas) : t_GCanvas = + let (biguintmodval: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into modval + in + let m:Core.Ops.Arith.Sub.t_Output = + biguintmodval -. (Core.Convert.From.from 2ul <: Num_bigint.Bigint.t_BigInt) + in + let (s: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + Core.Convert.Into.into (Num_bigint.Bigint.modpow_under_impl_24 s m biguintmodval + <: + Num_bigint.Bigint.t_BigInt) + +let pow_felem_under_impl_26 (self exp modval: t_GCanvas) : t_GCanvas = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into exp in + let (m: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into modval in + let (c: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Num_bigint.Bigint.modpow_under_impl_24 a b m + in + Core.Convert.Into.into c + +let pow_under_impl_26 (self: t_GCanvas) (exp: u128) (modval: t_GCanvas) : t_GCanvas = + pow_felem_under_impl_26 self + (Core.Convert.Into.into (Core.Convert.From.from exp <: Num_bigint.Bigint.t_BigInt) <: t_GCanvas) + modval + +let rem_under_impl_26 (self n: t_GCanvas) : Core.Ops.Arith.Rem.t_Output = self %. n + +let impl: Core.Ops.Arith.t_Add t_GCanvas t_GCanvas = + { + output = t_GCanvas; + add + = + fun (self: t_GCanvas) (rhs: t_GCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let c:Core.Ops.Arith.Add.t_Output = a +. b in + let _:Prims.unit = + if c >. (max_under_impl_15 <: Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = + ["bounded addition overflow for type GCanvas"] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Arith.t_Sub t_GCanvas t_GCanvas = + { + output = t_GCanvas; + sub + = + fun (self: t_GCanvas) (rhs: t_GCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let c:Core.Ops.Arith.Sub.t_Output = + if self.Hacspec_ovn.Schnorr.GCanvas.f_signed + then a -. b + else + Core.Option.unwrap_or_else_under_impl (Num_bigint.Bigint.checked_sub_under_impl_24 a b + <: + Core.Option.t_Option Num_bigint.Bigint.t_BigInt) + (fun -> + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = + ["bounded substraction underflow for type GCanvas"] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + <: + Num_bigint.Bigint.t_BigInt) + in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Arith.t_Mul t_GCanvas t_GCanvas = + { + output = t_GCanvas; + mul + = + fun (self: t_GCanvas) (rhs: t_GCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let c:Core.Ops.Arith.Mul.t_Output = a *. b in + let _:Prims.unit = + if c >. (max_under_impl_15 <: Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = + ["bounded multiplication overflow for type GCanvas"] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Arith.t_Div t_GCanvas t_GCanvas = + { + output = t_GCanvas; + div + = + fun (self: t_GCanvas) (rhs: t_GCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let _:Prims.unit = + if b =. (Num_traits.Identities.Zero.zero <: Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = ["dividing by zero in type GCanvas"] in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let c:Core.Ops.Arith.Div.t_Output = a /. b in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Arith.t_Rem t_GCanvas t_GCanvas = + { + output = t_GCanvas; + rem + = + fun (self: t_GCanvas) (rhs: t_GCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let _:Prims.unit = + if b =. (Num_traits.Identities.Zero.zero <: Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = ["dividing by zero in type GCanvas"] in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let c:Core.Ops.Arith.Rem.t_Output = a %. b in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Bit.t_Not t_GCanvas = + { + output = t_GCanvas; + not + = + fun (self: t_GCanvas) -> + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "not implemented" + <: + Rust_primitives.Hax.t_Never) + } + +let impl: Core.Ops.Bit.t_BitOr t_GCanvas t_GCanvas = + { + output = t_GCanvas; + bitor + = + fun (self: t_GCanvas) (rhs: t_GCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a |. b <: Core.Ops.Bit.BitOr.t_Output) + } + +let impl: Core.Ops.Bit.t_BitXor t_GCanvas t_GCanvas = + { + output = t_GCanvas; + bitxor + = + fun (self: t_GCanvas) (rhs: t_GCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a ^. b <: Core.Ops.Bit.BitXor.t_Output) + } + +let impl: Core.Ops.Bit.t_BitAnd t_GCanvas t_GCanvas = + { + output = t_GCanvas; + bitand + = + fun (self: t_GCanvas) (rhs: t_GCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a &. b <: Core.Ops.Bit.BitAnd.t_Output) + } + +let impl: Core.Ops.Bit.t_Shr t_GCanvas usize = + { + output = t_GCanvas; + shr + = + fun (self: t_GCanvas) (rhs: usize) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let b:usize = rhs in + Core.Convert.Into.into (a <<. b <: Core.Ops.Bit.Shr.t_Output) + } + +let impl: Core.Ops.Bit.t_Shl t_GCanvas usize = + { + output = t_GCanvas; + shl + = + fun (self: t_GCanvas) (rhs: usize) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let b:usize = rhs in + Core.Convert.Into.into (a >>. b <: Core.Ops.Bit.Shl.t_Output) + } + +let impl: Core.Cmp.t_PartialEq t_GCanvas t_GCanvas = + { + eq + = + fun (self: t_GCanvas) (rhs: t_GCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + a =. b + } + +let impl: Core.Cmp.t_Eq t_GCanvas = { } + +let impl: Core.Cmp.t_PartialOrd t_GCanvas t_GCanvas = + { + partial_cmp + = + fun (self: t_GCanvas) (other: t_GCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into other + in + Core.Cmp.PartialOrd.partial_cmp a b + } + +let impl: Core.Cmp.t_Ord t_GCanvas = + { + cmp + = + fun (self: t_GCanvas) (other: t_GCanvas) -> + Core.Option.unwrap_under_impl (Core.Cmp.PartialOrd.partial_cmp self other + <: + Core.Option.t_Option Core.Cmp.t_Ordering) + } + +let from_byte_seq_be_under_impl_7 (s: a) : t_GCanvas = + from_be_bytes_under_impl_14 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (Secret_integers.t_U8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + +let from_public_byte_seq_be_under_impl_7 (s: a) : t_GCanvas = + from_be_bytes_under_impl_14 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> x) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + +let to_byte_seq_be_under_impl_7 (self: t_GCanvas) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map + (Core.Slice.iter_under_impl (Rust_primitives.unsize (to_be_bytes_under_impl_14 self + <: + array u8 48sz) + <: + slice u8) + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) + <: + Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) + +let impl: Hacspec_lib.Traits.t_NumericCopy t_GCanvas = { } + +let impl: Hacspec_lib.Traits.t_UnsignedInteger t_GCanvas = { } + +let impl: Hacspec_lib.Traits.t_UnsignedIntegerCopy t_GCanvas = { } + +let impl: Hacspec_lib.Traits.t_Integer t_GCanvas = + { + nUM_BITS = (fun -> 384sz); + zERO = (fun -> from_literal_under_impl_15 (pub_u128 0sz)); + oNE = (fun -> from_literal_under_impl_15 (pub_u128 1sz)); + tWO = (fun -> from_literal_under_impl_15 (pub_u128 2sz)); + from_literal = (fun (v_val: u128) -> from_literal_under_impl_15 v_val); + from_hex_string + = + (fun (s: Alloc.String.t_String) -> + from_hex_under_impl_14 (Core.Ops.Deref.Deref.deref (Alloc.Str.replace_under_impl_5 (Core.Ops.Deref.Deref.deref + s + <: + string) + "0x" + "" + <: + Alloc.String.t_String) + <: + string)); + get_bit + = + (fun (self: t_GCanvas) (i: usize) -> + (self <<. i <: Core.Ops.Bit.Shr.t_Output) &. (Hacspec_lib.Traits.Integer.v_ONE <: t_GCanvas) + ); + set_bit + = + (fun (self: t_GCanvas) (b: t_GCanvas) (i: usize) -> + let _:Prims.unit = + if true + then + let _:Prims.unit = + if + ~.(Prims.op_BarBar (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b + <: + t_GCanvas) + (Hacspec_lib.Traits.Integer.v_ONE <: t_GCanvas) + <: + bool) + (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b <: t_GCanvas) + (Hacspec_lib.Traits.Integer.v_ZERO <: t_GCanvas) + <: + bool)) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO())" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + () + in + let tmp1:t_GCanvas = from_literal_under_impl_15 (~.(pub_u128 1sz >>. i <: u128) <: u128) in + let tmp2:Core.Ops.Bit.Shl.t_Output = b >>. i in + (self &. tmp1 <: Core.Ops.Bit.BitAnd.t_Output) |. tmp2); + set + = + (fun (self: t_GCanvas) (pos: usize) (y: t_GCanvas) (yi: usize) -> + let b:t_GCanvas = Hacspec_lib.Traits.Integer.get_bit y yi in + Hacspec_lib.Traits.Integer.set_bit self b pos); + rotate_left + = + (fun (self: t_GCanvas) (n: usize) -> + let _:Prims.unit = + if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + ((Core.Clone.Clone.clone self <: t_GCanvas) >>. n <: Core.Ops.Bit.Shl.t_Output) |. + (self <<. + (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. + (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) + <: + usize) + <: + Core.Ops.Bit.Shr.t_Output)); + rotate_right + = + fun (self: t_GCanvas) (n: usize) -> + let _:Prims.unit = + if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + ((Core.Clone.Clone.clone self <: t_GCanvas) <<. n <: Core.Ops.Bit.Shr.t_Output) |. + (self >>. + (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. + (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) + <: + usize) + <: + Core.Ops.Bit.Shl.t_Output) + } + +let impl: Hacspec_lib.Traits.t_ModNumeric t_GCanvas = + { + sub_mod + = + (fun (self: t_GCanvas) (rhs: t_GCanvas) (n: t_GCanvas) -> + (self -. rhs <: Core.Ops.Arith.Sub.t_Output) %. n); + add_mod + = + (fun (self: t_GCanvas) (rhs: t_GCanvas) (n: t_GCanvas) -> + (self +. rhs <: Core.Ops.Arith.Add.t_Output) %. n); + mul_mod + = + (fun (self: t_GCanvas) (rhs: t_GCanvas) (n: t_GCanvas) -> + (self *. rhs <: Core.Ops.Arith.Mul.t_Output) %. n); + pow_mod + = + (fun (self: t_GCanvas) (exp: t_GCanvas) (n: t_GCanvas) -> pow_felem_under_impl_26 self exp n); + modulo = (fun (self: t_GCanvas) (n: t_GCanvas) -> self %. n); + signed_modulo + = + (fun (self: t_GCanvas) (n: t_GCanvas) -> Hacspec_lib.Traits.ModNumeric.modulo self n); + absolute = fun (self: t_GCanvas) -> self + } + +let impl: Hacspec_lib.Traits.t_Numeric t_GCanvas = + { + max_val = (fun -> max_value_under_impl_15); + wrap_add = (fun (self: t_GCanvas) (rhs: t_GCanvas) -> self +. rhs); + wrap_sub = (fun (self: t_GCanvas) (rhs: t_GCanvas) -> self -. rhs); + wrap_mul = (fun (self: t_GCanvas) (rhs: t_GCanvas) -> self *. rhs); + wrap_div = (fun (self: t_GCanvas) (rhs: t_GCanvas) -> self /. rhs); + exp + = + (fun (self: t_GCanvas) (exp: u32) -> + pow_under_impl_26 self + (Core.Convert.Into.into exp <: u128) + (Hacspec_lib.Traits.Numeric.max_val <: t_GCanvas)); + pow_self + = + (fun (self: t_GCanvas) (exp: t_GCanvas) -> + pow_felem_under_impl_26 self + (Core.Convert.Into.into exp <: t_GCanvas) + (Hacspec_lib.Traits.Numeric.max_val <: t_GCanvas)); + divide = (fun (self: t_GCanvas) (rhs: t_GCanvas) -> self /. rhs); + inv = (fun (self: t_GCanvas) (n: t_GCanvas) -> inv_under_impl_26 self n); + equal = (fun (self: t_GCanvas) (other: t_GCanvas) -> self =. other); + greater_than = (fun (self: t_GCanvas) (other: t_GCanvas) -> self >. other); + greater_than_or_equal = (fun (self: t_GCanvas) (other: t_GCanvas) -> self >=. other); + less_than = (fun (self: t_GCanvas) (other: t_GCanvas) -> self <. other); + less_than_or_equal = (fun (self: t_GCanvas) (other: t_GCanvas) -> self >=. other); + not_equal_bm + = + (fun (self: t_GCanvas) (other: t_GCanvas) -> + if ~.(Hacspec_lib.Traits.Numeric.equal self other <: bool) + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_15 (pub_u128 0sz)); + equal_bm + = + (fun (self: t_GCanvas) (other: t_GCanvas) -> + if Hacspec_lib.Traits.Numeric.equal self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_15 (pub_u128 0sz)); + greater_than_bm + = + (fun (self: t_GCanvas) (other: t_GCanvas) -> + if Hacspec_lib.Traits.Numeric.greater_than self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_15 (pub_u128 0sz)); + greater_than_or_equal_bm + = + (fun (self: t_GCanvas) (other: t_GCanvas) -> + if Hacspec_lib.Traits.Numeric.greater_than_or_equal self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_15 (pub_u128 0sz)); + less_than_bm + = + (fun (self: t_GCanvas) (other: t_GCanvas) -> + if Hacspec_lib.Traits.Numeric.less_than self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_15 (pub_u128 0sz)); + less_than_or_equal_bm + = + fun (self: t_GCanvas) (other: t_GCanvas) -> + if Hacspec_lib.Traits.Numeric.less_than_or_equal self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_15 (pub_u128 0sz) + } + +type t_G = | G : t_GCanvas -> t_G + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +let impl: Core.Convert.t_From t_G t_GCanvas = + { + from + = + fun (x: t_GCanvas) -> + G + (rem_under_impl_26 x + (from_hex_under_impl_14 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_GCanvas)) + } + +let impl: Core.Convert.t_Into t_G t_GCanvas = + { into = fun (self: t_G) -> self.Hacspec_ovn.Schnorr.G.0 } + +let from_canvas_under_impl_63 (x: t_GCanvas) : t_G = + G + (rem_under_impl_26 x + (from_hex_under_impl_14 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_GCanvas)) + +let into_canvas_under_impl_63 (self: t_G) : t_GCanvas = self.Hacspec_ovn.Schnorr.G.0 + +let max_under_impl_63: t_GCanvas = + from_hex_under_impl_14 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + +let declassify_under_impl_63 (self: t_G) : Num_bigint.Bigint.t_BigInt = + let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into a + +let from_hex_under_impl_63 (s: string) : t_G = + Core.Convert.Into.into (from_hex_under_impl_14 s <: t_GCanvas) + +let from_be_bytes_under_impl_63 (v: slice u8) : t_G = + Core.Convert.Into.into (from_be_bytes_under_impl_14 v <: t_GCanvas) + +let to_be_bytes_under_impl_63 (self: t_G) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = + Alloc.Slice.to_vec_under_impl (Rust_primitives.unsize (to_be_bytes_under_impl_14 (Core.Convert.Into.into + self + <: + t_GCanvas) + <: + array u8 48sz) + <: + slice u8) + +let from_le_bytes_under_impl_63 (v: slice u8) : t_G = + Core.Convert.Into.into (from_le_bytes_under_impl_14 v <: t_GCanvas) + +let to_le_bytes_under_impl_63 (self: t_G) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = + Alloc.Slice.to_vec_under_impl (Rust_primitives.unsize (to_le_bytes_under_impl_14 (Core.Convert.Into.into + self + <: + t_GCanvas) + <: + array u8 48sz) + <: + slice u8) + +let bit_under_impl_63 (self: t_G) (i: usize) : bool = + bit_under_impl_15 (Core.Convert.Into.into self <: t_GCanvas) i + +let from_literal_under_impl_63 (x: u128) : t_G = + let big_x:Num_bigint.Biguint.t_BigUint = Core.Convert.From.from x in + let _:Prims.unit = + if + big_x >. + (Core.Convert.Into.into (max_under_impl_63 <: t_GCanvas) <: Num_bigint.Biguint.t_BigUint) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["literal "; " too big for type G"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + G (Core.Convert.Into.into big_x) + +let from_signed_literal_under_impl_63 (x: i128) : t_G = + let big_x:Num_bigint.Biguint.t_BigUint = Core.Convert.From.from (cast x) in + let _:Prims.unit = + if + big_x >. + (Core.Convert.Into.into (max_under_impl_63 <: t_GCanvas) <: Num_bigint.Biguint.t_BigUint) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["literal "; " too big for type G"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + G (Core.Convert.Into.into big_x) + +let comp_eq_under_impl_63 (self rhs: t_G) : t_G = + let (x: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_eq_under_impl_14 x (Core.Convert.Into.into rhs <: t_GCanvas) + <: + t_GCanvas) + +let comp_ne_under_impl_63 (self rhs: t_G) : t_G = + let (x: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_ne_under_impl_14 x (Core.Convert.Into.into rhs <: t_GCanvas) + <: + t_GCanvas) + +let comp_gte_under_impl_63 (self rhs: t_G) : t_G = + let (x: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_gte_under_impl_14 x (Core.Convert.Into.into rhs <: t_GCanvas) + <: + t_GCanvas) + +let comp_gt_under_impl_63 (self rhs: t_G) : t_G = + let (x: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_gt_under_impl_14 x (Core.Convert.Into.into rhs <: t_GCanvas) + <: + t_GCanvas) + +let comp_lte_under_impl_63 (self rhs: t_G) : t_G = + let (x: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_lte_under_impl_14 x (Core.Convert.Into.into rhs <: t_GCanvas) + <: + t_GCanvas) + +let comp_lt_under_impl_63 (self rhs: t_G) : t_G = + let (x: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_lt_under_impl_14 x (Core.Convert.Into.into rhs <: t_GCanvas) + <: + t_GCanvas) + +let neg_under_impl_63 (self: t_G) : t_G = + let (mod_val: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into (from_hex_under_impl_14 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_GCanvas) + in + let (s: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + let (s: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into s in + let (result: t_GCanvas):t_GCanvas = + Core.Convert.Into.into (mod_val -. s <: Core.Ops.Arith.Sub.t_Output) + in + Core.Convert.Into.into result + +let impl: Core.Cmp.t_PartialOrd t_G t_G = + { + partial_cmp + = + fun (self: t_G) (other: t_G) -> Core.Option.Option_Some (Core.Cmp.Ord.cmp self other) + } + +let impl: Core.Cmp.t_Ord t_G = + { + cmp + = + fun (self: t_G) (other: t_G) -> + Core.Cmp.Ord.cmp self.Hacspec_ovn.Schnorr.G.0 other.Hacspec_ovn.Schnorr.G.0 + } + +let impl: Core.Cmp.t_PartialEq t_G t_G = + { + eq + = + fun (self: t_G) (other: t_G) -> self.Hacspec_ovn.Schnorr.G.0 =. other.Hacspec_ovn.Schnorr.G.0 + } + +let impl: Core.Cmp.t_Eq t_G = { } + +let impl: Core.Ops.Arith.t_Add t_G t_G = + { + output = t_G; + add + = + fun (self: t_G) (rhs: t_G) -> + let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + let (b: t_GCanvas):t_GCanvas = Core.Convert.Into.into rhs in + let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into a + in + let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into b + in + let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Add.t_Output = a +. b in + let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into (from_hex_under_impl_14 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_GCanvas) + in + let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in + let (d: t_GCanvas):t_GCanvas = Core.Convert.Into.into d in + Core.Convert.Into.into d + } + +let impl: Core.Ops.Arith.t_Sub t_G t_G = + { + output = t_G; + sub + = + fun (self: t_G) (rhs: t_G) -> + let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + let (b: t_GCanvas):t_GCanvas = Core.Convert.Into.into rhs in + let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into a + in + let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into b + in + let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into (from_hex_under_impl_14 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_GCanvas) + in + let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Add.t_Output = + if b >. a + then + ((Core.Clone.Clone.clone max <: Num_bigint.Biguint.t_BigUint) -. b + <: + Core.Ops.Arith.Sub.t_Output) +. + a + else a -. b + in + let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in + let (d: t_GCanvas):t_GCanvas = Core.Convert.Into.into d in + Core.Convert.Into.into d + } + +let impl: Core.Ops.Arith.t_Mul t_G t_G = + { + output = t_G; + mul + = + fun (self: t_G) (rhs: t_G) -> + let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + let (b: t_GCanvas):t_GCanvas = Core.Convert.Into.into rhs in + let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into a + in + let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into b + in + let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Mul.t_Output = a *. b in + let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into (from_hex_under_impl_14 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_GCanvas) + in + let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in + let (d: t_GCanvas):t_GCanvas = Core.Convert.Into.into d in + Core.Convert.Into.into d + } + +let impl: Core.Ops.Arith.t_Div t_G t_G = + { output = t_G; div = fun (self: t_G) (rhs: t_G) -> self *. (inv_under_impl_57 rhs <: t_G) } + +let impl: Core.Ops.Arith.t_Rem t_G t_G = + { + output = t_G; + rem + = + fun (self: t_G) (rhs: t_G) -> + let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + let (b: t_GCanvas):t_GCanvas = Core.Convert.Into.into rhs in + let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into a + in + let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into b + in + let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = a %. b in + let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into (from_hex_under_impl_14 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_GCanvas) + in + let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in + let (d: t_GCanvas):t_GCanvas = Core.Convert.Into.into d in + Core.Convert.Into.into d + } + +let impl: Core.Ops.Bit.t_Not t_G = + { + output = t_G; + not + = + fun (self: t_G) -> + let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (~.a <: Core.Ops.Bit.Not.t_Output) + } + +let impl: Core.Ops.Bit.t_BitOr t_G t_G = + { + output = t_G; + bitor + = + fun (self: t_G) (rhs: t_G) -> + let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + let (b: t_GCanvas):t_GCanvas = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a |. b <: Core.Ops.Bit.BitOr.t_Output) + } + +let impl: Core.Ops.Bit.t_BitXor t_G t_G = + { + output = t_G; + bitxor + = + fun (self: t_G) (rhs: t_G) -> + let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + let (b: t_GCanvas):t_GCanvas = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a ^. b <: Core.Ops.Bit.BitXor.t_Output) + } + +let impl: Core.Ops.Bit.t_BitAnd t_G t_G = + { + output = t_G; + bitand + = + fun (self: t_G) (rhs: t_G) -> + let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + let (b: t_GCanvas):t_GCanvas = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a &. b <: Core.Ops.Bit.BitAnd.t_Output) + } + +let impl: Core.Ops.Bit.t_Shr t_G usize = + { + output = t_G; + shr + = + fun (self: t_G) (rhs: usize) -> + let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (a <<. rhs <: Core.Ops.Bit.Shr.t_Output) + } + +let impl: Core.Ops.Bit.t_Shl t_G usize = + { + output = t_G; + shl + = + fun (self: t_G) (rhs: usize) -> + let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (a >>. rhs <: Core.Ops.Bit.Shl.t_Output) + } + +let inv_under_impl_57 (self: t_G) : t_G = + let (base: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (inv_under_impl_26 base (max_under_impl_63 <: t_GCanvas) <: t_GCanvas) + +let pow_felem_under_impl_57 (self exp: t_G) : t_G = + let (base: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (pow_felem_under_impl_26 base + (Core.Convert.Into.into exp <: t_GCanvas) + (max_under_impl_63 <: t_GCanvas) + <: + t_GCanvas) + +let pow_under_impl_57 (self: t_G) (exp: u128) : t_G = + let (base: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (pow_under_impl_26 base exp (max_under_impl_63 <: t_GCanvas) <: t_GCanvas) + +let pow2_under_impl_57 (x: usize) : t_G = Core.Convert.Into.into (pow2_under_impl_15 x <: t_GCanvas) + +let from_byte_seq_be_under_impl (s: a) : t_G = + Core.Convert.Into.into (from_be_bytes_under_impl_14 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (Secret_integers.t_U8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + t_GCanvas) + +let from_public_byte_seq_be_under_impl (s: a) : t_G = + Core.Convert.Into.into (from_be_bytes_under_impl_14 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> x) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + t_GCanvas) + +let to_byte_seq_be_under_impl (self: t_G) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map + (Core.Slice.iter_under_impl (Core.Ops.Deref.Deref.deref (to_be_bytes_under_impl_63 self + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) + <: + Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) + +let to_public_byte_seq_be_under_impl (self: t_G) : Hacspec_lib.Seq.t_Seq u8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (to_be_bytes_under_impl_63 self + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + +let from_byte_seq_le_under_impl (s: a) : t_G = + Core.Convert.Into.into (from_le_bytes_under_impl_14 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (Secret_integers.t_U8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + t_GCanvas) + +let from_public_byte_seq_le_under_impl (s: a) : t_G = + Core.Convert.Into.into (from_le_bytes_under_impl_14 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> x) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + t_GCanvas) + +let to_byte_seq_le_under_impl (self: t_G) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map + (Core.Slice.iter_under_impl (Core.Ops.Deref.Deref.deref (to_le_bytes_under_impl_63 self + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) + <: + Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) + +let to_public_byte_seq_le_under_impl (self: t_G) : Hacspec_lib.Seq.t_Seq u8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (to_le_bytes_under_impl_63 self + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + +let from_secret_literal_under_impl (x: Secret_integers.t_U128) : t_G = + Core.Convert.Into.into (from_literal_under_impl_15 (Secret_integers.declassify_under_impl_126 x + <: + u128) + <: + t_GCanvas) + +let impl: Hacspec_lib.Traits.t_NumericCopy t_G = { } + +let impl: Hacspec_lib.Traits.t_UnsignedInteger t_G = { } + +let impl: Hacspec_lib.Traits.t_UnsignedIntegerCopy t_G = { } + +let impl: Hacspec_lib.Traits.t_Integer t_G = + { + nUM_BITS = (fun -> 384sz); + zERO = (fun -> from_literal_under_impl_63 (pub_u128 0sz)); + oNE = (fun -> from_literal_under_impl_63 (pub_u128 1sz)); + tWO = (fun -> from_literal_under_impl_63 (pub_u128 2sz)); + from_literal = (fun (v_val: u128) -> from_literal_under_impl_63 v_val); + from_hex_string + = + (fun (s: Alloc.String.t_String) -> + from_hex_under_impl_63 (Core.Ops.Deref.Deref.deref (Alloc.Str.replace_under_impl_5 (Core.Ops.Deref.Deref.deref + s + <: + string) + "0x" + "" + <: + Alloc.String.t_String) + <: + string)); + get_bit + = + (fun (self: t_G) (i: usize) -> + (self <<. i <: Core.Ops.Bit.Shr.t_Output) &. (Hacspec_lib.Traits.Integer.v_ONE <: t_G)); + set_bit + = + (fun (self: t_G) (b: t_G) (i: usize) -> + let _:Prims.unit = + if true + then + let _:Prims.unit = + if + ~.(Prims.op_BarBar (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b + <: + t_G) + (Hacspec_lib.Traits.Integer.v_ONE <: t_G) + <: + bool) + (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b <: t_G) + (Hacspec_lib.Traits.Integer.v_ZERO <: t_G) + <: + bool)) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO())" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + () + in + let tmp1:t_G = from_literal_under_impl_63 (~.(pub_u128 1sz >>. i <: u128) <: u128) in + let tmp2:Core.Ops.Bit.Shl.t_Output = b >>. i in + (self &. tmp1 <: Core.Ops.Bit.BitAnd.t_Output) |. tmp2); + set + = + (fun (self: t_G) (pos: usize) (y: t_G) (yi: usize) -> + let b:t_G = Hacspec_lib.Traits.Integer.get_bit y yi in + Hacspec_lib.Traits.Integer.set_bit self b pos); + rotate_left + = + (fun (self: t_G) (n: usize) -> + let _:Prims.unit = + if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + ((Core.Clone.Clone.clone self <: t_G) >>. n <: Core.Ops.Bit.Shl.t_Output) |. + (self <<. + (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. + (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) + <: + usize) + <: + Core.Ops.Bit.Shr.t_Output)); + rotate_right + = + fun (self: t_G) (n: usize) -> + let _:Prims.unit = + if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + ((Core.Clone.Clone.clone self <: t_G) <<. n <: Core.Ops.Bit.Shr.t_Output) |. + (self >>. + (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. + (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) + <: + usize) + <: + Core.Ops.Bit.Shl.t_Output) + } + +let impl: Hacspec_lib.Traits.t_ModNumeric t_G = + { + sub_mod = (fun (self: t_G) (rhs: t_G) (n: t_G) -> self -. rhs); + add_mod = (fun (self: t_G) (rhs: t_G) (n: t_G) -> self +. rhs); + mul_mod = (fun (self: t_G) (rhs: t_G) (n: t_G) -> self *. rhs); + pow_mod = (fun (self: t_G) (exp: t_G) (n: t_G) -> pow_felem_under_impl_57 self exp); + modulo = (fun (self: t_G) (n: t_G) -> self %. n); + signed_modulo = (fun (self: t_G) (n: t_G) -> Hacspec_lib.Traits.ModNumeric.modulo self n); + absolute = fun (self: t_G) -> self + } + +let impl: Hacspec_lib.Traits.t_Numeric t_G = + { + max_val + = + (fun -> + Core.Convert.Into.into ((max_under_impl_63 <: t_GCanvas) -. + (from_literal_under_impl_15 (pub_u128 1sz) <: t_GCanvas) + <: + Core.Ops.Arith.Sub.t_Output)); + wrap_add = (fun (self: t_G) (rhs: t_G) -> self +. rhs); + wrap_sub = (fun (self: t_G) (rhs: t_G) -> self -. rhs); + wrap_mul = (fun (self: t_G) (rhs: t_G) -> self *. rhs); + wrap_div = (fun (self: t_G) (rhs: t_G) -> self /. rhs); + exp + = + (fun (self: t_G) (exp: u32) -> pow_under_impl_57 self (Core.Convert.Into.into exp <: u128)); + pow_self = (fun (self: t_G) (exp: t_G) -> pow_felem_under_impl_57 self exp); + divide = (fun (self: t_G) (rhs: t_G) -> self /. rhs); + inv = (fun (self: t_G) (n: t_G) -> inv_under_impl_57 self); + equal = (fun (self: t_G) (other: t_G) -> self =. other); + greater_than = (fun (self: t_G) (other: t_G) -> self >. other); + greater_than_or_equal = (fun (self: t_G) (other: t_G) -> self >=. other); + less_than = (fun (self: t_G) (other: t_G) -> self <. other); + less_than_or_equal = (fun (self: t_G) (other: t_G) -> self <=. other); + not_equal_bm + = + (fun (self: t_G) (other: t_G) -> + if self <>. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_G) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_G) + else Hacspec_lib.Traits.Integer.v_ZERO); + equal_bm + = + (fun (self: t_G) (other: t_G) -> + if self =. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_G) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_G) + else Hacspec_lib.Traits.Integer.v_ZERO); + greater_than_bm + = + (fun (self: t_G) (other: t_G) -> + if self >. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_G) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_G) + else Hacspec_lib.Traits.Integer.v_ZERO); + greater_than_or_equal_bm + = + (fun (self: t_G) (other: t_G) -> + if self >=. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_G) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_G) + else Hacspec_lib.Traits.Integer.v_ZERO); + less_than_bm + = + (fun (self: t_G) (other: t_G) -> + if self <. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_G) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_G) + else Hacspec_lib.Traits.Integer.v_ZERO); + less_than_or_equal_bm + = + fun (self: t_G) (other: t_G) -> + if self <=. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_G) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_G) + else Hacspec_lib.Traits.Integer.v_ZERO + } + +type t_QCanvas = { + f_b:array u8 48sz; + f_sign:Num_bigint.Bigint.t_Sign; + f_signed:bool +} + +let max_under_impl_82: Core.Ops.Arith.Sub.t_Output = + ((Core.Convert.From.from 1ul <: Num_bigint.Bigint.t_BigInt) >>. 384l <: Core.Ops.Bit.Shl.t_Output) -. + (Num_traits.Identities.One.one <: Num_bigint.Bigint.t_BigInt) + +let max_value_under_impl_82: t_QCanvas = + Core.Convert.From.from (max_under_impl_82 <: Num_bigint.Bigint.t_BigInt) + +let hex_string_to_bytes_under_impl_82 (s: string) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = + let s:Alloc.String.t_String = + if ((Core.Str.len_under_impl s <: usize) %. 2sz <: usize) <>. 0sz + then + let x:Alloc.String.t_String = Alloc.String.ToString.to_string "0" in + let x:Alloc.String.t_String = Alloc.String.push_str_under_impl x s in + x + else Alloc.String.ToString.to_string s + in + let _:Prims.unit = + if ~.(((Alloc.String.len_under_impl s <: usize) %. 2sz <: usize) =. 0sz <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["length of hex string "; ": "] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [ + Core.Fmt.Rt.new_display_under_impl_1 s <: Core.Fmt.Rt.t_Argument; + Core.Fmt.Rt.new_display_under_impl_1 (Alloc.String.len_under_impl s + <: + usize) + <: + Core.Fmt.Rt.t_Argument + ] + in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let + (b: Core.Result.t_Result (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) Core.Num.Error.t_ParseIntError):Core.Result.t_Result + (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) Core.Num.Error.t_ParseIntError = + Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map (Core.Iter.Traits.Iterator.Iterator.step_by + ({ + Core.Ops.Range.Range.f_start = 0sz; + Core.Ops.Range.Range.f_end = Alloc.String.len_under_impl s <: usize + }) + 2sz + <: + Core.Iter.Adapters.Step_by.t_StepBy (Core.Ops.Range.t_Range usize)) + (fun i -> + Core.Num.from_str_radix_under_impl_6 (s.[ { + Core.Ops.Range.Range.f_start = i; + Core.Ops.Range.Range.f_end = i +. 2sz <: usize + } ] + <: + string) + 16ul + <: + Core.Result.t_Result u8 Core.Num.Error.t_ParseIntError) + <: + Core.Iter.Adapters.Map.t_Map + (Core.Iter.Adapters.Step_by.t_StepBy (Core.Ops.Range.t_Range usize)) + (usize -> Core.Result.t_Result u8 Core.Num.Error.t_ParseIntError)) + in + Core.Result.expect_under_impl b "Error parsing hex string" + +let from_literal_under_impl_82 (x: u128) : t_QCanvas = + let big_x:Num_bigint.Bigint.t_BigInt = Core.Convert.From.from x in + let _:Prims.unit = + if + big_x >. + (Core.Convert.Into.into (max_under_impl_82 <: Num_bigint.Bigint.t_BigInt) + <: + Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["literal "; " too big for type QCanvas"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Core.Convert.Into.into big_x + +let from_signed_literal_under_impl_82 (x: i128) : t_QCanvas = + let big_x:Num_bigint.Bigint.t_BigInt = Core.Convert.From.from (cast x) in + let _:Prims.unit = + if + big_x >. + (Core.Convert.Into.into (max_under_impl_82 <: Num_bigint.Bigint.t_BigInt) + <: + Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["literal "; " too big for type QCanvas"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Core.Convert.Into.into big_x + +let pow2_under_impl_82 (x: usize) : t_QCanvas = + Core.Convert.Into.into ((Core.Convert.From.from 1ul <: Num_bigint.Bigint.t_BigInt) >>. x + <: + Core.Ops.Bit.Shl.t_Output) + +let bit_under_impl_82 (self: t_QCanvas) (i: usize) : bool = + let _:Prims.unit = + if + ~.(i <. + ((Core.Slice.len_under_impl (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.QCanvas.f_b + <: + slice u8) + <: + usize) *. + 8sz + <: + usize) + <: + bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = + [ + "the bit queried should be lower than the size of the integer representation: "; + " < " + ] + in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [ + Core.Fmt.Rt.new_display_under_impl_1 i <: Core.Fmt.Rt.t_Argument; + Core.Fmt.Rt.new_display_under_impl_1 ((Core.Slice.len_under_impl (Rust_primitives.unsize + self.Hacspec_ovn.Schnorr.QCanvas.f_b + <: + slice u8) + <: + usize) *. + 8sz + <: + usize) + <: + Core.Fmt.Rt.t_Argument + ] + in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let (bigint: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (tmp: Num_bigint.Bigint.t_BigInt):Core.Ops.Bit.Shr.t_Output = bigint <<. i in + ((Num_bigint.Bigint.to_bytes_le_under_impl_24 (tmp &. + (Num_traits.Identities.One.one <: Num_bigint.Bigint.t_BigInt) + <: + Num_bigint.Bigint.t_BigInt) + <: + (Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global)) + ._2.[ 0sz ] + <: + u8) =. + 1uy + +let impl: Core.Convert.t_From t_QCanvas Num_bigint.Biguint.t_BigUint = + { + from + = + fun (x: Num_bigint.Biguint.t_BigUint) -> + Core.Convert.From.from (Core.Convert.From.from x <: Num_bigint.Bigint.t_BigInt) + } + +let impl: Core.Convert.t_From t_QCanvas Num_bigint.Bigint.t_BigInt = + { + from + = + fun (x: Num_bigint.Bigint.t_BigInt) -> + let max_value:Num_bigint.Bigint.t_BigInt = max_under_impl_82 in + let _:Prims.unit = + if ~.(x <=. max_value <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = [""; " is too large for type QCanvas!"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let sign, repr:(Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) = + Num_bigint.Bigint.to_bytes_be_under_impl_24 x + in + let _:Prims.unit = + if Prims.op_AmpAmp (sign =. Num_bigint.Bigint.Sign_Minus) ~.false + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "Trying to convert a negative number into an unsigned integer!" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + let _:Prims.unit = + if (Alloc.Vec.len_under_impl_1 repr <: usize) >. ((384sz +. 7sz <: usize) /. 8sz <: usize) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = [""; " is too large for type QCanvas"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let out:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in + let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize out <: slice u8) in + let lower:usize = upper -. (Alloc.Vec.len_under_impl_1 repr <: usize) in + let _:Prims.unit = + Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" + "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (out),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(core::ops::deref::Deref::deref(&(deref(&(repr)))))),\n )" + + in + { + Hacspec_ovn.Schnorr.QCanvas.f_b = out; + Hacspec_ovn.Schnorr.QCanvas.f_sign = sign; + Hacspec_ovn.Schnorr.QCanvas.f_signed = false + } + } + +let impl: Core.Default.t_Default t_QCanvas = + { + default + = + fun -> + { + Hacspec_ovn.Schnorr.QCanvas.f_b = Rust_primitives.Hax.repeat 0uy 48sz; + Hacspec_ovn.Schnorr.QCanvas.f_sign = Num_bigint.Bigint.Sign_Plus; + Hacspec_ovn.Schnorr.QCanvas.f_signed = false + } + } + +let impl: Core.Convert.t_Into t_QCanvas Num_bigint.Bigint.t_BigInt = + { + into + = + fun (self: t_QCanvas) -> + Num_bigint.Bigint.from_bytes_be_under_impl_24 self.Hacspec_ovn.Schnorr.QCanvas.f_sign + (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.QCanvas.f_b <: slice u8) + } + +let impl: Core.Convert.t_Into t_QCanvas Num_bigint.Biguint.t_BigUint = + { + into + = + fun (self: t_QCanvas) -> + Num_bigint.Biguint.from_bytes_be_under_impl_18 (Rust_primitives.unsize self + .Hacspec_ovn.Schnorr.QCanvas.f_b + <: + slice u8) + } + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +let from_hex_under_impl_81 (s: string) : t_QCanvas = + Core.Convert.Into.into (Num_bigint.Bigint.from_bytes_be_under_impl_24 Num_bigint.Bigint.Sign_Plus + (Core.Ops.Deref.Deref.deref (hex_string_to_bytes_under_impl_82 s + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + Num_bigint.Bigint.t_BigInt) + +let from_be_bytes_under_impl_81 (v: slice u8) : t_QCanvas = + let _:Prims.unit = + if true + then + let _:Prims.unit = + if + ~.((Core.Slice.len_under_impl v <: usize) <=. ((384sz +. 7sz <: usize) /. 8sz <: usize) + <: + bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + () + in + let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in + let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize repr <: slice u8) in + let lower:usize = upper -. (Core.Slice.len_under_impl v <: usize) in + let _:Prims.unit = + Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" + "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(deref(&(v)))),\n )" + + in + { + Hacspec_ovn.Schnorr.QCanvas.f_b = repr; + Hacspec_ovn.Schnorr.QCanvas.f_sign = Num_bigint.Bigint.Sign_Plus; + Hacspec_ovn.Schnorr.QCanvas.f_signed = false + } + +let from_le_bytes_under_impl_81 (v: slice u8) : t_QCanvas = + let _:Prims.unit = + if true + then + let _:Prims.unit = + if + ~.((Core.Slice.len_under_impl v <: usize) <=. ((384sz +. 7sz <: usize) /. 8sz <: usize) + <: + bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + () + in + let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in + let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize repr <: slice u8) in + let lower:usize = upper -. (Core.Slice.len_under_impl v <: usize) in + let _:Prims.unit = + Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" + "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(deref(&(v)))),\n )" + + in + Core.Convert.Into.into (Num_bigint.Bigint.from_bytes_le_under_impl_24 Num_bigint.Bigint.Sign_Plus + (Rust_primitives.unsize repr <: slice u8) + <: + Num_bigint.Bigint.t_BigInt) + +let to_be_bytes_under_impl_81 (self: t_QCanvas) : array u8 48sz = + self.Hacspec_ovn.Schnorr.QCanvas.f_b + +let to_le_bytes_under_impl_81 (self: t_QCanvas) : array u8 48sz = + let x:Num_bigint.Bigint.t_BigInt = + Num_bigint.Bigint.from_bytes_be_under_impl_24 Num_bigint.Bigint.Sign_Plus + (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.QCanvas.f_b <: slice u8) + in + let _, x_s:(Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) = + Num_bigint.Bigint.to_bytes_le_under_impl_24 x + in + let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in + let _:Prims.unit = + Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" + "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: 0,\n f_end: alloc::vec::len_under_impl_1(&(x_s)),\n },\n ))),\n &(deref(core::ops::deref::Deref::deref(&(deref(&(x_s)))))),\n )" + + in + repr + +let comp_eq_under_impl_81 (self rhs: t_QCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a =. b + then + let one:t_QCanvas = from_literal_under_impl_82 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_ne_under_impl_81 (self rhs: t_QCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a <>. b + then + let one:t_QCanvas = from_literal_under_impl_82 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_gte_under_impl_81 (self rhs: t_QCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a >=. b + then + let one:t_QCanvas = from_literal_under_impl_82 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_gt_under_impl_81 (self rhs: t_QCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a >. b + then + let one:t_QCanvas = from_literal_under_impl_82 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_lte_under_impl_81 (self rhs: t_QCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a <=. b + then + let one:t_QCanvas = from_literal_under_impl_82 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let comp_lt_under_impl_81 (self rhs: t_QCanvas) : Core.Ops.Arith.Sub.t_Output = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + if a <. b + then + let one:t_QCanvas = from_literal_under_impl_82 (pub_u128 1sz) in + (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one + else Core.Default.Default.v_default + +let inv_under_impl_93 (self modval: t_QCanvas) : t_QCanvas = + let (biguintmodval: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into modval + in + let m:Core.Ops.Arith.Sub.t_Output = + biguintmodval -. (Core.Convert.From.from 2ul <: Num_bigint.Bigint.t_BigInt) + in + let (s: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + Core.Convert.Into.into (Num_bigint.Bigint.modpow_under_impl_24 s m biguintmodval + <: + Num_bigint.Bigint.t_BigInt) + +let pow_felem_under_impl_93 (self exp modval: t_QCanvas) : t_QCanvas = + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into exp in + let (m: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into modval in + let (c: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Num_bigint.Bigint.modpow_under_impl_24 a b m + in + Core.Convert.Into.into c + +let pow_under_impl_93 (self: t_QCanvas) (exp: u128) (modval: t_QCanvas) : t_QCanvas = + pow_felem_under_impl_93 self + (Core.Convert.Into.into (Core.Convert.From.from exp <: Num_bigint.Bigint.t_BigInt) <: t_QCanvas) + modval + +let rem_under_impl_93 (self n: t_QCanvas) : Core.Ops.Arith.Rem.t_Output = self %. n + +let impl: Core.Ops.Arith.t_Add t_QCanvas t_QCanvas = + { + output = t_QCanvas; + add + = + fun (self: t_QCanvas) (rhs: t_QCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let c:Core.Ops.Arith.Add.t_Output = a +. b in + let _:Prims.unit = + if c >. (max_under_impl_82 <: Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = + ["bounded addition overflow for type QCanvas"] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Arith.t_Sub t_QCanvas t_QCanvas = + { + output = t_QCanvas; + sub + = + fun (self: t_QCanvas) (rhs: t_QCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let c:Core.Ops.Arith.Sub.t_Output = + if self.Hacspec_ovn.Schnorr.QCanvas.f_signed + then a -. b + else + Core.Option.unwrap_or_else_under_impl (Num_bigint.Bigint.checked_sub_under_impl_24 a b + <: + Core.Option.t_Option Num_bigint.Bigint.t_BigInt) + (fun -> + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = + ["bounded substraction underflow for type QCanvas"] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + <: + Num_bigint.Bigint.t_BigInt) + in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Arith.t_Mul t_QCanvas t_QCanvas = + { + output = t_QCanvas; + mul + = + fun (self: t_QCanvas) (rhs: t_QCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let c:Core.Ops.Arith.Mul.t_Output = a *. b in + let _:Prims.unit = + if c >. (max_under_impl_82 <: Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = + ["bounded multiplication overflow for type QCanvas"] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Arith.t_Div t_QCanvas t_QCanvas = + { + output = t_QCanvas; + div + = + fun (self: t_QCanvas) (rhs: t_QCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let _:Prims.unit = + if b =. (Num_traits.Identities.Zero.zero <: Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = ["dividing by zero in type QCanvas"] in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let c:Core.Ops.Arith.Div.t_Output = a /. b in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Arith.t_Rem t_QCanvas t_QCanvas = + { + output = t_QCanvas; + rem + = + fun (self: t_QCanvas) (rhs: t_QCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + let _:Prims.unit = + if b =. (Num_traits.Identities.Zero.zero <: Num_bigint.Bigint.t_BigInt) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 + (Rust_primitives.unsize (let l = ["dividing by zero in type QCanvas"] in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 + <: + array Core.Fmt.Rt.t_Argument 0sz) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + let c:Core.Ops.Arith.Rem.t_Output = a %. b in + Core.Convert.Into.into c + } + +let impl: Core.Ops.Bit.t_Not t_QCanvas = + { + output = t_QCanvas; + not + = + fun (self: t_QCanvas) -> + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "not implemented" + <: + Rust_primitives.Hax.t_Never) + } + +let impl: Core.Ops.Bit.t_BitOr t_QCanvas t_QCanvas = + { + output = t_QCanvas; + bitor + = + fun (self: t_QCanvas) (rhs: t_QCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a |. b <: Core.Ops.Bit.BitOr.t_Output) + } + +let impl: Core.Ops.Bit.t_BitXor t_QCanvas t_QCanvas = + { + output = t_QCanvas; + bitxor + = + fun (self: t_QCanvas) (rhs: t_QCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a ^. b <: Core.Ops.Bit.BitXor.t_Output) + } + +let impl: Core.Ops.Bit.t_BitAnd t_QCanvas t_QCanvas = + { + output = t_QCanvas; + bitand + = + fun (self: t_QCanvas) (rhs: t_QCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a &. b <: Core.Ops.Bit.BitAnd.t_Output) + } + +let impl: Core.Ops.Bit.t_Shr t_QCanvas usize = + { + output = t_QCanvas; + shr + = + fun (self: t_QCanvas) (rhs: usize) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let b:usize = rhs in + Core.Convert.Into.into (a <<. b <: Core.Ops.Bit.Shr.t_Output) + } + +let impl: Core.Ops.Bit.t_Shl t_QCanvas usize = + { + output = t_QCanvas; + shl + = + fun (self: t_QCanvas) (rhs: usize) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let b:usize = rhs in + Core.Convert.Into.into (a >>. b <: Core.Ops.Bit.Shl.t_Output) + } + +let impl: Core.Cmp.t_PartialEq t_QCanvas t_QCanvas = + { + eq + = + fun (self: t_QCanvas) (rhs: t_QCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in + a =. b + } + +let impl: Core.Cmp.t_Eq t_QCanvas = { } + +let impl: Core.Cmp.t_PartialOrd t_QCanvas t_QCanvas = + { + partial_cmp + = + fun (self: t_QCanvas) (other: t_QCanvas) -> + let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into self + in + let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into other + in + Core.Cmp.PartialOrd.partial_cmp a b + } + +let impl: Core.Cmp.t_Ord t_QCanvas = + { + cmp + = + fun (self: t_QCanvas) (other: t_QCanvas) -> + Core.Option.unwrap_under_impl (Core.Cmp.PartialOrd.partial_cmp self other + <: + Core.Option.t_Option Core.Cmp.t_Ordering) + } + +let from_byte_seq_be_under_impl_74 (s: a) : t_QCanvas = + from_be_bytes_under_impl_81 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (Secret_integers.t_U8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + +let from_public_byte_seq_be_under_impl_74 (s: a) : t_QCanvas = + from_be_bytes_under_impl_81 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> x) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + +let to_byte_seq_be_under_impl_74 (self: t_QCanvas) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map + (Core.Slice.iter_under_impl (Rust_primitives.unsize (to_be_bytes_under_impl_81 self + <: + array u8 48sz) + <: + slice u8) + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) + <: + Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) + +let impl: Hacspec_lib.Traits.t_NumericCopy t_QCanvas = { } + +let impl: Hacspec_lib.Traits.t_UnsignedInteger t_QCanvas = { } + +let impl: Hacspec_lib.Traits.t_UnsignedIntegerCopy t_QCanvas = { } + +let impl: Hacspec_lib.Traits.t_Integer t_QCanvas = + { + nUM_BITS = (fun -> 384sz); + zERO = (fun -> from_literal_under_impl_82 (pub_u128 0sz)); + oNE = (fun -> from_literal_under_impl_82 (pub_u128 1sz)); + tWO = (fun -> from_literal_under_impl_82 (pub_u128 2sz)); + from_literal = (fun (v_val: u128) -> from_literal_under_impl_82 v_val); + from_hex_string + = + (fun (s: Alloc.String.t_String) -> + from_hex_under_impl_81 (Core.Ops.Deref.Deref.deref (Alloc.Str.replace_under_impl_5 (Core.Ops.Deref.Deref.deref + s + <: + string) + "0x" + "" + <: + Alloc.String.t_String) + <: + string)); + get_bit + = + (fun (self: t_QCanvas) (i: usize) -> + (self <<. i <: Core.Ops.Bit.Shr.t_Output) &. (Hacspec_lib.Traits.Integer.v_ONE <: t_QCanvas) + ); + set_bit + = + (fun (self: t_QCanvas) (b: t_QCanvas) (i: usize) -> + let _:Prims.unit = + if true + then + let _:Prims.unit = + if + ~.(Prims.op_BarBar (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b + <: + t_QCanvas) + (Hacspec_lib.Traits.Integer.v_ONE <: t_QCanvas) + <: + bool) + (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b <: t_QCanvas) + (Hacspec_lib.Traits.Integer.v_ZERO <: t_QCanvas) + <: + bool)) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO())" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + () + in + let tmp1:t_QCanvas = from_literal_under_impl_82 (~.(pub_u128 1sz >>. i <: u128) <: u128) in + let tmp2:Core.Ops.Bit.Shl.t_Output = b >>. i in + (self &. tmp1 <: Core.Ops.Bit.BitAnd.t_Output) |. tmp2); + set + = + (fun (self: t_QCanvas) (pos: usize) (y: t_QCanvas) (yi: usize) -> + let b:t_QCanvas = Hacspec_lib.Traits.Integer.get_bit y yi in + Hacspec_lib.Traits.Integer.set_bit self b pos); + rotate_left + = + (fun (self: t_QCanvas) (n: usize) -> + let _:Prims.unit = + if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + ((Core.Clone.Clone.clone self <: t_QCanvas) >>. n <: Core.Ops.Bit.Shl.t_Output) |. + (self <<. + (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. + (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) + <: + usize) + <: + Core.Ops.Bit.Shr.t_Output)); + rotate_right + = + fun (self: t_QCanvas) (n: usize) -> + let _:Prims.unit = + if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + ((Core.Clone.Clone.clone self <: t_QCanvas) <<. n <: Core.Ops.Bit.Shr.t_Output) |. + (self >>. + (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. + (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) + <: + usize) + <: + Core.Ops.Bit.Shl.t_Output) + } + +let impl: Hacspec_lib.Traits.t_ModNumeric t_QCanvas = + { + sub_mod + = + (fun (self: t_QCanvas) (rhs: t_QCanvas) (n: t_QCanvas) -> + (self -. rhs <: Core.Ops.Arith.Sub.t_Output) %. n); + add_mod + = + (fun (self: t_QCanvas) (rhs: t_QCanvas) (n: t_QCanvas) -> + (self +. rhs <: Core.Ops.Arith.Add.t_Output) %. n); + mul_mod + = + (fun (self: t_QCanvas) (rhs: t_QCanvas) (n: t_QCanvas) -> + (self *. rhs <: Core.Ops.Arith.Mul.t_Output) %. n); + pow_mod + = + (fun (self: t_QCanvas) (exp: t_QCanvas) (n: t_QCanvas) -> pow_felem_under_impl_93 self exp n); + modulo = (fun (self: t_QCanvas) (n: t_QCanvas) -> self %. n); + signed_modulo + = + (fun (self: t_QCanvas) (n: t_QCanvas) -> Hacspec_lib.Traits.ModNumeric.modulo self n); + absolute = fun (self: t_QCanvas) -> self + } + +let impl: Hacspec_lib.Traits.t_Numeric t_QCanvas = + { + max_val = (fun -> max_value_under_impl_82); + wrap_add = (fun (self: t_QCanvas) (rhs: t_QCanvas) -> self +. rhs); + wrap_sub = (fun (self: t_QCanvas) (rhs: t_QCanvas) -> self -. rhs); + wrap_mul = (fun (self: t_QCanvas) (rhs: t_QCanvas) -> self *. rhs); + wrap_div = (fun (self: t_QCanvas) (rhs: t_QCanvas) -> self /. rhs); + exp + = + (fun (self: t_QCanvas) (exp: u32) -> + pow_under_impl_93 self + (Core.Convert.Into.into exp <: u128) + (Hacspec_lib.Traits.Numeric.max_val <: t_QCanvas)); + pow_self + = + (fun (self: t_QCanvas) (exp: t_QCanvas) -> + pow_felem_under_impl_93 self + (Core.Convert.Into.into exp <: t_QCanvas) + (Hacspec_lib.Traits.Numeric.max_val <: t_QCanvas)); + divide = (fun (self: t_QCanvas) (rhs: t_QCanvas) -> self /. rhs); + inv = (fun (self: t_QCanvas) (n: t_QCanvas) -> inv_under_impl_93 self n); + equal = (fun (self: t_QCanvas) (other: t_QCanvas) -> self =. other); + greater_than = (fun (self: t_QCanvas) (other: t_QCanvas) -> self >. other); + greater_than_or_equal = (fun (self: t_QCanvas) (other: t_QCanvas) -> self >=. other); + less_than = (fun (self: t_QCanvas) (other: t_QCanvas) -> self <. other); + less_than_or_equal = (fun (self: t_QCanvas) (other: t_QCanvas) -> self >=. other); + not_equal_bm + = + (fun (self: t_QCanvas) (other: t_QCanvas) -> + if ~.(Hacspec_lib.Traits.Numeric.equal self other <: bool) + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_82 (pub_u128 0sz)); + equal_bm + = + (fun (self: t_QCanvas) (other: t_QCanvas) -> + if Hacspec_lib.Traits.Numeric.equal self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_82 (pub_u128 0sz)); + greater_than_bm + = + (fun (self: t_QCanvas) (other: t_QCanvas) -> + if Hacspec_lib.Traits.Numeric.greater_than self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_82 (pub_u128 0sz)); + greater_than_or_equal_bm + = + (fun (self: t_QCanvas) (other: t_QCanvas) -> + if Hacspec_lib.Traits.Numeric.greater_than_or_equal self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_82 (pub_u128 0sz)); + less_than_bm + = + (fun (self: t_QCanvas) (other: t_QCanvas) -> + if Hacspec_lib.Traits.Numeric.less_than self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_82 (pub_u128 0sz)); + less_than_or_equal_bm + = + fun (self: t_QCanvas) (other: t_QCanvas) -> + if Hacspec_lib.Traits.Numeric.less_than_or_equal self other + then Hacspec_lib.Traits.Numeric.max_val + else from_literal_under_impl_82 (pub_u128 0sz) + } + +type t_Q = | Q : t_QCanvas -> t_Q + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +(* RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + *) + +let impl: Core.Convert.t_From t_Q t_QCanvas = + { + from + = + fun (x: t_QCanvas) -> + Q + (rem_under_impl_93 x + (from_hex_under_impl_81 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_QCanvas)) + } + +let impl: Core.Convert.t_Into t_Q t_QCanvas = + { into = fun (self: t_Q) -> self.Hacspec_ovn.Schnorr.Q.0 } + +let from_canvas_under_impl_130 (x: t_QCanvas) : t_Q = + Q + (rem_under_impl_93 x + (from_hex_under_impl_81 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_QCanvas)) + +let into_canvas_under_impl_130 (self: t_Q) : t_QCanvas = self.Hacspec_ovn.Schnorr.Q.0 + +let max_under_impl_130: t_QCanvas = + from_hex_under_impl_81 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + +let declassify_under_impl_130 (self: t_Q) : Num_bigint.Bigint.t_BigInt = + let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into a + +let from_hex_under_impl_130 (s: string) : t_Q = + Core.Convert.Into.into (from_hex_under_impl_81 s <: t_QCanvas) + +let from_be_bytes_under_impl_130 (v: slice u8) : t_Q = + Core.Convert.Into.into (from_be_bytes_under_impl_81 v <: t_QCanvas) + +let to_be_bytes_under_impl_130 (self: t_Q) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = + Alloc.Slice.to_vec_under_impl (Rust_primitives.unsize (to_be_bytes_under_impl_81 (Core.Convert.Into.into + self + <: + t_QCanvas) + <: + array u8 48sz) + <: + slice u8) + +let from_le_bytes_under_impl_130 (v: slice u8) : t_Q = + Core.Convert.Into.into (from_le_bytes_under_impl_81 v <: t_QCanvas) + +let to_le_bytes_under_impl_130 (self: t_Q) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = + Alloc.Slice.to_vec_under_impl (Rust_primitives.unsize (to_le_bytes_under_impl_81 (Core.Convert.Into.into + self + <: + t_QCanvas) + <: + array u8 48sz) + <: + slice u8) + +let bit_under_impl_130 (self: t_Q) (i: usize) : bool = + bit_under_impl_82 (Core.Convert.Into.into self <: t_QCanvas) i + +let from_literal_under_impl_130 (x: u128) : t_Q = + let big_x:Num_bigint.Biguint.t_BigUint = Core.Convert.From.from x in + let _:Prims.unit = + if + big_x >. + (Core.Convert.Into.into (max_under_impl_130 <: t_QCanvas) <: Num_bigint.Biguint.t_BigUint) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["literal "; " too big for type Q"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Q (Core.Convert.Into.into big_x) + +let from_signed_literal_under_impl_130 (x: i128) : t_Q = + let big_x:Num_bigint.Biguint.t_BigUint = Core.Convert.From.from (cast x) in + let _:Prims.unit = + if + big_x >. + (Core.Convert.Into.into (max_under_impl_130 <: t_QCanvas) <: Num_bigint.Biguint.t_BigUint) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize + (let l = ["literal "; " too big for type Q"] in + assert_norm (List.Tot.length l == 2); + Rust_primitives.Hax.array_of_list l) + <: + slice string) + (Rust_primitives.unsize (let l = + [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] + in + assert_norm (List.Tot.length l == 1); + Rust_primitives.Hax.array_of_list l) + <: + slice Core.Fmt.Rt.t_Argument) + <: + Core.Fmt.t_Arguments) + <: + Rust_primitives.Hax.t_Never) + in + () + in + Q (Core.Convert.Into.into big_x) + +let comp_eq_under_impl_130 (self rhs: t_Q) : t_Q = + let (x: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_eq_under_impl_81 x (Core.Convert.Into.into rhs <: t_QCanvas) + <: + t_QCanvas) + +let comp_ne_under_impl_130 (self rhs: t_Q) : t_Q = + let (x: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_ne_under_impl_81 x (Core.Convert.Into.into rhs <: t_QCanvas) + <: + t_QCanvas) + +let comp_gte_under_impl_130 (self rhs: t_Q) : t_Q = + let (x: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_gte_under_impl_81 x (Core.Convert.Into.into rhs <: t_QCanvas) + <: + t_QCanvas) + +let comp_gt_under_impl_130 (self rhs: t_Q) : t_Q = + let (x: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_gt_under_impl_81 x (Core.Convert.Into.into rhs <: t_QCanvas) + <: + t_QCanvas) + +let comp_lte_under_impl_130 (self rhs: t_Q) : t_Q = + let (x: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_lte_under_impl_81 x (Core.Convert.Into.into rhs <: t_QCanvas) + <: + t_QCanvas) + +let comp_lt_under_impl_130 (self rhs: t_Q) : t_Q = + let (x: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (comp_lt_under_impl_81 x (Core.Convert.Into.into rhs <: t_QCanvas) + <: + t_QCanvas) + +let neg_under_impl_130 (self: t_Q) : t_Q = + let (mod_val: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = + Core.Convert.Into.into (from_hex_under_impl_81 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_QCanvas) + in + let (s: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + let (s: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into s in + let (result: t_QCanvas):t_QCanvas = + Core.Convert.Into.into (mod_val -. s <: Core.Ops.Arith.Sub.t_Output) + in + Core.Convert.Into.into result + +let impl: Core.Cmp.t_PartialOrd t_Q t_Q = + { + partial_cmp + = + fun (self: t_Q) (other: t_Q) -> Core.Option.Option_Some (Core.Cmp.Ord.cmp self other) + } + +let impl: Core.Cmp.t_Ord t_Q = + { + cmp + = + fun (self: t_Q) (other: t_Q) -> + Core.Cmp.Ord.cmp self.Hacspec_ovn.Schnorr.Q.0 other.Hacspec_ovn.Schnorr.Q.0 + } + +let impl: Core.Cmp.t_PartialEq t_Q t_Q = + { + eq + = + fun (self: t_Q) (other: t_Q) -> self.Hacspec_ovn.Schnorr.Q.0 =. other.Hacspec_ovn.Schnorr.Q.0 + } + +let impl: Core.Cmp.t_Eq t_Q = { } + +let impl: Core.Ops.Arith.t_Add t_Q t_Q = + { + output = t_Q; + add + = + fun (self: t_Q) (rhs: t_Q) -> + let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + let (b: t_QCanvas):t_QCanvas = Core.Convert.Into.into rhs in + let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into a + in + let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into b + in + let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Add.t_Output = a +. b in + let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into (from_hex_under_impl_81 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_QCanvas) + in + let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in + let (d: t_QCanvas):t_QCanvas = Core.Convert.Into.into d in + Core.Convert.Into.into d + } + +let impl: Core.Ops.Arith.t_Sub t_Q t_Q = + { + output = t_Q; + sub + = + fun (self: t_Q) (rhs: t_Q) -> + let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + let (b: t_QCanvas):t_QCanvas = Core.Convert.Into.into rhs in + let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into a + in + let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into b + in + let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into (from_hex_under_impl_81 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_QCanvas) + in + let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Add.t_Output = + if b >. a + then + ((Core.Clone.Clone.clone max <: Num_bigint.Biguint.t_BigUint) -. b + <: + Core.Ops.Arith.Sub.t_Output) +. + a + else a -. b + in + let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in + let (d: t_QCanvas):t_QCanvas = Core.Convert.Into.into d in + Core.Convert.Into.into d + } + +let impl: Core.Ops.Arith.t_Mul t_Q t_Q = + { + output = t_Q; + mul + = + fun (self: t_Q) (rhs: t_Q) -> + let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + let (b: t_QCanvas):t_QCanvas = Core.Convert.Into.into rhs in + let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into a + in + let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into b + in + let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Mul.t_Output = a *. b in + let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into (from_hex_under_impl_81 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_QCanvas) + in + let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in + let (d: t_QCanvas):t_QCanvas = Core.Convert.Into.into d in + Core.Convert.Into.into d + } + +let impl: Core.Ops.Arith.t_Div t_Q t_Q = + { output = t_Q; div = fun (self: t_Q) (rhs: t_Q) -> self *. (inv_under_impl_124 rhs <: t_Q) } + +let impl: Core.Ops.Arith.t_Rem t_Q t_Q = + { + output = t_Q; + rem + = + fun (self: t_Q) (rhs: t_Q) -> + let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + let (b: t_QCanvas):t_QCanvas = Core.Convert.Into.into rhs in + let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into a + in + let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into b + in + let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = a %. b in + let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = + Core.Convert.Into.into (from_hex_under_impl_81 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" + + <: + t_QCanvas) + in + let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in + let (d: t_QCanvas):t_QCanvas = Core.Convert.Into.into d in + Core.Convert.Into.into d + } + +let impl: Core.Ops.Bit.t_Not t_Q = + { + output = t_Q; + not + = + fun (self: t_Q) -> + let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (~.a <: Core.Ops.Bit.Not.t_Output) + } + +let impl: Core.Ops.Bit.t_BitOr t_Q t_Q = + { + output = t_Q; + bitor + = + fun (self: t_Q) (rhs: t_Q) -> + let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + let (b: t_QCanvas):t_QCanvas = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a |. b <: Core.Ops.Bit.BitOr.t_Output) + } + +let impl: Core.Ops.Bit.t_BitXor t_Q t_Q = + { + output = t_Q; + bitxor + = + fun (self: t_Q) (rhs: t_Q) -> + let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + let (b: t_QCanvas):t_QCanvas = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a ^. b <: Core.Ops.Bit.BitXor.t_Output) + } + +let impl: Core.Ops.Bit.t_BitAnd t_Q t_Q = + { + output = t_Q; + bitand + = + fun (self: t_Q) (rhs: t_Q) -> + let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + let (b: t_QCanvas):t_QCanvas = Core.Convert.Into.into rhs in + Core.Convert.Into.into (a &. b <: Core.Ops.Bit.BitAnd.t_Output) + } + +let impl: Core.Ops.Bit.t_Shr t_Q usize = + { + output = t_Q; + shr + = + fun (self: t_Q) (rhs: usize) -> + let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (a <<. rhs <: Core.Ops.Bit.Shr.t_Output) + } + +let impl: Core.Ops.Bit.t_Shl t_Q usize = + { + output = t_Q; + shl + = + fun (self: t_Q) (rhs: usize) -> + let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (a >>. rhs <: Core.Ops.Bit.Shl.t_Output) + } + +let inv_under_impl_124 (self: t_Q) : t_Q = + let (base: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (inv_under_impl_93 base (max_under_impl_130 <: t_QCanvas) <: t_QCanvas) + +let pow_felem_under_impl_124 (self exp: t_Q) : t_Q = + let (base: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (pow_felem_under_impl_93 base + (Core.Convert.Into.into exp <: t_QCanvas) + (max_under_impl_130 <: t_QCanvas) + <: + t_QCanvas) + +let pow_under_impl_124 (self: t_Q) (exp: u128) : t_Q = + let (base: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in + Core.Convert.Into.into (pow_under_impl_93 base exp (max_under_impl_130 <: t_QCanvas) <: t_QCanvas) + +let pow2_under_impl_124 (x: usize) : t_Q = + Core.Convert.Into.into (pow2_under_impl_82 x <: t_QCanvas) + +let from_byte_seq_be_under_impl_67 (s: a) : t_Q = + Core.Convert.Into.into (from_be_bytes_under_impl_81 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (Secret_integers.t_U8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + t_QCanvas) + +let from_public_byte_seq_be_under_impl_67 (s: a) : t_Q = + Core.Convert.Into.into (from_be_bytes_under_impl_81 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> x) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + t_QCanvas) + +let to_byte_seq_be_under_impl_67 (self: t_Q) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map + (Core.Slice.iter_under_impl (Core.Ops.Deref.Deref.deref (to_be_bytes_under_impl_130 self + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) + <: + Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) + +let to_public_byte_seq_be_under_impl_67 (self: t_Q) : Hacspec_lib.Seq.t_Seq u8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (to_be_bytes_under_impl_130 self + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + +let from_byte_seq_le_under_impl_67 (s: a) : t_Q = + Core.Convert.Into.into (from_le_bytes_under_impl_81 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) + (Secret_integers.t_U8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + t_QCanvas) + +let from_public_byte_seq_le_under_impl_67 (s: a) : t_Q = + Core.Convert.Into.into (from_le_bytes_under_impl_81 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect + (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> x) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + t_QCanvas) + +let to_byte_seq_le_under_impl_67 (self: t_Q) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map + (Core.Slice.iter_under_impl (Core.Ops.Deref.Deref.deref (to_le_bytes_under_impl_130 self + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + <: + slice u8) + <: + Core.Slice.Iter.t_Iter u8) + (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) + <: + Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) + <: + Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) + +let to_public_byte_seq_le_under_impl_67 (self: t_Q) : Hacspec_lib.Seq.t_Seq u8 = + Hacspec_lib.Seq.from_vec_under_impl_52 (to_le_bytes_under_impl_130 self + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + +let from_secret_literal_under_impl_67 (x: Secret_integers.t_U128) : t_Q = + Core.Convert.Into.into (from_literal_under_impl_82 (Secret_integers.declassify_under_impl_126 x + <: + u128) + <: + t_QCanvas) + +let impl: Hacspec_lib.Traits.t_NumericCopy t_Q = { } + +let impl: Hacspec_lib.Traits.t_UnsignedInteger t_Q = { } + +let impl: Hacspec_lib.Traits.t_UnsignedIntegerCopy t_Q = { } + +let impl: Hacspec_lib.Traits.t_Integer t_Q = + { + nUM_BITS = (fun -> 384sz); + zERO = (fun -> from_literal_under_impl_130 (pub_u128 0sz)); + oNE = (fun -> from_literal_under_impl_130 (pub_u128 1sz)); + tWO = (fun -> from_literal_under_impl_130 (pub_u128 2sz)); + from_literal = (fun (v_val: u128) -> from_literal_under_impl_130 v_val); + from_hex_string + = + (fun (s: Alloc.String.t_String) -> + from_hex_under_impl_130 (Core.Ops.Deref.Deref.deref (Alloc.Str.replace_under_impl_5 (Core.Ops.Deref.Deref.deref + s + <: + string) + "0x" + "" + <: + Alloc.String.t_String) + <: + string)); + get_bit + = + (fun (self: t_Q) (i: usize) -> + (self <<. i <: Core.Ops.Bit.Shr.t_Output) &. (Hacspec_lib.Traits.Integer.v_ONE <: t_Q)); + set_bit + = + (fun (self: t_Q) (b: t_Q) (i: usize) -> + let _:Prims.unit = + if true + then + let _:Prims.unit = + if + ~.(Prims.op_BarBar (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b + <: + t_Q) + (Hacspec_lib.Traits.Integer.v_ONE <: t_Q) + <: + bool) + (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b <: t_Q) + (Hacspec_lib.Traits.Integer.v_ZERO <: t_Q) + <: + bool)) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO())" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + () + in + let tmp1:t_Q = from_literal_under_impl_130 (~.(pub_u128 1sz >>. i <: u128) <: u128) in + let tmp2:Core.Ops.Bit.Shl.t_Output = b >>. i in + (self &. tmp1 <: Core.Ops.Bit.BitAnd.t_Output) |. tmp2); + set + = + (fun (self: t_Q) (pos: usize) (y: t_Q) (yi: usize) -> + let b:t_Q = Hacspec_lib.Traits.Integer.get_bit y yi in + Hacspec_lib.Traits.Integer.set_bit self b pos); + rotate_left + = + (fun (self: t_Q) (n: usize) -> + let _:Prims.unit = + if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + ((Core.Clone.Clone.clone self <: t_Q) >>. n <: Core.Ops.Bit.Shl.t_Output) |. + (self <<. + (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. + (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) + <: + usize) + <: + Core.Ops.Bit.Shr.t_Output)); + rotate_right + = + fun (self: t_Q) (n: usize) -> + let _:Prims.unit = + if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) + then + let ():Prims.unit = + Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" + + <: + Rust_primitives.Hax.t_Never) + in + () + in + ((Core.Clone.Clone.clone self <: t_Q) <<. n <: Core.Ops.Bit.Shr.t_Output) |. + (self >>. + (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. + (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) + <: + usize) + <: + Core.Ops.Bit.Shl.t_Output) + } + +let impl: Hacspec_lib.Traits.t_ModNumeric t_Q = + { + sub_mod = (fun (self: t_Q) (rhs: t_Q) (n: t_Q) -> self -. rhs); + add_mod = (fun (self: t_Q) (rhs: t_Q) (n: t_Q) -> self +. rhs); + mul_mod = (fun (self: t_Q) (rhs: t_Q) (n: t_Q) -> self *. rhs); + pow_mod = (fun (self: t_Q) (exp: t_Q) (n: t_Q) -> pow_felem_under_impl_124 self exp); + modulo = (fun (self: t_Q) (n: t_Q) -> self %. n); + signed_modulo = (fun (self: t_Q) (n: t_Q) -> Hacspec_lib.Traits.ModNumeric.modulo self n); + absolute = fun (self: t_Q) -> self + } + +let impl: Hacspec_lib.Traits.t_Numeric t_Q = + { + max_val + = + (fun -> + Core.Convert.Into.into ((max_under_impl_130 <: t_QCanvas) -. + (from_literal_under_impl_82 (pub_u128 1sz) <: t_QCanvas) + <: + Core.Ops.Arith.Sub.t_Output)); + wrap_add = (fun (self: t_Q) (rhs: t_Q) -> self +. rhs); + wrap_sub = (fun (self: t_Q) (rhs: t_Q) -> self -. rhs); + wrap_mul = (fun (self: t_Q) (rhs: t_Q) -> self *. rhs); + wrap_div = (fun (self: t_Q) (rhs: t_Q) -> self /. rhs); + exp + = + (fun (self: t_Q) (exp: u32) -> pow_under_impl_124 self (Core.Convert.Into.into exp <: u128)); + pow_self = (fun (self: t_Q) (exp: t_Q) -> pow_felem_under_impl_124 self exp); + divide = (fun (self: t_Q) (rhs: t_Q) -> self /. rhs); + inv = (fun (self: t_Q) (n: t_Q) -> inv_under_impl_124 self); + equal = (fun (self: t_Q) (other: t_Q) -> self =. other); + greater_than = (fun (self: t_Q) (other: t_Q) -> self >. other); + greater_than_or_equal = (fun (self: t_Q) (other: t_Q) -> self >=. other); + less_than = (fun (self: t_Q) (other: t_Q) -> self <. other); + less_than_or_equal = (fun (self: t_Q) (other: t_Q) -> self <=. other); + not_equal_bm + = + (fun (self: t_Q) (other: t_Q) -> + if self <>. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_Q) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_Q) + else Hacspec_lib.Traits.Integer.v_ZERO); + equal_bm + = + (fun (self: t_Q) (other: t_Q) -> + if self =. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_Q) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_Q) + else Hacspec_lib.Traits.Integer.v_ZERO); + greater_than_bm + = + (fun (self: t_Q) (other: t_Q) -> + if self >. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_Q) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_Q) + else Hacspec_lib.Traits.Integer.v_ZERO); + greater_than_or_equal_bm + = + (fun (self: t_Q) (other: t_Q) -> + if self >=. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_Q) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_Q) + else Hacspec_lib.Traits.Integer.v_ZERO); + less_than_bm + = + (fun (self: t_Q) (other: t_Q) -> + if self <. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_Q) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_Q) + else Hacspec_lib.Traits.Integer.v_ZERO); + less_than_or_equal_bm + = + fun (self: t_Q) (other: t_Q) -> + if self <=. other + then + ((Hacspec_lib.Traits.Integer.v_ONE <: t_Q) >>. (384sz -. 1sz <: usize) + <: + Core.Ops.Bit.Shl.t_Output) -. + (Hacspec_lib.Traits.Integer.v_ONE <: t_Q) + else Hacspec_lib.Traits.Integer.v_ZERO + } + +let t_Witness = t_Q + +let t_Statement = t_G + +let t_Message = t_G + +let t_Challenge = t_Q + +let t_Response = t_G + +let t_Transcript = (t_G & t_G & t_Q & t_G) + +let prod_assoc (statement, message: (t_G & t_G)) : Hacspec_ovn.Schnorr.Random_oracle.t_Query = + Hacspec_lib.Traits.Integer.v_ONE + +let verify (h a: t_G) (e: t_Q) (z: t_G) : bool = false + +let fiat_shamir_verify (t: (t_G & t_G & t_Q & t_G)) : bool = + let v_QUERIES:Std.Collections.Hash.Map.t_HashMap Hacspec_ovn.Schnorr.Random_oracle.t_Query + Hacspec_ovn.Schnorr.Random_oracle.t_Random + Std.Collections.Hash.Map.t_RandomState = + Std.Collections.Hash.Map.new_under_impl + in + let h, a, e, z:(t_G & t_G & t_Q & t_G) = t in + let v_QUERIES, eu:(Std.Collections.Hash.Map.t_HashMap Hacspec_ovn.Schnorr.Random_oracle.t_Query + Hacspec_ovn.Schnorr.Random_oracle.t_Random + Std.Collections.Hash.Map.t_RandomState & + Hacspec_ovn.Schnorr.Random_oracle.t_Random) = + Hacspec_ovn.Schnorr.Random_oracle.random_oracle_query v_QUERIES + (prod_assoc (h, a) <: Hacspec_ovn.Schnorr.Random_oracle.t_Query) + in + verify h a e z + +let t_Relation = (t_G & t_Q) + +let v_Commit (h: t_G) (w: t_Q) : t_G = + let r:Hacspec_ovn.Schnorr.Random_oracle.t_Random = + Hacspec_ovn.Schnorr.Random_oracle.sample_uniform + in + let commit:Hacspec_ovn.Schnorr.Random_oracle.t_Random = r in + Hacspec_lib.Traits.Integer.v_ONE + +let v_Response: Rust_primitives.Hax.t_Never = + Rust_primitives.Hax.failure "AST import:Fatal error: something we considered as impossible occurred! Please report this by submitting an issue on GitHub!\nDetails: [import_thir:literal] got an error literal: this means the Rust compiler or Hax's frontend probably reported errors above.\n" + "{ Types.attributes = [];\n contents =\n Types.Literal {\n lit =\n { Types.node = Types.Err;\n span =\n { Types.filename = (Types.Real (Types.LocalPath \"ovn/src/ovn.rs\"));\n hi = { Types.col = 0; line = 1 }; lo = { Types.col = 0; line = 1 } }\n };\n neg = false};\n hir_id = None;\n span =\n { Types.filename = (Types.Real (Types.LocalPath \"ovn/src/schnorr.rs\"));\n hi = { Types.col = 80; line = 102 }; lo = { Types.col = 0; line = 102 } };\n ty = Types.Never }" + +let fiat_shamir_run: Rust_primitives.Hax.t_Never = + Rust_primitives.Hax.failure "AST import:Fatal error: something we considered as impossible occurred! Please report this by submitting an issue on GitHub!\nDetails: [import_thir:literal] got an error literal: this means the Rust compiler or Hax's frontend probably reported errors above.\n" + "{ Types.attributes = [];\n contents =\n Types.Literal {\n lit =\n { Types.node = Types.Err;\n span =\n { Types.filename = (Types.Real (Types.LocalPath \"ovn/src/ovn.rs\"));\n hi = { Types.col = 0; line = 1 }; lo = { Types.col = 0; line = 1 } }\n };\n neg = false};\n hir_id = None;\n span =\n { Types.filename = (Types.Real (Types.LocalPath \"ovn/src/schnorr.rs\"));\n hi = { Types.col = 47; line = 108 }; lo = { Types.col = 0; line = 108 } };\n ty = Types.Never }" \ No newline at end of file diff --git a/ovn/proofs/fstar/extraction/Hacspec_ovn.fst b/ovn/proofs/fstar/extraction/Hacspec_ovn.fst new file mode 100644 index 0000000..34fac55 --- /dev/null +++ b/ovn/proofs/fstar/extraction/Hacspec_ovn.fst @@ -0,0 +1,9 @@ +module Hacspec_ovn +#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" +open Core + +let construct: Prims.unit = () + +let vote: Prims.unit = () + +let exec: Prims.unit = () \ No newline at end of file diff --git a/ovn/proofs/ssprove/extraction/.Core.aux b/ovn/proofs/ssprove/extraction/.Core.aux new file mode 100644 index 0000000..2eb7592 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/.Core.aux @@ -0,0 +1,2 @@ +COQAUX1 265cab0b506d10f1ada8bbe5826ce1eb /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Core.v +0 0 vo_compile_time "5.626" diff --git a/ovn/proofs/ssprove/extraction/.Hacspec_lib.aux b/ovn/proofs/ssprove/extraction/.Hacspec_lib.aux new file mode 100644 index 0000000..0bbc24b --- /dev/null +++ b/ovn/proofs/ssprove/extraction/.Hacspec_lib.aux @@ -0,0 +1,5 @@ +COQAUX1 e5f7624baf82764e7a994b8423d3c6dc /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Hacspec_lib.v +0 0 VernacProof "tac:no using:no" +13358 13366 proof_build_time "0.018" +13358 13366 proof_check_time "0.011" +0 0 vo_compile_time "1.195" diff --git a/ovn/proofs/ssprove/extraction/.Hacspec_ovn.aux b/ovn/proofs/ssprove/extraction/.Hacspec_ovn.aux new file mode 100644 index 0000000..c189c7b --- /dev/null +++ b/ovn/proofs/ssprove/extraction/.Hacspec_ovn.aux @@ -0,0 +1 @@ +COQAUX1 2601f3a4885d20ca193173741799192e /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Hacspec_ovn.v diff --git a/ovn/proofs/ssprove/extraction/.Makefile.d b/ovn/proofs/ssprove/extraction/.Makefile.d new file mode 100644 index 0000000..90e7173 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/.Makefile.d @@ -0,0 +1,9 @@ +Hacspec_lib.vo Hacspec_lib.glob Hacspec_lib.v.beautified Hacspec_lib.required_vo: Hacspec_lib.v +Hacspec_lib.vio: Hacspec_lib.v +Hacspec_lib.vos Hacspec_lib.vok Hacspec_lib.required_vos: Hacspec_lib.v +Core.vo Core.glob Core.v.beautified Core.required_vo: Core.v +Core.vio: Core.v +Core.vos Core.vok Core.required_vos: Core.v +Hacspec_ovn.vo Hacspec_ovn.glob Hacspec_ovn.v.beautified Hacspec_ovn.required_vo: Hacspec_ovn.v Core.vo Hacspec_lib.vo +Hacspec_ovn.vio: Hacspec_ovn.v Core.vio Hacspec_lib.vio +Hacspec_ovn.vos Hacspec_ovn.vok Hacspec_ovn.required_vos: Hacspec_ovn.v Core.vos Hacspec_lib.vos diff --git a/ovn/proofs/ssprove/extraction/Core.glob b/ovn/proofs/ssprove/extraction/Core.glob new file mode 100644 index 0000000..1234145 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Core.glob @@ -0,0 +1,877 @@ +DIGEST 265cab0b506d10f1ada8bbe5826ce1eb +FExamples.Core +R74:84 Hacspec.Hacspec_Lib <> <> lib +R112:117 Coq.ZArith.ZArith <> <> lib +R127:144 Coq.Lists.List ListNotations <> mod +R206:208 Coq.micromega.Lia <> <> lib +R226:259 Coq.Logic.FunctionalExtensionality <> <> lib +R277:283 Coq.Bool.Sumbool <> <> lib +R316:322 mathcomp.ssreflect.fintype <> <> lib +R352:362 Crypt.choice_type <> <> lib +R364:370 Crypt.Package <> <> lib +R372:378 Crypt.Prelude <> <> lib +R388:402 Crypt.package.pkg_notation PackageNotation <> mod +R437:439 extructures.ord <> <> lib +R441:444 extructures.fset <> <> lib +R446:449 extructures.fmap <> <> lib +R482:485 mathcomp.zify.ssrZ <> <> lib +R487:490 mathcomp.word.word <> <> lib +R520:523 Jasmin.word <> <> lib +R551:556 Coq.ZArith.ZArith <> <> lib +R558:561 Coq.Lists.List <> <> lib +R571:583 Coq.Lists.List ListNotations <> mod +R615:628 Hacspec.ChoiceEquality <> <> lib +R659:673 Hacspec.LocationUtility <> <> lib +R704:725 Hacspec.Hacspec_Lib_Comparable <> <> lib +R756:770 Hacspec.Hacspec_Lib_Pre <> <> lib +R801:811 Hacspec.Hacspec_Lib <> <> lib +R970:990 mathcomp.ssreflect.choice Choice.Exports <> mod +ind 1000:1008 <> t_TryFrom +constr 1031:1037 <> TryFrom +rec 1000:1008 <> t_TryFrom +proj 1031:1037 <> TryFrom +R1015:1025 Crypt.choice_type <> choice_type ind +binder 1011:1011 <> A:1 +R1042:1045 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1041:1041 Examples.Core <> A:1 var +R1046:1046 Examples.Core <> A:1 var +ind 1055:1060 <> t_Into +constr 1083:1086 <> Into +rec 1055:1060 <> t_Into +proj 1083:1086 <> Into +R1067:1077 Crypt.choice_type <> choice_type ind +binder 1063:1063 <> A:4 +R1091:1094 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1090:1090 Examples.Core <> A:4 var +R1095:1095 Examples.Core <> A:4 var +ind 1104:1114 <> t_PartialEq +constr 1137:1145 <> PartialEq +rec 1104:1114 <> t_PartialEq +proj 1137:1145 <> PartialEq +R1121:1131 Crypt.choice_type <> choice_type ind +binder 1117:1117 <> A:7 +R1150:1153 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1149:1149 Examples.Core <> A:7 var +R1154:1154 Examples.Core <> A:7 var +ind 1163:1168 <> t_Copy +constr 1191:1194 <> Copy +rec 1163:1168 <> t_Copy +proj 1191:1194 <> Copy +R1175:1185 Crypt.choice_type <> choice_type ind +binder 1171:1171 <> A:10 +R1199:1202 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1198:1198 Examples.Core <> A:10 var +R1203:1203 Examples.Core <> A:10 var +ind 1212:1218 <> t_Clone +constr 1241:1245 <> Clone +rec 1212:1218 <> t_Clone +proj 1241:1245 <> Clone +R1225:1235 Crypt.choice_type <> choice_type ind +binder 1221:1221 <> A:13 +R1250:1253 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1249:1249 Examples.Core <> A:13 var +R1254:1254 Examples.Core <> A:13 var +ind 1263:1269 <> t_Sized +constr 1292:1296 <> Sized +rec 1263:1269 <> t_Sized +proj 1292:1296 <> Sized +R1276:1286 Crypt.choice_type <> choice_type ind +binder 1272:1272 <> A:16 +R1301:1304 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1300:1300 Examples.Core <> A:16 var +R1305:1305 Examples.Core <> A:16 var +def 1319:1326 <> t_Option +R1341:1344 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1330:1340 Crypt.choice_type <> choice_type ind +R1345:1355 Crypt.choice_type <> choice_type ind +R1360:1367 Crypt.choice_type <> chOption constr +ind 1380:1386 <> vec_typ +constr 1393:1400 <> t_Global +def 1414:1418 <> t_Vec +R1433:1436 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1422:1432 Crypt.choice_type <> choice_type ind +R1444:1447 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1437:1443 Examples.Core <> vec_typ ind +R1448:1458 Crypt.choice_type <> choice_type ind +binder 1467:1467 <> A:21 +R1474:1479 Crypt.choice_type <> chList constr +R1481:1481 Examples.Core <> A:21 var +rec 1491:1499 <> t_Default +proj 1508:1514 <> default +binder 1501:1501 <> A:22 +R1518:1518 Examples.Core <> A:22 var +inst 1543:1551 <> bool_copy +R1555:1560 Examples.Core <> t_Copy class +R1562:1566 Crypt.package.pkg_notation PackageNotation ::package_scope:'''bool' not +R1572:1575 Examples.Core <> Copy def +binder 1577:1577 <> x:25 +R1582:1582 Examples.Core <> x:25 var +inst 1605:1614 <> bool_clone +R1618:1624 Examples.Core <> t_Clone class +R1626:1630 Crypt.package.pkg_notation PackageNotation ::package_scope:'''bool' not +R1636:1640 Examples.Core <> Clone def +binder 1642:1642 <> x:26 +R1647:1647 Examples.Core <> x:26 var +inst 1670:1679 <> bool_sized +R1683:1689 Examples.Core <> t_Sized class +R1691:1695 Crypt.package.pkg_notation PackageNotation ::package_scope:'''bool' not +R1701:1705 Examples.Core <> Sized def +binder 1707:1707 <> x:27 +R1712:1712 Examples.Core <> x:27 var +def 1728:1732 <> ilog2 +binder 1735:1736 <> WS:28 +binder 1740:1740 <> L:29 +binder 1742:1742 <> I:30 +R1750:1753 Hacspec.ChoiceEquality <> both rec +R1760:1762 Hacspec.Hacspec_Lib_Pre <> int syndef +R1764:1765 Examples.Core <> WS:28 var +R1757:1757 Examples.Core <> I:30 var +R1755:1755 Examples.Core <> L:29 var +binder 1746:1746 <> x:31 +R1771:1774 Hacspec.ChoiceEquality <> both rec +R1781:1783 Hacspec.Hacspec_Lib_Pre <> int syndef +R1785:1786 Examples.Core <> WS:28 var +R1778:1778 Examples.Core <> I:30 var +R1776:1776 Examples.Core <> L:29 var +R1792:1792 Examples.Core <> x:31 var +def 1818:1824 <> collect +binder 1827:1827 <> A:32 +binder 1831:1831 <> L:33 +binder 1833:1833 <> I:34 +R1841:1844 Hacspec.ChoiceEquality <> both rec +R1851:1856 Crypt.choice_type <> chList constr +R1858:1858 Examples.Core <> A:32 var +R1848:1848 Examples.Core <> I:34 var +R1846:1846 Examples.Core <> L:33 var +binder 1837:1837 <> x:35 +R1864:1867 Hacspec.ChoiceEquality <> both rec +R1874:1878 Examples.Core <> t_Vec def +R1880:1880 Examples.Core <> A:32 var +R1882:1889 Examples.Core <> t_Global constr +R1871:1871 Examples.Core <> I:34 var +R1869:1869 Examples.Core <> L:33 var +R1895:1895 Examples.Core <> x:35 var +def 1912:1925 <> swap_both_list +binder 1928:1928 <> A:36 +binder 1930:1930 <> L:37 +binder 1932:1932 <> I:38 +R1940:1943 Coq.Init.Datatypes <> list ind +R1946:1949 Hacspec.ChoiceEquality <> both rec +R1955:1955 Examples.Core <> A:36 var +R1953:1953 Examples.Core <> I:38 var +R1951:1951 Examples.Core <> L:37 var +binder 1936:1936 <> x:39 +R1961:1964 Hacspec.ChoiceEquality <> both rec +R1971:1976 Crypt.choice_type <> chList constr +R1986:1999 Examples.Core <> swap_both_list:42 def +R2001:2001 Examples.Core <> x:41 var +R2009:2022 Coq.Lists.List <> fold_left def +R2169:2176 Hacspec.ChoiceEquality <> ret_both def +R2184:2189 Crypt.choice_type <> chList constr +R2179:2180 Coq.Lists.List ListNotations ::list_scope:'['_']' not +R2034:2037 Hacspec.ChoiceEquality <> both rec +R2044:2049 Crypt.choice_type <> chList constr +binder 2030:2030 <> x:43 +binder 2055:2055 <> y:44 +R2063:2071 Hacspec.ChoiceEquality <> bind_both def +binder 2080:2081 <> x':45 +R2089:2097 Hacspec.ChoiceEquality <> bind_both def +binder 2106:2107 <> y':46 +R2130:2137 Hacspec.ChoiceEquality <> ret_both def +R2153:2158 Crypt.choice_type <> chList constr +R2143:2146 Coq.Init.Datatypes <> ::list_scope:x_'::'_x not +R2141:2142 Examples.Core <> y':46 var +R2147:2148 Examples.Core <> x':45 var +R2099:2099 Examples.Core <> y:44 var +R2073:2073 Examples.Core <> x:43 var +def 2284:2293 <> match_list +R2302:2312 Crypt.choice_type <> choice_type ind +binder 2296:2296 <> A:47 +binder 2298:2298 <> B:48 +binder 2316:2316 <> L:49 +binder 2318:2318 <> I:50 +R2326:2329 Hacspec.ChoiceEquality <> both rec +R2336:2341 Crypt.choice_type <> chList constr +R2343:2343 Examples.Core <> A:47 var +R2333:2333 Examples.Core <> I:50 var +R2331:2331 Examples.Core <> L:49 var +binder 2322:2322 <> x:51 +R2358:2361 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R2352:2355 Coq.Init.Datatypes <> list ind +R2357:2357 Examples.Core <> A:47 var +R2362:2362 Examples.Core <> B:48 var +binder 2348:2348 <> f:52 +R2367:2370 Hacspec.ChoiceEquality <> both rec +R2383:2392 Examples.Core <> match_list:56 def +R2396:2396 Examples.Core <> f:54 var +R2394:2394 Examples.Core <> x:55 var +R2403:2411 Hacspec.ChoiceEquality <> bind_both def +binder 2420:2421 <> x':57 +R2426:2433 Hacspec.ChoiceEquality <> ret_both def +R2438:2439 Examples.Core <> x':57 var +def 2531:2533 <> map +binder 2536:2536 <> A:58 +binder 2538:2538 <> B:59 +binder 2542:2542 <> L:60 +binder 2544:2544 <> I:61 +R2552:2555 Hacspec.ChoiceEquality <> both rec +R2562:2567 Crypt.choice_type <> chList constr +R2569:2569 Examples.Core <> A:58 var +R2559:2559 Examples.Core <> I:61 var +R2557:2557 Examples.Core <> L:60 var +binder 2548:2548 <> x:62 +R2589:2592 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R2579:2582 Hacspec.ChoiceEquality <> both rec +R2588:2588 Examples.Core <> A:58 var +R2586:2586 Examples.Core <> I:61 var +R2584:2584 Examples.Core <> L:60 var +R2593:2596 Hacspec.ChoiceEquality <> both rec +R2602:2602 Examples.Core <> B:59 var +R2600:2600 Examples.Core <> I:61 var +R2598:2598 Examples.Core <> L:60 var +binder 2575:2575 <> f:63 +R2607:2610 Hacspec.ChoiceEquality <> both rec +R2617:2622 Crypt.choice_type <> chList constr +R2632:2634 Examples.Core <> map:67 def +R2638:2638 Examples.Core <> f:65 var +R2636:2636 Examples.Core <> x:66 var +R2645:2653 Hacspec.ChoiceEquality <> bind_both def +binder 2662:2663 <> x':68 +R2668:2681 Examples.Core <> swap_both_list def +R2684:2691 Coq.Lists.List <> map def +R2719:2720 Examples.Core <> x':68 var +binder 2698:2698 <> y:69 +R2706:2713 Hacspec.ChoiceEquality <> ret_both def +R2715:2715 Examples.Core <> y:69 var +def 2813:2818 <> cloned +binder 2821:2821 <> A:70 +binder 2825:2825 <> L:71 +binder 2827:2827 <> I:72 +R2835:2838 Hacspec.ChoiceEquality <> both rec +R2845:2850 Crypt.choice_type <> chList constr +R2852:2852 Examples.Core <> A:70 var +R2842:2842 Examples.Core <> I:72 var +R2840:2840 Examples.Core <> L:71 var +binder 2831:2831 <> x:73 +R2858:2861 Hacspec.ChoiceEquality <> both rec +R2868:2873 Crypt.choice_type <> chList constr +R2875:2875 Examples.Core <> A:70 var +R2865:2865 Examples.Core <> I:72 var +R2863:2863 Examples.Core <> L:71 var +R2881:2881 Examples.Core <> x:73 var +def 2895:2898 <> iter +binder 2901:2901 <> A:74 +binder 2903:2903 <> L:75 +binder 2905:2905 <> I:76 +R2913:2916 Hacspec.ChoiceEquality <> both rec +R2923:2925 Hacspec.Hacspec_Lib_Pre <> seq def +R2927:2927 Examples.Core <> A:74 var +R2920:2920 Examples.Core <> I:76 var +R2918:2918 Examples.Core <> L:75 var +binder 2909:2909 <> x:77 +R2933:2936 Hacspec.ChoiceEquality <> both rec +R2943:2948 Crypt.choice_type <> chList constr +R2958:2961 Examples.Core <> iter:80 def +R2963:2963 Examples.Core <> x:79 var +R2970:2978 Hacspec.ChoiceEquality <> bind_both def +binder 2987:2988 <> x':81 +R2993:3000 Hacspec.ChoiceEquality <> ret_both def +R3022:3027 Crypt.choice_type <> chList constr +R3003:3013 Hacspec.Hacspec_Lib_Pre <> seq_to_list def +R3017:3018 Examples.Core <> x':81 var +def 3122:3126 <> dedup +binder 3129:3129 <> A:82 +binder 3133:3133 <> L:83 +binder 3135:3135 <> I:84 +R3143:3146 Hacspec.ChoiceEquality <> both rec +R3153:3157 Examples.Core <> t_Vec def +R3159:3159 Examples.Core <> A:82 var +R3161:3168 Examples.Core <> t_Global constr +R3150:3150 Examples.Core <> I:84 var +R3148:3148 Examples.Core <> L:83 var +binder 3139:3139 <> x:85 +R3174:3177 Hacspec.ChoiceEquality <> both rec +R3184:3188 Examples.Core <> t_Vec def +R3190:3190 Examples.Core <> A:82 var +R3192:3199 Examples.Core <> t_Global constr +R3181:3181 Examples.Core <> I:84 var +R3179:3179 Examples.Core <> L:83 var +R3205:3205 Examples.Core <> x:85 var +def 3220:3227 <> t_String +R3232:3256 Coq.Strings.String <> string ind +def 3270:3272 <> new +binder 3275:3275 <> A:86 +binder 3277:3277 <> L:87 +binder 3279:3279 <> I:88 +R3284:3287 Hacspec.ChoiceEquality <> both rec +R3294:3298 Examples.Core <> t_Vec def +R3300:3300 Examples.Core <> A:86 var +R3302:3309 Examples.Core <> t_Global constr +R3291:3291 Examples.Core <> I:88 var +R3289:3289 Examples.Core <> L:87 var +R3315:3322 Hacspec.ChoiceEquality <> ret_both def +R3330:3335 Crypt.choice_type <> chList constr +R3337:3337 Examples.Core <> A:86 var +R3325:3326 Coq.Lists.List ListNotations ::list_scope:'['_']' not +def 3353:3361 <> enumerate +binder 3364:3364 <> A:89 +binder 3368:3368 <> L:90 +binder 3370:3370 <> I:91 +R3378:3381 Hacspec.ChoiceEquality <> both rec +R3388:3392 Examples.Core <> t_Vec def +R3394:3394 Examples.Core <> A:89 var +R3396:3403 Examples.Core <> t_Global constr +R3385:3385 Examples.Core <> I:91 var +R3383:3383 Examples.Core <> L:90 var +binder 3374:3374 <> x:92 +R3409:3412 Hacspec.ChoiceEquality <> both rec +R3419:3423 Examples.Core <> t_Vec def +R3425:3425 Examples.Core <> A:89 var +R3427:3434 Examples.Core <> t_Global constr +R3416:3416 Examples.Core <> I:91 var +R3414:3414 Examples.Core <> L:90 var +R3440:3440 Examples.Core <> x:92 var +def 3455:3462 <> t_Result +binder 3464:3464 <> A:93 +binder 3466:3466 <> B:94 +R3471:3476 Hacspec.Hacspec_Lib_Pre <> result def +R3478:3478 Examples.Core <> B:94 var +R3480:3480 Examples.Core <> A:93 var +ind 3493:3503 <> ControlFlow +constr 3552:3571 <> ControlFlow_Continue +constr 3594:3610 <> ControlFlow_Break +binder 3506:3506 <> L:95 +binder 3508:3508 <> I:96 +R3516:3526 Crypt.choice_type <> choice_type ind +binder 3512:3512 <> A:97 +R3534:3544 Crypt.choice_type <> choice_type ind +binder 3530:3530 <> B:98 +R3580:3583 Hacspec.ChoiceEquality <> both rec +R3589:3589 Examples.Core <> A:97 var +R3587:3587 Examples.Core <> I:96 var +R3585:3585 Examples.Core <> L:95 var +binder 3574:3576 <> val:101 +R3619:3622 Hacspec.ChoiceEquality <> both rec +R3628:3628 Examples.Core <> B:98 var +R3626:3626 Examples.Core <> I:96 var +R3624:3624 Examples.Core <> L:95 var +binder 3613:3615 <> val:102 +def 3644:3646 <> run +R3655:3665 Crypt.choice_type <> choice_type ind +binder 3649:3649 <> A:103 +binder 3651:3651 <> B:104 +binder 3669:3669 <> L:105 +binder 3671:3671 <> I:106 +R3679:3689 Examples.Core <> ControlFlow ind +R3693:3693 Examples.Core <> B:104 var +R3691:3691 Examples.Core <> A:103 var +binder 3675:3675 <> x:107 +R3698:3701 Hacspec.ChoiceEquality <> both rec +R3708:3715 Examples.Core <> t_Result def +R3717:3717 Examples.Core <> A:103 var +R3719:3719 Examples.Core <> B:104 var +R3705:3705 Examples.Core <> I:106 var +R3703:3703 Examples.Core <> L:105 var +R3733:3733 Examples.Core <> x:107 var +R3744:3763 Examples.Core <> ControlFlow_Continue constr +R3770:3771 Hacspec.Hacspec_Lib <> Ok def +R3779:3795 Examples.Core <> ControlFlow_Break constr +R3802:3804 Hacspec.Hacspec_Lib <> Err def +def 4693:4703 <> t_ErrorKind +R4707:4717 Crypt.choice_type <> choice_type ind +R4722:4726 Crypt.choice_type <> chFin constr +R4729:4733 Crypt.Prelude <> mkpos constr +def 4750:4789 <> ErrorKind_SerializedProofSizeIsIncorrect +binder 4792:4792 <> L:109 +binder 4794:4794 <> I:110 +R4799:4802 Hacspec.ChoiceEquality <> both rec +R4808:4818 Examples.Core <> t_ErrorKind def +R4806:4806 Examples.Core <> I:110 var +R4804:4804 Examples.Core <> L:109 var +R4823:4830 Hacspec.ChoiceEquality <> ret_both def +R4873:4883 Examples.Core <> t_ErrorKind def +R4833:4847 mathcomp.ssreflect.fintype <> Ordinal constr +R4863:4869 Coq.Init.Logic <> eq_refl constr +def 4898:4927 <> ErrorKind_NotEnoughHelperNodes +binder 4930:4930 <> L:111 +binder 4932:4932 <> I:112 +R4937:4940 Hacspec.ChoiceEquality <> both rec +R4946:4956 Examples.Core <> t_ErrorKind def +R4944:4944 Examples.Core <> I:112 var +R4942:4942 Examples.Core <> L:111 var +R4961:4968 Hacspec.ChoiceEquality <> ret_both def +R5011:5021 Examples.Core <> t_ErrorKind def +R4971:4985 mathcomp.ssreflect.fintype <> Ordinal constr +R5001:5007 Coq.Init.Logic <> eq_refl constr +def 5036:5064 <> ErrorKind_HashConversionError +binder 5067:5067 <> L:113 +binder 5069:5069 <> I:114 +R5074:5077 Hacspec.ChoiceEquality <> both rec +R5083:5093 Examples.Core <> t_ErrorKind def +R5081:5081 Examples.Core <> I:114 var +R5079:5079 Examples.Core <> L:113 var +R5098:5105 Hacspec.ChoiceEquality <> ret_both def +R5148:5158 Examples.Core <> t_ErrorKind def +R5108:5122 mathcomp.ssreflect.fintype <> Ordinal constr +R5138:5144 Coq.Init.Logic <> eq_refl constr +def 5173:5212 <> ErrorKind_NotEnoughHashesToCalculateRoot +binder 5215:5215 <> L:115 +binder 5217:5217 <> I:116 +R5222:5225 Hacspec.ChoiceEquality <> both rec +R5231:5241 Examples.Core <> t_ErrorKind def +R5229:5229 Examples.Core <> I:116 var +R5227:5227 Examples.Core <> L:115 var +R5246:5253 Hacspec.ChoiceEquality <> ret_both def +R5296:5306 Examples.Core <> t_ErrorKind def +R5256:5270 mathcomp.ssreflect.fintype <> Ordinal constr +R5286:5292 Coq.Init.Logic <> eq_refl constr +def 5321:5356 <> ErrorKind_LeavesIndicesCountMismatch +binder 5359:5359 <> L:117 +binder 5361:5361 <> I:118 +R5366:5369 Hacspec.ChoiceEquality <> both rec +R5375:5385 Examples.Core <> t_ErrorKind def +R5373:5373 Examples.Core <> I:118 var +R5371:5371 Examples.Core <> L:117 var +R5390:5397 Hacspec.ChoiceEquality <> ret_both def +R5440:5450 Examples.Core <> t_ErrorKind def +R5400:5414 mathcomp.ssreflect.fintype <> Ordinal constr +R5430:5436 Coq.Init.Logic <> eq_refl constr +def 5643:5649 <> t_Error +R5653:5663 Crypt.choice_type <> choice_type ind +R5679:5682 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R5668:5678 Examples.Core <> t_ErrorKind def +R5683:5693 Examples.Core <> t_ErrorKind def +def 5735:5745 <> Build_Error +binder 5748:5748 <> L:119 +binder 5750:5750 <> I:120 +R5764:5767 Hacspec.ChoiceEquality <> both rec +R5773:5783 Examples.Core <> t_ErrorKind def +R5771:5771 Examples.Core <> I:120 var +R5769:5769 Examples.Core <> L:119 var +binder 5754:5760 <> f_kind1:121 +R5797:5800 Hacspec.ChoiceEquality <> both rec +R5806:5816 Examples.Core <> t_ErrorKind def +R5804:5804 Examples.Core <> I:120 var +R5802:5802 Examples.Core <> L:119 var +binder 5787:5793 <> f_kind2:122 +R5821:5824 Hacspec.ChoiceEquality <> both rec +R5830:5836 Examples.Core <> t_Error def +R5843:5853 Examples.Core <> Build_Error:126 def +R5882:5882 Examples.Core <> y:125 var +R5867:5867 Examples.Core <> x:124 var +R5890:5898 Hacspec.ChoiceEquality <> bind_both def +binder 5907:5908 <> x':127 +R5915:5923 Hacspec.ChoiceEquality <> bind_both def +binder 5932:5933 <> y':128 +R5955:5962 Hacspec.ChoiceEquality <> ret_both def +R5976:5982 Examples.Core <> t_Error def +R5965:5965 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not +R5968:5969 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not +R5972:5972 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not +R5966:5967 Examples.Core <> x':127 var +R5970:5971 Examples.Core <> y':128 var +def 6075:6081 <> f_kind1 +R6088:6094 Examples.Core <> t_Error def +binder 6084:6084 <> v:129 +R6100:6102 Coq.Init.Datatypes <> fst def +R6104:6104 Examples.Core <> v:129 var +def 6118:6124 <> f_kind2 +R6131:6137 Examples.Core <> t_Error def +binder 6127:6127 <> v:130 +R6143:6145 Coq.Init.Datatypes <> snd def +R6147:6147 Examples.Core <> v:130 var +def 6237:6243 <> t_Drain +R6258:6261 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R6247:6257 Crypt.choice_type <> choice_type ind +R6269:6272 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R6262:6268 Examples.Core <> vec_typ ind +R6273:6283 Crypt.choice_type <> choice_type ind +R6288:6292 Examples.Core <> t_Vec def +ind 6305:6311 <> t_Range +constr 6316:6324 <> RangeFull +def 6337:6341 <> drain +binder 6353:6353 <> L:133 +binder 6355:6355 <> I:134 +binder 6357:6357 <> A:135 +R6388:6391 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R6361:6364 Hacspec.ChoiceEquality <> both rec +R6371:6375 Examples.Core <> t_Vec def +R6377:6377 Examples.Core <> A:135 var +R6379:6386 Examples.Core <> t_Global constr +R6368:6368 Examples.Core <> I:134 var +R6366:6366 Examples.Core <> L:133 var +R6399:6402 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R6392:6398 Examples.Core <> t_Range ind +R6403:6406 Hacspec.ChoiceEquality <> both rec +R6431:6434 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R6413:6419 Examples.Core <> t_Drain def +R6421:6421 Examples.Core <> A:135 var +R6423:6430 Examples.Core <> t_Global constr +R6435:6439 Examples.Core <> t_Vec def +R6441:6441 Examples.Core <> A:135 var +R6443:6450 Examples.Core <> t_Global constr +R6410:6410 Examples.Core <> I:134 var +R6408:6408 Examples.Core <> L:133 var +R6458:6462 Examples.Core <> drain:138 def +R6464:6464 Examples.Core <> x:137 var +R6475:6483 Hacspec.ChoiceEquality <> bind_both def +binder 6492:6493 <> x':139 +R6498:6505 Hacspec.ChoiceEquality <> ret_both def +R6538:6541 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R6520:6526 Examples.Core <> t_Drain def +R6530:6537 Examples.Core <> t_Global constr +R6542:6546 Examples.Core <> t_Vec def +R6550:6557 Examples.Core <> t_Global constr +R6508:6508 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not +R6511:6512 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not +R6515:6515 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not +R6509:6510 Examples.Core <> x':139 var +R6513:6514 Coq.Lists.List ListNotations ::list_scope:'['_']' not +syndef 6648:6652 <> t_Rev +R6657:6658 Coq.Init.Datatypes <> id def +def 6671:6673 <> rev +binder 6676:6676 <> L:140 +binder 6678:6678 <> I:141 +binder 6680:6680 <> A:142 +R6688:6691 Hacspec.ChoiceEquality <> both rec +R6698:6703 Crypt.choice_type <> chList constr +R6705:6705 Examples.Core <> A:142 var +R6695:6695 Examples.Core <> I:141 var +R6693:6693 Examples.Core <> L:140 var +binder 6684:6684 <> x:143 +R6711:6714 Hacspec.ChoiceEquality <> both rec +R6721:6726 Crypt.choice_type <> chList constr +R6734:6736 Examples.Core <> rev:146 def +R6738:6738 Examples.Core <> x:145 var +R6743:6751 Hacspec.ChoiceEquality <> bind_both def +binder 6760:6760 <> x:147 +R6765:6772 Hacspec.ChoiceEquality <> ret_both def +R6788:6793 Crypt.choice_type <> chList constr +R6775:6782 Coq.Lists.List <> rev def +R6784:6784 Examples.Core <> x:147 var +def 6888:6890 <> pop +binder 6893:6893 <> L:148 +binder 6895:6895 <> I:149 +binder 6897:6897 <> A:150 +R6921:6924 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R6902:6905 Hacspec.ChoiceEquality <> both rec +R6912:6917 Crypt.choice_type <> chList constr +R6919:6919 Examples.Core <> A:150 var +R6909:6909 Examples.Core <> I:149 var +R6907:6907 Examples.Core <> L:148 var +R6925:6928 Hacspec.ChoiceEquality <> both rec +R6945:6948 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R6935:6942 Crypt.choice_type <> chOption constr +R6944:6944 Examples.Core <> A:150 var +R6949:6953 Examples.Core <> t_Vec def +R6955:6955 Examples.Core <> A:150 var +R6958:6965 Examples.Core <> t_Global constr +R6932:6932 Examples.Core <> I:149 var +R6930:6930 Examples.Core <> L:148 var +R6974:6983 Hacspec.ChoiceEquality <> lift1_both def +R6995:7000 Crypt.choice_type <> chList constr +R7002:7002 Examples.Core <> A:150 var +binder 6991:6991 <> x:151 +R7051:7054 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R7041:7048 Crypt.choice_type <> chOption constr +R7050:7050 Examples.Core <> A:150 var +R7055:7059 Examples.Core <> t_Vec def +R7061:7061 Examples.Core <> A:150 var +R7064:7071 Examples.Core <> t_Global constr +R7008:7008 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not +R7024:7026 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not +R7036:7036 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not +R7009:7021 Coq.Lists.List <> hd_error def +R7023:7023 Examples.Core <> x:151 var +R7027:7033 Coq.Lists.List <> tl def +R7035:7035 Examples.Core <> x:151 var +def 7089:7092 <> push +binder 7095:7096 <> L1:152 +binder 7098:7099 <> L2:153 +binder 7101:7102 <> I1:154 +binder 7104:7105 <> I2:155 +binder 7107:7107 <> A:156 +R7141:7144 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R7112:7115 Hacspec.ChoiceEquality <> both rec +R7124:7128 Examples.Core <> t_Vec def +R7130:7130 Examples.Core <> A:156 var +R7132:7139 Examples.Core <> t_Global constr +R7120:7121 Examples.Core <> I1:154 var +R7117:7118 Examples.Core <> L1:152 var +R7157:7160 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R7145:7148 Hacspec.ChoiceEquality <> both rec +R7156:7156 Examples.Core <> A:156 var +R7153:7154 Examples.Core <> I2:155 var +R7150:7151 Examples.Core <> L2:153 var +R7161:7164 Hacspec.ChoiceEquality <> both rec +R7191:7195 Examples.Core <> t_Vec def +R7197:7197 Examples.Core <> A:156 var +R7200:7207 Examples.Core <> t_Global constr +R7181:7185 extructures.fset <> ::fset_scope:x_':|:'_x not +R7179:7180 Examples.Core <> I1:154 var +R7186:7187 Examples.Core <> I2:155 var +R7169:7173 extructures.fset <> ::fset_scope:x_':|:'_x not +R7167:7168 Examples.Core <> L1:152 var +R7174:7175 Examples.Core <> L2:153 var +R7216:7225 Hacspec.ChoiceEquality <> lift2_both def +R7238:7243 Crypt.choice_type <> chList constr +R7245:7245 Examples.Core <> A:156 var +binder 7234:7234 <> x:157 +binder 7248:7248 <> y:158 +R7262:7267 Crypt.choice_type <> chList constr +R7269:7269 Examples.Core <> A:156 var +R7254:7257 Coq.Init.Datatypes <> ::list_scope:x_'::'_x not +R7253:7253 Examples.Core <> y:158 var +R7258:7258 Examples.Core <> x:157 var +syndef 7283:7293 <> Option_Some +R7298:7301 Coq.Init.Datatypes <> Some constr +def 7315:7320 <> append +binder 7323:7324 <> L1:159 +binder 7326:7327 <> L2:160 +binder 7329:7330 <> I1:161 +binder 7332:7333 <> I2:162 +R7341:7351 Crypt.choice_type <> choice_type ind +binder 7337:7337 <> A:163 +R7359:7362 Hacspec.ChoiceEquality <> both rec +R7371:7376 Crypt.choice_type <> chList constr +R7378:7378 Examples.Core <> A:163 var +R7367:7368 Examples.Core <> I1:161 var +R7364:7365 Examples.Core <> L1:159 var +binder 7355:7355 <> l:164 +R7387:7390 Hacspec.ChoiceEquality <> both rec +R7399:7404 Crypt.choice_type <> chList constr +R7406:7406 Examples.Core <> A:163 var +R7395:7396 Examples.Core <> I2:162 var +R7392:7393 Examples.Core <> L2:160 var +binder 7383:7383 <> x:165 +R7412:7415 Hacspec.ChoiceEquality <> both rec +R7450:7453 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R7442:7447 Crypt.choice_type <> chList constr +R7449:7449 Examples.Core <> A:163 var +R7454:7459 Crypt.choice_type <> chList constr +R7461:7461 Examples.Core <> A:163 var +R7432:7436 extructures.fset <> ::fset_scope:x_':|:'_x not +R7430:7431 Examples.Core <> I2:162 var +R7437:7438 Examples.Core <> I1:161 var +R7420:7424 extructures.fset <> ::fset_scope:x_':|:'_x not +R7418:7419 Examples.Core <> L2:160 var +R7425:7426 Examples.Core <> L1:159 var +R7469:7478 Hacspec.ChoiceEquality <> lift2_both def +R7558:7558 Examples.Core <> l:164 var +R7556:7556 Examples.Core <> x:165 var +R7490:7495 Crypt.choice_type <> chList constr +R7497:7497 Examples.Core <> A:163 var +binder 7486:7486 <> x:166 +R7505:7510 Crypt.choice_type <> chList constr +R7512:7512 Examples.Core <> A:163 var +binder 7501:7501 <> y:167 +R7542:7545 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R7534:7539 Crypt.choice_type <> chList constr +R7541:7541 Examples.Core <> A:163 var +R7546:7551 Crypt.choice_type <> chList constr +R7553:7553 Examples.Core <> A:163 var +R7518:7518 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not +R7526:7527 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not +R7530:7530 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not +R7519:7521 Coq.Init.Datatypes <> app def +R7525:7525 Examples.Core <> x:166 var +R7523:7523 Examples.Core <> y:167 var +R7528:7529 Coq.Lists.List ListNotations ::list_scope:'['_']' not +syndef 7571:7575 <> clone +R7580:7581 Coq.Init.Datatypes <> id def +def 7595:7603 <> seq_unzip +binder 7606:7606 <> A:168 +binder 7608:7608 <> B:169 +R7616:7621 Crypt.choice_type <> chList constr +R7625:7628 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R7624:7624 Examples.Core <> A:168 var +R7629:7629 Examples.Core <> B:169 var +binder 7612:7612 <> s:170 +R7643:7646 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R7635:7640 Crypt.choice_type <> chList constr +R7642:7642 Examples.Core <> A:168 var +R7647:7652 Crypt.choice_type <> chList constr +R7654:7654 Examples.Core <> B:169 var +R7659:7659 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not +R7672:7673 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not +R7686:7686 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not +R7660:7669 mathcomp.ssreflect.seq <> unzip1 def +R7671:7671 Examples.Core <> s:170 var +R7674:7683 mathcomp.ssreflect.seq <> unzip2 def +R7685:7685 Examples.Core <> s:170 var +def 7700:7704 <> unzip +binder 7707:7707 <> L:171 +binder 7709:7709 <> I:172 +binder 7713:7713 <> A:173 +binder 7715:7715 <> B:174 +R7746:7749 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R7720:7723 Hacspec.ChoiceEquality <> both rec +R7730:7735 Crypt.choice_type <> chList constr +R7739:7742 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R7738:7738 Examples.Core <> A:173 var +R7743:7743 Examples.Core <> B:174 var +R7727:7727 Examples.Core <> I:172 var +R7725:7725 Examples.Core <> L:171 var +R7750:7753 Hacspec.ChoiceEquality <> both rec +R7768:7771 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R7760:7765 Crypt.choice_type <> chList constr +R7767:7767 Examples.Core <> A:173 var +R7772:7777 Crypt.choice_type <> chList constr +R7779:7779 Examples.Core <> B:174 var +R7757:7757 Examples.Core <> I:172 var +R7755:7755 Examples.Core <> L:171 var +R7785:7794 Hacspec.ChoiceEquality <> lift1_both def +R7796:7804 Examples.Core <> seq_unzip def +def 7817:7821 <> deref +binder 7824:7824 <> L:175 +binder 7826:7826 <> I:176 +binder 7828:7828 <> A:177 +R7860:7863 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R7833:7836 Hacspec.ChoiceEquality <> both rec +R7843:7847 Examples.Core <> t_Vec def +R7851:7858 Examples.Core <> t_Global constr +R7864:7867 Hacspec.ChoiceEquality <> both rec +R7874:7876 Hacspec.Hacspec_Lib_Pre <> seq def +R7886:7890 Examples.Core <> deref:180 def +R7892:7892 Examples.Core <> X:179 var +R7897:7905 Hacspec.ChoiceEquality <> bind_both def +R7918:7922 Examples.Core <> t_Vec def +R7926:7933 Examples.Core <> t_Global constr +binder 7914:7914 <> x:181 +R7938:7945 Hacspec.ChoiceEquality <> ret_both def +R7948:7960 Hacspec.Hacspec_Lib_Pre <> seq_from_list def +R7964:7964 Examples.Core <> x:181 var +syndef 8054:8056 <> get +R8061:8062 Coq.Init.Datatypes <> id def +def 8076:8082 <> t_Never +R8087:8091 Coq.Init.Logic <> False ind +syndef 8103:8109 <> v_Break +R8114:8115 Coq.Init.Datatypes <> id def +syndef 8127:8136 <> Result_Err +R8141:8143 Hacspec.Hacspec_Lib <> Err def +def 8157:8168 <> never_to_any +R8173:8174 Coq.Init.Datatypes <> tt constr +syndef 8186:8194 <> Result_Ok +R8199:8200 Hacspec.Hacspec_Lib <> Ok def +def 8224:8230 <> if_both +binder 8233:8234 <> L1:182 +binder 8236:8237 <> L2:183 +binder 8239:8240 <> L3:184 +binder 8242:8243 <> I1:185 +binder 8245:8246 <> I2:186 +binder 8248:8249 <> I3:187 +binder 8253:8253 <> A:188 +R8261:8264 Hacspec.ChoiceEquality <> both rec +R8272:8276 Crypt.package.pkg_notation PackageNotation ::package_scope:'''bool' not +R8269:8270 Examples.Core <> I1:185 var +R8266:8267 Examples.Core <> L1:182 var +binder 8257:8257 <> c:189 +R8289:8292 Hacspec.ChoiceEquality <> both rec +R8300:8300 Examples.Core <> A:188 var +R8297:8298 Examples.Core <> I2:186 var +R8294:8295 Examples.Core <> L2:183 var +binder 8280:8285 <> e_then:190 +R8313:8316 Hacspec.ChoiceEquality <> both rec +R8324:8324 Examples.Core <> A:188 var +R8321:8322 Examples.Core <> I3:187 var +R8318:8319 Examples.Core <> L3:184 var +binder 8304:8309 <> e_else:191 +R8329:8332 Hacspec.ChoiceEquality <> both rec +R8372:8372 Examples.Core <> A:188 var +R8363:8367 extructures.fset <> ::fset_scope:x_':|:'_x not +R8356:8360 extructures.fset <> ::fset_scope:x_':|:'_x not +R8354:8355 Examples.Core <> I1:185 var +R8361:8362 Examples.Core <> I2:186 var +R8368:8369 Examples.Core <> I3:187 var +R8344:8348 extructures.fset <> ::fset_scope:x_':|:'_x not +R8337:8341 extructures.fset <> ::fset_scope:x_':|:'_x not +R8335:8336 Examples.Core <> L1:182 var +R8342:8343 Examples.Core <> L2:183 var +R8349:8350 Examples.Core <> L3:184 var +R8379:8387 Hacspec.ChoiceEquality <> bind_both def +binder 8436:8436 <> b:192 +R8444:8444 Examples.Core <> b:192 var +R8513:8521 Hacspec.ChoiceEquality <> lift_both def +R8564:8569 Examples.Core <> e_else:191 var +R8451:8459 Hacspec.ChoiceEquality <> lift_both def +R8501:8506 Examples.Core <> e_then:190 var +R8429:8429 Examples.Core <> c:189 var +def 8669:8678 <> match_both +binder 8681:8682 <> L1:193 +binder 8684:8685 <> L2:194 +binder 8687:8688 <> L3:195 +binder 8690:8691 <> I1:196 +binder 8693:8694 <> I2:197 +binder 8696:8697 <> I3:198 +binder 8701:8701 <> A:199 +binder 8703:8703 <> B:200 +R8711:8714 Hacspec.ChoiceEquality <> both rec +R8723:8728 Hacspec.Hacspec_Lib_Pre <> option def +R8730:8730 Examples.Core <> A:199 var +R8719:8720 Examples.Core <> I3:198 var +R8716:8717 Examples.Core <> L3:195 var +binder 8707:8707 <> x:201 +R8752:8755 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R8740:8743 Hacspec.ChoiceEquality <> both rec +R8751:8751 Examples.Core <> A:199 var +R8748:8749 Examples.Core <> I3:198 var +R8745:8746 Examples.Core <> L3:195 var +R8756:8759 Hacspec.ChoiceEquality <> both rec +R8767:8767 Examples.Core <> B:200 var +R8764:8765 Examples.Core <> I1:196 var +R8761:8762 Examples.Core <> L1:193 var +binder 8735:8736 <> fa:202 +R8776:8779 Hacspec.ChoiceEquality <> both rec +R8787:8787 Examples.Core <> B:200 var +R8784:8785 Examples.Core <> I2:197 var +R8781:8782 Examples.Core <> L2:194 var +binder 8771:8772 <> fb:203 +R8807:8813 Coq.Init.Datatypes <> is_true def +R8816:8822 extructures.fset <> fsubset def +R8827:8828 Examples.Core <> L1:193 var +R8824:8825 Examples.Core <> L3:195 var +binder 8792:8803 <> fsubset_loc1:204 +R8850:8856 Coq.Init.Datatypes <> is_true def +R8859:8865 extructures.fset <> fsubset def +R8870:8871 Examples.Core <> L2:194 var +R8867:8868 Examples.Core <> L3:195 var +binder 8835:8846 <> fsubset_loc2:205 +R8895:8901 Coq.Init.Datatypes <> is_true def +R8904:8910 extructures.fset <> fsubset def +R8915:8916 Examples.Core <> I1:196 var +R8912:8913 Examples.Core <> I3:198 var +binder 8878:8891 <> fsubset_opsig1:206 +R8940:8946 Coq.Init.Datatypes <> is_true def +R8949:8955 extructures.fset <> fsubset def +R8960:8961 Examples.Core <> I2:197 var +R8957:8958 Examples.Core <> I3:198 var +binder 8923:8936 <> fsubset_opsig2:207 +R8967:8970 Hacspec.ChoiceEquality <> both rec +R8996:8996 Examples.Core <> B:200 var +R8987:8991 extructures.fset <> ::fset_scope:x_':|:'_x not +R8985:8986 Examples.Core <> I1:196 var +R8992:8993 Examples.Core <> I2:197 var +R8975:8979 extructures.fset <> ::fset_scope:x_':|:'_x not +R8973:8974 Examples.Core <> L1:193 var +R8980:8981 Examples.Core <> L2:194 var +R9003:9011 Hacspec.ChoiceEquality <> bind_both def +binder 9060:9060 <> y:208 +R9071:9071 Examples.Core <> y:208 var +R9089:9092 Coq.Init.Datatypes <> Some constr +R9099:9107 Hacspec.ChoiceEquality <> lift_both def +R9151:9152 Examples.Core <> fa:202 var +R9155:9162 Hacspec.ChoiceEquality <> ret_both def +R9179:9182 Coq.Init.Datatypes <> None constr +R9187:9195 Hacspec.ChoiceEquality <> lift_both def +R9238:9239 Examples.Core <> fb:203 var +R9053:9053 Examples.Core <> x:201 var +R9440:9449 Examples.Core <> match_both def +binder 9458:9458 <> a:210 +not 9354:9354 <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'Option_None'_'=>'_x_'end' +R9642:9651 Examples.Core <> match_both def +binder 9660:9660 <> a:211 +not 9566:9566 <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'''_'''_'=>'_x_'end' +R9790:9797 Hacspec.ChoiceEquality <> ret_both def +R9805:9809 Crypt.package.pkg_notation PackageNotation ::package_scope:'''unit' not +R9800:9801 Coq.Init.Datatypes <> tt constr +not 9768:9768 <> :::'ret_both'_'tt' diff --git a/ovn/proofs/ssprove/extraction/Core.v b/ovn/proofs/ssprove/extraction/Core.v new file mode 100644 index 0000000..d5ae6aa --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Core.v @@ -0,0 +1,213 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib. + +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +Require Import Lia. +Require Import Coq.Logic.FunctionalExtensionality. +Require Import Sumbool. + +From mathcomp Require Import fintype. + +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset fmap. + +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith List. +Import ListNotations. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Declare Scope hacspec_scope. + +Open Scope list_scope. +Open Scope hacspec_scope. +Open Scope nat_scope. + +(* Require Import Hacspec_Lib_Comparable. *) + +Import choice.Choice.Exports. + +Class t_TryFrom (A : choice_type) := TryFrom : A -> A. +Class t_Into (A : choice_type) := Into : A -> A. +Class t_PartialEq (A : choice_type) := PartialEq : A -> A. +Class t_Copy (A : choice_type) := Copy : A -> A. +Class t_Clone (A : choice_type) := Clone : A -> A. +Class t_Sized (A : choice_type) := Sized : A -> A. +Definition t_Option : choice_type -> choice_type := chOption. +Inductive vec_typ := +| t_Global. +Definition t_Vec : choice_type -> vec_typ -> choice_type := fun A _ => chList A. + +Class t_Default A := { default : A }. + +#[global] Instance bool_copy : t_Copy 'bool := {Copy x := x}. +#[global] Instance bool_clone : t_Clone 'bool := {Clone x := x}. +#[global] Instance bool_sized : t_Sized 'bool := {Sized x := x}. + +Definition ilog2 {WS} {L I} (x : both L I (int WS)) : both L I (int WS) := x. (* TODO *) + +Definition collect {A} {L I} (x : both L I (chList A)) : both L I (t_Vec A t_Global) := x. + + +Equations swap_both_list {A L I} (x : list (both L I A)) : both L I (chList A) := + swap_both_list x := + (List.fold_left (fun (x : both L I (chList A)) y => + bind_both x (fun x' => + bind_both y (fun y' => + ret_both ((y' :: x') : chList A)))) x (ret_both ([] : chList A))). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Equations match_list {A B : choice_type} {L I} (x : both L I (chList A)) (f : list A -> B) : both L I B := + match_list x f := + bind_both x (fun x' => ret_both (f x')). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Equations map {A B} {L I} (x : both L I (chList A)) (f : both L I A -> both L I B) : both L I (chList B) := + map x f := + bind_both x (fun x' => swap_both_list (List.map (fun y => f (ret_both y)) x')). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Definition cloned {A} {L I} (x : both L I (chList A)) : both L I (chList A) := x. + +Equations iter {A L I} (x : both L I (seq A)) : both L I (chList A) := + iter x := + bind_both x (fun x' => ret_both (seq_to_list _ x' : chList A)). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Definition dedup {A} {L I} (x : both L I (t_Vec A t_Global)) : both L I (t_Vec A t_Global) := x. + +Definition t_String := Coq.Strings.String.string. +Definition new {A L I} : both L I (t_Vec A t_Global) := ret_both ([] : chList A). + +Definition enumerate {A} {L I} (x : both L I (t_Vec A t_Global)) : both L I (t_Vec A t_Global) := x. + +Definition t_Result A B := result B A. +Inductive ControlFlow {L I} (A : choice_type) (B : choice_type) := +| ControlFlow_Continue (val : both L I A) +| ControlFlow_Break (val : both L I B). + +Definition run {A B : choice_type} {L I} (x : ControlFlow A B) : both L I (t_Result A B) := + match x with + | ControlFlow_Continue v => Ok v + | ControlFlow_Break v => Err v + end. + +(* Program Definition build_under_impl_1 {A B} : (t_Result A B) := *) +(* run (letb layers := (match branch (build_tree_under_impl_1 partial_layers depth) with *) +(* | ControlFlow_Break residual => letb hoist1 := (v_Break (from_residual residual)) : both _ _ (t_Never) in *) +(* ControlFlow_Continue (never_to_any hoist1) *) +(* | ControlFlow_Continue val => ControlFlow_Continue val *) +(* end) in *) +(* ControlFlow_Continue (Result_Ok (Build_PartialTree layers))). *) +(* Fail Next Obligation. *) + +(** How to handle enums: **) + +(* Inductive t_ErrorKind : Type := *) +(* | ErrorKind_SerializedProofSizeIsIncorrectt_ErrorKind *) +(* | ErrorKind_NotEnoughHelperNodest_ErrorKind *) +(* | ErrorKind_HashConversionErrort_ErrorKind *) +(* | ErrorKind_NotEnoughHashesToCalculateRoott_ErrorKind *) +(* | ErrorKind_LeavesIndicesCountMismatcht_ErrorKind. *) + +Definition t_ErrorKind : choice_type := chFin (mkpos 5). +Definition ErrorKind_SerializedProofSizeIsIncorrect {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=0) eq_refl : t_ErrorKind). +Definition ErrorKind_NotEnoughHelperNodes {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=1) eq_refl : t_ErrorKind). +Definition ErrorKind_HashConversionError {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=2) eq_refl : t_ErrorKind). +Definition ErrorKind_NotEnoughHashesToCalculateRoot {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=3) eq_refl : t_ErrorKind). +Definition ErrorKind_LeavesIndicesCountMismatch {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=4) eq_refl : t_ErrorKind). + +(** How to handle records: **) +(* TODO: Remove them as a phase? *) + +(* Record t_Error : Type := { *) +(* f_kind1 : t_ErrorKind *) +(* f_kind2 : t_ErrorKind *) +(* }. *) + +Definition t_Error : choice_type := t_ErrorKind × t_ErrorKind. +(* Uncurry is Build_.. fn *) +Equations Build_Error {L I} {f_kind1 : both L I t_ErrorKind} {f_kind2 : both L I t_ErrorKind} : both L I t_Error := + Build_Error (f_kind1 := x) (f_kind2 := y) := + bind_both x (fun x' => + bind_both y (fun y' => + ret_both ((x', y') : t_Error))). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. +Definition f_kind1 (v : t_Error) := fst v. +Definition f_kind2 (v : t_Error) := snd v. +(* Make into tuple struct with named projctions! *) + +(*** More functions *) +Definition t_Drain : choice_type -> vec_typ -> choice_type := t_Vec. +Inductive t_Range := RangeFull. +Equations drain : forall {L I A}, both L I (t_Vec A t_Global) -> t_Range -> both L I (t_Drain A t_Global × t_Vec A t_Global) := + drain x _ := + bind_both x (fun x' => ret_both ((x', []) : (t_Drain A t_Global × t_Vec A t_Global))). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. +Notation t_Rev := id. +Equations rev {L I A} (x : both L I (chList A)) : both L I (chList A) := rev x := bind_both x (fun x => ret_both (List.rev x : chList _)). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Definition pop {L I A} : both L I (chList A) -> both L I (chOption A × t_Vec A (t_Global)) := + lift1_both (fun (x : chList A) => (List.hd_error x , List.tl x) : (chOption A × t_Vec A (t_Global))). + +Definition push {L1 L2 I1 I2 A} : both L1 I1 (t_Vec A t_Global) -> both L2 I2 A -> both (L1 :|: L2) (I1 :|: I2) (t_Vec A (t_Global)) := + lift2_both (fun (x : chList A) y => y :: x : chList A). + +Notation Option_Some := Some. +Definition append {L1 L2 I1 I2} {A : choice_type} (l : both L1 I1 (chList A)) (x : both L2 I2 (chList A)) : both (L2 :|: L1) (I2 :|: I1) (chList A × chList A) := + lift2_both (fun (x : chList A) (y : chList A) => (app y x, []) : chList A × chList A) x l. + +Notation clone := id. +Definition seq_unzip {A B} (s : chList (A × B)) : chList A × chList B := (seq.unzip1 s, seq.unzip2 s). +Definition unzip {L I} {A B} : both L I (chList (A × B)) -> both L I (chList A × chList B) := lift1_both seq_unzip. +Equations deref {L I A} : both L I (t_Vec A t_Global) -> both L I (seq A) := + deref X := bind_both X (fun x : t_Vec A t_Global => ret_both (seq_from_list A x)). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. +Notation get := id. +Definition t_Never := False. +Notation v_Break := id. +Notation Result_Err := Err. +Definition never_to_any := tt. +Notation Result_Ok := Ok. + + +Program Definition if_both {L1 L2 L3 I1 I2 I3} {A} (c : both L1 I1 'bool) (e_then : both L2 I2 A) (e_else : both L3 I3 A) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) A := + bind_both (fsubset_loc := _) (fsubset_opsig := _) c (fun b => if b then lift_both (fsubset_loc := _) (fsubset_opsig := _) e_then else lift_both (fsubset_loc := _) (fsubset_opsig := _) e_else). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Program Definition match_both {L1 L2 L3 I1 I2 I3} {A B} (x : both L3 I3 (option A)) (fa : both L3 I3 A -> both L1 I1 B) (fb : both L2 I2 B) `{fsubset_loc1 : is_true (fsubset L3 L1)} `{fsubset_loc2 : is_true (fsubset L3 L2)} `{fsubset_opsig1 : is_true (fsubset I3 I1)} `{fsubset_opsig2 : is_true (fsubset I3 I2)} : both (L1 :|: L2) (I1 :|: I2) B := + bind_both (fsubset_loc := _) (fsubset_opsig := _) x (fun y => match y with + | Some a => lift_both (fsubset_loc := _) (fsubset_opsig := _) (fa (ret_both a)) + | None => lift_both (fsubset_loc := _) (fsubset_opsig := _) fb + end). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Notation "'matchb' x 'with' '|' 'Option_Some' a '=>' va '|' 'Option_None' '=>' vb 'end'" := + (match_both x (fun a => va) vb (fsubset_loc1 := _) (fsubset_loc2 := _) (fsubset_opsig1 := _) (fsubset_opsig2 := _)). + +Notation "'matchb' x 'with' '|' 'Option_Some' a '=>' va '|' '_' '=>' vb 'end'" := + (match_both x (fun a => va) vb (fsubset_loc1 := _) (fsubset_loc2 := _) (fsubset_opsig1 := _) (fsubset_opsig2 := _)). + +Notation "'ret_both' 'tt'" := (ret_both (tt : 'unit)). diff --git a/ovn/proofs/ssprove/extraction/Core.vo b/ovn/proofs/ssprove/extraction/Core.vo new file mode 100644 index 0000000000000000000000000000000000000000..ee82f8ef2670acc9a26cb8ea652b2e4e0891e5cf GIT binary patch literal 199240 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 sz#}fWTZN* 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 <> lib +R112:117 Coq.ZArith.ZArith <> <> lib +R127:144 Coq.Lists.List ListNotations <> mod +R206:208 Coq.micromega.Lia <> <> lib +R226:259 Coq.Logic.FunctionalExtensionality <> <> lib +R277:283 Coq.Bool.Sumbool <> <> lib +R316:322 mathcomp.ssreflect.fintype <> <> lib +R352:362 Crypt.choice_type <> <> lib +R364:370 Crypt.Package <> <> lib +R372:378 Crypt.Prelude <> <> lib +R388:402 Crypt.package.pkg_notation PackageNotation <> mod +R437:439 extructures.ord <> <> lib +R441:444 extructures.fset <> <> lib +R446:449 extructures.fmap <> <> lib +R482:485 mathcomp.zify.ssrZ <> <> lib +R487:490 mathcomp.word.word <> <> lib +R520:523 Jasmin.word <> <> lib +R551:556 Coq.ZArith.ZArith <> <> lib +R558:561 Coq.Lists.List <> <> lib +R571:583 Coq.Lists.List ListNotations <> mod +R615:628 Hacspec.ChoiceEquality <> <> lib +R659:673 Hacspec.LocationUtility <> <> lib +R704:725 Hacspec.Hacspec_Lib_Comparable <> <> lib +R756:770 Hacspec.Hacspec_Lib_Pre <> <> lib +R801:811 Hacspec.Hacspec_Lib <> <> lib +R970:990 mathcomp.ssreflect.choice Choice.Exports <> mod +def 1122:1127 <> int_xI +R1135:1139 Jasmin.wsize <> wsize variant +binder 1130:1131 <> WS:1 +R1184:1186 Hacspec.Hacspec_Lib_Pre <> int syndef +R1188:1189 Examples.Hacspec_lib <> WS:1 var +binder 1143:1143 <> a:2 +R1232:1234 Hacspec.Hacspec_Lib_Pre <> int syndef +R1236:1237 Examples.Hacspec_lib <> WS:1 var +R1245:1267 Hacspec.Hacspec_Lib_Pre <> int_add def +R1401:1403 Hacspec.Hacspec_Lib_Pre <> one def +R1405:1406 Examples.Hacspec_lib <> WS:1 var +R1270:1292 Hacspec.Hacspec_Lib_Pre <> int_mul def +R1342:1345 Hacspec.Hacspec_Lib_Pre <> repr syndef +R1347:1348 Examples.Hacspec_lib <> WS:1 var +R1294:1294 Examples.Hacspec_lib <> a:2 var +def 1583:1588 <> int_xO +R1596:1600 Jasmin.wsize <> wsize variant +binder 1591:1592 <> WS:3 +R1608:1610 Hacspec.Hacspec_Lib_Pre <> int syndef +R1612:1613 Examples.Hacspec_lib <> WS:3 var +binder 1604:1604 <> a:4 +R1618:1620 Hacspec.Hacspec_Lib_Pre <> int syndef +R1622:1623 Examples.Hacspec_lib <> WS:3 var +R1630:1652 Hacspec.Hacspec_Lib_Pre <> int_mul def +R1658:1661 Hacspec.Hacspec_Lib_Pre <> repr syndef +R1663:1664 Examples.Hacspec_lib <> WS:3 var +R1654:1654 Examples.Hacspec_lib <> a:4 var +def 1824:1835 <> both_int_one +R1843:1847 Jasmin.wsize <> wsize variant +binder 1838:1839 <> WS:5 +R1852:1855 Hacspec.ChoiceEquality <> both rec +R1883:1885 Hacspec.Hacspec_Lib_Pre <> int syndef +R1887:1888 Examples.Hacspec_lib <> WS:5 var +R1868:1878 Crypt.package.pkg_notation PackageNotation ::package_scope:'['_'interface'_']' not +R1858:1861 extructures.fset <> fset def +R1863:1864 Coq.Lists.List ListNotations ::list_scope:'['_']' not +R1894:1901 Hacspec.ChoiceEquality <> ret_both def +R1919:1921 Hacspec.Hacspec_Lib_Pre <> one def +R1909:1912 extructures.fset <> fset def +R1914:1915 Coq.Lists.List ListNotations ::list_scope:'['_']' not +R1935:1957 Hacspec.Hacspec_Lib_Pre <> int_add def +R1975:1978 Hacspec.Hacspec_Lib_Pre <> repr syndef +R1980:1982 Jasmin.wsize <> U32 constr +R1960:1963 Hacspec.Hacspec_Lib_Pre <> repr syndef +R1965:1967 Jasmin.wsize <> U32 constr +def 2029:2035 <> int_num +R2043:2047 Jasmin.wsize <> wsize variant +binder 2038:2039 <> WS:6 +R2053:2055 Hacspec.Hacspec_Lib_Pre <> int syndef +R2057:2058 Examples.Hacspec_lib <> WS:6 var +R2120:2127 Coq.Numbers.BinNums <> positive ind +R2085:2098 Coq.PArith.BinPos Pos of_num_int def +R2120:2127 Coq.Numbers.BinNums <> positive ind +R2085:2098 Coq.PArith.BinPos Pos of_num_int def +R2120:2127 Coq.Numbers.BinNums <> positive ind +R2100:2113 Coq.PArith.BinPos Pos to_num_int def +R2220:2223 Hacspec.Hacspec_Lib_Pre <> repr syndef +not 2212:2212 <> ::hacspec_scope:'0' +R2260:2263 Hacspec.Hacspec_Lib_Pre <> int8 syndef +R2276:2279 Hacspec.Hacspec_Lib_Pre <> int8 syndef +R2292:2295 Hacspec.Hacspec_Lib_Pre <> int8 syndef +ind 2591:2598 <> Addition +constr 2843:2845 <> add +rec 2591:2598 <> Addition +proj 2843:2845 <> add +binder 2600:2601 <> L1:7 +binder 2603:2604 <> L2:8 +binder 2615:2616 <> I1:9 +binder 2618:2619 <> I2:10 +R2635:2645 Crypt.choice_type <> choice_type ind +binder 2631:2631 <> A:11 +R2861:2864 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R2849:2852 Hacspec.ChoiceEquality <> both rec +R2860:2860 Examples.Hacspec_lib <> A:11 var +R2857:2858 Examples.Hacspec_lib <> I1:9 var +R2854:2855 Examples.Hacspec_lib <> L1:7 var +R2877:2880 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R2865:2868 Hacspec.ChoiceEquality <> both rec +R2876:2876 Examples.Hacspec_lib <> A:11 var +R2873:2874 Examples.Hacspec_lib <> I2:10 var +R2870:2871 Examples.Hacspec_lib <> L2:8 var +R2881:2884 Hacspec.ChoiceEquality <> both rec +R2928:2928 Examples.Hacspec_lib <> A:11 var +R2910:2914 extructures.fset <> ::fset_scope:x_':|:'_x not +R2908:2909 Examples.Hacspec_lib <> I1:9 var +R2915:2916 Examples.Hacspec_lib <> I2:10 var +R2889:2893 extructures.fset <> ::fset_scope:x_':|:'_x not +R2887:2888 Examples.Hacspec_lib <> L1:7 var +R2894:2895 Examples.Hacspec_lib <> L2:8 var +R2953:2955 Examples.Hacspec_lib <> add def +not 2940:2940 <> :::x_'.+'_x +inst 3122:3133 <> int_add_inst +R3141:3145 Jasmin.wsize <> wsize variant +binder 3136:3137 <> ws:14 +binder 3149:3150 <> L1:15 +binder 3152:3153 <> L2:16 +binder 3164:3165 <> I1:17 +binder 3167:3168 <> I2:18 +R3373:3380 Examples.Hacspec_lib <> Addition class +R3414:3416 Hacspec.Hacspec_Lib_Pre <> int syndef +R3418:3419 Examples.Hacspec_lib <> ws:14 var +R3400:3401 Examples.Hacspec_lib <> I2:18 var +R3397:3398 Examples.Hacspec_lib <> I1:17 var +R3385:3386 Examples.Hacspec_lib <> L2:16 var +R3382:3383 Examples.Hacspec_lib <> L1:15 var +R3501:3503 Examples.Hacspec_lib <> add def +binder 3505:3505 <> a:19 +binder 3507:3507 <> b:20 +R3512:3518 Hacspec.Hacspec_Lib <> int_add def +R3672:3672 Examples.Hacspec_lib <> b:20 var +R3670:3670 Examples.Hacspec_lib <> a:19 var +ind 3684:3694 <> Subtraction +constr 3940:3942 <> sub +rec 3684:3694 <> Subtraction +proj 3940:3942 <> sub +binder 3697:3698 <> L1:21 +binder 3700:3701 <> L2:22 +binder 3712:3713 <> I1:23 +binder 3715:3716 <> I2:24 +R3732:3742 Crypt.choice_type <> choice_type ind +binder 3728:3728 <> A:25 +R3958:3961 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R3946:3949 Hacspec.ChoiceEquality <> both rec +R3957:3957 Examples.Hacspec_lib <> A:25 var +R3954:3955 Examples.Hacspec_lib <> I1:23 var +R3951:3952 Examples.Hacspec_lib <> L1:21 var +R3974:3977 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R3962:3965 Hacspec.ChoiceEquality <> both rec +R3973:3973 Examples.Hacspec_lib <> A:25 var +R3970:3971 Examples.Hacspec_lib <> I2:24 var +R3967:3968 Examples.Hacspec_lib <> L2:22 var +R3978:3981 Hacspec.ChoiceEquality <> both rec +R4025:4025 Examples.Hacspec_lib <> A:25 var +R4007:4011 extructures.fset <> ::fset_scope:x_':|:'_x not +R4005:4006 Examples.Hacspec_lib <> I1:23 var +R4012:4013 Examples.Hacspec_lib <> I2:24 var +R3986:3990 extructures.fset <> ::fset_scope:x_':|:'_x not +R3984:3985 Examples.Hacspec_lib <> L1:21 var +R3991:3992 Examples.Hacspec_lib <> L2:22 var +R4050:4052 Examples.Hacspec_lib <> sub def +not 4037:4037 <> :::x_'.-'_x +inst 4244:4255 <> int_sub_inst +R4263:4267 Jasmin.wsize <> wsize variant +binder 4258:4259 <> ws:28 +binder 4271:4272 <> L1:29 +binder 4274:4275 <> L2:30 +binder 4277:4278 <> L3:31 +binder 4280:4281 <> I1:32 +binder 4283:4284 <> I2:33 +binder 4286:4287 <> I3:34 +R4311:4317 Coq.Init.Datatypes <> is_true def +R4320:4326 extructures.fset <> fsubset def +R4331:4332 Examples.Hacspec_lib <> L3:31 var +R4328:4329 Examples.Hacspec_lib <> L1:29 var +binder 4293:4307 <> H_loc_fsubset13:35 +R4358:4364 Coq.Init.Datatypes <> is_true def +R4367:4373 extructures.fset <> fsubset def +R4378:4379 Examples.Hacspec_lib <> I3:34 var +R4375:4376 Examples.Hacspec_lib <> I1:32 var +binder 4338:4354 <> H_opsig_fsubset13:36 +R4403:4409 Coq.Init.Datatypes <> is_true def +R4412:4418 extructures.fset <> fsubset def +R4423:4424 Examples.Hacspec_lib <> L3:31 var +R4420:4421 Examples.Hacspec_lib <> L2:30 var +binder 4385:4399 <> H_loc_fsubset23:37 +R4450:4456 Coq.Init.Datatypes <> is_true def +R4459:4465 extructures.fset <> fsubset def +R4470:4471 Examples.Hacspec_lib <> I3:34 var +R4467:4468 Examples.Hacspec_lib <> I2:33 var +binder 4430:4446 <> H_opsig_fsubset23:38 +R4477:4487 Examples.Hacspec_lib <> Subtraction class +R4521:4523 Hacspec.Hacspec_Lib_Pre <> int syndef +R4525:4526 Examples.Hacspec_lib <> ws:28 var +R4507:4508 Examples.Hacspec_lib <> I2:33 var +R4504:4505 Examples.Hacspec_lib <> I1:32 var +R4492:4493 Examples.Hacspec_lib <> L2:30 var +R4489:4490 Examples.Hacspec_lib <> L1:29 var +R4608:4610 Examples.Hacspec_lib <> sub def +binder 4612:4612 <> a:39 +binder 4614:4614 <> b:40 +R4619:4625 Hacspec.Hacspec_Lib <> int_sub def +R4779:4779 Examples.Hacspec_lib <> b:40 var +R4777:4777 Examples.Hacspec_lib <> a:39 var +ind 4791:4804 <> Multiplication +constr 5046:5048 <> mul +rec 4791:4804 <> Multiplication +proj 5046:5048 <> mul +R4824:4829 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R4838:4838 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R4830:4837 Crypt.package.pkg_core_definition <> Location def +binder 4807:4808 <> L1:41 +binder 4810:4811 <> L2:42 +R4859:4867 Crypt.package.pkg_core_definition <> Interface def +binder 4842:4843 <> I1:43 +binder 4845:4846 <> I2:44 +binder 4870:4870 <> A:45 +R5064:5067 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R5052:5055 Hacspec.ChoiceEquality <> both rec +R5063:5063 Examples.Hacspec_lib <> A:45 var +R5060:5061 Examples.Hacspec_lib <> I1:43 var +R5057:5058 Examples.Hacspec_lib <> L1:41 var +R5080:5083 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R5068:5071 Hacspec.ChoiceEquality <> both rec +R5079:5079 Examples.Hacspec_lib <> A:45 var +R5076:5077 Examples.Hacspec_lib <> I2:44 var +R5073:5074 Examples.Hacspec_lib <> L2:42 var +R5084:5087 Hacspec.ChoiceEquality <> both rec +R5132:5132 Examples.Hacspec_lib <> A:45 var +R5113:5117 extructures.fset <> ::fset_scope:x_':|:'_x not +R5111:5112 Examples.Hacspec_lib <> I1:43 var +R5118:5119 Examples.Hacspec_lib <> I2:44 var +R5092:5096 extructures.fset <> ::fset_scope:x_':|:'_x not +R5090:5091 Examples.Hacspec_lib <> L1:41 var +R5097:5098 Examples.Hacspec_lib <> L2:42 var +R5157:5159 Examples.Hacspec_lib <> mul def +not 5144:5144 <> :::x_'.*'_x +inst 5342:5353 <> int_mul_inst +R5361:5365 Jasmin.wsize <> wsize variant +binder 5356:5357 <> ws:48 +R5387:5392 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R5401:5401 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R5393:5400 Crypt.package.pkg_core_definition <> Location def +binder 5370:5371 <> L1:49 +binder 5373:5374 <> L2:50 +R5424:5432 Crypt.package.pkg_core_definition <> Interface def +binder 5407:5408 <> I1:51 +binder 5410:5411 <> I2:52 +R5611:5624 Examples.Hacspec_lib <> Multiplication class +R5658:5660 Hacspec.Hacspec_Lib_Pre <> int syndef +R5662:5663 Examples.Hacspec_lib <> ws:48 var +R5644:5645 Examples.Hacspec_lib <> I2:52 var +R5641:5642 Examples.Hacspec_lib <> I1:51 var +R5629:5630 Examples.Hacspec_lib <> L2:50 var +R5626:5627 Examples.Hacspec_lib <> L1:49 var +R5729:5731 Examples.Hacspec_lib <> mul def +binder 5733:5733 <> a:53 +binder 5735:5735 <> b:54 +R5740:5746 Hacspec.Hacspec_Lib <> int_mul def +R5750:5750 Examples.Hacspec_lib <> b:54 var +R5748:5748 Examples.Hacspec_lib <> a:53 var +ind 5784:5786 <> Xor +constr 6028:6030 <> xor +rec 5784:5786 <> Xor +proj 6028:6030 <> xor +R5806:5811 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R5820:5820 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R5812:5819 Crypt.package.pkg_core_definition <> Location def +binder 5789:5790 <> L1:55 +binder 5792:5793 <> L2:56 +R5841:5849 Crypt.package.pkg_core_definition <> Interface def +binder 5824:5825 <> I1:57 +binder 5827:5828 <> I2:58 +binder 5852:5852 <> A:59 +R6046:6049 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R6034:6037 Hacspec.ChoiceEquality <> both rec +R6045:6045 Examples.Hacspec_lib <> A:59 var +R6042:6043 Examples.Hacspec_lib <> I1:57 var +R6039:6040 Examples.Hacspec_lib <> L1:55 var +R6062:6065 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R6050:6053 Hacspec.ChoiceEquality <> both rec +R6061:6061 Examples.Hacspec_lib <> A:59 var +R6058:6059 Examples.Hacspec_lib <> I2:58 var +R6055:6056 Examples.Hacspec_lib <> L2:56 var +R6066:6069 Hacspec.ChoiceEquality <> both rec +R6114:6114 Examples.Hacspec_lib <> A:59 var +R6095:6099 extructures.fset <> ::fset_scope:x_':|:'_x not +R6093:6094 Examples.Hacspec_lib <> I1:57 var +R6100:6101 Examples.Hacspec_lib <> I2:58 var +R6074:6078 extructures.fset <> ::fset_scope:x_':|:'_x not +R6072:6073 Examples.Hacspec_lib <> L1:55 var +R6079:6080 Examples.Hacspec_lib <> L2:56 var +R6139:6141 Examples.Hacspec_lib <> xor def +not 6126:6126 <> :::x_'.^'_x +inst 6313:6324 <> int_xor_inst +R6332:6336 Jasmin.wsize <> wsize variant +binder 6327:6328 <> ws:62 +binder 6340:6341 <> L1:63 +binder 6343:6344 <> L2:64 +binder 6355:6356 <> I1:65 +binder 6358:6359 <> I2:66 +R6547:6549 Examples.Hacspec_lib <> Xor class +R6583:6585 Hacspec.Hacspec_Lib_Pre <> int syndef +R6587:6588 Examples.Hacspec_lib <> ws:62 var +R6569:6570 Examples.Hacspec_lib <> I2:66 var +R6566:6567 Examples.Hacspec_lib <> I1:65 var +R6554:6555 Examples.Hacspec_lib <> L2:64 var +R6551:6552 Examples.Hacspec_lib <> L1:63 var +R6654:6656 Examples.Hacspec_lib <> xor def +binder 6658:6658 <> a:67 +binder 6660:6660 <> b:68 +R6665:6671 Hacspec.Hacspec_Lib <> int_xor def +R6675:6675 Examples.Hacspec_lib <> b:68 var +R6673:6673 Examples.Hacspec_lib <> a:67 var +rec 7356:7367 <> array_or_seq +proj 7394:7400 <> as_nseq +proj 7434:7439 <> as_seq +binder 7369:7369 <> A:69 +binder 7371:7371 <> L:70 +binder 7373:7373 <> I:71 +R7382:7384 Coq.Init.Datatypes <> nat ind +binder 7376:7378 <> len:72 +R7405:7408 Hacspec.ChoiceEquality <> both rec +R7415:7419 Hacspec.Hacspec_Lib_Pre <> nseq_ def +R7421:7421 Examples.Hacspec_lib <> A:69 var +R7423:7425 Examples.Hacspec_lib <> len:72 var +R7412:7412 Examples.Hacspec_lib <> I:71 var +R7410:7410 Examples.Hacspec_lib <> L:70 var +R7444:7447 Hacspec.ChoiceEquality <> both rec +R7454:7456 Hacspec.Hacspec_Lib_Pre <> seq def +R7458:7458 Examples.Hacspec_lib <> A:69 var +R7451:7451 Examples.Hacspec_lib <> I:71 var +R7449:7449 Examples.Hacspec_lib <> L:70 var +R7472:7477 Examples.Hacspec_lib <> as_seq proj +R7486:7492 Examples.Hacspec_lib <> as_nseq proj +R7678:7683 Examples.Hacspec_lib <> as_seq proj +R7678:7683 Examples.Hacspec_lib <> as_seq proj +R7732:7738 Examples.Hacspec_lib <> as_nseq proj +R7732:7738 Examples.Hacspec_lib <> as_nseq proj +def 8184:8200 <> nseq_array_or_seq +binder 8203:8203 <> A:76 +binder 8205:8205 <> L:77 +binder 8207:8207 <> I:78 +binder 8209:8211 <> len:79 +R8221:8224 Hacspec.ChoiceEquality <> both rec +R8231:8235 Hacspec.Hacspec_Lib_Pre <> nseq_ def +R8237:8237 Examples.Hacspec_lib <> A:76 var +R8239:8241 Examples.Hacspec_lib <> len:79 var +R8228:8228 Examples.Hacspec_lib <> I:78 var +R8226:8226 Examples.Hacspec_lib <> L:77 var +binder 8215:8217 <> val:80 +R8247:8258 Examples.Hacspec_lib <> array_or_seq rec +R8275:8291 Examples.Hacspec_lib <> nseq_array_or_seq:83 def +R8293:8295 Examples.Hacspec_lib <> val:82 var +R8303:8308 Examples.Hacspec_lib <> as_seq proj +R8303:8308 Examples.Hacspec_lib <> as_seq proj +R8303:8308 Examples.Hacspec_lib <> as_seq proj +R8332:8338 Examples.Hacspec_lib <> as_nseq proj +R8332:8338 Examples.Hacspec_lib <> as_nseq proj +R8313:8324 Hacspec.Hacspec_Lib <> array_to_seq def +R8384:8400 Examples.Hacspec_lib <> nseq_array_or_seq def +R8384:8400 Examples.Hacspec_lib <> nseq_array_or_seq def +R8427:8443 Examples.Hacspec_lib <> nseq_array_or_seq def +R8446:8495 Examples.Hacspec_lib <> nseq_array_or_seq def +R8518:8534 Examples.Hacspec_lib <> nseq_array_or_seq def +def 9350:9360 <> array_index +R9366:9376 Crypt.choice_type <> choice_type ind +binder 9363:9363 <> A:84 +R9386:9388 Coq.Init.Datatypes <> nat ind +binder 9380:9382 <> len:85 +binder 9392:9393 <> L1:86 +binder 9395:9396 <> L2:87 +binder 9398:9399 <> I1:88 +binder 9401:9402 <> I2:89 +R9409:9420 Examples.Hacspec_lib <> array_or_seq rec +R9422:9422 Examples.Hacspec_lib <> A:84 var +R9424:9425 Examples.Hacspec_lib <> L1:86 var +R9427:9428 Examples.Hacspec_lib <> I1:88 var +R9430:9432 Examples.Hacspec_lib <> len:85 var +binder 9406:9406 <> s:90 +binder 9436:9437 <> WS:91 +R9445:9448 Hacspec.ChoiceEquality <> both rec +R9458:9460 Hacspec.Hacspec_Lib_Pre <> int syndef +R9462:9463 Examples.Hacspec_lib <> WS:91 var +R9453:9454 Examples.Hacspec_lib <> I2:89 var +R9450:9451 Examples.Hacspec_lib <> L2:87 var +binder 9441:9441 <> i:92 +R9469:9472 Hacspec.ChoiceEquality <> both rec +R9498:9498 Examples.Hacspec_lib <> A:84 var +R9489:9493 extructures.fset <> ::fset_scope:x_':|:'_x not +R9487:9488 Examples.Hacspec_lib <> I1:88 var +R9494:9495 Examples.Hacspec_lib <> I2:89 var +R9477:9481 extructures.fset <> ::fset_scope:x_':|:'_x not +R9475:9476 Examples.Hacspec_lib <> L1:86 var +R9482:9483 Examples.Hacspec_lib <> L2:87 var +R9530:9552 Hacspec.Hacspec_Lib <> array_index def +R9566:9566 Examples.Hacspec_lib <> i:92 var +R9555:9561 Examples.Hacspec_lib <> as_nseq proj +R9563:9563 Examples.Hacspec_lib <> s:90 var +def 11333:11350 <> n_seq_array_or_seq +binder 11353:11353 <> L:93 +binder 11355:11355 <> I:94 +binder 11357:11357 <> A:95 +binder 11361:11361 <> B:96 +R11369:11372 Hacspec.ChoiceEquality <> both rec +R11378:11378 Examples.Hacspec_lib <> B:96 var +R11376:11376 Examples.Hacspec_lib <> I:94 var +R11374:11374 Examples.Hacspec_lib <> L:93 var +binder 11365:11365 <> x:97 +R11409:11409 Examples.Hacspec_lib <> B:96 var +R11440:11445 Crypt.choice_type <> chUnit constr +R11450:11453 Coq.Init.Logic <> True ind +R11479:11483 Crypt.choice_type <> chMap constr +R11486:11490 Crypt.choice_type <> chFin constr +R11494:11498 Crypt.Prelude <> mkpos constr +R11501:11501 Coq.Init.Datatypes <> S constr +R11518:11520 Coq.Init.Logic <> ::type_scope:x_'='_x not +R11521:11521 Examples.Hacspec_lib <> A:95 var +R11547:11551 Crypt.choice_type <> chMap constr +R11553:11556 Crypt.package.pkg_notation PackageNotation ::package_scope:'''nat' not +R11566:11568 Coq.Init.Logic <> ::type_scope:x_'='_x not +R11569:11569 Examples.Hacspec_lib <> A:95 var +R11600:11604 Coq.Init.Logic <> False ind +binder 11394:11399 <> contra:99 +R11655:11655 Examples.Hacspec_lib <> B:96 var +R11907:11910 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R11695:11695 Examples.Hacspec_lib <> K:100 var +R11724:11729 Crypt.choice_type <> chUnit constr +R11734:11737 Coq.Init.Logic <> True ind +R11761:11765 Crypt.choice_type <> chMap constr +R11768:11772 Crypt.choice_type <> chFin constr +R11776:11780 Crypt.Prelude <> mkpos constr +R11783:11783 Coq.Init.Datatypes <> S constr +R11800:11802 Coq.Init.Logic <> ::type_scope:x_'='_x not +R11803:11803 Examples.Hacspec_lib <> A:95 var +R11827:11831 Crypt.choice_type <> chMap constr +R11833:11836 Crypt.package.pkg_notation PackageNotation ::package_scope:'''nat' not +R11846:11848 Coq.Init.Logic <> ::type_scope:x_'='_x not +R11849:11849 Examples.Hacspec_lib <> A:95 var +R11878:11882 Coq.Init.Logic <> False ind +R11911:11913 Coq.Init.Datatypes <> nat ind +R11950:11955 Crypt.choice_type <> chUnit constr +R11991:11995 Crypt.choice_type <> chMap constr +R11998:12002 Crypt.choice_type <> chFin constr +R12006:12010 Crypt.Prelude <> mkpos constr +binder 12045:12052 <> m_contra:102 +R12265:12268 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R12105:12106 Examples.Hacspec_lib <> p_:103 var +R12156:12156 Coq.Init.Datatypes <> O constr +R12161:12165 Coq.Init.Logic <> False ind +R12216:12218 Coq.Init.Logic <> ::type_scope:x_'='_x not +R12219:12219 Examples.Hacspec_lib <> A:95 var +R12269:12271 Coq.Init.Datatypes <> nat ind +R12324:12324 Coq.Init.Datatypes <> O constr +binder 12333:12340 <> m_contra:105 +R12345:12354 Coq.Init.Logic <> False_rect scheme +R12360:12367 Examples.Hacspec_lib <> m_contra:105 var +R12356:12358 Coq.Init.Datatypes <> nat ind +R12389:12389 Coq.Init.Datatypes <> S constr +R12405:12405 Coq.Init.Datatypes <> S constr +R12431:12438 Examples.Hacspec_lib <> m_contra:102 var +R12456:12460 Crypt.choice_type <> chMap constr +R12462:12465 Crypt.package.pkg_notation PackageNotation ::package_scope:'''nat' not +binder 12494:12501 <> m_contra:106 +binder 12537:12544 <> m_contra:107 +R12549:12558 Coq.Init.Logic <> False_rect scheme +R12564:12571 Examples.Hacspec_lib <> m_contra:107 var +R12560:12562 Coq.Init.Datatypes <> nat ind +R12591:12596 Examples.Hacspec_lib <> contra:99 var +binder 11641:11643 <> len:108 +R12604:12615 Examples.Hacspec_lib <> array_or_seq rec +R12617:12617 Examples.Hacspec_lib <> A:95 var +R12619:12619 Examples.Hacspec_lib <> L:93 var +R12621:12621 Examples.Hacspec_lib <> I:94 var +R12623:12625 Examples.Hacspec_lib <> len:108 var +R12697:12701 Crypt.package.pkg_notation PackageNotation ::package_scope:'''unit' not +R12709:12713 Hacspec.Hacspec_Lib_Pre <> nseq_ def +R12697:12701 Crypt.package.pkg_notation PackageNotation ::package_scope:'''unit' not +R12709:12713 Hacspec.Hacspec_Lib_Pre <> nseq_ def +R12741:12746 Examples.Hacspec_lib <> as_seq proj +R12741:12746 Examples.Hacspec_lib <> as_seq proj +R12741:12746 Examples.Hacspec_lib <> as_seq proj +R12768:12774 Examples.Hacspec_lib <> as_nseq proj +R12768:12774 Examples.Hacspec_lib <> as_nseq proj +R12751:12762 Hacspec.Hacspec_Lib <> array_to_seq def +R12741:12746 Examples.Hacspec_lib <> as_seq proj +R12741:12746 Examples.Hacspec_lib <> as_seq proj +R12741:12746 Examples.Hacspec_lib <> as_seq proj +R12768:12774 Examples.Hacspec_lib <> as_nseq proj +R12768:12774 Examples.Hacspec_lib <> as_nseq proj +R12751:12762 Hacspec.Hacspec_Lib <> array_to_seq def +R12869:12873 Crypt.choice_type <> chMap constr +R12875:12878 Crypt.package.pkg_notation PackageNotation ::package_scope:'''nat' not +R12889:12891 Hacspec.Hacspec_Lib_Pre <> seq def +R12869:12873 Crypt.choice_type <> chMap constr +R12875:12878 Crypt.package.pkg_notation PackageNotation ::package_scope:'''nat' not +R12889:12891 Hacspec.Hacspec_Lib_Pre <> seq def +R12918:12923 Examples.Hacspec_lib <> as_seq proj +R12918:12923 Examples.Hacspec_lib <> as_seq proj +R12918:12923 Examples.Hacspec_lib <> as_seq proj +R12932:12938 Examples.Hacspec_lib <> as_nseq proj +R12932:12938 Examples.Hacspec_lib <> as_nseq proj +R12943:12956 Hacspec.Hacspec_Lib <> array_from_seq def +R12918:12923 Examples.Hacspec_lib <> as_seq proj +R12918:12923 Examples.Hacspec_lib <> as_seq proj +R12918:12923 Examples.Hacspec_lib <> as_seq proj +R12932:12938 Examples.Hacspec_lib <> as_nseq proj +R12932:12938 Examples.Hacspec_lib <> as_nseq proj +R12943:12956 Hacspec.Hacspec_Lib <> array_from_seq def +R13062:13066 Crypt.choice_type <> chMap constr +R13069:13073 Crypt.choice_type <> chFin constr +R13087:13091 Hacspec.Hacspec_Lib_Pre <> nseq_ def +R13062:13066 Crypt.choice_type <> chMap constr +R13069:13073 Crypt.choice_type <> chFin constr +R13087:13091 Hacspec.Hacspec_Lib_Pre <> nseq_ def +R13190:13202 Coq.ssr.ssrbool <> elimT thm +R13205:13216 Crypt.Prelude <> positive_eqP thm +R13190:13202 Coq.ssr.ssrbool <> elimT thm +R13205:13216 Crypt.Prelude <> positive_eqP thm +R13242:13252 Crypt.Prelude <> positive_eq def +R13271:13284 mathcomp.ssreflect.eqtype <> eq_refl thm +R13271:13284 mathcomp.ssreflect.eqtype <> eq_refl thm +R13314:13319 Examples.Hacspec_lib <> as_seq proj +R13314:13319 Examples.Hacspec_lib <> as_seq proj +R13314:13319 Examples.Hacspec_lib <> as_seq proj +R13341:13347 Examples.Hacspec_lib <> as_nseq proj +R13341:13347 Examples.Hacspec_lib <> as_nseq proj +R13324:13335 Hacspec.Hacspec_Lib <> array_to_seq def +R13314:13319 Examples.Hacspec_lib <> as_seq proj +R13314:13319 Examples.Hacspec_lib <> as_seq proj +R13314:13319 Examples.Hacspec_lib <> as_seq proj +R13341:13347 Examples.Hacspec_lib <> as_nseq proj +R13341:13347 Examples.Hacspec_lib <> as_nseq proj +R13324:13335 Hacspec.Hacspec_Lib <> array_to_seq def +R13393:13403 Examples.Hacspec_lib <> array_index def +R13406:13423 Examples.Hacspec_lib <> n_seq_array_or_seq def +not 13377:13377 <> :::x_'.['_x_']' +def 13484:13492 <> array_upd +R13498:13508 Crypt.choice_type <> choice_type ind +binder 13495:13495 <> A:109 +R13518:13526 Hacspec.Hacspec_Lib_Pre <> uint_size def +binder 13512:13514 <> len:110 +binder 13530:13530 <> L:111 +binder 13532:13532 <> I:112 +R13539:13542 Hacspec.ChoiceEquality <> both rec +R13549:13558 Hacspec.Hacspec_Lib_Pre <> :::'nseq' not +R13554:13554 Examples.Hacspec_lib <> A:109 var +R13556:13558 Examples.Hacspec_lib <> len:110 var +R13546:13546 Examples.Hacspec_lib <> I:112 var +R13544:13544 Examples.Hacspec_lib <> L:111 var +binder 13536:13536 <> s:113 +binder 13563:13564 <> WS:114 +R13571:13574 Hacspec.ChoiceEquality <> both rec +R13582:13584 Hacspec.Hacspec_Lib_Pre <> int syndef +R13586:13587 Examples.Hacspec_lib <> WS:114 var +R13578:13578 Examples.Hacspec_lib <> I:112 var +R13576:13576 Examples.Hacspec_lib <> L:111 var +binder 13568:13568 <> i:115 +R13599:13602 Hacspec.ChoiceEquality <> both rec +R13608:13608 Examples.Hacspec_lib <> A:109 var +R13606:13606 Examples.Hacspec_lib <> I:112 var +R13604:13604 Examples.Hacspec_lib <> L:111 var +binder 13592:13596 <> new_v:116 +R13613:13616 Hacspec.ChoiceEquality <> both rec +R13623:13632 Hacspec.Hacspec_Lib_Pre <> :::'nseq' not +R13628:13628 Examples.Hacspec_lib <> A:109 var +R13630:13632 Examples.Hacspec_lib <> len:110 var +R13620:13620 Examples.Hacspec_lib <> I:112 var +R13618:13618 Examples.Hacspec_lib <> L:111 var +R13669:13689 Hacspec.Hacspec_Lib <> array_upd syndef +R13691:13691 Examples.Hacspec_lib <> s:113 var +R13693:13693 Examples.Hacspec_lib <> i:115 var +R13695:13699 Examples.Hacspec_lib <> new_v:116 var +R13753:13761 Examples.Hacspec_lib <> array_upd def +not 13733:13733 <> :::x_'.['_x_']<-'_x +syndef 14317:14321 <> t_Seq +R14326:14328 Hacspec.Hacspec_Lib_Pre <> seq def +syndef 14779:14794 <> num_exact_chunks +R14799:14818 Hacspec.Hacspec_Lib <> seq_num_exact_chunks def +syndef 14830:14844 <> get_exact_chunk +R14849:14867 Hacspec.Hacspec_Lib <> seq_get_exact_chunk def +syndef 15201:15219 <> get_remainder_chunk +R15224:15246 Hacspec.Hacspec_Lib <> seq_get_remainder_chunk def +R15271:15274 Hacspec.Hacspec_Lib <> negb def +R15277:15279 Hacspec.Hacspec_Lib <> eqb def +not 15258:15258 <> :::x_'<>'_x +syndef 15298:15316 <> from_secret_literal +R15321:15347 Hacspec.Hacspec_Lib <> nat_mod_from_secret_literal def +syndef 15922:15925 <> zero +R15930:15941 Hacspec.Hacspec_Lib <> nat_mod_zero def +syndef 15953:15966 <> to_byte_seq_le +R15971:15992 Hacspec.Hacspec_Lib <> nat_mod_to_byte_seq_le def +syndef 16004:16019 <> U128_to_le_bytes +R16024:16039 Hacspec.Hacspec_Lib <> u128_to_le_bytes def +syndef 16051:16065 <> U64_to_le_bytes +R16070:16084 Hacspec.Hacspec_Lib <> u64_to_le_bytes def +syndef 16101:16116 <> from_byte_seq_le +R16121:16144 Hacspec.Hacspec_Lib <> nat_mod_from_byte_seq_le def +def 16158:16169 <> from_literal +binder 16172:16172 <> m:117 +R16178:16197 Hacspec.Hacspec_Lib <> nat_mod_from_literal def +R16199:16199 Examples.Hacspec_lib <> m:117 var +syndef 16211:16213 <> inv +R16218:16228 Hacspec.Hacspec_Lib <> nat_mod_inv def +syndef 16240:16251 <> update_start +R16256:16273 Hacspec.Hacspec_Lib <> array_update_start def +syndef 16285:16287 <> pow +R16292:16307 Hacspec.Hacspec_Lib <> nat_mod_pow_self def +syndef 16319:16321 <> bit +R16326:16336 Hacspec.Hacspec_Lib <> nat_mod_bit def +syndef 16509:16520 <> Build_secret +R16525:16530 Hacspec.Hacspec_Lib <> secret syndef +R16525:16530 Hacspec.Hacspec_Lib <> secret syndef +R16556:16559 Coq.Init.Datatypes <> prod ind +not 16542:16542 <> ::hacspec_scope:x_'-×'_x +syndef 16627:16634 <> Result_t +R16639:16644 Hacspec.Hacspec_Lib_Pre <> result def +ax 16653:16661 <> TODO_name +syndef 16680:16682 <> ONE +R16687:16697 Hacspec.Hacspec_Lib <> nat_mod_one def +syndef 16709:16711 <> exp +R16716:16726 Hacspec.Hacspec_Lib <> nat_mod_exp def +syndef 17062:17064 <> TWO +R17069:17079 Hacspec.Hacspec_Lib <> nat_mod_two def +syndef 17091:17092 <> ne +binder 17102:17102 <> x:119 +binder 17104:17104 <> y:120 +R17109:17112 Hacspec.Hacspec_Lib <> negb def +R17115:17117 Hacspec.Hacspec_Lib <> eqb def +R17121:17121 Examples.Hacspec_lib <> y:120 var +R17119:17119 Examples.Hacspec_lib <> x:119 var +syndef 17135:17136 <> eq +R17142:17144 Hacspec.Hacspec_Lib <> eqb def +syndef 17157:17168 <> rotate_right +R17174:17176 Hacspec.Hacspec_Lib_Pre <> ror syndef +R17174:17176 Hacspec.Hacspec_Lib_Pre <> ror syndef +syndef 17189:17198 <> to_be_U32s +R17203:17221 Hacspec.Hacspec_Lib <> array_to_be_uint32s def +syndef 17233:17241 <> get_chunk +R17246:17258 Hacspec.Hacspec_Lib <> seq_get_chunk def +syndef 17270:17279 <> num_chunks +R17284:17297 Hacspec.Hacspec_Lib <> seq_num_chunks def +syndef 17309:17323 <> U64_to_be_bytes +R17328:17345 Hacspec.Hacspec_Lib <> uint64_to_be_bytes def +syndef 17357:17367 <> to_be_bytes +R17372:17388 Hacspec.Hacspec_Lib <> array_to_be_bytes def +syndef 17400:17412 <> U8_from_usize +R17417:17432 Hacspec.Hacspec_Lib <> uint8_from_usize def +syndef 17444:17449 <> concat +R17454:17463 Hacspec.Hacspec_Lib <> seq_concat def +syndef 17475:17484 <> declassify +R17489:17490 Coq.Init.Datatypes <> id def +syndef 17502:17519 <> U128_from_be_bytes +R17524:17544 Hacspec.Hacspec_Lib <> uint128_from_be_bytes def +syndef 17556:17571 <> U128_to_be_bytes +R17576:17594 Hacspec.Hacspec_Lib <> uint128_to_be_bytes def +syndef 17606:17616 <> slice_range +R17621:17637 Hacspec.Hacspec_Lib <> array_slice_range def +syndef 17649:17656 <> truncate +R17661:17672 Hacspec.Hacspec_Lib <> seq_truncate def +ax 17681:17699 <> array_to_be_uint64s +binder 17711:17711 <> A:121 +binder 17713:17713 <> l:122 +R17725:17728 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R17717:17724 Hacspec.Hacspec_Lib_Pre <> :::'nseq' not +R17722:17722 Examples.Hacspec_lib <> A:121 var +R17724:17724 Examples.Hacspec_lib <> l:122 var +R17729:17731 Hacspec.Hacspec_Lib_Pre <> seq def +R17733:17738 Hacspec.Hacspec_Lib_Pre <> uint64 syndef +syndef 17750:17759 <> to_be_U64s +R17764:17782 Examples.Hacspec_lib <> array_to_be_uint64s prfax +syndef 17794:17801 <> classify +R17806:17807 Coq.Init.Datatypes <> id def +syndef 17819:17829 <> U64_from_U8 +R17834:17850 Hacspec.Hacspec_Lib <> uint64_from_uint8 def +def 18031:18043 <> Build_t_Range +binder 18046:18047 <> WS:124 +binder 18049:18050 <> L1:125 +binder 18052:18053 <> L2:126 +binder 18055:18056 <> I1:127 +binder 18058:18059 <> I2:128 +R18067:18070 Hacspec.ChoiceEquality <> both rec +R18079:18081 Hacspec.Hacspec_Lib_Pre <> int syndef +R18083:18084 Examples.Hacspec_lib <> WS:124 var +R18075:18076 Examples.Hacspec_lib <> I1:127 var +R18072:18073 Examples.Hacspec_lib <> L1:125 var +binder 18063:18063 <> a:129 +R18093:18096 Hacspec.ChoiceEquality <> both rec +R18105:18107 Hacspec.Hacspec_Lib_Pre <> int syndef +R18109:18110 Examples.Hacspec_lib <> WS:124 var +R18101:18102 Examples.Hacspec_lib <> I2:128 var +R18098:18099 Examples.Hacspec_lib <> L2:126 var +binder 18089:18089 <> b:130 +R18117:18117 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not +R18119:18119 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not +R18121:18121 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not +R18118:18118 Examples.Hacspec_lib <> a:129 var +R18120:18120 Examples.Hacspec_lib <> b:130 var +syndef 18133:18145 <> declassify_eq +R18150:18151 Examples.Hacspec_lib <> eq syndef +syndef 18163:18170 <> String_t +R18175:18187 Coq.Strings.String <> string ind +R18240:18243 Hacspec.ChoiceEquality <> both rec +R18256:18266 Crypt.package.pkg_notation PackageNotation ::package_scope:'['_'interface'_']' not +R18246:18249 extructures.fset <> fset def +R18251:18252 Coq.Lists.List ListNotations ::list_scope:'['_']' not +R18218:18225 Hacspec.ChoiceEquality <> ret_both def +R18232:18235 Hacspec.Hacspec_Lib_Pre <> int8 syndef +not 18200:18200 <> :::'i8('_x_')' +R18324:18327 Hacspec.ChoiceEquality <> both rec +R18340:18350 Crypt.package.pkg_notation PackageNotation ::package_scope:'['_'interface'_']' not +R18330:18333 extructures.fset <> fset def +R18335:18336 Coq.Lists.List ListNotations ::list_scope:'['_']' not +R18301:18308 Hacspec.ChoiceEquality <> ret_both def +R18315:18319 Hacspec.Hacspec_Lib_Pre <> int16 syndef +not 18282:18282 <> :::'i16('_x_')' +R18408:18411 Hacspec.ChoiceEquality <> both rec +R18424:18434 Crypt.package.pkg_notation PackageNotation ::package_scope:'['_'interface'_']' not +R18414:18417 extructures.fset <> fset def +R18419:18420 Coq.Lists.List ListNotations ::list_scope:'['_']' not +R18385:18392 Hacspec.ChoiceEquality <> ret_both def +R18399:18403 Hacspec.Hacspec_Lib_Pre <> int32 syndef +not 18366:18366 <> :::'i32('_x_')' +R18492:18495 Hacspec.ChoiceEquality <> both rec +R18508:18518 Crypt.package.pkg_notation PackageNotation ::package_scope:'['_'interface'_']' not +R18498:18501 extructures.fset <> fset def +R18503:18504 Coq.Lists.List ListNotations ::list_scope:'['_']' not +R18469:18476 Hacspec.ChoiceEquality <> ret_both def +R18483:18487 Hacspec.Hacspec_Lib_Pre <> int64 syndef +not 18450:18450 <> :::'i64('_x_')' +R18578:18581 Hacspec.ChoiceEquality <> both rec +R18594:18604 Crypt.package.pkg_notation PackageNotation ::package_scope:'['_'interface'_']' not +R18584:18587 extructures.fset <> fset def +R18589:18590 Coq.Lists.List ListNotations ::list_scope:'['_']' not +R18554:18561 Hacspec.ChoiceEquality <> ret_both def +R18568:18573 Hacspec.Hacspec_Lib_Pre <> int128 syndef +not 18534:18534 <> :::'i128('_x_')' +syndef 18621:18629 <> into_iter +binder 18639:18639 <> x:131 +R18644:18644 Examples.Hacspec_lib <> x:131 var diff --git a/ovn/proofs/ssprove/extraction/Hacspec_lib.v b/ovn/proofs/ssprove/extraction/Hacspec_lib.v new file mode 100644 index 0000000..6599048 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_lib.v @@ -0,0 +1,362 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib. + +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +Require Import Lia. +Require Import Coq.Logic.FunctionalExtensionality. +Require Import Sumbool. + +From mathcomp Require Import fintype. + +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset fmap. + +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith List. +Import ListNotations. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Declare Scope hacspec_scope. + +Open Scope list_scope. +Open Scope hacspec_scope. +Open Scope nat_scope. + +(* Require Import Hacspec_Lib_Comparable. *) + +Import choice.Choice.Exports. +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +(** Should be moved to Hacspec_Lib.v **) +Program Definition int_xI {WS : wsize} (a : (* both (fset []) ([interface]) *)(@int WS)) : (* both (fset []) ([interface]) *) (@int WS) := + Hacspec_Lib_Pre.int_add (Hacspec_Lib_Pre.int_mul a ((* lift_to_both (fset []) ([interface]) *) (@repr WS 2))) ((* lift_to_both (fset []) ([interface]) *) (@one WS)). +(* Next Obligation. intros ; now do 2 rewrite fsetU0. Defined. *) +(* Next Obligation. intros ; rewrite <- fset0E ; now do 2 rewrite fsetU0. Defined. *) + +Program Definition int_xO {WS : wsize} (a : int WS) : int WS := + Hacspec_Lib_Pre.int_mul a (@repr WS 2). +(* Next Obligation. intros ; now rewrite fsetU0. Defined. *) +(* Next Obligation. intros ; rewrite <- fset0E ; now rewrite fsetU0. Defined. *) + +Definition both_int_one {WS : wsize} : both (fset []) ([interface]) (@int WS) := ret_both (L := fset []) (one). + +Compute (Hacspec_Lib_Pre.int_add (repr U32 3%Z) (repr U32 8%Z)). + +Open Scope hacspec_scope. +Definition int_num {WS : wsize} := int WS. +Number Notation int_num Pos.of_num_int Pos.to_num_int (via positive mapping [[int_xI] => xI, [int_xO] => xO , [one] => xH]) : hacspec_scope. + +Notation "0" := (repr _ 0%Z) : hacspec_scope. + +Check 5 : int8. +Check 3 : int8. +Check 8 : int8. + +(* Notation U8_t := int8. *) +(* Notation U8 := id. *) +(* Notation U16_t := int16. *) +(* Notation U16 := id. *) +(* Notation U32_t := int32. *) +(* Notation U32 := id. *) +(* Notation U64_t := int64. *) +(* Notation U64 := id. *) +(* Notation U128_t := int128. *) +(* Notation U128 := id. *) + +Class Addition L1 L2 (* L3 *) I1 I2 (* I3 *) (A : choice_type) (* `(H_loc_fsubset13 : is_true (fsubset L1 L3)) `(H_opsig_fsubset13 : is_true (fsubset I1 I3)) `(H_loc_fsubset23 : is_true (fsubset L2 L3)) `(H_opsig_fsubset23 : is_true (fsubset I2 I3)) *) := + add : both L1 I1 A -> both L2 I2 A -> both (L1 :|: L2) (* L3 *) (I1 :|: I2) (* I3 *) A. +Notation "a .+ b" := (add a b). +(* Instance array_add_inst {ws : wsize} {len: uint_size} {L1 L2 I1 I2} : Addition L1 L2 I1 I2 (nseq (int ws) len) := { add a b := a array_add b }. *) +Instance int_add_inst {ws : wsize} {L1 L2 (* L3 *) I1 I2 (* I3 *)} (* `{H_loc_fsubset13 : is_true (fsubset L1 L3)} `{H_opsig_fsubset13 : is_true (fsubset I1 I3)} `{H_loc_fsubset23 : is_true (fsubset L2 L3)} `{H_opsig_fsubset23 : is_true (fsubset I2 I3)} *) : Addition L1 L2 (* L3 *) I1 I2 (* I3 *) (@int ws) (* H_loc_fsubset13 H_opsig_fsubset13 H_loc_fsubset23 H_opsig_fsubset23 *) := { add a b := int_add (* (H_loc_incl_x := H_loc_fsubset13) (H_opsig_incl_x := H_opsig_fsubset13) (H_loc_incl_y := H_loc_fsubset23) (H_opsig_incl_y := H_opsig_fsubset23) *) a b }. + +Class Subtraction L1 L2 (* L3 *) I1 I2 (* I3 *) (A : choice_type) (* `(H_loc_fsubset13 : is_true (fsubset L1 L3)) `(H_opsig_fsubset13 : is_true (fsubset I1 I3)) `(H_loc_fsubset23 : is_true (fsubset L2 L3)) `(H_opsig_fsubset23 : is_true (fsubset I2 I3)) *) := + sub : both L1 I1 A -> both L2 I2 A -> both (L1 :|: L2) (* L3 *) (I1 :|: I2) (* I3 *) A. +Notation "a .- b" := (sub a b (Subtraction := _)). +(* Instance array_sub_inst {ws : wsize} {len: uint_size} {L1 L2 I1 I2} : Subtraction L1 L2 I1 I2 (nseq (@int ws) len) := { sub a b := a array_minus b }. *) +Instance int_sub_inst {ws : wsize} {L1 L2 L3 I1 I2 I3} `{H_loc_fsubset13 : is_true (fsubset L1 L3)} `{H_opsig_fsubset13 : is_true (fsubset I1 I3)} `{H_loc_fsubset23 : is_true (fsubset L2 L3)} `{H_opsig_fsubset23 : is_true (fsubset I2 I3)} : Subtraction L1 L2 (* L3 *) I1 I2 (* I3 *) (@int ws) (* H_loc_fsubset13 H_opsig_fsubset13 H_loc_fsubset23 H_opsig_fsubset23 *) := { sub a b := int_sub (* (H_loc_incl_x := H_loc_fsubset13) (H_opsig_incl_x := H_opsig_fsubset13) (H_loc_incl_y := H_loc_fsubset23) (H_opsig_incl_y := H_opsig_fsubset23) *) a b }. + +Class Multiplication (L1 L2 (* L3 *) : {fset Location}) (I1 I2 (* I3 *) : Interface) A (* `(H_loc_incl1 : is_true (fsubset L1 L3)) (H_opsig_incl1 : is_true (fsubset I1 I3)) (H_loc_incl2 : is_true (fsubset L2 L3)) (H_opsig_incl2 : is_true (fsubset I2 I3)) *) := mul : both L1 I1 A -> both L2 I2 A -> both (L1 :|: L2) (* L3 *) (I1 :|: I2) (* I3 *) A. +Notation "a .* b" := (mul a b). +(* Instance array_mul_inst {ws : wsize} {len: uint_size} { L1 L2 I1 I2} : Multiplication L1 L2 I1 I2 (nseq (@int ws) len) := { mul a b := a array_mul b }. *) +Program Instance int_mul_inst {ws : wsize} { L1 L2 (* L3 *) : {fset Location} } { I1 I2 (* I3 *) : Interface} (* `{H_loc_incl1 : is_true (fsubset L1 L3)} `{H_opsig_incl1 : is_true (fsubset I1 I3)} `{H_loc_incl2 : is_true (fsubset L2 L3)} `{H_opsig_incl2 : is_true (fsubset I2 I3)} *) : Multiplication L1 L2 (* L3 *) I1 I2 (* I3 *) (@int ws) (* H_loc_incl1 H_opsig_incl1 H_loc_incl2 H_opsig_incl2 *) := { mul a b := int_mul a b }. +Fail Next Obligation. + +Class Xor (L1 L2 (* L3 *) : {fset Location}) (I1 I2 (* I3 *) : Interface) A (* `(H_loc_incl1 : is_true (fsubset L1 L3)) (H_opsig_incl1 : is_true (fsubset I1 I3)) (H_loc_incl2 : is_true (fsubset L2 L3)) (H_opsig_incl2 : is_true (fsubset I2 I3)) *) := xor : both L1 I1 A -> both L2 I2 A -> both (L1 :|: L2) (* L3 *) (I1 :|: I2) (* I3 *) A. +Notation "a .^ b" := (xor a b). + +(* Instance array_xor_inst {ws : wsize} {len: uint_size} {L1 L2 I1 I2} : Xor L1 L2 I1 I2 (nseq (@int ws) len) := { xor a b := a array_xor b }. *) +Program Instance int_xor_inst {ws : wsize} {L1 L2 (* L3 *) I1 I2 (* I3 *)} (* `{H_loc_incl1 : is_true (fsubset L1 L3)} `{H_opsig_incl1 : is_true (fsubset I1 I3)} `{H_loc_incl2 : is_true (fsubset L2 L3)} `{H_opsig_incl2 : is_true (fsubset I2 I3)} *) : Xor L1 L2 (* L3 *) I1 I2 (* I3 *) (@int ws) (* H_loc_incl1 H_opsig_incl1 H_loc_incl2 H_opsig_incl2 *) := { xor a b := int_xor a b }. +Fail Next Obligation. + +(* Definition new {A : choice_type} {len} : nseq A len := array_new_ default _. *) + +(* (* Axiom conv : A -> B. *) *) +(* (* Coercion conv : A >-> B. *) *) +(* (* Check (fun x : A => x : B). *) *) + +(* Record mixin_of A := *) +(* Mixin { *) +(* as_nseq :> both A ; *) +(* as_seq :> both A ; *) +(* }. *) +(* (* Check choice_type_class_of. *) *) +(* Record class_of (A : choice_type) := { *) +(* base : choice.Choice.sort A ; *) +(* mixin : mixin_of A *) +(* }. *) +(* Structure type := Pack {sort : choice_type ; _ : class_of sort }. *) + +(* Coercion mixin : class_of >-> mixin_of. *) +(* Coercion sort : type >-> choice_type. *) + +Structure array_or_seq A L I (len : nat) := + { as_nseq :> both L I (nseq_ A len) ; + as_seq :> both L I (seq A) + }. +Print as_seq. +Print as_nseq. + +Print Graph. + +(* Check (fun x : array_or_seq 'nat 25 => x : (* both_seq *) seq 'nat). *) +(* Check (fun x : array_or_seq 'nat 25 => x : (* both_nseq *) (nseq 'nat 25)). *) + +Arguments as_seq {_} {_} {_} {_}. (* array_or_seq. *) +Arguments as_nseq {_} {_} {_} {_}. (* array_or_seq. *) +(* Coercion as_seq : array_or_seq >-> both. *) +(* Coercion as_nseq : array_or_seq >-> both. *) + + + +(* Check (fun x : array_or_seq 'nat fset0 (fset []) 25 => x : both (fset []) ([interface]) (nseq 'nat 25)). *) + +(* Definition nseq_array_or_seq {A L I len} (a : both L I (nseq A len)) := *) +(* Build_array_or_seq A L I len (array_to_seq a) a. *) +(* Canonical (* Structure *) nseq_array_or_seq. *) + +Equations nseq_array_or_seq {A L I len} (val : both L I (nseq_ A len)) : array_or_seq A L I len := + nseq_array_or_seq val := {| as_seq := array_to_seq val ; as_nseq := val |}. +Fail Next Obligation. + +Arguments nseq_array_or_seq {A} {L} {I} {len}. +Check nseq_array_or_seq. +Coercion nseq_array_or_seq : both >-> array_or_seq. +Canonical Structure nseq_array_or_seq. + +(* Check (fun (x : both (fset []) ([interface]) (nseq 'nat 25)) => x : array_or_seq 'nat fset0 (fset []) 25). *) + +(* (* TODO: use of is pure here is an issue!! *) *) +(* Definition seq_array_or_seq {A : choice_type} {L I} (a : both L I (seq A)) : array_or_seq A L I (is_pure (seq_len (* (H_loc_incl_x := fsubsetxx _) (H_opsig_incl_x := fsubsetxx _) *) a : both L I _)) := *) +(* {| as_seq := a ; as_nseq := array_from_seq _ a ; |}. *) + +(* Coercion seq_array_or_seq : both >-> array_or_seq. *) +(* Canonical Structure seq_array_or_seq. *) + +(* Definition seq_array_or_seq {A L I len} (a : both L I (seq A)) := *) +(* Build_array_or_seq A L I len a (array_from_seq (from_uint_size len) a). *) +(* Canonical (* Structure *) seq_array_or_seq. *) +(* Print Canonical Projections . *) + +Program Definition (* Equations *) array_index {A: choice_type} {len : nat} {L1 L2 I1 I2} (s: array_or_seq A L1 I1 len) {WS} (i : both L2 I2 (@int WS)) : both (L1 :|: L2) (I1 :|: I2) A := + (* array_index s i := *)Hacspec_Lib.array_index (as_nseq s) i. +Fail Next Obligation. + +(* Definition array_index {A: choice_type} {len : uint_size} {L I} (s: both L I (nseq A len)) {WS} (i : both L I (@int WS)) := array_index s i. *) + +(* Definition size : forall {L I A len} {B} (H : {B = nseq A len} + {(B = seq A)}) (x : both L I B) `{len : match H with left _ => True | right b => len = eq_rect_r (fun B0 : choice_type => both L I B0 -> uint_size) (fun x' => is_pure (seq_len x')) b x end}, uint_size. *) +(* Proof. *) +(* intros. *) +(* destruct H ; subst. *) +(* refine len. *) +(* refine (is_pure (seq_len x)). *) +(* Show Proof. *) +(* Show Proof. *) +(* Qed. *) + +(* Close Scope hacspec_scope. *) +(* Print Prelude.positive. *) +(* Definition len_of_nseq (H : choice_type) `{contra : match H with *) +(* | chUnit => True *) +(* | chMap (chFin (mkpos (S n) cond_pos) ) (A) => True *) +(* | _ => False *) +(* end} : nat. *) +(* refine *) +(* (match H as K return match K with *) +(* | chUnit => True *) +(* | chMap (chFin (mkpos (S n) cond_pos)) (A) => True *) +(* | _ => False *) +(* end -> nat with *) +(* | chUnit => fun _ => 0%nat *) +(* | chMap (chFin (mkpos pos cond_pos)) A => *) +(* match pos as n return *) +(* match n with *) +(* | O => False *) +(* | _ => True *) +(* end -> nat *) +(* with *) +(* | O => fun m_contra => False_rect nat m_contra *) +(* | S n => fun _ => S n *) +(* end *) +(* | _ => fun m_contra => False_rect nat m_contra *) +(* end contra). *) + +Definition n_seq_array_or_seq {L I A} {B} (x : both L I B) + `(contra : match B with + | chUnit => True + | chMap (chFin (@mkpos (S n) _)) (C) => C = A + | chMap 'nat (C) => C = A + | _ => False + end) : + let len := (match B as K return + match K with + | chUnit => True + | chMap (chFin (@mkpos (S n) _)) (C) => C = A + | chMap 'nat (C) => C = A + | _ => False + end -> nat + with + | chUnit => fun _ => 0%nat + | chMap (chFin (@mkpos p _)) C => + fun m_contra => + match p as p_ return match p_ with + | O => False + | _ => C = A + end -> nat + with + | O => fun m_contra => False_rect nat m_contra + | S n => fun _ => S n + end m_contra + | chMap 'nat C => + fun m_contra => 3%nat + | _ => fun m_contra => False_rect nat m_contra + end contra) in + array_or_seq A L I len. +Proof. + intros. + destruct B ; try contradiction contra. + - change 'unit with (nseq_ A len) in x. + exact {| as_seq := array_to_seq x ; as_nseq := x |}. + - destruct B1 ; try contradiction contra ; simpl in *. + + subst. + change (chMap 'nat A) with (seq A) in x. + exact ({| as_seq := x ; as_nseq := array_from_seq _ x ; |}). + + destruct n. + destruct pos. + * contradiction. + * subst. + replace (chMap (chFin _) A) with (nseq_ A len) in x. + 2:{ + simpl. + f_equal. + f_equal. + apply (ssrbool.elimT (positive_eqP _ _)). + unfold positive_eq. + apply eqtype.eq_refl. + } + exact {| as_seq := array_to_seq x ; as_nseq := x |}. +Defined. + +Notation " x .[ a ]" := (array_index (n_seq_array_or_seq x _) a) (at level 40). + +Program Definition (* Equations *) array_upd {A: choice_type} {len : uint_size} {L I} (s: both L I (nseq A len)) {WS} (i: both L I (@int WS)) (new_v: both L I A) : both L I (nseq A len) := + (* array_upd s i new_v := *) Hacspec_Lib.array_upd s i new_v. +Fail Next Obligation. +Notation " x .[ i ]<- a" := (array_upd x i a) (at level 40). + +(* Definition update {A : Type} `{Default A} {len slen} (s : nseq A len) {WS} (start : @int WS) (start_a : array_or_seq A slen) : nseq A len := *) +(* array_update (a := A) (len := len) s (unsigned start) (as_seq start_a). *) + +(* Definition to_le_U32s {A l} := array_to_le_uint32s (A := A) (l := l). *) +(* Axiom to_le_bytes : forall {ws : wsize} {len}, nseq (@int ws) len -> seq int8. *) +(* Definition from_seq {A : Type} `{Default A} {len slen} (s : array_or_seq A slen) : nseq A len := array_from_seq _ (as_seq s). *) + +Notation t_Seq := seq. +(* Notation len := (fun s => seq_len s : int32). *) + +(* Definition array_slice {a: Type} `{Default a} {len : nat} (input: nseq a len) {WS} (start: @int WS) (slice_len: @int WS) : seq a := slice (array_to_seq input) (unsigned start) (unsigned (start .+ slice_len)). *) +(* Notation slice := array_slice. *) +(* Definition seq_new {A: Type} `{Default A} {WS} (len: @int WS) : seq A := seq_new (unsigned len). *) +(* Notation new := seq_new. *) +Notation num_exact_chunks := seq_num_exact_chunks. +Notation get_exact_chunk := seq_get_exact_chunk. +(* Definition set_chunk {a: Type} `{Default a} {len} (s: seq a) {WS} (chunk_len: @int WS) (chunk_num: @int WS) (chunk: array_or_seq a len) : seq a := seq_set_chunk s (unsigned chunk_len) (unsigned chunk_num) (as_seq chunk). *) +(* Definition set_exact_chunk {a} `{H : Default a} {len} s {WS} := @set_chunk a H len s WS. *) +Notation get_remainder_chunk := seq_get_remainder_chunk. +Notation "a <> b" := (negb (eqb a b)). + +Notation from_secret_literal := nat_mod_from_secret_literal. +(* Definition pow2 {m} (x : @int wsize32) := nat_mod_pow2 m (unsigned x). *) +(* Instance nat_mod_addition {n} : Addition (nat_mod n) := { add a b := a +% b }. *) +(* Instance nat_mod_subtraction {n} : Subtraction (nat_mod n) := { sub a b := a -% b }. *) +(* Instance nat_mod_multiplication {n} : Multiplication (nat_mod n) := { mul a b := a *% b }. *) +(* Definition from_slice {a: Type} `{Default a} {len slen} (x : array_or_seq a slen) {WS} (start: @int WS) (slice_len: @int WS) := array_from_slice default len (as_seq x) (unsigned start) (unsigned slice_len). *) +Notation zero := nat_mod_zero. +Notation to_byte_seq_le := nat_mod_to_byte_seq_le. +Notation U128_to_le_bytes := u128_to_le_bytes. +Notation U64_to_le_bytes := u64_to_le_bytes. + Notation from_byte_seq_le := nat_mod_from_byte_seq_le. +Definition from_literal {m} := nat_mod_from_literal m. +Notation inv := nat_mod_inv. +Notation update_start := array_update_start. +Notation pow := nat_mod_pow_self. +Notation bit := nat_mod_bit. + +(* Definition int_to_int {ws1 ws2} (i : @int ws1) : @int ws2 := repr (unsigned i). *) +(* Coercion int_to_int : int >-> int. *) +(* Notation push := seq_push. *) +Notation Build_secret := secret. +Notation "a -× b" := +(prod a b) (at level 80, right associativity) : hacspec_scope. +Notation Result_t := result. +Axiom TODO_name : Type. +Notation ONE := nat_mod_one. +Notation exp := nat_mod_exp. +(* Notation nat_mod := GZnZ.znz. *) +(* Instance nat_mod_znz_addition {n} : Addition (GZnZ.znz n) := { add a b := a +% b }. *) +(* Instance nat_mod_znz_subtraction {n} : Subtraction (GZnZ.znz n) := { sub a b := a -% b }. *) +(* Instance nat_mod_znz_multiplication {n} : Multiplication (GZnZ.znz n) := { mul a b := a *% b }. *) +Notation TWO := nat_mod_two. +Notation ne := (fun x y => negb (eqb x y)). +Notation eq := (eqb). +Notation rotate_right := (ror). +Notation to_be_U32s := array_to_be_uint32s. +Notation get_chunk := seq_get_chunk. +Notation num_chunks := seq_num_chunks. +Notation U64_to_be_bytes := uint64_to_be_bytes. +Notation to_be_bytes := array_to_be_bytes. +Notation U8_from_usize := uint8_from_usize. +Notation concat := seq_concat. +Notation declassify := id. +Notation U128_from_be_bytes := uint128_from_be_bytes. +Notation U128_to_be_bytes := uint128_to_be_bytes. +Notation slice_range := array_slice_range. +Notation truncate := seq_truncate. +Axiom array_to_be_uint64s : forall {A l}, nseq A l -> seq uint64. +Notation to_be_U64s := array_to_be_uint64s. +Notation classify := id. +Notation U64_from_U8 := uint64_from_uint8. +(* Definition Build_Range_t (a b : nat) := (a,b). (* match (b - a)%nat with O => [] | S n => match b with | O => [] | S b' => Build_Range_t a b' ++ [b] end end. *) *) +Definition Build_t_Range {WS L1 L2 I1 I2} (a : both L1 I1 (int WS)) (b : both L2 I2 (int WS)) := (a,b). +Notation declassify_eq := eq. +Notation String_t := String.string. + +Notation "'i8(' v ')'" := (ret_both (v : int8) : both (fset []) ([interface]) _). +Notation "'i16(' v ')'" := (ret_both (v : int16) : both (fset []) ([interface]) _). +Notation "'i32(' v ')'" := (ret_both (v : int32) : both (fset []) ([interface]) _). +Notation "'i64(' v ')'" := (ret_both (v : int64) : both (fset []) ([interface]) _). +Notation "'i128(' v ')'" := (ret_both (v : int128) : both (fset []) ([interface]) _). + +Notation into_iter := (fun x => x). +(** end of: Should be moved to Hacspec_Lib.v **) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_lib.vo b/ovn/proofs/ssprove/extraction/Hacspec_lib.vo new file mode 100644 index 0000000000000000000000000000000000000000..98a2f26594c2cbc32a6d95486071189a12335145 GIT binary patch literal 123685 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≫NZ&*?V)f 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 SvpnV-Q5*vgZn4y5i2n~qCP< + bind_both f_sign (fun f_sign => + bind_both f_b (fun f_b => + ret_both f_b f_sign f_signed))) : both L I (t_QueryCanvas). +Fail Next Obligation. + +Program Definition max_under_impl_16 : both (fset []) ([interface ]) (t_Output) := + ((from i32(1)) shift_left i32(384)) .- one. +Fail Next Obligation. + +Program Definition max_value_under_impl_16 : both (fset []) ([interface ]) (t_QueryCanvas) := + from max_under_impl_16. +Fail Next Obligation. + +(*item error backend*) + +Program Definition from_literal_under_impl_16 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_QueryCanvas) := + letb big_x := (from x) : both _ _ (t_BigInt) in + letb _ := (ifb big_x >.? (into max_under_impl_16) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; + too big for type QueryCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + into big_x. +Fail Next Obligation. + +Program Definition from_signed_literal_under_impl_16 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_QueryCanvas) := + letb big_x := (from (cast_int x)) : both _ _ (t_BigInt) in + letb _ := (ifb big_x >.? (into max_under_impl_16) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; + too big for type QueryCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + into big_x. +Fail Next Obligation. + +Program Definition pow2_under_impl_16 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_QueryCanvas) := + into ((from i32(1)) shift_left x). +Fail Next Obligation. + +(*item error backend*) + +#[global] Instance t_QueryCanvas_t_From : t_From t_QueryCanvas t_BigUint := { + from (x : t_BigUint) := from (from x); +}. + +#[global] Instance t_QueryCanvas_t_From : t_From t_QueryCanvas t_BigInt := { + from (x : t_BigInt) := letb max_value := (max_under_impl_16) : both _ _ (t_BigInt) in + letb _ := (ifb not (x <=.? max_value) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [; + is too large for type QueryCanvas!])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb '(sign,repr) := (to_bytes_be_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in + letb _ := (ifb andb (sign =.? Sign_Minus) (not false) + then letb 'tt := (never_to_any (begin_panic Trying to convert a negative number into an unsigned integer!)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb _ := (ifb (len_under_impl_1 repr) >.? ((i32(384) .+ i32(7)) ./ i32(8)) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [; + is too large for type QueryCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letbm out loc(out_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in + letb upper := (len_under_impl (unsize out)) : both _ _ (uint_size) in + letb lower := (upper .- (len_under_impl_1 repr)) : both _ _ (uint_size) in + letb _ := (failure RefMut:The mutation of this &mut is not allowed here. + core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (out), + core::ops::range::Range { + f_start: lower, + f_end: upper, + }, + ))), + &(deref(core::ops::deref::Deref::deref(&(deref(&(repr)))))), + )) : both _ _ (unit) in + Build_t_QueryCanvas outsignfalse; +}. + +#[global] Instance t_QueryCanvas_t_Default : t_Default t_QueryCanvas := { + default := Build_t_QueryCanvas (repeat i8(0) i32(48))Sign_Plusfalse; +}. + +#[global] Instance t_QueryCanvas_t_Into : t_Into t_QueryCanvas t_BigInt := { + into (self : t_QueryCanvas) := from_bytes_be_under_impl_24 (f_sign self) (unsize (f_b self)); +}. + +#[global] Instance t_QueryCanvas_t_Into : t_Into t_QueryCanvas t_BigUint := { + into (self : t_QueryCanvas) := from_bytes_be_under_impl_18 (unsize (f_b self)); +}. + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*item error backend*) + +Definition repr_loc : Location := + (nseq int8 TODO: Int.to_string length ; 9%nat). +Program Definition from_be_bytes_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_QueryCanvas) := + letb _ := (ifb true + then letb _ := (ifb not ((len_under_impl v) <=.? ((i32(384) .+ i32(7)) ./ i32(8))) + then letb 'tt := (never_to_any (begin_panic from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in + letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in + letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in + letb _ := (failure RefMut:The mutation of this &mut is not allowed here. + core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (repr), + core::ops::range::Range { + f_start: lower, + f_end: upper, + }, + ))), + &(deref(deref(&(v)))), + )) : both _ _ (unit) in + Build_t_QueryCanvas reprSign_Plusfalse. +Fail Next Obligation. + +Definition repr_loc : Location := + (nseq int8 TODO: Int.to_string length ; 10%nat). +Program Definition from_le_bytes_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_QueryCanvas) := + letb _ := (ifb true + then letb _ := (ifb not ((len_under_impl v) <=.? ((i32(384) .+ i32(7)) ./ i32(8))) + then letb 'tt := (never_to_any (begin_panic from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in + letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in + letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in + letb _ := (failure RefMut:The mutation of this &mut is not allowed here. + core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (repr), + core::ops::range::Range { + f_start: lower, + f_end: upper, + }, + ))), + &(deref(deref(&(v)))), + )) : both _ _ (unit) in + into (from_bytes_le_under_impl_24 Sign_Plus (unsize repr)). +Fail Next Obligation. + +Program Definition to_be_bytes_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_QueryCanvas)) : both (L1) (I1) (nseq int8 TODO: Int.to_string length) := + f_b self. +Fail Next Obligation. + +Definition repr_loc : Location := + (nseq int8 TODO: Int.to_string length ; 11%nat). +Program Definition to_le_bytes_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_QueryCanvas)) : both (L1 :|: fset [repr_loc]) (I1) (nseq int8 TODO: Int.to_string length) := + letb x := (from_bytes_be_under_impl_24 Sign_Plus (unsize (f_b self))) : both _ _ (t_BigInt) in + letb '(_,x_s) := (to_bytes_le_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in + letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in + letb _ := (failure RefMut:The mutation of this &mut is not allowed here. + core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (repr), + core::ops::range::Range { + f_start: 0, + f_end: alloc::vec::len_under_impl_1(&(x_s)), + }, + ))), + &(deref(core::ops::deref::Deref::deref(&(deref(&(x_s)))))), + )) : both _ _ (unit) in + repr. +Fail Next Obligation. + +Program Definition comp_eq_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QueryCanvas)) (rhs : both L2 I2 (t_QueryCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a =.? b + then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_QueryCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_ne_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QueryCanvas)) (rhs : both L2 I2 (t_QueryCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a <> b + then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_QueryCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_gte_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QueryCanvas)) (rhs : both L2 I2 (t_QueryCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a >=.? b + then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_QueryCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_gt_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QueryCanvas)) (rhs : both L2 I2 (t_QueryCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a >.? b + then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_QueryCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_lte_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QueryCanvas)) (rhs : both L2 I2 (t_QueryCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a <=.? b + then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_QueryCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_lt_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QueryCanvas)) (rhs : both L2 I2 (t_QueryCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a <.? b + then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_QueryCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition inv_under_impl_27 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QueryCanvas)) (modval : both L2 I2 (t_QueryCanvas)) : both (L1:|:L2) (I1:|:I2) (t_QueryCanvas) := + letb biguintmodval := (into modval) : both _ _ (t_BigInt) in + letb m := (biguintmodval .- (from i32(2))) : both _ _ (t_Output) in + letb s := (into self) : both _ _ (t_BigInt) in + into (modpow_under_impl_24 s m biguintmodval). +Fail Next Obligation. + +Program Definition pow_felem_under_impl_27 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_QueryCanvas)) (exp : both L2 I2 (t_QueryCanvas)) (modval : both L3 I3 (t_QueryCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_QueryCanvas) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into exp) : both _ _ (t_BigInt) in + letb m := (into modval) : both _ _ (t_BigInt) in + letb c := (modpow_under_impl_24 a b m) : both _ _ (t_BigInt) in + into c. +Fail Next Obligation. + +Program Definition pow_under_impl_27 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_QueryCanvas)) (exp : both L2 I2 (int128)) (modval : both L3 I3 (t_QueryCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_QueryCanvas) := + pow_felem_under_impl_27 self (into (from exp)) modval. +Fail Next Obligation. + +Program Definition rem_under_impl_27 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QueryCanvas)) (n : both L2 I2 (t_QueryCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + self .% n. +Fail Next Obligation. + +#[global] Instance t_QueryCanvas_t_Add : t_Add t_QueryCanvas t_QueryCanvas := { + t_Output := t_QueryCanvas; + add (self : t_QueryCanvas) (rhs : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb c := (a .+ b) : both _ _ (t_Output) in + letb _ := (ifb c >.? max_under_impl_16 + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded addition overflow for type QueryCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + into c; +}. + +#[global] Instance t_QueryCanvas_t_Sub : t_Sub t_QueryCanvas t_QueryCanvas := { + t_Output := t_QueryCanvas; + sub (self : t_QueryCanvas) (rhs : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb c := (ifb f_signed self + then a .- b + else unwrap_or_else_under_impl (checked_sub_under_impl_24 a b) ( + never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded substraction underflow for type QueryCanvas])) (unsize none_under_impl_1))))) : both _ _ (t_Output) in + into c; +}. + +#[global] Instance t_QueryCanvas_t_Mul : t_Mul t_QueryCanvas t_QueryCanvas := { + t_Output := t_QueryCanvas; + mul (self : t_QueryCanvas) (rhs : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb c := (a .* b) : both _ _ (t_Output) in + letb _ := (ifb c >.? max_under_impl_16 + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded multiplication overflow for type QueryCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + into c; +}. + +#[global] Instance t_QueryCanvas_t_Div : t_Div t_QueryCanvas t_QueryCanvas := { + t_Output := t_QueryCanvas; + div (self : t_QueryCanvas) (rhs : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb _ := (ifb b =.? zero + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [dividing by zero in type QueryCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb c := (a ./ b) : both _ _ (t_Output) in + into c; +}. + +#[global] Instance t_QueryCanvas_t_Rem : t_Rem t_QueryCanvas t_QueryCanvas := { + t_Output := t_QueryCanvas; + rem (self : t_QueryCanvas) (rhs : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb _ := (ifb b =.? zero + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [dividing by zero in type QueryCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb c := (a .% b) : both _ _ (t_Output) in + into c; +}. + +#[global] Instance t_QueryCanvas_t_Not : t_Not t_QueryCanvas := { + t_Output := t_QueryCanvas; + not (self : t_QueryCanvas) := never_to_any (panic not implemented); +}. + +#[global] Instance t_QueryCanvas_t_BitOr : t_BitOr t_QueryCanvas t_QueryCanvas := { + t_Output := t_QueryCanvas; + bitor (self : t_QueryCanvas) (rhs : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + into (a .| b); +}. + +#[global] Instance t_QueryCanvas_t_BitXor : t_BitXor t_QueryCanvas t_QueryCanvas := { + t_Output := t_QueryCanvas; + bitxor (self : t_QueryCanvas) (rhs : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + into (a .^ b); +}. + +#[global] Instance t_QueryCanvas_t_BitAnd : t_BitAnd t_QueryCanvas t_QueryCanvas := { + t_Output := t_QueryCanvas; + bitand (self : t_QueryCanvas) (rhs : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + into (a .& b); +}. + +#[global] Instance t_QueryCanvas_t_Shr : t_Shr t_QueryCanvas uint_size := { + t_Output := t_QueryCanvas; + shr (self : t_QueryCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (rhs) : both _ _ (uint_size) in + into (a shift_right b); +}. + +#[global] Instance t_QueryCanvas_t_Shl : t_Shl t_QueryCanvas uint_size := { + t_Output := t_QueryCanvas; + shl (self : t_QueryCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (rhs) : both _ _ (uint_size) in + into (a shift_left b); +}. + +#[global] Instance t_QueryCanvas_t_PartialEq : t_PartialEq t_QueryCanvas t_QueryCanvas := { + eq (self : t_QueryCanvas) (rhs : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + a =.? b; +}. + +#[global] Instance t_QueryCanvas_t_Eq : t_Eq t_QueryCanvas := { +}. + +#[global] Instance t_QueryCanvas_t_PartialOrd : t_PartialOrd t_QueryCanvas t_QueryCanvas := { + partial_cmp (self : t_QueryCanvas) (other : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into other) : both _ _ (t_BigInt) in + partial_cmp a b; +}. + +#[global] Instance t_QueryCanvas_t_Ord : t_Ord t_QueryCanvas := { + cmp (self : t_QueryCanvas) (other : t_QueryCanvas) := unwrap_under_impl (partial_cmp self other); +}. + +Program Definition from_byte_seq_be_under_impl_8 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_QueryCanvas) := + from_be_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + declassify_under_impl_2 x)))). +Fail Next Obligation. + +Program Definition from_public_byte_seq_be_under_impl_8 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_QueryCanvas) := + from_be_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + x)))). +Fail Next Obligation. + +Program Definition to_byte_seq_be_under_impl_8 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_QueryCanvas)) : both (L1) (I1) (t_Seq (t_U8)) := + from_vec_under_impl_52 (collect (map (iter_under_impl (unsize (to_be_bytes_under_impl_15 self))) (fun x => + classify_under_impl_2 x))). +Fail Next Obligation. + +#[global] Instance t_QueryCanvas_t_NumericCopy : t_NumericCopy t_QueryCanvas := { +}. + +#[global] Instance t_QueryCanvas_t_UnsignedInteger : t_UnsignedInteger t_QueryCanvas := { +}. + +#[global] Instance t_QueryCanvas_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_QueryCanvas := { +}. + +#[global] Instance t_QueryCanvas_t_Integer : t_Integer t_QueryCanvas := { + NUM_BITS := i32(384); + ZERO := from_literal_under_impl_16 i128(0); + ONE := from_literal_under_impl_16 i128(1); + TWO := from_literal_under_impl_16 i128(2); + from_literal (val : int128) := from_literal_under_impl_16 val; + from_hex_string (s : t_String) := from_hex_under_impl_15 (deref (replace_under_impl_5 (deref s) 0x )); + get_bit (self : t_QueryCanvas) (i : uint_size) := (self shift_right i) .& v_ONE; + set_bit (self : t_QueryCanvas) (b : t_QueryCanvas) (i : uint_size) := letb _ := (ifb true + then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) + then letb 'tt := (never_to_any (panic assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb tmp1 := (from_literal_under_impl_16 (not (i128(1) shift_left i))) : both _ _ (t_QueryCanvas) in + letb tmp2 := (b shift_left i) : both _ _ (t_Output) in + (self .& tmp1) .| tmp2; + set (self : t_QueryCanvas) (pos : uint_size) (y : t_QueryCanvas) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_QueryCanvas) in + set_bit self b pos; + rotate_left (self : t_QueryCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + ((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); + rotate_right (self : t_QueryCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + ((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); +}. + +#[global] Instance t_QueryCanvas_t_ModNumeric : t_ModNumeric t_QueryCanvas := { + sub_mod (self : t_QueryCanvas) (rhs : t_QueryCanvas) (n : t_QueryCanvas) := (self .- rhs) .% n; + add_mod (self : t_QueryCanvas) (rhs : t_QueryCanvas) (n : t_QueryCanvas) := (self .+ rhs) .% n; + mul_mod (self : t_QueryCanvas) (rhs : t_QueryCanvas) (n : t_QueryCanvas) := (self .* rhs) .% n; + pow_mod (self : t_QueryCanvas) (exp : t_QueryCanvas) (n : t_QueryCanvas) := pow_felem_under_impl_27 self exp n; + modulo (self : t_QueryCanvas) (n : t_QueryCanvas) := self .% n; + signed_modulo (self : t_QueryCanvas) (n : t_QueryCanvas) := modulo self n; + absolute (self : t_QueryCanvas) := self; +}. + +#[global] Instance t_QueryCanvas_t_Numeric : t_Numeric t_QueryCanvas := { + max_val := max_value_under_impl_16; + wrap_add (self : t_QueryCanvas) (rhs : t_QueryCanvas) := self .+ rhs; + wrap_sub (self : t_QueryCanvas) (rhs : t_QueryCanvas) := self .- rhs; + wrap_mul (self : t_QueryCanvas) (rhs : t_QueryCanvas) := self .* rhs; + wrap_div (self : t_QueryCanvas) (rhs : t_QueryCanvas) := self ./ rhs; + exp (self : t_QueryCanvas) (exp : int32) := pow_under_impl_27 self (into exp) max_val; + pow_self (self : t_QueryCanvas) (exp : t_QueryCanvas) := pow_felem_under_impl_27 self (into exp) max_val; + divide (self : t_QueryCanvas) (rhs : t_QueryCanvas) := self ./ rhs; + inv (self : t_QueryCanvas) (n : t_QueryCanvas) := inv_under_impl_27 self n; + equal (self : t_QueryCanvas) (other : t_QueryCanvas) := self =.? other; + greater_than (self : t_QueryCanvas) (other : t_QueryCanvas) := self >.? other; + greater_than_or_equal (self : t_QueryCanvas) (other : t_QueryCanvas) := self >=.? other; + less_than (self : t_QueryCanvas) (other : t_QueryCanvas) := self <.? other; + less_than_or_equal (self : t_QueryCanvas) (other : t_QueryCanvas) := self >=.? other; + not_equal_bm (self : t_QueryCanvas) (other : t_QueryCanvas) := ifb not (equal self other) + then max_val + else from_literal_under_impl_16 i128(0); + equal_bm (self : t_QueryCanvas) (other : t_QueryCanvas) := ifb equal self other + then max_val + else from_literal_under_impl_16 i128(0); + greater_than_bm (self : t_QueryCanvas) (other : t_QueryCanvas) := ifb greater_than self other + then max_val + else from_literal_under_impl_16 i128(0); + greater_than_or_equal_bm (self : t_QueryCanvas) (other : t_QueryCanvas) := ifb greater_than_or_equal self other + then max_val + else from_literal_under_impl_16 i128(0); + less_than_bm (self : t_QueryCanvas) (other : t_QueryCanvas) := ifb less_than self other + then max_val + else from_literal_under_impl_16 i128(0); + less_than_or_equal_bm (self : t_QueryCanvas) (other : t_QueryCanvas) := ifb less_than_or_equal self other + then max_val + else from_literal_under_impl_16 i128(0); +}. + +Definition t_Query : choice_type := + (t_QueryCanvas). +Equations Build_t_Query {L : {fset Location}} {I : Interface} (0 : both L I (t_QueryCanvas)) : both L I (t_Query) := + Build_t_Query 0 := + bind_both 0 (fun 0 => + ret_both 0) : both L I (t_Query). +Fail Next Obligation. + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +#[global] Instance t_Query_t_From : t_From t_Query t_QueryCanvas := { + from (x : t_QueryCanvas) := Query (rem_under_impl_27 x (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)); +}. + +#[global] Instance t_Query_t_Into : t_Into t_Query t_QueryCanvas := { + into (self : t_Query) := 0 self; +}. + +Program Definition from_canvas_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_QueryCanvas)) : both (L1 :|: fset [x_loc]) (I1) (t_Query) := + Query (rem_under_impl_27 x (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)). +Fail Next Obligation. + +Program Definition into_canvas_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1) (I1) (t_QueryCanvas) := + 0 self. +Fail Next Obligation. + +Program Definition max_under_impl_64 : both (fset [x_loc]) ([interface ]) (t_QueryCanvas) := + from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab. +Fail Next Obligation. + +Program Definition declassify_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1) (I1) (t_BigInt) := + letb a := (into self) : both _ _ (t_QueryCanvas) in + into a. +Fail Next Obligation. + +(*item error backend*) + +Program Definition from_be_bytes_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_Query) := + into (from_be_bytes_under_impl_15 v). +Fail Next Obligation. + +Program Definition to_be_bytes_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1) (I1) (t_Vec (int8) (t_Global)) := + to_vec_under_impl (unsize (to_be_bytes_under_impl_15 (into self))). +Fail Next Obligation. + +Program Definition from_le_bytes_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_Query) := + into (from_le_bytes_under_impl_15 v). +Fail Next Obligation. + +Program Definition to_le_bytes_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1 :|: fset [repr_loc]) (I1) (t_Vec (int8) (t_Global)) := + to_vec_under_impl (unsize (to_le_bytes_under_impl_15 (into self))). +Fail Next Obligation. + +Program Definition bit_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Query)) (i : both L2 I2 (uint_size)) : both (L1:|:L2) (I1:|:I2) ('bool) := + bit_under_impl_16 (into self) i. +Fail Next Obligation. + +Program Definition from_literal_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_Query) := + letb big_x := (from x) : both _ _ (t_BigUint) in + letb _ := (ifb big_x >.? (into max_under_impl_64) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; + too big for type Query])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + Query (into big_x). +Fail Next Obligation. + +Program Definition from_signed_literal_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_Query) := + letb big_x := (from (cast_int x)) : both _ _ (t_BigUint) in + letb _ := (ifb big_x >.? (into max_under_impl_64) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; + too big for type Query])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + Query (into big_x). +Fail Next Obligation. + +Program Definition comp_eq_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Query)) (rhs : both L2 I2 (t_Query)) : both (L1:|:L2) (I1:|:I2) (t_Query) := + letb x := (into self) : both _ _ (t_QueryCanvas) in + into (comp_eq_under_impl_15 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_ne_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Query)) (rhs : both L2 I2 (t_Query)) : both (L1:|:L2) (I1:|:I2) (t_Query) := + letb x := (into self) : both _ _ (t_QueryCanvas) in + into (comp_ne_under_impl_15 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_gte_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Query)) (rhs : both L2 I2 (t_Query)) : both (L1:|:L2) (I1:|:I2) (t_Query) := + letb x := (into self) : both _ _ (t_QueryCanvas) in + into (comp_gte_under_impl_15 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_gt_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Query)) (rhs : both L2 I2 (t_Query)) : both (L1:|:L2) (I1:|:I2) (t_Query) := + letb x := (into self) : both _ _ (t_QueryCanvas) in + into (comp_gt_under_impl_15 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_lte_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Query)) (rhs : both L2 I2 (t_Query)) : both (L1:|:L2) (I1:|:I2) (t_Query) := + letb x := (into self) : both _ _ (t_QueryCanvas) in + into (comp_lte_under_impl_15 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_lt_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Query)) (rhs : both L2 I2 (t_Query)) : both (L1:|:L2) (I1:|:I2) (t_Query) := + letb x := (into self) : both _ _ (t_QueryCanvas) in + into (comp_lt_under_impl_15 x (into rhs)). +Fail Next Obligation. + +Program Definition neg_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1 :|: fset [x_loc]) (I1) (t_Query) := + letb mod_val := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigInt) in + letb s := (into self) : both _ _ (t_QueryCanvas) in + letb s := (into s) : both _ _ (t_BigInt) in + letb result := (into (mod_val .- s)) : both _ _ (t_QueryCanvas) in + into result. +Fail Next Obligation. + +#[global] Instance t_Query_t_PartialOrd : t_PartialOrd t_Query t_Query := { + partial_cmp (self : t_Query) (other : t_Query) := Option_Some (cmp self other); +}. + +#[global] Instance t_Query_t_Ord : t_Ord t_Query := { + cmp (self : t_Query) (other : t_Query) := cmp (0 self) (0 other); +}. + +#[global] Instance t_Query_t_PartialEq : t_PartialEq t_Query t_Query := { + eq (self : t_Query) (other : t_Query) := (0 self) =.? (0 other); +}. + +#[global] Instance t_Query_t_Eq : t_Eq t_Query := { +}. + +#[global] Instance t_Query_t_Add : t_Add t_Query t_Query := { + t_Output := t_Query; + add (self : t_Query) (rhs : t_Query) := letb a := (into self) : both _ _ (t_QueryCanvas) in + letb b := (into rhs) : both _ _ (t_QueryCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb c := (a .+ b) : both _ _ (t_Output) in + letb max := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_QueryCanvas) in + into d; +}. + +#[global] Instance t_Query_t_Sub : t_Sub t_Query t_Query := { + t_Output := t_Query; + sub (self : t_Query) (rhs : t_Query) := letb a := (into self) : both _ _ (t_QueryCanvas) in + letb b := (into rhs) : both _ _ (t_QueryCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb max := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in + letb c := (ifb b >.? a + then ((clone max) .- b) .+ a + else a .- b) : both _ _ (t_Output) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_QueryCanvas) in + into d; +}. + +#[global] Instance t_Query_t_Mul : t_Mul t_Query t_Query := { + t_Output := t_Query; + mul (self : t_Query) (rhs : t_Query) := letb a := (into self) : both _ _ (t_QueryCanvas) in + letb b := (into rhs) : both _ _ (t_QueryCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb c := (a .* b) : both _ _ (t_Output) in + letb max := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_QueryCanvas) in + into d; +}. + +#[global] Instance t_Query_t_Div : t_Div t_Query t_Query := { + t_Output := t_Query; + div (self : t_Query) (rhs : t_Query) := self .* (inv_under_impl_58 rhs); +}. + +#[global] Instance t_Query_t_Rem : t_Rem t_Query t_Query := { + t_Output := t_Query; + rem (self : t_Query) (rhs : t_Query) := letb a := (into self) : both _ _ (t_QueryCanvas) in + letb b := (into rhs) : both _ _ (t_QueryCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb c := (a .% b) : both _ _ (t_Output) in + letb max := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_QueryCanvas) in + into d; +}. + +#[global] Instance t_Query_t_Not : t_Not t_Query := { + t_Output := t_Query; + not (self : t_Query) := letb a := (into self) : both _ _ (t_QueryCanvas) in + into (not a); +}. + +#[global] Instance t_Query_t_BitOr : t_BitOr t_Query t_Query := { + t_Output := t_Query; + bitor (self : t_Query) (rhs : t_Query) := letb a := (into self) : both _ _ (t_QueryCanvas) in + letb b := (into rhs) : both _ _ (t_QueryCanvas) in + into (a .| b); +}. + +#[global] Instance t_Query_t_BitXor : t_BitXor t_Query t_Query := { + t_Output := t_Query; + bitxor (self : t_Query) (rhs : t_Query) := letb a := (into self) : both _ _ (t_QueryCanvas) in + letb b := (into rhs) : both _ _ (t_QueryCanvas) in + into (a .^ b); +}. + +#[global] Instance t_Query_t_BitAnd : t_BitAnd t_Query t_Query := { + t_Output := t_Query; + bitand (self : t_Query) (rhs : t_Query) := letb a := (into self) : both _ _ (t_QueryCanvas) in + letb b := (into rhs) : both _ _ (t_QueryCanvas) in + into (a .& b); +}. + +#[global] Instance t_Query_t_Shr : t_Shr t_Query uint_size := { + t_Output := t_Query; + shr (self : t_Query) (rhs : uint_size) := letb a := (into self) : both _ _ (t_QueryCanvas) in + into (a shift_right rhs); +}. + +#[global] Instance t_Query_t_Shl : t_Shl t_Query uint_size := { + t_Output := t_Query; + shl (self : t_Query) (rhs : uint_size) := letb a := (into self) : both _ _ (t_QueryCanvas) in + into (a shift_left rhs); +}. + +Program Definition inv_under_impl_58 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1 :|: fset [x_loc]) (I1) (t_Query) := + letb base := (into self) : both _ _ (t_QueryCanvas) in + into (inv_under_impl_27 base max_under_impl_64). +Fail Next Obligation. + +Program Definition pow_felem_under_impl_58 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Query)) (exp : both L2 I2 (t_Query)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_Query) := + letb base := (into self) : both _ _ (t_QueryCanvas) in + into (pow_felem_under_impl_27 base (into exp) max_under_impl_64). +Fail Next Obligation. + +Program Definition pow_under_impl_58 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Query)) (exp : both L2 I2 (int128)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_Query) := + letb base := (into self) : both _ _ (t_QueryCanvas) in + into (pow_under_impl_27 base exp max_under_impl_64). +Fail Next Obligation. + +Program Definition pow2_under_impl_58 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_Query) := + into (pow2_under_impl_16 x). +Fail Next Obligation. + +Program Definition from_byte_seq_be_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Query) := + into (from_be_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + declassify_under_impl_2 x))))). +Fail Next Obligation. + +Program Definition from_public_byte_seq_be_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Query) := + into (from_be_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + x))))). +Fail Next Obligation. + +Program Definition to_byte_seq_be_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1) (I1) (t_Seq (t_U8)) := + from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_be_bytes_under_impl_64 self))) (fun x => + classify_under_impl_2 x))). +Fail Next Obligation. + +Program Definition to_public_byte_seq_be_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1) (I1) (t_Seq (int8)) := + from_vec_under_impl_52 (to_be_bytes_under_impl_64 self). +Fail Next Obligation. + +Program Definition from_byte_seq_le_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Query) := + into (from_le_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + declassify_under_impl_2 x))))). +Fail Next Obligation. + +Program Definition from_public_byte_seq_le_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Query) := + into (from_le_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + x))))). +Fail Next Obligation. + +Program Definition to_byte_seq_le_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (t_U8)) := + from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_le_bytes_under_impl_64 self))) (fun x => + classify_under_impl_2 x))). +Fail Next Obligation. + +Program Definition to_public_byte_seq_le_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (int8)) := + from_vec_under_impl_52 (to_le_bytes_under_impl_64 self). +Fail Next Obligation. + +Program Definition from_secret_literal_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_U128)) : both (L1) (I1) (t_Query) := + into (from_literal_under_impl_16 (declassify_under_impl_126 x)). +Fail Next Obligation. + +#[global] Instance t_Query_t_NumericCopy : t_NumericCopy t_Query := { +}. + +#[global] Instance t_Query_t_UnsignedInteger : t_UnsignedInteger t_Query := { +}. + +#[global] Instance t_Query_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_Query := { +}. + +#[global] Instance t_Query_t_Integer : t_Integer t_Query := { + NUM_BITS := i32(384); + ZERO := from_literal_under_impl_64 i128(0); + ONE := from_literal_under_impl_64 i128(1); + TWO := from_literal_under_impl_64 i128(2); + from_literal (val : int128) := from_literal_under_impl_64 val; + from_hex_string (s : t_String) := from_hex_under_impl_64 (deref (replace_under_impl_5 (deref s) 0x )); + get_bit (self : t_Query) (i : uint_size) := (self shift_right i) .& v_ONE; + set_bit (self : t_Query) (b : t_Query) (i : uint_size) := letb _ := (ifb true + then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) + then letb 'tt := (never_to_any (panic assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb tmp1 := (from_literal_under_impl_64 (not (i128(1) shift_left i))) : both _ _ (t_Query) in + letb tmp2 := (b shift_left i) : both _ _ (t_Output) in + (self .& tmp1) .| tmp2; + set (self : t_Query) (pos : uint_size) (y : t_Query) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_Query) in + set_bit self b pos; + rotate_left (self : t_Query) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + ((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); + rotate_right (self : t_Query) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + ((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); +}. + +#[global] Instance t_Query_t_ModNumeric : t_ModNumeric t_Query := { + sub_mod (self : t_Query) (rhs : t_Query) (n : t_Query) := self .- rhs; + add_mod (self : t_Query) (rhs : t_Query) (n : t_Query) := self .+ rhs; + mul_mod (self : t_Query) (rhs : t_Query) (n : t_Query) := self .* rhs; + pow_mod (self : t_Query) (exp : t_Query) (n : t_Query) := pow_felem_under_impl_58 self exp; + modulo (self : t_Query) (n : t_Query) := self .% n; + signed_modulo (self : t_Query) (n : t_Query) := modulo self n; + absolute (self : t_Query) := self; +}. + +#[global] Instance t_Query_t_Numeric : t_Numeric t_Query := { + max_val := into (max_under_impl_64 .- (from_literal_under_impl_16 i128(1))); + wrap_add (self : t_Query) (rhs : t_Query) := self .+ rhs; + wrap_sub (self : t_Query) (rhs : t_Query) := self .- rhs; + wrap_mul (self : t_Query) (rhs : t_Query) := self .* rhs; + wrap_div (self : t_Query) (rhs : t_Query) := self ./ rhs; + exp (self : t_Query) (exp : int32) := pow_under_impl_58 self (into exp); + pow_self (self : t_Query) (exp : t_Query) := pow_felem_under_impl_58 self exp; + divide (self : t_Query) (rhs : t_Query) := self ./ rhs; + inv (self : t_Query) (n : t_Query) := inv_under_impl_58 self; + equal (self : t_Query) (other : t_Query) := self =.? other; + greater_than (self : t_Query) (other : t_Query) := self >.? other; + greater_than_or_equal (self : t_Query) (other : t_Query) := self >=.? other; + less_than (self : t_Query) (other : t_Query) := self <.? other; + less_than_or_equal (self : t_Query) (other : t_Query) := self <=.? other; + not_equal_bm (self : t_Query) (other : t_Query) := ifb self <> other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + equal_bm (self : t_Query) (other : t_Query) := ifb self =.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + greater_than_bm (self : t_Query) (other : t_Query) := ifb self >.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + greater_than_or_equal_bm (self : t_Query) (other : t_Query) := ifb self >=.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + less_than_bm (self : t_Query) (other : t_Query) := ifb self <.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + less_than_or_equal_bm (self : t_Query) (other : t_Query) := ifb self <=.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; +}. + +Definition t_RandomCanvas : choice_type := + (nseq int8 TODO: Int.to_string length × t_Sign × 'bool). +Equations Build_t_RandomCanvas {L : {fset Location}} {I : Interface} (f_b : both L I (nseq int8 TODO: Int.to_string length)) (f_sign : both L I (t_Sign)) (f_signed : both L I ('bool)) : both L I (t_RandomCanvas) := + Build_t_RandomCanvas f_b f_sign f_signed := + bind_both f_signed (fun f_signed => + bind_both f_sign (fun f_sign => + bind_both f_b (fun f_b => + ret_both f_b f_sign f_signed))) : both L I (t_RandomCanvas). +Fail Next Obligation. + +Program Definition max_under_impl_83 : both (fset []) ([interface ]) (t_Output) := + ((from i32(1)) shift_left i32(384)) .- one. +Fail Next Obligation. + +Program Definition max_value_under_impl_83 : both (fset []) ([interface ]) (t_RandomCanvas) := + from max_under_impl_83. +Fail Next Obligation. + +(*item error backend*) + +Program Definition from_literal_under_impl_83 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_RandomCanvas) := + letb big_x := (from x) : both _ _ (t_BigInt) in + letb _ := (ifb big_x >.? (into max_under_impl_83) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; + too big for type RandomCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + into big_x. +Fail Next Obligation. + +Program Definition from_signed_literal_under_impl_83 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_RandomCanvas) := + letb big_x := (from (cast_int x)) : both _ _ (t_BigInt) in + letb _ := (ifb big_x >.? (into max_under_impl_83) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; + too big for type RandomCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + into big_x. +Fail Next Obligation. + +Program Definition pow2_under_impl_83 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_RandomCanvas) := + into ((from i32(1)) shift_left x). +Fail Next Obligation. + +(*item error backend*) + +#[global] Instance t_RandomCanvas_t_From : t_From t_RandomCanvas t_BigUint := { + from (x : t_BigUint) := from (from x); +}. + +#[global] Instance t_RandomCanvas_t_From : t_From t_RandomCanvas t_BigInt := { + from (x : t_BigInt) := letb max_value := (max_under_impl_83) : both _ _ (t_BigInt) in + letb _ := (ifb not (x <=.? max_value) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [; + is too large for type RandomCanvas!])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb '(sign,repr) := (to_bytes_be_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in + letb _ := (ifb andb (sign =.? Sign_Minus) (not false) + then letb 'tt := (never_to_any (begin_panic Trying to convert a negative number into an unsigned integer!)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb _ := (ifb (len_under_impl_1 repr) >.? ((i32(384) .+ i32(7)) ./ i32(8)) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [; + is too large for type RandomCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letbm out loc(out_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in + letb upper := (len_under_impl (unsize out)) : both _ _ (uint_size) in + letb lower := (upper .- (len_under_impl_1 repr)) : both _ _ (uint_size) in + letb _ := (failure RefMut:The mutation of this &mut is not allowed here. + core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (out), + core::ops::range::Range { + f_start: lower, + f_end: upper, + }, + ))), + &(deref(core::ops::deref::Deref::deref(&(deref(&(repr)))))), + )) : both _ _ (unit) in + Build_t_RandomCanvas outsignfalse; +}. + +#[global] Instance t_RandomCanvas_t_Default : t_Default t_RandomCanvas := { + default := Build_t_RandomCanvas (repeat i8(0) i32(48))Sign_Plusfalse; +}. + +#[global] Instance t_RandomCanvas_t_Into : t_Into t_RandomCanvas t_BigInt := { + into (self : t_RandomCanvas) := from_bytes_be_under_impl_24 (f_sign self) (unsize (f_b self)); +}. + +#[global] Instance t_RandomCanvas_t_Into : t_Into t_RandomCanvas t_BigUint := { + into (self : t_RandomCanvas) := from_bytes_be_under_impl_18 (unsize (f_b self)); +}. + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*item error backend*) + +Definition repr_loc : Location := + (nseq int8 TODO: Int.to_string length ; 13%nat). +Program Definition from_be_bytes_under_impl_82 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_RandomCanvas) := + letb _ := (ifb true + then letb _ := (ifb not ((len_under_impl v) <=.? ((i32(384) .+ i32(7)) ./ i32(8))) + then letb 'tt := (never_to_any (begin_panic from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in + letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in + letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in + letb _ := (failure RefMut:The mutation of this &mut is not allowed here. + core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (repr), + core::ops::range::Range { + f_start: lower, + f_end: upper, + }, + ))), + &(deref(deref(&(v)))), + )) : both _ _ (unit) in + Build_t_RandomCanvas reprSign_Plusfalse. +Fail Next Obligation. + +Definition repr_loc : Location := + (nseq int8 TODO: Int.to_string length ; 14%nat). +Program Definition from_le_bytes_under_impl_82 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_RandomCanvas) := + letb _ := (ifb true + then letb _ := (ifb not ((len_under_impl v) <=.? ((i32(384) .+ i32(7)) ./ i32(8))) + then letb 'tt := (never_to_any (begin_panic from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in + letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in + letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in + letb _ := (failure RefMut:The mutation of this &mut is not allowed here. + core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (repr), + core::ops::range::Range { + f_start: lower, + f_end: upper, + }, + ))), + &(deref(deref(&(v)))), + )) : both _ _ (unit) in + into (from_bytes_le_under_impl_24 Sign_Plus (unsize repr)). +Fail Next Obligation. + +Program Definition to_be_bytes_under_impl_82 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_RandomCanvas)) : both (L1) (I1) (nseq int8 TODO: Int.to_string length) := + f_b self. +Fail Next Obligation. + +Definition repr_loc : Location := + (nseq int8 TODO: Int.to_string length ; 15%nat). +Program Definition to_le_bytes_under_impl_82 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_RandomCanvas)) : both (L1 :|: fset [repr_loc]) (I1) (nseq int8 TODO: Int.to_string length) := + letb x := (from_bytes_be_under_impl_24 Sign_Plus (unsize (f_b self))) : both _ _ (t_BigInt) in + letb '(_,x_s) := (to_bytes_le_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in + letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in + letb _ := (failure RefMut:The mutation of this &mut is not allowed here. + core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (repr), + core::ops::range::Range { + f_start: 0, + f_end: alloc::vec::len_under_impl_1(&(x_s)), + }, + ))), + &(deref(core::ops::deref::Deref::deref(&(deref(&(x_s)))))), + )) : both _ _ (unit) in + repr. +Fail Next Obligation. + +Program Definition comp_eq_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_RandomCanvas)) (rhs : both L2 I2 (t_RandomCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a =.? b + then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_RandomCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_ne_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_RandomCanvas)) (rhs : both L2 I2 (t_RandomCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a <> b + then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_RandomCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_gte_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_RandomCanvas)) (rhs : both L2 I2 (t_RandomCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a >=.? b + then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_RandomCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_gt_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_RandomCanvas)) (rhs : both L2 I2 (t_RandomCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a >.? b + then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_RandomCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_lte_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_RandomCanvas)) (rhs : both L2 I2 (t_RandomCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a <=.? b + then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_RandomCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_lt_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_RandomCanvas)) (rhs : both L2 I2 (t_RandomCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a <.? b + then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_RandomCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition inv_under_impl_94 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_RandomCanvas)) (modval : both L2 I2 (t_RandomCanvas)) : both (L1:|:L2) (I1:|:I2) (t_RandomCanvas) := + letb biguintmodval := (into modval) : both _ _ (t_BigInt) in + letb m := (biguintmodval .- (from i32(2))) : both _ _ (t_Output) in + letb s := (into self) : both _ _ (t_BigInt) in + into (modpow_under_impl_24 s m biguintmodval). +Fail Next Obligation. + +Program Definition pow_felem_under_impl_94 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_RandomCanvas)) (exp : both L2 I2 (t_RandomCanvas)) (modval : both L3 I3 (t_RandomCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_RandomCanvas) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into exp) : both _ _ (t_BigInt) in + letb m := (into modval) : both _ _ (t_BigInt) in + letb c := (modpow_under_impl_24 a b m) : both _ _ (t_BigInt) in + into c. +Fail Next Obligation. + +Program Definition pow_under_impl_94 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_RandomCanvas)) (exp : both L2 I2 (int128)) (modval : both L3 I3 (t_RandomCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_RandomCanvas) := + pow_felem_under_impl_94 self (into (from exp)) modval. +Fail Next Obligation. + +Program Definition rem_under_impl_94 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_RandomCanvas)) (n : both L2 I2 (t_RandomCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + self .% n. +Fail Next Obligation. + +#[global] Instance t_RandomCanvas_t_Add : t_Add t_RandomCanvas t_RandomCanvas := { + t_Output := t_RandomCanvas; + add (self : t_RandomCanvas) (rhs : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb c := (a .+ b) : both _ _ (t_Output) in + letb _ := (ifb c >.? max_under_impl_83 + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded addition overflow for type RandomCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + into c; +}. + +#[global] Instance t_RandomCanvas_t_Sub : t_Sub t_RandomCanvas t_RandomCanvas := { + t_Output := t_RandomCanvas; + sub (self : t_RandomCanvas) (rhs : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb c := (ifb f_signed self + then a .- b + else unwrap_or_else_under_impl (checked_sub_under_impl_24 a b) ( + never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded substraction underflow for type RandomCanvas])) (unsize none_under_impl_1))))) : both _ _ (t_Output) in + into c; +}. + +#[global] Instance t_RandomCanvas_t_Mul : t_Mul t_RandomCanvas t_RandomCanvas := { + t_Output := t_RandomCanvas; + mul (self : t_RandomCanvas) (rhs : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb c := (a .* b) : both _ _ (t_Output) in + letb _ := (ifb c >.? max_under_impl_83 + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded multiplication overflow for type RandomCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + into c; +}. + +#[global] Instance t_RandomCanvas_t_Div : t_Div t_RandomCanvas t_RandomCanvas := { + t_Output := t_RandomCanvas; + div (self : t_RandomCanvas) (rhs : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb _ := (ifb b =.? zero + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [dividing by zero in type RandomCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb c := (a ./ b) : both _ _ (t_Output) in + into c; +}. + +#[global] Instance t_RandomCanvas_t_Rem : t_Rem t_RandomCanvas t_RandomCanvas := { + t_Output := t_RandomCanvas; + rem (self : t_RandomCanvas) (rhs : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb _ := (ifb b =.? zero + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [dividing by zero in type RandomCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb c := (a .% b) : both _ _ (t_Output) in + into c; +}. + +#[global] Instance t_RandomCanvas_t_Not : t_Not t_RandomCanvas := { + t_Output := t_RandomCanvas; + not (self : t_RandomCanvas) := never_to_any (panic not implemented); +}. + +#[global] Instance t_RandomCanvas_t_BitOr : t_BitOr t_RandomCanvas t_RandomCanvas := { + t_Output := t_RandomCanvas; + bitor (self : t_RandomCanvas) (rhs : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + into (a .| b); +}. + +#[global] Instance t_RandomCanvas_t_BitXor : t_BitXor t_RandomCanvas t_RandomCanvas := { + t_Output := t_RandomCanvas; + bitxor (self : t_RandomCanvas) (rhs : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + into (a .^ b); +}. + +#[global] Instance t_RandomCanvas_t_BitAnd : t_BitAnd t_RandomCanvas t_RandomCanvas := { + t_Output := t_RandomCanvas; + bitand (self : t_RandomCanvas) (rhs : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + into (a .& b); +}. + +#[global] Instance t_RandomCanvas_t_Shr : t_Shr t_RandomCanvas uint_size := { + t_Output := t_RandomCanvas; + shr (self : t_RandomCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (rhs) : both _ _ (uint_size) in + into (a shift_right b); +}. + +#[global] Instance t_RandomCanvas_t_Shl : t_Shl t_RandomCanvas uint_size := { + t_Output := t_RandomCanvas; + shl (self : t_RandomCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (rhs) : both _ _ (uint_size) in + into (a shift_left b); +}. + +#[global] Instance t_RandomCanvas_t_PartialEq : t_PartialEq t_RandomCanvas t_RandomCanvas := { + eq (self : t_RandomCanvas) (rhs : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + a =.? b; +}. + +#[global] Instance t_RandomCanvas_t_Eq : t_Eq t_RandomCanvas := { +}. + +#[global] Instance t_RandomCanvas_t_PartialOrd : t_PartialOrd t_RandomCanvas t_RandomCanvas := { + partial_cmp (self : t_RandomCanvas) (other : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into other) : both _ _ (t_BigInt) in + partial_cmp a b; +}. + +#[global] Instance t_RandomCanvas_t_Ord : t_Ord t_RandomCanvas := { + cmp (self : t_RandomCanvas) (other : t_RandomCanvas) := unwrap_under_impl (partial_cmp self other); +}. + +Program Definition from_byte_seq_be_under_impl_75 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_RandomCanvas) := + from_be_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + declassify_under_impl_2 x)))). +Fail Next Obligation. + +Program Definition from_public_byte_seq_be_under_impl_75 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_RandomCanvas) := + from_be_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + x)))). +Fail Next Obligation. + +Program Definition to_byte_seq_be_under_impl_75 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_RandomCanvas)) : both (L1) (I1) (t_Seq (t_U8)) := + from_vec_under_impl_52 (collect (map (iter_under_impl (unsize (to_be_bytes_under_impl_82 self))) (fun x => + classify_under_impl_2 x))). +Fail Next Obligation. + +#[global] Instance t_RandomCanvas_t_NumericCopy : t_NumericCopy t_RandomCanvas := { +}. + +#[global] Instance t_RandomCanvas_t_UnsignedInteger : t_UnsignedInteger t_RandomCanvas := { +}. + +#[global] Instance t_RandomCanvas_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_RandomCanvas := { +}. + +#[global] Instance t_RandomCanvas_t_Integer : t_Integer t_RandomCanvas := { + NUM_BITS := i32(384); + ZERO := from_literal_under_impl_83 i128(0); + ONE := from_literal_under_impl_83 i128(1); + TWO := from_literal_under_impl_83 i128(2); + from_literal (val : int128) := from_literal_under_impl_83 val; + from_hex_string (s : t_String) := from_hex_under_impl_82 (deref (replace_under_impl_5 (deref s) 0x )); + get_bit (self : t_RandomCanvas) (i : uint_size) := (self shift_right i) .& v_ONE; + set_bit (self : t_RandomCanvas) (b : t_RandomCanvas) (i : uint_size) := letb _ := (ifb true + then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) + then letb 'tt := (never_to_any (panic assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb tmp1 := (from_literal_under_impl_83 (not (i128(1) shift_left i))) : both _ _ (t_RandomCanvas) in + letb tmp2 := (b shift_left i) : both _ _ (t_Output) in + (self .& tmp1) .| tmp2; + set (self : t_RandomCanvas) (pos : uint_size) (y : t_RandomCanvas) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_RandomCanvas) in + set_bit self b pos; + rotate_left (self : t_RandomCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + ((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); + rotate_right (self : t_RandomCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + ((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); +}. + +#[global] Instance t_RandomCanvas_t_ModNumeric : t_ModNumeric t_RandomCanvas := { + sub_mod (self : t_RandomCanvas) (rhs : t_RandomCanvas) (n : t_RandomCanvas) := (self .- rhs) .% n; + add_mod (self : t_RandomCanvas) (rhs : t_RandomCanvas) (n : t_RandomCanvas) := (self .+ rhs) .% n; + mul_mod (self : t_RandomCanvas) (rhs : t_RandomCanvas) (n : t_RandomCanvas) := (self .* rhs) .% n; + pow_mod (self : t_RandomCanvas) (exp : t_RandomCanvas) (n : t_RandomCanvas) := pow_felem_under_impl_94 self exp n; + modulo (self : t_RandomCanvas) (n : t_RandomCanvas) := self .% n; + signed_modulo (self : t_RandomCanvas) (n : t_RandomCanvas) := modulo self n; + absolute (self : t_RandomCanvas) := self; +}. + +#[global] Instance t_RandomCanvas_t_Numeric : t_Numeric t_RandomCanvas := { + max_val := max_value_under_impl_83; + wrap_add (self : t_RandomCanvas) (rhs : t_RandomCanvas) := self .+ rhs; + wrap_sub (self : t_RandomCanvas) (rhs : t_RandomCanvas) := self .- rhs; + wrap_mul (self : t_RandomCanvas) (rhs : t_RandomCanvas) := self .* rhs; + wrap_div (self : t_RandomCanvas) (rhs : t_RandomCanvas) := self ./ rhs; + exp (self : t_RandomCanvas) (exp : int32) := pow_under_impl_94 self (into exp) max_val; + pow_self (self : t_RandomCanvas) (exp : t_RandomCanvas) := pow_felem_under_impl_94 self (into exp) max_val; + divide (self : t_RandomCanvas) (rhs : t_RandomCanvas) := self ./ rhs; + inv (self : t_RandomCanvas) (n : t_RandomCanvas) := inv_under_impl_94 self n; + equal (self : t_RandomCanvas) (other : t_RandomCanvas) := self =.? other; + greater_than (self : t_RandomCanvas) (other : t_RandomCanvas) := self >.? other; + greater_than_or_equal (self : t_RandomCanvas) (other : t_RandomCanvas) := self >=.? other; + less_than (self : t_RandomCanvas) (other : t_RandomCanvas) := self <.? other; + less_than_or_equal (self : t_RandomCanvas) (other : t_RandomCanvas) := self >=.? other; + not_equal_bm (self : t_RandomCanvas) (other : t_RandomCanvas) := ifb not (equal self other) + then max_val + else from_literal_under_impl_83 i128(0); + equal_bm (self : t_RandomCanvas) (other : t_RandomCanvas) := ifb equal self other + then max_val + else from_literal_under_impl_83 i128(0); + greater_than_bm (self : t_RandomCanvas) (other : t_RandomCanvas) := ifb greater_than self other + then max_val + else from_literal_under_impl_83 i128(0); + greater_than_or_equal_bm (self : t_RandomCanvas) (other : t_RandomCanvas) := ifb greater_than_or_equal self other + then max_val + else from_literal_under_impl_83 i128(0); + less_than_bm (self : t_RandomCanvas) (other : t_RandomCanvas) := ifb less_than self other + then max_val + else from_literal_under_impl_83 i128(0); + less_than_or_equal_bm (self : t_RandomCanvas) (other : t_RandomCanvas) := ifb less_than_or_equal self other + then max_val + else from_literal_under_impl_83 i128(0); +}. + +Definition t_Random : choice_type := + (t_RandomCanvas). +Equations Build_t_Random {L : {fset Location}} {I : Interface} (0 : both L I (t_RandomCanvas)) : both L I (t_Random) := + Build_t_Random 0 := + bind_both 0 (fun 0 => + ret_both 0) : both L I (t_Random). +Fail Next Obligation. + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +#[global] Instance t_Random_t_From : t_From t_Random t_RandomCanvas := { + from (x : t_RandomCanvas) := Random (rem_under_impl_94 x (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)); +}. + +#[global] Instance t_Random_t_Into : t_Into t_Random t_RandomCanvas := { + into (self : t_Random) := 0 self; +}. + +Program Definition from_canvas_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_RandomCanvas)) : both (L1 :|: fset [x_loc]) (I1) (t_Random) := + Random (rem_under_impl_94 x (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)). +Fail Next Obligation. + +Program Definition into_canvas_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1) (I1) (t_RandomCanvas) := + 0 self. +Fail Next Obligation. + +Program Definition max_under_impl_131 : both (fset [x_loc]) ([interface ]) (t_RandomCanvas) := + from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab. +Fail Next Obligation. + +Program Definition declassify_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1) (I1) (t_BigInt) := + letb a := (into self) : both _ _ (t_RandomCanvas) in + into a. +Fail Next Obligation. + +(*item error backend*) + +Program Definition from_be_bytes_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_Random) := + into (from_be_bytes_under_impl_82 v). +Fail Next Obligation. + +Program Definition to_be_bytes_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1) (I1) (t_Vec (int8) (t_Global)) := + to_vec_under_impl (unsize (to_be_bytes_under_impl_82 (into self))). +Fail Next Obligation. + +Program Definition from_le_bytes_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_Random) := + into (from_le_bytes_under_impl_82 v). +Fail Next Obligation. + +Program Definition to_le_bytes_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1 :|: fset [repr_loc]) (I1) (t_Vec (int8) (t_Global)) := + to_vec_under_impl (unsize (to_le_bytes_under_impl_82 (into self))). +Fail Next Obligation. + +Program Definition bit_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Random)) (i : both L2 I2 (uint_size)) : both (L1:|:L2) (I1:|:I2) ('bool) := + bit_under_impl_83 (into self) i. +Fail Next Obligation. + +Program Definition from_literal_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_Random) := + letb big_x := (from x) : both _ _ (t_BigUint) in + letb _ := (ifb big_x >.? (into max_under_impl_131) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; + too big for type Random])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + Random (into big_x). +Fail Next Obligation. + +Program Definition from_signed_literal_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_Random) := + letb big_x := (from (cast_int x)) : both _ _ (t_BigUint) in + letb _ := (ifb big_x >.? (into max_under_impl_131) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; + too big for type Random])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + Random (into big_x). +Fail Next Obligation. + +Program Definition comp_eq_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Random)) (rhs : both L2 I2 (t_Random)) : both (L1:|:L2) (I1:|:I2) (t_Random) := + letb x := (into self) : both _ _ (t_RandomCanvas) in + into (comp_eq_under_impl_82 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_ne_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Random)) (rhs : both L2 I2 (t_Random)) : both (L1:|:L2) (I1:|:I2) (t_Random) := + letb x := (into self) : both _ _ (t_RandomCanvas) in + into (comp_ne_under_impl_82 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_gte_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Random)) (rhs : both L2 I2 (t_Random)) : both (L1:|:L2) (I1:|:I2) (t_Random) := + letb x := (into self) : both _ _ (t_RandomCanvas) in + into (comp_gte_under_impl_82 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_gt_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Random)) (rhs : both L2 I2 (t_Random)) : both (L1:|:L2) (I1:|:I2) (t_Random) := + letb x := (into self) : both _ _ (t_RandomCanvas) in + into (comp_gt_under_impl_82 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_lte_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Random)) (rhs : both L2 I2 (t_Random)) : both (L1:|:L2) (I1:|:I2) (t_Random) := + letb x := (into self) : both _ _ (t_RandomCanvas) in + into (comp_lte_under_impl_82 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_lt_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Random)) (rhs : both L2 I2 (t_Random)) : both (L1:|:L2) (I1:|:I2) (t_Random) := + letb x := (into self) : both _ _ (t_RandomCanvas) in + into (comp_lt_under_impl_82 x (into rhs)). +Fail Next Obligation. + +Program Definition neg_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1 :|: fset [x_loc]) (I1) (t_Random) := + letb mod_val := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigInt) in + letb s := (into self) : both _ _ (t_RandomCanvas) in + letb s := (into s) : both _ _ (t_BigInt) in + letb result := (into (mod_val .- s)) : both _ _ (t_RandomCanvas) in + into result. +Fail Next Obligation. + +#[global] Instance t_Random_t_PartialOrd : t_PartialOrd t_Random t_Random := { + partial_cmp (self : t_Random) (other : t_Random) := Option_Some (cmp self other); +}. + +#[global] Instance t_Random_t_Ord : t_Ord t_Random := { + cmp (self : t_Random) (other : t_Random) := cmp (0 self) (0 other); +}. + +#[global] Instance t_Random_t_PartialEq : t_PartialEq t_Random t_Random := { + eq (self : t_Random) (other : t_Random) := (0 self) =.? (0 other); +}. + +#[global] Instance t_Random_t_Eq : t_Eq t_Random := { +}. + +#[global] Instance t_Random_t_Add : t_Add t_Random t_Random := { + t_Output := t_Random; + add (self : t_Random) (rhs : t_Random) := letb a := (into self) : both _ _ (t_RandomCanvas) in + letb b := (into rhs) : both _ _ (t_RandomCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb c := (a .+ b) : both _ _ (t_Output) in + letb max := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_RandomCanvas) in + into d; +}. + +#[global] Instance t_Random_t_Sub : t_Sub t_Random t_Random := { + t_Output := t_Random; + sub (self : t_Random) (rhs : t_Random) := letb a := (into self) : both _ _ (t_RandomCanvas) in + letb b := (into rhs) : both _ _ (t_RandomCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb max := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in + letb c := (ifb b >.? a + then ((clone max) .- b) .+ a + else a .- b) : both _ _ (t_Output) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_RandomCanvas) in + into d; +}. + +#[global] Instance t_Random_t_Mul : t_Mul t_Random t_Random := { + t_Output := t_Random; + mul (self : t_Random) (rhs : t_Random) := letb a := (into self) : both _ _ (t_RandomCanvas) in + letb b := (into rhs) : both _ _ (t_RandomCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb c := (a .* b) : both _ _ (t_Output) in + letb max := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_RandomCanvas) in + into d; +}. + +#[global] Instance t_Random_t_Div : t_Div t_Random t_Random := { + t_Output := t_Random; + div (self : t_Random) (rhs : t_Random) := self .* (inv_under_impl_125 rhs); +}. + +#[global] Instance t_Random_t_Rem : t_Rem t_Random t_Random := { + t_Output := t_Random; + rem (self : t_Random) (rhs : t_Random) := letb a := (into self) : both _ _ (t_RandomCanvas) in + letb b := (into rhs) : both _ _ (t_RandomCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb c := (a .% b) : both _ _ (t_Output) in + letb max := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_RandomCanvas) in + into d; +}. + +#[global] Instance t_Random_t_Not : t_Not t_Random := { + t_Output := t_Random; + not (self : t_Random) := letb a := (into self) : both _ _ (t_RandomCanvas) in + into (not a); +}. + +#[global] Instance t_Random_t_BitOr : t_BitOr t_Random t_Random := { + t_Output := t_Random; + bitor (self : t_Random) (rhs : t_Random) := letb a := (into self) : both _ _ (t_RandomCanvas) in + letb b := (into rhs) : both _ _ (t_RandomCanvas) in + into (a .| b); +}. + +#[global] Instance t_Random_t_BitXor : t_BitXor t_Random t_Random := { + t_Output := t_Random; + bitxor (self : t_Random) (rhs : t_Random) := letb a := (into self) : both _ _ (t_RandomCanvas) in + letb b := (into rhs) : both _ _ (t_RandomCanvas) in + into (a .^ b); +}. + +#[global] Instance t_Random_t_BitAnd : t_BitAnd t_Random t_Random := { + t_Output := t_Random; + bitand (self : t_Random) (rhs : t_Random) := letb a := (into self) : both _ _ (t_RandomCanvas) in + letb b := (into rhs) : both _ _ (t_RandomCanvas) in + into (a .& b); +}. + +#[global] Instance t_Random_t_Shr : t_Shr t_Random uint_size := { + t_Output := t_Random; + shr (self : t_Random) (rhs : uint_size) := letb a := (into self) : both _ _ (t_RandomCanvas) in + into (a shift_right rhs); +}. + +#[global] Instance t_Random_t_Shl : t_Shl t_Random uint_size := { + t_Output := t_Random; + shl (self : t_Random) (rhs : uint_size) := letb a := (into self) : both _ _ (t_RandomCanvas) in + into (a shift_left rhs); +}. + +Program Definition inv_under_impl_125 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1 :|: fset [x_loc]) (I1) (t_Random) := + letb base := (into self) : both _ _ (t_RandomCanvas) in + into (inv_under_impl_94 base max_under_impl_131). +Fail Next Obligation. + +Program Definition pow_felem_under_impl_125 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Random)) (exp : both L2 I2 (t_Random)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_Random) := + letb base := (into self) : both _ _ (t_RandomCanvas) in + into (pow_felem_under_impl_94 base (into exp) max_under_impl_131). +Fail Next Obligation. + +Program Definition pow_under_impl_125 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Random)) (exp : both L2 I2 (int128)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_Random) := + letb base := (into self) : both _ _ (t_RandomCanvas) in + into (pow_under_impl_94 base exp max_under_impl_131). +Fail Next Obligation. + +Program Definition pow2_under_impl_125 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_Random) := + into (pow2_under_impl_83 x). +Fail Next Obligation. + +Program Definition from_byte_seq_be_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Random) := + into (from_be_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + declassify_under_impl_2 x))))). +Fail Next Obligation. + +Program Definition from_public_byte_seq_be_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Random) := + into (from_be_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + x))))). +Fail Next Obligation. + +Program Definition to_byte_seq_be_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1) (I1) (t_Seq (t_U8)) := + from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_be_bytes_under_impl_131 self))) (fun x => + classify_under_impl_2 x))). +Fail Next Obligation. + +Program Definition to_public_byte_seq_be_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1) (I1) (t_Seq (int8)) := + from_vec_under_impl_52 (to_be_bytes_under_impl_131 self). +Fail Next Obligation. + +Program Definition from_byte_seq_le_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Random) := + into (from_le_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + declassify_under_impl_2 x))))). +Fail Next Obligation. + +Program Definition from_public_byte_seq_le_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Random) := + into (from_le_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + x))))). +Fail Next Obligation. + +Program Definition to_byte_seq_le_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (t_U8)) := + from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_le_bytes_under_impl_131 self))) (fun x => + classify_under_impl_2 x))). +Fail Next Obligation. + +Program Definition to_public_byte_seq_le_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (int8)) := + from_vec_under_impl_52 (to_le_bytes_under_impl_131 self). +Fail Next Obligation. + +Program Definition from_secret_literal_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_U128)) : both (L1) (I1) (t_Random) := + into (from_literal_under_impl_83 (declassify_under_impl_126 x)). +Fail Next Obligation. + +#[global] Instance t_Random_t_NumericCopy : t_NumericCopy t_Random := { +}. + +#[global] Instance t_Random_t_UnsignedInteger : t_UnsignedInteger t_Random := { +}. + +#[global] Instance t_Random_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_Random := { +}. + +#[global] Instance t_Random_t_Integer : t_Integer t_Random := { + NUM_BITS := i32(384); + ZERO := from_literal_under_impl_131 i128(0); + ONE := from_literal_under_impl_131 i128(1); + TWO := from_literal_under_impl_131 i128(2); + from_literal (val : int128) := from_literal_under_impl_131 val; + from_hex_string (s : t_String) := from_hex_under_impl_131 (deref (replace_under_impl_5 (deref s) 0x )); + get_bit (self : t_Random) (i : uint_size) := (self shift_right i) .& v_ONE; + set_bit (self : t_Random) (b : t_Random) (i : uint_size) := letb _ := (ifb true + then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) + then letb 'tt := (never_to_any (panic assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb tmp1 := (from_literal_under_impl_131 (not (i128(1) shift_left i))) : both _ _ (t_Random) in + letb tmp2 := (b shift_left i) : both _ _ (t_Output) in + (self .& tmp1) .| tmp2; + set (self : t_Random) (pos : uint_size) (y : t_Random) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_Random) in + set_bit self b pos; + rotate_left (self : t_Random) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + ((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); + rotate_right (self : t_Random) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + ((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); +}. + +#[global] Instance t_Random_t_ModNumeric : t_ModNumeric t_Random := { + sub_mod (self : t_Random) (rhs : t_Random) (n : t_Random) := self .- rhs; + add_mod (self : t_Random) (rhs : t_Random) (n : t_Random) := self .+ rhs; + mul_mod (self : t_Random) (rhs : t_Random) (n : t_Random) := self .* rhs; + pow_mod (self : t_Random) (exp : t_Random) (n : t_Random) := pow_felem_under_impl_125 self exp; + modulo (self : t_Random) (n : t_Random) := self .% n; + signed_modulo (self : t_Random) (n : t_Random) := modulo self n; + absolute (self : t_Random) := self; +}. + +#[global] Instance t_Random_t_Numeric : t_Numeric t_Random := { + max_val := into (max_under_impl_131 .- (from_literal_under_impl_83 i128(1))); + wrap_add (self : t_Random) (rhs : t_Random) := self .+ rhs; + wrap_sub (self : t_Random) (rhs : t_Random) := self .- rhs; + wrap_mul (self : t_Random) (rhs : t_Random) := self .* rhs; + wrap_div (self : t_Random) (rhs : t_Random) := self ./ rhs; + exp (self : t_Random) (exp : int32) := pow_under_impl_125 self (into exp); + pow_self (self : t_Random) (exp : t_Random) := pow_felem_under_impl_125 self exp; + divide (self : t_Random) (rhs : t_Random) := self ./ rhs; + inv (self : t_Random) (n : t_Random) := inv_under_impl_125 self; + equal (self : t_Random) (other : t_Random) := self =.? other; + greater_than (self : t_Random) (other : t_Random) := self >.? other; + greater_than_or_equal (self : t_Random) (other : t_Random) := self >=.? other; + less_than (self : t_Random) (other : t_Random) := self <.? other; + less_than_or_equal (self : t_Random) (other : t_Random) := self <=.? other; + not_equal_bm (self : t_Random) (other : t_Random) := ifb self <> other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + equal_bm (self : t_Random) (other : t_Random) := ifb self =.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + greater_than_bm (self : t_Random) (other : t_Random) := ifb self >.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + greater_than_or_equal_bm (self : t_Random) (other : t_Random) := ifb self >=.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + less_than_bm (self : t_Random) (other : t_Random) := ifb self <.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + less_than_or_equal_bm (self : t_Random) (other : t_Random) := ifb self <=.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; +}. + +Program Definition sample_uniform : both (fset []) ([interface ]) (t_Random) := + v_ONE. +Fail Next Obligation. + +Require Import Std. (* as HashMap *) + +Require Import Std. + +Require Import Std. (* as Hash *) + +Require Import Std. (* as Hasher *) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +Program Definition random_oracle_query {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (QUERIES : both L1 I1 (t_HashMap (t_Query) (t_Random) (t_RandomState))) (q : both L2 I2 (t_Query)) : both (L1:|:L2) (I1:|:I2) ((t_HashMap (t_Query) (t_Random) (t_RandomState) × t_Random)) := + match get_under_impl_2 QUERIES q with + | Option_Some r => prod_b(clone QUERIES,clone r) + | Option_None => letb r := (sample_uniform) : both _ _ (t_Random) in + letb '(todo_fresh_var,QUERIES_temp) := (insert_under_impl_2 QUERIES q r) : both _ _ ((t_Option (t_Random) × t_HashMap (t_Query) (t_Random) (t_RandomState))) in + letb QUERIES := (QUERIES_temp) : both _ _ (t_HashMap (t_Query) (t_Random) (t_RandomState)) in + letb _ := (todo_fresh_var) : both _ _ (t_Option (t_Random)) in + prod_b(QUERIES,r) + end. +Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.Schnorr.Random_oracle.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.Schnorr.Random_oracle.v new file mode 100644 index 0000000..0413b7f --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.Schnorr.Random_oracle.v @@ -0,0 +1,1838 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_lib. + +Program Definition random_oracle_init {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 (unit)) : both (L1) (I1) (unit) := + tt. +Fail Next Obligation. + +Definition t_GCanvas : choice_type := + (nseq int8 TODO: Int.to_string length × t_Sign × 'bool). +Equations Build_t_GCanvas {L : {fset Location}} {I : Interface} (f_b : both L I (nseq int8 TODO: Int.to_string length)) (f_sign : both L I (t_Sign)) (f_signed : both L I ('bool)) : both L I (t_GCanvas) := + Build_t_GCanvas f_b f_sign f_signed := + bind_both f_signed (fun f_signed => + bind_both f_sign (fun f_sign => + bind_both f_b (fun f_b => + ret_both f_b f_sign f_signed))) : both L I (t_GCanvas). +Fail Next Obligation. + +Program Definition max_under_impl_16 : both (fset []) ([interface ]) (t_Output) := + ((from i32(1)) shift_left i32(384)) .- one. +Fail Next Obligation. + +Program Definition max_value_under_impl_16 : both (fset []) ([interface ]) (t_GCanvas) := + from max_under_impl_16. +Fail Next Obligation. + +(*item error backend*) + +Program Definition from_literal_under_impl_16 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_GCanvas) := + letb big_x := (from x) : both _ _ (t_BigInt) in + letb _ := (ifb big_x >.? (into max_under_impl_16) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; + too big for type GCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + into big_x. +Fail Next Obligation. + +Program Definition from_signed_literal_under_impl_16 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_GCanvas) := + letb big_x := (from (cast_int x)) : both _ _ (t_BigInt) in + letb _ := (ifb big_x >.? (into max_under_impl_16) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; + too big for type GCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + into big_x. +Fail Next Obligation. + +Program Definition pow2_under_impl_16 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_GCanvas) := + into ((from i32(1)) shift_left x). +Fail Next Obligation. + +(*item error backend*) + +#[global] Instance t_GCanvas_t_From : t_From t_GCanvas t_BigUint := { + from (x : t_BigUint) := from (from x); +}. + +#[global] Instance t_GCanvas_t_From : t_From t_GCanvas t_BigInt := { + from (x : t_BigInt) := letb max_value := (max_under_impl_16) : both _ _ (t_BigInt) in + letb _ := (ifb not (x <=.? max_value) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [; + is too large for type GCanvas!])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb '(sign,repr) := (to_bytes_be_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in + letb _ := (ifb andb (sign =.? Sign_Minus) (not false) + then letb 'tt := (never_to_any (begin_panic Trying to convert a negative number into an unsigned integer!)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb _ := (ifb (len_under_impl_1 repr) >.? ((i32(384) .+ i32(7)) ./ i32(8)) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [; + is too large for type GCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letbm out loc(out_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in + letb upper := (len_under_impl (unsize out)) : both _ _ (uint_size) in + letb lower := (upper .- (len_under_impl_1 repr)) : both _ _ (uint_size) in + letb _ := (failure RefMut:The mutation of this &mut is not allowed here. + core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (out), + core::ops::range::Range { + f_start: lower, + f_end: upper, + }, + ))), + &(deref(core::ops::deref::Deref::deref(&(deref(&(repr)))))), + )) : both _ _ (unit) in + Build_t_GCanvas outsignfalse; +}. + +#[global] Instance t_GCanvas_t_Default : t_Default t_GCanvas := { + default := Build_t_GCanvas (repeat i8(0) i32(48))Sign_Plusfalse; +}. + +#[global] Instance t_GCanvas_t_Into : t_Into t_GCanvas t_BigInt := { + into (self : t_GCanvas) := from_bytes_be_under_impl_24 (f_sign self) (unsize (f_b self)); +}. + +#[global] Instance t_GCanvas_t_Into : t_Into t_GCanvas t_BigUint := { + into (self : t_GCanvas) := from_bytes_be_under_impl_18 (unsize (f_b self)); +}. + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*item error backend*) + +Definition repr_loc : Location := + (nseq int8 TODO: Int.to_string length ; 1%nat). +Program Definition from_be_bytes_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas) := + letb _ := (ifb true + then letb _ := (ifb not ((len_under_impl v) <=.? ((i32(384) .+ i32(7)) ./ i32(8))) + then letb 'tt := (never_to_any (begin_panic from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in + letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in + letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in + letb _ := (failure RefMut:The mutation of this &mut is not allowed here. + core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (repr), + core::ops::range::Range { + f_start: lower, + f_end: upper, + }, + ))), + &(deref(deref(&(v)))), + )) : both _ _ (unit) in + Build_t_GCanvas reprSign_Plusfalse. +Fail Next Obligation. + +Definition repr_loc : Location := + (nseq int8 TODO: Int.to_string length ; 2%nat). +Program Definition from_le_bytes_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas) := + letb _ := (ifb true + then letb _ := (ifb not ((len_under_impl v) <=.? ((i32(384) .+ i32(7)) ./ i32(8))) + then letb 'tt := (never_to_any (begin_panic from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in + letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in + letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in + letb _ := (failure RefMut:The mutation of this &mut is not allowed here. + core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (repr), + core::ops::range::Range { + f_start: lower, + f_end: upper, + }, + ))), + &(deref(deref(&(v)))), + )) : both _ _ (unit) in + into (from_bytes_le_under_impl_24 Sign_Plus (unsize repr)). +Fail Next Obligation. + +Program Definition to_be_bytes_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_GCanvas)) : both (L1) (I1) (nseq int8 TODO: Int.to_string length) := + f_b self. +Fail Next Obligation. + +Definition repr_loc : Location := + (nseq int8 TODO: Int.to_string length ; 3%nat). +Program Definition to_le_bytes_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_GCanvas)) : both (L1 :|: fset [repr_loc]) (I1) (nseq int8 TODO: Int.to_string length) := + letb x := (from_bytes_be_under_impl_24 Sign_Plus (unsize (f_b self))) : both _ _ (t_BigInt) in + letb '(_,x_s) := (to_bytes_le_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in + letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in + letb _ := (failure RefMut:The mutation of this &mut is not allowed here. + core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (repr), + core::ops::range::Range { + f_start: 0, + f_end: alloc::vec::len_under_impl_1(&(x_s)), + }, + ))), + &(deref(core::ops::deref::Deref::deref(&(deref(&(x_s)))))), + )) : both _ _ (unit) in + repr. +Fail Next Obligation. + +Program Definition comp_eq_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a =.? b + then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_GCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_ne_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a <> b + then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_GCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_gte_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a >=.? b + then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_GCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_gt_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a >.? b + then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_GCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_lte_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a <=.? b + then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_GCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_lt_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a <.? b + then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_GCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition inv_under_impl_27 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (modval : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_GCanvas) := + letb biguintmodval := (into modval) : both _ _ (t_BigInt) in + letb m := (biguintmodval .- (from i32(2))) : both _ _ (t_Output) in + letb s := (into self) : both _ _ (t_BigInt) in + into (modpow_under_impl_24 s m biguintmodval). +Fail Next Obligation. + +Program Definition pow_felem_under_impl_27 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_GCanvas)) (exp : both L2 I2 (t_GCanvas)) (modval : both L3 I3 (t_GCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_GCanvas) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into exp) : both _ _ (t_BigInt) in + letb m := (into modval) : both _ _ (t_BigInt) in + letb c := (modpow_under_impl_24 a b m) : both _ _ (t_BigInt) in + into c. +Fail Next Obligation. + +Program Definition pow_under_impl_27 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_GCanvas)) (exp : both L2 I2 (int128)) (modval : both L3 I3 (t_GCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_GCanvas) := + pow_felem_under_impl_27 self (into (from exp)) modval. +Fail Next Obligation. + +Program Definition rem_under_impl_27 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (n : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + self .% n. +Fail Next Obligation. + +#[global] Instance t_GCanvas_t_Add : t_Add t_GCanvas t_GCanvas := { + t_Output := t_GCanvas; + add (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb c := (a .+ b) : both _ _ (t_Output) in + letb _ := (ifb c >.? max_under_impl_16 + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded addition overflow for type GCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + into c; +}. + +#[global] Instance t_GCanvas_t_Sub : t_Sub t_GCanvas t_GCanvas := { + t_Output := t_GCanvas; + sub (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb c := (ifb f_signed self + then a .- b + else unwrap_or_else_under_impl (checked_sub_under_impl_24 a b) ( + never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded substraction underflow for type GCanvas])) (unsize none_under_impl_1))))) : both _ _ (t_Output) in + into c; +}. + +#[global] Instance t_GCanvas_t_Mul : t_Mul t_GCanvas t_GCanvas := { + t_Output := t_GCanvas; + mul (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb c := (a .* b) : both _ _ (t_Output) in + letb _ := (ifb c >.? max_under_impl_16 + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded multiplication overflow for type GCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + into c; +}. + +#[global] Instance t_GCanvas_t_Div : t_Div t_GCanvas t_GCanvas := { + t_Output := t_GCanvas; + div (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb _ := (ifb b =.? zero + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [dividing by zero in type GCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb c := (a ./ b) : both _ _ (t_Output) in + into c; +}. + +#[global] Instance t_GCanvas_t_Rem : t_Rem t_GCanvas t_GCanvas := { + t_Output := t_GCanvas; + rem (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb _ := (ifb b =.? zero + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [dividing by zero in type GCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb c := (a .% b) : both _ _ (t_Output) in + into c; +}. + +#[global] Instance t_GCanvas_t_Not : t_Not t_GCanvas := { + t_Output := t_GCanvas; + not (self : t_GCanvas) := never_to_any (panic not implemented); +}. + +#[global] Instance t_GCanvas_t_BitOr : t_BitOr t_GCanvas t_GCanvas := { + t_Output := t_GCanvas; + bitor (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + into (a .| b); +}. + +#[global] Instance t_GCanvas_t_BitXor : t_BitXor t_GCanvas t_GCanvas := { + t_Output := t_GCanvas; + bitxor (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + into (a .^ b); +}. + +#[global] Instance t_GCanvas_t_BitAnd : t_BitAnd t_GCanvas t_GCanvas := { + t_Output := t_GCanvas; + bitand (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + into (a .& b); +}. + +#[global] Instance t_GCanvas_t_Shr : t_Shr t_GCanvas uint_size := { + t_Output := t_GCanvas; + shr (self : t_GCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (rhs) : both _ _ (uint_size) in + into (a shift_right b); +}. + +#[global] Instance t_GCanvas_t_Shl : t_Shl t_GCanvas uint_size := { + t_Output := t_GCanvas; + shl (self : t_GCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (rhs) : both _ _ (uint_size) in + into (a shift_left b); +}. + +#[global] Instance t_GCanvas_t_PartialEq : t_PartialEq t_GCanvas t_GCanvas := { + eq (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + a =.? b; +}. + +#[global] Instance t_GCanvas_t_Eq : t_Eq t_GCanvas := { +}. + +#[global] Instance t_GCanvas_t_PartialOrd : t_PartialOrd t_GCanvas t_GCanvas := { + partial_cmp (self : t_GCanvas) (other : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into other) : both _ _ (t_BigInt) in + partial_cmp a b; +}. + +#[global] Instance t_GCanvas_t_Ord : t_Ord t_GCanvas := { + cmp (self : t_GCanvas) (other : t_GCanvas) := unwrap_under_impl (partial_cmp self other); +}. + +Program Definition from_byte_seq_be_under_impl_8 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas) := + from_be_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + declassify_under_impl_2 x)))). +Fail Next Obligation. + +Program Definition from_public_byte_seq_be_under_impl_8 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas) := + from_be_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + x)))). +Fail Next Obligation. + +Program Definition to_byte_seq_be_under_impl_8 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_GCanvas)) : both (L1) (I1) (t_Seq (t_U8)) := + from_vec_under_impl_52 (collect (map (iter_under_impl (unsize (to_be_bytes_under_impl_15 self))) (fun x => + classify_under_impl_2 x))). +Fail Next Obligation. + +#[global] Instance t_GCanvas_t_NumericCopy : t_NumericCopy t_GCanvas := { +}. + +#[global] Instance t_GCanvas_t_UnsignedInteger : t_UnsignedInteger t_GCanvas := { +}. + +#[global] Instance t_GCanvas_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_GCanvas := { +}. + +#[global] Instance t_GCanvas_t_Integer : t_Integer t_GCanvas := { + NUM_BITS := i32(384); + ZERO := from_literal_under_impl_16 i128(0); + ONE := from_literal_under_impl_16 i128(1); + TWO := from_literal_under_impl_16 i128(2); + from_literal (val : int128) := from_literal_under_impl_16 val; + from_hex_string (s : t_String) := from_hex_under_impl_15 (deref (replace_under_impl_5 (deref s) 0x )); + get_bit (self : t_GCanvas) (i : uint_size) := (self shift_right i) .& v_ONE; + set_bit (self : t_GCanvas) (b : t_GCanvas) (i : uint_size) := letb _ := (ifb true + then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) + then letb 'tt := (never_to_any (panic assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb tmp1 := (from_literal_under_impl_16 (not (i128(1) shift_left i))) : both _ _ (t_GCanvas) in + letb tmp2 := (b shift_left i) : both _ _ (t_Output) in + (self .& tmp1) .| tmp2; + set (self : t_GCanvas) (pos : uint_size) (y : t_GCanvas) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_GCanvas) in + set_bit self b pos; + rotate_left (self : t_GCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + ((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); + rotate_right (self : t_GCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + ((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); +}. + +#[global] Instance t_GCanvas_t_ModNumeric : t_ModNumeric t_GCanvas := { + sub_mod (self : t_GCanvas) (rhs : t_GCanvas) (n : t_GCanvas) := (self .- rhs) .% n; + add_mod (self : t_GCanvas) (rhs : t_GCanvas) (n : t_GCanvas) := (self .+ rhs) .% n; + mul_mod (self : t_GCanvas) (rhs : t_GCanvas) (n : t_GCanvas) := (self .* rhs) .% n; + pow_mod (self : t_GCanvas) (exp : t_GCanvas) (n : t_GCanvas) := pow_felem_under_impl_27 self exp n; + modulo (self : t_GCanvas) (n : t_GCanvas) := self .% n; + signed_modulo (self : t_GCanvas) (n : t_GCanvas) := modulo self n; + absolute (self : t_GCanvas) := self; +}. + +#[global] Instance t_GCanvas_t_Numeric : t_Numeric t_GCanvas := { + max_val := max_value_under_impl_16; + wrap_add (self : t_GCanvas) (rhs : t_GCanvas) := self .+ rhs; + wrap_sub (self : t_GCanvas) (rhs : t_GCanvas) := self .- rhs; + wrap_mul (self : t_GCanvas) (rhs : t_GCanvas) := self .* rhs; + wrap_div (self : t_GCanvas) (rhs : t_GCanvas) := self ./ rhs; + exp (self : t_GCanvas) (exp : int32) := pow_under_impl_27 self (into exp) max_val; + pow_self (self : t_GCanvas) (exp : t_GCanvas) := pow_felem_under_impl_27 self (into exp) max_val; + divide (self : t_GCanvas) (rhs : t_GCanvas) := self ./ rhs; + inv (self : t_GCanvas) (n : t_GCanvas) := inv_under_impl_27 self n; + equal (self : t_GCanvas) (other : t_GCanvas) := self =.? other; + greater_than (self : t_GCanvas) (other : t_GCanvas) := self >.? other; + greater_than_or_equal (self : t_GCanvas) (other : t_GCanvas) := self >=.? other; + less_than (self : t_GCanvas) (other : t_GCanvas) := self <.? other; + less_than_or_equal (self : t_GCanvas) (other : t_GCanvas) := self >=.? other; + not_equal_bm (self : t_GCanvas) (other : t_GCanvas) := ifb not (equal self other) + then max_val + else from_literal_under_impl_16 i128(0); + equal_bm (self : t_GCanvas) (other : t_GCanvas) := ifb equal self other + then max_val + else from_literal_under_impl_16 i128(0); + greater_than_bm (self : t_GCanvas) (other : t_GCanvas) := ifb greater_than self other + then max_val + else from_literal_under_impl_16 i128(0); + greater_than_or_equal_bm (self : t_GCanvas) (other : t_GCanvas) := ifb greater_than_or_equal self other + then max_val + else from_literal_under_impl_16 i128(0); + less_than_bm (self : t_GCanvas) (other : t_GCanvas) := ifb less_than self other + then max_val + else from_literal_under_impl_16 i128(0); + less_than_or_equal_bm (self : t_GCanvas) (other : t_GCanvas) := ifb less_than_or_equal self other + then max_val + else from_literal_under_impl_16 i128(0); +}. + +Definition t_G : choice_type := + (t_GCanvas). +Equations Build_t_G {L : {fset Location}} {I : Interface} (0 : both L I (t_GCanvas)) : both L I (t_G) := + Build_t_G 0 := + bind_both 0 (fun 0 => + ret_both 0) : both L I (t_G). +Fail Next Obligation. + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +#[global] Instance t_G_t_From : t_From t_G t_GCanvas := { + from (x : t_GCanvas) := G (rem_under_impl_27 x (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)); +}. + +#[global] Instance t_G_t_Into : t_Into t_G t_GCanvas := { + into (self : t_G) := 0 self; +}. + +Program Definition from_canvas_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_GCanvas)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := + G (rem_under_impl_27 x (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)). +Fail Next Obligation. + +Program Definition into_canvas_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_GCanvas) := + 0 self. +Fail Next Obligation. + +Program Definition max_under_impl_64 : both (fset [x_loc]) ([interface ]) (t_GCanvas) := + from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab. +Fail Next Obligation. + +Program Definition declassify_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_BigInt) := + letb a := (into self) : both _ _ (t_GCanvas) in + into a. +Fail Next Obligation. + +(*item error backend*) + +Program Definition from_be_bytes_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := + into (from_be_bytes_under_impl_15 v). +Fail Next Obligation. + +Program Definition to_be_bytes_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_Vec (int8) (t_Global)) := + to_vec_under_impl (unsize (to_be_bytes_under_impl_15 (into self))). +Fail Next Obligation. + +Program Definition from_le_bytes_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := + into (from_le_bytes_under_impl_15 v). +Fail Next Obligation. + +Program Definition to_le_bytes_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [repr_loc]) (I1) (t_Vec (int8) (t_Global)) := + to_vec_under_impl (unsize (to_le_bytes_under_impl_15 (into self))). +Fail Next Obligation. + +Program Definition bit_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (i : both L2 I2 (uint_size)) : both (L1:|:L2) (I1:|:I2) ('bool) := + bit_under_impl_16 (into self) i. +Fail Next Obligation. + +Program Definition from_literal_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := + letb big_x := (from x) : both _ _ (t_BigUint) in + letb _ := (ifb big_x >.? (into max_under_impl_64) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; + too big for type G])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + G (into big_x). +Fail Next Obligation. + +Program Definition from_signed_literal_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := + letb big_x := (from (cast_int x)) : both _ _ (t_BigUint) in + letb _ := (ifb big_x >.? (into max_under_impl_64) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; + too big for type G])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + G (into big_x). +Fail Next Obligation. + +Program Definition comp_eq_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := + letb x := (into self) : both _ _ (t_GCanvas) in + into (comp_eq_under_impl_15 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_ne_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := + letb x := (into self) : both _ _ (t_GCanvas) in + into (comp_ne_under_impl_15 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_gte_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := + letb x := (into self) : both _ _ (t_GCanvas) in + into (comp_gte_under_impl_15 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_gt_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := + letb x := (into self) : both _ _ (t_GCanvas) in + into (comp_gt_under_impl_15 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_lte_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := + letb x := (into self) : both _ _ (t_GCanvas) in + into (comp_lte_under_impl_15 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_lt_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := + letb x := (into self) : both _ _ (t_GCanvas) in + into (comp_lt_under_impl_15 x (into rhs)). +Fail Next Obligation. + +Program Definition neg_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := + letb mod_val := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigInt) in + letb s := (into self) : both _ _ (t_GCanvas) in + letb s := (into s) : both _ _ (t_BigInt) in + letb result := (into (mod_val .- s)) : both _ _ (t_GCanvas) in + into result. +Fail Next Obligation. + +#[global] Instance t_G_t_PartialOrd : t_PartialOrd t_G t_G := { + partial_cmp (self : t_G) (other : t_G) := Option_Some (cmp self other); +}. + +#[global] Instance t_G_t_Ord : t_Ord t_G := { + cmp (self : t_G) (other : t_G) := cmp (0 self) (0 other); +}. + +#[global] Instance t_G_t_PartialEq : t_PartialEq t_G t_G := { + eq (self : t_G) (other : t_G) := (0 self) =.? (0 other); +}. + +#[global] Instance t_G_t_Eq : t_Eq t_G := { +}. + +#[global] Instance t_G_t_Add : t_Add t_G t_G := { + t_Output := t_G; + add (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in + letb b := (into rhs) : both _ _ (t_GCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb c := (a .+ b) : both _ _ (t_Output) in + letb max := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_GCanvas) in + into d; +}. + +#[global] Instance t_G_t_Sub : t_Sub t_G t_G := { + t_Output := t_G; + sub (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in + letb b := (into rhs) : both _ _ (t_GCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb max := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in + letb c := (ifb b >.? a + then ((clone max) .- b) .+ a + else a .- b) : both _ _ (t_Output) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_GCanvas) in + into d; +}. + +#[global] Instance t_G_t_Mul : t_Mul t_G t_G := { + t_Output := t_G; + mul (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in + letb b := (into rhs) : both _ _ (t_GCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb c := (a .* b) : both _ _ (t_Output) in + letb max := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_GCanvas) in + into d; +}. + +#[global] Instance t_G_t_Div : t_Div t_G t_G := { + t_Output := t_G; + div (self : t_G) (rhs : t_G) := self .* (inv_under_impl_58 rhs); +}. + +#[global] Instance t_G_t_Rem : t_Rem t_G t_G := { + t_Output := t_G; + rem (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in + letb b := (into rhs) : both _ _ (t_GCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb c := (a .% b) : both _ _ (t_Output) in + letb max := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_GCanvas) in + into d; +}. + +#[global] Instance t_G_t_Not : t_Not t_G := { + t_Output := t_G; + not (self : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in + into (not a); +}. + +#[global] Instance t_G_t_BitOr : t_BitOr t_G t_G := { + t_Output := t_G; + bitor (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in + letb b := (into rhs) : both _ _ (t_GCanvas) in + into (a .| b); +}. + +#[global] Instance t_G_t_BitXor : t_BitXor t_G t_G := { + t_Output := t_G; + bitxor (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in + letb b := (into rhs) : both _ _ (t_GCanvas) in + into (a .^ b); +}. + +#[global] Instance t_G_t_BitAnd : t_BitAnd t_G t_G := { + t_Output := t_G; + bitand (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in + letb b := (into rhs) : both _ _ (t_GCanvas) in + into (a .& b); +}. + +#[global] Instance t_G_t_Shr : t_Shr t_G uint_size := { + t_Output := t_G; + shr (self : t_G) (rhs : uint_size) := letb a := (into self) : both _ _ (t_GCanvas) in + into (a shift_right rhs); +}. + +#[global] Instance t_G_t_Shl : t_Shl t_G uint_size := { + t_Output := t_G; + shl (self : t_G) (rhs : uint_size) := letb a := (into self) : both _ _ (t_GCanvas) in + into (a shift_left rhs); +}. + +Program Definition inv_under_impl_58 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := + letb base := (into self) : both _ _ (t_GCanvas) in + into (inv_under_impl_27 base max_under_impl_64). +Fail Next Obligation. + +Program Definition pow_felem_under_impl_58 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (exp : both L2 I2 (t_G)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_G) := + letb base := (into self) : both _ _ (t_GCanvas) in + into (pow_felem_under_impl_27 base (into exp) max_under_impl_64). +Fail Next Obligation. + +Program Definition pow_under_impl_58 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (exp : both L2 I2 (int128)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_G) := + letb base := (into self) : both _ _ (t_GCanvas) in + into (pow_under_impl_27 base exp max_under_impl_64). +Fail Next Obligation. + +Program Definition pow2_under_impl_58 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_G) := + into (pow2_under_impl_16 x). +Fail Next Obligation. + +Program Definition from_byte_seq_be_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := + into (from_be_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + declassify_under_impl_2 x))))). +Fail Next Obligation. + +Program Definition from_public_byte_seq_be_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := + into (from_be_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + x))))). +Fail Next Obligation. + +Program Definition to_byte_seq_be_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_Seq (t_U8)) := + from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_be_bytes_under_impl_64 self))) (fun x => + classify_under_impl_2 x))). +Fail Next Obligation. + +Program Definition to_public_byte_seq_be_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_Seq (int8)) := + from_vec_under_impl_52 (to_be_bytes_under_impl_64 self). +Fail Next Obligation. + +Program Definition from_byte_seq_le_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := + into (from_le_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + declassify_under_impl_2 x))))). +Fail Next Obligation. + +Program Definition from_public_byte_seq_le_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := + into (from_le_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + x))))). +Fail Next Obligation. + +Program Definition to_byte_seq_le_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (t_U8)) := + from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_le_bytes_under_impl_64 self))) (fun x => + classify_under_impl_2 x))). +Fail Next Obligation. + +Program Definition to_public_byte_seq_le_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (int8)) := + from_vec_under_impl_52 (to_le_bytes_under_impl_64 self). +Fail Next Obligation. + +Program Definition from_secret_literal_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_U128)) : both (L1) (I1) (t_G) := + into (from_literal_under_impl_16 (declassify_under_impl_126 x)). +Fail Next Obligation. + +#[global] Instance t_G_t_NumericCopy : t_NumericCopy t_G := { +}. + +#[global] Instance t_G_t_UnsignedInteger : t_UnsignedInteger t_G := { +}. + +#[global] Instance t_G_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_G := { +}. + +#[global] Instance t_G_t_Integer : t_Integer t_G := { + NUM_BITS := i32(384); + ZERO := from_literal_under_impl_64 i128(0); + ONE := from_literal_under_impl_64 i128(1); + TWO := from_literal_under_impl_64 i128(2); + from_literal (val : int128) := from_literal_under_impl_64 val; + from_hex_string (s : t_String) := from_hex_under_impl_64 (deref (replace_under_impl_5 (deref s) 0x )); + get_bit (self : t_G) (i : uint_size) := (self shift_right i) .& v_ONE; + set_bit (self : t_G) (b : t_G) (i : uint_size) := letb _ := (ifb true + then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) + then letb 'tt := (never_to_any (panic assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb tmp1 := (from_literal_under_impl_64 (not (i128(1) shift_left i))) : both _ _ (t_G) in + letb tmp2 := (b shift_left i) : both _ _ (t_Output) in + (self .& tmp1) .| tmp2; + set (self : t_G) (pos : uint_size) (y : t_G) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_G) in + set_bit self b pos; + rotate_left (self : t_G) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + ((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); + rotate_right (self : t_G) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + ((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); +}. + +#[global] Instance t_G_t_ModNumeric : t_ModNumeric t_G := { + sub_mod (self : t_G) (rhs : t_G) (n : t_G) := self .- rhs; + add_mod (self : t_G) (rhs : t_G) (n : t_G) := self .+ rhs; + mul_mod (self : t_G) (rhs : t_G) (n : t_G) := self .* rhs; + pow_mod (self : t_G) (exp : t_G) (n : t_G) := pow_felem_under_impl_58 self exp; + modulo (self : t_G) (n : t_G) := self .% n; + signed_modulo (self : t_G) (n : t_G) := modulo self n; + absolute (self : t_G) := self; +}. + +#[global] Instance t_G_t_Numeric : t_Numeric t_G := { + max_val := into (max_under_impl_64 .- (from_literal_under_impl_16 i128(1))); + wrap_add (self : t_G) (rhs : t_G) := self .+ rhs; + wrap_sub (self : t_G) (rhs : t_G) := self .- rhs; + wrap_mul (self : t_G) (rhs : t_G) := self .* rhs; + wrap_div (self : t_G) (rhs : t_G) := self ./ rhs; + exp (self : t_G) (exp : int32) := pow_under_impl_58 self (into exp); + pow_self (self : t_G) (exp : t_G) := pow_felem_under_impl_58 self exp; + divide (self : t_G) (rhs : t_G) := self ./ rhs; + inv (self : t_G) (n : t_G) := inv_under_impl_58 self; + equal (self : t_G) (other : t_G) := self =.? other; + greater_than (self : t_G) (other : t_G) := self >.? other; + greater_than_or_equal (self : t_G) (other : t_G) := self >=.? other; + less_than (self : t_G) (other : t_G) := self <.? other; + less_than_or_equal (self : t_G) (other : t_G) := self <=.? other; + not_equal_bm (self : t_G) (other : t_G) := ifb self <> other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + equal_bm (self : t_G) (other : t_G) := ifb self =.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + greater_than_bm (self : t_G) (other : t_G) := ifb self >.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + greater_than_or_equal_bm (self : t_G) (other : t_G) := ifb self >=.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + less_than_bm (self : t_G) (other : t_G) := ifb self <.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + less_than_or_equal_bm (self : t_G) (other : t_G) := ifb self <=.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; +}. + +Definition t_QCanvas : choice_type := + (nseq int8 TODO: Int.to_string length × t_Sign × 'bool). +Equations Build_t_QCanvas {L : {fset Location}} {I : Interface} (f_b : both L I (nseq int8 TODO: Int.to_string length)) (f_sign : both L I (t_Sign)) (f_signed : both L I ('bool)) : both L I (t_QCanvas) := + Build_t_QCanvas f_b f_sign f_signed := + bind_both f_signed (fun f_signed => + bind_both f_sign (fun f_sign => + bind_both f_b (fun f_b => + ret_both f_b f_sign f_signed))) : both L I (t_QCanvas). +Fail Next Obligation. + +Program Definition max_under_impl_83 : both (fset []) ([interface ]) (t_Output) := + ((from i32(1)) shift_left i32(384)) .- one. +Fail Next Obligation. + +Program Definition max_value_under_impl_83 : both (fset []) ([interface ]) (t_QCanvas) := + from max_under_impl_83. +Fail Next Obligation. + +(*item error backend*) + +Program Definition from_literal_under_impl_83 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_QCanvas) := + letb big_x := (from x) : both _ _ (t_BigInt) in + letb _ := (ifb big_x >.? (into max_under_impl_83) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; + too big for type QCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + into big_x. +Fail Next Obligation. + +Program Definition from_signed_literal_under_impl_83 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_QCanvas) := + letb big_x := (from (cast_int x)) : both _ _ (t_BigInt) in + letb _ := (ifb big_x >.? (into max_under_impl_83) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; + too big for type QCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + into big_x. +Fail Next Obligation. + +Program Definition pow2_under_impl_83 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_QCanvas) := + into ((from i32(1)) shift_left x). +Fail Next Obligation. + +(*item error backend*) + +#[global] Instance t_QCanvas_t_From : t_From t_QCanvas t_BigUint := { + from (x : t_BigUint) := from (from x); +}. + +#[global] Instance t_QCanvas_t_From : t_From t_QCanvas t_BigInt := { + from (x : t_BigInt) := letb max_value := (max_under_impl_83) : both _ _ (t_BigInt) in + letb _ := (ifb not (x <=.? max_value) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [; + is too large for type QCanvas!])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb '(sign,repr) := (to_bytes_be_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in + letb _ := (ifb andb (sign =.? Sign_Minus) (not false) + then letb 'tt := (never_to_any (begin_panic Trying to convert a negative number into an unsigned integer!)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb _ := (ifb (len_under_impl_1 repr) >.? ((i32(384) .+ i32(7)) ./ i32(8)) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [; + is too large for type QCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letbm out loc(out_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in + letb upper := (len_under_impl (unsize out)) : both _ _ (uint_size) in + letb lower := (upper .- (len_under_impl_1 repr)) : both _ _ (uint_size) in + letb _ := (failure RefMut:The mutation of this &mut is not allowed here. + core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (out), + core::ops::range::Range { + f_start: lower, + f_end: upper, + }, + ))), + &(deref(core::ops::deref::Deref::deref(&(deref(&(repr)))))), + )) : both _ _ (unit) in + Build_t_QCanvas outsignfalse; +}. + +#[global] Instance t_QCanvas_t_Default : t_Default t_QCanvas := { + default := Build_t_QCanvas (repeat i8(0) i32(48))Sign_Plusfalse; +}. + +#[global] Instance t_QCanvas_t_Into : t_Into t_QCanvas t_BigInt := { + into (self : t_QCanvas) := from_bytes_be_under_impl_24 (f_sign self) (unsize (f_b self)); +}. + +#[global] Instance t_QCanvas_t_Into : t_Into t_QCanvas t_BigUint := { + into (self : t_QCanvas) := from_bytes_be_under_impl_18 (unsize (f_b self)); +}. + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*item error backend*) + +Definition repr_loc : Location := + (nseq int8 TODO: Int.to_string length ; 5%nat). +Program Definition from_be_bytes_under_impl_82 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_QCanvas) := + letb _ := (ifb true + then letb _ := (ifb not ((len_under_impl v) <=.? ((i32(384) .+ i32(7)) ./ i32(8))) + then letb 'tt := (never_to_any (begin_panic from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in + letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in + letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in + letb _ := (failure RefMut:The mutation of this &mut is not allowed here. + core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (repr), + core::ops::range::Range { + f_start: lower, + f_end: upper, + }, + ))), + &(deref(deref(&(v)))), + )) : both _ _ (unit) in + Build_t_QCanvas reprSign_Plusfalse. +Fail Next Obligation. + +Definition repr_loc : Location := + (nseq int8 TODO: Int.to_string length ; 6%nat). +Program Definition from_le_bytes_under_impl_82 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_QCanvas) := + letb _ := (ifb true + then letb _ := (ifb not ((len_under_impl v) <=.? ((i32(384) .+ i32(7)) ./ i32(8))) + then letb 'tt := (never_to_any (begin_panic from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in + letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in + letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in + letb _ := (failure RefMut:The mutation of this &mut is not allowed here. + core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (repr), + core::ops::range::Range { + f_start: lower, + f_end: upper, + }, + ))), + &(deref(deref(&(v)))), + )) : both _ _ (unit) in + into (from_bytes_le_under_impl_24 Sign_Plus (unsize repr)). +Fail Next Obligation. + +Program Definition to_be_bytes_under_impl_82 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_QCanvas)) : both (L1) (I1) (nseq int8 TODO: Int.to_string length) := + f_b self. +Fail Next Obligation. + +Definition repr_loc : Location := + (nseq int8 TODO: Int.to_string length ; 7%nat). +Program Definition to_le_bytes_under_impl_82 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_QCanvas)) : both (L1 :|: fset [repr_loc]) (I1) (nseq int8 TODO: Int.to_string length) := + letb x := (from_bytes_be_under_impl_24 Sign_Plus (unsize (f_b self))) : both _ _ (t_BigInt) in + letb '(_,x_s) := (to_bytes_le_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in + letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in + letb _ := (failure RefMut:The mutation of this &mut is not allowed here. + core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (repr), + core::ops::range::Range { + f_start: 0, + f_end: alloc::vec::len_under_impl_1(&(x_s)), + }, + ))), + &(deref(core::ops::deref::Deref::deref(&(deref(&(x_s)))))), + )) : both _ _ (unit) in + repr. +Fail Next Obligation. + +Program Definition comp_eq_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QCanvas)) (rhs : both L2 I2 (t_QCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a =.? b + then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_QCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_ne_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QCanvas)) (rhs : both L2 I2 (t_QCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a <> b + then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_QCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_gte_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QCanvas)) (rhs : both L2 I2 (t_QCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a >=.? b + then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_QCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_gt_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QCanvas)) (rhs : both L2 I2 (t_QCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a >.? b + then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_QCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_lte_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QCanvas)) (rhs : both L2 I2 (t_QCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a <=.? b + then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_QCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition comp_lt_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QCanvas)) (rhs : both L2 I2 (t_QCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb a <.? b + then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_QCanvas) in + (one shift_left (i32(384) .- i32(1))) .- one + else default. +Fail Next Obligation. + +Program Definition inv_under_impl_94 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QCanvas)) (modval : both L2 I2 (t_QCanvas)) : both (L1:|:L2) (I1:|:I2) (t_QCanvas) := + letb biguintmodval := (into modval) : both _ _ (t_BigInt) in + letb m := (biguintmodval .- (from i32(2))) : both _ _ (t_Output) in + letb s := (into self) : both _ _ (t_BigInt) in + into (modpow_under_impl_24 s m biguintmodval). +Fail Next Obligation. + +Program Definition pow_felem_under_impl_94 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_QCanvas)) (exp : both L2 I2 (t_QCanvas)) (modval : both L3 I3 (t_QCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_QCanvas) := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into exp) : both _ _ (t_BigInt) in + letb m := (into modval) : both _ _ (t_BigInt) in + letb c := (modpow_under_impl_24 a b m) : both _ _ (t_BigInt) in + into c. +Fail Next Obligation. + +Program Definition pow_under_impl_94 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_QCanvas)) (exp : both L2 I2 (int128)) (modval : both L3 I3 (t_QCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_QCanvas) := + pow_felem_under_impl_94 self (into (from exp)) modval. +Fail Next Obligation. + +Program Definition rem_under_impl_94 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QCanvas)) (n : both L2 I2 (t_QCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + self .% n. +Fail Next Obligation. + +#[global] Instance t_QCanvas_t_Add : t_Add t_QCanvas t_QCanvas := { + t_Output := t_QCanvas; + add (self : t_QCanvas) (rhs : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb c := (a .+ b) : both _ _ (t_Output) in + letb _ := (ifb c >.? max_under_impl_83 + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded addition overflow for type QCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + into c; +}. + +#[global] Instance t_QCanvas_t_Sub : t_Sub t_QCanvas t_QCanvas := { + t_Output := t_QCanvas; + sub (self : t_QCanvas) (rhs : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb c := (ifb f_signed self + then a .- b + else unwrap_or_else_under_impl (checked_sub_under_impl_24 a b) ( + never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded substraction underflow for type QCanvas])) (unsize none_under_impl_1))))) : both _ _ (t_Output) in + into c; +}. + +#[global] Instance t_QCanvas_t_Mul : t_Mul t_QCanvas t_QCanvas := { + t_Output := t_QCanvas; + mul (self : t_QCanvas) (rhs : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb c := (a .* b) : both _ _ (t_Output) in + letb _ := (ifb c >.? max_under_impl_83 + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded multiplication overflow for type QCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + into c; +}. + +#[global] Instance t_QCanvas_t_Div : t_Div t_QCanvas t_QCanvas := { + t_Output := t_QCanvas; + div (self : t_QCanvas) (rhs : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb _ := (ifb b =.? zero + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [dividing by zero in type QCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb c := (a ./ b) : both _ _ (t_Output) in + into c; +}. + +#[global] Instance t_QCanvas_t_Rem : t_Rem t_QCanvas t_QCanvas := { + t_Output := t_QCanvas; + rem (self : t_QCanvas) (rhs : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb _ := (ifb b =.? zero + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [dividing by zero in type QCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb c := (a .% b) : both _ _ (t_Output) in + into c; +}. + +#[global] Instance t_QCanvas_t_Not : t_Not t_QCanvas := { + t_Output := t_QCanvas; + not (self : t_QCanvas) := never_to_any (panic not implemented); +}. + +#[global] Instance t_QCanvas_t_BitOr : t_BitOr t_QCanvas t_QCanvas := { + t_Output := t_QCanvas; + bitor (self : t_QCanvas) (rhs : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + into (a .| b); +}. + +#[global] Instance t_QCanvas_t_BitXor : t_BitXor t_QCanvas t_QCanvas := { + t_Output := t_QCanvas; + bitxor (self : t_QCanvas) (rhs : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + into (a .^ b); +}. + +#[global] Instance t_QCanvas_t_BitAnd : t_BitAnd t_QCanvas t_QCanvas := { + t_Output := t_QCanvas; + bitand (self : t_QCanvas) (rhs : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + into (a .& b); +}. + +#[global] Instance t_QCanvas_t_Shr : t_Shr t_QCanvas uint_size := { + t_Output := t_QCanvas; + shr (self : t_QCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (rhs) : both _ _ (uint_size) in + into (a shift_right b); +}. + +#[global] Instance t_QCanvas_t_Shl : t_Shl t_QCanvas uint_size := { + t_Output := t_QCanvas; + shl (self : t_QCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (rhs) : both _ _ (uint_size) in + into (a shift_left b); +}. + +#[global] Instance t_QCanvas_t_PartialEq : t_PartialEq t_QCanvas t_QCanvas := { + eq (self : t_QCanvas) (rhs : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + a =.? b; +}. + +#[global] Instance t_QCanvas_t_Eq : t_Eq t_QCanvas := { +}. + +#[global] Instance t_QCanvas_t_PartialOrd : t_PartialOrd t_QCanvas t_QCanvas := { + partial_cmp (self : t_QCanvas) (other : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into other) : both _ _ (t_BigInt) in + partial_cmp a b; +}. + +#[global] Instance t_QCanvas_t_Ord : t_Ord t_QCanvas := { + cmp (self : t_QCanvas) (other : t_QCanvas) := unwrap_under_impl (partial_cmp self other); +}. + +Program Definition from_byte_seq_be_under_impl_75 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_QCanvas) := + from_be_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + declassify_under_impl_2 x)))). +Fail Next Obligation. + +Program Definition from_public_byte_seq_be_under_impl_75 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_QCanvas) := + from_be_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + x)))). +Fail Next Obligation. + +Program Definition to_byte_seq_be_under_impl_75 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_QCanvas)) : both (L1) (I1) (t_Seq (t_U8)) := + from_vec_under_impl_52 (collect (map (iter_under_impl (unsize (to_be_bytes_under_impl_82 self))) (fun x => + classify_under_impl_2 x))). +Fail Next Obligation. + +#[global] Instance t_QCanvas_t_NumericCopy : t_NumericCopy t_QCanvas := { +}. + +#[global] Instance t_QCanvas_t_UnsignedInteger : t_UnsignedInteger t_QCanvas := { +}. + +#[global] Instance t_QCanvas_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_QCanvas := { +}. + +#[global] Instance t_QCanvas_t_Integer : t_Integer t_QCanvas := { + NUM_BITS := i32(384); + ZERO := from_literal_under_impl_83 i128(0); + ONE := from_literal_under_impl_83 i128(1); + TWO := from_literal_under_impl_83 i128(2); + from_literal (val : int128) := from_literal_under_impl_83 val; + from_hex_string (s : t_String) := from_hex_under_impl_82 (deref (replace_under_impl_5 (deref s) 0x )); + get_bit (self : t_QCanvas) (i : uint_size) := (self shift_right i) .& v_ONE; + set_bit (self : t_QCanvas) (b : t_QCanvas) (i : uint_size) := letb _ := (ifb true + then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) + then letb 'tt := (never_to_any (panic assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb tmp1 := (from_literal_under_impl_83 (not (i128(1) shift_left i))) : both _ _ (t_QCanvas) in + letb tmp2 := (b shift_left i) : both _ _ (t_Output) in + (self .& tmp1) .| tmp2; + set (self : t_QCanvas) (pos : uint_size) (y : t_QCanvas) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_QCanvas) in + set_bit self b pos; + rotate_left (self : t_QCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + ((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); + rotate_right (self : t_QCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + ((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); +}. + +#[global] Instance t_QCanvas_t_ModNumeric : t_ModNumeric t_QCanvas := { + sub_mod (self : t_QCanvas) (rhs : t_QCanvas) (n : t_QCanvas) := (self .- rhs) .% n; + add_mod (self : t_QCanvas) (rhs : t_QCanvas) (n : t_QCanvas) := (self .+ rhs) .% n; + mul_mod (self : t_QCanvas) (rhs : t_QCanvas) (n : t_QCanvas) := (self .* rhs) .% n; + pow_mod (self : t_QCanvas) (exp : t_QCanvas) (n : t_QCanvas) := pow_felem_under_impl_94 self exp n; + modulo (self : t_QCanvas) (n : t_QCanvas) := self .% n; + signed_modulo (self : t_QCanvas) (n : t_QCanvas) := modulo self n; + absolute (self : t_QCanvas) := self; +}. + +#[global] Instance t_QCanvas_t_Numeric : t_Numeric t_QCanvas := { + max_val := max_value_under_impl_83; + wrap_add (self : t_QCanvas) (rhs : t_QCanvas) := self .+ rhs; + wrap_sub (self : t_QCanvas) (rhs : t_QCanvas) := self .- rhs; + wrap_mul (self : t_QCanvas) (rhs : t_QCanvas) := self .* rhs; + wrap_div (self : t_QCanvas) (rhs : t_QCanvas) := self ./ rhs; + exp (self : t_QCanvas) (exp : int32) := pow_under_impl_94 self (into exp) max_val; + pow_self (self : t_QCanvas) (exp : t_QCanvas) := pow_felem_under_impl_94 self (into exp) max_val; + divide (self : t_QCanvas) (rhs : t_QCanvas) := self ./ rhs; + inv (self : t_QCanvas) (n : t_QCanvas) := inv_under_impl_94 self n; + equal (self : t_QCanvas) (other : t_QCanvas) := self =.? other; + greater_than (self : t_QCanvas) (other : t_QCanvas) := self >.? other; + greater_than_or_equal (self : t_QCanvas) (other : t_QCanvas) := self >=.? other; + less_than (self : t_QCanvas) (other : t_QCanvas) := self <.? other; + less_than_or_equal (self : t_QCanvas) (other : t_QCanvas) := self >=.? other; + not_equal_bm (self : t_QCanvas) (other : t_QCanvas) := ifb not (equal self other) + then max_val + else from_literal_under_impl_83 i128(0); + equal_bm (self : t_QCanvas) (other : t_QCanvas) := ifb equal self other + then max_val + else from_literal_under_impl_83 i128(0); + greater_than_bm (self : t_QCanvas) (other : t_QCanvas) := ifb greater_than self other + then max_val + else from_literal_under_impl_83 i128(0); + greater_than_or_equal_bm (self : t_QCanvas) (other : t_QCanvas) := ifb greater_than_or_equal self other + then max_val + else from_literal_under_impl_83 i128(0); + less_than_bm (self : t_QCanvas) (other : t_QCanvas) := ifb less_than self other + then max_val + else from_literal_under_impl_83 i128(0); + less_than_or_equal_bm (self : t_QCanvas) (other : t_QCanvas) := ifb less_than_or_equal self other + then max_val + else from_literal_under_impl_83 i128(0); +}. + +Definition t_Q : choice_type := + (t_QCanvas). +Equations Build_t_Q {L : {fset Location}} {I : Interface} (0 : both L I (t_QCanvas)) : both L I (t_Q) := + Build_t_Q 0 := + bind_both 0 (fun 0 => + ret_both 0) : both L I (t_Q). +Fail Next Obligation. + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +#[global] Instance t_Q_t_From : t_From t_Q t_QCanvas := { + from (x : t_QCanvas) := Q (rem_under_impl_94 x (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)); +}. + +#[global] Instance t_Q_t_Into : t_Into t_Q t_QCanvas := { + into (self : t_Q) := 0 self; +}. + +Program Definition from_canvas_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_QCanvas)) : both (L1 :|: fset [x_loc]) (I1) (t_Q) := + Q (rem_under_impl_94 x (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)). +Fail Next Obligation. + +Program Definition into_canvas_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1) (I1) (t_QCanvas) := + 0 self. +Fail Next Obligation. + +Program Definition max_under_impl_131 : both (fset [x_loc]) ([interface ]) (t_QCanvas) := + from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab. +Fail Next Obligation. + +Program Definition declassify_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1) (I1) (t_BigInt) := + letb a := (into self) : both _ _ (t_QCanvas) in + into a. +Fail Next Obligation. + +(*item error backend*) + +Program Definition from_be_bytes_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_Q) := + into (from_be_bytes_under_impl_82 v). +Fail Next Obligation. + +Program Definition to_be_bytes_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1) (I1) (t_Vec (int8) (t_Global)) := + to_vec_under_impl (unsize (to_be_bytes_under_impl_82 (into self))). +Fail Next Obligation. + +Program Definition from_le_bytes_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_Q) := + into (from_le_bytes_under_impl_82 v). +Fail Next Obligation. + +Program Definition to_le_bytes_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1 :|: fset [repr_loc]) (I1) (t_Vec (int8) (t_Global)) := + to_vec_under_impl (unsize (to_le_bytes_under_impl_82 (into self))). +Fail Next Obligation. + +Program Definition bit_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Q)) (i : both L2 I2 (uint_size)) : both (L1:|:L2) (I1:|:I2) ('bool) := + bit_under_impl_83 (into self) i. +Fail Next Obligation. + +Program Definition from_literal_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_Q) := + letb big_x := (from x) : both _ _ (t_BigUint) in + letb _ := (ifb big_x >.? (into max_under_impl_131) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; + too big for type Q])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + Q (into big_x). +Fail Next Obligation. + +Program Definition from_signed_literal_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_Q) := + letb big_x := (from (cast_int x)) : both _ _ (t_BigUint) in + letb _ := (ifb big_x >.? (into max_under_impl_131) + then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; + too big for type Q])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + Q (into big_x). +Fail Next Obligation. + +Program Definition comp_eq_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Q)) (rhs : both L2 I2 (t_Q)) : both (L1:|:L2) (I1:|:I2) (t_Q) := + letb x := (into self) : both _ _ (t_QCanvas) in + into (comp_eq_under_impl_82 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_ne_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Q)) (rhs : both L2 I2 (t_Q)) : both (L1:|:L2) (I1:|:I2) (t_Q) := + letb x := (into self) : both _ _ (t_QCanvas) in + into (comp_ne_under_impl_82 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_gte_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Q)) (rhs : both L2 I2 (t_Q)) : both (L1:|:L2) (I1:|:I2) (t_Q) := + letb x := (into self) : both _ _ (t_QCanvas) in + into (comp_gte_under_impl_82 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_gt_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Q)) (rhs : both L2 I2 (t_Q)) : both (L1:|:L2) (I1:|:I2) (t_Q) := + letb x := (into self) : both _ _ (t_QCanvas) in + into (comp_gt_under_impl_82 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_lte_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Q)) (rhs : both L2 I2 (t_Q)) : both (L1:|:L2) (I1:|:I2) (t_Q) := + letb x := (into self) : both _ _ (t_QCanvas) in + into (comp_lte_under_impl_82 x (into rhs)). +Fail Next Obligation. + +Program Definition comp_lt_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Q)) (rhs : both L2 I2 (t_Q)) : both (L1:|:L2) (I1:|:I2) (t_Q) := + letb x := (into self) : both _ _ (t_QCanvas) in + into (comp_lt_under_impl_82 x (into rhs)). +Fail Next Obligation. + +Program Definition neg_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1 :|: fset [x_loc]) (I1) (t_Q) := + letb mod_val := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigInt) in + letb s := (into self) : both _ _ (t_QCanvas) in + letb s := (into s) : both _ _ (t_BigInt) in + letb result := (into (mod_val .- s)) : both _ _ (t_QCanvas) in + into result. +Fail Next Obligation. + +#[global] Instance t_Q_t_PartialOrd : t_PartialOrd t_Q t_Q := { + partial_cmp (self : t_Q) (other : t_Q) := Option_Some (cmp self other); +}. + +#[global] Instance t_Q_t_Ord : t_Ord t_Q := { + cmp (self : t_Q) (other : t_Q) := cmp (0 self) (0 other); +}. + +#[global] Instance t_Q_t_PartialEq : t_PartialEq t_Q t_Q := { + eq (self : t_Q) (other : t_Q) := (0 self) =.? (0 other); +}. + +#[global] Instance t_Q_t_Eq : t_Eq t_Q := { +}. + +#[global] Instance t_Q_t_Add : t_Add t_Q t_Q := { + t_Output := t_Q; + add (self : t_Q) (rhs : t_Q) := letb a := (into self) : both _ _ (t_QCanvas) in + letb b := (into rhs) : both _ _ (t_QCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb c := (a .+ b) : both _ _ (t_Output) in + letb max := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_QCanvas) in + into d; +}. + +#[global] Instance t_Q_t_Sub : t_Sub t_Q t_Q := { + t_Output := t_Q; + sub (self : t_Q) (rhs : t_Q) := letb a := (into self) : both _ _ (t_QCanvas) in + letb b := (into rhs) : both _ _ (t_QCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb max := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in + letb c := (ifb b >.? a + then ((clone max) .- b) .+ a + else a .- b) : both _ _ (t_Output) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_QCanvas) in + into d; +}. + +#[global] Instance t_Q_t_Mul : t_Mul t_Q t_Q := { + t_Output := t_Q; + mul (self : t_Q) (rhs : t_Q) := letb a := (into self) : both _ _ (t_QCanvas) in + letb b := (into rhs) : both _ _ (t_QCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb c := (a .* b) : both _ _ (t_Output) in + letb max := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_QCanvas) in + into d; +}. + +#[global] Instance t_Q_t_Div : t_Div t_Q t_Q := { + t_Output := t_Q; + div (self : t_Q) (rhs : t_Q) := self .* (inv_under_impl_125 rhs); +}. + +#[global] Instance t_Q_t_Rem : t_Rem t_Q t_Q := { + t_Output := t_Q; + rem (self : t_Q) (rhs : t_Q) := letb a := (into self) : both _ _ (t_QCanvas) in + letb b := (into rhs) : both _ _ (t_QCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb c := (a .% b) : both _ _ (t_Output) in + letb max := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_QCanvas) in + into d; +}. + +#[global] Instance t_Q_t_Not : t_Not t_Q := { + t_Output := t_Q; + not (self : t_Q) := letb a := (into self) : both _ _ (t_QCanvas) in + into (not a); +}. + +#[global] Instance t_Q_t_BitOr : t_BitOr t_Q t_Q := { + t_Output := t_Q; + bitor (self : t_Q) (rhs : t_Q) := letb a := (into self) : both _ _ (t_QCanvas) in + letb b := (into rhs) : both _ _ (t_QCanvas) in + into (a .| b); +}. + +#[global] Instance t_Q_t_BitXor : t_BitXor t_Q t_Q := { + t_Output := t_Q; + bitxor (self : t_Q) (rhs : t_Q) := letb a := (into self) : both _ _ (t_QCanvas) in + letb b := (into rhs) : both _ _ (t_QCanvas) in + into (a .^ b); +}. + +#[global] Instance t_Q_t_BitAnd : t_BitAnd t_Q t_Q := { + t_Output := t_Q; + bitand (self : t_Q) (rhs : t_Q) := letb a := (into self) : both _ _ (t_QCanvas) in + letb b := (into rhs) : both _ _ (t_QCanvas) in + into (a .& b); +}. + +#[global] Instance t_Q_t_Shr : t_Shr t_Q uint_size := { + t_Output := t_Q; + shr (self : t_Q) (rhs : uint_size) := letb a := (into self) : both _ _ (t_QCanvas) in + into (a shift_right rhs); +}. + +#[global] Instance t_Q_t_Shl : t_Shl t_Q uint_size := { + t_Output := t_Q; + shl (self : t_Q) (rhs : uint_size) := letb a := (into self) : both _ _ (t_QCanvas) in + into (a shift_left rhs); +}. + +Program Definition inv_under_impl_125 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1 :|: fset [x_loc]) (I1) (t_Q) := + letb base := (into self) : both _ _ (t_QCanvas) in + into (inv_under_impl_94 base max_under_impl_131). +Fail Next Obligation. + +Program Definition pow_felem_under_impl_125 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Q)) (exp : both L2 I2 (t_Q)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_Q) := + letb base := (into self) : both _ _ (t_QCanvas) in + into (pow_felem_under_impl_94 base (into exp) max_under_impl_131). +Fail Next Obligation. + +Program Definition pow_under_impl_125 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Q)) (exp : both L2 I2 (int128)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_Q) := + letb base := (into self) : both _ _ (t_QCanvas) in + into (pow_under_impl_94 base exp max_under_impl_131). +Fail Next Obligation. + +Program Definition pow2_under_impl_125 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_Q) := + into (pow2_under_impl_83 x). +Fail Next Obligation. + +Program Definition from_byte_seq_be_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Q) := + into (from_be_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + declassify_under_impl_2 x))))). +Fail Next Obligation. + +Program Definition from_public_byte_seq_be_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Q) := + into (from_be_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + x))))). +Fail Next Obligation. + +Program Definition to_byte_seq_be_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1) (I1) (t_Seq (t_U8)) := + from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_be_bytes_under_impl_131 self))) (fun x => + classify_under_impl_2 x))). +Fail Next Obligation. + +Program Definition to_public_byte_seq_be_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1) (I1) (t_Seq (int8)) := + from_vec_under_impl_52 (to_be_bytes_under_impl_131 self). +Fail Next Obligation. + +Program Definition from_byte_seq_le_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Q) := + into (from_le_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + declassify_under_impl_2 x))))). +Fail Next Obligation. + +Program Definition from_public_byte_seq_le_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Q) := + into (from_le_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + x))))). +Fail Next Obligation. + +Program Definition to_byte_seq_le_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (t_U8)) := + from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_le_bytes_under_impl_131 self))) (fun x => + classify_under_impl_2 x))). +Fail Next Obligation. + +Program Definition to_public_byte_seq_le_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (int8)) := + from_vec_under_impl_52 (to_le_bytes_under_impl_131 self). +Fail Next Obligation. + +Program Definition from_secret_literal_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_U128)) : both (L1) (I1) (t_Q) := + into (from_literal_under_impl_83 (declassify_under_impl_126 x)). +Fail Next Obligation. + +#[global] Instance t_Q_t_NumericCopy : t_NumericCopy t_Q := { +}. + +#[global] Instance t_Q_t_UnsignedInteger : t_UnsignedInteger t_Q := { +}. + +#[global] Instance t_Q_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_Q := { +}. + +#[global] Instance t_Q_t_Integer : t_Integer t_Q := { + NUM_BITS := i32(384); + ZERO := from_literal_under_impl_131 i128(0); + ONE := from_literal_under_impl_131 i128(1); + TWO := from_literal_under_impl_131 i128(2); + from_literal (val : int128) := from_literal_under_impl_131 val; + from_hex_string (s : t_String) := from_hex_under_impl_131 (deref (replace_under_impl_5 (deref s) 0x )); + get_bit (self : t_Q) (i : uint_size) := (self shift_right i) .& v_ONE; + set_bit (self : t_Q) (b : t_Q) (i : uint_size) := letb _ := (ifb true + then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) + then letb 'tt := (never_to_any (panic assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()))) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + letb tmp1 := (from_literal_under_impl_131 (not (i128(1) shift_left i))) : both _ _ (t_Q) in + letb tmp2 := (b shift_left i) : both _ _ (t_Output) in + (self .& tmp1) .| tmp2; + set (self : t_Q) (pos : uint_size) (y : t_Q) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_Q) in + set_bit self b pos; + rotate_left (self : t_Q) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + ((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); + rotate_right (self : t_Q) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in + tt + else tt) : both _ _ (unit) in + ((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); +}. + +#[global] Instance t_Q_t_ModNumeric : t_ModNumeric t_Q := { + sub_mod (self : t_Q) (rhs : t_Q) (n : t_Q) := self .- rhs; + add_mod (self : t_Q) (rhs : t_Q) (n : t_Q) := self .+ rhs; + mul_mod (self : t_Q) (rhs : t_Q) (n : t_Q) := self .* rhs; + pow_mod (self : t_Q) (exp : t_Q) (n : t_Q) := pow_felem_under_impl_125 self exp; + modulo (self : t_Q) (n : t_Q) := self .% n; + signed_modulo (self : t_Q) (n : t_Q) := modulo self n; + absolute (self : t_Q) := self; +}. + +#[global] Instance t_Q_t_Numeric : t_Numeric t_Q := { + max_val := into (max_under_impl_131 .- (from_literal_under_impl_83 i128(1))); + wrap_add (self : t_Q) (rhs : t_Q) := self .+ rhs; + wrap_sub (self : t_Q) (rhs : t_Q) := self .- rhs; + wrap_mul (self : t_Q) (rhs : t_Q) := self .* rhs; + wrap_div (self : t_Q) (rhs : t_Q) := self ./ rhs; + exp (self : t_Q) (exp : int32) := pow_under_impl_125 self (into exp); + pow_self (self : t_Q) (exp : t_Q) := pow_felem_under_impl_125 self exp; + divide (self : t_Q) (rhs : t_Q) := self ./ rhs; + inv (self : t_Q) (n : t_Q) := inv_under_impl_125 self; + equal (self : t_Q) (other : t_Q) := self =.? other; + greater_than (self : t_Q) (other : t_Q) := self >.? other; + greater_than_or_equal (self : t_Q) (other : t_Q) := self >=.? other; + less_than (self : t_Q) (other : t_Q) := self <.? other; + less_than_or_equal (self : t_Q) (other : t_Q) := self <=.? other; + not_equal_bm (self : t_Q) (other : t_Q) := ifb self <> other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + equal_bm (self : t_Q) (other : t_Q) := ifb self =.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + greater_than_bm (self : t_Q) (other : t_Q) := ifb self >.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + greater_than_or_equal_bm (self : t_Q) (other : t_Q) := ifb self >=.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + less_than_bm (self : t_Q) (other : t_Q) := ifb self <.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; + less_than_or_equal_bm (self : t_Q) (other : t_Q) := ifb self <=.? other + then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE + else v_ZERO; +}. + +Notation t_Random := (t_G). + +Notation t_Query := (t_G). + +Program Definition sample_uniform : both (fset []) ([interface ]) (t_G) := + v_ONE. +Fail Next Obligation. + +Require Import Std. (* as HashMap *) + +Require Import Std. + +Require Import Std. (* as Hash *) + +Require Import Std. (* as Hasher *) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +Program Definition random_oracle_query {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (QUERIES : both L1 I1 (t_HashMap (t_G) (t_G) (t_RandomState))) (q : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) ((t_HashMap (t_G) (t_G) (t_RandomState) × t_G)) := + match get_under_impl_2 QUERIES q with + | Option_Some r => prod_b(clone QUERIES,clone r) + | Option_None => letb r := (sample_uniform) : both _ _ (t_G) in + letb '(todo_fresh_var,QUERIES_temp) := (insert_under_impl_2 QUERIES q r) : both _ _ ((t_Option (t_G) × t_HashMap (t_G) (t_G) (t_RandomState))) in + letb QUERIES := (QUERIES_temp) : both _ _ (t_HashMap (t_G) (t_G) (t_RandomState)) in + letb _ := (todo_fresh_var) : both _ _ (t_Option (t_G)) in + prod_b(QUERIES,r) + end. +Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.Schnorr.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.Schnorr.v new file mode 100644 index 0000000..9ad6757 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.Schnorr.v @@ -0,0 +1,83 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_lib. + +Require Import Std. (* as HashMap *) + +(*Not implemented yet? todo(item)*) + +Notation t_Witness := (t_Q). + +Notation t_Statement := (t_G). + +Notation t_Message := (t_G). + +Notation t_Challenge := (t_Q). + +Notation t_Response := (t_G). + +Notation t_Transcript := ((t_G × t_G × t_Q × t_G)). + +Program Definition prod_assoc {L1 : {fset Location}} {I1 : Interface} ('(statement,message) : both L1 I1 ((t_G × t_G))) : both (L1) (I1) (t_G) := + v_ONE. +Fail Next Obligation. + +Program Definition verify {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (h : both L1 I1 (t_G)) (a : both L2 I2 (t_G)) (e : both L3 I3 (t_Q)) (z : both L4 I4 (t_G)) : both (L1:|:L2:|:L3:|:L4) (I1:|:I2:|:I3:|:I4) ('bool) := + false. +Fail Next Obligation. + +Program Definition fiat_shamir_verify {L1 : {fset Location}} {I1 : Interface} (t : both L1 I1 ((t_G × t_G × t_Q × t_G))) : both (L1) (I1) ('bool) := + letb QUERIES := (new_under_impl) : both _ _ (t_HashMap (t_G) (t_G) (t_RandomState)) in + letb '(h,a,e,z) := (t) : both _ _ ((t_G × t_G × t_Q × t_G)) in + letb '(QUERIES,eu) := (random_oracle_query QUERIES (prod_assoc prod_b(h,a))) : both _ _ ((t_HashMap (t_G) (t_G) (t_RandomState) × t_G)) in + verify h a e z. +Fail Next Obligation. + +Notation t_Relation := ((t_G × t_Q)). + +Definition commit_loc : Location := + (t_G ; 8%nat). +Program Definition v_Commit {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (h : both L1 I1 (t_G)) (w : both L2 I2 (t_Q)) : both (L1:|:L2 :|: fset [commit_loc]) (I1:|:I2) (t_G) := + letb r := (sample_uniform) : both _ _ (t_G) in + letbm commit loc(commit_loc) := (r) : both _ _ (t_G) in + v_ONE. +Fail Next Obligation. + +Program Definition v_Response {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (h : both L1 I1 (t_G)) (w : both L2 I2 (t_Q)) (a : both L3 I3 (t_G)) (e : both L4 I4 (t_Q)) : both (L1:|:L2:|:L3:|:L4) (I1:|:I2:|:I3:|:I4) (t_G) := + v_ONE. +Fail Next Obligation. + +Program Definition fiat_shamir_run {L1 : {fset Location}} {I1 : Interface} (hw : both L1 I1 ((t_G × t_Q))) : both (L1 :|: fset [commit_loc]) (I1) ((t_G × t_G × t_Q × t_G)) := + letb QUERIES := (new_under_impl) : both _ _ (t_HashMap (t_G) (t_G) (t_RandomState)) in + letb '(h,w) := (hw) : both _ _ ((t_G × t_Q)) in + letb a := (v_Commit h w) : both _ _ (t_G) in + letb 'tt := (random_oracle_init tt) : both _ _ (unit) in + letb _ := (tt) : both _ _ (unit) in + letb '(QUERIES,eu) := (random_oracle_query QUERIES (prod_assoc prod_b(h,a))) : both _ _ ((t_HashMap (t_G) (t_G) (t_RandomState) × t_G)) in + letb e := (v_ONE) : both _ _ (t_Q) in + letb z := (v_Response h w a e) : both _ _ (t_G) in + prod_b(h,a,e,z). +Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.glob b/ovn/proofs/ssprove/extraction/Hacspec_ovn.glob new file mode 100644 index 0000000..b3cc9a5 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.glob @@ -0,0 +1,1104 @@ +DIGEST 2601f3a4885d20ca193173741799192e +FExamples.Hacspec_ovn +R126:136 Crypt.choice_type <> <> lib +R138:144 Crypt.Package <> <> lib +R146:152 Crypt.Prelude <> <> lib +R162:176 Crypt.package.pkg_notation PackageNotation <> mod +R211:213 extructures.ord <> <> lib +R215:218 extructures.fset <> <> lib +R250:253 mathcomp.zify.ssrZ <> <> lib +R255:258 mathcomp.word.word <> <> lib +R288:291 Jasmin.word <> <> lib +R319:324 Coq.ZArith.ZArith <> <> lib +R334:351 Coq.Lists.List ListNotations <> mod +R449:462 Hacspec.ChoiceEquality <> <> lib +R493:507 Hacspec.LocationUtility <> <> lib +R538:559 Hacspec.Hacspec_Lib_Comparable <> <> lib +R590:604 Hacspec.Hacspec_Lib_Pre <> <> lib +R635:645 Hacspec.Hacspec_Lib <> <> lib +R682:702 mathcomp.ssreflect.choice Choice.Exports <> mod +R827:830 Examples.Core <> <> lib +R866:869 Examples.Core <> <> lib +R901:911 Examples.Hacspec_lib <> <> lib +rec 921:928 <> t_Hasher +proj 958:963 <> t_Hash +proj 983:998 <> t_Hash_t_TryFrom +proj 1026:1038 <> t_Hash_t_Into +proj 1063:1080 <> t_Hash_t_PartialEq +proj 1110:1122 <> t_Hash_t_Copy +proj 1147:1160 <> t_Hash_t_Clone +proj 1186:1199 <> t_Hash_t_Sized +proj 1225:1228 <> hash +proj 1255:1269 <> concat_and_hash +proj 1315:1323 <> hash_size +R938:948 Crypt.choice_type <> choice_type ind +binder 931:934 <> Self:1 +R967:977 Crypt.choice_type <> choice_type ind +R1003:1011 Examples.Core <> t_TryFrom class +R1014:1019 Examples.Hacspec_ovn <> t_Hash:3 meth +R1043:1048 Examples.Core <> t_Into class +R1051:1056 Examples.Hacspec_ovn <> t_Hash:3 meth +R1085:1095 Examples.Core <> t_PartialEq class +R1098:1103 Examples.Hacspec_ovn <> t_Hash:3 meth +R1127:1132 Examples.Core <> t_Copy class +R1135:1140 Examples.Hacspec_ovn <> t_Hash:3 meth +R1165:1171 Examples.Core <> t_Clone class +R1174:1179 Examples.Hacspec_ovn <> t_Hash:3 meth +R1204:1210 Examples.Core <> t_Sized class +R1213:1218 Examples.Hacspec_ovn <> t_Hash:3 meth +R1240:1243 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1232:1234 Hacspec.Hacspec_Lib_Pre <> seq def +R1236:1239 Hacspec.Hacspec_Lib_Pre <> int8 syndef +R1244:1249 Examples.Hacspec_ovn <> t_Hash:3 meth +R1279:1282 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1273:1278 Examples.Hacspec_ovn <> t_Hash:3 meth +R1300:1303 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1283:1290 Examples.Core <> t_Option def +R1293:1298 Examples.Hacspec_ovn <> t_Hash:3 meth +R1304:1309 Examples.Hacspec_ovn <> t_Hash:3 meth +R1327:1335 Hacspec.Hacspec_Lib_Pre <> uint_size def +def 1354:1371 <> t_PartialTreeLayer +binder 1374:1374 <> H:13 +R1383:1393 Crypt.choice_type <> choice_type ind +R1400:1404 Examples.Core <> t_Vec def +R1417:1420 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R1408:1416 Hacspec.Hacspec_Lib_Pre <> uint_size def +R1421:1421 Examples.Hacspec_ovn <> H:13 var +R1426:1433 Examples.Core <> t_Global constr +def 1449:1461 <> t_PartialTree +binder 1464:1464 <> T:14 +R1474:1480 Examples.Core <> t_Sized class +R1483:1483 Examples.Hacspec_ovn <> T:14 var +binder 1474:1484 <> H:15 +R1490:1497 Examples.Hacspec_ovn <> t_Hasher class +R1500:1500 Examples.Hacspec_ovn <> T:14 var +binder 1490:1501 <> H0:16 +R1506:1516 Crypt.choice_type <> choice_type ind +R1524:1528 Examples.Core <> t_Vec def +R1531:1535 Examples.Core <> t_Vec def +R1548:1551 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R1539:1547 Hacspec.Hacspec_Lib_Pre <> uint_size def +R1552:1557 Examples.Hacspec_ovn <> t_Hash meth +R1562:1569 Examples.Core <> t_Global constr +R1574:1581 Examples.Core <> t_Global constr +def 1596:1614 <> Build_t_PartialTree +R1621:1626 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R1635:1635 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R1627:1634 Crypt.package.pkg_core_definition <> Location def +binder 1617:1617 <> L:17 +R1643:1651 Crypt.package.pkg_core_definition <> Interface def +binder 1639:1639 <> I:18 +binder 1655:1655 <> T:19 +R1665:1671 Examples.Core <> t_Sized class +R1674:1674 Examples.Hacspec_ovn <> T:19 var +binder 1665:1675 <> H:20 +R1681:1688 Examples.Hacspec_ovn <> t_Hasher class +R1691:1691 Examples.Hacspec_ovn <> T:19 var +binder 1681:1692 <> H0:21 +R1707:1710 Hacspec.ChoiceEquality <> both rec +R1717:1721 Examples.Core <> t_Vec def +R1724:1728 Examples.Core <> t_Vec def +R1741:1744 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R1732:1740 Hacspec.Hacspec_Lib_Pre <> uint_size def +R1745:1750 Examples.Hacspec_ovn <> t_Hash meth +R1755:1762 Examples.Core <> t_Global constr +R1767:1774 Examples.Core <> t_Global constr +R1714:1714 Examples.Hacspec_ovn <> I:18 var +R1712:1712 Examples.Hacspec_ovn <> L:17 var +binder 1696:1703 <> f_layers:22 +R1781:1784 Hacspec.ChoiceEquality <> both rec +R1791:1803 Examples.Hacspec_ovn <> t_PartialTree def +R1813:1831 Examples.Hacspec_ovn <> Build_t_PartialTree:25 def +R1833:1840 Examples.Hacspec_ovn <> f_layers:24 var +R1913:1916 Hacspec.ChoiceEquality <> both rec +R1923:1935 Examples.Hacspec_ovn <> t_PartialTree def +R1850:1858 Hacspec.ChoiceEquality <> bind_both def +binder 1874:1881 <> f_layers:26 +R1892:1899 Hacspec.ChoiceEquality <> ret_both def +R1901:1908 Examples.Hacspec_ovn <> f_layers:26 var +def 1983:1995 <> is_left_index +R2003:2008 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R2017:2017 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R2009:2016 Crypt.package.pkg_core_definition <> Location def +binder 1998:1999 <> L1:27 +R2026:2034 Crypt.package.pkg_core_definition <> Interface def +binder 2021:2022 <> I1:28 +R2046:2049 Hacspec.ChoiceEquality <> both rec +R2058:2066 Hacspec.Hacspec_Lib_Pre <> uint_size def +R2054:2055 Examples.Hacspec_ovn <> I1:28 var +R2051:2052 Examples.Hacspec_ovn <> L1:27 var +binder 2038:2042 <> index:29 +R2072:2075 Hacspec.ChoiceEquality <> both rec +R2088:2092 Crypt.package.pkg_notation PackageNotation ::package_scope:'''bool' not +R2083:2084 Examples.Hacspec_ovn <> I1:28 var +R2078:2079 Examples.Hacspec_ovn <> L1:27 var +R2101:2101 Hacspec.Hacspec_Lib <> ::hacspec_scope:x_'=.?'_x not +R2117:2122 Hacspec.Hacspec_Lib <> ::hacspec_scope:x_'=.?'_x not +R2107:2110 Hacspec.Hacspec_Lib <> ::hacspec_scope:x_'.%'_x not +R2102:2106 Examples.Hacspec_ovn <> index:29 var +R2111:2114 Examples.Hacspec_lib <> :::'i32('_x_')' not +R2116:2116 Examples.Hacspec_lib <> :::'i32('_x_')' not +R2123:2126 Examples.Hacspec_lib <> :::'i32('_x_')' not +R2128:2128 Examples.Hacspec_lib <> :::'i32('_x_')' not +def 2152:2168 <> get_sibling_index +R2176:2181 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R2190:2190 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R2182:2189 Crypt.package.pkg_core_definition <> Location def +binder 2171:2172 <> L1:30 +R2199:2207 Crypt.package.pkg_core_definition <> Interface def +binder 2194:2195 <> I1:31 +R2219:2222 Hacspec.ChoiceEquality <> both rec +R2231:2239 Hacspec.Hacspec_Lib_Pre <> uint_size def +R2227:2228 Examples.Hacspec_ovn <> I1:31 var +R2224:2225 Examples.Hacspec_ovn <> L1:30 var +binder 2211:2215 <> index:32 +R2245:2248 Hacspec.ChoiceEquality <> both rec +R2261:2269 Hacspec.Hacspec_Lib_Pre <> uint_size def +R2256:2257 Examples.Hacspec_ovn <> I1:31 var +R2251:2252 Examples.Hacspec_ovn <> L1:30 var +R2277:2280 Hacspec.Hacspec_Lib <> :::'ifb'_x_'then'_x_'else'_x not +R2300:2307 Hacspec.Hacspec_Lib <> :::'ifb'_x_'then'_x_'else'_x not +R2323:2330 Hacspec.Hacspec_Lib <> :::'ifb'_x_'then'_x_'else'_x not +R2281:2293 Examples.Hacspec_ovn <> is_left_index def +R2295:2299 Examples.Hacspec_ovn <> index:32 var +R2313:2316 Examples.Hacspec_lib <> :::x_'.+'_x not +R2308:2312 Examples.Hacspec_ovn <> index:32 var +R2317:2320 Examples.Hacspec_lib <> :::'i32('_x_')' not +R2322:2322 Examples.Hacspec_lib <> :::'i32('_x_')' not +R2336:2339 Examples.Hacspec_lib <> :::x_'.-'_x not +R2331:2335 Examples.Hacspec_ovn <> index:32 var +R2340:2343 Examples.Hacspec_lib <> :::'i32('_x_')' not +R2345:2345 Examples.Hacspec_lib <> :::'i32('_x_')' not +R2401:2409 Hacspec.ChoiceEquality <> lift_both def +not 2380:2380 <> :::'solve_lift'_x +R2560:2567 Hacspec.ChoiceEquality <> let_both def +binder 2640:2640 <> x:33 +not 2529:2529 <> :::'letb'_x_':='_x_'in'_x +R2813:2820 Hacspec.ChoiceEquality <> let_both def +binder 2894:2894 <> x:34 +not 2778:2778 <> :::'letb'_''''_x_':='_x_'in'_x +def 3094:3103 <> height_loc +R3107:3114 Crypt.package.pkg_core_definition <> Location def +R3121:3121 Crypt.Prelude <> :::'('_x_';'_x_')' not +R3127:3129 Crypt.Prelude <> :::'('_x_';'_x_')' not +R3135:3135 Crypt.Prelude <> :::'('_x_';'_x_')' not +R3122:3126 Hacspec.Hacspec_Lib_Pre <> int32 syndef +def 3157:3166 <> tree_depth +R3174:3179 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R3188:3188 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R3180:3187 Crypt.package.pkg_core_definition <> Location def +binder 3169:3170 <> L1:35 +R3197:3205 Crypt.package.pkg_core_definition <> Interface def +binder 3192:3193 <> I1:36 +R3224:3227 Hacspec.ChoiceEquality <> both rec +R3236:3244 Hacspec.Hacspec_Lib_Pre <> uint_size def +R3232:3233 Examples.Hacspec_ovn <> I1:36 var +R3229:3230 Examples.Hacspec_ovn <> L1:35 var +binder 3209:3220 <> leaves_count:37 +R3250:3253 Hacspec.ChoiceEquality <> both rec +R3288:3296 Hacspec.Hacspec_Lib_Pre <> uint_size def +R3283:3284 Examples.Hacspec_ovn <> I1:36 var +R3258:3262 extructures.fset <> ::fset_scope:x_':|:'_x not +R3256:3257 Examples.Hacspec_ovn <> L1:35 var +R3263:3266 extructures.fset <> fset def +R3268:3268 Coq.Lists.List ListNotations ::list_scope:'['_x_']' not +R3279:3279 Coq.Lists.List ListNotations ::list_scope:'['_x_']' not +R3269:3278 Examples.Hacspec_ovn <> height_loc def +R3304:3309 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R3316:3320 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R3331:3335 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R3363:3368 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R3321:3330 Examples.Hacspec_ovn <> height_loc def +R3347:3350 Hacspec.ChoiceEquality <> both rec +R3357:3361 Hacspec.Hacspec_Lib_Pre <> int32 syndef +R3337:3340 Examples.Hacspec_lib <> :::'i32('_x_')' not +R3342:3342 Examples.Hacspec_lib <> :::'i32('_x_')' not +binder 3310:3315 <> height:38 +binder 3310:3315 <> height:39 +R3369:3373 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R3380:3383 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R3411:3652 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R3395:3398 Hacspec.ChoiceEquality <> both rec +R3405:3409 Hacspec.Hacspec_Lib_Pre <> int32 syndef +R3385:3388 Examples.Hacspec_lib <> :::'i32('_x_')' not +R3390:3390 Examples.Hacspec_lib <> :::'i32('_x_')' not +binder 3374:3379 <> height:40 +binder 3374:3379 <> height:41 +R3653:3664 Examples.Hacspec_ovn <> :::'solve_lift'_x not +R3680:3680 Examples.Hacspec_ovn <> :::'solve_lift'_x not +R3665:3672 Hacspec.Hacspec_Lib <> cast_int def +R3674:3679 Examples.Hacspec_ovn <> height:40 var +def 3725:3736 <> parent_index +R3744:3749 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R3758:3758 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R3750:3757 Crypt.package.pkg_core_definition <> Location def +binder 3739:3740 <> L1:42 +R3767:3775 Crypt.package.pkg_core_definition <> Interface def +binder 3762:3763 <> I1:43 +R3787:3790 Hacspec.ChoiceEquality <> both rec +R3799:3807 Hacspec.Hacspec_Lib_Pre <> uint_size def +R3795:3796 Examples.Hacspec_ovn <> I1:43 var +R3792:3793 Examples.Hacspec_ovn <> L1:42 var +binder 3779:3783 <> index:44 +R3813:3816 Hacspec.ChoiceEquality <> both rec +R3829:3837 Hacspec.Hacspec_Lib_Pre <> uint_size def +R3824:3825 Examples.Hacspec_ovn <> I1:43 var +R3819:3820 Examples.Hacspec_ovn <> L1:42 var +R3845:3848 Hacspec.Hacspec_Lib <> :::'ifb'_x_'then'_x_'else'_x not +R3868:3875 Hacspec.Hacspec_Lib <> :::'ifb'_x_'then'_x_'else'_x not +R3891:3898 Hacspec.Hacspec_Lib <> :::'ifb'_x_'then'_x_'else'_x not +R3849:3861 Examples.Hacspec_ovn <> is_left_index def +R3863:3867 Examples.Hacspec_ovn <> index:44 var +R3881:3884 Hacspec.Hacspec_Lib <> ::hacspec_scope:x_'./'_x not +R3876:3880 Examples.Hacspec_ovn <> index:44 var +R3885:3888 Examples.Hacspec_lib <> :::'i32('_x_')' not +R3890:3890 Examples.Hacspec_lib <> :::'i32('_x_')' not +R3899:3899 Hacspec.Hacspec_Lib <> ::hacspec_scope:x_'./'_x not +R3923:3927 Hacspec.Hacspec_Lib <> ::hacspec_scope:x_'./'_x not +R3900:3916 Examples.Hacspec_ovn <> get_sibling_index def +R3918:3922 Examples.Hacspec_ovn <> index:44 var +R3928:3931 Examples.Hacspec_lib <> :::'i32('_x_')' not +R3933:3933 Examples.Hacspec_lib <> :::'i32('_x_')' not +def 3970:3980 <> parents_loc +R3984:3991 Crypt.package.pkg_core_definition <> Location def +R3998:3998 Crypt.Prelude <> :::'('_x_';'_x_')' not +R4027:4029 Crypt.Prelude <> :::'('_x_';'_x_')' not +R4035:4035 Crypt.Prelude <> :::'('_x_';'_x_')' not +R3999:4003 Examples.Core <> t_Vec def +R4006:4014 Hacspec.Hacspec_Lib_Pre <> uint_size def +R4018:4025 Examples.Core <> t_Global constr +def 4057:4070 <> parent_indices +R4078:4083 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R4092:4092 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R4084:4091 Crypt.package.pkg_core_definition <> Location def +binder 4073:4074 <> L1:45 +R4101:4109 Crypt.package.pkg_core_definition <> Interface def +binder 4096:4097 <> I1:46 +R4123:4126 Hacspec.ChoiceEquality <> both rec +R4135:4137 Hacspec.Hacspec_Lib_Pre <> seq def +R4139:4147 Hacspec.Hacspec_Lib_Pre <> uint_size def +R4131:4132 Examples.Hacspec_ovn <> I1:46 var +R4128:4129 Examples.Hacspec_ovn <> L1:45 var +binder 4113:4119 <> indices:47 +R4153:4156 Hacspec.ChoiceEquality <> both rec +R4192:4196 Examples.Core <> t_Vec def +R4199:4207 Hacspec.Hacspec_Lib_Pre <> uint_size def +R4211:4218 Examples.Core <> t_Global constr +R4187:4188 Examples.Hacspec_ovn <> I1:46 var +R4161:4165 extructures.fset <> ::fset_scope:x_':|:'_x not +R4159:4160 Examples.Hacspec_ovn <> L1:45 var +R4166:4169 extructures.fset <> fset def +R4171:4171 Coq.Lists.List ListNotations ::list_scope:'['_x_']' not +R4183:4183 Coq.Lists.List ListNotations ::list_scope:'['_x_']' not +R4172:4182 Examples.Hacspec_ovn <> parents_loc def +R4227:4232 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R4240:4244 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R4256:4260 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R4355:4360 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R4245:4255 Examples.Hacspec_ovn <> parents_loc def +R4316:4319 Hacspec.ChoiceEquality <> both rec +R4326:4330 Examples.Core <> t_Vec def +R4333:4341 Hacspec.Hacspec_Lib_Pre <> uint_size def +R4345:4352 Examples.Core <> t_Global constr +R4262:4268 Examples.Core <> collect def +R4271:4273 Examples.Core <> map def +R4299:4310 Examples.Hacspec_ovn <> parent_index def +R4276:4281 Examples.Core <> cloned def +R4284:4287 Examples.Core <> iter def +R4289:4295 Examples.Hacspec_ovn <> indices:47 var +binder 4233:4239 <> parents:48 +binder 4233:4239 <> parents:49 +R4361:4366 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R4374:4378 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R4390:4394 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R4452:4457 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R4379:4389 Examples.Hacspec_ovn <> parents_loc def +R4413:4416 Hacspec.ChoiceEquality <> both rec +R4423:4427 Examples.Core <> t_Vec def +R4430:4438 Hacspec.Hacspec_Lib_Pre <> uint_size def +R4442:4449 Examples.Core <> t_Global constr +R4396:4400 Examples.Core <> dedup def +R4402:4408 Examples.Hacspec_ovn <> parents:48 var +binder 4367:4373 <> parents:50 +binder 4367:4373 <> parents:51 +R4458:4464 Examples.Hacspec_ovn <> parents:50 var +def 4501:4513 <> t_t_ErrorKind +R4517:4527 Crypt.choice_type <> choice_type ind +R4534:4538 Crypt.choice_type <> chFin constr +R4541:4545 Crypt.Prelude <> mkpos constr +def 4562:4601 <> ErrorKind_SerializedProofSizeIsIncorrect +R4608:4613 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R4622:4622 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R4614:4621 Crypt.package.pkg_core_definition <> Location def +binder 4604:4604 <> L:52 +R4630:4638 Crypt.package.pkg_core_definition <> Interface def +binder 4626:4626 <> I:53 +R4643:4646 Hacspec.ChoiceEquality <> both rec +R4652:4662 Examples.Core <> t_ErrorKind def +R4650:4650 Examples.Hacspec_ovn <> I:53 var +R4648:4648 Examples.Hacspec_ovn <> L:52 var +R4669:4676 Hacspec.ChoiceEquality <> ret_both def +R4719:4729 Examples.Core <> t_ErrorKind def +R4679:4693 mathcomp.ssreflect.fintype <> Ordinal constr +R4709:4715 Coq.Init.Logic <> eq_refl constr +def 4744:4773 <> ErrorKind_NotEnoughHelperNodes +R4780:4785 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R4794:4794 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R4786:4793 Crypt.package.pkg_core_definition <> Location def +binder 4776:4776 <> L:54 +R4802:4810 Crypt.package.pkg_core_definition <> Interface def +binder 4798:4798 <> I:55 +R4815:4818 Hacspec.ChoiceEquality <> both rec +R4824:4834 Examples.Core <> t_ErrorKind def +R4822:4822 Examples.Hacspec_ovn <> I:55 var +R4820:4820 Examples.Hacspec_ovn <> L:54 var +R4841:4848 Hacspec.ChoiceEquality <> ret_both def +R4891:4901 Examples.Core <> t_ErrorKind def +R4851:4865 mathcomp.ssreflect.fintype <> Ordinal constr +R4881:4887 Coq.Init.Logic <> eq_refl constr +def 4916:4944 <> ErrorKind_HashConversionError +R4951:4956 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R4965:4965 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R4957:4964 Crypt.package.pkg_core_definition <> Location def +binder 4947:4947 <> L:56 +R4973:4981 Crypt.package.pkg_core_definition <> Interface def +binder 4969:4969 <> I:57 +R4986:4989 Hacspec.ChoiceEquality <> both rec +R4995:5005 Examples.Core <> t_ErrorKind def +R4993:4993 Examples.Hacspec_ovn <> I:57 var +R4991:4991 Examples.Hacspec_ovn <> L:56 var +R5012:5019 Hacspec.ChoiceEquality <> ret_both def +R5062:5072 Examples.Core <> t_ErrorKind def +R5022:5036 mathcomp.ssreflect.fintype <> Ordinal constr +R5052:5058 Coq.Init.Logic <> eq_refl constr +def 5087:5126 <> ErrorKind_NotEnoughHashesToCalculateRoot +R5133:5138 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R5147:5147 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R5139:5146 Crypt.package.pkg_core_definition <> Location def +binder 5129:5129 <> L:58 +R5155:5163 Crypt.package.pkg_core_definition <> Interface def +binder 5151:5151 <> I:59 +R5168:5171 Hacspec.ChoiceEquality <> both rec +R5177:5187 Examples.Core <> t_ErrorKind def +R5175:5175 Examples.Hacspec_ovn <> I:59 var +R5173:5173 Examples.Hacspec_ovn <> L:58 var +R5194:5201 Hacspec.ChoiceEquality <> ret_both def +R5244:5254 Examples.Core <> t_ErrorKind def +R5204:5218 mathcomp.ssreflect.fintype <> Ordinal constr +R5234:5240 Coq.Init.Logic <> eq_refl constr +def 5269:5304 <> ErrorKind_LeavesIndicesCountMismatch +R5311:5316 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R5325:5325 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R5317:5324 Crypt.package.pkg_core_definition <> Location def +binder 5307:5307 <> L:60 +R5333:5341 Crypt.package.pkg_core_definition <> Interface def +binder 5329:5329 <> I:61 +R5346:5349 Hacspec.ChoiceEquality <> both rec +R5355:5365 Examples.Core <> t_ErrorKind def +R5353:5353 Examples.Hacspec_ovn <> I:61 var +R5351:5351 Examples.Hacspec_ovn <> L:60 var +R5372:5379 Hacspec.ChoiceEquality <> ret_both def +R5422:5432 Examples.Core <> t_ErrorKind def +R5382:5396 mathcomp.ssreflect.fintype <> Ordinal constr +R5412:5418 Coq.Init.Logic <> eq_refl constr +def 5448:5454 <> t_Error +R5458:5468 Crypt.choice_type <> choice_type ind +R5476:5486 Examples.Core <> t_ErrorKind def +def 5500:5512 <> Build_t_Error +R5519:5524 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R5533:5533 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R5525:5532 Crypt.package.pkg_core_definition <> Location def +binder 5515:5515 <> L:62 +R5541:5549 Crypt.package.pkg_core_definition <> Interface def +binder 5537:5537 <> I:63 +R5562:5565 Hacspec.ChoiceEquality <> both rec +R5572:5582 Examples.Core <> t_ErrorKind def +R5569:5569 Examples.Hacspec_ovn <> I:63 var +R5567:5567 Examples.Hacspec_ovn <> L:62 var +binder 5553:5558 <> f_kind:64 +R5588:5591 Hacspec.ChoiceEquality <> both rec +R5598:5604 Examples.Hacspec_ovn <> t_Error def +R5612:5624 Examples.Hacspec_ovn <> Build_t_Error:67 def +R5626:5631 Examples.Hacspec_ovn <> f_kind:66 var +R5698:5701 Hacspec.ChoiceEquality <> both rec +R5708:5714 Examples.Hacspec_ovn <> t_Error def +R5641:5649 Hacspec.ChoiceEquality <> bind_both def +binder 5663:5668 <> f_kind:68 +R5679:5686 Hacspec.ChoiceEquality <> ret_both def +R5688:5693 Examples.Hacspec_ovn <> f_kind:68 var +def 5760:5773 <> new_under_impl +R5781:5786 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R5795:5795 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R5787:5794 Crypt.package.pkg_core_definition <> Location def +binder 5776:5777 <> L1:69 +R5804:5812 Crypt.package.pkg_core_definition <> Interface def +binder 5799:5800 <> I1:70 +R5823:5826 Hacspec.ChoiceEquality <> both rec +R5835:5845 Examples.Core <> t_ErrorKind def +R5831:5832 Examples.Hacspec_ovn <> I1:70 var +R5828:5829 Examples.Hacspec_ovn <> L1:69 var +binder 5816:5819 <> kind:71 +R5851:5854 Hacspec.ChoiceEquality <> both rec +R5867:5873 Examples.Hacspec_ovn <> t_Error def +R5862:5863 Examples.Hacspec_ovn <> I1:70 var +R5857:5858 Examples.Hacspec_ovn <> L1:69 var +R5881:5893 Examples.Hacspec_ovn <> Build_t_Error def +R5895:5898 Examples.Hacspec_ovn <> kind:71 var +def 5943:5976 <> not_enough_helper_nodes_under_impl +R5980:5983 Hacspec.ChoiceEquality <> both rec +R6011:6017 Examples.Hacspec_ovn <> t_Error def +R5996:6007 Crypt.package.pkg_notation PackageNotation ::package_scope:'['_'interface'_']' not +R5986:5989 extructures.fset <> fset def +R5991:5992 Coq.Lists.List ListNotations ::list_scope:'['_']' not +R6025:6038 Examples.Hacspec_ovn <> new_under_impl def +R6040:6069 Examples.Hacspec_ovn <> ErrorKind_NotEnoughHelperNodes def +def 6114:6129 <> new_under_impl_1 +binder 6132:6132 <> T:72 +R6142:6148 Examples.Core <> t_Sized class +R6151:6151 Examples.Hacspec_ovn <> T:72 var +binder 6142:6152 <> H:73 +R6158:6165 Examples.Hacspec_ovn <> t_Hasher class +R6168:6168 Examples.Hacspec_ovn <> T:72 var +binder 6158:6169 <> H0:74 +R6174:6177 Hacspec.ChoiceEquality <> both rec +R6205:6217 Examples.Hacspec_ovn <> t_PartialTree def +R6220:6220 Examples.Hacspec_ovn <> T:72 var +R6190:6201 Crypt.package.pkg_notation PackageNotation ::package_scope:'['_'interface'_']' not +R6180:6183 extructures.fset <> fset def +R6185:6186 Coq.Lists.List ListNotations ::list_scope:'['_']' not +R6229:6247 Examples.Hacspec_ovn <> Build_t_PartialTree def +R6249:6256 Examples.Core <> new def +def 6293:6311 <> reversed_layers_loc +binder 6314:6314 <> T:75 +R6324:6330 Examples.Core <> t_Sized class +R6333:6333 Examples.Hacspec_ovn <> T:75 var +binder 6324:6334 <> H:76 +R6340:6347 Examples.Hacspec_ovn <> t_Hasher class +R6350:6350 Examples.Hacspec_ovn <> T:75 var +binder 6340:6351 <> H0:77 +R6356:6363 Crypt.package.pkg_core_definition <> Location def +R6370:6370 Crypt.Prelude <> :::'('_x_';'_x_')' not +R6430:6432 Crypt.Prelude <> :::'('_x_';'_x_')' not +R6438:6438 Crypt.Prelude <> :::'('_x_';'_x_')' not +R6371:6375 Examples.Core <> t_Vec def +R6378:6382 Examples.Core <> t_Vec def +R6395:6398 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R6386:6394 Hacspec.Hacspec_Lib_Pre <> uint_size def +R6399:6404 Examples.Hacspec_ovn <> t_Hash meth +R6409:6416 Examples.Core <> t_Global constr +R6421:6428 Examples.Core <> t_Global constr +def 6452:6467 <> partial_tree_loc +binder 6470:6470 <> T:78 +R6480:6486 Examples.Core <> t_Sized class +R6489:6489 Examples.Hacspec_ovn <> T:78 var +binder 6480:6490 <> H:79 +R6496:6503 Examples.Hacspec_ovn <> t_Hasher class +R6506:6506 Examples.Hacspec_ovn <> T:78 var +binder 6496:6507 <> H0:80 +R6512:6519 Crypt.package.pkg_core_definition <> Location def +R6526:6526 Crypt.Prelude <> :::'('_x_';'_x_')' not +R6586:6588 Crypt.Prelude <> :::'('_x_';'_x_')' not +R6594:6594 Crypt.Prelude <> :::'('_x_';'_x_')' not +R6527:6531 Examples.Core <> t_Vec def +R6534:6538 Examples.Core <> t_Vec def +R6551:6554 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R6542:6550 Hacspec.Hacspec_Lib_Pre <> uint_size def +R6555:6560 Examples.Hacspec_ovn <> t_Hash meth +R6565:6572 Examples.Core <> t_Global constr +R6577:6584 Examples.Core <> t_Global constr +def 6608:6616 <> nodes_loc +binder 6619:6619 <> T:81 +R6629:6635 Examples.Core <> t_Sized class +R6638:6638 Examples.Hacspec_ovn <> T:81 var +binder 6629:6639 <> H:82 +R6645:6652 Examples.Hacspec_ovn <> t_Hasher class +R6655:6655 Examples.Hacspec_ovn <> T:81 var +binder 6645:6656 <> H0:83 +R6661:6668 Crypt.package.pkg_core_definition <> Location def +R6675:6675 Crypt.Prelude <> :::'('_x_';'_x_')' not +R6716:6718 Crypt.Prelude <> :::'('_x_';'_x_')' not +R6724:6724 Crypt.Prelude <> :::'('_x_';'_x_')' not +R6676:6680 Examples.Core <> t_Vec def +R6693:6696 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R6684:6692 Hacspec.Hacspec_Lib_Pre <> uint_size def +R6697:6702 Examples.Hacspec_ovn <> t_Hash meth +R6707:6714 Examples.Core <> t_Global constr +def 6738:6754 <> current_layer_loc +binder 6757:6757 <> T:84 +R6767:6773 Examples.Core <> t_Sized class +R6776:6776 Examples.Hacspec_ovn <> T:84 var +binder 6767:6777 <> H:85 +R6783:6790 Examples.Hacspec_ovn <> t_Hasher class +R6793:6793 Examples.Hacspec_ovn <> T:84 var +binder 6783:6794 <> H0:86 +R6799:6806 Crypt.package.pkg_core_definition <> Location def +R6813:6813 Crypt.Prelude <> :::'('_x_';'_x_')' not +R6854:6856 Crypt.Prelude <> :::'('_x_';'_x_')' not +R6862:6862 Crypt.Prelude <> :::'('_x_';'_x_')' not +R6814:6818 Examples.Core <> t_Vec def +R6831:6834 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R6822:6830 Hacspec.Hacspec_Lib_Pre <> uint_size def +R6835:6840 Examples.Hacspec_ovn <> t_Hash meth +R6845:6852 Examples.Core <> t_Global constr +def 6885:6907 <> build_tree_under_impl_1 +binder 6910:6910 <> T:87 +R6920:6926 Examples.Core <> t_Sized class +R6929:6929 Examples.Hacspec_ovn <> T:87 var +binder 6920:6930 <> H:88 +R6936:6943 Examples.Hacspec_ovn <> t_Hasher class +R6946:6946 Examples.Hacspec_ovn <> T:87 var +binder 6936:6947 <> H0:89 +R6956:6961 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R6970:6970 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R6962:6969 Crypt.package.pkg_core_definition <> Location def +binder 6951:6952 <> L1:90 +R6979:6984 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R6993:6993 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R6985:6992 Crypt.package.pkg_core_definition <> Location def +binder 6974:6975 <> L2:91 +R7002:7010 Crypt.package.pkg_core_definition <> Interface def +binder 6997:6998 <> I1:92 +R7019:7027 Crypt.package.pkg_core_definition <> Interface def +binder 7014:7015 <> I2:93 +R7048:7051 Hacspec.ChoiceEquality <> both rec +R7060:7064 Examples.Core <> t_Vec def +R7067:7071 Examples.Core <> t_Vec def +R7084:7087 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R7075:7083 Hacspec.Hacspec_Lib_Pre <> uint_size def +R7088:7093 Examples.Hacspec_ovn <> t_Hash meth +R7098:7105 Examples.Core <> t_Global constr +R7110:7117 Examples.Core <> t_Global constr +R7056:7057 Examples.Hacspec_ovn <> I1:92 var +R7053:7054 Examples.Hacspec_ovn <> L1:90 var +binder 7031:7044 <> partial_layers:94 +R7141:7144 Hacspec.ChoiceEquality <> both rec +R7153:7161 Hacspec.Hacspec_Lib_Pre <> uint_size def +R7149:7150 Examples.Hacspec_ovn <> I2:93 var +R7146:7147 Examples.Hacspec_ovn <> L2:91 var +binder 7123:7137 <> full_tree_depth:95 +R7167:7170 Hacspec.ChoiceEquality <> both rec +R7274:7281 Examples.Core <> t_Result def +R7284:7288 Examples.Core <> t_Vec def +R7291:7295 Examples.Core <> t_Vec def +R7308:7311 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R7299:7307 Hacspec.Hacspec_Lib_Pre <> uint_size def +R7312:7317 Examples.Hacspec_ovn <> t_Hash meth +R7322:7329 Examples.Core <> t_Global constr +R7334:7341 Examples.Core <> t_Global constr +R7346:7352 Examples.Hacspec_ovn <> t_Error def +R7266:7268 extructures.fset <> ::fset_scope:x_':|:'_x not +R7264:7265 Examples.Hacspec_ovn <> I1:92 var +R7269:7270 Examples.Hacspec_ovn <> I2:93 var +R7180:7184 extructures.fset <> ::fset_scope:x_':|:'_x not +R7175:7177 extructures.fset <> ::fset_scope:x_':|:'_x not +R7173:7174 Examples.Hacspec_ovn <> L1:90 var +R7178:7179 Examples.Hacspec_ovn <> L2:91 var +R7185:7188 extructures.fset <> fset def +R7190:7190 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not +R7208:7209 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not +R7226:7227 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not +R7247:7248 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not +R7260:7260 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not +R7191:7207 Examples.Hacspec_ovn <> current_layer_loc def +R7210:7225 Examples.Hacspec_ovn <> partial_tree_loc def +R7228:7246 Examples.Hacspec_ovn <> reversed_layers_loc def +R7249:7259 Examples.Hacspec_ovn <> parents_loc def +R7429:7434 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R7447:7451 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R7468:7472 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R7556:7561 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R7452:7467 Examples.Hacspec_ovn <> partial_tree_loc def +R7486:7489 Hacspec.ChoiceEquality <> both rec +R7496:7500 Examples.Core <> t_Vec def +R7503:7507 Examples.Core <> t_Vec def +R7520:7523 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R7511:7519 Hacspec.Hacspec_Lib_Pre <> uint_size def +R7524:7529 Examples.Hacspec_ovn <> t_Hash meth +R7534:7541 Examples.Core <> t_Global constr +R7546:7553 Examples.Core <> t_Global constr +R7474:7481 Examples.Core <> new def +binder 7435:7446 <> partial_tree:96 +binder 7435:7446 <> partial_tree:97 +R7562:7567 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R7581:7585 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R7603:7607 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R7672:7677 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R7586:7602 Examples.Hacspec_ovn <> current_layer_loc def +R7621:7624 Hacspec.ChoiceEquality <> both rec +R7631:7635 Examples.Core <> t_Vec def +R7648:7651 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R7639:7647 Hacspec.Hacspec_Lib_Pre <> uint_size def +R7652:7657 Examples.Hacspec_ovn <> t_Hash meth +R7662:7669 Examples.Core <> t_Global constr +R7609:7616 Examples.Core <> new def +binder 7568:7580 <> current_layer:98 +binder 7568:7580 <> current_layer:99 +R7678:7684 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R7699:7699 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R7719:7723 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R7896:7901 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R7759:7762 Hacspec.ChoiceEquality <> both rec +R7831:7834 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R7770:7776 Examples.Core <> t_Drain def +R7779:7783 Examples.Core <> t_Vec def +R7796:7799 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R7787:7795 Hacspec.Hacspec_Lib_Pre <> uint_size def +R7800:7805 Examples.Hacspec_ovn <> t_Hash meth +R7810:7817 Examples.Core <> t_Global constr +R7822:7829 Examples.Core <> t_Global constr +R7835:7839 Examples.Core <> t_Vec def +R7842:7846 Examples.Core <> t_Vec def +R7859:7862 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R7850:7858 Hacspec.Hacspec_Lib_Pre <> uint_size def +R7863:7868 Examples.Hacspec_ovn <> t_Hash meth +R7873:7880 Examples.Core <> t_Global constr +R7885:7892 Examples.Core <> t_Global constr +R7725:7729 Examples.Core <> drain def +R7746:7754 Examples.Core <> RangeFull constr +R7731:7744 Examples.Hacspec_ovn <> partial_layers:94 var +binder 7685:7698 <> todo_fresh_var:100 +binder 7700:7718 <> partial_layers_temp:101 +R7902:7906 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R7921:7924 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R8019:8024 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R7949:7952 Hacspec.ChoiceEquality <> both rec +R7959:7963 Examples.Core <> t_Vec def +R7966:7970 Examples.Core <> t_Vec def +R7983:7986 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R7974:7982 Hacspec.Hacspec_Lib_Pre <> uint_size def +R7987:7992 Examples.Hacspec_ovn <> t_Hash meth +R7997:8004 Examples.Core <> t_Global constr +R8009:8016 Examples.Core <> t_Global constr +R7926:7944 Examples.Hacspec_ovn <> partial_layers_temp:101 var +binder 7907:7920 <> partial_layers:102 +binder 7907:7920 <> partial_layers:103 +R8025:8029 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R8036:8039 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R8131:8136 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R8059:8062 Hacspec.ChoiceEquality <> both rec +R8069:8075 Examples.Core <> t_Drain def +R8078:8082 Examples.Core <> t_Vec def +R8095:8098 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R8086:8094 Hacspec.Hacspec_Lib_Pre <> uint_size def +R8099:8104 Examples.Hacspec_ovn <> t_Hash meth +R8109:8116 Examples.Core <> t_Global constr +R8121:8128 Examples.Core <> t_Global constr +R8041:8054 Examples.Hacspec_ovn <> todo_fresh_var:100 var +binder 8030:8035 <> hoist1:104 +binder 8030:8035 <> hoist1:105 +R8137:8141 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R8148:8151 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R8247:8252 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R8167:8170 Hacspec.ChoiceEquality <> both rec +R8177:8181 Examples.Core <> t_Rev syndef +R8184:8190 Examples.Core <> t_Drain def +R8193:8197 Examples.Core <> t_Vec def +R8210:8213 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R8201:8209 Hacspec.Hacspec_Lib_Pre <> uint_size def +R8214:8219 Examples.Hacspec_ovn <> t_Hash meth +R8224:8231 Examples.Core <> t_Global constr +R8236:8243 Examples.Core <> t_Global constr +R8153:8155 Examples.Core <> rev def +R8157:8162 Examples.Hacspec_ovn <> hoist1:104 var +binder 8142:8147 <> hoist2:106 +binder 8142:8147 <> hoist2:107 +R8253:8258 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R8274:8278 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R8298:8302 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R8392:8397 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not +R8279:8297 Examples.Hacspec_ovn <> reversed_layers_loc def +R8322:8325 Hacspec.ChoiceEquality <> both rec +R8332:8336 Examples.Core <> t_Vec def +R8339:8343 Examples.Core <> t_Vec def +R8356:8359 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R8347:8355 Hacspec.Hacspec_Lib_Pre <> uint_size def +R8360:8365 Examples.Hacspec_ovn <> t_Hash meth +R8370:8377 Examples.Core <> t_Global constr +R8382:8389 Examples.Core <> t_Global constr +R8304:8310 Examples.Core <> collect def +R8312:8317 Examples.Hacspec_ovn <> hoist2:106 var +binder 8259:8273 <> reversed_layers:108 +binder 8259:8273 <> reversed_layers:109 +R8398:8404 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_','_x_')'_':='_x_'in'_x not +R8418:8418 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_','_x_')'_':='_x_'in'_x not +R8431:8431 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_','_x_')'_':='_x_'in'_x not +R8447:8451 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_','_x_')'_':='_x_'in'_x not +R11635:11640 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_','_x_')'_':='_x_'in'_x not +R11456:11459 Hacspec.ChoiceEquality <> both rec +R11570:11573 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R11507:11510 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R11467:11471 Examples.Core <> t_Vec def +R11484:11487 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R11475:11483 Hacspec.Hacspec_Lib_Pre <> uint_size def +R11488:11493 Examples.Hacspec_ovn <> t_Hash meth +R11498:11505 Examples.Core <> t_Global constr +R11511:11515 Examples.Core <> t_Vec def +R11518:11522 Examples.Core <> t_Vec def +R11535:11538 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R11526:11534 Hacspec.Hacspec_Lib_Pre <> uint_size def +R11539:11544 Examples.Hacspec_ovn <> t_Hash meth +R11549:11556 Examples.Core <> t_Global constr +R11561:11568 Examples.Core <> t_Global constr +R11574:11578 Examples.Core <> t_Vec def +R11581:11585 Examples.Core <> t_Vec def +R11598:11601 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R11589:11597 Hacspec.Hacspec_Lib_Pre <> uint_size def +R11602:11607 Examples.Hacspec_ovn <> t_Hash meth +R11612:11619 Examples.Core <> t_Global constr +R11624:11631 Examples.Core <> t_Global constr +R8453:8462 Hacspec.Hacspec_Lib <> foldi_both def +R11402:11408 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b('_x_','_x_','_'..'_','_x_')' not +R11422:11422 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b('_x_','_x_','_'..'_','_x_')' not +R11435:11435 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b('_x_','_x_','_'..'_','_x_')' not +R11451:11451 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b('_x_','_x_','_'..'_','_x_')' not +R11409:11421 Examples.Hacspec_ovn <> current_layer:98 var +R11423:11434 Examples.Hacspec_ovn <> partial_tree:96 var +R11436:11450 Examples.Hacspec_ovn <> reversed_layers:108 var +binder 8520:8520 <> L:110 +binder 8522:8522 <> I:111 +R8547:8557 Hacspec.Hacspec_Lib <> :::'ssp'_'('_'fun'_''''_'('_x_','_x_','_x_')'_'=>'_x_')' not +R8571:8571 Hacspec.Hacspec_Lib <> :::'ssp'_'('_'fun'_''''_'('_x_','_x_','_x_')'_'=>'_x_')' not +R8584:8584 Hacspec.Hacspec_Lib <> :::'ssp'_'('_'fun'_''''_'('_x_','_x_','_x_')'_'=>'_x_')' not +R8600:8612 Hacspec.Hacspec_Lib <> :::'ssp'_'('_'fun'_''''_'('_x_','_x_','_x_')'_'=>'_x_')' not +R11397:11397 Hacspec.Hacspec_Lib <> :::'ssp'_'('_'fun'_''''_'('_x_','_x_','_x_')'_'=>'_x_')' not +binder 8558:8570 <> current_layer:112 +binder 8572:8583 <> partial_tree:113 +binder 8585:8599 <> reversed_layers:114 +R8613:8619 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R8634:8634 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R8655:8659 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R8811:8822 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R8684:8687 Hacspec.ChoiceEquality <> both rec +R8746:8749 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R8695:8702 Examples.Core <> t_Option def +R8705:8709 Examples.Core <> t_Vec def +R8722:8725 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R8713:8721 Hacspec.Hacspec_Lib_Pre <> uint_size def +R8726:8731 Examples.Hacspec_ovn <> t_Hash meth +R8736:8743 Examples.Core <> t_Global constr +R8750:8754 Examples.Core <> t_Vec def +R8757:8761 Examples.Core <> t_Vec def +R8774:8777 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R8765:8773 Hacspec.Hacspec_Lib_Pre <> uint_size def +R8778:8783 Examples.Hacspec_ovn <> t_Hash meth +R8788:8795 Examples.Core <> t_Global constr +R8800:8807 Examples.Core <> t_Global constr +R8661:8663 Examples.Core <> pop def +R8665:8679 Examples.Hacspec_ovn <> reversed_layers:114 var +binder 8620:8633 <> todo_fresh_var:115 +binder 8635:8654 <> reversed_layers_temp:116 +R8823:8827 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R8843:8846 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R8942:8953 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R8872:8875 Hacspec.ChoiceEquality <> both rec +R8882:8886 Examples.Core <> t_Vec def +R8889:8893 Examples.Core <> t_Vec def +R8906:8909 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R8897:8905 Hacspec.Hacspec_Lib_Pre <> uint_size def +R8910:8915 Examples.Hacspec_ovn <> t_Hash meth +R8920:8927 Examples.Core <> t_Global constr +R8932:8939 Examples.Core <> t_Global constr +R8848:8867 Examples.Hacspec_ovn <> reversed_layers_temp:116 var +binder 8828:8842 <> reversed_layers:117 +binder 8828:8842 <> reversed_layers:118 +R8954:8958 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R8965:8968 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R9050:9061 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R8988:8991 Hacspec.ChoiceEquality <> both rec +R8998:9005 Examples.Core <> t_Option def +R9008:9012 Examples.Core <> t_Vec def +R9025:9028 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R9016:9024 Hacspec.Hacspec_Lib_Pre <> uint_size def +R9029:9034 Examples.Hacspec_ovn <> t_Hash meth +R9039:9046 Examples.Core <> t_Global constr +R8970:8983 Examples.Hacspec_ovn <> todo_fresh_var:115 var +binder 8959:8964 <> hoist3:119 +binder 8959:8964 <> hoist3:120 +R9062:9066 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R9080:9083 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R9701:9712 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R9650:9653 Hacspec.ChoiceEquality <> both rec +R9660:9664 Examples.Core <> t_Vec def +R9677:9680 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R9668:9676 Hacspec.Hacspec_Lib_Pre <> uint_size def +R9681:9686 Examples.Hacspec_ovn <> t_Hash meth +R9691:9698 Examples.Core <> t_Global constr +R9085:9091 Examples.Core <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'''_'''_'=>'_x_'end' not +R9098:9127 Examples.Core <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'''_'''_'=>'_x_'end' not +R9133:9136 Examples.Core <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'''_'''_'=>'_x_'end' not +R9601:9618 Examples.Core <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'''_'''_'=>'_x_'end' not +R9632:9645 Examples.Core <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'''_'''_'=>'_x_'end' not +R9092:9097 Examples.Hacspec_ovn <> hoist3:119 var +binder 9128:9132 <> nodes:121 +R9137:9143 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R9162:9162 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R9173:9177 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R9306:9321 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R9209:9212 Hacspec.ChoiceEquality <> both rec +R9260:9263 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R9220:9224 Examples.Core <> t_Vec def +R9237:9240 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R9228:9236 Hacspec.Hacspec_Lib_Pre <> uint_size def +R9241:9246 Examples.Hacspec_ovn <> t_Hash meth +R9251:9258 Examples.Core <> t_Global constr +R9264:9268 Examples.Core <> t_Vec def +R9281:9284 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R9272:9280 Hacspec.Hacspec_Lib_Pre <> uint_size def +R9285:9290 Examples.Hacspec_ovn <> t_Hash meth +R9295:9302 Examples.Core <> t_Global constr +R9179:9184 Examples.Core <> append def +R9200:9204 Examples.Hacspec_ovn <> nodes:121 var +R9186:9198 Examples.Hacspec_ovn <> current_layer:112 var +binder 9144:9161 <> current_layer_temp:122 +binder 9163:9172 <> nodes_temp:123 +R9322:9326 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R9340:9343 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R9418:9433 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R9367:9370 Hacspec.ChoiceEquality <> both rec +R9377:9381 Examples.Core <> t_Vec def +R9394:9397 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R9385:9393 Hacspec.Hacspec_Lib_Pre <> uint_size def +R9398:9403 Examples.Hacspec_ovn <> t_Hash meth +R9408:9415 Examples.Core <> t_Global constr +R9345:9362 Examples.Hacspec_ovn <> current_layer_temp:122 var +binder 9327:9339 <> current_layer:124 +binder 9327:9339 <> current_layer:125 +R9434:9438 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R9444:9447 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R9514:9529 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R9463:9466 Hacspec.ChoiceEquality <> both rec +R9473:9477 Examples.Core <> t_Vec def +R9490:9493 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R9481:9489 Hacspec.Hacspec_Lib_Pre <> uint_size def +R9494:9499 Examples.Hacspec_ovn <> t_Hash meth +R9504:9511 Examples.Core <> t_Global constr +R9449:9458 Examples.Hacspec_ovn <> nodes_temp:123 var +binder 9439:9443 <> nodes:126 +binder 9439:9443 <> nodes:127 +R9530:9534 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R9536:9539 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R9572:9587 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R9556:9559 Hacspec.ChoiceEquality <> both rec +R9566:9570 Crypt.package.pkg_notation PackageNotation ::package_scope:'''unit' not +R9541:9551 Examples.Core <> :::'ret_both'_'tt' not +binder 9535:9535 <> pat:128 +R9588:9600 Examples.Hacspec_ovn <> current_layer:124 var +R9619:9631 Examples.Hacspec_ovn <> current_layer:112 var +binder 9067:9079 <> current_layer:129 +binder 9067:9079 <> current_layer:130 +R9713:9717 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R9730:9733 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R9848:9859 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R9778:9781 Hacspec.ChoiceEquality <> both rec +R9788:9792 Examples.Core <> t_Vec def +R9795:9799 Examples.Core <> t_Vec def +R9812:9815 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R9803:9811 Hacspec.Hacspec_Lib_Pre <> uint_size def +R9816:9821 Examples.Hacspec_ovn <> t_Hash meth +R9826:9833 Examples.Core <> t_Global constr +R9838:9845 Examples.Core <> t_Global constr +R9735:9738 Examples.Core <> push def +R9754:9758 Examples.Core <> clone syndef +R9760:9772 Examples.Hacspec_ovn <> current_layer:129 var +R9740:9751 Examples.Hacspec_ovn <> partial_tree:113 var +binder 9718:9729 <> partial_tree:131 +binder 9718:9729 <> partial_tree:132 +R9860:9866 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R9881:9881 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R9900:9904 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R10038:11346 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R9939:9942 Hacspec.ChoiceEquality <> both rec +R9992:9995 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R9950:9956 Examples.Core <> t_Drain def +R9969:9972 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R9960:9968 Hacspec.Hacspec_Lib_Pre <> uint_size def +R9973:9978 Examples.Hacspec_ovn <> t_Hash meth +R9983:9990 Examples.Core <> t_Global constr +R9996:10000 Examples.Core <> t_Vec def +R10013:10016 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R10004:10012 Hacspec.Hacspec_Lib_Pre <> uint_size def +R10017:10022 Examples.Hacspec_ovn <> t_Hash meth +R10027:10034 Examples.Core <> t_Global constr +R9906:9910 Examples.Core <> drain def +R9926:9934 Examples.Core <> RangeFull constr +R9912:9924 Examples.Hacspec_ovn <> current_layer:129 var +binder 9867:9880 <> todo_fresh_var:133 +binder 9882:9899 <> current_layer_temp:134 +R11347:11353 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b('_x_','_x_','_'..'_','_x_')' not +R11367:11367 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b('_x_','_x_','_'..'_','_x_')' not +R11380:11380 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b('_x_','_x_','_'..'_','_x_')' not +R11396:11396 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b('_x_','_x_','_'..'_','_x_')' not +R11354:11366 Examples.Hacspec_ovn <> current_layer:129 var +R11368:11379 Examples.Hacspec_ovn <> partial_tree:131 var +R11381:11395 Examples.Hacspec_ovn <> reversed_layers:117 var +R8465:8473 Examples.Hacspec_lib <> into_iter syndef +R8476:8488 Examples.Hacspec_lib <> Build_t_Range def +R8496:8510 Examples.Hacspec_ovn <> full_tree_depth:95 var +R8490:8493 Examples.Hacspec_lib <> :::'i32('_x_')' not +R8495:8495 Examples.Hacspec_lib <> :::'i32('_x_')' not +binder 8405:8417 <> current_layer:135 +binder 8419:8430 <> partial_tree:136 +binder 8432:8446 <> reversed_layers:137 +R11641:11645 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R11658:11661 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R11776:11801 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R11706:11709 Hacspec.ChoiceEquality <> both rec +R11716:11720 Examples.Core <> t_Vec def +R11723:11727 Examples.Core <> t_Vec def +R11740:11743 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R11731:11739 Hacspec.Hacspec_Lib_Pre <> uint_size def +R11744:11749 Examples.Hacspec_ovn <> t_Hash meth +R11754:11761 Examples.Core <> t_Global constr +R11766:11773 Examples.Core <> t_Global constr +R11663:11666 Examples.Core <> push def +R11682:11686 Examples.Core <> clone syndef +R11688:11700 Examples.Hacspec_ovn <> current_layer:135 var +R11668:11679 Examples.Hacspec_ovn <> partial_tree:136 var +binder 11646:11657 <> partial_tree:138 +binder 11646:11657 <> partial_tree:139 +R11802:11813 Examples.Hacspec_ovn <> :::'solve_lift'_x not +R11836:11836 Examples.Hacspec_ovn <> :::'solve_lift'_x not +R11814:11822 Examples.Core <> Result_Ok syndef +R11824:11835 Examples.Hacspec_ovn <> partial_tree:138 var +R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm +R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm +R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm +R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm +R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm +R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm +R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm +R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm +R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm +R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm +R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm +R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm +R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm +R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm +R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm +R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm +R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm +R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm +R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm +R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm +R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm +R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm +R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm +R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm +R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm +R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm +R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm +R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm +R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm +R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm +R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm +R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm +R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm +R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm +R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm +R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm +R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm +R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm +R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm +R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm +R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm +R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm +R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm +R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm +R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm +R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm +R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm +R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm +R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm +R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm +R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm +R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm +R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm +R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm +R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm +R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm +R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm +R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm +R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm +R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm +R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm +R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm +R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm +R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm +R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm +R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm +R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm +R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm +R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm +R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm +def 12252:12269 <> build_under_impl_1 +binder 12272:12272 <> T:140 +R12282:12288 Examples.Core <> t_Sized class +R12291:12291 Examples.Hacspec_ovn <> T:140 var +binder 12282:12292 <> H:141 +R12298:12305 Examples.Hacspec_ovn <> t_Hasher class +R12308:12308 Examples.Hacspec_ovn <> T:140 var +binder 12298:12309 <> H0:142 +R12318:12323 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R12332:12332 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R12324:12331 Crypt.package.pkg_core_definition <> Location def +binder 12313:12314 <> L1:143 +R12341:12346 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R12355:12355 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R12347:12354 Crypt.package.pkg_core_definition <> Location def +binder 12336:12337 <> L2:144 +R12364:12372 Crypt.package.pkg_core_definition <> Interface def +binder 12359:12360 <> I1:145 +R12381:12389 Crypt.package.pkg_core_definition <> Interface def +binder 12376:12377 <> I2:146 +R12410:12413 Hacspec.ChoiceEquality <> both rec +R12422:12426 Examples.Core <> t_Vec def +R12429:12433 Examples.Core <> t_Vec def +R12446:12449 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R12437:12445 Hacspec.Hacspec_Lib_Pre <> uint_size def +R12450:12455 Examples.Hacspec_ovn <> t_Hash meth +R12460:12467 Examples.Core <> t_Global constr +R12472:12479 Examples.Core <> t_Global constr +R12418:12419 Examples.Hacspec_ovn <> I1:145 var +R12415:12416 Examples.Hacspec_ovn <> L1:143 var +binder 12393:12406 <> partial_layers:147 +R12493:12496 Hacspec.ChoiceEquality <> both rec +R12505:12513 Hacspec.Hacspec_Lib_Pre <> uint_size def +R12501:12502 Examples.Hacspec_ovn <> I2:146 var +R12498:12499 Examples.Hacspec_ovn <> L2:144 var +binder 12485:12489 <> depth:148 +R12519:12522 Hacspec.ChoiceEquality <> both rec +R12637:12644 Examples.Core <> t_Result def +R12647:12659 Examples.Hacspec_ovn <> t_PartialTree def +R12662:12662 Examples.Hacspec_ovn <> T:140 var +R12667:12673 Examples.Hacspec_ovn <> t_Error def +R12629:12631 extructures.fset <> ::fset_scope:x_':|:'_x not +R12627:12628 Examples.Hacspec_ovn <> I1:145 var +R12632:12633 Examples.Hacspec_ovn <> I2:146 var +R12532:12536 extructures.fset <> ::fset_scope:x_':|:'_x not +R12527:12529 extructures.fset <> ::fset_scope:x_':|:'_x not +R12525:12526 Examples.Hacspec_ovn <> L1:143 var +R12530:12531 Examples.Hacspec_ovn <> L2:144 var +R12537:12540 extructures.fset <> fset def +R12542:12542 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not +R12560:12561 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not +R12571:12572 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not +R12589:12590 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not +R12610:12611 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not +R12623:12623 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not +R12543:12559 Examples.Hacspec_ovn <> current_layer_loc def +R12562:12570 Examples.Hacspec_ovn <> nodes_loc def +R12573:12588 Examples.Hacspec_ovn <> partial_tree_loc def +R12591:12609 Examples.Hacspec_ovn <> reversed_layers_loc def +R12612:12622 Examples.Hacspec_ovn <> parents_loc def +R12682:12684 Examples.Core <> run def +R12687:12691 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R12698:12701 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R13067:13072 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not +R12997:13000 Hacspec.ChoiceEquality <> both rec +R13007:13011 Examples.Core <> t_Vec def +R13014:13018 Examples.Core <> t_Vec def +R13031:13034 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R13022:13030 Hacspec.Hacspec_Lib_Pre <> uint_size def +R13035:13040 Examples.Hacspec_ovn <> t_Hash meth +R13045:13052 Examples.Core <> t_Global constr +R13057:13064 Examples.Core <> t_Global constr diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v new file mode 100644 index 0000000..27dfb4e --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -0,0 +1,72 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +(*Not implemented yet? todo(item)*) + +Require Import Hacspec_lib. + +(*Not implemented yet? todo(item)*) + +Require Import Schnorr. + +Require Import Schnorr. (* as sample_uniform *) + +Require Import Schnorr. + +Notation t_public := (t_Q). + +Notation t_public_key := ((t_Q × (t_G × t_G × t_Q × t_G))). + +Program Definition p_i_init {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 (unit)) : both (L1 :|: fset [commit_loc]) (I1) ((t_Q × (t_G × t_G × t_Q × t_G))) := + letb x := (sample_uniform) : both _ _ (t_G) in + letb y := (v_ONE) : both _ _ (t_Q) in + letb zkp := (fiat_shamir_run prod_b(x,y)) : both _ _ ((t_G × t_G × t_Q × t_G)) in + prod_b(y,zkp). +Fail Next Obligation. + +Notation t_N := (nat_mod 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab). +Definition N {L : {fset Location}} {I : Interface} : both L I (t_N) -> both L I (t_N) := + id. + +Notation t_pid := (t_N). + +Require Import Std. (* as HashMap *) + +Notation t_public_keys := (t_HashMap (t_N) ((t_Q × (t_G × t_G × t_Q × t_G))) (t_RandomState)). + +Program Definition p_i_construct {L1 : {fset Location}} {I1 : Interface} (m : both L1 I1 (t_HashMap (t_N) ((t_Q × (t_G × t_G × t_Q × t_G))) (t_RandomState))) : both (L1) (I1) (unit) := + tt. +Fail Next Obligation. + +Program Definition p_i_vote {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 ('bool)) : both (L1) (I1) (t_Q) := + v_ONE. +Fail Next Obligation. + +Program Definition exec {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 ('bool)) : both (L1 :|: fset [commit_loc]) (I1) (t_Q) := + letb x := (sample_uniform) : both _ _ (t_G) in + letb y := (v_ONE) : both _ _ (t_Q) in + letb zkp := (fiat_shamir_run prod_b(x,y)) : both _ _ ((t_G × t_G × t_Q × t_G)) in + p_i_vote v. +Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Makefile b/ovn/proofs/ssprove/extraction/Makefile new file mode 100644 index 0000000..ac7ef75 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Makefile @@ -0,0 +1,924 @@ +########################################################################## +## # The Coq Proof Assistant / The Coq Development Team ## +## v # Copyright INRIA, CNRS and contributors ## +## /dev/null 2>/dev/null; echo $$?)) +STDTIME?=command time -f $(TIMEFMT) +else +ifeq (0,$(shell gtime -f "" true >/dev/null 2>/dev/null; echo $$?)) +STDTIME?=gtime -f $(TIMEFMT) +else +STDTIME?=command time +endif +endif +else +STDTIME?=command time -f $(TIMEFMT) +endif + +COQBIN?= +ifneq (,$(COQBIN)) +# add an ending / +COQBIN:=$(COQBIN)/ +endif + +# Coq binaries +COQC ?= "$(COQBIN)coqc" +COQTOP ?= "$(COQBIN)coqtop" +COQCHK ?= "$(COQBIN)coqchk" +COQNATIVE ?= "$(COQBIN)coqnative" +COQDEP ?= "$(COQBIN)coqdep" +COQDOC ?= "$(COQBIN)coqdoc" +COQPP ?= "$(COQBIN)coqpp" +COQMKFILE ?= "$(COQBIN)coq_makefile" +OCAMLLIBDEP ?= "$(COQBIN)ocamllibdep" + +# Timing scripts +COQMAKE_ONE_TIME_FILE ?= "$(COQCORELIB)/tools/make-one-time-file.py" +COQMAKE_BOTH_TIME_FILES ?= "$(COQCORELIB)/tools/make-both-time-files.py" +COQMAKE_BOTH_SINGLE_TIMING_FILES ?= "$(COQCORELIB)/tools/make-both-single-timing-files.py" +BEFORE ?= +AFTER ?= + +# FIXME this should be generated by Coq (modules already linked by Coq) +CAMLDONTLINK=str,unix,dynlink,threads,zarith + +# OCaml binaries +CAMLC ?= "$(OCAMLFIND)" ocamlc -c +CAMLOPTC ?= "$(OCAMLFIND)" opt -c +CAMLLINK ?= "$(OCAMLFIND)" ocamlc -linkpkg -dontlink $(CAMLDONTLINK) +CAMLOPTLINK ?= "$(OCAMLFIND)" opt -linkpkg -dontlink $(CAMLDONTLINK) +CAMLDOC ?= "$(OCAMLFIND)" ocamldoc +CAMLDEP ?= "$(OCAMLFIND)" ocamldep -slash -ml-synonym .mlpack + +# DESTDIR is prepended to all installation paths +DESTDIR ?= + +# Debug builds, typically -g to OCaml, -debug to Coq. +CAMLDEBUG ?= +COQDEBUG ?= + +# Extra packages to be linked in (as in findlib -package) +CAMLPKGS ?= + +# Option for making timing files +TIMING?= +# Option for changing sorting of timing output file +TIMING_SORT_BY ?= auto +# Option for changing the fuzz parameter on the output file +TIMING_FUZZ ?= 0 +# Option for changing whether to use real or user time for timing tables +TIMING_REAL?= +# Option for including the memory column(s) +TIMING_INCLUDE_MEM?= +# Option for sorting by the memory column +TIMING_SORT_BY_MEM?= +# Output file names for timed builds +TIME_OF_BUILD_FILE ?= time-of-build.log +TIME_OF_BUILD_BEFORE_FILE ?= time-of-build-before.log +TIME_OF_BUILD_AFTER_FILE ?= time-of-build-after.log +TIME_OF_PRETTY_BUILD_FILE ?= time-of-build-pretty.log +TIME_OF_PRETTY_BOTH_BUILD_FILE ?= time-of-build-both.log +TIME_OF_PRETTY_BUILD_EXTRA_FILES ?= - # also output to the command line + +TGTS ?= + +# Retro compatibility (DESTDIR is standard on Unix, DSTROOT is not) +ifdef DSTROOT +DESTDIR := $(DSTROOT) +endif + +# Substitution of the path by appending $(DESTDIR) if needed. +# The variable $(COQMF_WINDRIVE) can be needed for Cygwin environments. +windrive_path = $(if $(COQMF_WINDRIVE),$(subst $(COQMF_WINDRIVE),/,$(1)),$(1)) +destination_path = $(if $(DESTDIR),$(DESTDIR)/$(call windrive_path,$(1)),$(1)) + +# Installation paths of libraries and documentation. +COQLIBINSTALL ?= $(call destination_path,$(COQLIB)/user-contrib) +COQDOCINSTALL ?= $(call destination_path,$(DOCDIR)/coq/user-contrib) +COQTOPINSTALL ?= $(call destination_path,$(COQLIB)/toploop) # FIXME: Unused variable? + +########## End of parameters ################################################## +# What follows may be relevant to you only if you need to +# extend this Makefile. If so, look for 'Extension point' here and +# put in Makefile.local double colon rules accordingly. +# E.g. to perform some work after the all target completes you can write +# +# post-all:: +# echo "All done!" +# +# in Makefile.local +# +############################################################################### + + + + +# Flags ####################################################################### +# +# We define a bunch of variables combining the parameters. +# To add additional flags to coq, coqchk or coqdoc, set the +# {COQ,COQCHK,COQDOC}EXTRAFLAGS variable to whatever you want to add. +# To overwrite the default choice and set your own flags entirely, set the +# {COQ,COQCHK,COQDOC}FLAGS variable. + +SHOW := $(if $(VERBOSE),@true "",@echo "") +HIDE := $(if $(VERBOSE),,@) + +TIMER=$(if $(TIMED), $(STDTIME), $(TIMECMD)) + +OPT?= + +# The DYNOBJ and DYNLIB variables are used by "coqdep -dyndep var" in .v.d +ifeq '$(OPT)' '-byte' +USEBYTE:=true +DYNOBJ:=.cma +DYNLIB:=.cma +else +USEBYTE:= +DYNOBJ:=.cmxs +DYNLIB:=.cmxs +endif + +# these variables are meant to be overridden if you want to add *extra* flags +COQEXTRAFLAGS?= +COQCHKEXTRAFLAGS?= +COQDOCEXTRAFLAGS?= + +# Find the last argument of the form "-native-compiler FLAG" +COQUSERNATIVEFLAG:=$(strip \ +$(subst -native-compiler-,,\ +$(lastword \ +$(filter -native-compiler-%,\ +$(subst -native-compiler ,-native-compiler-,\ +$(strip $(COQEXTRAFLAGS))))))) + +COQFILTEREDEXTRAFLAGS:=$(strip \ +$(filter-out -native-compiler-%,\ +$(subst -native-compiler ,-native-compiler-,\ +$(strip $(COQEXTRAFLAGS))))) + +COQACTUALNATIVEFLAG:=$(lastword $(COQMF_COQ_NATIVE_COMPILER_DEFAULT) $(COQMF_COQPROJECTNATIVEFLAG) $(COQUSERNATIVEFLAG)) + +ifeq '$(COQACTUALNATIVEFLAG)' 'yes' + COQNATIVEFLAG="-w" "-deprecated-native-compiler-option" "-native-compiler" "ondemand" + COQDONATIVE="yes" +else +ifeq '$(COQACTUALNATIVEFLAG)' 'ondemand' + COQNATIVEFLAG="-w" "-deprecated-native-compiler-option" "-native-compiler" "ondemand" + COQDONATIVE="no" +else + COQNATIVEFLAG="-w" "-deprecated-native-compiler-option" "-native-compiler" "no" + COQDONATIVE="no" +endif +endif + +# these flags do NOT contain the libraries, to make them easier to overwrite +COQFLAGS?=-q $(OTHERFLAGS) $(COQFILTEREDEXTRAFLAGS) $(COQNATIVEFLAG) +COQCHKFLAGS?=-silent -o $(COQCHKEXTRAFLAGS) +COQDOCFLAGS?=-interpolate -utf8 $(COQDOCEXTRAFLAGS) + +COQDOCLIBS?=$(COQLIBS_NOML) + +# The version of Coq being run and the version of coq_makefile that +# generated this makefile +COQ_VERSION:=$(shell $(COQC) --print-version | cut -d " " -f 1) +COQMAKEFILE_VERSION:=8.15.2 + +# COQ_SRC_SUBDIRS is for user-overriding, usually to add +# `user-contrib/Foo` to the includes, we keep COQCORE_SRC_SUBDIRS for +# Coq's own core libraries, which should be replaced by ocamlfind +# options at some point. +COQ_SRC_SUBDIRS?= +COQSRCLIBS?= $(foreach d,$(COQCORE_SRC_SUBDIRS), -I "$(COQCORELIB)/$(d)") $(foreach d,$(COQ_SRC_SUBDIRS), -I "$(COQLIB)/$(d)") + +CAMLFLAGS+=$(OCAMLLIBS) $(COQSRCLIBS) +# ocamldoc fails with unknown argument otherwise +CAMLDOCFLAGS:=$(filter-out -annot, $(filter-out -bin-annot, $(CAMLFLAGS))) +CAMLFLAGS+=$(OCAMLWARN) + +ifneq (,$(TIMING)) +TIMING_ARG=-time +ifeq (after,$(TIMING)) +TIMING_EXT=after-timing +else +ifeq (before,$(TIMING)) +TIMING_EXT=before-timing +else +TIMING_EXT=timing +endif +endif +else +TIMING_ARG= +endif + +# Files ####################################################################### +# +# We here define a bunch of variables about the files being part of the +# Coq project in order to ease the writing of build target and build rules + +VDFILE := .Makefile.d + +ALLSRCFILES := \ + $(MLGFILES) \ + $(MLFILES) \ + $(MLPACKFILES) \ + $(MLLIBFILES) \ + $(MLIFILES) + +# helpers +vo_to_obj = $(addsuffix .o,\ + $(filter-out Warning: Error:,\ + $(shell $(COQTOP) -q -noinit -batch -quiet -print-mod-uid $(1)))) +strip_dotslash = $(patsubst ./%,%,$(1)) + +# without this we get undefined variables in the expansion for the +# targets of the [deprecated,use-mllib-or-mlpack] rule +with_undef = $(if $(filter-out undefined, $(origin $(1))),$($(1))) + +VO = vo +VOS = vos + +VOFILES = $(VFILES:.v=.$(VO)) +GLOBFILES = $(VFILES:.v=.glob) +HTMLFILES = $(VFILES:.v=.html) +GHTMLFILES = $(VFILES:.v=.g.html) +BEAUTYFILES = $(addsuffix .beautified,$(VFILES)) +TEXFILES = $(VFILES:.v=.tex) +GTEXFILES = $(VFILES:.v=.g.tex) +CMOFILES = \ + $(MLGFILES:.mlg=.cmo) \ + $(MLFILES:.ml=.cmo) \ + $(MLPACKFILES:.mlpack=.cmo) +CMXFILES = $(CMOFILES:.cmo=.cmx) +OFILES = $(CMXFILES:.cmx=.o) +CMAFILES = $(MLLIBFILES:.mllib=.cma) $(MLPACKFILES:.mlpack=.cma) +CMXAFILES = $(CMAFILES:.cma=.cmxa) +CMIFILES = \ + $(CMOFILES:.cmo=.cmi) \ + $(MLIFILES:.mli=.cmi) +# the /if/ is because old _CoqProject did not list a .ml(pack|lib) but just +# a .mlg file +CMXSFILES = \ + $(MLPACKFILES:.mlpack=.cmxs) \ + $(CMXAFILES:.cmxa=.cmxs) \ + $(if $(MLPACKFILES)$(CMXAFILES),,\ + $(MLGFILES:.mlg=.cmxs) $(MLFILES:.ml=.cmxs)) + +# files that are packed into a plugin (no extension) +PACKEDFILES = \ + $(call strip_dotslash, \ + $(foreach lib, \ + $(call strip_dotslash, \ + $(MLPACKFILES:.mlpack=_MLPACK_DEPENDENCIES)),$(call with_undef,$(lib)))) +# files that are archived into a .cma (mllib) +LIBEDFILES = \ + $(call strip_dotslash, \ + $(foreach lib, \ + $(call strip_dotslash, \ + $(MLLIBFILES:.mllib=_MLLIB_DEPENDENCIES)),$(call with_undef,$(lib)))) +CMIFILESTOINSTALL = $(filter-out $(addsuffix .cmi,$(PACKEDFILES)),$(CMIFILES)) +CMOFILESTOINSTALL = $(filter-out $(addsuffix .cmo,$(PACKEDFILES)),$(CMOFILES)) +OBJFILES = $(call vo_to_obj,$(VOFILES)) +ALLNATIVEFILES = \ + $(OBJFILES:.o=.cmi) \ + $(OBJFILES:.o=.cmx) \ + $(OBJFILES:.o=.cmxs) +# trick: wildcard filters out non-existing files, so that `install` doesn't show +# warnings and `clean` doesn't pass to rm a list of files that is too long for +# the shell. +NATIVEFILES = $(wildcard $(ALLNATIVEFILES)) +FILESTOINSTALL = \ + $(VOFILES) \ + $(VFILES) \ + $(GLOBFILES) \ + $(NATIVEFILES) \ + $(CMIFILESTOINSTALL) +BYTEFILESTOINSTALL = \ + $(CMOFILESTOINSTALL) \ + $(CMAFILES) +ifeq '$(HASNATDYNLINK)' 'true' +DO_NATDYNLINK = yes +FILESTOINSTALL += $(CMXSFILES) $(CMXAFILES) $(CMOFILESTOINSTALL:.cmo=.cmx) +else +DO_NATDYNLINK = +endif + +ALLDFILES = $(addsuffix .d,$(ALLSRCFILES)) $(VDFILE) + +# Compilation targets ######################################################### + +all: + $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" pre-all + $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" real-all + $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" post-all +.PHONY: all + +all.timing.diff: + $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" pre-all + $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" real-all.timing.diff TIME_OF_PRETTY_BUILD_EXTRA_FILES="" + $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" post-all +.PHONY: all.timing.diff + +ifeq (0,$(TIMING_REAL)) +TIMING_REAL_ARG := +TIMING_USER_ARG := --user +else +ifeq (1,$(TIMING_REAL)) +TIMING_REAL_ARG := --real +TIMING_USER_ARG := +else +TIMING_REAL_ARG := +TIMING_USER_ARG := +endif +endif + +ifeq (0,$(TIMING_INCLUDE_MEM)) +TIMING_INCLUDE_MEM_ARG := --no-include-mem +else +TIMING_INCLUDE_MEM_ARG := +endif + +ifeq (1,$(TIMING_SORT_BY_MEM)) +TIMING_SORT_BY_MEM_ARG := --sort-by-mem +else +TIMING_SORT_BY_MEM_ARG := +endif + +make-pretty-timed-before:: TIME_OF_BUILD_FILE=$(TIME_OF_BUILD_BEFORE_FILE) +make-pretty-timed-after:: TIME_OF_BUILD_FILE=$(TIME_OF_BUILD_AFTER_FILE) +make-pretty-timed make-pretty-timed-before make-pretty-timed-after:: + $(HIDE)rm -f pretty-timed-success.ok + $(HIDE)($(MAKE) --no-print-directory -f "$(PARENT)" $(TGTS) TIMED=1 2>&1 && touch pretty-timed-success.ok) | tee -a $(TIME_OF_BUILD_FILE) + $(HIDE)rm pretty-timed-success.ok # must not be -f; must fail if the touch failed +print-pretty-timed:: + $(HIDE)$(COQMAKE_ONE_TIME_FILE) $(TIMING_INCLUDE_MEM_ARG) $(TIMING_SORT_BY_MEM_ARG) $(TIMING_REAL_ARG) $(TIME_OF_BUILD_FILE) $(TIME_OF_PRETTY_BUILD_FILE) $(TIME_OF_PRETTY_BUILD_EXTRA_FILES) +print-pretty-timed-diff:: + $(HIDE)$(COQMAKE_BOTH_TIME_FILES) --sort-by=$(TIMING_SORT_BY) $(TIMING_INCLUDE_MEM_ARG) $(TIMING_SORT_BY_MEM_ARG) $(TIMING_REAL_ARG) $(TIME_OF_BUILD_AFTER_FILE) $(TIME_OF_BUILD_BEFORE_FILE) $(TIME_OF_PRETTY_BOTH_BUILD_FILE) $(TIME_OF_PRETTY_BUILD_EXTRA_FILES) +ifeq (,$(BEFORE)) +print-pretty-single-time-diff:: + @echo 'Error: Usage: $(MAKE) print-pretty-single-time-diff AFTER=path/to/file.v.after-timing BEFORE=path/to/file.v.before-timing' + $(HIDE)false +else +ifeq (,$(AFTER)) +print-pretty-single-time-diff:: + @echo 'Error: Usage: $(MAKE) print-pretty-single-time-diff AFTER=path/to/file.v.after-timing BEFORE=path/to/file.v.before-timing' + $(HIDE)false +else +print-pretty-single-time-diff:: + $(HIDE)$(COQMAKE_BOTH_SINGLE_TIMING_FILES) --fuzz=$(TIMING_FUZZ) --sort-by=$(TIMING_SORT_BY) $(TIMING_USER_ARG) $(AFTER) $(BEFORE) $(TIME_OF_PRETTY_BUILD_FILE) $(TIME_OF_PRETTY_BUILD_EXTRA_FILES) +endif +endif +pretty-timed: + $(HIDE)$(MAKE) --no-print-directory -f "$(PARENT)" make-pretty-timed + $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" print-pretty-timed +.PHONY: pretty-timed make-pretty-timed make-pretty-timed-before make-pretty-timed-after print-pretty-timed print-pretty-timed-diff print-pretty-single-time-diff + +# Extension points for actions to be performed before/after the all target +pre-all:: + @# Extension point + $(HIDE)if [ "$(COQMAKEFILE_VERSION)" != "$(COQ_VERSION)" ]; then\ + echo "W: This Makefile was generated by Coq $(COQMAKEFILE_VERSION)";\ + echo "W: while the current Coq version is $(COQ_VERSION)";\ + fi +.PHONY: pre-all + +post-all:: + @# Extension point +.PHONY: post-all + +real-all: $(VOFILES) $(if $(USEBYTE),bytefiles,optfiles) +.PHONY: real-all + +real-all.timing.diff: $(VOFILES:.vo=.v.timing.diff) +.PHONY: real-all.timing.diff + +bytefiles: $(CMOFILES) $(CMAFILES) +.PHONY: bytefiles + +optfiles: $(if $(DO_NATDYNLINK),$(CMXSFILES)) +.PHONY: optfiles + +# FIXME, see Ralf's bugreport +# quick is deprecated, now renamed vio +vio: $(VOFILES:.vo=.vio) +.PHONY: vio +quick: vio + $(warning "'make quick' is deprecated, use 'make vio' or consider using 'vos' files") +.PHONY: quick + +vio2vo: + $(TIMER) $(COQC) $(COQDEBUG) $(COQFLAGS) $(COQLIBS) \ + -schedule-vio2vo $(J) $(VOFILES:%.vo=%.vio) +.PHONY: vio2vo + +# quick2vo is undocumented +quick2vo: + $(HIDE)make -j $(J) vio + $(HIDE)VIOFILES=$$(for vofile in $(VOFILES); do \ + viofile="$$(echo "$$vofile" | sed "s/\.vo$$/.vio/")"; \ + if [ "$$vofile" -ot "$$viofile" -o ! -e "$$vofile" ]; then printf "$$viofile "; fi; \ + done); \ + echo "VIO2VO: $$VIOFILES"; \ + if [ -n "$$VIOFILES" ]; then \ + $(TIMER) $(COQC) $(COQDEBUG) $(COQFLAGS) $(COQLIBS) -schedule-vio2vo $(J) $$VIOFILES; \ + fi +.PHONY: quick2vo + +checkproofs: + $(TIMER) $(COQC) $(COQDEBUG) $(COQFLAGS) $(COQLIBS) \ + -schedule-vio-checking $(J) $(VOFILES:%.vo=%.vio) +.PHONY: checkproofs + +vos: $(VOFILES:%.vo=%.vos) +.PHONY: vos + +vok: $(VOFILES:%.vo=%.vok) +.PHONY: vok + +validate: $(VOFILES) + $(TIMER) $(COQCHK) $(COQCHKFLAGS) $(COQLIBS_NOML) $^ +.PHONY: validate + +only: $(TGTS) +.PHONY: only + +# Documentation targets ####################################################### + +html: $(GLOBFILES) $(VFILES) + $(SHOW)'COQDOC -d html $(GAL)' + $(HIDE)mkdir -p html + $(HIDE)$(COQDOC) \ + -toc $(COQDOCFLAGS) -html $(GAL) $(COQDOCLIBS) -d html $(VFILES) + +mlihtml: $(MLIFILES:.mli=.cmi) + $(SHOW)'CAMLDOC -d $@' + $(HIDE)mkdir $@ || rm -rf $@/* + $(HIDE)$(CAMLDOC) -html \ + -d $@ -m A $(CAMLDEBUG) $(CAMLDOCFLAGS) $(MLIFILES) + +all-mli.tex: $(MLIFILES:.mli=.cmi) + $(SHOW)'CAMLDOC -latex $@' + $(HIDE)$(CAMLDOC) -latex \ + -o $@ -m A $(CAMLDEBUG) $(CAMLDOCFLAGS) $(MLIFILES) + +all.ps: $(VFILES) + $(SHOW)'COQDOC -ps $(GAL)' + $(HIDE)$(COQDOC) \ + -toc $(COQDOCFLAGS) -ps $(GAL) $(COQDOCLIBS) \ + -o $@ `$(COQDEP) -sort $(VFILES)` + +all.pdf: $(VFILES) + $(SHOW)'COQDOC -pdf $(GAL)' + $(HIDE)$(COQDOC) \ + -toc $(COQDOCFLAGS) -pdf $(GAL) $(COQDOCLIBS) \ + -o $@ `$(COQDEP) -sort $(VFILES)` + +# FIXME: not quite right, since the output name is different +gallinahtml: GAL=-g +gallinahtml: html + +all-gal.ps: GAL=-g +all-gal.ps: all.ps + +all-gal.pdf: GAL=-g +all-gal.pdf: all.pdf + +# ? +beautify: $(BEAUTYFILES) + for file in $^; do mv $${file%.beautified} $${file%beautified}old && mv $${file} $${file%.beautified}; done + @echo 'Do not do "make clean" until you are sure that everything went well!' + @echo 'If there were a problem, execute "for file in $$(find . -name \*.v.old -print); do mv $${file} $${file%.old}; done" in your shell/' +.PHONY: beautify + +# Installation targets ######################################################## +# +# There rules can be extended in Makefile.local +# Extensions can't assume when they run. + +install: + $(HIDE)code=0; for f in $(FILESTOINSTALL); do\ + if ! [ -f "$$f" ]; then >&2 echo $$f does not exist; code=1; fi \ + done; exit $$code + $(HIDE)for f in $(FILESTOINSTALL); do\ + df="`$(COQMKFILE) -destination-of "$$f" $(COQLIBS)`";\ + if [ "$$?" != "0" -o -z "$$df" ]; then\ + echo SKIP "$$f" since it has no logical path;\ + else\ + install -d "$(COQLIBINSTALL)/$$df" &&\ + install -m 0644 "$$f" "$(COQLIBINSTALL)/$$df" &&\ + echo INSTALL "$$f" "$(COQLIBINSTALL)/$$df";\ + fi;\ + done + $(HIDE)$(MAKE) install-extra -f "$(SELF)" +install-extra:: + @# Extension point +.PHONY: install install-extra + +install-byte: + $(HIDE)for f in $(BYTEFILESTOINSTALL); do\ + df="`$(COQMKFILE) -destination-of "$$f" $(COQLIBS)`";\ + if [ "$$?" != "0" -o -z "$$df" ]; then\ + echo SKIP "$$f" since it has no logical path;\ + else\ + install -d "$(COQLIBINSTALL)/$$df" &&\ + install -m 0644 "$$f" "$(COQLIBINSTALL)/$$df" &&\ + echo INSTALL "$$f" "$(COQLIBINSTALL)/$$df";\ + fi;\ + done + +install-doc:: html mlihtml + @# Extension point + $(HIDE)install -d "$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/html" + $(HIDE)for i in html/*; do \ + dest="$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/$$i";\ + install -m 0644 "$$i" "$$dest";\ + echo INSTALL "$$i" "$$dest";\ + done + $(HIDE)install -d \ + "$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/mlihtml" + $(HIDE)for i in mlihtml/*; do \ + dest="$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/$$i";\ + install -m 0644 "$$i" "$$dest";\ + echo INSTALL "$$i" "$$dest";\ + done +.PHONY: install-doc + +uninstall:: + @# Extension point + $(HIDE)for f in $(FILESTOINSTALL); do \ + df="`$(COQMKFILE) -destination-of "$$f" $(COQLIBS)`" &&\ + instf="$(COQLIBINSTALL)/$$df/`basename $$f`" &&\ + rm -f "$$instf" &&\ + echo RM "$$instf" &&\ + (rmdir "$(COQLIBINSTALL)/$$df/" 2>/dev/null || true); \ + done +.PHONY: uninstall + +uninstall-doc:: + @# Extension point + $(SHOW)'RM $(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/html' + $(HIDE)rm -rf "$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/html" + $(SHOW)'RM $(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/mlihtml' + $(HIDE)rm -rf "$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/mlihtml" + $(HIDE) rmdir "$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/" || true +.PHONY: uninstall-doc + +# Cleaning #################################################################### +# +# There rules can be extended in Makefile.local +# Extensions can't assume when they run. + +clean:: + @# Extension point + $(SHOW)'CLEAN' + $(HIDE)rm -f $(CMOFILES) + $(HIDE)rm -f $(CMIFILES) + $(HIDE)rm -f $(CMAFILES) + $(HIDE)rm -f $(CMOFILES:.cmo=.cmx) + $(HIDE)rm -f $(CMXAFILES) + $(HIDE)rm -f $(CMXSFILES) + $(HIDE)rm -f $(CMOFILES:.cmo=.o) + $(HIDE)rm -f $(CMXAFILES:.cmxa=.a) + $(HIDE)rm -f $(MLGFILES:.mlg=.ml) + $(HIDE)rm -f $(ALLDFILES) + $(HIDE)rm -f $(NATIVEFILES) + $(HIDE)find . -name .coq-native -type d -empty -delete + $(HIDE)rm -f $(VOFILES) + $(HIDE)rm -f $(VOFILES:.vo=.vio) + $(HIDE)rm -f $(VOFILES:.vo=.vos) + $(HIDE)rm -f $(VOFILES:.vo=.vok) + $(HIDE)rm -f $(BEAUTYFILES) $(VFILES:=.old) + $(HIDE)rm -f all.ps all-gal.ps all.pdf all-gal.pdf all.glob all-mli.tex + $(HIDE)rm -f $(VFILES:.v=.glob) + $(HIDE)rm -f $(VFILES:.v=.tex) + $(HIDE)rm -f $(VFILES:.v=.g.tex) + $(HIDE)rm -f pretty-timed-success.ok + $(HIDE)rm -rf html mlihtml +.PHONY: clean + +cleanall:: clean + @# Extension point + $(SHOW)'CLEAN *.aux *.timing' + $(HIDE)rm -f $(foreach f,$(VFILES:.v=),$(dir $(f)).$(notdir $(f)).aux) + $(HIDE)rm -f $(TIME_OF_BUILD_FILE) $(TIME_OF_BUILD_BEFORE_FILE) $(TIME_OF_BUILD_AFTER_FILE) $(TIME_OF_PRETTY_BUILD_FILE) $(TIME_OF_PRETTY_BOTH_BUILD_FILE) + $(HIDE)rm -f $(VOFILES:.vo=.v.timing) + $(HIDE)rm -f $(VOFILES:.vo=.v.before-timing) + $(HIDE)rm -f $(VOFILES:.vo=.v.after-timing) + $(HIDE)rm -f $(VOFILES:.vo=.v.timing.diff) + $(HIDE)rm -f .lia.cache .nia.cache +.PHONY: cleanall + +archclean:: + @# Extension point + $(SHOW)'CLEAN *.cmx *.o' + $(HIDE)rm -f $(NATIVEFILES) + $(HIDE)rm -f $(CMOFILES:%.cmo=%.cmx) +.PHONY: archclean + + +# Compilation rules ########################################################### + +$(MLIFILES:.mli=.cmi): %.cmi: %.mli + $(SHOW)'CAMLC -c $<' + $(HIDE)$(TIMER) $(CAMLC) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) $< + +$(MLGFILES:.mlg=.ml): %.ml: %.mlg + $(SHOW)'COQPP $<' + $(HIDE)$(COQPP) $< + +# Stupid hack around a deficient syntax: we cannot concatenate two expansions +$(filter %.cmo, $(MLFILES:.ml=.cmo) $(MLGFILES:.mlg=.cmo)): %.cmo: %.ml + $(SHOW)'CAMLC -c $<' + $(HIDE)$(TIMER) $(CAMLC) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) $< + +# Same hack +$(filter %.cmx, $(MLFILES:.ml=.cmx) $(MLGFILES:.mlg=.cmx)): %.cmx: %.ml + $(SHOW)'CAMLOPT -c $(FOR_PACK) $<' + $(HIDE)$(TIMER) $(CAMLOPTC) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) $(FOR_PACK) $< + + +$(MLLIBFILES:.mllib=.cmxs): %.cmxs: %.cmxa + $(SHOW)'CAMLOPT -shared -o $@' + $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) \ + -linkall -shared -o $@ $< + +$(MLLIBFILES:.mllib=.cma): %.cma: | %.mllib + $(SHOW)'CAMLC -a -o $@' + $(HIDE)$(TIMER) $(CAMLLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) -a -o $@ $^ + +$(MLLIBFILES:.mllib=.cmxa): %.cmxa: | %.mllib + $(SHOW)'CAMLOPT -a -o $@' + $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) -a -o $@ $^ + + +$(MLPACKFILES:.mlpack=.cmxs): %.cmxs: %.cmxa + $(SHOW)'CAMLOPT -shared -o $@' + $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) \ + -shared -linkall -o $@ $< + +$(MLPACKFILES:.mlpack=.cmxa): %.cmxa: %.cmx + $(SHOW)'CAMLOPT -a -o $@' + $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) -a -o $@ $< + +$(MLPACKFILES:.mlpack=.cma): %.cma: %.cmo | %.mlpack + $(SHOW)'CAMLC -a -o $@' + $(HIDE)$(TIMER) $(CAMLLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) -a -o $@ $^ + +$(MLPACKFILES:.mlpack=.cmo): %.cmo: | %.mlpack + $(SHOW)'CAMLC -pack -o $@' + $(HIDE)$(TIMER) $(CAMLLINK) $(CAMLDEBUG) $(CAMLFLAGS) -pack -o $@ $^ + +$(MLPACKFILES:.mlpack=.cmx): %.cmx: | %.mlpack + $(SHOW)'CAMLOPT -pack -o $@' + $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) -pack -o $@ $^ + +# This rule is for _CoqProject with no .mllib nor .mlpack +$(filter-out $(MLLIBFILES:.mllib=.cmxs) $(MLPACKFILES:.mlpack=.cmxs) $(addsuffix .cmxs,$(PACKEDFILES)) $(addsuffix .cmxs,$(LIBEDFILES)),$(MLFILES:.ml=.cmxs) $(MLGFILES:.mlg=.cmxs)): %.cmxs: %.cmx + $(SHOW)'[deprecated,use-mllib-or-mlpack] CAMLOPT -shared -o $@' + $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) \ + -shared -o $@ $< + +ifneq (,$(TIMING)) +TIMING_EXTRA = > $<.$(TIMING_EXT) +else +TIMING_EXTRA = +endif + +$(VOFILES): %.vo: %.v | $(VDFILE) + $(SHOW)COQC $< + $(HIDE)$(TIMER) $(COQC) $(COQDEBUG) $(TIMING_ARG) $(COQFLAGS) $(COQLIBS) $< $(TIMING_EXTRA) +ifeq ($(COQDONATIVE), "yes") + $(SHOW)COQNATIVE $@ + $(HIDE)$(COQNATIVE) $(COQLIBS) $@ +endif + +# FIXME ?merge with .vo / .vio ? +$(GLOBFILES): %.glob: %.v + $(TIMER) $(COQC) $(COQDEBUG) $(COQFLAGS) $(COQLIBS) $< + +$(VFILES:.v=.vio): %.vio: %.v + $(SHOW)COQC -vio $< + $(HIDE)$(TIMER) $(COQC) -vio $(COQDEBUG) $(COQFLAGS) $(COQLIBS) $< + +$(VFILES:.v=.vos): %.vos: %.v + $(SHOW)COQC -vos $< + $(HIDE)$(TIMER) $(COQC) -vos $(COQDEBUG) $(COQFLAGS) $(COQLIBS) $< + +$(VFILES:.v=.vok): %.vok: %.v + $(SHOW)COQC -vok $< + $(HIDE)$(TIMER) $(COQC) -vok $(COQDEBUG) $(COQFLAGS) $(COQLIBS) $< + +$(addsuffix .timing.diff,$(VFILES)): %.timing.diff : %.before-timing %.after-timing + $(SHOW)PYTHON TIMING-DIFF $*.{before,after}-timing + $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" print-pretty-single-time-diff BEFORE=$*.before-timing AFTER=$*.after-timing TIME_OF_PRETTY_BUILD_FILE="$@" + +$(BEAUTYFILES): %.v.beautified: %.v + $(SHOW)'BEAUTIFY $<' + $(HIDE)$(TIMER) $(COQC) $(COQDEBUG) $(COQFLAGS) $(COQLIBS) -beautify $< + +$(TEXFILES): %.tex: %.v + $(SHOW)'COQDOC -latex $<' + $(HIDE)$(COQDOC) $(COQDOCFLAGS) -latex $< -o $@ + +$(GTEXFILES): %.g.tex: %.v + $(SHOW)'COQDOC -latex -g $<' + $(HIDE)$(COQDOC) $(COQDOCFLAGS) -latex -g $< -o $@ + +$(HTMLFILES): %.html: %.v %.glob + $(SHOW)'COQDOC -html $<' + $(HIDE)$(COQDOC) $(COQDOCFLAGS) -html $< -o $@ + +$(GHTMLFILES): %.g.html: %.v %.glob + $(SHOW)'COQDOC -html -g $<' + $(HIDE)$(COQDOC) $(COQDOCFLAGS) -html -g $< -o $@ + +# Dependency files ############################################################ + +ifndef MAKECMDGOALS + -include $(ALLDFILES) +else + ifneq ($(filter-out archclean clean cleanall printenv make-pretty-timed make-pretty-timed-before make-pretty-timed-after print-pretty-timed print-pretty-timed-diff print-pretty-single-time-diff,$(MAKECMDGOALS)),) + -include $(ALLDFILES) + endif +endif + +.SECONDARY: $(ALLDFILES) + +redir_if_ok = > "$@" || ( RV=$$?; rm -f "$@"; exit $$RV ) + +GENMLFILES:=$(MLGFILES:.mlg=.ml) +$(addsuffix .d,$(ALLSRCFILES)): $(GENMLFILES) + +$(addsuffix .d,$(MLIFILES)): %.mli.d: %.mli + $(SHOW)'CAMLDEP $<' + $(HIDE)$(CAMLDEP) $(OCAMLLIBS) "$<" $(redir_if_ok) + +$(addsuffix .d,$(MLGFILES)): %.mlg.d: %.ml + $(SHOW)'CAMLDEP $<' + $(HIDE)$(CAMLDEP) $(OCAMLLIBS) "$<" $(redir_if_ok) + +$(addsuffix .d,$(MLFILES)): %.ml.d: %.ml + $(SHOW)'CAMLDEP $<' + $(HIDE)$(CAMLDEP) $(OCAMLLIBS) "$<" $(redir_if_ok) + +$(addsuffix .d,$(MLLIBFILES)): %.mllib.d: %.mllib + $(SHOW)'OCAMLLIBDEP $<' + $(HIDE)$(OCAMLLIBDEP) -c $(OCAMLLIBS) "$<" $(redir_if_ok) + +$(addsuffix .d,$(MLPACKFILES)): %.mlpack.d: %.mlpack + $(SHOW)'OCAMLLIBDEP $<' + $(HIDE)$(OCAMLLIBDEP) -c $(OCAMLLIBS) "$<" $(redir_if_ok) + +# If this makefile is created using a _CoqProject we have coqdep get +# options from it. This avoids argument length limits for pathological +# projects. Note that extra options might be on the command line. +VDFILE_FLAGS:=$(if _CoqProject,-f _CoqProject,) $(CMDLINE_COQLIBS) $(CMDLINE_VFILES) + +$(VDFILE): _CoqProject $(VFILES) + $(SHOW)'COQDEP VFILES' + $(HIDE)$(COQDEP) -vos -dyndep var $(VDFILE_FLAGS) $(redir_if_ok) + +# Misc ######################################################################## + +byte: + $(HIDE)$(MAKE) all "OPT:=-byte" -f "$(SELF)" +.PHONY: byte + +opt: + $(HIDE)$(MAKE) all "OPT:=-opt" -f "$(SELF)" +.PHONY: opt + +# This is deprecated. To extend this makefile use +# extension points and Makefile.local +printenv:: + $(warning printenv is deprecated) + $(warning write extensions in Makefile.local or include Makefile.conf) + @echo 'COQLIB = $(COQLIB)' + @echo 'COQCORELIB = $(COQCORELIB)' + @echo 'DOCDIR = $(DOCDIR)' + @echo 'OCAMLFIND = $(OCAMLFIND)' + @echo 'HASNATDYNLINK = $(HASNATDYNLINK)' + @echo 'SRC_SUBDIRS = $(SRC_SUBDIRS)' + @echo 'COQ_SRC_SUBDIRS = $(COQ_SRC_SUBDIRS)' + @echo 'COQCORE_SRC_SUBDIRS = $(COQCORE_SRC_SUBDIRS)' + @echo 'OCAMLFIND = $(OCAMLFIND)' + @echo 'PP = $(PP)' + @echo 'COQFLAGS = $(COQFLAGS)' + @echo 'COQLIB = $(COQLIBS)' + @echo 'COQLIBINSTALL = $(COQLIBINSTALL)' + @echo 'COQDOCINSTALL = $(COQDOCINSTALL)' +.PHONY: printenv + +# Generate a .merlin file. If you need to append directives to this +# file you can extend the merlin-hook target in Makefile.local +.merlin: + $(SHOW)'FILL .merlin' + $(HIDE)echo 'FLG $(COQMF_CAMLFLAGS)' > .merlin + $(HIDE)echo 'B $(COQCORELIB)' >> .merlin + $(HIDE)echo 'S $(COQCORELIB)' >> .merlin + $(HIDE)$(foreach d,$(COQCORE_SRC_SUBDIRS), \ + echo 'B $(COQCORELIB)$(d)' >> .merlin;) + $(HIDE)$(foreach d,$(COQ_SRC_SUBDIRS), \ + echo 'S $(COQLIB)$(d)' >> .merlin;) + $(HIDE)$(foreach d,$(SRC_SUBDIRS), echo 'B $(d)' >> .merlin;) + $(HIDE)$(foreach d,$(SRC_SUBDIRS), echo 'S $(d)' >> .merlin;) + $(HIDE)$(MAKE) merlin-hook -f "$(SELF)" +.PHONY: merlin + +merlin-hook:: + @# Extension point +.PHONY: merlin-hook + +# prints all variables +debug: + $(foreach v,\ + $(sort $(filter-out $(INITIAL_VARS) INITIAL_VARS,\ + $(.VARIABLES))),\ + $(info $(v) = $($(v)))) +.PHONY: debug + +.DEFAULT_GOAL := all + +# Users can create Makefile.local-late to hook into double-colon rules +# or add other needed Makefile code, using defined +# variables if necessary. +-include Makefile.local-late + +# Local Variables: +# mode: makefile-gmake +# End: diff --git a/ovn/proofs/ssprove/extraction/Makefile.conf b/ovn/proofs/ssprove/extraction/Makefile.conf new file mode 100644 index 0000000..a49bc34 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Makefile.conf @@ -0,0 +1,63 @@ +# This configuration file was generated by running: +# coq_makefile -f _CoqProject -o Makefile + + +############################################################################### +# # +# Project files. # +# # +############################################################################### + +COQMF_VFILES = Hacspec_lib.v Core.v Hacspec_ovn.v +COQMF_MLIFILES = +COQMF_MLFILES = +COQMF_MLGFILES = +COQMF_MLPACKFILES = +COQMF_MLLIBFILES = +COQMF_CMDLINE_VFILES = + +############################################################################### +# # +# Path directives (-I, -R, -Q). # +# # +############################################################################### + +COQMF_OCAMLLIBS = +COQMF_SRC_SUBDIRS = +COQMF_COQLIBS = -R . Examples +COQMF_COQLIBS_NOML = -R . Examples +COQMF_CMDLINE_COQLIBS = + +############################################################################### +# # +# Coq configuration. # +# # +############################################################################### + +COQMF_COQLIB=/home/au538501/.opam/hacspec_ssprove/lib/coq/ +COQMF_COQCORELIB=/home/au538501/.opam/hacspec_ssprove/lib/coq/../coq-core/ +COQMF_DOCDIR=/home/au538501/.opam/hacspec_ssprove/doc/coq/ +COQMF_OCAMLFIND=/home/au538501/.opam/hacspec_ssprove/bin/ocamlfind +COQMF_CAMLFLAGS=-thread -rectypes -w -a+1..3-4+5..8-9+10..26-27+28..40-41-42+43-44-45+46..47-48+49..57-58+59..66-67-68+69-70 -safe-string -strict-sequence +COQMF_WARN=-warn-error +a-3 +COQMF_HASNATDYNLINK=true +COQMF_COQ_SRC_SUBDIRS=boot config lib clib kernel library engine pretyping interp gramlib parsing proofs tactics toplevel printing ide stm vernac plugins/btauto plugins/cc plugins/derive plugins/extraction plugins/firstorder plugins/funind plugins/ltac plugins/ltac2 plugins/micromega plugins/nsatz plugins/ring plugins/rtauto plugins/ssr plugins/ssrmatching plugins/syntax +COQMF_COQ_NATIVE_COMPILER_DEFAULT=no +COQMF_WINDRIVE= + +############################################################################### +# # +# Native compiler. # +# # +############################################################################### + +COQMF_COQPROJECTNATIVEFLAG = + +############################################################################### +# # +# Extra variables. # +# # +############################################################################### + +COQMF_OTHERFLAGS = '-w' 'all' +COQMF_INSTALLCOQDOCROOT = Examples diff --git a/ovn/proofs/ssprove/extraction/_CoqProject b/ovn/proofs/ssprove/extraction/_CoqProject new file mode 100644 index 0000000..1a474b8 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/_CoqProject @@ -0,0 +1,7 @@ +-R . Examples +-arg -w +-arg all + +Hacspec_lib.v +Core.v +Hacspec_ovn.v diff --git a/ovn/proofs/ssprove/extraction/ovn_by_hand.v b/ovn/proofs/ssprove/extraction/ovn_by_hand.v new file mode 100644 index 0000000..caafaea --- /dev/null +++ b/ovn/proofs/ssprove/extraction/ovn_by_hand.v @@ -0,0 +1,211 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +(*Not implemented yet? todo(item)*) + +Require Import Core. (* as TryFrom *) + +Require Import Core. (* as mem *) + +Require Import Hacspec_lib. + +Class t_Hasher (Self : choice_type) := { + t_Hash : choice_type ; + t_Hash_t_TryFrom :> t_TryFrom (t_Hash) ; + t_Hash_t_Into :> t_Into (t_Hash) ; + t_Hash_t_PartialEq :> t_PartialEq (t_Hash) ; + t_Hash_t_Copy :> t_Copy (t_Hash) ; + t_Hash_t_Clone :> t_Clone (t_Hash) ; + t_Hash_t_Sized :> t_Sized (t_Hash) ; + hash : seq int8 -> t_Hash ; + concat_and_hash : t_Hash -> t_Option (t_Hash) -> t_Hash ; + hash_size : uint_size ; +}. + +Definition t_PartialTreeLayer (H : _) : choice_type := + t_Vec ((uint_size × H)) (t_Global). + +Definition t_PartialTree (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} : choice_type := t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global). +Definition Build_PartialTree {L I} {T : _} `{ t_Sized (T)} `{ t_Hasher (T)} {f_layers : both L I (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global))} : both L I (t_PartialTree _) := f_layers. + +Program Definition is_left_index {L1 : {fset Location}} {I1 : Interface} (index : both L1 I1 (uint_size)) : both (L1) (I1) ('bool) := + (index .% i32(2)) =.? i32(0). +Fail Next Obligation. + +Program Definition get_sibling_index {L1 : {fset Location}} {I1 : Interface} (index : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := + ifb is_left_index index + then index .+ i32(1) + else index .- i32(1). +Fail Next Obligation. + +Definition height_loc : Location := + (int32 ; 0%nat). +Program Definition tree_depth {L1 : {fset Location}} {I1 : Interface} (leaves_count : both L1 I1 (uint_size)) : both (L1 :|: fset [height_loc]) (I1) (uint_size) := + letbm height loc(height_loc) := (i32(0)) : both _ _ (int32) in + letbm height loc(height_loc) := (ifb leaves_count =.? i32(1) + then letb height := (i32(1)) : both _ _ (int32) in + height + else letb height := (ilog2 leaves_count) : both _ _ (int32) in + height) : both _ _ (int32) in + (cast_int height). +Fail Next Obligation. + +Program Definition parent_index {L1 : {fset Location}} {I1 : Interface} (index : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := + ifb is_left_index index + then index ./ i32(2) + else (get_sibling_index index) ./ i32(2). +Fail Next Obligation. + +Definition parents_loc : Location := + (t_Vec (uint_size) (t_Global) ; 1%nat). +Program Definition parent_indices {L1 : {fset Location}} {I1 : Interface} (indices : both L1 I1 (seq uint_size)) : both (L1 :|: fset [parents_loc]) (I1) (t_Vec (uint_size) (t_Global)) := + letbm parents loc(parents_loc) := (collect (map (cloned (iter indices)) parent_index)) : both _ _ (t_Vec (uint_size) (t_Global)) in + letb parents := (dedup parents) : both _ _ (t_Vec (uint_size) (t_Global)) in + parents. +Fail Next Obligation. + +Definition t_ErrorKind : choice_type := chFin (mkpos 5). +Definition ErrorKind_SerializedProofSizeIsIncorrect {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=0) eq_refl : t_ErrorKind). +Definition ErrorKind_NotEnoughHelperNodes {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=1) eq_refl : t_ErrorKind). +Definition ErrorKind_HashConversionError {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=2) eq_refl : t_ErrorKind). +Definition ErrorKind_NotEnoughHashesToCalculateRoot {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=3) eq_refl : t_ErrorKind). +Definition ErrorKind_LeavesIndicesCountMismatch {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=4) eq_refl : t_ErrorKind). + +Definition t_Error : choice_type := t_ErrorKind. +Definition Build_Error {L I} : both L I t_ErrorKind -> both L I t_Error := + fun x => x. + +Program Definition new_under_impl {L1 : {fset Location}} {I1 : Interface} (kind : both L1 I1 (t_ErrorKind)) : both (L1) (I1) (t_Error) := + Build_Error kind. +Fail Next Obligation. + +Program Definition not_enough_helper_nodes_under_impl : both (fset []) ([interface ]) (t_Error) := + new_under_impl ErrorKind_NotEnoughHelperNodes. +Fail Next Obligation. + +Program Definition new_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} : both (fset []) ([interface ]) (t_PartialTree (T)) := + Build_PartialTree new_under_impl. +Fail Next Obligation. + +Program Definition from_leaves_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} {L1 : {fset Location}} {I1 : Interface} (leaves : both L1 I1 (seq t_Hash)) : both (L1 :|: fset [current_layer_loc;nodes_loc;partial_tree_loc;reversed_layers_loc;parents_loc;height_loc]) (I1) (t_Result (t_PartialTree (T)) (t_Error)) := + letb leaf_tuples := (collect (enumerate (cloned (iter_under_impl leaves)))) : both _ _ (t_Vec ((uint_size × t_Hash)) (t_Global)) in + build_under_impl_1 (into_vec_under_impl (unsize box_new)) (tree_depth (len_under_impl leaves)). +Fail Next Obligation. + +Program Definition build_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (partial_layers : both L1 I1 (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global))) (depth : both L2 I2 (uint_size)) : both (L1:|:L2 :|: fset [current_layer_loc;nodes_loc;partial_tree_loc;reversed_layers_loc;parents_loc]) (I1:|:I2) (t_Result (t_PartialTree (T)) (t_Error)) := + run (letb layers := (match branch (build_tree_under_impl_1 partial_layers depth) with + | ControlFlow_Break residual => letb hoist1 := (v_Break (from_residual residual)) : both _ _ (t_Never) in + ControlFlow_Continue (never_to_any hoist1) + | ControlFlow_Continue val => ControlFlow_Continue val + end) : both _ _ (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global)) in + ControlFlow_Continue (Result_Ok (Build_PartialTree layers))). +Fail Next Obligation. + +Definition reversed_layers_loc : Location := + (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global) ; 5%nat). +Definition partial_tree_loc : Location := + (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global) ; 4%nat). +Definition nodes_loc : Location := + (t_Vec ((uint_size × t_Hash)) (t_Global) ; 3%nat). +Definition current_layer_loc : Location := + (t_Vec ((uint_size × t_Hash)) (t_Global) ; 2%nat). +Program Definition build_tree_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (partial_layers : both L1 I1 (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global))) (full_tree_depth : both L2 I2 (uint_size)) : both (L1:|:L2 :|: fset [current_layer_loc;nodes_loc;partial_tree_loc;reversed_layers_loc;parents_loc]) (I1:|:I2) (t_Result (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global)) (t_Error)) := + letbm partial_tree loc(partial_tree_loc) := (new_under_impl) : both _ _ (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global)) in + letbm current_layer loc(current_layer_loc) := (new_under_impl) : both _ _ (t_Vec ((uint_size × t_Hash)) (t_Global)) in + letb '(todo_fresh_var,partial_layers_temp) := (drain_under_impl_1 partial_layers RangeFull) : both _ _ ((t_Drain (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global) × t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global))) in + letb partial_layers := (partial_layers_temp) : both _ _ (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global)) in + letb hoist2 := (todo_fresh_var) : both _ _ (t_Drain (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global)) in + letb hoist3 := (rev hoist2) : both _ _ (t_Rev (t_Drain (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global))) in + letbm reversed_layers loc(reversed_layers_loc) := (collect hoist3) : both _ _ (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global)) in + letb '(current_layer,partial_tree,reversed_layers) := (foldi_both (into_iter (Build_Range i32(0)full_tree_depth)) (fun {L I _ _} =>fun _ => + (ssp (fun '(current_layer,partial_tree,reversed_layers) => + letb '(todo_fresh_var,reversed_layers_temp) := (pop_under_impl_1 reversed_layers) : both _ _ ((t_Option (t_Vec ((uint_size × t_Hash)) (t_Global)) × t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global))) in + letb reversed_layers := (reversed_layers_temp) : both _ _ (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global)) in + letb hoist4 := (todo_fresh_var) : both _ _ (t_Option (t_Vec ((uint_size × t_Hash)) (t_Global))) in + letb current_layer := (match hoist4 with + | Option_Some nodes => letb '(current_layer_temp,nodes_temp) := (append_under_impl_1 current_layer nodes) : both _ _ ((t_Vec ((uint_size × t_Hash)) (t_Global) × t_Vec ((uint_size × t_Hash)) (t_Global))) in + letb current_layer := (current_layer_temp) : both _ _ (t_Vec ((uint_size × t_Hash)) (t_Global)) in + letb nodes := (nodes_temp) : both _ _ (t_Vec ((uint_size × t_Hash)) (t_Global)) in + letb _ := (tt) : both _ _ (unit) in + current_layer + | _ => current_layer + end) : both _ _ (t_Vec ((uint_size × t_Hash)) (t_Global)) in + letb partial_tree := (push_under_impl_1 partial_tree (clone current_layer)) : both _ _ (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global)) in + letb '(todo_fresh_var,current_layer_temp) := (drain_under_impl_1 current_layer RangeFull) : both _ _ ((t_Drain ((uint_size × t_Hash)) (t_Global) × t_Vec ((uint_size × t_Hash)) (t_Global))) in + letb current_layer := (current_layer_temp) : both _ _ (t_Vec ((uint_size × t_Hash)) (t_Global)) in + letb hoist5 := (todo_fresh_var) : both _ _ (t_Drain ((uint_size × t_Hash)) (t_Global)) in + letb '(indices,nodes) := (unzip hoist5) : both _ _ ((t_Vec (uint_size) (t_Global) × t_Vec (t_Hash) (t_Global))) in + letb parent_layer_indices := (parent_indices (deref indices)) : both _ _ (t_Vec (uint_size) (t_Global)) in + letb current_layer := (foldi_both (into_iter (enumerate (iter_under_impl (deref parent_layer_indices)))) (fun {L I _ _} =>fun '(i,parent_node_index) => + (ssp (fun current_layer => + match get_under_impl (deref nodes) (i .* i32(2)) with + | Option_Some left_node => ControlFlow_Continue (push_under_impl_1 current_layer prod_b(parent_node_index,concat_and_hash left_node (get_under_impl (deref nodes) ((i .* i32(2)) .+ i32(1))))) + | Option_None => letb hoist6 := (v_Break (Result_Err not_enough_helper_nodes_under_impl)) : both _ _ (t_Never) in + ControlFlow_Continue (letb 'tt := (never_to_any hoist6) : both _ _ (unit) in + current_layer) + end) )) current_layer) : both _ _ (t_Vec ((uint_size × t_Hash)) (t_Global)) in + prod_b(current_layer,partial_tree,reversed_layers)) )) prod_b(current_layer,partial_tree,reversed_layers)) : both _ _ ((t_Vec ((uint_size × t_Hash)) (t_Global) × t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global) × t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global))) in + letb partial_tree := (push_under_impl_1 partial_tree (clone current_layer)) : both _ _ (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global)) in + Result_Ok partial_tree. +Fail Next Obligation. + +Program Definition depth_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_PartialTree (T))) : both (L1) (I1) (uint_size) := + (len_under_impl_1 (f_layers self)) .- i32(1). +Fail Next Obligation. + +Definition temp_loc : Location := + (t_IntoIter ((uint_size × t_Hash)) (t_Global) ; 6%nat). +Program Definition contains_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_PartialTree (T))) (layer_index : both L2 I2 (uint_size)) (node_index : both L3 I3 (uint_size)) : both (L1:|:L2:|:L3 :|: fset [temp_loc]) (I1:|:I2:|:I3) ('bool) := + match get_under_impl (layers_under_impl_1 self) layer_index with + | Option_Some layer => letbm temp loc(temp_loc) := (into_iter (clone layer)) : both _ _ (t_IntoIter) in + letb '(todo_fresh_var,temp_temp) := (any temp (fun '(index,_) => + index =.? node_index)) : both _ _ (('bool × t_IntoIter ((uint_size × t_Hash)) (t_Global))) in + letb temp := (temp_temp) : both _ _ (t_IntoIter ((uint_size × t_Hash)) (t_Global)) in + todo_fresh_var + | Option_None => false + end. +Fail Next Obligation. + +Program Definition upsert_layer_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_PartialTree (T))) (layer_index : both L2 I2 (uint_size)) (new_layer : both L3 I3 (t_Vec ((uint_size × t_Hash)) (t_Global))) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (unit) := + match get_under_impl (deref (f_layers self)) layer_index with + | Option_Some layer => tt + | Option_None => tt + end. +Fail Next Obligation. + +Program Definition layer_nodes_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_PartialTree (T))) : both (L1) (I1) (t_Vec (t_Vec (t_Hash) (t_Global)) (t_Global)) := + letb hashes := (collect (map (iter_under_impl (layers_under_impl_1 self)) (fun layer => + collect (map (cloned (iter_under_impl (deref layer))) (fun '(_,hash) => + hash))))) : both _ _ (t_Vec (t_Vec (t_Hash) (t_Global)) (t_Global)) in + hashes. +Fail Next Obligation. + +Program Definition layers_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_PartialTree (T))) : both (L1) (I1) (seq t_Vec ((uint_size × t_Hash)) (t_Global)) := + deref (f_layers self). +Fail Next Obligation. + +Program Definition clear_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_PartialTree (T))) : both (L1) (I1) (unit) := + tt. +Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/ovn_helpers.txt b/ovn/proofs/ssprove/extraction/ovn_helpers.txt new file mode 100644 index 0000000..384d03a --- /dev/null +++ b/ovn/proofs/ssprove/extraction/ovn_helpers.txt @@ -0,0 +1,40 @@ +Class t_TryFrom (A : choice_type) := TryFrom : A -> A. +Class t_Into (A : choice_type) := Into : A -> A. +Class t_PartialEq (A : choice_type) := PartialEq : A -> A. +Class t_Copy (A : choice_type) := Copy : A -> A. +Class t_Clone (A : choice_type) := Clone : A -> A. +Class t_Sized (A : choice_type) := Sized : A -> A. +Axiom seq : choice_type -> choice_type. +Axiom int8 : choice_type. +Axiom t_Option : choice_type -> choice_type. +Axiom uint_size : choice_type. +Inductive vec_typ := +| t_Global. +Axiom t_Vec : choice_type -> vec_typ -> choice_type. +Class t_Default A := { default : A }. + + +Class t_Hasher `{t_TryFrom} `{t_Into} `{t_PartialEq} `{t_Copy} `{t_Clone} := { + t_temp_hash : choice_type ; + t_Hash `{t_TryFrom} `{t_Into} `{t_PartialEq} `{t_Copy} `{t_Clone} : choice_type ; + hash : seq int8 -> t_temp_hash ; + concat_and_hash : t_Hash -> t_Option (t_Hash) -> t_Hash ; + hash_size : uint_size ; +}. + +Notation t_PartialTreeLayer := (fun (H : choice_type) => (t_Vec ((uint_size * H)) (t_Global))). + +Record t_PartialTree `{T : t_Hasher} : choice_type :={ + f_layers : t_Vec (t_Vec ((uint_size * t_Hash)) (t_Global)) (t_Global); +}. +Definition new `{T : t_Hasher} : t_Vec (t_Vec ((uint_size * t_Hash)) (t_Global)) (t_Global). Admitted. + +Require Import Coq.Program.Tactics. +Check Build_t_PartialTree. +Program Definition new_under_impl `{T : t_Hasher} : (t_PartialTree) := + {| f_layers := new |}. +Fail Next Obligation. + +#[local] Instance t_PartialTree_t_Default `{T : t_Hasher} : t_Default t_PartialTree := {| + default := new_under_impl; +|}. diff --git a/ovn/src/Schnorr.rs b/ovn/src/Schnorr.rs new file mode 100644 index 0000000..e69de29 diff --git a/ovn/src/ovn.rs b/ovn/src/ovn.rs index a151bd1..d47b836 100644 --- a/ovn/src/ovn.rs +++ b/ovn/src/ovn.rs @@ -1,8 +1,141 @@ use hacspec_lib::*; -pub trait Hasher: Clone { - type Hash: Copy + PartialEq + Into> + TryFrom>; - fn hash(data: &[u8]) -> Self::Hash; - fn concat_and_hash(left: &Self::Hash, right: Option<&Self::Hash>) -> Self::Hash; - fn hash_size() -> usize ; +mod schnorr; + +use schnorr::{random_oracle::sample_uniform, *}; + +// (Exec_i i j m) ∘ (par ((P_i i b) ∘ (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) + +// Init, construct, vote: +// +// Definition P_i (i : pid) (b : bool): +// package (P_i_locs i) +// Sigma1_I +// P_i_E := +// [package +// #def #[ INIT ] (_ : 'unit) : 'public_key +// { +// #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; +// #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; +// x ← sample uniform i_secret ;; +// #put (skey_loc i) := x ;; +// let y := (fto (g ^+ (otf x))) : public in +// zkp ← ZKP (y, x) ;; +// ret (y, zkp) +// } +// ; +// #def #[ CONSTRUCT ] (m : 'public_keys) : 'unit +// { +// #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; +// #assert (size (domm m) == n) ;; +// let key := fto (compute_key m i) in +// #put (ckey_loc i) := key ;; +// @ret 'unit Datatypes.tt +// } +// ; +// #def #[ VOTE ] (v : 'bool) : 'public +// { +// skey ← get (skey_loc i) ;; +// ckey ← get (ckey_loc i) ;; +// if b then +// let vote := (otf ckey ^+ skey * g ^+ v) in +// @ret 'public (fto vote) +// else +// let vote := (otf ckey ^+ skey * g ^+ (negb v)) in +// @ret 'public (fto vote) +// } +// ]. + +type public = schnorr::random_oracle::Q; +type public_key = (public, schnorr::Transcript); +fn p_i_init(_: ()) -> public_key { + // #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; + // #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; + // x ← sample uniform i_secret ;; + let x = schnorr::random_oracle::sample_uniform(); + // #put (skey_loc i) := x ;; + // let y := (fto (g ^+ (otf x))) : public in + let y = public::ONE(); + // zkp ← ZKP (y, x) ;; + let zkp = schnorr::fiat_shamir_run((x, y)); // should be (y, x) + // ret (y, zkp) + (y, zkp) +} + +// fn compute_key (m : chMap pid (chProd public choiceTranscript1), i : pid) { +// let low := \prod_(k <- domm m | (k < i)%ord) (get_value m k); +// let high := \prod_(k <- domm m | (i < k)%ord) (get_value m k); +// low * invg high +// } + +// Order of G +public_nat_mod!( //Custom Macro - defining a newtype with some functions - well defined macro's have library functions built in + type_name: N, + type_of_canvas: NCanvas, + bit_size_of_field: 384, //381 with 3 extra bits + modulo_value: "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" //0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab +); + +type pid = N; +use std::collections::HashMap; + +type public_keys = HashMap; // TODO +fn p_i_construct(m: public_keys) -> () { + // #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; + // #assert (size (domm m) == n) ;; + // let key := fto (compute_key m i) in + // #put (ckey_loc i) := key ;; + // @ret 'unit Datatypes.tt + () +} + +fn p_i_vote(v: bool) -> public { + // skey ← get (skey_loc i) ;; + // ckey ← get (ckey_loc i) ;; + // if b then + // let vote := (otf ckey ^+ skey * g ^+ v) in + // @ret 'public (fto vote) + // else + // let vote := (otf ckey ^+ skey * g ^+ (negb v)) in + // @ret 'public (fto vote) + public::ONE() +} + +// Exec_i +// [package +// #def #[ Exec i ] (v : 'bool) : 'public +// { +// #import {sig #[ INIT ] : 'unit → 'public_key} as Init ;; +// #import {sig #[ CONSTRUCT ] : 'public_keys → 'unit} as Construct ;; +// #import {sig #[ VOTE ] : 'bool → 'public} as Vote ;; +// #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; +// pk ← Init Datatypes.tt ;; +// x ← sample uniform i_secret ;; +// let y := (fto (g ^+ (otf x))) : public in +// zkp ← ZKP (y, x) ;; +// let m' := setm (setm m j (y, zkp)) i pk in +// Construct m' ;; +// vote ← Vote v ;; +// @ret 'public vote +// } +// ] + +fn exec(v : bool) -> public { + // #import {sig #[ INIT ] : 'unit → 'public_key} as Init ;; + // #import {sig #[ CONSTRUCT ] : 'public_keys → 'unit} as Construct ;; + // #import {sig #[ VOTE ] : 'bool → 'public} as Vote ;; + // #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; + // pk ← Init Datatypes.tt ;; + // x ← sample uniform i_secret ;; + let x = random_oracle::sample_uniform(); + // let y := (fto (g ^+ (otf x))) : public in + let y = public::ONE(); + // zkp ← ZKP (y, x) ;; + let zkp = schnorr::fiat_shamir_run((x, y)); + // let m' := setm (setm m j (y, zkp)) i pk in + // Construct m' ;; + // vote ← Vote v ;; + let vote = p_i_vote (v); + // @ret 'public vote + vote } diff --git a/ovn/src/ovn_old.rs b/ovn/src/ovn_old.rs new file mode 100644 index 0000000..d29f4df --- /dev/null +++ b/ovn/src/ovn_old.rs @@ -0,0 +1,284 @@ + +// // use crate::prelude::*; +// use core::convert::TryFrom; +// use core::mem; +// use hacspec_lib::*; + +// pub trait Hasher: Clone { +// type Hash: Copy + PartialEq + Into> + TryFrom>; +// fn hash(data: &[u8]) -> Self::Hash; +// fn concat_and_hash(left: &Self::Hash, right: Option<&Self::Hash>) -> Self::Hash; +// fn hash_size() -> usize; +// } + +// // let mut concatenated: Vec = (*left).into(); + +// // match right { +// // Some(right_node) => { +// // let mut right_node_clone: Vec = (*right_node).into(); +// // concatenated.append(&mut right_node_clone); +// // Self::hash(&concatenated) +// // } +// // None => *left, +// // } + +// type PartialTreeLayer = Vec<(usize, H)>; + +// #[derive(Clone)] +// pub struct PartialTree { +// layers: Vec>, +// } + +// /////////// +// // Utils // +// /////////// +// pub fn is_left_index(index: usize) -> bool { +// index % 2 == 0 +// } + +// pub fn get_sibling_index(index: usize) -> usize { +// if is_left_index(index) { +// // Right sibling index +// index + 1 +// } +// // Left sibling index +// else { +// index - 1 +// } +// } + +// /// Rewritten tree_depth method to no longer make use of floats +// pub fn tree_depth(leaves_count: usize) -> usize { +// let mut height = 0; +// if leaves_count == 1 { +// height = 1; +// } +// else { +// height = usize::ilog2(leaves_count); +// } +// height as usize +// // for i in 1..65usize { +// // if leaves_count <= usize::pow(2, i as u32) { +// // height = i; +// // return height; +// // } +// // } +// // height +// } + +// pub fn parent_index(index: usize) -> usize { +// if is_left_index(index) { +// index / 2 +// } +// else { +// get_sibling_index(index) / 2 +// } +// } + +// pub fn parent_indices(indices: &[usize]) -> Vec { +// let mut parents: Vec = indices.iter().cloned().map(parent_index).collect(); +// parents.dedup(); +// parents +// } + +// /////////// +// // Error // +// /////////// +// #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] +// #[non_exhaustive] +// pub enum ErrorKind { +// /// Serialized to bytes merkle proof can't be parsed because it can not be divided +// SerializedProofSizeIsIncorrect, +// /// Not enough helper nodes to calculate the root was passed to the [`PartialTree`]. +// /// +// /// [`PartialTree`]: crate::PartialTree +// NotEnoughHelperNodes, +// HashConversionError, +// NotEnoughHashesToCalculateRoot, +// LeavesIndicesCountMismatch, +// } + +// #[derive(Clone, Debug)] +// pub struct Error { +// kind: ErrorKind, +// } + +// impl Error { +// pub fn new(kind: ErrorKind) -> Self { +// Self { kind } +// } + +// pub fn not_enough_helper_nodes() -> Self { +// Self::new( +// ErrorKind::NotEnoughHelperNodes +// ) +// } +// } + +// impl PartialTree { +// /// Takes leaves (item hashes) as an argument and build a Merkle Tree from them. +// /// Since it's a partial tree, hashes must be accompanied by their index in the original tree. +// pub fn new() -> Self { +// Self { layers: Vec::new() } +// } + +// /// This is a general algorithm for building a partial tree. It can be used to extract root +// /// from merkle proof, or if a complete set of leaves provided as a first argument and no +// /// helper indices given, will construct the whole tree. +// fn build_tree( +// mut partial_layers: Vec>, +// full_tree_depth: usize, +// ) -> Result>, Error> { +// let mut partial_tree: Vec> = Vec::new(); +// let mut current_layer = Vec::new(); + +// // Reversing helper nodes, so we can remove one layer starting from 0 each iteration +// let mut reversed_layers: Vec> = +// partial_layers.drain(..).rev().collect(); + +// // This iterates to full_tree_depth and not to the partial_layers_len because +// // when constructing + +// // It is iterating to full_tree_depth instead of partial_layers.len to address the case +// // of applying changes to a tree when tree requires a resize, and partial layer len +// // in that case going to be lower that the resulting tree depth +// for _ in 0..full_tree_depth { +// // Appending helper nodes to the current known nodes +// if let Some(mut nodes) = reversed_layers.pop() { +// current_layer.append(&mut nodes); +// } +// // current_layer.into_iter().is_sorted_by(|(a, _), (b, _)| a.cmp(b)) +// // current_layer.sort_by(|(a, _), (b, _)| a.cmp(b)); +// // TODO: SORT current_layer without using mutation! + +// // Adding partial layer to the tree +// partial_tree.push(current_layer.clone()); + +// // This empties `current` layer and prepares it to be reused for the next iteration +// let (indices, nodes): (Vec, Vec) = current_layer.drain(..).unzip(); +// let parent_layer_indices = parent_indices(&indices); + +// for (i, parent_node_index) in parent_layer_indices.iter().enumerate() { +// match nodes.get(i * 2) { +// // Populate `current_layer` back for the next iteration +// Some(left_node) => current_layer.push(( +// *parent_node_index, +// T::concat_and_hash(left_node, nodes.get(i * 2 + 1)), +// )), +// None => return Err(Error::not_enough_helper_nodes()), +// } +// } +// } + +// partial_tree.push(current_layer.clone()); + +// Ok(partial_tree) +// } + +// pub fn build(partial_layers: Vec>, depth: usize) -> Result { +// let layers = Self::build_tree(partial_layers, depth)?; +// Ok(Self { layers }) +// } + +// /// This is a helper function to build a full tree from a full set of leaves without any +// /// helper indices +// pub fn from_leaves(leaves: &[T::Hash]) -> Result { +// let leaf_tuples: Vec<(usize, T::Hash)> = leaves.iter().cloned().enumerate().collect(); + +// Self::build(vec![leaf_tuples], tree_depth(leaves.len())) +// } + +// /// Returns how many layers there is between leaves and the root +// pub fn depth(&self) -> usize { +// self.layers.len() - 1 +// } + +// // /// Return the root of the tree +// // pub fn root(&self) -> Option<&T::Hash> { +// // Some(&self.layers.last()?.first()?.1) +// // } + +// pub fn contains(&self, layer_index: usize, node_index: usize) -> bool { +// match self.layers().get(layer_index) { +// Some(layer) => +// {let mut temp = layer.clone().into_iter(); +// temp.any(|(index, _)| index == node_index)} +// None => false, +// } +// } + +// // /// Consumes other partial tree into itself, replacing any conflicting nodes with nodes from +// // /// `other` in the process. Doesn't rehash the nodes, so the integrity of the result is +// // /// not verified. It gives an advantage in speed, but should be used only if the integrity of +// // /// the tree can't be broken, for example, it is used in the `.commit` method of the +// // /// `MerkleTree`, since both partial trees are essentially constructed in place and there's +// // /// no need to verify integrity of the result. +// // pub fn merge_unverified(mut self, other: Self) { +// // // Figure out new tree depth after merge +// // let depth_difference = other.layers().len() - self.layers().len(); +// // let combined_tree_size = if depth_difference > 0 { +// // other.layers().len() +// // } else { +// // self.layers().len() +// // }; + +// // for layer_index in 0..combined_tree_size { +// // let mut combined_layer: Vec<(usize, T::Hash)> = Vec::new(); + +// // if let Some(self_layer) = self.layers().get(layer_index) { +// // let mut filtered_layer: Vec<(usize, T::Hash)> = self_layer +// // .iter() +// // .filter(|(node_index, _)| !other.contains(layer_index, *node_index)) +// // .cloned() +// // .collect(); + +// // combined_layer.append(&mut filtered_layer); +// // } + +// // if let Some(other_layer) = other.layers().get(layer_index) { +// // let mut cloned_other_layer = other_layer.clone(); +// // combined_layer.append(&mut cloned_other_layer); +// // } + +// // // combined_layer.sort_by(|(a, _), (b, _)| a.cmp(b)); +// // // TODO: SORT combined_layer without using mutation! +// // self.upsert_layer(layer_index, combined_layer); +// // } +// // } + +// /// Replace layer at a given index with a new layer. Used during tree merge +// fn upsert_layer(// & +// mut self, layer_index: usize, mut new_layer: Vec<(usize, T::Hash)>) { +// match self.layers.get(layer_index) { +// Some(layer) => { +// // layer.clear(); +// // layer.append(new_layer.as_mut()) +// // TODO: Update layer without mutation! +// } +// None => { // self.layers.push(new_layer) +// } +// } +// } + +// pub fn layer_nodes(&self) -> Vec> { +// let hashes: Vec> = self +// .layers() +// .iter() +// .map(|layer| layer.iter().cloned().map(|(_, hash)| hash).collect()) +// .collect(); + +// hashes +// } + +// /// Returns partial tree layers +// pub fn layers(&self) -> &[Vec<(usize, T::Hash)>] { +// &self.layers +// } + +// /// Clears all elements in the ree +// pub fn clear(// & +// mut self) { +// // self.layers.clear(); +// // TODO: update layer without reference mutation +// } +// } diff --git a/ovn/src/random_oracle.rs b/ovn/src/random_oracle.rs new file mode 100644 index 0000000..e69de29 diff --git a/ovn/src/schnorr.rs b/ovn/src/schnorr.rs new file mode 100644 index 0000000..ba8ab73 --- /dev/null +++ b/ovn/src/schnorr.rs @@ -0,0 +1,109 @@ +use hacspec_lib::*; +use std::collections::HashMap; + +pub mod random_oracle; +// use random_oracle::*; + +pub type Witness = random_oracle::Q; +pub type Statement = random_oracle::G; +pub type Message = random_oracle::G; +pub type Challenge = random_oracle::Q; +pub type Response = random_oracle::G; +// type Transcript = (Message, Challenge, Response); + +// Sigma1.Sigma.RUN and Sigma1.Sigma.VERIFY: (Schnorr, RO (RandomOracle) OracleParams) +// Definition Fiat_Shamir : +// package Sigma_locs +// [interface +// #val #[ INIT ] : 'unit → 'unit ; +// #val #[ QUERY ] : 'query → 'random +// ] +// [interface +// #val #[ VERIFY ] : chTranscript → 'bool ; +// #val #[ RUN ] : chRelation → chTranscript +// ] +// := +// [package +// #def #[ VERIFY ] (t : chTranscript) : 'bool +// { +// #import {sig #[ QUERY ] : 'query → 'random } as RO_query ;; +// let '(h,a,e,z) := t in +// e ← RO_query (prod_assoc (h, a)) ;; +// ret (otf (Verify h a e z)) +// } ; +// #def #[ RUN ] (hw : chRelation) : chTranscript +// { +// #import {sig #[ INIT ] : 'unit → 'unit } as RO_init ;; +// #import {sig #[ QUERY ] : 'query → 'random } as RO_query ;; +// let '(h,w) := hw in +// #assert (R (otf h) (otf w)) ;; +// a ← Commit h w ;; +// RO_init Datatypes.tt ;; +// e ← RO_query (prod_assoc (h, a)) ;; +// z ← Response h w a e ;; +// @ret choiceTranscript (h,a,e,z) +// } +// ]. + +pub type Transcript = (Statement , Message , Challenge , Response); + +fn prod_assoc ((statement, message) : (Statement, Message)) -> random_oracle::Query { + // Proof. + // cbn. intros [statement message]. + // rewrite !card_prod. + // apply mxvec_index. all: assumption. + // Qed. + random_oracle::Query::ONE() +} + +// Verify_schamir +fn verify (h : Statement, a : Message, e : Challenge, z : Response) -> bool { + // fto (g ^+ (otf z) == (otf a) * (otf h) ^+ (otf e)) + false +} + +pub fn fiat_shamir_verify(t : Transcript) -> bool { + let QUERIES = HashMap::new(); + let (h,a,e,z) = t; + let (QUERIES, eu) = random_oracle::random_oracle_query (QUERIES, prod_assoc ((h, a))); + // e <- eu; + // otf ( + verify (h, a, e, z) + // ) +} + +pub type Relation = (Statement, Witness); + +fn Commit (h : Statement, w : Witness) -> Message { + // r ← sample uniform i_witness ;; + let r = random_oracle::sample_uniform(); + // #put commit_loc := r ;; + let mut commit = r; + // ret (fto (g ^+ (otf r))) + Message::ONE() +} + + +fn Response (h : Statement, w : Witness, a : Message, e : Challenge) -> Response { + // r ← get commit_loc ;; + // ret (fto (otf r + otf e * otf w)) + Response::ONE() +} + +pub fn fiat_shamir_run(hw : Relation) -> Transcript { + let QUERIES = HashMap::new(); + // #import {sig #[ INIT ] : 'unit → 'unit } as RO_init ;; + // #import {sig #[ QUERY ] : 'query → 'random } as RO_query ;; + let (h,w) = hw; + // #assert (R (otf h) (otf w)) ;; + let a = Commit(h, w); + // RO_init Datatypes.tt ;; + random_oracle::random_oracle_init(()); + // e ← RO_query (prod_assoc (h, a)) ;; + let (QUERIES, eu) = random_oracle::random_oracle_query(QUERIES, prod_assoc((h, a))); + let e = Challenge::ONE(); // Should be e <- eu + // z ← Response h w a e ;; + let z = Response (h, w, a, e); + // @ret choiceTranscript (h,a,e,z) + (h,a,e,z) +} diff --git a/ovn/src/schnorr/random_oracle.rs b/ovn/src/schnorr/random_oracle.rs new file mode 100644 index 0000000..dcbfa62 --- /dev/null +++ b/ovn/src/schnorr/random_oracle.rs @@ -0,0 +1,72 @@ +use hacspec_lib::*; + +// INIT , QUERY (RO (RandomOracle) OracleParams) +// Definition RO : package RO_locs [interface] RO_exports := +// [package +// #def #[ INIT ] (_ : 'unit) : 'unit +// { +// #put queries_loc := emptym ;; +// ret Datatypes.tt +// } ; +// #def #[ QUERY ] (q : 'query) : 'random +// { +// queries ← get queries_loc ;; +// match queries q with +// | Some r => +// ret r +// | None => +// r ← sample uniform i_random ;; +// #put queries_loc := setm queries q r ;; +// ret r +// end +// } +// ]. + +pub fn random_oracle_init(_ : ()) -> () { + () +} + +public_nat_mod!( //Custom Macro - defining a newtype with some functions - well defined macro's have library functions built in + type_name: G, + type_of_canvas: GCanvas, + bit_size_of_field: 384, //381 with 3 extra bits + modulo_value: "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" //0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab +); + +// Order of G +public_nat_mod!( //Custom Macro - defining a newtype with some functions - well defined macro's have library functions built in + type_name: Q, + type_of_canvas: QCanvas, + bit_size_of_field: 384, //381 with 3 extra bits + modulo_value: "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" //0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab +); + +pub type Random = G; +pub type Query = G; + +pub fn sample_uniform () -> Random { + Random::ONE() +} + +use std::collections::HashMap; + +use std::hash::{Hash, Hasher}; +impl Hash for Query { + fn hash (&self, state: &mut H) { + + } +} + +// static ref QUERIES : HashMap = HashMap::new(); +// chQuery := 'fin #|Query| +// chRandom := 'fin #|Random| +pub fn random_oracle_query(mut QUERIES : HashMap, q : Query) -> (HashMap, Random) { + match QUERIES.get(&q) { + Some (r) => (QUERIES.clone(), r.clone()), + None => { + let r = sample_uniform(); + QUERIES.insert(q, r); + (QUERIES, r) + } + } +} From 6a4d2867f1510b7d528e455a935db6fb8166260a Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 19 Jul 2023 16:06:12 +0200 Subject: [PATCH 03/86] More ovn --- ovn/proofs/ssprove/extraction/.Core.aux | 4 +- .../ssprove/extraction/.Hacspec_lib.aux | 6 +- .../ssprove/extraction/.Hacspec_ovn.aux | 2 +- .../extraction/.Hacspec_ovn_Schnorr.aux | 1 + .../.Hacspec_ovn_Schnorr_Random_oracle.aux | 2 + ovn/proofs/ssprove/extraction/.Makefile.d | 15 +- ovn/proofs/ssprove/extraction/.Std.aux | 2 + ovn/proofs/ssprove/extraction/Core.glob | 150 +- ovn/proofs/ssprove/extraction/Core.v | 21 - ovn/proofs/ssprove/extraction/Core.vo | Bin 199240 -> 172384 bytes ovn/proofs/ssprove/extraction/Hacspec_lib.vo | Bin 123685 -> 123685 bytes .../extraction/Hacspec_ovn.Random_oracle.v | 1834 ---------------- .../Hacspec_ovn.Schnorr.Random_oracle.v | 1838 ----------------- .../ssprove/extraction/Hacspec_ovn.glob | 1104 ---------- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 45 +- .../extraction/Hacspec_ovn_Schnorr.glob | 31 + ...ec_ovn.Schnorr.v => Hacspec_ovn_Schnorr.v} | 58 +- .../Hacspec_ovn_Schnorr_Random_oracle.glob | 247 +++ .../Hacspec_ovn_Schnorr_Random_oracle.v | 78 + .../Hacspec_ovn_Schnorr_Random_oracle.vo | Bin 0 -> 268530 bytes .../Hacspec_ovn_Schnorr_Random_oracle.vok} | 0 .../Hacspec_ovn_Schnorr_Random_oracle.vos} | 0 ovn/proofs/ssprove/extraction/Makefile.conf | 2 +- ovn/proofs/ssprove/extraction/Std.glob | 113 + ovn/proofs/ssprove/extraction/Std.v | 50 + ovn/proofs/ssprove/extraction/Std.vo | Bin 0 -> 50252 bytes ovn/proofs/ssprove/extraction/Std.vok | 0 ovn/proofs/ssprove/extraction/Std.vos | 0 ovn/proofs/ssprove/extraction/_CoqProject | 3 + ovn/src/ovn.rs | 27 +- ovn/src/schnorr.rs | 23 +- ovn/src/schnorr/random_oracle.rs | 56 +- 32 files changed, 666 insertions(+), 5046 deletions(-) create mode 100644 ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr.aux create mode 100644 ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr_Random_oracle.aux create mode 100644 ovn/proofs/ssprove/extraction/.Std.aux delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn.Random_oracle.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn.Schnorr.Random_oracle.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn.glob create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.glob rename ovn/proofs/ssprove/extraction/{Hacspec_ovn.Schnorr.v => Hacspec_ovn_Schnorr.v} (62%) create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.glob create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.vo rename ovn/{src/Schnorr.rs => proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.vok} (100%) rename ovn/{src/random_oracle.rs => proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.vos} (100%) create mode 100644 ovn/proofs/ssprove/extraction/Std.glob create mode 100644 ovn/proofs/ssprove/extraction/Std.v create mode 100644 ovn/proofs/ssprove/extraction/Std.vo create mode 100644 ovn/proofs/ssprove/extraction/Std.vok create mode 100644 ovn/proofs/ssprove/extraction/Std.vos diff --git a/ovn/proofs/ssprove/extraction/.Core.aux b/ovn/proofs/ssprove/extraction/.Core.aux index 2eb7592..3ea5675 100644 --- a/ovn/proofs/ssprove/extraction/.Core.aux +++ b/ovn/proofs/ssprove/extraction/.Core.aux @@ -1,2 +1,2 @@ -COQAUX1 265cab0b506d10f1ada8bbe5826ce1eb /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Core.v -0 0 vo_compile_time "5.626" +COQAUX1 1d70d72b4eae36876b570fe4cf0d5092 /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Core.v +0 0 vo_compile_time "1.845" diff --git a/ovn/proofs/ssprove/extraction/.Hacspec_lib.aux b/ovn/proofs/ssprove/extraction/.Hacspec_lib.aux index 0bbc24b..2093e41 100644 --- a/ovn/proofs/ssprove/extraction/.Hacspec_lib.aux +++ b/ovn/proofs/ssprove/extraction/.Hacspec_lib.aux @@ -1,5 +1,5 @@ COQAUX1 e5f7624baf82764e7a994b8423d3c6dc /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Hacspec_lib.v 0 0 VernacProof "tac:no using:no" -13358 13366 proof_build_time "0.018" -13358 13366 proof_check_time "0.011" -0 0 vo_compile_time "1.195" +13358 13366 proof_build_time "0.010" +13358 13366 proof_check_time "0.006" +0 0 vo_compile_time "1.201" diff --git a/ovn/proofs/ssprove/extraction/.Hacspec_ovn.aux b/ovn/proofs/ssprove/extraction/.Hacspec_ovn.aux index c189c7b..0050d43 100644 --- a/ovn/proofs/ssprove/extraction/.Hacspec_ovn.aux +++ b/ovn/proofs/ssprove/extraction/.Hacspec_ovn.aux @@ -1 +1 @@ -COQAUX1 2601f3a4885d20ca193173741799192e /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +COQAUX1 8595645d12a1833a4ac0bf542319bc07 /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Hacspec_ovn.v diff --git a/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr.aux b/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr.aux new file mode 100644 index 0000000..8736229 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr.aux @@ -0,0 +1 @@ +COQAUX1 41711fa53f537116d9fcaa389f96befd /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v diff --git a/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr_Random_oracle.aux b/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr_Random_oracle.aux new file mode 100644 index 0000000..f25e6e2 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr_Random_oracle.aux @@ -0,0 +1,2 @@ +COQAUX1 ebf35470edb32d87446cf29c011d7916 /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v +0 0 vo_compile_time "2.720" diff --git a/ovn/proofs/ssprove/extraction/.Makefile.d b/ovn/proofs/ssprove/extraction/.Makefile.d index 90e7173..ccaf335 100644 --- a/ovn/proofs/ssprove/extraction/.Makefile.d +++ b/ovn/proofs/ssprove/extraction/.Makefile.d @@ -4,6 +4,15 @@ Hacspec_lib.vos Hacspec_lib.vok Hacspec_lib.required_vos: Hacspec_lib.v Core.vo Core.glob Core.v.beautified Core.required_vo: Core.v Core.vio: Core.v Core.vos Core.vok Core.required_vos: Core.v -Hacspec_ovn.vo Hacspec_ovn.glob Hacspec_ovn.v.beautified Hacspec_ovn.required_vo: Hacspec_ovn.v Core.vo Hacspec_lib.vo -Hacspec_ovn.vio: Hacspec_ovn.v Core.vio Hacspec_lib.vio -Hacspec_ovn.vos Hacspec_ovn.vok Hacspec_ovn.required_vos: Hacspec_ovn.v Core.vos Hacspec_lib.vos +Std.vo Std.glob Std.v.beautified Std.required_vo: Std.v Core.vo +Std.vio: Std.v Core.vio +Std.vos Std.vok Std.required_vos: Std.v Core.vos +Hacspec_ovn_Schnorr_Random_oracle.vo Hacspec_ovn_Schnorr_Random_oracle.glob Hacspec_ovn_Schnorr_Random_oracle.v.beautified Hacspec_ovn_Schnorr_Random_oracle.required_vo: Hacspec_ovn_Schnorr_Random_oracle.v Hacspec_lib.vo Std.vo +Hacspec_ovn_Schnorr_Random_oracle.vio: Hacspec_ovn_Schnorr_Random_oracle.v Hacspec_lib.vio Std.vio +Hacspec_ovn_Schnorr_Random_oracle.vos Hacspec_ovn_Schnorr_Random_oracle.vok Hacspec_ovn_Schnorr_Random_oracle.required_vos: Hacspec_ovn_Schnorr_Random_oracle.v Hacspec_lib.vos Std.vos +Hacspec_ovn_Schnorr.vo Hacspec_ovn_Schnorr.glob Hacspec_ovn_Schnorr.v.beautified Hacspec_ovn_Schnorr.required_vo: Hacspec_ovn_Schnorr.v Hacspec_lib.vo Std.vo Hacspec_ovn_Schnorr_Random_oracle.vo +Hacspec_ovn_Schnorr.vio: Hacspec_ovn_Schnorr.v Hacspec_lib.vio Std.vio Hacspec_ovn_Schnorr_Random_oracle.vio +Hacspec_ovn_Schnorr.vos Hacspec_ovn_Schnorr.vok Hacspec_ovn_Schnorr.required_vos: Hacspec_ovn_Schnorr.v Hacspec_lib.vos Std.vos Hacspec_ovn_Schnorr_Random_oracle.vos +Hacspec_ovn.vo Hacspec_ovn.glob Hacspec_ovn.v.beautified Hacspec_ovn.required_vo: Hacspec_ovn.v Hacspec_lib.vo Std.vo +Hacspec_ovn.vio: Hacspec_ovn.v Hacspec_lib.vio Std.vio +Hacspec_ovn.vos Hacspec_ovn.vok Hacspec_ovn.required_vos: Hacspec_ovn.v Hacspec_lib.vos Std.vos diff --git a/ovn/proofs/ssprove/extraction/.Std.aux b/ovn/proofs/ssprove/extraction/.Std.aux new file mode 100644 index 0000000..0c9eb85 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/.Std.aux @@ -0,0 +1,2 @@ +COQAUX1 da4b43ceb41a55c830a2111ff36e5a15 /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Std.v +0 0 vo_compile_time "0.994" diff --git a/ovn/proofs/ssprove/extraction/Core.glob b/ovn/proofs/ssprove/extraction/Core.glob index 1234145..569349b 100644 --- a/ovn/proofs/ssprove/extraction/Core.glob +++ b/ovn/proofs/ssprove/extraction/Core.glob @@ -1,4 +1,4 @@ -DIGEST 265cab0b506d10f1ada8bbe5826ce1eb +DIGEST 1d70d72b4eae36876b570fe4cf0d5092 FExamples.Core R74:84 Hacspec.Hacspec_Lib <> <> lib R112:117 Coq.ZArith.ZArith <> <> lib @@ -741,137 +741,17 @@ binder 7914:7914 <> x:181 R7938:7945 Hacspec.ChoiceEquality <> ret_both def R7948:7960 Hacspec.Hacspec_Lib_Pre <> seq_from_list def R7964:7964 Examples.Core <> x:181 var -syndef 8054:8056 <> get -R8061:8062 Coq.Init.Datatypes <> id def -def 8076:8082 <> t_Never -R8087:8091 Coq.Init.Logic <> False ind -syndef 8103:8109 <> v_Break -R8114:8115 Coq.Init.Datatypes <> id def -syndef 8127:8136 <> Result_Err -R8141:8143 Hacspec.Hacspec_Lib <> Err def -def 8157:8168 <> never_to_any -R8173:8174 Coq.Init.Datatypes <> tt constr -syndef 8186:8194 <> Result_Ok -R8199:8200 Hacspec.Hacspec_Lib <> Ok def -def 8224:8230 <> if_both -binder 8233:8234 <> L1:182 -binder 8236:8237 <> L2:183 -binder 8239:8240 <> L3:184 -binder 8242:8243 <> I1:185 -binder 8245:8246 <> I2:186 -binder 8248:8249 <> I3:187 -binder 8253:8253 <> A:188 -R8261:8264 Hacspec.ChoiceEquality <> both rec -R8272:8276 Crypt.package.pkg_notation PackageNotation ::package_scope:'''bool' not -R8269:8270 Examples.Core <> I1:185 var -R8266:8267 Examples.Core <> L1:182 var -binder 8257:8257 <> c:189 -R8289:8292 Hacspec.ChoiceEquality <> both rec -R8300:8300 Examples.Core <> A:188 var -R8297:8298 Examples.Core <> I2:186 var -R8294:8295 Examples.Core <> L2:183 var -binder 8280:8285 <> e_then:190 -R8313:8316 Hacspec.ChoiceEquality <> both rec -R8324:8324 Examples.Core <> A:188 var -R8321:8322 Examples.Core <> I3:187 var -R8318:8319 Examples.Core <> L3:184 var -binder 8304:8309 <> e_else:191 -R8329:8332 Hacspec.ChoiceEquality <> both rec -R8372:8372 Examples.Core <> A:188 var -R8363:8367 extructures.fset <> ::fset_scope:x_':|:'_x not -R8356:8360 extructures.fset <> ::fset_scope:x_':|:'_x not -R8354:8355 Examples.Core <> I1:185 var -R8361:8362 Examples.Core <> I2:186 var -R8368:8369 Examples.Core <> I3:187 var -R8344:8348 extructures.fset <> ::fset_scope:x_':|:'_x not -R8337:8341 extructures.fset <> ::fset_scope:x_':|:'_x not -R8335:8336 Examples.Core <> L1:182 var -R8342:8343 Examples.Core <> L2:183 var -R8349:8350 Examples.Core <> L3:184 var -R8379:8387 Hacspec.ChoiceEquality <> bind_both def -binder 8436:8436 <> b:192 -R8444:8444 Examples.Core <> b:192 var -R8513:8521 Hacspec.ChoiceEquality <> lift_both def -R8564:8569 Examples.Core <> e_else:191 var -R8451:8459 Hacspec.ChoiceEquality <> lift_both def -R8501:8506 Examples.Core <> e_then:190 var -R8429:8429 Examples.Core <> c:189 var -def 8669:8678 <> match_both -binder 8681:8682 <> L1:193 -binder 8684:8685 <> L2:194 -binder 8687:8688 <> L3:195 -binder 8690:8691 <> I1:196 -binder 8693:8694 <> I2:197 -binder 8696:8697 <> I3:198 -binder 8701:8701 <> A:199 -binder 8703:8703 <> B:200 -R8711:8714 Hacspec.ChoiceEquality <> both rec -R8723:8728 Hacspec.Hacspec_Lib_Pre <> option def -R8730:8730 Examples.Core <> A:199 var -R8719:8720 Examples.Core <> I3:198 var -R8716:8717 Examples.Core <> L3:195 var -binder 8707:8707 <> x:201 -R8752:8755 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R8740:8743 Hacspec.ChoiceEquality <> both rec -R8751:8751 Examples.Core <> A:199 var -R8748:8749 Examples.Core <> I3:198 var -R8745:8746 Examples.Core <> L3:195 var -R8756:8759 Hacspec.ChoiceEquality <> both rec -R8767:8767 Examples.Core <> B:200 var -R8764:8765 Examples.Core <> I1:196 var -R8761:8762 Examples.Core <> L1:193 var -binder 8735:8736 <> fa:202 -R8776:8779 Hacspec.ChoiceEquality <> both rec -R8787:8787 Examples.Core <> B:200 var -R8784:8785 Examples.Core <> I2:197 var -R8781:8782 Examples.Core <> L2:194 var -binder 8771:8772 <> fb:203 -R8807:8813 Coq.Init.Datatypes <> is_true def -R8816:8822 extructures.fset <> fsubset def -R8827:8828 Examples.Core <> L1:193 var -R8824:8825 Examples.Core <> L3:195 var -binder 8792:8803 <> fsubset_loc1:204 -R8850:8856 Coq.Init.Datatypes <> is_true def -R8859:8865 extructures.fset <> fsubset def -R8870:8871 Examples.Core <> L2:194 var -R8867:8868 Examples.Core <> L3:195 var -binder 8835:8846 <> fsubset_loc2:205 -R8895:8901 Coq.Init.Datatypes <> is_true def -R8904:8910 extructures.fset <> fsubset def -R8915:8916 Examples.Core <> I1:196 var -R8912:8913 Examples.Core <> I3:198 var -binder 8878:8891 <> fsubset_opsig1:206 -R8940:8946 Coq.Init.Datatypes <> is_true def -R8949:8955 extructures.fset <> fsubset def -R8960:8961 Examples.Core <> I2:197 var -R8957:8958 Examples.Core <> I3:198 var -binder 8923:8936 <> fsubset_opsig2:207 -R8967:8970 Hacspec.ChoiceEquality <> both rec -R8996:8996 Examples.Core <> B:200 var -R8987:8991 extructures.fset <> ::fset_scope:x_':|:'_x not -R8985:8986 Examples.Core <> I1:196 var -R8992:8993 Examples.Core <> I2:197 var -R8975:8979 extructures.fset <> ::fset_scope:x_':|:'_x not -R8973:8974 Examples.Core <> L1:193 var -R8980:8981 Examples.Core <> L2:194 var -R9003:9011 Hacspec.ChoiceEquality <> bind_both def -binder 9060:9060 <> y:208 -R9071:9071 Examples.Core <> y:208 var -R9089:9092 Coq.Init.Datatypes <> Some constr -R9099:9107 Hacspec.ChoiceEquality <> lift_both def -R9151:9152 Examples.Core <> fa:202 var -R9155:9162 Hacspec.ChoiceEquality <> ret_both def -R9179:9182 Coq.Init.Datatypes <> None constr -R9187:9195 Hacspec.ChoiceEquality <> lift_both def -R9238:9239 Examples.Core <> fb:203 var -R9053:9053 Examples.Core <> x:201 var -R9440:9449 Examples.Core <> match_both def -binder 9458:9458 <> a:210 -not 9354:9354 <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'Option_None'_'=>'_x_'end' -R9642:9651 Examples.Core <> match_both def -binder 9660:9660 <> a:211 -not 9566:9566 <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'''_'''_'=>'_x_'end' -R9790:9797 Hacspec.ChoiceEquality <> ret_both def -R9805:9809 Crypt.package.pkg_notation PackageNotation ::package_scope:'''unit' not -R9800:9801 Coq.Init.Datatypes <> tt constr -not 9768:9768 <> :::'ret_both'_'tt' +def 8056:8062 <> t_Never +R8067:8071 Coq.Init.Logic <> False ind +syndef 8083:8089 <> v_Break +R8094:8095 Coq.Init.Datatypes <> id def +syndef 8107:8116 <> Result_Err +R8121:8123 Hacspec.Hacspec_Lib <> Err def +def 8137:8148 <> never_to_any +R8153:8154 Coq.Init.Datatypes <> tt constr +syndef 8166:8174 <> Result_Ok +R8179:8180 Hacspec.Hacspec_Lib <> Ok def +R8215:8222 Hacspec.ChoiceEquality <> ret_both def +R8230:8234 Crypt.package.pkg_notation PackageNotation ::package_scope:'''unit' not +R8225:8226 Coq.Init.Datatypes <> tt constr +not 8193:8193 <> :::'ret_both'_'tt' diff --git a/ovn/proofs/ssprove/extraction/Core.v b/ovn/proofs/ssprove/extraction/Core.v index d5ae6aa..fa90358 100644 --- a/ovn/proofs/ssprove/extraction/Core.v +++ b/ovn/proofs/ssprove/extraction/Core.v @@ -183,31 +183,10 @@ Equations deref {L I A} : both L I (t_Vec A t_Global) -> both L I (seq A) := deref X := bind_both X (fun x : t_Vec A t_Global => ret_both (seq_from_list A x)). Solve All Obligations with solve_ssprove_obligations. Fail Next Obligation. -Notation get := id. Definition t_Never := False. Notation v_Break := id. Notation Result_Err := Err. Definition never_to_any := tt. Notation Result_Ok := Ok. - -Program Definition if_both {L1 L2 L3 I1 I2 I3} {A} (c : both L1 I1 'bool) (e_then : both L2 I2 A) (e_else : both L3 I3 A) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) A := - bind_both (fsubset_loc := _) (fsubset_opsig := _) c (fun b => if b then lift_both (fsubset_loc := _) (fsubset_opsig := _) e_then else lift_both (fsubset_loc := _) (fsubset_opsig := _) e_else). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Program Definition match_both {L1 L2 L3 I1 I2 I3} {A B} (x : both L3 I3 (option A)) (fa : both L3 I3 A -> both L1 I1 B) (fb : both L2 I2 B) `{fsubset_loc1 : is_true (fsubset L3 L1)} `{fsubset_loc2 : is_true (fsubset L3 L2)} `{fsubset_opsig1 : is_true (fsubset I3 I1)} `{fsubset_opsig2 : is_true (fsubset I3 I2)} : both (L1 :|: L2) (I1 :|: I2) B := - bind_both (fsubset_loc := _) (fsubset_opsig := _) x (fun y => match y with - | Some a => lift_both (fsubset_loc := _) (fsubset_opsig := _) (fa (ret_both a)) - | None => lift_both (fsubset_loc := _) (fsubset_opsig := _) fb - end). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Notation "'matchb' x 'with' '|' 'Option_Some' a '=>' va '|' 'Option_None' '=>' vb 'end'" := - (match_both x (fun a => va) vb (fsubset_loc1 := _) (fsubset_loc2 := _) (fsubset_opsig1 := _) (fsubset_opsig2 := _)). - -Notation "'matchb' x 'with' '|' 'Option_Some' a '=>' va '|' '_' '=>' vb 'end'" := - (match_both x (fun a => va) vb (fsubset_loc1 := _) (fsubset_loc2 := _) (fsubset_opsig1 := _) (fsubset_opsig2 := _)). - Notation "'ret_both' 'tt'" := (ret_both (tt : 'unit)). diff --git a/ovn/proofs/ssprove/extraction/Core.vo b/ovn/proofs/ssprove/extraction/Core.vo index ee82f8ef2670acc9a26cb8ea652b2e4e0891e5cf..e1544750ddd15b13211939c5b5ce0d47b974a426 100644 GIT binary patch delta 42974 zcmaHU1$PSSlnn zNZn|mrA~#qKTvtV+&lNo%+Zl^X69aA+|}js(>L^ptXew4%R4OB zi~rM{H=gQoF{|gM^JDKj^40Gnp368_J?QE0W;+|F&L7mvF>STqkjImoUd_q6X-m?j z^p`g`j>z_z{Z5OcYD2rXzSz+DuhPB=U%oYF)|BZprc8UXcHavx`^^4n*h5=qMBm)? z^-Z@QJ>#XtIlR1Xz2fEl(hX!q2mff^0+q=1g-E4N6%?`8k0{>@j=hgk}C7+N# zcD9&l_(ZeCY*CQ#KT`l1cF1fo%EbTuT#MPMa*=kpXhaD4-s@%NN)Za4aLt5TgLa~p zQ7!RWBtSmn4b=8aKGtg+7&NvOcha?|7-EvBA{DN*f1Y&HLz?NulJ9A+I7V(@Pygp{ zR2*=xf&G$C#`W2N^xx8oe9rY%4B0G^x3f!uGp|3&uw@>M=6cU`(?go+Ws>i+Ug@p4 z7kJm8R^RViap!rT0;JEoit#ALdA|2m2EHvBb+cNaO=YP4foE>+A+-WQvW0MskXgZFaN=Q_x+Uj>b1NOUWvb)9wq(!>6v;#IMFTi5k& z4v=OJs>%0bZ?8>~dA)gT@7jW@U13%Oy`$@OK)P&fMZcq47(+IAFuJqbS_UokV03r) z_A3GFJW6zY%zJR=2s`=y$J@)%ie^ubhmqguuwqhI=-wVb1K1I`TP?q@=M08{1B0ji zJ(n`1Myv$tj1k+&_b+d+J3aV0-0M3OX#a^Pnj^g@07iGUqB+`o5ku~1<>{W@#~89j zeEpdB5c`NbXk-U(uZJ0nuAj359VnntE0UIh=UdFCe_C-o<-$ZU5QZWj+9LWF)TwyU)nj;hg zD=pOP3^TxJ*WsZ>7O^9BQethen95Y{MhkWMQs!<#3a#9ZDmNkdCd6V6H(N{vI;O1_ z>Udd}-GJn!)3wX=;d|a^u*H#94_Z*Yt_O<#m-UjOBU5R zM`G+Z59j*McJE$3*ZtYtXcNketg0z-PPDD4tEn%ptFN)unumMkT1=lY7p6`Y8q{9$ zYwC(*2e51E1`B-#4Vk)IOdrFVE>jN+4Jfdq7;u~V;-QGk^+O_!%k{UI-h&}c17HW) zI!uE&#bpK~vBw;N7GWA7uh>L?2Jbhh*UeeRhz2bs5G1nX)t*~H+p-T~JB zuMGG0dfl)~)WcsoT&5CJUYss!7b7R(bOCZIOr^<8v4_P}&AJz)0n;Jdk+jb2gClo52c5L}D7(OhRI~*~c^stw7Vb#Kka-w0}=k#emdaR;@<4NM;_$Gy4beb|J{wX1dASyDwL{$;ilWw;CBcOk2IZ`$^94Fmj$A^e%F4H*NR!Ua9CD zFtVN*+#gwcO}o9lSFvPwBg6amgs8|0TMLg9wYH_s@wH;o)7~MS26~&mgpdPTMD^3& zextg+NZ#YUz1~1IFzr3(k^6tSH3-Oj$a}IkjX=ps=BAgQ_Fix5Gdj^R?ce@pQ~nFy zzqY$UOLUT!fWP>r{8zk9-rAV(Cfhmh!1mhME=>pC@V@TdXKa&W+P@vp#^NmhzBG30 z|N5&<*WUCV-mcU0PBJ}*zh}jmcfI#^brJ>RF9?5u=BDS~^)4T%P5Ps0#!udhyJ}O9 zH|@XfeN%@4)4y;``|R^n-*BHHr#8*#-Rxa|=@TbSztj}cK|9i}vvX8wt*y>U-F?hW zpWmQWwbN!y6Pew#6WR>Xozw?Uhb0Bv0b+fyRnavEs4b+N4gO zIjP5|`1_>kN^fmuJ8f2R)2RO1f4w!o+r^-P+F0^CL4HR?>_BaFN5A7{r;}z45_JPL zU-EmAW=#-#25Muv`MuzD?4Vgw`Rdmq&JWZq-Tkgw%x0&>;&ixNG;5w1=A)%({#`}2 zk2WOK?`5s?_Q!>}0SKKAnzhAz+G#c)zspH}Uo?=vNv6JTAiry7rwjRwW{0W5416HJ zT)gZ9zWk$T)@JdmkLKIa-y$c(@#O1i z@yZ}AB+UPA^B$*Zx53VrZg%`@8yw`nllk#q&dF_xp`XD}iO$d`B6_ekj{M)GSwD)J z!P>}<{;x}heh~ZcME+N4*5Bf}!P?kv{#T@myd^_li$4d0p@0D%4EaqG2}887@PL_M zh`h(>9QmcXISOb8HUfN^qks;a94tBVThPjpU!r(n2sjETA;0%26Y;@u1{LaPmII z(F-0NJtE?VF-O0U-*aNwFy`n-$w^7Nc|IKg!Kf;7G6$7{MF`j^$*CpDKPI z4vqrXGe`at#mEuN5t6|oaRhU8fO+u`mmJ+88b&ZjFM4vcSX>yv9DOD^dfVXWwpNZF zVm98895r$BoZ@JY2S+!HBww`Opg!b(r>OJQMh*<>DLE3iJGH^dqpmraJ#=UPUBcz7 z^`W3?(W-)veXFW*% zFNnBNoHa?T7{ysHi-R)jL-K!5yd<--#UG=zahm@-V&rJl3hqSyUx~!g+UUUG4oo&c z>H7;$>AnR6?}9Z55Ht%J-CGVdI}c)B3La1XzldX_wb~v5!<Jm{`6@xK*Z;ssh6*k z>9(DwE{rgCmjl;@%moFcIxx7nC?MTz>ZSTSsPq}j@|>Z7i6UgImNqT$q045+VaE>G zwb|il>mPY4QOU{C2wTa+;VAfQ=Z zmrFC&is#2`BPRuX>Z$GbA|SRt`Ul(@sUDy}iMC$!oxo_Hr+^zp*aV=R{k%l@kGwu9 z(LO5HOwdLSp8dH8+Q4C+Xg?N@PtXSU^#9D_q~PsNON-fo$)fij@%034M2~>`VL$K3 zXyABB^OP7kQS;66tD^SH0D$dha04@Xh~F{`8;ZxAbUoV-*e6`5hFmPt^L&^E>9oIa|jW=z%jw$Jyk8 zvq9o~5;zx6YipJ1fm-NKp<{uE0&W+UNt&6gc03*B^Z#wz<0+Vh5iYF-aD3XsJ-%CM{IFLHd+2i7v;h=D4IOrWNdjVz7QRrzT zU!u@m_%XN7iV4%SsR2QGZf=WpZgX{Rrz>v1mYNC*Qcr(Ke*YGZX;4)_67%*c5P!_n zwn@qxCFLwo4(`m*d7K)6zkw8b2|o}I>nuJ8aeL4aH}MlX@w*lA;7~~}IIxL={iLeG zhD%ii2ehgRNvW!K>AI@6ft}!T5DhM4RRzyy(sO_!mBNCNOoFO{n!;iVm5syvhHh)08Jzeun_fMdXXH^5A72wgp{nOkHoV?e_ zh8?yTVo>lQc`f9I9W+<38HAesXT5fxlY$nDr33nl&~&MIzWNuQ3u$7++^c^EGh3Lg~-rq&@}(XYv??yi(adxTge` zi!WwrGws2-7Y@tzFuTg^g8lp8ulHd!vxhs(2@X8_>LoVF5@P`wgTEr!f9*hVL8v08CcbH#w z*`pj}-i_JYL955dTFPyF@cp0Bj@MWEM z=i$aE2gKzoutX#GX9~WmazAsb`=!{!n?7 za24O7;EP_@QBak5Q_2oF`1sfZ{=U*l@E1n@FW^MxH&N&oh1DMXxfxt>GY|e$cULWa zRmIuu^op~4(d=%mh-Y`w^ZOY2BWd<9na?uEK_E?XHrq=T4E|FJ6_1Rwise5HNqe}k zt}^>pnthAPxF+ri)JE8Yo;F)Bpjy`KAUj(65L6ajY#gs zz#6&}18e9_D7Y5)Rk&Y2zK23;9Jq$AbdhBdS(Z@v*LV!xeu2W?rSR{_QbCrbz!FAAyUU)WFhagCi03aQ}4?MPISWgBWQL2=7*o)9d19g_Y5WUgc+ z8+0UVC(D39tagym6L{XRffbG@Z46ta#&Zswv70=NW;kV>9yEHBEE zj{~@zEKOuVjE;Of-oc3qB#ziQwFs$WoLK0f@CjsjhSS?x2o8efDaQLM;L{lIB8l-c z$MOA63Mq3@NU7sAg%rbfzf(vddR#~;S^m04A@ds=P{K+fHsE+4qD}I0HUMj)yvE3D z1g>@p!75mYA5)y-JWk;$4zhfXdm8TFA!icjOyu?uG6J93g+>2DMpO%a0_&{u+o8sJG3;fo)bXouX{*Ex6gZw`tWk5>N^Km5p?9s^`5AXgc3 z#d&-Hh3^4q8pPU%djJ%D0Ny}EnRtITyn*1u;@8=lZ)wn*)aATBg>lGgxVu4@TD<|n z+7zar#e1b_oi6ha#Rr@=b0y7tmY7 zo<+gOac@3N;i24pT-;m3njq#q6mcI}#;~$qy+G!EWEnq%B2G}mNuUhrgeEwUEKu$J z6!9Rdr=^)9lclC2t>$J5 zzgdoB;hWV^AHD{}VZG%|6kexF<(nmBnLc-g*J19GkP6f;k*Ol2;QF%q!*Y30=2Up8 z+0__}|!^n>u4JDaM`! zV^674_bJAnF&KNwVC+%UJ|!7D3A}!X?XrB>aW`jJFi@N|n|0QnY|9$^Cyh~eMK+UV z7TEeq5&QydnSCW&=HZGhb6?4pxknS3yQ)&ZOSa72b+*i1&Eu59%mlu!NxuF9BHeQe z`>&g=>td=|8)y&rzM!}=_i4jb)J(~ho;OP6HAaE*X&pADZTTcw9tsc(jNAJrJ8^BZL^<7zR+W3_x@XDfV~tQJ)P1H))hg}6&gMs3n-aLY+nNMjmf zB;r`3%x*3dEAhmu`a5+zn*mo0rL>@g-A(#It`ess2zMIZTGT^&#bd~I`)c6@l4)k4 z&|yf}nks@lb^jxLYl}xSjQS5#F{BUw09)cZ`YY_3h1bJ13$KA|7G5pw8{J;HX5lsL znuV`Yz#eeT;F(4Dm7ZDnCJ7DS;Nh8tR~nvKc)8)3g)cTdv+xq>nS~coxIJGfW5NHr zX5lpyUZrx2^lmY))iqd!)80`7K^XPmZ_& z9Ze2>hZ|!q$S#K`#a3xc>$B`Vp{vXhkWHo6nQsoj(Y z3cUwYNKC#cjnc;T2)!9&f0y1AiWu5Sp|^_tQQByVSw*3H#fwpzzZQCEceFOf9(u|h z9fqDZJDVwHw-Rv|YvOgKiSxQ9cySb>orNNvP^Iosia28^;t4|$52N;dvh)dzlhbrX z9Cj<>0i}r0Mnnue2ShXh&^iaiye&H)BQW>EiewRF?b1Q5?5=8{uy!o!&*D>v5Ec5k zT%HTyaC+vj@E$E@_|jN2jlPZ7OzDQ}`eJwhFQn=5cIY>(o=0fZK&hS|gf&JRYY$yT zJ(sG9HPCa#F?7AL*cX|kXL~Fkgubd4`$8S9i+x>^d9g2aw~Jx}|Fz;c3%dU)G*8m~ z863$KN9sJ@;uJr{V8t=?KI*w&r{cNd82XT#34cA?W5qG_Po0UUJ(yT6nRpRQ*u;WZ zI2K`@#L8H0RG--86gEKXay+1ldh${@)=&e*!O2=5@BZTXSj{&+G?#jQre}DrKZX{^ zIMw>2T!W;JDbgv6McBEMVjIyuDDo9~y@er>H;L(S+TfX?HyJCCu@8ByK!&AztUyNo z9Eo)ni$yL}Mm{7O;0$a=#;iCm@nd1S3iHp<92*%%|QtEW`?6xD-UOjK_%C>|?o zVRi83BLBFHB7cRu6?r%NtdV!Q_*w~XE(*Jh6uFdBQ}H*AVt>L94J*!9RK;UuE%FIB z@uzg+k166&a}>FhCW^Ak_8S*qmZX#Qm9>DG(~Xt2u8Y*lTG&HiCu#$TM%me=jH+SM zAq z39Lt9&x^tY%{M>vX6p5}GG`F4`y2jssH3epJ4Hxy#%*Nd#oYuUDGE!dxUOYL)JiAs z7jbh5;@+l~-oiuF(p%``=$L;Vhu18$M9rp!4;PCPwQZfkcgf|ounXd!M9pVf*!wWE zlfunFU@WtRV|gKbB*RDL&zQ!2%UEU$TP)(NTGYt+am+ycL}n(sSYCY@573c#&_)PH9eGpS;rUJyEB#e{s8z?+RL?>y{ zTKskq9-{RNjK0wzBwKd)X`NZ_9eU7VPUb$i6Mm?BObvftyq~1S&x^WEdOv#L(Hr+( z`0Jw&oAK{qw8Jy6u#LvwP}o^5e#PsHU-9n6uXug&OHFc7`^DO1&BtzbaDBPDM&_NI z&cKM-Jp?UpuagB^Y35~!gb{lvVd!ZxKZ*PB(-bowZ7U{+TVqTjT38I6#uzgtOh7Ue ztuZDDtubaY3XZ~k1nx%>%ft+EQ9@Tr=!Fuo1058*#(tV&ZvpzL$c-Ms%{F1WypFbbm0` zMA2OsU#!Fz%!>@Mp^hYEa&@hRqDN8e-4yL}oDu>Zln@56`5W-a3jpS?KF!@IEE*-i0OkGDX7z zFH>AR#phDOhm`Osw4K=N-`e(LZC6We{~}t_5bB1X5MQKeA+d>5S!szgSb?!};Xigf zLt;m_s*$HXqx=2`jk{w2g@25DPcI6`A|P7(FQP0R-8gX}ncIn-=~|jS;(22%k9eh} znG)B@Q9E%BdpSc?dOgyy@MJK9#6F=sp4e011CRGLQS5P5YL{6;?$x_)>~Y=Wi9Lwg zcgj4`OmTW-6??n#a}eoDKQ8fM>DM$eCK#7{Y#1 z>@z?pLp3H9F$tK!cH-BHxi49q%_{vJ(sARYIB{d_N}jkuQl7YeO%&H#75hiZ6W3Q~ zFb?O4WfULR8P(e{kvMOpHtXcCD|z(N)}e+t^@cdHU3GD+!<9JJzF;2m1Cv!>PDfT_ zv{50BgHtIHht=`>o5`9cS+l0FG*?x64okB`NwZxSW|I;IetFy)RcfIUW}P9-8bcU+ z9jaGIX%-`ORY?<9)>fL$hBO};%*8G{S`qvLJ>_AG<<@ zyojO2EoE9~yY(y+;P@9&b8Lgs$rC!_Q@G1EVtrGVlDV-BEiwp?IoudwER#nrLC7L= zBdZ*Z(3$nWO8TFnqsUz<{X5d}ezH{jOr@`QJLXVWA%0{N#SfRok~&L;#bfP4l8(pm zPig)50jMsWsrYV4?Na)R@6twJNfUK_C2TPC73ZVtD`~P4E6LZ;S5ja{9W+@~WoZMf zk%uq0RheWV>PTzU6LlZbinFK(!5NN2^}w{&YrhJ5v{4P{ycl4TZV?x=5cEX!Md$Aw zhJ{WZ1tJED&e<3Rl8#WsIN_I#Q6TDF_sksiAxAq&Pbxh;4s}K4s&osh?wV5FU%Kk9 zD$QYqJYIFRq>D;(-x`|x+R)r()P7g$`R!&($kjFXCTq^lv7VGN>1SPai3x7i8M_uq z|JC*Mt)aSPFCFq<3E^=dK{I*{lZq-wjAVyudMBzFsS%pFADT%H@Em%@rX0;DDk4w1 zSu@xR(&MFwK*USdH)OojD^kTvGiG?KEk@kRn*D<&!rzBxcZg4Ow6R&1>onjI0N}LE z@Qe~7+8d!t!VW!~cWQMvDWZy}z8w_Nw>4Dhy^}+gh(X|ZjmV#iP$lAav3f2}L_|y% z2j=3m39|?X5%m&QDV#HTrP#o^SH~Iaf%B}ynFO52J+*){K!G!O0y-*XxmR?bhxO6q z$Fb}y0_QQwM@25*E$@nkd0Ica<>R(9e)mQ><0rq#6I1d#%u`}_$=PcRNqE^kRn25C zS-P@^Onc#LV+T4yGeV){-#kL0=-nQnP-1{bD3sv+o9H)RTM&@&s4;~loKfu|p~)qi zX~H&8cTl3*eM^A9%};aWHCvpRk60+;4>%Bsp?6VYFwf{}g8#_H=~HkW5=%Mt2&ZcC zS4S!S_@M!%l!|}mBNj^ZGKeRVPW&H5Jn;@iuCa*{9kK_dtTs#1I}L9pz&{8cX*;yf zKKH9wC^C@Qc^*U)pJD$c@idb@2^9BI%I!!VgLjg682(ElZ{{RMN&hi%3NxI@=SC8- z2$A?Wr5r)BnNl|5$J{>jZ$nGJ?id?7GF)8EMJyE2nS6Xy3!3E_Uq|$6Yvmp{Nh_zk zz&1^RO?Qx0<7?tm3`u;_ZRJ_qlT<7e`H_l+B0?J|vi3MdmWv$=5DP`#DSlsoSSZS0 z#zK)+aciFD;}e-BW1+~$fxw7`B3r=ge(_YE)<=u@O1zVY=qI&;Nv2jwChn2fQifQI zz=TXJ6k+*@eo|#1o+<-zs|>`gx5#|Naw>A0;m1Pj?o%WmBI}n=k^7{EPKguw7%)?x zr^puZX1*4kntD+Zew#@qb(4f~SOSEx>aGaOCLc9jDb$aL482Q6T~!`#RETUjJZME( z#G(Q%-k$iz|1TO!8-lSB?PZKUR;G$@mGYu#Z6>Y6KGn2UOJOYuR4s& z5(TmPG7&re*5U7FtU0U2yy(ST63c&JG`fP*4mAFLXfhm**`0(XdydD_4(*||1Mt7Y za6fpOl0HEDPI`}fMAA95@}%dQDCsFmyBEnb=n+Yep+_V=fP!fENrz5T@>uxeN&8)t zb{nNNqD1mt4obduno>FgyNffAx+t|TrR^r`Mt(f*B6|u^>HxCdgy-lkSIKH8>&=wX zkx~ay+FmdM^42XX5=-d}RFpatKgND9oVXh~@cC1BH;-FBMdO}H8Yk*yo>rk*9 z_cGjnfNGLUAkZ92pNkSH1rYTa*!6W_U&fgguA*y(pMy(EU(AZT>)#`%T&6t1<3iLE;-3=4 zXi>|=NE>3b^d_mL$E1FKl2^n@&=LlBeUS0zxmh1%q8A#yJZg`SdBc!8qWXObTuAoWjTkM1#}VEXNNqHHvy`bQ!j8Qj zg{1@<-j|NTqMr4UD5HQeL^Gk7FM;Pd2vez8D~A9HT~xZ7g}Gk|bFcHTT{7lW((HjW zcc@|;l{9zh$W!pjs`SxQu=kX*MOL~AM7rp#Y*Nw~tlVt~^QT*w-TxBifMVX>8k40Q zZ!6D>QXY=a(uPBpi;A(=S(X}=ejDjjoFRkAsXdipQrk;WQoSL{KdRI>Qj}CLLlnF@ zt3>$~q9p!D%JMxB)#$Q(+eVf-e8P(jlUCrC^G>gk)+1yswJ&Wm+HmoB*z8 z>>kbum%?xemaG;v*t{-iy<9Br( zr%yF>ochYYbj+~~;#^UkrS+d0x90y9#aZK8qd3IzMighw6w?-K{W`>&Fyv%T7Dl4Y zKjqqh4zYZyBeqfuslaPJnO7-xok*y_s|A@Hno>H4_LTM&55sAni7gdaz|89A5nrUo zd&C#%o%Hy^jQ?c#7Ql|19t_47AQ+tUs0;>u@Ft}y;BiAqv^ZWYeOrnH80gH~`j z7n|v#tRk_sQX8bjJ|T`(;-!b!avJ`kj>PlyP;8BxMuDEqzOO;!8J)&@4;n`#jm@C3 zT?}8sG~N)QOAsDr9i-S#MClTQg|U~#E%H7_Jg`LTR~$Pz%Bk;(Nhcx;(<8*XBCij~ zsgkEr1j&J{7d;&O&Jo4oU~HTb4raaOVXllGp60qB##U*$0qHx8`7wRB8c5Q&yX0_? zUIJnc${3`c5H0Z2Bzc`G9;-qC7&jVzNk-qhD5DqLfb_HMRHdJG@%3hSBpJL=o_;H* z67grH>~8p>HD-s2Zq?c}d%9XW0p9cvb>eR;;u+P79CorY%4EOE&M-^Ti}e67aJoAH z9E@!gK4%qI!tCq^(TqLp7G>PVq&EY_M#`>4vH?y{#u~Uq8P%K}-JKcEXwM91?B}uq zWg96Q=Oi;6lsz9m=637!f4x^SZKl@$@Flt38n;MjOEuq=*hCufld_0>3(MUm)7u&{ zdoKi|421c(Vl3H78Qb-0++9?}7k5QPe6cuq9w&}tky11+g+CZ~N_@0bE9->SH$HeC zS1nR%u=^FaihCTzy$S?I#25Dl0FN?!RQ}9qyw_mte#H$Cch+d3J~>$Z-a&H~$Sb_l zoit~FybcmqYqT-`If%uOkL@{J17*%E9i7KwdEC>WJhU^#JuF#xURY}}(B{-o+*@K< ztrixWvqmC#SYB%-8ibr6R>RkLe;p+c1$rlne@i*U@fP<7LE~`u;nFZ=bWz< zjwG3%(8r0qIr>DJ(3fk@RXP2Uwwo4Uj2()NL$wnYkJq))^yc>1Lvy>H#x#Qll^M-V zFf$O%Dsy@hCMKHOAIS-5f|+B`1T%e5uqW=_aOa>U^9C2?{7E_2Q7r-IHM7?M82|bO z%BrAjJI(c?xx@|i`;K0AK02Gdfq!$`;m0+K9hAk#bF+FOQBQNbK@r~}W9}GkMFI)*e-I-8|A-WUI9l_}$Fu*-20Wrc{U-W{x*{!`myil+8 z)Z&xG`}G*R;+_=$)NB0`=9_pzQ2BE-_au@}v&zq~ z${$2QE_d`aWldz2AA(#vX|7;Fe{xVx9{>{;U7&0e<@6sybMK(J`#4XuP<98(@u9gO z=VWbM5L1?8D34zx5|<;4i61Pgmur4ubH8P2vwWq@pGcXpCd_?sy2lbpd=5HIzaJ<* z9`|7g>5{qg#OI06mZS5`8$$7wqU#EHDQRnr(K&5>OEb-zC5OU!GvJqGsk2#GmC7&4 z!m16%(X0hclr>M4iZ)9KR*Pi|&%!4qq|cU>j@k(_FAk~KlwXn+!+we0;uH74VT6~- z4olV?<&EfQ=G97Pj;kl8G*kAwV5>n9T*qwTg$L&2QJpQ!Rs47yY#mjlb||)v8EoMz z9EvUM(q!$HrFQ`@&Oz<8GkJD?+2zVcsi>+)H38yS-#8 z+oUt~hhpj%Fr{9BnD>EV>Su!~eBlL5*+KpraP^7g>SG|X>7+mOV9Gj!mDL!1LGCyi ztY*HVHfkbej29spu*OM`T$*G40LgA64w+}ZD|6?oHwI|F{sw`y$Zk0BnQzO3Tsn92 zgSe_%lCqXK5g#ar-&!KA27Oy?j>d>)nx83kFh7HJphm&$+msHnaU25$v)46I_G(qC zRO%pmtxhF-HJ?tDg=$f~T&5Nwbw%kQd!eTeo{&0-X{!Tk*}u=9rGL=s!>8kOH2O|V z`Zv%wUOmN|R5bi8wG-ogq@g1vc0^~J|CA_Lt&Q)I=!IS~qMj0d=kAhd5_hgfcbWeI zCH5B2tVVaq=I`t0#4bdtL|`N0cb{9P@kP zDoB`{DqdTI*U1xSvS1nF?=^79a~Dx!i5S0Dn=m*R$9;BC&Ov!C;9(^vR}CvO{Dq@J z^O=;p*~8PzdD_F%%h}MzF{i|8@yJ@djGcRu5*x&aYcYZ+77Oon40;hu^pEjSm$K>H1URMsY8rThNIT8^y(Sh$t3xVnlPLOEK3= z3h=k+Y1e!wEg0*;_}n57q;q}$#rRo~Z)dbAlz3ijwrgWXE=Xcj3sPl!c*ev1NqiA{ ze1QMN1-sUl7F1K>Me(g&OXxHALCMNeSyLWLT5ywyYtY8|%snS_aNGho_sJ_JFU$|O zid$s|oBNv3)@w7m&l~S4;5Q<2y*6{? zyeJRgJd-Z9^!Swyt=+_(>oKt;?hu>4+OU!H*bk?9a6NWXUZ}j9<+3?c ziyv0ew~GNAxG6oyP3fA5*?>NhS3}k=qI!cid*nPGk!fC~tcn2^Xg0J(@Va&p0pF`!n9yy8@fqAZCg^%4ymxo(s=v61QiLe>oNChAU{KTXmF zhMkn}Ew84wbu(0p_Ve34TI(Z{H)&lpYmQj336WC1KUvGfO`EhyKKTK%ZZKn;4<8cO z=?qD_S)ALXjSR}q@z8AMZyxPw{vCRI; z3hOLUFG2eW^6bA+8`E+A>yn^DoV!sQIb{B~9;D``=8E9WTsMZS z6{2`E)0G~4ZlKt)nd$EItgD}u)OoHJugkjY$l4(Olyy%@y47Ob7OwlUXWd)c(A_A? zwlLk(Sb-NiwrJC)TM@WZe!2|#M?IrL{+R(Buj^~L*4@zin3Z^cO&Z`X@e_z-C0?e9 zvs6oH^F5BluZ+NZK@UCKW3Sel%U&e*(SB_WyvOw9z&r787Zv;^%5R3ZW_5`zH-m+z|&5DL~oCl3CreU4pqQY^)`xd70ycl|mHqvg5 zqKUWZNI1B0(?~REELf~(a|CbDIIYu|=Ru=f(kK9p%vK*3dJkF6>Khv4m=E1}rl8K#QVuP5xl?DAt zBy2?=FWf~*-lA?RdQ6g+xMM5J?njfnbh4~Kx9lNN&em0p9kk$Mw%LOH+Y%Y!bHxHuW@G!p4b@wqcbc$sd76Ubnj_k6)W#(9Dt4f|I;x zuz*j{<^^!-CQe1+FPe%v;D<@QC_v1(6{{QzUUw6JTPJ>A5zpgk9mGqTD6dfZ4n@+&~G|opmy*X#^TT)uW}^SGdmoz<;sZ?0%9QgWCFOoh`4xWl;nchMdyk6t;K#&Y5zm6S zJX*vX#=qWR-kRr!NJI=@d7 z<@cbXKauPTRpobLRb6Aw#^D81+!~qT{E1w46v_^#;v0}0LPcNW2X2c8h&|iU1Co1* z=IvPfvHq7P+hx0*HLcBX@^{+fALQCk@<5)pM&-|%<}rFq-lpn)!p_L+Q;LP@9_vBLcwvyn-$BW8 zbu77BXge`R6kn%gyO^{S>p=x!5)I4=KLBkA*T3Zzt|qqoKGIQotOuoR=ivx>-^j+n zE_U*N#HpRy%(%R3GRV?b3EW4Zxm~1Qmgt)$C4n-qNoyye`NPGe zM!XA`)>~FNk19c^g5#E4rBpSwKrj3@M+REiJ0vP5eez zeiyvag%;Kf4rB)}*=Lsb{7(EvSAI_gyocZDLbO?O9~SUYVUQ{_(BqY^e3S7?SH5Pv z(gi6ElgXGqO!kt3k=id|Db^1!L)L@-G`I z1|Q#fnBYrYvp?$j1zzApw{4Mr$TR<{VcPuv=%y_lq3RXD0MfJt_MueZ(~7u2|Ik9g zaHGIfDwybL+k$SA`GPJwruK$y3tmwfI8~;9G6JS8xRVNYD|n|i`ctOO7;SeiGo`(X zMPAZ!Wa+f?@&U_eun$g}a89XuxF{bMV{)E|VNtCGr{Y7vn01Oi#2ixeKF>NuuVN-C zdcKK@o~F|KkUWc7r|5CaIz=Z@5T6Pvy8AR0kF#U(vFLz{O1D$#F09cOo~A-RUQ=|~ zMYi4wR*L7eO&6%dM7I7^dIy#A`eflIISf)s2maZ7@I!s`7gfcdAt%epVyn_lc$ETYiM|waD zV|`10-k@+E+`}Av-k>mZ50!pPg&F7vg*jCE!!;^QYG`m$VHg!=o2m31Xit)#Hz*9{ z4;vH)Iveb`&5{ojQE)618;;K#lvo^8`Zn&7xPOQoKKD~Ngf&~(8=#MoWySqVWbrms zVNZNCz-9yFdqBD|Q1BBATkw|w??k27 zo2XczcEL~ld4qx79>7ItMo2MO+B)E-I;`{0L`_g}_}ZyDf<*G3i& z0_byoz(*m-hQn10M*#9E8>!$EmiShHd~x57`*_y;Z^&90p>+HLbo?Ca_~|{gFq;Zn zSjW%N!g;l%pTbUqEUM-BYBY_cZA^J+; zR?fOb>bLa%>rLr z07_#}DmX3e0LX2Cq%b6zCH@nT?YRGq`);UsP6^)ZXrzUFGBl&3gNnGZ?NtvfWH8`WtG+d76NKI{_} zzsFuqF-~9L%HM2)cQ=EhHa#}Xuqi(%{p@99rzHJZL3?>$OcTL-wZZnZV;Fi$_yw#I z`2to6zkpSO7qCjqRE8I@O85n=5`F=z1TSEf;03G_ynvNa2DO*q1+22JRMrc+_!zK7 z4D)qS=?(?^9M2ir1+s0R(%Y%5AC>VZJu;@ZknKhuh{^_1S$oz@S+cma7v6EYxA=W8 zR#MsZ zub}obGViHoY=9|mq~xqx-DP+tjzZ1psl)YyEAn7f=1v{>HVWhP3KyOu9m0&So2fLj znQS;O2B2-aV#_v0vSl05M7E*QXIKP3kP8gg*|H7Q*|POR?QSx!3&_t=lx+IT-tquY z=IhA7yu?14tshvxX)>;m`Ju5zV#Cgzo3TT@HBySb6&sfLndWMpDYe&b!(O{h?X@q; zP)sd0n8N44rT=3qK@2(_XS?Xi6yq6@hcV{ojP|$Cb zd$$OF4Y#TVs?2;3_pT(y@Z3wH4DYTa((vv|LZx?CGMh>Q6?6V=yc6l&l_XM0oXVZ8 zjAk#H+19-)*`x9U-98W8yOJOU3}{gXDe*JByOOC?qMRvJVv_D;F&_b~PFTqdrTmgm zBi{;6kdFgQO;mbWM;l_ecO}8Pd$+h!uQ=bRxEP_72jW6Kzrx60O(n}cy}OcminAQO zV7lSm+3>MA-kK{(bBl^8tKK!%P6t}#wIB#y#W0A?aZEX_`+uBBxZA7c8ZN9pS znUBdH@Nr7BwwXqL1UQlTO|%eS#F1TihGAOUG~Kl2#VF6giVX$;-!8HhkS*5(vA)-6 zD>CwzlC4ta>rt64RSBFd3y=-_q86ts9&>9~m4UPLt)9E>64}%isV&japS>{(b(C#$ z7P>w6?CuVIV>BC)o;om@-P4`wggBO0#DvB`ws?lyaqjOK118*xB+=;zwnsBhV9K1~jZ+OgWoAAg zB936ntSF<*Cq=~(Oqs=d+zTkhPTn3Z!?%1`&WD}qeq1Tya1)iO&!ARpQ;N7-S47!C zeIh8k6Sa59%G)9DJ4)WNTU+OWxpM&jScl)qdYG+dr?~|>@GyY-q?t2{QDvXT_Gkgi zctvfG)-_PpNS5%DSbh|HTA3>$SWahghf7U}nJ#uUoT6RYmg#tf^R#16>fqcYp(u}+q`7^*84XYawLVP!I9 z)`|D-(bBZcDlzF8R=6|$MCviE-+;`JNR0NghCq#2Q*-d5Ht=O06zh&@gF0lUvH|La z^BA^7Di2ZSCh^iSZJL((s`%@eHdxENO$c}z;Vq6Es&f_p<<*$_K5>KFlmNi2B=eRbZL*{C1vs4@w!%k>EJu;s};hC>c z0%N1hr$qb-cwm_^V#x`u-~7xZW7U6gkxtFy6}rq*YSlk8w{_KjW-+h&XBN3=Nz%Xl z-C1($;a*AT9q};;*)vyA;6n;9Q`H{nD*+hgx0^CO+`Z61UjlJG7NUiCkO z{n*jIPZItCRMeiw^wSox{$6b$E!jqye~Sb6vbFva&)lnxjLMva&jss*d8O6O7ru1L zrj!4}f;(vOyYed7noH0f&_;IiHR~NQ;XZu!ICGwpP3>~g;y*q1AQnI7u?Ml_HL>_U zEk9uKdc#9qjI}^+;EU}pb)O?UT6t&n1eX|@<%8vQ*zWtWke(F)N4}iyqH+yh_TrNq z*DOBj;_FJd^yO1HwU$$}@fSi%{=pADrD}?pb3Yc+7r*GH{i;s;c}2UtKvA3DMCCbh zh_8w?OUm=~h4i2qGmTg4X4R{O^sHsf&TSxCzLkT*@^wra-)$?erK$x;RwJ$`uRvT; zUcj7%lMkpB-1!(2?dnuh`F8Xfn!d0 z6*y)ub&vnq%f$LqT9{V8Ry=hI2P!KX_`u^J6&fwUKmDc;_|9snJa#st#?PkMYiB5KDUpLv+ zTm|o>J2BoaxziwfnW3w7=n*%&xj1{@B1tdByW$T}`9pB@%3W~u${&zzeQA_g-pgI= z=#@7sU~;#Yw7A4ISM;l@kB5u6h}$ zVy|0dShqqok%~RKbt~>PtXt7Y7543|+OBZuT4p}>c))inD^wgb@?GFW<~LClyk4mh zOjLSmzi!sHUbGM*}96#P+T-6dbJb+ra%-Rcu&`L>ek-Ta{lS-2Jv$pcjRC~RGM8n&){ zSV~lzpln@vnr&TqMgiw2Ti4E&wyu0pLMxy5uyy4r!`7AdlZLS?A22#^B^m%eR9$(L zD&gm%-&G#`Ut3q6rpkv@?onmy%KdF^y+m!TRo?AZ0Bl`(Sk*bC+uB~~G>na@uyS{+ z?kiQ7bxA%BdB8C;NT!bICaHwz56S!{s>bW=Z0pK<3|m(o(QRG(u3k^|Sm1q&DqpvI zAU>xTc*j8eB~^YZ^L1NSKBp)@qZfSAu=SD+Dg%w6)z(W=;Up?}OB?-}d6%S}s?vS_ z8u_$c7M#CMEN#XpIWO1DdnVPq=33pr4n}n?oQ7(w3|E&?T{@CBI2hH1a4@PfQP7He z{AsFNu!rjA;hDctT^;M98o>BCM)g1^)rF%*KV+`jL%G{fV1B@5s+vqo@1vTtRA;8T zXq2p)q#viRnnw67J&7M9811B*=YYT$bPMJ%OY<)RbPgc?s8sbdJY2xTWUz-mHw&=3 zD)!RqiuhVR8~K-zABcyli7iwWNmcx>928VaT-cge`UbKixU4-MPjBNX1_koJZ(%H0 z{>JyBtGdHU>Wanwsv98b0jlbVhF{f{>JD9_Dy^ZxNlSjFsxFXay?e2L$xpn%zvKsb z{YG9dqa42lzT_<|eJ}mhL3LYk{~h<8$hpWX`b*wmzLvZQ*skMLjTI^K%Qa9Szhd4^0>YVzvLmRSiw~bSVj)y-pTUqx67FZfBdI}o zpz11X{Re1$166&;TE9y5H$v-QNUgt3RaeYZU(%}ex1^>o$m=l&Ur*?9bX%$UyiKLabJflG$lJ#;rsGbdkvsX03GGhhosi`8|v6i_1hS{ z%>Y1?QYCVqs;bcdAEbJ`L{`Het*gTR8Ll^Sv3h*P0JRSq#ZFTF5e6J!u)XS-0Y6Rk z_u&U7ZsqKoWv%t#>mh*FFlaS6t(yVJqk!<1Sk+2MTss<&$8aBu`%@087*-R` z5y{ejIPzH5gRe`k@ii|@ukNwFu)v|Bklddx8{1d8zlrT<5QQuV6X(z1pWB#!7PCOj z7I0j1BO9w`1!jSorO;<3Ez3r7F`5s$6jB)VYw&%`n&i{845!GJ<)20X40YF7T~zlt zEeql5L!GoN3N;3yuze5Z?LdJAA(v_C45~dvb=QDW~|tfS0-Pds&23y7+Dm8Gu1VJk?zpRYArrPSw?)Iq$sp&xS1 z9SFtF+)ueT;2yG&a=WvpbBBqL76f<8UZdP8qO=8zb4w;05&M!E*w3mRBxlIlfy&va z?FN!CVy7mmRi7|e_M=%sI_e=)ZF_xbuI8U+s`-`kYJO>^<(;I1u)KrW*b}PxjThr^ zG(;A8&53OrxL+89>hOFy24ci7cOD#AP^p$WuQ@Wp$?v7yb8E z7=N@EEaX|6sqPrWxk-t$Nf(F1Vu(`*ah6Jo_T{-so?1hmrMf(|c;}?HP!`XJJatN* z8gnyMV;z^hpV}f1iE4v%iNF~C&1}?#X;3KtA-4uiB{hMXs;@X{-aCunUd%uNOVcD_`DM6Lqj0^!?SV|s`eskzaj;C2?Bj2 zOWT)!0Ez1KZNA!bo)X>dmZ*LqOH_A*tWq$iJXQSN!;$Pv`D-}O)1oJD(I3B3^58{EE?+_2vd?OXG!me6t z&37CR)cmY~H>-GH#ceVks8L6=YX0(w2Wq}F;(?majc~wT^O+G3)O;x8ftpKHqjnu? z-frX1%Gj^wJE~Dz&NY`*3#hr+HXf+O>p8bbicwl8$Wvm+G3|{RG z7)soD7f`LYZp|(_;@Uw}+ut)DsQFVd|GSRqCnFxHZBiLOx8;$XOuG`h65Q?ok_NB+ z!^5<-FsP+L_N`A1)7E~XEQ=wo_L4Mh?R!*<{Vg7W-uz$F)_y~^U#i^qlxb^UZ)@5* zwXItFwp(79wicTpjPWhqw6zzFNU!!)s(s1pI^O0}eWUheL&M4%Rz=-BfG{c- z)qV?3bkiX#&S2yjd&dMOQf9Un3W z{#PB-Rl~G(kEo0*Zc$;{x{Xwamd4WltW3LXnA^0=@o&(xpsJ70#h@okuBu=|*Zl-T z*Ij|3>wb{dTeVRcy6y@ay6!gxyj2-`)lO;XdT$A>yY6A=x^E3b*M04D+0_D0-B(5* zu7k}H)7O1WbstFbb?^VLq3f%&#$58Tqj&~+HmA$r{<-OzRK zneB#N5u%)LReYVXjKX}VWfWBv4M(E*#He=_oalyLzDXIn?y_O%x{q{2ukNYWQwD`U z*Ny6LKt1_65%5&6e@CyrhmN>@7}XE*G<4lRit^t&re6(1*FUZ@@S#Y3xPqbUZ>D-R zbJyX-Fb~}NiBkR-4rKYFhaK2(m8W5f9sv*&+9{c_{G?Lp^22gsTz;U5mhY8zT)kON zjLWgeDci{Mz52ws9A{IOZ)3$QzonU0A5f+D@w^zObh4Z`7!BWLIVNU{LXo->Gcziy zcYcdMGUMB+|DG6&p1Px^Sg0`8OU?W~0R#4HrwihaliY|C06QQNZE zNGZGo&8#`-8BK^`=in_B^ z7gTs&965)72)S^Ic3g41xffD1OjS%(wu7%mtWNe(ApVP_`A3Uezd~h#E924-;l!26uVz1 z%&$@y@m684w#Nilu0;c)l_79wX>BrJSI!pp*R+9S3MU)ek}LOmY)h`pjWE04g<4xJ z&b+404_N7I1R5*HszG4oaF=SR|CJ4NrCQTofk+P4Un#%tw6aB{p2xmqkq;uYl{m7z z@@|ApD{;6I*H{-{`L&*v`~|(0Lpk*U{ywC&2k=8vS$kd_K97CLm5bcOm*~V7D&niW z6}i8gXyqTWy|4Y;EE)LA*q8L5Vf^z4k^R)ZWYJu(vuY}cuA0OF)Kc5iqXuX3oYrCBuRlUNx1=jzif|v<`1~tr|gVzsC>Ut{W^?UqE9nN)>lp zzzaTwT`6v(GSCdqeeJ?NZ4I=l2r>W>n`Rxp(Xx|P4cDvjKA-xyOL2R(A6bZhQod;2 zaVlCN#=njie2VT6b+6+EpJHqiVn4Dd6Q;w706+OnU417n4t@{k<#QetJq)DA9%T{M z1B!4!MAhMrW4z!~)JIHxLksm?^_}GIgyilC$(`KcUd3DKOejb^utOW_zq*4g_q;6k zt}OSQDk1+(WIeDgItmUDTo>ITSves-eFMXxy&V-jD!N?6i$1F(7|m*!btl<-^L4eC zytd%o0>k19fI{XYS0MH3>Ml{HH?IM4&?4@&nBT`|BTVEl4d}U4TLj0trY!Ko)70 z_WjN|cbMSQCzE?;&ibD1+s-CC32SY$t{02`hND3IoupQSNxvWAKfBRK)6LLbI1mBu zI5R@h(a^8d?>=zrouR;1*}X%2;ShRsXf)m`+-wz2iF5v*%?Ljd|Ck?B{)X}&r?kV; z!HSTF3>Ibl`4DCNc@SlMYSmEad8h2R{yY|C`~~ty=w&6!gqBKC#($9tQj{ag_^@|J z$*jK9w#@3oK9J$2?Ec3f$>4NP-x2a1lK6cGJFsG@j`;J)_r3BxqCoogXPI>^U)JQG zpu7)d`8z}z-(lt0-mF-K?<-qo_3b5JixeC-7lkWx$G$4@? zGgSG4P8MWUe}kAOk;Ge@sb*$q4u(P^@DEbA|SOa+@8u^PnXx3%crrCpso zFHyM>b~^NnQUR2mbf(ipv9aH_m!o!+eWLnOVoDqZ-TLw}jL1HdCOQf-+`3y80DxEHfCn*(~j?ff0~shQr(%2sr`r zQwj`4XAKM|bKCb67|iz8KtBrH=_E6gwYLWPvW+#+M?Q@J37jcQ9gxLKEQhIh;`j2WusQ&<& zU$FBRw!>CA?mk*>Cf6KHg3adNwcK$CYQzpCXQk7 z5wQ4sG>OcSf?NX>i7cDjG7JNQNo3hP(SJKgWZ7yaUrZj0@NeHiIdZK!Evb|lx3Lw- zj7{7w249(O`~g*$p>Q3(uHk;vfR1b|L%=0?|E7_`Z!Dqk%0>znqh<}ims>NcjxSSTXF4^*WGZ?gq(88dP}7=={AxJ80c8+c`-PB!9&r&{~yTGB+JjYvj` zSiyP??G*)WF`xr)2hx+X<+RNSQ~)tRatFPz+fOzb%qVE(yAHUIR?=`k;t|JnX=^!7qk1fSI$YP~eg0cGQ7-(nX zljaV;byPdM6A!9A`aYHR0v8F0MZoy2A zCN`9&X?&E!$Bi{MA2(LneB8j&1I5P;EFgkK!dOYh?<5Rk*$>&cv6c+ACf8UQQYekO zj(j|*ZX7gzmt}6?q(erVU6N?9xESOJuy5<>Smnv^#Jt&vCDn?qs}f`@aMJ z)TsHmIbJ7QZ}V|uh34ayvQ?4sksWaxsy-*-O*-Knw*LV#_DO%e%D`B!u>V;HY}RZ% zM8TNy!D^MWCW+u=3Qkb&f9z0!Fi8y81~$(=+dScEg)6#trHol6to0%AS=Rax*oh&9Q>`6*zWbQmbJGW{1PN4o-KdgIG`J9ZYnTXSgdo&yt*&8l{|^ zcN$C!vrx>j_bb!FuTe^nFN%#2HM_Cm+w~3?u2j6U8!NtJ50QJGXxohgvBJ**JcTDQ z&xn;u{xMN;jsdr*1F^!Zaunh4lR1iTEIu4+(lFNfr5fcrC7${c%fn;K$lXOO`O;Bx zO?anF{tNlU3?H(plUYGD1bc?11<$48=$DS(1Kk61GI9^h$;h31<%WB(K5&Q^568X~ zWA-?1{K?~)Yv#Lx?DuB<|10Ei_Re2%W@FK$B)pJVpoef5-hmbd+_60XLGHy zmb$Li=v;@zqPLQ9iCXVcN^eK)%lY_#zQKLW_++STU zi<|dx8mq|lmYBW|2RlXf%Tm22Q(7yZQb~=h6m|O?efnA5a?*=z$SGC)A33Em3~^|m zH1LFe_XM%_Mf|kv;D_a-9U*O&b9vxx|I!22V_PE#b#tQ#Z`xk6m-fwH*6btTr08} zU#Gp0wB9Lx_i0QsitZBn?eAjfE zxJ{?aGGsQ}M}CP0m4B+#SU-%i%eBObB-gx!RUT{-kk^~)V|W~+)ADp-mr;wj+<~mm za$3a7y=*2?j}{SA_B*D9tOsnN%$lhvyfv*s5+bWVvQ3kv=31;l>engh_Rl5hes_8Blb9s5=0i(Y+XX zN4>})>S8fEdOzob6=2cvlpKt&;~*SIM?s8^4q+HOSfQ}CFu16fgFb?w4^eV7zD}p) zHTW>FDd%<~TqcB0bONnF?pM%s(ulaoDTaLI=!xrdXwti?fd=Q=3tcaFY}e>-Q5xjK zEt-6cpV4VL+S&7FJeMnTl zZ)2p?k|!UaY}1pc04NW$JGzWKXUaA`x!q#@L7XiUyILZVB7X9uM6yRdTSaj@&X$P{ zWB*tlyQMCYKL6IqaRId=;690*$A3od{S3kVPZ4NG$4}i(o~~kfJ4{ZoN|_8A5y{-m z&)9A9c{@Knvvra=`joe`(x*K0v&_;H5I;NQ7!-;Q`7b6XbcfhbtYYolQ%RkPd~G}T zuV*9FRrtqkXmPcZEwxZ}`jn;Kv4=S3U>&oMjv1Z8y4zU%V=4gYLl5R9@oG7xcM?aj z4_i};Vx<>D7}AB}fG$BXA>DE1wtS{GC7H2P@l z1o~*~KqJLk@ZQx(siR9Mb-0ndtkuQ--VmbXSW5AMO|ds?DfKr*sfUlZa5E)_QgR}t zwo>YI?$_@ryG3Fc;gh@ zUhxr2is_T9*c%%jX zBzF=|mALwA?8Nuv)4k8?=Fc_#d%ATTGVv$42gOUczf|4H&v<_sZJ<0uTT^E5H>%fo z%UWzL+*>Z{zeca|uHcqDR|~)AMWuy%#&OfE0{r;fvT0uBrop`&aY0pKe0?5G6HlXQ z;!y+);Qe$XRn;t^suXBmUo=2`KIp|hs^ZJF;-hP+>T$#v!7Z}_Epz2|O14wgV^sAd z*U{(Al-Nnhuc>M-RmsX)F2YB^H9Skj%SXThJ+s6gk3bWTAD88p;!V|uvfQh5xpQ`? zcwRx3j{1N+X}l*?ljj9l$IHdQqZo))$FP%7JbV$8wXlP*ttrF0DDzj1r4a?i5j+wx% zw+h-5i0zfo+<>NTi>&rTD2|4(cuQtoo`WtiOryhCAfBbuVS=`Bj1pAx8WPsUliwim zoeCOeu4OKp6toS1woXA?rJ#LeLtCezg%bad=ouO7_rSJ61z!(rv#|qSLTk!}_RLvm zlTmNyo@E?=T@G=`@Q~u!uEDKWUkjUttdi8@nv5B|Cmk9(XvcgRsQQ$mde!afomh7^ z61M8dF!A@aqK-t3sZiIX>+B5XA+hLZBW z#Sqnul2wz02}nXrKA@{6iEXLLyJYaOO;j^ORz}T(+-hf3%_On(FFUuIyy|St?B|*p z*-@#R4e(qiQpr;`h;`08`Q#$?V`EmUvpx~c$1$f|UIv;~^M=@U97EjBgc4Vt;=-*K;-sT*;ex4D{wGJj2QKeH zQ{NOHpLCRT%82hzI3(u>0-ezEh5y3;ih- z=BgP3al3q5m;C8HZ(@3W^{kV3ppRaa2Pwq)D&&>Kd16{Y{!NbgX|bRn-&vA|WZ!u# z5?|2n?0@Z(Wfe0XnN#7p_KIsODz0U{t7qc5gDWoE<)8fOkT>72xNn#^Q;=VC_2^~i zy65HPb(u4F<`eVEp2F9>JV))r;_a^aw_N$|Q!lOCaOsd^#jC4t9+4{C0zayl`P6JX W*bq_DEx)Je)h+*`d`E2$`RhMSpCe-c delta 62695 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 diff --git a/ovn/proofs/ssprove/extraction/Hacspec_lib.vo b/ovn/proofs/ssprove/extraction/Hacspec_lib.vo index 98a2f26594c2cbc32a6d95486071189a12335145..a84e358eeff649e6d3129fa90e56663fdcc6fa9a 100644 GIT binary patch delta 286 zcmZ2_jD6`b_6@JX1Y6FluUY#1hvL!TGX>IzURy7i{?Ud}I(ULXwW;iGzwKuu!rD4~ zZwH-fU$8*iBQd$SAT>GOCo^e*I+Wuu!QlFV3HeRTSD!X<|4tM2dUjRKM9vtZkc@|`1QYXJTGd%0PB!+zp)SYt@i;GjIKX7LhoqWh$XuGgGqcE=kx~Y@1 z!puZj#b05%YdrZd#l@-9AGkA$PCn!=v|ZSpQJ7Z%-PFlh zVP>MN;;%4Ww!JZg(W_Trl6GgJ+20eTTaRr~%UaN)KJ5{s<@EOt8C9oSK4LV$ke*)o Qh|x^|-I3GJKVl360L-m?GXMYp diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.Random_oracle.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.Random_oracle.v deleted file mode 100644 index 5fe5835..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.Random_oracle.v +++ /dev/null @@ -1,1834 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Hacspec_lib. - -Program Definition random_oracle_init {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 (unit)) : both (L1) (I1) (unit) := - tt. -Fail Next Obligation. - -Definition t_QueryCanvas : choice_type := - (nseq int8 TODO: Int.to_string length × t_Sign × 'bool). -Equations Build_t_QueryCanvas {L : {fset Location}} {I : Interface} (f_b : both L I (nseq int8 TODO: Int.to_string length)) (f_sign : both L I (t_Sign)) (f_signed : both L I ('bool)) : both L I (t_QueryCanvas) := - Build_t_QueryCanvas f_b f_sign f_signed := - bind_both f_signed (fun f_signed => - bind_both f_sign (fun f_sign => - bind_both f_b (fun f_b => - ret_both f_b f_sign f_signed))) : both L I (t_QueryCanvas). -Fail Next Obligation. - -Program Definition max_under_impl_16 : both (fset []) ([interface ]) (t_Output) := - ((from i32(1)) shift_left i32(384)) .- one. -Fail Next Obligation. - -Program Definition max_value_under_impl_16 : both (fset []) ([interface ]) (t_QueryCanvas) := - from max_under_impl_16. -Fail Next Obligation. - -(*item error backend*) - -Program Definition from_literal_under_impl_16 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_QueryCanvas) := - letb big_x := (from x) : both _ _ (t_BigInt) in - letb _ := (ifb big_x >.? (into max_under_impl_16) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; - too big for type QueryCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - into big_x. -Fail Next Obligation. - -Program Definition from_signed_literal_under_impl_16 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_QueryCanvas) := - letb big_x := (from (cast_int x)) : both _ _ (t_BigInt) in - letb _ := (ifb big_x >.? (into max_under_impl_16) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; - too big for type QueryCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - into big_x. -Fail Next Obligation. - -Program Definition pow2_under_impl_16 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_QueryCanvas) := - into ((from i32(1)) shift_left x). -Fail Next Obligation. - -(*item error backend*) - -#[global] Instance t_QueryCanvas_t_From : t_From t_QueryCanvas t_BigUint := { - from (x : t_BigUint) := from (from x); -}. - -#[global] Instance t_QueryCanvas_t_From : t_From t_QueryCanvas t_BigInt := { - from (x : t_BigInt) := letb max_value := (max_under_impl_16) : both _ _ (t_BigInt) in - letb _ := (ifb not (x <=.? max_value) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [; - is too large for type QueryCanvas!])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb '(sign,repr) := (to_bytes_be_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in - letb _ := (ifb andb (sign =.? Sign_Minus) (not false) - then letb 'tt := (never_to_any (begin_panic Trying to convert a negative number into an unsigned integer!)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb _ := (ifb (len_under_impl_1 repr) >.? ((i32(384) .+ i32(7)) ./ i32(8)) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [; - is too large for type QueryCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letbm out loc(out_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in - letb upper := (len_under_impl (unsize out)) : both _ _ (uint_size) in - letb lower := (upper .- (len_under_impl_1 repr)) : both _ _ (uint_size) in - letb _ := (failure RefMut:The mutation of this &mut is not allowed here. - core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (out), - core::ops::range::Range { - f_start: lower, - f_end: upper, - }, - ))), - &(deref(core::ops::deref::Deref::deref(&(deref(&(repr)))))), - )) : both _ _ (unit) in - Build_t_QueryCanvas outsignfalse; -}. - -#[global] Instance t_QueryCanvas_t_Default : t_Default t_QueryCanvas := { - default := Build_t_QueryCanvas (repeat i8(0) i32(48))Sign_Plusfalse; -}. - -#[global] Instance t_QueryCanvas_t_Into : t_Into t_QueryCanvas t_BigInt := { - into (self : t_QueryCanvas) := from_bytes_be_under_impl_24 (f_sign self) (unsize (f_b self)); -}. - -#[global] Instance t_QueryCanvas_t_Into : t_Into t_QueryCanvas t_BigUint := { - into (self : t_QueryCanvas) := from_bytes_be_under_impl_18 (unsize (f_b self)); -}. - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*item error backend*) - -Definition repr_loc : Location := - (nseq int8 TODO: Int.to_string length ; 9%nat). -Program Definition from_be_bytes_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_QueryCanvas) := - letb _ := (ifb true - then letb _ := (ifb not ((len_under_impl v) <=.? ((i32(384) .+ i32(7)) ./ i32(8))) - then letb 'tt := (never_to_any (begin_panic from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in - letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in - letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in - letb _ := (failure RefMut:The mutation of this &mut is not allowed here. - core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (repr), - core::ops::range::Range { - f_start: lower, - f_end: upper, - }, - ))), - &(deref(deref(&(v)))), - )) : both _ _ (unit) in - Build_t_QueryCanvas reprSign_Plusfalse. -Fail Next Obligation. - -Definition repr_loc : Location := - (nseq int8 TODO: Int.to_string length ; 10%nat). -Program Definition from_le_bytes_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_QueryCanvas) := - letb _ := (ifb true - then letb _ := (ifb not ((len_under_impl v) <=.? ((i32(384) .+ i32(7)) ./ i32(8))) - then letb 'tt := (never_to_any (begin_panic from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in - letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in - letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in - letb _ := (failure RefMut:The mutation of this &mut is not allowed here. - core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (repr), - core::ops::range::Range { - f_start: lower, - f_end: upper, - }, - ))), - &(deref(deref(&(v)))), - )) : both _ _ (unit) in - into (from_bytes_le_under_impl_24 Sign_Plus (unsize repr)). -Fail Next Obligation. - -Program Definition to_be_bytes_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_QueryCanvas)) : both (L1) (I1) (nseq int8 TODO: Int.to_string length) := - f_b self. -Fail Next Obligation. - -Definition repr_loc : Location := - (nseq int8 TODO: Int.to_string length ; 11%nat). -Program Definition to_le_bytes_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_QueryCanvas)) : both (L1 :|: fset [repr_loc]) (I1) (nseq int8 TODO: Int.to_string length) := - letb x := (from_bytes_be_under_impl_24 Sign_Plus (unsize (f_b self))) : both _ _ (t_BigInt) in - letb '(_,x_s) := (to_bytes_le_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in - letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in - letb _ := (failure RefMut:The mutation of this &mut is not allowed here. - core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (repr), - core::ops::range::Range { - f_start: 0, - f_end: alloc::vec::len_under_impl_1(&(x_s)), - }, - ))), - &(deref(core::ops::deref::Deref::deref(&(deref(&(x_s)))))), - )) : both _ _ (unit) in - repr. -Fail Next Obligation. - -Program Definition comp_eq_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QueryCanvas)) (rhs : both L2 I2 (t_QueryCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a =.? b - then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_QueryCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_ne_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QueryCanvas)) (rhs : both L2 I2 (t_QueryCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a <> b - then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_QueryCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_gte_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QueryCanvas)) (rhs : both L2 I2 (t_QueryCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a >=.? b - then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_QueryCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_gt_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QueryCanvas)) (rhs : both L2 I2 (t_QueryCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a >.? b - then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_QueryCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_lte_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QueryCanvas)) (rhs : both L2 I2 (t_QueryCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a <=.? b - then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_QueryCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_lt_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QueryCanvas)) (rhs : both L2 I2 (t_QueryCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a <.? b - then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_QueryCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition inv_under_impl_27 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QueryCanvas)) (modval : both L2 I2 (t_QueryCanvas)) : both (L1:|:L2) (I1:|:I2) (t_QueryCanvas) := - letb biguintmodval := (into modval) : both _ _ (t_BigInt) in - letb m := (biguintmodval .- (from i32(2))) : both _ _ (t_Output) in - letb s := (into self) : both _ _ (t_BigInt) in - into (modpow_under_impl_24 s m biguintmodval). -Fail Next Obligation. - -Program Definition pow_felem_under_impl_27 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_QueryCanvas)) (exp : both L2 I2 (t_QueryCanvas)) (modval : both L3 I3 (t_QueryCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_QueryCanvas) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into exp) : both _ _ (t_BigInt) in - letb m := (into modval) : both _ _ (t_BigInt) in - letb c := (modpow_under_impl_24 a b m) : both _ _ (t_BigInt) in - into c. -Fail Next Obligation. - -Program Definition pow_under_impl_27 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_QueryCanvas)) (exp : both L2 I2 (int128)) (modval : both L3 I3 (t_QueryCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_QueryCanvas) := - pow_felem_under_impl_27 self (into (from exp)) modval. -Fail Next Obligation. - -Program Definition rem_under_impl_27 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QueryCanvas)) (n : both L2 I2 (t_QueryCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - self .% n. -Fail Next Obligation. - -#[global] Instance t_QueryCanvas_t_Add : t_Add t_QueryCanvas t_QueryCanvas := { - t_Output := t_QueryCanvas; - add (self : t_QueryCanvas) (rhs : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb c := (a .+ b) : both _ _ (t_Output) in - letb _ := (ifb c >.? max_under_impl_16 - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded addition overflow for type QueryCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - into c; -}. - -#[global] Instance t_QueryCanvas_t_Sub : t_Sub t_QueryCanvas t_QueryCanvas := { - t_Output := t_QueryCanvas; - sub (self : t_QueryCanvas) (rhs : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb c := (ifb f_signed self - then a .- b - else unwrap_or_else_under_impl (checked_sub_under_impl_24 a b) ( - never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded substraction underflow for type QueryCanvas])) (unsize none_under_impl_1))))) : both _ _ (t_Output) in - into c; -}. - -#[global] Instance t_QueryCanvas_t_Mul : t_Mul t_QueryCanvas t_QueryCanvas := { - t_Output := t_QueryCanvas; - mul (self : t_QueryCanvas) (rhs : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb c := (a .* b) : both _ _ (t_Output) in - letb _ := (ifb c >.? max_under_impl_16 - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded multiplication overflow for type QueryCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - into c; -}. - -#[global] Instance t_QueryCanvas_t_Div : t_Div t_QueryCanvas t_QueryCanvas := { - t_Output := t_QueryCanvas; - div (self : t_QueryCanvas) (rhs : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb _ := (ifb b =.? zero - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [dividing by zero in type QueryCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb c := (a ./ b) : both _ _ (t_Output) in - into c; -}. - -#[global] Instance t_QueryCanvas_t_Rem : t_Rem t_QueryCanvas t_QueryCanvas := { - t_Output := t_QueryCanvas; - rem (self : t_QueryCanvas) (rhs : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb _ := (ifb b =.? zero - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [dividing by zero in type QueryCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb c := (a .% b) : both _ _ (t_Output) in - into c; -}. - -#[global] Instance t_QueryCanvas_t_Not : t_Not t_QueryCanvas := { - t_Output := t_QueryCanvas; - not (self : t_QueryCanvas) := never_to_any (panic not implemented); -}. - -#[global] Instance t_QueryCanvas_t_BitOr : t_BitOr t_QueryCanvas t_QueryCanvas := { - t_Output := t_QueryCanvas; - bitor (self : t_QueryCanvas) (rhs : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - into (a .| b); -}. - -#[global] Instance t_QueryCanvas_t_BitXor : t_BitXor t_QueryCanvas t_QueryCanvas := { - t_Output := t_QueryCanvas; - bitxor (self : t_QueryCanvas) (rhs : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - into (a .^ b); -}. - -#[global] Instance t_QueryCanvas_t_BitAnd : t_BitAnd t_QueryCanvas t_QueryCanvas := { - t_Output := t_QueryCanvas; - bitand (self : t_QueryCanvas) (rhs : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - into (a .& b); -}. - -#[global] Instance t_QueryCanvas_t_Shr : t_Shr t_QueryCanvas uint_size := { - t_Output := t_QueryCanvas; - shr (self : t_QueryCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (rhs) : both _ _ (uint_size) in - into (a shift_right b); -}. - -#[global] Instance t_QueryCanvas_t_Shl : t_Shl t_QueryCanvas uint_size := { - t_Output := t_QueryCanvas; - shl (self : t_QueryCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (rhs) : both _ _ (uint_size) in - into (a shift_left b); -}. - -#[global] Instance t_QueryCanvas_t_PartialEq : t_PartialEq t_QueryCanvas t_QueryCanvas := { - eq (self : t_QueryCanvas) (rhs : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - a =.? b; -}. - -#[global] Instance t_QueryCanvas_t_Eq : t_Eq t_QueryCanvas := { -}. - -#[global] Instance t_QueryCanvas_t_PartialOrd : t_PartialOrd t_QueryCanvas t_QueryCanvas := { - partial_cmp (self : t_QueryCanvas) (other : t_QueryCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into other) : both _ _ (t_BigInt) in - partial_cmp a b; -}. - -#[global] Instance t_QueryCanvas_t_Ord : t_Ord t_QueryCanvas := { - cmp (self : t_QueryCanvas) (other : t_QueryCanvas) := unwrap_under_impl (partial_cmp self other); -}. - -Program Definition from_byte_seq_be_under_impl_8 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_QueryCanvas) := - from_be_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - declassify_under_impl_2 x)))). -Fail Next Obligation. - -Program Definition from_public_byte_seq_be_under_impl_8 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_QueryCanvas) := - from_be_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - x)))). -Fail Next Obligation. - -Program Definition to_byte_seq_be_under_impl_8 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_QueryCanvas)) : both (L1) (I1) (t_Seq (t_U8)) := - from_vec_under_impl_52 (collect (map (iter_under_impl (unsize (to_be_bytes_under_impl_15 self))) (fun x => - classify_under_impl_2 x))). -Fail Next Obligation. - -#[global] Instance t_QueryCanvas_t_NumericCopy : t_NumericCopy t_QueryCanvas := { -}. - -#[global] Instance t_QueryCanvas_t_UnsignedInteger : t_UnsignedInteger t_QueryCanvas := { -}. - -#[global] Instance t_QueryCanvas_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_QueryCanvas := { -}. - -#[global] Instance t_QueryCanvas_t_Integer : t_Integer t_QueryCanvas := { - NUM_BITS := i32(384); - ZERO := from_literal_under_impl_16 i128(0); - ONE := from_literal_under_impl_16 i128(1); - TWO := from_literal_under_impl_16 i128(2); - from_literal (val : int128) := from_literal_under_impl_16 val; - from_hex_string (s : t_String) := from_hex_under_impl_15 (deref (replace_under_impl_5 (deref s) 0x )); - get_bit (self : t_QueryCanvas) (i : uint_size) := (self shift_right i) .& v_ONE; - set_bit (self : t_QueryCanvas) (b : t_QueryCanvas) (i : uint_size) := letb _ := (ifb true - then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) - then letb 'tt := (never_to_any (panic assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb tmp1 := (from_literal_under_impl_16 (not (i128(1) shift_left i))) : both _ _ (t_QueryCanvas) in - letb tmp2 := (b shift_left i) : both _ _ (t_Output) in - (self .& tmp1) .| tmp2; - set (self : t_QueryCanvas) (pos : uint_size) (y : t_QueryCanvas) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_QueryCanvas) in - set_bit self b pos; - rotate_left (self : t_QueryCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - ((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); - rotate_right (self : t_QueryCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - ((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); -}. - -#[global] Instance t_QueryCanvas_t_ModNumeric : t_ModNumeric t_QueryCanvas := { - sub_mod (self : t_QueryCanvas) (rhs : t_QueryCanvas) (n : t_QueryCanvas) := (self .- rhs) .% n; - add_mod (self : t_QueryCanvas) (rhs : t_QueryCanvas) (n : t_QueryCanvas) := (self .+ rhs) .% n; - mul_mod (self : t_QueryCanvas) (rhs : t_QueryCanvas) (n : t_QueryCanvas) := (self .* rhs) .% n; - pow_mod (self : t_QueryCanvas) (exp : t_QueryCanvas) (n : t_QueryCanvas) := pow_felem_under_impl_27 self exp n; - modulo (self : t_QueryCanvas) (n : t_QueryCanvas) := self .% n; - signed_modulo (self : t_QueryCanvas) (n : t_QueryCanvas) := modulo self n; - absolute (self : t_QueryCanvas) := self; -}. - -#[global] Instance t_QueryCanvas_t_Numeric : t_Numeric t_QueryCanvas := { - max_val := max_value_under_impl_16; - wrap_add (self : t_QueryCanvas) (rhs : t_QueryCanvas) := self .+ rhs; - wrap_sub (self : t_QueryCanvas) (rhs : t_QueryCanvas) := self .- rhs; - wrap_mul (self : t_QueryCanvas) (rhs : t_QueryCanvas) := self .* rhs; - wrap_div (self : t_QueryCanvas) (rhs : t_QueryCanvas) := self ./ rhs; - exp (self : t_QueryCanvas) (exp : int32) := pow_under_impl_27 self (into exp) max_val; - pow_self (self : t_QueryCanvas) (exp : t_QueryCanvas) := pow_felem_under_impl_27 self (into exp) max_val; - divide (self : t_QueryCanvas) (rhs : t_QueryCanvas) := self ./ rhs; - inv (self : t_QueryCanvas) (n : t_QueryCanvas) := inv_under_impl_27 self n; - equal (self : t_QueryCanvas) (other : t_QueryCanvas) := self =.? other; - greater_than (self : t_QueryCanvas) (other : t_QueryCanvas) := self >.? other; - greater_than_or_equal (self : t_QueryCanvas) (other : t_QueryCanvas) := self >=.? other; - less_than (self : t_QueryCanvas) (other : t_QueryCanvas) := self <.? other; - less_than_or_equal (self : t_QueryCanvas) (other : t_QueryCanvas) := self >=.? other; - not_equal_bm (self : t_QueryCanvas) (other : t_QueryCanvas) := ifb not (equal self other) - then max_val - else from_literal_under_impl_16 i128(0); - equal_bm (self : t_QueryCanvas) (other : t_QueryCanvas) := ifb equal self other - then max_val - else from_literal_under_impl_16 i128(0); - greater_than_bm (self : t_QueryCanvas) (other : t_QueryCanvas) := ifb greater_than self other - then max_val - else from_literal_under_impl_16 i128(0); - greater_than_or_equal_bm (self : t_QueryCanvas) (other : t_QueryCanvas) := ifb greater_than_or_equal self other - then max_val - else from_literal_under_impl_16 i128(0); - less_than_bm (self : t_QueryCanvas) (other : t_QueryCanvas) := ifb less_than self other - then max_val - else from_literal_under_impl_16 i128(0); - less_than_or_equal_bm (self : t_QueryCanvas) (other : t_QueryCanvas) := ifb less_than_or_equal self other - then max_val - else from_literal_under_impl_16 i128(0); -}. - -Definition t_Query : choice_type := - (t_QueryCanvas). -Equations Build_t_Query {L : {fset Location}} {I : Interface} (0 : both L I (t_QueryCanvas)) : both L I (t_Query) := - Build_t_Query 0 := - bind_both 0 (fun 0 => - ret_both 0) : both L I (t_Query). -Fail Next Obligation. - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -#[global] Instance t_Query_t_From : t_From t_Query t_QueryCanvas := { - from (x : t_QueryCanvas) := Query (rem_under_impl_27 x (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)); -}. - -#[global] Instance t_Query_t_Into : t_Into t_Query t_QueryCanvas := { - into (self : t_Query) := 0 self; -}. - -Program Definition from_canvas_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_QueryCanvas)) : both (L1 :|: fset [x_loc]) (I1) (t_Query) := - Query (rem_under_impl_27 x (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)). -Fail Next Obligation. - -Program Definition into_canvas_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1) (I1) (t_QueryCanvas) := - 0 self. -Fail Next Obligation. - -Program Definition max_under_impl_64 : both (fset [x_loc]) ([interface ]) (t_QueryCanvas) := - from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab. -Fail Next Obligation. - -Program Definition declassify_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1) (I1) (t_BigInt) := - letb a := (into self) : both _ _ (t_QueryCanvas) in - into a. -Fail Next Obligation. - -(*item error backend*) - -Program Definition from_be_bytes_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_Query) := - into (from_be_bytes_under_impl_15 v). -Fail Next Obligation. - -Program Definition to_be_bytes_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1) (I1) (t_Vec (int8) (t_Global)) := - to_vec_under_impl (unsize (to_be_bytes_under_impl_15 (into self))). -Fail Next Obligation. - -Program Definition from_le_bytes_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_Query) := - into (from_le_bytes_under_impl_15 v). -Fail Next Obligation. - -Program Definition to_le_bytes_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1 :|: fset [repr_loc]) (I1) (t_Vec (int8) (t_Global)) := - to_vec_under_impl (unsize (to_le_bytes_under_impl_15 (into self))). -Fail Next Obligation. - -Program Definition bit_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Query)) (i : both L2 I2 (uint_size)) : both (L1:|:L2) (I1:|:I2) ('bool) := - bit_under_impl_16 (into self) i. -Fail Next Obligation. - -Program Definition from_literal_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_Query) := - letb big_x := (from x) : both _ _ (t_BigUint) in - letb _ := (ifb big_x >.? (into max_under_impl_64) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; - too big for type Query])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - Query (into big_x). -Fail Next Obligation. - -Program Definition from_signed_literal_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_Query) := - letb big_x := (from (cast_int x)) : both _ _ (t_BigUint) in - letb _ := (ifb big_x >.? (into max_under_impl_64) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; - too big for type Query])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - Query (into big_x). -Fail Next Obligation. - -Program Definition comp_eq_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Query)) (rhs : both L2 I2 (t_Query)) : both (L1:|:L2) (I1:|:I2) (t_Query) := - letb x := (into self) : both _ _ (t_QueryCanvas) in - into (comp_eq_under_impl_15 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_ne_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Query)) (rhs : both L2 I2 (t_Query)) : both (L1:|:L2) (I1:|:I2) (t_Query) := - letb x := (into self) : both _ _ (t_QueryCanvas) in - into (comp_ne_under_impl_15 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_gte_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Query)) (rhs : both L2 I2 (t_Query)) : both (L1:|:L2) (I1:|:I2) (t_Query) := - letb x := (into self) : both _ _ (t_QueryCanvas) in - into (comp_gte_under_impl_15 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_gt_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Query)) (rhs : both L2 I2 (t_Query)) : both (L1:|:L2) (I1:|:I2) (t_Query) := - letb x := (into self) : both _ _ (t_QueryCanvas) in - into (comp_gt_under_impl_15 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_lte_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Query)) (rhs : both L2 I2 (t_Query)) : both (L1:|:L2) (I1:|:I2) (t_Query) := - letb x := (into self) : both _ _ (t_QueryCanvas) in - into (comp_lte_under_impl_15 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_lt_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Query)) (rhs : both L2 I2 (t_Query)) : both (L1:|:L2) (I1:|:I2) (t_Query) := - letb x := (into self) : both _ _ (t_QueryCanvas) in - into (comp_lt_under_impl_15 x (into rhs)). -Fail Next Obligation. - -Program Definition neg_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1 :|: fset [x_loc]) (I1) (t_Query) := - letb mod_val := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigInt) in - letb s := (into self) : both _ _ (t_QueryCanvas) in - letb s := (into s) : both _ _ (t_BigInt) in - letb result := (into (mod_val .- s)) : both _ _ (t_QueryCanvas) in - into result. -Fail Next Obligation. - -#[global] Instance t_Query_t_PartialOrd : t_PartialOrd t_Query t_Query := { - partial_cmp (self : t_Query) (other : t_Query) := Option_Some (cmp self other); -}. - -#[global] Instance t_Query_t_Ord : t_Ord t_Query := { - cmp (self : t_Query) (other : t_Query) := cmp (0 self) (0 other); -}. - -#[global] Instance t_Query_t_PartialEq : t_PartialEq t_Query t_Query := { - eq (self : t_Query) (other : t_Query) := (0 self) =.? (0 other); -}. - -#[global] Instance t_Query_t_Eq : t_Eq t_Query := { -}. - -#[global] Instance t_Query_t_Add : t_Add t_Query t_Query := { - t_Output := t_Query; - add (self : t_Query) (rhs : t_Query) := letb a := (into self) : both _ _ (t_QueryCanvas) in - letb b := (into rhs) : both _ _ (t_QueryCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb c := (a .+ b) : both _ _ (t_Output) in - letb max := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_QueryCanvas) in - into d; -}. - -#[global] Instance t_Query_t_Sub : t_Sub t_Query t_Query := { - t_Output := t_Query; - sub (self : t_Query) (rhs : t_Query) := letb a := (into self) : both _ _ (t_QueryCanvas) in - letb b := (into rhs) : both _ _ (t_QueryCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb max := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in - letb c := (ifb b >.? a - then ((clone max) .- b) .+ a - else a .- b) : both _ _ (t_Output) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_QueryCanvas) in - into d; -}. - -#[global] Instance t_Query_t_Mul : t_Mul t_Query t_Query := { - t_Output := t_Query; - mul (self : t_Query) (rhs : t_Query) := letb a := (into self) : both _ _ (t_QueryCanvas) in - letb b := (into rhs) : both _ _ (t_QueryCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb c := (a .* b) : both _ _ (t_Output) in - letb max := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_QueryCanvas) in - into d; -}. - -#[global] Instance t_Query_t_Div : t_Div t_Query t_Query := { - t_Output := t_Query; - div (self : t_Query) (rhs : t_Query) := self .* (inv_under_impl_58 rhs); -}. - -#[global] Instance t_Query_t_Rem : t_Rem t_Query t_Query := { - t_Output := t_Query; - rem (self : t_Query) (rhs : t_Query) := letb a := (into self) : both _ _ (t_QueryCanvas) in - letb b := (into rhs) : both _ _ (t_QueryCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb c := (a .% b) : both _ _ (t_Output) in - letb max := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_QueryCanvas) in - into d; -}. - -#[global] Instance t_Query_t_Not : t_Not t_Query := { - t_Output := t_Query; - not (self : t_Query) := letb a := (into self) : both _ _ (t_QueryCanvas) in - into (not a); -}. - -#[global] Instance t_Query_t_BitOr : t_BitOr t_Query t_Query := { - t_Output := t_Query; - bitor (self : t_Query) (rhs : t_Query) := letb a := (into self) : both _ _ (t_QueryCanvas) in - letb b := (into rhs) : both _ _ (t_QueryCanvas) in - into (a .| b); -}. - -#[global] Instance t_Query_t_BitXor : t_BitXor t_Query t_Query := { - t_Output := t_Query; - bitxor (self : t_Query) (rhs : t_Query) := letb a := (into self) : both _ _ (t_QueryCanvas) in - letb b := (into rhs) : both _ _ (t_QueryCanvas) in - into (a .^ b); -}. - -#[global] Instance t_Query_t_BitAnd : t_BitAnd t_Query t_Query := { - t_Output := t_Query; - bitand (self : t_Query) (rhs : t_Query) := letb a := (into self) : both _ _ (t_QueryCanvas) in - letb b := (into rhs) : both _ _ (t_QueryCanvas) in - into (a .& b); -}. - -#[global] Instance t_Query_t_Shr : t_Shr t_Query uint_size := { - t_Output := t_Query; - shr (self : t_Query) (rhs : uint_size) := letb a := (into self) : both _ _ (t_QueryCanvas) in - into (a shift_right rhs); -}. - -#[global] Instance t_Query_t_Shl : t_Shl t_Query uint_size := { - t_Output := t_Query; - shl (self : t_Query) (rhs : uint_size) := letb a := (into self) : both _ _ (t_QueryCanvas) in - into (a shift_left rhs); -}. - -Program Definition inv_under_impl_58 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1 :|: fset [x_loc]) (I1) (t_Query) := - letb base := (into self) : both _ _ (t_QueryCanvas) in - into (inv_under_impl_27 base max_under_impl_64). -Fail Next Obligation. - -Program Definition pow_felem_under_impl_58 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Query)) (exp : both L2 I2 (t_Query)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_Query) := - letb base := (into self) : both _ _ (t_QueryCanvas) in - into (pow_felem_under_impl_27 base (into exp) max_under_impl_64). -Fail Next Obligation. - -Program Definition pow_under_impl_58 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Query)) (exp : both L2 I2 (int128)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_Query) := - letb base := (into self) : both _ _ (t_QueryCanvas) in - into (pow_under_impl_27 base exp max_under_impl_64). -Fail Next Obligation. - -Program Definition pow2_under_impl_58 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_Query) := - into (pow2_under_impl_16 x). -Fail Next Obligation. - -Program Definition from_byte_seq_be_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Query) := - into (from_be_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - declassify_under_impl_2 x))))). -Fail Next Obligation. - -Program Definition from_public_byte_seq_be_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Query) := - into (from_be_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - x))))). -Fail Next Obligation. - -Program Definition to_byte_seq_be_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1) (I1) (t_Seq (t_U8)) := - from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_be_bytes_under_impl_64 self))) (fun x => - classify_under_impl_2 x))). -Fail Next Obligation. - -Program Definition to_public_byte_seq_be_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1) (I1) (t_Seq (int8)) := - from_vec_under_impl_52 (to_be_bytes_under_impl_64 self). -Fail Next Obligation. - -Program Definition from_byte_seq_le_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Query) := - into (from_le_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - declassify_under_impl_2 x))))). -Fail Next Obligation. - -Program Definition from_public_byte_seq_le_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Query) := - into (from_le_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - x))))). -Fail Next Obligation. - -Program Definition to_byte_seq_le_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (t_U8)) := - from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_le_bytes_under_impl_64 self))) (fun x => - classify_under_impl_2 x))). -Fail Next Obligation. - -Program Definition to_public_byte_seq_le_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Query)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (int8)) := - from_vec_under_impl_52 (to_le_bytes_under_impl_64 self). -Fail Next Obligation. - -Program Definition from_secret_literal_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_U128)) : both (L1) (I1) (t_Query) := - into (from_literal_under_impl_16 (declassify_under_impl_126 x)). -Fail Next Obligation. - -#[global] Instance t_Query_t_NumericCopy : t_NumericCopy t_Query := { -}. - -#[global] Instance t_Query_t_UnsignedInteger : t_UnsignedInteger t_Query := { -}. - -#[global] Instance t_Query_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_Query := { -}. - -#[global] Instance t_Query_t_Integer : t_Integer t_Query := { - NUM_BITS := i32(384); - ZERO := from_literal_under_impl_64 i128(0); - ONE := from_literal_under_impl_64 i128(1); - TWO := from_literal_under_impl_64 i128(2); - from_literal (val : int128) := from_literal_under_impl_64 val; - from_hex_string (s : t_String) := from_hex_under_impl_64 (deref (replace_under_impl_5 (deref s) 0x )); - get_bit (self : t_Query) (i : uint_size) := (self shift_right i) .& v_ONE; - set_bit (self : t_Query) (b : t_Query) (i : uint_size) := letb _ := (ifb true - then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) - then letb 'tt := (never_to_any (panic assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb tmp1 := (from_literal_under_impl_64 (not (i128(1) shift_left i))) : both _ _ (t_Query) in - letb tmp2 := (b shift_left i) : both _ _ (t_Output) in - (self .& tmp1) .| tmp2; - set (self : t_Query) (pos : uint_size) (y : t_Query) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_Query) in - set_bit self b pos; - rotate_left (self : t_Query) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - ((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); - rotate_right (self : t_Query) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - ((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); -}. - -#[global] Instance t_Query_t_ModNumeric : t_ModNumeric t_Query := { - sub_mod (self : t_Query) (rhs : t_Query) (n : t_Query) := self .- rhs; - add_mod (self : t_Query) (rhs : t_Query) (n : t_Query) := self .+ rhs; - mul_mod (self : t_Query) (rhs : t_Query) (n : t_Query) := self .* rhs; - pow_mod (self : t_Query) (exp : t_Query) (n : t_Query) := pow_felem_under_impl_58 self exp; - modulo (self : t_Query) (n : t_Query) := self .% n; - signed_modulo (self : t_Query) (n : t_Query) := modulo self n; - absolute (self : t_Query) := self; -}. - -#[global] Instance t_Query_t_Numeric : t_Numeric t_Query := { - max_val := into (max_under_impl_64 .- (from_literal_under_impl_16 i128(1))); - wrap_add (self : t_Query) (rhs : t_Query) := self .+ rhs; - wrap_sub (self : t_Query) (rhs : t_Query) := self .- rhs; - wrap_mul (self : t_Query) (rhs : t_Query) := self .* rhs; - wrap_div (self : t_Query) (rhs : t_Query) := self ./ rhs; - exp (self : t_Query) (exp : int32) := pow_under_impl_58 self (into exp); - pow_self (self : t_Query) (exp : t_Query) := pow_felem_under_impl_58 self exp; - divide (self : t_Query) (rhs : t_Query) := self ./ rhs; - inv (self : t_Query) (n : t_Query) := inv_under_impl_58 self; - equal (self : t_Query) (other : t_Query) := self =.? other; - greater_than (self : t_Query) (other : t_Query) := self >.? other; - greater_than_or_equal (self : t_Query) (other : t_Query) := self >=.? other; - less_than (self : t_Query) (other : t_Query) := self <.? other; - less_than_or_equal (self : t_Query) (other : t_Query) := self <=.? other; - not_equal_bm (self : t_Query) (other : t_Query) := ifb self <> other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - equal_bm (self : t_Query) (other : t_Query) := ifb self =.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - greater_than_bm (self : t_Query) (other : t_Query) := ifb self >.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - greater_than_or_equal_bm (self : t_Query) (other : t_Query) := ifb self >=.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - less_than_bm (self : t_Query) (other : t_Query) := ifb self <.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - less_than_or_equal_bm (self : t_Query) (other : t_Query) := ifb self <=.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; -}. - -Definition t_RandomCanvas : choice_type := - (nseq int8 TODO: Int.to_string length × t_Sign × 'bool). -Equations Build_t_RandomCanvas {L : {fset Location}} {I : Interface} (f_b : both L I (nseq int8 TODO: Int.to_string length)) (f_sign : both L I (t_Sign)) (f_signed : both L I ('bool)) : both L I (t_RandomCanvas) := - Build_t_RandomCanvas f_b f_sign f_signed := - bind_both f_signed (fun f_signed => - bind_both f_sign (fun f_sign => - bind_both f_b (fun f_b => - ret_both f_b f_sign f_signed))) : both L I (t_RandomCanvas). -Fail Next Obligation. - -Program Definition max_under_impl_83 : both (fset []) ([interface ]) (t_Output) := - ((from i32(1)) shift_left i32(384)) .- one. -Fail Next Obligation. - -Program Definition max_value_under_impl_83 : both (fset []) ([interface ]) (t_RandomCanvas) := - from max_under_impl_83. -Fail Next Obligation. - -(*item error backend*) - -Program Definition from_literal_under_impl_83 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_RandomCanvas) := - letb big_x := (from x) : both _ _ (t_BigInt) in - letb _ := (ifb big_x >.? (into max_under_impl_83) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; - too big for type RandomCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - into big_x. -Fail Next Obligation. - -Program Definition from_signed_literal_under_impl_83 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_RandomCanvas) := - letb big_x := (from (cast_int x)) : both _ _ (t_BigInt) in - letb _ := (ifb big_x >.? (into max_under_impl_83) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; - too big for type RandomCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - into big_x. -Fail Next Obligation. - -Program Definition pow2_under_impl_83 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_RandomCanvas) := - into ((from i32(1)) shift_left x). -Fail Next Obligation. - -(*item error backend*) - -#[global] Instance t_RandomCanvas_t_From : t_From t_RandomCanvas t_BigUint := { - from (x : t_BigUint) := from (from x); -}. - -#[global] Instance t_RandomCanvas_t_From : t_From t_RandomCanvas t_BigInt := { - from (x : t_BigInt) := letb max_value := (max_under_impl_83) : both _ _ (t_BigInt) in - letb _ := (ifb not (x <=.? max_value) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [; - is too large for type RandomCanvas!])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb '(sign,repr) := (to_bytes_be_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in - letb _ := (ifb andb (sign =.? Sign_Minus) (not false) - then letb 'tt := (never_to_any (begin_panic Trying to convert a negative number into an unsigned integer!)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb _ := (ifb (len_under_impl_1 repr) >.? ((i32(384) .+ i32(7)) ./ i32(8)) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [; - is too large for type RandomCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letbm out loc(out_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in - letb upper := (len_under_impl (unsize out)) : both _ _ (uint_size) in - letb lower := (upper .- (len_under_impl_1 repr)) : both _ _ (uint_size) in - letb _ := (failure RefMut:The mutation of this &mut is not allowed here. - core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (out), - core::ops::range::Range { - f_start: lower, - f_end: upper, - }, - ))), - &(deref(core::ops::deref::Deref::deref(&(deref(&(repr)))))), - )) : both _ _ (unit) in - Build_t_RandomCanvas outsignfalse; -}. - -#[global] Instance t_RandomCanvas_t_Default : t_Default t_RandomCanvas := { - default := Build_t_RandomCanvas (repeat i8(0) i32(48))Sign_Plusfalse; -}. - -#[global] Instance t_RandomCanvas_t_Into : t_Into t_RandomCanvas t_BigInt := { - into (self : t_RandomCanvas) := from_bytes_be_under_impl_24 (f_sign self) (unsize (f_b self)); -}. - -#[global] Instance t_RandomCanvas_t_Into : t_Into t_RandomCanvas t_BigUint := { - into (self : t_RandomCanvas) := from_bytes_be_under_impl_18 (unsize (f_b self)); -}. - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*item error backend*) - -Definition repr_loc : Location := - (nseq int8 TODO: Int.to_string length ; 13%nat). -Program Definition from_be_bytes_under_impl_82 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_RandomCanvas) := - letb _ := (ifb true - then letb _ := (ifb not ((len_under_impl v) <=.? ((i32(384) .+ i32(7)) ./ i32(8))) - then letb 'tt := (never_to_any (begin_panic from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in - letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in - letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in - letb _ := (failure RefMut:The mutation of this &mut is not allowed here. - core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (repr), - core::ops::range::Range { - f_start: lower, - f_end: upper, - }, - ))), - &(deref(deref(&(v)))), - )) : both _ _ (unit) in - Build_t_RandomCanvas reprSign_Plusfalse. -Fail Next Obligation. - -Definition repr_loc : Location := - (nseq int8 TODO: Int.to_string length ; 14%nat). -Program Definition from_le_bytes_under_impl_82 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_RandomCanvas) := - letb _ := (ifb true - then letb _ := (ifb not ((len_under_impl v) <=.? ((i32(384) .+ i32(7)) ./ i32(8))) - then letb 'tt := (never_to_any (begin_panic from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in - letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in - letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in - letb _ := (failure RefMut:The mutation of this &mut is not allowed here. - core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (repr), - core::ops::range::Range { - f_start: lower, - f_end: upper, - }, - ))), - &(deref(deref(&(v)))), - )) : both _ _ (unit) in - into (from_bytes_le_under_impl_24 Sign_Plus (unsize repr)). -Fail Next Obligation. - -Program Definition to_be_bytes_under_impl_82 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_RandomCanvas)) : both (L1) (I1) (nseq int8 TODO: Int.to_string length) := - f_b self. -Fail Next Obligation. - -Definition repr_loc : Location := - (nseq int8 TODO: Int.to_string length ; 15%nat). -Program Definition to_le_bytes_under_impl_82 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_RandomCanvas)) : both (L1 :|: fset [repr_loc]) (I1) (nseq int8 TODO: Int.to_string length) := - letb x := (from_bytes_be_under_impl_24 Sign_Plus (unsize (f_b self))) : both _ _ (t_BigInt) in - letb '(_,x_s) := (to_bytes_le_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in - letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in - letb _ := (failure RefMut:The mutation of this &mut is not allowed here. - core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (repr), - core::ops::range::Range { - f_start: 0, - f_end: alloc::vec::len_under_impl_1(&(x_s)), - }, - ))), - &(deref(core::ops::deref::Deref::deref(&(deref(&(x_s)))))), - )) : both _ _ (unit) in - repr. -Fail Next Obligation. - -Program Definition comp_eq_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_RandomCanvas)) (rhs : both L2 I2 (t_RandomCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a =.? b - then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_RandomCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_ne_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_RandomCanvas)) (rhs : both L2 I2 (t_RandomCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a <> b - then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_RandomCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_gte_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_RandomCanvas)) (rhs : both L2 I2 (t_RandomCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a >=.? b - then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_RandomCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_gt_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_RandomCanvas)) (rhs : both L2 I2 (t_RandomCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a >.? b - then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_RandomCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_lte_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_RandomCanvas)) (rhs : both L2 I2 (t_RandomCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a <=.? b - then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_RandomCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_lt_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_RandomCanvas)) (rhs : both L2 I2 (t_RandomCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a <.? b - then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_RandomCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition inv_under_impl_94 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_RandomCanvas)) (modval : both L2 I2 (t_RandomCanvas)) : both (L1:|:L2) (I1:|:I2) (t_RandomCanvas) := - letb biguintmodval := (into modval) : both _ _ (t_BigInt) in - letb m := (biguintmodval .- (from i32(2))) : both _ _ (t_Output) in - letb s := (into self) : both _ _ (t_BigInt) in - into (modpow_under_impl_24 s m biguintmodval). -Fail Next Obligation. - -Program Definition pow_felem_under_impl_94 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_RandomCanvas)) (exp : both L2 I2 (t_RandomCanvas)) (modval : both L3 I3 (t_RandomCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_RandomCanvas) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into exp) : both _ _ (t_BigInt) in - letb m := (into modval) : both _ _ (t_BigInt) in - letb c := (modpow_under_impl_24 a b m) : both _ _ (t_BigInt) in - into c. -Fail Next Obligation. - -Program Definition pow_under_impl_94 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_RandomCanvas)) (exp : both L2 I2 (int128)) (modval : both L3 I3 (t_RandomCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_RandomCanvas) := - pow_felem_under_impl_94 self (into (from exp)) modval. -Fail Next Obligation. - -Program Definition rem_under_impl_94 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_RandomCanvas)) (n : both L2 I2 (t_RandomCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - self .% n. -Fail Next Obligation. - -#[global] Instance t_RandomCanvas_t_Add : t_Add t_RandomCanvas t_RandomCanvas := { - t_Output := t_RandomCanvas; - add (self : t_RandomCanvas) (rhs : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb c := (a .+ b) : both _ _ (t_Output) in - letb _ := (ifb c >.? max_under_impl_83 - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded addition overflow for type RandomCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - into c; -}. - -#[global] Instance t_RandomCanvas_t_Sub : t_Sub t_RandomCanvas t_RandomCanvas := { - t_Output := t_RandomCanvas; - sub (self : t_RandomCanvas) (rhs : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb c := (ifb f_signed self - then a .- b - else unwrap_or_else_under_impl (checked_sub_under_impl_24 a b) ( - never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded substraction underflow for type RandomCanvas])) (unsize none_under_impl_1))))) : both _ _ (t_Output) in - into c; -}. - -#[global] Instance t_RandomCanvas_t_Mul : t_Mul t_RandomCanvas t_RandomCanvas := { - t_Output := t_RandomCanvas; - mul (self : t_RandomCanvas) (rhs : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb c := (a .* b) : both _ _ (t_Output) in - letb _ := (ifb c >.? max_under_impl_83 - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded multiplication overflow for type RandomCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - into c; -}. - -#[global] Instance t_RandomCanvas_t_Div : t_Div t_RandomCanvas t_RandomCanvas := { - t_Output := t_RandomCanvas; - div (self : t_RandomCanvas) (rhs : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb _ := (ifb b =.? zero - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [dividing by zero in type RandomCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb c := (a ./ b) : both _ _ (t_Output) in - into c; -}. - -#[global] Instance t_RandomCanvas_t_Rem : t_Rem t_RandomCanvas t_RandomCanvas := { - t_Output := t_RandomCanvas; - rem (self : t_RandomCanvas) (rhs : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb _ := (ifb b =.? zero - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [dividing by zero in type RandomCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb c := (a .% b) : both _ _ (t_Output) in - into c; -}. - -#[global] Instance t_RandomCanvas_t_Not : t_Not t_RandomCanvas := { - t_Output := t_RandomCanvas; - not (self : t_RandomCanvas) := never_to_any (panic not implemented); -}. - -#[global] Instance t_RandomCanvas_t_BitOr : t_BitOr t_RandomCanvas t_RandomCanvas := { - t_Output := t_RandomCanvas; - bitor (self : t_RandomCanvas) (rhs : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - into (a .| b); -}. - -#[global] Instance t_RandomCanvas_t_BitXor : t_BitXor t_RandomCanvas t_RandomCanvas := { - t_Output := t_RandomCanvas; - bitxor (self : t_RandomCanvas) (rhs : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - into (a .^ b); -}. - -#[global] Instance t_RandomCanvas_t_BitAnd : t_BitAnd t_RandomCanvas t_RandomCanvas := { - t_Output := t_RandomCanvas; - bitand (self : t_RandomCanvas) (rhs : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - into (a .& b); -}. - -#[global] Instance t_RandomCanvas_t_Shr : t_Shr t_RandomCanvas uint_size := { - t_Output := t_RandomCanvas; - shr (self : t_RandomCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (rhs) : both _ _ (uint_size) in - into (a shift_right b); -}. - -#[global] Instance t_RandomCanvas_t_Shl : t_Shl t_RandomCanvas uint_size := { - t_Output := t_RandomCanvas; - shl (self : t_RandomCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (rhs) : both _ _ (uint_size) in - into (a shift_left b); -}. - -#[global] Instance t_RandomCanvas_t_PartialEq : t_PartialEq t_RandomCanvas t_RandomCanvas := { - eq (self : t_RandomCanvas) (rhs : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - a =.? b; -}. - -#[global] Instance t_RandomCanvas_t_Eq : t_Eq t_RandomCanvas := { -}. - -#[global] Instance t_RandomCanvas_t_PartialOrd : t_PartialOrd t_RandomCanvas t_RandomCanvas := { - partial_cmp (self : t_RandomCanvas) (other : t_RandomCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into other) : both _ _ (t_BigInt) in - partial_cmp a b; -}. - -#[global] Instance t_RandomCanvas_t_Ord : t_Ord t_RandomCanvas := { - cmp (self : t_RandomCanvas) (other : t_RandomCanvas) := unwrap_under_impl (partial_cmp self other); -}. - -Program Definition from_byte_seq_be_under_impl_75 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_RandomCanvas) := - from_be_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - declassify_under_impl_2 x)))). -Fail Next Obligation. - -Program Definition from_public_byte_seq_be_under_impl_75 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_RandomCanvas) := - from_be_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - x)))). -Fail Next Obligation. - -Program Definition to_byte_seq_be_under_impl_75 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_RandomCanvas)) : both (L1) (I1) (t_Seq (t_U8)) := - from_vec_under_impl_52 (collect (map (iter_under_impl (unsize (to_be_bytes_under_impl_82 self))) (fun x => - classify_under_impl_2 x))). -Fail Next Obligation. - -#[global] Instance t_RandomCanvas_t_NumericCopy : t_NumericCopy t_RandomCanvas := { -}. - -#[global] Instance t_RandomCanvas_t_UnsignedInteger : t_UnsignedInteger t_RandomCanvas := { -}. - -#[global] Instance t_RandomCanvas_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_RandomCanvas := { -}. - -#[global] Instance t_RandomCanvas_t_Integer : t_Integer t_RandomCanvas := { - NUM_BITS := i32(384); - ZERO := from_literal_under_impl_83 i128(0); - ONE := from_literal_under_impl_83 i128(1); - TWO := from_literal_under_impl_83 i128(2); - from_literal (val : int128) := from_literal_under_impl_83 val; - from_hex_string (s : t_String) := from_hex_under_impl_82 (deref (replace_under_impl_5 (deref s) 0x )); - get_bit (self : t_RandomCanvas) (i : uint_size) := (self shift_right i) .& v_ONE; - set_bit (self : t_RandomCanvas) (b : t_RandomCanvas) (i : uint_size) := letb _ := (ifb true - then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) - then letb 'tt := (never_to_any (panic assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb tmp1 := (from_literal_under_impl_83 (not (i128(1) shift_left i))) : both _ _ (t_RandomCanvas) in - letb tmp2 := (b shift_left i) : both _ _ (t_Output) in - (self .& tmp1) .| tmp2; - set (self : t_RandomCanvas) (pos : uint_size) (y : t_RandomCanvas) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_RandomCanvas) in - set_bit self b pos; - rotate_left (self : t_RandomCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - ((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); - rotate_right (self : t_RandomCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - ((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); -}. - -#[global] Instance t_RandomCanvas_t_ModNumeric : t_ModNumeric t_RandomCanvas := { - sub_mod (self : t_RandomCanvas) (rhs : t_RandomCanvas) (n : t_RandomCanvas) := (self .- rhs) .% n; - add_mod (self : t_RandomCanvas) (rhs : t_RandomCanvas) (n : t_RandomCanvas) := (self .+ rhs) .% n; - mul_mod (self : t_RandomCanvas) (rhs : t_RandomCanvas) (n : t_RandomCanvas) := (self .* rhs) .% n; - pow_mod (self : t_RandomCanvas) (exp : t_RandomCanvas) (n : t_RandomCanvas) := pow_felem_under_impl_94 self exp n; - modulo (self : t_RandomCanvas) (n : t_RandomCanvas) := self .% n; - signed_modulo (self : t_RandomCanvas) (n : t_RandomCanvas) := modulo self n; - absolute (self : t_RandomCanvas) := self; -}. - -#[global] Instance t_RandomCanvas_t_Numeric : t_Numeric t_RandomCanvas := { - max_val := max_value_under_impl_83; - wrap_add (self : t_RandomCanvas) (rhs : t_RandomCanvas) := self .+ rhs; - wrap_sub (self : t_RandomCanvas) (rhs : t_RandomCanvas) := self .- rhs; - wrap_mul (self : t_RandomCanvas) (rhs : t_RandomCanvas) := self .* rhs; - wrap_div (self : t_RandomCanvas) (rhs : t_RandomCanvas) := self ./ rhs; - exp (self : t_RandomCanvas) (exp : int32) := pow_under_impl_94 self (into exp) max_val; - pow_self (self : t_RandomCanvas) (exp : t_RandomCanvas) := pow_felem_under_impl_94 self (into exp) max_val; - divide (self : t_RandomCanvas) (rhs : t_RandomCanvas) := self ./ rhs; - inv (self : t_RandomCanvas) (n : t_RandomCanvas) := inv_under_impl_94 self n; - equal (self : t_RandomCanvas) (other : t_RandomCanvas) := self =.? other; - greater_than (self : t_RandomCanvas) (other : t_RandomCanvas) := self >.? other; - greater_than_or_equal (self : t_RandomCanvas) (other : t_RandomCanvas) := self >=.? other; - less_than (self : t_RandomCanvas) (other : t_RandomCanvas) := self <.? other; - less_than_or_equal (self : t_RandomCanvas) (other : t_RandomCanvas) := self >=.? other; - not_equal_bm (self : t_RandomCanvas) (other : t_RandomCanvas) := ifb not (equal self other) - then max_val - else from_literal_under_impl_83 i128(0); - equal_bm (self : t_RandomCanvas) (other : t_RandomCanvas) := ifb equal self other - then max_val - else from_literal_under_impl_83 i128(0); - greater_than_bm (self : t_RandomCanvas) (other : t_RandomCanvas) := ifb greater_than self other - then max_val - else from_literal_under_impl_83 i128(0); - greater_than_or_equal_bm (self : t_RandomCanvas) (other : t_RandomCanvas) := ifb greater_than_or_equal self other - then max_val - else from_literal_under_impl_83 i128(0); - less_than_bm (self : t_RandomCanvas) (other : t_RandomCanvas) := ifb less_than self other - then max_val - else from_literal_under_impl_83 i128(0); - less_than_or_equal_bm (self : t_RandomCanvas) (other : t_RandomCanvas) := ifb less_than_or_equal self other - then max_val - else from_literal_under_impl_83 i128(0); -}. - -Definition t_Random : choice_type := - (t_RandomCanvas). -Equations Build_t_Random {L : {fset Location}} {I : Interface} (0 : both L I (t_RandomCanvas)) : both L I (t_Random) := - Build_t_Random 0 := - bind_both 0 (fun 0 => - ret_both 0) : both L I (t_Random). -Fail Next Obligation. - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -#[global] Instance t_Random_t_From : t_From t_Random t_RandomCanvas := { - from (x : t_RandomCanvas) := Random (rem_under_impl_94 x (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)); -}. - -#[global] Instance t_Random_t_Into : t_Into t_Random t_RandomCanvas := { - into (self : t_Random) := 0 self; -}. - -Program Definition from_canvas_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_RandomCanvas)) : both (L1 :|: fset [x_loc]) (I1) (t_Random) := - Random (rem_under_impl_94 x (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)). -Fail Next Obligation. - -Program Definition into_canvas_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1) (I1) (t_RandomCanvas) := - 0 self. -Fail Next Obligation. - -Program Definition max_under_impl_131 : both (fset [x_loc]) ([interface ]) (t_RandomCanvas) := - from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab. -Fail Next Obligation. - -Program Definition declassify_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1) (I1) (t_BigInt) := - letb a := (into self) : both _ _ (t_RandomCanvas) in - into a. -Fail Next Obligation. - -(*item error backend*) - -Program Definition from_be_bytes_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_Random) := - into (from_be_bytes_under_impl_82 v). -Fail Next Obligation. - -Program Definition to_be_bytes_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1) (I1) (t_Vec (int8) (t_Global)) := - to_vec_under_impl (unsize (to_be_bytes_under_impl_82 (into self))). -Fail Next Obligation. - -Program Definition from_le_bytes_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_Random) := - into (from_le_bytes_under_impl_82 v). -Fail Next Obligation. - -Program Definition to_le_bytes_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1 :|: fset [repr_loc]) (I1) (t_Vec (int8) (t_Global)) := - to_vec_under_impl (unsize (to_le_bytes_under_impl_82 (into self))). -Fail Next Obligation. - -Program Definition bit_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Random)) (i : both L2 I2 (uint_size)) : both (L1:|:L2) (I1:|:I2) ('bool) := - bit_under_impl_83 (into self) i. -Fail Next Obligation. - -Program Definition from_literal_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_Random) := - letb big_x := (from x) : both _ _ (t_BigUint) in - letb _ := (ifb big_x >.? (into max_under_impl_131) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; - too big for type Random])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - Random (into big_x). -Fail Next Obligation. - -Program Definition from_signed_literal_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_Random) := - letb big_x := (from (cast_int x)) : both _ _ (t_BigUint) in - letb _ := (ifb big_x >.? (into max_under_impl_131) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; - too big for type Random])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - Random (into big_x). -Fail Next Obligation. - -Program Definition comp_eq_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Random)) (rhs : both L2 I2 (t_Random)) : both (L1:|:L2) (I1:|:I2) (t_Random) := - letb x := (into self) : both _ _ (t_RandomCanvas) in - into (comp_eq_under_impl_82 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_ne_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Random)) (rhs : both L2 I2 (t_Random)) : both (L1:|:L2) (I1:|:I2) (t_Random) := - letb x := (into self) : both _ _ (t_RandomCanvas) in - into (comp_ne_under_impl_82 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_gte_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Random)) (rhs : both L2 I2 (t_Random)) : both (L1:|:L2) (I1:|:I2) (t_Random) := - letb x := (into self) : both _ _ (t_RandomCanvas) in - into (comp_gte_under_impl_82 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_gt_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Random)) (rhs : both L2 I2 (t_Random)) : both (L1:|:L2) (I1:|:I2) (t_Random) := - letb x := (into self) : both _ _ (t_RandomCanvas) in - into (comp_gt_under_impl_82 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_lte_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Random)) (rhs : both L2 I2 (t_Random)) : both (L1:|:L2) (I1:|:I2) (t_Random) := - letb x := (into self) : both _ _ (t_RandomCanvas) in - into (comp_lte_under_impl_82 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_lt_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Random)) (rhs : both L2 I2 (t_Random)) : both (L1:|:L2) (I1:|:I2) (t_Random) := - letb x := (into self) : both _ _ (t_RandomCanvas) in - into (comp_lt_under_impl_82 x (into rhs)). -Fail Next Obligation. - -Program Definition neg_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1 :|: fset [x_loc]) (I1) (t_Random) := - letb mod_val := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigInt) in - letb s := (into self) : both _ _ (t_RandomCanvas) in - letb s := (into s) : both _ _ (t_BigInt) in - letb result := (into (mod_val .- s)) : both _ _ (t_RandomCanvas) in - into result. -Fail Next Obligation. - -#[global] Instance t_Random_t_PartialOrd : t_PartialOrd t_Random t_Random := { - partial_cmp (self : t_Random) (other : t_Random) := Option_Some (cmp self other); -}. - -#[global] Instance t_Random_t_Ord : t_Ord t_Random := { - cmp (self : t_Random) (other : t_Random) := cmp (0 self) (0 other); -}. - -#[global] Instance t_Random_t_PartialEq : t_PartialEq t_Random t_Random := { - eq (self : t_Random) (other : t_Random) := (0 self) =.? (0 other); -}. - -#[global] Instance t_Random_t_Eq : t_Eq t_Random := { -}. - -#[global] Instance t_Random_t_Add : t_Add t_Random t_Random := { - t_Output := t_Random; - add (self : t_Random) (rhs : t_Random) := letb a := (into self) : both _ _ (t_RandomCanvas) in - letb b := (into rhs) : both _ _ (t_RandomCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb c := (a .+ b) : both _ _ (t_Output) in - letb max := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_RandomCanvas) in - into d; -}. - -#[global] Instance t_Random_t_Sub : t_Sub t_Random t_Random := { - t_Output := t_Random; - sub (self : t_Random) (rhs : t_Random) := letb a := (into self) : both _ _ (t_RandomCanvas) in - letb b := (into rhs) : both _ _ (t_RandomCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb max := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in - letb c := (ifb b >.? a - then ((clone max) .- b) .+ a - else a .- b) : both _ _ (t_Output) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_RandomCanvas) in - into d; -}. - -#[global] Instance t_Random_t_Mul : t_Mul t_Random t_Random := { - t_Output := t_Random; - mul (self : t_Random) (rhs : t_Random) := letb a := (into self) : both _ _ (t_RandomCanvas) in - letb b := (into rhs) : both _ _ (t_RandomCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb c := (a .* b) : both _ _ (t_Output) in - letb max := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_RandomCanvas) in - into d; -}. - -#[global] Instance t_Random_t_Div : t_Div t_Random t_Random := { - t_Output := t_Random; - div (self : t_Random) (rhs : t_Random) := self .* (inv_under_impl_125 rhs); -}. - -#[global] Instance t_Random_t_Rem : t_Rem t_Random t_Random := { - t_Output := t_Random; - rem (self : t_Random) (rhs : t_Random) := letb a := (into self) : both _ _ (t_RandomCanvas) in - letb b := (into rhs) : both _ _ (t_RandomCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb c := (a .% b) : both _ _ (t_Output) in - letb max := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_RandomCanvas) in - into d; -}. - -#[global] Instance t_Random_t_Not : t_Not t_Random := { - t_Output := t_Random; - not (self : t_Random) := letb a := (into self) : both _ _ (t_RandomCanvas) in - into (not a); -}. - -#[global] Instance t_Random_t_BitOr : t_BitOr t_Random t_Random := { - t_Output := t_Random; - bitor (self : t_Random) (rhs : t_Random) := letb a := (into self) : both _ _ (t_RandomCanvas) in - letb b := (into rhs) : both _ _ (t_RandomCanvas) in - into (a .| b); -}. - -#[global] Instance t_Random_t_BitXor : t_BitXor t_Random t_Random := { - t_Output := t_Random; - bitxor (self : t_Random) (rhs : t_Random) := letb a := (into self) : both _ _ (t_RandomCanvas) in - letb b := (into rhs) : both _ _ (t_RandomCanvas) in - into (a .^ b); -}. - -#[global] Instance t_Random_t_BitAnd : t_BitAnd t_Random t_Random := { - t_Output := t_Random; - bitand (self : t_Random) (rhs : t_Random) := letb a := (into self) : both _ _ (t_RandomCanvas) in - letb b := (into rhs) : both _ _ (t_RandomCanvas) in - into (a .& b); -}. - -#[global] Instance t_Random_t_Shr : t_Shr t_Random uint_size := { - t_Output := t_Random; - shr (self : t_Random) (rhs : uint_size) := letb a := (into self) : both _ _ (t_RandomCanvas) in - into (a shift_right rhs); -}. - -#[global] Instance t_Random_t_Shl : t_Shl t_Random uint_size := { - t_Output := t_Random; - shl (self : t_Random) (rhs : uint_size) := letb a := (into self) : both _ _ (t_RandomCanvas) in - into (a shift_left rhs); -}. - -Program Definition inv_under_impl_125 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1 :|: fset [x_loc]) (I1) (t_Random) := - letb base := (into self) : both _ _ (t_RandomCanvas) in - into (inv_under_impl_94 base max_under_impl_131). -Fail Next Obligation. - -Program Definition pow_felem_under_impl_125 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Random)) (exp : both L2 I2 (t_Random)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_Random) := - letb base := (into self) : both _ _ (t_RandomCanvas) in - into (pow_felem_under_impl_94 base (into exp) max_under_impl_131). -Fail Next Obligation. - -Program Definition pow_under_impl_125 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Random)) (exp : both L2 I2 (int128)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_Random) := - letb base := (into self) : both _ _ (t_RandomCanvas) in - into (pow_under_impl_94 base exp max_under_impl_131). -Fail Next Obligation. - -Program Definition pow2_under_impl_125 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_Random) := - into (pow2_under_impl_83 x). -Fail Next Obligation. - -Program Definition from_byte_seq_be_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Random) := - into (from_be_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - declassify_under_impl_2 x))))). -Fail Next Obligation. - -Program Definition from_public_byte_seq_be_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Random) := - into (from_be_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - x))))). -Fail Next Obligation. - -Program Definition to_byte_seq_be_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1) (I1) (t_Seq (t_U8)) := - from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_be_bytes_under_impl_131 self))) (fun x => - classify_under_impl_2 x))). -Fail Next Obligation. - -Program Definition to_public_byte_seq_be_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1) (I1) (t_Seq (int8)) := - from_vec_under_impl_52 (to_be_bytes_under_impl_131 self). -Fail Next Obligation. - -Program Definition from_byte_seq_le_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Random) := - into (from_le_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - declassify_under_impl_2 x))))). -Fail Next Obligation. - -Program Definition from_public_byte_seq_le_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Random) := - into (from_le_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - x))))). -Fail Next Obligation. - -Program Definition to_byte_seq_le_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (t_U8)) := - from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_le_bytes_under_impl_131 self))) (fun x => - classify_under_impl_2 x))). -Fail Next Obligation. - -Program Definition to_public_byte_seq_le_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Random)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (int8)) := - from_vec_under_impl_52 (to_le_bytes_under_impl_131 self). -Fail Next Obligation. - -Program Definition from_secret_literal_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_U128)) : both (L1) (I1) (t_Random) := - into (from_literal_under_impl_83 (declassify_under_impl_126 x)). -Fail Next Obligation. - -#[global] Instance t_Random_t_NumericCopy : t_NumericCopy t_Random := { -}. - -#[global] Instance t_Random_t_UnsignedInteger : t_UnsignedInteger t_Random := { -}. - -#[global] Instance t_Random_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_Random := { -}. - -#[global] Instance t_Random_t_Integer : t_Integer t_Random := { - NUM_BITS := i32(384); - ZERO := from_literal_under_impl_131 i128(0); - ONE := from_literal_under_impl_131 i128(1); - TWO := from_literal_under_impl_131 i128(2); - from_literal (val : int128) := from_literal_under_impl_131 val; - from_hex_string (s : t_String) := from_hex_under_impl_131 (deref (replace_under_impl_5 (deref s) 0x )); - get_bit (self : t_Random) (i : uint_size) := (self shift_right i) .& v_ONE; - set_bit (self : t_Random) (b : t_Random) (i : uint_size) := letb _ := (ifb true - then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) - then letb 'tt := (never_to_any (panic assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb tmp1 := (from_literal_under_impl_131 (not (i128(1) shift_left i))) : both _ _ (t_Random) in - letb tmp2 := (b shift_left i) : both _ _ (t_Output) in - (self .& tmp1) .| tmp2; - set (self : t_Random) (pos : uint_size) (y : t_Random) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_Random) in - set_bit self b pos; - rotate_left (self : t_Random) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - ((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); - rotate_right (self : t_Random) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - ((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); -}. - -#[global] Instance t_Random_t_ModNumeric : t_ModNumeric t_Random := { - sub_mod (self : t_Random) (rhs : t_Random) (n : t_Random) := self .- rhs; - add_mod (self : t_Random) (rhs : t_Random) (n : t_Random) := self .+ rhs; - mul_mod (self : t_Random) (rhs : t_Random) (n : t_Random) := self .* rhs; - pow_mod (self : t_Random) (exp : t_Random) (n : t_Random) := pow_felem_under_impl_125 self exp; - modulo (self : t_Random) (n : t_Random) := self .% n; - signed_modulo (self : t_Random) (n : t_Random) := modulo self n; - absolute (self : t_Random) := self; -}. - -#[global] Instance t_Random_t_Numeric : t_Numeric t_Random := { - max_val := into (max_under_impl_131 .- (from_literal_under_impl_83 i128(1))); - wrap_add (self : t_Random) (rhs : t_Random) := self .+ rhs; - wrap_sub (self : t_Random) (rhs : t_Random) := self .- rhs; - wrap_mul (self : t_Random) (rhs : t_Random) := self .* rhs; - wrap_div (self : t_Random) (rhs : t_Random) := self ./ rhs; - exp (self : t_Random) (exp : int32) := pow_under_impl_125 self (into exp); - pow_self (self : t_Random) (exp : t_Random) := pow_felem_under_impl_125 self exp; - divide (self : t_Random) (rhs : t_Random) := self ./ rhs; - inv (self : t_Random) (n : t_Random) := inv_under_impl_125 self; - equal (self : t_Random) (other : t_Random) := self =.? other; - greater_than (self : t_Random) (other : t_Random) := self >.? other; - greater_than_or_equal (self : t_Random) (other : t_Random) := self >=.? other; - less_than (self : t_Random) (other : t_Random) := self <.? other; - less_than_or_equal (self : t_Random) (other : t_Random) := self <=.? other; - not_equal_bm (self : t_Random) (other : t_Random) := ifb self <> other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - equal_bm (self : t_Random) (other : t_Random) := ifb self =.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - greater_than_bm (self : t_Random) (other : t_Random) := ifb self >.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - greater_than_or_equal_bm (self : t_Random) (other : t_Random) := ifb self >=.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - less_than_bm (self : t_Random) (other : t_Random) := ifb self <.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - less_than_or_equal_bm (self : t_Random) (other : t_Random) := ifb self <=.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; -}. - -Program Definition sample_uniform : both (fset []) ([interface ]) (t_Random) := - v_ONE. -Fail Next Obligation. - -Require Import Std. (* as HashMap *) - -Require Import Std. - -Require Import Std. (* as Hash *) - -Require Import Std. (* as Hasher *) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -Program Definition random_oracle_query {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (QUERIES : both L1 I1 (t_HashMap (t_Query) (t_Random) (t_RandomState))) (q : both L2 I2 (t_Query)) : both (L1:|:L2) (I1:|:I2) ((t_HashMap (t_Query) (t_Random) (t_RandomState) × t_Random)) := - match get_under_impl_2 QUERIES q with - | Option_Some r => prod_b(clone QUERIES,clone r) - | Option_None => letb r := (sample_uniform) : both _ _ (t_Random) in - letb '(todo_fresh_var,QUERIES_temp) := (insert_under_impl_2 QUERIES q r) : both _ _ ((t_Option (t_Random) × t_HashMap (t_Query) (t_Random) (t_RandomState))) in - letb QUERIES := (QUERIES_temp) : both _ _ (t_HashMap (t_Query) (t_Random) (t_RandomState)) in - letb _ := (todo_fresh_var) : both _ _ (t_Option (t_Random)) in - prod_b(QUERIES,r) - end. -Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.Schnorr.Random_oracle.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.Schnorr.Random_oracle.v deleted file mode 100644 index 0413b7f..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.Schnorr.Random_oracle.v +++ /dev/null @@ -1,1838 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Hacspec_lib. - -Program Definition random_oracle_init {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 (unit)) : both (L1) (I1) (unit) := - tt. -Fail Next Obligation. - -Definition t_GCanvas : choice_type := - (nseq int8 TODO: Int.to_string length × t_Sign × 'bool). -Equations Build_t_GCanvas {L : {fset Location}} {I : Interface} (f_b : both L I (nseq int8 TODO: Int.to_string length)) (f_sign : both L I (t_Sign)) (f_signed : both L I ('bool)) : both L I (t_GCanvas) := - Build_t_GCanvas f_b f_sign f_signed := - bind_both f_signed (fun f_signed => - bind_both f_sign (fun f_sign => - bind_both f_b (fun f_b => - ret_both f_b f_sign f_signed))) : both L I (t_GCanvas). -Fail Next Obligation. - -Program Definition max_under_impl_16 : both (fset []) ([interface ]) (t_Output) := - ((from i32(1)) shift_left i32(384)) .- one. -Fail Next Obligation. - -Program Definition max_value_under_impl_16 : both (fset []) ([interface ]) (t_GCanvas) := - from max_under_impl_16. -Fail Next Obligation. - -(*item error backend*) - -Program Definition from_literal_under_impl_16 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_GCanvas) := - letb big_x := (from x) : both _ _ (t_BigInt) in - letb _ := (ifb big_x >.? (into max_under_impl_16) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; - too big for type GCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - into big_x. -Fail Next Obligation. - -Program Definition from_signed_literal_under_impl_16 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_GCanvas) := - letb big_x := (from (cast_int x)) : both _ _ (t_BigInt) in - letb _ := (ifb big_x >.? (into max_under_impl_16) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; - too big for type GCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - into big_x. -Fail Next Obligation. - -Program Definition pow2_under_impl_16 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_GCanvas) := - into ((from i32(1)) shift_left x). -Fail Next Obligation. - -(*item error backend*) - -#[global] Instance t_GCanvas_t_From : t_From t_GCanvas t_BigUint := { - from (x : t_BigUint) := from (from x); -}. - -#[global] Instance t_GCanvas_t_From : t_From t_GCanvas t_BigInt := { - from (x : t_BigInt) := letb max_value := (max_under_impl_16) : both _ _ (t_BigInt) in - letb _ := (ifb not (x <=.? max_value) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [; - is too large for type GCanvas!])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb '(sign,repr) := (to_bytes_be_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in - letb _ := (ifb andb (sign =.? Sign_Minus) (not false) - then letb 'tt := (never_to_any (begin_panic Trying to convert a negative number into an unsigned integer!)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb _ := (ifb (len_under_impl_1 repr) >.? ((i32(384) .+ i32(7)) ./ i32(8)) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [; - is too large for type GCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letbm out loc(out_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in - letb upper := (len_under_impl (unsize out)) : both _ _ (uint_size) in - letb lower := (upper .- (len_under_impl_1 repr)) : both _ _ (uint_size) in - letb _ := (failure RefMut:The mutation of this &mut is not allowed here. - core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (out), - core::ops::range::Range { - f_start: lower, - f_end: upper, - }, - ))), - &(deref(core::ops::deref::Deref::deref(&(deref(&(repr)))))), - )) : both _ _ (unit) in - Build_t_GCanvas outsignfalse; -}. - -#[global] Instance t_GCanvas_t_Default : t_Default t_GCanvas := { - default := Build_t_GCanvas (repeat i8(0) i32(48))Sign_Plusfalse; -}. - -#[global] Instance t_GCanvas_t_Into : t_Into t_GCanvas t_BigInt := { - into (self : t_GCanvas) := from_bytes_be_under_impl_24 (f_sign self) (unsize (f_b self)); -}. - -#[global] Instance t_GCanvas_t_Into : t_Into t_GCanvas t_BigUint := { - into (self : t_GCanvas) := from_bytes_be_under_impl_18 (unsize (f_b self)); -}. - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*item error backend*) - -Definition repr_loc : Location := - (nseq int8 TODO: Int.to_string length ; 1%nat). -Program Definition from_be_bytes_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas) := - letb _ := (ifb true - then letb _ := (ifb not ((len_under_impl v) <=.? ((i32(384) .+ i32(7)) ./ i32(8))) - then letb 'tt := (never_to_any (begin_panic from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in - letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in - letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in - letb _ := (failure RefMut:The mutation of this &mut is not allowed here. - core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (repr), - core::ops::range::Range { - f_start: lower, - f_end: upper, - }, - ))), - &(deref(deref(&(v)))), - )) : both _ _ (unit) in - Build_t_GCanvas reprSign_Plusfalse. -Fail Next Obligation. - -Definition repr_loc : Location := - (nseq int8 TODO: Int.to_string length ; 2%nat). -Program Definition from_le_bytes_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas) := - letb _ := (ifb true - then letb _ := (ifb not ((len_under_impl v) <=.? ((i32(384) .+ i32(7)) ./ i32(8))) - then letb 'tt := (never_to_any (begin_panic from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in - letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in - letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in - letb _ := (failure RefMut:The mutation of this &mut is not allowed here. - core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (repr), - core::ops::range::Range { - f_start: lower, - f_end: upper, - }, - ))), - &(deref(deref(&(v)))), - )) : both _ _ (unit) in - into (from_bytes_le_under_impl_24 Sign_Plus (unsize repr)). -Fail Next Obligation. - -Program Definition to_be_bytes_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_GCanvas)) : both (L1) (I1) (nseq int8 TODO: Int.to_string length) := - f_b self. -Fail Next Obligation. - -Definition repr_loc : Location := - (nseq int8 TODO: Int.to_string length ; 3%nat). -Program Definition to_le_bytes_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_GCanvas)) : both (L1 :|: fset [repr_loc]) (I1) (nseq int8 TODO: Int.to_string length) := - letb x := (from_bytes_be_under_impl_24 Sign_Plus (unsize (f_b self))) : both _ _ (t_BigInt) in - letb '(_,x_s) := (to_bytes_le_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in - letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in - letb _ := (failure RefMut:The mutation of this &mut is not allowed here. - core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (repr), - core::ops::range::Range { - f_start: 0, - f_end: alloc::vec::len_under_impl_1(&(x_s)), - }, - ))), - &(deref(core::ops::deref::Deref::deref(&(deref(&(x_s)))))), - )) : both _ _ (unit) in - repr. -Fail Next Obligation. - -Program Definition comp_eq_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a =.? b - then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_GCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_ne_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a <> b - then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_GCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_gte_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a >=.? b - then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_GCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_gt_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a >.? b - then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_GCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_lte_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a <=.? b - then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_GCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_lt_under_impl_15 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a <.? b - then letb one := (from_literal_under_impl_16 i128(1)) : both _ _ (t_GCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition inv_under_impl_27 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (modval : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_GCanvas) := - letb biguintmodval := (into modval) : both _ _ (t_BigInt) in - letb m := (biguintmodval .- (from i32(2))) : both _ _ (t_Output) in - letb s := (into self) : both _ _ (t_BigInt) in - into (modpow_under_impl_24 s m biguintmodval). -Fail Next Obligation. - -Program Definition pow_felem_under_impl_27 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_GCanvas)) (exp : both L2 I2 (t_GCanvas)) (modval : both L3 I3 (t_GCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_GCanvas) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into exp) : both _ _ (t_BigInt) in - letb m := (into modval) : both _ _ (t_BigInt) in - letb c := (modpow_under_impl_24 a b m) : both _ _ (t_BigInt) in - into c. -Fail Next Obligation. - -Program Definition pow_under_impl_27 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_GCanvas)) (exp : both L2 I2 (int128)) (modval : both L3 I3 (t_GCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_GCanvas) := - pow_felem_under_impl_27 self (into (from exp)) modval. -Fail Next Obligation. - -Program Definition rem_under_impl_27 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (n : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - self .% n. -Fail Next Obligation. - -#[global] Instance t_GCanvas_t_Add : t_Add t_GCanvas t_GCanvas := { - t_Output := t_GCanvas; - add (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb c := (a .+ b) : both _ _ (t_Output) in - letb _ := (ifb c >.? max_under_impl_16 - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded addition overflow for type GCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - into c; -}. - -#[global] Instance t_GCanvas_t_Sub : t_Sub t_GCanvas t_GCanvas := { - t_Output := t_GCanvas; - sub (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb c := (ifb f_signed self - then a .- b - else unwrap_or_else_under_impl (checked_sub_under_impl_24 a b) ( - never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded substraction underflow for type GCanvas])) (unsize none_under_impl_1))))) : both _ _ (t_Output) in - into c; -}. - -#[global] Instance t_GCanvas_t_Mul : t_Mul t_GCanvas t_GCanvas := { - t_Output := t_GCanvas; - mul (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb c := (a .* b) : both _ _ (t_Output) in - letb _ := (ifb c >.? max_under_impl_16 - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded multiplication overflow for type GCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - into c; -}. - -#[global] Instance t_GCanvas_t_Div : t_Div t_GCanvas t_GCanvas := { - t_Output := t_GCanvas; - div (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb _ := (ifb b =.? zero - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [dividing by zero in type GCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb c := (a ./ b) : both _ _ (t_Output) in - into c; -}. - -#[global] Instance t_GCanvas_t_Rem : t_Rem t_GCanvas t_GCanvas := { - t_Output := t_GCanvas; - rem (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb _ := (ifb b =.? zero - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [dividing by zero in type GCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb c := (a .% b) : both _ _ (t_Output) in - into c; -}. - -#[global] Instance t_GCanvas_t_Not : t_Not t_GCanvas := { - t_Output := t_GCanvas; - not (self : t_GCanvas) := never_to_any (panic not implemented); -}. - -#[global] Instance t_GCanvas_t_BitOr : t_BitOr t_GCanvas t_GCanvas := { - t_Output := t_GCanvas; - bitor (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - into (a .| b); -}. - -#[global] Instance t_GCanvas_t_BitXor : t_BitXor t_GCanvas t_GCanvas := { - t_Output := t_GCanvas; - bitxor (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - into (a .^ b); -}. - -#[global] Instance t_GCanvas_t_BitAnd : t_BitAnd t_GCanvas t_GCanvas := { - t_Output := t_GCanvas; - bitand (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - into (a .& b); -}. - -#[global] Instance t_GCanvas_t_Shr : t_Shr t_GCanvas uint_size := { - t_Output := t_GCanvas; - shr (self : t_GCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (rhs) : both _ _ (uint_size) in - into (a shift_right b); -}. - -#[global] Instance t_GCanvas_t_Shl : t_Shl t_GCanvas uint_size := { - t_Output := t_GCanvas; - shl (self : t_GCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (rhs) : both _ _ (uint_size) in - into (a shift_left b); -}. - -#[global] Instance t_GCanvas_t_PartialEq : t_PartialEq t_GCanvas t_GCanvas := { - eq (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - a =.? b; -}. - -#[global] Instance t_GCanvas_t_Eq : t_Eq t_GCanvas := { -}. - -#[global] Instance t_GCanvas_t_PartialOrd : t_PartialOrd t_GCanvas t_GCanvas := { - partial_cmp (self : t_GCanvas) (other : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into other) : both _ _ (t_BigInt) in - partial_cmp a b; -}. - -#[global] Instance t_GCanvas_t_Ord : t_Ord t_GCanvas := { - cmp (self : t_GCanvas) (other : t_GCanvas) := unwrap_under_impl (partial_cmp self other); -}. - -Program Definition from_byte_seq_be_under_impl_8 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas) := - from_be_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - declassify_under_impl_2 x)))). -Fail Next Obligation. - -Program Definition from_public_byte_seq_be_under_impl_8 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas) := - from_be_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - x)))). -Fail Next Obligation. - -Program Definition to_byte_seq_be_under_impl_8 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_GCanvas)) : both (L1) (I1) (t_Seq (t_U8)) := - from_vec_under_impl_52 (collect (map (iter_under_impl (unsize (to_be_bytes_under_impl_15 self))) (fun x => - classify_under_impl_2 x))). -Fail Next Obligation. - -#[global] Instance t_GCanvas_t_NumericCopy : t_NumericCopy t_GCanvas := { -}. - -#[global] Instance t_GCanvas_t_UnsignedInteger : t_UnsignedInteger t_GCanvas := { -}. - -#[global] Instance t_GCanvas_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_GCanvas := { -}. - -#[global] Instance t_GCanvas_t_Integer : t_Integer t_GCanvas := { - NUM_BITS := i32(384); - ZERO := from_literal_under_impl_16 i128(0); - ONE := from_literal_under_impl_16 i128(1); - TWO := from_literal_under_impl_16 i128(2); - from_literal (val : int128) := from_literal_under_impl_16 val; - from_hex_string (s : t_String) := from_hex_under_impl_15 (deref (replace_under_impl_5 (deref s) 0x )); - get_bit (self : t_GCanvas) (i : uint_size) := (self shift_right i) .& v_ONE; - set_bit (self : t_GCanvas) (b : t_GCanvas) (i : uint_size) := letb _ := (ifb true - then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) - then letb 'tt := (never_to_any (panic assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb tmp1 := (from_literal_under_impl_16 (not (i128(1) shift_left i))) : both _ _ (t_GCanvas) in - letb tmp2 := (b shift_left i) : both _ _ (t_Output) in - (self .& tmp1) .| tmp2; - set (self : t_GCanvas) (pos : uint_size) (y : t_GCanvas) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_GCanvas) in - set_bit self b pos; - rotate_left (self : t_GCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - ((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); - rotate_right (self : t_GCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - ((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); -}. - -#[global] Instance t_GCanvas_t_ModNumeric : t_ModNumeric t_GCanvas := { - sub_mod (self : t_GCanvas) (rhs : t_GCanvas) (n : t_GCanvas) := (self .- rhs) .% n; - add_mod (self : t_GCanvas) (rhs : t_GCanvas) (n : t_GCanvas) := (self .+ rhs) .% n; - mul_mod (self : t_GCanvas) (rhs : t_GCanvas) (n : t_GCanvas) := (self .* rhs) .% n; - pow_mod (self : t_GCanvas) (exp : t_GCanvas) (n : t_GCanvas) := pow_felem_under_impl_27 self exp n; - modulo (self : t_GCanvas) (n : t_GCanvas) := self .% n; - signed_modulo (self : t_GCanvas) (n : t_GCanvas) := modulo self n; - absolute (self : t_GCanvas) := self; -}. - -#[global] Instance t_GCanvas_t_Numeric : t_Numeric t_GCanvas := { - max_val := max_value_under_impl_16; - wrap_add (self : t_GCanvas) (rhs : t_GCanvas) := self .+ rhs; - wrap_sub (self : t_GCanvas) (rhs : t_GCanvas) := self .- rhs; - wrap_mul (self : t_GCanvas) (rhs : t_GCanvas) := self .* rhs; - wrap_div (self : t_GCanvas) (rhs : t_GCanvas) := self ./ rhs; - exp (self : t_GCanvas) (exp : int32) := pow_under_impl_27 self (into exp) max_val; - pow_self (self : t_GCanvas) (exp : t_GCanvas) := pow_felem_under_impl_27 self (into exp) max_val; - divide (self : t_GCanvas) (rhs : t_GCanvas) := self ./ rhs; - inv (self : t_GCanvas) (n : t_GCanvas) := inv_under_impl_27 self n; - equal (self : t_GCanvas) (other : t_GCanvas) := self =.? other; - greater_than (self : t_GCanvas) (other : t_GCanvas) := self >.? other; - greater_than_or_equal (self : t_GCanvas) (other : t_GCanvas) := self >=.? other; - less_than (self : t_GCanvas) (other : t_GCanvas) := self <.? other; - less_than_or_equal (self : t_GCanvas) (other : t_GCanvas) := self >=.? other; - not_equal_bm (self : t_GCanvas) (other : t_GCanvas) := ifb not (equal self other) - then max_val - else from_literal_under_impl_16 i128(0); - equal_bm (self : t_GCanvas) (other : t_GCanvas) := ifb equal self other - then max_val - else from_literal_under_impl_16 i128(0); - greater_than_bm (self : t_GCanvas) (other : t_GCanvas) := ifb greater_than self other - then max_val - else from_literal_under_impl_16 i128(0); - greater_than_or_equal_bm (self : t_GCanvas) (other : t_GCanvas) := ifb greater_than_or_equal self other - then max_val - else from_literal_under_impl_16 i128(0); - less_than_bm (self : t_GCanvas) (other : t_GCanvas) := ifb less_than self other - then max_val - else from_literal_under_impl_16 i128(0); - less_than_or_equal_bm (self : t_GCanvas) (other : t_GCanvas) := ifb less_than_or_equal self other - then max_val - else from_literal_under_impl_16 i128(0); -}. - -Definition t_G : choice_type := - (t_GCanvas). -Equations Build_t_G {L : {fset Location}} {I : Interface} (0 : both L I (t_GCanvas)) : both L I (t_G) := - Build_t_G 0 := - bind_both 0 (fun 0 => - ret_both 0) : both L I (t_G). -Fail Next Obligation. - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -#[global] Instance t_G_t_From : t_From t_G t_GCanvas := { - from (x : t_GCanvas) := G (rem_under_impl_27 x (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)); -}. - -#[global] Instance t_G_t_Into : t_Into t_G t_GCanvas := { - into (self : t_G) := 0 self; -}. - -Program Definition from_canvas_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_GCanvas)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := - G (rem_under_impl_27 x (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)). -Fail Next Obligation. - -Program Definition into_canvas_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_GCanvas) := - 0 self. -Fail Next Obligation. - -Program Definition max_under_impl_64 : both (fset [x_loc]) ([interface ]) (t_GCanvas) := - from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab. -Fail Next Obligation. - -Program Definition declassify_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_BigInt) := - letb a := (into self) : both _ _ (t_GCanvas) in - into a. -Fail Next Obligation. - -(*item error backend*) - -Program Definition from_be_bytes_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := - into (from_be_bytes_under_impl_15 v). -Fail Next Obligation. - -Program Definition to_be_bytes_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_Vec (int8) (t_Global)) := - to_vec_under_impl (unsize (to_be_bytes_under_impl_15 (into self))). -Fail Next Obligation. - -Program Definition from_le_bytes_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := - into (from_le_bytes_under_impl_15 v). -Fail Next Obligation. - -Program Definition to_le_bytes_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [repr_loc]) (I1) (t_Vec (int8) (t_Global)) := - to_vec_under_impl (unsize (to_le_bytes_under_impl_15 (into self))). -Fail Next Obligation. - -Program Definition bit_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (i : both L2 I2 (uint_size)) : both (L1:|:L2) (I1:|:I2) ('bool) := - bit_under_impl_16 (into self) i. -Fail Next Obligation. - -Program Definition from_literal_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := - letb big_x := (from x) : both _ _ (t_BigUint) in - letb _ := (ifb big_x >.? (into max_under_impl_64) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; - too big for type G])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - G (into big_x). -Fail Next Obligation. - -Program Definition from_signed_literal_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := - letb big_x := (from (cast_int x)) : both _ _ (t_BigUint) in - letb _ := (ifb big_x >.? (into max_under_impl_64) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; - too big for type G])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - G (into big_x). -Fail Next Obligation. - -Program Definition comp_eq_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := - letb x := (into self) : both _ _ (t_GCanvas) in - into (comp_eq_under_impl_15 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_ne_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := - letb x := (into self) : both _ _ (t_GCanvas) in - into (comp_ne_under_impl_15 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_gte_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := - letb x := (into self) : both _ _ (t_GCanvas) in - into (comp_gte_under_impl_15 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_gt_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := - letb x := (into self) : both _ _ (t_GCanvas) in - into (comp_gt_under_impl_15 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_lte_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := - letb x := (into self) : both _ _ (t_GCanvas) in - into (comp_lte_under_impl_15 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_lt_under_impl_64 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := - letb x := (into self) : both _ _ (t_GCanvas) in - into (comp_lt_under_impl_15 x (into rhs)). -Fail Next Obligation. - -Program Definition neg_under_impl_64 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := - letb mod_val := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigInt) in - letb s := (into self) : both _ _ (t_GCanvas) in - letb s := (into s) : both _ _ (t_BigInt) in - letb result := (into (mod_val .- s)) : both _ _ (t_GCanvas) in - into result. -Fail Next Obligation. - -#[global] Instance t_G_t_PartialOrd : t_PartialOrd t_G t_G := { - partial_cmp (self : t_G) (other : t_G) := Option_Some (cmp self other); -}. - -#[global] Instance t_G_t_Ord : t_Ord t_G := { - cmp (self : t_G) (other : t_G) := cmp (0 self) (0 other); -}. - -#[global] Instance t_G_t_PartialEq : t_PartialEq t_G t_G := { - eq (self : t_G) (other : t_G) := (0 self) =.? (0 other); -}. - -#[global] Instance t_G_t_Eq : t_Eq t_G := { -}. - -#[global] Instance t_G_t_Add : t_Add t_G t_G := { - t_Output := t_G; - add (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in - letb b := (into rhs) : both _ _ (t_GCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb c := (a .+ b) : both _ _ (t_Output) in - letb max := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_GCanvas) in - into d; -}. - -#[global] Instance t_G_t_Sub : t_Sub t_G t_G := { - t_Output := t_G; - sub (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in - letb b := (into rhs) : both _ _ (t_GCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb max := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in - letb c := (ifb b >.? a - then ((clone max) .- b) .+ a - else a .- b) : both _ _ (t_Output) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_GCanvas) in - into d; -}. - -#[global] Instance t_G_t_Mul : t_Mul t_G t_G := { - t_Output := t_G; - mul (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in - letb b := (into rhs) : both _ _ (t_GCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb c := (a .* b) : both _ _ (t_Output) in - letb max := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_GCanvas) in - into d; -}. - -#[global] Instance t_G_t_Div : t_Div t_G t_G := { - t_Output := t_G; - div (self : t_G) (rhs : t_G) := self .* (inv_under_impl_58 rhs); -}. - -#[global] Instance t_G_t_Rem : t_Rem t_G t_G := { - t_Output := t_G; - rem (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in - letb b := (into rhs) : both _ _ (t_GCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb c := (a .% b) : both _ _ (t_Output) in - letb max := (into (from_hex_under_impl_15 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_GCanvas) in - into d; -}. - -#[global] Instance t_G_t_Not : t_Not t_G := { - t_Output := t_G; - not (self : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in - into (not a); -}. - -#[global] Instance t_G_t_BitOr : t_BitOr t_G t_G := { - t_Output := t_G; - bitor (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in - letb b := (into rhs) : both _ _ (t_GCanvas) in - into (a .| b); -}. - -#[global] Instance t_G_t_BitXor : t_BitXor t_G t_G := { - t_Output := t_G; - bitxor (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in - letb b := (into rhs) : both _ _ (t_GCanvas) in - into (a .^ b); -}. - -#[global] Instance t_G_t_BitAnd : t_BitAnd t_G t_G := { - t_Output := t_G; - bitand (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in - letb b := (into rhs) : both _ _ (t_GCanvas) in - into (a .& b); -}. - -#[global] Instance t_G_t_Shr : t_Shr t_G uint_size := { - t_Output := t_G; - shr (self : t_G) (rhs : uint_size) := letb a := (into self) : both _ _ (t_GCanvas) in - into (a shift_right rhs); -}. - -#[global] Instance t_G_t_Shl : t_Shl t_G uint_size := { - t_Output := t_G; - shl (self : t_G) (rhs : uint_size) := letb a := (into self) : both _ _ (t_GCanvas) in - into (a shift_left rhs); -}. - -Program Definition inv_under_impl_58 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := - letb base := (into self) : both _ _ (t_GCanvas) in - into (inv_under_impl_27 base max_under_impl_64). -Fail Next Obligation. - -Program Definition pow_felem_under_impl_58 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (exp : both L2 I2 (t_G)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_G) := - letb base := (into self) : both _ _ (t_GCanvas) in - into (pow_felem_under_impl_27 base (into exp) max_under_impl_64). -Fail Next Obligation. - -Program Definition pow_under_impl_58 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (exp : both L2 I2 (int128)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_G) := - letb base := (into self) : both _ _ (t_GCanvas) in - into (pow_under_impl_27 base exp max_under_impl_64). -Fail Next Obligation. - -Program Definition pow2_under_impl_58 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_G) := - into (pow2_under_impl_16 x). -Fail Next Obligation. - -Program Definition from_byte_seq_be_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := - into (from_be_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - declassify_under_impl_2 x))))). -Fail Next Obligation. - -Program Definition from_public_byte_seq_be_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := - into (from_be_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - x))))). -Fail Next Obligation. - -Program Definition to_byte_seq_be_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_Seq (t_U8)) := - from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_be_bytes_under_impl_64 self))) (fun x => - classify_under_impl_2 x))). -Fail Next Obligation. - -Program Definition to_public_byte_seq_be_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_Seq (int8)) := - from_vec_under_impl_52 (to_be_bytes_under_impl_64 self). -Fail Next Obligation. - -Program Definition from_byte_seq_le_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := - into (from_le_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - declassify_under_impl_2 x))))). -Fail Next Obligation. - -Program Definition from_public_byte_seq_le_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := - into (from_le_bytes_under_impl_15 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - x))))). -Fail Next Obligation. - -Program Definition to_byte_seq_le_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (t_U8)) := - from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_le_bytes_under_impl_64 self))) (fun x => - classify_under_impl_2 x))). -Fail Next Obligation. - -Program Definition to_public_byte_seq_le_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (int8)) := - from_vec_under_impl_52 (to_le_bytes_under_impl_64 self). -Fail Next Obligation. - -Program Definition from_secret_literal_under_impl_1 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_U128)) : both (L1) (I1) (t_G) := - into (from_literal_under_impl_16 (declassify_under_impl_126 x)). -Fail Next Obligation. - -#[global] Instance t_G_t_NumericCopy : t_NumericCopy t_G := { -}. - -#[global] Instance t_G_t_UnsignedInteger : t_UnsignedInteger t_G := { -}. - -#[global] Instance t_G_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_G := { -}. - -#[global] Instance t_G_t_Integer : t_Integer t_G := { - NUM_BITS := i32(384); - ZERO := from_literal_under_impl_64 i128(0); - ONE := from_literal_under_impl_64 i128(1); - TWO := from_literal_under_impl_64 i128(2); - from_literal (val : int128) := from_literal_under_impl_64 val; - from_hex_string (s : t_String) := from_hex_under_impl_64 (deref (replace_under_impl_5 (deref s) 0x )); - get_bit (self : t_G) (i : uint_size) := (self shift_right i) .& v_ONE; - set_bit (self : t_G) (b : t_G) (i : uint_size) := letb _ := (ifb true - then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) - then letb 'tt := (never_to_any (panic assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb tmp1 := (from_literal_under_impl_64 (not (i128(1) shift_left i))) : both _ _ (t_G) in - letb tmp2 := (b shift_left i) : both _ _ (t_Output) in - (self .& tmp1) .| tmp2; - set (self : t_G) (pos : uint_size) (y : t_G) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_G) in - set_bit self b pos; - rotate_left (self : t_G) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - ((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); - rotate_right (self : t_G) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - ((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); -}. - -#[global] Instance t_G_t_ModNumeric : t_ModNumeric t_G := { - sub_mod (self : t_G) (rhs : t_G) (n : t_G) := self .- rhs; - add_mod (self : t_G) (rhs : t_G) (n : t_G) := self .+ rhs; - mul_mod (self : t_G) (rhs : t_G) (n : t_G) := self .* rhs; - pow_mod (self : t_G) (exp : t_G) (n : t_G) := pow_felem_under_impl_58 self exp; - modulo (self : t_G) (n : t_G) := self .% n; - signed_modulo (self : t_G) (n : t_G) := modulo self n; - absolute (self : t_G) := self; -}. - -#[global] Instance t_G_t_Numeric : t_Numeric t_G := { - max_val := into (max_under_impl_64 .- (from_literal_under_impl_16 i128(1))); - wrap_add (self : t_G) (rhs : t_G) := self .+ rhs; - wrap_sub (self : t_G) (rhs : t_G) := self .- rhs; - wrap_mul (self : t_G) (rhs : t_G) := self .* rhs; - wrap_div (self : t_G) (rhs : t_G) := self ./ rhs; - exp (self : t_G) (exp : int32) := pow_under_impl_58 self (into exp); - pow_self (self : t_G) (exp : t_G) := pow_felem_under_impl_58 self exp; - divide (self : t_G) (rhs : t_G) := self ./ rhs; - inv (self : t_G) (n : t_G) := inv_under_impl_58 self; - equal (self : t_G) (other : t_G) := self =.? other; - greater_than (self : t_G) (other : t_G) := self >.? other; - greater_than_or_equal (self : t_G) (other : t_G) := self >=.? other; - less_than (self : t_G) (other : t_G) := self <.? other; - less_than_or_equal (self : t_G) (other : t_G) := self <=.? other; - not_equal_bm (self : t_G) (other : t_G) := ifb self <> other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - equal_bm (self : t_G) (other : t_G) := ifb self =.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - greater_than_bm (self : t_G) (other : t_G) := ifb self >.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - greater_than_or_equal_bm (self : t_G) (other : t_G) := ifb self >=.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - less_than_bm (self : t_G) (other : t_G) := ifb self <.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - less_than_or_equal_bm (self : t_G) (other : t_G) := ifb self <=.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; -}. - -Definition t_QCanvas : choice_type := - (nseq int8 TODO: Int.to_string length × t_Sign × 'bool). -Equations Build_t_QCanvas {L : {fset Location}} {I : Interface} (f_b : both L I (nseq int8 TODO: Int.to_string length)) (f_sign : both L I (t_Sign)) (f_signed : both L I ('bool)) : both L I (t_QCanvas) := - Build_t_QCanvas f_b f_sign f_signed := - bind_both f_signed (fun f_signed => - bind_both f_sign (fun f_sign => - bind_both f_b (fun f_b => - ret_both f_b f_sign f_signed))) : both L I (t_QCanvas). -Fail Next Obligation. - -Program Definition max_under_impl_83 : both (fset []) ([interface ]) (t_Output) := - ((from i32(1)) shift_left i32(384)) .- one. -Fail Next Obligation. - -Program Definition max_value_under_impl_83 : both (fset []) ([interface ]) (t_QCanvas) := - from max_under_impl_83. -Fail Next Obligation. - -(*item error backend*) - -Program Definition from_literal_under_impl_83 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_QCanvas) := - letb big_x := (from x) : both _ _ (t_BigInt) in - letb _ := (ifb big_x >.? (into max_under_impl_83) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; - too big for type QCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - into big_x. -Fail Next Obligation. - -Program Definition from_signed_literal_under_impl_83 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_QCanvas) := - letb big_x := (from (cast_int x)) : both _ _ (t_BigInt) in - letb _ := (ifb big_x >.? (into max_under_impl_83) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; - too big for type QCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - into big_x. -Fail Next Obligation. - -Program Definition pow2_under_impl_83 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_QCanvas) := - into ((from i32(1)) shift_left x). -Fail Next Obligation. - -(*item error backend*) - -#[global] Instance t_QCanvas_t_From : t_From t_QCanvas t_BigUint := { - from (x : t_BigUint) := from (from x); -}. - -#[global] Instance t_QCanvas_t_From : t_From t_QCanvas t_BigInt := { - from (x : t_BigInt) := letb max_value := (max_under_impl_83) : both _ _ (t_BigInt) in - letb _ := (ifb not (x <=.? max_value) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [; - is too large for type QCanvas!])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb '(sign,repr) := (to_bytes_be_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in - letb _ := (ifb andb (sign =.? Sign_Minus) (not false) - then letb 'tt := (never_to_any (begin_panic Trying to convert a negative number into an unsigned integer!)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb _ := (ifb (len_under_impl_1 repr) >.? ((i32(384) .+ i32(7)) ./ i32(8)) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [; - is too large for type QCanvas])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letbm out loc(out_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in - letb upper := (len_under_impl (unsize out)) : both _ _ (uint_size) in - letb lower := (upper .- (len_under_impl_1 repr)) : both _ _ (uint_size) in - letb _ := (failure RefMut:The mutation of this &mut is not allowed here. - core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (out), - core::ops::range::Range { - f_start: lower, - f_end: upper, - }, - ))), - &(deref(core::ops::deref::Deref::deref(&(deref(&(repr)))))), - )) : both _ _ (unit) in - Build_t_QCanvas outsignfalse; -}. - -#[global] Instance t_QCanvas_t_Default : t_Default t_QCanvas := { - default := Build_t_QCanvas (repeat i8(0) i32(48))Sign_Plusfalse; -}. - -#[global] Instance t_QCanvas_t_Into : t_Into t_QCanvas t_BigInt := { - into (self : t_QCanvas) := from_bytes_be_under_impl_24 (f_sign self) (unsize (f_b self)); -}. - -#[global] Instance t_QCanvas_t_Into : t_Into t_QCanvas t_BigUint := { - into (self : t_QCanvas) := from_bytes_be_under_impl_18 (unsize (f_b self)); -}. - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*item error backend*) - -Definition repr_loc : Location := - (nseq int8 TODO: Int.to_string length ; 5%nat). -Program Definition from_be_bytes_under_impl_82 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_QCanvas) := - letb _ := (ifb true - then letb _ := (ifb not ((len_under_impl v) <=.? ((i32(384) .+ i32(7)) ./ i32(8))) - then letb 'tt := (never_to_any (begin_panic from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in - letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in - letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in - letb _ := (failure RefMut:The mutation of this &mut is not allowed here. - core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (repr), - core::ops::range::Range { - f_start: lower, - f_end: upper, - }, - ))), - &(deref(deref(&(v)))), - )) : both _ _ (unit) in - Build_t_QCanvas reprSign_Plusfalse. -Fail Next Obligation. - -Definition repr_loc : Location := - (nseq int8 TODO: Int.to_string length ; 6%nat). -Program Definition from_le_bytes_under_impl_82 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_QCanvas) := - letb _ := (ifb true - then letb _ := (ifb not ((len_under_impl v) <=.? ((i32(384) .+ i32(7)) ./ i32(8))) - then letb 'tt := (never_to_any (begin_panic from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in - letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in - letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in - letb _ := (failure RefMut:The mutation of this &mut is not allowed here. - core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (repr), - core::ops::range::Range { - f_start: lower, - f_end: upper, - }, - ))), - &(deref(deref(&(v)))), - )) : both _ _ (unit) in - into (from_bytes_le_under_impl_24 Sign_Plus (unsize repr)). -Fail Next Obligation. - -Program Definition to_be_bytes_under_impl_82 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_QCanvas)) : both (L1) (I1) (nseq int8 TODO: Int.to_string length) := - f_b self. -Fail Next Obligation. - -Definition repr_loc : Location := - (nseq int8 TODO: Int.to_string length ; 7%nat). -Program Definition to_le_bytes_under_impl_82 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_QCanvas)) : both (L1 :|: fset [repr_loc]) (I1) (nseq int8 TODO: Int.to_string length) := - letb x := (from_bytes_be_under_impl_24 Sign_Plus (unsize (f_b self))) : both _ _ (t_BigInt) in - letb '(_,x_s) := (to_bytes_le_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in - letbm repr loc(repr_loc) := (repeat i8(0) i32(48)) : both _ _ (nseq int8 TODO: Int.to_string length) in - letb _ := (failure RefMut:The mutation of this &mut is not allowed here. - core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (repr), - core::ops::range::Range { - f_start: 0, - f_end: alloc::vec::len_under_impl_1(&(x_s)), - }, - ))), - &(deref(core::ops::deref::Deref::deref(&(deref(&(x_s)))))), - )) : both _ _ (unit) in - repr. -Fail Next Obligation. - -Program Definition comp_eq_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QCanvas)) (rhs : both L2 I2 (t_QCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a =.? b - then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_QCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_ne_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QCanvas)) (rhs : both L2 I2 (t_QCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a <> b - then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_QCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_gte_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QCanvas)) (rhs : both L2 I2 (t_QCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a >=.? b - then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_QCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_gt_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QCanvas)) (rhs : both L2 I2 (t_QCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a >.? b - then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_QCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_lte_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QCanvas)) (rhs : both L2 I2 (t_QCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a <=.? b - then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_QCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition comp_lt_under_impl_82 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QCanvas)) (rhs : both L2 I2 (t_QCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb a <.? b - then letb one := (from_literal_under_impl_83 i128(1)) : both _ _ (t_QCanvas) in - (one shift_left (i32(384) .- i32(1))) .- one - else default. -Fail Next Obligation. - -Program Definition inv_under_impl_94 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QCanvas)) (modval : both L2 I2 (t_QCanvas)) : both (L1:|:L2) (I1:|:I2) (t_QCanvas) := - letb biguintmodval := (into modval) : both _ _ (t_BigInt) in - letb m := (biguintmodval .- (from i32(2))) : both _ _ (t_Output) in - letb s := (into self) : both _ _ (t_BigInt) in - into (modpow_under_impl_24 s m biguintmodval). -Fail Next Obligation. - -Program Definition pow_felem_under_impl_94 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_QCanvas)) (exp : both L2 I2 (t_QCanvas)) (modval : both L3 I3 (t_QCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_QCanvas) := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into exp) : both _ _ (t_BigInt) in - letb m := (into modval) : both _ _ (t_BigInt) in - letb c := (modpow_under_impl_24 a b m) : both _ _ (t_BigInt) in - into c. -Fail Next Obligation. - -Program Definition pow_under_impl_94 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_QCanvas)) (exp : both L2 I2 (int128)) (modval : both L3 I3 (t_QCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_QCanvas) := - pow_felem_under_impl_94 self (into (from exp)) modval. -Fail Next Obligation. - -Program Definition rem_under_impl_94 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_QCanvas)) (n : both L2 I2 (t_QCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - self .% n. -Fail Next Obligation. - -#[global] Instance t_QCanvas_t_Add : t_Add t_QCanvas t_QCanvas := { - t_Output := t_QCanvas; - add (self : t_QCanvas) (rhs : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb c := (a .+ b) : both _ _ (t_Output) in - letb _ := (ifb c >.? max_under_impl_83 - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded addition overflow for type QCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - into c; -}. - -#[global] Instance t_QCanvas_t_Sub : t_Sub t_QCanvas t_QCanvas := { - t_Output := t_QCanvas; - sub (self : t_QCanvas) (rhs : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb c := (ifb f_signed self - then a .- b - else unwrap_or_else_under_impl (checked_sub_under_impl_24 a b) ( - never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded substraction underflow for type QCanvas])) (unsize none_under_impl_1))))) : both _ _ (t_Output) in - into c; -}. - -#[global] Instance t_QCanvas_t_Mul : t_Mul t_QCanvas t_QCanvas := { - t_Output := t_QCanvas; - mul (self : t_QCanvas) (rhs : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb c := (a .* b) : both _ _ (t_Output) in - letb _ := (ifb c >.? max_under_impl_83 - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [bounded multiplication overflow for type QCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - into c; -}. - -#[global] Instance t_QCanvas_t_Div : t_Div t_QCanvas t_QCanvas := { - t_Output := t_QCanvas; - div (self : t_QCanvas) (rhs : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb _ := (ifb b =.? zero - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [dividing by zero in type QCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb c := (a ./ b) : both _ _ (t_Output) in - into c; -}. - -#[global] Instance t_QCanvas_t_Rem : t_Rem t_QCanvas t_QCanvas := { - t_Output := t_QCanvas; - rem (self : t_QCanvas) (rhs : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb _ := (ifb b =.? zero - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [dividing by zero in type QCanvas])) (unsize none_under_impl_1)))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb c := (a .% b) : both _ _ (t_Output) in - into c; -}. - -#[global] Instance t_QCanvas_t_Not : t_Not t_QCanvas := { - t_Output := t_QCanvas; - not (self : t_QCanvas) := never_to_any (panic not implemented); -}. - -#[global] Instance t_QCanvas_t_BitOr : t_BitOr t_QCanvas t_QCanvas := { - t_Output := t_QCanvas; - bitor (self : t_QCanvas) (rhs : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - into (a .| b); -}. - -#[global] Instance t_QCanvas_t_BitXor : t_BitXor t_QCanvas t_QCanvas := { - t_Output := t_QCanvas; - bitxor (self : t_QCanvas) (rhs : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - into (a .^ b); -}. - -#[global] Instance t_QCanvas_t_BitAnd : t_BitAnd t_QCanvas t_QCanvas := { - t_Output := t_QCanvas; - bitand (self : t_QCanvas) (rhs : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - into (a .& b); -}. - -#[global] Instance t_QCanvas_t_Shr : t_Shr t_QCanvas uint_size := { - t_Output := t_QCanvas; - shr (self : t_QCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (rhs) : both _ _ (uint_size) in - into (a shift_right b); -}. - -#[global] Instance t_QCanvas_t_Shl : t_Shl t_QCanvas uint_size := { - t_Output := t_QCanvas; - shl (self : t_QCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (rhs) : both _ _ (uint_size) in - into (a shift_left b); -}. - -#[global] Instance t_QCanvas_t_PartialEq : t_PartialEq t_QCanvas t_QCanvas := { - eq (self : t_QCanvas) (rhs : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - a =.? b; -}. - -#[global] Instance t_QCanvas_t_Eq : t_Eq t_QCanvas := { -}. - -#[global] Instance t_QCanvas_t_PartialOrd : t_PartialOrd t_QCanvas t_QCanvas := { - partial_cmp (self : t_QCanvas) (other : t_QCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into other) : both _ _ (t_BigInt) in - partial_cmp a b; -}. - -#[global] Instance t_QCanvas_t_Ord : t_Ord t_QCanvas := { - cmp (self : t_QCanvas) (other : t_QCanvas) := unwrap_under_impl (partial_cmp self other); -}. - -Program Definition from_byte_seq_be_under_impl_75 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_QCanvas) := - from_be_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - declassify_under_impl_2 x)))). -Fail Next Obligation. - -Program Definition from_public_byte_seq_be_under_impl_75 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_QCanvas) := - from_be_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - x)))). -Fail Next Obligation. - -Program Definition to_byte_seq_be_under_impl_75 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_QCanvas)) : both (L1) (I1) (t_Seq (t_U8)) := - from_vec_under_impl_52 (collect (map (iter_under_impl (unsize (to_be_bytes_under_impl_82 self))) (fun x => - classify_under_impl_2 x))). -Fail Next Obligation. - -#[global] Instance t_QCanvas_t_NumericCopy : t_NumericCopy t_QCanvas := { -}. - -#[global] Instance t_QCanvas_t_UnsignedInteger : t_UnsignedInteger t_QCanvas := { -}. - -#[global] Instance t_QCanvas_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_QCanvas := { -}. - -#[global] Instance t_QCanvas_t_Integer : t_Integer t_QCanvas := { - NUM_BITS := i32(384); - ZERO := from_literal_under_impl_83 i128(0); - ONE := from_literal_under_impl_83 i128(1); - TWO := from_literal_under_impl_83 i128(2); - from_literal (val : int128) := from_literal_under_impl_83 val; - from_hex_string (s : t_String) := from_hex_under_impl_82 (deref (replace_under_impl_5 (deref s) 0x )); - get_bit (self : t_QCanvas) (i : uint_size) := (self shift_right i) .& v_ONE; - set_bit (self : t_QCanvas) (b : t_QCanvas) (i : uint_size) := letb _ := (ifb true - then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) - then letb 'tt := (never_to_any (panic assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb tmp1 := (from_literal_under_impl_83 (not (i128(1) shift_left i))) : both _ _ (t_QCanvas) in - letb tmp2 := (b shift_left i) : both _ _ (t_Output) in - (self .& tmp1) .| tmp2; - set (self : t_QCanvas) (pos : uint_size) (y : t_QCanvas) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_QCanvas) in - set_bit self b pos; - rotate_left (self : t_QCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - ((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); - rotate_right (self : t_QCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - ((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); -}. - -#[global] Instance t_QCanvas_t_ModNumeric : t_ModNumeric t_QCanvas := { - sub_mod (self : t_QCanvas) (rhs : t_QCanvas) (n : t_QCanvas) := (self .- rhs) .% n; - add_mod (self : t_QCanvas) (rhs : t_QCanvas) (n : t_QCanvas) := (self .+ rhs) .% n; - mul_mod (self : t_QCanvas) (rhs : t_QCanvas) (n : t_QCanvas) := (self .* rhs) .% n; - pow_mod (self : t_QCanvas) (exp : t_QCanvas) (n : t_QCanvas) := pow_felem_under_impl_94 self exp n; - modulo (self : t_QCanvas) (n : t_QCanvas) := self .% n; - signed_modulo (self : t_QCanvas) (n : t_QCanvas) := modulo self n; - absolute (self : t_QCanvas) := self; -}. - -#[global] Instance t_QCanvas_t_Numeric : t_Numeric t_QCanvas := { - max_val := max_value_under_impl_83; - wrap_add (self : t_QCanvas) (rhs : t_QCanvas) := self .+ rhs; - wrap_sub (self : t_QCanvas) (rhs : t_QCanvas) := self .- rhs; - wrap_mul (self : t_QCanvas) (rhs : t_QCanvas) := self .* rhs; - wrap_div (self : t_QCanvas) (rhs : t_QCanvas) := self ./ rhs; - exp (self : t_QCanvas) (exp : int32) := pow_under_impl_94 self (into exp) max_val; - pow_self (self : t_QCanvas) (exp : t_QCanvas) := pow_felem_under_impl_94 self (into exp) max_val; - divide (self : t_QCanvas) (rhs : t_QCanvas) := self ./ rhs; - inv (self : t_QCanvas) (n : t_QCanvas) := inv_under_impl_94 self n; - equal (self : t_QCanvas) (other : t_QCanvas) := self =.? other; - greater_than (self : t_QCanvas) (other : t_QCanvas) := self >.? other; - greater_than_or_equal (self : t_QCanvas) (other : t_QCanvas) := self >=.? other; - less_than (self : t_QCanvas) (other : t_QCanvas) := self <.? other; - less_than_or_equal (self : t_QCanvas) (other : t_QCanvas) := self >=.? other; - not_equal_bm (self : t_QCanvas) (other : t_QCanvas) := ifb not (equal self other) - then max_val - else from_literal_under_impl_83 i128(0); - equal_bm (self : t_QCanvas) (other : t_QCanvas) := ifb equal self other - then max_val - else from_literal_under_impl_83 i128(0); - greater_than_bm (self : t_QCanvas) (other : t_QCanvas) := ifb greater_than self other - then max_val - else from_literal_under_impl_83 i128(0); - greater_than_or_equal_bm (self : t_QCanvas) (other : t_QCanvas) := ifb greater_than_or_equal self other - then max_val - else from_literal_under_impl_83 i128(0); - less_than_bm (self : t_QCanvas) (other : t_QCanvas) := ifb less_than self other - then max_val - else from_literal_under_impl_83 i128(0); - less_than_or_equal_bm (self : t_QCanvas) (other : t_QCanvas) := ifb less_than_or_equal self other - then max_val - else from_literal_under_impl_83 i128(0); -}. - -Definition t_Q : choice_type := - (t_QCanvas). -Equations Build_t_Q {L : {fset Location}} {I : Interface} (0 : both L I (t_QCanvas)) : both L I (t_Q) := - Build_t_Q 0 := - bind_both 0 (fun 0 => - ret_both 0) : both L I (t_Q). -Fail Next Obligation. - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -#[global] Instance t_Q_t_From : t_From t_Q t_QCanvas := { - from (x : t_QCanvas) := Q (rem_under_impl_94 x (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)); -}. - -#[global] Instance t_Q_t_Into : t_Into t_Q t_QCanvas := { - into (self : t_Q) := 0 self; -}. - -Program Definition from_canvas_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_QCanvas)) : both (L1 :|: fset [x_loc]) (I1) (t_Q) := - Q (rem_under_impl_94 x (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)). -Fail Next Obligation. - -Program Definition into_canvas_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1) (I1) (t_QCanvas) := - 0 self. -Fail Next Obligation. - -Program Definition max_under_impl_131 : both (fset [x_loc]) ([interface ]) (t_QCanvas) := - from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab. -Fail Next Obligation. - -Program Definition declassify_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1) (I1) (t_BigInt) := - letb a := (into self) : both _ _ (t_QCanvas) in - into a. -Fail Next Obligation. - -(*item error backend*) - -Program Definition from_be_bytes_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_Q) := - into (from_be_bytes_under_impl_82 v). -Fail Next Obligation. - -Program Definition to_be_bytes_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1) (I1) (t_Vec (int8) (t_Global)) := - to_vec_under_impl (unsize (to_be_bytes_under_impl_82 (into self))). -Fail Next Obligation. - -Program Definition from_le_bytes_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_Q) := - into (from_le_bytes_under_impl_82 v). -Fail Next Obligation. - -Program Definition to_le_bytes_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1 :|: fset [repr_loc]) (I1) (t_Vec (int8) (t_Global)) := - to_vec_under_impl (unsize (to_le_bytes_under_impl_82 (into self))). -Fail Next Obligation. - -Program Definition bit_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Q)) (i : both L2 I2 (uint_size)) : both (L1:|:L2) (I1:|:I2) ('bool) := - bit_under_impl_83 (into self) i. -Fail Next Obligation. - -Program Definition from_literal_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_Q) := - letb big_x := (from x) : both _ _ (t_BigUint) in - letb _ := (ifb big_x >.? (into max_under_impl_131) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; - too big for type Q])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - Q (into big_x). -Fail Next Obligation. - -Program Definition from_signed_literal_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_Q) := - letb big_x := (from (cast_int x)) : both _ _ (t_BigUint) in - letb _ := (ifb big_x >.? (into max_under_impl_131) - then letb 'tt := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [literal ; - too big for type Q])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - Q (into big_x). -Fail Next Obligation. - -Program Definition comp_eq_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Q)) (rhs : both L2 I2 (t_Q)) : both (L1:|:L2) (I1:|:I2) (t_Q) := - letb x := (into self) : both _ _ (t_QCanvas) in - into (comp_eq_under_impl_82 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_ne_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Q)) (rhs : both L2 I2 (t_Q)) : both (L1:|:L2) (I1:|:I2) (t_Q) := - letb x := (into self) : both _ _ (t_QCanvas) in - into (comp_ne_under_impl_82 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_gte_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Q)) (rhs : both L2 I2 (t_Q)) : both (L1:|:L2) (I1:|:I2) (t_Q) := - letb x := (into self) : both _ _ (t_QCanvas) in - into (comp_gte_under_impl_82 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_gt_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Q)) (rhs : both L2 I2 (t_Q)) : both (L1:|:L2) (I1:|:I2) (t_Q) := - letb x := (into self) : both _ _ (t_QCanvas) in - into (comp_gt_under_impl_82 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_lte_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Q)) (rhs : both L2 I2 (t_Q)) : both (L1:|:L2) (I1:|:I2) (t_Q) := - letb x := (into self) : both _ _ (t_QCanvas) in - into (comp_lte_under_impl_82 x (into rhs)). -Fail Next Obligation. - -Program Definition comp_lt_under_impl_131 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Q)) (rhs : both L2 I2 (t_Q)) : both (L1:|:L2) (I1:|:I2) (t_Q) := - letb x := (into self) : both _ _ (t_QCanvas) in - into (comp_lt_under_impl_82 x (into rhs)). -Fail Next Obligation. - -Program Definition neg_under_impl_131 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1 :|: fset [x_loc]) (I1) (t_Q) := - letb mod_val := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigInt) in - letb s := (into self) : both _ _ (t_QCanvas) in - letb s := (into s) : both _ _ (t_BigInt) in - letb result := (into (mod_val .- s)) : both _ _ (t_QCanvas) in - into result. -Fail Next Obligation. - -#[global] Instance t_Q_t_PartialOrd : t_PartialOrd t_Q t_Q := { - partial_cmp (self : t_Q) (other : t_Q) := Option_Some (cmp self other); -}. - -#[global] Instance t_Q_t_Ord : t_Ord t_Q := { - cmp (self : t_Q) (other : t_Q) := cmp (0 self) (0 other); -}. - -#[global] Instance t_Q_t_PartialEq : t_PartialEq t_Q t_Q := { - eq (self : t_Q) (other : t_Q) := (0 self) =.? (0 other); -}. - -#[global] Instance t_Q_t_Eq : t_Eq t_Q := { -}. - -#[global] Instance t_Q_t_Add : t_Add t_Q t_Q := { - t_Output := t_Q; - add (self : t_Q) (rhs : t_Q) := letb a := (into self) : both _ _ (t_QCanvas) in - letb b := (into rhs) : both _ _ (t_QCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb c := (a .+ b) : both _ _ (t_Output) in - letb max := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_QCanvas) in - into d; -}. - -#[global] Instance t_Q_t_Sub : t_Sub t_Q t_Q := { - t_Output := t_Q; - sub (self : t_Q) (rhs : t_Q) := letb a := (into self) : both _ _ (t_QCanvas) in - letb b := (into rhs) : both _ _ (t_QCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb max := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in - letb c := (ifb b >.? a - then ((clone max) .- b) .+ a - else a .- b) : both _ _ (t_Output) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_QCanvas) in - into d; -}. - -#[global] Instance t_Q_t_Mul : t_Mul t_Q t_Q := { - t_Output := t_Q; - mul (self : t_Q) (rhs : t_Q) := letb a := (into self) : both _ _ (t_QCanvas) in - letb b := (into rhs) : both _ _ (t_QCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb c := (a .* b) : both _ _ (t_Output) in - letb max := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_QCanvas) in - into d; -}. - -#[global] Instance t_Q_t_Div : t_Div t_Q t_Q := { - t_Output := t_Q; - div (self : t_Q) (rhs : t_Q) := self .* (inv_under_impl_125 rhs); -}. - -#[global] Instance t_Q_t_Rem : t_Rem t_Q t_Q := { - t_Output := t_Q; - rem (self : t_Q) (rhs : t_Q) := letb a := (into self) : both _ _ (t_QCanvas) in - letb b := (into rhs) : both _ _ (t_QCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb c := (a .% b) : both _ _ (t_Output) in - letb max := (into (from_hex_under_impl_82 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)) : both _ _ (t_BigUint) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_QCanvas) in - into d; -}. - -#[global] Instance t_Q_t_Not : t_Not t_Q := { - t_Output := t_Q; - not (self : t_Q) := letb a := (into self) : both _ _ (t_QCanvas) in - into (not a); -}. - -#[global] Instance t_Q_t_BitOr : t_BitOr t_Q t_Q := { - t_Output := t_Q; - bitor (self : t_Q) (rhs : t_Q) := letb a := (into self) : both _ _ (t_QCanvas) in - letb b := (into rhs) : both _ _ (t_QCanvas) in - into (a .| b); -}. - -#[global] Instance t_Q_t_BitXor : t_BitXor t_Q t_Q := { - t_Output := t_Q; - bitxor (self : t_Q) (rhs : t_Q) := letb a := (into self) : both _ _ (t_QCanvas) in - letb b := (into rhs) : both _ _ (t_QCanvas) in - into (a .^ b); -}. - -#[global] Instance t_Q_t_BitAnd : t_BitAnd t_Q t_Q := { - t_Output := t_Q; - bitand (self : t_Q) (rhs : t_Q) := letb a := (into self) : both _ _ (t_QCanvas) in - letb b := (into rhs) : both _ _ (t_QCanvas) in - into (a .& b); -}. - -#[global] Instance t_Q_t_Shr : t_Shr t_Q uint_size := { - t_Output := t_Q; - shr (self : t_Q) (rhs : uint_size) := letb a := (into self) : both _ _ (t_QCanvas) in - into (a shift_right rhs); -}. - -#[global] Instance t_Q_t_Shl : t_Shl t_Q uint_size := { - t_Output := t_Q; - shl (self : t_Q) (rhs : uint_size) := letb a := (into self) : both _ _ (t_QCanvas) in - into (a shift_left rhs); -}. - -Program Definition inv_under_impl_125 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1 :|: fset [x_loc]) (I1) (t_Q) := - letb base := (into self) : both _ _ (t_QCanvas) in - into (inv_under_impl_94 base max_under_impl_131). -Fail Next Obligation. - -Program Definition pow_felem_under_impl_125 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Q)) (exp : both L2 I2 (t_Q)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_Q) := - letb base := (into self) : both _ _ (t_QCanvas) in - into (pow_felem_under_impl_94 base (into exp) max_under_impl_131). -Fail Next Obligation. - -Program Definition pow_under_impl_125 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Q)) (exp : both L2 I2 (int128)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_Q) := - letb base := (into self) : both _ _ (t_QCanvas) in - into (pow_under_impl_94 base exp max_under_impl_131). -Fail Next Obligation. - -Program Definition pow2_under_impl_125 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_Q) := - into (pow2_under_impl_83 x). -Fail Next Obligation. - -Program Definition from_byte_seq_be_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Q) := - into (from_be_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - declassify_under_impl_2 x))))). -Fail Next Obligation. - -Program Definition from_public_byte_seq_be_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Q) := - into (from_be_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - x))))). -Fail Next Obligation. - -Program Definition to_byte_seq_be_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1) (I1) (t_Seq (t_U8)) := - from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_be_bytes_under_impl_131 self))) (fun x => - classify_under_impl_2 x))). -Fail Next Obligation. - -Program Definition to_public_byte_seq_be_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1) (I1) (t_Seq (int8)) := - from_vec_under_impl_52 (to_be_bytes_under_impl_131 self). -Fail Next Obligation. - -Program Definition from_byte_seq_le_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Q) := - into (from_le_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - declassify_under_impl_2 x))))). -Fail Next Obligation. - -Program Definition from_public_byte_seq_le_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_Q) := - into (from_le_bytes_under_impl_82 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - x))))). -Fail Next Obligation. - -Program Definition to_byte_seq_le_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (t_U8)) := - from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_le_bytes_under_impl_131 self))) (fun x => - classify_under_impl_2 x))). -Fail Next Obligation. - -Program Definition to_public_byte_seq_le_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Q)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (int8)) := - from_vec_under_impl_52 (to_le_bytes_under_impl_131 self). -Fail Next Obligation. - -Program Definition from_secret_literal_under_impl_68 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_U128)) : both (L1) (I1) (t_Q) := - into (from_literal_under_impl_83 (declassify_under_impl_126 x)). -Fail Next Obligation. - -#[global] Instance t_Q_t_NumericCopy : t_NumericCopy t_Q := { -}. - -#[global] Instance t_Q_t_UnsignedInteger : t_UnsignedInteger t_Q := { -}. - -#[global] Instance t_Q_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_Q := { -}. - -#[global] Instance t_Q_t_Integer : t_Integer t_Q := { - NUM_BITS := i32(384); - ZERO := from_literal_under_impl_131 i128(0); - ONE := from_literal_under_impl_131 i128(1); - TWO := from_literal_under_impl_131 i128(2); - from_literal (val : int128) := from_literal_under_impl_131 val; - from_hex_string (s : t_String) := from_hex_under_impl_131 (deref (replace_under_impl_5 (deref s) 0x )); - get_bit (self : t_Q) (i : uint_size) := (self shift_right i) .& v_ONE; - set_bit (self : t_Q) (b : t_Q) (i : uint_size) := letb _ := (ifb true - then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) - then letb 'tt := (never_to_any (panic assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()))) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - letb tmp1 := (from_literal_under_impl_131 (not (i128(1) shift_left i))) : both _ _ (t_Q) in - letb tmp2 := (b shift_left i) : both _ _ (t_Output) in - (self .& tmp1) .| tmp2; - set (self : t_Q) (pos : uint_size) (y : t_Q) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_Q) in - set_bit self b pos; - rotate_left (self : t_Q) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - ((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); - rotate_right (self : t_Q) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb 'tt := (never_to_any (panic assertion failed: n < Self::NUM_BITS)) : both _ _ (unit) in - tt - else tt) : both _ _ (unit) in - ((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- i32(1)))); -}. - -#[global] Instance t_Q_t_ModNumeric : t_ModNumeric t_Q := { - sub_mod (self : t_Q) (rhs : t_Q) (n : t_Q) := self .- rhs; - add_mod (self : t_Q) (rhs : t_Q) (n : t_Q) := self .+ rhs; - mul_mod (self : t_Q) (rhs : t_Q) (n : t_Q) := self .* rhs; - pow_mod (self : t_Q) (exp : t_Q) (n : t_Q) := pow_felem_under_impl_125 self exp; - modulo (self : t_Q) (n : t_Q) := self .% n; - signed_modulo (self : t_Q) (n : t_Q) := modulo self n; - absolute (self : t_Q) := self; -}. - -#[global] Instance t_Q_t_Numeric : t_Numeric t_Q := { - max_val := into (max_under_impl_131 .- (from_literal_under_impl_83 i128(1))); - wrap_add (self : t_Q) (rhs : t_Q) := self .+ rhs; - wrap_sub (self : t_Q) (rhs : t_Q) := self .- rhs; - wrap_mul (self : t_Q) (rhs : t_Q) := self .* rhs; - wrap_div (self : t_Q) (rhs : t_Q) := self ./ rhs; - exp (self : t_Q) (exp : int32) := pow_under_impl_125 self (into exp); - pow_self (self : t_Q) (exp : t_Q) := pow_felem_under_impl_125 self exp; - divide (self : t_Q) (rhs : t_Q) := self ./ rhs; - inv (self : t_Q) (n : t_Q) := inv_under_impl_125 self; - equal (self : t_Q) (other : t_Q) := self =.? other; - greater_than (self : t_Q) (other : t_Q) := self >.? other; - greater_than_or_equal (self : t_Q) (other : t_Q) := self >=.? other; - less_than (self : t_Q) (other : t_Q) := self <.? other; - less_than_or_equal (self : t_Q) (other : t_Q) := self <=.? other; - not_equal_bm (self : t_Q) (other : t_Q) := ifb self <> other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - equal_bm (self : t_Q) (other : t_Q) := ifb self =.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - greater_than_bm (self : t_Q) (other : t_Q) := ifb self >.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - greater_than_or_equal_bm (self : t_Q) (other : t_Q) := ifb self >=.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - less_than_bm (self : t_Q) (other : t_Q) := ifb self <.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; - less_than_or_equal_bm (self : t_Q) (other : t_Q) := ifb self <=.? other - then (v_ONE shift_left (i32(384) .- i32(1))) .- v_ONE - else v_ZERO; -}. - -Notation t_Random := (t_G). - -Notation t_Query := (t_G). - -Program Definition sample_uniform : both (fset []) ([interface ]) (t_G) := - v_ONE. -Fail Next Obligation. - -Require Import Std. (* as HashMap *) - -Require Import Std. - -Require Import Std. (* as Hash *) - -Require Import Std. (* as Hasher *) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -Program Definition random_oracle_query {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (QUERIES : both L1 I1 (t_HashMap (t_G) (t_G) (t_RandomState))) (q : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) ((t_HashMap (t_G) (t_G) (t_RandomState) × t_G)) := - match get_under_impl_2 QUERIES q with - | Option_Some r => prod_b(clone QUERIES,clone r) - | Option_None => letb r := (sample_uniform) : both _ _ (t_G) in - letb '(todo_fresh_var,QUERIES_temp) := (insert_under_impl_2 QUERIES q r) : both _ _ ((t_Option (t_G) × t_HashMap (t_G) (t_G) (t_RandomState))) in - letb QUERIES := (QUERIES_temp) : both _ _ (t_HashMap (t_G) (t_G) (t_RandomState)) in - letb _ := (todo_fresh_var) : both _ _ (t_Option (t_G)) in - prod_b(QUERIES,r) - end. -Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.glob b/ovn/proofs/ssprove/extraction/Hacspec_ovn.glob deleted file mode 100644 index b3cc9a5..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.glob +++ /dev/null @@ -1,1104 +0,0 @@ -DIGEST 2601f3a4885d20ca193173741799192e -FExamples.Hacspec_ovn -R126:136 Crypt.choice_type <> <> lib -R138:144 Crypt.Package <> <> lib -R146:152 Crypt.Prelude <> <> lib -R162:176 Crypt.package.pkg_notation PackageNotation <> mod -R211:213 extructures.ord <> <> lib -R215:218 extructures.fset <> <> lib -R250:253 mathcomp.zify.ssrZ <> <> lib -R255:258 mathcomp.word.word <> <> lib -R288:291 Jasmin.word <> <> lib -R319:324 Coq.ZArith.ZArith <> <> lib -R334:351 Coq.Lists.List ListNotations <> mod -R449:462 Hacspec.ChoiceEquality <> <> lib -R493:507 Hacspec.LocationUtility <> <> lib -R538:559 Hacspec.Hacspec_Lib_Comparable <> <> lib -R590:604 Hacspec.Hacspec_Lib_Pre <> <> lib -R635:645 Hacspec.Hacspec_Lib <> <> lib -R682:702 mathcomp.ssreflect.choice Choice.Exports <> mod -R827:830 Examples.Core <> <> lib -R866:869 Examples.Core <> <> lib -R901:911 Examples.Hacspec_lib <> <> lib -rec 921:928 <> t_Hasher -proj 958:963 <> t_Hash -proj 983:998 <> t_Hash_t_TryFrom -proj 1026:1038 <> t_Hash_t_Into -proj 1063:1080 <> t_Hash_t_PartialEq -proj 1110:1122 <> t_Hash_t_Copy -proj 1147:1160 <> t_Hash_t_Clone -proj 1186:1199 <> t_Hash_t_Sized -proj 1225:1228 <> hash -proj 1255:1269 <> concat_and_hash -proj 1315:1323 <> hash_size -R938:948 Crypt.choice_type <> choice_type ind -binder 931:934 <> Self:1 -R967:977 Crypt.choice_type <> choice_type ind -R1003:1011 Examples.Core <> t_TryFrom class -R1014:1019 Examples.Hacspec_ovn <> t_Hash:3 meth -R1043:1048 Examples.Core <> t_Into class -R1051:1056 Examples.Hacspec_ovn <> t_Hash:3 meth -R1085:1095 Examples.Core <> t_PartialEq class -R1098:1103 Examples.Hacspec_ovn <> t_Hash:3 meth -R1127:1132 Examples.Core <> t_Copy class -R1135:1140 Examples.Hacspec_ovn <> t_Hash:3 meth -R1165:1171 Examples.Core <> t_Clone class -R1174:1179 Examples.Hacspec_ovn <> t_Hash:3 meth -R1204:1210 Examples.Core <> t_Sized class -R1213:1218 Examples.Hacspec_ovn <> t_Hash:3 meth -R1240:1243 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R1232:1234 Hacspec.Hacspec_Lib_Pre <> seq def -R1236:1239 Hacspec.Hacspec_Lib_Pre <> int8 syndef -R1244:1249 Examples.Hacspec_ovn <> t_Hash:3 meth -R1279:1282 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R1273:1278 Examples.Hacspec_ovn <> t_Hash:3 meth -R1300:1303 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R1283:1290 Examples.Core <> t_Option def -R1293:1298 Examples.Hacspec_ovn <> t_Hash:3 meth -R1304:1309 Examples.Hacspec_ovn <> t_Hash:3 meth -R1327:1335 Hacspec.Hacspec_Lib_Pre <> uint_size def -def 1354:1371 <> t_PartialTreeLayer -binder 1374:1374 <> H:13 -R1383:1393 Crypt.choice_type <> choice_type ind -R1400:1404 Examples.Core <> t_Vec def -R1417:1420 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R1408:1416 Hacspec.Hacspec_Lib_Pre <> uint_size def -R1421:1421 Examples.Hacspec_ovn <> H:13 var -R1426:1433 Examples.Core <> t_Global constr -def 1449:1461 <> t_PartialTree -binder 1464:1464 <> T:14 -R1474:1480 Examples.Core <> t_Sized class -R1483:1483 Examples.Hacspec_ovn <> T:14 var -binder 1474:1484 <> H:15 -R1490:1497 Examples.Hacspec_ovn <> t_Hasher class -R1500:1500 Examples.Hacspec_ovn <> T:14 var -binder 1490:1501 <> H0:16 -R1506:1516 Crypt.choice_type <> choice_type ind -R1524:1528 Examples.Core <> t_Vec def -R1531:1535 Examples.Core <> t_Vec def -R1548:1551 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R1539:1547 Hacspec.Hacspec_Lib_Pre <> uint_size def -R1552:1557 Examples.Hacspec_ovn <> t_Hash meth -R1562:1569 Examples.Core <> t_Global constr -R1574:1581 Examples.Core <> t_Global constr -def 1596:1614 <> Build_t_PartialTree -R1621:1626 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R1635:1635 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R1627:1634 Crypt.package.pkg_core_definition <> Location def -binder 1617:1617 <> L:17 -R1643:1651 Crypt.package.pkg_core_definition <> Interface def -binder 1639:1639 <> I:18 -binder 1655:1655 <> T:19 -R1665:1671 Examples.Core <> t_Sized class -R1674:1674 Examples.Hacspec_ovn <> T:19 var -binder 1665:1675 <> H:20 -R1681:1688 Examples.Hacspec_ovn <> t_Hasher class -R1691:1691 Examples.Hacspec_ovn <> T:19 var -binder 1681:1692 <> H0:21 -R1707:1710 Hacspec.ChoiceEquality <> both rec -R1717:1721 Examples.Core <> t_Vec def -R1724:1728 Examples.Core <> t_Vec def -R1741:1744 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R1732:1740 Hacspec.Hacspec_Lib_Pre <> uint_size def -R1745:1750 Examples.Hacspec_ovn <> t_Hash meth -R1755:1762 Examples.Core <> t_Global constr -R1767:1774 Examples.Core <> t_Global constr -R1714:1714 Examples.Hacspec_ovn <> I:18 var -R1712:1712 Examples.Hacspec_ovn <> L:17 var -binder 1696:1703 <> f_layers:22 -R1781:1784 Hacspec.ChoiceEquality <> both rec -R1791:1803 Examples.Hacspec_ovn <> t_PartialTree def -R1813:1831 Examples.Hacspec_ovn <> Build_t_PartialTree:25 def -R1833:1840 Examples.Hacspec_ovn <> f_layers:24 var -R1913:1916 Hacspec.ChoiceEquality <> both rec -R1923:1935 Examples.Hacspec_ovn <> t_PartialTree def -R1850:1858 Hacspec.ChoiceEquality <> bind_both def -binder 1874:1881 <> f_layers:26 -R1892:1899 Hacspec.ChoiceEquality <> ret_both def -R1901:1908 Examples.Hacspec_ovn <> f_layers:26 var -def 1983:1995 <> is_left_index -R2003:2008 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R2017:2017 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R2009:2016 Crypt.package.pkg_core_definition <> Location def -binder 1998:1999 <> L1:27 -R2026:2034 Crypt.package.pkg_core_definition <> Interface def -binder 2021:2022 <> I1:28 -R2046:2049 Hacspec.ChoiceEquality <> both rec -R2058:2066 Hacspec.Hacspec_Lib_Pre <> uint_size def -R2054:2055 Examples.Hacspec_ovn <> I1:28 var -R2051:2052 Examples.Hacspec_ovn <> L1:27 var -binder 2038:2042 <> index:29 -R2072:2075 Hacspec.ChoiceEquality <> both rec -R2088:2092 Crypt.package.pkg_notation PackageNotation ::package_scope:'''bool' not -R2083:2084 Examples.Hacspec_ovn <> I1:28 var -R2078:2079 Examples.Hacspec_ovn <> L1:27 var -R2101:2101 Hacspec.Hacspec_Lib <> ::hacspec_scope:x_'=.?'_x not -R2117:2122 Hacspec.Hacspec_Lib <> ::hacspec_scope:x_'=.?'_x not -R2107:2110 Hacspec.Hacspec_Lib <> ::hacspec_scope:x_'.%'_x not -R2102:2106 Examples.Hacspec_ovn <> index:29 var -R2111:2114 Examples.Hacspec_lib <> :::'i32('_x_')' not -R2116:2116 Examples.Hacspec_lib <> :::'i32('_x_')' not -R2123:2126 Examples.Hacspec_lib <> :::'i32('_x_')' not -R2128:2128 Examples.Hacspec_lib <> :::'i32('_x_')' not -def 2152:2168 <> get_sibling_index -R2176:2181 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R2190:2190 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R2182:2189 Crypt.package.pkg_core_definition <> Location def -binder 2171:2172 <> L1:30 -R2199:2207 Crypt.package.pkg_core_definition <> Interface def -binder 2194:2195 <> I1:31 -R2219:2222 Hacspec.ChoiceEquality <> both rec -R2231:2239 Hacspec.Hacspec_Lib_Pre <> uint_size def -R2227:2228 Examples.Hacspec_ovn <> I1:31 var -R2224:2225 Examples.Hacspec_ovn <> L1:30 var -binder 2211:2215 <> index:32 -R2245:2248 Hacspec.ChoiceEquality <> both rec -R2261:2269 Hacspec.Hacspec_Lib_Pre <> uint_size def -R2256:2257 Examples.Hacspec_ovn <> I1:31 var -R2251:2252 Examples.Hacspec_ovn <> L1:30 var -R2277:2280 Hacspec.Hacspec_Lib <> :::'ifb'_x_'then'_x_'else'_x not -R2300:2307 Hacspec.Hacspec_Lib <> :::'ifb'_x_'then'_x_'else'_x not -R2323:2330 Hacspec.Hacspec_Lib <> :::'ifb'_x_'then'_x_'else'_x not -R2281:2293 Examples.Hacspec_ovn <> is_left_index def -R2295:2299 Examples.Hacspec_ovn <> index:32 var -R2313:2316 Examples.Hacspec_lib <> :::x_'.+'_x not -R2308:2312 Examples.Hacspec_ovn <> index:32 var -R2317:2320 Examples.Hacspec_lib <> :::'i32('_x_')' not -R2322:2322 Examples.Hacspec_lib <> :::'i32('_x_')' not -R2336:2339 Examples.Hacspec_lib <> :::x_'.-'_x not -R2331:2335 Examples.Hacspec_ovn <> index:32 var -R2340:2343 Examples.Hacspec_lib <> :::'i32('_x_')' not -R2345:2345 Examples.Hacspec_lib <> :::'i32('_x_')' not -R2401:2409 Hacspec.ChoiceEquality <> lift_both def -not 2380:2380 <> :::'solve_lift'_x -R2560:2567 Hacspec.ChoiceEquality <> let_both def -binder 2640:2640 <> x:33 -not 2529:2529 <> :::'letb'_x_':='_x_'in'_x -R2813:2820 Hacspec.ChoiceEquality <> let_both def -binder 2894:2894 <> x:34 -not 2778:2778 <> :::'letb'_''''_x_':='_x_'in'_x -def 3094:3103 <> height_loc -R3107:3114 Crypt.package.pkg_core_definition <> Location def -R3121:3121 Crypt.Prelude <> :::'('_x_';'_x_')' not -R3127:3129 Crypt.Prelude <> :::'('_x_';'_x_')' not -R3135:3135 Crypt.Prelude <> :::'('_x_';'_x_')' not -R3122:3126 Hacspec.Hacspec_Lib_Pre <> int32 syndef -def 3157:3166 <> tree_depth -R3174:3179 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R3188:3188 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R3180:3187 Crypt.package.pkg_core_definition <> Location def -binder 3169:3170 <> L1:35 -R3197:3205 Crypt.package.pkg_core_definition <> Interface def -binder 3192:3193 <> I1:36 -R3224:3227 Hacspec.ChoiceEquality <> both rec -R3236:3244 Hacspec.Hacspec_Lib_Pre <> uint_size def -R3232:3233 Examples.Hacspec_ovn <> I1:36 var -R3229:3230 Examples.Hacspec_ovn <> L1:35 var -binder 3209:3220 <> leaves_count:37 -R3250:3253 Hacspec.ChoiceEquality <> both rec -R3288:3296 Hacspec.Hacspec_Lib_Pre <> uint_size def -R3283:3284 Examples.Hacspec_ovn <> I1:36 var -R3258:3262 extructures.fset <> ::fset_scope:x_':|:'_x not -R3256:3257 Examples.Hacspec_ovn <> L1:35 var -R3263:3266 extructures.fset <> fset def -R3268:3268 Coq.Lists.List ListNotations ::list_scope:'['_x_']' not -R3279:3279 Coq.Lists.List ListNotations ::list_scope:'['_x_']' not -R3269:3278 Examples.Hacspec_ovn <> height_loc def -R3304:3309 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R3316:3320 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R3331:3335 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R3363:3368 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R3321:3330 Examples.Hacspec_ovn <> height_loc def -R3347:3350 Hacspec.ChoiceEquality <> both rec -R3357:3361 Hacspec.Hacspec_Lib_Pre <> int32 syndef -R3337:3340 Examples.Hacspec_lib <> :::'i32('_x_')' not -R3342:3342 Examples.Hacspec_lib <> :::'i32('_x_')' not -binder 3310:3315 <> height:38 -binder 3310:3315 <> height:39 -R3369:3373 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R3380:3383 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R3411:3652 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R3395:3398 Hacspec.ChoiceEquality <> both rec -R3405:3409 Hacspec.Hacspec_Lib_Pre <> int32 syndef -R3385:3388 Examples.Hacspec_lib <> :::'i32('_x_')' not -R3390:3390 Examples.Hacspec_lib <> :::'i32('_x_')' not -binder 3374:3379 <> height:40 -binder 3374:3379 <> height:41 -R3653:3664 Examples.Hacspec_ovn <> :::'solve_lift'_x not -R3680:3680 Examples.Hacspec_ovn <> :::'solve_lift'_x not -R3665:3672 Hacspec.Hacspec_Lib <> cast_int def -R3674:3679 Examples.Hacspec_ovn <> height:40 var -def 3725:3736 <> parent_index -R3744:3749 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R3758:3758 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R3750:3757 Crypt.package.pkg_core_definition <> Location def -binder 3739:3740 <> L1:42 -R3767:3775 Crypt.package.pkg_core_definition <> Interface def -binder 3762:3763 <> I1:43 -R3787:3790 Hacspec.ChoiceEquality <> both rec -R3799:3807 Hacspec.Hacspec_Lib_Pre <> uint_size def -R3795:3796 Examples.Hacspec_ovn <> I1:43 var -R3792:3793 Examples.Hacspec_ovn <> L1:42 var -binder 3779:3783 <> index:44 -R3813:3816 Hacspec.ChoiceEquality <> both rec -R3829:3837 Hacspec.Hacspec_Lib_Pre <> uint_size def -R3824:3825 Examples.Hacspec_ovn <> I1:43 var -R3819:3820 Examples.Hacspec_ovn <> L1:42 var -R3845:3848 Hacspec.Hacspec_Lib <> :::'ifb'_x_'then'_x_'else'_x not -R3868:3875 Hacspec.Hacspec_Lib <> :::'ifb'_x_'then'_x_'else'_x not -R3891:3898 Hacspec.Hacspec_Lib <> :::'ifb'_x_'then'_x_'else'_x not -R3849:3861 Examples.Hacspec_ovn <> is_left_index def -R3863:3867 Examples.Hacspec_ovn <> index:44 var -R3881:3884 Hacspec.Hacspec_Lib <> ::hacspec_scope:x_'./'_x not -R3876:3880 Examples.Hacspec_ovn <> index:44 var -R3885:3888 Examples.Hacspec_lib <> :::'i32('_x_')' not -R3890:3890 Examples.Hacspec_lib <> :::'i32('_x_')' not -R3899:3899 Hacspec.Hacspec_Lib <> ::hacspec_scope:x_'./'_x not -R3923:3927 Hacspec.Hacspec_Lib <> ::hacspec_scope:x_'./'_x not -R3900:3916 Examples.Hacspec_ovn <> get_sibling_index def -R3918:3922 Examples.Hacspec_ovn <> index:44 var -R3928:3931 Examples.Hacspec_lib <> :::'i32('_x_')' not -R3933:3933 Examples.Hacspec_lib <> :::'i32('_x_')' not -def 3970:3980 <> parents_loc -R3984:3991 Crypt.package.pkg_core_definition <> Location def -R3998:3998 Crypt.Prelude <> :::'('_x_';'_x_')' not -R4027:4029 Crypt.Prelude <> :::'('_x_';'_x_')' not -R4035:4035 Crypt.Prelude <> :::'('_x_';'_x_')' not -R3999:4003 Examples.Core <> t_Vec def -R4006:4014 Hacspec.Hacspec_Lib_Pre <> uint_size def -R4018:4025 Examples.Core <> t_Global constr -def 4057:4070 <> parent_indices -R4078:4083 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R4092:4092 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R4084:4091 Crypt.package.pkg_core_definition <> Location def -binder 4073:4074 <> L1:45 -R4101:4109 Crypt.package.pkg_core_definition <> Interface def -binder 4096:4097 <> I1:46 -R4123:4126 Hacspec.ChoiceEquality <> both rec -R4135:4137 Hacspec.Hacspec_Lib_Pre <> seq def -R4139:4147 Hacspec.Hacspec_Lib_Pre <> uint_size def -R4131:4132 Examples.Hacspec_ovn <> I1:46 var -R4128:4129 Examples.Hacspec_ovn <> L1:45 var -binder 4113:4119 <> indices:47 -R4153:4156 Hacspec.ChoiceEquality <> both rec -R4192:4196 Examples.Core <> t_Vec def -R4199:4207 Hacspec.Hacspec_Lib_Pre <> uint_size def -R4211:4218 Examples.Core <> t_Global constr -R4187:4188 Examples.Hacspec_ovn <> I1:46 var -R4161:4165 extructures.fset <> ::fset_scope:x_':|:'_x not -R4159:4160 Examples.Hacspec_ovn <> L1:45 var -R4166:4169 extructures.fset <> fset def -R4171:4171 Coq.Lists.List ListNotations ::list_scope:'['_x_']' not -R4183:4183 Coq.Lists.List ListNotations ::list_scope:'['_x_']' not -R4172:4182 Examples.Hacspec_ovn <> parents_loc def -R4227:4232 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R4240:4244 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R4256:4260 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R4355:4360 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R4245:4255 Examples.Hacspec_ovn <> parents_loc def -R4316:4319 Hacspec.ChoiceEquality <> both rec -R4326:4330 Examples.Core <> t_Vec def -R4333:4341 Hacspec.Hacspec_Lib_Pre <> uint_size def -R4345:4352 Examples.Core <> t_Global constr -R4262:4268 Examples.Core <> collect def -R4271:4273 Examples.Core <> map def -R4299:4310 Examples.Hacspec_ovn <> parent_index def -R4276:4281 Examples.Core <> cloned def -R4284:4287 Examples.Core <> iter def -R4289:4295 Examples.Hacspec_ovn <> indices:47 var -binder 4233:4239 <> parents:48 -binder 4233:4239 <> parents:49 -R4361:4366 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R4374:4378 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R4390:4394 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R4452:4457 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R4379:4389 Examples.Hacspec_ovn <> parents_loc def -R4413:4416 Hacspec.ChoiceEquality <> both rec -R4423:4427 Examples.Core <> t_Vec def -R4430:4438 Hacspec.Hacspec_Lib_Pre <> uint_size def -R4442:4449 Examples.Core <> t_Global constr -R4396:4400 Examples.Core <> dedup def -R4402:4408 Examples.Hacspec_ovn <> parents:48 var -binder 4367:4373 <> parents:50 -binder 4367:4373 <> parents:51 -R4458:4464 Examples.Hacspec_ovn <> parents:50 var -def 4501:4513 <> t_t_ErrorKind -R4517:4527 Crypt.choice_type <> choice_type ind -R4534:4538 Crypt.choice_type <> chFin constr -R4541:4545 Crypt.Prelude <> mkpos constr -def 4562:4601 <> ErrorKind_SerializedProofSizeIsIncorrect -R4608:4613 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R4622:4622 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R4614:4621 Crypt.package.pkg_core_definition <> Location def -binder 4604:4604 <> L:52 -R4630:4638 Crypt.package.pkg_core_definition <> Interface def -binder 4626:4626 <> I:53 -R4643:4646 Hacspec.ChoiceEquality <> both rec -R4652:4662 Examples.Core <> t_ErrorKind def -R4650:4650 Examples.Hacspec_ovn <> I:53 var -R4648:4648 Examples.Hacspec_ovn <> L:52 var -R4669:4676 Hacspec.ChoiceEquality <> ret_both def -R4719:4729 Examples.Core <> t_ErrorKind def -R4679:4693 mathcomp.ssreflect.fintype <> Ordinal constr -R4709:4715 Coq.Init.Logic <> eq_refl constr -def 4744:4773 <> ErrorKind_NotEnoughHelperNodes -R4780:4785 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R4794:4794 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R4786:4793 Crypt.package.pkg_core_definition <> Location def -binder 4776:4776 <> L:54 -R4802:4810 Crypt.package.pkg_core_definition <> Interface def -binder 4798:4798 <> I:55 -R4815:4818 Hacspec.ChoiceEquality <> both rec -R4824:4834 Examples.Core <> t_ErrorKind def -R4822:4822 Examples.Hacspec_ovn <> I:55 var -R4820:4820 Examples.Hacspec_ovn <> L:54 var -R4841:4848 Hacspec.ChoiceEquality <> ret_both def -R4891:4901 Examples.Core <> t_ErrorKind def -R4851:4865 mathcomp.ssreflect.fintype <> Ordinal constr -R4881:4887 Coq.Init.Logic <> eq_refl constr -def 4916:4944 <> ErrorKind_HashConversionError -R4951:4956 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R4965:4965 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R4957:4964 Crypt.package.pkg_core_definition <> Location def -binder 4947:4947 <> L:56 -R4973:4981 Crypt.package.pkg_core_definition <> Interface def -binder 4969:4969 <> I:57 -R4986:4989 Hacspec.ChoiceEquality <> both rec -R4995:5005 Examples.Core <> t_ErrorKind def -R4993:4993 Examples.Hacspec_ovn <> I:57 var -R4991:4991 Examples.Hacspec_ovn <> L:56 var -R5012:5019 Hacspec.ChoiceEquality <> ret_both def -R5062:5072 Examples.Core <> t_ErrorKind def -R5022:5036 mathcomp.ssreflect.fintype <> Ordinal constr -R5052:5058 Coq.Init.Logic <> eq_refl constr -def 5087:5126 <> ErrorKind_NotEnoughHashesToCalculateRoot -R5133:5138 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R5147:5147 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R5139:5146 Crypt.package.pkg_core_definition <> Location def -binder 5129:5129 <> L:58 -R5155:5163 Crypt.package.pkg_core_definition <> Interface def -binder 5151:5151 <> I:59 -R5168:5171 Hacspec.ChoiceEquality <> both rec -R5177:5187 Examples.Core <> t_ErrorKind def -R5175:5175 Examples.Hacspec_ovn <> I:59 var -R5173:5173 Examples.Hacspec_ovn <> L:58 var -R5194:5201 Hacspec.ChoiceEquality <> ret_both def -R5244:5254 Examples.Core <> t_ErrorKind def -R5204:5218 mathcomp.ssreflect.fintype <> Ordinal constr -R5234:5240 Coq.Init.Logic <> eq_refl constr -def 5269:5304 <> ErrorKind_LeavesIndicesCountMismatch -R5311:5316 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R5325:5325 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R5317:5324 Crypt.package.pkg_core_definition <> Location def -binder 5307:5307 <> L:60 -R5333:5341 Crypt.package.pkg_core_definition <> Interface def -binder 5329:5329 <> I:61 -R5346:5349 Hacspec.ChoiceEquality <> both rec -R5355:5365 Examples.Core <> t_ErrorKind def -R5353:5353 Examples.Hacspec_ovn <> I:61 var -R5351:5351 Examples.Hacspec_ovn <> L:60 var -R5372:5379 Hacspec.ChoiceEquality <> ret_both def -R5422:5432 Examples.Core <> t_ErrorKind def -R5382:5396 mathcomp.ssreflect.fintype <> Ordinal constr -R5412:5418 Coq.Init.Logic <> eq_refl constr -def 5448:5454 <> t_Error -R5458:5468 Crypt.choice_type <> choice_type ind -R5476:5486 Examples.Core <> t_ErrorKind def -def 5500:5512 <> Build_t_Error -R5519:5524 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R5533:5533 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R5525:5532 Crypt.package.pkg_core_definition <> Location def -binder 5515:5515 <> L:62 -R5541:5549 Crypt.package.pkg_core_definition <> Interface def -binder 5537:5537 <> I:63 -R5562:5565 Hacspec.ChoiceEquality <> both rec -R5572:5582 Examples.Core <> t_ErrorKind def -R5569:5569 Examples.Hacspec_ovn <> I:63 var -R5567:5567 Examples.Hacspec_ovn <> L:62 var -binder 5553:5558 <> f_kind:64 -R5588:5591 Hacspec.ChoiceEquality <> both rec -R5598:5604 Examples.Hacspec_ovn <> t_Error def -R5612:5624 Examples.Hacspec_ovn <> Build_t_Error:67 def -R5626:5631 Examples.Hacspec_ovn <> f_kind:66 var -R5698:5701 Hacspec.ChoiceEquality <> both rec -R5708:5714 Examples.Hacspec_ovn <> t_Error def -R5641:5649 Hacspec.ChoiceEquality <> bind_both def -binder 5663:5668 <> f_kind:68 -R5679:5686 Hacspec.ChoiceEquality <> ret_both def -R5688:5693 Examples.Hacspec_ovn <> f_kind:68 var -def 5760:5773 <> new_under_impl -R5781:5786 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R5795:5795 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R5787:5794 Crypt.package.pkg_core_definition <> Location def -binder 5776:5777 <> L1:69 -R5804:5812 Crypt.package.pkg_core_definition <> Interface def -binder 5799:5800 <> I1:70 -R5823:5826 Hacspec.ChoiceEquality <> both rec -R5835:5845 Examples.Core <> t_ErrorKind def -R5831:5832 Examples.Hacspec_ovn <> I1:70 var -R5828:5829 Examples.Hacspec_ovn <> L1:69 var -binder 5816:5819 <> kind:71 -R5851:5854 Hacspec.ChoiceEquality <> both rec -R5867:5873 Examples.Hacspec_ovn <> t_Error def -R5862:5863 Examples.Hacspec_ovn <> I1:70 var -R5857:5858 Examples.Hacspec_ovn <> L1:69 var -R5881:5893 Examples.Hacspec_ovn <> Build_t_Error def -R5895:5898 Examples.Hacspec_ovn <> kind:71 var -def 5943:5976 <> not_enough_helper_nodes_under_impl -R5980:5983 Hacspec.ChoiceEquality <> both rec -R6011:6017 Examples.Hacspec_ovn <> t_Error def -R5996:6007 Crypt.package.pkg_notation PackageNotation ::package_scope:'['_'interface'_']' not -R5986:5989 extructures.fset <> fset def -R5991:5992 Coq.Lists.List ListNotations ::list_scope:'['_']' not -R6025:6038 Examples.Hacspec_ovn <> new_under_impl def -R6040:6069 Examples.Hacspec_ovn <> ErrorKind_NotEnoughHelperNodes def -def 6114:6129 <> new_under_impl_1 -binder 6132:6132 <> T:72 -R6142:6148 Examples.Core <> t_Sized class -R6151:6151 Examples.Hacspec_ovn <> T:72 var -binder 6142:6152 <> H:73 -R6158:6165 Examples.Hacspec_ovn <> t_Hasher class -R6168:6168 Examples.Hacspec_ovn <> T:72 var -binder 6158:6169 <> H0:74 -R6174:6177 Hacspec.ChoiceEquality <> both rec -R6205:6217 Examples.Hacspec_ovn <> t_PartialTree def -R6220:6220 Examples.Hacspec_ovn <> T:72 var -R6190:6201 Crypt.package.pkg_notation PackageNotation ::package_scope:'['_'interface'_']' not -R6180:6183 extructures.fset <> fset def -R6185:6186 Coq.Lists.List ListNotations ::list_scope:'['_']' not -R6229:6247 Examples.Hacspec_ovn <> Build_t_PartialTree def -R6249:6256 Examples.Core <> new def -def 6293:6311 <> reversed_layers_loc -binder 6314:6314 <> T:75 -R6324:6330 Examples.Core <> t_Sized class -R6333:6333 Examples.Hacspec_ovn <> T:75 var -binder 6324:6334 <> H:76 -R6340:6347 Examples.Hacspec_ovn <> t_Hasher class -R6350:6350 Examples.Hacspec_ovn <> T:75 var -binder 6340:6351 <> H0:77 -R6356:6363 Crypt.package.pkg_core_definition <> Location def -R6370:6370 Crypt.Prelude <> :::'('_x_';'_x_')' not -R6430:6432 Crypt.Prelude <> :::'('_x_';'_x_')' not -R6438:6438 Crypt.Prelude <> :::'('_x_';'_x_')' not -R6371:6375 Examples.Core <> t_Vec def -R6378:6382 Examples.Core <> t_Vec def -R6395:6398 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R6386:6394 Hacspec.Hacspec_Lib_Pre <> uint_size def -R6399:6404 Examples.Hacspec_ovn <> t_Hash meth -R6409:6416 Examples.Core <> t_Global constr -R6421:6428 Examples.Core <> t_Global constr -def 6452:6467 <> partial_tree_loc -binder 6470:6470 <> T:78 -R6480:6486 Examples.Core <> t_Sized class -R6489:6489 Examples.Hacspec_ovn <> T:78 var -binder 6480:6490 <> H:79 -R6496:6503 Examples.Hacspec_ovn <> t_Hasher class -R6506:6506 Examples.Hacspec_ovn <> T:78 var -binder 6496:6507 <> H0:80 -R6512:6519 Crypt.package.pkg_core_definition <> Location def -R6526:6526 Crypt.Prelude <> :::'('_x_';'_x_')' not -R6586:6588 Crypt.Prelude <> :::'('_x_';'_x_')' not -R6594:6594 Crypt.Prelude <> :::'('_x_';'_x_')' not -R6527:6531 Examples.Core <> t_Vec def -R6534:6538 Examples.Core <> t_Vec def -R6551:6554 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R6542:6550 Hacspec.Hacspec_Lib_Pre <> uint_size def -R6555:6560 Examples.Hacspec_ovn <> t_Hash meth -R6565:6572 Examples.Core <> t_Global constr -R6577:6584 Examples.Core <> t_Global constr -def 6608:6616 <> nodes_loc -binder 6619:6619 <> T:81 -R6629:6635 Examples.Core <> t_Sized class -R6638:6638 Examples.Hacspec_ovn <> T:81 var -binder 6629:6639 <> H:82 -R6645:6652 Examples.Hacspec_ovn <> t_Hasher class -R6655:6655 Examples.Hacspec_ovn <> T:81 var -binder 6645:6656 <> H0:83 -R6661:6668 Crypt.package.pkg_core_definition <> Location def -R6675:6675 Crypt.Prelude <> :::'('_x_';'_x_')' not -R6716:6718 Crypt.Prelude <> :::'('_x_';'_x_')' not -R6724:6724 Crypt.Prelude <> :::'('_x_';'_x_')' not -R6676:6680 Examples.Core <> t_Vec def -R6693:6696 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R6684:6692 Hacspec.Hacspec_Lib_Pre <> uint_size def -R6697:6702 Examples.Hacspec_ovn <> t_Hash meth -R6707:6714 Examples.Core <> t_Global constr -def 6738:6754 <> current_layer_loc -binder 6757:6757 <> T:84 -R6767:6773 Examples.Core <> t_Sized class -R6776:6776 Examples.Hacspec_ovn <> T:84 var -binder 6767:6777 <> H:85 -R6783:6790 Examples.Hacspec_ovn <> t_Hasher class -R6793:6793 Examples.Hacspec_ovn <> T:84 var -binder 6783:6794 <> H0:86 -R6799:6806 Crypt.package.pkg_core_definition <> Location def -R6813:6813 Crypt.Prelude <> :::'('_x_';'_x_')' not -R6854:6856 Crypt.Prelude <> :::'('_x_';'_x_')' not -R6862:6862 Crypt.Prelude <> :::'('_x_';'_x_')' not -R6814:6818 Examples.Core <> t_Vec def -R6831:6834 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R6822:6830 Hacspec.Hacspec_Lib_Pre <> uint_size def -R6835:6840 Examples.Hacspec_ovn <> t_Hash meth -R6845:6852 Examples.Core <> t_Global constr -def 6885:6907 <> build_tree_under_impl_1 -binder 6910:6910 <> T:87 -R6920:6926 Examples.Core <> t_Sized class -R6929:6929 Examples.Hacspec_ovn <> T:87 var -binder 6920:6930 <> H:88 -R6936:6943 Examples.Hacspec_ovn <> t_Hasher class -R6946:6946 Examples.Hacspec_ovn <> T:87 var -binder 6936:6947 <> H0:89 -R6956:6961 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R6970:6970 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R6962:6969 Crypt.package.pkg_core_definition <> Location def -binder 6951:6952 <> L1:90 -R6979:6984 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R6993:6993 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R6985:6992 Crypt.package.pkg_core_definition <> Location def -binder 6974:6975 <> L2:91 -R7002:7010 Crypt.package.pkg_core_definition <> Interface def -binder 6997:6998 <> I1:92 -R7019:7027 Crypt.package.pkg_core_definition <> Interface def -binder 7014:7015 <> I2:93 -R7048:7051 Hacspec.ChoiceEquality <> both rec -R7060:7064 Examples.Core <> t_Vec def -R7067:7071 Examples.Core <> t_Vec def -R7084:7087 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R7075:7083 Hacspec.Hacspec_Lib_Pre <> uint_size def -R7088:7093 Examples.Hacspec_ovn <> t_Hash meth -R7098:7105 Examples.Core <> t_Global constr -R7110:7117 Examples.Core <> t_Global constr -R7056:7057 Examples.Hacspec_ovn <> I1:92 var -R7053:7054 Examples.Hacspec_ovn <> L1:90 var -binder 7031:7044 <> partial_layers:94 -R7141:7144 Hacspec.ChoiceEquality <> both rec -R7153:7161 Hacspec.Hacspec_Lib_Pre <> uint_size def -R7149:7150 Examples.Hacspec_ovn <> I2:93 var -R7146:7147 Examples.Hacspec_ovn <> L2:91 var -binder 7123:7137 <> full_tree_depth:95 -R7167:7170 Hacspec.ChoiceEquality <> both rec -R7274:7281 Examples.Core <> t_Result def -R7284:7288 Examples.Core <> t_Vec def -R7291:7295 Examples.Core <> t_Vec def -R7308:7311 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R7299:7307 Hacspec.Hacspec_Lib_Pre <> uint_size def -R7312:7317 Examples.Hacspec_ovn <> t_Hash meth -R7322:7329 Examples.Core <> t_Global constr -R7334:7341 Examples.Core <> t_Global constr -R7346:7352 Examples.Hacspec_ovn <> t_Error def -R7266:7268 extructures.fset <> ::fset_scope:x_':|:'_x not -R7264:7265 Examples.Hacspec_ovn <> I1:92 var -R7269:7270 Examples.Hacspec_ovn <> I2:93 var -R7180:7184 extructures.fset <> ::fset_scope:x_':|:'_x not -R7175:7177 extructures.fset <> ::fset_scope:x_':|:'_x not -R7173:7174 Examples.Hacspec_ovn <> L1:90 var -R7178:7179 Examples.Hacspec_ovn <> L2:91 var -R7185:7188 extructures.fset <> fset def -R7190:7190 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not -R7208:7209 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not -R7226:7227 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not -R7247:7248 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not -R7260:7260 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not -R7191:7207 Examples.Hacspec_ovn <> current_layer_loc def -R7210:7225 Examples.Hacspec_ovn <> partial_tree_loc def -R7228:7246 Examples.Hacspec_ovn <> reversed_layers_loc def -R7249:7259 Examples.Hacspec_ovn <> parents_loc def -R7429:7434 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R7447:7451 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R7468:7472 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R7556:7561 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R7452:7467 Examples.Hacspec_ovn <> partial_tree_loc def -R7486:7489 Hacspec.ChoiceEquality <> both rec -R7496:7500 Examples.Core <> t_Vec def -R7503:7507 Examples.Core <> t_Vec def -R7520:7523 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R7511:7519 Hacspec.Hacspec_Lib_Pre <> uint_size def -R7524:7529 Examples.Hacspec_ovn <> t_Hash meth -R7534:7541 Examples.Core <> t_Global constr -R7546:7553 Examples.Core <> t_Global constr -R7474:7481 Examples.Core <> new def -binder 7435:7446 <> partial_tree:96 -binder 7435:7446 <> partial_tree:97 -R7562:7567 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R7581:7585 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R7603:7607 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R7672:7677 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R7586:7602 Examples.Hacspec_ovn <> current_layer_loc def -R7621:7624 Hacspec.ChoiceEquality <> both rec -R7631:7635 Examples.Core <> t_Vec def -R7648:7651 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R7639:7647 Hacspec.Hacspec_Lib_Pre <> uint_size def -R7652:7657 Examples.Hacspec_ovn <> t_Hash meth -R7662:7669 Examples.Core <> t_Global constr -R7609:7616 Examples.Core <> new def -binder 7568:7580 <> current_layer:98 -binder 7568:7580 <> current_layer:99 -R7678:7684 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R7699:7699 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R7719:7723 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R7896:7901 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R7759:7762 Hacspec.ChoiceEquality <> both rec -R7831:7834 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R7770:7776 Examples.Core <> t_Drain def -R7779:7783 Examples.Core <> t_Vec def -R7796:7799 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R7787:7795 Hacspec.Hacspec_Lib_Pre <> uint_size def -R7800:7805 Examples.Hacspec_ovn <> t_Hash meth -R7810:7817 Examples.Core <> t_Global constr -R7822:7829 Examples.Core <> t_Global constr -R7835:7839 Examples.Core <> t_Vec def -R7842:7846 Examples.Core <> t_Vec def -R7859:7862 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R7850:7858 Hacspec.Hacspec_Lib_Pre <> uint_size def -R7863:7868 Examples.Hacspec_ovn <> t_Hash meth -R7873:7880 Examples.Core <> t_Global constr -R7885:7892 Examples.Core <> t_Global constr -R7725:7729 Examples.Core <> drain def -R7746:7754 Examples.Core <> RangeFull constr -R7731:7744 Examples.Hacspec_ovn <> partial_layers:94 var -binder 7685:7698 <> todo_fresh_var:100 -binder 7700:7718 <> partial_layers_temp:101 -R7902:7906 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R7921:7924 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R8019:8024 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R7949:7952 Hacspec.ChoiceEquality <> both rec -R7959:7963 Examples.Core <> t_Vec def -R7966:7970 Examples.Core <> t_Vec def -R7983:7986 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R7974:7982 Hacspec.Hacspec_Lib_Pre <> uint_size def -R7987:7992 Examples.Hacspec_ovn <> t_Hash meth -R7997:8004 Examples.Core <> t_Global constr -R8009:8016 Examples.Core <> t_Global constr -R7926:7944 Examples.Hacspec_ovn <> partial_layers_temp:101 var -binder 7907:7920 <> partial_layers:102 -binder 7907:7920 <> partial_layers:103 -R8025:8029 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R8036:8039 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R8131:8136 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R8059:8062 Hacspec.ChoiceEquality <> both rec -R8069:8075 Examples.Core <> t_Drain def -R8078:8082 Examples.Core <> t_Vec def -R8095:8098 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R8086:8094 Hacspec.Hacspec_Lib_Pre <> uint_size def -R8099:8104 Examples.Hacspec_ovn <> t_Hash meth -R8109:8116 Examples.Core <> t_Global constr -R8121:8128 Examples.Core <> t_Global constr -R8041:8054 Examples.Hacspec_ovn <> todo_fresh_var:100 var -binder 8030:8035 <> hoist1:104 -binder 8030:8035 <> hoist1:105 -R8137:8141 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R8148:8151 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R8247:8252 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R8167:8170 Hacspec.ChoiceEquality <> both rec -R8177:8181 Examples.Core <> t_Rev syndef -R8184:8190 Examples.Core <> t_Drain def -R8193:8197 Examples.Core <> t_Vec def -R8210:8213 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R8201:8209 Hacspec.Hacspec_Lib_Pre <> uint_size def -R8214:8219 Examples.Hacspec_ovn <> t_Hash meth -R8224:8231 Examples.Core <> t_Global constr -R8236:8243 Examples.Core <> t_Global constr -R8153:8155 Examples.Core <> rev def -R8157:8162 Examples.Hacspec_ovn <> hoist1:104 var -binder 8142:8147 <> hoist2:106 -binder 8142:8147 <> hoist2:107 -R8253:8258 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R8274:8278 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R8298:8302 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R8392:8397 Hacspec.ChoiceEquality <> :::'letbm'_x_'loc('_x_')'_':='_x_'in'_x not -R8279:8297 Examples.Hacspec_ovn <> reversed_layers_loc def -R8322:8325 Hacspec.ChoiceEquality <> both rec -R8332:8336 Examples.Core <> t_Vec def -R8339:8343 Examples.Core <> t_Vec def -R8356:8359 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R8347:8355 Hacspec.Hacspec_Lib_Pre <> uint_size def -R8360:8365 Examples.Hacspec_ovn <> t_Hash meth -R8370:8377 Examples.Core <> t_Global constr -R8382:8389 Examples.Core <> t_Global constr -R8304:8310 Examples.Core <> collect def -R8312:8317 Examples.Hacspec_ovn <> hoist2:106 var -binder 8259:8273 <> reversed_layers:108 -binder 8259:8273 <> reversed_layers:109 -R8398:8404 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_','_x_')'_':='_x_'in'_x not -R8418:8418 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_','_x_')'_':='_x_'in'_x not -R8431:8431 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_','_x_')'_':='_x_'in'_x not -R8447:8451 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_','_x_')'_':='_x_'in'_x not -R11635:11640 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_','_x_')'_':='_x_'in'_x not -R11456:11459 Hacspec.ChoiceEquality <> both rec -R11570:11573 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R11507:11510 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R11467:11471 Examples.Core <> t_Vec def -R11484:11487 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R11475:11483 Hacspec.Hacspec_Lib_Pre <> uint_size def -R11488:11493 Examples.Hacspec_ovn <> t_Hash meth -R11498:11505 Examples.Core <> t_Global constr -R11511:11515 Examples.Core <> t_Vec def -R11518:11522 Examples.Core <> t_Vec def -R11535:11538 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R11526:11534 Hacspec.Hacspec_Lib_Pre <> uint_size def -R11539:11544 Examples.Hacspec_ovn <> t_Hash meth -R11549:11556 Examples.Core <> t_Global constr -R11561:11568 Examples.Core <> t_Global constr -R11574:11578 Examples.Core <> t_Vec def -R11581:11585 Examples.Core <> t_Vec def -R11598:11601 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R11589:11597 Hacspec.Hacspec_Lib_Pre <> uint_size def -R11602:11607 Examples.Hacspec_ovn <> t_Hash meth -R11612:11619 Examples.Core <> t_Global constr -R11624:11631 Examples.Core <> t_Global constr -R8453:8462 Hacspec.Hacspec_Lib <> foldi_both def -R11402:11408 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b('_x_','_x_','_'..'_','_x_')' not -R11422:11422 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b('_x_','_x_','_'..'_','_x_')' not -R11435:11435 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b('_x_','_x_','_'..'_','_x_')' not -R11451:11451 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b('_x_','_x_','_'..'_','_x_')' not -R11409:11421 Examples.Hacspec_ovn <> current_layer:98 var -R11423:11434 Examples.Hacspec_ovn <> partial_tree:96 var -R11436:11450 Examples.Hacspec_ovn <> reversed_layers:108 var -binder 8520:8520 <> L:110 -binder 8522:8522 <> I:111 -R8547:8557 Hacspec.Hacspec_Lib <> :::'ssp'_'('_'fun'_''''_'('_x_','_x_','_x_')'_'=>'_x_')' not -R8571:8571 Hacspec.Hacspec_Lib <> :::'ssp'_'('_'fun'_''''_'('_x_','_x_','_x_')'_'=>'_x_')' not -R8584:8584 Hacspec.Hacspec_Lib <> :::'ssp'_'('_'fun'_''''_'('_x_','_x_','_x_')'_'=>'_x_')' not -R8600:8612 Hacspec.Hacspec_Lib <> :::'ssp'_'('_'fun'_''''_'('_x_','_x_','_x_')'_'=>'_x_')' not -R11397:11397 Hacspec.Hacspec_Lib <> :::'ssp'_'('_'fun'_''''_'('_x_','_x_','_x_')'_'=>'_x_')' not -binder 8558:8570 <> current_layer:112 -binder 8572:8583 <> partial_tree:113 -binder 8585:8599 <> reversed_layers:114 -R8613:8619 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R8634:8634 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R8655:8659 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R8811:8822 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R8684:8687 Hacspec.ChoiceEquality <> both rec -R8746:8749 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R8695:8702 Examples.Core <> t_Option def -R8705:8709 Examples.Core <> t_Vec def -R8722:8725 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R8713:8721 Hacspec.Hacspec_Lib_Pre <> uint_size def -R8726:8731 Examples.Hacspec_ovn <> t_Hash meth -R8736:8743 Examples.Core <> t_Global constr -R8750:8754 Examples.Core <> t_Vec def -R8757:8761 Examples.Core <> t_Vec def -R8774:8777 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R8765:8773 Hacspec.Hacspec_Lib_Pre <> uint_size def -R8778:8783 Examples.Hacspec_ovn <> t_Hash meth -R8788:8795 Examples.Core <> t_Global constr -R8800:8807 Examples.Core <> t_Global constr -R8661:8663 Examples.Core <> pop def -R8665:8679 Examples.Hacspec_ovn <> reversed_layers:114 var -binder 8620:8633 <> todo_fresh_var:115 -binder 8635:8654 <> reversed_layers_temp:116 -R8823:8827 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R8843:8846 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R8942:8953 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R8872:8875 Hacspec.ChoiceEquality <> both rec -R8882:8886 Examples.Core <> t_Vec def -R8889:8893 Examples.Core <> t_Vec def -R8906:8909 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R8897:8905 Hacspec.Hacspec_Lib_Pre <> uint_size def -R8910:8915 Examples.Hacspec_ovn <> t_Hash meth -R8920:8927 Examples.Core <> t_Global constr -R8932:8939 Examples.Core <> t_Global constr -R8848:8867 Examples.Hacspec_ovn <> reversed_layers_temp:116 var -binder 8828:8842 <> reversed_layers:117 -binder 8828:8842 <> reversed_layers:118 -R8954:8958 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R8965:8968 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R9050:9061 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R8988:8991 Hacspec.ChoiceEquality <> both rec -R8998:9005 Examples.Core <> t_Option def -R9008:9012 Examples.Core <> t_Vec def -R9025:9028 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R9016:9024 Hacspec.Hacspec_Lib_Pre <> uint_size def -R9029:9034 Examples.Hacspec_ovn <> t_Hash meth -R9039:9046 Examples.Core <> t_Global constr -R8970:8983 Examples.Hacspec_ovn <> todo_fresh_var:115 var -binder 8959:8964 <> hoist3:119 -binder 8959:8964 <> hoist3:120 -R9062:9066 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R9080:9083 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R9701:9712 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R9650:9653 Hacspec.ChoiceEquality <> both rec -R9660:9664 Examples.Core <> t_Vec def -R9677:9680 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R9668:9676 Hacspec.Hacspec_Lib_Pre <> uint_size def -R9681:9686 Examples.Hacspec_ovn <> t_Hash meth -R9691:9698 Examples.Core <> t_Global constr -R9085:9091 Examples.Core <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'''_'''_'=>'_x_'end' not -R9098:9127 Examples.Core <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'''_'''_'=>'_x_'end' not -R9133:9136 Examples.Core <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'''_'''_'=>'_x_'end' not -R9601:9618 Examples.Core <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'''_'''_'=>'_x_'end' not -R9632:9645 Examples.Core <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'''_'''_'=>'_x_'end' not -R9092:9097 Examples.Hacspec_ovn <> hoist3:119 var -binder 9128:9132 <> nodes:121 -R9137:9143 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R9162:9162 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R9173:9177 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R9306:9321 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R9209:9212 Hacspec.ChoiceEquality <> both rec -R9260:9263 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R9220:9224 Examples.Core <> t_Vec def -R9237:9240 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R9228:9236 Hacspec.Hacspec_Lib_Pre <> uint_size def -R9241:9246 Examples.Hacspec_ovn <> t_Hash meth -R9251:9258 Examples.Core <> t_Global constr -R9264:9268 Examples.Core <> t_Vec def -R9281:9284 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R9272:9280 Hacspec.Hacspec_Lib_Pre <> uint_size def -R9285:9290 Examples.Hacspec_ovn <> t_Hash meth -R9295:9302 Examples.Core <> t_Global constr -R9179:9184 Examples.Core <> append def -R9200:9204 Examples.Hacspec_ovn <> nodes:121 var -R9186:9198 Examples.Hacspec_ovn <> current_layer:112 var -binder 9144:9161 <> current_layer_temp:122 -binder 9163:9172 <> nodes_temp:123 -R9322:9326 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R9340:9343 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R9418:9433 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R9367:9370 Hacspec.ChoiceEquality <> both rec -R9377:9381 Examples.Core <> t_Vec def -R9394:9397 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R9385:9393 Hacspec.Hacspec_Lib_Pre <> uint_size def -R9398:9403 Examples.Hacspec_ovn <> t_Hash meth -R9408:9415 Examples.Core <> t_Global constr -R9345:9362 Examples.Hacspec_ovn <> current_layer_temp:122 var -binder 9327:9339 <> current_layer:124 -binder 9327:9339 <> current_layer:125 -R9434:9438 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R9444:9447 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R9514:9529 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R9463:9466 Hacspec.ChoiceEquality <> both rec -R9473:9477 Examples.Core <> t_Vec def -R9490:9493 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R9481:9489 Hacspec.Hacspec_Lib_Pre <> uint_size def -R9494:9499 Examples.Hacspec_ovn <> t_Hash meth -R9504:9511 Examples.Core <> t_Global constr -R9449:9458 Examples.Hacspec_ovn <> nodes_temp:123 var -binder 9439:9443 <> nodes:126 -binder 9439:9443 <> nodes:127 -R9530:9534 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R9536:9539 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R9572:9587 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R9556:9559 Hacspec.ChoiceEquality <> both rec -R9566:9570 Crypt.package.pkg_notation PackageNotation ::package_scope:'''unit' not -R9541:9551 Examples.Core <> :::'ret_both'_'tt' not -binder 9535:9535 <> pat:128 -R9588:9600 Examples.Hacspec_ovn <> current_layer:124 var -R9619:9631 Examples.Hacspec_ovn <> current_layer:112 var -binder 9067:9079 <> current_layer:129 -binder 9067:9079 <> current_layer:130 -R9713:9717 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R9730:9733 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R9848:9859 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R9778:9781 Hacspec.ChoiceEquality <> both rec -R9788:9792 Examples.Core <> t_Vec def -R9795:9799 Examples.Core <> t_Vec def -R9812:9815 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R9803:9811 Hacspec.Hacspec_Lib_Pre <> uint_size def -R9816:9821 Examples.Hacspec_ovn <> t_Hash meth -R9826:9833 Examples.Core <> t_Global constr -R9838:9845 Examples.Core <> t_Global constr -R9735:9738 Examples.Core <> push def -R9754:9758 Examples.Core <> clone syndef -R9760:9772 Examples.Hacspec_ovn <> current_layer:129 var -R9740:9751 Examples.Hacspec_ovn <> partial_tree:113 var -binder 9718:9729 <> partial_tree:131 -binder 9718:9729 <> partial_tree:132 -R9860:9866 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R9881:9881 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R9900:9904 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R10038:11346 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R9939:9942 Hacspec.ChoiceEquality <> both rec -R9992:9995 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R9950:9956 Examples.Core <> t_Drain def -R9969:9972 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R9960:9968 Hacspec.Hacspec_Lib_Pre <> uint_size def -R9973:9978 Examples.Hacspec_ovn <> t_Hash meth -R9983:9990 Examples.Core <> t_Global constr -R9996:10000 Examples.Core <> t_Vec def -R10013:10016 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R10004:10012 Hacspec.Hacspec_Lib_Pre <> uint_size def -R10017:10022 Examples.Hacspec_ovn <> t_Hash meth -R10027:10034 Examples.Core <> t_Global constr -R9906:9910 Examples.Core <> drain def -R9926:9934 Examples.Core <> RangeFull constr -R9912:9924 Examples.Hacspec_ovn <> current_layer:129 var -binder 9867:9880 <> todo_fresh_var:133 -binder 9882:9899 <> current_layer_temp:134 -R11347:11353 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b('_x_','_x_','_'..'_','_x_')' not -R11367:11367 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b('_x_','_x_','_'..'_','_x_')' not -R11380:11380 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b('_x_','_x_','_'..'_','_x_')' not -R11396:11396 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b('_x_','_x_','_'..'_','_x_')' not -R11354:11366 Examples.Hacspec_ovn <> current_layer:129 var -R11368:11379 Examples.Hacspec_ovn <> partial_tree:131 var -R11381:11395 Examples.Hacspec_ovn <> reversed_layers:117 var -R8465:8473 Examples.Hacspec_lib <> into_iter syndef -R8476:8488 Examples.Hacspec_lib <> Build_t_Range def -R8496:8510 Examples.Hacspec_ovn <> full_tree_depth:95 var -R8490:8493 Examples.Hacspec_lib <> :::'i32('_x_')' not -R8495:8495 Examples.Hacspec_lib <> :::'i32('_x_')' not -binder 8405:8417 <> current_layer:135 -binder 8419:8430 <> partial_tree:136 -binder 8432:8446 <> reversed_layers:137 -R11641:11645 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R11658:11661 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R11776:11801 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R11706:11709 Hacspec.ChoiceEquality <> both rec -R11716:11720 Examples.Core <> t_Vec def -R11723:11727 Examples.Core <> t_Vec def -R11740:11743 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R11731:11739 Hacspec.Hacspec_Lib_Pre <> uint_size def -R11744:11749 Examples.Hacspec_ovn <> t_Hash meth -R11754:11761 Examples.Core <> t_Global constr -R11766:11773 Examples.Core <> t_Global constr -R11663:11666 Examples.Core <> push def -R11682:11686 Examples.Core <> clone syndef -R11688:11700 Examples.Hacspec_ovn <> current_layer:135 var -R11668:11679 Examples.Hacspec_ovn <> partial_tree:136 var -binder 11646:11657 <> partial_tree:138 -binder 11646:11657 <> partial_tree:139 -R11802:11813 Examples.Hacspec_ovn <> :::'solve_lift'_x not -R11836:11836 Examples.Hacspec_ovn <> :::'solve_lift'_x not -R11814:11822 Examples.Core <> Result_Ok syndef -R11824:11835 Examples.Hacspec_ovn <> partial_tree:138 var -R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm -R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm -R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm -R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm -R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm -R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm -R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm -R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm -R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm -R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm -R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm -R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm -R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm -R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm -R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm -R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm -R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm -R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm -R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm -R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm -R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm -R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm -R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm -R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm -R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm -R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm -R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm -R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm -R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm -R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm -R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm -R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm -R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm -R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm -R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm -R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm -R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm -R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm -R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm -R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm -R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm -R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm -R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm -R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm -R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm -R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm -R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm -R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm -R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm -R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm -R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm -R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm -R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm -R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm -R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm -R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm -R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm -R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm -R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm -R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm -R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm -R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm -R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm -R11875:11910 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_1 thm -R11922:11957 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_2 thm -R11969:12004 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_3 thm -R12016:12051 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_6 thm -R12058:12093 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_8 thm -R12100:12136 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_20 thm -R12143:12179 Examples.Hacspec_ovn <> build_tree_under_impl_1_obligation_21 thm -def 12252:12269 <> build_under_impl_1 -binder 12272:12272 <> T:140 -R12282:12288 Examples.Core <> t_Sized class -R12291:12291 Examples.Hacspec_ovn <> T:140 var -binder 12282:12292 <> H:141 -R12298:12305 Examples.Hacspec_ovn <> t_Hasher class -R12308:12308 Examples.Hacspec_ovn <> T:140 var -binder 12298:12309 <> H0:142 -R12318:12323 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R12332:12332 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R12324:12331 Crypt.package.pkg_core_definition <> Location def -binder 12313:12314 <> L1:143 -R12341:12346 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R12355:12355 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R12347:12354 Crypt.package.pkg_core_definition <> Location def -binder 12336:12337 <> L2:144 -R12364:12372 Crypt.package.pkg_core_definition <> Interface def -binder 12359:12360 <> I1:145 -R12381:12389 Crypt.package.pkg_core_definition <> Interface def -binder 12376:12377 <> I2:146 -R12410:12413 Hacspec.ChoiceEquality <> both rec -R12422:12426 Examples.Core <> t_Vec def -R12429:12433 Examples.Core <> t_Vec def -R12446:12449 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R12437:12445 Hacspec.Hacspec_Lib_Pre <> uint_size def -R12450:12455 Examples.Hacspec_ovn <> t_Hash meth -R12460:12467 Examples.Core <> t_Global constr -R12472:12479 Examples.Core <> t_Global constr -R12418:12419 Examples.Hacspec_ovn <> I1:145 var -R12415:12416 Examples.Hacspec_ovn <> L1:143 var -binder 12393:12406 <> partial_layers:147 -R12493:12496 Hacspec.ChoiceEquality <> both rec -R12505:12513 Hacspec.Hacspec_Lib_Pre <> uint_size def -R12501:12502 Examples.Hacspec_ovn <> I2:146 var -R12498:12499 Examples.Hacspec_ovn <> L2:144 var -binder 12485:12489 <> depth:148 -R12519:12522 Hacspec.ChoiceEquality <> both rec -R12637:12644 Examples.Core <> t_Result def -R12647:12659 Examples.Hacspec_ovn <> t_PartialTree def -R12662:12662 Examples.Hacspec_ovn <> T:140 var -R12667:12673 Examples.Hacspec_ovn <> t_Error def -R12629:12631 extructures.fset <> ::fset_scope:x_':|:'_x not -R12627:12628 Examples.Hacspec_ovn <> I1:145 var -R12632:12633 Examples.Hacspec_ovn <> I2:146 var -R12532:12536 extructures.fset <> ::fset_scope:x_':|:'_x not -R12527:12529 extructures.fset <> ::fset_scope:x_':|:'_x not -R12525:12526 Examples.Hacspec_ovn <> L1:143 var -R12530:12531 Examples.Hacspec_ovn <> L2:144 var -R12537:12540 extructures.fset <> fset def -R12542:12542 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not -R12560:12561 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not -R12571:12572 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not -R12589:12590 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not -R12610:12611 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not -R12623:12623 Coq.Lists.List ListNotations ::list_scope:'['_x_';'_x_';'_'..'_';'_x_']' not -R12543:12559 Examples.Hacspec_ovn <> current_layer_loc def -R12562:12570 Examples.Hacspec_ovn <> nodes_loc def -R12573:12588 Examples.Hacspec_ovn <> partial_tree_loc def -R12591:12609 Examples.Hacspec_ovn <> reversed_layers_loc def -R12612:12622 Examples.Hacspec_ovn <> parents_loc def -R12682:12684 Examples.Core <> run def -R12687:12691 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R12698:12701 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R13067:13072 Examples.Hacspec_ovn <> :::'letb'_x_':='_x_'in'_x not -R12997:13000 Hacspec.ChoiceEquality <> both rec -R13007:13011 Examples.Core <> t_Vec def -R13014:13018 Examples.Core <> t_Vec def -R13031:13034 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R13022:13030 Hacspec.Hacspec_Lib_Pre <> uint_size def -R13035:13040 Examples.Hacspec_ovn <> t_Hash meth -R13045:13052 Examples.Core <> t_Global constr -R13057:13064 Examples.Core <> t_Global constr diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 27dfb4e..19437a5 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -7,7 +7,8 @@ From mathcomp Require Import ssrZ word. From Jasmin Require Import word. From Coq Require Import ZArith. -Import List.ListNotations. +From Coq Require Import Strings.String. + Import List.ListNotations. Open Scope list_scope. Open Scope Z_scope. Open Scope bool_scope. @@ -31,42 +32,40 @@ Require Import Hacspec_lib. Require Import Schnorr. -Require Import Schnorr. (* as sample_uniform *) +Notation t_Secret := (t_Q). -Require Import Schnorr. +Program Definition sample_uniform : both (fset []) ([interface ]) (t_Q) := + Build_t_Q i32(1). +Fail Next Obligation. -Notation t_public := (t_Q). +Notation t_public := (t_G). -Notation t_public_key := ((t_Q × (t_G × t_G × t_Q × t_G))). +Notation t_public_key := ((t_G × (t_G × t_G × t_Q × t_Q))). -Program Definition p_i_init {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 (unit)) : both (L1 :|: fset [commit_loc]) (I1) ((t_Q × (t_G × t_G × t_Q × t_G))) := - letb x := (sample_uniform) : both _ _ (t_G) in - letb y := (v_ONE) : both _ _ (t_Q) in - letb zkp := (fiat_shamir_run prod_b(x,y)) : both _ _ ((t_G × t_G × t_Q × t_G)) in - prod_b(y,zkp). +Program Definition p_i_init {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both (L1 :|: fset [commit_loc]) (I1) ((t_G × (t_G × t_G × t_Q × t_Q))) := + letb x := (sample_uniform) : both _ _ (t_Q) in + letb y := (Build_t_G i32(1)) : both _ _ (t_G) in + letb zkp := (fiat_shamir_run (prod_b (y,x))) : both _ _ ((t_G × t_G × t_Q × t_Q)) in + prod_b (y,zkp). Fail Next Obligation. -Notation t_N := (nat_mod 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab). -Definition N {L : {fset Location}} {I : Interface} : both L I (t_N) -> both L I (t_N) := - id. - Notation t_pid := (t_N). Require Import Std. (* as HashMap *) -Notation t_public_keys := (t_HashMap (t_N) ((t_Q × (t_G × t_G × t_Q × t_G))) (t_RandomState)). +Notation t_public_keys := (t_HashMap (t_N) ((t_G × (t_G × t_G × t_Q × t_Q))) (t_RandomState)). -Program Definition p_i_construct {L1 : {fset Location}} {I1 : Interface} (m : both L1 I1 (t_HashMap (t_N) ((t_Q × (t_G × t_G × t_Q × t_G))) (t_RandomState))) : both (L1) (I1) (unit) := - tt. +Program Definition p_i_construct {L1 : {fset Location}} {I1 : Interface} (m : both L1 I1 (t_HashMap (t_N) ((t_G × (t_G × t_G × t_Q × t_Q))) (t_RandomState))) : both (L1) (I1) ('unit) := + ret_both (tt : 'unit). Fail Next Obligation. -Program Definition p_i_vote {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 ('bool)) : both (L1) (I1) (t_Q) := - v_ONE. +Program Definition p_i_vote {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 ('bool)) : both (L1) (I1) (t_G) := + Build_t_G i32(1). Fail Next Obligation. -Program Definition exec {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 ('bool)) : both (L1 :|: fset [commit_loc]) (I1) (t_Q) := - letb x := (sample_uniform) : both _ _ (t_G) in - letb y := (v_ONE) : both _ _ (t_Q) in - letb zkp := (fiat_shamir_run prod_b(x,y)) : both _ _ ((t_G × t_G × t_Q × t_G)) in +Program Definition exec {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 ('bool)) : both (L1 :|: fset [commit_loc]) (I1) (t_G) := + letb x := (sample_uniform) : both _ _ (t_Q) in + letb y := (Build_t_G i32(1)) : both _ _ (t_G) in + letb zkp := (fiat_shamir_run (prod_b (y,x))) : both _ _ ((t_G × t_G × t_Q × t_Q)) in p_i_vote v. Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.glob b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.glob new file mode 100644 index 0000000..a2ada2d --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.glob @@ -0,0 +1,31 @@ +DIGEST 41711fa53f537116d9fcaa389f96befd +FExamples.Hacspec_ovn_Schnorr +R126:136 Crypt.choice_type <> <> lib +R138:144 Crypt.Package <> <> lib +R146:152 Crypt.Prelude <> <> lib +R162:176 Crypt.package.pkg_notation PackageNotation <> mod +R211:213 extructures.ord <> <> lib +R215:218 extructures.fset <> <> lib +R250:253 mathcomp.zify.ssrZ <> <> lib +R255:258 mathcomp.word.word <> <> lib +R288:291 Jasmin.word <> <> lib +R319:324 Coq.ZArith.ZArith <> <> lib +R351:364 Coq.Strings.String <> <> lib +R377:394 Coq.Lists.List ListNotations <> mod +R492:505 Hacspec.ChoiceEquality <> <> lib +R536:550 Hacspec.LocationUtility <> <> lib +R581:602 Hacspec.Hacspec_Lib_Comparable <> <> lib +R633:647 Hacspec.Hacspec_Lib_Pre <> <> lib +R678:688 Hacspec.Hacspec_Lib <> <> lib +R725:745 mathcomp.ssreflect.choice Choice.Exports <> mod +R833:843 Examples.Hacspec_lib <> <> lib +R862:864 Examples.Std <> <> lib +R937:969 Examples.Hacspec_ovn_Schnorr_Random_oracle <> <> lib +syndef 982:993 <> t_Transcript +R1017:1020 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R1010:1013 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R1003:1006 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R1000:1002 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R1007:1009 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R1014:1016 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def +R1021:1023 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.Schnorr.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v similarity index 62% rename from ovn/proofs/ssprove/extraction/Hacspec_ovn.Schnorr.v rename to ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v index 9ad6757..25eeecf 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.Schnorr.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v @@ -7,7 +7,8 @@ From mathcomp Require Import ssrZ word. From Jasmin Require Import word. From Coq Require Import ZArith. -Import List.ListNotations. +From Coq Require Import Strings.String. + Import List.ListNotations. Open Scope list_scope. Open Scope Z_scope. Open Scope bool_scope. @@ -29,55 +30,48 @@ Require Import Std. (* as HashMap *) (*Not implemented yet? todo(item)*) -Notation t_Witness := (t_Q). +Require Import Hacspec_ovn_Schnorr_Random_oracle. -Notation t_Statement := (t_G). +Notation t_Transcript := ((t_G × t_G × t_Q × t_Q)). -Notation t_Message := (t_G). - -Notation t_Challenge := (t_Q). - -Notation t_Response := (t_G). - -Notation t_Transcript := ((t_G × t_G × t_Q × t_G)). - -Program Definition prod_assoc {L1 : {fset Location}} {I1 : Interface} ('(statement,message) : both L1 I1 ((t_G × t_G))) : both (L1) (I1) (t_G) := - v_ONE. +Program Definition prod_assoc {L1 : {fset Location}} {I1 : Interface} (sm : both L1 I1 ((t_G × t_G))) : both (L1) (I1) (t_Q) := + letb '(statement,message) := (sm) : both _ _ ((t_G × t_G)) in + Build_t_Q i32(1). Fail Next Obligation. -Program Definition verify {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (h : both L1 I1 (t_G)) (a : both L2 I2 (t_G)) (e : both L3 I3 (t_Q)) (z : both L4 I4 (t_G)) : both (L1:|:L2:|:L3:|:L4) (I1:|:I2:|:I3:|:I4) ('bool) := +Program Definition verify {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (h : both L1 I1 (t_G)) (a : both L2 I2 (t_G)) (e : both L3 I3 (t_Q)) (z : both L4 I4 (t_Q)) : both (L1:|:L2:|:L3:|:L4) (I1:|:I2:|:I3:|:I4) ('bool) := false. Fail Next Obligation. -Program Definition fiat_shamir_verify {L1 : {fset Location}} {I1 : Interface} (t : both L1 I1 ((t_G × t_G × t_Q × t_G))) : both (L1) (I1) ('bool) := - letb QUERIES := (new_under_impl) : both _ _ (t_HashMap (t_G) (t_G) (t_RandomState)) in - letb '(h,a,e,z) := (t) : both _ _ ((t_G × t_G × t_Q × t_G)) in - letb '(QUERIES,eu) := (random_oracle_query QUERIES (prod_assoc prod_b(h,a))) : both _ _ ((t_HashMap (t_G) (t_G) (t_RandomState) × t_G)) in +Program Definition fiat_shamir_verify {L1 : {fset Location}} {I1 : Interface} (t : both L1 I1 ((t_G × t_G × t_Q × t_Q))) : both (L1) (I1) ('bool) := + letb QUERIES := (new_under_impl) : both _ _ (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState)) in + letb '(h,a,e,z) := (t) : both _ _ ((t_G × t_G × t_Q × t_Q)) in + letb '(QUERIES,eu) := (random_oracle_query QUERIES (prod_assoc (prod_b (h,a)))) : both _ _ ((t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState) × (t_G × t_G))) in verify h a e z. Fail Next Obligation. Notation t_Relation := ((t_G × t_Q)). Definition commit_loc : Location := - (t_G ; 8%nat). + ((t_G × t_G) ; 0%nat). Program Definition v_Commit {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (h : both L1 I1 (t_G)) (w : both L2 I2 (t_Q)) : both (L1:|:L2 :|: fset [commit_loc]) (I1:|:I2) (t_G) := - letb r := (sample_uniform) : both _ _ (t_G) in - letbm commit loc(commit_loc) := (r) : both _ _ (t_G) in - v_ONE. + letb r := (sample_uniform) : both _ _ ((t_G × t_G)) in + letbm commit loc(commit_loc) := (r) : both _ _ ((t_G × t_G)) in + Build_t_G i32(1). Fail Next Obligation. -Program Definition v_Response {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (h : both L1 I1 (t_G)) (w : both L2 I2 (t_Q)) (a : both L3 I3 (t_G)) (e : both L4 I4 (t_Q)) : both (L1:|:L2:|:L3:|:L4) (I1:|:I2:|:I3:|:I4) (t_G) := - v_ONE. +Program Definition v_Response {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (h : both L1 I1 (t_G)) (w : both L2 I2 (t_Q)) (a : both L3 I3 (t_G)) (e : both L4 I4 (t_Q)) : both (L1:|:L2:|:L3:|:L4) (I1:|:I2:|:I3:|:I4) (t_Q) := + Build_t_Q i32(1). Fail Next Obligation. -Program Definition fiat_shamir_run {L1 : {fset Location}} {I1 : Interface} (hw : both L1 I1 ((t_G × t_Q))) : both (L1 :|: fset [commit_loc]) (I1) ((t_G × t_G × t_Q × t_G)) := - letb QUERIES := (new_under_impl) : both _ _ (t_HashMap (t_G) (t_G) (t_RandomState)) in +Program Definition fiat_shamir_run {L1 : {fset Location}} {I1 : Interface} (hw : both L1 I1 ((t_G × t_Q))) : both (L1 :|: fset [commit_loc]) (I1) ((t_G × t_G × t_Q × t_Q)) := + letb QUERIES := (new_under_impl) : both _ _ (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState)) in letb '(h,w) := (hw) : both _ _ ((t_G × t_Q)) in letb a := (v_Commit h w) : both _ _ (t_G) in - letb 'tt := (random_oracle_init tt) : both _ _ (unit) in - letb _ := (tt) : both _ _ (unit) in - letb '(QUERIES,eu) := (random_oracle_query QUERIES (prod_assoc prod_b(h,a))) : both _ _ ((t_HashMap (t_G) (t_G) (t_RandomState) × t_G)) in - letb e := (v_ONE) : both _ _ (t_Q) in - letb z := (v_Response h w a e) : both _ _ (t_G) in - prod_b(h,a,e,z). + letb 'tt := (random_oracle_init (ret_both (tt : 'unit))) : both _ _ ('unit) in + letb _ := (ret_both (tt : 'unit)) : both _ _ ('unit) in + letb '(QUERIES,eu) := (random_oracle_query QUERIES (prod_assoc (prod_b (h,a)))) : both _ _ ((t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState) × (t_G × t_G))) in + letb e := (Build_t_Q i32(1)) : both _ _ (t_Q) in + letb z := (v_Response h w a e) : both _ _ (t_Q) in + prod_b (h,a,e,z). Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.glob b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.glob new file mode 100644 index 0000000..07c11be --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.glob @@ -0,0 +1,247 @@ +DIGEST ebf35470edb32d87446cf29c011d7916 +FExamples.Hacspec_ovn_Schnorr_Random_oracle +R126:136 Crypt.choice_type <> <> lib +R138:144 Crypt.Package <> <> lib +R146:152 Crypt.Prelude <> <> lib +R162:176 Crypt.package.pkg_notation PackageNotation <> mod +R211:213 extructures.ord <> <> lib +R215:218 extructures.fset <> <> lib +R250:253 mathcomp.zify.ssrZ <> <> lib +R255:258 mathcomp.word.word <> <> lib +R288:291 Jasmin.word <> <> lib +R319:324 Coq.ZArith.ZArith <> <> lib +R351:364 Coq.Strings.String <> <> lib +R377:394 Coq.Lists.List ListNotations <> mod +R492:505 Hacspec.ChoiceEquality <> <> lib +R536:550 Hacspec.LocationUtility <> <> lib +R581:602 Hacspec.Hacspec_Lib_Comparable <> <> lib +R633:647 Hacspec.Hacspec_Lib_Pre <> <> lib +R678:688 Hacspec.Hacspec_Lib <> <> lib +R725:745 mathcomp.ssreflect.choice Choice.Exports <> mod +R833:843 Examples.Hacspec_lib <> <> lib +def 866:883 <> random_oracle_init +R891:896 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R905:905 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R897:904 Crypt.package.pkg_core_definition <> Location def +binder 886:887 <> L1:1 +R914:922 Crypt.package.pkg_core_definition <> Interface def +binder 909:910 <> I1:2 +R930:933 Hacspec.ChoiceEquality <> both rec +R942:946 Crypt.package.pkg_notation PackageNotation ::package_scope:'''unit' not +R938:939 Examples.Hacspec_ovn_Schnorr_Random_oracle <> I1:2 var +R935:936 Examples.Hacspec_ovn_Schnorr_Random_oracle <> L1:1 var +R952:955 Hacspec.ChoiceEquality <> both rec +R968:972 Crypt.package.pkg_notation PackageNotation ::package_scope:'''unit' not +R963:964 Examples.Hacspec_ovn_Schnorr_Random_oracle <> I1:2 var +R958:959 Examples.Hacspec_ovn_Schnorr_Random_oracle <> L1:1 var +R980:987 Hacspec.ChoiceEquality <> ret_both def +R995:999 Crypt.package.pkg_notation PackageNotation ::package_scope:'''unit' not +R990:991 Coq.Init.Datatypes <> tt constr +def 1037:1039 <> t_G +R1043:1053 Crypt.choice_type <> choice_type ind +R1061:1065 Hacspec.Hacspec_Lib_Pre <> int32 syndef +def 1079:1087 <> Build_t_G +R1094:1099 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R1108:1108 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R1100:1107 Crypt.package.pkg_core_definition <> Location def +binder 1090:1090 <> L:3 +R1116:1124 Crypt.package.pkg_core_definition <> Interface def +binder 1112:1112 <> I:4 +R1134:1137 Hacspec.ChoiceEquality <> both rec +R1144:1148 Hacspec.Hacspec_Lib_Pre <> int32 syndef +R1141:1141 Examples.Hacspec_ovn_Schnorr_Random_oracle <> I:4 var +R1139:1139 Examples.Hacspec_ovn_Schnorr_Random_oracle <> L:3 var +binder 1128:1130 <> f_v:5 +R1154:1157 Hacspec.ChoiceEquality <> both rec +R1164:1166 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R1174:1182 Examples.Hacspec_ovn_Schnorr_Random_oracle <> Build_t_G:8 def +R1184:1186 Examples.Hacspec_ovn_Schnorr_Random_oracle <> f_v:7 var +R1256:1259 Hacspec.ChoiceEquality <> both rec +R1266:1268 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R1196:1204 Hacspec.ChoiceEquality <> bind_both def +binder 1215:1217 <> f_v:9 +R1228:1235 Hacspec.ChoiceEquality <> ret_both def +R1247:1249 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R1239:1241 Examples.Hacspec_ovn_Schnorr_Random_oracle <> f_v:9 var +def 1306:1308 <> t_Q +R1312:1322 Crypt.choice_type <> choice_type ind +R1330:1334 Hacspec.Hacspec_Lib_Pre <> int32 syndef +def 1348:1356 <> Build_t_Q +R1363:1368 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R1377:1377 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R1369:1376 Crypt.package.pkg_core_definition <> Location def +binder 1359:1359 <> L:10 +R1385:1393 Crypt.package.pkg_core_definition <> Interface def +binder 1381:1381 <> I:11 +R1403:1406 Hacspec.ChoiceEquality <> both rec +R1413:1417 Hacspec.Hacspec_Lib_Pre <> int32 syndef +R1410:1410 Examples.Hacspec_ovn_Schnorr_Random_oracle <> I:11 var +R1408:1408 Examples.Hacspec_ovn_Schnorr_Random_oracle <> L:10 var +binder 1397:1399 <> f_v:12 +R1423:1426 Hacspec.ChoiceEquality <> both rec +R1433:1435 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def +R1443:1451 Examples.Hacspec_ovn_Schnorr_Random_oracle <> Build_t_Q:15 def +R1453:1455 Examples.Hacspec_ovn_Schnorr_Random_oracle <> f_v:14 var +R1525:1528 Hacspec.ChoiceEquality <> both rec +R1535:1537 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def +R1465:1473 Hacspec.ChoiceEquality <> bind_both def +binder 1484:1486 <> f_v:16 +R1497:1504 Hacspec.ChoiceEquality <> ret_both def +R1516:1518 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def +R1508:1510 Examples.Hacspec_ovn_Schnorr_Random_oracle <> f_v:16 var +syndef 1573:1581 <> t_Witness +R1587:1589 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def +syndef 1603:1613 <> t_Statement +R1619:1621 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +syndef 1635:1643 <> t_Message +R1649:1651 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +syndef 1665:1675 <> t_Challenge +R1681:1683 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def +syndef 1697:1706 <> t_Response +R1712:1714 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def +syndef 1728:1735 <> t_Random +R1745:1748 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R1742:1744 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R1749:1751 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +syndef 1766:1772 <> t_Query +R1778:1780 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def +def 1804:1817 <> sample_uniform +R1821:1824 Hacspec.ChoiceEquality <> both rec +R1856:1859 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R1853:1855 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R1860:1862 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R1837:1848 Crypt.package.pkg_notation PackageNotation ::package_scope:'['_'interface'_']' not +R1827:1830 extructures.fset <> fset def +R1832:1833 Coq.Lists.List ListNotations ::list_scope:'['_']' not +R1871:1878 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b'_'('_x_','_x_','_'..'_','_x_')' not +R1895:1895 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b'_'('_x_','_x_','_'..'_','_x_')' not +R1912:1912 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b'_'('_x_','_x_','_'..'_','_x_')' not +R1879:1887 Examples.Hacspec_ovn_Schnorr_Random_oracle <> Build_t_G def +R1889:1892 Examples.Hacspec_lib <> :::'i32('_x_')' not +R1894:1894 Examples.Hacspec_lib <> :::'i32('_x_')' not +R1896:1904 Examples.Hacspec_ovn_Schnorr_Random_oracle <> Build_t_G def +R1906:1909 Examples.Hacspec_lib <> :::'i32('_x_')' not +R1911:1911 Examples.Hacspec_lib <> :::'i32('_x_')' not +R1953:1955 Examples.Std <> <> lib +def 1995:2013 <> random_oracle_query +R2021:2026 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R2035:2035 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R2027:2034 Crypt.package.pkg_core_definition <> Location def +binder 2016:2017 <> L1:17 +R2044:2049 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R2058:2058 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R2050:2057 Crypt.package.pkg_core_definition <> Location def +binder 2039:2040 <> L2:18 +R2067:2075 Crypt.package.pkg_core_definition <> Interface def +binder 2062:2063 <> I1:19 +R2084:2092 Crypt.package.pkg_core_definition <> Interface def +binder 2079:2080 <> I2:20 +R2106:2109 Hacspec.ChoiceEquality <> both rec +R2118:2126 Examples.Std <> t_HashMap def +R2129:2131 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def +R2139:2142 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R2136:2138 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R2143:2145 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R2150:2162 Examples.Std <> t_RandomState constr +R2114:2115 Examples.Hacspec_ovn_Schnorr_Random_oracle <> I1:19 var +R2111:2112 Examples.Hacspec_ovn_Schnorr_Random_oracle <> L1:17 var +binder 2096:2102 <> QUERIES:21 +R2172:2175 Hacspec.ChoiceEquality <> both rec +R2184:2186 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def +R2180:2181 Examples.Hacspec_ovn_Schnorr_Random_oracle <> I2:20 var +R2177:2178 Examples.Hacspec_ovn_Schnorr_Random_oracle <> L2:18 var +binder 2168:2168 <> q:22 +R2192:2195 Hacspec.ChoiceEquality <> both rec +R2265:2269 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R2280:2280 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R2219:2227 Examples.Std <> t_HashMap def +R2230:2232 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def +R2240:2243 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R2237:2239 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R2244:2246 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R2251:2263 Examples.Std <> t_RandomState constr +R2273:2276 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R2270:2272 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R2277:2279 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R2210:2212 extructures.fset <> ::fset_scope:x_':|:'_x not +R2208:2209 Examples.Hacspec_ovn_Schnorr_Random_oracle <> I1:19 var +R2213:2214 Examples.Hacspec_ovn_Schnorr_Random_oracle <> I2:20 var +R2200:2202 extructures.fset <> ::fset_scope:x_':|:'_x not +R2198:2199 Examples.Hacspec_ovn_Schnorr_Random_oracle <> L1:17 var +R2203:2204 Examples.Hacspec_ovn_Schnorr_Random_oracle <> L2:18 var +R2289:2295 Hacspec.Hacspec_Lib <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'Option_None'_'=>'_x_'end' not +R2309:2330 Hacspec.Hacspec_Lib <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'Option_None'_'=>'_x_'end' not +R2332:2335 Hacspec.Hacspec_Lib <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'Option_None'_'=>'_x_'end' not +R2366:2386 Hacspec.Hacspec_Lib <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'Option_None'_'=>'_x_'end' not +R2790:2793 Hacspec.Hacspec_Lib <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'Option_None'_'=>'_x_'end' not +R2296:2298 Examples.Std <> get prfax +R2308:2308 Examples.Hacspec_ovn_Schnorr_Random_oracle <> q:22 var +R2300:2306 Examples.Hacspec_ovn_Schnorr_Random_oracle <> QUERIES:21 var +binder 2331:2331 <> r:23 +R2336:2343 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b'_'('_x_','_x_','_'..'_','_x_')' not +R2357:2357 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b'_'('_x_','_x_','_'..'_','_x_')' not +R2365:2365 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b'_'('_x_','_x_','_'..'_','_x_')' not +R2344:2348 Examples.Core <> clone syndef +R2350:2356 Examples.Hacspec_ovn_Schnorr_Random_oracle <> QUERIES:21 var +R2358:2362 Examples.Core <> clone syndef +R2364:2364 Examples.Hacspec_ovn_Schnorr_Random_oracle <> r:23 var +R2387:2391 Hacspec.ChoiceEquality <> :::'letb'_x_':='_x_'in'_x not +R2393:2396 Hacspec.ChoiceEquality <> :::'letb'_x_':='_x_'in'_x not +R2439:2446 Hacspec.ChoiceEquality <> :::'letb'_x_':='_x_'in'_x not +R2416:2419 Hacspec.ChoiceEquality <> both rec +R2430:2433 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R2427:2429 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R2434:2436 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R2398:2411 Examples.Hacspec_ovn_Schnorr_Random_oracle <> sample_uniform def +binder 2392:2392 <> r:24 +binder 2392:2392 <> r:25 +R2447:2453 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R2468:2468 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R2481:2485 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R2595:2602 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not +R2509:2512 Hacspec.ChoiceEquality <> both rec +R2543:2546 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R2520:2527 Examples.Core <> t_Option def +R2534:2537 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R2531:2533 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R2538:2540 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R2547:2555 Examples.Std <> t_HashMap def +R2558:2560 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def +R2568:2571 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R2565:2567 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R2572:2574 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R2579:2591 Examples.Std <> t_RandomState constr +R2487:2492 Examples.Std <> insert prfax +R2504:2504 Examples.Hacspec_ovn_Schnorr_Random_oracle <> r:24 var +R2502:2502 Examples.Hacspec_ovn_Schnorr_Random_oracle <> q:22 var +R2494:2500 Examples.Hacspec_ovn_Schnorr_Random_oracle <> QUERIES:21 var +binder 2454:2467 <> todo_fresh_var:26 +binder 2469:2480 <> QUERIES_temp:27 +R2603:2607 Hacspec.ChoiceEquality <> :::'letb'_x_':='_x_'in'_x not +R2615:2618 Hacspec.ChoiceEquality <> :::'letb'_x_':='_x_'in'_x not +R2693:2700 Hacspec.ChoiceEquality <> :::'letb'_x_':='_x_'in'_x not +R2636:2639 Hacspec.ChoiceEquality <> both rec +R2646:2654 Examples.Std <> t_HashMap def +R2657:2659 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def +R2667:2670 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R2664:2666 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R2671:2673 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R2678:2690 Examples.Std <> t_RandomState constr +R2620:2631 Examples.Hacspec_ovn_Schnorr_Random_oracle <> QUERIES_temp:27 var +binder 2608:2614 <> QUERIES:28 +binder 2608:2614 <> QUERIES:29 +R2701:2705 Hacspec.ChoiceEquality <> :::'letb'_x_':='_x_'in'_x not +R2707:2710 Hacspec.ChoiceEquality <> :::'letb'_x_':='_x_'in'_x not +R2764:2771 Hacspec.ChoiceEquality <> :::'letb'_x_':='_x_'in'_x not +R2730:2733 Hacspec.ChoiceEquality <> both rec +R2740:2747 Examples.Core <> t_Option def +R2754:2757 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R2751:2753 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R2758:2760 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def +R2712:2725 Examples.Hacspec_ovn_Schnorr_Random_oracle <> todo_fresh_var:26 var +binder 2706:2706 <> pat:30 +R2772:2779 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b'_'('_x_','_x_','_'..'_','_x_')' not +R2787:2787 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b'_'('_x_','_x_','_'..'_','_x_')' not +R2789:2789 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b'_'('_x_','_x_','_'..'_','_x_')' not +R2780:2786 Examples.Hacspec_ovn_Schnorr_Random_oracle <> QUERIES:28 var +R2788:2788 Examples.Hacspec_ovn_Schnorr_Random_oracle <> r:24 var diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v new file mode 100644 index 0000000..9f74708 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v @@ -0,0 +1,78 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. + Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_lib. + +Program Definition random_oracle_init {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both (L1) (I1) ('unit) := + ret_both (tt : 'unit). +Fail Next Obligation. + +Definition t_G : choice_type := + (int32). +Equations Build_t_G {L : {fset Location}} {I : Interface} (f_v : both L I (int32)) : both L I (t_G) := + Build_t_G f_v := + bind_both f_v (fun f_v => + ret_both ((f_v) : (t_G))) : both L I (t_G). +Fail Next Obligation. + +Definition t_Q : choice_type := + (int32). +Equations Build_t_Q {L : {fset Location}} {I : Interface} (f_v : both L I (int32)) : both L I (t_Q) := + Build_t_Q f_v := + bind_both f_v (fun f_v => + ret_both ((f_v) : (t_Q))) : both L I (t_Q). +Fail Next Obligation. + +Notation t_Witness := (t_Q). + +Notation t_Statement := (t_G). + +Notation t_Message := (t_G). + +Notation t_Challenge := (t_Q). + +Notation t_Response := (t_Q). + +Notation t_Random := ((t_G × t_G)). + +Notation t_Query := (t_Q). + +Program Definition sample_uniform : both (fset []) ([interface ]) ((t_G × t_G)) := + prod_b (Build_t_G i32(1),Build_t_G i32(1)). +Fail Next Obligation. + +Require Import Std. (* as HashMap *) + +Program Definition random_oracle_query {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (QUERIES : both L1 I1 (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState))) (q : both L2 I2 (t_Q)) : both (L1:|:L2) (I1:|:I2) ((t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState) × (t_G × t_G))) := + match get_under_impl_2 QUERIES q with + | Option_Some r => prod_b (clone QUERIES,clone r) + | Option_None => letb r := (sample_uniform) : both _ _ ((t_G × t_G)) in + letb '(todo_fresh_var,QUERIES_temp) := (insert_under_impl_2 QUERIES q r) : both _ _ ((t_Option ((t_G × t_G)) × t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState))) in + letb QUERIES := (QUERIES_temp) : both _ _ (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState)) in + letb _ := (todo_fresh_var) : both _ _ (t_Option ((t_G × t_G))) in + prod_b (QUERIES,r) + end. +Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.vo b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.vo new file mode 100644 index 0000000000000000000000000000000000000000..7804990fce33771a8bc3c0e93aea26eb6fbab85f GIT binary patch literal 268530 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 X5!Pv1nQz!{m&qQ;X9lpLCgT4CoZ23g literal 0 HcmV?d00001 diff --git a/ovn/src/Schnorr.rs b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.vok similarity index 100% rename from ovn/src/Schnorr.rs rename to ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.vok diff --git a/ovn/src/random_oracle.rs b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.vos similarity index 100% rename from ovn/src/random_oracle.rs rename to ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.vos diff --git a/ovn/proofs/ssprove/extraction/Makefile.conf b/ovn/proofs/ssprove/extraction/Makefile.conf index a49bc34..d64abfe 100644 --- a/ovn/proofs/ssprove/extraction/Makefile.conf +++ b/ovn/proofs/ssprove/extraction/Makefile.conf @@ -8,7 +8,7 @@ # # ############################################################################### -COQMF_VFILES = Hacspec_lib.v Core.v Hacspec_ovn.v +COQMF_VFILES = Hacspec_lib.v Core.v Std.v Hacspec_ovn_Schnorr_Random_oracle.v Hacspec_ovn_Schnorr.v Hacspec_ovn.v COQMF_MLIFILES = COQMF_MLFILES = COQMF_MLGFILES = diff --git a/ovn/proofs/ssprove/extraction/Std.glob b/ovn/proofs/ssprove/extraction/Std.glob new file mode 100644 index 0000000..c414e40 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Std.glob @@ -0,0 +1,113 @@ +DIGEST da4b43ceb41a55c830a2111ff36e5a15 +FExamples.Std +R74:84 Hacspec.Hacspec_Lib <> <> lib +R112:117 Coq.ZArith.ZArith <> <> lib +R127:144 Coq.Lists.List ListNotations <> mod +R206:208 Coq.micromega.Lia <> <> lib +R226:259 Coq.Logic.FunctionalExtensionality <> <> lib +R277:283 Coq.Bool.Sumbool <> <> lib +R316:322 mathcomp.ssreflect.fintype <> <> lib +R352:362 Crypt.choice_type <> <> lib +R364:370 Crypt.Package <> <> lib +R372:378 Crypt.Prelude <> <> lib +R388:402 Crypt.package.pkg_notation PackageNotation <> mod +R437:439 extructures.ord <> <> lib +R441:444 extructures.fset <> <> lib +R446:449 extructures.fmap <> <> lib +R482:485 mathcomp.zify.ssrZ <> <> lib +R487:490 mathcomp.word.word <> <> lib +R520:523 Jasmin.word <> <> lib +R551:556 Coq.ZArith.ZArith <> <> lib +R558:561 Coq.Lists.List <> <> lib +R571:583 Coq.Lists.List ListNotations <> mod +R615:628 Hacspec.ChoiceEquality <> <> lib +R659:673 Hacspec.LocationUtility <> <> lib +R704:725 Hacspec.Hacspec_Lib_Comparable <> <> lib +R756:770 Hacspec.Hacspec_Lib_Pre <> <> lib +R801:811 Hacspec.Hacspec_Lib <> <> lib +R970:990 mathcomp.ssreflect.choice Choice.Exports <> mod +R1009:1012 Examples.Core <> <> lib +R1022:1025 Examples.Core <> <> mod +ind 1039:1050 <> random_state +constr 1057:1069 <> t_RandomState +def 1083:1091 <> t_HashMap +binder 1093:1093 <> A:3 +binder 1095:1095 <> B:4 +R1102:1113 Examples.Std <> random_state ind +R1119:1123 Crypt.choice_type <> chMap constr +R1125:1125 Examples.Std <> A:3 var +R1127:1127 Examples.Std <> B:4 var +ax 1137:1142 <> insert +binder 1154:1155 <> L1:5 +binder 1157:1158 <> L2:6 +binder 1160:1161 <> L3:7 +binder 1163:1164 <> I1:8 +binder 1166:1167 <> I2:9 +binder 1169:1170 <> I3:10 +binder 1172:1172 <> A:11 +binder 1174:1174 <> B:12 +R1218:1221 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1178:1181 Hacspec.ChoiceEquality <> both rec +R1190:1198 Examples.Std <> t_HashMap def +R1200:1200 Examples.Std <> A:11 var +R1202:1202 Examples.Std <> B:12 var +R1204:1216 Examples.Std <> t_RandomState constr +R1186:1187 Examples.Std <> I1:8 var +R1183:1184 Examples.Std <> L1:5 var +R1234:1237 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1222:1225 Hacspec.ChoiceEquality <> both rec +R1233:1233 Examples.Std <> A:11 var +R1230:1231 Examples.Std <> I2:9 var +R1227:1228 Examples.Std <> L2:6 var +R1250:1253 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1238:1241 Hacspec.ChoiceEquality <> both rec +R1249:1249 Examples.Std <> B:12 var +R1246:1247 Examples.Std <> I3:10 var +R1243:1244 Examples.Std <> L3:7 var +R1254:1257 Hacspec.ChoiceEquality <> both rec +R1308:1311 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not +R1298:1305 Examples.Core <> t_Option def +R1307:1307 Examples.Std <> B:12 var +R1312:1320 Examples.Std <> t_HashMap def +R1322:1322 Examples.Std <> A:11 var +R1324:1324 Examples.Std <> B:12 var +R1326:1338 Examples.Std <> t_RandomState constr +R1288:1292 extructures.fset <> ::fset_scope:x_':|:'_x not +R1281:1285 extructures.fset <> ::fset_scope:x_':|:'_x not +R1279:1280 Examples.Std <> I1:8 var +R1286:1287 Examples.Std <> I2:9 var +R1293:1294 Examples.Std <> I3:10 var +R1269:1273 extructures.fset <> ::fset_scope:x_':|:'_x not +R1262:1266 extructures.fset <> ::fset_scope:x_':|:'_x not +R1260:1261 Examples.Std <> L1:5 var +R1267:1268 Examples.Std <> L2:6 var +R1274:1275 Examples.Std <> L3:7 var +ax 1348:1350 <> get +binder 1363:1364 <> L1:14 +binder 1366:1367 <> L2:15 +binder 1369:1370 <> I1:16 +binder 1372:1373 <> I2:17 +binder 1375:1375 <> A:18 +binder 1377:1377 <> B:19 +R1421:1424 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1381:1384 Hacspec.ChoiceEquality <> both rec +R1393:1401 Examples.Std <> t_HashMap def +R1403:1403 Examples.Std <> A:18 var +R1405:1405 Examples.Std <> B:19 var +R1407:1419 Examples.Std <> t_RandomState constr +R1389:1390 Examples.Std <> I1:16 var +R1386:1387 Examples.Std <> L1:14 var +R1437:1440 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1425:1428 Hacspec.ChoiceEquality <> both rec +R1436:1436 Examples.Std <> A:18 var +R1433:1434 Examples.Std <> I2:17 var +R1430:1431 Examples.Std <> L2:15 var +R1441:1444 Hacspec.ChoiceEquality <> both rec +R1471:1478 Examples.Core <> t_Option def +R1480:1480 Examples.Std <> B:19 var +R1461:1465 extructures.fset <> ::fset_scope:x_':|:'_x not +R1459:1460 Examples.Std <> I1:16 var +R1466:1467 Examples.Std <> I2:17 var +R1449:1453 extructures.fset <> ::fset_scope:x_':|:'_x not +R1447:1448 Examples.Std <> L1:14 var +R1454:1455 Examples.Std <> L2:15 var diff --git a/ovn/proofs/ssprove/extraction/Std.v b/ovn/proofs/ssprove/extraction/Std.v new file mode 100644 index 0000000..ac7f4e2 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Std.v @@ -0,0 +1,50 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib. + +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +Require Import Lia. +Require Import Coq.Logic.FunctionalExtensionality. +Require Import Sumbool. + +From mathcomp Require Import fintype. + +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset fmap. + +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith List. +Import ListNotations. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Declare Scope hacspec_scope. + +Open Scope list_scope. +Open Scope hacspec_scope. +Open Scope nat_scope. + +(* Require Import Hacspec_Lib_Comparable. *) + +Import choice.Choice.Exports. + +Require Import Core. +Export Core. + +Inductive random_state := + t_RandomState. +Definition t_HashMap A B (_ : random_state) := chMap A B. + +Axiom insert : forall {L1 L2 L3 I1 I2 I3 A B}, both L1 I1 (t_HashMap A B t_RandomState) -> both L2 I2 A -> both L3 I3 B -> both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_Option B × t_HashMap A B t_RandomState). +Axiom get : forall {L1 L2 I1 I2 A B}, both L1 I1 (t_HashMap A B t_RandomState) -> both L2 I2 A -> both (L1 :|: L2) (I1 :|: I2) (t_Option B). + diff --git a/ovn/proofs/ssprove/extraction/Std.vo b/ovn/proofs/ssprove/extraction/Std.vo new file mode 100644 index 0000000000000000000000000000000000000000..a59878b2a8a0ff0595d3885ec1bb68068c3875f7 GIT binary patch literal 50252 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 YTB7ZSXR0aOe2)}9FiN<9{)qwqABuZEJpcdz literal 0 HcmV?d00001 diff --git a/ovn/proofs/ssprove/extraction/Std.vok b/ovn/proofs/ssprove/extraction/Std.vok new file mode 100644 index 0000000..e69de29 diff --git a/ovn/proofs/ssprove/extraction/Std.vos b/ovn/proofs/ssprove/extraction/Std.vos new file mode 100644 index 0000000..e69de29 diff --git a/ovn/proofs/ssprove/extraction/_CoqProject b/ovn/proofs/ssprove/extraction/_CoqProject index 1a474b8..f7496fc 100644 --- a/ovn/proofs/ssprove/extraction/_CoqProject +++ b/ovn/proofs/ssprove/extraction/_CoqProject @@ -4,4 +4,7 @@ Hacspec_lib.v Core.v +Std.v +Hacspec_ovn_Schnorr_Random_oracle.v +Hacspec_ovn_Schnorr.v Hacspec_ovn.v diff --git a/ovn/src/ovn.rs b/ovn/src/ovn.rs index d47b836..f73e73d 100644 --- a/ovn/src/ovn.rs +++ b/ovn/src/ovn.rs @@ -1,8 +1,7 @@ use hacspec_lib::*; mod schnorr; - -use schnorr::{random_oracle::sample_uniform, *}; +use schnorr::*; // (Exec_i i j m) ∘ (par ((P_i i b) ∘ (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) @@ -46,19 +45,23 @@ use schnorr::{random_oracle::sample_uniform, *}; // } // ]. -type public = schnorr::random_oracle::Q; -type public_key = (public, schnorr::Transcript); +type Secret = schnorr::random_oracle::Q; // Zp_finComRingType (Zp_trunc #[g]); +pub fn sample_uniform () -> Secret { + schnorr::random_oracle::Q{v: 1} // Secret::ONE() +} + +type public = schnorr::random_oracle::G; +type public_key = (public, schnorr::Transcript); // (public, (schnorr::random_oracle::Message , schnorr::random_oracle::Challenge , schnorr::random_oracle::Response)) fn p_i_init(_: ()) -> public_key { // #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; // #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; // x ← sample uniform i_secret ;; - let x = schnorr::random_oracle::sample_uniform(); + let x = sample_uniform(); // #put (skey_loc i) := x ;; // let y := (fto (g ^+ (otf x))) : public in - let y = public::ONE(); + let y = schnorr::random_oracle::G{v: 1}; // public::ONE(); // zkp ← ZKP (y, x) ;; - let zkp = schnorr::fiat_shamir_run((x, y)); // should be (y, x) - // ret (y, zkp) + let zkp = schnorr::fiat_shamir_run((y, x)); (y, zkp) } @@ -98,7 +101,7 @@ fn p_i_vote(v: bool) -> public { // else // let vote := (otf ckey ^+ skey * g ^+ (negb v)) in // @ret 'public (fto vote) - public::ONE() + schnorr::random_oracle::G{v: 1} // public::ONE() } // Exec_i @@ -127,11 +130,11 @@ fn exec(v : bool) -> public { // #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; // pk ← Init Datatypes.tt ;; // x ← sample uniform i_secret ;; - let x = random_oracle::sample_uniform(); + let x = sample_uniform(); // let y := (fto (g ^+ (otf x))) : public in - let y = public::ONE(); + let y = schnorr::random_oracle::G{v: 1}; // public::ONE(); // zkp ← ZKP (y, x) ;; - let zkp = schnorr::fiat_shamir_run((x, y)); + let zkp = schnorr::fiat_shamir_run((y, x)); // let m' := setm (setm m j (y, zkp)) i pk in // Construct m' ;; // vote ← Vote v ;; diff --git a/ovn/src/schnorr.rs b/ovn/src/schnorr.rs index ba8ab73..95dc63c 100644 --- a/ovn/src/schnorr.rs +++ b/ovn/src/schnorr.rs @@ -2,13 +2,7 @@ use hacspec_lib::*; use std::collections::HashMap; pub mod random_oracle; -// use random_oracle::*; - -pub type Witness = random_oracle::Q; -pub type Statement = random_oracle::G; -pub type Message = random_oracle::G; -pub type Challenge = random_oracle::Q; -pub type Response = random_oracle::G; +use random_oracle::*; // type Transcript = (Message, Challenge, Response); // Sigma1.Sigma.RUN and Sigma1.Sigma.VERIFY: (Schnorr, RO (RandomOracle) OracleParams) @@ -47,13 +41,14 @@ pub type Response = random_oracle::G; pub type Transcript = (Statement , Message , Challenge , Response); -fn prod_assoc ((statement, message) : (Statement, Message)) -> random_oracle::Query { +fn prod_assoc (sm : (Statement, Message)) -> random_oracle::Query { + let (statement, message) = sm; // Proof. // cbn. intros [statement message]. // rewrite !card_prod. // apply mxvec_index. all: assumption. // Qed. - random_oracle::Query::ONE() + random_oracle::Q{v: 1} // random_oracle::Query::ONE() } // Verify_schamir @@ -80,14 +75,14 @@ fn Commit (h : Statement, w : Witness) -> Message { // #put commit_loc := r ;; let mut commit = r; // ret (fto (g ^+ (otf r))) - Message::ONE() + G{v: 1} // Message::ONE() } fn Response (h : Statement, w : Witness, a : Message, e : Challenge) -> Response { // r ← get commit_loc ;; // ret (fto (otf r + otf e * otf w)) - Response::ONE() + Q{v: 1} // Response::ONE() } pub fn fiat_shamir_run(hw : Relation) -> Transcript { @@ -97,13 +92,9 @@ pub fn fiat_shamir_run(hw : Relation) -> Transcript { let (h,w) = hw; // #assert (R (otf h) (otf w)) ;; let a = Commit(h, w); - // RO_init Datatypes.tt ;; random_oracle::random_oracle_init(()); - // e ← RO_query (prod_assoc (h, a)) ;; let (QUERIES, eu) = random_oracle::random_oracle_query(QUERIES, prod_assoc((h, a))); - let e = Challenge::ONE(); // Should be e <- eu - // z ← Response h w a e ;; + let e = Q{v: 1}; // Challenge::ONE(); // Should be e <- eu let z = Response (h, w, a, e); - // @ret choiceTranscript (h,a,e,z) (h,a,e,z) } diff --git a/ovn/src/schnorr/random_oracle.rs b/ovn/src/schnorr/random_oracle.rs index dcbfa62..8481733 100644 --- a/ovn/src/schnorr/random_oracle.rs +++ b/ovn/src/schnorr/random_oracle.rs @@ -26,36 +26,50 @@ pub fn random_oracle_init(_ : ()) -> () { () } -public_nat_mod!( //Custom Macro - defining a newtype with some functions - well defined macro's have library functions built in - type_name: G, - type_of_canvas: GCanvas, - bit_size_of_field: 384, //381 with 3 extra bits - modulo_value: "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" //0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab -); +#[derive(PartialEq, Eq, Clone, Copy)] +pub struct G{ + pub v : u32 +} +// public_nat_mod!( //Custom Macro - defining a newtype with some functions - well defined macro's have library functions built in +// type_name: G, +// type_of_canvas: GCanvas, +// bit_size_of_field: 384, //381 with 3 extra bits +// modulo_value: "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" //0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab +// ); + +#[derive(PartialEq, Eq, Clone, Copy, Hash)] +pub struct Q { + pub v : u32 +} +// // Order of G +// public_nat_mod!( //Custom Macro - defining a newtype with some functions - well defined macro's have library functions built in +// type_name: Q, +// type_of_canvas: QCanvas, +// bit_size_of_field: 384, //381 with 3 extra bits +// modulo_value: "2566" // TODO Order of group G! +// ); -// Order of G -public_nat_mod!( //Custom Macro - defining a newtype with some functions - well defined macro's have library functions built in - type_name: Q, - type_of_canvas: QCanvas, - bit_size_of_field: 384, //381 with 3 extra bits - modulo_value: "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" //0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab -); +pub type Witness = Q; +pub type Statement = G; +pub type Message = G; +pub type Challenge = Q; +pub type Response = Q; -pub type Random = G; -pub type Query = G; +pub type Random = (Statement, Message); +pub type Query = Challenge; pub fn sample_uniform () -> Random { - Random::ONE() + (G{v: 1}, G{v: 1})// (Statement::ONE(), Message::ONE()) } use std::collections::HashMap; -use std::hash::{Hash, Hasher}; -impl Hash for Query { - fn hash (&self, state: &mut H) { +// use std::hash::{Hash, Hasher}; +// impl Hash for Query { +// fn hash (&self, state: &mut H) { - } -} +// } +// } // static ref QUERIES : HashMap = HashMap::new(); // chQuery := 'fin #|Query| From 2c850ed93224be5cc47bbc4d9e597176d8e619d6 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Thu, 27 Jul 2023 15:07:14 +0200 Subject: [PATCH 04/86] Initial semi-working ovn --- Cargo.toml | 46 +- ovn/proofs/ssprove/extraction/.Core.aux | 4 +- .../ssprove/extraction/.Hacspec_lib.aux | 8 +- .../ssprove/extraction/.Hacspec_ovn.aux | 3 +- .../extraction/.Hacspec_ovn_Schnorr.aux | 3 +- .../.Hacspec_ovn_Schnorr_Random_oracle.aux | 4 +- ovn/proofs/ssprove/extraction/.HashMap.aux | 2 + ovn/proofs/ssprove/extraction/.Makefile.d | 18 - ovn/proofs/ssprove/extraction/.Std.aux | 2 +- ovn/proofs/ssprove/extraction/Core.glob | 757 ------------------ ovn/proofs/ssprove/extraction/Core.v | 44 +- ovn/proofs/ssprove/extraction/Core.vo | Bin 172384 -> 0 bytes ovn/proofs/ssprove/extraction/Core.vok | 0 ovn/proofs/ssprove/extraction/Core.vos | 0 .../ssprove/extraction/Hacspec_lib.glob | 747 ----------------- ovn/proofs/ssprove/extraction/Hacspec_lib.v | 8 +- ovn/proofs/ssprove/extraction/Hacspec_lib.vo | Bin 123685 -> 0 bytes ovn/proofs/ssprove/extraction/Hacspec_lib.vok | 0 ovn/proofs/ssprove/extraction/Hacspec_lib.vos | 0 ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 49 +- .../extraction/Hacspec_ovn_Schnorr.glob | 31 - .../ssprove/extraction/Hacspec_ovn_Schnorr.v | 64 +- .../Hacspec_ovn_Schnorr_Random_oracle.glob | 247 ------ .../Hacspec_ovn_Schnorr_Random_oracle.v | 44 +- .../Hacspec_ovn_Schnorr_Random_oracle.vo | Bin 268530 -> 0 bytes .../Hacspec_ovn_Schnorr_Random_oracle.vok | 0 .../Hacspec_ovn_Schnorr_Random_oracle.vos | 0 .../ssprove/extraction/{Std.v => HashMap.v} | 2 + ovn/proofs/ssprove/extraction/Makefile.conf | 2 +- ovn/proofs/ssprove/extraction/Std.glob | 113 --- ovn/proofs/ssprove/extraction/Std.vo | Bin 50252 -> 0 bytes ovn/proofs/ssprove/extraction/Std.vok | 0 ovn/proofs/ssprove/extraction/Std.vos | 0 ovn/proofs/ssprove/extraction/_CoqProject | 2 +- ovn/src/schnorr/random_oracle.rs | 3 +- 35 files changed, 167 insertions(+), 2036 deletions(-) create mode 100644 ovn/proofs/ssprove/extraction/.HashMap.aux delete mode 100644 ovn/proofs/ssprove/extraction/.Makefile.d delete mode 100644 ovn/proofs/ssprove/extraction/Core.glob delete mode 100644 ovn/proofs/ssprove/extraction/Core.vo delete mode 100644 ovn/proofs/ssprove/extraction/Core.vok delete mode 100644 ovn/proofs/ssprove/extraction/Core.vos delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_lib.glob delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_lib.vo delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_lib.vok delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_lib.vos delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.glob delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.glob delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.vo delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.vok delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.vos rename ovn/proofs/ssprove/extraction/{Std.v => HashMap.v} (95%) delete mode 100644 ovn/proofs/ssprove/extraction/Std.glob delete mode 100644 ovn/proofs/ssprove/extraction/Std.vo delete mode 100644 ovn/proofs/ssprove/extraction/Std.vok delete mode 100644 ovn/proofs/ssprove/extraction/Std.vos diff --git a/Cargo.toml b/Cargo.toml index 867021f..bfafcd2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,27 +1,27 @@ [workspace] members = [ - "basic", - "curve25519", - "chacha20", - "poly1305", - "chacha20poly1305", - "gimli", - "sha256", - "sha3", - "hmac", - "hkdf", - "p256", - "bls12-381", - "ecdsa-p256-sha256", - "aes", - "aes_jazz", - "gf128", - "aes128-gcm", - "bls12-381-hash", - "edwards25519", - "ed25519", - "pasta", - "halo2", - "weierstrass-curves", + # "basic", + # "curve25519", + # "chacha20", + # "poly1305", + # "chacha20poly1305", + # "gimli", + # "sha256", + # "sha3", + # "hmac", + # "hkdf", + # "p256", + # "bls12-381", + # "ecdsa-p256-sha256", + # "aes", + # "aes_jazz", + # "gf128", + # "aes128-gcm", + # "bls12-381-hash", + # "edwards25519", + # "ed25519", + # "pasta", + # "halo2", + # "weierstrass-curves", "ovn", ] diff --git a/ovn/proofs/ssprove/extraction/.Core.aux b/ovn/proofs/ssprove/extraction/.Core.aux index 3ea5675..d48f156 100644 --- a/ovn/proofs/ssprove/extraction/.Core.aux +++ b/ovn/proofs/ssprove/extraction/.Core.aux @@ -1,2 +1,2 @@ -COQAUX1 1d70d72b4eae36876b570fe4cf0d5092 /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Core.v -0 0 vo_compile_time "1.845" +COQAUX1 6790c792e32a6045be2322b9eaf2b504 /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Core.v +0 0 vo_compile_time "2.665" diff --git a/ovn/proofs/ssprove/extraction/.Hacspec_lib.aux b/ovn/proofs/ssprove/extraction/.Hacspec_lib.aux index 2093e41..83ff308 100644 --- a/ovn/proofs/ssprove/extraction/.Hacspec_lib.aux +++ b/ovn/proofs/ssprove/extraction/.Hacspec_lib.aux @@ -1,5 +1,5 @@ -COQAUX1 e5f7624baf82764e7a994b8423d3c6dc /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Hacspec_lib.v +COQAUX1 014d8494ee07a77b223cddd03655e2fd /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Hacspec_lib.v 0 0 VernacProof "tac:no using:no" -13358 13366 proof_build_time "0.010" -13358 13366 proof_check_time "0.006" -0 0 vo_compile_time "1.201" +13228 13236 proof_build_time "0.009" +13228 13236 proof_check_time "0.007" +0 0 vo_compile_time "1.055" diff --git a/ovn/proofs/ssprove/extraction/.Hacspec_ovn.aux b/ovn/proofs/ssprove/extraction/.Hacspec_ovn.aux index 0050d43..fe3ef67 100644 --- a/ovn/proofs/ssprove/extraction/.Hacspec_ovn.aux +++ b/ovn/proofs/ssprove/extraction/.Hacspec_ovn.aux @@ -1 +1,2 @@ -COQAUX1 8595645d12a1833a4ac0bf542319bc07 /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +COQAUX1 2ab43b20a7808931e6961c7e28a31d30 /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +0 0 vo_compile_time "3.152" diff --git a/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr.aux b/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr.aux index 8736229..1c755c6 100644 --- a/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr.aux +++ b/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr.aux @@ -1 +1,2 @@ -COQAUX1 41711fa53f537116d9fcaa389f96befd /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v +COQAUX1 dfcdbe07a610db85932ecc770fb2795b /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v +0 0 vo_compile_time "10.855" diff --git a/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr_Random_oracle.aux b/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr_Random_oracle.aux index f25e6e2..3b04bf0 100644 --- a/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr_Random_oracle.aux +++ b/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr_Random_oracle.aux @@ -1,2 +1,2 @@ -COQAUX1 ebf35470edb32d87446cf29c011d7916 /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v -0 0 vo_compile_time "2.720" +COQAUX1 2e797f525541438f76d209d0776dcf2f /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v +0 0 vo_compile_time "10.662" diff --git a/ovn/proofs/ssprove/extraction/.HashMap.aux b/ovn/proofs/ssprove/extraction/.HashMap.aux new file mode 100644 index 0000000..3cd16d8 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/.HashMap.aux @@ -0,0 +1,2 @@ +COQAUX1 6f52e059b6e6f53cab8150523c26e076 /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/HashMap.v +0 0 vo_compile_time "0.910" diff --git a/ovn/proofs/ssprove/extraction/.Makefile.d b/ovn/proofs/ssprove/extraction/.Makefile.d deleted file mode 100644 index ccaf335..0000000 --- a/ovn/proofs/ssprove/extraction/.Makefile.d +++ /dev/null @@ -1,18 +0,0 @@ -Hacspec_lib.vo Hacspec_lib.glob Hacspec_lib.v.beautified Hacspec_lib.required_vo: Hacspec_lib.v -Hacspec_lib.vio: Hacspec_lib.v -Hacspec_lib.vos Hacspec_lib.vok Hacspec_lib.required_vos: Hacspec_lib.v -Core.vo Core.glob Core.v.beautified Core.required_vo: Core.v -Core.vio: Core.v -Core.vos Core.vok Core.required_vos: Core.v -Std.vo Std.glob Std.v.beautified Std.required_vo: Std.v Core.vo -Std.vio: Std.v Core.vio -Std.vos Std.vok Std.required_vos: Std.v Core.vos -Hacspec_ovn_Schnorr_Random_oracle.vo Hacspec_ovn_Schnorr_Random_oracle.glob Hacspec_ovn_Schnorr_Random_oracle.v.beautified Hacspec_ovn_Schnorr_Random_oracle.required_vo: Hacspec_ovn_Schnorr_Random_oracle.v Hacspec_lib.vo Std.vo -Hacspec_ovn_Schnorr_Random_oracle.vio: Hacspec_ovn_Schnorr_Random_oracle.v Hacspec_lib.vio Std.vio -Hacspec_ovn_Schnorr_Random_oracle.vos Hacspec_ovn_Schnorr_Random_oracle.vok Hacspec_ovn_Schnorr_Random_oracle.required_vos: Hacspec_ovn_Schnorr_Random_oracle.v Hacspec_lib.vos Std.vos -Hacspec_ovn_Schnorr.vo Hacspec_ovn_Schnorr.glob Hacspec_ovn_Schnorr.v.beautified Hacspec_ovn_Schnorr.required_vo: Hacspec_ovn_Schnorr.v Hacspec_lib.vo Std.vo Hacspec_ovn_Schnorr_Random_oracle.vo -Hacspec_ovn_Schnorr.vio: Hacspec_ovn_Schnorr.v Hacspec_lib.vio Std.vio Hacspec_ovn_Schnorr_Random_oracle.vio -Hacspec_ovn_Schnorr.vos Hacspec_ovn_Schnorr.vok Hacspec_ovn_Schnorr.required_vos: Hacspec_ovn_Schnorr.v Hacspec_lib.vos Std.vos Hacspec_ovn_Schnorr_Random_oracle.vos -Hacspec_ovn.vo Hacspec_ovn.glob Hacspec_ovn.v.beautified Hacspec_ovn.required_vo: Hacspec_ovn.v Hacspec_lib.vo Std.vo -Hacspec_ovn.vio: Hacspec_ovn.v Hacspec_lib.vio Std.vio -Hacspec_ovn.vos Hacspec_ovn.vok Hacspec_ovn.required_vos: Hacspec_ovn.v Hacspec_lib.vos Std.vos diff --git a/ovn/proofs/ssprove/extraction/.Std.aux b/ovn/proofs/ssprove/extraction/.Std.aux index 0c9eb85..02307f5 100644 --- a/ovn/proofs/ssprove/extraction/.Std.aux +++ b/ovn/proofs/ssprove/extraction/.Std.aux @@ -1,2 +1,2 @@ COQAUX1 da4b43ceb41a55c830a2111ff36e5a15 /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Std.v -0 0 vo_compile_time "0.994" +0 0 vo_compile_time "1.029" diff --git a/ovn/proofs/ssprove/extraction/Core.glob b/ovn/proofs/ssprove/extraction/Core.glob deleted file mode 100644 index 569349b..0000000 --- a/ovn/proofs/ssprove/extraction/Core.glob +++ /dev/null @@ -1,757 +0,0 @@ -DIGEST 1d70d72b4eae36876b570fe4cf0d5092 -FExamples.Core -R74:84 Hacspec.Hacspec_Lib <> <> lib -R112:117 Coq.ZArith.ZArith <> <> lib -R127:144 Coq.Lists.List ListNotations <> mod -R206:208 Coq.micromega.Lia <> <> lib -R226:259 Coq.Logic.FunctionalExtensionality <> <> lib -R277:283 Coq.Bool.Sumbool <> <> lib -R316:322 mathcomp.ssreflect.fintype <> <> lib -R352:362 Crypt.choice_type <> <> lib -R364:370 Crypt.Package <> <> lib -R372:378 Crypt.Prelude <> <> lib -R388:402 Crypt.package.pkg_notation PackageNotation <> mod -R437:439 extructures.ord <> <> lib -R441:444 extructures.fset <> <> lib -R446:449 extructures.fmap <> <> lib -R482:485 mathcomp.zify.ssrZ <> <> lib -R487:490 mathcomp.word.word <> <> lib -R520:523 Jasmin.word <> <> lib -R551:556 Coq.ZArith.ZArith <> <> lib -R558:561 Coq.Lists.List <> <> lib -R571:583 Coq.Lists.List ListNotations <> mod -R615:628 Hacspec.ChoiceEquality <> <> lib -R659:673 Hacspec.LocationUtility <> <> lib -R704:725 Hacspec.Hacspec_Lib_Comparable <> <> lib -R756:770 Hacspec.Hacspec_Lib_Pre <> <> lib -R801:811 Hacspec.Hacspec_Lib <> <> lib -R970:990 mathcomp.ssreflect.choice Choice.Exports <> mod -ind 1000:1008 <> t_TryFrom -constr 1031:1037 <> TryFrom -rec 1000:1008 <> t_TryFrom -proj 1031:1037 <> TryFrom -R1015:1025 Crypt.choice_type <> choice_type ind -binder 1011:1011 <> A:1 -R1042:1045 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R1041:1041 Examples.Core <> A:1 var -R1046:1046 Examples.Core <> A:1 var -ind 1055:1060 <> t_Into -constr 1083:1086 <> Into -rec 1055:1060 <> t_Into -proj 1083:1086 <> Into -R1067:1077 Crypt.choice_type <> choice_type ind -binder 1063:1063 <> A:4 -R1091:1094 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R1090:1090 Examples.Core <> A:4 var -R1095:1095 Examples.Core <> A:4 var -ind 1104:1114 <> t_PartialEq -constr 1137:1145 <> PartialEq -rec 1104:1114 <> t_PartialEq -proj 1137:1145 <> PartialEq -R1121:1131 Crypt.choice_type <> choice_type ind -binder 1117:1117 <> A:7 -R1150:1153 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R1149:1149 Examples.Core <> A:7 var -R1154:1154 Examples.Core <> A:7 var -ind 1163:1168 <> t_Copy -constr 1191:1194 <> Copy -rec 1163:1168 <> t_Copy -proj 1191:1194 <> Copy -R1175:1185 Crypt.choice_type <> choice_type ind -binder 1171:1171 <> A:10 -R1199:1202 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R1198:1198 Examples.Core <> A:10 var -R1203:1203 Examples.Core <> A:10 var -ind 1212:1218 <> t_Clone -constr 1241:1245 <> Clone -rec 1212:1218 <> t_Clone -proj 1241:1245 <> Clone -R1225:1235 Crypt.choice_type <> choice_type ind -binder 1221:1221 <> A:13 -R1250:1253 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R1249:1249 Examples.Core <> A:13 var -R1254:1254 Examples.Core <> A:13 var -ind 1263:1269 <> t_Sized -constr 1292:1296 <> Sized -rec 1263:1269 <> t_Sized -proj 1292:1296 <> Sized -R1276:1286 Crypt.choice_type <> choice_type ind -binder 1272:1272 <> A:16 -R1301:1304 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R1300:1300 Examples.Core <> A:16 var -R1305:1305 Examples.Core <> A:16 var -def 1319:1326 <> t_Option -R1341:1344 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R1330:1340 Crypt.choice_type <> choice_type ind -R1345:1355 Crypt.choice_type <> choice_type ind -R1360:1367 Crypt.choice_type <> chOption constr -ind 1380:1386 <> vec_typ -constr 1393:1400 <> t_Global -def 1414:1418 <> t_Vec -R1433:1436 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R1422:1432 Crypt.choice_type <> choice_type ind -R1444:1447 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R1437:1443 Examples.Core <> vec_typ ind -R1448:1458 Crypt.choice_type <> choice_type ind -binder 1467:1467 <> A:21 -R1474:1479 Crypt.choice_type <> chList constr -R1481:1481 Examples.Core <> A:21 var -rec 1491:1499 <> t_Default -proj 1508:1514 <> default -binder 1501:1501 <> A:22 -R1518:1518 Examples.Core <> A:22 var -inst 1543:1551 <> bool_copy -R1555:1560 Examples.Core <> t_Copy class -R1562:1566 Crypt.package.pkg_notation PackageNotation ::package_scope:'''bool' not -R1572:1575 Examples.Core <> Copy def -binder 1577:1577 <> x:25 -R1582:1582 Examples.Core <> x:25 var -inst 1605:1614 <> bool_clone -R1618:1624 Examples.Core <> t_Clone class -R1626:1630 Crypt.package.pkg_notation PackageNotation ::package_scope:'''bool' not -R1636:1640 Examples.Core <> Clone def -binder 1642:1642 <> x:26 -R1647:1647 Examples.Core <> x:26 var -inst 1670:1679 <> bool_sized -R1683:1689 Examples.Core <> t_Sized class -R1691:1695 Crypt.package.pkg_notation PackageNotation ::package_scope:'''bool' not -R1701:1705 Examples.Core <> Sized def -binder 1707:1707 <> x:27 -R1712:1712 Examples.Core <> x:27 var -def 1728:1732 <> ilog2 -binder 1735:1736 <> WS:28 -binder 1740:1740 <> L:29 -binder 1742:1742 <> I:30 -R1750:1753 Hacspec.ChoiceEquality <> both rec -R1760:1762 Hacspec.Hacspec_Lib_Pre <> int syndef -R1764:1765 Examples.Core <> WS:28 var -R1757:1757 Examples.Core <> I:30 var -R1755:1755 Examples.Core <> L:29 var -binder 1746:1746 <> x:31 -R1771:1774 Hacspec.ChoiceEquality <> both rec -R1781:1783 Hacspec.Hacspec_Lib_Pre <> int syndef -R1785:1786 Examples.Core <> WS:28 var -R1778:1778 Examples.Core <> I:30 var -R1776:1776 Examples.Core <> L:29 var -R1792:1792 Examples.Core <> x:31 var -def 1818:1824 <> collect -binder 1827:1827 <> A:32 -binder 1831:1831 <> L:33 -binder 1833:1833 <> I:34 -R1841:1844 Hacspec.ChoiceEquality <> both rec -R1851:1856 Crypt.choice_type <> chList constr -R1858:1858 Examples.Core <> A:32 var -R1848:1848 Examples.Core <> I:34 var -R1846:1846 Examples.Core <> L:33 var -binder 1837:1837 <> x:35 -R1864:1867 Hacspec.ChoiceEquality <> both rec -R1874:1878 Examples.Core <> t_Vec def -R1880:1880 Examples.Core <> A:32 var -R1882:1889 Examples.Core <> t_Global constr -R1871:1871 Examples.Core <> I:34 var -R1869:1869 Examples.Core <> L:33 var -R1895:1895 Examples.Core <> x:35 var -def 1912:1925 <> swap_both_list -binder 1928:1928 <> A:36 -binder 1930:1930 <> L:37 -binder 1932:1932 <> I:38 -R1940:1943 Coq.Init.Datatypes <> list ind -R1946:1949 Hacspec.ChoiceEquality <> both rec -R1955:1955 Examples.Core <> A:36 var -R1953:1953 Examples.Core <> I:38 var -R1951:1951 Examples.Core <> L:37 var -binder 1936:1936 <> x:39 -R1961:1964 Hacspec.ChoiceEquality <> both rec -R1971:1976 Crypt.choice_type <> chList constr -R1986:1999 Examples.Core <> swap_both_list:42 def -R2001:2001 Examples.Core <> x:41 var -R2009:2022 Coq.Lists.List <> fold_left def -R2169:2176 Hacspec.ChoiceEquality <> ret_both def -R2184:2189 Crypt.choice_type <> chList constr -R2179:2180 Coq.Lists.List ListNotations ::list_scope:'['_']' not -R2034:2037 Hacspec.ChoiceEquality <> both rec -R2044:2049 Crypt.choice_type <> chList constr -binder 2030:2030 <> x:43 -binder 2055:2055 <> y:44 -R2063:2071 Hacspec.ChoiceEquality <> bind_both def -binder 2080:2081 <> x':45 -R2089:2097 Hacspec.ChoiceEquality <> bind_both def -binder 2106:2107 <> y':46 -R2130:2137 Hacspec.ChoiceEquality <> ret_both def -R2153:2158 Crypt.choice_type <> chList constr -R2143:2146 Coq.Init.Datatypes <> ::list_scope:x_'::'_x not -R2141:2142 Examples.Core <> y':46 var -R2147:2148 Examples.Core <> x':45 var -R2099:2099 Examples.Core <> y:44 var -R2073:2073 Examples.Core <> x:43 var -def 2284:2293 <> match_list -R2302:2312 Crypt.choice_type <> choice_type ind -binder 2296:2296 <> A:47 -binder 2298:2298 <> B:48 -binder 2316:2316 <> L:49 -binder 2318:2318 <> I:50 -R2326:2329 Hacspec.ChoiceEquality <> both rec -R2336:2341 Crypt.choice_type <> chList constr -R2343:2343 Examples.Core <> A:47 var -R2333:2333 Examples.Core <> I:50 var -R2331:2331 Examples.Core <> L:49 var -binder 2322:2322 <> x:51 -R2358:2361 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R2352:2355 Coq.Init.Datatypes <> list ind -R2357:2357 Examples.Core <> A:47 var -R2362:2362 Examples.Core <> B:48 var -binder 2348:2348 <> f:52 -R2367:2370 Hacspec.ChoiceEquality <> both rec -R2383:2392 Examples.Core <> match_list:56 def -R2396:2396 Examples.Core <> f:54 var -R2394:2394 Examples.Core <> x:55 var -R2403:2411 Hacspec.ChoiceEquality <> bind_both def -binder 2420:2421 <> x':57 -R2426:2433 Hacspec.ChoiceEquality <> ret_both def -R2438:2439 Examples.Core <> x':57 var -def 2531:2533 <> map -binder 2536:2536 <> A:58 -binder 2538:2538 <> B:59 -binder 2542:2542 <> L:60 -binder 2544:2544 <> I:61 -R2552:2555 Hacspec.ChoiceEquality <> both rec -R2562:2567 Crypt.choice_type <> chList constr -R2569:2569 Examples.Core <> A:58 var -R2559:2559 Examples.Core <> I:61 var -R2557:2557 Examples.Core <> L:60 var -binder 2548:2548 <> x:62 -R2589:2592 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R2579:2582 Hacspec.ChoiceEquality <> both rec -R2588:2588 Examples.Core <> A:58 var -R2586:2586 Examples.Core <> I:61 var -R2584:2584 Examples.Core <> L:60 var -R2593:2596 Hacspec.ChoiceEquality <> both rec -R2602:2602 Examples.Core <> B:59 var -R2600:2600 Examples.Core <> I:61 var -R2598:2598 Examples.Core <> L:60 var -binder 2575:2575 <> f:63 -R2607:2610 Hacspec.ChoiceEquality <> both rec -R2617:2622 Crypt.choice_type <> chList constr -R2632:2634 Examples.Core <> map:67 def -R2638:2638 Examples.Core <> f:65 var -R2636:2636 Examples.Core <> x:66 var -R2645:2653 Hacspec.ChoiceEquality <> bind_both def -binder 2662:2663 <> x':68 -R2668:2681 Examples.Core <> swap_both_list def -R2684:2691 Coq.Lists.List <> map def -R2719:2720 Examples.Core <> x':68 var -binder 2698:2698 <> y:69 -R2706:2713 Hacspec.ChoiceEquality <> ret_both def -R2715:2715 Examples.Core <> y:69 var -def 2813:2818 <> cloned -binder 2821:2821 <> A:70 -binder 2825:2825 <> L:71 -binder 2827:2827 <> I:72 -R2835:2838 Hacspec.ChoiceEquality <> both rec -R2845:2850 Crypt.choice_type <> chList constr -R2852:2852 Examples.Core <> A:70 var -R2842:2842 Examples.Core <> I:72 var -R2840:2840 Examples.Core <> L:71 var -binder 2831:2831 <> x:73 -R2858:2861 Hacspec.ChoiceEquality <> both rec -R2868:2873 Crypt.choice_type <> chList constr -R2875:2875 Examples.Core <> A:70 var -R2865:2865 Examples.Core <> I:72 var -R2863:2863 Examples.Core <> L:71 var -R2881:2881 Examples.Core <> x:73 var -def 2895:2898 <> iter -binder 2901:2901 <> A:74 -binder 2903:2903 <> L:75 -binder 2905:2905 <> I:76 -R2913:2916 Hacspec.ChoiceEquality <> both rec -R2923:2925 Hacspec.Hacspec_Lib_Pre <> seq def -R2927:2927 Examples.Core <> A:74 var -R2920:2920 Examples.Core <> I:76 var -R2918:2918 Examples.Core <> L:75 var -binder 2909:2909 <> x:77 -R2933:2936 Hacspec.ChoiceEquality <> both rec -R2943:2948 Crypt.choice_type <> chList constr -R2958:2961 Examples.Core <> iter:80 def -R2963:2963 Examples.Core <> x:79 var -R2970:2978 Hacspec.ChoiceEquality <> bind_both def -binder 2987:2988 <> x':81 -R2993:3000 Hacspec.ChoiceEquality <> ret_both def -R3022:3027 Crypt.choice_type <> chList constr -R3003:3013 Hacspec.Hacspec_Lib_Pre <> seq_to_list def -R3017:3018 Examples.Core <> x':81 var -def 3122:3126 <> dedup -binder 3129:3129 <> A:82 -binder 3133:3133 <> L:83 -binder 3135:3135 <> I:84 -R3143:3146 Hacspec.ChoiceEquality <> both rec -R3153:3157 Examples.Core <> t_Vec def -R3159:3159 Examples.Core <> A:82 var -R3161:3168 Examples.Core <> t_Global constr -R3150:3150 Examples.Core <> I:84 var -R3148:3148 Examples.Core <> L:83 var -binder 3139:3139 <> x:85 -R3174:3177 Hacspec.ChoiceEquality <> both rec -R3184:3188 Examples.Core <> t_Vec def -R3190:3190 Examples.Core <> A:82 var -R3192:3199 Examples.Core <> t_Global constr -R3181:3181 Examples.Core <> I:84 var -R3179:3179 Examples.Core <> L:83 var -R3205:3205 Examples.Core <> x:85 var -def 3220:3227 <> t_String -R3232:3256 Coq.Strings.String <> string ind -def 3270:3272 <> new -binder 3275:3275 <> A:86 -binder 3277:3277 <> L:87 -binder 3279:3279 <> I:88 -R3284:3287 Hacspec.ChoiceEquality <> both rec -R3294:3298 Examples.Core <> t_Vec def -R3300:3300 Examples.Core <> A:86 var -R3302:3309 Examples.Core <> t_Global constr -R3291:3291 Examples.Core <> I:88 var -R3289:3289 Examples.Core <> L:87 var -R3315:3322 Hacspec.ChoiceEquality <> ret_both def -R3330:3335 Crypt.choice_type <> chList constr -R3337:3337 Examples.Core <> A:86 var -R3325:3326 Coq.Lists.List ListNotations ::list_scope:'['_']' not -def 3353:3361 <> enumerate -binder 3364:3364 <> A:89 -binder 3368:3368 <> L:90 -binder 3370:3370 <> I:91 -R3378:3381 Hacspec.ChoiceEquality <> both rec -R3388:3392 Examples.Core <> t_Vec def -R3394:3394 Examples.Core <> A:89 var -R3396:3403 Examples.Core <> t_Global constr -R3385:3385 Examples.Core <> I:91 var -R3383:3383 Examples.Core <> L:90 var -binder 3374:3374 <> x:92 -R3409:3412 Hacspec.ChoiceEquality <> both rec -R3419:3423 Examples.Core <> t_Vec def -R3425:3425 Examples.Core <> A:89 var -R3427:3434 Examples.Core <> t_Global constr -R3416:3416 Examples.Core <> I:91 var -R3414:3414 Examples.Core <> L:90 var -R3440:3440 Examples.Core <> x:92 var -def 3455:3462 <> t_Result -binder 3464:3464 <> A:93 -binder 3466:3466 <> B:94 -R3471:3476 Hacspec.Hacspec_Lib_Pre <> result def -R3478:3478 Examples.Core <> B:94 var -R3480:3480 Examples.Core <> A:93 var -ind 3493:3503 <> ControlFlow -constr 3552:3571 <> ControlFlow_Continue -constr 3594:3610 <> ControlFlow_Break -binder 3506:3506 <> L:95 -binder 3508:3508 <> I:96 -R3516:3526 Crypt.choice_type <> choice_type ind -binder 3512:3512 <> A:97 -R3534:3544 Crypt.choice_type <> choice_type ind -binder 3530:3530 <> B:98 -R3580:3583 Hacspec.ChoiceEquality <> both rec -R3589:3589 Examples.Core <> A:97 var -R3587:3587 Examples.Core <> I:96 var -R3585:3585 Examples.Core <> L:95 var -binder 3574:3576 <> val:101 -R3619:3622 Hacspec.ChoiceEquality <> both rec -R3628:3628 Examples.Core <> B:98 var -R3626:3626 Examples.Core <> I:96 var -R3624:3624 Examples.Core <> L:95 var -binder 3613:3615 <> val:102 -def 3644:3646 <> run -R3655:3665 Crypt.choice_type <> choice_type ind -binder 3649:3649 <> A:103 -binder 3651:3651 <> B:104 -binder 3669:3669 <> L:105 -binder 3671:3671 <> I:106 -R3679:3689 Examples.Core <> ControlFlow ind -R3693:3693 Examples.Core <> B:104 var -R3691:3691 Examples.Core <> A:103 var -binder 3675:3675 <> x:107 -R3698:3701 Hacspec.ChoiceEquality <> both rec -R3708:3715 Examples.Core <> t_Result def -R3717:3717 Examples.Core <> A:103 var -R3719:3719 Examples.Core <> B:104 var -R3705:3705 Examples.Core <> I:106 var -R3703:3703 Examples.Core <> L:105 var -R3733:3733 Examples.Core <> x:107 var -R3744:3763 Examples.Core <> ControlFlow_Continue constr -R3770:3771 Hacspec.Hacspec_Lib <> Ok def -R3779:3795 Examples.Core <> ControlFlow_Break constr -R3802:3804 Hacspec.Hacspec_Lib <> Err def -def 4693:4703 <> t_ErrorKind -R4707:4717 Crypt.choice_type <> choice_type ind -R4722:4726 Crypt.choice_type <> chFin constr -R4729:4733 Crypt.Prelude <> mkpos constr -def 4750:4789 <> ErrorKind_SerializedProofSizeIsIncorrect -binder 4792:4792 <> L:109 -binder 4794:4794 <> I:110 -R4799:4802 Hacspec.ChoiceEquality <> both rec -R4808:4818 Examples.Core <> t_ErrorKind def -R4806:4806 Examples.Core <> I:110 var -R4804:4804 Examples.Core <> L:109 var -R4823:4830 Hacspec.ChoiceEquality <> ret_both def -R4873:4883 Examples.Core <> t_ErrorKind def -R4833:4847 mathcomp.ssreflect.fintype <> Ordinal constr -R4863:4869 Coq.Init.Logic <> eq_refl constr -def 4898:4927 <> ErrorKind_NotEnoughHelperNodes -binder 4930:4930 <> L:111 -binder 4932:4932 <> I:112 -R4937:4940 Hacspec.ChoiceEquality <> both rec -R4946:4956 Examples.Core <> t_ErrorKind def -R4944:4944 Examples.Core <> I:112 var -R4942:4942 Examples.Core <> L:111 var -R4961:4968 Hacspec.ChoiceEquality <> ret_both def -R5011:5021 Examples.Core <> t_ErrorKind def -R4971:4985 mathcomp.ssreflect.fintype <> Ordinal constr -R5001:5007 Coq.Init.Logic <> eq_refl constr -def 5036:5064 <> ErrorKind_HashConversionError -binder 5067:5067 <> L:113 -binder 5069:5069 <> I:114 -R5074:5077 Hacspec.ChoiceEquality <> both rec -R5083:5093 Examples.Core <> t_ErrorKind def -R5081:5081 Examples.Core <> I:114 var -R5079:5079 Examples.Core <> L:113 var -R5098:5105 Hacspec.ChoiceEquality <> ret_both def -R5148:5158 Examples.Core <> t_ErrorKind def -R5108:5122 mathcomp.ssreflect.fintype <> Ordinal constr -R5138:5144 Coq.Init.Logic <> eq_refl constr -def 5173:5212 <> ErrorKind_NotEnoughHashesToCalculateRoot -binder 5215:5215 <> L:115 -binder 5217:5217 <> I:116 -R5222:5225 Hacspec.ChoiceEquality <> both rec -R5231:5241 Examples.Core <> t_ErrorKind def -R5229:5229 Examples.Core <> I:116 var -R5227:5227 Examples.Core <> L:115 var -R5246:5253 Hacspec.ChoiceEquality <> ret_both def -R5296:5306 Examples.Core <> t_ErrorKind def -R5256:5270 mathcomp.ssreflect.fintype <> Ordinal constr -R5286:5292 Coq.Init.Logic <> eq_refl constr -def 5321:5356 <> ErrorKind_LeavesIndicesCountMismatch -binder 5359:5359 <> L:117 -binder 5361:5361 <> I:118 -R5366:5369 Hacspec.ChoiceEquality <> both rec -R5375:5385 Examples.Core <> t_ErrorKind def -R5373:5373 Examples.Core <> I:118 var -R5371:5371 Examples.Core <> L:117 var -R5390:5397 Hacspec.ChoiceEquality <> ret_both def -R5440:5450 Examples.Core <> t_ErrorKind def -R5400:5414 mathcomp.ssreflect.fintype <> Ordinal constr -R5430:5436 Coq.Init.Logic <> eq_refl constr -def 5643:5649 <> t_Error -R5653:5663 Crypt.choice_type <> choice_type ind -R5679:5682 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R5668:5678 Examples.Core <> t_ErrorKind def -R5683:5693 Examples.Core <> t_ErrorKind def -def 5735:5745 <> Build_Error -binder 5748:5748 <> L:119 -binder 5750:5750 <> I:120 -R5764:5767 Hacspec.ChoiceEquality <> both rec -R5773:5783 Examples.Core <> t_ErrorKind def -R5771:5771 Examples.Core <> I:120 var -R5769:5769 Examples.Core <> L:119 var -binder 5754:5760 <> f_kind1:121 -R5797:5800 Hacspec.ChoiceEquality <> both rec -R5806:5816 Examples.Core <> t_ErrorKind def -R5804:5804 Examples.Core <> I:120 var -R5802:5802 Examples.Core <> L:119 var -binder 5787:5793 <> f_kind2:122 -R5821:5824 Hacspec.ChoiceEquality <> both rec -R5830:5836 Examples.Core <> t_Error def -R5843:5853 Examples.Core <> Build_Error:126 def -R5882:5882 Examples.Core <> y:125 var -R5867:5867 Examples.Core <> x:124 var -R5890:5898 Hacspec.ChoiceEquality <> bind_both def -binder 5907:5908 <> x':127 -R5915:5923 Hacspec.ChoiceEquality <> bind_both def -binder 5932:5933 <> y':128 -R5955:5962 Hacspec.ChoiceEquality <> ret_both def -R5976:5982 Examples.Core <> t_Error def -R5965:5965 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not -R5968:5969 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not -R5972:5972 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not -R5966:5967 Examples.Core <> x':127 var -R5970:5971 Examples.Core <> y':128 var -def 6075:6081 <> f_kind1 -R6088:6094 Examples.Core <> t_Error def -binder 6084:6084 <> v:129 -R6100:6102 Coq.Init.Datatypes <> fst def -R6104:6104 Examples.Core <> v:129 var -def 6118:6124 <> f_kind2 -R6131:6137 Examples.Core <> t_Error def -binder 6127:6127 <> v:130 -R6143:6145 Coq.Init.Datatypes <> snd def -R6147:6147 Examples.Core <> v:130 var -def 6237:6243 <> t_Drain -R6258:6261 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R6247:6257 Crypt.choice_type <> choice_type ind -R6269:6272 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R6262:6268 Examples.Core <> vec_typ ind -R6273:6283 Crypt.choice_type <> choice_type ind -R6288:6292 Examples.Core <> t_Vec def -ind 6305:6311 <> t_Range -constr 6316:6324 <> RangeFull -def 6337:6341 <> drain -binder 6353:6353 <> L:133 -binder 6355:6355 <> I:134 -binder 6357:6357 <> A:135 -R6388:6391 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R6361:6364 Hacspec.ChoiceEquality <> both rec -R6371:6375 Examples.Core <> t_Vec def -R6377:6377 Examples.Core <> A:135 var -R6379:6386 Examples.Core <> t_Global constr -R6368:6368 Examples.Core <> I:134 var -R6366:6366 Examples.Core <> L:133 var -R6399:6402 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R6392:6398 Examples.Core <> t_Range ind -R6403:6406 Hacspec.ChoiceEquality <> both rec -R6431:6434 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R6413:6419 Examples.Core <> t_Drain def -R6421:6421 Examples.Core <> A:135 var -R6423:6430 Examples.Core <> t_Global constr -R6435:6439 Examples.Core <> t_Vec def -R6441:6441 Examples.Core <> A:135 var -R6443:6450 Examples.Core <> t_Global constr -R6410:6410 Examples.Core <> I:134 var -R6408:6408 Examples.Core <> L:133 var -R6458:6462 Examples.Core <> drain:138 def -R6464:6464 Examples.Core <> x:137 var -R6475:6483 Hacspec.ChoiceEquality <> bind_both def -binder 6492:6493 <> x':139 -R6498:6505 Hacspec.ChoiceEquality <> ret_both def -R6538:6541 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R6520:6526 Examples.Core <> t_Drain def -R6530:6537 Examples.Core <> t_Global constr -R6542:6546 Examples.Core <> t_Vec def -R6550:6557 Examples.Core <> t_Global constr -R6508:6508 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not -R6511:6512 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not -R6515:6515 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not -R6509:6510 Examples.Core <> x':139 var -R6513:6514 Coq.Lists.List ListNotations ::list_scope:'['_']' not -syndef 6648:6652 <> t_Rev -R6657:6658 Coq.Init.Datatypes <> id def -def 6671:6673 <> rev -binder 6676:6676 <> L:140 -binder 6678:6678 <> I:141 -binder 6680:6680 <> A:142 -R6688:6691 Hacspec.ChoiceEquality <> both rec -R6698:6703 Crypt.choice_type <> chList constr -R6705:6705 Examples.Core <> A:142 var -R6695:6695 Examples.Core <> I:141 var -R6693:6693 Examples.Core <> L:140 var -binder 6684:6684 <> x:143 -R6711:6714 Hacspec.ChoiceEquality <> both rec -R6721:6726 Crypt.choice_type <> chList constr -R6734:6736 Examples.Core <> rev:146 def -R6738:6738 Examples.Core <> x:145 var -R6743:6751 Hacspec.ChoiceEquality <> bind_both def -binder 6760:6760 <> x:147 -R6765:6772 Hacspec.ChoiceEquality <> ret_both def -R6788:6793 Crypt.choice_type <> chList constr -R6775:6782 Coq.Lists.List <> rev def -R6784:6784 Examples.Core <> x:147 var -def 6888:6890 <> pop -binder 6893:6893 <> L:148 -binder 6895:6895 <> I:149 -binder 6897:6897 <> A:150 -R6921:6924 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R6902:6905 Hacspec.ChoiceEquality <> both rec -R6912:6917 Crypt.choice_type <> chList constr -R6919:6919 Examples.Core <> A:150 var -R6909:6909 Examples.Core <> I:149 var -R6907:6907 Examples.Core <> L:148 var -R6925:6928 Hacspec.ChoiceEquality <> both rec -R6945:6948 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R6935:6942 Crypt.choice_type <> chOption constr -R6944:6944 Examples.Core <> A:150 var -R6949:6953 Examples.Core <> t_Vec def -R6955:6955 Examples.Core <> A:150 var -R6958:6965 Examples.Core <> t_Global constr -R6932:6932 Examples.Core <> I:149 var -R6930:6930 Examples.Core <> L:148 var -R6974:6983 Hacspec.ChoiceEquality <> lift1_both def -R6995:7000 Crypt.choice_type <> chList constr -R7002:7002 Examples.Core <> A:150 var -binder 6991:6991 <> x:151 -R7051:7054 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R7041:7048 Crypt.choice_type <> chOption constr -R7050:7050 Examples.Core <> A:150 var -R7055:7059 Examples.Core <> t_Vec def -R7061:7061 Examples.Core <> A:150 var -R7064:7071 Examples.Core <> t_Global constr -R7008:7008 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not -R7024:7026 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not -R7036:7036 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not -R7009:7021 Coq.Lists.List <> hd_error def -R7023:7023 Examples.Core <> x:151 var -R7027:7033 Coq.Lists.List <> tl def -R7035:7035 Examples.Core <> x:151 var -def 7089:7092 <> push -binder 7095:7096 <> L1:152 -binder 7098:7099 <> L2:153 -binder 7101:7102 <> I1:154 -binder 7104:7105 <> I2:155 -binder 7107:7107 <> A:156 -R7141:7144 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R7112:7115 Hacspec.ChoiceEquality <> both rec -R7124:7128 Examples.Core <> t_Vec def -R7130:7130 Examples.Core <> A:156 var -R7132:7139 Examples.Core <> t_Global constr -R7120:7121 Examples.Core <> I1:154 var -R7117:7118 Examples.Core <> L1:152 var -R7157:7160 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R7145:7148 Hacspec.ChoiceEquality <> both rec -R7156:7156 Examples.Core <> A:156 var -R7153:7154 Examples.Core <> I2:155 var -R7150:7151 Examples.Core <> L2:153 var -R7161:7164 Hacspec.ChoiceEquality <> both rec -R7191:7195 Examples.Core <> t_Vec def -R7197:7197 Examples.Core <> A:156 var -R7200:7207 Examples.Core <> t_Global constr -R7181:7185 extructures.fset <> ::fset_scope:x_':|:'_x not -R7179:7180 Examples.Core <> I1:154 var -R7186:7187 Examples.Core <> I2:155 var -R7169:7173 extructures.fset <> ::fset_scope:x_':|:'_x not -R7167:7168 Examples.Core <> L1:152 var -R7174:7175 Examples.Core <> L2:153 var -R7216:7225 Hacspec.ChoiceEquality <> lift2_both def -R7238:7243 Crypt.choice_type <> chList constr -R7245:7245 Examples.Core <> A:156 var -binder 7234:7234 <> x:157 -binder 7248:7248 <> y:158 -R7262:7267 Crypt.choice_type <> chList constr -R7269:7269 Examples.Core <> A:156 var -R7254:7257 Coq.Init.Datatypes <> ::list_scope:x_'::'_x not -R7253:7253 Examples.Core <> y:158 var -R7258:7258 Examples.Core <> x:157 var -syndef 7283:7293 <> Option_Some -R7298:7301 Coq.Init.Datatypes <> Some constr -def 7315:7320 <> append -binder 7323:7324 <> L1:159 -binder 7326:7327 <> L2:160 -binder 7329:7330 <> I1:161 -binder 7332:7333 <> I2:162 -R7341:7351 Crypt.choice_type <> choice_type ind -binder 7337:7337 <> A:163 -R7359:7362 Hacspec.ChoiceEquality <> both rec -R7371:7376 Crypt.choice_type <> chList constr -R7378:7378 Examples.Core <> A:163 var -R7367:7368 Examples.Core <> I1:161 var -R7364:7365 Examples.Core <> L1:159 var -binder 7355:7355 <> l:164 -R7387:7390 Hacspec.ChoiceEquality <> both rec -R7399:7404 Crypt.choice_type <> chList constr -R7406:7406 Examples.Core <> A:163 var -R7395:7396 Examples.Core <> I2:162 var -R7392:7393 Examples.Core <> L2:160 var -binder 7383:7383 <> x:165 -R7412:7415 Hacspec.ChoiceEquality <> both rec -R7450:7453 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R7442:7447 Crypt.choice_type <> chList constr -R7449:7449 Examples.Core <> A:163 var -R7454:7459 Crypt.choice_type <> chList constr -R7461:7461 Examples.Core <> A:163 var -R7432:7436 extructures.fset <> ::fset_scope:x_':|:'_x not -R7430:7431 Examples.Core <> I2:162 var -R7437:7438 Examples.Core <> I1:161 var -R7420:7424 extructures.fset <> ::fset_scope:x_':|:'_x not -R7418:7419 Examples.Core <> L2:160 var -R7425:7426 Examples.Core <> L1:159 var -R7469:7478 Hacspec.ChoiceEquality <> lift2_both def -R7558:7558 Examples.Core <> l:164 var -R7556:7556 Examples.Core <> x:165 var -R7490:7495 Crypt.choice_type <> chList constr -R7497:7497 Examples.Core <> A:163 var -binder 7486:7486 <> x:166 -R7505:7510 Crypt.choice_type <> chList constr -R7512:7512 Examples.Core <> A:163 var -binder 7501:7501 <> y:167 -R7542:7545 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R7534:7539 Crypt.choice_type <> chList constr -R7541:7541 Examples.Core <> A:163 var -R7546:7551 Crypt.choice_type <> chList constr -R7553:7553 Examples.Core <> A:163 var -R7518:7518 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not -R7526:7527 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not -R7530:7530 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not -R7519:7521 Coq.Init.Datatypes <> app def -R7525:7525 Examples.Core <> x:166 var -R7523:7523 Examples.Core <> y:167 var -R7528:7529 Coq.Lists.List ListNotations ::list_scope:'['_']' not -syndef 7571:7575 <> clone -R7580:7581 Coq.Init.Datatypes <> id def -def 7595:7603 <> seq_unzip -binder 7606:7606 <> A:168 -binder 7608:7608 <> B:169 -R7616:7621 Crypt.choice_type <> chList constr -R7625:7628 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R7624:7624 Examples.Core <> A:168 var -R7629:7629 Examples.Core <> B:169 var -binder 7612:7612 <> s:170 -R7643:7646 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R7635:7640 Crypt.choice_type <> chList constr -R7642:7642 Examples.Core <> A:168 var -R7647:7652 Crypt.choice_type <> chList constr -R7654:7654 Examples.Core <> B:169 var -R7659:7659 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not -R7672:7673 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not -R7686:7686 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not -R7660:7669 mathcomp.ssreflect.seq <> unzip1 def -R7671:7671 Examples.Core <> s:170 var -R7674:7683 mathcomp.ssreflect.seq <> unzip2 def -R7685:7685 Examples.Core <> s:170 var -def 7700:7704 <> unzip -binder 7707:7707 <> L:171 -binder 7709:7709 <> I:172 -binder 7713:7713 <> A:173 -binder 7715:7715 <> B:174 -R7746:7749 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R7720:7723 Hacspec.ChoiceEquality <> both rec -R7730:7735 Crypt.choice_type <> chList constr -R7739:7742 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R7738:7738 Examples.Core <> A:173 var -R7743:7743 Examples.Core <> B:174 var -R7727:7727 Examples.Core <> I:172 var -R7725:7725 Examples.Core <> L:171 var -R7750:7753 Hacspec.ChoiceEquality <> both rec -R7768:7771 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R7760:7765 Crypt.choice_type <> chList constr -R7767:7767 Examples.Core <> A:173 var -R7772:7777 Crypt.choice_type <> chList constr -R7779:7779 Examples.Core <> B:174 var -R7757:7757 Examples.Core <> I:172 var -R7755:7755 Examples.Core <> L:171 var -R7785:7794 Hacspec.ChoiceEquality <> lift1_both def -R7796:7804 Examples.Core <> seq_unzip def -def 7817:7821 <> deref -binder 7824:7824 <> L:175 -binder 7826:7826 <> I:176 -binder 7828:7828 <> A:177 -R7860:7863 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R7833:7836 Hacspec.ChoiceEquality <> both rec -R7843:7847 Examples.Core <> t_Vec def -R7851:7858 Examples.Core <> t_Global constr -R7864:7867 Hacspec.ChoiceEquality <> both rec -R7874:7876 Hacspec.Hacspec_Lib_Pre <> seq def -R7886:7890 Examples.Core <> deref:180 def -R7892:7892 Examples.Core <> X:179 var -R7897:7905 Hacspec.ChoiceEquality <> bind_both def -R7918:7922 Examples.Core <> t_Vec def -R7926:7933 Examples.Core <> t_Global constr -binder 7914:7914 <> x:181 -R7938:7945 Hacspec.ChoiceEquality <> ret_both def -R7948:7960 Hacspec.Hacspec_Lib_Pre <> seq_from_list def -R7964:7964 Examples.Core <> x:181 var -def 8056:8062 <> t_Never -R8067:8071 Coq.Init.Logic <> False ind -syndef 8083:8089 <> v_Break -R8094:8095 Coq.Init.Datatypes <> id def -syndef 8107:8116 <> Result_Err -R8121:8123 Hacspec.Hacspec_Lib <> Err def -def 8137:8148 <> never_to_any -R8153:8154 Coq.Init.Datatypes <> tt constr -syndef 8166:8174 <> Result_Ok -R8179:8180 Hacspec.Hacspec_Lib <> Ok def -R8215:8222 Hacspec.ChoiceEquality <> ret_both def -R8230:8234 Crypt.package.pkg_notation PackageNotation ::package_scope:'''unit' not -R8225:8226 Coq.Init.Datatypes <> tt constr -not 8193:8193 <> :::'ret_both'_'tt' diff --git a/ovn/proofs/ssprove/extraction/Core.v b/ovn/proofs/ssprove/extraction/Core.v index fa90358..0f7bb8f 100644 --- a/ovn/proofs/ssprove/extraction/Core.v +++ b/ovn/proofs/ssprove/extraction/Core.v @@ -65,19 +65,19 @@ Equations swap_both_list {A L I} (x : list (both L I A)) : both L I (chList A) : (List.fold_left (fun (x : both L I (chList A)) y => bind_both x (fun x' => bind_both y (fun y' => - ret_both ((y' :: x') : chList A)))) x (ret_both ([] : chList A))). + solve_lift (ret_both ((y' :: x') : chList A))))) x (solve_lift (ret_both ([] : chList A)))). Solve All Obligations with solve_ssprove_obligations. Fail Next Obligation. Equations match_list {A B : choice_type} {L I} (x : both L I (chList A)) (f : list A -> B) : both L I B := match_list x f := - bind_both x (fun x' => ret_both (f x')). + bind_both x (fun x' => solve_lift (ret_both (f x'))). Solve All Obligations with solve_ssprove_obligations. Fail Next Obligation. Equations map {A B} {L I} (x : both L I (chList A)) (f : both L I A -> both L I B) : both L I (chList B) := map x f := - bind_both x (fun x' => swap_both_list (List.map (fun y => f (ret_both y)) x')). + bind_both x (fun x' => swap_both_list (List.map (fun y => f (solve_lift (ret_both y))) x')). Solve All Obligations with solve_ssprove_obligations. Fail Next Obligation. @@ -85,14 +85,16 @@ Definition cloned {A} {L I} (x : both L I (chList A)) : both L I (chList A) := x Equations iter {A L I} (x : both L I (seq A)) : both L I (chList A) := iter x := - bind_both x (fun x' => ret_both (seq_to_list _ x' : chList A)). + bind_both x (fun x' => solve_lift (ret_both (seq_to_list _ x' : chList A))). Solve All Obligations with solve_ssprove_obligations. Fail Next Obligation. Definition dedup {A} {L I} (x : both L I (t_Vec A t_Global)) : both L I (t_Vec A t_Global) := x. Definition t_String := Coq.Strings.String.string. -Definition new {A L I} : both L I (t_Vec A t_Global) := ret_both ([] : chList A). +Program Definition new {A L I} : both L I (t_Vec A t_Global) := solve_lift (ret_both ([] : chList A)). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. Definition enumerate {A} {L I} (x : both L I (t_Vec A t_Global)) : both L I (t_Vec A t_Global) := x. @@ -126,11 +128,25 @@ Definition run {A B : choice_type} {L I} (x : ControlFlow A B) : both L I (t_Res (* | ErrorKind_LeavesIndicesCountMismatcht_ErrorKind. *) Definition t_ErrorKind : choice_type := chFin (mkpos 5). -Definition ErrorKind_SerializedProofSizeIsIncorrect {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=0) eq_refl : t_ErrorKind). -Definition ErrorKind_NotEnoughHelperNodes {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=1) eq_refl : t_ErrorKind). -Definition ErrorKind_HashConversionError {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=2) eq_refl : t_ErrorKind). -Definition ErrorKind_NotEnoughHashesToCalculateRoot {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=3) eq_refl : t_ErrorKind). -Definition ErrorKind_LeavesIndicesCountMismatch {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=4) eq_refl : t_ErrorKind). +Program Definition ErrorKind_SerializedProofSizeIsIncorrect {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=0) eq_refl : t_ErrorKind)). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Program Definition ErrorKind_NotEnoughHelperNodes {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=1) eq_refl : t_ErrorKind)). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Program Definition ErrorKind_HashConversionError {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=2) eq_refl : t_ErrorKind)). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Program Definition ErrorKind_NotEnoughHashesToCalculateRoot {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=3) eq_refl : t_ErrorKind)). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Program Definition ErrorKind_LeavesIndicesCountMismatch {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=4) eq_refl : t_ErrorKind)). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. (** How to handle records: **) (* TODO: Remove them as a phase? *) @@ -146,7 +162,7 @@ Equations Build_Error {L I} {f_kind1 : both L I t_ErrorKind} {f_kind2 : both L I Build_Error (f_kind1 := x) (f_kind2 := y) := bind_both x (fun x' => bind_both y (fun y' => - ret_both ((x', y') : t_Error))). + solve_lift (ret_both ((x', y') : t_Error)))). Solve All Obligations with solve_ssprove_obligations. Fail Next Obligation. Definition f_kind1 (v : t_Error) := fst v. @@ -158,11 +174,11 @@ Definition t_Drain : choice_type -> vec_typ -> choice_type := t_Vec. Inductive t_Range := RangeFull. Equations drain : forall {L I A}, both L I (t_Vec A t_Global) -> t_Range -> both L I (t_Drain A t_Global × t_Vec A t_Global) := drain x _ := - bind_both x (fun x' => ret_both ((x', []) : (t_Drain A t_Global × t_Vec A t_Global))). + bind_both x (fun x' => solve_lift (ret_both ((x', []) : (t_Drain A t_Global × t_Vec A t_Global)))). Solve All Obligations with solve_ssprove_obligations. Fail Next Obligation. Notation t_Rev := id. -Equations rev {L I A} (x : both L I (chList A)) : both L I (chList A) := rev x := bind_both x (fun x => ret_both (List.rev x : chList _)). +Equations rev {L I A} (x : both L I (chList A)) : both L I (chList A) := rev x := bind_both x (fun x => solve_lift (ret_both (List.rev x : chList _))). Solve All Obligations with solve_ssprove_obligations. Fail Next Obligation. @@ -180,7 +196,7 @@ Notation clone := id. Definition seq_unzip {A B} (s : chList (A × B)) : chList A × chList B := (seq.unzip1 s, seq.unzip2 s). Definition unzip {L I} {A B} : both L I (chList (A × B)) -> both L I (chList A × chList B) := lift1_both seq_unzip. Equations deref {L I A} : both L I (t_Vec A t_Global) -> both L I (seq A) := - deref X := bind_both X (fun x : t_Vec A t_Global => ret_both (seq_from_list A x)). + deref X := bind_both X (fun x : t_Vec A t_Global => solve_lift (ret_both (seq_from_list A x))). Solve All Obligations with solve_ssprove_obligations. Fail Next Obligation. Definition t_Never := False. diff --git a/ovn/proofs/ssprove/extraction/Core.vo b/ovn/proofs/ssprove/extraction/Core.vo deleted file mode 100644 index e1544750ddd15b13211939c5b5ce0d47b974a426..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 172384 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 z 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
FNMgHt|Pp)q^Y>tI9d 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𐫥cmiHevl|@F6En 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 lvzz <> lib -R112:117 Coq.ZArith.ZArith <> <> lib -R127:144 Coq.Lists.List ListNotations <> mod -R206:208 Coq.micromega.Lia <> <> lib -R226:259 Coq.Logic.FunctionalExtensionality <> <> lib -R277:283 Coq.Bool.Sumbool <> <> lib -R316:322 mathcomp.ssreflect.fintype <> <> lib -R352:362 Crypt.choice_type <> <> lib -R364:370 Crypt.Package <> <> lib -R372:378 Crypt.Prelude <> <> lib -R388:402 Crypt.package.pkg_notation PackageNotation <> mod -R437:439 extructures.ord <> <> lib -R441:444 extructures.fset <> <> lib -R446:449 extructures.fmap <> <> lib -R482:485 mathcomp.zify.ssrZ <> <> lib -R487:490 mathcomp.word.word <> <> lib -R520:523 Jasmin.word <> <> lib -R551:556 Coq.ZArith.ZArith <> <> lib -R558:561 Coq.Lists.List <> <> lib -R571:583 Coq.Lists.List ListNotations <> mod -R615:628 Hacspec.ChoiceEquality <> <> lib -R659:673 Hacspec.LocationUtility <> <> lib -R704:725 Hacspec.Hacspec_Lib_Comparable <> <> lib -R756:770 Hacspec.Hacspec_Lib_Pre <> <> lib -R801:811 Hacspec.Hacspec_Lib <> <> lib -R970:990 mathcomp.ssreflect.choice Choice.Exports <> mod -def 1122:1127 <> int_xI -R1135:1139 Jasmin.wsize <> wsize variant -binder 1130:1131 <> WS:1 -R1184:1186 Hacspec.Hacspec_Lib_Pre <> int syndef -R1188:1189 Examples.Hacspec_lib <> WS:1 var -binder 1143:1143 <> a:2 -R1232:1234 Hacspec.Hacspec_Lib_Pre <> int syndef -R1236:1237 Examples.Hacspec_lib <> WS:1 var -R1245:1267 Hacspec.Hacspec_Lib_Pre <> int_add def -R1401:1403 Hacspec.Hacspec_Lib_Pre <> one def -R1405:1406 Examples.Hacspec_lib <> WS:1 var -R1270:1292 Hacspec.Hacspec_Lib_Pre <> int_mul def -R1342:1345 Hacspec.Hacspec_Lib_Pre <> repr syndef -R1347:1348 Examples.Hacspec_lib <> WS:1 var -R1294:1294 Examples.Hacspec_lib <> a:2 var -def 1583:1588 <> int_xO -R1596:1600 Jasmin.wsize <> wsize variant -binder 1591:1592 <> WS:3 -R1608:1610 Hacspec.Hacspec_Lib_Pre <> int syndef -R1612:1613 Examples.Hacspec_lib <> WS:3 var -binder 1604:1604 <> a:4 -R1618:1620 Hacspec.Hacspec_Lib_Pre <> int syndef -R1622:1623 Examples.Hacspec_lib <> WS:3 var -R1630:1652 Hacspec.Hacspec_Lib_Pre <> int_mul def -R1658:1661 Hacspec.Hacspec_Lib_Pre <> repr syndef -R1663:1664 Examples.Hacspec_lib <> WS:3 var -R1654:1654 Examples.Hacspec_lib <> a:4 var -def 1824:1835 <> both_int_one -R1843:1847 Jasmin.wsize <> wsize variant -binder 1838:1839 <> WS:5 -R1852:1855 Hacspec.ChoiceEquality <> both rec -R1883:1885 Hacspec.Hacspec_Lib_Pre <> int syndef -R1887:1888 Examples.Hacspec_lib <> WS:5 var -R1868:1878 Crypt.package.pkg_notation PackageNotation ::package_scope:'['_'interface'_']' not -R1858:1861 extructures.fset <> fset def -R1863:1864 Coq.Lists.List ListNotations ::list_scope:'['_']' not -R1894:1901 Hacspec.ChoiceEquality <> ret_both def -R1919:1921 Hacspec.Hacspec_Lib_Pre <> one def -R1909:1912 extructures.fset <> fset def -R1914:1915 Coq.Lists.List ListNotations ::list_scope:'['_']' not -R1935:1957 Hacspec.Hacspec_Lib_Pre <> int_add def -R1975:1978 Hacspec.Hacspec_Lib_Pre <> repr syndef -R1980:1982 Jasmin.wsize <> U32 constr -R1960:1963 Hacspec.Hacspec_Lib_Pre <> repr syndef -R1965:1967 Jasmin.wsize <> U32 constr -def 2029:2035 <> int_num -R2043:2047 Jasmin.wsize <> wsize variant -binder 2038:2039 <> WS:6 -R2053:2055 Hacspec.Hacspec_Lib_Pre <> int syndef -R2057:2058 Examples.Hacspec_lib <> WS:6 var -R2120:2127 Coq.Numbers.BinNums <> positive ind -R2085:2098 Coq.PArith.BinPos Pos of_num_int def -R2120:2127 Coq.Numbers.BinNums <> positive ind -R2085:2098 Coq.PArith.BinPos Pos of_num_int def -R2120:2127 Coq.Numbers.BinNums <> positive ind -R2100:2113 Coq.PArith.BinPos Pos to_num_int def -R2220:2223 Hacspec.Hacspec_Lib_Pre <> repr syndef -not 2212:2212 <> ::hacspec_scope:'0' -R2260:2263 Hacspec.Hacspec_Lib_Pre <> int8 syndef -R2276:2279 Hacspec.Hacspec_Lib_Pre <> int8 syndef -R2292:2295 Hacspec.Hacspec_Lib_Pre <> int8 syndef -ind 2591:2598 <> Addition -constr 2843:2845 <> add -rec 2591:2598 <> Addition -proj 2843:2845 <> add -binder 2600:2601 <> L1:7 -binder 2603:2604 <> L2:8 -binder 2615:2616 <> I1:9 -binder 2618:2619 <> I2:10 -R2635:2645 Crypt.choice_type <> choice_type ind -binder 2631:2631 <> A:11 -R2861:2864 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R2849:2852 Hacspec.ChoiceEquality <> both rec -R2860:2860 Examples.Hacspec_lib <> A:11 var -R2857:2858 Examples.Hacspec_lib <> I1:9 var -R2854:2855 Examples.Hacspec_lib <> L1:7 var -R2877:2880 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R2865:2868 Hacspec.ChoiceEquality <> both rec -R2876:2876 Examples.Hacspec_lib <> A:11 var -R2873:2874 Examples.Hacspec_lib <> I2:10 var -R2870:2871 Examples.Hacspec_lib <> L2:8 var -R2881:2884 Hacspec.ChoiceEquality <> both rec -R2928:2928 Examples.Hacspec_lib <> A:11 var -R2910:2914 extructures.fset <> ::fset_scope:x_':|:'_x not -R2908:2909 Examples.Hacspec_lib <> I1:9 var -R2915:2916 Examples.Hacspec_lib <> I2:10 var -R2889:2893 extructures.fset <> ::fset_scope:x_':|:'_x not -R2887:2888 Examples.Hacspec_lib <> L1:7 var -R2894:2895 Examples.Hacspec_lib <> L2:8 var -R2953:2955 Examples.Hacspec_lib <> add def -not 2940:2940 <> :::x_'.+'_x -inst 3122:3133 <> int_add_inst -R3141:3145 Jasmin.wsize <> wsize variant -binder 3136:3137 <> ws:14 -binder 3149:3150 <> L1:15 -binder 3152:3153 <> L2:16 -binder 3164:3165 <> I1:17 -binder 3167:3168 <> I2:18 -R3373:3380 Examples.Hacspec_lib <> Addition class -R3414:3416 Hacspec.Hacspec_Lib_Pre <> int syndef -R3418:3419 Examples.Hacspec_lib <> ws:14 var -R3400:3401 Examples.Hacspec_lib <> I2:18 var -R3397:3398 Examples.Hacspec_lib <> I1:17 var -R3385:3386 Examples.Hacspec_lib <> L2:16 var -R3382:3383 Examples.Hacspec_lib <> L1:15 var -R3501:3503 Examples.Hacspec_lib <> add def -binder 3505:3505 <> a:19 -binder 3507:3507 <> b:20 -R3512:3518 Hacspec.Hacspec_Lib <> int_add def -R3672:3672 Examples.Hacspec_lib <> b:20 var -R3670:3670 Examples.Hacspec_lib <> a:19 var -ind 3684:3694 <> Subtraction -constr 3940:3942 <> sub -rec 3684:3694 <> Subtraction -proj 3940:3942 <> sub -binder 3697:3698 <> L1:21 -binder 3700:3701 <> L2:22 -binder 3712:3713 <> I1:23 -binder 3715:3716 <> I2:24 -R3732:3742 Crypt.choice_type <> choice_type ind -binder 3728:3728 <> A:25 -R3958:3961 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R3946:3949 Hacspec.ChoiceEquality <> both rec -R3957:3957 Examples.Hacspec_lib <> A:25 var -R3954:3955 Examples.Hacspec_lib <> I1:23 var -R3951:3952 Examples.Hacspec_lib <> L1:21 var -R3974:3977 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R3962:3965 Hacspec.ChoiceEquality <> both rec -R3973:3973 Examples.Hacspec_lib <> A:25 var -R3970:3971 Examples.Hacspec_lib <> I2:24 var -R3967:3968 Examples.Hacspec_lib <> L2:22 var -R3978:3981 Hacspec.ChoiceEquality <> both rec -R4025:4025 Examples.Hacspec_lib <> A:25 var -R4007:4011 extructures.fset <> ::fset_scope:x_':|:'_x not -R4005:4006 Examples.Hacspec_lib <> I1:23 var -R4012:4013 Examples.Hacspec_lib <> I2:24 var -R3986:3990 extructures.fset <> ::fset_scope:x_':|:'_x not -R3984:3985 Examples.Hacspec_lib <> L1:21 var -R3991:3992 Examples.Hacspec_lib <> L2:22 var -R4050:4052 Examples.Hacspec_lib <> sub def -not 4037:4037 <> :::x_'.-'_x -inst 4244:4255 <> int_sub_inst -R4263:4267 Jasmin.wsize <> wsize variant -binder 4258:4259 <> ws:28 -binder 4271:4272 <> L1:29 -binder 4274:4275 <> L2:30 -binder 4277:4278 <> L3:31 -binder 4280:4281 <> I1:32 -binder 4283:4284 <> I2:33 -binder 4286:4287 <> I3:34 -R4311:4317 Coq.Init.Datatypes <> is_true def -R4320:4326 extructures.fset <> fsubset def -R4331:4332 Examples.Hacspec_lib <> L3:31 var -R4328:4329 Examples.Hacspec_lib <> L1:29 var -binder 4293:4307 <> H_loc_fsubset13:35 -R4358:4364 Coq.Init.Datatypes <> is_true def -R4367:4373 extructures.fset <> fsubset def -R4378:4379 Examples.Hacspec_lib <> I3:34 var -R4375:4376 Examples.Hacspec_lib <> I1:32 var -binder 4338:4354 <> H_opsig_fsubset13:36 -R4403:4409 Coq.Init.Datatypes <> is_true def -R4412:4418 extructures.fset <> fsubset def -R4423:4424 Examples.Hacspec_lib <> L3:31 var -R4420:4421 Examples.Hacspec_lib <> L2:30 var -binder 4385:4399 <> H_loc_fsubset23:37 -R4450:4456 Coq.Init.Datatypes <> is_true def -R4459:4465 extructures.fset <> fsubset def -R4470:4471 Examples.Hacspec_lib <> I3:34 var -R4467:4468 Examples.Hacspec_lib <> I2:33 var -binder 4430:4446 <> H_opsig_fsubset23:38 -R4477:4487 Examples.Hacspec_lib <> Subtraction class -R4521:4523 Hacspec.Hacspec_Lib_Pre <> int syndef -R4525:4526 Examples.Hacspec_lib <> ws:28 var -R4507:4508 Examples.Hacspec_lib <> I2:33 var -R4504:4505 Examples.Hacspec_lib <> I1:32 var -R4492:4493 Examples.Hacspec_lib <> L2:30 var -R4489:4490 Examples.Hacspec_lib <> L1:29 var -R4608:4610 Examples.Hacspec_lib <> sub def -binder 4612:4612 <> a:39 -binder 4614:4614 <> b:40 -R4619:4625 Hacspec.Hacspec_Lib <> int_sub def -R4779:4779 Examples.Hacspec_lib <> b:40 var -R4777:4777 Examples.Hacspec_lib <> a:39 var -ind 4791:4804 <> Multiplication -constr 5046:5048 <> mul -rec 4791:4804 <> Multiplication -proj 5046:5048 <> mul -R4824:4829 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R4838:4838 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R4830:4837 Crypt.package.pkg_core_definition <> Location def -binder 4807:4808 <> L1:41 -binder 4810:4811 <> L2:42 -R4859:4867 Crypt.package.pkg_core_definition <> Interface def -binder 4842:4843 <> I1:43 -binder 4845:4846 <> I2:44 -binder 4870:4870 <> A:45 -R5064:5067 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R5052:5055 Hacspec.ChoiceEquality <> both rec -R5063:5063 Examples.Hacspec_lib <> A:45 var -R5060:5061 Examples.Hacspec_lib <> I1:43 var -R5057:5058 Examples.Hacspec_lib <> L1:41 var -R5080:5083 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R5068:5071 Hacspec.ChoiceEquality <> both rec -R5079:5079 Examples.Hacspec_lib <> A:45 var -R5076:5077 Examples.Hacspec_lib <> I2:44 var -R5073:5074 Examples.Hacspec_lib <> L2:42 var -R5084:5087 Hacspec.ChoiceEquality <> both rec -R5132:5132 Examples.Hacspec_lib <> A:45 var -R5113:5117 extructures.fset <> ::fset_scope:x_':|:'_x not -R5111:5112 Examples.Hacspec_lib <> I1:43 var -R5118:5119 Examples.Hacspec_lib <> I2:44 var -R5092:5096 extructures.fset <> ::fset_scope:x_':|:'_x not -R5090:5091 Examples.Hacspec_lib <> L1:41 var -R5097:5098 Examples.Hacspec_lib <> L2:42 var -R5157:5159 Examples.Hacspec_lib <> mul def -not 5144:5144 <> :::x_'.*'_x -inst 5342:5353 <> int_mul_inst -R5361:5365 Jasmin.wsize <> wsize variant -binder 5356:5357 <> ws:48 -R5387:5392 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R5401:5401 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R5393:5400 Crypt.package.pkg_core_definition <> Location def -binder 5370:5371 <> L1:49 -binder 5373:5374 <> L2:50 -R5424:5432 Crypt.package.pkg_core_definition <> Interface def -binder 5407:5408 <> I1:51 -binder 5410:5411 <> I2:52 -R5611:5624 Examples.Hacspec_lib <> Multiplication class -R5658:5660 Hacspec.Hacspec_Lib_Pre <> int syndef -R5662:5663 Examples.Hacspec_lib <> ws:48 var -R5644:5645 Examples.Hacspec_lib <> I2:52 var -R5641:5642 Examples.Hacspec_lib <> I1:51 var -R5629:5630 Examples.Hacspec_lib <> L2:50 var -R5626:5627 Examples.Hacspec_lib <> L1:49 var -R5729:5731 Examples.Hacspec_lib <> mul def -binder 5733:5733 <> a:53 -binder 5735:5735 <> b:54 -R5740:5746 Hacspec.Hacspec_Lib <> int_mul def -R5750:5750 Examples.Hacspec_lib <> b:54 var -R5748:5748 Examples.Hacspec_lib <> a:53 var -ind 5784:5786 <> Xor -constr 6028:6030 <> xor -rec 5784:5786 <> Xor -proj 6028:6030 <> xor -R5806:5811 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R5820:5820 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R5812:5819 Crypt.package.pkg_core_definition <> Location def -binder 5789:5790 <> L1:55 -binder 5792:5793 <> L2:56 -R5841:5849 Crypt.package.pkg_core_definition <> Interface def -binder 5824:5825 <> I1:57 -binder 5827:5828 <> I2:58 -binder 5852:5852 <> A:59 -R6046:6049 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R6034:6037 Hacspec.ChoiceEquality <> both rec -R6045:6045 Examples.Hacspec_lib <> A:59 var -R6042:6043 Examples.Hacspec_lib <> I1:57 var -R6039:6040 Examples.Hacspec_lib <> L1:55 var -R6062:6065 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R6050:6053 Hacspec.ChoiceEquality <> both rec -R6061:6061 Examples.Hacspec_lib <> A:59 var -R6058:6059 Examples.Hacspec_lib <> I2:58 var -R6055:6056 Examples.Hacspec_lib <> L2:56 var -R6066:6069 Hacspec.ChoiceEquality <> both rec -R6114:6114 Examples.Hacspec_lib <> A:59 var -R6095:6099 extructures.fset <> ::fset_scope:x_':|:'_x not -R6093:6094 Examples.Hacspec_lib <> I1:57 var -R6100:6101 Examples.Hacspec_lib <> I2:58 var -R6074:6078 extructures.fset <> ::fset_scope:x_':|:'_x not -R6072:6073 Examples.Hacspec_lib <> L1:55 var -R6079:6080 Examples.Hacspec_lib <> L2:56 var -R6139:6141 Examples.Hacspec_lib <> xor def -not 6126:6126 <> :::x_'.^'_x -inst 6313:6324 <> int_xor_inst -R6332:6336 Jasmin.wsize <> wsize variant -binder 6327:6328 <> ws:62 -binder 6340:6341 <> L1:63 -binder 6343:6344 <> L2:64 -binder 6355:6356 <> I1:65 -binder 6358:6359 <> I2:66 -R6547:6549 Examples.Hacspec_lib <> Xor class -R6583:6585 Hacspec.Hacspec_Lib_Pre <> int syndef -R6587:6588 Examples.Hacspec_lib <> ws:62 var -R6569:6570 Examples.Hacspec_lib <> I2:66 var -R6566:6567 Examples.Hacspec_lib <> I1:65 var -R6554:6555 Examples.Hacspec_lib <> L2:64 var -R6551:6552 Examples.Hacspec_lib <> L1:63 var -R6654:6656 Examples.Hacspec_lib <> xor def -binder 6658:6658 <> a:67 -binder 6660:6660 <> b:68 -R6665:6671 Hacspec.Hacspec_Lib <> int_xor def -R6675:6675 Examples.Hacspec_lib <> b:68 var -R6673:6673 Examples.Hacspec_lib <> a:67 var -rec 7356:7367 <> array_or_seq -proj 7394:7400 <> as_nseq -proj 7434:7439 <> as_seq -binder 7369:7369 <> A:69 -binder 7371:7371 <> L:70 -binder 7373:7373 <> I:71 -R7382:7384 Coq.Init.Datatypes <> nat ind -binder 7376:7378 <> len:72 -R7405:7408 Hacspec.ChoiceEquality <> both rec -R7415:7419 Hacspec.Hacspec_Lib_Pre <> nseq_ def -R7421:7421 Examples.Hacspec_lib <> A:69 var -R7423:7425 Examples.Hacspec_lib <> len:72 var -R7412:7412 Examples.Hacspec_lib <> I:71 var -R7410:7410 Examples.Hacspec_lib <> L:70 var -R7444:7447 Hacspec.ChoiceEquality <> both rec -R7454:7456 Hacspec.Hacspec_Lib_Pre <> seq def -R7458:7458 Examples.Hacspec_lib <> A:69 var -R7451:7451 Examples.Hacspec_lib <> I:71 var -R7449:7449 Examples.Hacspec_lib <> L:70 var -R7472:7477 Examples.Hacspec_lib <> as_seq proj -R7486:7492 Examples.Hacspec_lib <> as_nseq proj -R7678:7683 Examples.Hacspec_lib <> as_seq proj -R7678:7683 Examples.Hacspec_lib <> as_seq proj -R7732:7738 Examples.Hacspec_lib <> as_nseq proj -R7732:7738 Examples.Hacspec_lib <> as_nseq proj -def 8184:8200 <> nseq_array_or_seq -binder 8203:8203 <> A:76 -binder 8205:8205 <> L:77 -binder 8207:8207 <> I:78 -binder 8209:8211 <> len:79 -R8221:8224 Hacspec.ChoiceEquality <> both rec -R8231:8235 Hacspec.Hacspec_Lib_Pre <> nseq_ def -R8237:8237 Examples.Hacspec_lib <> A:76 var -R8239:8241 Examples.Hacspec_lib <> len:79 var -R8228:8228 Examples.Hacspec_lib <> I:78 var -R8226:8226 Examples.Hacspec_lib <> L:77 var -binder 8215:8217 <> val:80 -R8247:8258 Examples.Hacspec_lib <> array_or_seq rec -R8275:8291 Examples.Hacspec_lib <> nseq_array_or_seq:83 def -R8293:8295 Examples.Hacspec_lib <> val:82 var -R8303:8308 Examples.Hacspec_lib <> as_seq proj -R8303:8308 Examples.Hacspec_lib <> as_seq proj -R8303:8308 Examples.Hacspec_lib <> as_seq proj -R8332:8338 Examples.Hacspec_lib <> as_nseq proj -R8332:8338 Examples.Hacspec_lib <> as_nseq proj -R8313:8324 Hacspec.Hacspec_Lib <> array_to_seq def -R8384:8400 Examples.Hacspec_lib <> nseq_array_or_seq def -R8384:8400 Examples.Hacspec_lib <> nseq_array_or_seq def -R8427:8443 Examples.Hacspec_lib <> nseq_array_or_seq def -R8446:8495 Examples.Hacspec_lib <> nseq_array_or_seq def -R8518:8534 Examples.Hacspec_lib <> nseq_array_or_seq def -def 9350:9360 <> array_index -R9366:9376 Crypt.choice_type <> choice_type ind -binder 9363:9363 <> A:84 -R9386:9388 Coq.Init.Datatypes <> nat ind -binder 9380:9382 <> len:85 -binder 9392:9393 <> L1:86 -binder 9395:9396 <> L2:87 -binder 9398:9399 <> I1:88 -binder 9401:9402 <> I2:89 -R9409:9420 Examples.Hacspec_lib <> array_or_seq rec -R9422:9422 Examples.Hacspec_lib <> A:84 var -R9424:9425 Examples.Hacspec_lib <> L1:86 var -R9427:9428 Examples.Hacspec_lib <> I1:88 var -R9430:9432 Examples.Hacspec_lib <> len:85 var -binder 9406:9406 <> s:90 -binder 9436:9437 <> WS:91 -R9445:9448 Hacspec.ChoiceEquality <> both rec -R9458:9460 Hacspec.Hacspec_Lib_Pre <> int syndef -R9462:9463 Examples.Hacspec_lib <> WS:91 var -R9453:9454 Examples.Hacspec_lib <> I2:89 var -R9450:9451 Examples.Hacspec_lib <> L2:87 var -binder 9441:9441 <> i:92 -R9469:9472 Hacspec.ChoiceEquality <> both rec -R9498:9498 Examples.Hacspec_lib <> A:84 var -R9489:9493 extructures.fset <> ::fset_scope:x_':|:'_x not -R9487:9488 Examples.Hacspec_lib <> I1:88 var -R9494:9495 Examples.Hacspec_lib <> I2:89 var -R9477:9481 extructures.fset <> ::fset_scope:x_':|:'_x not -R9475:9476 Examples.Hacspec_lib <> L1:86 var -R9482:9483 Examples.Hacspec_lib <> L2:87 var -R9530:9552 Hacspec.Hacspec_Lib <> array_index def -R9566:9566 Examples.Hacspec_lib <> i:92 var -R9555:9561 Examples.Hacspec_lib <> as_nseq proj -R9563:9563 Examples.Hacspec_lib <> s:90 var -def 11333:11350 <> n_seq_array_or_seq -binder 11353:11353 <> L:93 -binder 11355:11355 <> I:94 -binder 11357:11357 <> A:95 -binder 11361:11361 <> B:96 -R11369:11372 Hacspec.ChoiceEquality <> both rec -R11378:11378 Examples.Hacspec_lib <> B:96 var -R11376:11376 Examples.Hacspec_lib <> I:94 var -R11374:11374 Examples.Hacspec_lib <> L:93 var -binder 11365:11365 <> x:97 -R11409:11409 Examples.Hacspec_lib <> B:96 var -R11440:11445 Crypt.choice_type <> chUnit constr -R11450:11453 Coq.Init.Logic <> True ind -R11479:11483 Crypt.choice_type <> chMap constr -R11486:11490 Crypt.choice_type <> chFin constr -R11494:11498 Crypt.Prelude <> mkpos constr -R11501:11501 Coq.Init.Datatypes <> S constr -R11518:11520 Coq.Init.Logic <> ::type_scope:x_'='_x not -R11521:11521 Examples.Hacspec_lib <> A:95 var -R11547:11551 Crypt.choice_type <> chMap constr -R11553:11556 Crypt.package.pkg_notation PackageNotation ::package_scope:'''nat' not -R11566:11568 Coq.Init.Logic <> ::type_scope:x_'='_x not -R11569:11569 Examples.Hacspec_lib <> A:95 var -R11600:11604 Coq.Init.Logic <> False ind -binder 11394:11399 <> contra:99 -R11655:11655 Examples.Hacspec_lib <> B:96 var -R11907:11910 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R11695:11695 Examples.Hacspec_lib <> K:100 var -R11724:11729 Crypt.choice_type <> chUnit constr -R11734:11737 Coq.Init.Logic <> True ind -R11761:11765 Crypt.choice_type <> chMap constr -R11768:11772 Crypt.choice_type <> chFin constr -R11776:11780 Crypt.Prelude <> mkpos constr -R11783:11783 Coq.Init.Datatypes <> S constr -R11800:11802 Coq.Init.Logic <> ::type_scope:x_'='_x not -R11803:11803 Examples.Hacspec_lib <> A:95 var -R11827:11831 Crypt.choice_type <> chMap constr -R11833:11836 Crypt.package.pkg_notation PackageNotation ::package_scope:'''nat' not -R11846:11848 Coq.Init.Logic <> ::type_scope:x_'='_x not -R11849:11849 Examples.Hacspec_lib <> A:95 var -R11878:11882 Coq.Init.Logic <> False ind -R11911:11913 Coq.Init.Datatypes <> nat ind -R11950:11955 Crypt.choice_type <> chUnit constr -R11991:11995 Crypt.choice_type <> chMap constr -R11998:12002 Crypt.choice_type <> chFin constr -R12006:12010 Crypt.Prelude <> mkpos constr -binder 12045:12052 <> m_contra:102 -R12265:12268 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R12105:12106 Examples.Hacspec_lib <> p_:103 var -R12156:12156 Coq.Init.Datatypes <> O constr -R12161:12165 Coq.Init.Logic <> False ind -R12216:12218 Coq.Init.Logic <> ::type_scope:x_'='_x not -R12219:12219 Examples.Hacspec_lib <> A:95 var -R12269:12271 Coq.Init.Datatypes <> nat ind -R12324:12324 Coq.Init.Datatypes <> O constr -binder 12333:12340 <> m_contra:105 -R12345:12354 Coq.Init.Logic <> False_rect scheme -R12360:12367 Examples.Hacspec_lib <> m_contra:105 var -R12356:12358 Coq.Init.Datatypes <> nat ind -R12389:12389 Coq.Init.Datatypes <> S constr -R12405:12405 Coq.Init.Datatypes <> S constr -R12431:12438 Examples.Hacspec_lib <> m_contra:102 var -R12456:12460 Crypt.choice_type <> chMap constr -R12462:12465 Crypt.package.pkg_notation PackageNotation ::package_scope:'''nat' not -binder 12494:12501 <> m_contra:106 -binder 12537:12544 <> m_contra:107 -R12549:12558 Coq.Init.Logic <> False_rect scheme -R12564:12571 Examples.Hacspec_lib <> m_contra:107 var -R12560:12562 Coq.Init.Datatypes <> nat ind -R12591:12596 Examples.Hacspec_lib <> contra:99 var -binder 11641:11643 <> len:108 -R12604:12615 Examples.Hacspec_lib <> array_or_seq rec -R12617:12617 Examples.Hacspec_lib <> A:95 var -R12619:12619 Examples.Hacspec_lib <> L:93 var -R12621:12621 Examples.Hacspec_lib <> I:94 var -R12623:12625 Examples.Hacspec_lib <> len:108 var -R12697:12701 Crypt.package.pkg_notation PackageNotation ::package_scope:'''unit' not -R12709:12713 Hacspec.Hacspec_Lib_Pre <> nseq_ def -R12697:12701 Crypt.package.pkg_notation PackageNotation ::package_scope:'''unit' not -R12709:12713 Hacspec.Hacspec_Lib_Pre <> nseq_ def -R12741:12746 Examples.Hacspec_lib <> as_seq proj -R12741:12746 Examples.Hacspec_lib <> as_seq proj -R12741:12746 Examples.Hacspec_lib <> as_seq proj -R12768:12774 Examples.Hacspec_lib <> as_nseq proj -R12768:12774 Examples.Hacspec_lib <> as_nseq proj -R12751:12762 Hacspec.Hacspec_Lib <> array_to_seq def -R12741:12746 Examples.Hacspec_lib <> as_seq proj -R12741:12746 Examples.Hacspec_lib <> as_seq proj -R12741:12746 Examples.Hacspec_lib <> as_seq proj -R12768:12774 Examples.Hacspec_lib <> as_nseq proj -R12768:12774 Examples.Hacspec_lib <> as_nseq proj -R12751:12762 Hacspec.Hacspec_Lib <> array_to_seq def -R12869:12873 Crypt.choice_type <> chMap constr -R12875:12878 Crypt.package.pkg_notation PackageNotation ::package_scope:'''nat' not -R12889:12891 Hacspec.Hacspec_Lib_Pre <> seq def -R12869:12873 Crypt.choice_type <> chMap constr -R12875:12878 Crypt.package.pkg_notation PackageNotation ::package_scope:'''nat' not -R12889:12891 Hacspec.Hacspec_Lib_Pre <> seq def -R12918:12923 Examples.Hacspec_lib <> as_seq proj -R12918:12923 Examples.Hacspec_lib <> as_seq proj -R12918:12923 Examples.Hacspec_lib <> as_seq proj -R12932:12938 Examples.Hacspec_lib <> as_nseq proj -R12932:12938 Examples.Hacspec_lib <> as_nseq proj -R12943:12956 Hacspec.Hacspec_Lib <> array_from_seq def -R12918:12923 Examples.Hacspec_lib <> as_seq proj -R12918:12923 Examples.Hacspec_lib <> as_seq proj -R12918:12923 Examples.Hacspec_lib <> as_seq proj -R12932:12938 Examples.Hacspec_lib <> as_nseq proj -R12932:12938 Examples.Hacspec_lib <> as_nseq proj -R12943:12956 Hacspec.Hacspec_Lib <> array_from_seq def -R13062:13066 Crypt.choice_type <> chMap constr -R13069:13073 Crypt.choice_type <> chFin constr -R13087:13091 Hacspec.Hacspec_Lib_Pre <> nseq_ def -R13062:13066 Crypt.choice_type <> chMap constr -R13069:13073 Crypt.choice_type <> chFin constr -R13087:13091 Hacspec.Hacspec_Lib_Pre <> nseq_ def -R13190:13202 Coq.ssr.ssrbool <> elimT thm -R13205:13216 Crypt.Prelude <> positive_eqP thm -R13190:13202 Coq.ssr.ssrbool <> elimT thm -R13205:13216 Crypt.Prelude <> positive_eqP thm -R13242:13252 Crypt.Prelude <> positive_eq def -R13271:13284 mathcomp.ssreflect.eqtype <> eq_refl thm -R13271:13284 mathcomp.ssreflect.eqtype <> eq_refl thm -R13314:13319 Examples.Hacspec_lib <> as_seq proj -R13314:13319 Examples.Hacspec_lib <> as_seq proj -R13314:13319 Examples.Hacspec_lib <> as_seq proj -R13341:13347 Examples.Hacspec_lib <> as_nseq proj -R13341:13347 Examples.Hacspec_lib <> as_nseq proj -R13324:13335 Hacspec.Hacspec_Lib <> array_to_seq def -R13314:13319 Examples.Hacspec_lib <> as_seq proj -R13314:13319 Examples.Hacspec_lib <> as_seq proj -R13314:13319 Examples.Hacspec_lib <> as_seq proj -R13341:13347 Examples.Hacspec_lib <> as_nseq proj -R13341:13347 Examples.Hacspec_lib <> as_nseq proj -R13324:13335 Hacspec.Hacspec_Lib <> array_to_seq def -R13393:13403 Examples.Hacspec_lib <> array_index def -R13406:13423 Examples.Hacspec_lib <> n_seq_array_or_seq def -not 13377:13377 <> :::x_'.['_x_']' -def 13484:13492 <> array_upd -R13498:13508 Crypt.choice_type <> choice_type ind -binder 13495:13495 <> A:109 -R13518:13526 Hacspec.Hacspec_Lib_Pre <> uint_size def -binder 13512:13514 <> len:110 -binder 13530:13530 <> L:111 -binder 13532:13532 <> I:112 -R13539:13542 Hacspec.ChoiceEquality <> both rec -R13549:13558 Hacspec.Hacspec_Lib_Pre <> :::'nseq' not -R13554:13554 Examples.Hacspec_lib <> A:109 var -R13556:13558 Examples.Hacspec_lib <> len:110 var -R13546:13546 Examples.Hacspec_lib <> I:112 var -R13544:13544 Examples.Hacspec_lib <> L:111 var -binder 13536:13536 <> s:113 -binder 13563:13564 <> WS:114 -R13571:13574 Hacspec.ChoiceEquality <> both rec -R13582:13584 Hacspec.Hacspec_Lib_Pre <> int syndef -R13586:13587 Examples.Hacspec_lib <> WS:114 var -R13578:13578 Examples.Hacspec_lib <> I:112 var -R13576:13576 Examples.Hacspec_lib <> L:111 var -binder 13568:13568 <> i:115 -R13599:13602 Hacspec.ChoiceEquality <> both rec -R13608:13608 Examples.Hacspec_lib <> A:109 var -R13606:13606 Examples.Hacspec_lib <> I:112 var -R13604:13604 Examples.Hacspec_lib <> L:111 var -binder 13592:13596 <> new_v:116 -R13613:13616 Hacspec.ChoiceEquality <> both rec -R13623:13632 Hacspec.Hacspec_Lib_Pre <> :::'nseq' not -R13628:13628 Examples.Hacspec_lib <> A:109 var -R13630:13632 Examples.Hacspec_lib <> len:110 var -R13620:13620 Examples.Hacspec_lib <> I:112 var -R13618:13618 Examples.Hacspec_lib <> L:111 var -R13669:13689 Hacspec.Hacspec_Lib <> array_upd syndef -R13691:13691 Examples.Hacspec_lib <> s:113 var -R13693:13693 Examples.Hacspec_lib <> i:115 var -R13695:13699 Examples.Hacspec_lib <> new_v:116 var -R13753:13761 Examples.Hacspec_lib <> array_upd def -not 13733:13733 <> :::x_'.['_x_']<-'_x -syndef 14317:14321 <> t_Seq -R14326:14328 Hacspec.Hacspec_Lib_Pre <> seq def -syndef 14779:14794 <> num_exact_chunks -R14799:14818 Hacspec.Hacspec_Lib <> seq_num_exact_chunks def -syndef 14830:14844 <> get_exact_chunk -R14849:14867 Hacspec.Hacspec_Lib <> seq_get_exact_chunk def -syndef 15201:15219 <> get_remainder_chunk -R15224:15246 Hacspec.Hacspec_Lib <> seq_get_remainder_chunk def -R15271:15274 Hacspec.Hacspec_Lib <> negb def -R15277:15279 Hacspec.Hacspec_Lib <> eqb def -not 15258:15258 <> :::x_'<>'_x -syndef 15298:15316 <> from_secret_literal -R15321:15347 Hacspec.Hacspec_Lib <> nat_mod_from_secret_literal def -syndef 15922:15925 <> zero -R15930:15941 Hacspec.Hacspec_Lib <> nat_mod_zero def -syndef 15953:15966 <> to_byte_seq_le -R15971:15992 Hacspec.Hacspec_Lib <> nat_mod_to_byte_seq_le def -syndef 16004:16019 <> U128_to_le_bytes -R16024:16039 Hacspec.Hacspec_Lib <> u128_to_le_bytes def -syndef 16051:16065 <> U64_to_le_bytes -R16070:16084 Hacspec.Hacspec_Lib <> u64_to_le_bytes def -syndef 16101:16116 <> from_byte_seq_le -R16121:16144 Hacspec.Hacspec_Lib <> nat_mod_from_byte_seq_le def -def 16158:16169 <> from_literal -binder 16172:16172 <> m:117 -R16178:16197 Hacspec.Hacspec_Lib <> nat_mod_from_literal def -R16199:16199 Examples.Hacspec_lib <> m:117 var -syndef 16211:16213 <> inv -R16218:16228 Hacspec.Hacspec_Lib <> nat_mod_inv def -syndef 16240:16251 <> update_start -R16256:16273 Hacspec.Hacspec_Lib <> array_update_start def -syndef 16285:16287 <> pow -R16292:16307 Hacspec.Hacspec_Lib <> nat_mod_pow_self def -syndef 16319:16321 <> bit -R16326:16336 Hacspec.Hacspec_Lib <> nat_mod_bit def -syndef 16509:16520 <> Build_secret -R16525:16530 Hacspec.Hacspec_Lib <> secret syndef -R16525:16530 Hacspec.Hacspec_Lib <> secret syndef -R16556:16559 Coq.Init.Datatypes <> prod ind -not 16542:16542 <> ::hacspec_scope:x_'-×'_x -syndef 16627:16634 <> Result_t -R16639:16644 Hacspec.Hacspec_Lib_Pre <> result def -ax 16653:16661 <> TODO_name -syndef 16680:16682 <> ONE -R16687:16697 Hacspec.Hacspec_Lib <> nat_mod_one def -syndef 16709:16711 <> exp -R16716:16726 Hacspec.Hacspec_Lib <> nat_mod_exp def -syndef 17062:17064 <> TWO -R17069:17079 Hacspec.Hacspec_Lib <> nat_mod_two def -syndef 17091:17092 <> ne -binder 17102:17102 <> x:119 -binder 17104:17104 <> y:120 -R17109:17112 Hacspec.Hacspec_Lib <> negb def -R17115:17117 Hacspec.Hacspec_Lib <> eqb def -R17121:17121 Examples.Hacspec_lib <> y:120 var -R17119:17119 Examples.Hacspec_lib <> x:119 var -syndef 17135:17136 <> eq -R17142:17144 Hacspec.Hacspec_Lib <> eqb def -syndef 17157:17168 <> rotate_right -R17174:17176 Hacspec.Hacspec_Lib_Pre <> ror syndef -R17174:17176 Hacspec.Hacspec_Lib_Pre <> ror syndef -syndef 17189:17198 <> to_be_U32s -R17203:17221 Hacspec.Hacspec_Lib <> array_to_be_uint32s def -syndef 17233:17241 <> get_chunk -R17246:17258 Hacspec.Hacspec_Lib <> seq_get_chunk def -syndef 17270:17279 <> num_chunks -R17284:17297 Hacspec.Hacspec_Lib <> seq_num_chunks def -syndef 17309:17323 <> U64_to_be_bytes -R17328:17345 Hacspec.Hacspec_Lib <> uint64_to_be_bytes def -syndef 17357:17367 <> to_be_bytes -R17372:17388 Hacspec.Hacspec_Lib <> array_to_be_bytes def -syndef 17400:17412 <> U8_from_usize -R17417:17432 Hacspec.Hacspec_Lib <> uint8_from_usize def -syndef 17444:17449 <> concat -R17454:17463 Hacspec.Hacspec_Lib <> seq_concat def -syndef 17475:17484 <> declassify -R17489:17490 Coq.Init.Datatypes <> id def -syndef 17502:17519 <> U128_from_be_bytes -R17524:17544 Hacspec.Hacspec_Lib <> uint128_from_be_bytes def -syndef 17556:17571 <> U128_to_be_bytes -R17576:17594 Hacspec.Hacspec_Lib <> uint128_to_be_bytes def -syndef 17606:17616 <> slice_range -R17621:17637 Hacspec.Hacspec_Lib <> array_slice_range def -syndef 17649:17656 <> truncate -R17661:17672 Hacspec.Hacspec_Lib <> seq_truncate def -ax 17681:17699 <> array_to_be_uint64s -binder 17711:17711 <> A:121 -binder 17713:17713 <> l:122 -R17725:17728 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R17717:17724 Hacspec.Hacspec_Lib_Pre <> :::'nseq' not -R17722:17722 Examples.Hacspec_lib <> A:121 var -R17724:17724 Examples.Hacspec_lib <> l:122 var -R17729:17731 Hacspec.Hacspec_Lib_Pre <> seq def -R17733:17738 Hacspec.Hacspec_Lib_Pre <> uint64 syndef -syndef 17750:17759 <> to_be_U64s -R17764:17782 Examples.Hacspec_lib <> array_to_be_uint64s prfax -syndef 17794:17801 <> classify -R17806:17807 Coq.Init.Datatypes <> id def -syndef 17819:17829 <> U64_from_U8 -R17834:17850 Hacspec.Hacspec_Lib <> uint64_from_uint8 def -def 18031:18043 <> Build_t_Range -binder 18046:18047 <> WS:124 -binder 18049:18050 <> L1:125 -binder 18052:18053 <> L2:126 -binder 18055:18056 <> I1:127 -binder 18058:18059 <> I2:128 -R18067:18070 Hacspec.ChoiceEquality <> both rec -R18079:18081 Hacspec.Hacspec_Lib_Pre <> int syndef -R18083:18084 Examples.Hacspec_lib <> WS:124 var -R18075:18076 Examples.Hacspec_lib <> I1:127 var -R18072:18073 Examples.Hacspec_lib <> L1:125 var -binder 18063:18063 <> a:129 -R18093:18096 Hacspec.ChoiceEquality <> both rec -R18105:18107 Hacspec.Hacspec_Lib_Pre <> int syndef -R18109:18110 Examples.Hacspec_lib <> WS:124 var -R18101:18102 Examples.Hacspec_lib <> I2:128 var -R18098:18099 Examples.Hacspec_lib <> L2:126 var -binder 18089:18089 <> b:130 -R18117:18117 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not -R18119:18119 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not -R18121:18121 Coq.Init.Datatypes <> ::core_scope:'('_x_','_x_','_'..'_','_x_')' not -R18118:18118 Examples.Hacspec_lib <> a:129 var -R18120:18120 Examples.Hacspec_lib <> b:130 var -syndef 18133:18145 <> declassify_eq -R18150:18151 Examples.Hacspec_lib <> eq syndef -syndef 18163:18170 <> String_t -R18175:18187 Coq.Strings.String <> string ind -R18240:18243 Hacspec.ChoiceEquality <> both rec -R18256:18266 Crypt.package.pkg_notation PackageNotation ::package_scope:'['_'interface'_']' not -R18246:18249 extructures.fset <> fset def -R18251:18252 Coq.Lists.List ListNotations ::list_scope:'['_']' not -R18218:18225 Hacspec.ChoiceEquality <> ret_both def -R18232:18235 Hacspec.Hacspec_Lib_Pre <> int8 syndef -not 18200:18200 <> :::'i8('_x_')' -R18324:18327 Hacspec.ChoiceEquality <> both rec -R18340:18350 Crypt.package.pkg_notation PackageNotation ::package_scope:'['_'interface'_']' not -R18330:18333 extructures.fset <> fset def -R18335:18336 Coq.Lists.List ListNotations ::list_scope:'['_']' not -R18301:18308 Hacspec.ChoiceEquality <> ret_both def -R18315:18319 Hacspec.Hacspec_Lib_Pre <> int16 syndef -not 18282:18282 <> :::'i16('_x_')' -R18408:18411 Hacspec.ChoiceEquality <> both rec -R18424:18434 Crypt.package.pkg_notation PackageNotation ::package_scope:'['_'interface'_']' not -R18414:18417 extructures.fset <> fset def -R18419:18420 Coq.Lists.List ListNotations ::list_scope:'['_']' not -R18385:18392 Hacspec.ChoiceEquality <> ret_both def -R18399:18403 Hacspec.Hacspec_Lib_Pre <> int32 syndef -not 18366:18366 <> :::'i32('_x_')' -R18492:18495 Hacspec.ChoiceEquality <> both rec -R18508:18518 Crypt.package.pkg_notation PackageNotation ::package_scope:'['_'interface'_']' not -R18498:18501 extructures.fset <> fset def -R18503:18504 Coq.Lists.List ListNotations ::list_scope:'['_']' not -R18469:18476 Hacspec.ChoiceEquality <> ret_both def -R18483:18487 Hacspec.Hacspec_Lib_Pre <> int64 syndef -not 18450:18450 <> :::'i64('_x_')' -R18578:18581 Hacspec.ChoiceEquality <> both rec -R18594:18604 Crypt.package.pkg_notation PackageNotation ::package_scope:'['_'interface'_']' not -R18584:18587 extructures.fset <> fset def -R18589:18590 Coq.Lists.List ListNotations ::list_scope:'['_']' not -R18554:18561 Hacspec.ChoiceEquality <> ret_both def -R18568:18573 Hacspec.Hacspec_Lib_Pre <> int128 syndef -not 18534:18534 <> :::'i128('_x_')' -syndef 18621:18629 <> into_iter -binder 18639:18639 <> x:131 -R18644:18644 Examples.Hacspec_lib <> x:131 var diff --git a/ovn/proofs/ssprove/extraction/Hacspec_lib.v b/ovn/proofs/ssprove/extraction/Hacspec_lib.v index 6599048..1ee5131 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_lib.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_lib.v @@ -50,9 +50,7 @@ Program Definition int_xO {WS : wsize} (a : int WS) : int WS := (* Next Obligation. intros ; now rewrite fsetU0. Defined. *) (* Next Obligation. intros ; rewrite <- fset0E ; now rewrite fsetU0. Defined. *) -Definition both_int_one {WS : wsize} : both (fset []) ([interface]) (@int WS) := ret_both (L := fset []) (one). - -Compute (Hacspec_Lib_Pre.int_add (repr U32 3%Z) (repr U32 8%Z)). +Definition both_int_one {WS : wsize} : both (fset []) ([interface]) (@int WS) := ret_both (one). Open Scope hacspec_scope. Definition int_num {WS : wsize} := int WS. @@ -60,10 +58,6 @@ Number Notation int_num Pos.of_num_int Pos.to_num_int (via positive mapping [[in Notation "0" := (repr _ 0%Z) : hacspec_scope. -Check 5 : int8. -Check 3 : int8. -Check 8 : int8. - (* Notation U8_t := int8. *) (* Notation U8 := id. *) (* Notation U16_t := int16. *) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_lib.vo b/ovn/proofs/ssprove/extraction/Hacspec_lib.vo deleted file mode 100644 index a84e358eeff649e6d3129fa90e56663fdcc6fa9a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 123685 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 diff --git a/ovn/proofs/ssprove/extraction/Hacspec_lib.vok b/ovn/proofs/ssprove/extraction/Hacspec_lib.vok deleted file mode 100644 index e69de29..0000000 diff --git a/ovn/proofs/ssprove/extraction/Hacspec_lib.vos b/ovn/proofs/ssprove/extraction/Hacspec_lib.vos deleted file mode 100644 index e69de29..0000000 diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 19437a5..16caece 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -26,46 +26,57 @@ Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. (*Not implemented yet? todo(item)*) -Require Import Hacspec_lib. +Require Import (* Hacspec_ovn_ *)Hacspec_lib. +Export Hacspec_lib. (*Not implemented yet? todo(item)*) -Require Import Schnorr. +Require Import Hacspec_ovn_Schnorr. +Export Hacspec_ovn_Schnorr. Notation t_Secret := (t_Q). -Program Definition sample_uniform : both (fset []) ([interface ]) (t_Q) := - Build_t_Q i32(1). +Equations sample_uniform : both (fset []) ([interface ]) (t_Q) := + sample_uniform := + solve_lift (Build_t_Q (ret_both (1 : int32))) : both (fset []) ([interface ]) (t_Q). Fail Next Obligation. Notation t_public := (t_G). Notation t_public_key := ((t_G × (t_G × t_G × t_Q × t_Q))). -Program Definition p_i_init {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both (L1 :|: fset [commit_loc]) (I1) ((t_G × (t_G × t_G × t_Q × t_Q))) := - letb x := (sample_uniform) : both _ _ (t_Q) in - letb y := (Build_t_G i32(1)) : both _ _ (t_G) in - letb zkp := (fiat_shamir_run (prod_b (y,x))) : both _ _ ((t_G × t_G × t_Q × t_Q)) in - prod_b (y,zkp). +Equations p_i_init {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both (L1 :|: fset [commit_loc]) (I1) ((t_G × (t_G × t_G × t_Q × t_Q))) := + p_i_init _ := + letb x := (sample_uniform) : both _ _ (t_Q) in + letb y := (Build_t_G (ret_both (1 : int32))) : both _ _ (t_G) in + letb zkp := (fiat_shamir_run (prod_b (y,x))) : both _ _ ((t_G × t_G × t_Q × t_Q)) in + solve_lift (prod_b (y,zkp)) : both (L1 :|: fset [commit_loc]) (I1) ((t_G × (t_G × t_G × t_Q × t_Q))). Fail Next Obligation. +Definition t_N := nat_mod 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab. Notation t_pid := (t_N). -Require Import Std. (* as HashMap *) +Require Import HashMap. Notation t_public_keys := (t_HashMap (t_N) ((t_G × (t_G × t_G × t_Q × t_Q))) (t_RandomState)). -Program Definition p_i_construct {L1 : {fset Location}} {I1 : Interface} (m : both L1 I1 (t_HashMap (t_N) ((t_G × (t_G × t_G × t_Q × t_Q))) (t_RandomState))) : both (L1) (I1) ('unit) := - ret_both (tt : 'unit). +Equations p_i_construct {L1 : {fset Location}} {I1 : Interface} (m : both L1 I1 (t_HashMap (t_N) ((t_G × (t_G × t_G × t_Q × t_Q))) (t_RandomState))) : both (L1) (I1) ('unit) := + p_i_construct m := + solve_lift (ret_both (tt : 'unit)) : both (L1) (I1) ('unit). Fail Next Obligation. -Program Definition p_i_vote {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 ('bool)) : both (L1) (I1) (t_G) := - Build_t_G i32(1). +Require Import (* Hacspec_ovn_ *)Hacspec_lib. + + +Equations p_i_vote {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 ('bool)) : both (L1) (I1) (t_G) := + p_i_vote v := + solve_lift (Build_t_G (ret_both (1 : int32))) : both (L1) (I1) (t_G). Fail Next Obligation. -Program Definition exec {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 ('bool)) : both (L1 :|: fset [commit_loc]) (I1) (t_G) := - letb x := (sample_uniform) : both _ _ (t_Q) in - letb y := (Build_t_G i32(1)) : both _ _ (t_G) in - letb zkp := (fiat_shamir_run (prod_b (y,x))) : both _ _ ((t_G × t_G × t_Q × t_Q)) in - p_i_vote v. +Equations exec {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 ('bool)) : both (L1 :|: fset [commit_loc]) (I1) (t_G) := + exec v := + letb x := (sample_uniform) : both _ _ (t_Q) in + letb y := (Build_t_G (ret_both (1 : int32))) : both _ _ (t_G) in + letb zkp := (fiat_shamir_run (prod_b (y,x))) : both _ _ ((t_G × t_G × t_Q × t_Q)) in + solve_lift (p_i_vote v) : both (L1 :|: fset [commit_loc]) (I1) (t_G). Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.glob b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.glob deleted file mode 100644 index a2ada2d..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.glob +++ /dev/null @@ -1,31 +0,0 @@ -DIGEST 41711fa53f537116d9fcaa389f96befd -FExamples.Hacspec_ovn_Schnorr -R126:136 Crypt.choice_type <> <> lib -R138:144 Crypt.Package <> <> lib -R146:152 Crypt.Prelude <> <> lib -R162:176 Crypt.package.pkg_notation PackageNotation <> mod -R211:213 extructures.ord <> <> lib -R215:218 extructures.fset <> <> lib -R250:253 mathcomp.zify.ssrZ <> <> lib -R255:258 mathcomp.word.word <> <> lib -R288:291 Jasmin.word <> <> lib -R319:324 Coq.ZArith.ZArith <> <> lib -R351:364 Coq.Strings.String <> <> lib -R377:394 Coq.Lists.List ListNotations <> mod -R492:505 Hacspec.ChoiceEquality <> <> lib -R536:550 Hacspec.LocationUtility <> <> lib -R581:602 Hacspec.Hacspec_Lib_Comparable <> <> lib -R633:647 Hacspec.Hacspec_Lib_Pre <> <> lib -R678:688 Hacspec.Hacspec_Lib <> <> lib -R725:745 mathcomp.ssreflect.choice Choice.Exports <> mod -R833:843 Examples.Hacspec_lib <> <> lib -R862:864 Examples.Std <> <> lib -R937:969 Examples.Hacspec_ovn_Schnorr_Random_oracle <> <> lib -syndef 982:993 <> t_Transcript -R1017:1020 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R1010:1013 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R1003:1006 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R1000:1002 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R1007:1009 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R1014:1016 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def -R1021:1023 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v index 25eeecf..40681a3 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v @@ -24,54 +24,62 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Require Import Hacspec_lib. +Require Import (* Hacspec_ovn_ *)Hacspec_lib. +Export Hacspec_lib. -Require Import Std. (* as HashMap *) +Require Import HashMap. (*Not implemented yet? todo(item)*) Require Import Hacspec_ovn_Schnorr_Random_oracle. +Export Hacspec_ovn_Schnorr_Random_oracle. Notation t_Transcript := ((t_G × t_G × t_Q × t_Q)). -Program Definition prod_assoc {L1 : {fset Location}} {I1 : Interface} (sm : both L1 I1 ((t_G × t_G))) : both (L1) (I1) (t_Q) := - letb '(statement,message) := (sm) : both _ _ ((t_G × t_G)) in - Build_t_Q i32(1). +Equations prod_assoc {L1 : {fset Location}} {I1 : Interface} (sm : both L1 I1 ((t_G × t_G))) : both (L1) (I1) (t_Q) := + prod_assoc sm := + letb '(statement,message) := (sm) : both _ _ ((t_G × t_G)) in + solve_lift (Build_t_Q (ret_both (1 : int32))) : both (L1) (I1) (t_Q). Fail Next Obligation. -Program Definition verify {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (h : both L1 I1 (t_G)) (a : both L2 I2 (t_G)) (e : both L3 I3 (t_Q)) (z : both L4 I4 (t_Q)) : both (L1:|:L2:|:L3:|:L4) (I1:|:I2:|:I3:|:I4) ('bool) := - false. +Equations verify {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (h : both L1 I1 (t_G)) (a : both L2 I2 (t_G)) (e : both L3 I3 (t_Q)) (z : both L4 I4 (t_Q)) : both (L1:|:L2:|:L3:|:L4) (I1:|:I2:|:I3:|:I4) ('bool) := + verify h a e z := + solve_lift (ret_both (false : 'bool)) : both (L1:|:L2:|:L3:|:L4) (I1:|:I2:|:I3:|:I4) ('bool). Fail Next Obligation. -Program Definition fiat_shamir_verify {L1 : {fset Location}} {I1 : Interface} (t : both L1 I1 ((t_G × t_G × t_Q × t_Q))) : both (L1) (I1) ('bool) := - letb QUERIES := (new_under_impl) : both _ _ (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState)) in - letb '(h,a,e,z) := (t) : both _ _ ((t_G × t_G × t_Q × t_Q)) in - letb '(QUERIES,eu) := (random_oracle_query QUERIES (prod_assoc (prod_b (h,a)))) : both _ _ ((t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState) × (t_G × t_G))) in - verify h a e z. +Equations fiat_shamir_verify {L1 : {fset Location}} {I1 : Interface} (t : both L1 I1 ((t_G × t_G × t_Q × t_Q))) : both (L1) (I1) ('bool) := + fiat_shamir_verify t := + letb QUERIES := (new(* _under_impl *)) : both _ _ (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState)) in + letb '(h,a,e,z) := (t) : both _ _ ((t_G × t_G × t_Q × t_Q)) in + letb '(QUERIES,eu) := (random_oracle_query QUERIES (prod_assoc (prod_b (h,a)))) : both _ _ ((t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState) × (t_G × t_G))) in + solve_lift (verify h a e z) : both (L1) (I1) ('bool). Fail Next Obligation. Notation t_Relation := ((t_G × t_Q)). Definition commit_loc : Location := ((t_G × t_G) ; 0%nat). -Program Definition v_Commit {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (h : both L1 I1 (t_G)) (w : both L2 I2 (t_Q)) : both (L1:|:L2 :|: fset [commit_loc]) (I1:|:I2) (t_G) := - letb r := (sample_uniform) : both _ _ ((t_G × t_G)) in - letbm commit loc(commit_loc) := (r) : both _ _ ((t_G × t_G)) in - Build_t_G i32(1). +Equations v_Commit {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (h : both L1 I1 (t_G)) (w : both L2 I2 (t_Q)) : both (L1:|:L2 :|: fset [commit_loc]) (I1:|:I2) (t_G) := + v_Commit h w := + letb r := (sample_uniform) : both _ _ ((t_G × t_G)) in + letbm commit loc(commit_loc) := (r) : both _ _ ((t_G × t_G)) in + solve_lift (Build_t_G (ret_both (1 : int32))) : both (L1:|:L2 :|: fset [commit_loc]) (I1:|:I2) (t_G). Fail Next Obligation. -Program Definition v_Response {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (h : both L1 I1 (t_G)) (w : both L2 I2 (t_Q)) (a : both L3 I3 (t_G)) (e : both L4 I4 (t_Q)) : both (L1:|:L2:|:L3:|:L4) (I1:|:I2:|:I3:|:I4) (t_Q) := - Build_t_Q i32(1). +Equations v_Response {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (h : both L1 I1 (t_G)) (w : both L2 I2 (t_Q)) (a : both L3 I3 (t_G)) (e : both L4 I4 (t_Q)) : both (L1:|:L2:|:L3:|:L4) (I1:|:I2:|:I3:|:I4) (t_Q) := + v_Response h w a e := + solve_lift (Build_t_Q (ret_both (1 : int32))) : both (L1:|:L2:|:L3:|:L4) (I1:|:I2:|:I3:|:I4) (t_Q). Fail Next Obligation. -Program Definition fiat_shamir_run {L1 : {fset Location}} {I1 : Interface} (hw : both L1 I1 ((t_G × t_Q))) : both (L1 :|: fset [commit_loc]) (I1) ((t_G × t_G × t_Q × t_Q)) := - letb QUERIES := (new_under_impl) : both _ _ (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState)) in - letb '(h,w) := (hw) : both _ _ ((t_G × t_Q)) in - letb a := (v_Commit h w) : both _ _ (t_G) in - letb 'tt := (random_oracle_init (ret_both (tt : 'unit))) : both _ _ ('unit) in - letb _ := (ret_both (tt : 'unit)) : both _ _ ('unit) in - letb '(QUERIES,eu) := (random_oracle_query QUERIES (prod_assoc (prod_b (h,a)))) : both _ _ ((t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState) × (t_G × t_G))) in - letb e := (Build_t_Q i32(1)) : both _ _ (t_Q) in - letb z := (v_Response h w a e) : both _ _ (t_Q) in - prod_b (h,a,e,z). +Equations fiat_shamir_run {L1 : {fset Location}} {I1 : Interface} (hw : both L1 I1 ((t_G × t_Q))) : both (L1 :|: fset [commit_loc]) (I1) ((t_G × t_G × t_Q × t_Q)) := + fiat_shamir_run hw := + letb QUERIES := (new) : both _ _ (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState)) in + letb '(h,w) := (hw) : both _ _ ((t_G × t_Q)) in + letb a := (v_Commit h w) : both _ _ (t_G) in + letb '{| both_prog := {| is_pure := tt |} |} := (random_oracle_init (ret_both (tt : 'unit))) : both _ _ ('unit) in + letb _ := (ret_both (tt : 'unit)) : both _ _ ('unit) in + letb '(QUERIES,eu) := (random_oracle_query QUERIES (prod_assoc (prod_b (h,a)))) : both _ _ ((t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState) × (t_G × t_G))) in + letb e := (Build_t_Q (ret_both (1 : int32))) : both _ _ (t_Q) in + letb z := (v_Response h w a e) : both _ _ (t_Q) in + solve_lift (prod_b (h,a,e,z)) : both (L1 :|: fset [commit_loc]) (I1) ((t_G × t_G × t_Q × t_Q)). Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.glob b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.glob deleted file mode 100644 index 07c11be..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.glob +++ /dev/null @@ -1,247 +0,0 @@ -DIGEST ebf35470edb32d87446cf29c011d7916 -FExamples.Hacspec_ovn_Schnorr_Random_oracle -R126:136 Crypt.choice_type <> <> lib -R138:144 Crypt.Package <> <> lib -R146:152 Crypt.Prelude <> <> lib -R162:176 Crypt.package.pkg_notation PackageNotation <> mod -R211:213 extructures.ord <> <> lib -R215:218 extructures.fset <> <> lib -R250:253 mathcomp.zify.ssrZ <> <> lib -R255:258 mathcomp.word.word <> <> lib -R288:291 Jasmin.word <> <> lib -R319:324 Coq.ZArith.ZArith <> <> lib -R351:364 Coq.Strings.String <> <> lib -R377:394 Coq.Lists.List ListNotations <> mod -R492:505 Hacspec.ChoiceEquality <> <> lib -R536:550 Hacspec.LocationUtility <> <> lib -R581:602 Hacspec.Hacspec_Lib_Comparable <> <> lib -R633:647 Hacspec.Hacspec_Lib_Pre <> <> lib -R678:688 Hacspec.Hacspec_Lib <> <> lib -R725:745 mathcomp.ssreflect.choice Choice.Exports <> mod -R833:843 Examples.Hacspec_lib <> <> lib -def 866:883 <> random_oracle_init -R891:896 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R905:905 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R897:904 Crypt.package.pkg_core_definition <> Location def -binder 886:887 <> L1:1 -R914:922 Crypt.package.pkg_core_definition <> Interface def -binder 909:910 <> I1:2 -R930:933 Hacspec.ChoiceEquality <> both rec -R942:946 Crypt.package.pkg_notation PackageNotation ::package_scope:'''unit' not -R938:939 Examples.Hacspec_ovn_Schnorr_Random_oracle <> I1:2 var -R935:936 Examples.Hacspec_ovn_Schnorr_Random_oracle <> L1:1 var -R952:955 Hacspec.ChoiceEquality <> both rec -R968:972 Crypt.package.pkg_notation PackageNotation ::package_scope:'''unit' not -R963:964 Examples.Hacspec_ovn_Schnorr_Random_oracle <> I1:2 var -R958:959 Examples.Hacspec_ovn_Schnorr_Random_oracle <> L1:1 var -R980:987 Hacspec.ChoiceEquality <> ret_both def -R995:999 Crypt.package.pkg_notation PackageNotation ::package_scope:'''unit' not -R990:991 Coq.Init.Datatypes <> tt constr -def 1037:1039 <> t_G -R1043:1053 Crypt.choice_type <> choice_type ind -R1061:1065 Hacspec.Hacspec_Lib_Pre <> int32 syndef -def 1079:1087 <> Build_t_G -R1094:1099 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R1108:1108 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R1100:1107 Crypt.package.pkg_core_definition <> Location def -binder 1090:1090 <> L:3 -R1116:1124 Crypt.package.pkg_core_definition <> Interface def -binder 1112:1112 <> I:4 -R1134:1137 Hacspec.ChoiceEquality <> both rec -R1144:1148 Hacspec.Hacspec_Lib_Pre <> int32 syndef -R1141:1141 Examples.Hacspec_ovn_Schnorr_Random_oracle <> I:4 var -R1139:1139 Examples.Hacspec_ovn_Schnorr_Random_oracle <> L:3 var -binder 1128:1130 <> f_v:5 -R1154:1157 Hacspec.ChoiceEquality <> both rec -R1164:1166 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R1174:1182 Examples.Hacspec_ovn_Schnorr_Random_oracle <> Build_t_G:8 def -R1184:1186 Examples.Hacspec_ovn_Schnorr_Random_oracle <> f_v:7 var -R1256:1259 Hacspec.ChoiceEquality <> both rec -R1266:1268 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R1196:1204 Hacspec.ChoiceEquality <> bind_both def -binder 1215:1217 <> f_v:9 -R1228:1235 Hacspec.ChoiceEquality <> ret_both def -R1247:1249 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R1239:1241 Examples.Hacspec_ovn_Schnorr_Random_oracle <> f_v:9 var -def 1306:1308 <> t_Q -R1312:1322 Crypt.choice_type <> choice_type ind -R1330:1334 Hacspec.Hacspec_Lib_Pre <> int32 syndef -def 1348:1356 <> Build_t_Q -R1363:1368 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R1377:1377 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R1369:1376 Crypt.package.pkg_core_definition <> Location def -binder 1359:1359 <> L:10 -R1385:1393 Crypt.package.pkg_core_definition <> Interface def -binder 1381:1381 <> I:11 -R1403:1406 Hacspec.ChoiceEquality <> both rec -R1413:1417 Hacspec.Hacspec_Lib_Pre <> int32 syndef -R1410:1410 Examples.Hacspec_ovn_Schnorr_Random_oracle <> I:11 var -R1408:1408 Examples.Hacspec_ovn_Schnorr_Random_oracle <> L:10 var -binder 1397:1399 <> f_v:12 -R1423:1426 Hacspec.ChoiceEquality <> both rec -R1433:1435 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def -R1443:1451 Examples.Hacspec_ovn_Schnorr_Random_oracle <> Build_t_Q:15 def -R1453:1455 Examples.Hacspec_ovn_Schnorr_Random_oracle <> f_v:14 var -R1525:1528 Hacspec.ChoiceEquality <> both rec -R1535:1537 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def -R1465:1473 Hacspec.ChoiceEquality <> bind_both def -binder 1484:1486 <> f_v:16 -R1497:1504 Hacspec.ChoiceEquality <> ret_both def -R1516:1518 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def -R1508:1510 Examples.Hacspec_ovn_Schnorr_Random_oracle <> f_v:16 var -syndef 1573:1581 <> t_Witness -R1587:1589 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def -syndef 1603:1613 <> t_Statement -R1619:1621 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -syndef 1635:1643 <> t_Message -R1649:1651 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -syndef 1665:1675 <> t_Challenge -R1681:1683 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def -syndef 1697:1706 <> t_Response -R1712:1714 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def -syndef 1728:1735 <> t_Random -R1745:1748 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R1742:1744 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R1749:1751 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -syndef 1766:1772 <> t_Query -R1778:1780 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def -def 1804:1817 <> sample_uniform -R1821:1824 Hacspec.ChoiceEquality <> both rec -R1856:1859 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R1853:1855 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R1860:1862 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R1837:1848 Crypt.package.pkg_notation PackageNotation ::package_scope:'['_'interface'_']' not -R1827:1830 extructures.fset <> fset def -R1832:1833 Coq.Lists.List ListNotations ::list_scope:'['_']' not -R1871:1878 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b'_'('_x_','_x_','_'..'_','_x_')' not -R1895:1895 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b'_'('_x_','_x_','_'..'_','_x_')' not -R1912:1912 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b'_'('_x_','_x_','_'..'_','_x_')' not -R1879:1887 Examples.Hacspec_ovn_Schnorr_Random_oracle <> Build_t_G def -R1889:1892 Examples.Hacspec_lib <> :::'i32('_x_')' not -R1894:1894 Examples.Hacspec_lib <> :::'i32('_x_')' not -R1896:1904 Examples.Hacspec_ovn_Schnorr_Random_oracle <> Build_t_G def -R1906:1909 Examples.Hacspec_lib <> :::'i32('_x_')' not -R1911:1911 Examples.Hacspec_lib <> :::'i32('_x_')' not -R1953:1955 Examples.Std <> <> lib -def 1995:2013 <> random_oracle_query -R2021:2026 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R2035:2035 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R2027:2034 Crypt.package.pkg_core_definition <> Location def -binder 2016:2017 <> L1:17 -R2044:2049 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R2058:2058 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not -R2050:2057 Crypt.package.pkg_core_definition <> Location def -binder 2039:2040 <> L2:18 -R2067:2075 Crypt.package.pkg_core_definition <> Interface def -binder 2062:2063 <> I1:19 -R2084:2092 Crypt.package.pkg_core_definition <> Interface def -binder 2079:2080 <> I2:20 -R2106:2109 Hacspec.ChoiceEquality <> both rec -R2118:2126 Examples.Std <> t_HashMap def -R2129:2131 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def -R2139:2142 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R2136:2138 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R2143:2145 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R2150:2162 Examples.Std <> t_RandomState constr -R2114:2115 Examples.Hacspec_ovn_Schnorr_Random_oracle <> I1:19 var -R2111:2112 Examples.Hacspec_ovn_Schnorr_Random_oracle <> L1:17 var -binder 2096:2102 <> QUERIES:21 -R2172:2175 Hacspec.ChoiceEquality <> both rec -R2184:2186 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def -R2180:2181 Examples.Hacspec_ovn_Schnorr_Random_oracle <> I2:20 var -R2177:2178 Examples.Hacspec_ovn_Schnorr_Random_oracle <> L2:18 var -binder 2168:2168 <> q:22 -R2192:2195 Hacspec.ChoiceEquality <> both rec -R2265:2269 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R2280:2280 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R2219:2227 Examples.Std <> t_HashMap def -R2230:2232 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def -R2240:2243 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R2237:2239 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R2244:2246 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R2251:2263 Examples.Std <> t_RandomState constr -R2273:2276 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R2270:2272 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R2277:2279 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R2210:2212 extructures.fset <> ::fset_scope:x_':|:'_x not -R2208:2209 Examples.Hacspec_ovn_Schnorr_Random_oracle <> I1:19 var -R2213:2214 Examples.Hacspec_ovn_Schnorr_Random_oracle <> I2:20 var -R2200:2202 extructures.fset <> ::fset_scope:x_':|:'_x not -R2198:2199 Examples.Hacspec_ovn_Schnorr_Random_oracle <> L1:17 var -R2203:2204 Examples.Hacspec_ovn_Schnorr_Random_oracle <> L2:18 var -R2289:2295 Hacspec.Hacspec_Lib <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'Option_None'_'=>'_x_'end' not -R2309:2330 Hacspec.Hacspec_Lib <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'Option_None'_'=>'_x_'end' not -R2332:2335 Hacspec.Hacspec_Lib <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'Option_None'_'=>'_x_'end' not -R2366:2386 Hacspec.Hacspec_Lib <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'Option_None'_'=>'_x_'end' not -R2790:2793 Hacspec.Hacspec_Lib <> :::'matchb'_x_'with'_'|'_'Option_Some'_x_'=>'_x_'|'_'Option_None'_'=>'_x_'end' not -R2296:2298 Examples.Std <> get prfax -R2308:2308 Examples.Hacspec_ovn_Schnorr_Random_oracle <> q:22 var -R2300:2306 Examples.Hacspec_ovn_Schnorr_Random_oracle <> QUERIES:21 var -binder 2331:2331 <> r:23 -R2336:2343 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b'_'('_x_','_x_','_'..'_','_x_')' not -R2357:2357 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b'_'('_x_','_x_','_'..'_','_x_')' not -R2365:2365 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b'_'('_x_','_x_','_'..'_','_x_')' not -R2344:2348 Examples.Core <> clone syndef -R2350:2356 Examples.Hacspec_ovn_Schnorr_Random_oracle <> QUERIES:21 var -R2358:2362 Examples.Core <> clone syndef -R2364:2364 Examples.Hacspec_ovn_Schnorr_Random_oracle <> r:23 var -R2387:2391 Hacspec.ChoiceEquality <> :::'letb'_x_':='_x_'in'_x not -R2393:2396 Hacspec.ChoiceEquality <> :::'letb'_x_':='_x_'in'_x not -R2439:2446 Hacspec.ChoiceEquality <> :::'letb'_x_':='_x_'in'_x not -R2416:2419 Hacspec.ChoiceEquality <> both rec -R2430:2433 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R2427:2429 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R2434:2436 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R2398:2411 Examples.Hacspec_ovn_Schnorr_Random_oracle <> sample_uniform def -binder 2392:2392 <> r:24 -binder 2392:2392 <> r:25 -R2447:2453 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R2468:2468 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R2481:2485 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R2595:2602 Hacspec.ChoiceEquality <> :::'letb'_''''_'('_x_','_x_')'_':='_x_'in'_x not -R2509:2512 Hacspec.ChoiceEquality <> both rec -R2543:2546 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R2520:2527 Examples.Core <> t_Option def -R2534:2537 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R2531:2533 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R2538:2540 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R2547:2555 Examples.Std <> t_HashMap def -R2558:2560 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def -R2568:2571 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R2565:2567 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R2572:2574 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R2579:2591 Examples.Std <> t_RandomState constr -R2487:2492 Examples.Std <> insert prfax -R2504:2504 Examples.Hacspec_ovn_Schnorr_Random_oracle <> r:24 var -R2502:2502 Examples.Hacspec_ovn_Schnorr_Random_oracle <> q:22 var -R2494:2500 Examples.Hacspec_ovn_Schnorr_Random_oracle <> QUERIES:21 var -binder 2454:2467 <> todo_fresh_var:26 -binder 2469:2480 <> QUERIES_temp:27 -R2603:2607 Hacspec.ChoiceEquality <> :::'letb'_x_':='_x_'in'_x not -R2615:2618 Hacspec.ChoiceEquality <> :::'letb'_x_':='_x_'in'_x not -R2693:2700 Hacspec.ChoiceEquality <> :::'letb'_x_':='_x_'in'_x not -R2636:2639 Hacspec.ChoiceEquality <> both rec -R2646:2654 Examples.Std <> t_HashMap def -R2657:2659 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_Q def -R2667:2670 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R2664:2666 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R2671:2673 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R2678:2690 Examples.Std <> t_RandomState constr -R2620:2631 Examples.Hacspec_ovn_Schnorr_Random_oracle <> QUERIES_temp:27 var -binder 2608:2614 <> QUERIES:28 -binder 2608:2614 <> QUERIES:29 -R2701:2705 Hacspec.ChoiceEquality <> :::'letb'_x_':='_x_'in'_x not -R2707:2710 Hacspec.ChoiceEquality <> :::'letb'_x_':='_x_'in'_x not -R2764:2771 Hacspec.ChoiceEquality <> :::'letb'_x_':='_x_'in'_x not -R2730:2733 Hacspec.ChoiceEquality <> both rec -R2740:2747 Examples.Core <> t_Option def -R2754:2757 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R2751:2753 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R2758:2760 Examples.Hacspec_ovn_Schnorr_Random_oracle <> t_G def -R2712:2725 Examples.Hacspec_ovn_Schnorr_Random_oracle <> todo_fresh_var:26 var -binder 2706:2706 <> pat:30 -R2772:2779 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b'_'('_x_','_x_','_'..'_','_x_')' not -R2787:2787 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b'_'('_x_','_x_','_'..'_','_x_')' not -R2789:2789 Hacspec.ChoiceEquality <> ::hacspec_scope:'prod_b'_'('_x_','_x_','_'..'_','_x_')' not -R2780:2786 Examples.Hacspec_ovn_Schnorr_Random_oracle <> QUERIES:28 var -R2788:2788 Examples.Hacspec_ovn_Schnorr_Random_oracle <> r:24 var diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v index 9f74708..1034c3d 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v @@ -24,10 +24,12 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Require Import Hacspec_lib. +Require Import (* Hacspec_ovn_ *)Hacspec_lib. +Export (* Hacspec_ovn_ *)Hacspec_lib. -Program Definition random_oracle_init {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both (L1) (I1) ('unit) := - ret_both (tt : 'unit). +Equations random_oracle_init {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both (L1) (I1) ('unit) := + random_oracle_init _ := + solve_lift (ret_both (tt : 'unit)) : both (L1) (I1) ('unit). Fail Next Obligation. Definition t_G : choice_type := @@ -35,7 +37,7 @@ Definition t_G : choice_type := Equations Build_t_G {L : {fset Location}} {I : Interface} (f_v : both L I (int32)) : both L I (t_G) := Build_t_G f_v := bind_both f_v (fun f_v => - ret_both ((f_v) : (t_G))) : both L I (t_G). + solve_lift (ret_both ((f_v) : (t_G)))) : both L I (t_G). Fail Next Obligation. Definition t_Q : choice_type := @@ -43,7 +45,7 @@ Definition t_Q : choice_type := Equations Build_t_Q {L : {fset Location}} {I : Interface} (f_v : both L I (int32)) : both L I (t_Q) := Build_t_Q f_v := bind_both f_v (fun f_v => - ret_both ((f_v) : (t_Q))) : both L I (t_Q). + solve_lift (ret_both ((f_v) : (t_Q)))) : both L I (t_Q). Fail Next Obligation. Notation t_Witness := (t_Q). @@ -60,19 +62,25 @@ Notation t_Random := ((t_G × t_G)). Notation t_Query := (t_Q). -Program Definition sample_uniform : both (fset []) ([interface ]) ((t_G × t_G)) := - prod_b (Build_t_G i32(1),Build_t_G i32(1)). +Equations sample_uniform : both (fset []) ([interface ]) ((t_G × t_G)) := + sample_uniform := + solve_lift (prod_b (Build_t_G (ret_both (1 : int32)),Build_t_G (ret_both (1 : int32)))) : both (fset []) ([interface ]) ((t_G × t_G)). Fail Next Obligation. -Require Import Std. (* as HashMap *) - -Program Definition random_oracle_query {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (QUERIES : both L1 I1 (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState))) (q : both L2 I2 (t_Q)) : both (L1:|:L2) (I1:|:I2) ((t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState) × (t_G × t_G))) := - match get_under_impl_2 QUERIES q with - | Option_Some r => prod_b (clone QUERIES,clone r) - | Option_None => letb r := (sample_uniform) : both _ _ ((t_G × t_G)) in - letb '(todo_fresh_var,QUERIES_temp) := (insert_under_impl_2 QUERIES q r) : both _ _ ((t_Option ((t_G × t_G)) × t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState))) in - letb QUERIES := (QUERIES_temp) : both _ _ (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState)) in - letb _ := (todo_fresh_var) : both _ _ (t_Option ((t_G × t_G))) in - prod_b (QUERIES,r) - end. +Require Import HashMap. + +Notation t_QueriesType := (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState)). + +Equations random_oracle_query {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (QUERIES : both L1 I1 (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState))) (q : both L2 I2 (t_Q)) : both (L1:|:L2) (I1:|:I2) ((t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState) × (t_G × t_G))) := + random_oracle_query QUERIES q := + solve_lift matchb get QUERIES q with + | Option_Some r => + prod_b (clone QUERIES,clone r) + | Option_None => + letb r := (sample_uniform) : both _ _ ((t_G × t_G)) in + letb '(todo_fresh_var,QUERIES_temp) := (insert QUERIES q r) : both _ _ ((t_Option ((t_G × t_G)) × t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState))) in + letb QUERIES := (QUERIES_temp) : both _ _ (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState)) in + letb _ := (todo_fresh_var) : both _ _ (t_Option ((t_G × t_G))) in + prod_b (QUERIES,r) + end : both (L1:|:L2) (I1:|:I2) ((t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState) × (t_G × t_G))). Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.vo b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.vo deleted file mode 100644 index 7804990fce33771a8bc3c0e93aea26eb6fbab85f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 268530 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 X5!Pv1nQz!{m&qQ;X9lpLCgT4CoZ23g diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.vok b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.vok deleted file mode 100644 index e69de29..0000000 diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.vos b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.vos deleted file mode 100644 index e69de29..0000000 diff --git a/ovn/proofs/ssprove/extraction/Std.v b/ovn/proofs/ssprove/extraction/HashMap.v similarity index 95% rename from ovn/proofs/ssprove/extraction/Std.v rename to ovn/proofs/ssprove/extraction/HashMap.v index ac7f4e2..0a2a0c3 100644 --- a/ovn/proofs/ssprove/extraction/Std.v +++ b/ovn/proofs/ssprove/extraction/HashMap.v @@ -48,3 +48,5 @@ Definition t_HashMap A B (_ : random_state) := chMap A B. Axiom insert : forall {L1 L2 L3 I1 I2 I3 A B}, both L1 I1 (t_HashMap A B t_RandomState) -> both L2 I2 A -> both L3 I3 B -> both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_Option B × t_HashMap A B t_RandomState). Axiom get : forall {L1 L2 I1 I2 A B}, both L1 I1 (t_HashMap A B t_RandomState) -> both L2 I2 A -> both (L1 :|: L2) (I1 :|: I2) (t_Option B). +Axiom new : forall {L I A B}, both L I (t_HashMap A B t_RandomState). + diff --git a/ovn/proofs/ssprove/extraction/Makefile.conf b/ovn/proofs/ssprove/extraction/Makefile.conf index d64abfe..d8d1fdb 100644 --- a/ovn/proofs/ssprove/extraction/Makefile.conf +++ b/ovn/proofs/ssprove/extraction/Makefile.conf @@ -8,7 +8,7 @@ # # ############################################################################### -COQMF_VFILES = Hacspec_lib.v Core.v Std.v Hacspec_ovn_Schnorr_Random_oracle.v Hacspec_ovn_Schnorr.v Hacspec_ovn.v +COQMF_VFILES = Hacspec_lib.v Core.v HashMap.v Hacspec_ovn_Schnorr_Random_oracle.v Hacspec_ovn_Schnorr.v Hacspec_ovn.v COQMF_MLIFILES = COQMF_MLFILES = COQMF_MLGFILES = diff --git a/ovn/proofs/ssprove/extraction/Std.glob b/ovn/proofs/ssprove/extraction/Std.glob deleted file mode 100644 index c414e40..0000000 --- a/ovn/proofs/ssprove/extraction/Std.glob +++ /dev/null @@ -1,113 +0,0 @@ -DIGEST da4b43ceb41a55c830a2111ff36e5a15 -FExamples.Std -R74:84 Hacspec.Hacspec_Lib <> <> lib -R112:117 Coq.ZArith.ZArith <> <> lib -R127:144 Coq.Lists.List ListNotations <> mod -R206:208 Coq.micromega.Lia <> <> lib -R226:259 Coq.Logic.FunctionalExtensionality <> <> lib -R277:283 Coq.Bool.Sumbool <> <> lib -R316:322 mathcomp.ssreflect.fintype <> <> lib -R352:362 Crypt.choice_type <> <> lib -R364:370 Crypt.Package <> <> lib -R372:378 Crypt.Prelude <> <> lib -R388:402 Crypt.package.pkg_notation PackageNotation <> mod -R437:439 extructures.ord <> <> lib -R441:444 extructures.fset <> <> lib -R446:449 extructures.fmap <> <> lib -R482:485 mathcomp.zify.ssrZ <> <> lib -R487:490 mathcomp.word.word <> <> lib -R520:523 Jasmin.word <> <> lib -R551:556 Coq.ZArith.ZArith <> <> lib -R558:561 Coq.Lists.List <> <> lib -R571:583 Coq.Lists.List ListNotations <> mod -R615:628 Hacspec.ChoiceEquality <> <> lib -R659:673 Hacspec.LocationUtility <> <> lib -R704:725 Hacspec.Hacspec_Lib_Comparable <> <> lib -R756:770 Hacspec.Hacspec_Lib_Pre <> <> lib -R801:811 Hacspec.Hacspec_Lib <> <> lib -R970:990 mathcomp.ssreflect.choice Choice.Exports <> mod -R1009:1012 Examples.Core <> <> lib -R1022:1025 Examples.Core <> <> mod -ind 1039:1050 <> random_state -constr 1057:1069 <> t_RandomState -def 1083:1091 <> t_HashMap -binder 1093:1093 <> A:3 -binder 1095:1095 <> B:4 -R1102:1113 Examples.Std <> random_state ind -R1119:1123 Crypt.choice_type <> chMap constr -R1125:1125 Examples.Std <> A:3 var -R1127:1127 Examples.Std <> B:4 var -ax 1137:1142 <> insert -binder 1154:1155 <> L1:5 -binder 1157:1158 <> L2:6 -binder 1160:1161 <> L3:7 -binder 1163:1164 <> I1:8 -binder 1166:1167 <> I2:9 -binder 1169:1170 <> I3:10 -binder 1172:1172 <> A:11 -binder 1174:1174 <> B:12 -R1218:1221 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R1178:1181 Hacspec.ChoiceEquality <> both rec -R1190:1198 Examples.Std <> t_HashMap def -R1200:1200 Examples.Std <> A:11 var -R1202:1202 Examples.Std <> B:12 var -R1204:1216 Examples.Std <> t_RandomState constr -R1186:1187 Examples.Std <> I1:8 var -R1183:1184 Examples.Std <> L1:5 var -R1234:1237 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R1222:1225 Hacspec.ChoiceEquality <> both rec -R1233:1233 Examples.Std <> A:11 var -R1230:1231 Examples.Std <> I2:9 var -R1227:1228 Examples.Std <> L2:6 var -R1250:1253 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R1238:1241 Hacspec.ChoiceEquality <> both rec -R1249:1249 Examples.Std <> B:12 var -R1246:1247 Examples.Std <> I3:10 var -R1243:1244 Examples.Std <> L3:7 var -R1254:1257 Hacspec.ChoiceEquality <> both rec -R1308:1311 Crypt.package.pkg_notation PackageNotation ::package_scope:x_'×'_x not -R1298:1305 Examples.Core <> t_Option def -R1307:1307 Examples.Std <> B:12 var -R1312:1320 Examples.Std <> t_HashMap def -R1322:1322 Examples.Std <> A:11 var -R1324:1324 Examples.Std <> B:12 var -R1326:1338 Examples.Std <> t_RandomState constr -R1288:1292 extructures.fset <> ::fset_scope:x_':|:'_x not -R1281:1285 extructures.fset <> ::fset_scope:x_':|:'_x not -R1279:1280 Examples.Std <> I1:8 var -R1286:1287 Examples.Std <> I2:9 var -R1293:1294 Examples.Std <> I3:10 var -R1269:1273 extructures.fset <> ::fset_scope:x_':|:'_x not -R1262:1266 extructures.fset <> ::fset_scope:x_':|:'_x not -R1260:1261 Examples.Std <> L1:5 var -R1267:1268 Examples.Std <> L2:6 var -R1274:1275 Examples.Std <> L3:7 var -ax 1348:1350 <> get -binder 1363:1364 <> L1:14 -binder 1366:1367 <> L2:15 -binder 1369:1370 <> I1:16 -binder 1372:1373 <> I2:17 -binder 1375:1375 <> A:18 -binder 1377:1377 <> B:19 -R1421:1424 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R1381:1384 Hacspec.ChoiceEquality <> both rec -R1393:1401 Examples.Std <> t_HashMap def -R1403:1403 Examples.Std <> A:18 var -R1405:1405 Examples.Std <> B:19 var -R1407:1419 Examples.Std <> t_RandomState constr -R1389:1390 Examples.Std <> I1:16 var -R1386:1387 Examples.Std <> L1:14 var -R1437:1440 Coq.Init.Logic <> ::type_scope:x_'->'_x not -R1425:1428 Hacspec.ChoiceEquality <> both rec -R1436:1436 Examples.Std <> A:18 var -R1433:1434 Examples.Std <> I2:17 var -R1430:1431 Examples.Std <> L2:15 var -R1441:1444 Hacspec.ChoiceEquality <> both rec -R1471:1478 Examples.Core <> t_Option def -R1480:1480 Examples.Std <> B:19 var -R1461:1465 extructures.fset <> ::fset_scope:x_':|:'_x not -R1459:1460 Examples.Std <> I1:16 var -R1466:1467 Examples.Std <> I2:17 var -R1449:1453 extructures.fset <> ::fset_scope:x_':|:'_x not -R1447:1448 Examples.Std <> L1:14 var -R1454:1455 Examples.Std <> L2:15 var diff --git a/ovn/proofs/ssprove/extraction/Std.vo b/ovn/proofs/ssprove/extraction/Std.vo deleted file mode 100644 index a59878b2a8a0ff0595d3885ec1bb68068c3875f7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 50252 zcmdUY2V9fM6DTDSu^}MXQ0ZNIv6E1xN)rW@7$86t5=a69Dk6%#!~&wCM)Xu{2r4Lw z1;K{c3yNaJiUk{jif{Hyf~j|jcmMZ(&pRObzM0wG+1cIM+1VL4da|B^;+V+_*uOK$ z^K*BcP*9iXAlHOiG|I30)Ob0u?wMvj94a%%ak1 zOpc*9jmqK}xY3gdY@2f$4=msQm_PW!u6Z`K$=91W978`AIa(O#gWkQ`r#p8~7-f6^ zL{NMUiNi7SqsLK2pzvpMj;UF#zGTSc=I(AdiLdTEXGpO$T5;&?*+{7HiND` z)YN&QYL9P>gHUupN@5g+AxyG+nWlPD%*%C#3dd?qT;@7+I0gY^mM~1aX+UtMscq=h z^~0Qb`Pb$STkYH49$GqP zF>xFe7)nlIi4?diV?^0KqunF7T3GzVd8sS}YJm(&LQ0HC^}Tf#2WP01T*q5vyBZ~D z8KE}P=?NU15?|J)M(7m+l`guu_ z$BNA}1`l)_&fz!&QxdQtL2{?WQejMBqr;5Q<;g-SUwi75h{avZ}?z$R@ZolPS7NU zcQg*i#_gX92<*s_f3<~td~w1d`Fy(G zcz-5`Gc<(4qEln|awpp6jR%WcgFaW#2CscNB*N-C)X1F4WJL3O7e4d5*mZi+?d7;d zB&V$RO&?u{!H6}5w<)w37>5P|aMhN-j#uN~dR#1A+H$?;D40{s;4KrYg%F_6_=`E3 zO_#5i@AGm#kX8+HYRs)G$AtU0v*T;BW`=nz-*ENO_ULaNC*IwJN&*we2_PvTg61JC zMoKg*h4EV)WAHoHKVEQcZR;ZI%@0#*d^sFDen*nVB~ch;7M;Q5h)bAt+}V3Bk*>7u zw91yS;8&wTHao$w{-H3iBE>Nyf7O2)=UHNNr*+YTf`F!KXf?k?rohO1xGeWC`jka2 zyB!a!HCVQVLz~AjfP)fSu`n|}~3!sSJwQ5e){e=5zNoF=K1W|uhA+Z!{Anij1cQ@-Z;ZjhRQ2x1zQ z4&%=lre|*&izC_+_Qe%1_wLtED?hre;ivDyyJ)_TfC-8s6{E58&B2fdoamJD!?_Q7 zo>&YMD3lTtBNZWbV%(9e!5@tWr&M(_Kl2FI0YLCiNsx+gVZ9ZtYs<7>Q@Xu7Q)3q4 z58OrTS`0ZVfx=&edD95tl}>4G7jLa!xFp?y+HV_SE)0mkSSyu!L&uQfu-5pvDX)(Y z%)WEW3H3Cp|KDTXdiO2$BkPCW?S)xeMn`^JgkeD={vK=6^m5H7-Ar0*Q$vi48#XM# zdL)p{pt91X)-OnDy;=2NE&fM!!da99r(k*qb_LRBNJUuo{0J>4RliQdEVAZ!uaS;e z7ltG=SW+>5y6@Wl$hRRiY*(e6FL5WJ$L3kikhcx!B5i(^w3_PFt7uKz5q98zI$NRwR4 z*n*LJ%{Esy-Z3>!dmFg`bv;kmO^H!V76XPBJR-wn1qzX<+)wn*pI#NZ(CL}^+$D>a z9?0czEP>0gD)43NBTMp8!?58ZLzy;I*PTlYkAA*vFj+Nd zv)vF_-~-UWkpY$Hx?uRO{vDgHv?-3WVrJYx?BR-@49JC=9j@aCowpp|oiZKYl)M4P z6Dn6`{KLhQ@sE!mtGdB)>uJ*Ux;nz|6nz=W@5fx^XgcKBRErfE&sgKfX`*(Aq(sTm z?v>vndYD)?jnvrB{@(xNVjSvZnEhZ5lm$Dh;6|#_(t#_FUJ3klXKqvu!sd-W8LGWX zqoJ|GMQ>-sY0stG?DkrrYNK%|1FDwl)17s*BiECQ12v5_E9N38!A7JExZy8;E^^x3 zlz2NtX~gL)e*;u38k;hpp0(WaQ*-XcgJ0)wqb^Gs2MUs502-w-p!Ry&V7$45{WYN6 zL9=hV8UdlA@hSuABm9v{gDDqJ_%&?u)j7_Ap#&9vSKJnTz!DI(d4ahhRt{G z4{~&^&`SPhvg1=T2!xqOGQg5x11GW^QdgY!FRQ(A99Ly(wd>_sXpz1jESW-Wd9N6B z!?NVbr{uX?o)a^2&LbGn_FCMVK_)Fv+0pw!Oj1tAgfGzEz=Ra02&IQjsn!0hkqb9I zFmqlsxjU*Dv^S8>gsla~I8dn6N2QM&yDIp;G)RA0*S_?`8koSiu%dvzi|1Hd-rlF2RTf2oc?)9OX1H=UC|XXWN$_jAqT@5=Gr-EDX5pDT7wkZ^zex zFMYmJ`^*P+TLe>SaU@neh0aLlSa3CF5(A#`yL@_E%nXIo+J}{?HslENk`iubV!bX2 zT#LGA;KCiN%^!Xn-}3rZ#9+iR8mfpe8(!FC81HqP(SOdStFLmleJKR0d<{)NU_nu% z#DS_WDm6ZFHzHmi^47aC!`4SrHQgPC3s+Z@0e9cS*R#52R5vFZ9X9@a$(sxn#I!aU zP-FBwXz$<67@*@s**LNOeNTjn^fwt$8_o|?=~_CM*x&RnhgG)&G!26YkTw}G$9M0= z8n&Wt@76xP&-N=bZ9oowYiTmz-;UN8(>TJS@m;rS>vbtrpt67_$=BCpz}F$-cK6Bt zYl3!&VMbMp>O|C2;wz7|o?4&99;KLn_h@7A)B9h>WkBssB0}P5pqI$fc7kE_w?R{; zIzCPM+_%uw4cRgx#MdopWeM*QCRv~G)zV~|%UAUD@oMGkFGS9*@1!fjOHBtsaYwWl6;c}BU^2zSoBbIAZ zRszpp!h`a#2`@ru!ZUXz##XMWY}SfcbkROBb0BxZ16Yo+FktGe{zINzH)OA5&FQy% zb`Tf_EU^hMiJp*7qbEw7@$h!L&g)bxKQemh8J9~w_4d#dG~My78NzGbo&L6V1)0wa zJ!(un9xpi-fOtkprO-qxqUxjJ-##wC;zAF$rRMAt-(a=z5?yVwcPRWA7ZRqkLbY;H z(~`;0ffguuV$032sOMp(v|gU{)Y-At`NvbChhadA5_@PD(b8@In&HfG+j`&D3=4rp zJtCT(m_%m4mR6Wa!7lxLtvCGKQFed!m&%S`pnaIQQdl!6&_oywpvD5id6?x9Xh2OuQ0UmiIiz_OGDL2@JQCeB`N6H)G zmoL}`0x}_%gcc%Uay1DB-XltSSD)}aGrd&hR|DuDSTjgbXzMQwTe|w(F7gR-QAgE8 zX2RY^*u)w~(2*fUl%G*0dic`j+NSsw$J*?5FM=eSgn;cB*+aQjQJz9m|AwSu6}}>@ z&+-{XJ7;OJp>S@;U@Q{pq%wL%u;b!_!h>BBchawr{E(nwBt_utsQ2fVCtB}btTv`e z`N{kBz<6Xm1x_NtmniTvf;We~&aA7Cy;d?e#kIf-M1`vrfDuR18h=ecWXv%`+H1~3 zbKkR!*m&qJ3?Ac|B!uwm-AuI(#XRkGZ@uZw1?N0LVx?9l^JCGvA3YuOdw)1;^s(2p zu~2_(gGPzLP|Omk(F}SbC63HjP{^Fr5JTsE%^lrGyvq*%Xbi*yFpWc4^=VyirhWCS z(rxo!FQ@Od8pA>+h!|=ruo`qUVNk`s)G1owD=t(Q-o10W;?i(vUjP&A2$EpG?zheE zdwiqgqYL{^rkVRcLS*BjVbO2A-znO$lkf?WR&jY@M zKA8I`mNtd)LrdN5UK*6ng+TM5DDWNgoL7B*Z94YBy*KS+tqPb6%(=kmoJ0)z%}<*% z*E=F#65hm|C9hhh29@PPdnAj&nxC7MpJ=q?)n|+T-evPD(Fo$gib39dNGNbATfM`% z!^6~N@tw(N`bfpvBrNVd)=kZsl(9RrW5lYgM$Rg*QE|^fOu&{3qS?uSPlu^1xA+)D zvK8-`EPCwMpLOUii82bAJ}mB^1IU$xB50TeVpJ7YmONhW#vALOoV20OBE~KOKZ*8?6+qQ*QrC{msIbL_(Z@&hKXO((F*yvF1mYLRHS7q@oMr9yvES%zj=oo) z*DX9^3)T^Hu6Rmq))tNQm;1=S7S7)~r!j4ln*r3BC(ys!)#{Xd)uZ8so9^Hz@65{= zfEs7uK}+R`4=2T_w`x6DX49uQtm%C>Wht24O#o2J*ek=|R?1wiZeLCAIsWyr+5$AN zDX|F>$l_Y8pIM)dD~%_BeA+`RloWTMx!Sr6Urlv_!BEi%gH!6KS7T73ja3HSq95+m?QzP-6rs z3U+nLY=YLdcq$E<9fh0X=v;L2!{l=7qgiWJ!Ux^Xfa#gHW?{3x2y}1GpmRP! zyBU;sKe7$myMbhyMkLW^aA!wh!k6;AHeK#{?Z?cOZs&fCsLJnL45f;_p-T^6=H{PKk|`AbzE;>ZQiY(WL5D1YlkjLOYHYc~Wvx!@Bw%|S9 zyCGIlW7GKufZ|1mHYXc)t-f9!7Bae{{N<>#h+BZ*O#=&yIJ7cpPPdkz5sxAhN8Je5 zG2Vij1ke&7^H2GDS-p2$U(-GGts>nMtRbdwpfe6zM2&>jQsUHArQS*}SB5qZnYX@Z zbup;Rn9`U)Nu)>+hUo>-;TtqhH%?1@Hz61wwh2`M)>KiMxxHx1`cbRu(gut?&oOwP zWP!StmXgRbI*5qO)Zqu#M0Z&}MBlHv`m#ajFW_2`fJ$b}{lZ`Tb#~NOR`=6;W@)(F z=_BRQN2stTm68zicNUGu1T%wcW2e3OsoFeV@zjH47-l>iDf*7}wvxcPUDu_$6y30x zk~6U$#u|noQ8_9%x_>%`G;Z9a#gA^Pk39mtZX6Vgssw+9=J_qU9;>pQuC_n1>Tkr< zOaZ%{Q4j;EXd-ZNv9VPP725(^ZF;zEUGfREbMqhuB?e9(;mBGPc&h8Dpw@d|od%vJ z9Up&TGYBT1+V7>H^7ieE=EoYk)}3A$uc}fEQ-X0Anc+`Pk{~+S0lphX`jnij-;>5iHG?aAcL>2CgS8GHlPp#rWfz;;pTtYD(j3 z4eY9jYrt{Dz>i9n061V1byKj-J+(8#KbhcD7q@XZ!#rU-j<`Th@JM4(XiV%QI#Uuh z9KK7Py7qCX?!~3#%6neP-{6GR0#1h$$*gFY;^G8OO0zAz7F0OTBaOaW@jfQ+?I4g0 z0E7h%v>Bme?Wt35|2@sHQbIY{MndpF9sfno<#Cna2luy5v-hp2 zb`k)SLb$$M$v^w#&dlozch7m$p^J7$lw{=oBgh)Ts%!4q8|zD-Pgjad&Q2OM6Z+FI z09kVRx(jcUK>tk_|s zXgciNO~%ux(RA>>;c+J^tYqT)lYV6FR|CS^1`I&HG6+}fhidT=Hb?$gw>o!lk z9>8Izbq4-)8p!A)Q_C#7180VosRn*49`qH|9cOfeAUvuh+2mJP4xVr(F)l*AdV2V= zynrNV-q;kzbQp^wWAO15-1{BL@w2<=GY@9J90R)=D{LX8Mw1gH5#D%XZ(;n#r?sAD z*O&_)wL1bALQs_iYyIm>sENYR9j){$gA@9t<-^{~5!)(y(7-()o)Y6m2Jo?xtJZInr41=PtaWK5-p$m9CX^%cWKZ2$9BL>$@M6~Oy$BxqXlb*9_LhT zeCsr1o^6RP}}WQm9UR|3(oaBk$c@_G{|wh%3#UC9zH& zFTewb=PMGN0^X1zROA#Xg0tv@LNVvagCoWD(|49GZk!JT15;#8!LCD1h5iMB30B5A z&)k<-zIc62^Uv!;BS2s<<;jndm`Dae7gC{)g}?OZb}3~3WsCX~dRLoZL|F0^WUf9f zz5=#BvCrOVf01o|k-phw-xeE?F{C7m+m*g4_%YN22H&mCOQ|2U^pZaU6y3k3Y3KxO z+N5&ez1F1Odx{Uf0&Y`jaC|Ay91qto9lLMdn_-p^ZMY(%FagFasKS_spdeVn5KrdI zhkFlPWEIA5T`|lD^b=MJVxW|X@nYU7rsc;zez--aPg%b@0y`1|qzg)co*QMH*Lz{h zfFhDZ$ASu9KWGcgi)dApf?(;KQSC7=vp{=8&WLEX4-5gLC~6#duStO~c^mS$&FOpc z?3i_DcRjxYN*gKw4!EQtY<{ZHUBmeH@-NeC?BA5eK*t#+F{p`B+w0hRtz+$0omq}O z!@`d3Xhl0(t~F3fgfaDZTiznO%~2`7?fk$6vovCN@EJkvc+7h~t>RFG>`HEL1{@*NiPsHtGCi zd*9io)8#%4BAYm_`x+@Zg${mwNGApYJRMW8a`{%ZyPP9V#zxes^qu2U`4kojv_1HZ zC$T`{%DY5^8V`KM>uuC7TaazmG@715V@a){ftm}Y^l*Uc;H105SI>P1VsD5JMmbF-gFIK8FWhF;YEH|kdvh9OKoe~ zHSf2_y?i*P@5G_+P(Eoz` zHHqA%XQ>-h-P5HkowTb6&cY4B=?UC5I;BMrx`U2;bh`4~_iJ+`RU<#dm%y0iPfH?P6gY3pkACX4vUThVM3R zdP*<5)6FNZMCBe^T?s5k)11`at{HS*)%V1<6PgxhCsTJeOoD-rdK*pD62JnJcY$RJIo5Z3 zX&40&mU)47z!(8f43}J==fx{(NrctgrjI!@?soioB7lS3fwnFgoS55g{~`3<jntd)!FtCVhe?q79`vUEY-d(d)? z&^|MXV@d`AO=nVJB@@^uXR!;WE32ovzG>KbM)#}AeP}aCaw3=|L}u;T(TDfUvlw#F z==0>2VExYkjTQ49M_UOJEbu^9VgaKlj(yE;>7Lj%CaU|g>b5|r4}(HZkOrRbQvJ&9 z#G|P?H@*aBRz()UP)Xxe$dsG_i>!3i{ok+p-P`nI)VqNFdF{jQc88|WXmMcjl2S88 z|M3N*daU-fJny02i*e)%z$ej}(&0%BOPd4Sj%sasJm$7uiH|3AABzr>O^-{LQi4iA zx@lde%jk}hymSsT<~6jPf?6O2ysmHX%o)cBHX&?}2|m4I-a!E|U|eQU;M&SRHQr`C zsb3wT_-IoE`EWKb3Ho^D``}Kb+ zW`v?s@gx_6g2~e@hc$he-OfkFnEdzM6YMnDGt{tX{#+}qm07{+X21++9SbzEf9TiI zi`P&m)7%SNzFZCK@y0wGnl=M;KD0VTa17B$A&DNl-O;ac zLWHT>pTPIlRU34keJGJN??%ff1PIC%D4Tp!BX39ireAqP%*9=Ej;c)Rh@O%c%;DH$ zc0jaOrKVCml9<#4m~VueR=+IwMRBjG>4}kn$4|1!cVSZXOO|8~EOVo;a({8xcGK&z zO4&D8!Qx>Vi0v3DG1x^i5r?x(!@Es8O5={M$y!bo# zq$|z47O$CCYh|}kFYsmrSS)OXSn@YT?U|~#dhAPE-3e~4hjjMnfJ23|AS$6j~u zi$hJN3D$u76IT!$VH66$eb zIXz!n(9_cK{^^;6bj+;#>;&D*B#3_|C=6-U)s8k~XSmPozDnz!=zWI`u~5B&ks&t$ zO?{HPWeL)8_3ihVK0wYXUtxMmf z73wGzpn5gh}>3 z=c0aO`7wocrg1ldMr3PZB*BkF1Z=|u75|DORhB#Y5E|6gtznk72uXr#X3+oigcK3r z8}Hl>R)6;>+&V9Q6a4^TF|slu;NV2e1B@$Xyvb=My>ejfT=gHL#;>978@}i?tP&o` zGfnuElJHlzhp!wLUt7C$b^O}bS7AqB=uSuk~MzgP{X! z2{yrstR)X-SEoH)sy(4ORDJv=a}}7p%!B`KDfJn4anI5M;4G#hh^VuNT5J#G9Cj=k{dW8&ZPg2# zK=#o&t}AjE6EA=7`s*9c_@{f1t_{+Tyxg@C8kPaj0vlvQ^j$~~`RNelzj1T*PO!#QI7U{yc)s&d zFk$a66WdQW0fH_J(Q8<#)yI|Hofcm>cjKmRD(qm5Qdm^bVSW>dIMdK2owcVZ+WX|} zoSMJvU|xUECVY(0!*(7wO&q`tok1KMdlb0_%u}#5;vHU({5FU(;O` z5V?Fp|E@L_z;^*0BDh~lC}=-jz4wY9AIR+adLC7MzxqN!ofr6|RqkfrX}2@iP7l4Y z|K4Sb6+_O$K?cRJl36lmgVe$a2C#+jZD_8u>Bs1yx*tH>G;K8aqfkK|nJz){5N67HkdRajl z2d>?)NLAdL<_d!fRapY0(WTlC9gjcV+dF>$OxD7*MIdGf5+(>Cfk?=;&tB`=H0ufVaGGF(h!Mm5M94YrXn(nJ&wAs!fi9j} z+lGds{(=sY)?XGGO@=JB-k;N$Z+;GVNFR=R0Kg^n0Bu$%`+?^O(vKB8E@zCd8wiyB zg(;)2os#hGrBC32T?2pQZHeAe^R6u)D5Lj0%0i$-FWSw4l!nZScg<-Z=9Ykg-yBr} zbL$1aS|N75`7mJ2X}bPm^>>!r@7Mc*c5Z=a!EsC|Sf|0SS+EX4eYRGfdt;QnqG>v_ zJuyNDxQ5V%B7V6gwgzqjc_$sF+kn+HUhR}i5v^@68M(~^h%tA};l5Ay}@N;Q&oiC3!EIM(HR68kjo9kAem z@_`MYcUmFp0(ZuQyXQrmcKt@(Alunq_EAr?-QidbT-+J-C}GA_4xX~YWZH*)-<`aJ ze#Z2(;zN z$zVlC?>&;GV*H3DrA;>aRc)_#vdktn8Wu7e)J9=}8{l z-&3s+^cR!SdzP;-KK)^SQO@hVz4igGx$l4PQb*o%Zfnmo>&qaHi&887j_gukT_Gic zq3rhxJAHfqHG_;Nj(JsT;hnSR3mEE6z`y~=2ZGBmd9?Q6Zjl{*)~h~#ymsN6XHeJ- zCN%^0Ih~7e(yr|HxJ!XI+WL+Q)t-2d#@AtfL#S?{ygjUQ<|-}O%Bf_*XPBA{=wJu2 zKvO;MP#V;Rye>J{e!L>OT=H8HYkL+q6zIe<;Ve!BEO?Q-N9AU6h5n}AMLv0I$^eFi z{(y^qDck@yKx>9uuROmMnyn+62JEeB{j3FpHG~=m9w88o0bL3F4SDf%N#mA>3O9&r zkIe6L_!g|ca0!7y;osyCf^En&pv}2ezG~ZuX>ZjAo}>dau&^|6e+}ulLa^kInFnnD zTA+IPL!UP1n;^eE? z?iXmeM>aJC0A+Vdl1BnHQ4;i%uxtJd!cAkZ$!}98J5-GZPGH+W@U((xFXHunIv{TW z)BJQ)PNObEeYA=aj5~KKa~d6t#UyYn0b`8C1WH0eEVAZ+ivw@UqdxcAIA91fG<{Fn z>@VN;mOv@qv}m{nDGkA5+e`cJu|Lgj4!LlC%YZsC%?97mB@irVL8 zH4*hH%XYiu1a^JC4BQ#*LK$T6=|Tz#$t{7-MBOW?el_>KuJ2Y%t~ndOVol8Gk}e$1 zC_hRXxXD0J8Hl1p4!c!$Xq$9&amdM?NM2=12hg@DJ3 z2|ae!o|w5~gl(T6e_7=6g;0icrcbfz zee1EyJo|>GfJFswSm3ZT6m<;=TQ*=EODtjHr~HN*t*9FhPub3Y(QhBLLWp0#=a3Cy zBd)yh%0B+dg2rwdeG`-^qw$!IE*dzeUE8?NwKAoU#h1TTexJ4kc#8rKi9*GjygY}m zJXPv=Gi?UxkRKRS;lfK4sGbs~cJ_#hjL!ouO!D`=pKUa43#=6Opz>i_AvpmwKV%*R zQIsIR{jb&dJNs{VaI-Yec#7laQBV$lEK7jiY#d||nfR)FNyVUNSpjE`8Z zUtXy531WLM0|DT^<^&j^1JVp{@}kufi@L?_8d`G<^` z>uhky{-k>{Tek&{n+;>pN+dF`2i^$$cCxdsugEJ!}Y&=gV9`u#maa%q% z)kF?DVcP43pI29;LL*13PPZc-T$S0DD-9N1bAM@<>hF#jGZ1D2cj~n1u+Wkv!p|AC z{&S@Ahar6#Mwh>3DhNI8jwBcvvtsC=KbP}MXxdqBX;AVjShH$+jN*%`>@)p&g z0cYYzPD2|k**W3&-FoVh2U};{-#%>Oi`wL$E5SAvS%(6*eL*23xaZWv^~>ns<%4%l`9y@Gsu(O$q>e+DIUX zi2%e)8y5?;{iBKomYki|>%!sEPlwSGaDrqVTC^+MY1>SXoj`*dMZ<+@`cs%U`1F+6h5{5_q&tNd&J{D~~$ z+8qVcN2D6}f{8C_dK~5ejcyL{4jaI8g&aK{sgs@Sz}pXl?m1X=Ecov0Z*%FJ;TqVS za}g8aI2~q7XL=4lfox$2iSK$Z0i!}Er&l*e!`AeT24v^q z`Z};mAq>6~rFap``ks1q{K|yS(Yifmdnl~z1G+8rO)Q8aHtF*HNJZGN@k6fdTOYr# zKZ4q?PFXV6p4+1c3+oVxtV=x`oB2(v)HzVmYfYL>V>O7qK=1M731%}{I*yigmGR*F z=)5a7MVSwF%~}EiiJBQt0Z9^XBkSjpBX-Mj4r!M8rld}aP=Lh^LH}N@#ZlH4?)!Fb zU(5a3QCl~AX5PiYe2GvXNWygR)f0!`7tv*GT|iHt(8ZIN_^3oQ@QNVEq=G_#1VJ37 zexgBA@3|&Zul4VmkQq}8=KyA?2<~yeIQWm2#p`<(QapmM4zq2YH8l-n6@gP}sbsi| zj&@bzI7?bvlSeDgIhwT0VBier0@&V}ARJItBmnPp*fXzWVOht!$a^nKv?KTMnvlYz zFi6NsE&=89FP#m`Vgq{&m{jiScbYSZC)BWKqcDxHwGmqehW1yB-6JHD|(m4m#xQ z=S}7Hu1`L8*>BhSBcyQTzSFFUL}LdlTRSV8 z#=$Q*!v;9?9rp7EQ|rTFnXyK5G>eh?6*{M5FFLV&l3H*)Wg5{xyc4 zNWv!nRb3SnhAFV&H$ef1C$KqdiA45L7AY8m!3HUNBZtF2z~vl!S}~7!e|Yi0E~7GnmVzC(2E8P&K3D zNeQ4&Vo-oUAS!iD%rfM{OBDgjB+&UtEIOw9VF(D-)lI2etSSTH;#AErkSIDU9(#z@ z1uE0S<9rt`amhkpf-D^5m>3KYAz>)h7|m|nmo)5UH7b$l3UHT7vA4ajx8Qk)J;KUE zxOdNBZ~I_x!66cRgyF)cd!wAF5)CKcVMp(A=I;KL+WoKQ1;)9zoBFXgPe}~3hQQsf)%Btws1!tR?aw6aG4-s zJ%yg3x2{TRt*Z>Uq`60-d@~|W8GD6lKv3$vMXe4a;b$I8Pl%y%iJ+%g5pJGJy)RrI z!zJ@iw>^zLJt*J>iDAI-;0}e}Z*#X}1*BQHrcmLss0V`q{6depjZn9l;eY`|n?{qF zEMOB$2|eT1Pb>bT9`<&w0c>@Z&{y;VYOWREmW91pXuzPPVqdugwU}+Iuop`WVgJTZ zLf_FFS2uShtvMYO>|Lr6)?DlXMi3}!kBGIvUgjBrMS&8FJ>b&R9=RLqCfo+27zUY2 zQ$i0gqDtD#okKCKTuammu*2l?5Isi_ZXQbgGap>RK-QbXfM?lq0nk&dXo6Dz?K?Cu zfGrq+9S;DWA^>=Qk;WCM?bv&J-g|h8N`N7x^I`-h3GBbUGHMRda=>kql9t54Fi1&-i7=B4G-M~$G3=J#Y&C^RspZTLZm&QMZ{4oyX3JJpK6cPi& z*8{QkKXaldk&{y>or8r$Nk$rh5`w@=Q!+SV(+7inY0Dd2>7CHnO8~=$mf^0^b{OCV z%gzA=r{_xOIhT}?TIMqhqRtr2Ss<3^33}(MWK^_{+h-fC0Ev{66oWPuXdXasP#FXz zk2Ag27o#2`yiid+e;i6i0lyT>mA}4O;Vj<89HoigU zO90<^B?Q5RwP&Sq=g0l#3FxX4DHe?~^pyAhSol_~oL3fHS}@a4(vv44z{?e90O~RnKwI1#^s)Y-0<{$#^OG2OsfLHLS-pz-(u=-Za8Bjem)p2J- z^om=7F)nYo>#+}O5p8%0?`exXnKl(R~$kh zy5kiG0uElWFM)_x)I^`ufTD*dUa>nuCg7sci*D#e7x;DxUb^8v!KeLzjN6SMb^!IQ z@HZHKuAuiGUN|3a$#})_@G>8Y&LlvoZipgYaU1|%NA;ctACjOxs3myCc%bNkbLYZn z1KvD%JsQFJq1QM7^c+h>x()n*+oGUaMPk6+Y@}7`DiBtcbJ%);gtef0ag-I*PTqL? zeLfrY{yN=60s*~@C9sL;F9XQ#{P_re!H3Ow#Vv#bpj^3UWpR)m#das)da^lLY}YcJ zE^bg6P79||hEvBY9%j1{fS_uY1(t+CK|vY*E`%Rb_%VYYCEm|S_^Sy2tMa}Fz+d#a z{nxKw@CU;);r#_T1^#FB4$(%>aPXr6Km0N@;WL6m@7PEO#4GLwy>C_)0oqUmn?oVC zz zA6|Pub+#7_^=2&6STZvnOe38Q1>qnPczU=b8#QPu-B%u4N612A-*UfuwE%FWJ@|wHAJW6Cg}K!!D5=A16Q~gsARCmzaWc) z;jyv9T3jy+*gnHrgLzIXbu%h9%;KQV#<|!FnCUwK`Wd@z!P?Iv;NaQ|k|qnZ3iAor zKJKzH3vmQqu?4TU{f;nTloSu!X(h8o@1_!nS!_gv{r6TL9Lbcw(NyZK7i^w|wcn0_ z^Ta;b6L3E0gSRaKtC2RGQSz6IfzKxl#=yM+Tor=?a1f6iTy_~Q4L7e0_qvGJ=TbK( zhL|dA8oKr(A?pBpEZc)S9F%t8I7+=Y5_e@Cz z0VIrGgj3<*GH@A1xPAvf$}HGkY)?!8PkD6qE4C@aE8Q_=LGl4)`BLhA9Dh2CjaRfQ z!i_k98;w_Vz&XLBholRx^BBZY1VjsW2v<^uqvJ};aPc@w8Ez^rwhY&ZYbe8A!`+9* zxE0~TVGoK|bjSI@SI;8c(D!nq&7IpZvFVMRD2 zD19seHxL#19AN!Bc=SwpLUNh_QOqGml3TWToM2Rk02C=$I2fOJ$YN9n z07T*NL}10^Afq}!$Z1&uPowg|D~H3s7s5O8mmG%~0I~9gqZ*3`cjo$z{XTdX&w?Yn zqnUhB^@I{ViDws*HT0f*G415bL-Qw@Ze$N*@nrd&P$_ihEqnix;+sBL)M zF}97kKcc)2F@NTdDBF!C`QsG*Pa>qsGX z@c5r>8%dra6q(cf${fE^?n@A|X0es&%F7=lbuf@%;Ss;E_(xYY{tGwN|8E>gWl1IW zU)(_XS65494x%hu0yhg}$m8F&5DsQ4o&iU$`w#NDkMZwhVYk9~dZ>8naXu8dNdDu^ zEjf~p%N&VD=GXx;Wt@{GCA-WQX63m^D*u&9IqnY2bst#HE6o3^yO{Fcla=oVsSGzg z|GQKKGG>;N_2SDv-nWq}1-cdA|DP#qf^yk1VEv0Uv;Q_zEdQk9_fdd&Mi%+=y!^XN zzyBsU0sNn3T>rn5&E7bGoBUB)25|Abi zB}h!q4gu+;B3xK+MeEu!?bnoU@6OafUR1b&67V}as6 zojJFg1_WoC+J;_TKfLO%7nQ5w+J$WSJ!DUeW-5CIKU3MW^2wM!Q2xv0W&xe)T!c7v zPUC^)+aL1>U)VLzrZ)L{6F8>Hk#Eo({2TaJy+sox_q$Uc|8e|*AzfH2s=M6kx*xpA z06GfYO&8ojbuZIYPl|cD&QRf4t%=KAXE;)mC&7WkIB*Uoqa22qx&}^a=&CNnW3(f%yL8P=uTAgq$38;OTfGsbWv1}j>a8J}@s_P)%oKd((& z_9*`Y$qu-kc@ldsLM!%KiI-n7j+*f$2Slw|Z z=zP&#PmYgT`zrDrU0BF4C^Y>G2bQe$-%5K~^>&YQDRube6OSRrh#bj+4Fe&*j0nMp zO{vxXtdR>hJ}`4$G`YJ0EGV+2mX|+@uk88pWQnrT2_rP=dh09>&QK}2jDh z`WHEu$|rl!V0q$Y%NXNSok}8abk0YSHQks4AAtmJue<;Zl2p7tPA6LJV{<1p4k#_W znd^ii9du%LYKan5L+iM+_go@fY1?U)En&g0M#Eyk$77a2 zg0_d3m-Da99k$xHy*;#a%wi%$6YGQ%4KuhrtvEdN^O7Qu6`N-a9_R+4Mms?zgxV7i z|HsQXFQkR<${100&uI6^triwPab7A5!N?Yh5_?J5Qj6!MmpgXfzl`Yg|2`hse;!2Z z&x3sa-wUB6SD4QKD(aT3d3@zc4lHw&PkAze8;8LaY&t|C;{NSiyly@u6u6YF-r?Ng zVd}E@&SY3$xDe>(lqm2W^PE?Ger-DT!M!)_W39?8SoFET9?4>`=I3VRCmJnz_1U7o zciFs3h{bNsg+)t^81$Q;HfOGPM7|`vi8)JNwM-4P-~VYORTLmqXo?BRJ<_$kXZ+aa zaFy;Bx}PA9qiiu$4JX8sB1Es`?HG4g`L6v^hRL(9`{LG9KW4`1fx#l6}e z^@u-Of3p-+e_mc)EMG6b2;N4aH)qf}pP=0g%DW%ghV9+JR>Y%^f*EzzhX-6nuLyQr zTu^whOX5!Y6%r)>kUwRwNdzx6stgSFiMtW;`jEHYjTyE+nyTsUu;xTyS3YIH-S_bI ztgac=&B;cGjXz)VCS$lFC-Krc*7ttzp$oT?i8HLcTIN}Jrl5{-qf=sIB`kKOuIi=6 z%F(3(8oNqb3O(*2A%Md@PYBKidD8w_i1Liwd*yd9_e}Y8-M{$j7G(WH_@NAlIVlUi zi(6}1$>EO5rTr$~;au4WK|&29yrN~2-@%FflA{M;n8m-v2T#!-j+JrOdWbQr+us(p;yxenP=StNn>Ns3GVyQwD+!=ZC3u zEuBm3Z+e%*s@nkvba1+vk|6UK)*<3{_sRZif_8{uMpcXIMARJKait8U4}8D2W4qUc zFr%cFv^$R3*HFdL!KDnS!=t*D?R)PvTp{PnCxQuF5{F@q-1vBhN-|Jr?6>vda+5al z$?n@DmTOa1qN<0)(V!D#DW6~%{cX^csg6&RKKCs&b%V*;FoKLylJTZ6-jq>6tsh(5 z^gX{e&Q^O9qxc6JhL{d40%u3PKes&5diP?rF-^)(-miycEdm9)Aw&E*5zt_le!kWl ze(or{Kl@8%$FD3j3n9=1N+QHA7puYag6QxKnx`A5CBB;wj1Sv{DhgrBM5*3hv}OIM zRds0tMxN&wyic+~6_q7<13;l%Q6hCz_0jNeAD3Top$FSibM}dEXap7ci+2%2yC5+@(p zoNU;&`g(a-$movpm!r<|$fJnf5-Ouin$xW%XvCw)#8EfGb&O$OY8a77P7`GVb^qk- z^ycno9?sEy{A*P|eGCjnx(K(fE}0yBeQJYRMoexK{quBFB#97wRsuomiL_6v3iMyi z8hH4jZA(9hs%Qj|OtFb7&H#S{VNsqs{J@&%F3X4L`&Cz8HVB0ot}}x$U{r}7zO=cv zDSpMVHhbNRFtALqbdoXXBEB%_r97`qmwR6OF>|HcxgR5{@=*m)KDSsIGfyI5&`d6s;kn|9(I(*y!1q} zW?TM~G`N47(fZFaPMbkwGziQ|7Vr5`qrn#2S1V0(o~J#@VU0g@s3E3HbtYhkc%Q+_ zIOm!B63Z8_uW9~yeP{$MBywbPH3C@Vf(_ZdBxE=*c^mS$&FOpc?3i_DcRjyT4+0e> zclvcXa|+8H@tzw1M_Ln}J`2=$88E11zMbX~#gvA}uv`g5%=sOeSUj-(pXMx1K%EuX~O>)wYg=@IdTR29f3nSGieRBbk3;un3q|gy&-2rG}{L@YuxDv(w9g> zX0HJW4vp zRlCbM;$&<@ol4(1E|suZF@Vr#LelNw`lVy{&3iM<5~2-PWE3WVu!1zf@+de2rm_e6 z;|(fwN=}h3I_r~>!Y_HOd`_>NjNh5$)f%0uWU?**R1IV3GBg?`CVu}9Qp+1dJYWVj zO)`CE#@6$=*XF8?p3|3um$cL9aPFnmeN{5?O z_}koPgt^x4S`Fjm9}{yLCXrcEXBewK>TQ0+A3vwXvESjX7uEqm*o8^!l@2=Y(do)Z z8^+QXzv0|@HSp?F%N5-o-}?vKMm);;pM;B-H|V|m=?UZy zNH1U5e!0^hV5tG*3wm!TeZcNLn646(sU0ok_fA} zO&@b+-0k@FL|B6mxYQ}|*3ehkn}3E?_%E$Y8at>RRA3;_g#8r9lnhEhI+F_8h`^-6p^VdN$;sELr9PV&fgY`xa8cB{@T$DUzf$9A-az!ccIYDk^} zZ(e)c;yb^UfX|QpcCoOH1&apw-%4(6nyr7A@1z>9j;KqsA8cFt6KccFuq?Uq`7YJ3 z+)g~2s&nH@U}jY$#1%Ecz#$2+DLH}lcc>#2or)*97!*vNZaJ*!!|ZlGD#ob4M-6rw z>=|lUG=Hv@*2=74bu*YfP_n|`tEa??nz-^V(V)fyU-5bywab>+cwhrcMJ$EQIPEVi z$8N)v?Oc+K>*n7)gF(xhAjt^2j_4+h^z3zG?3mw{y^88Jpg79104(ORCs;NH%2GAS z6t5Xuo@~Ru{6Ocn0D=pT;1Kcm_~6IcdMbU;s8@$igj^|xAqB-F4Ox(4$mG3i zr_i3~HENxSD@a}eMm9c_0A)e4@gJKjuA@tql z2m5sv4t9V@rVy}#$-uG~fba>p9c5d1EvRswM;d*%;(bis+d*8q$nYYiA{$=J{PZO5 zy6)wQ(f6vTDR7!)36%LMWx#O?zDd{+=S_ZOlxs&+AE$geFX+ip4_-MifF#QQrn!mV ztn-fEbPZk^bV}jjMQ*pFfg_N?Q#_3}Djbx0EIk^0w4O`93e_18LRZ zk7^2UQ6@+L5rC_<{B^t<|JLJT;nJ4tJx5`s%8**r1S~LE);2+{HDQP+^X0?62QIP- z65+_%cfOONkOqbCeC3)!_X3T5oGnkYp5Z4w(T$iTw9$Ygi zTeDAoWCIST>^#XIv`ixwgaMN}C11=t#kBm`#}BvY^eO9CN5C>7Lk@G}RNgtLB&BlX zm}A<$wYBVkVfnhxmrttU;5FW}ZN!tO%9tYF3}uo>N#7%QN#zBH!PxDNevKQy1QXor z^Mk(!g7IF4ysjo`plzc~;Xh6D`@diHySM4bsCNPT^V)~q?GBUOKjw)4lN|L%8IV^4 z(f~=~W?OUC*PR(v-mi~cIqsi?SBFr;`XuLEj*{_-XEg^1M7Bu;3CpR7o(~gvZjRmZ1k0RH^~n2rMPgmE!cCxO>yFjEL%4qMCN zK)x2yv?)*|zK;T+=>!=51a}#HA3O)I`4b(1Kvjmr3$;^)M>ty{e0CpAd>=I|{mUa1 z5*>l8=HOJ|5B7Ntd?w<$V2JiMfM_z6L%&J@5G^jS0mv@?d2#XW_yx0Zuq>~_YmCL2aNi)_aVf*oac&&8IokR28j7O(av;1f{929g!)=5; z;-^bD`!J3*7Pg&)B^ZE=E=kZ_HqM8D*Px&}Ea%q&B8#KO+aq3Mjc4P=LmdzY67d=Z zO4f&WYv9InVGzT4wZW-EWpGwdwqP9+xo}8IusT>_DH;T-fE$X_LB;RvEPf&v1ql$Z z_$*%W`FM>oD88&OE{h9;`bVhvaFOEkF*pa*9lYWpzPca>a1*)3AL%T99v2056|Z>6 z7lpO{3|`|L#7{rA6Ss#8gL+A*`1vBmpW(uxKI8QO3b8I!{yc8^HT?2d0r!CW4yf07 z<=^3z{~oV#3yXSUY3~uGgr?em7uZ&;r1CjcR@YY$6vKbset&SmRLx zwff*SZYrt$6(irA}{_Q6bO>oi2Z(y{eFi1hJfJkd=vH?1Z_25voH30 z09Lhp?Dt0O_hxQkogH3?R~*Uqg*xHj1&}{*0Iv!8Paquw5&NQX%~jybbvJ=8H{1oj zT=5Y2a@F(q7tJs)fiM1JxnHoh!B7<%418{N&IAxmJDtZa)I22@mzne65!M99-@|?t zPIW9tgj*P=G$$gCXima@t7E_WV0>AM{a%6n?t%SQ;}Y$ZMBvL__E^LhhfcoC6X1)c zs{mg#T?F`|IZ}Wxnw0{4(LBWC3)B_+XT&&EfA2;dZlk{LiNon9Y`Dp{u>1!QB%k|_ zQ1diYeO<)+gom3Tib3rFiL=%p|b3BX8oX)3-(gL7= YTB7ZSXR0aOe2)}9FiN<9{)qwqABuZEJpcdz diff --git a/ovn/proofs/ssprove/extraction/Std.vok b/ovn/proofs/ssprove/extraction/Std.vok deleted file mode 100644 index e69de29..0000000 diff --git a/ovn/proofs/ssprove/extraction/Std.vos b/ovn/proofs/ssprove/extraction/Std.vos deleted file mode 100644 index e69de29..0000000 diff --git a/ovn/proofs/ssprove/extraction/_CoqProject b/ovn/proofs/ssprove/extraction/_CoqProject index f7496fc..4a3e1aa 100644 --- a/ovn/proofs/ssprove/extraction/_CoqProject +++ b/ovn/proofs/ssprove/extraction/_CoqProject @@ -4,7 +4,7 @@ Hacspec_lib.v Core.v -Std.v +HashMap.v Hacspec_ovn_Schnorr_Random_oracle.v Hacspec_ovn_Schnorr.v Hacspec_ovn.v diff --git a/ovn/src/schnorr/random_oracle.rs b/ovn/src/schnorr/random_oracle.rs index 8481733..2152200 100644 --- a/ovn/src/schnorr/random_oracle.rs +++ b/ovn/src/schnorr/random_oracle.rs @@ -71,10 +71,11 @@ use std::collections::HashMap; // } // } +pub type QueriesType = HashMap; // static ref QUERIES : HashMap = HashMap::new(); // chQuery := 'fin #|Query| // chRandom := 'fin #|Random| -pub fn random_oracle_query(mut QUERIES : HashMap, q : Query) -> (HashMap, Random) { +pub fn random_oracle_query(mut QUERIES : QueriesType, q : Query) -> (QueriesType, Random) { match QUERIES.get(&q) { Some (r) => (QUERIES.clone(), r.clone()), None => { From 5852a82facbefc05aa7216b0af01892172a2b464 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Thu, 27 Jul 2023 17:52:19 +0200 Subject: [PATCH 05/86] Start of equivalence proof --- ovn/proofs/ssprove/extraction/DDH.v | 118 + ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 11 +- .../ssprove/extraction/Hacspec_ovn_Schnorr.v | 7 +- .../Hacspec_ovn_Schnorr_Random_oracle.v | 5 +- ovn/proofs/ssprove/extraction/HashMap.v | 3 + ovn/proofs/ssprove/extraction/OVN.v | 2292 +++++++++++++++++ ovn/proofs/ssprove/extraction/Schnorr.v | 687 +++++ ovn/proofs/ssprove/extraction/SigmaProtocol.v | 1064 ++++++++ ovn/proofs/ssprove/extraction/_CoqProject | 12 + ovn/proofs/ssprove/extraction/ovn_eq_proof.v | 3 + 10 files changed, 4192 insertions(+), 10 deletions(-) create mode 100644 ovn/proofs/ssprove/extraction/DDH.v create mode 100644 ovn/proofs/ssprove/extraction/OVN.v create mode 100644 ovn/proofs/ssprove/extraction/Schnorr.v create mode 100644 ovn/proofs/ssprove/extraction/SigmaProtocol.v create mode 100644 ovn/proofs/ssprove/extraction/ovn_eq_proof.v diff --git a/ovn/proofs/ssprove/extraction/DDH.v b/ovn/proofs/ssprove/extraction/DDH.v new file mode 100644 index 0000000..09e5446 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/DDH.v @@ -0,0 +1,118 @@ +From Relational Require Import OrderEnrichedCategory GenericRulesSimple. + +Set Warnings "-notation-overridden,-ambiguous-paths,-notation-incompatible-format". +From mathcomp Require Import all_ssreflect all_algebra reals distr + fingroup.fingroup realsum ssrnat ssreflect ssrfun ssrbool ssrnum eqtype choice + seq. +Set Warnings "notation-overridden,ambiguous-paths,notation-incompatible-format". + +From Crypt Require Import Axioms ChoiceAsOrd SubDistr Couplings + UniformDistrLemmas FreeProbProg Theta_dens RulesStateProb UniformStateProb + Package Prelude pkg_composition. + +From Coq Require Import Utf8 Lia. +From extructures Require Import ord fset fmap. + +From Equations Require Import Equations. +Require Equations.Prop.DepElim. + +Set Equations With UIP. + +Set Bullet Behavior "Strict Subproofs". +Set Default Goal Selector "!". +Set Primitive Projections. + +Import Num.Def. +Import Num.Theory. +Import Order.POrderTheory. + +Import PackageNotation. + +#[local] Open Scope ring_scope. +#[local] Open Scope package_scope. +Import GroupScope GRing.Theory. + +Module Type GroupParam. + + Parameter gT : finGroupType. + Definition ζ : {set gT} := [set : gT]. + Parameter g : gT. + Parameter g_gen : ζ = <[g]>. + Parameter prime_order : prime #[g]. + +End GroupParam. + +Module Type DDHParams. + Parameter Space : finType. + Parameter Space_pos : Positive #|Space|. +End DDHParams. + +Module DDH (DDHP : DDHParams) (GP : GroupParam). + + Import DDHP. + Import GP. + + Definition SAMPLE := 0%N. + + #[local] Existing Instance Space_pos. + + Definition GroupSpace : finType := FinGroup.arg_finType gT. + #[local] Instance GroupSpace_pos : Positive #|GroupSpace|. + Proof. + apply /card_gt0P; by exists g. + (* Needs to be transparent to unify with local positivity proof? *) + Defined. + + Definition chGroup : choice_type := 'fin #|GroupSpace|. + + Definition i_space := #|Space|. + Definition chElem : choice_type := 'fin #|Space|. + + Notation " 'group " := (chGroup) (in custom pack_type at level 2). + + Definition secret_loc1 : Location := (chElem ; 33%N). + Definition secret_loc2 : Location := (chElem ; 34%N). + Definition secret_loc3 : Location := (chElem ; 35%N). + + Definition DDH_locs := + fset [:: secret_loc1 ; secret_loc2 ; secret_loc3]. + + Definition DDH_real : + package DDH_locs [interface] + [interface #val #[ SAMPLE ] : 'unit → 'group × 'group × 'group ] := + [package + #def #[ SAMPLE ] (_ : 'unit) : 'group × 'group × 'group + { + a ← sample uniform i_space ;; + b ← sample uniform i_space ;; + #put secret_loc1 := a ;; + #put secret_loc2 := b ;; + ret (fto (g^+ a), (fto (g^+ b), fto (g^+(a * b)))) + } + ]. + + Definition DDH_E := [interface #val #[ SAMPLE ] : 'unit → 'group × 'group × 'group ]. + + Definition DDH_ideal : + package DDH_locs [interface] DDH_E := + [package + #def #[ SAMPLE ] (_ : 'unit) : 'group × 'group × 'group + { + a ← sample uniform i_space ;; + b ← sample uniform i_space ;; + c ← sample uniform i_space ;; + #put secret_loc1 := a ;; + #put secret_loc2 := b ;; + #put secret_loc3 := c ;; + ret (fto (g^+a), (fto (g^+b), fto (g^+c))) + } + ]. + + Definition DDH : + loc_GamePair [interface #val #[ SAMPLE ] : 'unit → 'group × 'group × 'group ] := + λ b, + if b then {locpackage DDH_real } else {locpackage DDH_ideal }. + + Definition ϵ_DDH := Advantage DDH. + +End DDH. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 16caece..78190d3 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -26,7 +26,7 @@ Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. (*Not implemented yet? todo(item)*) -Require Import (* Hacspec_ovn_ *)Hacspec_lib. +Require Import Hacspec_lib. Export Hacspec_lib. (*Not implemented yet? todo(item)*) @@ -53,10 +53,14 @@ Equations p_i_init {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('uni solve_lift (prod_b (y,zkp)) : both (L1 :|: fset [commit_loc]) (I1) ((t_G × (t_G × t_G × t_Q × t_Q))). Fail Next Obligation. -Definition t_N := nat_mod 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab. +Notation t_N := (nat_mod 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab). +Definition N {L : {fset Location}} {I : Interface} : both L I (t_N) -> both L I (t_N) := + id. + Notation t_pid := (t_N). Require Import HashMap. +Export HashMap. Notation t_public_keys := (t_HashMap (t_N) ((t_G × (t_G × t_G × t_Q × t_Q))) (t_RandomState)). @@ -65,9 +69,6 @@ Equations p_i_construct {L1 : {fset Location}} {I1 : Interface} (m : both L1 I1 solve_lift (ret_both (tt : 'unit)) : both (L1) (I1) ('unit). Fail Next Obligation. -Require Import (* Hacspec_ovn_ *)Hacspec_lib. - - Equations p_i_vote {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 ('bool)) : both (L1) (I1) (t_G) := p_i_vote v := solve_lift (Build_t_G (ret_both (1 : int32))) : both (L1) (I1) (t_G). diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v index 40681a3..4d6fd65 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v @@ -24,10 +24,11 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Require Import (* Hacspec_ovn_ *)Hacspec_lib. +Require Import Hacspec_lib. Export Hacspec_lib. Require Import HashMap. +Export HashMap. (*Not implemented yet? todo(item)*) @@ -49,7 +50,7 @@ Fail Next Obligation. Equations fiat_shamir_verify {L1 : {fset Location}} {I1 : Interface} (t : both L1 I1 ((t_G × t_G × t_Q × t_Q))) : both (L1) (I1) ('bool) := fiat_shamir_verify t := - letb QUERIES := (new(* _under_impl *)) : both _ _ (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState)) in + letb QUERIES := (new) : both _ _ (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState)) in letb '(h,a,e,z) := (t) : both _ _ ((t_G × t_G × t_Q × t_Q)) in letb '(QUERIES,eu) := (random_oracle_query QUERIES (prod_assoc (prod_b (h,a)))) : both _ _ ((t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState) × (t_G × t_G))) in solve_lift (verify h a e z) : both (L1) (I1) ('bool). @@ -76,7 +77,7 @@ Equations fiat_shamir_run {L1 : {fset Location}} {I1 : Interface} (hw : both L1 letb QUERIES := (new) : both _ _ (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState)) in letb '(h,w) := (hw) : both _ _ ((t_G × t_Q)) in letb a := (v_Commit h w) : both _ _ (t_G) in - letb '{| both_prog := {| is_pure := tt |} |} := (random_oracle_init (ret_both (tt : 'unit))) : both _ _ ('unit) in + letb _ := (random_oracle_init (ret_both (tt : 'unit))) : both _ _ ('unit) in letb _ := (ret_both (tt : 'unit)) : both _ _ ('unit) in letb '(QUERIES,eu) := (random_oracle_query QUERIES (prod_assoc (prod_b (h,a)))) : both _ _ ((t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState) × (t_G × t_G))) in letb e := (Build_t_Q (ret_both (1 : int32))) : both _ _ (t_Q) in diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v index 1034c3d..bf40eb8 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v @@ -24,8 +24,8 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Require Import (* Hacspec_ovn_ *)Hacspec_lib. -Export (* Hacspec_ovn_ *)Hacspec_lib. +Require Import Hacspec_lib. +Export Hacspec_lib. Equations random_oracle_init {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both (L1) (I1) ('unit) := random_oracle_init _ := @@ -68,6 +68,7 @@ Equations sample_uniform : both (fset []) ([interface ]) ((t_G × t_G)) := Fail Next Obligation. Require Import HashMap. +Export HashMap. Notation t_QueriesType := (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState)). diff --git a/ovn/proofs/ssprove/extraction/HashMap.v b/ovn/proofs/ssprove/extraction/HashMap.v index 0a2a0c3..2c37240 100644 --- a/ovn/proofs/ssprove/extraction/HashMap.v +++ b/ovn/proofs/ssprove/extraction/HashMap.v @@ -41,6 +41,9 @@ Import choice.Choice.Exports. Require Import Core. Export Core. +Require Import Hacspec_lib. +Export Hacspec_lib. + Inductive random_state := t_RandomState. Definition t_HashMap A B (_ : random_state) := chMap A B. diff --git a/ovn/proofs/ssprove/extraction/OVN.v b/ovn/proofs/ssprove/extraction/OVN.v new file mode 100644 index 0000000..552bbe5 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/OVN.v @@ -0,0 +1,2292 @@ + +From Relational Require Import OrderEnrichedCategory GenericRulesSimple. + +Set Warnings "-notation-overridden,-ambiguous-paths". +From mathcomp Require Import all_ssreflect all_algebra reals distr realsum + fingroup.fingroup solvable.cyclic prime ssrnat ssreflect ssrfun ssrbool ssrnum + eqtype choice seq. +Set Warnings "notation-overridden,ambiguous-paths". + +From Crypt Require Import Axioms ChoiceAsOrd SubDistr Couplings + UniformDistrLemmas FreeProbProg Theta_dens RulesStateProb UniformStateProb + pkg_composition Package Prelude (* Schnorr *) (* DDH *). + +Require Import SigmaProtocol. +Require Import Schnorr. +Require Import DDH. + +From Coq Require Import Utf8 Lia. +From extructures Require Import ord fset fmap. + +From Equations Require Import Equations. +Require Equations.Prop.DepElim. + +Set Equations With UIP. + +Set Bullet Behavior "Strict Subproofs". +Set Default Goal Selector "!". +Set Primitive Projections. + +Import Num.Def. +Import Num.Theory. +Import Order.POrderTheory. + +#[local] Open Scope ring_scope. +Import GroupScope GRing.Theory. + +Import PackageNotation. + +Module Type GroupParam. + + Parameter n : nat. + Parameter n_pos : Positive n. + + Parameter gT : finGroupType. + Definition ζ : {set gT} := [set : gT]. + Parameter g : gT. + Parameter g_gen : ζ = <[g]>. + Parameter prime_order : prime #[g]. + +End GroupParam. + +Module Type OVNParam. + + Parameter N : nat. + Parameter N_pos : Positive N. + +End OVNParam. + +Module OVN (GP : GroupParam) (OP : OVNParam). +Import GP. +Import OP. + +Set Equations Transparent. + +Lemma cyclic_zeta: cyclic ζ. +Proof. + apply /cyclicP. exists g. exact: g_gen. +Qed. + +(* order of g *) +Definition q' := Zp_trunc (pdiv #[g]). +Definition q : nat := q'.+2. + +Lemma q_order_g : q = #[g]. +Proof. + unfold q, q'. + apply Fp_cast. + apply prime_order. +Qed. + +Lemma q_field : (Zp_trunc #[g]) = q'. +Proof. + unfold q'. + rewrite pdiv_id. + 2: apply prime_order. + reflexivity. +Qed. + +Lemma expg_g : forall x, exists ix, x = g ^+ ix. +Proof. + intros. + apply /cycleP. + rewrite -g_gen. + apply: in_setT. +Qed. + +Lemma group_prodC : + @commutative gT gT mulg. +Proof. + move => x y. + destruct (expg_g x) as [ix ->]. + destruct (expg_g y) as [iy ->]. + repeat rewrite -expgD addnC. + reflexivity. +Qed. + +Definition Pid : finType := [finType of 'I_n]. +Definition Secret : finType := Zp_finComRingType (Zp_trunc #[g]). +Definition Public : finType := FinGroup.arg_finType gT. +Definition s0 : Secret := 0. + +Definition Pid_pos : Positive #|Pid|. +Proof. + rewrite card_ord. + eapply PositiveInFin. + apply n_pos. +Qed. + +Definition Secret_pos : Positive #|Secret|. +Proof. + apply /card_gt0P. exists s0. auto. +Qed. + +Definition Public_pos : Positive #|Public|. +Proof. + apply /card_gt0P. exists g. auto. +Defined. + +#[local] Existing Instance Pid_pos. +#[local] Existing Instance Secret_pos. +#[local] Existing Instance Public_pos. + +Definition pid : choice_type := 'fin #|Pid|. +Definition secret : choice_type := 'fin #|Secret|. +Definition public: choice_type := 'fin #|Public|. + +Definition nat_to_pid : nat → pid. +Proof. + move=> n. + eapply give_fin. +Defined. + +Definition i_secret := #|Secret|. +Definition i_public := #|Public|. + +Module Type CDSParams <: SigmaProtocolParams. + Definition Witness : finType := Secret. + Definition Statement : finType := prod_finType (prod_finType Public Public) Public. + + Definition Witness_pos : Positive #|Witness| := Secret_pos. + Definition Statement_pos : Positive #|Statement|. + Proof. + unfold Statement. + rewrite !card_prod. + repeat apply Positive_prod. + all: apply Public_pos. + Qed. + + Definition R : Statement -> Witness -> bool := + λ (h : Statement) (x : Witness), + let '(gx, gy, gyxv) := h in + (gy^+x * g^+0 == gyxv) || (gy^+x * g^+1 == gyxv). + + Lemma relation_valid_left: + ∀ (x : Secret) (gy : Public), + R (g^+x, gy, gy^+x * g^+ 0) x. + Proof. + intros x gy. + unfold R. + apply /orP ; left. + done. + Qed. + + Lemma relation_valid_right: + ∀ (x : Secret) (gy : Public), + R (g^+x, gy, gy^+x * g^+ 1) x. + Proof. + intros x y. + unfold R. + apply /orP ; right. + done. + Qed. + + Parameter Message Challenge Response State : finType. + Parameter w0 : Witness. + Parameter e0 : Challenge. + Parameter z0 : Response. + + Parameter Message_pos : Positive #|Message|. + Parameter Challenge_pos : Positive #|Challenge|. + Parameter Response_pos : Positive #|Response|. + Parameter State_pos : Positive #|State|. + Parameter Bool_pos : Positive #|bool_choiceType|. +End CDSParams. + +Module OVN (π2 : CDSParams) (Alg2 : SigmaProtocolAlgorithms π2). + + Module Sigma1 := Schnorr GP. + Module Sigma2 := SigmaProtocol π2 Alg2. + + Obligation Tactic := idtac. + Set Equations Transparent. + + Definition skey_loc (i : nat) : Location := (secret; (100+i)%N). + Definition ckey_loc (i : nat) : Location := (public; (101+i)%N). + + Definition P_i_locs (i : nat) : {fset Location} := fset [:: skey_loc i ; ckey_loc i]. + + Notation choiceStatement1 := Sigma1.MyAlg.choiceStatement. + Notation choiceWitness1 := Sigma1.MyAlg.choiceWitness. + Notation choiceTranscript1 := Sigma1.MyAlg.choiceTranscript. + + Notation " 'pid " := pid (in custom pack_type at level 2). + Notation " 'pids " := (chProd pid pid) (in custom pack_type at level 2). + Notation " 'public " := public (in custom pack_type at level 2). + Notation " 'public " := public (at level 2) : package_scope. + + Notation " 'chRelation1' " := (chProd choiceStatement1 choiceWitness1) (in custom pack_type at level 2). + Notation " 'chTranscript1' " := choiceTranscript1 (in custom pack_type at level 2). + Notation " 'public_key " := (chProd public choiceTranscript1) (in custom pack_type at level 2). + Notation " 'public_keys " := (chMap pid (chProd public choiceTranscript1)) (in custom pack_type at level 2). + + Notation " 'chRelation2' " := (chProd Alg2.choiceStatement Alg2.choiceWitness) (in custom pack_type at level 2). + Notation " 'chTranscript2' " := Alg2.choiceTranscript (in custom pack_type at level 2). + Notation " 'vote " := (chProd public Alg2.choiceTranscript) (in custom pack_type at level 2). + + Definition INIT : nat := 4. + Definition VOTE : nat := 5. + Definition CONSTRUCT : nat := 6. + + Definition P (i : nat) : nat := 14 + i. + Definition Exec (i : nat) : nat := 15 + i. + + Lemma not_in_domm {T S} : + ∀ i m, + i \notin @domm T S m :\ i. + Proof. + intros. + apply /negPn. + rewrite in_fsetD. + move=> /andP [H _]. + move: H => /negPn H. + apply H. + by rewrite in_fset1. + Qed. + + Lemma not_in_fsetU : + ∀ (l : Location) L0 L1, + l \notin L0 → + l \notin L1 → + l \notin L0 :|: L1. + Proof. + intros l L0 L1 h1 h2. + rewrite -fdisjoints1 fset1E. + rewrite fdisjointUl. + apply /andP ; split. + + rewrite -fdisjoints1 fset1E in h1. apply h1. + + rewrite -fdisjoints1 fset1E in h2. apply h2. + Qed. + + #[local] Hint Extern 3 (is_true (?l \notin ?L0 :|: ?L1)) => + apply not_in_fsetU : typeclass_instances ssprove_valid_db ssprove_invariant. + + Definition get_value (m : chMap pid (chProd public choiceTranscript1)) (i : pid) := + match m i with + | Some (v, _) => otf v + | _ => 1 + end. + + Canonical finGroup_com_law := Monoid.ComLaw group_prodC. + + Definition compute_key + (m : chMap pid (chProd public choiceTranscript1)) + (i : pid) + := + let low := \prod_(k <- domm m | (k < i)%ord) (get_value m k) in + let high := \prod_(k <- domm m | (i < k)%ord) (get_value m k) in + low * invg high. + + Definition compute_key' + (m : chMap pid (chProd public choiceTranscript1)) + (i j : pid) + (x : Secret) + := + if (j < i)%ord then + let low := \prod_(k <- domm m | (k < i)%ord) (get_value m k) in + let high := \prod_(k <- domm m | (i < k)%ord) (get_value m k) in + (g ^+ x) * low * invg high + else + let low := \prod_(k <- domm m | (k < i)%ord) (get_value m k) in + let high := \prod_(k <- domm m | (i < k)%ord) (get_value m k) in + low * invg (high * (g ^+ x)). + + Lemma compute_key'_equiv + (i j : pid) + (x : Secret) + (zk : choiceTranscript1) + (keys : chMap pid (chProd public choiceTranscript1)): + (i != j) → + compute_key (setm keys j (fto (g ^+ x), zk)) i = compute_key' (remm keys j) i j x. + Proof. + intro ij_neq. + unfold compute_key, compute_key'. + simpl. + rewrite <- setm_rem. + rewrite domm_set domm_rem. + set X := domm _. + rewrite !big_fsetU1. + 2-3: subst X; apply not_in_domm. + rewrite setm_rem. + + have set_rem_eq : forall P x, + \big[finGroup_com_law/1]_(k <- X :\ j | P k) + get_value (setm keys j x) k = + \prod_(k <- X :\ j | P k) + get_value (remm keys j) k. + { intros. + rewrite big_seq_cond. + rewrite [RHS] big_seq_cond. + unfold get_value. + erewrite eq_bigr. + 1: done. + intros k. + move => /andP [k_in _]. + simpl. + rewrite setmE remmE. + case (k == j) eqn:eq. + - move: eq => /eqP eq. + rewrite eq in_fsetD1 in k_in. + move: k_in => /andP [contra]. + rewrite eq_refl in contra. + discriminate. + - reflexivity. + } + + case (j < i)%ord eqn:e. + - rewrite !e. + rewrite -2!mulgA. + f_equal. + 1: unfold get_value ; by rewrite setmE eq_refl otf_fto. + f_equal. + + apply set_rem_eq. + + rewrite Ord.ltNge Ord.leq_eqVlt in e. + rewrite negb_or in e. + move: e => /andP [_ e]. + apply negbTE in e. + rewrite e. + f_equal. + apply set_rem_eq. + - rewrite e. + rewrite Ord.ltNge in e. + apply negbT in e. + apply negbNE in e. + rewrite Ord.leq_eqVlt in e. + move: e => /orP [contra|e]. + 1: by rewrite contra in ij_neq. + rewrite e !invMg. + f_equal. + { apply set_rem_eq. } + rewrite group_prodC. + f_equal. + { unfold get_value. by rewrite setmE eq_refl otf_fto. } + f_equal. + apply set_rem_eq. + Qed. + + Lemma compute_key_bij: + ∀ (m : chMap pid (chProd public choiceTranscript1)) (i j: pid), + (i != j)%ord → + exists (a b : nat), + (a != 0)%N /\ (a < q)%N /\ + (∀ (x : Secret) zk, + compute_key (setm m j (fto (g ^+ x), zk)) i = g ^+ ((a * x + b) %% q)). + Proof. + intros m i j ne. + simpl. + pose low := \prod_(k <- domm m :\ j| (k < i)%ord) get_value m k. + pose hi := \prod_(k <- domm m :\ j| (i < k)%ord) get_value m k. + have Hlow : exists ilow, low = g ^+ ilow by apply expg_g. + have Hhi : exists ihi, hi = g ^+ ihi by apply expg_g. + destruct Hlow as [ilow Hlow]. + destruct Hhi as [ihi Hhi]. + + have getv_remm_eq : forall P j m, + \prod_(k <- domm m :\ j | P k) get_value (remm m j) k = + \prod_(k <- domm m :\ j | P k) get_value m k. + { + clear low hi ilow ihi Hlow Hhi ne i j m. + intros. + rewrite big_seq_cond. + rewrite [RHS] big_seq_cond. + erewrite eq_bigr. + 1: done. + intros k. + move => /andP [k_in _]. + simpl. + unfold get_value. + rewrite remmE. + case (k == j) eqn:eq. + ++ move: eq => /eqP eq. + rewrite eq in_fsetD1 in k_in. + move: k_in => /andP [contra]. + rewrite eq_refl in contra. + discriminate. + ++ reflexivity. + } + + case (j < i)%ord eqn:ij_rel. + - exists 1%N. + exists (ilow + (ihi * #[g ^+ ihi].-1))%N. + do 2 split. + 1: rewrite q_order_g ; apply (prime_gt1 prime_order). + intros x zk. + rewrite compute_key'_equiv. + 2: assumption. + unfold compute_key'. + simpl. + rewrite ij_rel. + rewrite domm_rem. + set low' := \prod_(k0 <- _ | _) _. + set hi' := \prod_(k0 <- _ | _) _. + have -> : low' = low by apply getv_remm_eq. + have -> : hi' = hi by apply getv_remm_eq. + clear low' hi'. + rewrite Hhi Hlow. + rewrite invg_expg. + rewrite -!expgM. + rewrite -!expgD. + rewrite !addnA. + rewrite -expg_mod_order. + f_equal. + f_equal. + 2: { + unfold q. rewrite Fp_cast; + [reflexivity | apply prime_order]. + } + rewrite mul1n. + done. + - exists #[g].-1. + exists (ilow + (ihi * #[g ^+ ihi].-1))%N. + repeat split. + { unfold negb. + rewrite -leqn0. + case (#[g].-1 <= 0)%N eqn:e. + 2: done. + have Hgt1 := (prime_gt1 prime_order). + rewrite -ltn_predRL in Hgt1. + rewrite -ltnS in Hgt1. + rewrite -addn1 in Hgt1. + rewrite leq_add2l in Hgt1. + eapply leq_trans in e. + 2: apply Hgt1. + discriminate. + } + { + rewrite q_order_g. + rewrite ltn_predL. + apply (prime_gt0 prime_order). + } + intros x zk. + rewrite compute_key'_equiv. + 2: assumption. + unfold compute_key'. + simpl. + rewrite ij_rel. + rewrite domm_rem. + set low' := \prod_(k0 <- _ | _) _. + set hi' := \prod_(k0 <- _ | _) _. + have -> : low' = low by apply getv_remm_eq. + have -> : hi' = hi by apply getv_remm_eq. + clear low' hi'. + rewrite Hhi Hlow. + rewrite invMg. + rewrite -expgVn. + rewrite !invg_expg. + rewrite -!expgM. + rewrite mulgA. + rewrite -!expgD. + rewrite !addnA. + rewrite -expg_mod_order. + f_equal. + f_equal. + 2: { + unfold q. rewrite Fp_cast; + [reflexivity | apply prime_order]. + } + rewrite addnAC. + rewrite addnC. + rewrite addnA. + done. + Qed. + + Lemma compute_key_set_i + (i : pid) + (v : (chProd public choiceTranscript1)) + (m : chMap pid (chProd public choiceTranscript1)): + compute_key (setm m i v) i = compute_key m i. + Proof. + unfold compute_key. + simpl. + case (i \in domm m) eqn:i_in. + all: simpl in i_in. + - have -> : forall v, domm (setm m i v) = domm m. + { intros. + simpl. + rewrite domm_set. + rewrite -eq_fset. + intro k. + rewrite in_fsetU1. + case (eq_op) eqn:e. + + move: e => /eqP ->. + by rewrite i_in. + + done. + } + simpl. + f_equal. + + apply eq_big. + 1: done. + intros k k_lt. + unfold get_value. + rewrite setmE. + rewrite Ord.lt_neqAle in k_lt. + move: k_lt => /andP [k_lt _]. + move: k_lt => /negbTE ->. + done. + + f_equal. + apply eq_big. + 1: done. + intros k k_lt. + unfold get_value. + rewrite setmE. + rewrite Ord.lt_neqAle in k_lt. + move: k_lt => /andP [k_lt _]. + rewrite eq_sym. + move: k_lt => /negbTE ->. + done. + - have -> : domm m = domm (remm m i). + { + simpl. + rewrite -eq_fset. + intro k. + rewrite domm_rem. + rewrite in_fsetD1. + case (eq_op) eqn:e. + + simpl. + move: e => /eqP ->. + assumption. + + done. + } + simpl. + f_equal. + + rewrite -setm_rem domm_set domm_rem. + rewrite big_fsetU1. + all: simpl. + 2: by rewrite in_fsetD1 eq_refl. + rewrite Ord.ltxx. + apply eq_big. + 1: done. + intros k k_lt. + unfold get_value. + rewrite setmE remmE. + rewrite Ord.lt_neqAle in k_lt. + move: k_lt => /andP [k_lt _]. + move: k_lt => /negbTE ->. + done. + + f_equal. + rewrite -setm_rem domm_set domm_rem. + rewrite big_fsetU1. + all: simpl. + 2: by rewrite in_fsetD1 eq_refl. + rewrite Ord.ltxx. + apply eq_big. + 1: done. + intros k k_lt. + unfold get_value. + rewrite setmE remmE. + rewrite Ord.lt_neqAle in k_lt. + move: k_lt => /andP [k_lt _]. + rewrite eq_sym. + move: k_lt => /negbTE ->. + done. + Qed. + + Lemma test_bij + (i j : pid) + (m : chMap pid (chProd public choiceTranscript1)) + : + (i != j)%N → + ∃ (f : Secret → Secret), + ∀ (x : Secret), + bijective f /\ + (∀ zk, compute_key (setm m j (fto (g ^+ x), zk)) i = g ^+ (f x)). + Proof. + simpl. + intros ne. + have H := compute_key_bij m i j ne. + simpl in H. + destruct H as [a [b [a_pos [a_leq_q H]]]]. + set a_ord := @inZp ((Zp_trunc #[g]).+1) a. + set b_ord := @inZp ((Zp_trunc #[g]).+1) b. + pose f' := (fun (x : Secret) => Zp_add (Zp_mul x a_ord) b_ord). + exists f'. + unfold f'. clear f'. + intros x. + have := q_order_g. + unfold q. + intros Hq. + split. + 2: { + intro zk. + rewrite (H x zk). + apply /eqP. + rewrite eq_expg_mod_order. + apply /eqP. + simpl. + rewrite modn_small. + 2: { + rewrite q_order_g. + apply ltn_pmod. + apply (prime_gt0 prime_order). + } + repeat rewrite -> Zp_cast at 3. + 2-5: apply (prime_gt1 prime_order). + symmetry. + rewrite modn_small. + 2: { + apply ltn_pmod. + apply (prime_gt0 prime_order). + } + simpl. + unfold q, q'. + rewrite Fp_cast. + 2: apply prime_order. + rewrite modnMmr. + rewrite modnDm. + rewrite mulnC. + reflexivity. + } + assert (coprime q'.+2 a_ord) as a_ord_coprime. + { + rewrite -unitFpE. + 2: rewrite Hq ; apply prime_order. + rewrite unitfE. simpl. + rewrite Zp_cast. + 2: apply (prime_gt1 prime_order). + unfold q, q' in a_leq_q. + rewrite Fp_cast in a_leq_q. + 2: apply prime_order. + rewrite modn_small. + 2: apply a_leq_q. + erewrite <- inj_eq. + 2: apply ord_inj. + rewrite val_Zp_nat. + 2: { + rewrite pdiv_id. + 1: apply prime_gt1. + 1,2: rewrite Hq ; apply prime_order. + } + rewrite -> pdiv_id at 1. + 1,2: rewrite Hq. + 2: apply prime_order. + unfold q in a_leq_q. + rewrite modn_small. + 2: apply a_leq_q. + assumption. + } + pose f' := (fun (x : Secret) => Zp_mul (Zp_add (Zp_opp b_ord) x) (Zp_inv a_ord)). + exists f'. + - intro z. + unfold f'. clear f'. + simpl. + rewrite Zp_addC. + rewrite -Zp_addA. + have -> : (Zp_add b_ord (Zp_opp b_ord)) = Zp0. + 1: by rewrite Zp_addC Zp_addNz. + rewrite Zp_addC. + rewrite Zp_add0z. + rewrite -Zp_mulA. + rewrite Zp_mulzV. + 2: { + rewrite -> q_field at 1. + assumption. + } + rewrite Zp_mulz1. + reflexivity. + - intro z. + unfold f'. clear f'. + simpl. + rewrite Zp_addC. + rewrite -Zp_mulA. + rewrite Zp_mul_addl. + have -> : (Zp_mul (Zp_inv a_ord) a_ord) = Zp1. + { + rewrite Zp_mulC. + rewrite Zp_mulzV. + + reflexivity. + + rewrite -> q_field at 1. + assumption. + } + rewrite -Zp_mul_addl. + rewrite Zp_mulz1. + rewrite Zp_addA. + have -> : (Zp_add b_ord (Zp_opp b_ord)) = Zp0. + 1: by rewrite Zp_addC Zp_addNz. + rewrite Zp_add0z. + reflexivity. + Qed. + + Lemma test_bij' + (i j : pid) + (m : chMap pid (chProd public choiceTranscript1)) + : + (i != j)%N → + ∃ (f : secret → secret), + ∀ (x : secret), + bijective f /\ + (∀ zk, compute_key (setm m j (fto (g ^+ otf x), zk)) i = g ^+ (otf (f x))). + Proof. + simpl. + intros ne. + have [f H] := test_bij i j m ne. + simpl in H. + exists (fun (x : secret) => fto (f (otf x))). + intro x. + destruct (H (otf x)) as [f_bij H'] ; clear H. + split. + - exists (fun z => fto ((finv f) (otf z))). + + apply bij_inj in f_bij. + intro z. + rewrite otf_fto. + apply finv_f in f_bij. + rewrite f_bij fto_otf. + reflexivity. + + apply bij_inj in f_bij. + intro z. + rewrite otf_fto. + apply f_finv in f_bij. + rewrite f_bij fto_otf. + reflexivity. + - intro zk. + specialize (H' zk). + rewrite otf_fto. + apply H'. + Qed. + + Definition P_i_E := + [interface + #val #[ INIT ] : 'unit → 'public_key ; + #val #[ CONSTRUCT ] : 'public_keys → 'unit ; + #val #[ VOTE ] : 'bool → 'public + ]. + + Definition Sigma1_I := + [interface + #val #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool ; + #val #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1 + ]. + + Definition P_i (i : pid) (b : bool): + package (P_i_locs i) + Sigma1_I + P_i_E := + [package + #def #[ INIT ] (_ : 'unit) : 'public_key + { + #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; + #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; + x ← sample uniform i_secret ;; + #put (skey_loc i) := x ;; + let y := (fto (g ^+ (otf x))) : public in + zkp ← ZKP (y, x) ;; + ret (y, zkp) + } + ; + #def #[ CONSTRUCT ] (m : 'public_keys) : 'unit + { + #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; + #assert (size (domm m) == n) ;; + let key := fto (compute_key m i) in + #put (ckey_loc i) := key ;; + @ret 'unit Datatypes.tt + } + ; + #def #[ VOTE ] (v : 'bool) : 'public + { + skey ← get (skey_loc i) ;; + ckey ← get (ckey_loc i) ;; + if b then + let vote := (otf ckey ^+ skey * g ^+ v) in + @ret 'public (fto vote) + else + let vote := (otf ckey ^+ skey * g ^+ (negb v)) in + @ret 'public (fto vote) + } + ]. + + Definition EXEC_i_I := + [interface + #val #[ INIT ] : 'unit → 'public_key ; + #val #[ CONSTRUCT ] : 'public_keys → 'unit ; + #val #[ VOTE ] : 'bool → 'public ; + #val #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1 + ]. + + Definition Exec_i_E i := [interface #val #[ Exec i ] : 'bool → 'public]. + + Definition Exec_i (i j : pid) (m : chMap pid (chProd public choiceTranscript1)): + package fset0 + EXEC_i_I + (Exec_i_E i) + := + [package + #def #[ Exec i ] (v : 'bool) : 'public + { + #import {sig #[ INIT ] : 'unit → 'public_key} as Init ;; + #import {sig #[ CONSTRUCT ] : 'public_keys → 'unit} as Construct ;; + #import {sig #[ VOTE ] : 'bool → 'public} as Vote ;; + #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; + pk ← Init Datatypes.tt ;; + x ← sample uniform i_secret ;; + let y := (fto (g ^+ (otf x))) : public in + zkp ← ZKP (y, x) ;; + let m' := setm (setm m j (y, zkp)) i pk in + Construct m' ;; + vote ← Vote v ;; + @ret 'public vote + } + ]. + + Module DDHParams <: DDHParams. + Definition Space := Secret. + Definition Space_pos := Secret_pos. + End DDHParams. + + Module DDH := DDH DDHParams GP. + + #[tactic=notac] Equations? Aux (b : bool) (i j : pid) m f': + package DDH.DDH_locs + (DDH.DDH_E :|: + [interface #val #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1] + ) + [interface #val #[ Exec i ] : 'bool → 'public] + := Aux b i j m f' := + [package + #def #[ Exec i ] (v : 'bool) : 'public + { + #import {sig #[ DDH.SAMPLE ] : 'unit → 'public × 'public × 'public} as DDH ;; + #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; + abc ← DDH Datatypes.tt ;; + x_i ← get DDH.secret_loc1 ;; + x_j ← get DDH.secret_loc2 ;; + let '(y_i, (y_j, c)) := abc in + let y_j' := fto (g ^+ ((finv f') x_j)) in + zkp1 ← ZKP (y_i, x_i) ;; + zkp2 ← ZKP (y_j', (finv f') x_j) ;; + let m' := (setm (setm m j (y_j', zkp2)) i (y_i, zkp1)) in + #assert (size (domm m') == n) ;; + @ret 'public (fto ((otf c) * g ^+ (if b then v else (negb v)))) + } + ]. + Proof. + ssprove_valid. + all: rewrite in_fsetU. + all: apply /orP. + { + left. + unfold DDH.DDH_E. + rewrite fset_cons -fset0E fsetU0. + by apply /fset1P. + } + { + right. + rewrite fset_cons -fset0E fsetU0. + by apply /fset1P. + } + { + right. + rewrite fset_cons -fset0E fsetU0. + by apply /fset1P. + } + Qed. + + Module RO1 := Sigma1.Sigma.Oracle. + Module RO2 := Sigma2.Oracle. + + Definition combined_locations := + (Sigma1.MyAlg.Sigma_locs :|: RO1.RO_locs). + + From Hacspec Require Import Hacspec_Lib. + + Equations? Exec_i_realised b m (i j : pid) : package (P_i_locs i :|: combined_locations) [interface] (Exec_i_E i) := + Exec_i_realised b m i j := + {package (Exec_i i j m) ∘ (par ((P_i i b) ∘ (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) + (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO))}. + Proof. + ssprove_valid. + 10: apply fsub0set. + 8:{ rewrite fsetUid. apply fsubsetxx. } + 9: apply fsubsetxx. + 7:{ erewrite fsetUid. apply fsubsetxx. } + 4: apply fsubsetUr. + 3: apply fsubsetUl. + all: unfold combined_locations. + - apply fsubsetUl. + - apply fsubsetUr. + - eapply fsubset_trans. 2: eapply fsubsetUr. + apply fsubsetUl. + - eapply fsubset_trans. 2: eapply fsubsetUr. + apply fsubsetUr. + - unfold EXEC_i_I, P_i_E, Sigma1_I. + rewrite !fset_cons. + rewrite -!fsetUA. + repeat apply fsetUS. + rewrite -fset0E fsetU0 fset0U. + apply fsubsetUr. + Qed. + + + Lemma loc_helper_commit i: + Sigma1.MyAlg.commit_loc \in P_i_locs i :|: combined_locations. + Proof. + unfold combined_locations. + unfold Sigma1.MyAlg.Sigma_locs. + rewrite in_fsetU. + apply /orP ; right. + rewrite fset_cons. + rewrite in_fsetU. + apply /orP ; left. + rewrite in_fsetU1. + apply /orP ; left. + done. + Qed. + + Lemma loc_helper_queries i: + RO1.queries_loc \in P_i_locs i :|: combined_locations. + Proof. + unfold combined_locations. + unfold RO1.RO_locs. + rewrite in_fsetU. + apply /orP ; right. + rewrite fset_cons. + rewrite in_fsetU. + apply /orP ; right. + rewrite in_fsetU1. + apply /orP ; left. + done. + Qed. + + Lemma loc_helper_skey i: + skey_loc i \in P_i_locs i :|: combined_locations. + Proof. + unfold P_i_locs. + rewrite in_fsetU. + apply /orP ; left. + rewrite fset_cons. + rewrite in_fsetU1. + apply /orP ; left. + done. + Qed. + + Lemma loc_helper_ckey i: + ckey_loc i \in P_i_locs i :|: combined_locations. + Proof. + unfold P_i_locs. + rewrite in_fsetU. + apply /orP ; left. + rewrite !fset_cons. + rewrite in_fsetU1. + apply /orP ; right. + rewrite in_fsetU1. + apply /orP ; left. + done. + Qed. + + #[local] Hint Resolve loc_helper_commit : loc_db. + #[local] Hint Resolve loc_helper_queries : loc_db. + #[local] Hint Resolve loc_helper_skey: loc_db. + #[local] Hint Resolve loc_helper_ckey: loc_db. + + #[program] Definition Exec_i_realised_code m (i j : pid) (vote : 'bool): + code (P_i_locs i :|: combined_locations) [interface] 'public := + {code + x ← sample uniform i_secret ;; + #put skey_loc i := x ;; + #assert Sigma1.MyParam.R (otf (fto (expgn_rec (T:=gT) g (otf x)))) (otf x) ;; + x1 ← sample uniform Sigma1.MyAlg.i_witness ;; + #put Sigma1.MyAlg.commit_loc := x1 ;; + #put RO1.queries_loc := emptym ;; + x2 ← get RO1.queries_loc ;; + match x2 (Sigma1.Sigma.prod_assoc (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)))) with + | Some a => + v ← get Sigma1.MyAlg.commit_loc ;; + x3 ← sample uniform i_secret ;; + #assert Sigma1.MyParam.R (otf (fto (expgn_rec (T:=gT) g (otf x3)))) (otf x3) ;; + x5 ← sample uniform Sigma1.MyAlg.i_witness ;; + #put Sigma1.MyAlg.commit_loc := x5 ;; + #put RO1.queries_loc := emptym ;; + v0 ← get RO1.queries_loc ;; + match v0 (Sigma1.Sigma.prod_assoc (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)))) with + | Some a0 => + x6 ← get Sigma1.MyAlg.commit_loc ;; + let x4 := + (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)), a0, fto (Zp_add (otf x6) (Zp_mul (otf a0) (otf x3)))) + in + #assert eqn + (size + (domm (T:=[ordType of 'I_#|'I_n|]) (S:='I_#|gT| * ('I_#|gT| * 'I_#|gT| * 'I_#|'Z_Sigma1.q| * 'I_#|'Z_Sigma1.q|)) + (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i + (fto (expgn_rec (T:=gT) g (otf x)), + (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))))) n ;; + #put ckey_loc i := fto + (compute_key + (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i + (fto (expgn_rec (T:=gT) g (otf x)), + (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, + fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))) i) ;; + v0 ← get skey_loc i ;; + v1 ← get ckey_loc i ;; + @ret 'public (fto (expgn_rec (T:=gT) (otf v1) v0 * expgn_rec (T:=gT) g vote)%g) + | None => + a0 ← sample uniform RO1.i_random ;; + #put RO1.queries_loc := setm v0 + (Sigma1.Sigma.prod_assoc (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)))) a0 ;; + x6 ← get Sigma1.MyAlg.commit_loc ;; + let x4 := (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)), a0, fto (Zp_add (otf x6) (Zp_mul (otf a0) (otf x3)))) in + #assert eqn + (size + (domm (T:=[ordType of 'I_#|'I_n|]) (S:='I_#|gT| * ('I_#|gT| * 'I_#|gT| * 'I_#|'Z_Sigma1.q| * 'I_#|'Z_Sigma1.q|)) + (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i + (fto (expgn_rec (T:=gT) g (otf x)), + (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))))) n ;; + #put ckey_loc i := fto + (compute_key + (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i + (fto (expgn_rec (T:=gT) g (otf x)), + (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, + fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))) i) ;; + v0 ← get skey_loc i ;; + v1 ← get ckey_loc i ;; + @ret 'public (fto (expgn_rec (T:=gT) (otf v1) v0 * expgn_rec (T:=gT) g vote)%g) + end + | None => + a ← sample uniform RO1.i_random ;; + #put RO1.queries_loc := setm x2 + (Sigma1.Sigma.prod_assoc (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)))) a ;; + v ← get Sigma1.MyAlg.commit_loc ;; + x3 ← sample uniform i_secret ;; + #assert Sigma1.MyParam.R (otf (fto (expgn_rec (T:=gT) g (otf x3)))) (otf x3) ;; + x5 ← sample uniform Sigma1.MyAlg.i_witness ;; + #put Sigma1.MyAlg.commit_loc := x5 ;; + #put RO1.queries_loc := emptym ;; + v0 ← get RO1.queries_loc ;; + match v0 (Sigma1.Sigma.prod_assoc (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)))) with + | Some a0 => + x6 ← get Sigma1.MyAlg.commit_loc ;; + let x4 := (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)), a0, fto (Zp_add (otf x6) (Zp_mul (otf a0) (otf x3)))) in + #assert eqn + (size + (domm (T:=[ordType of 'I_#|'I_n|]) (S:='I_#|gT| * ('I_#|gT| * 'I_#|gT| * 'I_#|'Z_Sigma1.q| * 'I_#|'Z_Sigma1.q|)) + (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i + (fto (expgn_rec (T:=gT) g (otf x)), + (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))))) n ;; + #put ckey_loc i := fto + (compute_key + (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i + (fto (expgn_rec (T:=gT) g (otf x)), + (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, + fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))) i) ;; + v0 ← get skey_loc i ;; + v1 ← get ckey_loc i ;; + @ret 'public (fto (expgn_rec (T:=gT) (otf v1) v0 * expgn_rec (T:=gT) g vote)%g) + | None => + a0 ← sample uniform RO1.i_random ;; + #put RO1.queries_loc := setm v0 + (Sigma1.Sigma.prod_assoc (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)))) a0 ;; + x6 ← get Sigma1.MyAlg.commit_loc ;; + let x4 := (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)), a0, fto (Zp_add (otf x6) (Zp_mul (otf a0) (otf x3)))) in + #assert eqn + (size + (domm (T:=[ordType of 'I_#|'I_n|]) (S:='I_#|gT| * ('I_#|gT| * 'I_#|gT| * 'I_#|'Z_Sigma1.q| * 'I_#|'Z_Sigma1.q|)) + (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i + (fto (expgn_rec (T:=gT) g (otf x)), + (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))))) n ;; + #put ckey_loc i := fto + (compute_key + (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i + (fto (expgn_rec (T:=gT) g (otf x)), + (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, + fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))) i) ;; + v0 ← get skey_loc i ;; + v1 ← get ckey_loc i ;; + @ret 'public (fto (expgn_rec (T:=gT) (otf v1) v0 * expgn_rec (T:=gT) g vote)%g) + end + end + }. + Next Obligation. + intros. + ssprove_valid ; auto with loc_db. + destruct (v1 _) ; ssprove_valid ; auto with loc_db. + - destruct (v5 _) ; ssprove_valid ; auto with loc_db. + - destruct (v6 _) ; ssprove_valid ; auto with loc_db. + Qed. + + #[program] Definition Exec_i_realised_code_runnable m (i j : pid) (vote : 'bool): + code (P_i_locs i :|: combined_locations) [interface] 'public := + {code + x ← sample uniform i_secret ;; + #put skey_loc i := x ;; + #assert Sigma1.MyParam.R (otf (fto (expgn_rec (T:=gT) g (otf x)))) (otf x) ;; + x1 ← sample uniform Sigma1.MyAlg.i_witness ;; + #put Sigma1.MyAlg.commit_loc := x1 ;; + x2 ← get RO1.queries_loc ;; + a ← sample uniform RO1.i_random ;; + #put RO1.queries_loc := setm x2 + (Sigma1.Sigma.prod_assoc (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)))) a ;; + v ← get Sigma1.MyAlg.commit_loc ;; + x3 ← sample uniform i_secret ;; + #assert Sigma1.MyParam.R (otf (fto (expgn_rec (T:=gT) g (otf x3)))) (otf x3) ;; + x5 ← sample uniform Sigma1.MyAlg.i_witness ;; + #put Sigma1.MyAlg.commit_loc := x5 ;; + v0 ← get RO1.queries_loc ;; + a0 ← sample uniform RO1.i_random ;; + #put RO1.queries_loc := setm v0 + (Sigma1.Sigma.prod_assoc (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)))) a0 ;; + x6 ← get Sigma1.MyAlg.commit_loc ;; + let x4 := (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)), a0, fto (Zp_add (otf x6) (Zp_mul (otf a0) (otf x3)))) in + #assert eqn + (size + (domm (T:=[ordType of 'I_#|'I_n|]) (S:='I_#|gT| * ('I_#|gT| * 'I_#|gT| * 'I_#|'Z_Sigma1.q| * 'I_#|'Z_Sigma1.q|)) + (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i + (fto (expgn_rec (T:=gT) g (otf x)), + (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))))) n ;; + #put ckey_loc i := fto + (compute_key + (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i + (fto (expgn_rec (T:=gT) g (otf x)), + (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, + fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))) i) ;; + v0 ← get skey_loc i ;; + v1 ← get ckey_loc i ;; + @ret 'public (fto (expgn_rec (T:=gT) (otf v1) v0 * expgn_rec (T:=gT) g vote)%g) + }. + Next Obligation. + intros. + ssprove_valid ; auto with loc_db. + Qed. + + Lemma code_pkg_equiv m i j (vote : 'bool): + ⊢ + ⦃ λ '(h₀, h₁), h₀ = h₁ ⦄ + get_op_default (Exec_i_realised true m i j) ((Exec i), ('bool, 'public)) vote + ≈ + Exec_i_realised_code m i j vote + ⦃ eq ⦄. + Proof. + unfold Exec_i_realised. + rewrite get_op_default_link. + erewrite get_op_default_spec. + 2: { + cbn. + rewrite eqnE eq_refl. + done. + } + ssprove_code_simpl. + simpl. + repeat choice_type_eqP_handle. + rewrite !cast_fun_K. + ssprove_code_simpl. + simpl. + ssprove_code_simpl. + ssprove_code_simpl_more. + simpl. + ssprove_sync_eq=>x. + simpl. + ssprove_code_simpl_more. + ssprove_sync_eq. + ssprove_sync_eq=>rel1. + ssprove_sync_eq=>r1. + ssprove_sync_eq. + ssprove_code_simpl. + + (* ssprove_sync_eq. *) + (* ssprove_sync_eq. *) + (* intros. *) + + match goal with + | |- context [⊢ ⦃ _ ⦄ #put _ := _ ;; getr _ ?x ≈ #put _ := _ ;; getr _ ?y ⦃ _ ⦄] => + set (x) ; set (y) + end. + + apply (r_transL (#put RO1.queries_loc := emptym ;; r emptym)). + 1: apply r_put_get. + + apply (r_transL (#put RO1.queries_loc := emptym ;; r0 emptym)). + 2: apply r_put_get. + + ssprove_sync_eq. + subst r r0. hnf. + + simpl. + + ssprove_code_simpl. + ssprove_sync_eq=>a. + ssprove_sync_eq. + ssprove_sync_eq=>v. + + match goal with + | |- context [⊢ ⦃ _ ⦄ @pkg_core_definition.sampler _ _ ?x ≈ @pkg_core_definition.sampler _ _ ?y ⦃ _ ⦄] => + set (temp1 := x) ; set (temp2 := y) + end. + + apply r_uniform_bij with (f := (fun (x : Arit (@uniform i_secret Secret_pos)) => (x : Arit (@uniform i_secret Sigma1.MyParam.Witness_pos)))). + 1: exact (inv_bij (fun x => erefl)). + intros. + subst temp1 temp2. hnf. + ssprove_code_simpl. + simpl. + + match goal with + | |- context [⊢ ⦃ _ ⦄ ?x ≈ bind (assertD ?v ?z) ?y ⦃ _ ⦄] => + set (temp1 := x) ; set (temp2 := y) ; set (temp3 := z) ; set (temp4 := v) in * + end. + + change (prod_choiceType _ _) with ( (chElement ((( chFin (mkpos #|gT|) × chFin (mkpos #|gT|)) × chFin (mkpos #|'Z_Sigma1.q|)) × chFin (mkpos #|'Z_Sigma1.q|)))) in *. + + apply (r_transR _ (@assertD _ temp4 (fun z => x ← temp3 z ;; temp2 x))). + 1:{ + eapply r_transL. + 2:{ + apply r_bind_assertD_sym. + } + apply rreflexivity_rule. + } + subst temp1 temp2 temp3 temp4. hnf. + + match goal with + | |- context [⊢ ⦃ _ ⦄ assertD _ ?x ≈ assertD _ ?y ⦃ _ ⦄] => + set (temp1 := x) ; set (temp2 := y) + end. + + change (Sigma1.MyParam.Witness) with (Secret) in *. + change (raw_code _) with (raw_code (chElement (chFin (mkpos #|gT|)))) in temp1. + (* Unset Printing Notations. *) + apply (@r_assertD_same (chFin (mkpos #|gT|)) (Sigma1.MyParam.R (otf (fto (expgn_rec (T:=gT) g (otf x0)))) (otf x0))). + intros. + + subst temp1 temp2. hnf. + simpl. + ssprove_code_simpl. + ssprove_code_simpl_more. + simpl. + ssprove_sync_eq=>a0. + ssprove_sync_eq. + + match goal with + | |- context [⊢ ⦃ _ ⦄ #put _ := _ ;; getr _ ?x ≈ #put _ := _ ;; getr _ ?y ⦃ _ ⦄] => + set (x) ; set (y) + end. + + apply (r_transL (#put RO1.queries_loc := emptym ;; r emptym)). + 1: apply r_put_get. + + apply (r_transL (#put RO1.queries_loc := emptym ;; r0 emptym)). + 2: apply r_put_get. + + ssprove_sync_eq. + subst r r0. hnf. + + simpl. + + ssprove_sync_eq=>a1. + ssprove_sync_eq. + ssprove_sync_eq=>a2. + + match goal with + | |- context [⊢ ⦃ _ ⦄ bind (assertD ?v ?z) ?y ≈ ?x ⦃ _ ⦄] => + set (temp1 := x) ; set (temp2 := y) ; set (temp3 := z) ; set (temp4 := v) in * + end. + + change (prod_choiceType _ _) with ( (chElement ((( chFin (mkpos #|gT|) × chFin (mkpos #|gT|)) × chFin (mkpos #|'Z_Sigma1.q|)) × chFin (mkpos #|'Z_Sigma1.q|)))) in *. + + apply (r_transL (@assertD _ temp4 (fun z => x ← temp3 z ;; temp2 x))). + 1:{ + eapply r_transR. + 1:{ + apply r_bind_assertD_sym. + } + apply rreflexivity_rule. + } + subst temp1 temp2 temp3 temp4. hnf. + + match goal with + | |- context [⊢ ⦃ _ ⦄ assertD _ ?x ≈ assertD _ ?y ⦃ _ ⦄] => + set (temp1 := x) ; set (temp2 := y) + end. + + change (Sigma1.MyParam.Witness) with (Secret) in *. + (* Unset Printing Notations. *) + apply (@r_assertD_same (chFin (mkpos _)) (eq_op _ n)). + + intros. + subst temp1 temp2. hnf. + + ssprove_sync_eq. + ssprove_sync_eq=>a3. + ssprove_sync_eq=>a4. + apply r_ret. + intros. subst. + reflexivity. + + (* ssprove_sync_eq=>queries. + destruct (queries (Sigma1.Sigma.prod_assoc (fto (g ^+ otf x), fto (g ^+ otf r1)))) eqn:e. + all: rewrite e. + - simpl. + ssprove_code_simpl. + ssprove_sync_eq=>?. *) + (* Admitted. *) + Qed. + + #[tactic=notac] Equations? Aux_realised (b : bool) (i j : pid) m f' : + package (DDH.DDH_locs :|: P_i_locs i :|: combined_locations) Game_import [interface #val #[ Exec i ] : 'bool → 'public] := + Aux_realised b i j m f' := {package Aux b i j m f' ∘ (par DDH.DDH_real (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) }. + Proof. + ssprove_valid. + 4:{ rewrite fsetUid. rewrite -fset0E. apply fsub0set. } + 6: apply fsubsetxx. + 3:{ rewrite -fsetUA. apply fsubsetxx. } + 4:{ rewrite -fsetUA. apply fsubsetUl. } + all: unfold combined_locations. + - eapply fsubset_trans. 2: apply fsubsetUr. + apply fsubsetUl. + - eapply fsubset_trans. 2: apply fsubsetUr. + apply fsubsetUr. + - unfold DDH.DDH_E. + apply fsetUS. + rewrite !fset_cons. + apply fsubsetUr. + Qed. + + #[tactic=notac] Equations? Aux_ideal_realised (b : bool) (i j : pid) m f' : + package (DDH.DDH_locs :|: P_i_locs i :|: combined_locations) Game_import [interface #val #[ Exec i ] : 'bool → 'public] := + Aux_ideal_realised b i j m f' := {package Aux b i j m f' ∘ (par DDH.DDH_ideal (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) }. + Proof. + ssprove_valid. + 4:{ rewrite fsetUid. rewrite -fset0E. apply fsub0set. } + 6: apply fsubsetxx. + 3:{ rewrite -fsetUA. apply fsubsetxx. } + 4:{ rewrite -fsetUA. apply fsubsetUl. } + all: unfold combined_locations. + - eapply fsubset_trans. 2: apply fsubsetUr. + apply fsubsetUl. + - eapply fsubset_trans. 2: apply fsubsetUr. + apply fsubsetUr. + - unfold DDH.DDH_E. + apply fsetUS. + rewrite !fset_cons. + apply fsubsetUr. + Qed. + + Notation inv i := (heap_ignore (P_i_locs i :|: DDH.DDH_locs)). + + #[local] Hint Extern 50 (_ = code_link _ _) => + rewrite code_link_scheme + : ssprove_code_simpl. + + (** We extend swapping to schemes. + This means that the ssprove_swap tactic will be able to swap any command + with a scheme without asking a proof from the user. + *) + #[local] Hint Extern 40 (⊢ ⦃ _ ⦄ x ← ?s ;; y ← cmd _ ;; _ ≈ _ ⦃ _ ⦄) => + eapply r_swap_scheme_cmd ; ssprove_valid + : ssprove_swap. + + Lemma P_i_aux_equiv (i j : pid) m: + fdisjoint Sigma1.MyAlg.Sigma_locs DDH.DDH_locs → + i != j → + (∃ f, + bijective f ∧ + (∀ b, (Exec_i_realised b m i j) ≈₀ Aux_realised b i j m f)). + Proof. + intros Hdisj ij_neq. + have [f' Hf] := test_bij' i j m ij_neq. + simpl in Hf. + exists f'. + split. + { + assert ('I_#|'Z_#[g]|) as x. + { rewrite card_ord. + eapply Ordinal. + rewrite ltnS. + apply ltnSn. + } + specialize (Hf x). + destruct Hf. + assumption. + } + intro b. + eapply eq_rel_perf_ind with (inv := inv i). + { + ssprove_invariant. + rewrite -!fsetUA. + apply fsetUS. + do 2 (apply fsubsetU ; apply /orP ; right). + apply fsubsetUl. + } + simplify_eq_rel v. + rewrite !setmE. + rewrite !eq_refl. + ssprove_code_simpl. + repeat simplify_linking. + ssprove_sync => x_i. + + rewrite !cast_fun_K. + ssprove_code_simpl. + ssprove_code_simpl_more. + + ssprove_swap_seq_rhs [:: 4 ; 5 ; 6 ; 7]%N. + ssprove_swap_seq_rhs [:: 2 ; 3 ; 4 ; 5 ; 6]%N. + ssprove_swap_seq_rhs [:: 0 ; 1 ; 2 ; 3 ; 4 ; 5]%N. + ssprove_contract_put_get_rhs. + apply r_put_rhs. + ssprove_swap_seq_lhs [:: 0 ; 1 ; 2 ; 3]%N. + unfold Sigma1.MyParam.R. + have Hord : ∀ x, (nat_of_ord x) = (nat_of_ord (otf x)). + { + unfold otf. + intros n x. + rewrite enum_val_ord. + done. + } + rewrite -Hord otf_fto eq_refl. + simpl. + ssprove_sync => r_i. + apply r_put_vs_put. + ssprove_restore_pre. + { ssprove_invariant. + apply preserve_update_r_ignored_heap_ignore. + - unfold DDH.DDH_locs. + rewrite in_fsetU. + apply /orP ; right. + rewrite fset_cons. + rewrite in_fsetU. + apply /orP ; left. + by apply /fset1P. + - apply preserve_update_mem_nil. + } + lazymatch goal with + | |- ⊢ ⦃ _ ⦄ _ ≈ ?c ⦃ _ ⦄ => + lazymatch c with + | x ← sample ?op ;; _ => + (* Maybe make it one lemma, safer and probably less time consuming *) + eapply (rsame_head_cmd_alt (cmd_sample op)) ; [ + eapply cmd_sample_preserve_pre + | idtac + ] + | #put ?ℓ := ?v ;; _ => + eapply (@rsame_head_cmd_alt _ _ (λ z, _) (λ z, _) (cmd_put ℓ v)) ; [ + eapply cmd_put_preserve_pre ; ssprove_invariant + | intros + ] + | x ← get ?ℓ ;; _ => + eapply (rsame_head_cmd_alt (cmd_get ℓ)) ; [ + eapply cmd_get_preserve_pre ; ssprove_invariant + | idtac + ] + | x ← cmd ?c ;; _ => + eapply (rsame_head_cmd_alt c) + | @assertD ?A ?b _ => + eapply (r_assertD_same A b) + | _ => fail "No head found" + end + | |- _ => fail "The goal should be a syntactic judgment" + end. + (* ssprove_sync. *) + ssprove_swap_seq_lhs [:: 0 ]%N. + ssprove_swap_seq_rhs [:: 2 ; 1 ; 0]%N. + ssprove_sync => queries. + destruct (queries (Sigma1.Sigma.prod_assoc (fto (g ^+ x_i), fto (g ^+ otf r_i)))) eqn:e. + all: rewrite e; simpl. + all: ssprove_code_simpl_more. + - ssprove_swap_seq_lhs [:: 0 ; 1 ; 2 ; 3 ; 4 ; 5]%N. + ssprove_swap_seq_lhs [:: 0 ; 1 ]%N. + eapply r_uniform_bij. + { apply Hf. + + rewrite card_ord. + rewrite Zp_cast. + 2: apply (prime_gt1 prime_order). + eapply Ordinal. + apply (prime_gt1 prime_order). + } + intro x. + specialize (Hf x). + destruct Hf as [bij_f Hf]. + apply bij_inj in bij_f. + apply finv_f in bij_f. + ssprove_contract_put_get_rhs. + rewrite bij_f. + rewrite -Hord !otf_fto !eq_refl. + simpl. + apply r_put_rhs. + ssprove_restore_pre. + { + apply preserve_update_r_ignored_heap_ignore. + - unfold DDH.DDH_locs. + rewrite !fset_cons. + rewrite !in_fsetU. + apply /orP ; right. + apply /orP ; right. + apply /orP ; left. + by apply /fset1P. + - apply preserve_update_mem_nil. + } + apply r_get_remember_lhs. + intros ?. + apply r_get_remember_rhs. + intros ?. + ssprove_forget_all. + ssprove_sync=>r_j. + apply r_put_vs_put. + ssprove_restore_pre. + 1: ssprove_invariant. + clear e queries. + ssprove_sync. + ssprove_swap_seq_lhs [:: 0]%N. + ssprove_sync=>queries. + destruct (queries (Sigma1.Sigma.prod_assoc (fto (g ^+ x), fto (g ^+ otf r_j)))) eqn:e. + all: rewrite e. + all: ssprove_code_simpl. + all: ssprove_code_simpl_more. + + ssprove_swap_seq_lhs [:: 0 ; 1]%N. + simpl. + apply r_get_remember_lhs. + intros ?. + apply r_get_remember_rhs. + intros ?. + ssprove_forget_all. + apply r_assertD. + { + intros ??. + rewrite !domm_set. + done. + } + intros _ _. + ssprove_swap_lhs 1%N. + { + move: H0 => /eqP. + erewrite eqn_add2r. + intros contra. + discriminate. + } + ssprove_contract_put_get_lhs. + apply r_put_lhs. + ssprove_contract_put_get_lhs. + apply r_put_lhs. + ssprove_restore_pre. + { + repeat apply preserve_update_l_ignored_heap_ignore. + 1,2: unfold P_i_locs ; rewrite in_fsetU. + 1,2: apply /orP ; left ; rewrite !fset_cons ; + rewrite -fset0E fsetU0 ; rewrite in_fsetU. + - apply /orP ; right. + by apply /fset1P. + - apply /orP ; left. + by apply /fset1P. + - apply preserve_update_mem_nil. + } + rewrite otf_fto. + rewrite compute_key_set_i. + set zk := (fto (g ^+ x), fto (g ^+ otf r_j), s1, fto (otf x2 + otf s1 * otf x)%R). + clearbody zk. + specialize (Hf zk). + rewrite !Hord. + rewrite Hf. + rewrite -!Hord. + rewrite -expgM. + rewrite mulnC. + case b; apply r_ret ; done. + + ssprove_swap_seq_lhs [:: 0 ; 1 ; 2 ; 3]%N. + simpl. + ssprove_sync=>e_j. + apply r_put_vs_put. + apply r_get_remember_lhs. + intros ?. + apply r_get_remember_rhs. + intros ?. + ssprove_forget_all. + apply r_assertD. + { + intros ??. + rewrite !domm_set. + done. + } + intros _ _. + ssprove_swap_lhs 1%N. + { + move: H0 => /eqP. + erewrite eqn_add2r. + intros contra. + discriminate. + } + ssprove_contract_put_get_lhs. + apply r_put_lhs. + ssprove_contract_put_get_lhs. + apply r_put_lhs. + ssprove_restore_pre. + { + repeat apply preserve_update_l_ignored_heap_ignore. + 1,2: unfold P_i_locs ; rewrite in_fsetU. + 1,2: apply /orP ; left ; rewrite !fset_cons ; + rewrite -fset0E fsetU0 ; rewrite in_fsetU. + - apply /orP ; right. + by apply /fset1P. + - apply /orP ; left. + by apply /fset1P. + - ssprove_invariant. + } + rewrite otf_fto. + rewrite compute_key_set_i. + set zk := (fto (g ^+ x), fto (g ^+ otf r_j), e_j, fto (otf x2 + otf e_j * otf x)%R). + clearbody zk. + specialize (Hf zk). + rewrite !Hord. + rewrite Hf. + rewrite -!Hord. + rewrite -expgM. + rewrite mulnC. + case b; apply r_ret ; done. + - ssprove_swap_seq_lhs [:: 0 ; 1 ; 2 ; 3 ; 4 ; 5 ; 6 ; 7]%N. + ssprove_swap_seq_lhs [:: 2 ; 1 ; 0 ]%N. + eapply r_uniform_bij. + { apply Hf. + + rewrite card_ord. + rewrite Zp_cast. + 2: apply (prime_gt1 prime_order). + eapply Ordinal. + apply (prime_gt1 prime_order). + } + intro x. + specialize (Hf x). + destruct Hf as [bij_f Hf]. + apply bij_inj in bij_f. + apply finv_f in bij_f. + ssprove_contract_put_get_rhs. + rewrite bij_f. + rewrite -Hord !otf_fto !eq_refl. + simpl. + apply r_put_rhs. + ssprove_restore_pre. + { + apply preserve_update_r_ignored_heap_ignore. + - unfold DDH.DDH_locs. + rewrite !fset_cons. + rewrite !in_fsetU. + apply /orP ; right. + apply /orP ; right. + apply /orP ; left. + by apply /fset1P. + - apply preserve_update_mem_nil. + } + ssprove_sync=>e_i. + apply r_put_vs_put. + apply r_get_remember_lhs. + intros ?. + apply r_get_remember_rhs. + intros ?. + ssprove_forget_all. + rewrite -Hord eq_refl. + simpl. + ssprove_sync=>r_j. + apply r_put_vs_put. + ssprove_restore_pre. + 1: ssprove_invariant. + clear e queries. + ssprove_sync. + ssprove_swap_seq_lhs [:: 0]%N. + ssprove_sync=>queries. + destruct (queries (Sigma1.Sigma.prod_assoc (fto (g ^+ x), fto (g ^+ otf r_j)))) eqn:e. + all: rewrite e. + all: ssprove_code_simpl. + all: ssprove_code_simpl_more. + + ssprove_swap_seq_lhs [:: 0 ; 1]%N. + simpl. + apply r_get_remember_lhs. + intros ?. + apply r_get_remember_rhs. + intros ?. + ssprove_forget_all. + apply r_assertD. + { + intros ??. + rewrite !domm_set. + done. + } + intros _ _. + ssprove_swap_lhs 1%N. + { + move: H0 => /eqP. + erewrite eqn_add2r. + intros contra. + discriminate. + } + ssprove_contract_put_get_lhs. + apply r_put_lhs. + ssprove_contract_put_get_lhs. + apply r_put_lhs. + ssprove_restore_pre. + { + repeat apply preserve_update_l_ignored_heap_ignore. + 1,2: unfold P_i_locs ; rewrite in_fsetU. + 1,2: apply /orP ; left ; rewrite !fset_cons ; + rewrite -fset0E fsetU0 ; rewrite in_fsetU. + - apply /orP ; right. + by apply /fset1P. + - apply /orP ; left. + by apply /fset1P. + - apply preserve_update_mem_nil. + } + rewrite otf_fto. + rewrite compute_key_set_i. + set zk := (fto (g ^+ x), fto (g ^+ otf r_j), s, fto (otf x2 + otf s * otf x)%R). + clearbody zk. + specialize (Hf zk). + rewrite !Hord. + rewrite Hf. + rewrite -!Hord. + rewrite -expgM. + rewrite mulnC. + case b; apply r_ret ; done. + + ssprove_swap_seq_lhs [:: 0 ; 1 ; 2 ; 3]%N. + simpl. + ssprove_sync=>e_j. + apply r_put_vs_put. + apply r_get_remember_lhs. + intros ?. + apply r_get_remember_rhs. + intros ?. + ssprove_forget_all. + apply r_assertD. + { + intros ??. + rewrite !domm_set. + done. + } + intros _ _. + ssprove_swap_lhs 1%N. + { + move: H0 => /eqP. + erewrite eqn_add2r. + intros contra. + discriminate. + } + ssprove_contract_put_get_lhs. + apply r_put_lhs. + ssprove_contract_put_get_lhs. + apply r_put_lhs. + ssprove_restore_pre. + { + repeat apply preserve_update_l_ignored_heap_ignore. + 1,2: unfold P_i_locs ; rewrite in_fsetU. + 1,2: apply /orP ; left ; rewrite !fset_cons ; + rewrite -fset0E fsetU0 ; rewrite in_fsetU. + - apply /orP ; right. + by apply /fset1P. + - apply /orP ; left. + by apply /fset1P. + - ssprove_invariant. + } + rewrite otf_fto. + rewrite compute_key_set_i. + set zk := (fto (g ^+ x), fto (g ^+ otf r_j), e_j, fto (otf x2 + otf e_j * otf x)%R). + clearbody zk. + specialize (Hf zk). + rewrite !Hord. + rewrite Hf. + rewrite -!Hord. + rewrite -expgM. + rewrite mulnC. + case b; apply r_ret ; done. + Qed. + + Lemma Hord (x : secret): (nat_of_ord x) = (nat_of_ord (otf x)). + Proof. + unfold otf. + rewrite enum_val_ord. + done. + Qed. + + Lemma vote_hiding_bij (c : secret) (v : bool): + fto (otf (fto (g ^+ c)) * g ^+ v) = + fto + (otf (fto (g ^+ (if v then fto (Zp_add (otf c) Zp1) else fto (Zp_add (otf c) (Zp_opp Zp1))))) * + g ^+ (~~ v)). + Proof. + f_equal. + rewrite !otf_fto. + rewrite -!expgD. + have h' : ∀ (x : Secret), nat_of_ord x = (nat_of_ord (fto x)). + { + unfold fto. + intros k. + rewrite enum_rank_ord. + done. + } + case v. + ++ apply /eqP. + rewrite eq_expg_mod_order. + rewrite addn0. + have h : ∀ (x : secret), (((nat_of_ord x) + 1) %% q'.+2)%N = (nat_of_ord (Zp_add (otf x) Zp1)). + { + intro k. + unfold Zp_add. + simpl. + rewrite -Hord. + apply /eqP. + rewrite eq_sym. + apply /eqP. + rewrite -> Zp_cast at 2. + 2: apply (prime_gt1 prime_order). + rewrite -> Zp_cast at 1. + 2: apply (prime_gt1 prime_order). + rewrite modnDmr. + rewrite Fp_cast. + 2: apply prime_order. + reflexivity. + } + rewrite -h'. + rewrite -h. + rewrite -modn_mod. + rewrite Fp_cast. + 2: apply prime_order. + 1: apply eq_refl. + ++ apply /eqP. + rewrite eq_expg_mod_order. + rewrite addn0. + unfold Zp_add, Zp_opp, Zp1. + simpl. + repeat rewrite -> Zp_cast at 12. + 2-4: apply (prime_gt1 prime_order). + rewrite -!Hord. + have -> : (#[g] - 1 %% #[g])%N = #[g].-1. + { rewrite modn_small. + 2: apply (prime_gt1 prime_order). + by rewrite -subn1. + } + rewrite modn_small. + 2:{ + destruct c as [c Hc]. + move: Hc. + simpl. + unfold DDH.i_space, DDHParams.Space, Secret. + rewrite card_ord. + rewrite Zp_cast. + 2: apply (prime_gt1 prime_order). + done. + } + have -> : (#[g].-1 %% #[g])%N = #[g].-1. + { + rewrite modn_small. + 1: reflexivity. + apply ltnSE. + rewrite -subn1 -2!addn1. + rewrite subnK. + 2: apply (prime_gt0 prime_order). + rewrite addn1. + apply ltnSn. + } + rewrite -h'. + simpl. + rewrite -> Zp_cast at 9. + 2: apply (prime_gt1 prime_order). + rewrite modnDml. + rewrite -subn1. + rewrite -addnA. + rewrite subnK. + 2: apply (prime_gt0 prime_order). + rewrite -modnDmr. + rewrite modnn. + rewrite addn0. + rewrite modn_small. + 1: apply eq_refl. + destruct c as [h Hc]. + move: Hc. + unfold DDH.i_space, DDHParams.Space, Secret. + simpl. + rewrite card_ord. + rewrite Zp_cast. + 2: apply (prime_gt1 prime_order). + done. + Qed. + + Lemma vote_hiding (i j : pid) m: + i != j → + ∀ LA A ϵ_DDH, + ValidPackage LA [interface #val #[ Exec i ] : 'bool → 'public] A_export A → + fdisjoint Sigma1.MyAlg.Sigma_locs DDH.DDH_locs → + fdisjoint LA DDH.DDH_locs → + fdisjoint LA (P_i_locs i) → + fdisjoint LA combined_locations → + (∀ D, DDH.ϵ_DDH D <= ϵ_DDH) → + AdvantageE (Exec_i_realised true m i j) (Exec_i_realised false m i j) A <= ϵ_DDH + ϵ_DDH. + Proof. + intros ij_neq LA A ϵ_DDH Va Hdisj Hdisj2 Hdisj3 Hdisj4 Dadv. + have [f' [bij_f Hf]] := P_i_aux_equiv i j m Hdisj ij_neq. + ssprove triangle (Exec_i_realised true m i j) [:: + (Aux_realised true i j m f').(pack) ; + (Aux true i j m f') ∘ (par DDH.DDH_ideal (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) ; + (Aux false i j m f') ∘ (par DDH.DDH_ideal (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) ; + (Aux_realised false i j m f').(pack) + ] (Exec_i_realised false m i j) A as ineq. + eapply le_trans. + 2: { + instantiate (1 := 0 + ϵ_DDH + 0 + ϵ_DDH + 0). + by rewrite ?GRing.addr0 ?GRing.add0r. + } + eapply le_trans. 1: exact ineq. + clear ineq. + repeat eapply ler_add. + { + apply eq_ler. + specialize (Hf true LA A Va). + apply Hf. + - rewrite fdisjointUr. + apply /andP ; split ; assumption. + - rewrite fdisjointUr. + apply /andP ; split. + 2: assumption. + rewrite fdisjointUr. + apply /andP ; split ; assumption. + } + { + unfold Aux_realised. + rewrite -Advantage_link. + rewrite par_commut. + have -> : (par DDH.DDH_ideal (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) = + (par (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO) DDH.DDH_ideal). + { apply par_commut. ssprove_valid. } + erewrite Advantage_par. + 3: apply DDH.DDH_real. + 3: apply DDH.DDH_ideal. + 2: { + ssprove_valid. + - eapply fsubsetUr. + - apply fsubsetUl. + } + 1: rewrite Advantage_sym ; apply Dadv. + - ssprove_valid. + - unfold trimmed. + rewrite -link_trim_commut. + f_equal. + unfold trim. + rewrite !fset_cons -fset0E fsetU0. + rewrite !filterm_set. + simpl. + rewrite !in_fsetU !in_fset1 !eq_refl. + rewrite filterm0. + done. + - unfold trimmed. + unfold trim. + rewrite !fset_cons -fset0E fsetU0. + rewrite !filterm_set. + simpl. + rewrite !in_fset1 !eq_refl. + rewrite filterm0. + done. + - unfold trimmed. + unfold trim. + rewrite !fset_cons -fset0E fsetU0. + rewrite !filterm_set. + simpl. + rewrite !in_fset1 !eq_refl. + rewrite filterm0. + done. + } + 2:{ + unfold Aux_realised. + rewrite -Advantage_link. + rewrite par_commut. + have -> : (par DDH.DDH_real (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) = + (par (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO) DDH.DDH_real). + { apply par_commut. ssprove_valid. } + erewrite Advantage_par. + 3: apply DDH.DDH_ideal. + 3: apply DDH.DDH_real. + 2: { + ssprove_valid. + - eapply fsubsetUr. + - apply fsubsetUl. + } + 1: apply Dadv. + - ssprove_valid. + - unfold trimmed. + rewrite -link_trim_commut. + f_equal. + unfold trim. + rewrite !fset_cons -fset0E fsetU0. + rewrite !filterm_set. + simpl. + rewrite !in_fsetU !in_fset1 !eq_refl. + rewrite filterm0. + done. + - unfold trimmed. + unfold trim. + unfold DDH.DDH_E. + rewrite !fset_cons -fset0E fsetU0. + rewrite !filterm_set. + simpl. + rewrite !in_fset1 !eq_refl. + rewrite filterm0. + done. + - unfold trimmed. + unfold trim. + unfold DDH.DDH_E. + rewrite !fset_cons -fset0E fsetU0. + rewrite !filterm_set. + simpl. + rewrite !in_fset1 !eq_refl. + rewrite filterm0. + done. + } + 2: { + apply eq_ler. + specialize (Hf false LA A Va). + rewrite Advantage_sym. + apply Hf. + - rewrite fdisjointUr. + apply /andP ; split ; assumption. + - rewrite fdisjointUr. + apply /andP ; split. + 2: assumption. + rewrite fdisjointUr. + apply /andP ; split ; assumption. + } + apply eq_ler. + eapply eq_rel_perf_ind with (inv := inv i). + 5: apply Va. + 1,2: apply Aux_ideal_realised. + 3: { + rewrite fdisjointUr. + apply /andP ; split. + 2: assumption. + rewrite fdisjointUr. + apply /andP ; split ; assumption. + } + 3: { + rewrite fdisjointUr. + apply /andP ; split. + 2: assumption. + rewrite fdisjointUr. + apply /andP ; split ; assumption. + } + { + ssprove_invariant. + rewrite fsetUC. + rewrite -!fsetUA. + apply fsetUS. + apply fsubsetUl. + } + simplify_eq_rel v. + rewrite !setmE. + rewrite !eq_refl. + simpl. + repeat simplify_linking. + rewrite !cast_fun_K. + ssprove_code_simpl. + ssprove_code_simpl_more. + ssprove_sync=>x_i. + ssprove_sync=>x_j. + pose f_v := (fun (x : secret) => + if v then + fto (Zp_add (otf x) Zp1) + else + fto (Zp_add (otf x) (Zp_opp Zp1)) + ). + assert (bijective f_v) as bij_fv. + { + exists (fun x => + if v then + fto (Zp_add (otf x) (Zp_opp Zp1)) + else + fto (Zp_add (otf x) Zp1) + ). + - intro x. + unfold f_v. + case v. + + rewrite otf_fto. + rewrite -Zp_addA. + rewrite Zp_addC. + have -> : (Zp_add Zp1 (Zp_opp Zp1)) = (Zp_add (Zp_opp Zp1) Zp1). + { intro n. by rewrite Zp_addC. } + rewrite Zp_addNz. + rewrite Zp_add0z. + by rewrite fto_otf. + + rewrite otf_fto. + rewrite -Zp_addA. + rewrite Zp_addC. + rewrite Zp_addNz. + rewrite Zp_add0z. + by rewrite fto_otf. + - intro x. + unfold f_v. + case v. + + rewrite otf_fto. + rewrite -Zp_addA. + rewrite Zp_addNz. + rewrite Zp_addC. + rewrite Zp_add0z. + by rewrite fto_otf. + + rewrite otf_fto. + rewrite -Zp_addA. + rewrite Zp_addC. + have -> : (Zp_add Zp1 (Zp_opp Zp1)) = (Zp_add (Zp_opp Zp1) Zp1). + { intro n. by rewrite Zp_addC. } + rewrite Zp_addNz. + rewrite Zp_add0z. + by rewrite fto_otf. + } + eapply r_uniform_bij. + 1: apply bij_fv. + intro c. + ssprove_swap_seq_rhs [:: 1 ; 2]%N. + ssprove_swap_seq_rhs [:: 0 ]%N. + ssprove_swap_seq_lhs [:: 1 ; 2]%N. + ssprove_swap_seq_lhs [:: 0 ]%N. + apply r_put_vs_put. + ssprove_contract_put_get_lhs. + ssprove_contract_put_get_rhs. + apply r_put_vs_put. + ssprove_contract_put_get_lhs. + ssprove_contract_put_get_rhs. + apply r_put_vs_put. + unfold Sigma1.MyParam.R. + rewrite -Hord otf_fto eq_refl. + simpl. + ssprove_sync=>r_i. + apply r_put_vs_put. + ssprove_restore_pre. + { + ssprove_invariant. + apply preserve_update_r_ignored_heap_ignore. + { + rewrite in_fsetU. + apply /orP ; right. + unfold DDH.DDH_locs. + rewrite !fset_cons -fset0E fsetU0. + rewrite in_fsetU. + apply /orP ; right. + rewrite in_fsetU. + apply /orP ; right. + by apply /fset1P. + } + apply preserve_update_l_ignored_heap_ignore. + 2: apply preserve_update_mem_nil. + rewrite in_fsetU. + apply /orP ; right. + unfold DDH.DDH_locs. + rewrite !fset_cons -fset0E fsetU0. + rewrite in_fsetU. + apply /orP ; right. + rewrite in_fsetU. + apply /orP ; right. + by apply /fset1P. + } + ssprove_sync. + ssprove_sync=>queries. + case (queries (Sigma1.Sigma.prod_assoc (fto (g ^+ x_i), fto (g ^+ otf r_i)))) eqn:e. + all: rewrite e. + all: ssprove_code_simpl ; simpl. + all: ssprove_code_simpl_more ; simpl. + - apply r_get_remember_lhs. + intros ?. + apply r_get_remember_rhs. + intros ?. + ssprove_forget_all. + rewrite -Hord otf_fto eq_refl. + simpl. + ssprove_sync=>e_j. + apply r_put_lhs. + apply r_put_rhs. + clear e queries. + ssprove_restore_pre. + 1: ssprove_invariant. + ssprove_sync. + ssprove_sync=>queries. + case (queries (Sigma1.Sigma.prod_assoc (fto (g ^+ finv f' x_j), fto (g ^+ otf e_j)))) eqn:e. + all: rewrite e. + all: simpl; ssprove_code_simpl. + all: ssprove_code_simpl_more. + + apply r_get_remember_lhs. + intros ?. + apply r_get_remember_rhs. + intros ?. + ssprove_forget_all. + apply r_assertD. + { + intros ??. + rewrite !domm_set. + done. + } + intros _ _. + apply r_ret. + intros ???. + split. + 2: assumption. + unfold f_v. + apply vote_hiding_bij. + + ssprove_sync=>e_i. + apply r_put_vs_put. + apply r_get_remember_lhs. + intros ?. + apply r_get_remember_rhs. + intros ?. + ssprove_forget_all. + apply r_assertD. + { + intros ??. + rewrite !domm_set. + done. + } + intros _ _. + ssprove_restore_pre. + 1: ssprove_invariant. + apply r_ret. + intros ???. + split. + 2: assumption. + unfold f_v. + apply vote_hiding_bij. + - ssprove_sync=>e_i. + apply r_put_vs_put. + apply r_get_remember_lhs. + intros ?. + apply r_get_remember_rhs. + intros ?. + ssprove_forget_all. + rewrite -Hord otf_fto. + rewrite -Hord eq_refl. + simpl. + ssprove_sync=>r_j. + apply r_put_lhs. + apply r_put_rhs. + ssprove_restore_pre. + 1: ssprove_invariant. + ssprove_sync. + ssprove_sync=>queries'. + case (queries' (Sigma1.Sigma.prod_assoc (fto (g ^+ finv f' x_j), fto (g ^+ otf r_j)))) eqn:e'. + all: rewrite e'. + all: simpl; ssprove_code_simpl. + all: ssprove_code_simpl_more. + + apply r_get_remember_lhs. + intros ?. + apply r_get_remember_rhs. + intros ?. + ssprove_forget_all. + apply r_assertD. + { + intros ??. + rewrite !domm_set. + done. + } + intros _ _. + apply r_ret. + intros ???. + split. + 2: assumption. + unfold f_v. + apply vote_hiding_bij. + + ssprove_sync=>e_j. + apply r_put_vs_put. + apply r_get_remember_lhs. + intros ?. + apply r_get_remember_rhs. + intros ?. + ssprove_forget_all. + apply r_assertD. + { + intros ??. + rewrite !domm_set. + done. + } + intros _ _. + ssprove_restore_pre. + 1: ssprove_invariant. + apply r_ret. + intros ???. + split. + 2: assumption. + unfold f_v. + apply vote_hiding_bij. + Qed. + +End OVN. +End OVN. diff --git a/ovn/proofs/ssprove/extraction/Schnorr.v b/ovn/proofs/ssprove/extraction/Schnorr.v new file mode 100644 index 0000000..19bf9e6 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Schnorr.v @@ -0,0 +1,687 @@ + +From Relational Require Import OrderEnrichedCategory GenericRulesSimple. + +Set Warnings "-notation-overridden,-ambiguous-paths". +From mathcomp Require Import all_ssreflect all_algebra reals distr realsum + fingroup.fingroup solvable.cyclic prime ssrnat ssreflect ssrfun ssrbool ssrnum + eqtype choice seq. +Set Warnings "notation-overridden,ambiguous-paths". + +From Mon Require Import SPropBase. + +From Crypt Require Import Axioms ChoiceAsOrd SubDistr Couplings + UniformDistrLemmas FreeProbProg Theta_dens RulesStateProb UniformStateProb + pkg_core_definition choice_type pkg_composition pkg_rhl Package Prelude. + +Require Import SigmaProtocol. + +From Coq Require Import Utf8. +From extructures Require Import ord fset fmap. + +From Equations Require Import Equations. +Require Equations.Prop.DepElim. + +Set Equations With UIP. + +Set Bullet Behavior "Strict Subproofs". +Set Default Goal Selector "!". +Set Primitive Projections. + +Local Open Scope ring_scope. +Import GroupScope GRing.Theory. + +Import Num.Def. +Import Num.Theory. +Import Order.POrderTheory. + +Import PackageNotation. + +Module Type GroupParam. + + Parameter gT : finGroupType. + Definition ζ : {set gT} := [set : gT]. + Parameter g : gT. + Parameter g_gen : ζ = <[g]>. + Parameter prime_order : prime #[g]. + +End GroupParam. + +Module Schnorr (GP : GroupParam). + +Import GP. + +(* order of g *) +Definition q : nat := #[g]. + +Module MyParam <: SigmaProtocolParams. + + Definition Witness : finType := [finType of 'Z_q]. + Definition Statement : finType := FinGroup.arg_finType gT. + Definition Message : finType := FinGroup.arg_finType gT. + Definition Challenge : finType := [finType of 'Z_q]. + Definition Response : finType := [finType of 'Z_q]. + Definition Transcript := + prod_finType (prod_finType Message Challenge) Response. + + Definition w0 : Witness := 0. + Definition e0 : Challenge := 0. + Definition z0 : Response := 0. + + Definition R : Statement -> Witness -> bool := + (λ (h : Statement) (w : Witness), h == (g ^+ w)). + + #[export] Instance positive_gT : Positive #|gT|. + Proof. + apply /card_gt0P. exists g. auto. + Qed. + + #[export] Instance Witness_pos : Positive #|Witness|. + Proof. + apply /card_gt0P. exists w0. auto. + Qed. + + Definition Statement_pos : Positive #|Statement| := _. + Definition Message_pos : Positive #|Message| := _. + Definition Challenge_pos : Positive #|Challenge| := _. + Definition Response_pos : Positive #|Response| := _. + Definition Bool_pos : Positive #|bool_choiceType|. + Proof. + rewrite card_bool. done. + Defined. + +End MyParam. + +Module MyAlg <: SigmaProtocolAlgorithms MyParam. + + Import MyParam. + + #[local] Existing Instance Bool_pos. + + Definition choiceWitness : choice_type := 'fin #|Witness|. + Definition choiceStatement : choice_type := 'fin #|Statement|. + Definition choiceMessage : choice_type := 'fin #|Message|. + Definition choiceChallenge : choice_type := 'fin #|Challenge|. + Definition choiceResponse : choice_type := 'fin #|Response|. + Definition choiceTranscript : choice_type := + chProd + (chProd (chProd choiceStatement choiceMessage) choiceChallenge) + choiceResponse. + Definition choiceBool := 'fin #|bool_choiceType|. + + Definition i_witness := #|Witness|. + + Definition commit_loc : Location := (choiceWitness; 2%N). + + Definition Sigma_locs : {fset Location} := fset [:: commit_loc]. + Definition Simulator_locs : {fset Location} := fset0. + + Definition Commit (h : choiceStatement) (w : choiceWitness): + code Sigma_locs [interface] choiceMessage := + {code + r ← sample uniform i_witness ;; + #put commit_loc := r ;; + ret (fto (g ^+ (otf r))) + }. + + Definition Response (h : choiceStatement) (w : choiceWitness) (a : choiceMessage) (e : choiceChallenge) : + code Sigma_locs [interface] choiceResponse := + {code + r ← get commit_loc ;; + ret (fto (otf r + otf e * otf w)) + }. + + Definition Simulate (h : choiceStatement) (e : choiceChallenge) : + code Simulator_locs [interface] choiceTranscript := + {code + z ← sample uniform i_witness ;; + ret (h, fto (g ^+ (otf z) * (otf h ^- (otf e))), e, z) + }. + + Definition Verify (h : choiceStatement) (a : choiceMessage) + (e : choiceChallenge) (z : choiceResponse) : choiceBool := + fto (g ^+ (otf z) == (otf a) * (otf h) ^+ (otf e)). + + Definition Extractor (h : choiceStatement) (a : choiceMessage) + (e : choiceChallenge) (e' : choiceChallenge) + (z : choiceResponse) (z' : choiceResponse) : 'option choiceWitness := + Some (fto ((otf z - otf z') / (otf e - otf e'))). + + Definition KeyGen (w : choiceWitness) := fto (g ^+ w). + +End MyAlg. + + +#[local] Open Scope package_scope. + +Module Sigma := SigmaProtocol MyParam MyAlg. + +Import MyParam MyAlg Sigma. + +Lemma cyclic_zeta: cyclic ζ. +Proof. + apply /cyclicP. exists g. exact: g_gen. +Qed. + +Lemma group_prodC : + ∀ (x y : gT), x * y = y * x. +Proof. + move => x y. + have Hx: exists ix, x = g^+ix. + { apply /cycleP. rewrite -g_gen. + apply: in_setT. + } + have Hy: exists iy, y = g^+iy. + { apply /cycleP. rewrite -g_gen. + apply: in_setT. + } + destruct Hx as [ix Hx]. + destruct Hy as [iy Hy]. + subst. + repeat rewrite -expgD addnC. reflexivity. +Qed. + +Lemma group_prodA : + ∀ (x y z : gT), x * (y * z) = (x * y) * z. +Proof. + move => x y z. + have Hx: exists ix, x = g^+ix. + { apply /cycleP. rewrite -g_gen. + apply: in_setT. + } + have Hy: exists iy, y = g^+iy. + { apply /cycleP. rewrite -g_gen. + apply: in_setT. + } + have Hz: exists iz, z = g^+iz. + { apply /cycleP. rewrite -g_gen. + apply: in_setT. + } + destruct Hx as [ix Hx]. + destruct Hy as [iy Hy]. + + subst. + repeat rewrite -expgD addnC addnA. + rewrite mulgA. + reflexivity. +Qed. + +#[local] Definition f (e w : Witness) : + Arit (uniform i_witness) → Arit (uniform i_witness) := + λ z, fto (otf z + e * w). + +Lemma order_ge1 : succn (succn (Zp_trunc q)) = q. +Proof. + apply Zp_cast, prime_gt1, prime_order. +Qed. + +Lemma bij_f w e : bijective (f w e). +Proof. + unfold f. + exists (λ x, fto (otf x - w * e)). + all: intro x ; unfold fto, otf ; rewrite !enum_rankK. + - by rewrite addrK enum_valK. + - by rewrite subrK enum_valK. +Qed. + + +(* Main theorem. *) +(* Proves that Schnorr is a ∑-protocol with perfect special honest-verifier + zero-knowledge *) +Theorem schnorr_SHVZK : + ∀ LA A, + ValidPackage LA [interface + #val #[ TRANSCRIPT ] : chInput → chTranscript + ] A_export A → + fdisjoint LA Sigma_locs → + ɛ_SHVZK A = 0. +Proof. + intros LA A Va Hdisj. + apply: eq_rel_perf_ind. + all: ssprove_valid. + 3: apply fdisjoints0. + 1:{ instantiate (1 := heap_ignore Sigma_locs). + ssprove_invariant. + apply fsubsetUl. } + simplify_eq_rel hwe. + (* Programming logic part *) + destruct hwe as [[h w] e]. + (* We can only simulate if the relation is valid *) + ssprove_sync_eq. intros rel. + (* When relation holds we can reconstruct the first message from the response *) + unfold R in rel. apply reflection_nonsense in rel. + eapply r_uniform_bij with (1 := bij_f (otf w) (otf e)). intros z_val. + ssprove_contract_put_get_lhs. + apply r_put_lhs. + ssprove_restore_pre. + 1: ssprove_invariant. + apply r_ret. + (* Ambient logic proof of post condition *) + intros s₀ s₁ Hs. + unfold f. + rewrite rel. + split. + 2: apply Hs. + simpl. + rewrite otf_fto expg_mod. + 2: rewrite order_ge1 ; apply expg_order. + rewrite expgD - !expgVn. + rewrite group_prodC group_prodA group_prodC group_prodA /=. + rewrite expg_mod. + 2: rewrite order_ge1 ; apply expg_order. + rewrite -expgM -expgMn. + 2: apply group_prodC. + rewrite mulgV expg1n mul1g. + cbn. rewrite Zp_mulC. + reflexivity. +Qed. + +Lemma otf_neq : + ∀ (a b : choiceChallenge), + a != b → otf a != otf b. +Proof. + intros a b. + apply: contra => H. + rewrite bij_eq in H. + - assumption. + - apply enum_val_bij. +Qed. + +Lemma neq_pos : + ∀ (q : nat) (a b : Zp_finZmodType q), + a != b → + a - b != 0. +Proof. + intros q a b. + apply contraPneq => H_eq. + assert (H : (a - b == 0)). + { by rewrite H_eq. } + rewrite subr_eq0 in H. + apply reflection_nonsense in H. + rewrite H. + unfold not => contra. + rewrite eq_refl in contra. + discriminate. +Qed. + +(* Lemma proving that the output of the extractor defined for Schnorr's + protocol is perfectly indistinguishable from real protocol execution. + *) +Lemma extractor_success: + ∀ LA A, + ValidPackage LA [interface + #val #[ SOUNDNESS ] : chSoundness → 'bool + ] A_export A → + ɛ_soundness A = 0. +Proof. + intros LA A VA. + apply: eq_rel_perf_ind_eq. + 2,3: apply fdisjoints0. + simplify_eq_rel h. + destruct h as [? [? [? [? [? ?]]]]]. + destruct s1. + case [&& _ & _] eqn:e. + all: apply r_ret; auto. + intros h1 h2 ->. + (* Algebraic proof that the produced witness satisfies the relation. *) + unfold R. + unfold "&&" in e. + inversion e. + repeat match goal with + | |- context [ if ?b then _ else _ ] => case b eqn:? + end. + 2,3: discriminate. + rewrite otf_fto in Heqs4. + rewrite otf_fto in e. + apply reflection_nonsense in e. + apply reflection_nonsense in Heqs4. + rewrite H0. + rewrite otf_fto expg_mod. + 2: rewrite order_ge1 ; apply expg_order. + rewrite expgM expg_mod. + 2: rewrite order_ge1 ; apply expg_order. + rewrite expgD -FinRing.zmodVgE expg_zneg. + 2: apply cycle_id. + rewrite Heqs4 e !expgMn. + 2-3: apply group_prodC. + rewrite invMg !expgMn. + 2: apply group_prodC. + rewrite !group_prodA. + rewrite group_prodC 2!group_prodA -expgMn. + 2: apply group_prodC. + rewrite mulVg expg1n mul1g -expg_zneg. + 2:{ + have Hx : exists ix, otf s = g ^+ ix. + { apply /cycleP. rewrite -g_gen. apply: in_setT. } + destruct Hx as [ix ->]. + apply mem_cycle. + } + rewrite expgAC. + rewrite [otf s ^+ (- otf s2) ^+ _] expgAC. + rewrite -expgD -expgM. + have <- := @expg_mod _ q. + 2:{ + have Hx : exists ix, otf s = g ^+ ix. + { apply /cycleP. rewrite -g_gen. apply: in_setT. } + destruct Hx as [ix ->]. + rewrite expgAC /q. + rewrite expg_order. + apply expg1n. + } + rewrite -modnMmr. + have -> : + (modn + (addn (@nat_of_ord (S (S (Zp_trunc q))) (@otf Challenge s1)) + (@nat_of_ord (S (S (Zp_trunc q))) + (@GRing.opp (FinRing.Zmodule.zmodType (Zp_finZmodType (S (Zp_trunc q)))) + (@otf Challenge s2)))) q) = + (@nat_of_ord (S (S (Zp_trunc q))) + (@Zp_add (S (Zp_trunc q)) (@otf Challenge s1) (@Zp_opp (S (Zp_trunc q)) (@otf Challenge s2)))). + { simpl. + rewrite modnDmr. + destruct (otf s2) as [a Ha]. + destruct a as [| Pa]. + - simpl. + rewrite subn0 modnn addn0 modnDr. + rewrite -> order_ge1 at 3. + rewrite modn_small. + + reflexivity. + + rewrite <- order_ge1 at 2. apply ltn_ord. + - simpl. + rewrite <- order_ge1 at 4. + rewrite modnDmr. + reflexivity. + } + have -> : + (modn + (muln (@nat_of_ord (S (S (Zp_trunc q))) + (@GRing.inv (FinRing.UnitRing.unitRingType (Zp_finUnitRingType (Zp_trunc q))) + (@GRing.add (FinRing.Zmodule.zmodType (Zp_finZmodType (S (Zp_trunc q)))) + (@otf Challenge s1) + (@GRing.opp (FinRing.Zmodule.zmodType (Zp_finZmodType (S (Zp_trunc q)))) + (@otf Challenge s2))))) + (@nat_of_ord (S (S (Zp_trunc q))) + (@Zp_add (S (Zp_trunc q)) (@otf Challenge s1) (@Zp_opp (S (Zp_trunc q)) (@otf Challenge s2))))) q) = + (Zp_mul + (@GRing.inv (FinRing.UnitRing.unitRingType (Zp_finUnitRingType (Zp_trunc q))) + (@GRing.add (FinRing.Zmodule.zmodType (Zp_finZmodType (S (Zp_trunc q)))) + (@otf Challenge s1) + (@GRing.opp (FinRing.Zmodule.zmodType (Zp_finZmodType (S (Zp_trunc q)))) + (@otf Challenge s2)))) + (@Zp_add (S (Zp_trunc q)) (@otf Challenge s1) (@Zp_opp (S (Zp_trunc q)) (@otf Challenge s2)))). + { simpl. + rewrite modnDmr. + rewrite <- order_ge1 at 9. + rewrite modnMmr. + reflexivity. + } + rewrite Zp_mulVz. + 1: cbn ; by rewrite eq_refl. + rewrite -> order_ge1 at 1. + apply otf_neq in Heqb. + rewrite prime_coprime. + 2: apply prime_order. + rewrite gtnNdvd. + - done. + - rewrite lt0n. + apply neq_pos. + assumption. + - destruct (otf s1 - otf s2) as [k Hk]. + simpl. + rewrite order_ge1 in Hk. + apply Hk. +Qed. + +(* Main theorem proving that the Schnorr protocol has perfect hiding. *) +Theorem schnorr_com_hiding : + ∀ LA A, + ValidPackage LA [interface + #val #[HIDING] : (chChallenge) × (chChallenge) → chMessage + ] A_export (A ∘ par KEY (ID Hiding_E)) -> + fdisjoint LA KEY_locs -> + fdisjoint LA Sigma_to_Com_locs -> + fdisjoint LA (fset [:: setup_loc]) -> + fdisjoint LA Sigma_locs -> + fdisjoint LA Simulator_locs -> + ɛ_hiding A <= 0. +Proof. + intros LA A VA Hd1 Hd2 Hd3 Hd4 Hd5. + eapply le_trans. + 1: eapply commitment_hiding with (LA := LA). + all: try assumption. + 1: apply fdisjoint0s. + { + unfold Sigma_locs. + unfold commit_loc. + unfold statement_loc. + unfold witness_loc. + rewrite !fset_cons. + rewrite -fset0E. + rewrite fdisjointUr ; apply /andP ; split. + - rewrite fdisjoints1. + rewrite fset1E. + rewrite fsetU0. + rewrite -fset1E. + unfold "\notin". + rewrite in_fset1. + case (_ == _) eqn:e. + 2: done. + move: e => /eqP. + done. + - rewrite fdisjointUr ; apply /andP ; split. + + rewrite fdisjoints1. + rewrite fset1E. + rewrite fsetU0. + rewrite -fset1E. + unfold "\notin". + rewrite in_fset1. + case (_ == _) eqn:e. + 2: done. + move: e => /eqP. + done. + + apply fdisjoints0. + } + rewrite addr0. + rewrite add0r. + erewrite schnorr_SHVZK. + 2: { + ssprove_valid. + 1: instantiate (1 := (LA :|: (setup_loc |: Sigma_to_Com_locs))). + 3: apply fsubsetxx. + 2: apply fsub0set. + - apply fsubsetUl. + - apply fsubsetU ; apply /orP ; right. + apply fsubsetxx. + } + 2: { + (* unfold Sigma_locs. *) + unfold Sigma_to_Com_locs. + unfold Simulator_locs. + rewrite fsetU0. + rewrite fdisjointUl ; apply /andP ; split. + - assumption. + - unfold Sigma_locs. + rewrite fdisjointUl ; apply /andP ; split. + + rewrite fdisjoint1s. + unfold "\notin". + rewrite -fset1E. + rewrite in_fset1. + done. + + unfold Com_locs. + rewrite fset_cons. + rewrite fdisjointUl ; apply /andP ; split. + ++ rewrite fdisjoint1s. + rewrite -fset1E. + unfold "\notin". + rewrite in_fset1. + done. + ++ + rewrite -!fset1E. + rewrite fdisjoint1s. + unfold "\notin". + rewrite in_fset1. + done. + } + rewrite Advantage_sym. + erewrite schnorr_SHVZK. + 2: { + ssprove_valid. + 1: instantiate (1 := (LA :|: (setup_loc |: Sigma_to_Com_locs))). + 3: apply fsubsetxx. + 2: apply fsub0set. + - apply fsubsetUl. + - apply fsubsetU ; apply /orP ; right. + apply fsubsetxx. + } + 2: { + (* unfold Sigma_locs. *) + unfold Sigma_to_Com_locs. + unfold Simulator_locs. + rewrite fsetU0. + rewrite fdisjointUl ; apply /andP ; split. + - assumption. + - unfold Sigma_locs. + rewrite fdisjointUl ; apply /andP ; split. + + rewrite fdisjoint1s. + unfold "\notin". + rewrite -fset1E. + rewrite in_fset1. + done. + + unfold Com_locs. + rewrite fset_cons. + rewrite fdisjointUl ; apply /andP ; split. + ++ rewrite fdisjoint1s. + rewrite -fset1E. + unfold "\notin". + rewrite in_fset1. + done. + ++ + rewrite -!fset1E. + rewrite fdisjoint1s. + unfold "\notin". + rewrite in_fset1. + done. + } + rewrite addr0 add0r. + apply eq_ler. + eapply eq_rel_perf_ind. + 1,2: exact _. + 1:{ + instantiate (1 := (heap_ignore Com_locs)). + ssprove_invariant. + unfold Sigma_to_Com_locs. + rewrite !fset0U. + apply fsubsetU; apply /orP; left. + apply fsubsetU; apply /orP; left. + apply fsubsetU; apply /orP; right. + apply fsubsetU; apply /orP; left. + apply fsubsetxx. + } + 2: apply VA. + 3: { + rewrite fset0U. + rewrite fdisjointUr ; apply /andP ; split. + 2: assumption. + rewrite fdisjointUr ; apply /andP ; split. + 2: assumption. + rewrite fset1E. assumption. + } + 2: { + rewrite fset0U. + rewrite fdisjointUr ; apply /andP ; split. + 2: assumption. + rewrite fdisjointUr ; apply /andP ; split. + 2: assumption. + rewrite fset1E. assumption. + } + rewrite Sigma_to_Com_Aux_equation_1. + simplify_eq_rel hwe. + ssprove_code_simpl. + simplify_linking. + destruct hwe as [e e']. + apply r_const_sample_R. + 1: apply LosslessOp_uniform. + intros e_rand. + rewrite !cast_fun_K. + ssprove_code_simpl. + ssprove_code_simpl_more. + apply r_const_sample_L. + 1: apply LosslessOp_uniform. + intros b. + simpl. + case (Nat.even b) eqn:hb. + - rewrite hb ; clear hb. + ssprove_code_simpl. + ssprove_code_simpl_more. + ssprove_code_simpl. + ssprove_code_simpl_more. + ssprove_sync=>setup. + apply r_assertD. + 1: done. + intros _ _. + ssprove_sync=> w. + apply r_assertD. + 1: done. + intros _ _. + ssprove_sync. + apply r_assertD. + 1: done. + intros _ rel. + ssprove_sync=>x. + ssprove_contract_put_get_lhs. + ssprove_contract_put_get_rhs. + eapply r_put_vs_put. + eapply r_put_vs_put. + eapply r_put_vs_put. + ssprove_restore_pre. 1: ssprove_invariant. + apply r_ret. intuition auto. + - rewrite hb ; clear hb. + ssprove_code_simpl. + ssprove_code_simpl_more. + ssprove_code_simpl. + ssprove_code_simpl_more. + ssprove_sync=>setup. + apply r_assertD. + 1: done. + intros _ _. + ssprove_sync=> w. + apply r_assertD. + 1: done. + intros _ _. + ssprove_sync. + apply r_assertD. + 1: done. + intros _ rel. + ssprove_sync=>x. + ssprove_contract_put_get_lhs. + ssprove_contract_put_get_rhs. + eapply r_put_vs_put. + eapply r_put_vs_put. + eapply r_put_vs_put. + ssprove_restore_pre. 1: ssprove_invariant. + apply r_ret. intuition auto. +Qed. + + +End Schnorr. + +Module GP_Z3 <: GroupParam. + + Definition gT : finGroupType := Zp_finGroupType 2. + Definition ζ : {set gT} := [set : gT]. + Definition g : gT := Zp1. + + Lemma g_gen : ζ = <[g]>. + Proof. + unfold ζ, g. apply Zp_cycle. + Qed. + + Lemma prime_order : prime #[g]. + Proof. + unfold g. + rewrite order_Zp1. + reflexivity. + Qed. + +End GP_Z3. + +Module Schnorr_Z3 := Schnorr GP_Z3. diff --git a/ovn/proofs/ssprove/extraction/SigmaProtocol.v b/ovn/proofs/ssprove/extraction/SigmaProtocol.v new file mode 100644 index 0000000..f0a117a --- /dev/null +++ b/ovn/proofs/ssprove/extraction/SigmaProtocol.v @@ -0,0 +1,1064 @@ + +From Relational Require Import OrderEnrichedCategory GenericRulesSimple. + +Set Warnings "-notation-overridden,-ambiguous-paths". +From mathcomp Require Import all_ssreflect all_algebra reals distr realsum + fingroup.fingroup solvable.cyclic prime ssrnat ssreflect ssrfun ssrbool ssrnum + eqtype choice seq. +Set Warnings "notation-overridden,ambiguous-paths". + +From Crypt Require Import Axioms ChoiceAsOrd SubDistr Couplings + UniformDistrLemmas FreeProbProg Theta_dens RulesStateProb UniformStateProb + pkg_core_definition choice_type pkg_composition pkg_rhl + Package Prelude RandomOracle. + +From Coq Require Import Utf8. +From extructures Require Import ord fset fmap. + +From Equations Require Import Equations. +Require Equations.Prop.DepElim. + +Set Equations With UIP. + +Set Bullet Behavior "Strict Subproofs". +Set Default Goal Selector "!". +Set Primitive Projections. + +Import Num.Def. +Import Num.Theory. +Import Order.POrderTheory. + +Import PackageNotation. + +#[local] Open Scope ring_scope. + +Module Type SigmaProtocolParams. + + Parameter Witness Statement Message Challenge Response : finType. + Parameter w0 : Witness. + Parameter e0 : Challenge. + Parameter z0 : Response. + Parameter R : Statement → Witness → bool. + + Parameter Statement_pos : Positive #|Statement|. + Parameter Witness_pos : Positive #|Witness|. + Parameter Message_pos : Positive #|Message|. + Parameter Challenge_pos : Positive #|Challenge|. + Parameter Response_pos : Positive #|Response|. + Parameter Bool_pos : Positive #|bool_choiceType|. + +End SigmaProtocolParams. + +Module Type SigmaProtocolAlgorithms (π : SigmaProtocolParams). + + Import π. + + #[local] Open Scope package_scope. + + #[local] Existing Instance Bool_pos. + #[local] Existing Instance Statement_pos. + #[local] Existing Instance Witness_pos. + #[local] Existing Instance Message_pos. + #[local] Existing Instance Challenge_pos. + #[local] Existing Instance Response_pos. + + Definition choiceWitness := 'fin #|Witness|. + Definition choiceStatement := 'fin #|Statement|. + Definition choiceMessage := 'fin #|Message|. + Definition choiceChallenge := 'fin #|Challenge|. + Definition choiceResponse := 'fin #|Response|. + Definition choiceTranscript := + chProd (chProd (chProd choiceStatement choiceMessage) choiceChallenge) choiceResponse. + Definition choiceBool := 'fin #|bool_choiceType|. + + Parameter Sigma_locs : {fset Location}. + + Parameter Simulator_locs : {fset Location}. + + Parameter Commit : + ∀ (h : choiceStatement) (w : choiceWitness), + code Sigma_locs [interface] choiceMessage. + + Parameter Response : + ∀ (h : choiceStatement) (w : choiceWitness) + (a : choiceMessage) (e : choiceChallenge), + code Sigma_locs [interface] choiceResponse. + + Parameter Verify : + ∀ (h : choiceStatement) (a : choiceMessage) (e : choiceChallenge) + (z : choiceResponse), + choiceBool. + + Parameter Simulate : + ∀ (h : choiceStatement) (e : choiceChallenge), + code Simulator_locs [interface] choiceTranscript. + + Parameter Extractor : + ∀ (h : choiceStatement) (a : choiceMessage) + (e : choiceChallenge) (e' : choiceChallenge) + (z : choiceResponse) (z' : choiceResponse), + 'option choiceWitness. + + Parameter KeyGen : ∀ (w : choiceWitness), choiceStatement. + +End SigmaProtocolAlgorithms. + +Module SigmaProtocol (π : SigmaProtocolParams) + (Alg : SigmaProtocolAlgorithms π). + + Import π. + Import Alg. + + Notation " 'chStatement' " := + choiceStatement (in custom pack_type at level 2). + Notation " 'chWitness' " := + choiceWitness (in custom pack_type at level 2). + Notation " 'chChallenge' " := + choiceChallenge (in custom pack_type at level 2). + Notation " 'chRelation' " := + (chProd choiceStatement choiceWitness) (in custom pack_type at level 2). + Definition choiceInput := (chProd (chProd choiceStatement choiceWitness) choiceChallenge). + Notation " 'chInput' " := + choiceInput + (in custom pack_type at level 2). + Notation " 'chMessage' " := choiceMessage (in custom pack_type at level 2). + Notation " 'chTranscript' " := + choiceTranscript (in custom pack_type at level 2). + Definition Opening := chProd choiceChallenge choiceResponse. + Notation " 'chSoundness' " := + (chProd choiceStatement (chProd choiceMessage (chProd Opening Opening))) + (in custom pack_type at level 2). + + Definition i_challenge := #|Challenge|. + Definition i_witness := #|Witness|. + + Definition TRANSCRIPT : nat := 0. + Definition COM : nat := 1. + Definition VER : nat := 2. + Definition ADV : nat := 3. + Definition SOUNDNESS : nat := 4. + + Definition i_challenge_pos : Positive i_challenge. + Proof. + unfold i_challenge. + apply Challenge_pos. + Qed. + + Definition i_witness_pos : Positive i_witness. + Proof. + unfold i_witness. + apply Witness_pos. + Qed. + + #[local] Existing Instance i_challenge_pos. + #[local] Existing Instance i_witness_pos. + + #[local] Open Scope package_scope. + + Definition SHVZK_real: + package Sigma_locs + [interface] + [interface #val #[ TRANSCRIPT ] : chInput → chTranscript] + := + [package + #def #[ TRANSCRIPT ] (hwe : chInput) : chTranscript + { + let '(h,w,e) := hwe in + #assert (R (otf h) (otf w)) ;; + a ← Commit h w ;; + z ← Response h w a e ;; + @ret choiceTranscript (h,a,e,z) + } + ]. + + Definition SHVZK_ideal: + package Simulator_locs + [interface] + [interface #val #[ TRANSCRIPT ] : chInput → chTranscript] + := + [package + #def #[ TRANSCRIPT ] (hwe : chInput) : chTranscript + { + let '(h, w, e) := hwe in + #assert (R (otf h) (otf w)) ;; + t ← Simulate h e ;; + ret t + } + ]. + + (* Main security statement for Special Honest-Verifier Zero-Knowledge. *) + Definition ɛ_SHVZK A := AdvantageE SHVZK_real SHVZK_ideal A. + + Definition Special_Soundness_f : + package fset0 + [interface] + [interface #val #[ SOUNDNESS ] : chSoundness → 'bool ] + := + [package + #def #[ SOUNDNESS ] (t : chSoundness) : 'bool + { + let '(h, (a, ((e, z), (e', z')))) := t in + let v1 := Verify h a e z in + let v2 := Verify h a e' z' in + if [&& (e != e') , (otf v1) & (otf v2) ] then + match Extractor h a e e' z z' with + | Some w => ret (R (otf h) (otf w)) + | None => ret false + end + else ret false + } + ]. + + Definition Special_Soundness_t : + package fset0 + [interface] + [interface #val #[ SOUNDNESS ] : chSoundness → 'bool ] + := + [package + #def #[ SOUNDNESS ] (t : chSoundness) : 'bool + { + let '(h, (a, ((e, z), (e', z')))) := t in + let v1 := Verify h a e z in + let v2 := Verify h a e' z' in + ret [&& (e != e') , (otf v1) & (otf v2) ] + } + ]. + + (* Main security statement for 2-special soundness. *) + Definition ɛ_soundness A := + AdvantageE Special_Soundness_t Special_Soundness_f A. + + (**************************************) + (* Start of Commitment Scheme Section *) + (**************************************) + Section Commitments. + + Definition HIDING : nat := 5. + Definition OPEN : nat := 6. + Definition INIT : nat := 7. + Definition GET : nat := 8. + + Definition challenge_loc : Location := ('option choiceChallenge; 7%N). + Definition response_loc : Location := ('option choiceResponse; 8%N). + + Definition Com_locs : {fset Location} := + fset [:: challenge_loc ; response_loc ]. + + + Definition setup_loc : Location := ('bool; 10%N). + Definition statement_loc : Location := (choiceStatement; 11%N). + Definition witness_loc : Location := (choiceWitness; 12%N). + Definition KEY_locs : {fset Location} := fset [:: setup_loc; witness_loc ; statement_loc]. + + Definition choiceOpen := (chProd choiceChallenge choiceResponse). + Notation " 'chOpen' " := choiceOpen (in custom pack_type at level 2). + Notation " 'chKeys' " := (chProd choiceStatement choiceWitness) (in custom pack_type at level 2). + + Lemma in_fset_left l (L1 L2 : {fset Location}) : + is_true (l \in L1) → + is_true (l \in (L1 :|: L2)). + Proof. + intros H. + apply /fsetUP. + left. assumption. + Qed. + + Hint Extern 20 (is_true (_ \in (_ :|: _))) => + apply in_fset_left; solve [auto_in_fset] + : typeclass_instances ssprove_valid_db. + + Definition KEY: + package KEY_locs + [interface] + [interface + #val #[ INIT ] : 'unit → 'unit ; + #val #[ GET ] : 'unit → chStatement + ] + := + [package + #def #[ INIT ] (_ : 'unit) : 'unit + { + b ← get setup_loc ;; + #assert (negb b) ;; + w ← sample uniform i_witness ;; + let h := KeyGen w in + #assert (R (otf h) (otf w)) ;; + #put setup_loc := true ;; + #put statement_loc := h ;; + #put witness_loc := w ;; + @ret 'unit Datatypes.tt + } + ; + #def #[ GET ] (_ : 'unit) : chStatement + { + b ← get setup_loc ;; + if b then + h ← get statement_loc ;; + w ← get witness_loc ;; + ret h + else + fail + } + ]. + + Definition Sigma_to_Com_locs := (Com_locs :|: Simulator_locs). + + #[tactic=notac] Equations? Sigma_to_Com: + package Sigma_to_Com_locs + [interface + #val #[ INIT ] : 'unit → 'unit ; + #val #[ GET ] : 'unit → chStatement + ] + [interface + #val #[ COM ] : chChallenge → chMessage ; + #val #[ OPEN ] : 'unit → chOpen ; + #val #[ VER ] : chTranscript → 'bool + ] + := Sigma_to_Com := + [package + #def #[ COM ] (e : chChallenge) : chMessage + { + #import {sig #[ INIT ] : 'unit → 'unit } as key_gen_init ;; + #import {sig #[ GET ] : 'unit → chStatement } as key_gen_get ;; + _ ← key_gen_init Datatypes.tt ;; + h ← key_gen_get Datatypes.tt ;; + '(h,a,e,z) ← Simulate h e ;; + #put challenge_loc := Some e ;; + #put response_loc := Some z ;; + ret a + } + ; + #def #[ OPEN ] (_ : 'unit) : chOpen + { + o_e ← get challenge_loc ;; + o_z ← get response_loc ;; + match (o_e, o_z) with + | (Some e, Some z) => @ret choiceOpen (e, z) + | _ => fail + end + } + ; + #def #[ VER ] (t : chTranscript) : 'bool + { + let '(h,a,e,z) := t in + ret (otf (Verify h a e z)) + } + ]. + Proof. + unfold Sigma_to_Com_locs. + ssprove_valid. + eapply valid_injectLocations. + 1: apply fsubsetUr. + eapply valid_injectMap. + 2: apply (Simulate x1 x). + rewrite -fset0E. + apply fsub0set. + Qed. + + #[tactic=notac] Equations? Sigma_to_Com_Aux: + package (setup_loc |: Sigma_to_Com_locs) + [interface + #val #[ TRANSCRIPT ] : chInput → chTranscript + ] + [interface + #val #[ COM ] : chChallenge → chMessage ; + #val #[ OPEN ] : 'unit → chOpen ; + #val #[ VER ] : chTranscript → 'bool + ] + := Sigma_to_Com_Aux := + [package + #def #[ COM ] (e : chChallenge) : chMessage + { + #import {sig #[ TRANSCRIPT ] : chInput → chTranscript } as RUN ;; + b ← get setup_loc ;; + #assert (negb b) ;; + w ← sample uniform i_witness ;; + let h := KeyGen w in + #assert (R (otf h) (otf w)) ;; + #put setup_loc := true ;; + '(h, a, e, z) ← RUN (h, w, e) ;; + #put challenge_loc := Some e ;; + #put response_loc := Some z ;; + @ret choiceMessage a + } + ; + #def #[ OPEN ] (_ : 'unit) : chOpen + { + o_e ← get challenge_loc ;; + o_z ← get response_loc ;; + match (o_e, o_z) with + | (Some e, Some z) => @ret choiceOpen (e, z) + | _ => fail + end + } + ; + #def #[ VER ] (t : chTranscript) : 'bool + { + let '(h,a,e,z) := t in + ret (otf (Verify h a e z)) + } + ]. + Proof. + unfold Sigma_to_Com_locs, Com_locs. + ssprove_valid. + all: rewrite in_fsetU ; apply /orP ; right. + all: rewrite in_fsetU ; apply /orP ; left. + all: rewrite !fset_cons. + 1,3 : rewrite in_fsetU ; apply /orP ; left ; rewrite in_fset1 ; done. + 1,2 : rewrite in_fsetU ; apply /orP ; right ; + rewrite in_fsetU ; apply /orP ; left ; + rewrite in_fset1 ; done. + Qed. + + Notation " 'chHiding' " := (chProd choiceChallenge choiceChallenge) (in custom pack_type at level 2). + + Definition Hiding_E := [interface #val #[ HIDING ] : chHiding → chMessage ]. + + (* Commitment to input value*) + Definition Hiding_real: + package fset0 + [interface + #val #[ COM ] : chChallenge → chMessage ; + #val #[ OPEN ] : 'unit → chOpen ; + #val #[ VER ] : chTranscript → 'bool + ] + Hiding_E + := + [package + #def #[ HIDING ] (ms : chHiding) : chMessage + { + #import {sig #[ COM ] : chChallenge → chMessage } as com ;; + let '(m1, m2) := ms in + b ← sample uniform 1 ;; + if Nat.even b then + a ← com m1 ;; + ret a + else + a ← com m2 ;; + ret a + } + ]. + + (* Commitment to random value *) + Definition Hiding_ideal : + package fset0 + [interface + #val #[ COM ] : chChallenge → chMessage ; + #val #[ OPEN ] : 'unit → chOpen ; + #val #[ VER ] : chTranscript → 'bool + ] + Hiding_E + := + [package + #def #[ HIDING ] (_ : chHiding) : chMessage + { + #import {sig #[ COM ] : chChallenge → chMessage } as com ;; + e ← sample uniform i_challenge ;; + t ← com e ;; + ret t + } + ]. + + Definition ɛ_hiding A := + AdvantageE + (Hiding_real ∘ Sigma_to_Com ∘ KEY) + (Hiding_ideal ∘ Sigma_to_Com ∘ KEY) (A ∘ (par KEY (ID Hiding_E))). + + Notation inv := ( + heap_ignore (fset [:: statement_loc ; witness_loc]) + ). + + Instance Invariant_inv : Invariant (Sigma_to_Com_locs :|: KEY_locs) (setup_loc |: Sigma_to_Com_locs) inv. + Proof. + ssprove_invariant. + unfold KEY_locs. + apply fsubsetU ; apply /orP ; left. + apply fsubsetU ; apply /orP ; right. + rewrite !fset_cons. + apply fsubsetU ; apply /orP ; right. + rewrite fsubUset ; apply /andP ; split. + - apply fsubsetU ; apply /orP ; right. + apply fsubsetU ; apply /orP ; left. + apply fsubsetxx. + - apply fsubsetU ; apply /orP ; left. + rewrite fsubUset ; apply /andP ; split. + + apply fsubsetxx. + + rewrite -fset0E. apply fsub0set. + Qed. + + Hint Extern 50 (_ = code_link _ _) => + rewrite code_link_scheme + : ssprove_code_simpl. + + Theorem commitment_hiding : + ∀ LA A, + ValidPackage LA [interface + #val #[ HIDING ] : chHiding → chMessage + ] A_export (A ∘ (par KEY (ID Hiding_E))) → + fdisjoint LA KEY_locs -> + fdisjoint LA Sigma_to_Com_locs -> + fdisjoint LA (fset [:: setup_loc]) -> + fdisjoint LA Sigma_locs -> + fdisjoint LA Simulator_locs -> + fdisjoint Simulator_locs (fset [:: statement_loc ; witness_loc]) -> + fdisjoint Sigma_locs (fset [:: statement_loc ; witness_loc]) -> + (ɛ_hiding A) <= 0 + + AdvantageE SHVZK_ideal SHVZK_real (((A ∘ par KEY (ID Hiding_E)) ∘ Hiding_real) ∘ Sigma_to_Com_Aux) + + AdvantageE (Hiding_real ∘ Sigma_to_Com_Aux ∘ SHVZK_real) + (Hiding_ideal ∘ Sigma_to_Com_Aux ∘ SHVZK_real) (A ∘ par KEY (ID Hiding_E)) + + AdvantageE SHVZK_real SHVZK_ideal (((A ∘ par KEY (ID Hiding_E)) ∘ Hiding_ideal) ∘ Sigma_to_Com_Aux) + + 0. + Proof. + unfold ɛ_hiding, ɛ_SHVZK. + intros LA A VA Hd1 Hd2 Hd3 HdSigma HdSimulator Hd4 Hd5. + ssprove triangle (Hiding_real ∘ Sigma_to_Com ∘ KEY) [:: + (Hiding_real ∘ Sigma_to_Com_Aux ∘ SHVZK_ideal) ; + (Hiding_real ∘ Sigma_to_Com_Aux ∘ SHVZK_real) ; + (Hiding_ideal ∘ Sigma_to_Com_Aux ∘ SHVZK_real) ; + (Hiding_ideal ∘ Sigma_to_Com_Aux ∘ SHVZK_ideal) + ] (Hiding_ideal ∘ Sigma_to_Com ∘ KEY) (A ∘ (par KEY (ID Hiding_E))) + as ineq. + eapply le_trans. 1: exact ineq. + clear ineq. + repeat eapply ler_add. + - apply eq_ler. + eapply eq_rel_perf_ind with (inv := inv). + 5: apply VA. + 1:{ + ssprove_valid. + 3: apply fsub0set. + 3: apply fsubsetxx. + 1: instantiate (1 := (Sigma_to_Com_locs :|: KEY_locs)). + 1: apply fsubsetUl. + 1: apply fsubsetUr. + } + 1:{ + ssprove_valid. + 1: apply fsubsetxx. + 2: apply fsub0set. + 2: apply fsubsetxx. + unfold Sigma_to_Com_locs. + apply fsubsetU ; apply /orP ; right. + apply fsubsetUr. + } + 3,4: rewrite fdisjointUr ; apply /andP ; split. + 3-4,6: assumption. + 3: rewrite fset1E ; assumption. + 1: exact _. + rewrite Sigma_to_Com_equation_1. + rewrite Sigma_to_Com_Aux_equation_1. + simplify_eq_rel h. + ssprove_code_simpl. + destruct h. + ssprove_code_simpl. + ssprove_code_simpl_more. + ssprove_sync=>b. + case (Nat.even b) eqn:Hb ; rewrite Hb. + + ssprove_sync=> setup. + ssprove_code_simpl. + ssprove_code_simpl_more. + apply r_assertD. + 1: done. + intros _ _. + ssprove_sync=> w. + apply r_assertD. + 1: done. + intros _ Rel. + ssprove_swap_seq_lhs [:: 2 ; 1]%N. + ssprove_contract_put_get_lhs. + rewrite !cast_fun_K. + rewrite Rel. + ssprove_code_simpl. + ssprove_code_simpl_more. + ssprove_sync. + ssprove_swap_lhs 1%N. + ssprove_contract_put_get_lhs. + ssprove_swap_seq_lhs [:: 0 ; 1]%N. + ssprove_contract_put_get_lhs. + apply r_put_lhs. + apply r_put_lhs. + ssprove_restore_pre. + 1: ssprove_invariant. + eapply rsame_head_alt. + 1: exact _. + { + unfold inv. + intros l lin h1 s' h2. + apply h2. + move: Hd4 => /fdisjointP Hd4. + apply Hd4. + apply lin. + } + { + unfold inv. + intros l v lin. + apply put_pre_cond_heap_ignore. + } + intros t. + destruct t. + destruct s1. + destruct s1. + ssprove_sync. + ssprove_sync. + apply r_ret. + done. + + ssprove_sync=>setup. + ssprove_code_simpl. + ssprove_code_simpl_more. + apply r_assertD. + 1: done. + intros _ _. + ssprove_sync=>w. + apply r_assertD. + 1: done. + intros _ Rel. + ssprove_swap_seq_lhs [:: 2 ; 1]%N. + ssprove_contract_put_get_lhs. + rewrite !cast_fun_K. + rewrite Rel. + ssprove_code_simpl. + ssprove_code_simpl_more. + ssprove_sync. + ssprove_swap_lhs 1%N. + ssprove_contract_put_get_lhs. + ssprove_swap_seq_lhs [:: 0 ; 1]%N. + ssprove_contract_put_get_lhs. + apply r_put_lhs. + apply r_put_lhs. + ssprove_restore_pre. + 1: ssprove_invariant. + eapply rsame_head_alt. + 1: exact _. + { + unfold inv. + intros l lin h1 s' h2. + apply h2. + move: Hd4 => /fdisjointP Hd4. + apply Hd4. + apply lin. + } + { + unfold inv. + intros l v lin. + apply put_pre_cond_heap_ignore. + } + intros t. + destruct t. + destruct s1. + destruct s1. + ssprove_sync. + ssprove_sync. + apply r_ret. + done. + - rewrite -!Advantage_link. + 1: apply eq_ler ; done. + - done. + - rewrite -!Advantage_link. + 1: apply eq_ler ; done. + - apply eq_ler. + eapply eq_rel_perf_ind with (inv := inv). + 5: apply VA. + 1:{ + ssprove_valid. + 4: apply fsubsetxx. + 3: apply fsub0set. + 2: instantiate (1 := (Simulator_locs :|: (setup_loc |: Sigma_to_Com_locs))). + - apply fsubsetUr. + - apply fsubsetUl. + } + 1:{ + ssprove_valid. + 3: apply fsub0set. + 3: apply fsubsetxx. + 1: instantiate (1 := (Sigma_to_Com_locs :|: KEY_locs)). + - apply fsubsetUl. + - apply fsubsetUr. + } + 3,4: rewrite fdisjointUr ; apply /andP ; split. + 4: rewrite fdisjointUr ; apply /andP ; split. + 3,5-7: assumption. + 3: rewrite fset1E ; assumption. + { + ssprove_invariant. + unfold KEY_locs. + apply fsubsetU ; apply /orP ; right. + apply fsubsetU ; apply /orP ; right. + rewrite !fset_cons. + apply fsubsetU ; apply /orP ; right. + rewrite fsubUset ; apply /andP ; split. + - apply fsubsetU ; apply /orP ; right. + apply fsubsetU ; apply /orP ; left. + apply fsubsetxx. + - apply fsubsetU ; apply /orP ; left. + rewrite fsubUset ; apply /andP ; split. + + apply fsubsetxx. + + rewrite -fset0E. apply fsub0set. + } + rewrite Sigma_to_Com_equation_1. + rewrite Sigma_to_Com_Aux_equation_1. + simplify_eq_rel h. + ssprove_code_simpl. + destruct h. + ssprove_code_simpl. + ssprove_code_simpl_more. + ssprove_sync=>e. + ssprove_sync=> setup. + ssprove_code_simpl. + ssprove_code_simpl_more. + apply r_assertD. + 1: done. + intros _ _. + ssprove_sync=> w. + apply r_assertD. + 1: done. + intros _ Rel. + ssprove_swap_seq_rhs [:: 2 ; 1]%N. + ssprove_contract_put_get_rhs. + rewrite !cast_fun_K. + rewrite Rel. + ssprove_code_simpl. + ssprove_code_simpl_more. + ssprove_sync. + ssprove_swap_rhs 1%N. + ssprove_contract_put_get_rhs. + ssprove_swap_seq_rhs [:: 0 ; 1]%N. + ssprove_contract_put_get_rhs. + apply r_put_rhs. + apply r_put_rhs. + ssprove_restore_pre. + 1: ssprove_invariant. + eapply rsame_head_alt. + 1: exact _. + { + unfold inv. + intros l lin h1 s' h2. + apply h2. + move: Hd4 => /fdisjointP Hd4. + apply Hd4. + apply lin. + } + { + unfold inv. + intros l v lin. + apply put_pre_cond_heap_ignore. + } + intros t. + destruct t. + destruct s1. + destruct s1. + ssprove_sync. + ssprove_sync. + apply r_ret. + done. + Qed. + + Definition Com_Binding: + package fset0 + [interface + #val #[ COM ] : chChallenge → chMessage ; + #val #[ OPEN ] : 'unit → chOpen ; + #val #[ VER ] : chTranscript → 'bool + ] + [interface #val #[ SOUNDNESS ] : chSoundness → 'bool ] + := + [package + #def #[ SOUNDNESS ] (t : chSoundness) : 'bool + { + #import {sig #[ VER ] : chTranscript → 'bool } as Ver ;; + let '(h, (a, ((e, z), (e', z')))) := t in + v1 ← Ver (h, a, e, z) ;; + v2 ← Ver (h, a, e', z') ;; + ret [&& (e != e'), v1 & v2] + } + ]. + + Lemma commitment_binding : + ∀ LA A, + ValidPackage LA [interface + #val #[ SOUNDNESS ] : chSoundness → 'bool + ] A_export A → + fdisjoint LA (Sigma_to_Com_locs :|: KEY_locs) → + AdvantageE (Com_Binding ∘ Sigma_to_Com ∘ KEY) (Special_Soundness_t) A = 0. + Proof. + intros LA A VA Hdisj. + eapply eq_rel_perf_ind_eq. + 4: apply VA. + 1:{ + ssprove_valid. + 3: apply fsub0set. + 1: instantiate (1 := (Sigma_to_Com_locs :|: KEY_locs)). + 2: apply fsubsetUr. + 1: apply fsubsetUl. + apply fsubsetxx. + } + 1: ssprove_valid. + 2: assumption. + 2: apply fdisjoints0. + rewrite Sigma_to_Com_equation_1. + simplify_eq_rel h. + ssprove_code_simpl. + simpl. + destruct h, s0, s1, s1, s2. + apply r_ret. auto. + Qed. + + End Commitments. + + (* This section aim to prove an automatic conversation between the sampling of the random challenge and a random oracle. *) + (* The main difference is that the random oracle is a query parametrized by the context of the execution. *) + + Module OracleParams <: ROParams. + + Definition Query := prod_finType Statement Message. + Definition Random := Challenge. + + Definition Query_pos : Positive #|Query|. + Proof. + unfold Query. rewrite !card_prod. + apply Positive_prod. + - apply Statement_pos. + - apply Message_pos. + Qed. + + Definition Random_pos : Positive #|Random| := Challenge_pos. + + End OracleParams. + + Module Oracle := RO OracleParams. + + Import Oracle OracleParams. + + Section FiatShamir. + + Definition RUN : nat := 7. + Definition VERIFY : nat := 8. + Definition SIM : nat := 9. + + Context (Sim_locs : {fset Location}). + Context (Sim : choiceStatement → code Sim_locs [interface] choiceTranscript). + + Definition prod_assoc : chProd choiceStatement choiceMessage → chQuery. + Proof. + cbn. intros [statement message]. + rewrite !card_prod. + apply mxvec_index. all: assumption. + Qed. + + (* TW: I moved it here because it might induce back-tracking and we want to + avoid it because of time-consumption. + *) + Hint Extern 20 (ValidCode ?L ?I ?c.(prog)) => + eapply valid_injectMap ; [| eapply c.(prog_valid) ] + : typeclass_instances ssprove_valid_db. + + Definition Fiat_Shamir : + package Sigma_locs + [interface + #val #[ INIT ] : 'unit → 'unit ; + #val #[ QUERY ] : 'query → 'random + ] + [interface + #val #[ VERIFY ] : chTranscript → 'bool ; + #val #[ RUN ] : chRelation → chTranscript + ] + := + [package + #def #[ VERIFY ] (t : chTranscript) : 'bool + { + #import {sig #[ QUERY ] : 'query → 'random } as RO_query ;; + let '(h,a,e,z) := t in + e ← RO_query (prod_assoc (h, a)) ;; + ret (otf (Verify h a e z)) + } ; + #def #[ RUN ] (hw : chRelation) : chTranscript + { + #import {sig #[ INIT ] : 'unit → 'unit } as RO_init ;; + #import {sig #[ QUERY ] : 'query → 'random } as RO_query ;; + let '(h,w) := hw in + #assert (R (otf h) (otf w)) ;; + a ← Commit h w ;; + RO_init Datatypes.tt ;; + e ← RO_query (prod_assoc (h, a)) ;; + z ← Response h w a e ;; + @ret choiceTranscript (h,a,e,z) + } + ]. + + Definition Fiat_Shamir_SIM : + package Sim_locs + [interface + #val #[ QUERY ] : 'query → 'random + ] + [interface + #val #[ VERIFY ] : chTranscript → 'bool ; + #val #[ RUN ] : chRelation → chTranscript + ] + := + [package + #def #[ VERIFY ] (t : chTranscript) : 'bool + { + #import {sig #[ QUERY ] : 'query → 'random } as RO_query ;; + let '(h,a,e,z) := t in + e ← RO_query (prod_assoc (h, a)) ;; + ret (otf (Verify h a e z)) + } ; + #def #[ RUN ] (hw : chRelation) : chTranscript + { + let '(h,w) := hw in + #assert (R (otf h) (otf w)) ;; + t ← Sim h ;; + ret t + } + ]. + + Definition RUN_interactive : + package Sigma_locs + [interface] + [interface + #val #[ VERIFY ] : chTranscript → 'bool ; + #val #[ RUN ] : chRelation → chTranscript + ] + := + [package + #def #[ VERIFY ] (t : chTranscript) : 'bool + { + let '(h,a,e,z) := t in + ret (otf (Verify h a e z)) + } ; + #def #[ RUN ] (hw : chRelation) : chTranscript + { + let '(h,w) := hw in + #assert (R (otf h) (otf w)) ;; + a ← Commit h w ;; + e ← sample uniform i_random ;; + z ← Response h w a e ;; + @ret choiceTranscript (h,a,e,z) + } + ]. + + Definition SHVZK_real_aux : + package Sigma_locs + [interface #val #[ TRANSCRIPT ] : chInput → chTranscript ] + [interface #val #[ RUN ] : chRelation → chTranscript ] + := + [package + #def #[ RUN ] (hw : chRelation) : chTranscript + { + #import {sig #[ TRANSCRIPT ] : chInput → chTranscript } as SHVZK ;; + e ← sample uniform i_random ;; + t ← SHVZK (hw, e) ;; + ret t + } + ]. + + Lemma run_interactive_shvzk : + ∀ LA A, + ValidPackage LA [interface + #val #[ RUN ] : chRelation → chTranscript + ] A_export A → + fdisjoint LA Sigma_locs → + AdvantageE RUN_interactive (SHVZK_real_aux ∘ SHVZK_real) A = 0. + Proof. + intros LA A Va Hdisj. + eapply eq_rel_perf_ind_eq. + 5,6: apply Hdisj. + 4: apply Va. + 2:{ + rewrite <- fsetUid. + eapply valid_link. + - apply SHVZK_real_aux. + - apply SHVZK_real. + } + 1:{ + eapply valid_package_inject_export. + 2: apply RUN_interactive. + apply fsubset_ext. intros ? ?. + rewrite fset_cons. apply /fsetUP. right. assumption. + } + simplify_eq_rel hw. + ssprove_code_simpl. + rewrite cast_fun_K. + ssprove_code_simpl. + destruct hw as [h w]. + ssprove_code_simpl_more. ssprove_code_simpl. + ssprove_swap_rhs 0%N. + ssprove_sync_eq. intro rel. + ssprove_swap_rhs 0%N. + apply rsame_head. intros [a st]. + ssprove_sync_eq. intro e. + apply rsame_head. intro z. + apply r_ret. intuition auto. + Qed. + + Hint Extern 50 (_ = code_link _ _) => + rewrite code_link_scheme + : ssprove_code_simpl. + + Theorem fiat_shamir_correct : + ∀ LA A , + ValidPackage LA [interface + #val #[ RUN ] : chRelation → chTranscript + ] A_export A → + fdisjoint LA (Sigma_locs :|: RO_locs) → + fdisjoint Sigma_locs RO_locs → + AdvantageE (Fiat_Shamir ∘ RO) RUN_interactive A = 0. + Proof. + intros LA A Va Hdisj Hdisj_oracle. + eapply eq_rel_perf_ind_ignore. + 6: apply Hdisj. + 6:{ + rewrite fdisjointUr in Hdisj. move: Hdisj => /andP [h _]. + apply h. + } + 5: apply Va. + 1:{ + ssprove_valid. + 2: apply fsubsetUl. + 2: apply fsubsetUr. + eapply valid_package_inject_export. + 2: apply Fiat_Shamir. + apply fsubset_ext. intros. + rewrite fset_cons. apply /fsetUP. right. assumption. + } + 1:{ + eapply valid_package_inject_export. + 2: apply RUN_interactive. + apply fsubset_ext. intros. + rewrite fset_cons. apply /fsetUP. right. assumption. + } + 1:{ apply fsubsetU. erewrite fsubsetUr. auto. } + simplify_eq_rel hw. + ssprove_code_simpl. + destruct hw as [h w]. + ssprove_sync. intros rel. + eapply rsame_head_alt. + 1: exact _. + 1:{ + intros l Il. + apply get_pre_cond_heap_ignore. + revert l Il. + apply /fdisjointP. + assumption. + } + 1:{ intros. apply put_pre_cond_heap_ignore. } + intros [a st]. + ssprove_contract_put_get_lhs. + rewrite emptymE. + apply r_put_lhs. + ssprove_sync. intro e. + apply r_put_lhs. + ssprove_restore_pre. 1: ssprove_invariant. + eapply r_reflexivity_alt. + - exact _. + - intros l Il. + ssprove_invariant. + revert l Il. + apply /fdisjointP. assumption. + - intros. ssprove_invariant. + Qed. + + (* GOAL: reason about ZK property *) + + End FiatShamir. + +End SigmaProtocol. diff --git a/ovn/proofs/ssprove/extraction/_CoqProject b/ovn/proofs/ssprove/extraction/_CoqProject index 4a3e1aa..985b8a9 100644 --- a/ovn/proofs/ssprove/extraction/_CoqProject +++ b/ovn/proofs/ssprove/extraction/_CoqProject @@ -2,9 +2,21 @@ -arg -w -arg all +# Taken from Crypt (as branches are not merged!) +SigmaProtocol.v +Schnorr.v +DDH.v +OVN.v + +# Written by hand Hacspec_lib.v Core.v HashMap.v + +# Translated Hacspec_ovn_Schnorr_Random_oracle.v Hacspec_ovn_Schnorr.v Hacspec_ovn.v + +# Equality proof between the two versions! +ovn_eq_proof.v \ No newline at end of file diff --git a/ovn/proofs/ssprove/extraction/ovn_eq_proof.v b/ovn/proofs/ssprove/extraction/ovn_eq_proof.v new file mode 100644 index 0000000..32d2181 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/ovn_eq_proof.v @@ -0,0 +1,3 @@ +Require Import Hacspec_ovn. +From Crypt Require Import choice_type Package Prelude. +Require Import OVN. From 28cf6ac144b5511c8d8a12abcdf157b5066cc21e Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Fri, 28 Jul 2023 14:39:30 +0200 Subject: [PATCH 06/86] Working on EQ proof --- ovn/proofs/ssprove/extraction/Hacspec_lib.v | 4 +- ovn/proofs/ssprove/extraction/OVN.v | 5 +- ovn/proofs/ssprove/extraction/_CoqProject | 1 + ovn/proofs/ssprove/extraction/ovn_eq_proof.v | 224 ++++++++- ovn/proofs/ssprove/extraction/pkg_advantage.v | 469 ++++++++++++++++++ 5 files changed, 698 insertions(+), 5 deletions(-) create mode 100644 ovn/proofs/ssprove/extraction/pkg_advantage.v diff --git a/ovn/proofs/ssprove/extraction/Hacspec_lib.v b/ovn/proofs/ssprove/extraction/Hacspec_lib.v index 1ee5131..be58d50 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_lib.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_lib.v @@ -262,12 +262,12 @@ Proof. exact {| as_seq := array_to_seq x ; as_nseq := x |}. Defined. -Notation " x .[ a ]" := (array_index (n_seq_array_or_seq x _) a) (at level 40). +Notation " x '.a[' a ']'" := (array_index (n_seq_array_or_seq x _) a) (at level 40). Program Definition (* Equations *) array_upd {A: choice_type} {len : uint_size} {L I} (s: both L I (nseq A len)) {WS} (i: both L I (@int WS)) (new_v: both L I A) : both L I (nseq A len) := (* array_upd s i new_v := *) Hacspec_Lib.array_upd s i new_v. Fail Next Obligation. -Notation " x .[ i ]<- a" := (array_upd x i a) (at level 40). +Notation " x '.a[' i ']<-' a" := (array_upd x i a) (at level 40). (* Definition update {A : Type} `{Default A} {len slen} (s : nseq A len) {WS} (start : @int WS) (start_a : array_or_seq A slen) : nseq A len := *) (* array_update (a := A) (len := len) s (unsigned start) (as_seq start_a). *) diff --git a/ovn/proofs/ssprove/extraction/OVN.v b/ovn/proofs/ssprove/extraction/OVN.v index 552bbe5..6687dc2 100644 --- a/ovn/proofs/ssprove/extraction/OVN.v +++ b/ovn/proofs/ssprove/extraction/OVN.v @@ -11,6 +11,7 @@ From Crypt Require Import Axioms ChoiceAsOrd SubDistr Couplings UniformDistrLemmas FreeProbProg Theta_dens RulesStateProb UniformStateProb pkg_composition Package Prelude (* Schnorr *) (* DDH *). +Require Import pkg_advantage. Require Import SigmaProtocol. Require Import Schnorr. Require Import DDH. @@ -886,8 +887,6 @@ Module OVN (π2 : CDSParams) (Alg2 : SigmaProtocolAlgorithms π2). Definition combined_locations := (Sigma1.MyAlg.Sigma_locs :|: RO1.RO_locs). - From Hacspec Require Import Hacspec_Lib. - Equations? Exec_i_realised b m (i j : pid) : package (P_i_locs i :|: combined_locations) [interface] (Exec_i_E i) := Exec_i_realised b m i j := {package (Exec_i i j m) ∘ (par ((P_i i b) ∘ (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) @@ -1778,6 +1777,7 @@ Module OVN (π2 : CDSParams) (Alg2 : SigmaProtocolAlgorithms π2). case b; apply r_ret ; done. Qed. + Check secret. Lemma Hord (x : secret): (nat_of_ord x) = (nat_of_ord (otf x)). Proof. unfold otf. @@ -1934,6 +1934,7 @@ Module OVN (π2 : CDSParams) (Alg2 : SigmaProtocolAlgorithms π2). have -> : (par DDH.DDH_ideal (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) = (par (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO) DDH.DDH_ideal). { apply par_commut. ssprove_valid. } + Locate Advantage_par. erewrite Advantage_par. 3: apply DDH.DDH_real. 3: apply DDH.DDH_ideal. diff --git a/ovn/proofs/ssprove/extraction/_CoqProject b/ovn/proofs/ssprove/extraction/_CoqProject index 985b8a9..9860176 100644 --- a/ovn/proofs/ssprove/extraction/_CoqProject +++ b/ovn/proofs/ssprove/extraction/_CoqProject @@ -3,6 +3,7 @@ -arg all # Taken from Crypt (as branches are not merged!) +pkg_advantage.v SigmaProtocol.v Schnorr.v DDH.v diff --git a/ovn/proofs/ssprove/extraction/ovn_eq_proof.v b/ovn/proofs/ssprove/extraction/ovn_eq_proof.v index 32d2181..db7d9fa 100644 --- a/ovn/proofs/ssprove/extraction/ovn_eq_proof.v +++ b/ovn/proofs/ssprove/extraction/ovn_eq_proof.v @@ -1,3 +1,225 @@ +Set Warnings "-notation-overridden,-ambiguous-paths". +From mathcomp Require Import all_ssreflect. + +From JasminSSProve Require Import jasmin_translate. +From Crypt Require Import Prelude Package pkg_composition. +From Crypt Require Import Axioms. (* proof_irrelevance *) +From extructures Require Import ord fset fmap. +Import PackageNotation. + +#[global] Hint Resolve preceq_I preceq_O preceq_refl : preceq. + +Definition pdisj (P : precond) (s_id : p_id) (rhs : {fset Location}) := + (forall h1 h2 l a v s_id', l = translate_var s_id' v -> (s_id ⪯ s_id') -> (P (h1, h2) -> P (set_heap h1 l a, h2))) /\ + (forall h1 h2 l a, l \in rhs -> (P (h1, h2) -> P (h1, set_heap h2 l a))). + +(* From Crypt Require Import choice_type Package Prelude. *) + +Require Import Hacspec_ovn_Schnorr_Random_oracle. + +Require Import SigmaProtocol. +Require Import DDH. + +Require Import Hacspec_ovn_Schnorr. + +Require Import Schnorr. + Require Import Hacspec_ovn. -From Crypt Require Import choice_type Package Prelude. + +From Hacspec Require Import ChoiceEquality. +(* From Hacspec Require Import Hacspec_Lib_Pre. *) +From Hacspec Require Import Hacspec_Lib. + +Module Schnorr_eq (GP : GroupParam). + Import GP. + Module Sigma1 := Schnorr GP. + Module RO1 := Sigma1.Sigma.Oracle. + + Check both_prog. + + (* Check (chProd Sigma1.MyAlg.choiceStatement Sigma1.MyAlg.choiceWitness). *) + Locate choiceTranscript. + + Definition Schnorr_translate_type (x : Sigma1.MyAlg.choiceStatement × Sigma1.MyAlg.choiceWitness) : t_Relation := + (Hacspec_Lib_Pre.repr _ (word.modulus (nat_of_ord (fst x))), + Hacspec_Lib_Pre.repr _ (word.modulus (nat_of_ord (snd x) ))). + + Ltac destruct_pre := + repeat + match goal with + | [ H : set_lhs _ _ _ _ |- _ ] => + let sn := fresh in + let Hsn := fresh in + destruct H as [sn [Hsn]] + | [ H : set_rhs _ _ _ _ |- _ ] => + let sn := fresh in + let Hsn := fresh in + destruct H as [sn [Hsn]] + | [ H : _ /\ _ |- _ ] => + let H1 := fresh in + let H2 := fresh in + destruct H as [H1 H2] + | [ H : (_ ⋊ _) _ |- _ ] => + let H1 := fresh in + let H2 := fresh in + destruct H as [H1 H2] + | [ H : exists _, _ |- _ ] => + let o := fresh in + destruct H as [o] + end; simpl in *; subst. + + Ltac remove_get_in_lhs := + eapply better_r_get_remind_lhs ; + unfold Remembers_lhs , rem_lhs ; + [ intros ? ? ? ; + destruct_pre ; + repeat (rewrite get_set_heap_neq ; [ | apply injective_translate_var3 ; reflexivity ]) ; + rewrite get_set_heap_eq ; + reflexivity | ]. + + From Crypt Require Import Axioms. + + Check proof_irrelevance. + + Lemma both_eq : forall {A : choice_type} {L I} (a b : both L I A), + both_prog a = both_prog b -> + a = b. + Proof. + intros. + destruct a , b. + cbn in *. subst. + f_equal ; apply proof_irrelevance. + Qed. + + Lemma bind_ret_both : forall {A B : choice_type} {L I} `{fsubset_loc : is_true (fsubset (fset [::]) L)} `{fsubset_opsig : is_true (fsubset (fset [::]) I)} (f : A -> both L I B) (x : A), + (bind_both (fsubset_loc := fsubset_loc) (fsubset_opsig := fsubset_opsig) (ret_both x) f) = f x. + Proof. + intros. + apply both_eq. + simpl. + unfold bind_raw_both. + simpl. + destruct (f x). simpl. + destruct both_prog. simpl. + reflexivity. + Qed. + + Theorem Schnorr_eq_proof id0 (pre : precond) : + forall (hw : (Sigma1.MyAlg.choiceStatement × Sigma1.MyAlg.choiceWitness)), + (pdisj pre id0 (fset0)) -> + ⊢ ⦃ pre ⦄ + is_state (both_prog (fiat_shamir_run (ret_both (Schnorr_translate_type hw)))) + ≈ + get_op_default (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO) (Sigma1.Sigma.RUN, ((chProd Sigma1.MyAlg.choiceStatement Sigma1.MyAlg.choiceWitness), Sigma1.MyAlg.choiceTranscript)) hw + ⦃ fun '(v0, h0) '(v1, h1) => pre (h0, h1) ⦄. + Proof. + intros. + + (* Unfolding and simplifying to raw code! *) + (* TODO: Work on higher level than raw code? *) + + rewrite get_op_default_link. + erewrite get_op_default_spec. + 2: { + cbn. + done. + } + ssprove_code_simpl. + + rewrite fiat_shamir_run_equation_1. + destruct hw. + + ssprove_code_simpl. + ssprove_code_simpl_more. + + unfold let_both at 1. + + unfold prod_to_prod_n at 1 ; fold @prod_to_prod_n ; rewrite prod_to_prod_equation_1 ; rewrite !bind_ret_both ; simpl. + unfold Schnorr_translate_type ; simpl. + rewrite v_Commit_equation_1. + + unfold Build_t_G at 1. + + + unfold is_state , both_prog. + rewrite !let_both_equation_1. + unfold both_prog. + rewrite !prod_both_equation_1. + setoid_rewrite bind_assoc. + setoid_rewrite bind_assoc. + setoid_rewrite bind_assoc. + setoid_rewrite bind_assoc. + (* unfold is_state, ret_both, lift_both, both_prog, bind_both, bind_raw_both. *) + + (* Actual proof *) + + match goal with + | [ |- context [ ⊢ ⦃ ?P ⦄ ?x ≈ assertD ?b ?f ⦃ ?Q ⦄ ] ] => + change x with (assertD true (fun _ => x)) ; + apply (r_assertD true b pre _ (fun _ => x)) + end. + { + intros. + admit. + } + intros. + + match goal with + | [ |- context [ ⊢ ⦃ ?P ⦄ bind ?a ?f ≈ pkg_core_definition.sampler ?x ?y ⦃ ?Q ⦄ ] ] => + set (a) ; set (f) ; set (x) ; set (y) + end. + Check pkg_core_definition.sampler o. + pose (Arit o). + cbn in t. + pose Sigma1.MyAlg.i_witness. + cbn in n. + + assert (s1 : forall (x : Arit o), commit_loc). + { clear. intros. + apply (Schnorr_translate_type). + split. + (* apply (Hacspec_Lib_Pre.repr _ (word.modulus 1%nat)). *) + 2:{ + apply x. + }. + admit. + } + replace (x ← r ;; r0 _) with (x ← sample o ;; r0 (s1 x)) by admit. + apply r_uniform_bij with (f := id). + { + apply injF_bij. + apply inj_id. + } + intros. + subst r0 r1. + hnf. + + + Set Printing Coercions. + Unset Printing Notations. + + pose (r_bind). + + apply r_bind. + + bind_jazz_bind. + + + + apply r_assertR. + r_assertR. + + rewrite bind_assoc. + rewrite bind_assoc. + + r_assertR. + + ssprove_sync_eq. + + Require Import OVN. + +(* Exec_i_realised *) +(* {package (Exec_i i j m) ∘ (par ((P_i i b) ∘ (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) *) +(* (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO))} *) + diff --git a/ovn/proofs/ssprove/extraction/pkg_advantage.v b/ovn/proofs/ssprove/extraction/pkg_advantage.v new file mode 100644 index 0000000..e17f21f --- /dev/null +++ b/ovn/proofs/ssprove/extraction/pkg_advantage.v @@ -0,0 +1,469 @@ +(** Notion of adversary and advantage *) + + +From Coq Require Import Utf8. +From Relational Require Import OrderEnrichedCategory + OrderEnrichedRelativeMonadExamples. +Set Warnings "-ambiguous-paths,-notation-overridden,-notation-incompatible-format". +From mathcomp Require Import ssrnat ssreflect ssrfun ssrbool ssrnum eqtype + choice reals distr seq all_algebra fintype realsum. +Set Warnings "ambiguous-paths,notation-overridden,notation-incompatible-format". +From extructures Require Import ord fset fmap. +From Mon Require Import SPropBase. +From Crypt Require Import Prelude Axioms ChoiceAsOrd SubDistr Couplings + RulesStateProb UniformStateProb UniformDistrLemmas StateTransfThetaDens + StateTransformingLaxMorph choice_type pkg_core_definition pkg_notation + pkg_tactics pkg_composition pkg_heap pkg_semantics pkg_lookup. +Require Import Equations.Prop.DepElim. +From Equations Require Import Equations. + +(* Must come after importing Equations.Equations, who knows why. *) +From Crypt Require Import FreeProbProg. + +Import Num.Theory. + +Set Equations With UIP. +Set Equations Transparent. + +Import SPropNotations. +Import PackageNotation. +Import RSemanticNotation. + +Set Bullet Behavior "Strict Subproofs". +Set Default Goal Selector "!". +Set Primitive Projections. + +#[local] Open Scope rsemantic_scope. + +#[local] Open Scope fset. +#[local] Open Scope fset_scope. +#[local] Open Scope type_scope. +#[local] Open Scope package_scope. +#[local] Open Scope ring_scope. +#[local] Open Scope real_scope. + +Definition Game_import : Interface := [interface]. + +Definition Game_Type (Game_export : Interface) : Type := + loc_package Game_import Game_export. + +Definition RUN := (0%N, ('unit, 'bool)). + +Definition A_export : Interface := fset1 RUN. + +Lemma RUN_in_A_export : RUN \in A_export. +Proof. + apply in_fset1. +Qed. + +Definition Adversary4Game (Game_export : Interface) : Type := + loc_package Game_export A_export. + +Definition Adversary4Game_weak (Game_export : Interface) : Type := + package fset0 Game_export A_export. + +Definition Game_op_import_S : Type := {_ : ident & void}. + +Definition Game_import_P : Game_op_import_S → choiceType := + λ v, let 'existT a b := v in match b with end. + +Definition Pr_code {A} (p : raw_code A) : + heap_choiceType → SDistr (F_choice_prod_obj ⟨ A , heap_choiceType ⟩) := + λ s, thetaFstd A (repr p) s. + +(* TODO REMOVE? *) +Definition Pr_raw_func_code {A B} (p : A → raw_code B) : + A → heap_choiceType → SDistr (F_choice_prod_obj ⟨ B , heap_choiceType ⟩) := + λ a s, Pr_code (p a) s. + +Definition Pr_op (p : raw_package) (o : opsig) (x : src o) : + heap_choiceType → SDistr (F_choice_prod_obj ⟨ tgt o , heap_choiceType ⟩) := + Pr_code (get_op_default p o x). + +Arguments SDistr_bind {_ _}. + +Definition Pr (p : raw_package) : + SDistr (bool_choiceType) := + SDistr_bind + (λ '(b, _), SDistr_unit _ b) + (Pr_op p RUN Datatypes.tt empty_heap). + +Definition loc_GamePair (Game_export : Interface) := + bool → Game_Type Game_export. + +(* TODO Again, why not an actual pair? *) +Definition GamePair := + bool → raw_package. + +Definition Advantage (G : GamePair) (A : raw_package) : R := + `| Pr (A ∘ (G false)) true - Pr (A ∘ (G true)) true |. + +Definition AdvantageE (G₀ G₁ : raw_package) (A : raw_package) : R := + `| Pr (A ∘ G₀) true - Pr (A ∘ G₁) true |. + +(* TODO We could have the following + Not clear it would be an improvement. It would be shorter but maybe not + as easy to work with. +*) + +(* Record AdversaryFor {I} (G : loc_GamePair I) := mkAdversary { + adv_pack : loc_package I A_export ; + adv_disj_false : fdisjoint adv_pack.(locs) (G false).(locs) ; + adv_disj_true : fdisjoint adv_pack.(locs) (G true).(locs) +}. + +Coercion adv_pack : AdversaryFor >-> loc_package. *) + +(* TODO Update to the new setting *) +(* Lemma pr_weak {Game_export : Interface} + (A : Adversary4Game Game_export) (G : loc_package _ _) : + Pr {locpackage link (turn_adversary_weak A) G } true = + Pr {locpackage link A G } true. +Proof. +Admitted. *) + +(* TODO UPDATE, first figure out what its role is *) +(* Definition perf_ind {Game_export : Interface} + (G0 : Game_Type Game_export) (G1 : Game_Type Game_export) := + ∀ A, + fdisjoint A.(locs) G0.(locs) → + fdisjoint A.(locs) G1.(locs) → + AdvantageE G0 G1 A = 0. *) + +(* TODO UPDATE *) +(* Definition perf_ind_weak {Game_export : Interface} + (G0 : Game_Type Game_export) (G1 : Game_Type Game_export) := + ∀ A, AdvantageE_weak G0 G1 A = 0. *) + +(* Definition perf_ind_weak_implies_perf_ind {Game_export : Interface} + (G0 : Game_Type Game_export) (G1 : Game_Type Game_export) + (h : perf_ind_weak G0 G1) : perf_ind G0 G1. +Proof. + unfold perf_ind, perf_ind_weak, AdvantageE, AdvantageE_weak in *. + intros A H1 H2. + rewrite -(pr_weak A G0). + rewrite -(pr_weak A G1). + apply h. +Qed. *) + +(* Notation "ε( GP )" := + (AdvantageE (GP false) (GP true)) + (at level 90) + : package_scope. *) + +Definition state_pass_ {A} (p : raw_code A) : + heap_choiceType → raw_code (prod_choiceType A heap_choiceType). +Proof. + induction p; intros h. + - constructor. + exact (x, h). + - apply (opr o). + + exact x. + + intros v. exact (X v h). + - apply X. + + exact (get_heap h l). + + exact h. + - apply IHp. + apply (set_heap h l v). + - apply (sampler op). + intros v. exact (X v h). +Defined. + +Definition state_pass__valid {A} {L} {I} (p : raw_code A) + (h : ValidCode L I p) : + ∀ hp, ValidCode fset0 I (state_pass_ p hp). +Proof. + intro hp. + unfold ValidCode in *. + induction h in hp |- *. + - cbn. constructor. + - simpl. constructor. + + assumption. + + intros t. eauto. + - simpl. eauto. + - simpl. eauto. + - simpl. constructor. + intros v. eauto. +Qed. + +Definition state_pass {A} (p : raw_code A) : raw_code A := + bind (state_pass_ p empty_heap) (λ '(r, _), ret r). + +Definition state_pass_valid {A} {L} {I} (p : raw_code A) + (h : ValidCode L I p) : + ValidCode fset0 I (state_pass p). +Proof. + apply valid_bind. + - apply (state_pass__valid p h empty_heap). + - intros x. destruct x. constructor. +Qed. + +(* TODO Will have to be updated *) +(* Probably by having first an operation on raw_packages + and then a validity proof. +*) +Definition turn_adversary_weak {Game_export : Interface} + (A : Adversary4Game Game_export) : Adversary4Game_weak Game_export. +Proof. + unfold Adversary4Game_weak. + pose (get_op A RUN RUN_in_A_export Datatypes.tt) as run. + destruct run as [run valid_run]. + cbn in *. + pose (state_pass run) as raw_run_st. + pose (state_pass_valid run valid_run) as raw_run_st_valid. + apply funmkpack. + - unfold flat, A_export. + intros n u1 u2. + move /fset1P => h1. + move /fset1P => h2. + inversion h1. inversion h2. + reflexivity. + - intros o. + move /fset1P => hin. + subst. intros _. + exists raw_run_st. + assumption. +Defined. + +Definition adv_equiv {L₀ L₁ E} (G₀ G₁ : raw_package) + `{ValidPackage L₀ Game_import E G₀} `{ValidPackage L₁ Game_import E G₁} ε := + ∀ LA A, + ValidPackage LA E A_export A → + fdisjoint LA L₀ → + fdisjoint LA L₁ → + AdvantageE G₀ G₁ A = ε A. + +Notation " G0 ≈[ R ] G1 " := + (adv_equiv G0 G1 R) + (at level 50, format " G0 ≈[ R ] G1") + : package_scope. + +Notation " G0 ≈₀ G1 " := + (G0 ≈[ λ (_ : raw_package), 0 ] G1) + (at level 50, format " G0 ≈₀ G1") + : package_scope. + +Lemma Advantage_equiv : + ∀ I (G : loc_GamePair I), + (G false) ≈[ Advantage G ] (G true). +Proof. + intros I G. intros LA A vA hd₀ hd₁. reflexivity. +Qed. + +Lemma AdvantageE_equiv : + ∀ I (G₀ G₁ : Game_Type I), + G₀ ≈[ AdvantageE G₀ G₁ ] G₁. +Proof. + intros I G₀ G₁. intros LA A vA hd₀ hd₁. reflexivity. +Qed. + +Lemma Advantage_E : + ∀ (G : GamePair) A, + Advantage G A = AdvantageE (G false) (G true) A. +Proof. + intros G A. + reflexivity. +Qed. + +Lemma Advantage_link : + ∀ G₀ G₁ A P, + AdvantageE G₀ G₁ (A ∘ P) = + AdvantageE (P ∘ G₀) (P ∘ G₁) A. +Proof. + intros G₀ G₁ A P. + unfold AdvantageE. rewrite !link_assoc. reflexivity. +Qed. + +Lemma Advantage_par_empty : + ∀ G₀ G₁ A, + AdvantageE (par emptym G₀) (par emptym G₁) A = AdvantageE G₀ G₁ A. +Proof. + intros G₀ G₁ A. + unfold AdvantageE. + rewrite distrC. + reflexivity. +Qed. + +Lemma Advantage_par : + ∀ G₀ G₁ G₁' A L₀ L₁ L₁' E₀ E₁, + ValidPackage L₀ Game_import E₀ G₀ → + ValidPackage L₁ Game_import E₁ G₁ → + ValidPackage L₁' Game_import E₁ G₁' → + flat E₁ → + trimmed E₀ G₀ → + trimmed E₁ G₁ → + trimmed E₁ G₁' → + AdvantageE (par G₀ G₁) (par G₀ G₁') A = + AdvantageE G₁ G₁' (A ∘ par G₀ (ID E₁)). +Proof. + intros G₀ G₁ G₁' A L₀ L₁ L₁' E₀ E₁. + intros Va0 Va1 Va1' Fe0 Te0 Te1 Te1'. + replace (par G₀ G₁) with ((par G₀ (ID E₁)) ∘ (par (ID Game_import) G₁)). + 2:{ + erewrite <- interchange. + all: ssprove_valid. + 4:{ + ssprove_valid. + rewrite domm_ID_fset. + rewrite -fset0E. + apply fdisjoint0s. + } + 2:{ unfold Game_import. rewrite -fset0E. discriminate. } + 2: apply trimmed_ID. + rewrite link_id. + 2:{ unfold Game_import. rewrite -fset0E. discriminate. } + 2: assumption. + rewrite id_link. + 2: assumption. + reflexivity. + } + replace (par G₀ G₁') with ((par G₀ (ID E₁)) ∘ (par (ID Game_import) G₁')). + 2:{ + erewrite <- interchange. + all: ssprove_valid. + 4:{ + ssprove_valid. + rewrite domm_ID_fset. + rewrite -fset0E. + apply fdisjoint0s. + } + 2:{ unfold Game_import. rewrite -fset0E. discriminate. } + 2: apply trimmed_ID. + rewrite link_id. + 2:{ unfold Game_import. rewrite -fset0E. discriminate. } + 2: assumption. + rewrite id_link. + 2: assumption. + reflexivity. + } + rewrite -Advantage_link. + unfold Game_import. rewrite -fset0E. + rewrite Advantage_par_empty. + reflexivity. + Unshelve. all: auto. +Qed. + +Lemma Advantage_sym : + ∀ P Q A, + AdvantageE P Q A = AdvantageE Q P A. +Proof. + intros P Q A. + unfold AdvantageE. + rewrite distrC. reflexivity. +Qed. + +Lemma adv_equiv_sym : + ∀ L₀ L₁ E G₀ G₁ h₀ h₁ ε, + @adv_equiv L₀ L₁ E G₀ G₁ h₀ h₁ ε → + adv_equiv G₁ G₀ ε. +Proof. + intros L₀ L₁ E G₀ G₁ h₀ h₁ ε h. + intros LA A hA hd₁ hd₀. + rewrite Advantage_sym. + eapply h. all: eauto. +Qed. + +Lemma Advantage_triangle : + ∀ P Q R A, + AdvantageE P Q A <= AdvantageE P R A + AdvantageE R Q A. +Proof. + intros P Q R A. + unfold AdvantageE. + apply ler_dist_add. +Qed. + +Fixpoint advantage_sum P l Q A := + match l with + | [::] => AdvantageE P Q A + | R :: l => AdvantageE P R A + advantage_sum R l Q A + end. + +Lemma Advantage_triangle_chain : + ∀ P (l : seq raw_package) Q A, + AdvantageE P Q A <= advantage_sum P l Q A. +Proof. + intros P l Q A. + induction l as [| R l ih] in P, Q |- *. + - simpl. auto. + - simpl. eapply order.Order.POrderTheory.le_trans. + + eapply Advantage_triangle. + + eapply ler_add. + * auto. + * eapply ih. +Qed. + +Lemma AdvantageE_le_0 : + ∀ G₀ G₁ A, + AdvantageE G₀ G₁ A <= 0 → + AdvantageE G₀ G₁ A = 0. +Proof. + intros G₀ G₁ A h. + unfold AdvantageE in *. + rewrite normr_le0 in h. + apply/normr0P. auto. +Qed. + +Lemma Advantage_le_0 : + ∀ G A, + Advantage G A <= 0 → + Advantage G A = 0. +Proof. + intros G A h. + rewrite -> Advantage_E in *. apply AdvantageE_le_0. auto. +Qed. + +Lemma TriangleInequality : + ∀ {Game_export : Interface} + {F G H : Game_Type Game_export} + {ϵ1 ϵ2 ϵ3}, + F ≈[ ϵ1 ] G → + G ≈[ ϵ2 ] H → + F ≈[ ϵ3 ] H → + ∀ LA A, + ValidPackage LA Game_export A_export A → + fdisjoint LA F.(locs) → + fdisjoint LA G.(locs) → + fdisjoint LA H.(locs) → + ϵ3 A <= ϵ1 A + ϵ2 A. +Proof. + intros Game_export F G H ε₁ ε₂ ε₃ h1 h2 h3 LA A vA hF hG hH. + unfold adv_equiv in *. + erewrite <- h1, <- h2, <- h3 by eassumption. + apply ler_dist_add. +Qed. + +Lemma Reduction : + ∀ (M : raw_package) (G : GamePair) A b, + `| Pr (A ∘ (M ∘ (G b))) true | = + `| Pr ((A ∘ M) ∘ (G b)) true |. +Proof. + intros M G A b. + rewrite link_assoc. reflexivity. +Qed. + +Lemma ReductionLem : + ∀ L₀ L₁ E M (G : GamePair) + `{ValidPackage L₀ Game_import E (M ∘ G false)} + `{ValidPackage L₁ Game_import E (M ∘ G true)}, + (M ∘ (G false)) ≈[ λ A, Advantage G (A ∘ M) ] (M ∘ (G true)). +Proof. + intros L₀ L₁ E M G v₀ v₁. + unfold adv_equiv. intros LA A vA hd₀ hd₁. rewrite Advantage_E. + unfold AdvantageE. rewrite !link_assoc. reflexivity. +Qed. + +Ltac advantage_sum_simpl_in h := + repeat + change (advantage_sum ?P (?R :: ?l) ?Q ?A) + with (AdvantageE P R A + advantage_sum R l Q A) in h ; + change (advantage_sum ?P [::] ?Q ?A) with (AdvantageE P Q A) in h. + +Ltac ssprove_triangle_as p₀ l p₁ A ineq := + pose proof (Advantage_triangle_chain p₀ l p₁ A) as ineq ; + advantage_sum_simpl_in ineq ; + rewrite ?ssralg.GRing.addrA in ineq. + +Tactic Notation + "ssprove" "triangle" constr(p₀) constr(l) constr(p₁) constr(A) + "as" ident(ineq) := + ssprove_triangle_as p₀ l p₁ A ineq. From 412b18f31070080b851625e146e67a1260ac1b34 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Mon, 14 Aug 2023 18:21:21 +0200 Subject: [PATCH 07/86] OVN_template --- ovn/proofs/ssprove/extraction/Hacspec_lib.v | 2 +- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 161 ++- .../extraction/Hacspec_ovn_GroupParameter.v | 33 + .../ssprove/extraction/Hacspec_ovn_Schnorr.v | 38 +- .../Hacspec_ovn_Schnorr_Random_oracle.v | 995 +++++++++++++++++- ovn/proofs/ssprove/extraction/HashMap.v | 22 +- ovn/proofs/ssprove/extraction/ovn_eq_proof.v | 622 +++++++++-- ovn/src/ovn_template.rs | 123 +++ 8 files changed, 1808 insertions(+), 188 deletions(-) create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_GroupParameter.v create mode 100644 ovn/src/ovn_template.rs diff --git a/ovn/proofs/ssprove/extraction/Hacspec_lib.v b/ovn/proofs/ssprove/extraction/Hacspec_lib.v index be58d50..5f53b5a 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_lib.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_lib.v @@ -79,7 +79,7 @@ Class Subtraction L1 L2 (* L3 *) I1 I2 (* I3 *) (A : choice_type) (* `(H_loc_fs sub : both L1 I1 A -> both L2 I2 A -> both (L1 :|: L2) (* L3 *) (I1 :|: I2) (* I3 *) A. Notation "a .- b" := (sub a b (Subtraction := _)). (* Instance array_sub_inst {ws : wsize} {len: uint_size} {L1 L2 I1 I2} : Subtraction L1 L2 I1 I2 (nseq (@int ws) len) := { sub a b := a array_minus b }. *) -Instance int_sub_inst {ws : wsize} {L1 L2 L3 I1 I2 I3} `{H_loc_fsubset13 : is_true (fsubset L1 L3)} `{H_opsig_fsubset13 : is_true (fsubset I1 I3)} `{H_loc_fsubset23 : is_true (fsubset L2 L3)} `{H_opsig_fsubset23 : is_true (fsubset I2 I3)} : Subtraction L1 L2 (* L3 *) I1 I2 (* I3 *) (@int ws) (* H_loc_fsubset13 H_opsig_fsubset13 H_loc_fsubset23 H_opsig_fsubset23 *) := { sub a b := int_sub (* (H_loc_incl_x := H_loc_fsubset13) (H_opsig_incl_x := H_opsig_fsubset13) (H_loc_incl_y := H_loc_fsubset23) (H_opsig_incl_y := H_opsig_fsubset23) *) a b }. +Instance int_sub_inst {ws : wsize} {L1 L2 (* L3 *) I1 I2 (* I3 *)} (* `{H_loc_fsubset13 : is_true (fsubset L1 L3)} `{H_opsig_fsubset13 : is_true (fsubset I1 I3)} `{H_loc_fsubset23 : is_true (fsubset L2 L3)} `{H_opsig_fsubset23 : is_true (fsubset I2 I3)} *) : Subtraction L1 L2 (* L3 *) I1 I2 (* I3 *) (@int ws) (* H_loc_fsubset13 H_opsig_fsubset13 H_loc_fsubset23 H_opsig_fsubset23 *) := { sub a b := int_sub (* (H_loc_incl_x := H_loc_fsubset13) (H_opsig_incl_x := H_opsig_fsubset13) (H_loc_incl_y := H_loc_fsubset23) (H_opsig_incl_y := H_opsig_fsubset23) *) a b }. Class Multiplication (L1 L2 (* L3 *) : {fset Location}) (I1 I2 (* I3 *) : Interface) A (* `(H_loc_incl1 : is_true (fsubset L1 L3)) (H_opsig_incl1 : is_true (fsubset I1 I3)) (H_loc_incl2 : is_true (fsubset L2 L3)) (H_opsig_incl2 : is_true (fsubset I2 I3)) *) := mul : both L1 I1 A -> both L2 I2 A -> both (L1 :|: L2) (* L3 *) (I1 :|: I2) (* I3 *) A. Notation "a .* b" := (mul a b). diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 78190d3..4a61820 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -26,58 +26,147 @@ Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. (*Not implemented yet? todo(item)*) -Require Import Hacspec_lib. -Export Hacspec_lib. +Require Import (* Hacspec_ovn_ *)Hacspec_lib. +Export (* Hacspec_ovn_ *)Hacspec_lib. + +Class t_Group (Self : choice_type) := { + t_group_type : choice_type ; + (* t_group_type_t_PartialEq :> t_PartialEq (t_group_type) ; *) + (* t_group_type_t_Sized :> t_Sized (t_group_type) ; *) + q : forall {L I}, both L I uint_size ; + g : t_group_type ; + g_pow : forall {L I}, both L I uint_size -> both L I t_group_type ; + one : forall {L I}, both L I t_group_type ; + prod : forall {L1 L2 I1 I2}, both L1 I1 t_group_type -> both L2 I2 t_group_type -> both (L1 :|: L2) (I1 :|: I2) t_group_type ; + div : forall {L1 L2 I1 I2}, both L1 I1 t_group_type -> both L2 I2 t_group_type -> both (L1 :|: L2) (I1 :|: I2) t_group_type ; + random_element : t_group_type ; +}. + +Definition t_eligible_votes : choice_type := + (uint_size). +Equations Build_t_eligible_votes {L : {fset Location}} {I : Interface} (f_v_id : both L I (uint_size)) : both L I (t_eligible_votes) := + Build_t_eligible_votes f_v_id := + bind_both f_v_id (fun f_v_id => + solve_lift (ret_both ((f_v_id) : (t_eligible_votes)))) : both L I (t_eligible_votes). +Fail Next Obligation. -(*Not implemented yet? todo(item)*) +Equations n : both (fset []) ([interface ]) (uint_size) := + n := + solve_lift (ret_both (3 : uint_size)) : both (fset []) ([interface ]) (uint_size). +Fail Next Obligation. -Require Import Hacspec_ovn_Schnorr. -Export Hacspec_ovn_Schnorr. +Equations v_P : both (fset []) ([interface ]) (nseq t_eligible_votes 3) := + v_P := + array_from_list [solve_lift (Build_t_eligible_votes (* Build_t_C_eligible_votes *) (ret_both (0 : uint_size))); + solve_lift (Build_t_eligible_votes (* Build_t_C_eligible_votes *) (ret_both (1 : uint_size))); + solve_lift (Build_t_eligible_votes (* Build_t_C_eligible_votes *) (ret_both (2 : uint_size)))] : both (fset []) ([interface ]) (nseq t_eligible_votes 3). +Fail Next Obligation. -Notation t_Secret := (t_Q). +Equations select_private_voting_key (G : _) (* `{ t_Sized (G)} *) `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := + select_private_voting_key G random := + solve_lift (random .% q) : both (L1) (I1) (uint_size). +Fail Next Obligation. -Equations sample_uniform : both (fset []) ([interface ]) (t_Q) := - sample_uniform := - solve_lift (Build_t_Q (ret_both (1 : int32))) : both (fset []) ([interface ]) (t_Q). +Equations v_ZKP (G : _) (* `{ t_Sized (G)} *) `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (xi : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := + v_ZKP G xi := + solve_lift (ret_both (0 : uint_size)) : both (L1) (I1) (uint_size). Fail Next Obligation. -Notation t_public := (t_G). +Require Import Core. -Notation t_public_key := ((t_G × (t_G × t_G × t_Q × t_Q))). +Equations get_broadcast1 : both (fset []) ([interface ]) ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))) := + get_broadcast1 := + solve_lift (prod_b (@new _ fset0 fset0,@new _ fset0 fset0)) : both (fset []) ([interface ]) ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))). +Fail Next Obligation. -Equations p_i_init {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both (L1 :|: fset [commit_loc]) (I1) ((t_G × (t_G × t_G × t_Q × t_Q))) := - p_i_init _ := - letb x := (sample_uniform) : both _ _ (t_Q) in - letb y := (Build_t_G (ret_both (1 : int32))) : both _ _ (t_G) in - letb zkp := (fiat_shamir_run (prod_b (y,x))) : both _ _ ((t_G × t_G × t_Q × t_Q)) in - solve_lift (prod_b (y,zkp)) : both (L1 :|: fset [commit_loc]) (I1) ((t_G × (t_G × t_G × t_Q × t_Q))). +Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (uint_size)) : both (L1) (I1) ('bool) := + check_valid zkp := + solve_lift (ret_both (true : 'bool)) : both (L1) (I1) ('bool). Fail Next Obligation. -Notation t_N := (nat_mod 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab). -Definition N {L : {fset Location}} {I : Interface} : both L I (t_N) -> both L I (t_N) := - id. +Equations broadcast1 (G : _) (* `{ t_Sized (G)} *) `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (t_group_type)) (zkp : both L2 I2 (uint_size)) (i : both L3 I3 (uint_size)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := + broadcast1 G xi zkp i := + solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). +Fail Next Obligation. -Notation t_pid := (t_N). +Require Import (* Hacspec_ovn_ *)Hacspec_lib. +Export (* Hacspec_ovn_ *)Hacspec_lib. + +Definition prod1_loc {G : _} (* `{ t_Sized (G)} *) `{ t_Group (G)} : Location := + (t_group_type ; 0%nat). +Equations register_vote (G : _) (* `{ t_Sized (G)} *) `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (i : both L1 I1 (uint_size)) (random : both L2 I2 (uint_size)) : both (L1:|:L2 :|: fset [prod1_loc]) (I1:|:I2) ('unit) := + register_vote G i random := + letb xi := (select_private_voting_key G random) : both _ _ (uint_size) in + letb _ := (broadcast1 G (g_pow xi) (v_ZKP G xi) i) : both _ _ ('unit) in + letb _ := (ret_both (tt : 'unit)) : both _ _ ('unit) in + letb '(gs,zkps) := (get_broadcast1) : both _ _ ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))) in + (* letb _ := (other loop todo(term)) : both _ _ ('unit) in *) (* TODO LOOP *) + letbm prod1 loc(prod1_loc) := (one) : both _ _ (t_group_type) in + letb prod1 := (foldi_both (into_iter (Build_t_Range (ret_both (1 : uint_size)) (i .- (ret_both (1 : uint_size))))) (fun {L I _ _} =>fun j => + (ssp (fun prod1 => + solve_lift (prod prod1 (g_pow (gs.a[j])))) )) prod1) : both _ _ (t_group_type) in + letb prod2 := (one) : both _ _ (t_group_type) in + letb prod1 := (foldi_both (into_iter (Build_t_Range (i .+ (ret_both (1 : uint_size)))n)) (fun {L I _ _} =>fun j => + (ssp (fun prod1 => + solve_lift (prod prod1 (g_pow (gs.a[j])))) )) prod1) : both _ _ (t_group_type) in + letb Yi := (div prod1 prod2) : both _ _ (t_group_type) in + solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2 :|: fset [prod1_loc]) (I1:|:I2) ('unit). +Next Obligation. + admit. +Admitted. +Next Obligation. + admit. +Admitted. +Fail Next Obligation. -Require Import HashMap. -Export HashMap. +Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {I1 : Interface} (vi : both L1 I1 ('bool)) : both (L1) (I1) (uint_size) := + v_ZKP_one_out_of_two vi := + solve_lift (ret_both (32 : uint_size)) : both (L1) (I1) (uint_size). +Fail Next Obligation. -Notation t_public_keys := (t_HashMap (t_N) ((t_G × (t_G × t_G × t_Q × t_Q))) (t_RandomState)). +Equations broadcast2 (G : _) (* `{ t_Sized (G)} *) `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (g_pow_xiyi : both L1 I1 (t_group_type)) (g_pow_vi : both L2 I2 (t_group_type)) (g_pow_vi_zkp : both L3 I3 (uint_size)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := + broadcast2 G g_pow_xiyi g_pow_vi g_pow_vi_zkp := + solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). +Fail Next Obligation. -Equations p_i_construct {L1 : {fset Location}} {I1 : Interface} (m : both L1 I1 (t_HashMap (t_N) ((t_G × (t_G × t_G × t_Q × t_Q))) (t_RandomState))) : both (L1) (I1) ('unit) := - p_i_construct m := - solve_lift (ret_both (tt : 'unit)) : both (L1) (I1) ('unit). +Equations get_broadcast2 (G : _) (* `{ t_Sized (G)} *) `{ t_Group (G)} : both (fset []) ([interface ]) ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))) := + get_broadcast2 G := + solve_lift (prod_b (@new _ fset0 fset0,@new _ fset0 fset0,@new _ fset0 fset0)) : both (fset []) ([interface ]) ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))). Fail Next Obligation. -Equations p_i_vote {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 ('bool)) : both (L1) (I1) (t_G) := - p_i_vote v := - solve_lift (Build_t_G (ret_both (1 : int32))) : both (L1) (I1) (t_G). +Equations cast_vote (G : _) (* `{ t_Sized (G)} *) `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (uint_size)) (yi : both L2 I2 (uint_size)) (vi : both L3 I3 ('bool)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := + cast_vote G xi yi vi := + letb _ := (broadcast2 G (g_pow (xi .* yi)) (g_pow (ifb vi + then ret_both (1 : uint_size) + else ret_both (0 : uint_size))) (v_ZKP_one_out_of_two vi)) : both _ _ ('unit) in + letb _ := (ret_both (tt : 'unit)) : both _ _ ('unit) in + solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). Fail Next Obligation. -Equations exec {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 ('bool)) : both (L1 :|: fset [commit_loc]) (I1) (t_G) := - exec v := - letb x := (sample_uniform) : both _ _ (t_Q) in - letb y := (Build_t_G (ret_both (1 : int32))) : both _ _ (t_G) in - letb zkp := (fiat_shamir_run (prod_b (y,x))) : both _ _ ((t_G × t_G × t_Q × t_Q)) in - solve_lift (p_i_vote v) : both (L1 :|: fset [commit_loc]) (I1) (t_G). +Definition vote_result_loc {G : _} (* `{ t_Sized (G)} *) `{ t_Group (G)} : Location := + (t_group_type ; 2%nat). +Definition tally_loc {G : _} (* `{ t_Sized (G)} *) `{ t_Group (G)} : Location := + (uint_size ; 1%nat). +Definition into_iter_zip {L I A B} (x : both L I (chList (A × B))) : both L I (chList A) * both L I (chList B). Admitted. +Equations tally_votes (G : _) (* `{ t_Sized (G)} *) `{ t_Group (G)} : both (fset [tally_loc; vote_result_loc]) ([interface ]) (uint_size) := + tally_votes G := + letb '(g_pow_xi_yi,g_pow_vi,zkps) := (get_broadcast2 G) : both _ _ ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))) in + (* letb _ := (other loop todo(term)) : both _ _ ('unit) in *) (* TODO Loop *) + letbm vote_result loc(vote_result_loc) := (one) : both _ _ (t_group_type) in + (* letb vote_result := (foldi_both (into_iter_zip ((lift2_both (fun (x : chList _) (y : chList _) => seq.zip x y : chList (chProd _ _))) (into_iter g_pow_xi_yi) g_pow_vi)) (fun {L I _ _} =>fun '(gxiyi,gvi) => *) + (* (ssp (fun vote_result => *) + (* solve_lift (prod vote_result (prod gxiyi gvi))) )) vote_result) : both _ _ (t_group_type) in *) + (* TODO for_loop *) + letbm tally loc(tally_loc) := (ret_both (0 : uint_size)) : both _ _ (uint_size) in + (* letb tally := (foldi_both (into_iter (Build_t_Range (ret_both (1 : uint_size))n)) (fun {L I _ _} =>fun i => *) + (* (ssp (fun tally => *) + (* ifb solve_lift ((g_pow tally) <> vote_result) *) + (* then ControlFlow_Continue (letb _ := (tally .+ (ret_both (1 : uint_size))) : both _ _ ('unit) in *) + (* solve_lift (ret_both (tt : 'unit))) *) + (* else letb hoist1 := (v_Break tally) : both _ _ (t_Never) in *) + (* ControlFlow_Continue (letb _ := (never_to_any hoist1) : both _ _ ('unit) in *) + (* tally)) )) tally) : both _ _ ('unit) in *) + (* TODO for_loop *) + solve_lift tally : both (fset [tally_loc; vote_result_loc]) ([interface ]) (uint_size). +Admit Obligations. Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_GroupParameter.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_GroupParameter.v new file mode 100644 index 0000000..f564a29 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_GroupParameter.v @@ -0,0 +1,33 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. + Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_ovn_GroupParameter_Hacspec_lib. +Export Hacspec_ovn_GroupParameter_Hacspec_lib. + +Equations modulo_value : both (fset []) ([interface ]) (t_String) := + modulo_value := + solve_lift (from (ret_both (1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab : chString))) : both (fset []) ([interface ]) (t_String). +Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v index 4d6fd65..1d6ca60 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v @@ -24,8 +24,8 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Require Import Hacspec_lib. -Export Hacspec_lib. +Require Import Hacspec_ovn_Schnorr_Hacspec_lib. +Export Hacspec_ovn_Schnorr_Hacspec_lib. Require Import HashMap. Export HashMap. @@ -48,23 +48,23 @@ Equations verify {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Locat solve_lift (ret_both (false : 'bool)) : both (L1:|:L2:|:L3:|:L4) (I1:|:I2:|:I3:|:I4) ('bool). Fail Next Obligation. -Equations fiat_shamir_verify {L1 : {fset Location}} {I1 : Interface} (t : both L1 I1 ((t_G × t_G × t_Q × t_Q))) : both (L1) (I1) ('bool) := - fiat_shamir_verify t := - letb QUERIES := (new) : both _ _ (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState)) in +Equations fiat_shamir_verify {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (t : both L1 I1 ((t_G × t_G × t_Q × t_Q))) (uniform_sample : both L2 I2 (t_Q)) : both (L1:|:L2) (I1:|:I2) ('bool) := + fiat_shamir_verify t uniform_sample := + letb QUERIES := (new_under_impl) : both _ _ (t_HashMap (t_Q) (t_Q) (t_RandomState)) in letb '(h,a,e,z) := (t) : both _ _ ((t_G × t_G × t_Q × t_Q)) in - letb '(QUERIES,eu) := (random_oracle_query QUERIES (prod_assoc (prod_b (h,a)))) : both _ _ ((t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState) × (t_G × t_G))) in - solve_lift (verify h a e z) : both (L1) (I1) ('bool). + letb '(QUERIES,eu) := (random_oracle_query QUERIES (prod_assoc (prod_b (h,a))) uniform_sample) : both _ _ ((t_HashMap (t_Q) (t_Q) (t_RandomState) × t_Q)) in + solve_lift (verify h a e z) : both (L1:|:L2) (I1:|:I2) ('bool). Fail Next Obligation. Notation t_Relation := ((t_G × t_Q)). Definition commit_loc : Location := - ((t_G × t_G) ; 0%nat). -Equations v_Commit {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (h : both L1 I1 (t_G)) (w : both L2 I2 (t_Q)) : both (L1:|:L2 :|: fset [commit_loc]) (I1:|:I2) (t_G) := - v_Commit h w := - letb r := (sample_uniform) : both _ _ ((t_G × t_G)) in - letbm commit loc(commit_loc) := (r) : both _ _ ((t_G × t_G)) in - solve_lift (Build_t_G (ret_both (1 : int32))) : both (L1:|:L2 :|: fset [commit_loc]) (I1:|:I2) (t_G). + (t_Q ; 5%nat). +Equations v_Commit {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (h : both L1 I1 (t_G)) (w : both L2 I2 (t_Q)) (uniform_sample : both L3 I3 (t_Q)) : both (L1:|:L2:|:L3 :|: fset [commit_loc]) (I1:|:I2:|:I3) (t_G) := + v_Commit h w uniform_sample := + letb r := (uniform_sample) : both _ _ (t_Q) in + letbm commit loc(commit_loc) := (r) : both _ _ (t_Q) in + solve_lift v_ONE : both (L1:|:L2:|:L3 :|: fset [commit_loc]) (I1:|:I2:|:I3) (t_G). Fail Next Obligation. Equations v_Response {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (h : both L1 I1 (t_G)) (w : both L2 I2 (t_Q)) (a : both L3 I3 (t_G)) (e : both L4 I4 (t_Q)) : both (L1:|:L2:|:L3:|:L4) (I1:|:I2:|:I3:|:I4) (t_Q) := @@ -72,15 +72,15 @@ Equations v_Response {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset L solve_lift (Build_t_Q (ret_both (1 : int32))) : both (L1:|:L2:|:L3:|:L4) (I1:|:I2:|:I3:|:I4) (t_Q). Fail Next Obligation. -Equations fiat_shamir_run {L1 : {fset Location}} {I1 : Interface} (hw : both L1 I1 ((t_G × t_Q))) : both (L1 :|: fset [commit_loc]) (I1) ((t_G × t_G × t_Q × t_Q)) := - fiat_shamir_run hw := - letb QUERIES := (new) : both _ _ (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState)) in +Equations fiat_shamir_run {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (hw : both L1 I1 ((t_G × t_Q))) (uniform_sample_1 : both L2 I2 (t_Q)) (uniform_sample_2 : both L3 I3 (t_Q)) : both (L1:|:L2:|:L3 :|: fset [commit_loc]) (I1:|:I2:|:I3) ((t_G × t_G × t_Q × t_Q)) := + fiat_shamir_run hw uniform_sample_1 uniform_sample_2 := + letb QUERIES := (new_under_impl) : both _ _ (t_HashMap (t_Q) (t_Q) (t_RandomState)) in letb '(h,w) := (hw) : both _ _ ((t_G × t_Q)) in - letb a := (v_Commit h w) : both _ _ (t_G) in + letb a := (v_Commit h w uniform_sample_1) : both _ _ (t_G) in letb _ := (random_oracle_init (ret_both (tt : 'unit))) : both _ _ ('unit) in letb _ := (ret_both (tt : 'unit)) : both _ _ ('unit) in - letb '(QUERIES,eu) := (random_oracle_query QUERIES (prod_assoc (prod_b (h,a)))) : both _ _ ((t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState) × (t_G × t_G))) in + letb '(QUERIES,eu) := (random_oracle_query QUERIES (prod_assoc (prod_b (h,a))) uniform_sample_2) : both _ _ ((t_HashMap (t_Q) (t_Q) (t_RandomState) × t_Q)) in letb e := (Build_t_Q (ret_both (1 : int32))) : both _ _ (t_Q) in letb z := (v_Response h w a e) : both _ _ (t_Q) in - solve_lift (prod_b (h,a,e,z)) : both (L1 :|: fset [commit_loc]) (I1) ((t_G × t_G × t_Q × t_Q)). + solve_lift (prod_b (h,a,e,z)) : both (L1:|:L2:|:L3 :|: fset [commit_loc]) (I1:|:I2:|:I3) ((t_G × t_G × t_Q × t_Q)). Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v index bf40eb8..da8b819 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v @@ -24,22 +24,978 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Require Import Hacspec_lib. -Export Hacspec_lib. +Require Import Hacspec_ovn_Schnorr_Random_oracle_Hacspec_lib. +Export Hacspec_ovn_Schnorr_Random_oracle_Hacspec_lib. Equations random_oracle_init {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both (L1) (I1) ('unit) := random_oracle_init _ := solve_lift (ret_both (tt : 'unit)) : both (L1) (I1) ('unit). Fail Next Obligation. +Definition t_GCanvas : choice_type := + (nseq int8 48 × t_Sign × 'bool). +Equations Build_t_GCanvas {L : {fset Location}} {I : Interface} (f_b : both L I (nseq int8 48)) (f_sign : both L I (t_Sign)) (f_signed : both L I ('bool)) : both L I (t_GCanvas) := + Build_t_GCanvas f_b f_sign f_signed := + bind_both f_signed (fun f_signed => + bind_both f_sign (fun f_sign => + bind_both f_b (fun f_b => + solve_lift (ret_both ((f_b,f_sign,f_signed) : (t_GCanvas)))))) : both L I (t_GCanvas). +Fail Next Obligation. + +Equations max_under_impl_15 : both (fset []) ([interface ]) (t_Output) := + max_under_impl_15 := + solve_lift (((from (ret_both (1 : int32))) shift_left (ret_both (384 : int32))) .- one) : both (fset []) ([interface ]) (t_Output). +Fail Next Obligation. + +Equations max_value_under_impl_15 : both (fset []) ([interface ]) (t_GCanvas) := + max_value_under_impl_15 := + solve_lift (from max_under_impl_15) : both (fset []) ([interface ]) (t_GCanvas). +Fail Next Obligation. + +Definition x_loc : Location := + (t_String ; 1%nat). +Equations hex_string_to_bytes_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (chString)) : both (L1 :|: fset [x_loc]) (I1) (t_Vec (int8) (t_Global)) := + hex_string_to_bytes_under_impl_15 s := + letb s := (ifb ((len_under_impl s) .% (ret_both (2 : uint_size))) <> (ret_both (0 : uint_size)) + then letbm x loc(x_loc) := (to_string (ret_both (0 : chString))) : both _ _ (t_String) in + letb x := (push_str_under_impl x s) : both _ _ (t_String) in + x + else to_string s) : both _ _ (t_String) in + letb _ := (ifb not (((len_under_impl s) .% (ret_both (2 : uint_size))) =.? (ret_both (0 : uint_size))) + then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (length of hex string : chString); + ret_both (: : chString)])) (unsize (array_from_list [new_display_under_impl_1 s; + new_display_under_impl_1 (len_under_impl s)]))))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + letb b := (collect (map (step_by (Build_t_Range (ret_both (0 : uint_size))(len_under_impl s)) (ret_both (2 : uint_size))) (fun i => + from_str_radix_under_impl_6 (s.a[(Build_t_Range i(i .+ (ret_both (2 : uint_size))))]) (ret_both (16 : int32))))) : both _ _ (t_Result (t_Vec (int8) (t_Global)) (t_ParseIntError)) in + solve_lift (expect_under_impl b (ret_both (Error parsing hex string : chString))) : both (L1 :|: fset [x_loc]) (I1) (t_Vec (int8) (t_Global)). +Fail Next Obligation. + +Equations from_literal_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_GCanvas) := + from_literal_under_impl_15 x := + letb big_x := (from x) : both _ _ (t_BigInt) in + letb _ := (ifb big_x >.? (into max_under_impl_15) + then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (literal : chString); + ret_both ( too big for type GCanvas : chString)])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + solve_lift (into big_x) : both (L1) (I1) (t_GCanvas). +Fail Next Obligation. + +Equations from_signed_literal_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_GCanvas) := + from_signed_literal_under_impl_15 x := + letb big_x := (from (cast_int x)) : both _ _ (t_BigInt) in + letb _ := (ifb big_x >.? (into max_under_impl_15) + then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (literal : chString); + ret_both ( too big for type GCanvas : chString)])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + solve_lift (into big_x) : both (L1) (I1) (t_GCanvas). +Fail Next Obligation. + +Equations pow2_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_GCanvas) := + pow2_under_impl_15 x := + solve_lift (into ((from (ret_both (1 : int32))) shift_left x)) : both (L1) (I1) (t_GCanvas). +Fail Next Obligation. + +(*item error backend*) + +#[global] Instance t_GCanvas_t_From : t_From t_GCanvas t_BigUint := { + from (x : t_BigUint) := solve_lift (from (from x)); +}. + +#[global] Instance t_GCanvas_t_From : t_From t_GCanvas t_BigInt := { + from (x : t_BigInt) := letb max_value := (max_under_impl_15) : both _ _ (t_BigInt) in + letb _ := (ifb not (x <=.? max_value) + then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both ( : chString); + ret_both ( is too large for type GCanvas! : chString)])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + letb '(sign,repr) := (to_bytes_be_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in + letb _ := (ifb andb (sign =.? Sign_Minus) (not (ret_both (false : 'bool))) + then letb _ := (never_to_any (begin_panic (ret_both (Trying to convert a negative number into an unsigned integer! : chString)))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + letb _ := (ifb (len_under_impl_1 repr) >.? (((ret_both (384 : uint_size)) .+ (ret_both (7 : uint_size))) ./ (ret_both (8 : uint_size))) + then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both ( : chString); + ret_both ( is too large for type GCanvas : chString)])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + letbm out loc(out_loc) := (repeat (ret_both (0 : int8)) (ret_both (48 : uint_size))) : both _ _ (nseq int8 48) in + letb upper := (len_under_impl (unsize out)) : both _ _ (uint_size) in + letb lower := (upper .- (len_under_impl_1 repr)) : both _ _ (uint_size) in + letb _ := (failure (ret_both (RefMut:The mutation of this &mut is not allowed here. + : chString)) (ret_both (core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (out), + core::ops::range::Range { + f_start: lower, + f_end: upper, + }, + ))), + &(deref(core::ops::deref::Deref::deref(&(deref(&(repr)))))), + ) : chString))) : both _ _ ('unit) in + solve_lift (Build_t_GCanvas outsign(ret_both (false : 'bool))); +}. + +#[global] Instance t_GCanvas_t_Default : t_Default t_GCanvas := { + default := solve_lift (Build_t_GCanvas (repeat (ret_both (0 : int8)) (ret_both (48 : uint_size)))Sign_Plus(ret_both (false : 'bool))); +}. + +#[global] Instance t_GCanvas_t_Into : t_Into t_GCanvas t_BigInt := { + into (self : t_GCanvas) := solve_lift (from_bytes_be_under_impl_24 (f_sign self) (unsize (f_b self))); +}. + +#[global] Instance t_GCanvas_t_Into : t_Into t_GCanvas t_BigUint := { + into (self : t_GCanvas) := solve_lift (from_bytes_be_under_impl_18 (unsize (f_b self))); +}. + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +Equations from_hex_under_impl_14 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (chString)) : both (L1 :|: fset [x_loc]) (I1) (t_GCanvas) := + from_hex_under_impl_14 s := + solve_lift (into (from_bytes_be_under_impl_24 Sign_Plus (deref (hex_string_to_bytes_under_impl_15 s)))) : both (L1 :|: fset [x_loc]) (I1) (t_GCanvas). +Fail Next Obligation. + +Definition repr_loc : Location := + (nseq int8 48 ; 2%nat). +Equations from_be_bytes_under_impl_14 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas) := + from_be_bytes_under_impl_14 v := + letb _ := (ifb ret_both (true : 'bool) + then letb _ := (ifb not ((len_under_impl v) <=.? (((ret_both (384 : uint_size)) .+ (ret_both (7 : uint_size))) ./ (ret_both (8 : uint_size)))) + then letb _ := (never_to_any (begin_panic (ret_both (from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas : chString)))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + letbm repr loc(repr_loc) := (repeat (ret_both (0 : int8)) (ret_both (48 : uint_size))) : both _ _ (nseq int8 48) in + letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in + letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in + letb _ := (failure (ret_both (RefMut:The mutation of this &mut is not allowed here. + : chString)) (ret_both (core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (repr), + core::ops::range::Range { + f_start: lower, + f_end: upper, + }, + ))), + &(deref(deref(&(v)))), + ) : chString))) : both _ _ ('unit) in + solve_lift (Build_t_GCanvas reprSign_Plus(ret_both (false : 'bool))) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas). +Fail Next Obligation. + +Definition repr_loc : Location := + (nseq int8 48 ; 3%nat). +Equations from_le_bytes_under_impl_14 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas) := + from_le_bytes_under_impl_14 v := + letb _ := (ifb ret_both (true : 'bool) + then letb _ := (ifb not ((len_under_impl v) <=.? (((ret_both (384 : uint_size)) .+ (ret_both (7 : uint_size))) ./ (ret_both (8 : uint_size)))) + then letb _ := (never_to_any (begin_panic (ret_both (from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas : chString)))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + letbm repr loc(repr_loc) := (repeat (ret_both (0 : int8)) (ret_both (48 : uint_size))) : both _ _ (nseq int8 48) in + letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in + letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in + letb _ := (failure (ret_both (RefMut:The mutation of this &mut is not allowed here. + : chString)) (ret_both (core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (repr), + core::ops::range::Range { + f_start: lower, + f_end: upper, + }, + ))), + &(deref(deref(&(v)))), + ) : chString))) : both _ _ ('unit) in + solve_lift (into (from_bytes_le_under_impl_24 Sign_Plus (unsize repr))) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas). +Fail Next Obligation. + +Equations to_be_bytes_under_impl_14 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_GCanvas)) : both (L1) (I1) (nseq int8 48) := + to_be_bytes_under_impl_14 self := + solve_lift (f_b self) : both (L1) (I1) (nseq int8 48). +Fail Next Obligation. + +Definition repr_loc : Location := + (nseq int8 48 ; 4%nat). +Equations to_le_bytes_under_impl_14 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_GCanvas)) : both (L1 :|: fset [repr_loc]) (I1) (nseq int8 48) := + to_le_bytes_under_impl_14 self := + letb x := (from_bytes_be_under_impl_24 Sign_Plus (unsize (f_b self))) : both _ _ (t_BigInt) in + letb '(_,x_s) := (to_bytes_le_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in + letbm repr loc(repr_loc) := (repeat (ret_both (0 : int8)) (ret_both (48 : uint_size))) : both _ _ (nseq int8 48) in + letb _ := (failure (ret_both (RefMut:The mutation of this &mut is not allowed here. + : chString)) (ret_both (core::slice::copy_from_slice_under_impl( + &mut (deref(core::ops::index::IndexMut::index_mut( + &mut (repr), + core::ops::range::Range { + f_start: 0, + f_end: alloc::vec::len_under_impl_1(&(x_s)), + }, + ))), + &(deref(core::ops::deref::Deref::deref(&(deref(&(x_s)))))), + ) : chString))) : both _ _ ('unit) in + repr : both (L1 :|: fset [repr_loc]) (I1) (nseq int8 48). +Fail Next Obligation. + +Equations comp_eq_under_impl_14 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + comp_eq_under_impl_14 self rhs := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb solve_lift (a =.? b) + then letb one := (from_literal_under_impl_15 (ret_both (1 : int128))) : both _ _ (t_GCanvas) in + solve_lift ((one shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- one) + else solve_lift default : both (L1:|:L2) (I1:|:I2) (t_Output). +Fail Next Obligation. + +Equations comp_ne_under_impl_14 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + comp_ne_under_impl_14 self rhs := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb solve_lift (a <> b) + then letb one := (from_literal_under_impl_15 (ret_both (1 : int128))) : both _ _ (t_GCanvas) in + solve_lift ((one shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- one) + else solve_lift default : both (L1:|:L2) (I1:|:I2) (t_Output). +Fail Next Obligation. + +Equations comp_gte_under_impl_14 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + comp_gte_under_impl_14 self rhs := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb solve_lift (a >=.? b) + then letb one := (from_literal_under_impl_15 (ret_both (1 : int128))) : both _ _ (t_GCanvas) in + solve_lift ((one shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- one) + else solve_lift default : both (L1:|:L2) (I1:|:I2) (t_Output). +Fail Next Obligation. + +Equations comp_gt_under_impl_14 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + comp_gt_under_impl_14 self rhs := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb solve_lift (a >.? b) + then letb one := (from_literal_under_impl_15 (ret_both (1 : int128))) : both _ _ (t_GCanvas) in + solve_lift ((one shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- one) + else solve_lift default : both (L1:|:L2) (I1:|:I2) (t_Output). +Fail Next Obligation. + +Equations comp_lte_under_impl_14 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + comp_lte_under_impl_14 self rhs := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb solve_lift (a <=.? b) + then letb one := (from_literal_under_impl_15 (ret_both (1 : int128))) : both _ _ (t_GCanvas) in + solve_lift ((one shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- one) + else solve_lift default : both (L1:|:L2) (I1:|:I2) (t_Output). +Fail Next Obligation. + +Equations comp_lt_under_impl_14 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + comp_lt_under_impl_14 self rhs := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + ifb solve_lift (a <.? b) + then letb one := (from_literal_under_impl_15 (ret_both (1 : int128))) : both _ _ (t_GCanvas) in + solve_lift ((one shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- one) + else solve_lift default : both (L1:|:L2) (I1:|:I2) (t_Output). +Fail Next Obligation. + +Equations inv_under_impl_26 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (modval : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_GCanvas) := + inv_under_impl_26 self modval := + letb biguintmodval := (into modval) : both _ _ (t_BigInt) in + letb m := (biguintmodval .- (from (ret_both (2 : int32)))) : both _ _ (t_Output) in + letb s := (into self) : both _ _ (t_BigInt) in + solve_lift (into (modpow_under_impl_24 s m biguintmodval)) : both (L1:|:L2) (I1:|:I2) (t_GCanvas). +Fail Next Obligation. + +Equations pow_felem_under_impl_26 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_GCanvas)) (exp : both L2 I2 (t_GCanvas)) (modval : both L3 I3 (t_GCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_GCanvas) := + pow_felem_under_impl_26 self exp modval := + letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into exp) : both _ _ (t_BigInt) in + letb m := (into modval) : both _ _ (t_BigInt) in + letb c := (modpow_under_impl_24 a b m) : both _ _ (t_BigInt) in + solve_lift (into c) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_GCanvas). +Fail Next Obligation. + +Equations pow_under_impl_26 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_GCanvas)) (exp : both L2 I2 (int128)) (modval : both L3 I3 (t_GCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_GCanvas) := + pow_under_impl_26 self exp modval := + solve_lift (pow_felem_under_impl_26 self (into (from exp)) modval) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_GCanvas). +Fail Next Obligation. + +Equations rem_under_impl_26 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (n : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := + rem_under_impl_26 self n := + solve_lift (self .% n) : both (L1:|:L2) (I1:|:I2) (t_Output). +Fail Next Obligation. + +#[global] Instance t_GCanvas_t_Add : t_Add t_GCanvas t_GCanvas := { + t_Output := t_GCanvas; + add (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb c := (a .+ b) : both _ _ (t_Output) in + letb _ := (ifb c >.? max_under_impl_15 + then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (bounded addition overflow for type GCanvas : chString)])) (unsize none_under_impl_1)))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + solve_lift (into c); +}. + +#[global] Instance t_GCanvas_t_Sub : t_Sub t_GCanvas t_GCanvas := { + t_Output := t_GCanvas; + sub (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb c := (ifb f_signed self + then a .- b + else unwrap_or_else_under_impl (checked_sub_under_impl_24 a b) ( + never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (bounded substraction underflow for type GCanvas : chString)])) (unsize none_under_impl_1))))) : both _ _ (t_Output) in + solve_lift (into c); +}. + +#[global] Instance t_GCanvas_t_Mul : t_Mul t_GCanvas t_GCanvas := { + t_Output := t_GCanvas; + mul (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb c := (a .* b) : both _ _ (t_Output) in + letb _ := (ifb c >.? max_under_impl_15 + then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (bounded multiplication overflow for type GCanvas : chString)])) (unsize none_under_impl_1)))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + solve_lift (into c); +}. + +#[global] Instance t_GCanvas_t_Div : t_Div t_GCanvas t_GCanvas := { + t_Output := t_GCanvas; + div (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb _ := (ifb b =.? zero + then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (dividing by zero in type GCanvas : chString)])) (unsize none_under_impl_1)))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + letb c := (a ./ b) : both _ _ (t_Output) in + solve_lift (into c); +}. + +#[global] Instance t_GCanvas_t_Rem : t_Rem t_GCanvas t_GCanvas := { + t_Output := t_GCanvas; + rem (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + letb _ := (ifb b =.? zero + then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (dividing by zero in type GCanvas : chString)])) (unsize none_under_impl_1)))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + letb c := (a .% b) : both _ _ (t_Output) in + solve_lift (into c); +}. + +#[global] Instance t_GCanvas_t_Not : t_Not t_GCanvas := { + t_Output := t_GCanvas; + not (self : t_GCanvas) := solve_lift (never_to_any (panic (ret_both (not implemented : chString)))); +}. + +#[global] Instance t_GCanvas_t_BitOr : t_BitOr t_GCanvas t_GCanvas := { + t_Output := t_GCanvas; + bitor (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + solve_lift (into (a .| b)); +}. + +#[global] Instance t_GCanvas_t_BitXor : t_BitXor t_GCanvas t_GCanvas := { + t_Output := t_GCanvas; + bitxor (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + solve_lift (into (a .^ b)); +}. + +#[global] Instance t_GCanvas_t_BitAnd : t_BitAnd t_GCanvas t_GCanvas := { + t_Output := t_GCanvas; + bitand (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + solve_lift (into (a .& b)); +}. + +#[global] Instance t_GCanvas_t_Shr : t_Shr t_GCanvas uint_size := { + t_Output := t_GCanvas; + shr (self : t_GCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (rhs) : both _ _ (uint_size) in + solve_lift (into (a shift_right b)); +}. + +#[global] Instance t_GCanvas_t_Shl : t_Shl t_GCanvas uint_size := { + t_Output := t_GCanvas; + shl (self : t_GCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (rhs) : both _ _ (uint_size) in + solve_lift (into (a shift_left b)); +}. + +#[global] Instance t_GCanvas_t_PartialEq : t_PartialEq t_GCanvas t_GCanvas := { + eq (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into rhs) : both _ _ (t_BigInt) in + solve_lift (a =.? b); +}. + +#[global] Instance t_GCanvas_t_Eq : t_Eq t_GCanvas := { +}. + +#[global] Instance t_GCanvas_t_PartialOrd : t_PartialOrd t_GCanvas t_GCanvas := { + partial_cmp (self : t_GCanvas) (other : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in + letb b := (into other) : both _ _ (t_BigInt) in + solve_lift (partial_cmp a b); +}. + +#[global] Instance t_GCanvas_t_Ord : t_Ord t_GCanvas := { + cmp (self : t_GCanvas) (other : t_GCanvas) := solve_lift (unwrap_under_impl (partial_cmp self other)); +}. + +Equations from_byte_seq_be_under_impl_7 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas) := + from_byte_seq_be_under_impl_7 s := + solve_lift (from_be_bytes_under_impl_14 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + declassify_under_impl_2 x))))) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas). +Fail Next Obligation. + +Equations from_public_byte_seq_be_under_impl_7 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas) := + from_public_byte_seq_be_under_impl_7 s := + solve_lift (from_be_bytes_under_impl_14 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + x))))) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas). +Fail Next Obligation. + +Equations to_byte_seq_be_under_impl_7 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_GCanvas)) : both (L1) (I1) (t_Seq (t_U8)) := + to_byte_seq_be_under_impl_7 self := + solve_lift (from_vec_under_impl_52 (collect (map (iter_under_impl (unsize (to_be_bytes_under_impl_14 self))) (fun x => + classify_under_impl_2 x)))) : both (L1) (I1) (t_Seq (t_U8)). +Fail Next Obligation. + +#[global] Instance t_GCanvas_t_NumericCopy : t_NumericCopy t_GCanvas := { +}. + +#[global] Instance t_GCanvas_t_UnsignedInteger : t_UnsignedInteger t_GCanvas := { +}. + +#[global] Instance t_GCanvas_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_GCanvas := { +}. + +#[global] Instance t_GCanvas_t_Integer : t_Integer t_GCanvas := { + NUM_BITS := solve_lift (ret_both (384 : uint_size)); + ZERO := solve_lift (from_literal_under_impl_15 (ret_both (0 : int128))); + ONE := solve_lift (from_literal_under_impl_15 (ret_both (1 : int128))); + TWO := solve_lift (from_literal_under_impl_15 (ret_both (2 : int128))); + from_literal (val : int128) := solve_lift (from_literal_under_impl_15 val); + from_hex_string (s : t_String) := solve_lift (from_hex_under_impl_14 (deref (replace_under_impl_5 (deref s) (ret_both (0x : chString)) (ret_both ( : chString))))); + get_bit (self : t_GCanvas) (i : uint_size) := solve_lift ((self shift_right i) .& v_ONE); + set_bit (self : t_GCanvas) (b : t_GCanvas) (i : uint_size) := letb _ := (ifb ret_both (true : 'bool) + then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) + then letb _ := (never_to_any (panic (ret_both (assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()) : chString)))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + letb tmp1 := (from_literal_under_impl_15 (not ((ret_both (1 : int128)) shift_left i))) : both _ _ (t_GCanvas) in + letb tmp2 := (b shift_left i) : both _ _ (t_Output) in + solve_lift ((self .& tmp1) .| tmp2); + set (self : t_GCanvas) (pos : uint_size) (y : t_GCanvas) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_GCanvas) in + solve_lift (set_bit self b pos); + rotate_left (self : t_GCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb _ := (never_to_any (panic (ret_both (assertion failed: n < Self::NUM_BITS : chString)))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + solve_lift (((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- (ret_both (1 : uint_size)))))); + rotate_right (self : t_GCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb _ := (never_to_any (panic (ret_both (assertion failed: n < Self::NUM_BITS : chString)))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + solve_lift (((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- (ret_both (1 : uint_size)))))); +}. + +#[global] Instance t_GCanvas_t_ModNumeric : t_ModNumeric t_GCanvas := { + sub_mod (self : t_GCanvas) (rhs : t_GCanvas) (n : t_GCanvas) := solve_lift ((self .- rhs) .% n); + add_mod (self : t_GCanvas) (rhs : t_GCanvas) (n : t_GCanvas) := solve_lift ((self .+ rhs) .% n); + mul_mod (self : t_GCanvas) (rhs : t_GCanvas) (n : t_GCanvas) := solve_lift ((self .* rhs) .% n); + pow_mod (self : t_GCanvas) (exp : t_GCanvas) (n : t_GCanvas) := solve_lift (pow_felem_under_impl_26 self exp n); + modulo (self : t_GCanvas) (n : t_GCanvas) := solve_lift (self .% n); + signed_modulo (self : t_GCanvas) (n : t_GCanvas) := solve_lift (modulo self n); + absolute (self : t_GCanvas) := self; +}. + +#[global] Instance t_GCanvas_t_Numeric : t_Numeric t_GCanvas := { + max_val := solve_lift max_value_under_impl_15; + wrap_add (self : t_GCanvas) (rhs : t_GCanvas) := solve_lift (self .+ rhs); + wrap_sub (self : t_GCanvas) (rhs : t_GCanvas) := solve_lift (self .- rhs); + wrap_mul (self : t_GCanvas) (rhs : t_GCanvas) := solve_lift (self .* rhs); + wrap_div (self : t_GCanvas) (rhs : t_GCanvas) := solve_lift (self ./ rhs); + exp (self : t_GCanvas) (exp : int32) := solve_lift (pow_under_impl_26 self (into exp) max_val); + pow_self (self : t_GCanvas) (exp : t_GCanvas) := solve_lift (pow_felem_under_impl_26 self (into exp) max_val); + divide (self : t_GCanvas) (rhs : t_GCanvas) := solve_lift (self ./ rhs); + inv (self : t_GCanvas) (n : t_GCanvas) := solve_lift (inv_under_impl_26 self n); + equal (self : t_GCanvas) (other : t_GCanvas) := solve_lift (self =.? other); + greater_than (self : t_GCanvas) (other : t_GCanvas) := solve_lift (self >.? other); + greater_than_or_equal (self : t_GCanvas) (other : t_GCanvas) := solve_lift (self >=.? other); + less_than (self : t_GCanvas) (other : t_GCanvas) := solve_lift (self <.? other); + less_than_or_equal (self : t_GCanvas) (other : t_GCanvas) := solve_lift (self >=.? other); + not_equal_bm (self : t_GCanvas) (other : t_GCanvas) := ifb solve_lift (not (equal self other)) + then solve_lift max_val + else solve_lift (from_literal_under_impl_15 (ret_both (0 : int128))); + equal_bm (self : t_GCanvas) (other : t_GCanvas) := ifb solve_lift (equal self other) + then solve_lift max_val + else solve_lift (from_literal_under_impl_15 (ret_both (0 : int128))); + greater_than_bm (self : t_GCanvas) (other : t_GCanvas) := ifb solve_lift (greater_than self other) + then solve_lift max_val + else solve_lift (from_literal_under_impl_15 (ret_both (0 : int128))); + greater_than_or_equal_bm (self : t_GCanvas) (other : t_GCanvas) := ifb solve_lift (greater_than_or_equal self other) + then solve_lift max_val + else solve_lift (from_literal_under_impl_15 (ret_both (0 : int128))); + less_than_bm (self : t_GCanvas) (other : t_GCanvas) := ifb solve_lift (less_than self other) + then solve_lift max_val + else solve_lift (from_literal_under_impl_15 (ret_both (0 : int128))); + less_than_or_equal_bm (self : t_GCanvas) (other : t_GCanvas) := ifb solve_lift (less_than_or_equal self other) + then solve_lift max_val + else solve_lift (from_literal_under_impl_15 (ret_both (0 : int128))); +}. + Definition t_G : choice_type := - (int32). -Equations Build_t_G {L : {fset Location}} {I : Interface} (f_v : both L I (int32)) : both L I (t_G) := - Build_t_G f_v := - bind_both f_v (fun f_v => - solve_lift (ret_both ((f_v) : (t_G)))) : both L I (t_G). + (t_GCanvas). +Equations Build_t_G {L : {fset Location}} {I : Interface} (0 : both L I (t_GCanvas)) : both L I (t_G) := + Build_t_G 0 := + bind_both 0 (fun 0 => + solve_lift (ret_both ((0) : (t_G)))) : both L I (t_G). +Fail Next Obligation. + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +(*RefMut:The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* TO DO */ + todo(item)*) + +#[global] Instance t_G_t_From : t_From t_G t_GCanvas := { + from (x : t_GCanvas) := G (solve_lift (rem_under_impl_26 x (from_hex_under_impl_14 (ret_both (1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab : chString))))); +}. + +#[global] Instance t_G_t_Into : t_Into t_G t_GCanvas := { + into (self : t_G) := solve_lift (0 self); +}. + +Equations from_canvas_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_GCanvas)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := + from_canvas_under_impl_63 x := + G (solve_lift (rem_under_impl_26 x (from_hex_under_impl_14 (ret_both (1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab : chString))))) : both (L1 :|: fset [x_loc]) (I1) (t_G). +Fail Next Obligation. + +Equations into_canvas_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_GCanvas) := + into_canvas_under_impl_63 self := + solve_lift (0 self) : both (L1) (I1) (t_GCanvas). +Fail Next Obligation. + +Equations max_under_impl_63 : both (fset [x_loc]) ([interface ]) (t_GCanvas) := + max_under_impl_63 := + solve_lift (from_hex_under_impl_14 (ret_both (1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab : chString))) : both (fset [x_loc]) ([interface ]) (t_GCanvas). +Fail Next Obligation. + +Equations declassify_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_BigInt) := + declassify_under_impl_63 self := + letb a := (into self) : both _ _ (t_GCanvas) in + solve_lift (into a) : both (L1) (I1) (t_BigInt). +Fail Next Obligation. + +Equations from_hex_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (chString)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := + from_hex_under_impl_63 s := + solve_lift (into (from_hex_under_impl_14 s)) : both (L1 :|: fset [x_loc]) (I1) (t_G). +Fail Next Obligation. + +Equations from_be_bytes_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := + from_be_bytes_under_impl_63 v := + solve_lift (into (from_be_bytes_under_impl_14 v)) : both (L1 :|: fset [repr_loc]) (I1) (t_G). +Fail Next Obligation. + +Equations to_be_bytes_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_Vec (int8) (t_Global)) := + to_be_bytes_under_impl_63 self := + solve_lift (to_vec_under_impl (unsize (to_be_bytes_under_impl_14 (into self)))) : both (L1) (I1) (t_Vec (int8) (t_Global)). +Fail Next Obligation. + +Equations from_le_bytes_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := + from_le_bytes_under_impl_63 v := + solve_lift (into (from_le_bytes_under_impl_14 v)) : both (L1 :|: fset [repr_loc]) (I1) (t_G). +Fail Next Obligation. + +Equations to_le_bytes_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [repr_loc]) (I1) (t_Vec (int8) (t_Global)) := + to_le_bytes_under_impl_63 self := + solve_lift (to_vec_under_impl (unsize (to_le_bytes_under_impl_14 (into self)))) : both (L1 :|: fset [repr_loc]) (I1) (t_Vec (int8) (t_Global)). Fail Next Obligation. +Equations bit_under_impl_63 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (i : both L2 I2 (uint_size)) : both (L1:|:L2) (I1:|:I2) ('bool) := + bit_under_impl_63 self i := + solve_lift (bit_under_impl_15 (into self) i) : both (L1:|:L2) (I1:|:I2) ('bool). +Fail Next Obligation. + +Equations from_literal_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := + from_literal_under_impl_63 x := + letb big_x := (from x) : both _ _ (t_BigUint) in + letb _ := (ifb big_x >.? (into max_under_impl_63) + then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (literal : chString); + ret_both ( too big for type G : chString)])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + G (solve_lift (into big_x)) : both (L1 :|: fset [x_loc]) (I1) (t_G). +Fail Next Obligation. + +Equations from_signed_literal_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := + from_signed_literal_under_impl_63 x := + letb big_x := (from (cast_int x)) : both _ _ (t_BigUint) in + letb _ := (ifb big_x >.? (into max_under_impl_63) + then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (literal : chString); + ret_both ( too big for type G : chString)])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + G (solve_lift (into big_x)) : both (L1 :|: fset [x_loc]) (I1) (t_G). +Fail Next Obligation. + +Equations comp_eq_under_impl_63 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := + comp_eq_under_impl_63 self rhs := + letb x := (into self) : both _ _ (t_GCanvas) in + solve_lift (into (comp_eq_under_impl_14 x (into rhs))) : both (L1:|:L2) (I1:|:I2) (t_G). +Fail Next Obligation. + +Equations comp_ne_under_impl_63 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := + comp_ne_under_impl_63 self rhs := + letb x := (into self) : both _ _ (t_GCanvas) in + solve_lift (into (comp_ne_under_impl_14 x (into rhs))) : both (L1:|:L2) (I1:|:I2) (t_G). +Fail Next Obligation. + +Equations comp_gte_under_impl_63 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := + comp_gte_under_impl_63 self rhs := + letb x := (into self) : both _ _ (t_GCanvas) in + solve_lift (into (comp_gte_under_impl_14 x (into rhs))) : both (L1:|:L2) (I1:|:I2) (t_G). +Fail Next Obligation. + +Equations comp_gt_under_impl_63 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := + comp_gt_under_impl_63 self rhs := + letb x := (into self) : both _ _ (t_GCanvas) in + solve_lift (into (comp_gt_under_impl_14 x (into rhs))) : both (L1:|:L2) (I1:|:I2) (t_G). +Fail Next Obligation. + +Equations comp_lte_under_impl_63 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := + comp_lte_under_impl_63 self rhs := + letb x := (into self) : both _ _ (t_GCanvas) in + solve_lift (into (comp_lte_under_impl_14 x (into rhs))) : both (L1:|:L2) (I1:|:I2) (t_G). +Fail Next Obligation. + +Equations comp_lt_under_impl_63 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := + comp_lt_under_impl_63 self rhs := + letb x := (into self) : both _ _ (t_GCanvas) in + solve_lift (into (comp_lt_under_impl_14 x (into rhs))) : both (L1:|:L2) (I1:|:I2) (t_G). +Fail Next Obligation. + +Equations neg_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := + neg_under_impl_63 self := + letb mod_val := (into (from_hex_under_impl_14 (ret_both (1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab : chString)))) : both _ _ (t_BigInt) in + letb s := (into self) : both _ _ (t_GCanvas) in + letb s := (into s) : both _ _ (t_BigInt) in + letb result := (into (mod_val .- s)) : both _ _ (t_GCanvas) in + solve_lift (into result) : both (L1 :|: fset [x_loc]) (I1) (t_G). +Fail Next Obligation. + +#[global] Instance t_G_t_PartialOrd : t_PartialOrd t_G t_G := { + partial_cmp (self : t_G) (other : t_G) := Option_Some (solve_lift (cmp self other)); +}. + +#[global] Instance t_G_t_Ord : t_Ord t_G := { + cmp (self : t_G) (other : t_G) := solve_lift (cmp (0 self) (0 other)); +}. + +#[global] Instance t_G_t_PartialEq : t_PartialEq t_G t_G := { + eq (self : t_G) (other : t_G) := solve_lift ((0 self) =.? (0 other)); +}. + +#[global] Instance t_G_t_Eq : t_Eq t_G := { +}. + +#[global] Instance t_G_t_Add : t_Add t_G t_G := { + t_Output := t_G; + add (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in + letb b := (into rhs) : both _ _ (t_GCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb c := (a .+ b) : both _ _ (t_Output) in + letb max := (into (from_hex_under_impl_14 (ret_both (1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab : chString)))) : both _ _ (t_BigUint) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_GCanvas) in + solve_lift (into d); +}. + +#[global] Instance t_G_t_Sub : t_Sub t_G t_G := { + t_Output := t_G; + sub (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in + letb b := (into rhs) : both _ _ (t_GCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb max := (into (from_hex_under_impl_14 (ret_both (1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab : chString)))) : both _ _ (t_BigUint) in + letb c := (ifb b >.? a + then ((clone max) .- b) .+ a + else a .- b) : both _ _ (t_Output) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_GCanvas) in + solve_lift (into d); +}. + +#[global] Instance t_G_t_Mul : t_Mul t_G t_G := { + t_Output := t_G; + mul (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in + letb b := (into rhs) : both _ _ (t_GCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb c := (a .* b) : both _ _ (t_Output) in + letb max := (into (from_hex_under_impl_14 (ret_both (1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab : chString)))) : both _ _ (t_BigUint) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_GCanvas) in + solve_lift (into d); +}. + +#[global] Instance t_G_t_Div : t_Div t_G t_G := { + t_Output := t_G; + div (self : t_G) (rhs : t_G) := solve_lift (self .* (inv_under_impl_57 rhs)); +}. + +#[global] Instance t_G_t_Rem : t_Rem t_G t_G := { + t_Output := t_G; + rem (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in + letb b := (into rhs) : both _ _ (t_GCanvas) in + letb a := (into a) : both _ _ (t_BigUint) in + letb b := (into b) : both _ _ (t_BigUint) in + letb c := (a .% b) : both _ _ (t_Output) in + letb max := (into (from_hex_under_impl_14 (ret_both (1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab : chString)))) : both _ _ (t_BigUint) in + letb d := (c .% max) : both _ _ (t_Output) in + letb d := (into d) : both _ _ (t_GCanvas) in + solve_lift (into d); +}. + +#[global] Instance t_G_t_Not : t_Not t_G := { + t_Output := t_G; + not (self : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in + solve_lift (into (not a)); +}. + +#[global] Instance t_G_t_BitOr : t_BitOr t_G t_G := { + t_Output := t_G; + bitor (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in + letb b := (into rhs) : both _ _ (t_GCanvas) in + solve_lift (into (a .| b)); +}. + +#[global] Instance t_G_t_BitXor : t_BitXor t_G t_G := { + t_Output := t_G; + bitxor (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in + letb b := (into rhs) : both _ _ (t_GCanvas) in + solve_lift (into (a .^ b)); +}. + +#[global] Instance t_G_t_BitAnd : t_BitAnd t_G t_G := { + t_Output := t_G; + bitand (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in + letb b := (into rhs) : both _ _ (t_GCanvas) in + solve_lift (into (a .& b)); +}. + +#[global] Instance t_G_t_Shr : t_Shr t_G uint_size := { + t_Output := t_G; + shr (self : t_G) (rhs : uint_size) := letb a := (into self) : both _ _ (t_GCanvas) in + solve_lift (into (a shift_right rhs)); +}. + +#[global] Instance t_G_t_Shl : t_Shl t_G uint_size := { + t_Output := t_G; + shl (self : t_G) (rhs : uint_size) := letb a := (into self) : both _ _ (t_GCanvas) in + solve_lift (into (a shift_left rhs)); +}. + +Equations inv_under_impl_57 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := + inv_under_impl_57 self := + letb base := (into self) : both _ _ (t_GCanvas) in + solve_lift (into (inv_under_impl_26 base max_under_impl_63)) : both (L1 :|: fset [x_loc]) (I1) (t_G). +Fail Next Obligation. + +Equations pow_felem_under_impl_57 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (exp : both L2 I2 (t_G)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_G) := + pow_felem_under_impl_57 self exp := + letb base := (into self) : both _ _ (t_GCanvas) in + solve_lift (into (pow_felem_under_impl_26 base (into exp) max_under_impl_63)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_G). +Fail Next Obligation. + +Equations pow_under_impl_57 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (exp : both L2 I2 (int128)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_G) := + pow_under_impl_57 self exp := + letb base := (into self) : both _ _ (t_GCanvas) in + solve_lift (into (pow_under_impl_26 base exp max_under_impl_63)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_G). +Fail Next Obligation. + +Equations pow2_under_impl_57 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_G) := + pow2_under_impl_57 x := + solve_lift (into (pow2_under_impl_15 x)) : both (L1) (I1) (t_G). +Fail Next Obligation. + +Equations from_byte_seq_be_under_impl {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := + from_byte_seq_be_under_impl s := + solve_lift (into (from_be_bytes_under_impl_14 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + declassify_under_impl_2 x)))))) : both (L1 :|: fset [repr_loc]) (I1) (t_G). +Fail Next Obligation. + +Equations from_public_byte_seq_be_under_impl {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := + from_public_byte_seq_be_under_impl s := + solve_lift (into (from_be_bytes_under_impl_14 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + x)))))) : both (L1 :|: fset [repr_loc]) (I1) (t_G). +Fail Next Obligation. + +Equations to_byte_seq_be_under_impl {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_Seq (t_U8)) := + to_byte_seq_be_under_impl self := + solve_lift (from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_be_bytes_under_impl_63 self))) (fun x => + classify_under_impl_2 x)))) : both (L1) (I1) (t_Seq (t_U8)). +Fail Next Obligation. + +Equations to_public_byte_seq_be_under_impl {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_Seq (int8)) := + to_public_byte_seq_be_under_impl self := + solve_lift (from_vec_under_impl_52 (to_be_bytes_under_impl_63 self)) : both (L1) (I1) (t_Seq (int8)). +Fail Next Obligation. + +Equations from_byte_seq_le_under_impl {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := + from_byte_seq_le_under_impl s := + solve_lift (into (from_le_bytes_under_impl_14 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + declassify_under_impl_2 x)))))) : both (L1 :|: fset [repr_loc]) (I1) (t_G). +Fail Next Obligation. + +Equations from_public_byte_seq_le_under_impl {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := + from_public_byte_seq_le_under_impl s := + solve_lift (into (from_le_bytes_under_impl_14 (as_slice_under_impl_1 (collect (map (iter s) (fun x => + x)))))) : both (L1 :|: fset [repr_loc]) (I1) (t_G). +Fail Next Obligation. + +Equations to_byte_seq_le_under_impl {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (t_U8)) := + to_byte_seq_le_under_impl self := + solve_lift (from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_le_bytes_under_impl_63 self))) (fun x => + classify_under_impl_2 x)))) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (t_U8)). +Fail Next Obligation. + +Equations to_public_byte_seq_le_under_impl {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (int8)) := + to_public_byte_seq_le_under_impl self := + solve_lift (from_vec_under_impl_52 (to_le_bytes_under_impl_63 self)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (int8)). +Fail Next Obligation. + +Equations from_secret_literal_under_impl {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_U128)) : both (L1) (I1) (t_G) := + from_secret_literal_under_impl x := + solve_lift (into (from_literal_under_impl_15 (declassify_under_impl_126 x))) : both (L1) (I1) (t_G). +Fail Next Obligation. + +#[global] Instance t_G_t_NumericCopy : t_NumericCopy t_G := { +}. + +#[global] Instance t_G_t_UnsignedInteger : t_UnsignedInteger t_G := { +}. + +#[global] Instance t_G_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_G := { +}. + +#[global] Instance t_G_t_Integer : t_Integer t_G := { + NUM_BITS := solve_lift (ret_both (384 : uint_size)); + ZERO := solve_lift (from_literal_under_impl_63 (ret_both (0 : int128))); + ONE := solve_lift (from_literal_under_impl_63 (ret_both (1 : int128))); + TWO := solve_lift (from_literal_under_impl_63 (ret_both (2 : int128))); + from_literal (val : int128) := solve_lift (from_literal_under_impl_63 val); + from_hex_string (s : t_String) := solve_lift (from_hex_under_impl_63 (deref (replace_under_impl_5 (deref s) (ret_both (0x : chString)) (ret_both ( : chString))))); + get_bit (self : t_G) (i : uint_size) := solve_lift ((self shift_right i) .& v_ONE); + set_bit (self : t_G) (b : t_G) (i : uint_size) := letb _ := (ifb ret_both (true : 'bool) + then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) + then letb _ := (never_to_any (panic (ret_both (assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()) : chString)))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + letb tmp1 := (from_literal_under_impl_63 (not ((ret_both (1 : int128)) shift_left i))) : both _ _ (t_G) in + letb tmp2 := (b shift_left i) : both _ _ (t_Output) in + solve_lift ((self .& tmp1) .| tmp2); + set (self : t_G) (pos : uint_size) (y : t_G) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_G) in + solve_lift (set_bit self b pos); + rotate_left (self : t_G) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb _ := (never_to_any (panic (ret_both (assertion failed: n < Self::NUM_BITS : chString)))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + solve_lift (((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- (ret_both (1 : uint_size)))))); + rotate_right (self : t_G) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) + then letb _ := (never_to_any (panic (ret_both (assertion failed: n < Self::NUM_BITS : chString)))) : both _ _ ('unit) in + ret_both (tt : 'unit) + else ret_both (tt : 'unit)) : both _ _ ('unit) in + solve_lift (((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- (ret_both (1 : uint_size)))))); +}. + +#[global] Instance t_G_t_ModNumeric : t_ModNumeric t_G := { + sub_mod (self : t_G) (rhs : t_G) (n : t_G) := solve_lift (self .- rhs); + add_mod (self : t_G) (rhs : t_G) (n : t_G) := solve_lift (self .+ rhs); + mul_mod (self : t_G) (rhs : t_G) (n : t_G) := solve_lift (self .* rhs); + pow_mod (self : t_G) (exp : t_G) (n : t_G) := solve_lift (pow_felem_under_impl_57 self exp); + modulo (self : t_G) (n : t_G) := solve_lift (self .% n); + signed_modulo (self : t_G) (n : t_G) := solve_lift (modulo self n); + absolute (self : t_G) := self; +}. + +#[global] Instance t_G_t_Numeric : t_Numeric t_G := { + max_val := solve_lift (into (max_under_impl_63 .- (from_literal_under_impl_15 (ret_both (1 : int128))))); + wrap_add (self : t_G) (rhs : t_G) := solve_lift (self .+ rhs); + wrap_sub (self : t_G) (rhs : t_G) := solve_lift (self .- rhs); + wrap_mul (self : t_G) (rhs : t_G) := solve_lift (self .* rhs); + wrap_div (self : t_G) (rhs : t_G) := solve_lift (self ./ rhs); + exp (self : t_G) (exp : int32) := solve_lift (pow_under_impl_57 self (into exp)); + pow_self (self : t_G) (exp : t_G) := solve_lift (pow_felem_under_impl_57 self exp); + divide (self : t_G) (rhs : t_G) := solve_lift (self ./ rhs); + inv (self : t_G) (n : t_G) := solve_lift (inv_under_impl_57 self); + equal (self : t_G) (other : t_G) := solve_lift (self =.? other); + greater_than (self : t_G) (other : t_G) := solve_lift (self >.? other); + greater_than_or_equal (self : t_G) (other : t_G) := solve_lift (self >=.? other); + less_than (self : t_G) (other : t_G) := solve_lift (self <.? other); + less_than_or_equal (self : t_G) (other : t_G) := solve_lift (self <=.? other); + not_equal_bm (self : t_G) (other : t_G) := ifb solve_lift (self <> other) + then solve_lift ((v_ONE shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- v_ONE) + else solve_lift v_ZERO; + equal_bm (self : t_G) (other : t_G) := ifb solve_lift (self =.? other) + then solve_lift ((v_ONE shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- v_ONE) + else solve_lift v_ZERO; + greater_than_bm (self : t_G) (other : t_G) := ifb solve_lift (self >.? other) + then solve_lift ((v_ONE shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- v_ONE) + else solve_lift v_ZERO; + greater_than_or_equal_bm (self : t_G) (other : t_G) := ifb solve_lift (self >=.? other) + then solve_lift ((v_ONE shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- v_ONE) + else solve_lift v_ZERO; + less_than_bm (self : t_G) (other : t_G) := ifb solve_lift (self <.? other) + then solve_lift ((v_ONE shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- v_ONE) + else solve_lift v_ZERO; + less_than_or_equal_bm (self : t_G) (other : t_G) := ifb solve_lift (self <=.? other) + then solve_lift ((v_ONE shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- v_ONE) + else solve_lift v_ZERO; +}. + Definition t_Q : choice_type := (int32). Equations Build_t_Q {L : {fset Location}} {I : Interface} (f_v : both L I (int32)) : both L I (t_Q) := @@ -58,30 +1014,25 @@ Notation t_Challenge := (t_Q). Notation t_Response := (t_Q). -Notation t_Random := ((t_G × t_G)). +Notation t_Random := (t_Q). Notation t_Query := (t_Q). -Equations sample_uniform : both (fset []) ([interface ]) ((t_G × t_G)) := - sample_uniform := - solve_lift (prod_b (Build_t_G (ret_both (1 : int32)),Build_t_G (ret_both (1 : int32)))) : both (fset []) ([interface ]) ((t_G × t_G)). -Fail Next Obligation. - Require Import HashMap. Export HashMap. -Notation t_QueriesType := (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState)). +Notation t_QueriesType := (t_HashMap (t_Q) (t_Q) (t_RandomState)). -Equations random_oracle_query {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (QUERIES : both L1 I1 (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState))) (q : both L2 I2 (t_Q)) : both (L1:|:L2) (I1:|:I2) ((t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState) × (t_G × t_G))) := - random_oracle_query QUERIES q := - solve_lift matchb get QUERIES q with +Equations random_oracle_query {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (QUERIES : both L1 I1 (t_HashMap (t_Q) (t_Q) (t_RandomState))) (q : both L2 I2 (t_Q)) (uniform_sample : both L3 I3 (t_Q)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ((t_HashMap (t_Q) (t_Q) (t_RandomState) × t_Q)) := + random_oracle_query QUERIES q uniform_sample := + solve_lift matchb get_under_impl_2 QUERIES q with | Option_Some r => prod_b (clone QUERIES,clone r) | Option_None => - letb r := (sample_uniform) : both _ _ ((t_G × t_G)) in - letb '(todo_fresh_var,QUERIES_temp) := (insert QUERIES q r) : both _ _ ((t_Option ((t_G × t_G)) × t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState))) in - letb QUERIES := (QUERIES_temp) : both _ _ (t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState)) in - letb _ := (todo_fresh_var) : both _ _ (t_Option ((t_G × t_G))) in + letb r := (uniform_sample) : both _ _ (t_Q) in + letb '(todo_fresh_var,QUERIES_temp) := (insert_under_impl_2 QUERIES q r) : both _ _ ((t_Option (t_Q) × t_HashMap (t_Q) (t_Q) (t_RandomState))) in + letb QUERIES := (QUERIES_temp) : both _ _ (t_HashMap (t_Q) (t_Q) (t_RandomState)) in + letb _ := (todo_fresh_var) : both _ _ (t_Option (t_Q)) in prod_b (QUERIES,r) - end : both (L1:|:L2) (I1:|:I2) ((t_HashMap (t_Q) ((t_G × t_G)) (t_RandomState) × (t_G × t_G))). + end : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ((t_HashMap (t_Q) (t_Q) (t_RandomState) × t_Q)). Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/HashMap.v b/ovn/proofs/ssprove/extraction/HashMap.v index 2c37240..9091008 100644 --- a/ovn/proofs/ssprove/extraction/HashMap.v +++ b/ovn/proofs/ssprove/extraction/HashMap.v @@ -48,8 +48,20 @@ Inductive random_state := t_RandomState. Definition t_HashMap A B (_ : random_state) := chMap A B. -Axiom insert : forall {L1 L2 L3 I1 I2 I3 A B}, both L1 I1 (t_HashMap A B t_RandomState) -> both L2 I2 A -> both L3 I3 B -> both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_Option B × t_HashMap A B t_RandomState). -Axiom get : forall {L1 L2 I1 I2 A B}, both L1 I1 (t_HashMap A B t_RandomState) -> both L2 I2 A -> both (L1 :|: L2) (I1 :|: I2) (t_Option B). - -Axiom new : forall {L I A B}, both L I (t_HashMap A B t_RandomState). - +Equations insert : forall {L1 L2 L3 I1 I2 I3} {A B : choice_type}, both L1 I1 (t_HashMap A B t_RandomState) -> both L2 I2 A -> both L3 I3 B -> both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_Option B × t_HashMap A B t_RandomState) := + insert m i v := + bind_both m (fun m' => + bind_both i (fun i' => + bind_both v (fun v' => + solve_lift ret_both ( + (Some v', setm m' (chElement_ordType_ce_to_ce A i') v') + : chOption B × t_HashMap A B _)))). + +Equations get {L1 L2 I1 I2} {A B} (m : both L1 I1 (t_HashMap A B t_RandomState)) (i : both L2 I2 A) : both (L1 :|: L2) (I1 :|: I2) (t_Option B) := + get m i := + bind_both m (fun m' => + bind_both i (fun i' => + solve_lift ret_both (getm m' (chElement_ordType_ce_to_ce A i') : chOption B))). + +Equations new {L I A B} : both L I (t_HashMap A B t_RandomState) := + new := (solve_lift ret_both emptym). (* (fmap (s:=[]) _ : chMap _ _) *) diff --git a/ovn/proofs/ssprove/extraction/ovn_eq_proof.v b/ovn/proofs/ssprove/extraction/ovn_eq_proof.v index db7d9fa..10a2594 100644 --- a/ovn/proofs/ssprove/extraction/ovn_eq_proof.v +++ b/ovn/proofs/ssprove/extraction/ovn_eq_proof.v @@ -1,36 +1,36 @@ Set Warnings "-notation-overridden,-ambiguous-paths". From mathcomp Require Import all_ssreflect. -From JasminSSProve Require Import jasmin_translate. +(* From JasminSSProve Require Import jasmin_translate. *) From Crypt Require Import Prelude Package pkg_composition. -From Crypt Require Import Axioms. (* proof_irrelevance *) From extructures Require Import ord fset fmap. Import PackageNotation. +From Coq Require Import ZArith. +(* #[global] Hint Resolve preceq_I preceq_O preceq_refl : preceq. *) -#[global] Hint Resolve preceq_I preceq_O preceq_refl : preceq. - -Definition pdisj (P : precond) (s_id : p_id) (rhs : {fset Location}) := - (forall h1 h2 l a v s_id', l = translate_var s_id' v -> (s_id ⪯ s_id') -> (P (h1, h2) -> P (set_heap h1 l a, h2))) /\ +Definition pdisj (P : precond) (* (s_id : p_id) *) (rhs : {fset Location}) := + (forall h1 h2 l a (* v *) (* s_id' *), (* l = translate_var s_id' v -> (s_id ⪯ s_id') -> *) (P (h1, h2) -> P (set_heap h1 l a, h2))) /\ (forall h1 h2 l a, l \in rhs -> (P (h1, h2) -> P (h1, set_heap h2 l a))). (* From Crypt Require Import choice_type Package Prelude. *) +From Crypt Require Import Axioms. -Require Import Hacspec_ovn_Schnorr_Random_oracle. +(* Require Import Hacspec_ovn_Schnorr_Random_oracle. *) Require Import SigmaProtocol. Require Import DDH. -Require Import Hacspec_ovn_Schnorr. - +(* Require Import Hacspec_ovn_Schnorr. *) Require Import Schnorr. Require Import Hacspec_ovn. +Require Import OVN. From Hacspec Require Import ChoiceEquality. (* From Hacspec Require Import Hacspec_Lib_Pre. *) From Hacspec Require Import Hacspec_Lib. -Module Schnorr_eq (GP : GroupParam). +Module Schnorr_eq (GP : GroupParam) (OP : OVNParam). Import GP. Module Sigma1 := Schnorr GP. Module RO1 := Sigma1.Sigma.Oracle. @@ -40,9 +40,26 @@ Module Schnorr_eq (GP : GroupParam). (* Check (chProd Sigma1.MyAlg.choiceStatement Sigma1.MyAlg.choiceWitness). *) Locate choiceTranscript. - Definition Schnorr_translate_type (x : Sigma1.MyAlg.choiceStatement × Sigma1.MyAlg.choiceWitness) : t_Relation := - (Hacspec_Lib_Pre.repr _ (word.modulus (nat_of_ord (fst x))), - Hacspec_Lib_Pre.repr _ (word.modulus (nat_of_ord (snd x) ))). + Notation mymod := (4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787)%Z. + Axiom mymod_is_statement : Z.to_nat mymod = #|Sigma1.MyParam.Statement|. + + Notation mymod2 := (9574)%Z. + Axiom mymod2_is_statement : Z.to_nat mymod2 = #|Sigma1.MyParam.Witness|. + + Definition Schnorr_translate_type (x : Sigma1.MyAlg.choiceStatement × Sigma1.MyAlg.choiceWitness) : t_Relation. + Proof. + refine (cast_ord _ (fst x), cast_ord _ (snd x)). + unfold pos. + rewrite mymod_is_statement. + symmetry. + eapply prednK. + apply Sigma1.MyParam.positive_gT. + + rewrite mymod2_is_statement. + symmetry. + eapply prednK. + apply Sigma1.MyParam.Witness_pos. + Defined. Ltac destruct_pre := repeat @@ -68,31 +85,156 @@ Module Schnorr_eq (GP : GroupParam). destruct H as [o] end; simpl in *; subst. - Ltac remove_get_in_lhs := - eapply better_r_get_remind_lhs ; - unfold Remembers_lhs , rem_lhs ; - [ intros ? ? ? ; - destruct_pre ; - repeat (rewrite get_set_heap_neq ; [ | apply injective_translate_var3 ; reflexivity ]) ; - rewrite get_set_heap_eq ; - reflexivity | ]. + (* Ltac remove_get_in_lhs := *) + (* eapply better_r_get_remind_lhs ; *) + (* unfold Remembers_lhs , rem_lhs ; *) + (* [ intros ? ? ? ; *) + (* destruct_pre ; *) + (* repeat (rewrite get_set_heap_neq ; [ | apply injective_translate_var3 ; reflexivity ]) ; *) + (* rewrite get_set_heap_eq ; *) + (* reflexivity | ]. *) + + Definition uniform_secret (x : Arit (uniform (H := Sigma1.MyParam.Witness_pos) #|Sigma1.MyParam.Witness|)) : t_Secret. + Proof. + simpl in x. + + refine (cast_ord _ x). + rewrite mymod2_is_statement. + simpl. + symmetry. + eapply prednK. + apply Sigma1.MyParam.Witness_pos. + Defined. + (* Hacspec_Lib_Pre.repr _ (word.modulus (nat_of_ord x)). *) + + Theorem random_sample (pre : precond) : + forall i `{Positive i}, + exists (random_val : Arit (uniform i)), + ⊢ ⦃ pre ⦄ + x ← sample uniform i ;; ret x ≈ ret random_val + ⦃ fun '(v0, h0) '(v1, h1) => pre (h0, h1) ⦄. + Proof. + intros. + eexists. + apply (r_const_sample_L _ (fun x => ret x) _). + apply LosslessOp_uniform. + intros. + apply r_ret. + intros. + apply H0. + Unshelve. + refine (Ordinal (n:={| pos := i; cond_pos := H |}) (m := 0) _). + easy. + Qed. + + (* Definition cast_type (x : (chProd (chProd (chProd t_G t_G) t_Q) t_Q)) : (tgt *) + (* (@pair ident (prod choice_type choice_type) Sigma1.Sigma.RUN *) + (* (@pair choice_type choice_type *) + (* (chProd Sigma1.MyAlg.choiceStatement *) + (* Sigma1.MyAlg.choiceWitness) *) + (* Sigma1.MyAlg.choiceTranscript))). *) + (* Proof. *) + (* destruct x as [[[]]]. *) + (* repeat split. *) + (* refine (Ordinal (m := Z.to_nat (Hacspec_Lib_Pre.unsigned s)) _). *) + (* simpl. *) +Theorem better_rsame_head_cmd_alt : + forall {A B C : choiceType} {f₀ : A -> raw_code B} {f₁ : A -> raw_code C} + (m : command A) pre (post : postcond B C), + ⊢ ⦃ pre ⦄ + x ← cmd m ;; ret x ≈ x ← cmd m ;; ret x + ⦃ fun '(a₀, s₀) '(a₁, s₁) => pre (s₀, s₁) /\ a₀ = a₁ ⦄ -> + (forall a, ⊢ ⦃ pre ⦄ f₀ a ≈ f₁ a ⦃ post ⦄) -> + ⊢ ⦃ pre ⦄ x ← cmd m ;; f₀ x ≈ x ← cmd m ;; f₁ x ⦃ post ⦄. +Proof. + intros A B C f₀ f₁ m pre post hm hf. + eapply from_sem_jdg. rewrite !repr_cmd_bind. + eapply (RulesStateProb.bind_rule_pp (repr_cmd m) (repr_cmd m)). + - eapply to_sem_jdg in hm. rewrite !repr_cmd_bind in hm. + rewrite bindrFree_ret in hm. eauto. + - intros a₀ a₁. eapply to_sem_jdg. + eapply rpre_hypothesis_rule. + intros s₀ s₁ [h e]. subst. + eapply rpre_weaken_rule. 1: eapply hf. + simpl. intros ? ? [? ?]. subst. auto. +Qed. + + Lemma better_r_const_sample_R : + forall {A B : choiceType} (op : Op) c₀ c₁ (pre : precond) (post : postcond A B), + LosslessOp op -> + (forall x, ⊢ ⦃ pre ⦄ c₀ ≈ c₁ x ⦃ post ⦄) -> + ⊢ ⦃ pre ⦄ c₀ ≈ x ← sample op ;; c₁ x ⦃ post ⦄. +Proof. + intros A B op c₀ c₁ pre post hop h. + eapply r_transL with (x ← sample op ;; (fun _ => c₀) x). + - apply r_dead_sample_L. 1: auto. + apply rreflexivity_rule. + - apply (better_rsame_head_cmd_alt (cmd_sample op)). + + eapply rpre_weaken_rule. 1: eapply cmd_sample_preserve_pre. + auto. + + apply h. +Qed. + + (* Ltac solve_var_neq := *) + (* ((now apply injective_translate_var3) || *) + (* (apply injective_translate_var2 ; red ; intros ; subst)). *) + (* Ltac eexists_set_heap := *) + (* eexists ; split ; [ | *) + (* match goal with *) + (* | [ |- context [ *) + (* set_heap _ _ ?d *) + (* = set_heap _ _ ?d *) + (* ] ] => *) + (* reflexivity *) + (* end || *) + (* match goal with *) + (* | [ |- context [ *) + (* set_heap ?a ?b ?c *) + (* = set_heap _ _ ?e *) + (* ] ] => *) + (* rewrite [set_heap a b c]set_heap_commut ; [ reflexivity | *) + (* solve_var_neq ] *) + (* end]. *) + + Ltac solve_in := + repeat match goal with + | |- is_true (?v \in fset1 ?v :|: _) => apply/fsetU1P; left; auto + | |- is_true (_ \in fsetU _ _) => apply/fsetU1P; right + end. + + Ltac pdisj_apply h := + lazymatch goal with + | |- ?pre (set_heap _ _ _, set_heap _ _ _) => eapply h; [ solve_in | pdisj_apply h ] + | |- ?pre (set_heap _ _ _, _) => + eapply h ; [ reflexivity | auto with preceq | pdisj_apply h ] + | |- _ => try assumption + end. - From Crypt Require Import Axioms. - Check proof_irrelevance. + Ltac solve_in_fset := + rewrite in_fset ; repeat (reflexivity || (rewrite mem_head) || (now rewrite Bool.orb_true_r) || (now rewrite Bool.orb_true_l) || rewrite in_cons ; simpl). - Lemma both_eq : forall {A : choice_type} {L I} (a b : both L I A), - both_prog a = both_prog b -> - a = b. + Theorem unfold_prod0 : + forall L I A (x : both L I A), prod_to_prod_n 0 x = x. + Proof. destruct A ; reflexivity. Qed. + + Lemma bind_solve_lift_ret_both : forall {A B : choice_type} {L1 L2 I1 I2} `{fsubset_loc : is_true (fsubset (fset [::]) L1)} `{fsubset_opsig : is_true (fsubset (fset [::]) I1)} `{fsubset_loc2 : is_true (fsubset L1 L2)} `{fsubset_opsig2 : is_true (fsubset I1 I2)} (f : A -> both L2 I2 B) (x : A), + (bind_both (L1 := L1) (I1 := I1) (fsubset_loc := fsubset_loc2) (fsubset_opsig := fsubset_opsig2) (lift_both (fsubset_loc := fsubset_loc) (fsubset_opsig := fsubset_opsig) (ret_both x)) f) = f x. Proof. intros. - destruct a , b. - cbn in *. subst. - f_equal ; apply proof_irrelevance. + apply both_eq. + simpl. + unfold bind_raw_both. + simpl. + destruct (f x). simpl. + destruct both_prog. simpl. + reflexivity. Qed. - Lemma bind_ret_both : forall {A B : choice_type} {L I} `{fsubset_loc : is_true (fsubset (fset [::]) L)} `{fsubset_opsig : is_true (fsubset (fset [::]) I)} (f : A -> both L I B) (x : A), - (bind_both (fsubset_loc := fsubset_loc) (fsubset_opsig := fsubset_opsig) (ret_both x) f) = f x. + Lemma bind_solve_both_assoc : + forall {A B : choice_type} {L1 L2 I1 I2} (f : A -> both L2 I2 B) (x : A) `{fsubset_loc : is_true (fsubset (fset [::]) L1)} `{fsubset_opsig : is_true (fsubset (fset [::]) I1)} `{fsubset_loc2 : is_true (fsubset L1 L2)} `{fsubset_opsig2 : is_true (fsubset I1 I2)}, + (bind_both (fsubset_loc := fsubset_loc2) (fsubset_opsig := fsubset_opsig2) (lift_both (L2 := L1) (I2 := I1) (fsubset_loc := fsubset_loc) (fsubset_opsig := fsubset_opsig) (ret_both x)) f) = + (bind_both (fsubset_loc := fsubset_trans fsubset_loc fsubset_loc2) (fsubset_opsig := fsubset_trans fsubset_opsig fsubset_opsig2) (ret_both x) f). Proof. intros. apply both_eq. @@ -103,123 +245,393 @@ Module Schnorr_eq (GP : GroupParam). destruct both_prog. simpl. reflexivity. Qed. + + Theorem unfold_letb'2 : + forall L1 L2 I1 I2 A B C, + forall (z : both L1 I1 (A × B)) (f : _ -> both L2 I2 C), + forall `{fsubset_loc1 : is_true (fsubset (fset [::]) L1)} `{fsubset_opsig1 : is_true (fsubset (fset [::]) I1)}, + forall `{fsubset_loc2 : is_true (fsubset L1 L2)} `{fsubset_opsig2 : is_true (fsubset I1 I2)}, + is_state (lift_n (fsubset_loc := fsubset_loc2) (fsubset_opsig := fsubset_opsig2) 1 z f) = + ('(x, y) ← is_state z ;; is_state (f (lift_both (fsubset_loc := fsubset_loc1) (fsubset_opsig := fsubset_opsig1) (ret_both x) : both _ _ A, lift_both (fsubset_loc := fsubset_loc1) (fsubset_opsig := fsubset_opsig1) (ret_both y) : both _ _ B))). + Proof. + intros. + unfold lift_n at 1. + simpl. + + f_equal. + apply functional_extensionality. + intros []. + + rewrite unfold_prod0. + + rewrite <- surjective_pairing. + set (prod_to_prod _). + set (solve_lift _, solve_lift _). + replace p with p0 ; [ reflexivity | subst p p0 ]. + + unfold prod_to_prod at 1. + + rewrite bind_solve_both_assoc. + rewrite bind_solve_both_assoc. + + rewrite bind_ret_both. + rewrite bind_ret_both. + + simpl. + + f_equal. + f_equal. + apply proof_irrelevance. + apply proof_irrelevance. + f_equal. + f_equal. + apply proof_irrelevance. + apply proof_irrelevance. + Qed. - Theorem Schnorr_eq_proof id0 (pre : precond) : + Theorem Schnorr_eq_proof (* id0 *) (pre : precond) : forall (hw : (Sigma1.MyAlg.choiceStatement × Sigma1.MyAlg.choiceWitness)), - (pdisj pre id0 (fset0)) -> + forall (H_pdisj : pdisj pre (* id0 *) (fset [ :: RO1.queries_loc ; Sigma1.MyAlg.commit_loc ])), + forall (* exists *) (random_sample1 : Arit (uniform (H := Sigma1.MyParam.Witness_pos) Sigma1.MyAlg.i_witness)) random_sample2, ⊢ ⦃ pre ⦄ - is_state (both_prog (fiat_shamir_run (ret_both (Schnorr_translate_type hw)))) + is_state (both_prog (fiat_shamir_run (ret_both (Schnorr_translate_type hw)) (ret_both (uniform_secret random_sample1)) (ret_both random_sample2))) ≈ get_op_default (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO) (Sigma1.Sigma.RUN, ((chProd Sigma1.MyAlg.choiceStatement Sigma1.MyAlg.choiceWitness), Sigma1.MyAlg.choiceTranscript)) hw ⦃ fun '(v0, h0) '(v1, h1) => pre (h0, h1) ⦄. Proof. intros. - + (* eexists. *) + (* eexists. *) + (* Unfolding and simplifying to raw code! *) (* TODO: Work on higher level than raw code? *) - + rewrite get_op_default_link. erewrite get_op_default_spec. - 2: { - cbn. - done. - } + 2: {cbn. done.} ssprove_code_simpl. - - rewrite fiat_shamir_run_equation_1. destruct hw. - + hnf. + rewrite fiat_shamir_run_equation_1. + ssprove_code_simpl. ssprove_code_simpl_more. + (* Ltac get_next_statement := _. *) unfold let_both at 1. - - unfold prod_to_prod_n at 1 ; fold @prod_to_prod_n ; rewrite prod_to_prod_equation_1 ; rewrite !bind_ret_both ; simpl. - unfold Schnorr_translate_type ; simpl. - rewrite v_Commit_equation_1. - - unfold Build_t_G at 1. - + rewrite unfold_letb'2. + rewrite bind_rewrite. + destruct Schnorr_translate_type eqn:So. + unfold let_both at 1. + unfold let_both at 1. + unfold let_both at 1. + unfold let_both at 1. + unfold let_both at 1. + rewrite unfold_letb'2. - unfold is_state , both_prog. - rewrite !let_both_equation_1. - unfold both_prog. - rewrite !prod_both_equation_1. - setoid_rewrite bind_assoc. - setoid_rewrite bind_assoc. - setoid_rewrite bind_assoc. - setoid_rewrite bind_assoc. - (* unfold is_state, ret_both, lift_both, both_prog, bind_both, bind_raw_both. *) - - (* Actual proof *) - match goal with | [ |- context [ ⊢ ⦃ ?P ⦄ ?x ≈ assertD ?b ?f ⦃ ?Q ⦄ ] ] => change x with (assertD true (fun _ => x)) ; apply (r_assertD true b pre _ (fun _ => x)) end. { + clear -So. intros. + apply pair_equal_spec in So. + destruct So. + + eapply (@f_equal _ _ (cast_ord (esym _)) _ _) in H0. + erewrite cast_ordK in H0. + unfold fst in H0. + rewrite H0 ; clear H0. + + eapply (@f_equal _ _ (cast_ord (esym _)) _ _) in H1. + erewrite cast_ordK in H1. + unfold snd in H1. + rewrite H1 ; clear H1. + clear. + + destruct s1 , s2. + cbn. + unfold cast_ord. + + + unfold Sigma1.MyParam.R. + cbn. + pose nth_ord_enum. + unfold enum. + cbn. + simpl. + setoid_rewrite nth_ord_enum. admit. } - intros. - - match goal with - | [ |- context [ ⊢ ⦃ ?P ⦄ bind ?a ?f ≈ pkg_core_definition.sampler ?x ?y ⦃ ?Q ⦄ ] ] => - set (a) ; set (f) ; set (x) ; set (y) - end. - Check pkg_core_definition.sampler o. - pose (Arit o). - cbn in t. - pose Sigma1.MyAlg.i_witness. - cbn in n. - - assert (s1 : forall (x : Arit o), commit_loc). - { clear. intros. - apply (Schnorr_translate_type). - split. - (* apply (Hacspec_Lib_Pre.repr _ (word.modulus 1%nat)). *) - 2:{ - apply x. - }. - admit. - } - replace (x ← r ;; r0 _) with (x ← sample o ;; r0 (s1 x)) by admit. - apply r_uniform_bij with (f := id). + intros _ ?. + apply (better_r_const_sample_R) ; [ apply LosslessOp_uniform | intros ]. + + unfold random_oracle_query at 1. + + rewrite bind_assoc. + rewrite bind_assoc. + rewrite bind_rewrite. + + apply better_r_put_rhs. + apply better_r_put_get_rhs. + apply better_r_put_rhs. + + rewrite emptymE. + + rewrite bind_assoc. + rewrite bind_assoc. + rewrite bind_assoc. + rewrite bind_rewrite. + rewrite bind_assoc. + rewrite bind_assoc. + + (* Sample *) + apply (better_r_const_sample_R) ; [ apply LosslessOp_uniform | intros ]. + rewrite bind_rewrite. + + unfold is_state at 1, both_prog at 1. + unfold bind ; fold @bind. + apply better_r_put_get_lhs. + apply better_r_put_lhs. + + rewrite bind_rewrite. + rewrite bind_rewrite. + + unfold prod_to_prod_n at 1 ; fold @prod_to_prod_n. + rewrite bind_rewrite. + rewrite bind_rewrite. + + rewrite emptymE. + rewrite bind_assoc. + rewrite bind_assoc. + rewrite bind_rewrite. + apply better_r_put_rhs. + + apply better_r. + apply r_get_remind_rhs with (v := x). { - apply injF_bij. - apply inj_id. + unfold Remembers_rhs , rem_rhs. + intros ? ? ?. + clear -H. + destruct_pre. + rewrite get_set_heap_neq ; [ | easy ]. + rewrite get_set_heap_neq ; [ | easy ]. + rewrite get_set_heap_eq. reflexivity. } + apply better_r. + + repeat (rewrite !bind_assoc ; rewrite bind_rewrite). + unfold is_state at 1, both_prog at 1. + unfold bind ; fold @bind. + + apply better_r_put_get_lhs. + apply better_r_put_lhs. + + rewrite bind_rewrite. + rewrite bind_rewrite. + + unfold prod_to_prod_n at 1 ; fold @prod_to_prod_n. + + rewrite bind_rewrite. + rewrite bind_assoc. + rewrite bind_rewrite. + rewrite bind_rewrite. + unfold prod_to_prod_n at 1 ; fold @prod_to_prod_n. + rewrite !unfold_prod0. + rewrite bind_assoc. + rewrite bind_assoc. + rewrite bind_rewrite. + rewrite bind_rewrite. + rewrite bind_assoc. + rewrite bind_rewrite. + rewrite bind_rewrite. + + unfold prod_both at 1. + unfold prod_both at 1. + unfold prod_both at 1. + unfold is_state. + setoid_rewrite bind_assoc. + setoid_rewrite bind_assoc. + setoid_rewrite bind_assoc. + setoid_rewrite bind_assoc. + rewrite bind_rewrite. + unfold both_prog at 1 , is_state at 1. + unfold bind ; fold @bind. + + apply better_r_put_get_lhs. + apply better_r_put_lhs. + + rewrite bind_rewrite. + rewrite bind_rewrite. + + + rewrite bind_assoc. + rewrite bind_rewrite. + rewrite bind_rewrite. + apply r_ret. + intros. - subst r0 r1. - hnf. + clear -H H_pdisj. + destruct_pre. + + repeat apply H_pdisj. + - solve_in_fset. + - solve_in_fset. + - solve_in_fset. + - assumption. + + Unshelve. + all: intros ? ? ? ? ; apply proof_irrelevance. + Admitted. + + Definition Schnorr_translate_type2 (x : Sigma1.MyAlg.choiceTranscript) : t_Transcript. + Proof. + destruct x as [[[]]]. + refine (cast_ord _ s, cast_ord _ s0, cast_ord _ s1, cast_ord _ s2). + unfold pos. + rewrite mymod_is_statement. + symmetry. + eapply prednK. + apply Sigma1.MyParam.positive_gT. + + unfold pos. + rewrite mymod_is_statement. + symmetry. + eapply prednK. + apply Sigma1.MyParam.positive_gT. + + rewrite mymod2_is_statement. + symmetry. + eapply prednK. + apply Sigma1.MyParam.Witness_pos. + + rewrite mymod2_is_statement. + symmetry. + eapply prednK. + apply Sigma1.MyParam.Witness_pos. + Defined. + + Module OVN_mod := OVN GP OP. + Import OVN_mod. + Module OVN_proof (π2 : CDSParams) (Alg2 : SigmaProtocolAlgorithms π2). + Module OVN_OVN_mod := OVN π2 Alg2. + Import OVN_OVN_mod. + + Theorem Schnorr__eq_proof (* id0 *) (pre : precond) : + forall (hw : Sigma1.MyAlg.choiceTranscript), + forall (H_pdisj : pdisj pre (* id0 *) (fset [ :: RO1.queries_loc ; Sigma1.MyAlg.commit_loc ])), + (* forall i b, *) + forall (* exists *) (random_sample1 : Arit (uniform _)), + ⊢ ⦃ pre ⦄ + is_state (both_prog (fiat_shamir_verify (ret_both (Schnorr_translate_type2 hw)) (ret_both (uniform_secret random_sample1)))) + ≈ + get_op_default ((Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) (Sigma1.Sigma.VERIFY, ((Sigma1.MyAlg.choiceTranscript, 'bool))) hw + ⦃ fun '(v0, h0) '(v1, h1) => pre (h0, h1) ⦄. + Proof. + intros. + (* eexists. *) + (* eexists. *) + + (* Unfolding and simplifying to raw code! *) + (* TODO: Work on higher level than raw code? *) + + rewrite get_op_default_link. + erewrite get_op_default_spec. + 2: {cbn. done.} + ssprove_code_simpl. + destruct hw as [[[]]]. + hnf. + rewrite fiat_shamir_verify_equation_1. - Set Printing Coercions. - Unset Printing Notations. - - pose (r_bind). - - apply r_bind. + ssprove_code_simpl. + ssprove_code_simpl_more. + + (* setoid_rewrite bind_rewrite. *) + + unfold prod_to_prod_n at 1 ; fold @prod_to_prod_n ; rewrite !unfold_prod0. + autorewrite with let_both. + autorewrite with prod_to_prod. + rewrite prod_assoc_equation_1. - bind_jazz_bind. + rewrite !bind_ret_both. + + rewrite !bind_solve_both_assoc. + rewrite !bind_ret_both. + rewrite !bind_solve_both_assoc. + rewrite !bind_ret_both. + unfold fst, snd. + + unfold Schnorr_translate_type2. + + unfold prod_to_prod_n at 2 ; fold @prod_to_prod_n. + + (* Unset Printing Notations. *) + (* Set Printing Coercions. *) + match goal with + | |- context [let 'pair _ _ := prod_to_prod_n 1 ?b in ?x] => + pose (is_state (both_prog (let 'pair _ _ := prod_to_prod_n 1 b in x))); + pose ('(_, _) ← is_state (both_prog b) ;; is_state (both_prog x)) + ; set (b) ; set (x) + end. + + epose (is_state (both_prog b) ;; _). + + epose (_ ← (is_state b) ;; _). + + assert (forall L1 I1 A B L2 I2 C (b : both L1 I1 (A × B)) (x : both L2 I2 C), + is_state (letb '(_, _) := b in x) = + '(_, _) ← is_state b ;; is_state x). + { + clear. + intros. + destruct b. + destruct both_prog_valid. + simpl. + inversion is_valid_code. + - simpl. + destruct x0. + reflexivity. + - simpl. + + + + replace (is_state (both_prog (let 'pair _ _ := prod_to_prod_n 1 b in b0))) + with + ('(_, _) ← (is_state b) ;; is_state b0). + 2:{ + clear. + destruct b. + destruct both_prog. + unfold both_prog. + unfold ChoiceEquality.is_state. + destruct is_state. + + + change (is_state b0) with + ('(_, _) ← (is_state b) ;; is_state b0). - apply r_assertR. - r_assertR. + unfold prod_to_prod_n at 1 ; fold @prod_to_prod_n. - rewrite bind_assoc. - rewrite bind_assoc. + (* TODO, Sub proofs: *) + rewrite random_oracle_query_equation_1. + (* TODO, verify proofs: *) + rewrite verify_equation_1. - r_assertR. + rewrite prod_both_equation_1. + - ssprove_sync_eq. + setoid_rewrite bind_rewrite. -Require Import OVN. + + + (* Exec_i_realised *) (* {package (Exec_i i j m) ∘ (par ((P_i i b) ∘ (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) *) (* (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO))} *) - diff --git a/ovn/src/ovn_template.rs b/ovn/src/ovn_template.rs new file mode 100644 index 0000000..394f88c --- /dev/null +++ b/ovn/src/ovn_template.rs @@ -0,0 +1,123 @@ +use hacspec_lib::*; + +pub trait Group { + type group_type : PartialEq; + + const q : usize; // Prime order + const g : Self::group_type; // Generator (elemnent of group) + + fn g_pow(x : usize) -> Self::group_type; + fn one() -> Self::group_type; + fn prod(x : Self::group_type, y : Self::group_type) -> Self::group_type; + fn div(x : Self::group_type, y : Self::group_type) -> Self::group_type; + fn random_element() -> Self::group_type; +} + +struct eligible_votes { + v_id : usize, +} + +const n : usize = 3; +const P : [eligible_votes; 3] = // n = 3 + [eligible_votes {v_id: 0}, + eligible_votes {v_id: 1}, + eligible_votes {v_id: 2}]; + +pub fn select_private_voting_key (random : usize) -> usize { + random % G::q // x_i \in_R Z_q; +} + +pub fn ZKP(xi : usize) -> usize { + // TODO: Non-usizeeractive Schnorr proof using Fiat-Shamir heuristics + 0 +} + +// State of bulletin board +pub fn get_broadcast1() -> (Vec, Vec) { + (Vec::new(), Vec::new()) +} + +pub fn check_valid(zkp : usize) -> bool { + true +} + +pub fn broadcast1(xi : G::group_type, zkp : usize, i : usize) { + +} + +pub fn register_vote(i : usize, random : usize) { + let xi = select_private_voting_key::(random); + broadcast1::(G::g_pow(xi), ZKP::(xi), i); + let (gs, zkps) = get_broadcast1(); + + for zkp in zkps { + check_valid(zkp); + } + + let mut prod1 = G::one(); + for j in 1..i-1 { + prod1 = G::prod(prod1, G::g_pow(gs[j])); + } + let prod2 = G::one(); + for j in i+1..n { + prod1 = G::prod(prod1, G::g_pow(gs[j])); + } + let Yi = G::div(prod1, prod2); + // implicityly: Y_i = g^y_i +} + +// Meta Round: + +// pub fn round1(user){ +// for x in user { +// register() +// } +// } + +// Cramer, Damgård and Schoenmakers (CDS) technique +pub fn ZKP_one_out_of_two(vi : bool) -> usize { + 32 // TODO +} + +pub fn broadcast2 (g_pow_xiyi : G::group_type, g_pow_vi : G::group_type, g_pow_vi_zkp : usize) { + +} + +pub fn get_broadcast2 () -> (Vec,Vec,Vec) { + (Vec::new(),Vec::new(),Vec::new()) +} + +pub fn cast_vote(xi : usize, yi : usize, vi : bool) { + broadcast2::(G::g_pow(xi * yi), G::g_pow(if vi { 1 } else { 0 }), ZKP_one_out_of_two(vi)); +} + +// Meta Round: + +// pub fn round2(){ +// for x in user { +// cast_vote() +// } +// } + +pub fn tally_votes() -> usize { + let (g_pow_xi_yi, g_pow_vi, zkps) = get_broadcast2::(); + for zkp in zkps { + check_valid(zkp); + } + + let mut vote_result = G::one(); + for (gxiyi, gvi) in g_pow_xi_yi.into_iter().zip(g_pow_vi) { + vote_result = G::prod(vote_result, G::prod(gxiyi, gvi)); + } + + let mut tally = 0; + for i in 1..n { // Should be while, but is bounded by n anyways! + if G::g_pow(tally) != vote_result { + tally += 1 + } + else { + return tally + } + } + tally +} From ea8fb481578cd68ece27713244175ead432372b7 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Fri, 18 Aug 2023 13:22:36 +0200 Subject: [PATCH 08/86] Update template --- ovn/Cargo.toml | 2 +- ovn/proofs/ssprove/extraction/Hacspec_lib.v | 33 +++- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 125 ++++++------- .../ssprove/extraction/Hacspec_ovn_template.v | 165 ++++++++++++++++++ ovn/proofs/ssprove/extraction/HashMap.v | 2 +- ovn/proofs/ssprove/extraction/_CoqProject | 4 +- ovn/src/ovn_template.rs | 20 ++- 7 files changed, 273 insertions(+), 78 deletions(-) create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_template.v diff --git a/ovn/Cargo.toml b/ovn/Cargo.toml index 5099192..1a92989 100644 --- a/ovn/Cargo.toml +++ b/ovn/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Lasse Letager Hanse "] edition = "2018" [lib] -path = "src/ovn.rs" +path = "src/ovn_template.rs" [dependencies] hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } diff --git a/ovn/proofs/ssprove/extraction/Hacspec_lib.v b/ovn/proofs/ssprove/extraction/Hacspec_lib.v index 5f53b5a..39aafb9 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_lib.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_lib.v @@ -117,7 +117,8 @@ Fail Next Obligation. Structure array_or_seq A L I (len : nat) := { as_nseq :> both L I (nseq_ A len) ; - as_seq :> both L I (seq A) + as_seq :> both L I (seq A) ; + as_list :> both L I (chList A) }. Print as_seq. Print as_nseq. @@ -129,6 +130,7 @@ Print Graph. Arguments as_seq {_} {_} {_} {_}. (* array_or_seq. *) Arguments as_nseq {_} {_} {_} {_}. (* array_or_seq. *) +Arguments as_list {_} {_} {_} {_}. (* array_or_seq. *) (* Coercion as_seq : array_or_seq >-> both. *) (* Coercion as_nseq : array_or_seq >-> both. *) @@ -140,8 +142,16 @@ Arguments as_nseq {_} {_} {_} {_}. (* array_or_seq. *) (* Build_array_or_seq A L I len (array_to_seq a) a. *) (* Canonical (* Structure *) nseq_array_or_seq. *) +Definition array_to_list {L I A n} := lift1_both (L := L) (I := I) (fun x => (@array_to_list A n x) : chList _). + +Definition seq_to_list {L I A} := lift1_both (L := L) (I := I) (fun x => (@seq_to_list A x) : chList _). + +Definition seq_from_list {L I A} := lift1_both (L := L) (I := I) (fun (x : chList _) => seq_from_list A (x : list _)). + +Definition array_from_list' {L I A} {n : nat} := lift1_both (L := L) (I := I) (fun (x : chList A) => @array_from_list' A x n : nseq_ _ _). + Equations nseq_array_or_seq {A L I len} (val : both L I (nseq_ A len)) : array_or_seq A L I len := - nseq_array_or_seq val := {| as_seq := array_to_seq val ; as_nseq := val |}. + nseq_array_or_seq val := {| as_seq := array_to_seq val ; as_nseq := val ; as_list := array_to_list val |}. Fail Next Obligation. Arguments nseq_array_or_seq {A} {L} {I} {len}. @@ -211,6 +221,7 @@ Definition n_seq_array_or_seq {L I A} {B} (x : both L I B) | chUnit => True | chMap (chFin (@mkpos (S n) _)) (C) => C = A | chMap 'nat (C) => C = A + | chList C => C = A | _ => False end) : let len := (match B as K return @@ -218,6 +229,7 @@ Definition n_seq_array_or_seq {L I A} {B} (x : both L I B) | chUnit => True | chMap (chFin (@mkpos (S n) _)) (C) => C = A | chMap 'nat (C) => C = A + | chList C => C = A | _ => False end -> nat with @@ -234,6 +246,7 @@ Definition n_seq_array_or_seq {L I A} {B} (x : both L I B) end m_contra | chMap 'nat C => fun m_contra => 3%nat + | chList C => fun m_contra => 4%nat | _ => fun m_contra => False_rect nat m_contra end contra) in array_or_seq A L I len. @@ -241,11 +254,11 @@ Proof. intros. destruct B ; try contradiction contra. - change 'unit with (nseq_ A len) in x. - exact {| as_seq := array_to_seq x ; as_nseq := x |}. + exact {| as_seq := array_to_seq x ; as_nseq := x; as_list := array_to_list x |}. - destruct B1 ; try contradiction contra ; simpl in *. + subst. change (chMap 'nat A) with (seq A) in x. - exact ({| as_seq := x ; as_nseq := array_from_seq _ x ; |}). + exact ({| as_seq := x ; as_nseq := array_from_seq _ x ; as_list := seq_to_list x |}). + destruct n. destruct pos. * contradiction. @@ -259,7 +272,9 @@ Proof. unfold positive_eq. apply eqtype.eq_refl. } - exact {| as_seq := array_to_seq x ; as_nseq := x |}. + exact {| as_seq := array_to_seq x ; as_nseq := x; as_list := array_to_list x |}. + - subst. + exact {| as_seq := seq_from_list x ; as_nseq := array_from_list' x ; as_list := x |}. Defined. Notation " x '.a[' a ']'" := (array_index (n_seq_array_or_seq x _) a) (at level 40). @@ -353,4 +368,12 @@ Notation "'i64(' v ')'" := (ret_both (v : int64) : both (fset []) ([interface]) Notation "'i128(' v ')'" := (ret_both (v : int128) : both (fset []) ([interface]) _). Notation into_iter := (fun x => x). + +Definition vec_len {L I A ws} := lift1_both (L := L) (I := I) (fun (x : chList A) => repr ws (List.length x)). + +Definition andb {L1 L2 I1 I2} (x : both L1 I1 'bool) (y : both L2 I2 'bool) : both (L1 :|: L2) (I1 :|: I2) 'bool := lift2_both (fun (x y : 'bool) => Datatypes.andb x y : 'bool) x y. +Definition negb {L1 I1} (x : both L1 I1 'bool) : both (L1) (I1) 'bool := lift1_both (fun (x : 'bool) => Datatypes.negb x : 'bool) x. +Notation "a <> b" := (negb (eqb a b)). +Notation "'not'" := (negb). + (** end of: Should be moved to Hacspec_Lib.v **) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 4a61820..fade2d4 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -26,26 +26,31 @@ Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. (*Not implemented yet? todo(item)*) +Require Import (* Hacspec_ovn_ *)Core. +Export (* Hacspec_ovn_ *)Core. + Require Import (* Hacspec_ovn_ *)Hacspec_lib. Export (* Hacspec_ovn_ *)Hacspec_lib. Class t_Group (Self : choice_type) := { t_group_type : choice_type ; - (* t_group_type_t_PartialEq :> t_PartialEq (t_group_type) ; *) - (* t_group_type_t_Sized :> t_Sized (t_group_type) ; *) - q : forall {L I}, both L I uint_size ; - g : t_group_type ; - g_pow : forall {L I}, both L I uint_size -> both L I t_group_type ; - one : forall {L I}, both L I t_group_type ; - prod : forall {L1 L2 I1 I2}, both L1 I1 t_group_type -> both L2 I2 t_group_type -> both (L1 :|: L2) (I1 :|: I2) t_group_type ; - div : forall {L1 L2 I1 I2}, both L1 I1 t_group_type -> both L2 I2 t_group_type -> both (L1 :|: L2) (I1 :|: I2) t_group_type ; - random_element : t_group_type ; + t_group_type_t_Copy :> t_Copy (t_group_type) ; + t_group_type_t_Clone :> t_Clone (t_group_type) ; + t_group_type_t_PartialEq :> t_PartialEq (t_group_type) ; + t_group_type_t_Sized :> t_Sized (t_group_type) ; + q : forall {L0 I0}, both L0 I0 (uint_size) ; + g : forall {L0 I0}, both L0 I0 (t_group_type) ; + g_pow : forall {L0 L1 I0 I1}, both L0 I0 (uint_size) -> both L1 I1 (t_group_type) ; + one : forall {L0 I0}, both L0 I0 (t_group_type) ; + prod : forall {L0 L1 L2 I0 I1 I2}, both L0 I0 (t_group_type) -> both L1 I1 (t_group_type) -> both L2 I2 (t_group_type) ; + div : forall {L0 L1 L2 I0 I1 I2}, both L0 I0 (t_group_type) -> both L1 I1 (t_group_type) -> both L2 I2 (t_group_type) ; + random_element : forall {L0 I0}, both L0 I0 (t_group_type) ; }. Definition t_eligible_votes : choice_type := (uint_size). -Equations Build_t_eligible_votes {L : {fset Location}} {I : Interface} (f_v_id : both L I (uint_size)) : both L I (t_eligible_votes) := - Build_t_eligible_votes f_v_id := +Equations Build_t_C_eligible_votes {L : {fset Location}} {I : Interface} (f_v_id : both L I (uint_size)) : both L I (t_eligible_votes) := + Build_t_C_eligible_votes f_v_id := bind_both f_v_id (fun f_v_id => solve_lift (ret_both ((f_v_id) : (t_eligible_votes)))) : both L I (t_eligible_votes). Fail Next Obligation. @@ -57,26 +62,24 @@ Fail Next Obligation. Equations v_P : both (fset []) ([interface ]) (nseq t_eligible_votes 3) := v_P := - array_from_list [solve_lift (Build_t_eligible_votes (* Build_t_C_eligible_votes *) (ret_both (0 : uint_size))); - solve_lift (Build_t_eligible_votes (* Build_t_C_eligible_votes *) (ret_both (1 : uint_size))); - solve_lift (Build_t_eligible_votes (* Build_t_C_eligible_votes *) (ret_both (2 : uint_size)))] : both (fset []) ([interface ]) (nseq t_eligible_votes 3). + array_from_list [solve_lift (Build_t_C_eligible_votes (ret_both (0 : uint_size))); + solve_lift (Build_t_C_eligible_votes (ret_both (1 : uint_size))); + solve_lift (Build_t_C_eligible_votes (ret_both (2 : uint_size)))] : both (fset []) ([interface ]) (nseq t_eligible_votes 3). Fail Next Obligation. -Equations select_private_voting_key (G : _) (* `{ t_Sized (G)} *) `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := +Equations select_private_voting_key (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := select_private_voting_key G random := solve_lift (random .% q) : both (L1) (I1) (uint_size). Fail Next Obligation. -Equations v_ZKP (G : _) (* `{ t_Sized (G)} *) `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (xi : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := +Equations v_ZKP (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (xi : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := v_ZKP G xi := solve_lift (ret_both (0 : uint_size)) : both (L1) (I1) (uint_size). Fail Next Obligation. -Require Import Core. - Equations get_broadcast1 : both (fset []) ([interface ]) ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))) := get_broadcast1 := - solve_lift (prod_b (@new _ fset0 fset0,@new _ fset0 fset0)) : both (fset []) ([interface ]) ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))). + solve_lift (prod_b (new(* _under_impl *) : both fset0 fset0 _,new(* _under_impl *) : both fset0 fset0 _)) : both (fset []) ([interface ]) ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))). Fail Next Obligation. Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (uint_size)) : both (L1) (I1) ('bool) := @@ -84,39 +87,32 @@ Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 solve_lift (ret_both (true : 'bool)) : both (L1) (I1) ('bool). Fail Next Obligation. -Equations broadcast1 (G : _) (* `{ t_Sized (G)} *) `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (t_group_type)) (zkp : both L2 I2 (uint_size)) (i : both L3 I3 (uint_size)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := +Equations broadcast1 (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (t_group_type)) (zkp : both L2 I2 (uint_size)) (i : both L3 I3 (uint_size)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := broadcast1 G xi zkp i := solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). Fail Next Obligation. -Require Import (* Hacspec_ovn_ *)Hacspec_lib. -Export (* Hacspec_ovn_ *)Hacspec_lib. - -Definition prod1_loc {G : _} (* `{ t_Sized (G)} *) `{ t_Group (G)} : Location := +Definition prod1_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := (t_group_type ; 0%nat). -Equations register_vote (G : _) (* `{ t_Sized (G)} *) `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (i : both L1 I1 (uint_size)) (random : both L2 I2 (uint_size)) : both (L1:|:L2 :|: fset [prod1_loc]) (I1:|:I2) ('unit) := - register_vote G i random := +Equations register_vote (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (i : both L1 I1 (uint_size)) (random : both L2 I2 (uint_size)) : both (L1:|:L2 :|: fset [prod1_loc]) (I1:|:I2) ('unit) := + register_vote G i random := letb xi := (select_private_voting_key G random) : both _ _ (uint_size) in letb _ := (broadcast1 G (g_pow xi) (v_ZKP G xi) i) : both _ _ ('unit) in letb _ := (ret_both (tt : 'unit)) : both _ _ ('unit) in letb '(gs,zkps) := (get_broadcast1) : both _ _ ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))) in - (* letb _ := (other loop todo(term)) : both _ _ ('unit) in *) (* TODO LOOP *) + letb _ := (foldi_both_list (into_iter zkps) (fun {L I _ _} =>fun zkp => + (ssp (fun _ => + letb _ := (check_valid zkp) in solve_lift ret_both (tt : 'unit)) )) (ret_both (tt : 'unit))) : both _ _ ('unit) in letbm prod1 loc(prod1_loc) := (one) : both _ _ (t_group_type) in - letb prod1 := (foldi_both (into_iter (Build_t_Range (ret_both (1 : uint_size)) (i .- (ret_both (1 : uint_size))))) (fun {L I _ _} =>fun j => + letb prod1 := (foldi_both (into_iter (Build_t_Range (ret_both (0 : uint_size))(i .- (ret_both (1 : uint_size))))) (fun {L I _ _} =>fun j => (ssp (fun prod1 => - solve_lift (prod prod1 (g_pow (gs.a[j])))) )) prod1) : both _ _ (t_group_type) in + solve_lift (prod prod1 (g_pow (gs.a[j])))) )) prod1) : both _ _ (t_group_type) in letb prod2 := (one) : both _ _ (t_group_type) in letb prod1 := (foldi_both (into_iter (Build_t_Range (i .+ (ret_both (1 : uint_size)))n)) (fun {L I _ _} =>fun j => (ssp (fun prod1 => solve_lift (prod prod1 (g_pow (gs.a[j])))) )) prod1) : both _ _ (t_group_type) in letb Yi := (div prod1 prod2) : both _ _ (t_group_type) in - solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2 :|: fset [prod1_loc]) (I1:|:I2) ('unit). -Next Obligation. - admit. -Admitted. -Next Obligation. - admit. -Admitted. + solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2 :|: fset [prod1_loc]) (I1:|:I2) ('unit). Fail Next Obligation. Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {I1 : Interface} (vi : both L1 I1 ('bool)) : both (L1) (I1) (uint_size) := @@ -124,17 +120,17 @@ Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {I1 : Interface} (vi : bot solve_lift (ret_both (32 : uint_size)) : both (L1) (I1) (uint_size). Fail Next Obligation. -Equations broadcast2 (G : _) (* `{ t_Sized (G)} *) `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (g_pow_xiyi : both L1 I1 (t_group_type)) (g_pow_vi : both L2 I2 (t_group_type)) (g_pow_vi_zkp : both L3 I3 (uint_size)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := +Equations broadcast2 (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (g_pow_xiyi : both L1 I1 (t_group_type)) (g_pow_vi : both L2 I2 (t_group_type)) (g_pow_vi_zkp : both L3 I3 (uint_size)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := broadcast2 G g_pow_xiyi g_pow_vi g_pow_vi_zkp := solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). Fail Next Obligation. -Equations get_broadcast2 (G : _) (* `{ t_Sized (G)} *) `{ t_Group (G)} : both (fset []) ([interface ]) ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))) := +Equations get_broadcast2 (G : _) `{ t_Sized (G)} `{ t_Group (G)} : both (fset []) ([interface ]) ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))) := get_broadcast2 G := - solve_lift (prod_b (@new _ fset0 fset0,@new _ fset0 fset0,@new _ fset0 fset0)) : both (fset []) ([interface ]) ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))). + solve_lift (prod_b (new(* _under_impl *) : both fset0 fset0 _,new(* _under_impl *) : both fset0 fset0 _,new(* _under_impl *) : both fset0 fset0 _)) : both (fset []) ([interface ]) ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))). Fail Next Obligation. -Equations cast_vote (G : _) (* `{ t_Sized (G)} *) `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (uint_size)) (yi : both L2 I2 (uint_size)) (vi : both L3 I3 ('bool)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := +Equations cast_vote (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (uint_size)) (yi : both L2 I2 (uint_size)) (vi : both L3 I3 ('bool)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := cast_vote G xi yi vi := letb _ := (broadcast2 G (g_pow (xi .* yi)) (g_pow (ifb vi then ret_both (1 : uint_size) @@ -143,30 +139,35 @@ Equations cast_vote (G : _) (* `{ t_Sized (G)} *) `{ t_Group (G)} {L1 : {fset Lo solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). Fail Next Obligation. -Definition vote_result_loc {G : _} (* `{ t_Sized (G)} *) `{ t_Group (G)} : Location := - (t_group_type ; 2%nat). -Definition tally_loc {G : _} (* `{ t_Sized (G)} *) `{ t_Group (G)} : Location := - (uint_size ; 1%nat). -Definition into_iter_zip {L I A B} (x : both L I (chList (A × B))) : both L I (chList A) * both L I (chList B). Admitted. -Equations tally_votes (G : _) (* `{ t_Sized (G)} *) `{ t_Group (G)} : both (fset [tally_loc; vote_result_loc]) ([interface ]) (uint_size) := +Definition vote_result_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := + (t_group_type ; 3%nat). +Definition tally_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := + (uint_size ; 2%nat). +Definition done_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := + ('bool ; 1%nat). + +Definition andb {L1 L2 I1 I2} (x : both L1 I1 'bool) (y : both L2 I2 'bool) : both (L1 :|: L2) (I1 :|: I2) 'bool := lift2_both (fun (x y : 'bool) => Datatypes.andb x y : 'bool) x y. +Definition negb {L1 I1} (x : both L1 I1 'bool) : both (L1) (I1) 'bool := lift1_both (fun (x : 'bool) => Datatypes.negb x : 'bool) x. +Notation "a <> b" := (negb (eqb a b)). +Notation "'not'" := (negb). +Equations tally_votes (G : _) `{ t_Sized (G)} `{ t_Group (G)} : both (fset [done_loc; tally_loc; vote_result_loc]) ([interface ]) (uint_size) := tally_votes G := letb '(g_pow_xi_yi,g_pow_vi,zkps) := (get_broadcast2 G) : both _ _ ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))) in - (* letb _ := (other loop todo(term)) : both _ _ ('unit) in *) (* TODO Loop *) + letb _ := (foldi_both_list (into_iter zkps) (fun {L I _ _} =>fun zkp => + (ssp (fun _ => + letb _ := (check_valid zkp) in solve_lift ret_both (tt : 'unit)) )) (ret_both (tt : 'unit))) : both _ _ ('unit) in letbm vote_result loc(vote_result_loc) := (one) : both _ _ (t_group_type) in - (* letb vote_result := (foldi_both (into_iter_zip ((lift2_both (fun (x : chList _) (y : chList _) => seq.zip x y : chList (chProd _ _))) (into_iter g_pow_xi_yi) g_pow_vi)) (fun {L I _ _} =>fun '(gxiyi,gvi) => *) - (* (ssp (fun vote_result => *) - (* solve_lift (prod vote_result (prod gxiyi gvi))) )) vote_result) : both _ _ (t_group_type) in *) - (* TODO for_loop *) + letb vote_result := (foldi_both (into_iter (Build_t_Range (ret_both (0 : uint_size))(vec_len (* len_under_impl_1 *) g_pow_vi))) (fun {L I _ _} =>fun i => + (ssp (fun vote_result => + solve_lift (prod vote_result (prod (clone (g_pow_xi_yi.a[i])) (clone (g_pow_vi.a[i]))))) )) vote_result) : both _ _ (t_group_type) in letbm tally loc(tally_loc) := (ret_both (0 : uint_size)) : both _ _ (uint_size) in - (* letb tally := (foldi_both (into_iter (Build_t_Range (ret_both (1 : uint_size))n)) (fun {L I _ _} =>fun i => *) - (* (ssp (fun tally => *) - (* ifb solve_lift ((g_pow tally) <> vote_result) *) - (* then ControlFlow_Continue (letb _ := (tally .+ (ret_both (1 : uint_size))) : both _ _ ('unit) in *) - (* solve_lift (ret_both (tt : 'unit))) *) - (* else letb hoist1 := (v_Break tally) : both _ _ (t_Never) in *) - (* ControlFlow_Continue (letb _ := (never_to_any hoist1) : both _ _ ('unit) in *) - (* tally)) )) tally) : both _ _ ('unit) in *) - (* TODO for_loop *) - solve_lift tally : both (fset [tally_loc; vote_result_loc]) ([interface ]) (uint_size). -Admit Obligations. + letbm done loc(done_loc) := (ret_both (false : 'bool)) : both _ _ ('bool) in + letb '(done,tally) := (foldi_both (into_iter (Build_t_Range (ret_both (1 : uint_size))n)) (fun {L I _ _} =>fun _ => + (ssp (fun '(done,tally) => + ifb solve_lift (andb ((g_pow tally) <> vote_result) (not done)) + then letb _ := (tally .+ (ret_both (1 : uint_size))) : both _ _ ('unit) in + solve_lift (prod_b (done,ret_both (tt : 'unit))) + else letb done := (ret_both (true : 'bool)) : both _ _ ('bool) in + solve_lift (prod_b (done,tally))) )) (prod_b (done,tally))) : both _ _ (('bool × 'unit)) in + tally : both (fset [done_loc; tally_loc; vote_result_loc]) ([interface ]) (uint_size). Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_template.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_template.v new file mode 100644 index 0000000..65fdc50 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_template.v @@ -0,0 +1,165 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. + Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +(*Not implemented yet? todo(item)*) + +Require Import (* Hacspec_ovn_ *)Core. +Export (* Hacspec_ovn_ *)Core. + +Require Import (* Hacspec_ovn_ *)Hacspec_lib. +Export (* Hacspec_ovn_ *)Hacspec_lib. + +Class t_Group (Self : choice_type) := { + t_group_type : choice_type ; + t_group_type_t_Copy :> t_Copy (t_group_type) ; + t_group_type_t_Clone :> t_Clone (t_group_type) ; + t_group_type_t_PartialEq :> t_PartialEq (t_group_type) ; + t_group_type_t_Sized :> t_Sized (t_group_type) ; + q : forall {L I}, both L I uint_size ; + g : forall {L I}, both L I t_group_type ; + g_pow : forall {L I}, both L I uint_size -> both L I t_group_type ; + one : forall {L I}, both L I t_group_type ; + prod_tt : forall {L1 L2 I1 I2}, both L1 I1 t_group_type -> both L2 I2 t_group_type -> both (L1 :|: L2) (I1 :|: I2) t_group_type ; + div : forall {L1 L2 I1 I2}, both L1 I1 t_group_type -> both L2 I2 t_group_type -> both (L1 :|: L2) (I1 :|: I2) t_group_type ; + random_element : forall {L I}, both L I t_group_type ; +}. + +Definition t_eligible_votes : choice_type := + (uint_size). +Equations Build_t_eligible_votes {L : {fset Location}} {I : Interface} (f_v_id : both L I (uint_size)) : both L I (t_eligible_votes) := + Build_t_eligible_votes f_v_id := + bind_both f_v_id (fun f_v_id => + solve_lift (ret_both ((f_v_id) : (t_eligible_votes)))) : both L I (t_eligible_votes). +Fail Next Obligation. + +Equations n : both (fset []) ([interface ]) (uint_size) := + n := + solve_lift (ret_both (3 : uint_size)) : both (fset []) ([interface ]) (uint_size). +Fail Next Obligation. + +Equations v_P : both (fset []) ([interface ]) (nseq t_eligible_votes 3) := + v_P := + array_from_list [solve_lift (Build_t_eligible_votes (* Build_t_C_eligible_votes *) (ret_both (0 : uint_size))); + solve_lift (Build_t_eligible_votes (* Build_t_C_eligible_votes *) (ret_both (1 : uint_size))); + solve_lift (Build_t_eligible_votes (* Build_t_C_eligible_votes *) (ret_both (2 : uint_size)))] : both (fset []) ([interface ]) (nseq t_eligible_votes 3). +Fail Next Obligation. + +Equations select_private_voting_key (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := + select_private_voting_key G random := + solve_lift (random .% q) : both (L1) (I1) (uint_size). +Fail Next Obligation. + +Equations v_ZKP (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (xi : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := + v_ZKP G xi := + solve_lift (ret_both (0 : uint_size)) : both (L1) (I1) (uint_size). +Fail Next Obligation. + +Equations get_broadcast1 : both (fset []) ([interface ]) ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))) := + get_broadcast1 := + solve_lift (prod_b (new(* _under_impl *) : both fset0 fset0 _,new(* _under_impl *) : both fset0 fset0 _)) : both (fset []) ([interface ]) ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))). +Fail Next Obligation. + +Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (uint_size)) : both (L1) (I1) ('bool) := + check_valid zkp := + solve_lift (ret_both (true : 'bool)) : both (L1) (I1) ('bool). +Fail Next Obligation. + +Equations broadcast1 (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (t_group_type)) (zkp : both L2 I2 (uint_size)) (i : both L3 I3 (uint_size)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := + broadcast1 G xi zkp i := + solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). +Fail Next Obligation. + +Definition prod1_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := + (t_group_type ; 0%nat). +Equations register_vote (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (i : both L1 I1 (uint_size)) (random : both L2 I2 (uint_size)) : both (L1:|:L2 :|: fset [prod1_loc]) (I1:|:I2) ('unit) := + register_vote G i random := + letb xi := (select_private_voting_key G random) : both _ _ (uint_size) in + letb _ := (broadcast1 G (g_pow xi) (v_ZKP G xi) i) : both _ _ ('unit) in + letb _ := (ret_both (tt : 'unit)) : both _ _ ('unit) in + letb '(gs,zkps) := (get_broadcast1) : both _ _ ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))) in + (* letb _ := (other loop todo(term)) : both _ _ ('unit) in *) + letbm prod1 loc(prod1_loc) := (one) : both _ _ (t_group_type) in + letb prod1 := (foldi_both (into_iter (Build_t_Range (ret_both (1 : uint_size))(i .- (ret_both (1 : uint_size))))) (fun {L I _ _} =>fun j => + (ssp (fun prod1 => + solve_lift (prod_tt prod1 (g_pow (gs.a[j])))) )) prod1) : both _ _ (t_group_type) in + letb prod2 := (one) : both _ _ (t_group_type) in + letb prod1 := (foldi_both (into_iter (Build_t_Range (i .+ (ret_both (1 : uint_size)))n)) (fun {L I _ _} =>fun j => + (ssp (fun prod1 => + solve_lift (prod_tt prod1 (g_pow (gs.a[j])))) )) prod1) : both _ _ (t_group_type) in + letb Yi := (div prod1 prod2) : both _ _ (t_group_type) in + solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2 :|: fset [prod1_loc]) (I1:|:I2) ('unit). +Fail Next Obligation. + +Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {I1 : Interface} (vi : both L1 I1 ('bool)) : both (L1) (I1) (uint_size) := + v_ZKP_one_out_of_two vi := + solve_lift (ret_both (32 : uint_size)) : both (L1) (I1) (uint_size). +Fail Next Obligation. + +Equations broadcast2 (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (g_pow_xiyi : both L1 I1 (t_group_type)) (g_pow_vi : both L2 I2 (t_group_type)) (g_pow_vi_zkp : both L3 I3 (uint_size)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := + broadcast2 G g_pow_xiyi g_pow_vi g_pow_vi_zkp := + solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). +Fail Next Obligation. + +Equations get_broadcast2 (G : _) `{ t_Sized (G)} `{ t_Group (G)} : both (fset []) ([interface ]) ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))) := + get_broadcast2 G := + solve_lift (prod_b (new(* _under_impl *) : both fset0 fset0 _,new(* _under_impl *): both fset0 fset0 _,new(* _under_impl *): both fset0 fset0 _)) : both (fset []) ([interface ]) ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))). +Fail Next Obligation. + +Equations cast_vote (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (uint_size)) (yi : both L2 I2 (uint_size)) (vi : both L3 I3 ('bool)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := + cast_vote G xi yi vi := + letb _ := (broadcast2 G (g_pow (xi .* yi)) (g_pow (ifb vi + then ret_both (1 : uint_size) + else ret_both (0 : uint_size))) (v_ZKP_one_out_of_two vi)) : both _ _ ('unit) in + letb _ := (ret_both (tt : 'unit)) : both _ _ ('unit) in + solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). +Fail Next Obligation. + +Definition vote_result_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := + (t_group_type ; 2%nat). +Definition tally_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := + (uint_size ; 1%nat). + +Definition len {A L I} := lift1_both (L := L) (I := I) (fun (x : chList A) => repr _ (@List.length A x) : uint32). + +Equations tally_votes (G : _) `{ t_Sized (G)} `{ t_Group (G)} : both (fset [tally_loc; vote_result_loc]) ([interface ]) (uint_size) := + tally_votes G := + letb '(g_pow_xi_yi,g_pow_vi,zkps) := (get_broadcast2 G) : both _ _ ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))) in + (* letb _ := (other loop todo(term)) : both _ _ ('unit) in *) + (* letbm vote_result loc(vote_result_loc) := (one) : both _ _ (t_group_type) in *) + (* letb vote_result := (foldi_both (into_iter (Build_t_Range (ret_both (0 : uint_size))(len(* _under_impl_1 *) g_pow_vi))) (fun {L I _ _} =>fun i => *) + (* (ssp (fun vote_result => *) + (* solve_lift (prod_tt vote_result (prod_tt (clone (g_pow_xi_yi.a[i])) (clone (g_pow_vi.a[i]))))) )) vote_result) : both _ _ (t_group_type) in *) + letbm tally loc(tally_loc) := (ret_both (0 : uint_size)) : both _ _ (uint_size) in + (* letb tally := (foldi_both (into_iter (Build_t_Range (ret_both (1 : uint_size))n)) (fun {L I _ _} =>fun i => *) + (* (ssp (fun tally => *) + (* (* ifb solve_lift ((g_pow tally) <> vote_result) *) *) + (* (* then ControlFlow_Continue (letb _ := (tally .+ (ret_both (1 : uint_size))) : both _ _ ('unit) in *) *) + (* solve_lift (ret_both (tt : 'unit)) (* ) *) *) + (* (* else letb hoist1 := (v_Break tally) : both _ _ (t_Never) in *) *) + (* (* ControlFlow_Continue (letb _ := (never_to_any hoist1) : both _ _ ('unit) in *) *) + (* (* tally) *)) )) tally) : both _ _ ('unit) in *) + solve_lift tally : both (fset [tally_loc; vote_result_loc]) ([interface ]) (uint_size). +Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/HashMap.v b/ovn/proofs/ssprove/extraction/HashMap.v index 9091008..58eeb1e 100644 --- a/ovn/proofs/ssprove/extraction/HashMap.v +++ b/ovn/proofs/ssprove/extraction/HashMap.v @@ -64,4 +64,4 @@ Equations get {L1 L2 I1 I2} {A B} (m : both L1 I1 (t_HashMap A B t_RandomState)) solve_lift ret_both (getm m' (chElement_ordType_ce_to_ce A i') : chOption B))). Equations new {L I A B} : both L I (t_HashMap A B t_RandomState) := - new := (solve_lift ret_both emptym). (* (fmap (s:=[]) _ : chMap _ _) *) + new := solve_lift ret_both (emptym : t_HashMap A B t_RandomState). (* (fmap (s:=[]) _ : chMap _ _) *) diff --git a/ovn/proofs/ssprove/extraction/_CoqProject b/ovn/proofs/ssprove/extraction/_CoqProject index 9860176..2773cce 100644 --- a/ovn/proofs/ssprove/extraction/_CoqProject +++ b/ovn/proofs/ssprove/extraction/_CoqProject @@ -15,8 +15,8 @@ Core.v HashMap.v # Translated -Hacspec_ovn_Schnorr_Random_oracle.v -Hacspec_ovn_Schnorr.v +# Hacspec_ovn_Schnorr_Random_oracle.v +# Hacspec_ovn_Schnorr.v Hacspec_ovn.v # Equality proof between the two versions! diff --git a/ovn/src/ovn_template.rs b/ovn/src/ovn_template.rs index 394f88c..09ea52b 100644 --- a/ovn/src/ovn_template.rs +++ b/ovn/src/ovn_template.rs @@ -1,7 +1,8 @@ +use core::*; use hacspec_lib::*; pub trait Group { - type group_type : PartialEq; + type group_type : PartialEq + Clone + Copy; const q : usize; // Prime order const g : Self::group_type; // Generator (elemnent of group) @@ -55,7 +56,7 @@ pub fn register_vote(i : usize, random : usize) { } let mut prod1 = G::one(); - for j in 1..i-1 { + for j in 0..i-1 { prod1 = G::prod(prod1, G::g_pow(gs[j])); } let prod2 = G::one(); @@ -106,18 +107,23 @@ pub fn tally_votes() -> usize { } let mut vote_result = G::one(); - for (gxiyi, gvi) in g_pow_xi_yi.into_iter().zip(g_pow_vi) { - vote_result = G::prod(vote_result, G::prod(gxiyi, gvi)); + for i in 0..g_pow_vi.len() { + vote_result = G::prod(vote_result, G::prod(g_pow_xi_yi[i].clone(), g_pow_vi[i].clone())); } let mut tally = 0; - for i in 1..n { // Should be while, but is bounded by n anyways! - if G::g_pow(tally) != vote_result { + let mut done = false; + for _ in 1..n { // Should be while, but is bounded by n anyways! + if G::g_pow(tally) != vote_result && !done { tally += 1 } else { - return tally + done = true; } } tally } + +// Meta Round: + +// Tally From 4854f9db5622bbe6747d3117357b5a5764b4aa10 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Mon, 21 Aug 2023 16:44:34 +0200 Subject: [PATCH 09/86] Update --- ovn/proofs/ssprove/extraction/.gitignore | 7 + ovn/proofs/ssprove/extraction/Hacspec_lib.v | 5 +- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 160 ++++---- ovn/src/ovn.rs | 265 +++++++++++- ovn/src/ovn_old.rs | 421 +++++++------------- ovn/src/ovn_template.rs | 37 +- ovn/src/schnorr.rs | 18 +- ovn/src/schnorr/random_oracle.rs | 33 +- 8 files changed, 517 insertions(+), 429 deletions(-) create mode 100644 ovn/proofs/ssprove/extraction/.gitignore diff --git a/ovn/proofs/ssprove/extraction/.gitignore b/ovn/proofs/ssprove/extraction/.gitignore new file mode 100644 index 0000000..0b7287c --- /dev/null +++ b/ovn/proofs/ssprove/extraction/.gitignore @@ -0,0 +1,7 @@ +*.vo* +*.aux +*.glob +*.cache +.Makefile.d +Makefile +Makefile.conf diff --git a/ovn/proofs/ssprove/extraction/Hacspec_lib.v b/ovn/proofs/ssprove/extraction/Hacspec_lib.v index 39aafb9..3456657 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_lib.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_lib.v @@ -369,11 +369,12 @@ Notation "'i128(' v ')'" := (ret_both (v : int128) : both (fset []) ([interface] Notation into_iter := (fun x => x). -Definition vec_len {L I A ws} := lift1_both (L := L) (I := I) (fun (x : chList A) => repr ws (List.length x)). +Definition (* vec_ *)len {L I A ws} := lift1_both (L := L) (I := I) (fun (x : chList A) => repr ws (List.length x)). Definition andb {L1 L2 I1 I2} (x : both L1 I1 'bool) (y : both L2 I2 'bool) : both (L1 :|: L2) (I1 :|: I2) 'bool := lift2_both (fun (x y : 'bool) => Datatypes.andb x y : 'bool) x y. Definition negb {L1 I1} (x : both L1 I1 'bool) : both (L1) (I1) 'bool := lift1_both (fun (x : 'bool) => Datatypes.negb x : 'bool) x. Notation "a <> b" := (negb (eqb a b)). Notation "'not'" := (negb). - +Notation "x ':of:' y" := (x : both _ _ y) (at level 100). +Notation "x ':of0:' y" := (x : both (fset []) (fset []) y) (at level 100). (** end of: Should be moved to Hacspec_Lib.v **) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index fade2d4..886abd3 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -26,60 +26,42 @@ Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. (*Not implemented yet? todo(item)*) -Require Import (* Hacspec_ovn_ *)Core. -Export (* Hacspec_ovn_ *)Core. +Require Import Core. +Export Core. -Require Import (* Hacspec_ovn_ *)Hacspec_lib. -Export (* Hacspec_ovn_ *)Hacspec_lib. +Require Import Hacspec_lib. +Export Hacspec_lib. Class t_Group (Self : choice_type) := { t_group_type : choice_type ; - t_group_type_t_Copy :> t_Copy (t_group_type) ; - t_group_type_t_Clone :> t_Clone (t_group_type) ; - t_group_type_t_PartialEq :> t_PartialEq (t_group_type) ; - t_group_type_t_Sized :> t_Sized (t_group_type) ; + t_group_type_t_EqDec :> EqDec (t_group_type) ; q : forall {L0 I0}, both L0 I0 (uint_size) ; g : forall {L0 I0}, both L0 I0 (t_group_type) ; - g_pow : forall {L0 L1 I0 I1}, both L0 I0 (uint_size) -> both L1 I1 (t_group_type) ; + g_pow : forall {L0 I0}, both L0 I0 (uint_size) -> both L0 I0 (t_group_type) ; one : forall {L0 I0}, both L0 I0 (t_group_type) ; - prod : forall {L0 L1 L2 I0 I1 I2}, both L0 I0 (t_group_type) -> both L1 I1 (t_group_type) -> both L2 I2 (t_group_type) ; - div : forall {L0 L1 L2 I0 I1 I2}, both L0 I0 (t_group_type) -> both L1 I1 (t_group_type) -> both L2 I2 (t_group_type) ; + prod : forall {L0 L1 I0 I1}, both L0 I0 (t_group_type) -> both L1 I1 (t_group_type) -> both (L0 :|: L1) (I0 :|: I1) (t_group_type) ; + div : forall {L0 L1 I0 I1}, both L0 I0 (t_group_type) -> both L1 I1 (t_group_type) -> both (L0 :|: L1) (I0 :|: I1) (t_group_type) ; random_element : forall {L0 I0}, both L0 I0 (t_group_type) ; }. -Definition t_eligible_votes : choice_type := - (uint_size). -Equations Build_t_C_eligible_votes {L : {fset Location}} {I : Interface} (f_v_id : both L I (uint_size)) : both L I (t_eligible_votes) := - Build_t_C_eligible_votes f_v_id := - bind_both f_v_id (fun f_v_id => - solve_lift (ret_both ((f_v_id) : (t_eligible_votes)))) : both L I (t_eligible_votes). -Fail Next Obligation. - Equations n : both (fset []) ([interface ]) (uint_size) := n := solve_lift (ret_both (3 : uint_size)) : both (fset []) ([interface ]) (uint_size). Fail Next Obligation. -Equations v_P : both (fset []) ([interface ]) (nseq t_eligible_votes 3) := - v_P := - array_from_list [solve_lift (Build_t_C_eligible_votes (ret_both (0 : uint_size))); - solve_lift (Build_t_C_eligible_votes (ret_both (1 : uint_size))); - solve_lift (Build_t_C_eligible_votes (ret_both (2 : uint_size)))] : both (fset []) ([interface ]) (nseq t_eligible_votes 3). -Fail Next Obligation. - -Equations select_private_voting_key (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := - select_private_voting_key G random := +Equations select_private_voting_key {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := + select_private_voting_key random := solve_lift (random .% q) : both (L1) (I1) (uint_size). Fail Next Obligation. -Equations v_ZKP (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (xi : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := - v_ZKP G xi := +Equations v_ZKP {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (xi : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := + v_ZKP xi := solve_lift (ret_both (0 : uint_size)) : both (L1) (I1) (uint_size). Fail Next Obligation. Equations get_broadcast1 : both (fset []) ([interface ]) ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))) := get_broadcast1 := - solve_lift (prod_b (new(* _under_impl *) : both fset0 fset0 _,new(* _under_impl *) : both fset0 fset0 _)) : both (fset []) ([interface ]) ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))). + solve_lift (prod_b (new(* _under_impl *):of0:_,new(* _under_impl *):of0:_)) : both (fset []) ([interface ]) ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))). Fail Next Obligation. Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (uint_size)) : both (L1) (I1) ('bool) := @@ -87,31 +69,34 @@ Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 solve_lift (ret_both (true : 'bool)) : both (L1) (I1) ('bool). Fail Next Obligation. -Equations broadcast1 (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (t_group_type)) (zkp : both L2 I2 (uint_size)) (i : both L3 I3 (uint_size)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := - broadcast1 G xi zkp i := +Equations broadcast1 {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (t_group_type)) (zkp : both L2 I2 (uint_size)) (i : both L3 I3 (uint_size)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := + broadcast1 xi zkp i := solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). Fail Next Obligation. Definition prod1_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := (t_group_type ; 0%nat). -Equations register_vote (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (i : both L1 I1 (uint_size)) (random : both L2 I2 (uint_size)) : both (L1:|:L2 :|: fset [prod1_loc]) (I1:|:I2) ('unit) := - register_vote G i random := - letb xi := (select_private_voting_key G random) : both _ _ (uint_size) in - letb _ := (broadcast1 G (g_pow xi) (v_ZKP G xi) i) : both _ _ ('unit) in - letb _ := (ret_both (tt : 'unit)) : both _ _ ('unit) in - letb '(gs,zkps) := (get_broadcast1) : both _ _ ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))) in - letb _ := (foldi_both_list (into_iter zkps) (fun {L I _ _} =>fun zkp => - (ssp (fun _ => - letb _ := (check_valid zkp) in solve_lift ret_both (tt : 'unit)) )) (ret_both (tt : 'unit))) : both _ _ ('unit) in +Equations register_vote {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (i : both L1 I1 (uint_size)) (random : both L2 I2 (uint_size)) : both (L1:|:L2 :|: fset [prod1_loc]) (I1:|:I2) ('unit) := + register_vote i random := + letb xi := select_private_voting_key random :of: uint_size in + letb _ := broadcast1 (g_pow xi) (v_ZKP xi) i :of: 'unit in + letb _ := ret_both (tt : 'unit) :of: 'unit in + letb '(gs,zkps) := get_broadcast1 :of: (t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global)) in + letb _ := foldi_both_list (into_iter zkps) (fun {L I _ _} =>fun zkp => + ssp (fun _ => + letb _ := check_valid zkp :of: 'bool in + solve_lift (ret_both (tt : 'unit)))) (ret_both (tt : 'unit)) :of: 'unit in letbm prod1 loc(prod1_loc) := (one) : both _ _ (t_group_type) in - letb prod1 := (foldi_both (into_iter (Build_t_Range (ret_both (0 : uint_size))(i .- (ret_both (1 : uint_size))))) (fun {L I _ _} =>fun j => - (ssp (fun prod1 => - solve_lift (prod prod1 (g_pow (gs.a[j])))) )) prod1) : both _ _ (t_group_type) in - letb prod2 := (one) : both _ _ (t_group_type) in - letb prod1 := (foldi_both (into_iter (Build_t_Range (i .+ (ret_both (1 : uint_size)))n)) (fun {L I _ _} =>fun j => - (ssp (fun prod1 => - solve_lift (prod prod1 (g_pow (gs.a[j])))) )) prod1) : both _ _ (t_group_type) in - letb Yi := (div prod1 prod2) : both _ _ (t_group_type) in + letb prod1 := foldi_both(* _list *) (into_iter (Build_t_Range (ret_both (0 : uint_size)) (i .- (ret_both (1 : uint_size))))) (fun {L I _ _} =>fun j => + ssp (fun prod1 => + letb prod1 := prod prod1 (g_pow (gs.a[j])) :of: t_group_type in + solve_lift prod1)) prod1 :of: t_group_type in + letb prod2 := one :of: t_group_type in + letb prod1 := foldi_both(* _list *) (into_iter (Build_t_Range (i .+ (ret_both (1 : uint_size))) n)) (fun {L I _ _} =>fun j => + ssp (fun prod1 => + letb prod1 := prod prod1 (g_pow (gs.a[j])) :of: t_group_type in + solve_lift prod1)) prod1 :of: t_group_type in + letb Yi := div prod1 prod2 :of: t_group_type in solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2 :|: fset [prod1_loc]) (I1:|:I2) ('unit). Fail Next Obligation. @@ -120,54 +105,53 @@ Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {I1 : Interface} (vi : bot solve_lift (ret_both (32 : uint_size)) : both (L1) (I1) (uint_size). Fail Next Obligation. -Equations broadcast2 (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (g_pow_xiyi : both L1 I1 (t_group_type)) (g_pow_vi : both L2 I2 (t_group_type)) (g_pow_vi_zkp : both L3 I3 (uint_size)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := - broadcast2 G g_pow_xiyi g_pow_vi g_pow_vi_zkp := +Equations broadcast2 {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (g_pow_xiyi : both L1 I1 (t_group_type)) (g_pow_vi : both L2 I2 (t_group_type)) (g_pow_vi_zkp : both L3 I3 (uint_size)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := + broadcast2 g_pow_xiyi g_pow_vi g_pow_vi_zkp := solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). Fail Next Obligation. -Equations get_broadcast2 (G : _) `{ t_Sized (G)} `{ t_Group (G)} : both (fset []) ([interface ]) ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))) := - get_broadcast2 G := - solve_lift (prod_b (new(* _under_impl *) : both fset0 fset0 _,new(* _under_impl *) : both fset0 fset0 _,new(* _under_impl *) : both fset0 fset0 _)) : both (fset []) ([interface ]) ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))). +Equations get_broadcast2 {G : _} `{ t_Sized (G)} `{ t_Group (G)} : both (fset []) ([interface ]) ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))) := + get_broadcast2 := + solve_lift (prod_b (new(* _under_impl *):of0:_,new(* _under_impl *):of0:_,new(* _under_impl *):of0:_)) : both (fset []) ([interface ]) ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))). Fail Next Obligation. -Equations cast_vote (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (uint_size)) (yi : both L2 I2 (uint_size)) (vi : both L3 I3 ('bool)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := - cast_vote G xi yi vi := - letb _ := (broadcast2 G (g_pow (xi .* yi)) (g_pow (ifb vi +Equations cast_vote {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (uint_size)) (yi : both L2 I2 (uint_size)) (vi : both L3 I3 ('bool)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := + cast_vote xi yi vi := + letb _ := broadcast2 (g_pow (xi .* yi)) (g_pow (ifb vi then ret_both (1 : uint_size) - else ret_both (0 : uint_size))) (v_ZKP_one_out_of_two vi)) : both _ _ ('unit) in - letb _ := (ret_both (tt : 'unit)) : both _ _ ('unit) in + else ret_both (0 : uint_size))) (v_ZKP_one_out_of_two vi) :of: 'unit in + letb _ := ret_both (tt : 'unit) :of: 'unit in solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). Fail Next Obligation. Definition vote_result_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := - (t_group_type ; 3%nat). + (t_group_type ; 2%nat). Definition tally_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := - (uint_size ; 2%nat). -Definition done_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := - ('bool ; 1%nat). - -Definition andb {L1 L2 I1 I2} (x : both L1 I1 'bool) (y : both L2 I2 'bool) : both (L1 :|: L2) (I1 :|: I2) 'bool := lift2_both (fun (x y : 'bool) => Datatypes.andb x y : 'bool) x y. -Definition negb {L1 I1} (x : both L1 I1 'bool) : both (L1) (I1) 'bool := lift1_both (fun (x : 'bool) => Datatypes.negb x : 'bool) x. -Notation "a <> b" := (negb (eqb a b)). -Notation "'not'" := (negb). -Equations tally_votes (G : _) `{ t_Sized (G)} `{ t_Group (G)} : both (fset [done_loc; tally_loc; vote_result_loc]) ([interface ]) (uint_size) := - tally_votes G := - letb '(g_pow_xi_yi,g_pow_vi,zkps) := (get_broadcast2 G) : both _ _ ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))) in - letb _ := (foldi_both_list (into_iter zkps) (fun {L I _ _} =>fun zkp => - (ssp (fun _ => - letb _ := (check_valid zkp) in solve_lift ret_both (tt : 'unit)) )) (ret_both (tt : 'unit))) : both _ _ ('unit) in - letbm vote_result loc(vote_result_loc) := (one) : both _ _ (t_group_type) in - letb vote_result := (foldi_both (into_iter (Build_t_Range (ret_both (0 : uint_size))(vec_len (* len_under_impl_1 *) g_pow_vi))) (fun {L I _ _} =>fun i => - (ssp (fun vote_result => - solve_lift (prod vote_result (prod (clone (g_pow_xi_yi.a[i])) (clone (g_pow_vi.a[i]))))) )) vote_result) : both _ _ (t_group_type) in + (uint_size ; 1%nat). +Equations tally_votes {G : _} `{ t_Sized (G)} `{ t_Group (G)} : both (fset [tally_loc; vote_result_loc]) ([interface ]) (uint_size) := + tally_votes := + letb '(g_pow_xi_yi,g_pow_vi,zkps) := get_broadcast2 :of: (t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global)) in + letb _ := foldi_both_list (into_iter zkps) (fun {L I _ _} =>fun zkp => + ssp (fun _ => + letb _ := check_valid zkp :of: 'bool in + solve_lift (ret_both (tt : 'unit)))) (ret_both (tt : 'unit)) :of: 'unit in + letbm vote_result loc(vote_result_loc) := (one) : both (fset []) (fset []) (t_group_type) in + letb vote_result := foldi_both(* _list *) (into_iter (Build_t_Range (ret_both (0 : uint_size)) (len(* _under_impl_1 *) g_pow_vi))) (fun {L I _ _} =>fun i => + ssp (fun vote_result => + letb vote_result := prod vote_result (prod (clone (g_pow_xi_yi.a[i])) (clone (g_pow_vi.a[i]))) :of: t_group_type in + solve_lift vote_result)) vote_result :of: t_group_type in letbm tally loc(tally_loc) := (ret_both (0 : uint_size)) : both _ _ (uint_size) in - letbm done loc(done_loc) := (ret_both (false : 'bool)) : both _ _ ('bool) in - letb '(done,tally) := (foldi_both (into_iter (Build_t_Range (ret_both (1 : uint_size))n)) (fun {L I _ _} =>fun _ => - (ssp (fun '(done,tally) => - ifb solve_lift (andb ((g_pow tally) <> vote_result) (not done)) - then letb _ := (tally .+ (ret_both (1 : uint_size))) : both _ _ ('unit) in - solve_lift (prod_b (done,ret_both (tt : 'unit))) - else letb done := (ret_both (true : 'bool)) : both _ _ ('bool) in - solve_lift (prod_b (done,tally))) )) (prod_b (done,tally))) : both _ _ (('bool × 'unit)) in - tally : both (fset [done_loc; tally_loc; vote_result_loc]) ([interface ]) (uint_size). + letb tally := foldi_both(* _list *) (into_iter (Build_t_Range (ret_both (1 : uint_size)) n)) (fun {L I _ _} =>fun i => + ssp (fun tally => + solve_lift ifb solve_lift ((g_pow i) =.? vote_result) + then letb tally := i :of: uint_size in + tally + else tally + )) (solve_lift tally : both (fset [tally_loc; vote_result_loc]) [interface] _) :of: uint_size in + solve_lift tally : both (fset [tally_loc; vote_result_loc]) ([interface ]) (uint_size). +Next Obligation. + unfold tally_votes_obligations_obligation_15. + refine (fsubset_trans _ i1). + solve_ssprove_obligations. +Defined. Fail Next Obligation. diff --git a/ovn/src/ovn.rs b/ovn/src/ovn.rs index f73e73d..474f06b 100644 --- a/ovn/src/ovn.rs +++ b/ovn/src/ovn.rs @@ -1,7 +1,218 @@ +/**************************/ +/*** Random Oracle file ***/ +/**************************/ + use hacspec_lib::*; -mod schnorr; -use schnorr::*; +// INIT , QUERY (RO (RandomOracle) OracleParams) +// Definition RO : package RO_locs [interface] RO_exports := +// [package +// #def #[ INIT ] (_ : 'unit) : 'unit +// { +// #put queries_loc := emptym ;; +// ret Datatypes.tt +// } ; +// #def #[ QUERY ] (q : 'query) : 'random +// { +// queries ← get queries_loc ;; +// match queries q with +// | Some r => +// ret r +// | None => +// r ← sample uniform i_random ;; +// #put queries_loc := setm queries q r ;; +// ret r +// end +// } +// ]. + +pub fn random_oracle_init(_ : ()) -> () { + () +} + +// #[derive(PartialEq, Eq, Clone, Copy)] +// pub struct G{ +// pub v : u32 +// } +public_nat_mod!( //Custom Macro - defining a newtype with some functions - well defined macro's have library functions built in + type_name: G, + type_of_canvas: GCanvas, + bit_size_of_field: 384, //381 with 3 extra bits + modulo_value: "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" //0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab +); + +// #[derive(PartialEq, Eq, Clone, Copy, Hash)] +// pub struct Q { +// pub v : u32 +// } +// Order of G +public_nat_mod!( //Custom Macro - defining a newtype with some functions - well defined macro's have library functions built in + type_name: Q, + type_of_canvas: QCanvas, + bit_size_of_field: 384, //381 with 3 extra bits + modulo_value: "2566" // TODO Order of group G! +); + +pub type Witness = Q; +pub type Statement = G; +pub type Message = G; +pub type Challenge = Q; +pub type Response = Q; + +pub type Random = Challenge; // (Statement, Message); +pub type Query = Challenge; + +// pub fn sample_uniform () -> Random { +// uniform_sample +// // (G{v: 1}, G{v: 1})// (Statement::ONE(), Message::ONE()) +// } + +use std::collections::HashMap; + +use std::hash::*; +// use std::hash::{Hash, Hasher}; +impl Hash for Query { + fn hash (&self, state: &mut H) { + + } +} + + +pub type QueriesType = HashMap; +// static ref QUERIES : HashMap = HashMap::new(); +// chQuery := 'fin #|Query| +// chRandom := 'fin #|Random| +pub fn random_oracle_query(mut QUERIES : QueriesType, q : Query, uniform_sample : Random) -> (QueriesType, Random) { + match QUERIES.get(&q) + { + Some (r) => (QUERIES.clone(), r.clone()), + None => { + let r = uniform_sample; + QUERIES.insert(q, r); + (QUERIES, r) + } + } +} + +/********************/ +/*** Schnorr file ***/ +/********************/ + +// use hacspec_lib::*; +// use std::collections::HashMap; + +// pub mod random_oracle; +// use random_oracle::*; +// type Transcript = (Message, Challenge, Response); + +// Sigma1.Sigma.RUN and Sigma1.Sigma.VERIFY: (Schnorr, RO (RandomOracle) OracleParams) +// Definition Fiat_Shamir : +// package Sigma_locs +// [interface +// #val #[ INIT ] : 'unit → 'unit ; +// #val #[ QUERY ] : 'query → 'random +// ] +// [interface +// #val #[ VERIFY ] : chTranscript → 'bool ; +// #val #[ RUN ] : chRelation → chTranscript +// ] +// := +// [package +// #def #[ VERIFY ] (t : chTranscript) : 'bool +// { +// #import {sig #[ QUERY ] : 'query → 'random } as RO_query ;; +// let '(h,a,e,z) := t in +// e ← RO_query (prod_assoc (h, a)) ;; +// ret (otf (Verify h a e z)) +// } ; +// #def #[ RUN ] (hw : chRelation) : chTranscript +// { +// #import {sig #[ INIT ] : 'unit → 'unit } as RO_init ;; +// #import {sig #[ QUERY ] : 'query → 'random } as RO_query ;; +// let '(h,w) := hw in +// #assert (R (otf h) (otf w)) ;; +// a ← Commit h w ;; +// RO_init Datatypes.tt ;; +// e ← RO_query (prod_assoc (h, a)) ;; +// z ← Response h w a e ;; +// @ret choiceTranscript (h,a,e,z) +// } +// ]. + +pub type Transcript = (Statement , Message , Challenge , Response); + +fn prod_assoc (sm : (Statement, Message)) -> // random_oracle:: +Query { + let (statement, message) = sm; + // Proof. + // cbn. intros [statement message]. + // rewrite !card_prod. + // apply mxvec_index. all: assumption. + // Qed. + // random_oracle:: + Q::ONE()// {v: 1} + // random_oracle::Query::ONE() +} + +// Verify_schamir +fn verify (h : Statement, a : Message, e : Challenge, z : Response) -> bool { + // fto (g ^+ (otf z) == (otf a) * (otf h) ^+ (otf e)) + false +} + +pub fn fiat_shamir_verify(t : Transcript, uniform_sample : Random) -> bool { + let QUERIES = HashMap::new(); + let (h,a,e,z) = t; + let (QUERIES, eu) = // random_oracle:: + random_oracle_query (QUERIES, prod_assoc ((h, a)), uniform_sample); + // e <- eu; + // otf ( + verify (h, a, e, z) + // ) +} + +pub type Relation = (Statement, Witness); + +fn Commit (h : Statement, w : Witness, uniform_sample : Random) -> Message { + // r ← sample uniform i_witness ;; + let r = uniform_sample; + // #put commit_loc := r ;; + let mut commit = r; + // ret (fto (g ^+ (otf r))) + // G{v: 1} + G::ONE() + // Message::ONE() +} + + +fn Response (h : Statement, w : Witness, a : Message, e : Challenge) -> Response { + // r ← get commit_loc ;; + // ret (fto (otf r + otf e * otf w)) + Q::ONE()// {v: 1} + // Response::ONE() +} + +pub fn fiat_shamir_run(hw : Relation, uniform_sample_1 : Random, uniform_sample_2 : Random) -> Transcript { + let QUERIES = HashMap::new(); + // #import {sig #[ INIT ] : 'unit → 'unit } as RO_init ;; + // #import {sig #[ QUERY ] : 'query → 'random } as RO_query ;; + let (h,w) = hw; + // #assert (R (otf h) (otf w)) ;; + let a = Commit(h, w, uniform_sample_1); + // random_oracle:: + random_oracle_init(()); + let (QUERIES, eu) = // random_oracle:: + random_oracle_query(QUERIES, prod_assoc((h, a)), uniform_sample_2); + let e = Q::ONE()// {v: 1} + ; // Challenge::ONE(); // Should be e <- eu + let z = Response (h, w, a, e); + (h,a,e,z) +} + +// use hacspec_lib::*; + +// mod schnorr; +// use schnorr::*; // (Exec_i i j m) ∘ (par ((P_i i b) ∘ (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) @@ -45,23 +256,31 @@ use schnorr::*; // } // ]. -type Secret = schnorr::random_oracle::Q; // Zp_finComRingType (Zp_trunc #[g]); -pub fn sample_uniform () -> Secret { - schnorr::random_oracle::Q{v: 1} // Secret::ONE() -} +type Secret = // schnorr::random_oracle:: +Q; // Zp_finComRingType (Zp_trunc #[g]); +// pub fn sample_uniform () -> Secret { +// schnorr::random_oracle::Q{v: 1} // Secret::ONE() +// } -type public = schnorr::random_oracle::G; -type public_key = (public, schnorr::Transcript); // (public, (schnorr::random_oracle::Message , schnorr::random_oracle::Challenge , schnorr::random_oracle::Response)) -fn p_i_init(_: ()) -> public_key { +type public = // schnorr::random_oracle:: +G; +type public_key = (public, // schnorr:: + Transcript); // (public, (schnorr::random_oracle::Message , schnorr::random_oracle::Challenge , schnorr::random_oracle::Response)) +fn p_i_init(_: (), uniform_sample : Secret, uniform_sample_R1 : // schnorr::random_oracle:: + Random, uniform_sample_R2 : // schnorr::random_oracle:: + Random) -> public_key { // #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; // #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; // x ← sample uniform i_secret ;; - let x = sample_uniform(); + let x = uniform_sample; // sample_uniform(); // #put (skey_loc i) := x ;; // let y := (fto (g ^+ (otf x))) : public in - let y = schnorr::random_oracle::G{v: 1}; // public::ONE(); + let y = // schnorr::random_oracle:: + G::ONE() // {v: 1} + ; // public::ONE(); // zkp ← ZKP (y, x) ;; - let zkp = schnorr::fiat_shamir_run((y, x)); + let zkp = // schnorr:: + fiat_shamir_run((y, x), uniform_sample_R1, uniform_sample_R2); (y, zkp) } @@ -80,9 +299,10 @@ public_nat_mod!( //Custom Macro - defining a newtype with some functions - well ); type pid = N; -use std::collections::HashMap; +// use std::collections::HashMap; -type public_keys = HashMap; // TODO +type public_keys = HashMap; // TODO fn p_i_construct(m: public_keys) -> () { // #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; // #assert (size (domm m) == n) ;; @@ -101,7 +321,9 @@ fn p_i_vote(v: bool) -> public { // else // let vote := (otf ckey ^+ skey * g ^+ (negb v)) in // @ret 'public (fto vote) - schnorr::random_oracle::G{v: 1} // public::ONE() + // schnorr::random_oracle:: + G::ONE()// {v: 1} + // public::ONE() } // Exec_i @@ -123,18 +345,23 @@ fn p_i_vote(v: bool) -> public { // } // ] -fn exec(v : bool) -> public { +fn exec(v : bool,uniform_sample : Secret, uniform_sample_R1 : // schnorr::random_oracle:: + Random, uniform_sample_R2 : // schnorr::random_oracle:: + Random) -> public { // #import {sig #[ INIT ] : 'unit → 'public_key} as Init ;; // #import {sig #[ CONSTRUCT ] : 'public_keys → 'unit} as Construct ;; // #import {sig #[ VOTE ] : 'bool → 'public} as Vote ;; // #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; // pk ← Init Datatypes.tt ;; // x ← sample uniform i_secret ;; - let x = sample_uniform(); + let x = uniform_sample; // let y := (fto (g ^+ (otf x))) : public in - let y = schnorr::random_oracle::G{v: 1}; // public::ONE(); + let y = // schnorr::random_oracle:: + G::ONE()// {v: 1} + ; // public::ONE(); // zkp ← ZKP (y, x) ;; - let zkp = schnorr::fiat_shamir_run((y, x)); + let zkp = // schnorr:: + fiat_shamir_run((y, x),uniform_sample_R1,uniform_sample_R2); // let m' := setm (setm m j (y, zkp)) i pk in // Construct m' ;; // vote ← Vote v ;; diff --git a/ovn/src/ovn_old.rs b/ovn/src/ovn_old.rs index d29f4df..f2b5876 100644 --- a/ovn/src/ovn_old.rs +++ b/ovn/src/ovn_old.rs @@ -1,284 +1,147 @@ - -// // use crate::prelude::*; -// use core::convert::TryFrom; -// use core::mem; -// use hacspec_lib::*; - -// pub trait Hasher: Clone { -// type Hash: Copy + PartialEq + Into> + TryFrom>; -// fn hash(data: &[u8]) -> Self::Hash; -// fn concat_and_hash(left: &Self::Hash, right: Option<&Self::Hash>) -> Self::Hash; -// fn hash_size() -> usize; -// } - -// // let mut concatenated: Vec = (*left).into(); - -// // match right { -// // Some(right_node) => { -// // let mut right_node_clone: Vec = (*right_node).into(); -// // concatenated.append(&mut right_node_clone); -// // Self::hash(&concatenated) -// // } -// // None => *left, -// // } - -// type PartialTreeLayer = Vec<(usize, H)>; - -// #[derive(Clone)] -// pub struct PartialTree { -// layers: Vec>, -// } - -// /////////// -// // Utils // -// /////////// -// pub fn is_left_index(index: usize) -> bool { -// index % 2 == 0 -// } - -// pub fn get_sibling_index(index: usize) -> usize { -// if is_left_index(index) { -// // Right sibling index -// index + 1 -// } -// // Left sibling index -// else { -// index - 1 -// } -// } - -// /// Rewritten tree_depth method to no longer make use of floats -// pub fn tree_depth(leaves_count: usize) -> usize { -// let mut height = 0; -// if leaves_count == 1 { -// height = 1; -// } -// else { -// height = usize::ilog2(leaves_count); -// } -// height as usize -// // for i in 1..65usize { -// // if leaves_count <= usize::pow(2, i as u32) { -// // height = i; -// // return height; -// // } -// // } -// // height -// } - -// pub fn parent_index(index: usize) -> usize { -// if is_left_index(index) { -// index / 2 -// } -// else { -// get_sibling_index(index) / 2 -// } -// } - -// pub fn parent_indices(indices: &[usize]) -> Vec { -// let mut parents: Vec = indices.iter().cloned().map(parent_index).collect(); -// parents.dedup(); -// parents -// } - -// /////////// -// // Error // -// /////////// -// #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] -// #[non_exhaustive] -// pub enum ErrorKind { -// /// Serialized to bytes merkle proof can't be parsed because it can not be divided -// SerializedProofSizeIsIncorrect, -// /// Not enough helper nodes to calculate the root was passed to the [`PartialTree`]. -// /// -// /// [`PartialTree`]: crate::PartialTree -// NotEnoughHelperNodes, -// HashConversionError, -// NotEnoughHashesToCalculateRoot, -// LeavesIndicesCountMismatch, -// } - -// #[derive(Clone, Debug)] -// pub struct Error { -// kind: ErrorKind, -// } - -// impl Error { -// pub fn new(kind: ErrorKind) -> Self { -// Self { kind } -// } - -// pub fn not_enough_helper_nodes() -> Self { -// Self::new( -// ErrorKind::NotEnoughHelperNodes -// ) -// } -// } - -// impl PartialTree { -// /// Takes leaves (item hashes) as an argument and build a Merkle Tree from them. -// /// Since it's a partial tree, hashes must be accompanied by their index in the original tree. -// pub fn new() -> Self { -// Self { layers: Vec::new() } -// } - -// /// This is a general algorithm for building a partial tree. It can be used to extract root -// /// from merkle proof, or if a complete set of leaves provided as a first argument and no -// /// helper indices given, will construct the whole tree. -// fn build_tree( -// mut partial_layers: Vec>, -// full_tree_depth: usize, -// ) -> Result>, Error> { -// let mut partial_tree: Vec> = Vec::new(); -// let mut current_layer = Vec::new(); - -// // Reversing helper nodes, so we can remove one layer starting from 0 each iteration -// let mut reversed_layers: Vec> = -// partial_layers.drain(..).rev().collect(); - -// // This iterates to full_tree_depth and not to the partial_layers_len because -// // when constructing - -// // It is iterating to full_tree_depth instead of partial_layers.len to address the case -// // of applying changes to a tree when tree requires a resize, and partial layer len -// // in that case going to be lower that the resulting tree depth -// for _ in 0..full_tree_depth { -// // Appending helper nodes to the current known nodes -// if let Some(mut nodes) = reversed_layers.pop() { -// current_layer.append(&mut nodes); -// } -// // current_layer.into_iter().is_sorted_by(|(a, _), (b, _)| a.cmp(b)) -// // current_layer.sort_by(|(a, _), (b, _)| a.cmp(b)); -// // TODO: SORT current_layer without using mutation! - -// // Adding partial layer to the tree -// partial_tree.push(current_layer.clone()); - -// // This empties `current` layer and prepares it to be reused for the next iteration -// let (indices, nodes): (Vec, Vec) = current_layer.drain(..).unzip(); -// let parent_layer_indices = parent_indices(&indices); - -// for (i, parent_node_index) in parent_layer_indices.iter().enumerate() { -// match nodes.get(i * 2) { -// // Populate `current_layer` back for the next iteration -// Some(left_node) => current_layer.push(( -// *parent_node_index, -// T::concat_and_hash(left_node, nodes.get(i * 2 + 1)), -// )), -// None => return Err(Error::not_enough_helper_nodes()), -// } -// } +use hacspec_lib::*; + +mod schnorr; +use schnorr::*; + +// (Exec_i i j m) ∘ (par ((P_i i b) ∘ (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) + +// Init, construct, vote: +// +// Definition P_i (i : pid) (b : bool): +// package (P_i_locs i) +// Sigma1_I +// P_i_E := +// [package +// #def #[ INIT ] (_ : 'unit) : 'public_key +// { +// #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; +// #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; +// x ← sample uniform i_secret ;; +// #put (skey_loc i) := x ;; +// let y := (fto (g ^+ (otf x))) : public in +// zkp ← ZKP (y, x) ;; +// ret (y, zkp) // } - -// partial_tree.push(current_layer.clone()); - -// Ok(partial_tree) -// } - -// pub fn build(partial_layers: Vec>, depth: usize) -> Result { -// let layers = Self::build_tree(partial_layers, depth)?; -// Ok(Self { layers }) -// } - -// /// This is a helper function to build a full tree from a full set of leaves without any -// /// helper indices -// pub fn from_leaves(leaves: &[T::Hash]) -> Result { -// let leaf_tuples: Vec<(usize, T::Hash)> = leaves.iter().cloned().enumerate().collect(); - -// Self::build(vec![leaf_tuples], tree_depth(leaves.len())) -// } - -// /// Returns how many layers there is between leaves and the root -// pub fn depth(&self) -> usize { -// self.layers.len() - 1 -// } - -// // /// Return the root of the tree -// // pub fn root(&self) -> Option<&T::Hash> { -// // Some(&self.layers.last()?.first()?.1) -// // } - -// pub fn contains(&self, layer_index: usize, node_index: usize) -> bool { -// match self.layers().get(layer_index) { -// Some(layer) => -// {let mut temp = layer.clone().into_iter(); -// temp.any(|(index, _)| index == node_index)} -// None => false, +// ; +// #def #[ CONSTRUCT ] (m : 'public_keys) : 'unit +// { +// #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; +// #assert (size (domm m) == n) ;; +// let key := fto (compute_key m i) in +// #put (ckey_loc i) := key ;; +// @ret 'unit Datatypes.tt // } -// } - -// // /// Consumes other partial tree into itself, replacing any conflicting nodes with nodes from -// // /// `other` in the process. Doesn't rehash the nodes, so the integrity of the result is -// // /// not verified. It gives an advantage in speed, but should be used only if the integrity of -// // /// the tree can't be broken, for example, it is used in the `.commit` method of the -// // /// `MerkleTree`, since both partial trees are essentially constructed in place and there's -// // /// no need to verify integrity of the result. -// // pub fn merge_unverified(mut self, other: Self) { -// // // Figure out new tree depth after merge -// // let depth_difference = other.layers().len() - self.layers().len(); -// // let combined_tree_size = if depth_difference > 0 { -// // other.layers().len() -// // } else { -// // self.layers().len() -// // }; - -// // for layer_index in 0..combined_tree_size { -// // let mut combined_layer: Vec<(usize, T::Hash)> = Vec::new(); - -// // if let Some(self_layer) = self.layers().get(layer_index) { -// // let mut filtered_layer: Vec<(usize, T::Hash)> = self_layer -// // .iter() -// // .filter(|(node_index, _)| !other.contains(layer_index, *node_index)) -// // .cloned() -// // .collect(); - -// // combined_layer.append(&mut filtered_layer); -// // } - -// // if let Some(other_layer) = other.layers().get(layer_index) { -// // let mut cloned_other_layer = other_layer.clone(); -// // combined_layer.append(&mut cloned_other_layer); -// // } - -// // // combined_layer.sort_by(|(a, _), (b, _)| a.cmp(b)); -// // // TODO: SORT combined_layer without using mutation! -// // self.upsert_layer(layer_index, combined_layer); -// // } -// // } - -// /// Replace layer at a given index with a new layer. Used during tree merge -// fn upsert_layer(// & -// mut self, layer_index: usize, mut new_layer: Vec<(usize, T::Hash)>) { -// match self.layers.get(layer_index) { -// Some(layer) => { -// // layer.clear(); -// // layer.append(new_layer.as_mut()) -// // TODO: Update layer without mutation! -// } -// None => { // self.layers.push(new_layer) -// } +// ; +// #def #[ VOTE ] (v : 'bool) : 'public +// { +// skey ← get (skey_loc i) ;; +// ckey ← get (ckey_loc i) ;; +// if b then +// let vote := (otf ckey ^+ skey * g ^+ v) in +// @ret 'public (fto vote) +// else +// let vote := (otf ckey ^+ skey * g ^+ (negb v)) in +// @ret 'public (fto vote) // } -// } +// ]. -// pub fn layer_nodes(&self) -> Vec> { -// let hashes: Vec> = self -// .layers() -// .iter() -// .map(|layer| layer.iter().cloned().map(|(_, hash)| hash).collect()) -// .collect(); - -// hashes -// } - -// /// Returns partial tree layers -// pub fn layers(&self) -> &[Vec<(usize, T::Hash)>] { -// &self.layers -// } - -// /// Clears all elements in the ree -// pub fn clear(// & -// mut self) { -// // self.layers.clear(); -// // TODO: update layer without reference mutation -// } +type Secret = schnorr::random_oracle::Q; // Zp_finComRingType (Zp_trunc #[g]); +// pub fn sample_uniform () -> Secret { +// schnorr::random_oracle::Q{v: 1} // Secret::ONE() // } + +type public = schnorr::random_oracle::G; +type public_key = (public, schnorr::Transcript); // (public, (schnorr::random_oracle::Message , schnorr::random_oracle::Challenge , schnorr::random_oracle::Response)) +fn p_i_init(_: (), uniform_sample : Secret, uniform_sample_R1 : schnorr::random_oracle::Random, uniform_sample_R2 : schnorr::random_oracle::Random) -> public_key { + // #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; + // #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; + // x ← sample uniform i_secret ;; + let x = uniform_sample; // sample_uniform(); + // #put (skey_loc i) := x ;; + // let y := (fto (g ^+ (otf x))) : public in + let y = schnorr::random_oracle::G::ONE() // {v: 1} + ; // public::ONE(); + // zkp ← ZKP (y, x) ;; + let zkp = schnorr::fiat_shamir_run((y, x), uniform_sample_R1, uniform_sample_R2); + (y, zkp) +} + +// fn compute_key (m : chMap pid (chProd public choiceTranscript1), i : pid) { +// let low := \prod_(k <- domm m | (k < i)%ord) (get_value m k); +// let high := \prod_(k <- domm m | (i < k)%ord) (get_value m k); +// low * invg high +// } + +// Order of G +public_nat_mod!( //Custom Macro - defining a newtype with some functions - well defined macro's have library functions built in + type_name: N, + type_of_canvas: NCanvas, + bit_size_of_field: 384, //381 with 3 extra bits + modulo_value: "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" //0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab +); + +type pid = N; +use std::collections::HashMap; + +type public_keys = HashMap; // TODO +fn p_i_construct(m: public_keys) -> () { + // #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; + // #assert (size (domm m) == n) ;; + // let key := fto (compute_key m i) in + // #put (ckey_loc i) := key ;; + // @ret 'unit Datatypes.tt + () +} + +fn p_i_vote(v: bool) -> public { + // skey ← get (skey_loc i) ;; + // ckey ← get (ckey_loc i) ;; + // if b then + // let vote := (otf ckey ^+ skey * g ^+ v) in + // @ret 'public (fto vote) + // else + // let vote := (otf ckey ^+ skey * g ^+ (negb v)) in + // @ret 'public (fto vote) + schnorr::random_oracle::G::ONE()// {v: 1} + // public::ONE() +} + +// Exec_i +// [package +// #def #[ Exec i ] (v : 'bool) : 'public +// { +// #import {sig #[ INIT ] : 'unit → 'public_key} as Init ;; +// #import {sig #[ CONSTRUCT ] : 'public_keys → 'unit} as Construct ;; +// #import {sig #[ VOTE ] : 'bool → 'public} as Vote ;; +// #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; +// pk ← Init Datatypes.tt ;; +// x ← sample uniform i_secret ;; +// let y := (fto (g ^+ (otf x))) : public in +// zkp ← ZKP (y, x) ;; +// let m' := setm (setm m j (y, zkp)) i pk in +// Construct m' ;; +// vote ← Vote v ;; +// @ret 'public vote +// } +// ] + +fn exec(v : bool,uniform_sample : Secret, uniform_sample_R1 : schnorr::random_oracle::Random, uniform_sample_R2 : schnorr::random_oracle::Random) -> public { + // #import {sig #[ INIT ] : 'unit → 'public_key} as Init ;; + // #import {sig #[ CONSTRUCT ] : 'public_keys → 'unit} as Construct ;; + // #import {sig #[ VOTE ] : 'bool → 'public} as Vote ;; + // #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; + // pk ← Init Datatypes.tt ;; + // x ← sample uniform i_secret ;; + let x = uniform_sample; + // let y := (fto (g ^+ (otf x))) : public in + let y = schnorr::random_oracle::G::ONE()// {v: 1} + ; // public::ONE(); + // zkp ← ZKP (y, x) ;; + let zkp = schnorr::fiat_shamir_run((y, x),uniform_sample_R1,uniform_sample_R2); + // let m' := setm (setm m j (y, zkp)) i pk in + // Construct m' ;; + // vote ← Vote v ;; + let vote = p_i_vote (v); + // @ret 'public vote + vote +} diff --git a/ovn/src/ovn_template.rs b/ovn/src/ovn_template.rs index 09ea52b..334dd09 100644 --- a/ovn/src/ovn_template.rs +++ b/ovn/src/ovn_template.rs @@ -2,7 +2,7 @@ use core::*; use hacspec_lib::*; pub trait Group { - type group_type : PartialEq + Clone + Copy; + type group_type : PartialEq + Eq + Clone + Copy; const q : usize; // Prime order const g : Self::group_type; // Generator (elemnent of group) @@ -14,15 +14,15 @@ pub trait Group { fn random_element() -> Self::group_type; } -struct eligible_votes { - v_id : usize, -} +// struct eligible_votes { +// v_id : usize, +// } const n : usize = 3; -const P : [eligible_votes; 3] = // n = 3 - [eligible_votes {v_id: 0}, - eligible_votes {v_id: 1}, - eligible_votes {v_id: 2}]; +// const P : [eligible_votes; 3] = // n = 3 +// [eligible_votes {v_id: 0}, +// eligible_votes {v_id: 1}, +// eligible_votes {v_id: 2}]; pub fn select_private_voting_key (random : usize) -> usize { random % G::q // x_i \in_R Z_q; @@ -43,7 +43,7 @@ pub fn check_valid(zkp : usize) -> bool { } pub fn broadcast1(xi : G::group_type, zkp : usize, i : usize) { - + () } pub fn register_vote(i : usize, random : usize) { @@ -53,18 +53,22 @@ pub fn register_vote(i : usize, random : usize) { for zkp in zkps { check_valid(zkp); + () } let mut prod1 = G::one(); for j in 0..i-1 { prod1 = G::prod(prod1, G::g_pow(gs[j])); + () } let prod2 = G::one(); for j in i+1..n { prod1 = G::prod(prod1, G::g_pow(gs[j])); + () } let Yi = G::div(prod1, prod2); // implicityly: Y_i = g^y_i + () } // Meta Round: @@ -81,7 +85,7 @@ pub fn ZKP_one_out_of_two(vi : bool) -> usize { } pub fn broadcast2 (g_pow_xiyi : G::group_type, g_pow_vi : G::group_type, g_pow_vi_zkp : usize) { - + () } pub fn get_broadcast2 () -> (Vec,Vec,Vec) { @@ -90,6 +94,7 @@ pub fn get_broadcast2 () -> (Vec,Vec,Ve pub fn cast_vote(xi : usize, yi : usize, vi : bool) { broadcast2::(G::g_pow(xi * yi), G::g_pow(if vi { 1 } else { 0 }), ZKP_one_out_of_two(vi)); + () } // Meta Round: @@ -104,21 +109,19 @@ pub fn tally_votes() -> usize { let (g_pow_xi_yi, g_pow_vi, zkps) = get_broadcast2::(); for zkp in zkps { check_valid(zkp); + () } let mut vote_result = G::one(); for i in 0..g_pow_vi.len() { vote_result = G::prod(vote_result, G::prod(g_pow_xi_yi[i].clone(), g_pow_vi[i].clone())); + () } let mut tally = 0; - let mut done = false; - for _ in 1..n { // Should be while, but is bounded by n anyways! - if G::g_pow(tally) != vote_result && !done { - tally += 1 - } - else { - done = true; + for i in 1..n { // Should be while, but is bounded by n anyways! + if G::g_pow(i) == vote_result { + tally = i; } } tally diff --git a/ovn/src/schnorr.rs b/ovn/src/schnorr.rs index 95dc63c..954a9ee 100644 --- a/ovn/src/schnorr.rs +++ b/ovn/src/schnorr.rs @@ -57,10 +57,10 @@ fn verify (h : Statement, a : Message, e : Challenge, z : Response) -> bool { false } -pub fn fiat_shamir_verify(t : Transcript) -> bool { +pub fn fiat_shamir_verify(t : Transcript, uniform_sample : Random) -> bool { let QUERIES = HashMap::new(); let (h,a,e,z) = t; - let (QUERIES, eu) = random_oracle::random_oracle_query (QUERIES, prod_assoc ((h, a))); + let (QUERIES, eu) = random_oracle::random_oracle_query (QUERIES, prod_assoc ((h, a)), uniform_sample); // e <- eu; // otf ( verify (h, a, e, z) @@ -69,13 +69,15 @@ pub fn fiat_shamir_verify(t : Transcript) -> bool { pub type Relation = (Statement, Witness); -fn Commit (h : Statement, w : Witness) -> Message { +fn Commit (h : Statement, w : Witness, uniform_sample : Random) -> Message { // r ← sample uniform i_witness ;; - let r = random_oracle::sample_uniform(); + let r = uniform_sample; // #put commit_loc := r ;; let mut commit = r; // ret (fto (g ^+ (otf r))) - G{v: 1} // Message::ONE() + // G{v: 1} + G::ONE() + // Message::ONE() } @@ -85,15 +87,15 @@ fn Response (h : Statement, w : Witness, a : Message, e : Challenge) -> Response Q{v: 1} // Response::ONE() } -pub fn fiat_shamir_run(hw : Relation) -> Transcript { +pub fn fiat_shamir_run(hw : Relation, uniform_sample_1 : Random, uniform_sample_2 : Random) -> Transcript { let QUERIES = HashMap::new(); // #import {sig #[ INIT ] : 'unit → 'unit } as RO_init ;; // #import {sig #[ QUERY ] : 'query → 'random } as RO_query ;; let (h,w) = hw; // #assert (R (otf h) (otf w)) ;; - let a = Commit(h, w); + let a = Commit(h, w, uniform_sample_1); random_oracle::random_oracle_init(()); - let (QUERIES, eu) = random_oracle::random_oracle_query(QUERIES, prod_assoc((h, a))); + let (QUERIES, eu) = random_oracle::random_oracle_query(QUERIES, prod_assoc((h, a)), uniform_sample_2); let e = Q{v: 1}; // Challenge::ONE(); // Should be e <- eu let z = Response (h, w, a, e); (h,a,e,z) diff --git a/ovn/src/schnorr/random_oracle.rs b/ovn/src/schnorr/random_oracle.rs index 2152200..c3286f0 100644 --- a/ovn/src/schnorr/random_oracle.rs +++ b/ovn/src/schnorr/random_oracle.rs @@ -26,16 +26,16 @@ pub fn random_oracle_init(_ : ()) -> () { () } -#[derive(PartialEq, Eq, Clone, Copy)] -pub struct G{ - pub v : u32 -} -// public_nat_mod!( //Custom Macro - defining a newtype with some functions - well defined macro's have library functions built in -// type_name: G, -// type_of_canvas: GCanvas, -// bit_size_of_field: 384, //381 with 3 extra bits -// modulo_value: "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" //0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab -// ); +// #[derive(PartialEq, Eq, Clone, Copy)] +// pub struct G{ +// pub v : u32 +// } +public_nat_mod!( //Custom Macro - defining a newtype with some functions - well defined macro's have library functions built in + type_name: G, + type_of_canvas: GCanvas, + bit_size_of_field: 384, //381 with 3 extra bits + modulo_value: "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" //0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab +); #[derive(PartialEq, Eq, Clone, Copy, Hash)] pub struct Q { @@ -55,12 +55,13 @@ pub type Message = G; pub type Challenge = Q; pub type Response = Q; -pub type Random = (Statement, Message); +pub type Random = Challenge; // (Statement, Message); pub type Query = Challenge; -pub fn sample_uniform () -> Random { - (G{v: 1}, G{v: 1})// (Statement::ONE(), Message::ONE()) -} +// pub fn sample_uniform () -> Random { +// uniform_sample +// // (G{v: 1}, G{v: 1})// (Statement::ONE(), Message::ONE()) +// } use std::collections::HashMap; @@ -75,11 +76,11 @@ pub type QueriesType = HashMap; // static ref QUERIES : HashMap = HashMap::new(); // chQuery := 'fin #|Query| // chRandom := 'fin #|Random| -pub fn random_oracle_query(mut QUERIES : QueriesType, q : Query) -> (QueriesType, Random) { +pub fn random_oracle_query(mut QUERIES : QueriesType, q : Query, uniform_sample : Random) -> (QueriesType, Random) { match QUERIES.get(&q) { Some (r) => (QUERIES.clone(), r.clone()), None => { - let r = sample_uniform(); + let r = uniform_sample; QUERIES.insert(q, r); (QUERIES, r) } From 1a3ce94697fc667e929dd7bada36963b360eb49e Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Mon, 21 Aug 2023 16:45:17 +0200 Subject: [PATCH 10/86] Update --- ovn/proofs/ssprove/extraction/.Core.aux | 2 - .../ssprove/extraction/.Hacspec_lib.aux | 5 -- .../ssprove/extraction/.Hacspec_ovn.aux | 2 - .../extraction/.Hacspec_ovn_Schnorr.aux | 2 - .../.Hacspec_ovn_Schnorr_Random_oracle.aux | 2 - ovn/proofs/ssprove/extraction/.HashMap.aux | 2 - ovn/proofs/ssprove/extraction/.Std.aux | 2 - ovn/proofs/ssprove/extraction/Makefile.conf | 63 ------------------- 8 files changed, 80 deletions(-) delete mode 100644 ovn/proofs/ssprove/extraction/.Core.aux delete mode 100644 ovn/proofs/ssprove/extraction/.Hacspec_lib.aux delete mode 100644 ovn/proofs/ssprove/extraction/.Hacspec_ovn.aux delete mode 100644 ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr.aux delete mode 100644 ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr_Random_oracle.aux delete mode 100644 ovn/proofs/ssprove/extraction/.HashMap.aux delete mode 100644 ovn/proofs/ssprove/extraction/.Std.aux delete mode 100644 ovn/proofs/ssprove/extraction/Makefile.conf diff --git a/ovn/proofs/ssprove/extraction/.Core.aux b/ovn/proofs/ssprove/extraction/.Core.aux deleted file mode 100644 index d48f156..0000000 --- a/ovn/proofs/ssprove/extraction/.Core.aux +++ /dev/null @@ -1,2 +0,0 @@ -COQAUX1 6790c792e32a6045be2322b9eaf2b504 /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Core.v -0 0 vo_compile_time "2.665" diff --git a/ovn/proofs/ssprove/extraction/.Hacspec_lib.aux b/ovn/proofs/ssprove/extraction/.Hacspec_lib.aux deleted file mode 100644 index 83ff308..0000000 --- a/ovn/proofs/ssprove/extraction/.Hacspec_lib.aux +++ /dev/null @@ -1,5 +0,0 @@ -COQAUX1 014d8494ee07a77b223cddd03655e2fd /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Hacspec_lib.v -0 0 VernacProof "tac:no using:no" -13228 13236 proof_build_time "0.009" -13228 13236 proof_check_time "0.007" -0 0 vo_compile_time "1.055" diff --git a/ovn/proofs/ssprove/extraction/.Hacspec_ovn.aux b/ovn/proofs/ssprove/extraction/.Hacspec_ovn.aux deleted file mode 100644 index fe3ef67..0000000 --- a/ovn/proofs/ssprove/extraction/.Hacspec_ovn.aux +++ /dev/null @@ -1,2 +0,0 @@ -COQAUX1 2ab43b20a7808931e6961c7e28a31d30 /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Hacspec_ovn.v -0 0 vo_compile_time "3.152" diff --git a/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr.aux b/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr.aux deleted file mode 100644 index 1c755c6..0000000 --- a/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr.aux +++ /dev/null @@ -1,2 +0,0 @@ -COQAUX1 dfcdbe07a610db85932ecc770fb2795b /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v -0 0 vo_compile_time "10.855" diff --git a/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr_Random_oracle.aux b/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr_Random_oracle.aux deleted file mode 100644 index 3b04bf0..0000000 --- a/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Schnorr_Random_oracle.aux +++ /dev/null @@ -1,2 +0,0 @@ -COQAUX1 2e797f525541438f76d209d0776dcf2f /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v -0 0 vo_compile_time "10.662" diff --git a/ovn/proofs/ssprove/extraction/.HashMap.aux b/ovn/proofs/ssprove/extraction/.HashMap.aux deleted file mode 100644 index 3cd16d8..0000000 --- a/ovn/proofs/ssprove/extraction/.HashMap.aux +++ /dev/null @@ -1,2 +0,0 @@ -COQAUX1 6f52e059b6e6f53cab8150523c26e076 /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/HashMap.v -0 0 vo_compile_time "0.910" diff --git a/ovn/proofs/ssprove/extraction/.Std.aux b/ovn/proofs/ssprove/extraction/.Std.aux deleted file mode 100644 index 02307f5..0000000 --- a/ovn/proofs/ssprove/extraction/.Std.aux +++ /dev/null @@ -1,2 +0,0 @@ -COQAUX1 da4b43ceb41a55c830a2111ff36e5a15 /home/au538501/Documents/LocalHacspec/specs/ovn/proofs/ssprove/extraction/Std.v -0 0 vo_compile_time "1.029" diff --git a/ovn/proofs/ssprove/extraction/Makefile.conf b/ovn/proofs/ssprove/extraction/Makefile.conf deleted file mode 100644 index d8d1fdb..0000000 --- a/ovn/proofs/ssprove/extraction/Makefile.conf +++ /dev/null @@ -1,63 +0,0 @@ -# This configuration file was generated by running: -# coq_makefile -f _CoqProject -o Makefile - - -############################################################################### -# # -# Project files. # -# # -############################################################################### - -COQMF_VFILES = Hacspec_lib.v Core.v HashMap.v Hacspec_ovn_Schnorr_Random_oracle.v Hacspec_ovn_Schnorr.v Hacspec_ovn.v -COQMF_MLIFILES = -COQMF_MLFILES = -COQMF_MLGFILES = -COQMF_MLPACKFILES = -COQMF_MLLIBFILES = -COQMF_CMDLINE_VFILES = - -############################################################################### -# # -# Path directives (-I, -R, -Q). # -# # -############################################################################### - -COQMF_OCAMLLIBS = -COQMF_SRC_SUBDIRS = -COQMF_COQLIBS = -R . Examples -COQMF_COQLIBS_NOML = -R . Examples -COQMF_CMDLINE_COQLIBS = - -############################################################################### -# # -# Coq configuration. # -# # -############################################################################### - -COQMF_COQLIB=/home/au538501/.opam/hacspec_ssprove/lib/coq/ -COQMF_COQCORELIB=/home/au538501/.opam/hacspec_ssprove/lib/coq/../coq-core/ -COQMF_DOCDIR=/home/au538501/.opam/hacspec_ssprove/doc/coq/ -COQMF_OCAMLFIND=/home/au538501/.opam/hacspec_ssprove/bin/ocamlfind -COQMF_CAMLFLAGS=-thread -rectypes -w -a+1..3-4+5..8-9+10..26-27+28..40-41-42+43-44-45+46..47-48+49..57-58+59..66-67-68+69-70 -safe-string -strict-sequence -COQMF_WARN=-warn-error +a-3 -COQMF_HASNATDYNLINK=true -COQMF_COQ_SRC_SUBDIRS=boot config lib clib kernel library engine pretyping interp gramlib parsing proofs tactics toplevel printing ide stm vernac plugins/btauto plugins/cc plugins/derive plugins/extraction plugins/firstorder plugins/funind plugins/ltac plugins/ltac2 plugins/micromega plugins/nsatz plugins/ring plugins/rtauto plugins/ssr plugins/ssrmatching plugins/syntax -COQMF_COQ_NATIVE_COMPILER_DEFAULT=no -COQMF_WINDRIVE= - -############################################################################### -# # -# Native compiler. # -# # -############################################################################### - -COQMF_COQPROJECTNATIVEFLAG = - -############################################################################### -# # -# Extra variables. # -# # -############################################################################### - -COQMF_OTHERFLAGS = '-w' 'all' -COQMF_INSTALLCOQDOCROOT = Examples From b8d4495247f8e76e2cd16a353f18a1c5719ef894 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Mon, 21 Aug 2023 17:24:31 +0200 Subject: [PATCH 11/86] Cleanup --- .../Hacspec_ovn.Schnorr.Random_oracle.fst | 3740 ----------------- .../fstar/extraction/Hacspec_ovn.Schnorr.fst | 3704 ---------------- ovn/proofs/fstar/extraction/Hacspec_ovn.fst | 9 - ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 21 +- ovn/src/ovn_template.rs | 15 +- 5 files changed, 14 insertions(+), 7475 deletions(-) delete mode 100644 ovn/proofs/fstar/extraction/Hacspec_ovn.Schnorr.Random_oracle.fst delete mode 100644 ovn/proofs/fstar/extraction/Hacspec_ovn.Schnorr.fst delete mode 100644 ovn/proofs/fstar/extraction/Hacspec_ovn.fst diff --git a/ovn/proofs/fstar/extraction/Hacspec_ovn.Schnorr.Random_oracle.fst b/ovn/proofs/fstar/extraction/Hacspec_ovn.Schnorr.Random_oracle.fst deleted file mode 100644 index dc01cd2..0000000 --- a/ovn/proofs/fstar/extraction/Hacspec_ovn.Schnorr.Random_oracle.fst +++ /dev/null @@ -1,3740 +0,0 @@ -module Hacspec_ovn.Schnorr.Random_oracle -#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" -open Core - -let random_oracle_init (_: Prims.unit) : Prims.unit = () - -type t_QueryCanvas = { - f_b:array u8 48sz; - f_sign:Num_bigint.Bigint.t_Sign; - f_signed:bool -} - -let max_under_impl_16: Core.Ops.Arith.Sub.t_Output = - ((Core.Convert.From.from 1ul <: Num_bigint.Bigint.t_BigInt) >>. 384l <: Core.Ops.Bit.Shl.t_Output) -. - (Num_traits.Identities.One.one <: Num_bigint.Bigint.t_BigInt) - -let max_value_under_impl_16: t_QueryCanvas = - Core.Convert.From.from (max_under_impl_16 <: Num_bigint.Bigint.t_BigInt) - -let hex_string_to_bytes_under_impl_16 (s: string) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = - let s:Alloc.String.t_String = - if ((Core.Str.len_under_impl s <: usize) %. 2sz <: usize) <>. 0sz - then - let x:Alloc.String.t_String = Alloc.String.ToString.to_string "0" in - let x:Alloc.String.t_String = Alloc.String.push_str_under_impl x s in - x - else Alloc.String.ToString.to_string s - in - let _:Prims.unit = - if ~.(((Alloc.String.len_under_impl s <: usize) %. 2sz <: usize) =. 0sz <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["length of hex string "; ": "] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [ - Core.Fmt.Rt.new_display_under_impl_1 s <: Core.Fmt.Rt.t_Argument; - Core.Fmt.Rt.new_display_under_impl_1 (Alloc.String.len_under_impl s - <: - usize) - <: - Core.Fmt.Rt.t_Argument - ] - in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let - (b: Core.Result.t_Result (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) Core.Num.Error.t_ParseIntError):Core.Result.t_Result - (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) Core.Num.Error.t_ParseIntError = - Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map (Core.Iter.Traits.Iterator.Iterator.step_by - ({ - Core.Ops.Range.Range.f_start = 0sz; - Core.Ops.Range.Range.f_end = Alloc.String.len_under_impl s <: usize - }) - 2sz - <: - Core.Iter.Adapters.Step_by.t_StepBy (Core.Ops.Range.t_Range usize)) - (fun i -> - Core.Num.from_str_radix_under_impl_6 (s.[ { - Core.Ops.Range.Range.f_start = i; - Core.Ops.Range.Range.f_end = i +. 2sz <: usize - } ] - <: - string) - 16ul - <: - Core.Result.t_Result u8 Core.Num.Error.t_ParseIntError) - <: - Core.Iter.Adapters.Map.t_Map - (Core.Iter.Adapters.Step_by.t_StepBy (Core.Ops.Range.t_Range usize)) - (usize -> Core.Result.t_Result u8 Core.Num.Error.t_ParseIntError)) - in - Core.Result.expect_under_impl b "Error parsing hex string" - -let from_literal_under_impl_16 (x: u128) : t_QueryCanvas = - let big_x:Num_bigint.Bigint.t_BigInt = Core.Convert.From.from x in - let _:Prims.unit = - if - big_x >. - (Core.Convert.Into.into (max_under_impl_16 <: Num_bigint.Bigint.t_BigInt) - <: - Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["literal "; " too big for type QueryCanvas"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Core.Convert.Into.into big_x - -let from_signed_literal_under_impl_16 (x: i128) : t_QueryCanvas = - let big_x:Num_bigint.Bigint.t_BigInt = Core.Convert.From.from (cast x) in - let _:Prims.unit = - if - big_x >. - (Core.Convert.Into.into (max_under_impl_16 <: Num_bigint.Bigint.t_BigInt) - <: - Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["literal "; " too big for type QueryCanvas"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Core.Convert.Into.into big_x - -let pow2_under_impl_16 (x: usize) : t_QueryCanvas = - Core.Convert.Into.into ((Core.Convert.From.from 1ul <: Num_bigint.Bigint.t_BigInt) >>. x - <: - Core.Ops.Bit.Shl.t_Output) - -let bit_under_impl_16 (self: t_QueryCanvas) (i: usize) : bool = - let _:Prims.unit = - if - ~.(i <. - ((Core.Slice.len_under_impl (Rust_primitives.unsize self - .Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_b - <: - slice u8) - <: - usize) *. - 8sz - <: - usize) - <: - bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = - [ - "the bit queried should be lower than the size of the integer representation: "; - " < " - ] - in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [ - Core.Fmt.Rt.new_display_under_impl_1 i <: Core.Fmt.Rt.t_Argument; - Core.Fmt.Rt.new_display_under_impl_1 ((Core.Slice.len_under_impl (Rust_primitives.unsize - self.Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_b - <: - slice u8) - <: - usize) *. - 8sz - <: - usize) - <: - Core.Fmt.Rt.t_Argument - ] - in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let (bigint: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (tmp: Num_bigint.Bigint.t_BigInt):Core.Ops.Bit.Shr.t_Output = bigint <<. i in - ((Num_bigint.Bigint.to_bytes_le_under_impl_24 (tmp &. - (Num_traits.Identities.One.one <: Num_bigint.Bigint.t_BigInt) - <: - Num_bigint.Bigint.t_BigInt) - <: - (Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global)) - ._2.[ 0sz ] - <: - u8) =. - 1uy - -let impl: Core.Convert.t_From t_QueryCanvas Num_bigint.Biguint.t_BigUint = - { - from - = - fun (x: Num_bigint.Biguint.t_BigUint) -> - Core.Convert.From.from (Core.Convert.From.from x <: Num_bigint.Bigint.t_BigInt) - } - -let impl: Core.Convert.t_From t_QueryCanvas Num_bigint.Bigint.t_BigInt = - { - from - = - fun (x: Num_bigint.Bigint.t_BigInt) -> - let max_value:Num_bigint.Bigint.t_BigInt = max_under_impl_16 in - let _:Prims.unit = - if ~.(x <=. max_value <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = - [""; " is too large for type QueryCanvas!"] - in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let sign, repr:(Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) = - Num_bigint.Bigint.to_bytes_be_under_impl_24 x - in - let _:Prims.unit = - if Prims.op_AmpAmp (sign =. Num_bigint.Bigint.Sign_Minus) ~.false - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "Trying to convert a negative number into an unsigned integer!" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - let _:Prims.unit = - if (Alloc.Vec.len_under_impl_1 repr <: usize) >. ((384sz +. 7sz <: usize) /. 8sz <: usize) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = [""; " is too large for type QueryCanvas"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let out:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in - let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize out <: slice u8) in - let lower:usize = upper -. (Alloc.Vec.len_under_impl_1 repr <: usize) in - let _:Prims.unit = - Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" - "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (out),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(core::ops::deref::Deref::deref(&(deref(&(repr)))))),\n )" - - in - { - Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_b = out; - Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_sign = sign; - Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_signed = false - } - } - -let impl: Core.Default.t_Default t_QueryCanvas = - { - default - = - fun -> - { - Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_b = Rust_primitives.Hax.repeat 0uy 48sz; - Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_sign = Num_bigint.Bigint.Sign_Plus; - Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_signed = false - } - } - -let impl: Core.Convert.t_Into t_QueryCanvas Num_bigint.Bigint.t_BigInt = - { - into - = - fun (self: t_QueryCanvas) -> - Num_bigint.Bigint.from_bytes_be_under_impl_24 self - .Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_sign - (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_b <: slice u8) - } - -let impl: Core.Convert.t_Into t_QueryCanvas Num_bigint.Biguint.t_BigUint = - { - into - = - fun (self: t_QueryCanvas) -> - Num_bigint.Biguint.from_bytes_be_under_impl_18 (Rust_primitives.unsize self - .Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_b - <: - slice u8) - } - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -let from_hex_under_impl_15 (s: string) : t_QueryCanvas = - Core.Convert.Into.into (Num_bigint.Bigint.from_bytes_be_under_impl_24 Num_bigint.Bigint.Sign_Plus - (Core.Ops.Deref.Deref.deref (hex_string_to_bytes_under_impl_16 s - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - Num_bigint.Bigint.t_BigInt) - -let from_be_bytes_under_impl_15 (v: slice u8) : t_QueryCanvas = - let _:Prims.unit = - if true - then - let _:Prims.unit = - if - ~.((Core.Slice.len_under_impl v <: usize) <=. ((384sz +. 7sz <: usize) /. 8sz <: usize) - <: - bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - () - in - let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in - let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize repr <: slice u8) in - let lower:usize = upper -. (Core.Slice.len_under_impl v <: usize) in - let _:Prims.unit = - Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" - "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(deref(&(v)))),\n )" - - in - { - Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_b = repr; - Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_sign = Num_bigint.Bigint.Sign_Plus; - Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_signed = false - } - -let from_le_bytes_under_impl_15 (v: slice u8) : t_QueryCanvas = - let _:Prims.unit = - if true - then - let _:Prims.unit = - if - ~.((Core.Slice.len_under_impl v <: usize) <=. ((384sz +. 7sz <: usize) /. 8sz <: usize) - <: - bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - () - in - let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in - let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize repr <: slice u8) in - let lower:usize = upper -. (Core.Slice.len_under_impl v <: usize) in - let _:Prims.unit = - Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" - "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(deref(&(v)))),\n )" - - in - Core.Convert.Into.into (Num_bigint.Bigint.from_bytes_le_under_impl_24 Num_bigint.Bigint.Sign_Plus - (Rust_primitives.unsize repr <: slice u8) - <: - Num_bigint.Bigint.t_BigInt) - -let to_be_bytes_under_impl_15 (self: t_QueryCanvas) : array u8 48sz = - self.Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_b - -let to_le_bytes_under_impl_15 (self: t_QueryCanvas) : array u8 48sz = - let x:Num_bigint.Bigint.t_BigInt = - Num_bigint.Bigint.from_bytes_be_under_impl_24 Num_bigint.Bigint.Sign_Plus - (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_b <: slice u8) - in - let _, x_s:(Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) = - Num_bigint.Bigint.to_bytes_le_under_impl_24 x - in - let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in - let _:Prims.unit = - Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" - "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: 0,\n f_end: alloc::vec::len_under_impl_1(&(x_s)),\n },\n ))),\n &(deref(core::ops::deref::Deref::deref(&(deref(&(x_s)))))),\n )" - - in - repr - -let comp_eq_under_impl_15 (self rhs: t_QueryCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a =. b - then - let one:t_QueryCanvas = from_literal_under_impl_16 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_ne_under_impl_15 (self rhs: t_QueryCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a <>. b - then - let one:t_QueryCanvas = from_literal_under_impl_16 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_gte_under_impl_15 (self rhs: t_QueryCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a >=. b - then - let one:t_QueryCanvas = from_literal_under_impl_16 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_gt_under_impl_15 (self rhs: t_QueryCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a >. b - then - let one:t_QueryCanvas = from_literal_under_impl_16 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_lte_under_impl_15 (self rhs: t_QueryCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a <=. b - then - let one:t_QueryCanvas = from_literal_under_impl_16 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_lt_under_impl_15 (self rhs: t_QueryCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a <. b - then - let one:t_QueryCanvas = from_literal_under_impl_16 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let inv_under_impl_27 (self modval: t_QueryCanvas) : t_QueryCanvas = - let (biguintmodval: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into modval - in - let m:Core.Ops.Arith.Sub.t_Output = - biguintmodval -. (Core.Convert.From.from 2ul <: Num_bigint.Bigint.t_BigInt) - in - let (s: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - Core.Convert.Into.into (Num_bigint.Bigint.modpow_under_impl_24 s m biguintmodval - <: - Num_bigint.Bigint.t_BigInt) - -let pow_felem_under_impl_27 (self exp modval: t_QueryCanvas) : t_QueryCanvas = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into exp in - let (m: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into modval in - let (c: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Num_bigint.Bigint.modpow_under_impl_24 a b m - in - Core.Convert.Into.into c - -let pow_under_impl_27 (self: t_QueryCanvas) (exp: u128) (modval: t_QueryCanvas) : t_QueryCanvas = - pow_felem_under_impl_27 self - (Core.Convert.Into.into (Core.Convert.From.from exp <: Num_bigint.Bigint.t_BigInt) - <: - t_QueryCanvas) - modval - -let rem_under_impl_27 (self n: t_QueryCanvas) : Core.Ops.Arith.Rem.t_Output = self %. n - -let impl: Core.Ops.Arith.t_Add t_QueryCanvas t_QueryCanvas = - { - output = t_QueryCanvas; - add - = - fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let c:Core.Ops.Arith.Add.t_Output = a +. b in - let _:Prims.unit = - if c >. (max_under_impl_16 <: Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = - ["bounded addition overflow for type QueryCanvas"] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Arith.t_Sub t_QueryCanvas t_QueryCanvas = - { - output = t_QueryCanvas; - sub - = - fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let c:Core.Ops.Arith.Sub.t_Output = - if self.Hacspec_ovn.Schnorr.Random_oracle.QueryCanvas.f_signed - then a -. b - else - Core.Option.unwrap_or_else_under_impl (Num_bigint.Bigint.checked_sub_under_impl_24 a b - <: - Core.Option.t_Option Num_bigint.Bigint.t_BigInt) - (fun -> - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = - ["bounded substraction underflow for type QueryCanvas"] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - <: - Num_bigint.Bigint.t_BigInt) - in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Arith.t_Mul t_QueryCanvas t_QueryCanvas = - { - output = t_QueryCanvas; - mul - = - fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let c:Core.Ops.Arith.Mul.t_Output = a *. b in - let _:Prims.unit = - if c >. (max_under_impl_16 <: Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = - ["bounded multiplication overflow for type QueryCanvas"] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Arith.t_Div t_QueryCanvas t_QueryCanvas = - { - output = t_QueryCanvas; - div - = - fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let _:Prims.unit = - if b =. (Num_traits.Identities.Zero.zero <: Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = ["dividing by zero in type QueryCanvas"] in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let c:Core.Ops.Arith.Div.t_Output = a /. b in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Arith.t_Rem t_QueryCanvas t_QueryCanvas = - { - output = t_QueryCanvas; - rem - = - fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let _:Prims.unit = - if b =. (Num_traits.Identities.Zero.zero <: Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = ["dividing by zero in type QueryCanvas"] in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let c:Core.Ops.Arith.Rem.t_Output = a %. b in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Bit.t_Not t_QueryCanvas = - { - output = t_QueryCanvas; - not - = - fun (self: t_QueryCanvas) -> - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "not implemented" - <: - Rust_primitives.Hax.t_Never) - } - -let impl: Core.Ops.Bit.t_BitOr t_QueryCanvas t_QueryCanvas = - { - output = t_QueryCanvas; - bitor - = - fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a |. b <: Core.Ops.Bit.BitOr.t_Output) - } - -let impl: Core.Ops.Bit.t_BitXor t_QueryCanvas t_QueryCanvas = - { - output = t_QueryCanvas; - bitxor - = - fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a ^. b <: Core.Ops.Bit.BitXor.t_Output) - } - -let impl: Core.Ops.Bit.t_BitAnd t_QueryCanvas t_QueryCanvas = - { - output = t_QueryCanvas; - bitand - = - fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a &. b <: Core.Ops.Bit.BitAnd.t_Output) - } - -let impl: Core.Ops.Bit.t_Shr t_QueryCanvas usize = - { - output = t_QueryCanvas; - shr - = - fun (self: t_QueryCanvas) (rhs: usize) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let b:usize = rhs in - Core.Convert.Into.into (a <<. b <: Core.Ops.Bit.Shr.t_Output) - } - -let impl: Core.Ops.Bit.t_Shl t_QueryCanvas usize = - { - output = t_QueryCanvas; - shl - = - fun (self: t_QueryCanvas) (rhs: usize) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let b:usize = rhs in - Core.Convert.Into.into (a >>. b <: Core.Ops.Bit.Shl.t_Output) - } - -let impl: Core.Cmp.t_PartialEq t_QueryCanvas t_QueryCanvas = - { - eq - = - fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - a =. b - } - -let impl: Core.Cmp.t_Eq t_QueryCanvas = { } - -let impl: Core.Cmp.t_PartialOrd t_QueryCanvas t_QueryCanvas = - { - partial_cmp - = - fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into other - in - Core.Cmp.PartialOrd.partial_cmp a b - } - -let impl: Core.Cmp.t_Ord t_QueryCanvas = - { - cmp - = - fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> - Core.Option.unwrap_under_impl (Core.Cmp.PartialOrd.partial_cmp self other - <: - Core.Option.t_Option Core.Cmp.t_Ordering) - } - -let from_byte_seq_be_under_impl_8 (s: a) : t_QueryCanvas = - from_be_bytes_under_impl_15 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (Secret_integers.t_U8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - -let from_public_byte_seq_be_under_impl_8 (s: a) : t_QueryCanvas = - from_be_bytes_under_impl_15 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> x) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - -let to_byte_seq_be_under_impl_8 (self: t_QueryCanvas) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map - (Core.Slice.iter_under_impl (Rust_primitives.unsize (to_be_bytes_under_impl_15 self - <: - array u8 48sz) - <: - slice u8) - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) - <: - Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) - -let impl: Hacspec_lib.Traits.t_NumericCopy t_QueryCanvas = { } - -let impl: Hacspec_lib.Traits.t_UnsignedInteger t_QueryCanvas = { } - -let impl: Hacspec_lib.Traits.t_UnsignedIntegerCopy t_QueryCanvas = { } - -let impl: Hacspec_lib.Traits.t_Integer t_QueryCanvas = - { - nUM_BITS = (fun -> 384sz); - zERO = (fun -> from_literal_under_impl_16 (pub_u128 0sz)); - oNE = (fun -> from_literal_under_impl_16 (pub_u128 1sz)); - tWO = (fun -> from_literal_under_impl_16 (pub_u128 2sz)); - from_literal = (fun (v_val: u128) -> from_literal_under_impl_16 v_val); - from_hex_string - = - (fun (s: Alloc.String.t_String) -> - from_hex_under_impl_15 (Core.Ops.Deref.Deref.deref (Alloc.Str.replace_under_impl_5 (Core.Ops.Deref.Deref.deref - s - <: - string) - "0x" - "" - <: - Alloc.String.t_String) - <: - string)); - get_bit - = - (fun (self: t_QueryCanvas) (i: usize) -> - (self <<. i <: Core.Ops.Bit.Shr.t_Output) &. - (Hacspec_lib.Traits.Integer.v_ONE <: t_QueryCanvas)); - set_bit - = - (fun (self: t_QueryCanvas) (b: t_QueryCanvas) (i: usize) -> - let _:Prims.unit = - if true - then - let _:Prims.unit = - if - ~.(Prims.op_BarBar (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b - <: - t_QueryCanvas) - (Hacspec_lib.Traits.Integer.v_ONE <: t_QueryCanvas) - <: - bool) - (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b <: t_QueryCanvas) - (Hacspec_lib.Traits.Integer.v_ZERO <: t_QueryCanvas) - <: - bool)) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO())" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - () - in - let tmp1:t_QueryCanvas = - from_literal_under_impl_16 (~.(pub_u128 1sz >>. i <: u128) <: u128) - in - let tmp2:Core.Ops.Bit.Shl.t_Output = b >>. i in - (self &. tmp1 <: Core.Ops.Bit.BitAnd.t_Output) |. tmp2); - set - = - (fun (self: t_QueryCanvas) (pos: usize) (y: t_QueryCanvas) (yi: usize) -> - let b:t_QueryCanvas = Hacspec_lib.Traits.Integer.get_bit y yi in - Hacspec_lib.Traits.Integer.set_bit self b pos); - rotate_left - = - (fun (self: t_QueryCanvas) (n: usize) -> - let _:Prims.unit = - if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - ((Core.Clone.Clone.clone self <: t_QueryCanvas) >>. n <: Core.Ops.Bit.Shl.t_Output) |. - (self <<. - (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. - (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) - <: - usize) - <: - Core.Ops.Bit.Shr.t_Output)); - rotate_right - = - fun (self: t_QueryCanvas) (n: usize) -> - let _:Prims.unit = - if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - ((Core.Clone.Clone.clone self <: t_QueryCanvas) <<. n <: Core.Ops.Bit.Shr.t_Output) |. - (self >>. - (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. - (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) - <: - usize) - <: - Core.Ops.Bit.Shl.t_Output) - } - -let impl: Hacspec_lib.Traits.t_ModNumeric t_QueryCanvas = - { - sub_mod - = - (fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) (n: t_QueryCanvas) -> - (self -. rhs <: Core.Ops.Arith.Sub.t_Output) %. n); - add_mod - = - (fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) (n: t_QueryCanvas) -> - (self +. rhs <: Core.Ops.Arith.Add.t_Output) %. n); - mul_mod - = - (fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) (n: t_QueryCanvas) -> - (self *. rhs <: Core.Ops.Arith.Mul.t_Output) %. n); - pow_mod - = - (fun (self: t_QueryCanvas) (exp: t_QueryCanvas) (n: t_QueryCanvas) -> - pow_felem_under_impl_27 self exp n); - modulo = (fun (self: t_QueryCanvas) (n: t_QueryCanvas) -> self %. n); - signed_modulo - = - (fun (self: t_QueryCanvas) (n: t_QueryCanvas) -> Hacspec_lib.Traits.ModNumeric.modulo self n); - absolute = fun (self: t_QueryCanvas) -> self - } - -let impl: Hacspec_lib.Traits.t_Numeric t_QueryCanvas = - { - max_val = (fun -> max_value_under_impl_16); - wrap_add = (fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> self +. rhs); - wrap_sub = (fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> self -. rhs); - wrap_mul = (fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> self *. rhs); - wrap_div = (fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> self /. rhs); - exp - = - (fun (self: t_QueryCanvas) (exp: u32) -> - pow_under_impl_27 self - (Core.Convert.Into.into exp <: u128) - (Hacspec_lib.Traits.Numeric.max_val <: t_QueryCanvas)); - pow_self - = - (fun (self: t_QueryCanvas) (exp: t_QueryCanvas) -> - pow_felem_under_impl_27 self - (Core.Convert.Into.into exp <: t_QueryCanvas) - (Hacspec_lib.Traits.Numeric.max_val <: t_QueryCanvas)); - divide = (fun (self: t_QueryCanvas) (rhs: t_QueryCanvas) -> self /. rhs); - inv = (fun (self: t_QueryCanvas) (n: t_QueryCanvas) -> inv_under_impl_27 self n); - equal = (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> self =. other); - greater_than = (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> self >. other); - greater_than_or_equal = (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> self >=. other); - less_than = (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> self <. other); - less_than_or_equal = (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> self >=. other); - not_equal_bm - = - (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> - if ~.(Hacspec_lib.Traits.Numeric.equal self other <: bool) - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_16 (pub_u128 0sz)); - equal_bm - = - (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> - if Hacspec_lib.Traits.Numeric.equal self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_16 (pub_u128 0sz)); - greater_than_bm - = - (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> - if Hacspec_lib.Traits.Numeric.greater_than self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_16 (pub_u128 0sz)); - greater_than_or_equal_bm - = - (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> - if Hacspec_lib.Traits.Numeric.greater_than_or_equal self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_16 (pub_u128 0sz)); - less_than_bm - = - (fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> - if Hacspec_lib.Traits.Numeric.less_than self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_16 (pub_u128 0sz)); - less_than_or_equal_bm - = - fun (self: t_QueryCanvas) (other: t_QueryCanvas) -> - if Hacspec_lib.Traits.Numeric.less_than_or_equal self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_16 (pub_u128 0sz) - } - -type t_Query = | Query : t_QueryCanvas -> t_Query - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -let impl: Core.Convert.t_From t_Query t_QueryCanvas = - { - from - = - fun (x: t_QueryCanvas) -> - Query - (rem_under_impl_27 x - (from_hex_under_impl_15 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_QueryCanvas)) - } - -let impl: Core.Convert.t_Into t_Query t_QueryCanvas = - { into = fun (self: t_Query) -> self.Hacspec_ovn.Schnorr.Random_oracle.Query.0 } - -let from_canvas_under_impl_64 (x: t_QueryCanvas) : t_Query = - Query - (rem_under_impl_27 x - (from_hex_under_impl_15 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_QueryCanvas)) - -let into_canvas_under_impl_64 (self: t_Query) : t_QueryCanvas = - self.Hacspec_ovn.Schnorr.Random_oracle.Query.0 - -let max_under_impl_64: t_QueryCanvas = - from_hex_under_impl_15 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - -let declassify_under_impl_64 (self: t_Query) : Num_bigint.Bigint.t_BigInt = - let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into a - -let from_hex_under_impl_64 (s: string) : t_Query = - Core.Convert.Into.into (from_hex_under_impl_15 s <: t_QueryCanvas) - -let from_be_bytes_under_impl_64 (v: slice u8) : t_Query = - Core.Convert.Into.into (from_be_bytes_under_impl_15 v <: t_QueryCanvas) - -let to_be_bytes_under_impl_64 (self: t_Query) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = - Alloc.Slice.to_vec_under_impl (Rust_primitives.unsize (to_be_bytes_under_impl_15 (Core.Convert.Into.into - self - <: - t_QueryCanvas) - <: - array u8 48sz) - <: - slice u8) - -let from_le_bytes_under_impl_64 (v: slice u8) : t_Query = - Core.Convert.Into.into (from_le_bytes_under_impl_15 v <: t_QueryCanvas) - -let to_le_bytes_under_impl_64 (self: t_Query) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = - Alloc.Slice.to_vec_under_impl (Rust_primitives.unsize (to_le_bytes_under_impl_15 (Core.Convert.Into.into - self - <: - t_QueryCanvas) - <: - array u8 48sz) - <: - slice u8) - -let bit_under_impl_64 (self: t_Query) (i: usize) : bool = - bit_under_impl_16 (Core.Convert.Into.into self <: t_QueryCanvas) i - -let from_literal_under_impl_64 (x: u128) : t_Query = - let big_x:Num_bigint.Biguint.t_BigUint = Core.Convert.From.from x in - let _:Prims.unit = - if - big_x >. - (Core.Convert.Into.into (max_under_impl_64 <: t_QueryCanvas) <: Num_bigint.Biguint.t_BigUint) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["literal "; " too big for type Query"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Query (Core.Convert.Into.into big_x) - -let from_signed_literal_under_impl_64 (x: i128) : t_Query = - let big_x:Num_bigint.Biguint.t_BigUint = Core.Convert.From.from (cast x) in - let _:Prims.unit = - if - big_x >. - (Core.Convert.Into.into (max_under_impl_64 <: t_QueryCanvas) <: Num_bigint.Biguint.t_BigUint) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["literal "; " too big for type Query"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Query (Core.Convert.Into.into big_x) - -let comp_eq_under_impl_64 (self rhs: t_Query) : t_Query = - let (x: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_eq_under_impl_15 x (Core.Convert.Into.into rhs <: t_QueryCanvas) - <: - t_QueryCanvas) - -let comp_ne_under_impl_64 (self rhs: t_Query) : t_Query = - let (x: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_ne_under_impl_15 x (Core.Convert.Into.into rhs <: t_QueryCanvas) - <: - t_QueryCanvas) - -let comp_gte_under_impl_64 (self rhs: t_Query) : t_Query = - let (x: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_gte_under_impl_15 x (Core.Convert.Into.into rhs <: t_QueryCanvas) - <: - t_QueryCanvas) - -let comp_gt_under_impl_64 (self rhs: t_Query) : t_Query = - let (x: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_gt_under_impl_15 x (Core.Convert.Into.into rhs <: t_QueryCanvas) - <: - t_QueryCanvas) - -let comp_lte_under_impl_64 (self rhs: t_Query) : t_Query = - let (x: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_lte_under_impl_15 x (Core.Convert.Into.into rhs <: t_QueryCanvas) - <: - t_QueryCanvas) - -let comp_lt_under_impl_64 (self rhs: t_Query) : t_Query = - let (x: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_lt_under_impl_15 x (Core.Convert.Into.into rhs <: t_QueryCanvas) - <: - t_QueryCanvas) - -let neg_under_impl_64 (self: t_Query) : t_Query = - let (mod_val: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into (from_hex_under_impl_15 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_QueryCanvas) - in - let (s: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - let (s: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into s in - let (result: t_QueryCanvas):t_QueryCanvas = - Core.Convert.Into.into (mod_val -. s <: Core.Ops.Arith.Sub.t_Output) - in - Core.Convert.Into.into result - -let impl: Core.Cmp.t_PartialOrd t_Query t_Query = - { - partial_cmp - = - fun (self: t_Query) (other: t_Query) -> Core.Option.Option_Some (Core.Cmp.Ord.cmp self other) - } - -let impl: Core.Cmp.t_Ord t_Query = - { - cmp - = - fun (self: t_Query) (other: t_Query) -> - Core.Cmp.Ord.cmp self.Hacspec_ovn.Schnorr.Random_oracle.Query.0 - other.Hacspec_ovn.Schnorr.Random_oracle.Query.0 - } - -let impl: Core.Cmp.t_PartialEq t_Query t_Query = - { - eq - = - fun (self: t_Query) (other: t_Query) -> - self.Hacspec_ovn.Schnorr.Random_oracle.Query.0 =. - other.Hacspec_ovn.Schnorr.Random_oracle.Query.0 - } - -let impl: Core.Cmp.t_Eq t_Query = { } - -let impl: Core.Ops.Arith.t_Add t_Query t_Query = - { - output = t_Query; - add - = - fun (self: t_Query) (rhs: t_Query) -> - let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - let (b: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into rhs in - let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into a - in - let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into b - in - let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Add.t_Output = a +. b in - let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into (from_hex_under_impl_15 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_QueryCanvas) - in - let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in - let (d: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into d in - Core.Convert.Into.into d - } - -let impl: Core.Ops.Arith.t_Sub t_Query t_Query = - { - output = t_Query; - sub - = - fun (self: t_Query) (rhs: t_Query) -> - let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - let (b: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into rhs in - let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into a - in - let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into b - in - let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into (from_hex_under_impl_15 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_QueryCanvas) - in - let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Add.t_Output = - if b >. a - then - ((Core.Clone.Clone.clone max <: Num_bigint.Biguint.t_BigUint) -. b - <: - Core.Ops.Arith.Sub.t_Output) +. - a - else a -. b - in - let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in - let (d: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into d in - Core.Convert.Into.into d - } - -let impl: Core.Ops.Arith.t_Mul t_Query t_Query = - { - output = t_Query; - mul - = - fun (self: t_Query) (rhs: t_Query) -> - let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - let (b: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into rhs in - let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into a - in - let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into b - in - let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Mul.t_Output = a *. b in - let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into (from_hex_under_impl_15 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_QueryCanvas) - in - let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in - let (d: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into d in - Core.Convert.Into.into d - } - -let impl: Core.Ops.Arith.t_Div t_Query t_Query = - { - output = t_Query; - div = fun (self: t_Query) (rhs: t_Query) -> self *. (inv_under_impl_58 rhs <: t_Query) - } - -let impl: Core.Ops.Arith.t_Rem t_Query t_Query = - { - output = t_Query; - rem - = - fun (self: t_Query) (rhs: t_Query) -> - let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - let (b: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into rhs in - let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into a - in - let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into b - in - let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = a %. b in - let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into (from_hex_under_impl_15 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_QueryCanvas) - in - let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in - let (d: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into d in - Core.Convert.Into.into d - } - -let impl: Core.Ops.Bit.t_Not t_Query = - { - output = t_Query; - not - = - fun (self: t_Query) -> - let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (~.a <: Core.Ops.Bit.Not.t_Output) - } - -let impl: Core.Ops.Bit.t_BitOr t_Query t_Query = - { - output = t_Query; - bitor - = - fun (self: t_Query) (rhs: t_Query) -> - let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - let (b: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a |. b <: Core.Ops.Bit.BitOr.t_Output) - } - -let impl: Core.Ops.Bit.t_BitXor t_Query t_Query = - { - output = t_Query; - bitxor - = - fun (self: t_Query) (rhs: t_Query) -> - let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - let (b: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a ^. b <: Core.Ops.Bit.BitXor.t_Output) - } - -let impl: Core.Ops.Bit.t_BitAnd t_Query t_Query = - { - output = t_Query; - bitand - = - fun (self: t_Query) (rhs: t_Query) -> - let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - let (b: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a &. b <: Core.Ops.Bit.BitAnd.t_Output) - } - -let impl: Core.Ops.Bit.t_Shr t_Query usize = - { - output = t_Query; - shr - = - fun (self: t_Query) (rhs: usize) -> - let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (a <<. rhs <: Core.Ops.Bit.Shr.t_Output) - } - -let impl: Core.Ops.Bit.t_Shl t_Query usize = - { - output = t_Query; - shl - = - fun (self: t_Query) (rhs: usize) -> - let (a: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (a >>. rhs <: Core.Ops.Bit.Shl.t_Output) - } - -let inv_under_impl_58 (self: t_Query) : t_Query = - let (base: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (inv_under_impl_27 base (max_under_impl_64 <: t_QueryCanvas) - <: - t_QueryCanvas) - -let pow_felem_under_impl_58 (self exp: t_Query) : t_Query = - let (base: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (pow_felem_under_impl_27 base - (Core.Convert.Into.into exp <: t_QueryCanvas) - (max_under_impl_64 <: t_QueryCanvas) - <: - t_QueryCanvas) - -let pow_under_impl_58 (self: t_Query) (exp: u128) : t_Query = - let (base: t_QueryCanvas):t_QueryCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (pow_under_impl_27 base exp (max_under_impl_64 <: t_QueryCanvas) - <: - t_QueryCanvas) - -let pow2_under_impl_58 (x: usize) : t_Query = - Core.Convert.Into.into (pow2_under_impl_16 x <: t_QueryCanvas) - -let from_byte_seq_be_under_impl_1 (s: a) : t_Query = - Core.Convert.Into.into (from_be_bytes_under_impl_15 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (Secret_integers.t_U8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - t_QueryCanvas) - -let from_public_byte_seq_be_under_impl_1 (s: a) : t_Query = - Core.Convert.Into.into (from_be_bytes_under_impl_15 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> x) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - t_QueryCanvas) - -let to_byte_seq_be_under_impl_1 (self: t_Query) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map - (Core.Slice.iter_under_impl (Core.Ops.Deref.Deref.deref (to_be_bytes_under_impl_64 self - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) - <: - Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) - -let to_public_byte_seq_be_under_impl_1 (self: t_Query) : Hacspec_lib.Seq.t_Seq u8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (to_be_bytes_under_impl_64 self - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - -let from_byte_seq_le_under_impl_1 (s: a) : t_Query = - Core.Convert.Into.into (from_le_bytes_under_impl_15 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (Secret_integers.t_U8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - t_QueryCanvas) - -let from_public_byte_seq_le_under_impl_1 (s: a) : t_Query = - Core.Convert.Into.into (from_le_bytes_under_impl_15 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> x) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - t_QueryCanvas) - -let to_byte_seq_le_under_impl_1 (self: t_Query) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map - (Core.Slice.iter_under_impl (Core.Ops.Deref.Deref.deref (to_le_bytes_under_impl_64 self - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) - <: - Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) - -let to_public_byte_seq_le_under_impl_1 (self: t_Query) : Hacspec_lib.Seq.t_Seq u8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (to_le_bytes_under_impl_64 self - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - -let from_secret_literal_under_impl_1 (x: Secret_integers.t_U128) : t_Query = - Core.Convert.Into.into (from_literal_under_impl_16 (Secret_integers.declassify_under_impl_126 x - <: - u128) - <: - t_QueryCanvas) - -let impl: Hacspec_lib.Traits.t_NumericCopy t_Query = { } - -let impl: Hacspec_lib.Traits.t_UnsignedInteger t_Query = { } - -let impl: Hacspec_lib.Traits.t_UnsignedIntegerCopy t_Query = { } - -let impl: Hacspec_lib.Traits.t_Integer t_Query = - { - nUM_BITS = (fun -> 384sz); - zERO = (fun -> from_literal_under_impl_64 (pub_u128 0sz)); - oNE = (fun -> from_literal_under_impl_64 (pub_u128 1sz)); - tWO = (fun -> from_literal_under_impl_64 (pub_u128 2sz)); - from_literal = (fun (v_val: u128) -> from_literal_under_impl_64 v_val); - from_hex_string - = - (fun (s: Alloc.String.t_String) -> - from_hex_under_impl_64 (Core.Ops.Deref.Deref.deref (Alloc.Str.replace_under_impl_5 (Core.Ops.Deref.Deref.deref - s - <: - string) - "0x" - "" - <: - Alloc.String.t_String) - <: - string)); - get_bit - = - (fun (self: t_Query) (i: usize) -> - (self <<. i <: Core.Ops.Bit.Shr.t_Output) &. (Hacspec_lib.Traits.Integer.v_ONE <: t_Query)); - set_bit - = - (fun (self: t_Query) (b: t_Query) (i: usize) -> - let _:Prims.unit = - if true - then - let _:Prims.unit = - if - ~.(Prims.op_BarBar (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b - <: - t_Query) - (Hacspec_lib.Traits.Integer.v_ONE <: t_Query) - <: - bool) - (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b <: t_Query) - (Hacspec_lib.Traits.Integer.v_ZERO <: t_Query) - <: - bool)) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO())" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - () - in - let tmp1:t_Query = from_literal_under_impl_64 (~.(pub_u128 1sz >>. i <: u128) <: u128) in - let tmp2:Core.Ops.Bit.Shl.t_Output = b >>. i in - (self &. tmp1 <: Core.Ops.Bit.BitAnd.t_Output) |. tmp2); - set - = - (fun (self: t_Query) (pos: usize) (y: t_Query) (yi: usize) -> - let b:t_Query = Hacspec_lib.Traits.Integer.get_bit y yi in - Hacspec_lib.Traits.Integer.set_bit self b pos); - rotate_left - = - (fun (self: t_Query) (n: usize) -> - let _:Prims.unit = - if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - ((Core.Clone.Clone.clone self <: t_Query) >>. n <: Core.Ops.Bit.Shl.t_Output) |. - (self <<. - (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. - (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) - <: - usize) - <: - Core.Ops.Bit.Shr.t_Output)); - rotate_right - = - fun (self: t_Query) (n: usize) -> - let _:Prims.unit = - if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - ((Core.Clone.Clone.clone self <: t_Query) <<. n <: Core.Ops.Bit.Shr.t_Output) |. - (self >>. - (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. - (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) - <: - usize) - <: - Core.Ops.Bit.Shl.t_Output) - } - -let impl: Hacspec_lib.Traits.t_ModNumeric t_Query = - { - sub_mod = (fun (self: t_Query) (rhs: t_Query) (n: t_Query) -> self -. rhs); - add_mod = (fun (self: t_Query) (rhs: t_Query) (n: t_Query) -> self +. rhs); - mul_mod = (fun (self: t_Query) (rhs: t_Query) (n: t_Query) -> self *. rhs); - pow_mod = (fun (self: t_Query) (exp: t_Query) (n: t_Query) -> pow_felem_under_impl_58 self exp); - modulo = (fun (self: t_Query) (n: t_Query) -> self %. n); - signed_modulo - = - (fun (self: t_Query) (n: t_Query) -> Hacspec_lib.Traits.ModNumeric.modulo self n); - absolute = fun (self: t_Query) -> self - } - -let impl: Hacspec_lib.Traits.t_Numeric t_Query = - { - max_val - = - (fun -> - Core.Convert.Into.into ((max_under_impl_64 <: t_QueryCanvas) -. - (from_literal_under_impl_16 (pub_u128 1sz) <: t_QueryCanvas) - <: - Core.Ops.Arith.Sub.t_Output)); - wrap_add = (fun (self: t_Query) (rhs: t_Query) -> self +. rhs); - wrap_sub = (fun (self: t_Query) (rhs: t_Query) -> self -. rhs); - wrap_mul = (fun (self: t_Query) (rhs: t_Query) -> self *. rhs); - wrap_div = (fun (self: t_Query) (rhs: t_Query) -> self /. rhs); - exp - = - (fun (self: t_Query) (exp: u32) -> pow_under_impl_58 self (Core.Convert.Into.into exp <: u128)); - pow_self = (fun (self: t_Query) (exp: t_Query) -> pow_felem_under_impl_58 self exp); - divide = (fun (self: t_Query) (rhs: t_Query) -> self /. rhs); - inv = (fun (self: t_Query) (n: t_Query) -> inv_under_impl_58 self); - equal = (fun (self: t_Query) (other: t_Query) -> self =. other); - greater_than = (fun (self: t_Query) (other: t_Query) -> self >. other); - greater_than_or_equal = (fun (self: t_Query) (other: t_Query) -> self >=. other); - less_than = (fun (self: t_Query) (other: t_Query) -> self <. other); - less_than_or_equal = (fun (self: t_Query) (other: t_Query) -> self <=. other); - not_equal_bm - = - (fun (self: t_Query) (other: t_Query) -> - if self <>. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_Query) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_Query) - else Hacspec_lib.Traits.Integer.v_ZERO); - equal_bm - = - (fun (self: t_Query) (other: t_Query) -> - if self =. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_Query) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_Query) - else Hacspec_lib.Traits.Integer.v_ZERO); - greater_than_bm - = - (fun (self: t_Query) (other: t_Query) -> - if self >. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_Query) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_Query) - else Hacspec_lib.Traits.Integer.v_ZERO); - greater_than_or_equal_bm - = - (fun (self: t_Query) (other: t_Query) -> - if self >=. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_Query) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_Query) - else Hacspec_lib.Traits.Integer.v_ZERO); - less_than_bm - = - (fun (self: t_Query) (other: t_Query) -> - if self <. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_Query) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_Query) - else Hacspec_lib.Traits.Integer.v_ZERO); - less_than_or_equal_bm - = - fun (self: t_Query) (other: t_Query) -> - if self <=. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_Query) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_Query) - else Hacspec_lib.Traits.Integer.v_ZERO - } - -type t_RandomCanvas = { - f_b:array u8 48sz; - f_sign:Num_bigint.Bigint.t_Sign; - f_signed:bool -} - -let max_under_impl_83: Core.Ops.Arith.Sub.t_Output = - ((Core.Convert.From.from 1ul <: Num_bigint.Bigint.t_BigInt) >>. 384l <: Core.Ops.Bit.Shl.t_Output) -. - (Num_traits.Identities.One.one <: Num_bigint.Bigint.t_BigInt) - -let max_value_under_impl_83: t_RandomCanvas = - Core.Convert.From.from (max_under_impl_83 <: Num_bigint.Bigint.t_BigInt) - -let hex_string_to_bytes_under_impl_83 (s: string) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = - let s:Alloc.String.t_String = - if ((Core.Str.len_under_impl s <: usize) %. 2sz <: usize) <>. 0sz - then - let x:Alloc.String.t_String = Alloc.String.ToString.to_string "0" in - let x:Alloc.String.t_String = Alloc.String.push_str_under_impl x s in - x - else Alloc.String.ToString.to_string s - in - let _:Prims.unit = - if ~.(((Alloc.String.len_under_impl s <: usize) %. 2sz <: usize) =. 0sz <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["length of hex string "; ": "] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [ - Core.Fmt.Rt.new_display_under_impl_1 s <: Core.Fmt.Rt.t_Argument; - Core.Fmt.Rt.new_display_under_impl_1 (Alloc.String.len_under_impl s - <: - usize) - <: - Core.Fmt.Rt.t_Argument - ] - in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let - (b: Core.Result.t_Result (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) Core.Num.Error.t_ParseIntError):Core.Result.t_Result - (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) Core.Num.Error.t_ParseIntError = - Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map (Core.Iter.Traits.Iterator.Iterator.step_by - ({ - Core.Ops.Range.Range.f_start = 0sz; - Core.Ops.Range.Range.f_end = Alloc.String.len_under_impl s <: usize - }) - 2sz - <: - Core.Iter.Adapters.Step_by.t_StepBy (Core.Ops.Range.t_Range usize)) - (fun i -> - Core.Num.from_str_radix_under_impl_6 (s.[ { - Core.Ops.Range.Range.f_start = i; - Core.Ops.Range.Range.f_end = i +. 2sz <: usize - } ] - <: - string) - 16ul - <: - Core.Result.t_Result u8 Core.Num.Error.t_ParseIntError) - <: - Core.Iter.Adapters.Map.t_Map - (Core.Iter.Adapters.Step_by.t_StepBy (Core.Ops.Range.t_Range usize)) - (usize -> Core.Result.t_Result u8 Core.Num.Error.t_ParseIntError)) - in - Core.Result.expect_under_impl b "Error parsing hex string" - -let from_literal_under_impl_83 (x: u128) : t_RandomCanvas = - let big_x:Num_bigint.Bigint.t_BigInt = Core.Convert.From.from x in - let _:Prims.unit = - if - big_x >. - (Core.Convert.Into.into (max_under_impl_83 <: Num_bigint.Bigint.t_BigInt) - <: - Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["literal "; " too big for type RandomCanvas"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Core.Convert.Into.into big_x - -let from_signed_literal_under_impl_83 (x: i128) : t_RandomCanvas = - let big_x:Num_bigint.Bigint.t_BigInt = Core.Convert.From.from (cast x) in - let _:Prims.unit = - if - big_x >. - (Core.Convert.Into.into (max_under_impl_83 <: Num_bigint.Bigint.t_BigInt) - <: - Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["literal "; " too big for type RandomCanvas"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Core.Convert.Into.into big_x - -let pow2_under_impl_83 (x: usize) : t_RandomCanvas = - Core.Convert.Into.into ((Core.Convert.From.from 1ul <: Num_bigint.Bigint.t_BigInt) >>. x - <: - Core.Ops.Bit.Shl.t_Output) - -let bit_under_impl_83 (self: t_RandomCanvas) (i: usize) : bool = - let _:Prims.unit = - if - ~.(i <. - ((Core.Slice.len_under_impl (Rust_primitives.unsize self - .Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_b - <: - slice u8) - <: - usize) *. - 8sz - <: - usize) - <: - bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = - [ - "the bit queried should be lower than the size of the integer representation: "; - " < " - ] - in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [ - Core.Fmt.Rt.new_display_under_impl_1 i <: Core.Fmt.Rt.t_Argument; - Core.Fmt.Rt.new_display_under_impl_1 ((Core.Slice.len_under_impl (Rust_primitives.unsize - self.Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_b - <: - slice u8) - <: - usize) *. - 8sz - <: - usize) - <: - Core.Fmt.Rt.t_Argument - ] - in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let (bigint: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (tmp: Num_bigint.Bigint.t_BigInt):Core.Ops.Bit.Shr.t_Output = bigint <<. i in - ((Num_bigint.Bigint.to_bytes_le_under_impl_24 (tmp &. - (Num_traits.Identities.One.one <: Num_bigint.Bigint.t_BigInt) - <: - Num_bigint.Bigint.t_BigInt) - <: - (Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global)) - ._2.[ 0sz ] - <: - u8) =. - 1uy - -let impl: Core.Convert.t_From t_RandomCanvas Num_bigint.Biguint.t_BigUint = - { - from - = - fun (x: Num_bigint.Biguint.t_BigUint) -> - Core.Convert.From.from (Core.Convert.From.from x <: Num_bigint.Bigint.t_BigInt) - } - -let impl: Core.Convert.t_From t_RandomCanvas Num_bigint.Bigint.t_BigInt = - { - from - = - fun (x: Num_bigint.Bigint.t_BigInt) -> - let max_value:Num_bigint.Bigint.t_BigInt = max_under_impl_83 in - let _:Prims.unit = - if ~.(x <=. max_value <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = - [""; " is too large for type RandomCanvas!"] - in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let sign, repr:(Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) = - Num_bigint.Bigint.to_bytes_be_under_impl_24 x - in - let _:Prims.unit = - if Prims.op_AmpAmp (sign =. Num_bigint.Bigint.Sign_Minus) ~.false - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "Trying to convert a negative number into an unsigned integer!" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - let _:Prims.unit = - if (Alloc.Vec.len_under_impl_1 repr <: usize) >. ((384sz +. 7sz <: usize) /. 8sz <: usize) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = - [""; " is too large for type RandomCanvas"] - in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let out:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in - let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize out <: slice u8) in - let lower:usize = upper -. (Alloc.Vec.len_under_impl_1 repr <: usize) in - let _:Prims.unit = - Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" - "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (out),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(core::ops::deref::Deref::deref(&(deref(&(repr)))))),\n )" - - in - { - Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_b = out; - Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_sign = sign; - Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_signed = false - } - } - -let impl: Core.Default.t_Default t_RandomCanvas = - { - default - = - fun -> - { - Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_b = Rust_primitives.Hax.repeat 0uy 48sz; - Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_sign = Num_bigint.Bigint.Sign_Plus; - Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_signed = false - } - } - -let impl: Core.Convert.t_Into t_RandomCanvas Num_bigint.Bigint.t_BigInt = - { - into - = - fun (self: t_RandomCanvas) -> - Num_bigint.Bigint.from_bytes_be_under_impl_24 self - .Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_sign - (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_b <: slice u8) - } - -let impl: Core.Convert.t_Into t_RandomCanvas Num_bigint.Biguint.t_BigUint = - { - into - = - fun (self: t_RandomCanvas) -> - Num_bigint.Biguint.from_bytes_be_under_impl_18 (Rust_primitives.unsize self - .Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_b - <: - slice u8) - } - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -let from_hex_under_impl_82 (s: string) : t_RandomCanvas = - Core.Convert.Into.into (Num_bigint.Bigint.from_bytes_be_under_impl_24 Num_bigint.Bigint.Sign_Plus - (Core.Ops.Deref.Deref.deref (hex_string_to_bytes_under_impl_83 s - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - Num_bigint.Bigint.t_BigInt) - -let from_be_bytes_under_impl_82 (v: slice u8) : t_RandomCanvas = - let _:Prims.unit = - if true - then - let _:Prims.unit = - if - ~.((Core.Slice.len_under_impl v <: usize) <=. ((384sz +. 7sz <: usize) /. 8sz <: usize) - <: - bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - () - in - let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in - let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize repr <: slice u8) in - let lower:usize = upper -. (Core.Slice.len_under_impl v <: usize) in - let _:Prims.unit = - Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" - "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(deref(&(v)))),\n )" - - in - { - Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_b = repr; - Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_sign = Num_bigint.Bigint.Sign_Plus; - Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_signed = false - } - -let from_le_bytes_under_impl_82 (v: slice u8) : t_RandomCanvas = - let _:Prims.unit = - if true - then - let _:Prims.unit = - if - ~.((Core.Slice.len_under_impl v <: usize) <=. ((384sz +. 7sz <: usize) /. 8sz <: usize) - <: - bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - () - in - let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in - let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize repr <: slice u8) in - let lower:usize = upper -. (Core.Slice.len_under_impl v <: usize) in - let _:Prims.unit = - Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" - "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(deref(&(v)))),\n )" - - in - Core.Convert.Into.into (Num_bigint.Bigint.from_bytes_le_under_impl_24 Num_bigint.Bigint.Sign_Plus - (Rust_primitives.unsize repr <: slice u8) - <: - Num_bigint.Bigint.t_BigInt) - -let to_be_bytes_under_impl_82 (self: t_RandomCanvas) : array u8 48sz = - self.Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_b - -let to_le_bytes_under_impl_82 (self: t_RandomCanvas) : array u8 48sz = - let x:Num_bigint.Bigint.t_BigInt = - Num_bigint.Bigint.from_bytes_be_under_impl_24 Num_bigint.Bigint.Sign_Plus - (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_b <: slice u8) - in - let _, x_s:(Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) = - Num_bigint.Bigint.to_bytes_le_under_impl_24 x - in - let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in - let _:Prims.unit = - Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" - "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: 0,\n f_end: alloc::vec::len_under_impl_1(&(x_s)),\n },\n ))),\n &(deref(core::ops::deref::Deref::deref(&(deref(&(x_s)))))),\n )" - - in - repr - -let comp_eq_under_impl_82 (self rhs: t_RandomCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a =. b - then - let one:t_RandomCanvas = from_literal_under_impl_83 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_ne_under_impl_82 (self rhs: t_RandomCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a <>. b - then - let one:t_RandomCanvas = from_literal_under_impl_83 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_gte_under_impl_82 (self rhs: t_RandomCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a >=. b - then - let one:t_RandomCanvas = from_literal_under_impl_83 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_gt_under_impl_82 (self rhs: t_RandomCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a >. b - then - let one:t_RandomCanvas = from_literal_under_impl_83 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_lte_under_impl_82 (self rhs: t_RandomCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a <=. b - then - let one:t_RandomCanvas = from_literal_under_impl_83 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_lt_under_impl_82 (self rhs: t_RandomCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a <. b - then - let one:t_RandomCanvas = from_literal_under_impl_83 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let inv_under_impl_94 (self modval: t_RandomCanvas) : t_RandomCanvas = - let (biguintmodval: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into modval - in - let m:Core.Ops.Arith.Sub.t_Output = - biguintmodval -. (Core.Convert.From.from 2ul <: Num_bigint.Bigint.t_BigInt) - in - let (s: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - Core.Convert.Into.into (Num_bigint.Bigint.modpow_under_impl_24 s m biguintmodval - <: - Num_bigint.Bigint.t_BigInt) - -let pow_felem_under_impl_94 (self exp modval: t_RandomCanvas) : t_RandomCanvas = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into exp in - let (m: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into modval in - let (c: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Num_bigint.Bigint.modpow_under_impl_24 a b m - in - Core.Convert.Into.into c - -let pow_under_impl_94 (self: t_RandomCanvas) (exp: u128) (modval: t_RandomCanvas) : t_RandomCanvas = - pow_felem_under_impl_94 self - (Core.Convert.Into.into (Core.Convert.From.from exp <: Num_bigint.Bigint.t_BigInt) - <: - t_RandomCanvas) - modval - -let rem_under_impl_94 (self n: t_RandomCanvas) : Core.Ops.Arith.Rem.t_Output = self %. n - -let impl: Core.Ops.Arith.t_Add t_RandomCanvas t_RandomCanvas = - { - output = t_RandomCanvas; - add - = - fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let c:Core.Ops.Arith.Add.t_Output = a +. b in - let _:Prims.unit = - if c >. (max_under_impl_83 <: Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = - ["bounded addition overflow for type RandomCanvas"] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Arith.t_Sub t_RandomCanvas t_RandomCanvas = - { - output = t_RandomCanvas; - sub - = - fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let c:Core.Ops.Arith.Sub.t_Output = - if self.Hacspec_ovn.Schnorr.Random_oracle.RandomCanvas.f_signed - then a -. b - else - Core.Option.unwrap_or_else_under_impl (Num_bigint.Bigint.checked_sub_under_impl_24 a b - <: - Core.Option.t_Option Num_bigint.Bigint.t_BigInt) - (fun -> - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = - ["bounded substraction underflow for type RandomCanvas"] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - <: - Num_bigint.Bigint.t_BigInt) - in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Arith.t_Mul t_RandomCanvas t_RandomCanvas = - { - output = t_RandomCanvas; - mul - = - fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let c:Core.Ops.Arith.Mul.t_Output = a *. b in - let _:Prims.unit = - if c >. (max_under_impl_83 <: Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = - ["bounded multiplication overflow for type RandomCanvas"] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Arith.t_Div t_RandomCanvas t_RandomCanvas = - { - output = t_RandomCanvas; - div - = - fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let _:Prims.unit = - if b =. (Num_traits.Identities.Zero.zero <: Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = ["dividing by zero in type RandomCanvas"] in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let c:Core.Ops.Arith.Div.t_Output = a /. b in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Arith.t_Rem t_RandomCanvas t_RandomCanvas = - { - output = t_RandomCanvas; - rem - = - fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let _:Prims.unit = - if b =. (Num_traits.Identities.Zero.zero <: Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = ["dividing by zero in type RandomCanvas"] in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let c:Core.Ops.Arith.Rem.t_Output = a %. b in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Bit.t_Not t_RandomCanvas = - { - output = t_RandomCanvas; - not - = - fun (self: t_RandomCanvas) -> - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "not implemented" - <: - Rust_primitives.Hax.t_Never) - } - -let impl: Core.Ops.Bit.t_BitOr t_RandomCanvas t_RandomCanvas = - { - output = t_RandomCanvas; - bitor - = - fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a |. b <: Core.Ops.Bit.BitOr.t_Output) - } - -let impl: Core.Ops.Bit.t_BitXor t_RandomCanvas t_RandomCanvas = - { - output = t_RandomCanvas; - bitxor - = - fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a ^. b <: Core.Ops.Bit.BitXor.t_Output) - } - -let impl: Core.Ops.Bit.t_BitAnd t_RandomCanvas t_RandomCanvas = - { - output = t_RandomCanvas; - bitand - = - fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a &. b <: Core.Ops.Bit.BitAnd.t_Output) - } - -let impl: Core.Ops.Bit.t_Shr t_RandomCanvas usize = - { - output = t_RandomCanvas; - shr - = - fun (self: t_RandomCanvas) (rhs: usize) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let b:usize = rhs in - Core.Convert.Into.into (a <<. b <: Core.Ops.Bit.Shr.t_Output) - } - -let impl: Core.Ops.Bit.t_Shl t_RandomCanvas usize = - { - output = t_RandomCanvas; - shl - = - fun (self: t_RandomCanvas) (rhs: usize) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let b:usize = rhs in - Core.Convert.Into.into (a >>. b <: Core.Ops.Bit.Shl.t_Output) - } - -let impl: Core.Cmp.t_PartialEq t_RandomCanvas t_RandomCanvas = - { - eq - = - fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - a =. b - } - -let impl: Core.Cmp.t_Eq t_RandomCanvas = { } - -let impl: Core.Cmp.t_PartialOrd t_RandomCanvas t_RandomCanvas = - { - partial_cmp - = - fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into other - in - Core.Cmp.PartialOrd.partial_cmp a b - } - -let impl: Core.Cmp.t_Ord t_RandomCanvas = - { - cmp - = - fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> - Core.Option.unwrap_under_impl (Core.Cmp.PartialOrd.partial_cmp self other - <: - Core.Option.t_Option Core.Cmp.t_Ordering) - } - -let from_byte_seq_be_under_impl_75 (s: a) : t_RandomCanvas = - from_be_bytes_under_impl_82 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (Secret_integers.t_U8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - -let from_public_byte_seq_be_under_impl_75 (s: a) : t_RandomCanvas = - from_be_bytes_under_impl_82 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> x) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - -let to_byte_seq_be_under_impl_75 (self: t_RandomCanvas) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map - (Core.Slice.iter_under_impl (Rust_primitives.unsize (to_be_bytes_under_impl_82 self - <: - array u8 48sz) - <: - slice u8) - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) - <: - Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) - -let impl: Hacspec_lib.Traits.t_NumericCopy t_RandomCanvas = { } - -let impl: Hacspec_lib.Traits.t_UnsignedInteger t_RandomCanvas = { } - -let impl: Hacspec_lib.Traits.t_UnsignedIntegerCopy t_RandomCanvas = { } - -let impl: Hacspec_lib.Traits.t_Integer t_RandomCanvas = - { - nUM_BITS = (fun -> 384sz); - zERO = (fun -> from_literal_under_impl_83 (pub_u128 0sz)); - oNE = (fun -> from_literal_under_impl_83 (pub_u128 1sz)); - tWO = (fun -> from_literal_under_impl_83 (pub_u128 2sz)); - from_literal = (fun (v_val: u128) -> from_literal_under_impl_83 v_val); - from_hex_string - = - (fun (s: Alloc.String.t_String) -> - from_hex_under_impl_82 (Core.Ops.Deref.Deref.deref (Alloc.Str.replace_under_impl_5 (Core.Ops.Deref.Deref.deref - s - <: - string) - "0x" - "" - <: - Alloc.String.t_String) - <: - string)); - get_bit - = - (fun (self: t_RandomCanvas) (i: usize) -> - (self <<. i <: Core.Ops.Bit.Shr.t_Output) &. - (Hacspec_lib.Traits.Integer.v_ONE <: t_RandomCanvas)); - set_bit - = - (fun (self: t_RandomCanvas) (b: t_RandomCanvas) (i: usize) -> - let _:Prims.unit = - if true - then - let _:Prims.unit = - if - ~.(Prims.op_BarBar (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b - <: - t_RandomCanvas) - (Hacspec_lib.Traits.Integer.v_ONE <: t_RandomCanvas) - <: - bool) - (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b <: t_RandomCanvas) - (Hacspec_lib.Traits.Integer.v_ZERO <: t_RandomCanvas) - <: - bool)) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO())" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - () - in - let tmp1:t_RandomCanvas = - from_literal_under_impl_83 (~.(pub_u128 1sz >>. i <: u128) <: u128) - in - let tmp2:Core.Ops.Bit.Shl.t_Output = b >>. i in - (self &. tmp1 <: Core.Ops.Bit.BitAnd.t_Output) |. tmp2); - set - = - (fun (self: t_RandomCanvas) (pos: usize) (y: t_RandomCanvas) (yi: usize) -> - let b:t_RandomCanvas = Hacspec_lib.Traits.Integer.get_bit y yi in - Hacspec_lib.Traits.Integer.set_bit self b pos); - rotate_left - = - (fun (self: t_RandomCanvas) (n: usize) -> - let _:Prims.unit = - if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - ((Core.Clone.Clone.clone self <: t_RandomCanvas) >>. n <: Core.Ops.Bit.Shl.t_Output) |. - (self <<. - (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. - (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) - <: - usize) - <: - Core.Ops.Bit.Shr.t_Output)); - rotate_right - = - fun (self: t_RandomCanvas) (n: usize) -> - let _:Prims.unit = - if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - ((Core.Clone.Clone.clone self <: t_RandomCanvas) <<. n <: Core.Ops.Bit.Shr.t_Output) |. - (self >>. - (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. - (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) - <: - usize) - <: - Core.Ops.Bit.Shl.t_Output) - } - -let impl: Hacspec_lib.Traits.t_ModNumeric t_RandomCanvas = - { - sub_mod - = - (fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) (n: t_RandomCanvas) -> - (self -. rhs <: Core.Ops.Arith.Sub.t_Output) %. n); - add_mod - = - (fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) (n: t_RandomCanvas) -> - (self +. rhs <: Core.Ops.Arith.Add.t_Output) %. n); - mul_mod - = - (fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) (n: t_RandomCanvas) -> - (self *. rhs <: Core.Ops.Arith.Mul.t_Output) %. n); - pow_mod - = - (fun (self: t_RandomCanvas) (exp: t_RandomCanvas) (n: t_RandomCanvas) -> - pow_felem_under_impl_94 self exp n); - modulo = (fun (self: t_RandomCanvas) (n: t_RandomCanvas) -> self %. n); - signed_modulo - = - (fun (self: t_RandomCanvas) (n: t_RandomCanvas) -> Hacspec_lib.Traits.ModNumeric.modulo self n); - absolute = fun (self: t_RandomCanvas) -> self - } - -let impl: Hacspec_lib.Traits.t_Numeric t_RandomCanvas = - { - max_val = (fun -> max_value_under_impl_83); - wrap_add = (fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> self +. rhs); - wrap_sub = (fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> self -. rhs); - wrap_mul = (fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> self *. rhs); - wrap_div = (fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> self /. rhs); - exp - = - (fun (self: t_RandomCanvas) (exp: u32) -> - pow_under_impl_94 self - (Core.Convert.Into.into exp <: u128) - (Hacspec_lib.Traits.Numeric.max_val <: t_RandomCanvas)); - pow_self - = - (fun (self: t_RandomCanvas) (exp: t_RandomCanvas) -> - pow_felem_under_impl_94 self - (Core.Convert.Into.into exp <: t_RandomCanvas) - (Hacspec_lib.Traits.Numeric.max_val <: t_RandomCanvas)); - divide = (fun (self: t_RandomCanvas) (rhs: t_RandomCanvas) -> self /. rhs); - inv = (fun (self: t_RandomCanvas) (n: t_RandomCanvas) -> inv_under_impl_94 self n); - equal = (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> self =. other); - greater_than = (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> self >. other); - greater_than_or_equal = (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> self >=. other); - less_than = (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> self <. other); - less_than_or_equal = (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> self >=. other); - not_equal_bm - = - (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> - if ~.(Hacspec_lib.Traits.Numeric.equal self other <: bool) - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_83 (pub_u128 0sz)); - equal_bm - = - (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> - if Hacspec_lib.Traits.Numeric.equal self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_83 (pub_u128 0sz)); - greater_than_bm - = - (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> - if Hacspec_lib.Traits.Numeric.greater_than self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_83 (pub_u128 0sz)); - greater_than_or_equal_bm - = - (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> - if Hacspec_lib.Traits.Numeric.greater_than_or_equal self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_83 (pub_u128 0sz)); - less_than_bm - = - (fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> - if Hacspec_lib.Traits.Numeric.less_than self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_83 (pub_u128 0sz)); - less_than_or_equal_bm - = - fun (self: t_RandomCanvas) (other: t_RandomCanvas) -> - if Hacspec_lib.Traits.Numeric.less_than_or_equal self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_83 (pub_u128 0sz) - } - -type t_Random = | Random : t_RandomCanvas -> t_Random - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -let impl: Core.Convert.t_From t_Random t_RandomCanvas = - { - from - = - fun (x: t_RandomCanvas) -> - Random - (rem_under_impl_94 x - (from_hex_under_impl_82 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_RandomCanvas)) - } - -let impl: Core.Convert.t_Into t_Random t_RandomCanvas = - { into = fun (self: t_Random) -> self.Hacspec_ovn.Schnorr.Random_oracle.Random.0 } - -let from_canvas_under_impl_131 (x: t_RandomCanvas) : t_Random = - Random - (rem_under_impl_94 x - (from_hex_under_impl_82 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_RandomCanvas)) - -let into_canvas_under_impl_131 (self: t_Random) : t_RandomCanvas = - self.Hacspec_ovn.Schnorr.Random_oracle.Random.0 - -let max_under_impl_131: t_RandomCanvas = - from_hex_under_impl_82 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - -let declassify_under_impl_131 (self: t_Random) : Num_bigint.Bigint.t_BigInt = - let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into a - -let from_hex_under_impl_131 (s: string) : t_Random = - Core.Convert.Into.into (from_hex_under_impl_82 s <: t_RandomCanvas) - -let from_be_bytes_under_impl_131 (v: slice u8) : t_Random = - Core.Convert.Into.into (from_be_bytes_under_impl_82 v <: t_RandomCanvas) - -let to_be_bytes_under_impl_131 (self: t_Random) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = - Alloc.Slice.to_vec_under_impl (Rust_primitives.unsize (to_be_bytes_under_impl_82 (Core.Convert.Into.into - self - <: - t_RandomCanvas) - <: - array u8 48sz) - <: - slice u8) - -let from_le_bytes_under_impl_131 (v: slice u8) : t_Random = - Core.Convert.Into.into (from_le_bytes_under_impl_82 v <: t_RandomCanvas) - -let to_le_bytes_under_impl_131 (self: t_Random) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = - Alloc.Slice.to_vec_under_impl (Rust_primitives.unsize (to_le_bytes_under_impl_82 (Core.Convert.Into.into - self - <: - t_RandomCanvas) - <: - array u8 48sz) - <: - slice u8) - -let bit_under_impl_131 (self: t_Random) (i: usize) : bool = - bit_under_impl_83 (Core.Convert.Into.into self <: t_RandomCanvas) i - -let from_literal_under_impl_131 (x: u128) : t_Random = - let big_x:Num_bigint.Biguint.t_BigUint = Core.Convert.From.from x in - let _:Prims.unit = - if - big_x >. - (Core.Convert.Into.into (max_under_impl_131 <: t_RandomCanvas) <: Num_bigint.Biguint.t_BigUint - ) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["literal "; " too big for type Random"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Random (Core.Convert.Into.into big_x) - -let from_signed_literal_under_impl_131 (x: i128) : t_Random = - let big_x:Num_bigint.Biguint.t_BigUint = Core.Convert.From.from (cast x) in - let _:Prims.unit = - if - big_x >. - (Core.Convert.Into.into (max_under_impl_131 <: t_RandomCanvas) <: Num_bigint.Biguint.t_BigUint - ) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["literal "; " too big for type Random"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Random (Core.Convert.Into.into big_x) - -let comp_eq_under_impl_131 (self rhs: t_Random) : t_Random = - let (x: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_eq_under_impl_82 x (Core.Convert.Into.into rhs <: t_RandomCanvas) - <: - t_RandomCanvas) - -let comp_ne_under_impl_131 (self rhs: t_Random) : t_Random = - let (x: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_ne_under_impl_82 x (Core.Convert.Into.into rhs <: t_RandomCanvas) - <: - t_RandomCanvas) - -let comp_gte_under_impl_131 (self rhs: t_Random) : t_Random = - let (x: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_gte_under_impl_82 x (Core.Convert.Into.into rhs <: t_RandomCanvas) - <: - t_RandomCanvas) - -let comp_gt_under_impl_131 (self rhs: t_Random) : t_Random = - let (x: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_gt_under_impl_82 x (Core.Convert.Into.into rhs <: t_RandomCanvas) - <: - t_RandomCanvas) - -let comp_lte_under_impl_131 (self rhs: t_Random) : t_Random = - let (x: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_lte_under_impl_82 x (Core.Convert.Into.into rhs <: t_RandomCanvas) - <: - t_RandomCanvas) - -let comp_lt_under_impl_131 (self rhs: t_Random) : t_Random = - let (x: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_lt_under_impl_82 x (Core.Convert.Into.into rhs <: t_RandomCanvas) - <: - t_RandomCanvas) - -let neg_under_impl_131 (self: t_Random) : t_Random = - let (mod_val: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into (from_hex_under_impl_82 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_RandomCanvas) - in - let (s: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - let (s: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into s in - let (result: t_RandomCanvas):t_RandomCanvas = - Core.Convert.Into.into (mod_val -. s <: Core.Ops.Arith.Sub.t_Output) - in - Core.Convert.Into.into result - -let impl: Core.Cmp.t_PartialOrd t_Random t_Random = - { - partial_cmp - = - fun (self: t_Random) (other: t_Random) -> Core.Option.Option_Some (Core.Cmp.Ord.cmp self other) - } - -let impl: Core.Cmp.t_Ord t_Random = - { - cmp - = - fun (self: t_Random) (other: t_Random) -> - Core.Cmp.Ord.cmp self.Hacspec_ovn.Schnorr.Random_oracle.Random.0 - other.Hacspec_ovn.Schnorr.Random_oracle.Random.0 - } - -let impl: Core.Cmp.t_PartialEq t_Random t_Random = - { - eq - = - fun (self: t_Random) (other: t_Random) -> - self.Hacspec_ovn.Schnorr.Random_oracle.Random.0 =. - other.Hacspec_ovn.Schnorr.Random_oracle.Random.0 - } - -let impl: Core.Cmp.t_Eq t_Random = { } - -let impl: Core.Ops.Arith.t_Add t_Random t_Random = - { - output = t_Random; - add - = - fun (self: t_Random) (rhs: t_Random) -> - let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - let (b: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into rhs in - let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into a - in - let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into b - in - let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Add.t_Output = a +. b in - let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into (from_hex_under_impl_82 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_RandomCanvas) - in - let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in - let (d: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into d in - Core.Convert.Into.into d - } - -let impl: Core.Ops.Arith.t_Sub t_Random t_Random = - { - output = t_Random; - sub - = - fun (self: t_Random) (rhs: t_Random) -> - let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - let (b: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into rhs in - let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into a - in - let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into b - in - let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into (from_hex_under_impl_82 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_RandomCanvas) - in - let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Add.t_Output = - if b >. a - then - ((Core.Clone.Clone.clone max <: Num_bigint.Biguint.t_BigUint) -. b - <: - Core.Ops.Arith.Sub.t_Output) +. - a - else a -. b - in - let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in - let (d: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into d in - Core.Convert.Into.into d - } - -let impl: Core.Ops.Arith.t_Mul t_Random t_Random = - { - output = t_Random; - mul - = - fun (self: t_Random) (rhs: t_Random) -> - let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - let (b: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into rhs in - let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into a - in - let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into b - in - let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Mul.t_Output = a *. b in - let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into (from_hex_under_impl_82 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_RandomCanvas) - in - let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in - let (d: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into d in - Core.Convert.Into.into d - } - -let impl: Core.Ops.Arith.t_Div t_Random t_Random = - { - output = t_Random; - div = fun (self: t_Random) (rhs: t_Random) -> self *. (inv_under_impl_125 rhs <: t_Random) - } - -let impl: Core.Ops.Arith.t_Rem t_Random t_Random = - { - output = t_Random; - rem - = - fun (self: t_Random) (rhs: t_Random) -> - let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - let (b: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into rhs in - let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into a - in - let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into b - in - let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = a %. b in - let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into (from_hex_under_impl_82 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_RandomCanvas) - in - let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in - let (d: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into d in - Core.Convert.Into.into d - } - -let impl: Core.Ops.Bit.t_Not t_Random = - { - output = t_Random; - not - = - fun (self: t_Random) -> - let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (~.a <: Core.Ops.Bit.Not.t_Output) - } - -let impl: Core.Ops.Bit.t_BitOr t_Random t_Random = - { - output = t_Random; - bitor - = - fun (self: t_Random) (rhs: t_Random) -> - let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - let (b: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a |. b <: Core.Ops.Bit.BitOr.t_Output) - } - -let impl: Core.Ops.Bit.t_BitXor t_Random t_Random = - { - output = t_Random; - bitxor - = - fun (self: t_Random) (rhs: t_Random) -> - let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - let (b: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a ^. b <: Core.Ops.Bit.BitXor.t_Output) - } - -let impl: Core.Ops.Bit.t_BitAnd t_Random t_Random = - { - output = t_Random; - bitand - = - fun (self: t_Random) (rhs: t_Random) -> - let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - let (b: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a &. b <: Core.Ops.Bit.BitAnd.t_Output) - } - -let impl: Core.Ops.Bit.t_Shr t_Random usize = - { - output = t_Random; - shr - = - fun (self: t_Random) (rhs: usize) -> - let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (a <<. rhs <: Core.Ops.Bit.Shr.t_Output) - } - -let impl: Core.Ops.Bit.t_Shl t_Random usize = - { - output = t_Random; - shl - = - fun (self: t_Random) (rhs: usize) -> - let (a: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (a >>. rhs <: Core.Ops.Bit.Shl.t_Output) - } - -let inv_under_impl_125 (self: t_Random) : t_Random = - let (base: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (inv_under_impl_94 base (max_under_impl_131 <: t_RandomCanvas) - <: - t_RandomCanvas) - -let pow_felem_under_impl_125 (self exp: t_Random) : t_Random = - let (base: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (pow_felem_under_impl_94 base - (Core.Convert.Into.into exp <: t_RandomCanvas) - (max_under_impl_131 <: t_RandomCanvas) - <: - t_RandomCanvas) - -let pow_under_impl_125 (self: t_Random) (exp: u128) : t_Random = - let (base: t_RandomCanvas):t_RandomCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (pow_under_impl_94 base exp (max_under_impl_131 <: t_RandomCanvas) - <: - t_RandomCanvas) - -let pow2_under_impl_125 (x: usize) : t_Random = - Core.Convert.Into.into (pow2_under_impl_83 x <: t_RandomCanvas) - -let from_byte_seq_be_under_impl_68 (s: a) : t_Random = - Core.Convert.Into.into (from_be_bytes_under_impl_82 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (Secret_integers.t_U8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - t_RandomCanvas) - -let from_public_byte_seq_be_under_impl_68 (s: a) : t_Random = - Core.Convert.Into.into (from_be_bytes_under_impl_82 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> x) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - t_RandomCanvas) - -let to_byte_seq_be_under_impl_68 (self: t_Random) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map - (Core.Slice.iter_under_impl (Core.Ops.Deref.Deref.deref (to_be_bytes_under_impl_131 self - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) - <: - Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) - -let to_public_byte_seq_be_under_impl_68 (self: t_Random) : Hacspec_lib.Seq.t_Seq u8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (to_be_bytes_under_impl_131 self - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - -let from_byte_seq_le_under_impl_68 (s: a) : t_Random = - Core.Convert.Into.into (from_le_bytes_under_impl_82 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (Secret_integers.t_U8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - t_RandomCanvas) - -let from_public_byte_seq_le_under_impl_68 (s: a) : t_Random = - Core.Convert.Into.into (from_le_bytes_under_impl_82 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> x) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - t_RandomCanvas) - -let to_byte_seq_le_under_impl_68 (self: t_Random) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map - (Core.Slice.iter_under_impl (Core.Ops.Deref.Deref.deref (to_le_bytes_under_impl_131 self - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) - <: - Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) - -let to_public_byte_seq_le_under_impl_68 (self: t_Random) : Hacspec_lib.Seq.t_Seq u8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (to_le_bytes_under_impl_131 self - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - -let from_secret_literal_under_impl_68 (x: Secret_integers.t_U128) : t_Random = - Core.Convert.Into.into (from_literal_under_impl_83 (Secret_integers.declassify_under_impl_126 x - <: - u128) - <: - t_RandomCanvas) - -let impl: Hacspec_lib.Traits.t_NumericCopy t_Random = { } - -let impl: Hacspec_lib.Traits.t_UnsignedInteger t_Random = { } - -let impl: Hacspec_lib.Traits.t_UnsignedIntegerCopy t_Random = { } - -let impl: Hacspec_lib.Traits.t_Integer t_Random = - { - nUM_BITS = (fun -> 384sz); - zERO = (fun -> from_literal_under_impl_131 (pub_u128 0sz)); - oNE = (fun -> from_literal_under_impl_131 (pub_u128 1sz)); - tWO = (fun -> from_literal_under_impl_131 (pub_u128 2sz)); - from_literal = (fun (v_val: u128) -> from_literal_under_impl_131 v_val); - from_hex_string - = - (fun (s: Alloc.String.t_String) -> - from_hex_under_impl_131 (Core.Ops.Deref.Deref.deref (Alloc.Str.replace_under_impl_5 (Core.Ops.Deref.Deref.deref - s - <: - string) - "0x" - "" - <: - Alloc.String.t_String) - <: - string)); - get_bit - = - (fun (self: t_Random) (i: usize) -> - (self <<. i <: Core.Ops.Bit.Shr.t_Output) &. (Hacspec_lib.Traits.Integer.v_ONE <: t_Random)); - set_bit - = - (fun (self: t_Random) (b: t_Random) (i: usize) -> - let _:Prims.unit = - if true - then - let _:Prims.unit = - if - ~.(Prims.op_BarBar (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b - <: - t_Random) - (Hacspec_lib.Traits.Integer.v_ONE <: t_Random) - <: - bool) - (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b <: t_Random) - (Hacspec_lib.Traits.Integer.v_ZERO <: t_Random) - <: - bool)) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO())" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - () - in - let tmp1:t_Random = from_literal_under_impl_131 (~.(pub_u128 1sz >>. i <: u128) <: u128) in - let tmp2:Core.Ops.Bit.Shl.t_Output = b >>. i in - (self &. tmp1 <: Core.Ops.Bit.BitAnd.t_Output) |. tmp2); - set - = - (fun (self: t_Random) (pos: usize) (y: t_Random) (yi: usize) -> - let b:t_Random = Hacspec_lib.Traits.Integer.get_bit y yi in - Hacspec_lib.Traits.Integer.set_bit self b pos); - rotate_left - = - (fun (self: t_Random) (n: usize) -> - let _:Prims.unit = - if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - ((Core.Clone.Clone.clone self <: t_Random) >>. n <: Core.Ops.Bit.Shl.t_Output) |. - (self <<. - (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. - (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) - <: - usize) - <: - Core.Ops.Bit.Shr.t_Output)); - rotate_right - = - fun (self: t_Random) (n: usize) -> - let _:Prims.unit = - if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - ((Core.Clone.Clone.clone self <: t_Random) <<. n <: Core.Ops.Bit.Shr.t_Output) |. - (self >>. - (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. - (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) - <: - usize) - <: - Core.Ops.Bit.Shl.t_Output) - } - -let impl: Hacspec_lib.Traits.t_ModNumeric t_Random = - { - sub_mod = (fun (self: t_Random) (rhs: t_Random) (n: t_Random) -> self -. rhs); - add_mod = (fun (self: t_Random) (rhs: t_Random) (n: t_Random) -> self +. rhs); - mul_mod = (fun (self: t_Random) (rhs: t_Random) (n: t_Random) -> self *. rhs); - pow_mod - = - (fun (self: t_Random) (exp: t_Random) (n: t_Random) -> pow_felem_under_impl_125 self exp); - modulo = (fun (self: t_Random) (n: t_Random) -> self %. n); - signed_modulo - = - (fun (self: t_Random) (n: t_Random) -> Hacspec_lib.Traits.ModNumeric.modulo self n); - absolute = fun (self: t_Random) -> self - } - -let impl: Hacspec_lib.Traits.t_Numeric t_Random = - { - max_val - = - (fun -> - Core.Convert.Into.into ((max_under_impl_131 <: t_RandomCanvas) -. - (from_literal_under_impl_83 (pub_u128 1sz) <: t_RandomCanvas) - <: - Core.Ops.Arith.Sub.t_Output)); - wrap_add = (fun (self: t_Random) (rhs: t_Random) -> self +. rhs); - wrap_sub = (fun (self: t_Random) (rhs: t_Random) -> self -. rhs); - wrap_mul = (fun (self: t_Random) (rhs: t_Random) -> self *. rhs); - wrap_div = (fun (self: t_Random) (rhs: t_Random) -> self /. rhs); - exp - = - (fun (self: t_Random) (exp: u32) -> pow_under_impl_125 self (Core.Convert.Into.into exp <: u128) - ); - pow_self = (fun (self: t_Random) (exp: t_Random) -> pow_felem_under_impl_125 self exp); - divide = (fun (self: t_Random) (rhs: t_Random) -> self /. rhs); - inv = (fun (self: t_Random) (n: t_Random) -> inv_under_impl_125 self); - equal = (fun (self: t_Random) (other: t_Random) -> self =. other); - greater_than = (fun (self: t_Random) (other: t_Random) -> self >. other); - greater_than_or_equal = (fun (self: t_Random) (other: t_Random) -> self >=. other); - less_than = (fun (self: t_Random) (other: t_Random) -> self <. other); - less_than_or_equal = (fun (self: t_Random) (other: t_Random) -> self <=. other); - not_equal_bm - = - (fun (self: t_Random) (other: t_Random) -> - if self <>. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_Random) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_Random) - else Hacspec_lib.Traits.Integer.v_ZERO); - equal_bm - = - (fun (self: t_Random) (other: t_Random) -> - if self =. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_Random) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_Random) - else Hacspec_lib.Traits.Integer.v_ZERO); - greater_than_bm - = - (fun (self: t_Random) (other: t_Random) -> - if self >. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_Random) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_Random) - else Hacspec_lib.Traits.Integer.v_ZERO); - greater_than_or_equal_bm - = - (fun (self: t_Random) (other: t_Random) -> - if self >=. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_Random) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_Random) - else Hacspec_lib.Traits.Integer.v_ZERO); - less_than_bm - = - (fun (self: t_Random) (other: t_Random) -> - if self <. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_Random) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_Random) - else Hacspec_lib.Traits.Integer.v_ZERO); - less_than_or_equal_bm - = - fun (self: t_Random) (other: t_Random) -> - if self <=. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_Random) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_Random) - else Hacspec_lib.Traits.Integer.v_ZERO - } - -let sample_uniform: t_Random = Hacspec_lib.Traits.Integer.v_ONE - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -let random_oracle_query - (v_QUERIES: - Std.Collections.Hash.Map.t_HashMap t_Query t_Random Std.Collections.Hash.Map.t_RandomState - ) - (q: t_Query) - : (Std.Collections.Hash.Map.t_HashMap t_Query t_Random Std.Collections.Hash.Map.t_RandomState & - t_Random) = - match Std.Collections.Hash.Map.get_under_impl_2 v_QUERIES q with - | Core.Option.Option_Some r -> Core.Clone.Clone.clone v_QUERIES, Core.Clone.Clone.clone r - | Core.Option.Option_None -> - let r:t_Random = sample_uniform in - let todo_fresh_var, v_QUERIES_temp:(Core.Option.t_Option t_Random & - Std.Collections.Hash.Map.t_HashMap t_Query t_Random Std.Collections.Hash.Map.t_RandomState) = - Std.Collections.Hash.Map.insert_under_impl_2 v_QUERIES q r - in - let v_QUERIES:Std.Collections.Hash.Map.t_HashMap t_Query - t_Random - Std.Collections.Hash.Map.t_RandomState = - v_QUERIES_temp - in - let _:Core.Option.t_Option t_Random = todo_fresh_var in - v_QUERIES, r \ No newline at end of file diff --git a/ovn/proofs/fstar/extraction/Hacspec_ovn.Schnorr.fst b/ovn/proofs/fstar/extraction/Hacspec_ovn.Schnorr.fst deleted file mode 100644 index 45c65e8..0000000 --- a/ovn/proofs/fstar/extraction/Hacspec_ovn.Schnorr.fst +++ /dev/null @@ -1,3704 +0,0 @@ -module Hacspec_ovn.Schnorr -#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" -open Core - -type t_GCanvas = { - f_b:array u8 48sz; - f_sign:Num_bigint.Bigint.t_Sign; - f_signed:bool -} - -let max_under_impl_15: Core.Ops.Arith.Sub.t_Output = - ((Core.Convert.From.from 1ul <: Num_bigint.Bigint.t_BigInt) >>. 384l <: Core.Ops.Bit.Shl.t_Output) -. - (Num_traits.Identities.One.one <: Num_bigint.Bigint.t_BigInt) - -let max_value_under_impl_15: t_GCanvas = - Core.Convert.From.from (max_under_impl_15 <: Num_bigint.Bigint.t_BigInt) - -let hex_string_to_bytes_under_impl_15 (s: string) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = - let s:Alloc.String.t_String = - if ((Core.Str.len_under_impl s <: usize) %. 2sz <: usize) <>. 0sz - then - let x:Alloc.String.t_String = Alloc.String.ToString.to_string "0" in - let x:Alloc.String.t_String = Alloc.String.push_str_under_impl x s in - x - else Alloc.String.ToString.to_string s - in - let _:Prims.unit = - if ~.(((Alloc.String.len_under_impl s <: usize) %. 2sz <: usize) =. 0sz <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["length of hex string "; ": "] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [ - Core.Fmt.Rt.new_display_under_impl_1 s <: Core.Fmt.Rt.t_Argument; - Core.Fmt.Rt.new_display_under_impl_1 (Alloc.String.len_under_impl s - <: - usize) - <: - Core.Fmt.Rt.t_Argument - ] - in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let - (b: Core.Result.t_Result (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) Core.Num.Error.t_ParseIntError):Core.Result.t_Result - (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) Core.Num.Error.t_ParseIntError = - Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map (Core.Iter.Traits.Iterator.Iterator.step_by - ({ - Core.Ops.Range.Range.f_start = 0sz; - Core.Ops.Range.Range.f_end = Alloc.String.len_under_impl s <: usize - }) - 2sz - <: - Core.Iter.Adapters.Step_by.t_StepBy (Core.Ops.Range.t_Range usize)) - (fun i -> - Core.Num.from_str_radix_under_impl_6 (s.[ { - Core.Ops.Range.Range.f_start = i; - Core.Ops.Range.Range.f_end = i +. 2sz <: usize - } ] - <: - string) - 16ul - <: - Core.Result.t_Result u8 Core.Num.Error.t_ParseIntError) - <: - Core.Iter.Adapters.Map.t_Map - (Core.Iter.Adapters.Step_by.t_StepBy (Core.Ops.Range.t_Range usize)) - (usize -> Core.Result.t_Result u8 Core.Num.Error.t_ParseIntError)) - in - Core.Result.expect_under_impl b "Error parsing hex string" - -let from_literal_under_impl_15 (x: u128) : t_GCanvas = - let big_x:Num_bigint.Bigint.t_BigInt = Core.Convert.From.from x in - let _:Prims.unit = - if - big_x >. - (Core.Convert.Into.into (max_under_impl_15 <: Num_bigint.Bigint.t_BigInt) - <: - Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["literal "; " too big for type GCanvas"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Core.Convert.Into.into big_x - -let from_signed_literal_under_impl_15 (x: i128) : t_GCanvas = - let big_x:Num_bigint.Bigint.t_BigInt = Core.Convert.From.from (cast x) in - let _:Prims.unit = - if - big_x >. - (Core.Convert.Into.into (max_under_impl_15 <: Num_bigint.Bigint.t_BigInt) - <: - Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["literal "; " too big for type GCanvas"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Core.Convert.Into.into big_x - -let pow2_under_impl_15 (x: usize) : t_GCanvas = - Core.Convert.Into.into ((Core.Convert.From.from 1ul <: Num_bigint.Bigint.t_BigInt) >>. x - <: - Core.Ops.Bit.Shl.t_Output) - -let bit_under_impl_15 (self: t_GCanvas) (i: usize) : bool = - let _:Prims.unit = - if - ~.(i <. - ((Core.Slice.len_under_impl (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.GCanvas.f_b - <: - slice u8) - <: - usize) *. - 8sz - <: - usize) - <: - bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = - [ - "the bit queried should be lower than the size of the integer representation: "; - " < " - ] - in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [ - Core.Fmt.Rt.new_display_under_impl_1 i <: Core.Fmt.Rt.t_Argument; - Core.Fmt.Rt.new_display_under_impl_1 ((Core.Slice.len_under_impl (Rust_primitives.unsize - self.Hacspec_ovn.Schnorr.GCanvas.f_b - <: - slice u8) - <: - usize) *. - 8sz - <: - usize) - <: - Core.Fmt.Rt.t_Argument - ] - in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let (bigint: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (tmp: Num_bigint.Bigint.t_BigInt):Core.Ops.Bit.Shr.t_Output = bigint <<. i in - ((Num_bigint.Bigint.to_bytes_le_under_impl_24 (tmp &. - (Num_traits.Identities.One.one <: Num_bigint.Bigint.t_BigInt) - <: - Num_bigint.Bigint.t_BigInt) - <: - (Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global)) - ._2.[ 0sz ] - <: - u8) =. - 1uy - -let impl: Core.Convert.t_From t_GCanvas Num_bigint.Biguint.t_BigUint = - { - from - = - fun (x: Num_bigint.Biguint.t_BigUint) -> - Core.Convert.From.from (Core.Convert.From.from x <: Num_bigint.Bigint.t_BigInt) - } - -let impl: Core.Convert.t_From t_GCanvas Num_bigint.Bigint.t_BigInt = - { - from - = - fun (x: Num_bigint.Bigint.t_BigInt) -> - let max_value:Num_bigint.Bigint.t_BigInt = max_under_impl_15 in - let _:Prims.unit = - if ~.(x <=. max_value <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = [""; " is too large for type GCanvas!"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let sign, repr:(Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) = - Num_bigint.Bigint.to_bytes_be_under_impl_24 x - in - let _:Prims.unit = - if Prims.op_AmpAmp (sign =. Num_bigint.Bigint.Sign_Minus) ~.false - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "Trying to convert a negative number into an unsigned integer!" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - let _:Prims.unit = - if (Alloc.Vec.len_under_impl_1 repr <: usize) >. ((384sz +. 7sz <: usize) /. 8sz <: usize) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = [""; " is too large for type GCanvas"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let out:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in - let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize out <: slice u8) in - let lower:usize = upper -. (Alloc.Vec.len_under_impl_1 repr <: usize) in - let _:Prims.unit = - Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" - "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (out),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(core::ops::deref::Deref::deref(&(deref(&(repr)))))),\n )" - - in - { - Hacspec_ovn.Schnorr.GCanvas.f_b = out; - Hacspec_ovn.Schnorr.GCanvas.f_sign = sign; - Hacspec_ovn.Schnorr.GCanvas.f_signed = false - } - } - -let impl: Core.Default.t_Default t_GCanvas = - { - default - = - fun -> - { - Hacspec_ovn.Schnorr.GCanvas.f_b = Rust_primitives.Hax.repeat 0uy 48sz; - Hacspec_ovn.Schnorr.GCanvas.f_sign = Num_bigint.Bigint.Sign_Plus; - Hacspec_ovn.Schnorr.GCanvas.f_signed = false - } - } - -let impl: Core.Convert.t_Into t_GCanvas Num_bigint.Bigint.t_BigInt = - { - into - = - fun (self: t_GCanvas) -> - Num_bigint.Bigint.from_bytes_be_under_impl_24 self.Hacspec_ovn.Schnorr.GCanvas.f_sign - (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.GCanvas.f_b <: slice u8) - } - -let impl: Core.Convert.t_Into t_GCanvas Num_bigint.Biguint.t_BigUint = - { - into - = - fun (self: t_GCanvas) -> - Num_bigint.Biguint.from_bytes_be_under_impl_18 (Rust_primitives.unsize self - .Hacspec_ovn.Schnorr.GCanvas.f_b - <: - slice u8) - } - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -let from_hex_under_impl_14 (s: string) : t_GCanvas = - Core.Convert.Into.into (Num_bigint.Bigint.from_bytes_be_under_impl_24 Num_bigint.Bigint.Sign_Plus - (Core.Ops.Deref.Deref.deref (hex_string_to_bytes_under_impl_15 s - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - Num_bigint.Bigint.t_BigInt) - -let from_be_bytes_under_impl_14 (v: slice u8) : t_GCanvas = - let _:Prims.unit = - if true - then - let _:Prims.unit = - if - ~.((Core.Slice.len_under_impl v <: usize) <=. ((384sz +. 7sz <: usize) /. 8sz <: usize) - <: - bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - () - in - let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in - let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize repr <: slice u8) in - let lower:usize = upper -. (Core.Slice.len_under_impl v <: usize) in - let _:Prims.unit = - Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" - "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(deref(&(v)))),\n )" - - in - { - Hacspec_ovn.Schnorr.GCanvas.f_b = repr; - Hacspec_ovn.Schnorr.GCanvas.f_sign = Num_bigint.Bigint.Sign_Plus; - Hacspec_ovn.Schnorr.GCanvas.f_signed = false - } - -let from_le_bytes_under_impl_14 (v: slice u8) : t_GCanvas = - let _:Prims.unit = - if true - then - let _:Prims.unit = - if - ~.((Core.Slice.len_under_impl v <: usize) <=. ((384sz +. 7sz <: usize) /. 8sz <: usize) - <: - bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - () - in - let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in - let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize repr <: slice u8) in - let lower:usize = upper -. (Core.Slice.len_under_impl v <: usize) in - let _:Prims.unit = - Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" - "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(deref(&(v)))),\n )" - - in - Core.Convert.Into.into (Num_bigint.Bigint.from_bytes_le_under_impl_24 Num_bigint.Bigint.Sign_Plus - (Rust_primitives.unsize repr <: slice u8) - <: - Num_bigint.Bigint.t_BigInt) - -let to_be_bytes_under_impl_14 (self: t_GCanvas) : array u8 48sz = - self.Hacspec_ovn.Schnorr.GCanvas.f_b - -let to_le_bytes_under_impl_14 (self: t_GCanvas) : array u8 48sz = - let x:Num_bigint.Bigint.t_BigInt = - Num_bigint.Bigint.from_bytes_be_under_impl_24 Num_bigint.Bigint.Sign_Plus - (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.GCanvas.f_b <: slice u8) - in - let _, x_s:(Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) = - Num_bigint.Bigint.to_bytes_le_under_impl_24 x - in - let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in - let _:Prims.unit = - Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" - "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: 0,\n f_end: alloc::vec::len_under_impl_1(&(x_s)),\n },\n ))),\n &(deref(core::ops::deref::Deref::deref(&(deref(&(x_s)))))),\n )" - - in - repr - -let comp_eq_under_impl_14 (self rhs: t_GCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a =. b - then - let one:t_GCanvas = from_literal_under_impl_15 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_ne_under_impl_14 (self rhs: t_GCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a <>. b - then - let one:t_GCanvas = from_literal_under_impl_15 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_gte_under_impl_14 (self rhs: t_GCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a >=. b - then - let one:t_GCanvas = from_literal_under_impl_15 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_gt_under_impl_14 (self rhs: t_GCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a >. b - then - let one:t_GCanvas = from_literal_under_impl_15 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_lte_under_impl_14 (self rhs: t_GCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a <=. b - then - let one:t_GCanvas = from_literal_under_impl_15 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_lt_under_impl_14 (self rhs: t_GCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a <. b - then - let one:t_GCanvas = from_literal_under_impl_15 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let inv_under_impl_26 (self modval: t_GCanvas) : t_GCanvas = - let (biguintmodval: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into modval - in - let m:Core.Ops.Arith.Sub.t_Output = - biguintmodval -. (Core.Convert.From.from 2ul <: Num_bigint.Bigint.t_BigInt) - in - let (s: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - Core.Convert.Into.into (Num_bigint.Bigint.modpow_under_impl_24 s m biguintmodval - <: - Num_bigint.Bigint.t_BigInt) - -let pow_felem_under_impl_26 (self exp modval: t_GCanvas) : t_GCanvas = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into exp in - let (m: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into modval in - let (c: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Num_bigint.Bigint.modpow_under_impl_24 a b m - in - Core.Convert.Into.into c - -let pow_under_impl_26 (self: t_GCanvas) (exp: u128) (modval: t_GCanvas) : t_GCanvas = - pow_felem_under_impl_26 self - (Core.Convert.Into.into (Core.Convert.From.from exp <: Num_bigint.Bigint.t_BigInt) <: t_GCanvas) - modval - -let rem_under_impl_26 (self n: t_GCanvas) : Core.Ops.Arith.Rem.t_Output = self %. n - -let impl: Core.Ops.Arith.t_Add t_GCanvas t_GCanvas = - { - output = t_GCanvas; - add - = - fun (self: t_GCanvas) (rhs: t_GCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let c:Core.Ops.Arith.Add.t_Output = a +. b in - let _:Prims.unit = - if c >. (max_under_impl_15 <: Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = - ["bounded addition overflow for type GCanvas"] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Arith.t_Sub t_GCanvas t_GCanvas = - { - output = t_GCanvas; - sub - = - fun (self: t_GCanvas) (rhs: t_GCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let c:Core.Ops.Arith.Sub.t_Output = - if self.Hacspec_ovn.Schnorr.GCanvas.f_signed - then a -. b - else - Core.Option.unwrap_or_else_under_impl (Num_bigint.Bigint.checked_sub_under_impl_24 a b - <: - Core.Option.t_Option Num_bigint.Bigint.t_BigInt) - (fun -> - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = - ["bounded substraction underflow for type GCanvas"] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - <: - Num_bigint.Bigint.t_BigInt) - in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Arith.t_Mul t_GCanvas t_GCanvas = - { - output = t_GCanvas; - mul - = - fun (self: t_GCanvas) (rhs: t_GCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let c:Core.Ops.Arith.Mul.t_Output = a *. b in - let _:Prims.unit = - if c >. (max_under_impl_15 <: Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = - ["bounded multiplication overflow for type GCanvas"] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Arith.t_Div t_GCanvas t_GCanvas = - { - output = t_GCanvas; - div - = - fun (self: t_GCanvas) (rhs: t_GCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let _:Prims.unit = - if b =. (Num_traits.Identities.Zero.zero <: Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = ["dividing by zero in type GCanvas"] in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let c:Core.Ops.Arith.Div.t_Output = a /. b in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Arith.t_Rem t_GCanvas t_GCanvas = - { - output = t_GCanvas; - rem - = - fun (self: t_GCanvas) (rhs: t_GCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let _:Prims.unit = - if b =. (Num_traits.Identities.Zero.zero <: Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = ["dividing by zero in type GCanvas"] in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let c:Core.Ops.Arith.Rem.t_Output = a %. b in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Bit.t_Not t_GCanvas = - { - output = t_GCanvas; - not - = - fun (self: t_GCanvas) -> - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "not implemented" - <: - Rust_primitives.Hax.t_Never) - } - -let impl: Core.Ops.Bit.t_BitOr t_GCanvas t_GCanvas = - { - output = t_GCanvas; - bitor - = - fun (self: t_GCanvas) (rhs: t_GCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a |. b <: Core.Ops.Bit.BitOr.t_Output) - } - -let impl: Core.Ops.Bit.t_BitXor t_GCanvas t_GCanvas = - { - output = t_GCanvas; - bitxor - = - fun (self: t_GCanvas) (rhs: t_GCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a ^. b <: Core.Ops.Bit.BitXor.t_Output) - } - -let impl: Core.Ops.Bit.t_BitAnd t_GCanvas t_GCanvas = - { - output = t_GCanvas; - bitand - = - fun (self: t_GCanvas) (rhs: t_GCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a &. b <: Core.Ops.Bit.BitAnd.t_Output) - } - -let impl: Core.Ops.Bit.t_Shr t_GCanvas usize = - { - output = t_GCanvas; - shr - = - fun (self: t_GCanvas) (rhs: usize) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let b:usize = rhs in - Core.Convert.Into.into (a <<. b <: Core.Ops.Bit.Shr.t_Output) - } - -let impl: Core.Ops.Bit.t_Shl t_GCanvas usize = - { - output = t_GCanvas; - shl - = - fun (self: t_GCanvas) (rhs: usize) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let b:usize = rhs in - Core.Convert.Into.into (a >>. b <: Core.Ops.Bit.Shl.t_Output) - } - -let impl: Core.Cmp.t_PartialEq t_GCanvas t_GCanvas = - { - eq - = - fun (self: t_GCanvas) (rhs: t_GCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - a =. b - } - -let impl: Core.Cmp.t_Eq t_GCanvas = { } - -let impl: Core.Cmp.t_PartialOrd t_GCanvas t_GCanvas = - { - partial_cmp - = - fun (self: t_GCanvas) (other: t_GCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into other - in - Core.Cmp.PartialOrd.partial_cmp a b - } - -let impl: Core.Cmp.t_Ord t_GCanvas = - { - cmp - = - fun (self: t_GCanvas) (other: t_GCanvas) -> - Core.Option.unwrap_under_impl (Core.Cmp.PartialOrd.partial_cmp self other - <: - Core.Option.t_Option Core.Cmp.t_Ordering) - } - -let from_byte_seq_be_under_impl_7 (s: a) : t_GCanvas = - from_be_bytes_under_impl_14 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (Secret_integers.t_U8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - -let from_public_byte_seq_be_under_impl_7 (s: a) : t_GCanvas = - from_be_bytes_under_impl_14 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> x) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - -let to_byte_seq_be_under_impl_7 (self: t_GCanvas) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map - (Core.Slice.iter_under_impl (Rust_primitives.unsize (to_be_bytes_under_impl_14 self - <: - array u8 48sz) - <: - slice u8) - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) - <: - Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) - -let impl: Hacspec_lib.Traits.t_NumericCopy t_GCanvas = { } - -let impl: Hacspec_lib.Traits.t_UnsignedInteger t_GCanvas = { } - -let impl: Hacspec_lib.Traits.t_UnsignedIntegerCopy t_GCanvas = { } - -let impl: Hacspec_lib.Traits.t_Integer t_GCanvas = - { - nUM_BITS = (fun -> 384sz); - zERO = (fun -> from_literal_under_impl_15 (pub_u128 0sz)); - oNE = (fun -> from_literal_under_impl_15 (pub_u128 1sz)); - tWO = (fun -> from_literal_under_impl_15 (pub_u128 2sz)); - from_literal = (fun (v_val: u128) -> from_literal_under_impl_15 v_val); - from_hex_string - = - (fun (s: Alloc.String.t_String) -> - from_hex_under_impl_14 (Core.Ops.Deref.Deref.deref (Alloc.Str.replace_under_impl_5 (Core.Ops.Deref.Deref.deref - s - <: - string) - "0x" - "" - <: - Alloc.String.t_String) - <: - string)); - get_bit - = - (fun (self: t_GCanvas) (i: usize) -> - (self <<. i <: Core.Ops.Bit.Shr.t_Output) &. (Hacspec_lib.Traits.Integer.v_ONE <: t_GCanvas) - ); - set_bit - = - (fun (self: t_GCanvas) (b: t_GCanvas) (i: usize) -> - let _:Prims.unit = - if true - then - let _:Prims.unit = - if - ~.(Prims.op_BarBar (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b - <: - t_GCanvas) - (Hacspec_lib.Traits.Integer.v_ONE <: t_GCanvas) - <: - bool) - (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b <: t_GCanvas) - (Hacspec_lib.Traits.Integer.v_ZERO <: t_GCanvas) - <: - bool)) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO())" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - () - in - let tmp1:t_GCanvas = from_literal_under_impl_15 (~.(pub_u128 1sz >>. i <: u128) <: u128) in - let tmp2:Core.Ops.Bit.Shl.t_Output = b >>. i in - (self &. tmp1 <: Core.Ops.Bit.BitAnd.t_Output) |. tmp2); - set - = - (fun (self: t_GCanvas) (pos: usize) (y: t_GCanvas) (yi: usize) -> - let b:t_GCanvas = Hacspec_lib.Traits.Integer.get_bit y yi in - Hacspec_lib.Traits.Integer.set_bit self b pos); - rotate_left - = - (fun (self: t_GCanvas) (n: usize) -> - let _:Prims.unit = - if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - ((Core.Clone.Clone.clone self <: t_GCanvas) >>. n <: Core.Ops.Bit.Shl.t_Output) |. - (self <<. - (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. - (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) - <: - usize) - <: - Core.Ops.Bit.Shr.t_Output)); - rotate_right - = - fun (self: t_GCanvas) (n: usize) -> - let _:Prims.unit = - if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - ((Core.Clone.Clone.clone self <: t_GCanvas) <<. n <: Core.Ops.Bit.Shr.t_Output) |. - (self >>. - (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. - (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) - <: - usize) - <: - Core.Ops.Bit.Shl.t_Output) - } - -let impl: Hacspec_lib.Traits.t_ModNumeric t_GCanvas = - { - sub_mod - = - (fun (self: t_GCanvas) (rhs: t_GCanvas) (n: t_GCanvas) -> - (self -. rhs <: Core.Ops.Arith.Sub.t_Output) %. n); - add_mod - = - (fun (self: t_GCanvas) (rhs: t_GCanvas) (n: t_GCanvas) -> - (self +. rhs <: Core.Ops.Arith.Add.t_Output) %. n); - mul_mod - = - (fun (self: t_GCanvas) (rhs: t_GCanvas) (n: t_GCanvas) -> - (self *. rhs <: Core.Ops.Arith.Mul.t_Output) %. n); - pow_mod - = - (fun (self: t_GCanvas) (exp: t_GCanvas) (n: t_GCanvas) -> pow_felem_under_impl_26 self exp n); - modulo = (fun (self: t_GCanvas) (n: t_GCanvas) -> self %. n); - signed_modulo - = - (fun (self: t_GCanvas) (n: t_GCanvas) -> Hacspec_lib.Traits.ModNumeric.modulo self n); - absolute = fun (self: t_GCanvas) -> self - } - -let impl: Hacspec_lib.Traits.t_Numeric t_GCanvas = - { - max_val = (fun -> max_value_under_impl_15); - wrap_add = (fun (self: t_GCanvas) (rhs: t_GCanvas) -> self +. rhs); - wrap_sub = (fun (self: t_GCanvas) (rhs: t_GCanvas) -> self -. rhs); - wrap_mul = (fun (self: t_GCanvas) (rhs: t_GCanvas) -> self *. rhs); - wrap_div = (fun (self: t_GCanvas) (rhs: t_GCanvas) -> self /. rhs); - exp - = - (fun (self: t_GCanvas) (exp: u32) -> - pow_under_impl_26 self - (Core.Convert.Into.into exp <: u128) - (Hacspec_lib.Traits.Numeric.max_val <: t_GCanvas)); - pow_self - = - (fun (self: t_GCanvas) (exp: t_GCanvas) -> - pow_felem_under_impl_26 self - (Core.Convert.Into.into exp <: t_GCanvas) - (Hacspec_lib.Traits.Numeric.max_val <: t_GCanvas)); - divide = (fun (self: t_GCanvas) (rhs: t_GCanvas) -> self /. rhs); - inv = (fun (self: t_GCanvas) (n: t_GCanvas) -> inv_under_impl_26 self n); - equal = (fun (self: t_GCanvas) (other: t_GCanvas) -> self =. other); - greater_than = (fun (self: t_GCanvas) (other: t_GCanvas) -> self >. other); - greater_than_or_equal = (fun (self: t_GCanvas) (other: t_GCanvas) -> self >=. other); - less_than = (fun (self: t_GCanvas) (other: t_GCanvas) -> self <. other); - less_than_or_equal = (fun (self: t_GCanvas) (other: t_GCanvas) -> self >=. other); - not_equal_bm - = - (fun (self: t_GCanvas) (other: t_GCanvas) -> - if ~.(Hacspec_lib.Traits.Numeric.equal self other <: bool) - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_15 (pub_u128 0sz)); - equal_bm - = - (fun (self: t_GCanvas) (other: t_GCanvas) -> - if Hacspec_lib.Traits.Numeric.equal self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_15 (pub_u128 0sz)); - greater_than_bm - = - (fun (self: t_GCanvas) (other: t_GCanvas) -> - if Hacspec_lib.Traits.Numeric.greater_than self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_15 (pub_u128 0sz)); - greater_than_or_equal_bm - = - (fun (self: t_GCanvas) (other: t_GCanvas) -> - if Hacspec_lib.Traits.Numeric.greater_than_or_equal self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_15 (pub_u128 0sz)); - less_than_bm - = - (fun (self: t_GCanvas) (other: t_GCanvas) -> - if Hacspec_lib.Traits.Numeric.less_than self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_15 (pub_u128 0sz)); - less_than_or_equal_bm - = - fun (self: t_GCanvas) (other: t_GCanvas) -> - if Hacspec_lib.Traits.Numeric.less_than_or_equal self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_15 (pub_u128 0sz) - } - -type t_G = | G : t_GCanvas -> t_G - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -let impl: Core.Convert.t_From t_G t_GCanvas = - { - from - = - fun (x: t_GCanvas) -> - G - (rem_under_impl_26 x - (from_hex_under_impl_14 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_GCanvas)) - } - -let impl: Core.Convert.t_Into t_G t_GCanvas = - { into = fun (self: t_G) -> self.Hacspec_ovn.Schnorr.G.0 } - -let from_canvas_under_impl_63 (x: t_GCanvas) : t_G = - G - (rem_under_impl_26 x - (from_hex_under_impl_14 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_GCanvas)) - -let into_canvas_under_impl_63 (self: t_G) : t_GCanvas = self.Hacspec_ovn.Schnorr.G.0 - -let max_under_impl_63: t_GCanvas = - from_hex_under_impl_14 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - -let declassify_under_impl_63 (self: t_G) : Num_bigint.Bigint.t_BigInt = - let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into a - -let from_hex_under_impl_63 (s: string) : t_G = - Core.Convert.Into.into (from_hex_under_impl_14 s <: t_GCanvas) - -let from_be_bytes_under_impl_63 (v: slice u8) : t_G = - Core.Convert.Into.into (from_be_bytes_under_impl_14 v <: t_GCanvas) - -let to_be_bytes_under_impl_63 (self: t_G) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = - Alloc.Slice.to_vec_under_impl (Rust_primitives.unsize (to_be_bytes_under_impl_14 (Core.Convert.Into.into - self - <: - t_GCanvas) - <: - array u8 48sz) - <: - slice u8) - -let from_le_bytes_under_impl_63 (v: slice u8) : t_G = - Core.Convert.Into.into (from_le_bytes_under_impl_14 v <: t_GCanvas) - -let to_le_bytes_under_impl_63 (self: t_G) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = - Alloc.Slice.to_vec_under_impl (Rust_primitives.unsize (to_le_bytes_under_impl_14 (Core.Convert.Into.into - self - <: - t_GCanvas) - <: - array u8 48sz) - <: - slice u8) - -let bit_under_impl_63 (self: t_G) (i: usize) : bool = - bit_under_impl_15 (Core.Convert.Into.into self <: t_GCanvas) i - -let from_literal_under_impl_63 (x: u128) : t_G = - let big_x:Num_bigint.Biguint.t_BigUint = Core.Convert.From.from x in - let _:Prims.unit = - if - big_x >. - (Core.Convert.Into.into (max_under_impl_63 <: t_GCanvas) <: Num_bigint.Biguint.t_BigUint) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["literal "; " too big for type G"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - G (Core.Convert.Into.into big_x) - -let from_signed_literal_under_impl_63 (x: i128) : t_G = - let big_x:Num_bigint.Biguint.t_BigUint = Core.Convert.From.from (cast x) in - let _:Prims.unit = - if - big_x >. - (Core.Convert.Into.into (max_under_impl_63 <: t_GCanvas) <: Num_bigint.Biguint.t_BigUint) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["literal "; " too big for type G"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - G (Core.Convert.Into.into big_x) - -let comp_eq_under_impl_63 (self rhs: t_G) : t_G = - let (x: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_eq_under_impl_14 x (Core.Convert.Into.into rhs <: t_GCanvas) - <: - t_GCanvas) - -let comp_ne_under_impl_63 (self rhs: t_G) : t_G = - let (x: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_ne_under_impl_14 x (Core.Convert.Into.into rhs <: t_GCanvas) - <: - t_GCanvas) - -let comp_gte_under_impl_63 (self rhs: t_G) : t_G = - let (x: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_gte_under_impl_14 x (Core.Convert.Into.into rhs <: t_GCanvas) - <: - t_GCanvas) - -let comp_gt_under_impl_63 (self rhs: t_G) : t_G = - let (x: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_gt_under_impl_14 x (Core.Convert.Into.into rhs <: t_GCanvas) - <: - t_GCanvas) - -let comp_lte_under_impl_63 (self rhs: t_G) : t_G = - let (x: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_lte_under_impl_14 x (Core.Convert.Into.into rhs <: t_GCanvas) - <: - t_GCanvas) - -let comp_lt_under_impl_63 (self rhs: t_G) : t_G = - let (x: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_lt_under_impl_14 x (Core.Convert.Into.into rhs <: t_GCanvas) - <: - t_GCanvas) - -let neg_under_impl_63 (self: t_G) : t_G = - let (mod_val: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into (from_hex_under_impl_14 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_GCanvas) - in - let (s: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - let (s: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into s in - let (result: t_GCanvas):t_GCanvas = - Core.Convert.Into.into (mod_val -. s <: Core.Ops.Arith.Sub.t_Output) - in - Core.Convert.Into.into result - -let impl: Core.Cmp.t_PartialOrd t_G t_G = - { - partial_cmp - = - fun (self: t_G) (other: t_G) -> Core.Option.Option_Some (Core.Cmp.Ord.cmp self other) - } - -let impl: Core.Cmp.t_Ord t_G = - { - cmp - = - fun (self: t_G) (other: t_G) -> - Core.Cmp.Ord.cmp self.Hacspec_ovn.Schnorr.G.0 other.Hacspec_ovn.Schnorr.G.0 - } - -let impl: Core.Cmp.t_PartialEq t_G t_G = - { - eq - = - fun (self: t_G) (other: t_G) -> self.Hacspec_ovn.Schnorr.G.0 =. other.Hacspec_ovn.Schnorr.G.0 - } - -let impl: Core.Cmp.t_Eq t_G = { } - -let impl: Core.Ops.Arith.t_Add t_G t_G = - { - output = t_G; - add - = - fun (self: t_G) (rhs: t_G) -> - let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - let (b: t_GCanvas):t_GCanvas = Core.Convert.Into.into rhs in - let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into a - in - let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into b - in - let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Add.t_Output = a +. b in - let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into (from_hex_under_impl_14 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_GCanvas) - in - let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in - let (d: t_GCanvas):t_GCanvas = Core.Convert.Into.into d in - Core.Convert.Into.into d - } - -let impl: Core.Ops.Arith.t_Sub t_G t_G = - { - output = t_G; - sub - = - fun (self: t_G) (rhs: t_G) -> - let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - let (b: t_GCanvas):t_GCanvas = Core.Convert.Into.into rhs in - let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into a - in - let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into b - in - let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into (from_hex_under_impl_14 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_GCanvas) - in - let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Add.t_Output = - if b >. a - then - ((Core.Clone.Clone.clone max <: Num_bigint.Biguint.t_BigUint) -. b - <: - Core.Ops.Arith.Sub.t_Output) +. - a - else a -. b - in - let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in - let (d: t_GCanvas):t_GCanvas = Core.Convert.Into.into d in - Core.Convert.Into.into d - } - -let impl: Core.Ops.Arith.t_Mul t_G t_G = - { - output = t_G; - mul - = - fun (self: t_G) (rhs: t_G) -> - let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - let (b: t_GCanvas):t_GCanvas = Core.Convert.Into.into rhs in - let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into a - in - let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into b - in - let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Mul.t_Output = a *. b in - let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into (from_hex_under_impl_14 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_GCanvas) - in - let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in - let (d: t_GCanvas):t_GCanvas = Core.Convert.Into.into d in - Core.Convert.Into.into d - } - -let impl: Core.Ops.Arith.t_Div t_G t_G = - { output = t_G; div = fun (self: t_G) (rhs: t_G) -> self *. (inv_under_impl_57 rhs <: t_G) } - -let impl: Core.Ops.Arith.t_Rem t_G t_G = - { - output = t_G; - rem - = - fun (self: t_G) (rhs: t_G) -> - let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - let (b: t_GCanvas):t_GCanvas = Core.Convert.Into.into rhs in - let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into a - in - let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into b - in - let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = a %. b in - let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into (from_hex_under_impl_14 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_GCanvas) - in - let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in - let (d: t_GCanvas):t_GCanvas = Core.Convert.Into.into d in - Core.Convert.Into.into d - } - -let impl: Core.Ops.Bit.t_Not t_G = - { - output = t_G; - not - = - fun (self: t_G) -> - let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (~.a <: Core.Ops.Bit.Not.t_Output) - } - -let impl: Core.Ops.Bit.t_BitOr t_G t_G = - { - output = t_G; - bitor - = - fun (self: t_G) (rhs: t_G) -> - let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - let (b: t_GCanvas):t_GCanvas = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a |. b <: Core.Ops.Bit.BitOr.t_Output) - } - -let impl: Core.Ops.Bit.t_BitXor t_G t_G = - { - output = t_G; - bitxor - = - fun (self: t_G) (rhs: t_G) -> - let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - let (b: t_GCanvas):t_GCanvas = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a ^. b <: Core.Ops.Bit.BitXor.t_Output) - } - -let impl: Core.Ops.Bit.t_BitAnd t_G t_G = - { - output = t_G; - bitand - = - fun (self: t_G) (rhs: t_G) -> - let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - let (b: t_GCanvas):t_GCanvas = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a &. b <: Core.Ops.Bit.BitAnd.t_Output) - } - -let impl: Core.Ops.Bit.t_Shr t_G usize = - { - output = t_G; - shr - = - fun (self: t_G) (rhs: usize) -> - let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (a <<. rhs <: Core.Ops.Bit.Shr.t_Output) - } - -let impl: Core.Ops.Bit.t_Shl t_G usize = - { - output = t_G; - shl - = - fun (self: t_G) (rhs: usize) -> - let (a: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (a >>. rhs <: Core.Ops.Bit.Shl.t_Output) - } - -let inv_under_impl_57 (self: t_G) : t_G = - let (base: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (inv_under_impl_26 base (max_under_impl_63 <: t_GCanvas) <: t_GCanvas) - -let pow_felem_under_impl_57 (self exp: t_G) : t_G = - let (base: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (pow_felem_under_impl_26 base - (Core.Convert.Into.into exp <: t_GCanvas) - (max_under_impl_63 <: t_GCanvas) - <: - t_GCanvas) - -let pow_under_impl_57 (self: t_G) (exp: u128) : t_G = - let (base: t_GCanvas):t_GCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (pow_under_impl_26 base exp (max_under_impl_63 <: t_GCanvas) <: t_GCanvas) - -let pow2_under_impl_57 (x: usize) : t_G = Core.Convert.Into.into (pow2_under_impl_15 x <: t_GCanvas) - -let from_byte_seq_be_under_impl (s: a) : t_G = - Core.Convert.Into.into (from_be_bytes_under_impl_14 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (Secret_integers.t_U8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - t_GCanvas) - -let from_public_byte_seq_be_under_impl (s: a) : t_G = - Core.Convert.Into.into (from_be_bytes_under_impl_14 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> x) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - t_GCanvas) - -let to_byte_seq_be_under_impl (self: t_G) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map - (Core.Slice.iter_under_impl (Core.Ops.Deref.Deref.deref (to_be_bytes_under_impl_63 self - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) - <: - Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) - -let to_public_byte_seq_be_under_impl (self: t_G) : Hacspec_lib.Seq.t_Seq u8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (to_be_bytes_under_impl_63 self - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - -let from_byte_seq_le_under_impl (s: a) : t_G = - Core.Convert.Into.into (from_le_bytes_under_impl_14 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (Secret_integers.t_U8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - t_GCanvas) - -let from_public_byte_seq_le_under_impl (s: a) : t_G = - Core.Convert.Into.into (from_le_bytes_under_impl_14 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> x) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - t_GCanvas) - -let to_byte_seq_le_under_impl (self: t_G) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map - (Core.Slice.iter_under_impl (Core.Ops.Deref.Deref.deref (to_le_bytes_under_impl_63 self - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) - <: - Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) - -let to_public_byte_seq_le_under_impl (self: t_G) : Hacspec_lib.Seq.t_Seq u8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (to_le_bytes_under_impl_63 self - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - -let from_secret_literal_under_impl (x: Secret_integers.t_U128) : t_G = - Core.Convert.Into.into (from_literal_under_impl_15 (Secret_integers.declassify_under_impl_126 x - <: - u128) - <: - t_GCanvas) - -let impl: Hacspec_lib.Traits.t_NumericCopy t_G = { } - -let impl: Hacspec_lib.Traits.t_UnsignedInteger t_G = { } - -let impl: Hacspec_lib.Traits.t_UnsignedIntegerCopy t_G = { } - -let impl: Hacspec_lib.Traits.t_Integer t_G = - { - nUM_BITS = (fun -> 384sz); - zERO = (fun -> from_literal_under_impl_63 (pub_u128 0sz)); - oNE = (fun -> from_literal_under_impl_63 (pub_u128 1sz)); - tWO = (fun -> from_literal_under_impl_63 (pub_u128 2sz)); - from_literal = (fun (v_val: u128) -> from_literal_under_impl_63 v_val); - from_hex_string - = - (fun (s: Alloc.String.t_String) -> - from_hex_under_impl_63 (Core.Ops.Deref.Deref.deref (Alloc.Str.replace_under_impl_5 (Core.Ops.Deref.Deref.deref - s - <: - string) - "0x" - "" - <: - Alloc.String.t_String) - <: - string)); - get_bit - = - (fun (self: t_G) (i: usize) -> - (self <<. i <: Core.Ops.Bit.Shr.t_Output) &. (Hacspec_lib.Traits.Integer.v_ONE <: t_G)); - set_bit - = - (fun (self: t_G) (b: t_G) (i: usize) -> - let _:Prims.unit = - if true - then - let _:Prims.unit = - if - ~.(Prims.op_BarBar (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b - <: - t_G) - (Hacspec_lib.Traits.Integer.v_ONE <: t_G) - <: - bool) - (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b <: t_G) - (Hacspec_lib.Traits.Integer.v_ZERO <: t_G) - <: - bool)) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO())" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - () - in - let tmp1:t_G = from_literal_under_impl_63 (~.(pub_u128 1sz >>. i <: u128) <: u128) in - let tmp2:Core.Ops.Bit.Shl.t_Output = b >>. i in - (self &. tmp1 <: Core.Ops.Bit.BitAnd.t_Output) |. tmp2); - set - = - (fun (self: t_G) (pos: usize) (y: t_G) (yi: usize) -> - let b:t_G = Hacspec_lib.Traits.Integer.get_bit y yi in - Hacspec_lib.Traits.Integer.set_bit self b pos); - rotate_left - = - (fun (self: t_G) (n: usize) -> - let _:Prims.unit = - if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - ((Core.Clone.Clone.clone self <: t_G) >>. n <: Core.Ops.Bit.Shl.t_Output) |. - (self <<. - (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. - (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) - <: - usize) - <: - Core.Ops.Bit.Shr.t_Output)); - rotate_right - = - fun (self: t_G) (n: usize) -> - let _:Prims.unit = - if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - ((Core.Clone.Clone.clone self <: t_G) <<. n <: Core.Ops.Bit.Shr.t_Output) |. - (self >>. - (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. - (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) - <: - usize) - <: - Core.Ops.Bit.Shl.t_Output) - } - -let impl: Hacspec_lib.Traits.t_ModNumeric t_G = - { - sub_mod = (fun (self: t_G) (rhs: t_G) (n: t_G) -> self -. rhs); - add_mod = (fun (self: t_G) (rhs: t_G) (n: t_G) -> self +. rhs); - mul_mod = (fun (self: t_G) (rhs: t_G) (n: t_G) -> self *. rhs); - pow_mod = (fun (self: t_G) (exp: t_G) (n: t_G) -> pow_felem_under_impl_57 self exp); - modulo = (fun (self: t_G) (n: t_G) -> self %. n); - signed_modulo = (fun (self: t_G) (n: t_G) -> Hacspec_lib.Traits.ModNumeric.modulo self n); - absolute = fun (self: t_G) -> self - } - -let impl: Hacspec_lib.Traits.t_Numeric t_G = - { - max_val - = - (fun -> - Core.Convert.Into.into ((max_under_impl_63 <: t_GCanvas) -. - (from_literal_under_impl_15 (pub_u128 1sz) <: t_GCanvas) - <: - Core.Ops.Arith.Sub.t_Output)); - wrap_add = (fun (self: t_G) (rhs: t_G) -> self +. rhs); - wrap_sub = (fun (self: t_G) (rhs: t_G) -> self -. rhs); - wrap_mul = (fun (self: t_G) (rhs: t_G) -> self *. rhs); - wrap_div = (fun (self: t_G) (rhs: t_G) -> self /. rhs); - exp - = - (fun (self: t_G) (exp: u32) -> pow_under_impl_57 self (Core.Convert.Into.into exp <: u128)); - pow_self = (fun (self: t_G) (exp: t_G) -> pow_felem_under_impl_57 self exp); - divide = (fun (self: t_G) (rhs: t_G) -> self /. rhs); - inv = (fun (self: t_G) (n: t_G) -> inv_under_impl_57 self); - equal = (fun (self: t_G) (other: t_G) -> self =. other); - greater_than = (fun (self: t_G) (other: t_G) -> self >. other); - greater_than_or_equal = (fun (self: t_G) (other: t_G) -> self >=. other); - less_than = (fun (self: t_G) (other: t_G) -> self <. other); - less_than_or_equal = (fun (self: t_G) (other: t_G) -> self <=. other); - not_equal_bm - = - (fun (self: t_G) (other: t_G) -> - if self <>. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_G) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_G) - else Hacspec_lib.Traits.Integer.v_ZERO); - equal_bm - = - (fun (self: t_G) (other: t_G) -> - if self =. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_G) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_G) - else Hacspec_lib.Traits.Integer.v_ZERO); - greater_than_bm - = - (fun (self: t_G) (other: t_G) -> - if self >. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_G) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_G) - else Hacspec_lib.Traits.Integer.v_ZERO); - greater_than_or_equal_bm - = - (fun (self: t_G) (other: t_G) -> - if self >=. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_G) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_G) - else Hacspec_lib.Traits.Integer.v_ZERO); - less_than_bm - = - (fun (self: t_G) (other: t_G) -> - if self <. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_G) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_G) - else Hacspec_lib.Traits.Integer.v_ZERO); - less_than_or_equal_bm - = - fun (self: t_G) (other: t_G) -> - if self <=. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_G) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_G) - else Hacspec_lib.Traits.Integer.v_ZERO - } - -type t_QCanvas = { - f_b:array u8 48sz; - f_sign:Num_bigint.Bigint.t_Sign; - f_signed:bool -} - -let max_under_impl_82: Core.Ops.Arith.Sub.t_Output = - ((Core.Convert.From.from 1ul <: Num_bigint.Bigint.t_BigInt) >>. 384l <: Core.Ops.Bit.Shl.t_Output) -. - (Num_traits.Identities.One.one <: Num_bigint.Bigint.t_BigInt) - -let max_value_under_impl_82: t_QCanvas = - Core.Convert.From.from (max_under_impl_82 <: Num_bigint.Bigint.t_BigInt) - -let hex_string_to_bytes_under_impl_82 (s: string) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = - let s:Alloc.String.t_String = - if ((Core.Str.len_under_impl s <: usize) %. 2sz <: usize) <>. 0sz - then - let x:Alloc.String.t_String = Alloc.String.ToString.to_string "0" in - let x:Alloc.String.t_String = Alloc.String.push_str_under_impl x s in - x - else Alloc.String.ToString.to_string s - in - let _:Prims.unit = - if ~.(((Alloc.String.len_under_impl s <: usize) %. 2sz <: usize) =. 0sz <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["length of hex string "; ": "] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [ - Core.Fmt.Rt.new_display_under_impl_1 s <: Core.Fmt.Rt.t_Argument; - Core.Fmt.Rt.new_display_under_impl_1 (Alloc.String.len_under_impl s - <: - usize) - <: - Core.Fmt.Rt.t_Argument - ] - in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let - (b: Core.Result.t_Result (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) Core.Num.Error.t_ParseIntError):Core.Result.t_Result - (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) Core.Num.Error.t_ParseIntError = - Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map (Core.Iter.Traits.Iterator.Iterator.step_by - ({ - Core.Ops.Range.Range.f_start = 0sz; - Core.Ops.Range.Range.f_end = Alloc.String.len_under_impl s <: usize - }) - 2sz - <: - Core.Iter.Adapters.Step_by.t_StepBy (Core.Ops.Range.t_Range usize)) - (fun i -> - Core.Num.from_str_radix_under_impl_6 (s.[ { - Core.Ops.Range.Range.f_start = i; - Core.Ops.Range.Range.f_end = i +. 2sz <: usize - } ] - <: - string) - 16ul - <: - Core.Result.t_Result u8 Core.Num.Error.t_ParseIntError) - <: - Core.Iter.Adapters.Map.t_Map - (Core.Iter.Adapters.Step_by.t_StepBy (Core.Ops.Range.t_Range usize)) - (usize -> Core.Result.t_Result u8 Core.Num.Error.t_ParseIntError)) - in - Core.Result.expect_under_impl b "Error parsing hex string" - -let from_literal_under_impl_82 (x: u128) : t_QCanvas = - let big_x:Num_bigint.Bigint.t_BigInt = Core.Convert.From.from x in - let _:Prims.unit = - if - big_x >. - (Core.Convert.Into.into (max_under_impl_82 <: Num_bigint.Bigint.t_BigInt) - <: - Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["literal "; " too big for type QCanvas"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Core.Convert.Into.into big_x - -let from_signed_literal_under_impl_82 (x: i128) : t_QCanvas = - let big_x:Num_bigint.Bigint.t_BigInt = Core.Convert.From.from (cast x) in - let _:Prims.unit = - if - big_x >. - (Core.Convert.Into.into (max_under_impl_82 <: Num_bigint.Bigint.t_BigInt) - <: - Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["literal "; " too big for type QCanvas"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Core.Convert.Into.into big_x - -let pow2_under_impl_82 (x: usize) : t_QCanvas = - Core.Convert.Into.into ((Core.Convert.From.from 1ul <: Num_bigint.Bigint.t_BigInt) >>. x - <: - Core.Ops.Bit.Shl.t_Output) - -let bit_under_impl_82 (self: t_QCanvas) (i: usize) : bool = - let _:Prims.unit = - if - ~.(i <. - ((Core.Slice.len_under_impl (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.QCanvas.f_b - <: - slice u8) - <: - usize) *. - 8sz - <: - usize) - <: - bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = - [ - "the bit queried should be lower than the size of the integer representation: "; - " < " - ] - in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [ - Core.Fmt.Rt.new_display_under_impl_1 i <: Core.Fmt.Rt.t_Argument; - Core.Fmt.Rt.new_display_under_impl_1 ((Core.Slice.len_under_impl (Rust_primitives.unsize - self.Hacspec_ovn.Schnorr.QCanvas.f_b - <: - slice u8) - <: - usize) *. - 8sz - <: - usize) - <: - Core.Fmt.Rt.t_Argument - ] - in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let (bigint: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (tmp: Num_bigint.Bigint.t_BigInt):Core.Ops.Bit.Shr.t_Output = bigint <<. i in - ((Num_bigint.Bigint.to_bytes_le_under_impl_24 (tmp &. - (Num_traits.Identities.One.one <: Num_bigint.Bigint.t_BigInt) - <: - Num_bigint.Bigint.t_BigInt) - <: - (Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global)) - ._2.[ 0sz ] - <: - u8) =. - 1uy - -let impl: Core.Convert.t_From t_QCanvas Num_bigint.Biguint.t_BigUint = - { - from - = - fun (x: Num_bigint.Biguint.t_BigUint) -> - Core.Convert.From.from (Core.Convert.From.from x <: Num_bigint.Bigint.t_BigInt) - } - -let impl: Core.Convert.t_From t_QCanvas Num_bigint.Bigint.t_BigInt = - { - from - = - fun (x: Num_bigint.Bigint.t_BigInt) -> - let max_value:Num_bigint.Bigint.t_BigInt = max_under_impl_82 in - let _:Prims.unit = - if ~.(x <=. max_value <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = [""; " is too large for type QCanvas!"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let sign, repr:(Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) = - Num_bigint.Bigint.to_bytes_be_under_impl_24 x - in - let _:Prims.unit = - if Prims.op_AmpAmp (sign =. Num_bigint.Bigint.Sign_Minus) ~.false - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "Trying to convert a negative number into an unsigned integer!" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - let _:Prims.unit = - if (Alloc.Vec.len_under_impl_1 repr <: usize) >. ((384sz +. 7sz <: usize) /. 8sz <: usize) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = [""; " is too large for type QCanvas"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let out:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in - let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize out <: slice u8) in - let lower:usize = upper -. (Alloc.Vec.len_under_impl_1 repr <: usize) in - let _:Prims.unit = - Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" - "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (out),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(core::ops::deref::Deref::deref(&(deref(&(repr)))))),\n )" - - in - { - Hacspec_ovn.Schnorr.QCanvas.f_b = out; - Hacspec_ovn.Schnorr.QCanvas.f_sign = sign; - Hacspec_ovn.Schnorr.QCanvas.f_signed = false - } - } - -let impl: Core.Default.t_Default t_QCanvas = - { - default - = - fun -> - { - Hacspec_ovn.Schnorr.QCanvas.f_b = Rust_primitives.Hax.repeat 0uy 48sz; - Hacspec_ovn.Schnorr.QCanvas.f_sign = Num_bigint.Bigint.Sign_Plus; - Hacspec_ovn.Schnorr.QCanvas.f_signed = false - } - } - -let impl: Core.Convert.t_Into t_QCanvas Num_bigint.Bigint.t_BigInt = - { - into - = - fun (self: t_QCanvas) -> - Num_bigint.Bigint.from_bytes_be_under_impl_24 self.Hacspec_ovn.Schnorr.QCanvas.f_sign - (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.QCanvas.f_b <: slice u8) - } - -let impl: Core.Convert.t_Into t_QCanvas Num_bigint.Biguint.t_BigUint = - { - into - = - fun (self: t_QCanvas) -> - Num_bigint.Biguint.from_bytes_be_under_impl_18 (Rust_primitives.unsize self - .Hacspec_ovn.Schnorr.QCanvas.f_b - <: - slice u8) - } - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -let from_hex_under_impl_81 (s: string) : t_QCanvas = - Core.Convert.Into.into (Num_bigint.Bigint.from_bytes_be_under_impl_24 Num_bigint.Bigint.Sign_Plus - (Core.Ops.Deref.Deref.deref (hex_string_to_bytes_under_impl_82 s - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - Num_bigint.Bigint.t_BigInt) - -let from_be_bytes_under_impl_81 (v: slice u8) : t_QCanvas = - let _:Prims.unit = - if true - then - let _:Prims.unit = - if - ~.((Core.Slice.len_under_impl v <: usize) <=. ((384sz +. 7sz <: usize) /. 8sz <: usize) - <: - bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - () - in - let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in - let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize repr <: slice u8) in - let lower:usize = upper -. (Core.Slice.len_under_impl v <: usize) in - let _:Prims.unit = - Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" - "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(deref(&(v)))),\n )" - - in - { - Hacspec_ovn.Schnorr.QCanvas.f_b = repr; - Hacspec_ovn.Schnorr.QCanvas.f_sign = Num_bigint.Bigint.Sign_Plus; - Hacspec_ovn.Schnorr.QCanvas.f_signed = false - } - -let from_le_bytes_under_impl_81 (v: slice u8) : t_QCanvas = - let _:Prims.unit = - if true - then - let _:Prims.unit = - if - ~.((Core.Slice.len_under_impl v <: usize) <=. ((384sz +. 7sz <: usize) /. 8sz <: usize) - <: - bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Std.Panicking.begin_panic "from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - () - in - let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in - let upper:usize = Core.Slice.len_under_impl (Rust_primitives.unsize repr <: slice u8) in - let lower:usize = upper -. (Core.Slice.len_under_impl v <: usize) in - let _:Prims.unit = - Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" - "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: lower,\n f_end: upper,\n },\n ))),\n &(deref(deref(&(v)))),\n )" - - in - Core.Convert.Into.into (Num_bigint.Bigint.from_bytes_le_under_impl_24 Num_bigint.Bigint.Sign_Plus - (Rust_primitives.unsize repr <: slice u8) - <: - Num_bigint.Bigint.t_BigInt) - -let to_be_bytes_under_impl_81 (self: t_QCanvas) : array u8 48sz = - self.Hacspec_ovn.Schnorr.QCanvas.f_b - -let to_le_bytes_under_impl_81 (self: t_QCanvas) : array u8 48sz = - let x:Num_bigint.Bigint.t_BigInt = - Num_bigint.Bigint.from_bytes_be_under_impl_24 Num_bigint.Bigint.Sign_Plus - (Rust_primitives.unsize self.Hacspec_ovn.Schnorr.QCanvas.f_b <: slice u8) - in - let _, x_s:(Num_bigint.Bigint.t_Sign & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) = - Num_bigint.Bigint.to_bytes_le_under_impl_24 x - in - let repr:array u8 48sz = Rust_primitives.Hax.repeat 0uy 48sz in - let _:Prims.unit = - Rust_primitives.Hax.failure "RefMut:The mutation of this &mut is not allowed here.\n" - "core::slice::copy_from_slice_under_impl(\n &mut (deref(core::ops::index::IndexMut::index_mut(\n &mut (repr),\n core::ops::range::Range {\n f_start: 0,\n f_end: alloc::vec::len_under_impl_1(&(x_s)),\n },\n ))),\n &(deref(core::ops::deref::Deref::deref(&(deref(&(x_s)))))),\n )" - - in - repr - -let comp_eq_under_impl_81 (self rhs: t_QCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a =. b - then - let one:t_QCanvas = from_literal_under_impl_82 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_ne_under_impl_81 (self rhs: t_QCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a <>. b - then - let one:t_QCanvas = from_literal_under_impl_82 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_gte_under_impl_81 (self rhs: t_QCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a >=. b - then - let one:t_QCanvas = from_literal_under_impl_82 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_gt_under_impl_81 (self rhs: t_QCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a >. b - then - let one:t_QCanvas = from_literal_under_impl_82 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_lte_under_impl_81 (self rhs: t_QCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a <=. b - then - let one:t_QCanvas = from_literal_under_impl_82 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let comp_lt_under_impl_81 (self rhs: t_QCanvas) : Core.Ops.Arith.Sub.t_Output = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - if a <. b - then - let one:t_QCanvas = from_literal_under_impl_82 (pub_u128 1sz) in - (one >>. (384sz -. 1sz <: usize) <: Core.Ops.Bit.Shl.t_Output) -. one - else Core.Default.Default.v_default - -let inv_under_impl_93 (self modval: t_QCanvas) : t_QCanvas = - let (biguintmodval: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into modval - in - let m:Core.Ops.Arith.Sub.t_Output = - biguintmodval -. (Core.Convert.From.from 2ul <: Num_bigint.Bigint.t_BigInt) - in - let (s: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - Core.Convert.Into.into (Num_bigint.Bigint.modpow_under_impl_24 s m biguintmodval - <: - Num_bigint.Bigint.t_BigInt) - -let pow_felem_under_impl_93 (self exp modval: t_QCanvas) : t_QCanvas = - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into self in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into exp in - let (m: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into modval in - let (c: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Num_bigint.Bigint.modpow_under_impl_24 a b m - in - Core.Convert.Into.into c - -let pow_under_impl_93 (self: t_QCanvas) (exp: u128) (modval: t_QCanvas) : t_QCanvas = - pow_felem_under_impl_93 self - (Core.Convert.Into.into (Core.Convert.From.from exp <: Num_bigint.Bigint.t_BigInt) <: t_QCanvas) - modval - -let rem_under_impl_93 (self n: t_QCanvas) : Core.Ops.Arith.Rem.t_Output = self %. n - -let impl: Core.Ops.Arith.t_Add t_QCanvas t_QCanvas = - { - output = t_QCanvas; - add - = - fun (self: t_QCanvas) (rhs: t_QCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let c:Core.Ops.Arith.Add.t_Output = a +. b in - let _:Prims.unit = - if c >. (max_under_impl_82 <: Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = - ["bounded addition overflow for type QCanvas"] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Arith.t_Sub t_QCanvas t_QCanvas = - { - output = t_QCanvas; - sub - = - fun (self: t_QCanvas) (rhs: t_QCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let c:Core.Ops.Arith.Sub.t_Output = - if self.Hacspec_ovn.Schnorr.QCanvas.f_signed - then a -. b - else - Core.Option.unwrap_or_else_under_impl (Num_bigint.Bigint.checked_sub_under_impl_24 a b - <: - Core.Option.t_Option Num_bigint.Bigint.t_BigInt) - (fun -> - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = - ["bounded substraction underflow for type QCanvas"] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - <: - Num_bigint.Bigint.t_BigInt) - in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Arith.t_Mul t_QCanvas t_QCanvas = - { - output = t_QCanvas; - mul - = - fun (self: t_QCanvas) (rhs: t_QCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let c:Core.Ops.Arith.Mul.t_Output = a *. b in - let _:Prims.unit = - if c >. (max_under_impl_82 <: Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = - ["bounded multiplication overflow for type QCanvas"] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Arith.t_Div t_QCanvas t_QCanvas = - { - output = t_QCanvas; - div - = - fun (self: t_QCanvas) (rhs: t_QCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let _:Prims.unit = - if b =. (Num_traits.Identities.Zero.zero <: Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = ["dividing by zero in type QCanvas"] in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let c:Core.Ops.Arith.Div.t_Output = a /. b in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Arith.t_Rem t_QCanvas t_QCanvas = - { - output = t_QCanvas; - rem - = - fun (self: t_QCanvas) (rhs: t_QCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - let _:Prims.unit = - if b =. (Num_traits.Identities.Zero.zero <: Num_bigint.Bigint.t_BigInt) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 - (Rust_primitives.unsize (let l = ["dividing by zero in type QCanvas"] in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (Core.Fmt.Rt.none_under_impl_1 - <: - array Core.Fmt.Rt.t_Argument 0sz) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - let c:Core.Ops.Arith.Rem.t_Output = a %. b in - Core.Convert.Into.into c - } - -let impl: Core.Ops.Bit.t_Not t_QCanvas = - { - output = t_QCanvas; - not - = - fun (self: t_QCanvas) -> - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "not implemented" - <: - Rust_primitives.Hax.t_Never) - } - -let impl: Core.Ops.Bit.t_BitOr t_QCanvas t_QCanvas = - { - output = t_QCanvas; - bitor - = - fun (self: t_QCanvas) (rhs: t_QCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a |. b <: Core.Ops.Bit.BitOr.t_Output) - } - -let impl: Core.Ops.Bit.t_BitXor t_QCanvas t_QCanvas = - { - output = t_QCanvas; - bitxor - = - fun (self: t_QCanvas) (rhs: t_QCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a ^. b <: Core.Ops.Bit.BitXor.t_Output) - } - -let impl: Core.Ops.Bit.t_BitAnd t_QCanvas t_QCanvas = - { - output = t_QCanvas; - bitand - = - fun (self: t_QCanvas) (rhs: t_QCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a &. b <: Core.Ops.Bit.BitAnd.t_Output) - } - -let impl: Core.Ops.Bit.t_Shr t_QCanvas usize = - { - output = t_QCanvas; - shr - = - fun (self: t_QCanvas) (rhs: usize) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let b:usize = rhs in - Core.Convert.Into.into (a <<. b <: Core.Ops.Bit.Shr.t_Output) - } - -let impl: Core.Ops.Bit.t_Shl t_QCanvas usize = - { - output = t_QCanvas; - shl - = - fun (self: t_QCanvas) (rhs: usize) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let b:usize = rhs in - Core.Convert.Into.into (a >>. b <: Core.Ops.Bit.Shl.t_Output) - } - -let impl: Core.Cmp.t_PartialEq t_QCanvas t_QCanvas = - { - eq - = - fun (self: t_QCanvas) (rhs: t_QCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into rhs in - a =. b - } - -let impl: Core.Cmp.t_Eq t_QCanvas = { } - -let impl: Core.Cmp.t_PartialOrd t_QCanvas t_QCanvas = - { - partial_cmp - = - fun (self: t_QCanvas) (other: t_QCanvas) -> - let (a: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into self - in - let (b: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into other - in - Core.Cmp.PartialOrd.partial_cmp a b - } - -let impl: Core.Cmp.t_Ord t_QCanvas = - { - cmp - = - fun (self: t_QCanvas) (other: t_QCanvas) -> - Core.Option.unwrap_under_impl (Core.Cmp.PartialOrd.partial_cmp self other - <: - Core.Option.t_Option Core.Cmp.t_Ordering) - } - -let from_byte_seq_be_under_impl_74 (s: a) : t_QCanvas = - from_be_bytes_under_impl_81 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (Secret_integers.t_U8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - -let from_public_byte_seq_be_under_impl_74 (s: a) : t_QCanvas = - from_be_bytes_under_impl_81 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> x) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - -let to_byte_seq_be_under_impl_74 (self: t_QCanvas) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map - (Core.Slice.iter_under_impl (Rust_primitives.unsize (to_be_bytes_under_impl_81 self - <: - array u8 48sz) - <: - slice u8) - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) - <: - Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) - -let impl: Hacspec_lib.Traits.t_NumericCopy t_QCanvas = { } - -let impl: Hacspec_lib.Traits.t_UnsignedInteger t_QCanvas = { } - -let impl: Hacspec_lib.Traits.t_UnsignedIntegerCopy t_QCanvas = { } - -let impl: Hacspec_lib.Traits.t_Integer t_QCanvas = - { - nUM_BITS = (fun -> 384sz); - zERO = (fun -> from_literal_under_impl_82 (pub_u128 0sz)); - oNE = (fun -> from_literal_under_impl_82 (pub_u128 1sz)); - tWO = (fun -> from_literal_under_impl_82 (pub_u128 2sz)); - from_literal = (fun (v_val: u128) -> from_literal_under_impl_82 v_val); - from_hex_string - = - (fun (s: Alloc.String.t_String) -> - from_hex_under_impl_81 (Core.Ops.Deref.Deref.deref (Alloc.Str.replace_under_impl_5 (Core.Ops.Deref.Deref.deref - s - <: - string) - "0x" - "" - <: - Alloc.String.t_String) - <: - string)); - get_bit - = - (fun (self: t_QCanvas) (i: usize) -> - (self <<. i <: Core.Ops.Bit.Shr.t_Output) &. (Hacspec_lib.Traits.Integer.v_ONE <: t_QCanvas) - ); - set_bit - = - (fun (self: t_QCanvas) (b: t_QCanvas) (i: usize) -> - let _:Prims.unit = - if true - then - let _:Prims.unit = - if - ~.(Prims.op_BarBar (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b - <: - t_QCanvas) - (Hacspec_lib.Traits.Integer.v_ONE <: t_QCanvas) - <: - bool) - (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b <: t_QCanvas) - (Hacspec_lib.Traits.Integer.v_ZERO <: t_QCanvas) - <: - bool)) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO())" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - () - in - let tmp1:t_QCanvas = from_literal_under_impl_82 (~.(pub_u128 1sz >>. i <: u128) <: u128) in - let tmp2:Core.Ops.Bit.Shl.t_Output = b >>. i in - (self &. tmp1 <: Core.Ops.Bit.BitAnd.t_Output) |. tmp2); - set - = - (fun (self: t_QCanvas) (pos: usize) (y: t_QCanvas) (yi: usize) -> - let b:t_QCanvas = Hacspec_lib.Traits.Integer.get_bit y yi in - Hacspec_lib.Traits.Integer.set_bit self b pos); - rotate_left - = - (fun (self: t_QCanvas) (n: usize) -> - let _:Prims.unit = - if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - ((Core.Clone.Clone.clone self <: t_QCanvas) >>. n <: Core.Ops.Bit.Shl.t_Output) |. - (self <<. - (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. - (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) - <: - usize) - <: - Core.Ops.Bit.Shr.t_Output)); - rotate_right - = - fun (self: t_QCanvas) (n: usize) -> - let _:Prims.unit = - if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - ((Core.Clone.Clone.clone self <: t_QCanvas) <<. n <: Core.Ops.Bit.Shr.t_Output) |. - (self >>. - (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. - (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) - <: - usize) - <: - Core.Ops.Bit.Shl.t_Output) - } - -let impl: Hacspec_lib.Traits.t_ModNumeric t_QCanvas = - { - sub_mod - = - (fun (self: t_QCanvas) (rhs: t_QCanvas) (n: t_QCanvas) -> - (self -. rhs <: Core.Ops.Arith.Sub.t_Output) %. n); - add_mod - = - (fun (self: t_QCanvas) (rhs: t_QCanvas) (n: t_QCanvas) -> - (self +. rhs <: Core.Ops.Arith.Add.t_Output) %. n); - mul_mod - = - (fun (self: t_QCanvas) (rhs: t_QCanvas) (n: t_QCanvas) -> - (self *. rhs <: Core.Ops.Arith.Mul.t_Output) %. n); - pow_mod - = - (fun (self: t_QCanvas) (exp: t_QCanvas) (n: t_QCanvas) -> pow_felem_under_impl_93 self exp n); - modulo = (fun (self: t_QCanvas) (n: t_QCanvas) -> self %. n); - signed_modulo - = - (fun (self: t_QCanvas) (n: t_QCanvas) -> Hacspec_lib.Traits.ModNumeric.modulo self n); - absolute = fun (self: t_QCanvas) -> self - } - -let impl: Hacspec_lib.Traits.t_Numeric t_QCanvas = - { - max_val = (fun -> max_value_under_impl_82); - wrap_add = (fun (self: t_QCanvas) (rhs: t_QCanvas) -> self +. rhs); - wrap_sub = (fun (self: t_QCanvas) (rhs: t_QCanvas) -> self -. rhs); - wrap_mul = (fun (self: t_QCanvas) (rhs: t_QCanvas) -> self *. rhs); - wrap_div = (fun (self: t_QCanvas) (rhs: t_QCanvas) -> self /. rhs); - exp - = - (fun (self: t_QCanvas) (exp: u32) -> - pow_under_impl_93 self - (Core.Convert.Into.into exp <: u128) - (Hacspec_lib.Traits.Numeric.max_val <: t_QCanvas)); - pow_self - = - (fun (self: t_QCanvas) (exp: t_QCanvas) -> - pow_felem_under_impl_93 self - (Core.Convert.Into.into exp <: t_QCanvas) - (Hacspec_lib.Traits.Numeric.max_val <: t_QCanvas)); - divide = (fun (self: t_QCanvas) (rhs: t_QCanvas) -> self /. rhs); - inv = (fun (self: t_QCanvas) (n: t_QCanvas) -> inv_under_impl_93 self n); - equal = (fun (self: t_QCanvas) (other: t_QCanvas) -> self =. other); - greater_than = (fun (self: t_QCanvas) (other: t_QCanvas) -> self >. other); - greater_than_or_equal = (fun (self: t_QCanvas) (other: t_QCanvas) -> self >=. other); - less_than = (fun (self: t_QCanvas) (other: t_QCanvas) -> self <. other); - less_than_or_equal = (fun (self: t_QCanvas) (other: t_QCanvas) -> self >=. other); - not_equal_bm - = - (fun (self: t_QCanvas) (other: t_QCanvas) -> - if ~.(Hacspec_lib.Traits.Numeric.equal self other <: bool) - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_82 (pub_u128 0sz)); - equal_bm - = - (fun (self: t_QCanvas) (other: t_QCanvas) -> - if Hacspec_lib.Traits.Numeric.equal self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_82 (pub_u128 0sz)); - greater_than_bm - = - (fun (self: t_QCanvas) (other: t_QCanvas) -> - if Hacspec_lib.Traits.Numeric.greater_than self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_82 (pub_u128 0sz)); - greater_than_or_equal_bm - = - (fun (self: t_QCanvas) (other: t_QCanvas) -> - if Hacspec_lib.Traits.Numeric.greater_than_or_equal self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_82 (pub_u128 0sz)); - less_than_bm - = - (fun (self: t_QCanvas) (other: t_QCanvas) -> - if Hacspec_lib.Traits.Numeric.less_than self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_82 (pub_u128 0sz)); - less_than_or_equal_bm - = - fun (self: t_QCanvas) (other: t_QCanvas) -> - if Hacspec_lib.Traits.Numeric.less_than_or_equal self other - then Hacspec_lib.Traits.Numeric.max_val - else from_literal_under_impl_82 (pub_u128 0sz) - } - -type t_Q = | Q : t_QCanvas -> t_Q - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -(* RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - *) - -let impl: Core.Convert.t_From t_Q t_QCanvas = - { - from - = - fun (x: t_QCanvas) -> - Q - (rem_under_impl_93 x - (from_hex_under_impl_81 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_QCanvas)) - } - -let impl: Core.Convert.t_Into t_Q t_QCanvas = - { into = fun (self: t_Q) -> self.Hacspec_ovn.Schnorr.Q.0 } - -let from_canvas_under_impl_130 (x: t_QCanvas) : t_Q = - Q - (rem_under_impl_93 x - (from_hex_under_impl_81 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_QCanvas)) - -let into_canvas_under_impl_130 (self: t_Q) : t_QCanvas = self.Hacspec_ovn.Schnorr.Q.0 - -let max_under_impl_130: t_QCanvas = - from_hex_under_impl_81 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - -let declassify_under_impl_130 (self: t_Q) : Num_bigint.Bigint.t_BigInt = - let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into a - -let from_hex_under_impl_130 (s: string) : t_Q = - Core.Convert.Into.into (from_hex_under_impl_81 s <: t_QCanvas) - -let from_be_bytes_under_impl_130 (v: slice u8) : t_Q = - Core.Convert.Into.into (from_be_bytes_under_impl_81 v <: t_QCanvas) - -let to_be_bytes_under_impl_130 (self: t_Q) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = - Alloc.Slice.to_vec_under_impl (Rust_primitives.unsize (to_be_bytes_under_impl_81 (Core.Convert.Into.into - self - <: - t_QCanvas) - <: - array u8 48sz) - <: - slice u8) - -let from_le_bytes_under_impl_130 (v: slice u8) : t_Q = - Core.Convert.Into.into (from_le_bytes_under_impl_81 v <: t_QCanvas) - -let to_le_bytes_under_impl_130 (self: t_Q) : Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = - Alloc.Slice.to_vec_under_impl (Rust_primitives.unsize (to_le_bytes_under_impl_81 (Core.Convert.Into.into - self - <: - t_QCanvas) - <: - array u8 48sz) - <: - slice u8) - -let bit_under_impl_130 (self: t_Q) (i: usize) : bool = - bit_under_impl_82 (Core.Convert.Into.into self <: t_QCanvas) i - -let from_literal_under_impl_130 (x: u128) : t_Q = - let big_x:Num_bigint.Biguint.t_BigUint = Core.Convert.From.from x in - let _:Prims.unit = - if - big_x >. - (Core.Convert.Into.into (max_under_impl_130 <: t_QCanvas) <: Num_bigint.Biguint.t_BigUint) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["literal "; " too big for type Q"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Q (Core.Convert.Into.into big_x) - -let from_signed_literal_under_impl_130 (x: i128) : t_Q = - let big_x:Num_bigint.Biguint.t_BigUint = Core.Convert.From.from (cast x) in - let _:Prims.unit = - if - big_x >. - (Core.Convert.Into.into (max_under_impl_130 <: t_QCanvas) <: Num_bigint.Biguint.t_BigUint) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic_fmt (Core.Fmt.new_v1_under_impl_2 (Rust_primitives.unsize - (let l = ["literal "; " too big for type Q"] in - assert_norm (List.Tot.length l == 2); - Rust_primitives.Hax.array_of_list l) - <: - slice string) - (Rust_primitives.unsize (let l = - [Core.Fmt.Rt.new_display_under_impl_1 x <: Core.Fmt.Rt.t_Argument] - in - assert_norm (List.Tot.length l == 1); - Rust_primitives.Hax.array_of_list l) - <: - slice Core.Fmt.Rt.t_Argument) - <: - Core.Fmt.t_Arguments) - <: - Rust_primitives.Hax.t_Never) - in - () - in - Q (Core.Convert.Into.into big_x) - -let comp_eq_under_impl_130 (self rhs: t_Q) : t_Q = - let (x: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_eq_under_impl_81 x (Core.Convert.Into.into rhs <: t_QCanvas) - <: - t_QCanvas) - -let comp_ne_under_impl_130 (self rhs: t_Q) : t_Q = - let (x: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_ne_under_impl_81 x (Core.Convert.Into.into rhs <: t_QCanvas) - <: - t_QCanvas) - -let comp_gte_under_impl_130 (self rhs: t_Q) : t_Q = - let (x: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_gte_under_impl_81 x (Core.Convert.Into.into rhs <: t_QCanvas) - <: - t_QCanvas) - -let comp_gt_under_impl_130 (self rhs: t_Q) : t_Q = - let (x: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_gt_under_impl_81 x (Core.Convert.Into.into rhs <: t_QCanvas) - <: - t_QCanvas) - -let comp_lte_under_impl_130 (self rhs: t_Q) : t_Q = - let (x: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_lte_under_impl_81 x (Core.Convert.Into.into rhs <: t_QCanvas) - <: - t_QCanvas) - -let comp_lt_under_impl_130 (self rhs: t_Q) : t_Q = - let (x: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (comp_lt_under_impl_81 x (Core.Convert.Into.into rhs <: t_QCanvas) - <: - t_QCanvas) - -let neg_under_impl_130 (self: t_Q) : t_Q = - let (mod_val: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = - Core.Convert.Into.into (from_hex_under_impl_81 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_QCanvas) - in - let (s: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - let (s: Num_bigint.Bigint.t_BigInt):Num_bigint.Bigint.t_BigInt = Core.Convert.Into.into s in - let (result: t_QCanvas):t_QCanvas = - Core.Convert.Into.into (mod_val -. s <: Core.Ops.Arith.Sub.t_Output) - in - Core.Convert.Into.into result - -let impl: Core.Cmp.t_PartialOrd t_Q t_Q = - { - partial_cmp - = - fun (self: t_Q) (other: t_Q) -> Core.Option.Option_Some (Core.Cmp.Ord.cmp self other) - } - -let impl: Core.Cmp.t_Ord t_Q = - { - cmp - = - fun (self: t_Q) (other: t_Q) -> - Core.Cmp.Ord.cmp self.Hacspec_ovn.Schnorr.Q.0 other.Hacspec_ovn.Schnorr.Q.0 - } - -let impl: Core.Cmp.t_PartialEq t_Q t_Q = - { - eq - = - fun (self: t_Q) (other: t_Q) -> self.Hacspec_ovn.Schnorr.Q.0 =. other.Hacspec_ovn.Schnorr.Q.0 - } - -let impl: Core.Cmp.t_Eq t_Q = { } - -let impl: Core.Ops.Arith.t_Add t_Q t_Q = - { - output = t_Q; - add - = - fun (self: t_Q) (rhs: t_Q) -> - let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - let (b: t_QCanvas):t_QCanvas = Core.Convert.Into.into rhs in - let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into a - in - let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into b - in - let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Add.t_Output = a +. b in - let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into (from_hex_under_impl_81 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_QCanvas) - in - let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in - let (d: t_QCanvas):t_QCanvas = Core.Convert.Into.into d in - Core.Convert.Into.into d - } - -let impl: Core.Ops.Arith.t_Sub t_Q t_Q = - { - output = t_Q; - sub - = - fun (self: t_Q) (rhs: t_Q) -> - let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - let (b: t_QCanvas):t_QCanvas = Core.Convert.Into.into rhs in - let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into a - in - let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into b - in - let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into (from_hex_under_impl_81 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_QCanvas) - in - let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Add.t_Output = - if b >. a - then - ((Core.Clone.Clone.clone max <: Num_bigint.Biguint.t_BigUint) -. b - <: - Core.Ops.Arith.Sub.t_Output) +. - a - else a -. b - in - let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in - let (d: t_QCanvas):t_QCanvas = Core.Convert.Into.into d in - Core.Convert.Into.into d - } - -let impl: Core.Ops.Arith.t_Mul t_Q t_Q = - { - output = t_Q; - mul - = - fun (self: t_Q) (rhs: t_Q) -> - let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - let (b: t_QCanvas):t_QCanvas = Core.Convert.Into.into rhs in - let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into a - in - let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into b - in - let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Mul.t_Output = a *. b in - let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into (from_hex_under_impl_81 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_QCanvas) - in - let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in - let (d: t_QCanvas):t_QCanvas = Core.Convert.Into.into d in - Core.Convert.Into.into d - } - -let impl: Core.Ops.Arith.t_Div t_Q t_Q = - { output = t_Q; div = fun (self: t_Q) (rhs: t_Q) -> self *. (inv_under_impl_124 rhs <: t_Q) } - -let impl: Core.Ops.Arith.t_Rem t_Q t_Q = - { - output = t_Q; - rem - = - fun (self: t_Q) (rhs: t_Q) -> - let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - let (b: t_QCanvas):t_QCanvas = Core.Convert.Into.into rhs in - let (a: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into a - in - let (b: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into b - in - let (c: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = a %. b in - let (max: Num_bigint.Biguint.t_BigUint):Num_bigint.Biguint.t_BigUint = - Core.Convert.Into.into (from_hex_under_impl_81 "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" - - <: - t_QCanvas) - in - let (d: Num_bigint.Biguint.t_BigUint):Core.Ops.Arith.Rem.t_Output = c %. max in - let (d: t_QCanvas):t_QCanvas = Core.Convert.Into.into d in - Core.Convert.Into.into d - } - -let impl: Core.Ops.Bit.t_Not t_Q = - { - output = t_Q; - not - = - fun (self: t_Q) -> - let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (~.a <: Core.Ops.Bit.Not.t_Output) - } - -let impl: Core.Ops.Bit.t_BitOr t_Q t_Q = - { - output = t_Q; - bitor - = - fun (self: t_Q) (rhs: t_Q) -> - let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - let (b: t_QCanvas):t_QCanvas = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a |. b <: Core.Ops.Bit.BitOr.t_Output) - } - -let impl: Core.Ops.Bit.t_BitXor t_Q t_Q = - { - output = t_Q; - bitxor - = - fun (self: t_Q) (rhs: t_Q) -> - let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - let (b: t_QCanvas):t_QCanvas = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a ^. b <: Core.Ops.Bit.BitXor.t_Output) - } - -let impl: Core.Ops.Bit.t_BitAnd t_Q t_Q = - { - output = t_Q; - bitand - = - fun (self: t_Q) (rhs: t_Q) -> - let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - let (b: t_QCanvas):t_QCanvas = Core.Convert.Into.into rhs in - Core.Convert.Into.into (a &. b <: Core.Ops.Bit.BitAnd.t_Output) - } - -let impl: Core.Ops.Bit.t_Shr t_Q usize = - { - output = t_Q; - shr - = - fun (self: t_Q) (rhs: usize) -> - let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (a <<. rhs <: Core.Ops.Bit.Shr.t_Output) - } - -let impl: Core.Ops.Bit.t_Shl t_Q usize = - { - output = t_Q; - shl - = - fun (self: t_Q) (rhs: usize) -> - let (a: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (a >>. rhs <: Core.Ops.Bit.Shl.t_Output) - } - -let inv_under_impl_124 (self: t_Q) : t_Q = - let (base: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (inv_under_impl_93 base (max_under_impl_130 <: t_QCanvas) <: t_QCanvas) - -let pow_felem_under_impl_124 (self exp: t_Q) : t_Q = - let (base: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (pow_felem_under_impl_93 base - (Core.Convert.Into.into exp <: t_QCanvas) - (max_under_impl_130 <: t_QCanvas) - <: - t_QCanvas) - -let pow_under_impl_124 (self: t_Q) (exp: u128) : t_Q = - let (base: t_QCanvas):t_QCanvas = Core.Convert.Into.into self in - Core.Convert.Into.into (pow_under_impl_93 base exp (max_under_impl_130 <: t_QCanvas) <: t_QCanvas) - -let pow2_under_impl_124 (x: usize) : t_Q = - Core.Convert.Into.into (pow2_under_impl_82 x <: t_QCanvas) - -let from_byte_seq_be_under_impl_67 (s: a) : t_Q = - Core.Convert.Into.into (from_be_bytes_under_impl_81 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (Secret_integers.t_U8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - t_QCanvas) - -let from_public_byte_seq_be_under_impl_67 (s: a) : t_Q = - Core.Convert.Into.into (from_be_bytes_under_impl_81 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> x) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - t_QCanvas) - -let to_byte_seq_be_under_impl_67 (self: t_Q) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map - (Core.Slice.iter_under_impl (Core.Ops.Deref.Deref.deref (to_be_bytes_under_impl_130 self - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) - <: - Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) - -let to_public_byte_seq_be_under_impl_67 (self: t_Q) : Hacspec_lib.Seq.t_Seq u8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (to_be_bytes_under_impl_130 self - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - -let from_byte_seq_le_under_impl_67 (s: a) : t_Q = - Core.Convert.Into.into (from_le_bytes_under_impl_81 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (fun x -> Secret_integers.declassify_under_impl_2 x <: u8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter Secret_integers.t_U8) - (Secret_integers.t_U8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - t_QCanvas) - -let from_public_byte_seq_le_under_impl_67 (s: a) : t_Q = - Core.Convert.Into.into (from_le_bytes_under_impl_81 (Alloc.Vec.as_slice_under_impl_1 (Core.Iter.Traits.Iterator.Iterator.collect - (Core.Iter.Traits.Iterator.Iterator.map (Hacspec_lib.Traits.SeqTrait.iter s - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> x) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> u8)) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - t_QCanvas) - -let to_byte_seq_le_under_impl_67 (self: t_Q) : Hacspec_lib.Seq.t_Seq Secret_integers.t_U8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (Core.Iter.Traits.Iterator.Iterator.collect (Core.Iter.Traits.Iterator.Iterator.map - (Core.Slice.iter_under_impl (Core.Ops.Deref.Deref.deref (to_le_bytes_under_impl_130 self - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - <: - slice u8) - <: - Core.Slice.Iter.t_Iter u8) - (fun x -> Secret_integers.classify_under_impl_2 x <: Secret_integers.t_U8) - <: - Core.Iter.Adapters.Map.t_Map (Core.Slice.Iter.t_Iter u8) (u8 -> Secret_integers.t_U8)) - <: - Alloc.Vec.t_Vec Secret_integers.t_U8 Alloc.Alloc.t_Global) - -let to_public_byte_seq_le_under_impl_67 (self: t_Q) : Hacspec_lib.Seq.t_Seq u8 = - Hacspec_lib.Seq.from_vec_under_impl_52 (to_le_bytes_under_impl_130 self - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - -let from_secret_literal_under_impl_67 (x: Secret_integers.t_U128) : t_Q = - Core.Convert.Into.into (from_literal_under_impl_82 (Secret_integers.declassify_under_impl_126 x - <: - u128) - <: - t_QCanvas) - -let impl: Hacspec_lib.Traits.t_NumericCopy t_Q = { } - -let impl: Hacspec_lib.Traits.t_UnsignedInteger t_Q = { } - -let impl: Hacspec_lib.Traits.t_UnsignedIntegerCopy t_Q = { } - -let impl: Hacspec_lib.Traits.t_Integer t_Q = - { - nUM_BITS = (fun -> 384sz); - zERO = (fun -> from_literal_under_impl_130 (pub_u128 0sz)); - oNE = (fun -> from_literal_under_impl_130 (pub_u128 1sz)); - tWO = (fun -> from_literal_under_impl_130 (pub_u128 2sz)); - from_literal = (fun (v_val: u128) -> from_literal_under_impl_130 v_val); - from_hex_string - = - (fun (s: Alloc.String.t_String) -> - from_hex_under_impl_130 (Core.Ops.Deref.Deref.deref (Alloc.Str.replace_under_impl_5 (Core.Ops.Deref.Deref.deref - s - <: - string) - "0x" - "" - <: - Alloc.String.t_String) - <: - string)); - get_bit - = - (fun (self: t_Q) (i: usize) -> - (self <<. i <: Core.Ops.Bit.Shr.t_Output) &. (Hacspec_lib.Traits.Integer.v_ONE <: t_Q)); - set_bit - = - (fun (self: t_Q) (b: t_Q) (i: usize) -> - let _:Prims.unit = - if true - then - let _:Prims.unit = - if - ~.(Prims.op_BarBar (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b - <: - t_Q) - (Hacspec_lib.Traits.Integer.v_ONE <: t_Q) - <: - bool) - (Hacspec_lib.Traits.Numeric.equal (Core.Clone.Clone.clone b <: t_Q) - (Hacspec_lib.Traits.Integer.v_ZERO <: t_Q) - <: - bool)) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO())" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - () - in - let tmp1:t_Q = from_literal_under_impl_130 (~.(pub_u128 1sz >>. i <: u128) <: u128) in - let tmp2:Core.Ops.Bit.Shl.t_Output = b >>. i in - (self &. tmp1 <: Core.Ops.Bit.BitAnd.t_Output) |. tmp2); - set - = - (fun (self: t_Q) (pos: usize) (y: t_Q) (yi: usize) -> - let b:t_Q = Hacspec_lib.Traits.Integer.get_bit y yi in - Hacspec_lib.Traits.Integer.set_bit self b pos); - rotate_left - = - (fun (self: t_Q) (n: usize) -> - let _:Prims.unit = - if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - ((Core.Clone.Clone.clone self <: t_Q) >>. n <: Core.Ops.Bit.Shl.t_Output) |. - (self <<. - (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. - (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) - <: - usize) - <: - Core.Ops.Bit.Shr.t_Output)); - rotate_right - = - fun (self: t_Q) (n: usize) -> - let _:Prims.unit = - if ~.(n <. Hacspec_lib.Traits.Integer.v_NUM_BITS <: bool) - then - let ():Prims.unit = - Rust_primitives.Hax.never_to_any (Core.Panicking.panic "assertion failed: n < Self::NUM_BITS" - - <: - Rust_primitives.Hax.t_Never) - in - () - in - ((Core.Clone.Clone.clone self <: t_Q) <<. n <: Core.Ops.Bit.Shr.t_Output) |. - (self >>. - (cast (Core.Ops.Arith.Neg.neg (cast n) <: i32) &. - (Hacspec_lib.Traits.Integer.v_NUM_BITS -. 1sz <: usize) - <: - usize) - <: - Core.Ops.Bit.Shl.t_Output) - } - -let impl: Hacspec_lib.Traits.t_ModNumeric t_Q = - { - sub_mod = (fun (self: t_Q) (rhs: t_Q) (n: t_Q) -> self -. rhs); - add_mod = (fun (self: t_Q) (rhs: t_Q) (n: t_Q) -> self +. rhs); - mul_mod = (fun (self: t_Q) (rhs: t_Q) (n: t_Q) -> self *. rhs); - pow_mod = (fun (self: t_Q) (exp: t_Q) (n: t_Q) -> pow_felem_under_impl_124 self exp); - modulo = (fun (self: t_Q) (n: t_Q) -> self %. n); - signed_modulo = (fun (self: t_Q) (n: t_Q) -> Hacspec_lib.Traits.ModNumeric.modulo self n); - absolute = fun (self: t_Q) -> self - } - -let impl: Hacspec_lib.Traits.t_Numeric t_Q = - { - max_val - = - (fun -> - Core.Convert.Into.into ((max_under_impl_130 <: t_QCanvas) -. - (from_literal_under_impl_82 (pub_u128 1sz) <: t_QCanvas) - <: - Core.Ops.Arith.Sub.t_Output)); - wrap_add = (fun (self: t_Q) (rhs: t_Q) -> self +. rhs); - wrap_sub = (fun (self: t_Q) (rhs: t_Q) -> self -. rhs); - wrap_mul = (fun (self: t_Q) (rhs: t_Q) -> self *. rhs); - wrap_div = (fun (self: t_Q) (rhs: t_Q) -> self /. rhs); - exp - = - (fun (self: t_Q) (exp: u32) -> pow_under_impl_124 self (Core.Convert.Into.into exp <: u128)); - pow_self = (fun (self: t_Q) (exp: t_Q) -> pow_felem_under_impl_124 self exp); - divide = (fun (self: t_Q) (rhs: t_Q) -> self /. rhs); - inv = (fun (self: t_Q) (n: t_Q) -> inv_under_impl_124 self); - equal = (fun (self: t_Q) (other: t_Q) -> self =. other); - greater_than = (fun (self: t_Q) (other: t_Q) -> self >. other); - greater_than_or_equal = (fun (self: t_Q) (other: t_Q) -> self >=. other); - less_than = (fun (self: t_Q) (other: t_Q) -> self <. other); - less_than_or_equal = (fun (self: t_Q) (other: t_Q) -> self <=. other); - not_equal_bm - = - (fun (self: t_Q) (other: t_Q) -> - if self <>. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_Q) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_Q) - else Hacspec_lib.Traits.Integer.v_ZERO); - equal_bm - = - (fun (self: t_Q) (other: t_Q) -> - if self =. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_Q) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_Q) - else Hacspec_lib.Traits.Integer.v_ZERO); - greater_than_bm - = - (fun (self: t_Q) (other: t_Q) -> - if self >. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_Q) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_Q) - else Hacspec_lib.Traits.Integer.v_ZERO); - greater_than_or_equal_bm - = - (fun (self: t_Q) (other: t_Q) -> - if self >=. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_Q) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_Q) - else Hacspec_lib.Traits.Integer.v_ZERO); - less_than_bm - = - (fun (self: t_Q) (other: t_Q) -> - if self <. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_Q) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_Q) - else Hacspec_lib.Traits.Integer.v_ZERO); - less_than_or_equal_bm - = - fun (self: t_Q) (other: t_Q) -> - if self <=. other - then - ((Hacspec_lib.Traits.Integer.v_ONE <: t_Q) >>. (384sz -. 1sz <: usize) - <: - Core.Ops.Bit.Shl.t_Output) -. - (Hacspec_lib.Traits.Integer.v_ONE <: t_Q) - else Hacspec_lib.Traits.Integer.v_ZERO - } - -let t_Witness = t_Q - -let t_Statement = t_G - -let t_Message = t_G - -let t_Challenge = t_Q - -let t_Response = t_G - -let t_Transcript = (t_G & t_G & t_Q & t_G) - -let prod_assoc (statement, message: (t_G & t_G)) : Hacspec_ovn.Schnorr.Random_oracle.t_Query = - Hacspec_lib.Traits.Integer.v_ONE - -let verify (h a: t_G) (e: t_Q) (z: t_G) : bool = false - -let fiat_shamir_verify (t: (t_G & t_G & t_Q & t_G)) : bool = - let v_QUERIES:Std.Collections.Hash.Map.t_HashMap Hacspec_ovn.Schnorr.Random_oracle.t_Query - Hacspec_ovn.Schnorr.Random_oracle.t_Random - Std.Collections.Hash.Map.t_RandomState = - Std.Collections.Hash.Map.new_under_impl - in - let h, a, e, z:(t_G & t_G & t_Q & t_G) = t in - let v_QUERIES, eu:(Std.Collections.Hash.Map.t_HashMap Hacspec_ovn.Schnorr.Random_oracle.t_Query - Hacspec_ovn.Schnorr.Random_oracle.t_Random - Std.Collections.Hash.Map.t_RandomState & - Hacspec_ovn.Schnorr.Random_oracle.t_Random) = - Hacspec_ovn.Schnorr.Random_oracle.random_oracle_query v_QUERIES - (prod_assoc (h, a) <: Hacspec_ovn.Schnorr.Random_oracle.t_Query) - in - verify h a e z - -let t_Relation = (t_G & t_Q) - -let v_Commit (h: t_G) (w: t_Q) : t_G = - let r:Hacspec_ovn.Schnorr.Random_oracle.t_Random = - Hacspec_ovn.Schnorr.Random_oracle.sample_uniform - in - let commit:Hacspec_ovn.Schnorr.Random_oracle.t_Random = r in - Hacspec_lib.Traits.Integer.v_ONE - -let v_Response: Rust_primitives.Hax.t_Never = - Rust_primitives.Hax.failure "AST import:Fatal error: something we considered as impossible occurred! Please report this by submitting an issue on GitHub!\nDetails: [import_thir:literal] got an error literal: this means the Rust compiler or Hax's frontend probably reported errors above.\n" - "{ Types.attributes = [];\n contents =\n Types.Literal {\n lit =\n { Types.node = Types.Err;\n span =\n { Types.filename = (Types.Real (Types.LocalPath \"ovn/src/ovn.rs\"));\n hi = { Types.col = 0; line = 1 }; lo = { Types.col = 0; line = 1 } }\n };\n neg = false};\n hir_id = None;\n span =\n { Types.filename = (Types.Real (Types.LocalPath \"ovn/src/schnorr.rs\"));\n hi = { Types.col = 80; line = 102 }; lo = { Types.col = 0; line = 102 } };\n ty = Types.Never }" - -let fiat_shamir_run: Rust_primitives.Hax.t_Never = - Rust_primitives.Hax.failure "AST import:Fatal error: something we considered as impossible occurred! Please report this by submitting an issue on GitHub!\nDetails: [import_thir:literal] got an error literal: this means the Rust compiler or Hax's frontend probably reported errors above.\n" - "{ Types.attributes = [];\n contents =\n Types.Literal {\n lit =\n { Types.node = Types.Err;\n span =\n { Types.filename = (Types.Real (Types.LocalPath \"ovn/src/ovn.rs\"));\n hi = { Types.col = 0; line = 1 }; lo = { Types.col = 0; line = 1 } }\n };\n neg = false};\n hir_id = None;\n span =\n { Types.filename = (Types.Real (Types.LocalPath \"ovn/src/schnorr.rs\"));\n hi = { Types.col = 47; line = 108 }; lo = { Types.col = 0; line = 108 } };\n ty = Types.Never }" \ No newline at end of file diff --git a/ovn/proofs/fstar/extraction/Hacspec_ovn.fst b/ovn/proofs/fstar/extraction/Hacspec_ovn.fst deleted file mode 100644 index 34fac55..0000000 --- a/ovn/proofs/fstar/extraction/Hacspec_ovn.fst +++ /dev/null @@ -1,9 +0,0 @@ -module Hacspec_ovn -#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" -open Core - -let construct: Prims.unit = () - -let vote: Prims.unit = () - -let exec: Prims.unit = () \ No newline at end of file diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 886abd3..60d98d6 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -89,13 +89,11 @@ Equations register_vote {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Loca letbm prod1 loc(prod1_loc) := (one) : both _ _ (t_group_type) in letb prod1 := foldi_both(* _list *) (into_iter (Build_t_Range (ret_both (0 : uint_size)) (i .- (ret_both (1 : uint_size))))) (fun {L I _ _} =>fun j => ssp (fun prod1 => - letb prod1 := prod prod1 (g_pow (gs.a[j])) :of: t_group_type in - solve_lift prod1)) prod1 :of: t_group_type in + solve_lift (prod prod1 (g_pow (gs.a[j]))))) prod1 :of: t_group_type in letb prod2 := one :of: t_group_type in letb prod1 := foldi_both(* _list *) (into_iter (Build_t_Range (i .+ (ret_both (1 : uint_size))) n)) (fun {L I _ _} =>fun j => ssp (fun prod1 => - letb prod1 := prod prod1 (g_pow (gs.a[j])) :of: t_group_type in - solve_lift prod1)) prod1 :of: t_group_type in + solve_lift (prod prod1 (g_pow (gs.a[j]))))) prod1 :of: t_group_type in letb Yi := div prod1 prod2 :of: t_group_type in solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2 :|: fset [prod1_loc]) (I1:|:I2) ('unit). Fail Next Obligation. @@ -135,22 +133,23 @@ Equations tally_votes {G : _} `{ t_Sized (G)} `{ t_Group (G)} : both (fset [tall ssp (fun _ => letb _ := check_valid zkp :of: 'bool in solve_lift (ret_both (tt : 'unit)))) (ret_both (tt : 'unit)) :of: 'unit in - letbm vote_result loc(vote_result_loc) := (one) : both (fset []) (fset []) (t_group_type) in + letbm vote_result loc(vote_result_loc) := (one) :of0: (t_group_type) in letb vote_result := foldi_both(* _list *) (into_iter (Build_t_Range (ret_both (0 : uint_size)) (len(* _under_impl_1 *) g_pow_vi))) (fun {L I _ _} =>fun i => ssp (fun vote_result => - letb vote_result := prod vote_result (prod (clone (g_pow_xi_yi.a[i])) (clone (g_pow_vi.a[i]))) :of: t_group_type in - solve_lift vote_result)) vote_result :of: t_group_type in + solve_lift (prod vote_result (prod (clone (g_pow_xi_yi.a[i])) (clone (g_pow_vi.a[i])))))) vote_result :of: t_group_type in letbm tally loc(tally_loc) := (ret_both (0 : uint_size)) : both _ _ (uint_size) in letb tally := foldi_both(* _list *) (into_iter (Build_t_Range (ret_both (1 : uint_size)) n)) (fun {L I _ _} =>fun i => ssp (fun tally => - solve_lift ifb solve_lift ((g_pow i) =.? vote_result) + solve_lift (ifb (g_pow i) =.? vote_result then letb tally := i :of: uint_size in tally - else tally - )) (solve_lift tally : both (fset [tally_loc; vote_result_loc]) [interface] _) :of: uint_size in + else tally))) (solve_lift tally : both (fset [tally_loc; vote_result_loc]) ([interface ]) (uint_size)) :of: uint_size in solve_lift tally : both (fset [tally_loc; vote_result_loc]) ([interface ]) (uint_size). Next Obligation. - unfold tally_votes_obligations_obligation_15. + noramlize_fset ; + repeat (rewrite is_true_split_and || rewrite fsubUset) ; + repeat (try rewrite andb_true_intro ; split) ; + repeat (solve_match || apply fsubsetU ; rewrite is_true_split_or ; (left ; solve_match) || right). refine (fsubset_trans _ i1). solve_ssprove_obligations. Defined. diff --git a/ovn/src/ovn_template.rs b/ovn/src/ovn_template.rs index 334dd09..74f2eb7 100644 --- a/ovn/src/ovn_template.rs +++ b/ovn/src/ovn_template.rs @@ -43,7 +43,7 @@ pub fn check_valid(zkp : usize) -> bool { } pub fn broadcast1(xi : G::group_type, zkp : usize, i : usize) { - () + } pub fn register_vote(i : usize, random : usize) { @@ -52,23 +52,19 @@ pub fn register_vote(i : usize, random : usize) { let (gs, zkps) = get_broadcast1(); for zkp in zkps { - check_valid(zkp); - () + check_valid(zkp); () } let mut prod1 = G::one(); for j in 0..i-1 { prod1 = G::prod(prod1, G::g_pow(gs[j])); - () } let prod2 = G::one(); for j in i+1..n { prod1 = G::prod(prod1, G::g_pow(gs[j])); - () } let Yi = G::div(prod1, prod2); // implicityly: Y_i = g^y_i - () } // Meta Round: @@ -85,7 +81,7 @@ pub fn ZKP_one_out_of_two(vi : bool) -> usize { } pub fn broadcast2 (g_pow_xiyi : G::group_type, g_pow_vi : G::group_type, g_pow_vi_zkp : usize) { - () + } pub fn get_broadcast2 () -> (Vec,Vec,Vec) { @@ -94,7 +90,6 @@ pub fn get_broadcast2 () -> (Vec,Vec,Ve pub fn cast_vote(xi : usize, yi : usize, vi : bool) { broadcast2::(G::g_pow(xi * yi), G::g_pow(if vi { 1 } else { 0 }), ZKP_one_out_of_two(vi)); - () } // Meta Round: @@ -108,14 +103,12 @@ pub fn cast_vote(xi : usize, yi : usize, vi : bool) { pub fn tally_votes() -> usize { let (g_pow_xi_yi, g_pow_vi, zkps) = get_broadcast2::(); for zkp in zkps { - check_valid(zkp); - () + check_valid(zkp); () } let mut vote_result = G::one(); for i in 0..g_pow_vi.len() { vote_result = G::prod(vote_result, G::prod(g_pow_xi_yi[i].clone(), g_pow_vi[i].clone())); - () } let mut tally = 0; From 4c19547d4b9c1e0edfa86a2d984a2638a8745d41 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Mon, 21 Aug 2023 18:45:26 +0200 Subject: [PATCH 12/86] ovn_template with tests --- ovn/Cargo.toml | 4 + ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 85 ++++++++++++------ ovn/src/ovn_template.rs | 98 +++++++++++++++++++-- 3 files changed, 152 insertions(+), 35 deletions(-) diff --git a/ovn/Cargo.toml b/ovn/Cargo.toml index 1a92989..37061b2 100644 --- a/ovn/Cargo.toml +++ b/ovn/Cargo.toml @@ -9,6 +9,10 @@ path = "src/ovn_template.rs" [dependencies] hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } +creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "1cca2320e262b2ec9d28b3c84cba759c96829898" } # branch = master + +quickcheck = "1" +quickcheck_macros = "1" [dev-dependencies] criterion = "0.4" diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 60d98d6..3b71a02 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -24,6 +24,9 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. +(** Tool: prelude_import _ **) + +(** Tool: macro_use _ **) (*Not implemented yet? todo(item)*) Require Import Core. @@ -32,36 +35,46 @@ Export Core. Require Import Hacspec_lib. Export Hacspec_lib. +Require Import Creusot_contracts. +Export Creusot_contracts. + +(** DocComment: Interface for group implementation **) Class t_Group (Self : choice_type) := { t_group_type : choice_type ; - t_group_type_t_EqDec :> EqDec (t_group_type) ; + t_group_type_t_Group :> t_Group (t_group_type) ; q : forall {L0 I0}, both L0 I0 (uint_size) ; g : forall {L0 I0}, both L0 I0 (t_group_type) ; g_pow : forall {L0 I0}, both L0 I0 (uint_size) -> both L0 I0 (t_group_type) ; + pow : forall {L0 L1 I0 I1}, both L0 I0 (t_group_type) -> both L1 I1 (uint_size) -> both (L0 :|: L1) (I0 :|: I1) (t_group_type) ; one : forall {L0 I0}, both L0 I0 (t_group_type) ; prod : forall {L0 L1 I0 I1}, both L0 I0 (t_group_type) -> both L1 I1 (t_group_type) -> both (L0 :|: L1) (I0 :|: I1) (t_group_type) ; div : forall {L0 L1 I0 I1}, both L0 I0 (t_group_type) -> both L1 I1 (t_group_type) -> both (L0 :|: L1) (I0 :|: I1) (t_group_type) ; random_element : forall {L0 I0}, both L0 I0 (t_group_type) ; }. +(** DocComment: number of parties **) Equations n : both (fset []) ([interface ]) (uint_size) := n := solve_lift (ret_both (3 : uint_size)) : both (fset []) ([interface ]) (uint_size). Fail Next Obligation. +(** Tool: cfg _ not(simple_test) +DocComment: Currently randomness needs to be injected **) Equations select_private_voting_key {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := select_private_voting_key random := solve_lift (random .% q) : both (L1) (I1) (uint_size). Fail Next Obligation. +(** DocComment: TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics **) Equations v_ZKP {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (xi : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := v_ZKP xi := solve_lift (ret_both (0 : uint_size)) : both (L1) (I1) (uint_size). Fail Next Obligation. +(** DocComment: State of bulletin board **) Equations get_broadcast1 : both (fset []) ([interface ]) ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))) := get_broadcast1 := - solve_lift (prod_b (new(* _under_impl *):of0:_,new(* _under_impl *):of0:_)) : both (fset []) ([interface ]) ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))). + solve_lift (prod_b (new_under_impl,new_under_impl)) : both (fset []) ([interface ]) ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))). Fail Next Obligation. Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (uint_size)) : both (L1) (I1) ('bool) := @@ -74,30 +87,36 @@ Equations broadcast1 {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Locatio solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). Fail Next Obligation. -Definition prod1_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := - (t_group_type ; 0%nat). -Equations register_vote {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (i : both L1 I1 (uint_size)) (random : both L2 I2 (uint_size)) : both (L1:|:L2 :|: fset [prod1_loc]) (I1:|:I2) ('unit) := - register_vote i random := +(** DocComment: Primary function in round 1 **) +Equations register_vote_pre {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (i : both L1 I1 (uint_size)) (random : both L2 I2 (uint_size)) : both (L1:|:L2) (I1:|:I2) (uint_size) := + register_vote_pre i random := letb xi := select_private_voting_key random :of: uint_size in letb _ := broadcast1 (g_pow xi) (v_ZKP xi) i :of: 'unit in letb _ := ret_both (tt : 'unit) :of: 'unit in - letb '(gs,zkps) := get_broadcast1 :of: (t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global)) in + solve_lift xi : both (L1:|:L2) (I1:|:I2) (uint_size). +Fail Next Obligation. + +(** DocComment: Primary function in round 1 **) +Definition prod1_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := + (t_group_type ; 0%nat). +Equations register_vote_post {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (i : both L1 I1 (uint_size)) (gs : both L2 I2 (t_Vec (uint_size) (t_Global))) (zkps : both L3 I3 (t_Vec (uint_size) (t_Global))) : both (L1:|:L2:|:L3 :|: fset [prod1_loc]) (I1:|:I2:|:I3) (t_group_type) := + register_vote_post i gs zkps := letb _ := foldi_both_list (into_iter zkps) (fun {L I _ _} =>fun zkp => ssp (fun _ => letb _ := check_valid zkp :of: 'bool in solve_lift (ret_both (tt : 'unit)))) (ret_both (tt : 'unit)) :of: 'unit in letbm prod1 loc(prod1_loc) := (one) : both _ _ (t_group_type) in - letb prod1 := foldi_both(* _list *) (into_iter (Build_t_Range (ret_both (0 : uint_size)) (i .- (ret_both (1 : uint_size))))) (fun {L I _ _} =>fun j => + letb prod1 := foldi_both_list (into_iter (Build_t_Range (ret_both (0 : uint_size)) (i .- (ret_both (1 : uint_size))))) (fun {L I _ _} =>fun j => ssp (fun prod1 => solve_lift (prod prod1 (g_pow (gs.a[j]))))) prod1 :of: t_group_type in letb prod2 := one :of: t_group_type in - letb prod1 := foldi_both(* _list *) (into_iter (Build_t_Range (i .+ (ret_both (1 : uint_size))) n)) (fun {L I _ _} =>fun j => + letb prod1 := foldi_both_list (into_iter (Build_t_Range (i .+ (ret_both (1 : uint_size))) n)) (fun {L I _ _} =>fun j => ssp (fun prod1 => solve_lift (prod prod1 (g_pow (gs.a[j]))))) prod1 :of: t_group_type in - letb Yi := div prod1 prod2 :of: t_group_type in - solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2 :|: fset [prod1_loc]) (I1:|:I2) ('unit). + solve_lift (div prod1 prod2) : both (L1:|:L2:|:L3 :|: fset [prod1_loc]) (I1:|:I2:|:I3) (t_group_type). Fail Next Obligation. +(** DocComment: Cramer, Damgård and Schoenmakers (CDS) technique **) Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {I1 : Interface} (vi : both L1 I1 ('bool)) : both (L1) (I1) (uint_size) := v_ZKP_one_out_of_two vi := solve_lift (ret_both (32 : uint_size)) : both (L1) (I1) (uint_size). @@ -110,18 +129,20 @@ Fail Next Obligation. Equations get_broadcast2 {G : _} `{ t_Sized (G)} `{ t_Group (G)} : both (fset []) ([interface ]) ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))) := get_broadcast2 := - solve_lift (prod_b (new(* _under_impl *):of0:_,new(* _under_impl *):of0:_,new(* _under_impl *):of0:_)) : both (fset []) ([interface ]) ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))). + solve_lift (prod_b (new_under_impl,new_under_impl,new_under_impl)) : both (fset []) ([interface ]) ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))). Fail Next Obligation. -Equations cast_vote {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (uint_size)) (yi : both L2 I2 (uint_size)) (vi : both L3 I3 ('bool)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := - cast_vote xi yi vi := - letb _ := broadcast2 (g_pow (xi .* yi)) (g_pow (ifb vi +(** DocComment: Primary function in round 2 **) +Equations cast_vote {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (uint_size)) (Yi : both L2 I2 (t_group_type)) (vi : both L3 I3 ('bool)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := + cast_vote xi Yi vi := + letb _ := broadcast2 (pow Yi xi) (g_pow (ifb vi then ret_both (1 : uint_size) else ret_both (0 : uint_size))) (v_ZKP_one_out_of_two vi) :of: 'unit in letb _ := ret_both (tt : 'unit) :of: 'unit in solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). Fail Next Obligation. +(** DocComment: Anyone can tally the votes **) Definition vote_result_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := (t_group_type ; 2%nat). Definition tally_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := @@ -133,24 +154,32 @@ Equations tally_votes {G : _} `{ t_Sized (G)} `{ t_Group (G)} : both (fset [tall ssp (fun _ => letb _ := check_valid zkp :of: 'bool in solve_lift (ret_both (tt : 'unit)))) (ret_both (tt : 'unit)) :of: 'unit in - letbm vote_result loc(vote_result_loc) := (one) :of0: (t_group_type) in - letb vote_result := foldi_both(* _list *) (into_iter (Build_t_Range (ret_both (0 : uint_size)) (len(* _under_impl_1 *) g_pow_vi))) (fun {L I _ _} =>fun i => + letbm vote_result loc(vote_result_loc) := (one) : both _ _ (t_group_type) in + letb vote_result := foldi_both_list (into_iter (Build_t_Range (ret_both (0 : uint_size)) (len_under_impl_1 g_pow_vi))) (fun {L I _ _} =>fun i => ssp (fun vote_result => solve_lift (prod vote_result (prod (clone (g_pow_xi_yi.a[i])) (clone (g_pow_vi.a[i])))))) vote_result :of: t_group_type in letbm tally loc(tally_loc) := (ret_both (0 : uint_size)) : both _ _ (uint_size) in - letb tally := foldi_both(* _list *) (into_iter (Build_t_Range (ret_both (1 : uint_size)) n)) (fun {L I _ _} =>fun i => + letb tally := foldi_both_list (into_iter (Build_t_Range (ret_both (1 : uint_size)) n)) (fun {L I _ _} =>fun i => ssp (fun tally => solve_lift (ifb (g_pow i) =.? vote_result then letb tally := i :of: uint_size in tally - else tally))) (solve_lift tally : both (fset [tally_loc; vote_result_loc]) ([interface ]) (uint_size)) :of: uint_size in - solve_lift tally : both (fset [tally_loc; vote_result_loc]) ([interface ]) (uint_size). -Next Obligation. - noramlize_fset ; - repeat (rewrite is_true_split_and || rewrite fsubUset) ; - repeat (try rewrite andb_true_intro ; split) ; - repeat (solve_match || apply fsubsetU ; rewrite is_true_split_or ; (left ; solve_match) || right). - refine (fsubset_trans _ i1). - solve_ssprove_obligations. -Defined. + else tally))) tally :of: uint_size in + solve_lift tally : both (fset [tally_loc; vote_result_loc]) ([interface ]) (uint_size). +Fail Next Obligation. + +Definition t_votes : choice_type := + (nseq 'bool 3). +Equations Build_t_votes {L : {fset Location}} {I : Interface} (f_elems : both L I (nseq 'bool 3)) : both L I (t_votes) := + Build_t_votes f_elems := + bind_both f_elems (fun f_elems => + solve_lift (ret_both ((f_elems) : (t_votes)))) : both L I (t_votes). +Fail Next Obligation. + +Definition t_randomness : choice_type := + (nseq uint_size 3). +Equations Build_t_randomness {L : {fset Location}} {I : Interface} (f_elems : both L I (nseq uint_size 3)) : both L I (t_randomness) := + Build_t_randomness f_elems := + bind_both f_elems (fun f_elems => + solve_lift (ret_both ((f_elems) : (t_randomness)))) : both L I (t_randomness). Fail Next Obligation. diff --git a/ovn/src/ovn_template.rs b/ovn/src/ovn_template.rs index 74f2eb7..198d6a2 100644 --- a/ovn/src/ovn_template.rs +++ b/ovn/src/ovn_template.rs @@ -1,6 +1,8 @@ use core::*; use hacspec_lib::*; +use creusot_contracts::*; +/** Interface for group implementation */ pub trait Group { type group_type : PartialEq + Eq + Clone + Copy; @@ -8,6 +10,7 @@ pub trait Group { const g : Self::group_type; // Generator (elemnent of group) fn g_pow(x : usize) -> Self::group_type; + fn pow(g : Self::group_type, x : usize) -> Self::group_type; fn one() -> Self::group_type; fn prod(x : Self::group_type, y : Self::group_type) -> Self::group_type; fn div(x : Self::group_type, y : Self::group_type) -> Self::group_type; @@ -18,22 +21,27 @@ pub trait Group { // v_id : usize, // } +/** number of parties */ const n : usize = 3; // const P : [eligible_votes; 3] = // n = 3 // [eligible_votes {v_id: 0}, // eligible_votes {v_id: 1}, // eligible_votes {v_id: 2}]; +#[ensures(is_random_group_elem(random))] +#[requires(is_random(random))] +#[cfg(not(simple_test))] +/** Currently randomness needs to be injected */ pub fn select_private_voting_key (random : usize) -> usize { random % G::q // x_i \in_R Z_q; } +/** TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics */ pub fn ZKP(xi : usize) -> usize { - // TODO: Non-usizeeractive Schnorr proof using Fiat-Shamir heuristics 0 } -// State of bulletin board +/** State of bulletin board */ pub fn get_broadcast1() -> (Vec, Vec) { (Vec::new(), Vec::new()) } @@ -46,11 +54,15 @@ pub fn broadcast1(xi : G::group_type, zkp : usize, i : usize) { } -pub fn register_vote(i : usize, random : usize) { +/** Primary function in round 1 */ +pub fn register_vote_pre(i : usize, random : usize) -> usize { let xi = select_private_voting_key::(random); broadcast1::(G::g_pow(xi), ZKP::(xi), i); - let (gs, zkps) = get_broadcast1(); + xi +} +/** Primary function in round 1 */ +pub fn register_vote_post(i : usize, gs : Vec, zkps : Vec) -> G::group_type { for zkp in zkps { check_valid(zkp); () } @@ -65,6 +77,7 @@ pub fn register_vote(i : usize, random : usize) { } let Yi = G::div(prod1, prod2); // implicityly: Y_i = g^y_i + Yi } // Meta Round: @@ -75,7 +88,7 @@ pub fn register_vote(i : usize, random : usize) { // } // } -// Cramer, Damgård and Schoenmakers (CDS) technique +/** Cramer, Damgård and Schoenmakers (CDS) technique */ pub fn ZKP_one_out_of_two(vi : bool) -> usize { 32 // TODO } @@ -88,8 +101,9 @@ pub fn get_broadcast2 () -> (Vec,Vec,Ve (Vec::new(),Vec::new(),Vec::new()) } -pub fn cast_vote(xi : usize, yi : usize, vi : bool) { - broadcast2::(G::g_pow(xi * yi), G::g_pow(if vi { 1 } else { 0 }), ZKP_one_out_of_two(vi)); +/** Primary function in round 2 */ +pub fn cast_vote(xi : usize, Yi : G::group_type, vi : bool) { + broadcast2::(G::pow(Yi, xi), G::g_pow(if vi { 1 } else { 0 }), ZKP_one_out_of_two(vi)); } // Meta Round: @@ -100,6 +114,7 @@ pub fn cast_vote(xi : usize, yi : usize, vi : bool) { // } // } +/** Anyone can tally the votes */ pub fn tally_votes() -> usize { let (g_pow_xi_yi, g_pow_vi, zkps) = get_broadcast2::(); for zkp in zkps { @@ -123,3 +138,72 @@ pub fn tally_votes() -> usize { // Meta Round: // Tally + +/////////// +// Tests // +/////////// + +#[cfg(test)] +extern crate quickcheck; +#[cfg(test)] +#[macro_use(quickcheck)] +extern crate quickcheck_macros; + +#[cfg(test)] +use quickcheck::*; + +#[derive(Debug, Clone)] +struct votes { + elems: [bool;n] +} + +#[cfg(test)] +impl Arbitrary for votes { + fn arbitrary(g: &mut Gen) -> votes { + let mut a: [bool; n] = [false; n]; + for i in 0..n { + a[i] = bool::arbitrary(g); + } + votes {elems: a} + } +} + +#[derive(Debug, Clone)] +struct randomness { + elems: [usize;n] +} + +#[cfg(test)] +impl Arbitrary for randomness { + fn arbitrary(g: &mut Gen) -> randomness { + let mut a: [usize; n] = [0; n]; + for i in 0..n { + a[i] = usize::arbitrary(g); + } + randomness {elems: a} + } +} + +#[cfg(test)] +#[quickcheck] +pub fn correctness(randomness : randomness, votes : votes) -> bool { + let mut xi = Vec::new(); + for i in 0..n { + xi.push(register_vote_pre::(i, randomness.elems[i])) + } + let (gs, zkps) = get_broadcast1(); + let mut Yi = Vec::new(); + for i in 0..n { + Yi.push(register_vote_post::(i, gs, zkps)); + } + for i in 0..n { + cast_vote::(xi[i], Yi[i], votes.elems[i]) + } + let mut count = 0; + for v in votes.elems { + if v { + count = count + 1; // += 1 does not work correctly + } + } + tally_votes::() == count +} From f23a65650950ad46a58f6f390e20eac15ba937c4 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 22 Aug 2023 17:04:25 +0200 Subject: [PATCH 13/86] Smart contract version of OVN --- ovn/Cargo.toml | 9 +- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 747 ++++++++++-- ...meter.v => Hacspec_ovn_Export_cast_vote.v} | 39 +- .../Hacspec_ovn_Export_init_ovn_contract.v | 60 + .../Hacspec_ovn_Export_register_vote_pre.v | 60 + .../Hacspec_ovn_Export_tally_votes.v | 60 + .../ssprove/extraction/Hacspec_ovn_Schnorr.v | 86 -- .../Hacspec_ovn_Schnorr_Random_oracle.v | 1038 ----------------- .../ssprove/extraction/Hacspec_ovn_template.v | 165 --- ovn/src/ovn_smart.rs | 246 ++++ ovn/src/ovn_template.rs | 327 +++--- 11 files changed, 1280 insertions(+), 1557 deletions(-) rename ovn/proofs/ssprove/extraction/{Hacspec_ovn_GroupParameter.v => Hacspec_ovn_Export_cast_vote.v} (52%) create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_init_ovn_contract.v create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote_pre.v create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_tally_votes.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_template.v create mode 100644 ovn/src/ovn_smart.rs diff --git a/ovn/Cargo.toml b/ovn/Cargo.toml index 37061b2..5c6b9f3 100644 --- a/ovn/Cargo.toml +++ b/ovn/Cargo.toml @@ -5,11 +5,14 @@ authors = ["Lasse Letager Hanse "] edition = "2018" [lib] -path = "src/ovn_template.rs" +path = "src/ovn_smart.rs" [dependencies] -hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } -creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "1cca2320e262b2ec9d28b3c84cba759c96829898" } # branch = master +# hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } +# creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "1cca2320e262b2ec9d28b3c84cba759c96829898" } # branch = master +# concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850" , version = "=2.0.0" , default-features = false } # 0cffb859f736ff6726fa38600428a415d800d7b6 +concordium-std = { git = "https://github.com/Concordium/concordium-rust-smart-contracts", rev = "4d4b024b547a1f120f6d6951cbc409c94f8f146a" , version = "*" , default-features = false } # 0cffb859f736ff6726fa38600428a415d800d7b6 +concordium-std-derive = { git = "https://github.com/Concordium/concordium-rust-smart-contracts", rev = "4d4b024b547a1f120f6d6951cbc409c94f8f146a" , version = "*" , default-features = false } # 0cffb859f736ff6726fa38600428a415d800d7b6 quickcheck = "1" quickcheck_macros = "1" diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 3b71a02..80ac907 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -24,162 +24,681 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -(** Tool: prelude_import _ **) +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax +Tool: prelude_import _ **) -(** Tool: macro_use _ **) +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax +Tool: macro_use _ **) (*Not implemented yet? todo(item)*) -Require Import Core. -Export Core. +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax +Tool: macro_use _ **) +(*Not implemented yet? todo(item)*) -Require Import Hacspec_lib. -Export Hacspec_lib. +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import Concordium_std. +Export Concordium_std. -Require Import Creusot_contracts. -Export Creusot_contracts. +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import Concordium_std_derive. +Export Concordium_std_derive. -(** DocComment: Interface for group implementation **) +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax +DocComment: Interface for group implementation **) Class t_Group (Self : choice_type) := { t_group_type : choice_type ; t_group_type_t_Group :> t_Group (t_group_type) ; - q : forall {L0 I0}, both L0 I0 (uint_size) ; + q : forall {L0 I0}, both L0 I0 (int32) ; g : forall {L0 I0}, both L0 I0 (t_group_type) ; - g_pow : forall {L0 I0}, both L0 I0 (uint_size) -> both L0 I0 (t_group_type) ; - pow : forall {L0 L1 I0 I1}, both L0 I0 (t_group_type) -> both L1 I1 (uint_size) -> both (L0 :|: L1) (I0 :|: I1) (t_group_type) ; + g_pow : forall {L0 I0}, both L0 I0 (int32) -> both L0 I0 (t_group_type) ; + pow : forall {L0 L1 I0 I1}, both L0 I0 (t_group_type) -> both L1 I1 (int32) -> both (L0 :|: L1) (I0 :|: I1) (t_group_type) ; one : forall {L0 I0}, both L0 I0 (t_group_type) ; prod : forall {L0 L1 I0 I1}, both L0 I0 (t_group_type) -> both L1 I1 (t_group_type) -> both (L0 :|: L1) (I0 :|: I1) (t_group_type) ; + inv : forall {L0 I0}, both L0 I0 (t_group_type) -> both L0 I0 (t_group_type) ; div : forall {L0 L1 I0 I1}, both L0 I0 (t_group_type) -> both L1 I1 (t_group_type) -> both (L0 :|: L1) (I0 :|: I1) (t_group_type) ; - random_element : forall {L0 I0}, both L0 I0 (t_group_type) ; }. -(** DocComment: number of parties **) -Equations n : both (fset []) ([interface ]) (uint_size) := - n := - solve_lift (ret_both (3 : uint_size)) : both (fset []) ([interface ]) (uint_size). +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Definition t_z_17_ : choice_type := + 'unit. +Equations Build_t_z_17_ {L : {fset Location}} {I : Interface} : both L I (t_z_17_) := + Build_t_z_17_ := + solve_lift (ret_both ((!TODO empty tuple!) : (t_z_17_))) : both L I (t_z_17_). Fail Next Obligation. -(** Tool: cfg _ not(simple_test) +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +#[global] Instance t_z_17__t_Group : t_Group t_z_17_ := { + t_group_type := int32; + q := solve_lift (ret_both (17 : int32)); + g := solve_lift (ret_both (3 : int32)); + g_pow (x : int32) := solve_lift ((g .^ x) .% q); + pow (g : int32) (x : int32) := solve_lift ((g .^ x) .% q); + one := solve_lift (ret_both (1 : int32)); + prod (x : int32) (y : int32) := solve_lift ((x .* y) .% q); + inv (x : int32) := letbm res loc(res_loc) := ret_both (0 : int32) :of: int32 in + letb res := foldi_both_list (into_iter (Build_t_Range (ret_both (1 : int32)) q)) (fun {L I _ _} =>fun i => + ssp (fun res => + solve_lift (ifb (pow g i) =.? x + then i + else res))) res :of: int32 in + solve_lift (q .- res); + div (x : int32) (y : int32) := solve_lift (prod x (inv y)); +}. + +(*item error backend*) + +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax +Tool: export_name _ **) +Definition state_bytes_loc : Location := + (t_ContractState ; 0%nat). +Equations export_init_ovn_contract {L1 : {fset Location}} {I1 : Interface} (amount : both L1 I1 (t_Amount)) : both (L1 :|: fset [state_bytes_loc]) (I1) (int32) := + export_init_ovn_contract amount := + solve_lift (run (letb _ := ifb (f_micro_ccd amount) <> (ret_both (0 : int64)) + then letb hoist1 := v_Break (get_under_impl_56 (f_error_code (from NotPayableError))) :of: t_Never in + ControlFlow_Continue (never_to_any hoist1) + else ControlFlow_Continue (ret_both (tt : 'unit)) :of: 'unit in + ControlFlow_Continue (letb ctx := open (ret_both (tt : 'unit)) :of: t_ExternContext (t_InitContextExtern) in + matchb init_ovn_contract ctx with + | Result_Ok state => + letbm state_bytes loc(state_bytes_loc) := open (ret_both (tt : 'unit)) :of: t_ContractState in + letb '(tmp0,out) := serial state state_bytes :of: (t_ContractState × t_Result ('unit) (t_Err)) in + letb state_bytes := tmp0 :of: t_ContractState in + letb hoist2 := out :of: (t_ContractState × t_Result ('unit) (t_Err)) in + letb hoist3 := is_err_under_impl hoist2 :of: 'bool in + letb _ := ifb hoist3 + then never_to_any trap + else ret_both (tt : 'unit) :of: 'unit in + ret_both (0 : int32) + | Result_Err reject => + letb code := get_under_impl_56 (f_error_code (from reject)) :of: int32 in + ifb code <.? (ret_both (0 : int32)) + then code + else never_to_any trap + end))) : both (L1 :|: fset [state_bytes_loc]) (I1) (int32). +Fail Next Obligation. + +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Equations init_ovn_contract {impl HasInitContext : _} `{ t_Sized (impl HasInitContext)} `{ t_HasInitContext (impl HasInitContext) ('unit)} {L1 : {fset Location}} {I1 : Interface} (ctx : both L1 I1 (impl HasInitContext)) : both (L1) (I1) (t_Result ('bool) ('unit)) := + init_ovn_contract ctx := + Result_Ok (solve_lift (ret_both (true : 'bool))) : both (L1) (I1) (t_Result ('bool) ('unit)). +Fail Next Obligation. + +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax DocComment: Currently randomness needs to be injected **) -Equations select_private_voting_key {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := +Equations select_private_voting_key {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) : both (L1) (I1) (int32) := select_private_voting_key random := - solve_lift (random .% q) : both (L1) (I1) (uint_size). + solve_lift (random .% q) : both (L1) (I1) (int32). Fail Next Obligation. -(** DocComment: TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics **) -Equations v_ZKP {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (xi : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax +DocComment: TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics **) +Equations v_ZKP {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (xi : both L1 I1 (int32)) : both (L1) (I1) (int32) := v_ZKP xi := - solve_lift (ret_both (0 : uint_size)) : both (L1) (I1) (uint_size). + solve_lift (ret_both (0 : int32)) : both (L1) (I1) (int32). Fail Next Obligation. -(** DocComment: State of bulletin board **) -Equations get_broadcast1 : both (fset []) ([interface ]) ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))) := - get_broadcast1 := - solve_lift (prod_b (new_under_impl,new_under_impl)) : both (fset []) ([interface ]) ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))). +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Definition t_RegisterParam : choice_type := + (int32 × int32). +Equations Build_t_RegisterParam {L : {fset Location}} {I : Interface} (f_i : both L I (int32)) (f_xi : both L I (int32)) : both L I (t_RegisterParam) := + Build_t_RegisterParam f_i f_xi := + bind_both f_xi (fun f_xi => + bind_both f_i (fun f_i => + solve_lift (ret_both ((f_i,f_xi) : (t_RegisterParam))))) : both L I (t_RegisterParam). Fail Next Obligation. -Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (uint_size)) : both (L1) (I1) ('bool) := - check_valid zkp := - solve_lift (ret_both (true : 'bool)) : both (L1) (I1) ('bool). -Fail Next Obligation. +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Notation t_G := (t_z_17_). -Equations broadcast1 {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (t_group_type)) (zkp : both L2 I2 (uint_size)) (i : both L3 I3 (uint_size)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := - broadcast1 xi zkp i := - solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Equations n : both (fset []) ([interface ]) (uint_size) := + n := + solve_lift (ret_both (20 : uint_size)) : both (fset []) ([interface ]) (uint_size). Fail Next Obligation. -(** DocComment: Primary function in round 1 **) -Equations register_vote_pre {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (i : both L1 I1 (uint_size)) (random : both L2 I2 (uint_size)) : both (L1:|:L2) (I1:|:I2) (uint_size) := - register_vote_pre i random := - letb xi := select_private_voting_key random :of: uint_size in - letb _ := broadcast1 (g_pow xi) (v_ZKP xi) i :of: 'unit in - letb _ := ret_both (tt : 'unit) :of: 'unit in - solve_lift xi : both (L1:|:L2) (I1:|:I2) (uint_size). +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax +Tool: export_name _ **) +Equations export_register_vote_pre {L1 : {fset Location}} {I1 : Interface} (amount : both L1 I1 (t_Amount)) : both (L1) (I1) (int32) := + export_register_vote_pre amount := + solve_lift (failure (ret_both ((LocalMutation) The bindings ["state_bytes"] cannot be mutated here: they don't belong to the closure scope, and this is not allowed. + : chString)) (ret_both ({ + let _: tuple0 = { + (if core::cmp::PartialEq::ne( + proj_concordium_contracts_common::types::Amount::f_micro_ccd(amount), + 0, + ) { + { + let hoist4: rust_primitives::hax::t_Never = { + (return core::num::nonzero::get_under_impl_56( + proj_concordium_std::types::Reject::f_error_code( + core::convert::From::from(concordium_std::types::NotPayableError()), + ), + )) + }; + rust_primitives::hax::never_to_any(hoist4) + } + }) + }; + { + let ctx: concordium_std::types::t_ExternContext< + concordium_std::types::t_ReceiveContextExtern, + > = { concordium_std::traits::HasReceiveContext::open(Tuple0()) }; + { + let mut state_bytes: concordium_std::types::t_ContractState = + { concordium_std::traits::HasContractState::open(Tuple0()) }; + { + let Tuple2(tmp0, out): tuple2< + concordium_std::types::t_ContractState, + core::result::t_Result< + hacspec_ovn::t_OvnContractState< + hacspec_ovn::t_z_17_, + generic_value!(todo), + >, + concordium_contracts_common::types::t_ParseError, + >, + > = { concordium_contracts_common::traits::Get::get(state_bytes) }; + { + let _: tuple0 = { (state_bytes = tmp0) }; + { + let hoist7: tuple2< + concordium_std::types::t_ContractState, + core::result::t_Result< + hacspec_ovn::t_OvnContractState< + hacspec_ovn::t_z_17_, + generic_value!(todo), + >, + concordium_contracts_common::types::t_ParseError, + >, + > = { out }; + (match hoist7 { + core::result::Result_Ok(mut state) => { + { + let Tuple2(tmp0, out): tuple2< + hacspec_ovn::t_OvnContractState< + hacspec_ovn::t_z_17_, + generic_value!(todo), + >, + core::result::t_Result< + concordium_std::types::t_Action, + concordium_contracts_common::types::t_ParseError, + >, + > = { hacspec_ovn::register_vote_pre(ctx, state) }; + { + let _: tuple0 = { (state = tmp0) }; + { + // Note: rhs.typ=tuple2, core::result::t_Result> + let pat_ascription!(res as core::result::t_Result): core::result::t_Result = {out}; + (match res { + core::result::Result_Ok(act) => { + let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Seek::seek(state_bytes,concordium_contracts_common::traits::SeekFrom_Start(0))}; + { + let _: tuple0 = + { (state_bytes = tmp0) }; + { + let hoist6: tuple2> = {out}; + { + let hoist5: arrow!(int -> core::result::t_Result) = { + (|_| { + let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Serial::serial(state,state_bytes)}; + { + let _: tuple0 = { + (state_bytes = + tmp0) + }; + out + } + }) + }; + { + let res: core::result::t_Result = {core::result::and_then_under_impl(hoist6,hoist5)}; + (if core::result::is_err_under_impl(res){rust_primitives::hax::never_to_any(concordium_std::trap())} else {cast(concordium_std::types::tag_under_impl(act))}) + } + } + } + } + } + core::result::Result_Err(reject) => { + let code: int = { + core::num::nonzero::get_under_impl_56(proj_concordium_std::types::Reject::f_error_code(core::convert::From::from(reject))) + }; + (if core::cmp::PartialOrd::lt(code, 0) { + code + } else { + rust_primitives::hax::never_to_any( + concordium_std::trap(), + ) + }) + } + }) + } + } + } + } + _ => rust_primitives::hax::never_to_any(concordium_std::trap()), + }) + } + } + } + } + } + } : chString))) : both (L1) (I1) (int32). Fail Next Obligation. -(** DocComment: Primary function in round 1 **) -Definition prod1_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := - (t_group_type ; 0%nat). -Equations register_vote_post {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (i : both L1 I1 (uint_size)) (gs : both L2 I2 (t_Vec (uint_size) (t_Global))) (zkps : both L3 I3 (t_Vec (uint_size) (t_Global))) : both (L1:|:L2:|:L3 :|: fset [prod1_loc]) (I1:|:I2:|:I3) (t_group_type) := - register_vote_post i gs zkps := - letb _ := foldi_both_list (into_iter zkps) (fun {L I _ _} =>fun zkp => - ssp (fun _ => - letb _ := check_valid zkp :of: 'bool in - solve_lift (ret_both (tt : 'unit)))) (ret_both (tt : 'unit)) :of: 'unit in - letbm prod1 loc(prod1_loc) := (one) : both _ _ (t_group_type) in - letb prod1 := foldi_both_list (into_iter (Build_t_Range (ret_both (0 : uint_size)) (i .- (ret_both (1 : uint_size))))) (fun {L I _ _} =>fun j => - ssp (fun prod1 => - solve_lift (prod prod1 (g_pow (gs.a[j]))))) prod1 :of: t_group_type in - letb prod2 := one :of: t_group_type in - letb prod1 := foldi_both_list (into_iter (Build_t_Range (i .+ (ret_both (1 : uint_size))) n)) (fun {L I _ _} =>fun j => - ssp (fun prod1 => - solve_lift (prod prod1 (g_pow (gs.a[j]))))) prod1 :of: t_group_type in - solve_lift (div prod1 prod2) : both (L1:|:L2:|:L3 :|: fset [prod1_loc]) (I1:|:I2:|:I3) (t_group_type). +(*(RefMut) The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* + + +####################################################### +########### WARNING: Failed running rustfmt ########### +#### STDOUT: + +#### STDERR: +error: expected identifier, found keyword `impl` + --> :1:125 + | +1 | ..._vote_pre(ctx: &impl HasReceiveContext,state: &mut hacspec_ovn::t_OvnCont... + | ^^^^ expected identifier, found keyword + +error: expected one of `,`, `:`, `=`, or `>`, found `HasReceiveContext` + --> :1:130 + | +1 | ...Anonymous: 'unk, Anonymous: 'unk, impl HasReceiveContext>(ctx: &impl HasReceiveContext,state: &mut hacspec_ovn::t_OvnContractState` +####################################################### + +*/ + +#[no_std()]#[feature(register_tool)]#[register_tool(_hax)]#[doc()]fn register_vote_pre(ctx: &impl HasReceiveContext,state: &mut hacspec_ovn::t_OvnContractState) -> core::result::t_Result where A:core::marker::t_Sized,A:core::marker::t_Sized,A:concordium_std::traits::t_HasActions,A:concordium_std::traits::t_HasReceiveContext,impl HasReceiveContext:core::marker::t_Sized,impl HasReceiveContext:core::marker::t_Sized,impl HasReceiveContext:concordium_std::traits::t_HasActions,impl HasReceiveContext:concordium_std::traits::t_HasReceiveContext{{let pat_ascription!(params as hacspec_ovn::t_RegisterParam): hacspec_ovn::t_RegisterParam = {(match core::ops::try_trait::Try::branch(concordium_contracts_common::traits::Get::get(&mut (concordium_std::traits::HasCommonData::parameter_cursor(&(deref(ctx)))))) {core::ops::control_flow::ControlFlow_Break(residual) => {rust_primitives::hax::never_to_any((return core::ops::try_trait::FromResidual::from_residual(residual)))},core::ops::control_flow::ControlFlow_Continue(val) => {val}})};{let _: tuple0 = {(deref(state).f_broadcast1_a[cast(proj_hacspec_ovn::RegisterParam::f_i(params))] = hacspec_ovn::Group::g_pow(proj_hacspec_ovn::RegisterParam::f_xi(params)))};{let _: tuple0 = {(deref(state).f_broadcast1_b[cast(proj_hacspec_ovn::RegisterParam::f_i(params))] = hacspec_ovn::v_ZKP(proj_hacspec_ovn::RegisterParam::f_xi(params)))};{core::result::Result_Ok(concordium_std::traits::HasActions::accept())}}}}} todo(item)*) + +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (int32)) : both (L1) (I1) ('bool) := + check_valid zkp := + solve_lift (ret_both (true : 'bool)) : both (L1) (I1) ('bool). Fail Next Obligation. -(** DocComment: Cramer, Damgård and Schoenmakers (CDS) technique **) -Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {I1 : Interface} (vi : both L1 I1 ('bool)) : both (L1) (I1) (uint_size) := +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax +DocComment: Cramer, Damgård and Schoenmakers (CDS) technique **) +Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {I1 : Interface} (vi : both L1 I1 ('bool)) : both (L1) (I1) (int32) := v_ZKP_one_out_of_two vi := - solve_lift (ret_both (32 : uint_size)) : both (L1) (I1) (uint_size). + solve_lift (ret_both (32 : int32)) : both (L1) (I1) (int32). Fail Next Obligation. -Equations broadcast2 {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (g_pow_xiyi : both L1 I1 (t_group_type)) (g_pow_vi : both L2 I2 (t_group_type)) (g_pow_vi_zkp : both L3 I3 (uint_size)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := - broadcast2 g_pow_xiyi g_pow_vi g_pow_vi_zkp := - solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Definition t_CastVoteParam : choice_type := + (int32 × int32 × 'bool). +Equations Build_t_CastVoteParam {L : {fset Location}} {I : Interface} (f_i : both L I (int32)) (f_xi : both L I (int32)) (f_vote : both L I ('bool)) : both L I (t_CastVoteParam) := + Build_t_CastVoteParam f_i f_xi f_vote := + bind_both f_vote (fun f_vote => + bind_both f_xi (fun f_xi => + bind_both f_i (fun f_i => + solve_lift (ret_both ((f_i,f_xi,f_vote) : (t_CastVoteParam)))))) : both L I (t_CastVoteParam). Fail Next Obligation. -Equations get_broadcast2 {G : _} `{ t_Sized (G)} `{ t_Group (G)} : both (fset []) ([interface ]) ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))) := - get_broadcast2 := - solve_lift (prod_b (new_under_impl,new_under_impl,new_under_impl)) : both (fset []) ([interface ]) ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))). +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax +Tool: export_name _ **) +Equations export_cast_vote {L1 : {fset Location}} {I1 : Interface} (amount : both L1 I1 (t_Amount)) : both (L1) (I1) (int32) := + export_cast_vote amount := + solve_lift (failure (ret_both ((LocalMutation) The bindings ["state_bytes"] cannot be mutated here: they don't belong to the closure scope, and this is not allowed. + : chString)) (ret_both ({ + let _: tuple0 = { + (if core::cmp::PartialEq::ne( + proj_concordium_contracts_common::types::Amount::f_micro_ccd(amount), + 0, + ) { + { + let hoist8: rust_primitives::hax::t_Never = { + (return core::num::nonzero::get_under_impl_56( + proj_concordium_std::types::Reject::f_error_code( + core::convert::From::from(concordium_std::types::NotPayableError()), + ), + )) + }; + rust_primitives::hax::never_to_any(hoist8) + } + }) + }; + { + let ctx: concordium_std::types::t_ExternContext< + concordium_std::types::t_ReceiveContextExtern, + > = { concordium_std::traits::HasReceiveContext::open(Tuple0()) }; + { + let mut state_bytes: concordium_std::types::t_ContractState = + { concordium_std::traits::HasContractState::open(Tuple0()) }; + { + let Tuple2(tmp0, out): tuple2< + concordium_std::types::t_ContractState, + core::result::t_Result< + hacspec_ovn::t_OvnContractState< + hacspec_ovn::t_z_17_, + generic_value!(todo), + >, + concordium_contracts_common::types::t_ParseError, + >, + > = { concordium_contracts_common::traits::Get::get(state_bytes) }; + { + let _: tuple0 = { (state_bytes = tmp0) }; + { + let hoist11: tuple2< + concordium_std::types::t_ContractState, + core::result::t_Result< + hacspec_ovn::t_OvnContractState< + hacspec_ovn::t_z_17_, + generic_value!(todo), + >, + concordium_contracts_common::types::t_ParseError, + >, + > = { out }; + (match hoist11 { + core::result::Result_Ok(mut state) => { + { + let Tuple2(tmp0, out): tuple2< + hacspec_ovn::t_OvnContractState< + hacspec_ovn::t_z_17_, + generic_value!(todo), + >, + core::result::t_Result< + concordium_std::types::t_Action, + concordium_contracts_common::types::t_ParseError, + >, + > = { hacspec_ovn::cast_vote(ctx, state) }; + { + let _: tuple0 = { (state = tmp0) }; + { + // Note: rhs.typ=tuple2, core::result::t_Result> + let pat_ascription!(res as core::result::t_Result): core::result::t_Result = {out}; + (match res { + core::result::Result_Ok(act) => { + let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Seek::seek(state_bytes,concordium_contracts_common::traits::SeekFrom_Start(0))}; + { + let _: tuple0 = + { (state_bytes = tmp0) }; + { + let hoist10: tuple2> = {out}; + { + let hoist9: arrow!(int -> core::result::t_Result) = { + (|_| { + let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Serial::serial(state,state_bytes)}; + { + let _: tuple0 = { + (state_bytes = + tmp0) + }; + out + } + }) + }; + { + let res: core::result::t_Result = {core::result::and_then_under_impl(hoist10,hoist9)}; + (if core::result::is_err_under_impl(res){rust_primitives::hax::never_to_any(concordium_std::trap())} else {cast(concordium_std::types::tag_under_impl(act))}) + } + } + } + } + } + core::result::Result_Err(reject) => { + let code: int = { + core::num::nonzero::get_under_impl_56(proj_concordium_std::types::Reject::f_error_code(core::convert::From::from(reject))) + }; + (if core::cmp::PartialOrd::lt(code, 0) { + code + } else { + rust_primitives::hax::never_to_any( + concordium_std::trap(), + ) + }) + } + }) + } + } + } + } + _ => rust_primitives::hax::never_to_any(concordium_std::trap()), + }) + } + } + } + } + } + } : chString))) : both (L1) (I1) (int32). Fail Next Obligation. -(** DocComment: Primary function in round 2 **) -Equations cast_vote {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (uint_size)) (Yi : both L2 I2 (t_group_type)) (vi : both L3 I3 ('bool)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := - cast_vote xi Yi vi := - letb _ := broadcast2 (pow Yi xi) (g_pow (ifb vi - then ret_both (1 : uint_size) - else ret_both (0 : uint_size))) (v_ZKP_one_out_of_two vi) :of: 'unit in - letb _ := ret_both (tt : 'unit) :of: 'unit in - solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). -Fail Next Obligation. +(*(RefMut) The mutation of this &mut is not allowed here. -(** DocComment: Anyone can tally the votes **) -Definition vote_result_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := - (t_group_type ; 2%nat). -Definition tally_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := - (uint_size ; 1%nat). -Equations tally_votes {G : _} `{ t_Sized (G)} `{ t_Group (G)} : both (fset [tally_loc; vote_result_loc]) ([interface ]) (uint_size) := - tally_votes := - letb '(g_pow_xi_yi,g_pow_vi,zkps) := get_broadcast2 :of: (t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global)) in - letb _ := foldi_both_list (into_iter zkps) (fun {L I _ _} =>fun zkp => - ssp (fun _ => - letb _ := check_valid zkp :of: 'bool in - solve_lift (ret_both (tt : 'unit)))) (ret_both (tt : 'unit)) :of: 'unit in - letbm vote_result loc(vote_result_loc) := (one) : both _ _ (t_group_type) in - letb vote_result := foldi_both_list (into_iter (Build_t_Range (ret_both (0 : uint_size)) (len_under_impl_1 g_pow_vi))) (fun {L I _ _} =>fun i => - ssp (fun vote_result => - solve_lift (prod vote_result (prod (clone (g_pow_xi_yi.a[i])) (clone (g_pow_vi.a[i])))))) vote_result :of: t_group_type in - letbm tally loc(tally_loc) := (ret_both (0 : uint_size)) : both _ _ (uint_size) in - letb tally := foldi_both_list (into_iter (Build_t_Range (ret_both (1 : uint_size)) n)) (fun {L I _ _} =>fun i => - ssp (fun tally => - solve_lift (ifb (g_pow i) =.? vote_result - then letb tally := i :of: uint_size in - tally - else tally))) tally :of: uint_size in - solve_lift tally : both (fset [tally_loc; vote_result_loc]) ([interface ]) (uint_size). -Fail Next Obligation. +Last available AST for this item: + +/* + + +####################################################### +########### WARNING: Failed running rustfmt ########### +#### STDOUT: + +#### STDERR: +error: expected identifier, found keyword `impl` + --> :1:117 + | +1 | ...cast_vote(ctx: &impl HasReceiveContext,state: &mut hacspec_ovn::t_OvnCont... + | ^^^^ expected identifier, found keyword + +error: expected one of `,`, `:`, `=`, or `>`, found `HasReceiveContext` + --> :1:122 + | +1 | ...Anonymous: 'unk, Anonymous: 'unk, impl HasReceiveContext>(ctx: &impl HasReceiveContext,state: &mut hacspec_ovn::t_OvnContractState` +####################################################### -Definition t_votes : choice_type := - (nseq 'bool 3). -Equations Build_t_votes {L : {fset Location}} {I : Interface} (f_elems : both L I (nseq 'bool 3)) : both L I (t_votes) := - Build_t_votes f_elems := - bind_both f_elems (fun f_elems => - solve_lift (ret_both ((f_elems) : (t_votes)))) : both L I (t_votes). +*/ + +#[no_std()]#[feature(register_tool)]#[register_tool(_hax)]#[doc()]fn cast_vote(ctx: &impl HasReceiveContext,state: &mut hacspec_ovn::t_OvnContractState) -> core::result::t_Result where A:core::marker::t_Sized,A:core::marker::t_Sized,A:concordium_std::traits::t_HasActions,A:concordium_std::traits::t_HasReceiveContext,impl HasReceiveContext:core::marker::t_Sized,impl HasReceiveContext:core::marker::t_Sized,impl HasReceiveContext:concordium_std::traits::t_HasActions,impl HasReceiveContext:concordium_std::traits::t_HasReceiveContext{{let pat_ascription!(params as hacspec_ovn::t_CastVoteParam): hacspec_ovn::t_CastVoteParam = {(match core::ops::try_trait::Try::branch(concordium_contracts_common::traits::Get::get(&mut (concordium_std::traits::HasCommonData::parameter_cursor(&(deref(ctx)))))) {core::ops::control_flow::ControlFlow_Break(residual) => {rust_primitives::hax::never_to_any((return core::ops::try_trait::FromResidual::from_residual(residual)))},core::ops::control_flow::ControlFlow_Continue(val) => {val}})};{let _: tuple0 = {{for zkp in (core::iter::traits::collect::IntoIterator::into_iter(proj_hacspec_ovn::OvnContractState::f_broadcast1_b(deref(state)))) { {let _: bool = {hacspec_ovn::check_valid(zkp)};{Tuple0()}} }}};{let mut prod1: int = {hacspec_ovn::Group::one()};{let _: tuple0 = {{for j in (core::iter::traits::collect::IntoIterator::into_iter(core::ops::range::Range{f_start:0,f_end:cast(core::ops::arith::Sub::sub(proj_hacspec_ovn::CastVoteParam::f_i(params),1)),})) { (prod1 = hacspec_ovn::Group::prod(prod1,core::ops::index::Index::index(proj_hacspec_ovn::OvnContractState::f_broadcast1_a(deref(state)),j))) }}};{let prod2: int = {hacspec_ovn::Group::one()};{let _: tuple0 = {{for j in (core::iter::traits::collect::IntoIterator::into_iter(core::ops::range::Range{f_start:cast(core::ops::arith::Add::add(proj_hacspec_ovn::CastVoteParam::f_i(params),1)),f_end:hacspec_ovn::n,})) { (prod2 = hacspec_ovn::Group::prod(prod2,core::ops::index::Index::index(proj_hacspec_ovn::OvnContractState::f_broadcast1_a(deref(state)),j))) }}};{let Yi: int = {hacspec_ovn::Group::div(prod1,prod2)};{let _: tuple0 = {(deref(state).f_broadcast2_a[cast(proj_hacspec_ovn::CastVoteParam::f_i(params))] = hacspec_ovn::Group::pow(Yi,proj_hacspec_ovn::CastVoteParam::f_xi(params)))};{let _: tuple0 = {(deref(state).f_broadcast2_b[cast(proj_hacspec_ovn::CastVoteParam::f_i(params))] = hacspec_ovn::Group::g_pow((if proj_hacspec_ovn::CastVoteParam::f_vote(params){{1}} else {{0}})))};{let _: tuple0 = {(deref(state).f_broadcast2_c[cast(proj_hacspec_ovn::CastVoteParam::f_i(params))] = hacspec_ovn::v_ZKP_one_out_of_two(proj_hacspec_ovn::CastVoteParam::f_vote(params)))};{core::result::Result_Ok(concordium_std::traits::HasActions::accept())}}}}}}}}}}}} todo(item)*) + +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Definition t_TallyParameter : choice_type := + 'unit. +Equations Build_t_TallyParameter {L : {fset Location}} {I : Interface} : both L I (t_TallyParameter) := + Build_t_TallyParameter := + solve_lift (ret_both ((!TODO empty tuple!) : (t_TallyParameter))) : both L I (t_TallyParameter). Fail Next Obligation. -Definition t_randomness : choice_type := - (nseq uint_size 3). -Equations Build_t_randomness {L : {fset Location}} {I : Interface} (f_elems : both L I (nseq uint_size 3)) : both L I (t_randomness) := - Build_t_randomness f_elems := - bind_both f_elems (fun f_elems => - solve_lift (ret_both ((f_elems) : (t_randomness)))) : both L I (t_randomness). +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax +Tool: export_name _ **) +Equations export_tally_votes {L1 : {fset Location}} {I1 : Interface} (amount : both L1 I1 (t_Amount)) : both (L1) (I1) (int32) := + export_tally_votes amount := + solve_lift (failure (ret_both ((LocalMutation) The bindings ["state_bytes"] cannot be mutated here: they don't belong to the closure scope, and this is not allowed. + : chString)) (ret_both ({ + let _: tuple0 = { + (if core::cmp::PartialEq::ne( + proj_concordium_contracts_common::types::Amount::f_micro_ccd(amount), + 0, + ) { + { + let hoist12: rust_primitives::hax::t_Never = { + (return core::num::nonzero::get_under_impl_56( + proj_concordium_std::types::Reject::f_error_code( + core::convert::From::from(concordium_std::types::NotPayableError()), + ), + )) + }; + rust_primitives::hax::never_to_any(hoist12) + } + }) + }; + { + let ctx: concordium_std::types::t_ExternContext< + concordium_std::types::t_ReceiveContextExtern, + > = { concordium_std::traits::HasReceiveContext::open(Tuple0()) }; + { + let mut state_bytes: concordium_std::types::t_ContractState = + { concordium_std::traits::HasContractState::open(Tuple0()) }; + { + let Tuple2(tmp0, out): tuple2< + concordium_std::types::t_ContractState, + core::result::t_Result< + hacspec_ovn::t_OvnContractState< + hacspec_ovn::t_z_17_, + generic_value!(todo), + >, + concordium_contracts_common::types::t_ParseError, + >, + > = { concordium_contracts_common::traits::Get::get(state_bytes) }; + { + let _: tuple0 = { (state_bytes = tmp0) }; + { + let hoist15: tuple2< + concordium_std::types::t_ContractState, + core::result::t_Result< + hacspec_ovn::t_OvnContractState< + hacspec_ovn::t_z_17_, + generic_value!(todo), + >, + concordium_contracts_common::types::t_ParseError, + >, + > = { out }; + (match hoist15 { + core::result::Result_Ok(mut state) => { + { + let Tuple2(tmp0, out): tuple2< + hacspec_ovn::t_OvnContractState< + hacspec_ovn::t_z_17_, + generic_value!(todo), + >, + core::result::t_Result< + concordium_std::types::t_Action, + concordium_contracts_common::types::t_ParseError, + >, + > = { hacspec_ovn::tally_votes(ctx, state) }; + { + let _: tuple0 = { (state = tmp0) }; + { + // Note: rhs.typ=tuple2, core::result::t_Result> + let pat_ascription!(res as core::result::t_Result): core::result::t_Result = {out}; + (match res { + core::result::Result_Ok(act) => { + let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Seek::seek(state_bytes,concordium_contracts_common::traits::SeekFrom_Start(0))}; + { + let _: tuple0 = + { (state_bytes = tmp0) }; + { + let hoist14: tuple2> = {out}; + { + let hoist13: arrow!(int -> core::result::t_Result) = { + (|_| { + let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Serial::serial(state,state_bytes)}; + { + let _: tuple0 = { + (state_bytes = + tmp0) + }; + out + } + }) + }; + { + let res: core::result::t_Result = {core::result::and_then_under_impl(hoist14,hoist13)}; + (if core::result::is_err_under_impl(res){rust_primitives::hax::never_to_any(concordium_std::trap())} else {cast(concordium_std::types::tag_under_impl(act))}) + } + } + } + } + } + core::result::Result_Err(reject) => { + let code: int = { + core::num::nonzero::get_under_impl_56(proj_concordium_std::types::Reject::f_error_code(core::convert::From::from(reject))) + }; + (if core::cmp::PartialOrd::lt(code, 0) { + code + } else { + rust_primitives::hax::never_to_any( + concordium_std::trap(), + ) + }) + } + }) + } + } + } + } + _ => rust_primitives::hax::never_to_any(concordium_std::trap()), + }) + } + } + } + } + } + } : chString))) : both (L1) (I1) (int32). Fail Next Obligation. + +(*(RefMut) The mutation of this &mut is not allowed here. + +Last available AST for this item: + +/* + + +####################################################### +########### WARNING: Failed running rustfmt ########### +#### STDOUT: + +#### STDERR: +error: expected identifier, found keyword `impl` + --> :1:119 + | +1 | ...lly_votes(_: &impl HasReceiveContext,state: &mut hacspec_ovn::t_OvnContra... + | ^^^^ expected identifier, found keyword + +error: expected one of `,`, `:`, `=`, or `>`, found `HasReceiveContext` + --> :1:124 + | +1 | ...Anonymous: 'unk, Anonymous: 'unk, impl HasReceiveContext>(_: &impl HasReceiveContext,state: &mut hacspec_ovn::t_OvnContractState` +####################################################### + +*/ + +#[no_std()]#[feature(register_tool)]#[register_tool(_hax)]#[doc()]fn tally_votes(_: &impl HasReceiveContext,state: &mut hacspec_ovn::t_OvnContractState) -> core::result::t_Result where A:core::marker::t_Sized,A:core::marker::t_Sized,A:concordium_std::traits::t_HasActions,A:concordium_std::traits::t_HasReceiveContext,impl HasReceiveContext:core::marker::t_Sized,impl HasReceiveContext:core::marker::t_Sized,impl HasReceiveContext:concordium_std::traits::t_HasActions,impl HasReceiveContext:concordium_std::traits::t_HasReceiveContext{{let Tuple3(g_pow_xi_yi, g_pow_vi, zkps): tuple3<[int;20], [int;20], [int;20]> = {Tuple3(proj_hacspec_ovn::OvnContractState::f_broadcast2_a(deref(state)),proj_hacspec_ovn::OvnContractState::f_broadcast2_b(deref(state)),proj_hacspec_ovn::OvnContractState::f_broadcast2_c(deref(state)))};{let _: tuple0 = {{for zkp in (core::iter::traits::collect::IntoIterator::into_iter(zkps)) { {let _: bool = {hacspec_ovn::check_valid(zkp)};{Tuple0()}} }}};{let mut vote_result: int = {hacspec_ovn::Group::one()};{let _: tuple0 = {{for i in (core::iter::traits::collect::IntoIterator::into_iter(core::ops::range::Range{f_start:0,f_end:core::slice::len_under_impl(rust_primitives::unsize(&(g_pow_vi))),})) { (vote_result = hacspec_ovn::Group::prod(vote_result,hacspec_ovn::Group::prod(core::clone::Clone::clone(&(core::ops::index::Index::index(g_pow_xi_yi,i))),core::clone::Clone::clone(&(core::ops::index::Index::index(g_pow_vi,i)))))) }}};{let mut tally: int = {0};{let _: tuple0 = {{for i in (core::iter::traits::collect::IntoIterator::into_iter(core::ops::range::Range{f_start:1,f_end:cast(hacspec_ovn::n),})) { {(if core::cmp::PartialEq::eq(hacspec_ovn::Group::g_pow(i),vote_result){{let _: tuple0 = {(tally = i)};Tuple0}})} }}};{let _: tuple0 = {(deref(state).f_tally = tally)};{core::result::Result_Ok(concordium_std::traits::HasActions::accept())}}}}}}}}} todo(item)*) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_GroupParameter.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_cast_vote.v similarity index 52% rename from ovn/proofs/ssprove/extraction/Hacspec_ovn_GroupParameter.v rename to ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_cast_vote.v index f564a29..55b3e69 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_GroupParameter.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_cast_vote.v @@ -24,10 +24,37 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Require Import Hacspec_ovn_GroupParameter_Hacspec_lib. -Export Hacspec_ovn_GroupParameter_Hacspec_lib. +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import Concordium_std. +Export Concordium_std. -Equations modulo_value : both (fset []) ([interface ]) (t_String) := - modulo_value := - solve_lift (from (ret_both (1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab : chString))) : both (fset []) ([interface ]) (t_String). -Fail Next Obligation. +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import SeekFrom. +Export SeekFrom. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import ContractState. +Export ContractState. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import Logger. +Export Logger. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import trap. +Export trap. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_init_ovn_contract.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_init_ovn_contract.v new file mode 100644 index 0000000..4cc4a43 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_init_ovn_contract.v @@ -0,0 +1,60 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. + Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import Concordium_std. +Export Concordium_std. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import trap. +Export trap. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import ExternContext. +Export ExternContext. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import InitContextExtern. +Export InitContextExtern. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import ContractState. +Export ContractState. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote_pre.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote_pre.v new file mode 100644 index 0000000..55b3e69 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote_pre.v @@ -0,0 +1,60 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. + Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import Concordium_std. +Export Concordium_std. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import SeekFrom. +Export SeekFrom. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import ContractState. +Export ContractState. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import Logger. +Export Logger. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import trap. +Export trap. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_tally_votes.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_tally_votes.v new file mode 100644 index 0000000..55b3e69 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_tally_votes.v @@ -0,0 +1,60 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. + Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import Concordium_std. +Export Concordium_std. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import SeekFrom. +Export SeekFrom. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import ContractState. +Export ContractState. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import Logger. +Export Logger. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import trap. +Export trap. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v deleted file mode 100644 index 1d6ca60..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr.v +++ /dev/null @@ -1,86 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. - Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Hacspec_ovn_Schnorr_Hacspec_lib. -Export Hacspec_ovn_Schnorr_Hacspec_lib. - -Require Import HashMap. -Export HashMap. - -(*Not implemented yet? todo(item)*) - -Require Import Hacspec_ovn_Schnorr_Random_oracle. -Export Hacspec_ovn_Schnorr_Random_oracle. - -Notation t_Transcript := ((t_G × t_G × t_Q × t_Q)). - -Equations prod_assoc {L1 : {fset Location}} {I1 : Interface} (sm : both L1 I1 ((t_G × t_G))) : both (L1) (I1) (t_Q) := - prod_assoc sm := - letb '(statement,message) := (sm) : both _ _ ((t_G × t_G)) in - solve_lift (Build_t_Q (ret_both (1 : int32))) : both (L1) (I1) (t_Q). -Fail Next Obligation. - -Equations verify {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (h : both L1 I1 (t_G)) (a : both L2 I2 (t_G)) (e : both L3 I3 (t_Q)) (z : both L4 I4 (t_Q)) : both (L1:|:L2:|:L3:|:L4) (I1:|:I2:|:I3:|:I4) ('bool) := - verify h a e z := - solve_lift (ret_both (false : 'bool)) : both (L1:|:L2:|:L3:|:L4) (I1:|:I2:|:I3:|:I4) ('bool). -Fail Next Obligation. - -Equations fiat_shamir_verify {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (t : both L1 I1 ((t_G × t_G × t_Q × t_Q))) (uniform_sample : both L2 I2 (t_Q)) : both (L1:|:L2) (I1:|:I2) ('bool) := - fiat_shamir_verify t uniform_sample := - letb QUERIES := (new_under_impl) : both _ _ (t_HashMap (t_Q) (t_Q) (t_RandomState)) in - letb '(h,a,e,z) := (t) : both _ _ ((t_G × t_G × t_Q × t_Q)) in - letb '(QUERIES,eu) := (random_oracle_query QUERIES (prod_assoc (prod_b (h,a))) uniform_sample) : both _ _ ((t_HashMap (t_Q) (t_Q) (t_RandomState) × t_Q)) in - solve_lift (verify h a e z) : both (L1:|:L2) (I1:|:I2) ('bool). -Fail Next Obligation. - -Notation t_Relation := ((t_G × t_Q)). - -Definition commit_loc : Location := - (t_Q ; 5%nat). -Equations v_Commit {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (h : both L1 I1 (t_G)) (w : both L2 I2 (t_Q)) (uniform_sample : both L3 I3 (t_Q)) : both (L1:|:L2:|:L3 :|: fset [commit_loc]) (I1:|:I2:|:I3) (t_G) := - v_Commit h w uniform_sample := - letb r := (uniform_sample) : both _ _ (t_Q) in - letbm commit loc(commit_loc) := (r) : both _ _ (t_Q) in - solve_lift v_ONE : both (L1:|:L2:|:L3 :|: fset [commit_loc]) (I1:|:I2:|:I3) (t_G). -Fail Next Obligation. - -Equations v_Response {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (h : both L1 I1 (t_G)) (w : both L2 I2 (t_Q)) (a : both L3 I3 (t_G)) (e : both L4 I4 (t_Q)) : both (L1:|:L2:|:L3:|:L4) (I1:|:I2:|:I3:|:I4) (t_Q) := - v_Response h w a e := - solve_lift (Build_t_Q (ret_both (1 : int32))) : both (L1:|:L2:|:L3:|:L4) (I1:|:I2:|:I3:|:I4) (t_Q). -Fail Next Obligation. - -Equations fiat_shamir_run {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (hw : both L1 I1 ((t_G × t_Q))) (uniform_sample_1 : both L2 I2 (t_Q)) (uniform_sample_2 : both L3 I3 (t_Q)) : both (L1:|:L2:|:L3 :|: fset [commit_loc]) (I1:|:I2:|:I3) ((t_G × t_G × t_Q × t_Q)) := - fiat_shamir_run hw uniform_sample_1 uniform_sample_2 := - letb QUERIES := (new_under_impl) : both _ _ (t_HashMap (t_Q) (t_Q) (t_RandomState)) in - letb '(h,w) := (hw) : both _ _ ((t_G × t_Q)) in - letb a := (v_Commit h w uniform_sample_1) : both _ _ (t_G) in - letb _ := (random_oracle_init (ret_both (tt : 'unit))) : both _ _ ('unit) in - letb _ := (ret_both (tt : 'unit)) : both _ _ ('unit) in - letb '(QUERIES,eu) := (random_oracle_query QUERIES (prod_assoc (prod_b (h,a))) uniform_sample_2) : both _ _ ((t_HashMap (t_Q) (t_Q) (t_RandomState) × t_Q)) in - letb e := (Build_t_Q (ret_both (1 : int32))) : both _ _ (t_Q) in - letb z := (v_Response h w a e) : both _ _ (t_Q) in - solve_lift (prod_b (h,a,e,z)) : both (L1:|:L2:|:L3 :|: fset [commit_loc]) (I1:|:I2:|:I3) ((t_G × t_G × t_Q × t_Q)). -Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v deleted file mode 100644 index da8b819..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Schnorr_Random_oracle.v +++ /dev/null @@ -1,1038 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. - Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Hacspec_ovn_Schnorr_Random_oracle_Hacspec_lib. -Export Hacspec_ovn_Schnorr_Random_oracle_Hacspec_lib. - -Equations random_oracle_init {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both (L1) (I1) ('unit) := - random_oracle_init _ := - solve_lift (ret_both (tt : 'unit)) : both (L1) (I1) ('unit). -Fail Next Obligation. - -Definition t_GCanvas : choice_type := - (nseq int8 48 × t_Sign × 'bool). -Equations Build_t_GCanvas {L : {fset Location}} {I : Interface} (f_b : both L I (nseq int8 48)) (f_sign : both L I (t_Sign)) (f_signed : both L I ('bool)) : both L I (t_GCanvas) := - Build_t_GCanvas f_b f_sign f_signed := - bind_both f_signed (fun f_signed => - bind_both f_sign (fun f_sign => - bind_both f_b (fun f_b => - solve_lift (ret_both ((f_b,f_sign,f_signed) : (t_GCanvas)))))) : both L I (t_GCanvas). -Fail Next Obligation. - -Equations max_under_impl_15 : both (fset []) ([interface ]) (t_Output) := - max_under_impl_15 := - solve_lift (((from (ret_both (1 : int32))) shift_left (ret_both (384 : int32))) .- one) : both (fset []) ([interface ]) (t_Output). -Fail Next Obligation. - -Equations max_value_under_impl_15 : both (fset []) ([interface ]) (t_GCanvas) := - max_value_under_impl_15 := - solve_lift (from max_under_impl_15) : both (fset []) ([interface ]) (t_GCanvas). -Fail Next Obligation. - -Definition x_loc : Location := - (t_String ; 1%nat). -Equations hex_string_to_bytes_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (chString)) : both (L1 :|: fset [x_loc]) (I1) (t_Vec (int8) (t_Global)) := - hex_string_to_bytes_under_impl_15 s := - letb s := (ifb ((len_under_impl s) .% (ret_both (2 : uint_size))) <> (ret_both (0 : uint_size)) - then letbm x loc(x_loc) := (to_string (ret_both (0 : chString))) : both _ _ (t_String) in - letb x := (push_str_under_impl x s) : both _ _ (t_String) in - x - else to_string s) : both _ _ (t_String) in - letb _ := (ifb not (((len_under_impl s) .% (ret_both (2 : uint_size))) =.? (ret_both (0 : uint_size))) - then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (length of hex string : chString); - ret_both (: : chString)])) (unsize (array_from_list [new_display_under_impl_1 s; - new_display_under_impl_1 (len_under_impl s)]))))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - letb b := (collect (map (step_by (Build_t_Range (ret_both (0 : uint_size))(len_under_impl s)) (ret_both (2 : uint_size))) (fun i => - from_str_radix_under_impl_6 (s.a[(Build_t_Range i(i .+ (ret_both (2 : uint_size))))]) (ret_both (16 : int32))))) : both _ _ (t_Result (t_Vec (int8) (t_Global)) (t_ParseIntError)) in - solve_lift (expect_under_impl b (ret_both (Error parsing hex string : chString))) : both (L1 :|: fset [x_loc]) (I1) (t_Vec (int8) (t_Global)). -Fail Next Obligation. - -Equations from_literal_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_GCanvas) := - from_literal_under_impl_15 x := - letb big_x := (from x) : both _ _ (t_BigInt) in - letb _ := (ifb big_x >.? (into max_under_impl_15) - then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (literal : chString); - ret_both ( too big for type GCanvas : chString)])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - solve_lift (into big_x) : both (L1) (I1) (t_GCanvas). -Fail Next Obligation. - -Equations from_signed_literal_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1) (I1) (t_GCanvas) := - from_signed_literal_under_impl_15 x := - letb big_x := (from (cast_int x)) : both _ _ (t_BigInt) in - letb _ := (ifb big_x >.? (into max_under_impl_15) - then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (literal : chString); - ret_both ( too big for type GCanvas : chString)])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - solve_lift (into big_x) : both (L1) (I1) (t_GCanvas). -Fail Next Obligation. - -Equations pow2_under_impl_15 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_GCanvas) := - pow2_under_impl_15 x := - solve_lift (into ((from (ret_both (1 : int32))) shift_left x)) : both (L1) (I1) (t_GCanvas). -Fail Next Obligation. - -(*item error backend*) - -#[global] Instance t_GCanvas_t_From : t_From t_GCanvas t_BigUint := { - from (x : t_BigUint) := solve_lift (from (from x)); -}. - -#[global] Instance t_GCanvas_t_From : t_From t_GCanvas t_BigInt := { - from (x : t_BigInt) := letb max_value := (max_under_impl_15) : both _ _ (t_BigInt) in - letb _ := (ifb not (x <=.? max_value) - then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both ( : chString); - ret_both ( is too large for type GCanvas! : chString)])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - letb '(sign,repr) := (to_bytes_be_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in - letb _ := (ifb andb (sign =.? Sign_Minus) (not (ret_both (false : 'bool))) - then letb _ := (never_to_any (begin_panic (ret_both (Trying to convert a negative number into an unsigned integer! : chString)))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - letb _ := (ifb (len_under_impl_1 repr) >.? (((ret_both (384 : uint_size)) .+ (ret_both (7 : uint_size))) ./ (ret_both (8 : uint_size))) - then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both ( : chString); - ret_both ( is too large for type GCanvas : chString)])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - letbm out loc(out_loc) := (repeat (ret_both (0 : int8)) (ret_both (48 : uint_size))) : both _ _ (nseq int8 48) in - letb upper := (len_under_impl (unsize out)) : both _ _ (uint_size) in - letb lower := (upper .- (len_under_impl_1 repr)) : both _ _ (uint_size) in - letb _ := (failure (ret_both (RefMut:The mutation of this &mut is not allowed here. - : chString)) (ret_both (core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (out), - core::ops::range::Range { - f_start: lower, - f_end: upper, - }, - ))), - &(deref(core::ops::deref::Deref::deref(&(deref(&(repr)))))), - ) : chString))) : both _ _ ('unit) in - solve_lift (Build_t_GCanvas outsign(ret_both (false : 'bool))); -}. - -#[global] Instance t_GCanvas_t_Default : t_Default t_GCanvas := { - default := solve_lift (Build_t_GCanvas (repeat (ret_both (0 : int8)) (ret_both (48 : uint_size)))Sign_Plus(ret_both (false : 'bool))); -}. - -#[global] Instance t_GCanvas_t_Into : t_Into t_GCanvas t_BigInt := { - into (self : t_GCanvas) := solve_lift (from_bytes_be_under_impl_24 (f_sign self) (unsize (f_b self))); -}. - -#[global] Instance t_GCanvas_t_Into : t_Into t_GCanvas t_BigUint := { - into (self : t_GCanvas) := solve_lift (from_bytes_be_under_impl_18 (unsize (f_b self))); -}. - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -Equations from_hex_under_impl_14 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (chString)) : both (L1 :|: fset [x_loc]) (I1) (t_GCanvas) := - from_hex_under_impl_14 s := - solve_lift (into (from_bytes_be_under_impl_24 Sign_Plus (deref (hex_string_to_bytes_under_impl_15 s)))) : both (L1 :|: fset [x_loc]) (I1) (t_GCanvas). -Fail Next Obligation. - -Definition repr_loc : Location := - (nseq int8 48 ; 2%nat). -Equations from_be_bytes_under_impl_14 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas) := - from_be_bytes_under_impl_14 v := - letb _ := (ifb ret_both (true : 'bool) - then letb _ := (ifb not ((len_under_impl v) <=.? (((ret_both (384 : uint_size)) .+ (ret_both (7 : uint_size))) ./ (ret_both (8 : uint_size)))) - then letb _ := (never_to_any (begin_panic (ret_both (from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas : chString)))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - letbm repr loc(repr_loc) := (repeat (ret_both (0 : int8)) (ret_both (48 : uint_size))) : both _ _ (nseq int8 48) in - letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in - letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in - letb _ := (failure (ret_both (RefMut:The mutation of this &mut is not allowed here. - : chString)) (ret_both (core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (repr), - core::ops::range::Range { - f_start: lower, - f_end: upper, - }, - ))), - &(deref(deref(&(v)))), - ) : chString))) : both _ _ ('unit) in - solve_lift (Build_t_GCanvas reprSign_Plus(ret_both (false : 'bool))) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas). -Fail Next Obligation. - -Definition repr_loc : Location := - (nseq int8 48 ; 3%nat). -Equations from_le_bytes_under_impl_14 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas) := - from_le_bytes_under_impl_14 v := - letb _ := (ifb ret_both (true : 'bool) - then letb _ := (ifb not ((len_under_impl v) <=.? (((ret_both (384 : uint_size)) .+ (ret_both (7 : uint_size))) ./ (ret_both (8 : uint_size)))) - then letb _ := (never_to_any (begin_panic (ret_both (from_be_bytes: lenght of bytes should be lesser than the lenght of the canvas : chString)))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - letbm repr loc(repr_loc) := (repeat (ret_both (0 : int8)) (ret_both (48 : uint_size))) : both _ _ (nseq int8 48) in - letb upper := (len_under_impl (unsize repr)) : both _ _ (uint_size) in - letb lower := (upper .- (len_under_impl v)) : both _ _ (uint_size) in - letb _ := (failure (ret_both (RefMut:The mutation of this &mut is not allowed here. - : chString)) (ret_both (core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (repr), - core::ops::range::Range { - f_start: lower, - f_end: upper, - }, - ))), - &(deref(deref(&(v)))), - ) : chString))) : both _ _ ('unit) in - solve_lift (into (from_bytes_le_under_impl_24 Sign_Plus (unsize repr))) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas). -Fail Next Obligation. - -Equations to_be_bytes_under_impl_14 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_GCanvas)) : both (L1) (I1) (nseq int8 48) := - to_be_bytes_under_impl_14 self := - solve_lift (f_b self) : both (L1) (I1) (nseq int8 48). -Fail Next Obligation. - -Definition repr_loc : Location := - (nseq int8 48 ; 4%nat). -Equations to_le_bytes_under_impl_14 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_GCanvas)) : both (L1 :|: fset [repr_loc]) (I1) (nseq int8 48) := - to_le_bytes_under_impl_14 self := - letb x := (from_bytes_be_under_impl_24 Sign_Plus (unsize (f_b self))) : both _ _ (t_BigInt) in - letb '(_,x_s) := (to_bytes_le_under_impl_24 x) : both _ _ ((t_Sign × t_Vec (int8) (t_Global))) in - letbm repr loc(repr_loc) := (repeat (ret_both (0 : int8)) (ret_both (48 : uint_size))) : both _ _ (nseq int8 48) in - letb _ := (failure (ret_both (RefMut:The mutation of this &mut is not allowed here. - : chString)) (ret_both (core::slice::copy_from_slice_under_impl( - &mut (deref(core::ops::index::IndexMut::index_mut( - &mut (repr), - core::ops::range::Range { - f_start: 0, - f_end: alloc::vec::len_under_impl_1(&(x_s)), - }, - ))), - &(deref(core::ops::deref::Deref::deref(&(deref(&(x_s)))))), - ) : chString))) : both _ _ ('unit) in - repr : both (L1 :|: fset [repr_loc]) (I1) (nseq int8 48). -Fail Next Obligation. - -Equations comp_eq_under_impl_14 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - comp_eq_under_impl_14 self rhs := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb solve_lift (a =.? b) - then letb one := (from_literal_under_impl_15 (ret_both (1 : int128))) : both _ _ (t_GCanvas) in - solve_lift ((one shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- one) - else solve_lift default : both (L1:|:L2) (I1:|:I2) (t_Output). -Fail Next Obligation. - -Equations comp_ne_under_impl_14 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - comp_ne_under_impl_14 self rhs := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb solve_lift (a <> b) - then letb one := (from_literal_under_impl_15 (ret_both (1 : int128))) : both _ _ (t_GCanvas) in - solve_lift ((one shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- one) - else solve_lift default : both (L1:|:L2) (I1:|:I2) (t_Output). -Fail Next Obligation. - -Equations comp_gte_under_impl_14 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - comp_gte_under_impl_14 self rhs := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb solve_lift (a >=.? b) - then letb one := (from_literal_under_impl_15 (ret_both (1 : int128))) : both _ _ (t_GCanvas) in - solve_lift ((one shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- one) - else solve_lift default : both (L1:|:L2) (I1:|:I2) (t_Output). -Fail Next Obligation. - -Equations comp_gt_under_impl_14 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - comp_gt_under_impl_14 self rhs := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb solve_lift (a >.? b) - then letb one := (from_literal_under_impl_15 (ret_both (1 : int128))) : both _ _ (t_GCanvas) in - solve_lift ((one shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- one) - else solve_lift default : both (L1:|:L2) (I1:|:I2) (t_Output). -Fail Next Obligation. - -Equations comp_lte_under_impl_14 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - comp_lte_under_impl_14 self rhs := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb solve_lift (a <=.? b) - then letb one := (from_literal_under_impl_15 (ret_both (1 : int128))) : both _ _ (t_GCanvas) in - solve_lift ((one shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- one) - else solve_lift default : both (L1:|:L2) (I1:|:I2) (t_Output). -Fail Next Obligation. - -Equations comp_lt_under_impl_14 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (rhs : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - comp_lt_under_impl_14 self rhs := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - ifb solve_lift (a <.? b) - then letb one := (from_literal_under_impl_15 (ret_both (1 : int128))) : both _ _ (t_GCanvas) in - solve_lift ((one shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- one) - else solve_lift default : both (L1:|:L2) (I1:|:I2) (t_Output). -Fail Next Obligation. - -Equations inv_under_impl_26 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (modval : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_GCanvas) := - inv_under_impl_26 self modval := - letb biguintmodval := (into modval) : both _ _ (t_BigInt) in - letb m := (biguintmodval .- (from (ret_both (2 : int32)))) : both _ _ (t_Output) in - letb s := (into self) : both _ _ (t_BigInt) in - solve_lift (into (modpow_under_impl_24 s m biguintmodval)) : both (L1:|:L2) (I1:|:I2) (t_GCanvas). -Fail Next Obligation. - -Equations pow_felem_under_impl_26 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_GCanvas)) (exp : both L2 I2 (t_GCanvas)) (modval : both L3 I3 (t_GCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_GCanvas) := - pow_felem_under_impl_26 self exp modval := - letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into exp) : both _ _ (t_BigInt) in - letb m := (into modval) : both _ _ (t_BigInt) in - letb c := (modpow_under_impl_24 a b m) : both _ _ (t_BigInt) in - solve_lift (into c) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_GCanvas). -Fail Next Obligation. - -Equations pow_under_impl_26 {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_GCanvas)) (exp : both L2 I2 (int128)) (modval : both L3 I3 (t_GCanvas)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_GCanvas) := - pow_under_impl_26 self exp modval := - solve_lift (pow_felem_under_impl_26 self (into (from exp)) modval) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (t_GCanvas). -Fail Next Obligation. - -Equations rem_under_impl_26 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_GCanvas)) (n : both L2 I2 (t_GCanvas)) : both (L1:|:L2) (I1:|:I2) (t_Output) := - rem_under_impl_26 self n := - solve_lift (self .% n) : both (L1:|:L2) (I1:|:I2) (t_Output). -Fail Next Obligation. - -#[global] Instance t_GCanvas_t_Add : t_Add t_GCanvas t_GCanvas := { - t_Output := t_GCanvas; - add (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb c := (a .+ b) : both _ _ (t_Output) in - letb _ := (ifb c >.? max_under_impl_15 - then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (bounded addition overflow for type GCanvas : chString)])) (unsize none_under_impl_1)))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - solve_lift (into c); -}. - -#[global] Instance t_GCanvas_t_Sub : t_Sub t_GCanvas t_GCanvas := { - t_Output := t_GCanvas; - sub (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb c := (ifb f_signed self - then a .- b - else unwrap_or_else_under_impl (checked_sub_under_impl_24 a b) ( - never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (bounded substraction underflow for type GCanvas : chString)])) (unsize none_under_impl_1))))) : both _ _ (t_Output) in - solve_lift (into c); -}. - -#[global] Instance t_GCanvas_t_Mul : t_Mul t_GCanvas t_GCanvas := { - t_Output := t_GCanvas; - mul (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb c := (a .* b) : both _ _ (t_Output) in - letb _ := (ifb c >.? max_under_impl_15 - then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (bounded multiplication overflow for type GCanvas : chString)])) (unsize none_under_impl_1)))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - solve_lift (into c); -}. - -#[global] Instance t_GCanvas_t_Div : t_Div t_GCanvas t_GCanvas := { - t_Output := t_GCanvas; - div (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb _ := (ifb b =.? zero - then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (dividing by zero in type GCanvas : chString)])) (unsize none_under_impl_1)))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - letb c := (a ./ b) : both _ _ (t_Output) in - solve_lift (into c); -}. - -#[global] Instance t_GCanvas_t_Rem : t_Rem t_GCanvas t_GCanvas := { - t_Output := t_GCanvas; - rem (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - letb _ := (ifb b =.? zero - then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (dividing by zero in type GCanvas : chString)])) (unsize none_under_impl_1)))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - letb c := (a .% b) : both _ _ (t_Output) in - solve_lift (into c); -}. - -#[global] Instance t_GCanvas_t_Not : t_Not t_GCanvas := { - t_Output := t_GCanvas; - not (self : t_GCanvas) := solve_lift (never_to_any (panic (ret_both (not implemented : chString)))); -}. - -#[global] Instance t_GCanvas_t_BitOr : t_BitOr t_GCanvas t_GCanvas := { - t_Output := t_GCanvas; - bitor (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - solve_lift (into (a .| b)); -}. - -#[global] Instance t_GCanvas_t_BitXor : t_BitXor t_GCanvas t_GCanvas := { - t_Output := t_GCanvas; - bitxor (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - solve_lift (into (a .^ b)); -}. - -#[global] Instance t_GCanvas_t_BitAnd : t_BitAnd t_GCanvas t_GCanvas := { - t_Output := t_GCanvas; - bitand (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - solve_lift (into (a .& b)); -}. - -#[global] Instance t_GCanvas_t_Shr : t_Shr t_GCanvas uint_size := { - t_Output := t_GCanvas; - shr (self : t_GCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (rhs) : both _ _ (uint_size) in - solve_lift (into (a shift_right b)); -}. - -#[global] Instance t_GCanvas_t_Shl : t_Shl t_GCanvas uint_size := { - t_Output := t_GCanvas; - shl (self : t_GCanvas) (rhs : uint_size) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (rhs) : both _ _ (uint_size) in - solve_lift (into (a shift_left b)); -}. - -#[global] Instance t_GCanvas_t_PartialEq : t_PartialEq t_GCanvas t_GCanvas := { - eq (self : t_GCanvas) (rhs : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into rhs) : both _ _ (t_BigInt) in - solve_lift (a =.? b); -}. - -#[global] Instance t_GCanvas_t_Eq : t_Eq t_GCanvas := { -}. - -#[global] Instance t_GCanvas_t_PartialOrd : t_PartialOrd t_GCanvas t_GCanvas := { - partial_cmp (self : t_GCanvas) (other : t_GCanvas) := letb a := (into self) : both _ _ (t_BigInt) in - letb b := (into other) : both _ _ (t_BigInt) in - solve_lift (partial_cmp a b); -}. - -#[global] Instance t_GCanvas_t_Ord : t_Ord t_GCanvas := { - cmp (self : t_GCanvas) (other : t_GCanvas) := solve_lift (unwrap_under_impl (partial_cmp self other)); -}. - -Equations from_byte_seq_be_under_impl_7 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas) := - from_byte_seq_be_under_impl_7 s := - solve_lift (from_be_bytes_under_impl_14 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - declassify_under_impl_2 x))))) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas). -Fail Next Obligation. - -Equations from_public_byte_seq_be_under_impl_7 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas) := - from_public_byte_seq_be_under_impl_7 s := - solve_lift (from_be_bytes_under_impl_14 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - x))))) : both (L1 :|: fset [repr_loc]) (I1) (t_GCanvas). -Fail Next Obligation. - -Equations to_byte_seq_be_under_impl_7 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_GCanvas)) : both (L1) (I1) (t_Seq (t_U8)) := - to_byte_seq_be_under_impl_7 self := - solve_lift (from_vec_under_impl_52 (collect (map (iter_under_impl (unsize (to_be_bytes_under_impl_14 self))) (fun x => - classify_under_impl_2 x)))) : both (L1) (I1) (t_Seq (t_U8)). -Fail Next Obligation. - -#[global] Instance t_GCanvas_t_NumericCopy : t_NumericCopy t_GCanvas := { -}. - -#[global] Instance t_GCanvas_t_UnsignedInteger : t_UnsignedInteger t_GCanvas := { -}. - -#[global] Instance t_GCanvas_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_GCanvas := { -}. - -#[global] Instance t_GCanvas_t_Integer : t_Integer t_GCanvas := { - NUM_BITS := solve_lift (ret_both (384 : uint_size)); - ZERO := solve_lift (from_literal_under_impl_15 (ret_both (0 : int128))); - ONE := solve_lift (from_literal_under_impl_15 (ret_both (1 : int128))); - TWO := solve_lift (from_literal_under_impl_15 (ret_both (2 : int128))); - from_literal (val : int128) := solve_lift (from_literal_under_impl_15 val); - from_hex_string (s : t_String) := solve_lift (from_hex_under_impl_14 (deref (replace_under_impl_5 (deref s) (ret_both (0x : chString)) (ret_both ( : chString))))); - get_bit (self : t_GCanvas) (i : uint_size) := solve_lift ((self shift_right i) .& v_ONE); - set_bit (self : t_GCanvas) (b : t_GCanvas) (i : uint_size) := letb _ := (ifb ret_both (true : 'bool) - then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) - then letb _ := (never_to_any (panic (ret_both (assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()) : chString)))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - letb tmp1 := (from_literal_under_impl_15 (not ((ret_both (1 : int128)) shift_left i))) : both _ _ (t_GCanvas) in - letb tmp2 := (b shift_left i) : both _ _ (t_Output) in - solve_lift ((self .& tmp1) .| tmp2); - set (self : t_GCanvas) (pos : uint_size) (y : t_GCanvas) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_GCanvas) in - solve_lift (set_bit self b pos); - rotate_left (self : t_GCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb _ := (never_to_any (panic (ret_both (assertion failed: n < Self::NUM_BITS : chString)))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - solve_lift (((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- (ret_both (1 : uint_size)))))); - rotate_right (self : t_GCanvas) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb _ := (never_to_any (panic (ret_both (assertion failed: n < Self::NUM_BITS : chString)))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - solve_lift (((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- (ret_both (1 : uint_size)))))); -}. - -#[global] Instance t_GCanvas_t_ModNumeric : t_ModNumeric t_GCanvas := { - sub_mod (self : t_GCanvas) (rhs : t_GCanvas) (n : t_GCanvas) := solve_lift ((self .- rhs) .% n); - add_mod (self : t_GCanvas) (rhs : t_GCanvas) (n : t_GCanvas) := solve_lift ((self .+ rhs) .% n); - mul_mod (self : t_GCanvas) (rhs : t_GCanvas) (n : t_GCanvas) := solve_lift ((self .* rhs) .% n); - pow_mod (self : t_GCanvas) (exp : t_GCanvas) (n : t_GCanvas) := solve_lift (pow_felem_under_impl_26 self exp n); - modulo (self : t_GCanvas) (n : t_GCanvas) := solve_lift (self .% n); - signed_modulo (self : t_GCanvas) (n : t_GCanvas) := solve_lift (modulo self n); - absolute (self : t_GCanvas) := self; -}. - -#[global] Instance t_GCanvas_t_Numeric : t_Numeric t_GCanvas := { - max_val := solve_lift max_value_under_impl_15; - wrap_add (self : t_GCanvas) (rhs : t_GCanvas) := solve_lift (self .+ rhs); - wrap_sub (self : t_GCanvas) (rhs : t_GCanvas) := solve_lift (self .- rhs); - wrap_mul (self : t_GCanvas) (rhs : t_GCanvas) := solve_lift (self .* rhs); - wrap_div (self : t_GCanvas) (rhs : t_GCanvas) := solve_lift (self ./ rhs); - exp (self : t_GCanvas) (exp : int32) := solve_lift (pow_under_impl_26 self (into exp) max_val); - pow_self (self : t_GCanvas) (exp : t_GCanvas) := solve_lift (pow_felem_under_impl_26 self (into exp) max_val); - divide (self : t_GCanvas) (rhs : t_GCanvas) := solve_lift (self ./ rhs); - inv (self : t_GCanvas) (n : t_GCanvas) := solve_lift (inv_under_impl_26 self n); - equal (self : t_GCanvas) (other : t_GCanvas) := solve_lift (self =.? other); - greater_than (self : t_GCanvas) (other : t_GCanvas) := solve_lift (self >.? other); - greater_than_or_equal (self : t_GCanvas) (other : t_GCanvas) := solve_lift (self >=.? other); - less_than (self : t_GCanvas) (other : t_GCanvas) := solve_lift (self <.? other); - less_than_or_equal (self : t_GCanvas) (other : t_GCanvas) := solve_lift (self >=.? other); - not_equal_bm (self : t_GCanvas) (other : t_GCanvas) := ifb solve_lift (not (equal self other)) - then solve_lift max_val - else solve_lift (from_literal_under_impl_15 (ret_both (0 : int128))); - equal_bm (self : t_GCanvas) (other : t_GCanvas) := ifb solve_lift (equal self other) - then solve_lift max_val - else solve_lift (from_literal_under_impl_15 (ret_both (0 : int128))); - greater_than_bm (self : t_GCanvas) (other : t_GCanvas) := ifb solve_lift (greater_than self other) - then solve_lift max_val - else solve_lift (from_literal_under_impl_15 (ret_both (0 : int128))); - greater_than_or_equal_bm (self : t_GCanvas) (other : t_GCanvas) := ifb solve_lift (greater_than_or_equal self other) - then solve_lift max_val - else solve_lift (from_literal_under_impl_15 (ret_both (0 : int128))); - less_than_bm (self : t_GCanvas) (other : t_GCanvas) := ifb solve_lift (less_than self other) - then solve_lift max_val - else solve_lift (from_literal_under_impl_15 (ret_both (0 : int128))); - less_than_or_equal_bm (self : t_GCanvas) (other : t_GCanvas) := ifb solve_lift (less_than_or_equal self other) - then solve_lift max_val - else solve_lift (from_literal_under_impl_15 (ret_both (0 : int128))); -}. - -Definition t_G : choice_type := - (t_GCanvas). -Equations Build_t_G {L : {fset Location}} {I : Interface} (0 : both L I (t_GCanvas)) : both L I (t_G) := - Build_t_G 0 := - bind_both 0 (fun 0 => - solve_lift (ret_both ((0) : (t_G)))) : both L I (t_G). -Fail Next Obligation. - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -(*RefMut:The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* TO DO */ - todo(item)*) - -#[global] Instance t_G_t_From : t_From t_G t_GCanvas := { - from (x : t_GCanvas) := G (solve_lift (rem_under_impl_26 x (from_hex_under_impl_14 (ret_both (1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab : chString))))); -}. - -#[global] Instance t_G_t_Into : t_Into t_G t_GCanvas := { - into (self : t_G) := solve_lift (0 self); -}. - -Equations from_canvas_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_GCanvas)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := - from_canvas_under_impl_63 x := - G (solve_lift (rem_under_impl_26 x (from_hex_under_impl_14 (ret_both (1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab : chString))))) : both (L1 :|: fset [x_loc]) (I1) (t_G). -Fail Next Obligation. - -Equations into_canvas_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_GCanvas) := - into_canvas_under_impl_63 self := - solve_lift (0 self) : both (L1) (I1) (t_GCanvas). -Fail Next Obligation. - -Equations max_under_impl_63 : both (fset [x_loc]) ([interface ]) (t_GCanvas) := - max_under_impl_63 := - solve_lift (from_hex_under_impl_14 (ret_both (1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab : chString))) : both (fset [x_loc]) ([interface ]) (t_GCanvas). -Fail Next Obligation. - -Equations declassify_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_BigInt) := - declassify_under_impl_63 self := - letb a := (into self) : both _ _ (t_GCanvas) in - solve_lift (into a) : both (L1) (I1) (t_BigInt). -Fail Next Obligation. - -Equations from_hex_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (chString)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := - from_hex_under_impl_63 s := - solve_lift (into (from_hex_under_impl_14 s)) : both (L1 :|: fset [x_loc]) (I1) (t_G). -Fail Next Obligation. - -Equations from_be_bytes_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := - from_be_bytes_under_impl_63 v := - solve_lift (into (from_be_bytes_under_impl_14 v)) : both (L1 :|: fset [repr_loc]) (I1) (t_G). -Fail Next Obligation. - -Equations to_be_bytes_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_Vec (int8) (t_Global)) := - to_be_bytes_under_impl_63 self := - solve_lift (to_vec_under_impl (unsize (to_be_bytes_under_impl_14 (into self)))) : both (L1) (I1) (t_Vec (int8) (t_Global)). -Fail Next Obligation. - -Equations from_le_bytes_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (v : both L1 I1 (seq int8)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := - from_le_bytes_under_impl_63 v := - solve_lift (into (from_le_bytes_under_impl_14 v)) : both (L1 :|: fset [repr_loc]) (I1) (t_G). -Fail Next Obligation. - -Equations to_le_bytes_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [repr_loc]) (I1) (t_Vec (int8) (t_Global)) := - to_le_bytes_under_impl_63 self := - solve_lift (to_vec_under_impl (unsize (to_le_bytes_under_impl_14 (into self)))) : both (L1 :|: fset [repr_loc]) (I1) (t_Vec (int8) (t_Global)). -Fail Next Obligation. - -Equations bit_under_impl_63 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (i : both L2 I2 (uint_size)) : both (L1:|:L2) (I1:|:I2) ('bool) := - bit_under_impl_63 self i := - solve_lift (bit_under_impl_15 (into self) i) : both (L1:|:L2) (I1:|:I2) ('bool). -Fail Next Obligation. - -Equations from_literal_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := - from_literal_under_impl_63 x := - letb big_x := (from x) : both _ _ (t_BigUint) in - letb _ := (ifb big_x >.? (into max_under_impl_63) - then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (literal : chString); - ret_both ( too big for type G : chString)])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - G (solve_lift (into big_x)) : both (L1 :|: fset [x_loc]) (I1) (t_G). -Fail Next Obligation. - -Equations from_signed_literal_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int128)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := - from_signed_literal_under_impl_63 x := - letb big_x := (from (cast_int x)) : both _ _ (t_BigUint) in - letb _ := (ifb big_x >.? (into max_under_impl_63) - then letb _ := (never_to_any (panic_fmt (new_v1_under_impl_2 (unsize (array_from_list [ret_both (literal : chString); - ret_both ( too big for type G : chString)])) (unsize (array_from_list [new_display_under_impl_1 x]))))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - G (solve_lift (into big_x)) : both (L1 :|: fset [x_loc]) (I1) (t_G). -Fail Next Obligation. - -Equations comp_eq_under_impl_63 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := - comp_eq_under_impl_63 self rhs := - letb x := (into self) : both _ _ (t_GCanvas) in - solve_lift (into (comp_eq_under_impl_14 x (into rhs))) : both (L1:|:L2) (I1:|:I2) (t_G). -Fail Next Obligation. - -Equations comp_ne_under_impl_63 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := - comp_ne_under_impl_63 self rhs := - letb x := (into self) : both _ _ (t_GCanvas) in - solve_lift (into (comp_ne_under_impl_14 x (into rhs))) : both (L1:|:L2) (I1:|:I2) (t_G). -Fail Next Obligation. - -Equations comp_gte_under_impl_63 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := - comp_gte_under_impl_63 self rhs := - letb x := (into self) : both _ _ (t_GCanvas) in - solve_lift (into (comp_gte_under_impl_14 x (into rhs))) : both (L1:|:L2) (I1:|:I2) (t_G). -Fail Next Obligation. - -Equations comp_gt_under_impl_63 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := - comp_gt_under_impl_63 self rhs := - letb x := (into self) : both _ _ (t_GCanvas) in - solve_lift (into (comp_gt_under_impl_14 x (into rhs))) : both (L1:|:L2) (I1:|:I2) (t_G). -Fail Next Obligation. - -Equations comp_lte_under_impl_63 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := - comp_lte_under_impl_63 self rhs := - letb x := (into self) : both _ _ (t_GCanvas) in - solve_lift (into (comp_lte_under_impl_14 x (into rhs))) : both (L1:|:L2) (I1:|:I2) (t_G). -Fail Next Obligation. - -Equations comp_lt_under_impl_63 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (rhs : both L2 I2 (t_G)) : both (L1:|:L2) (I1:|:I2) (t_G) := - comp_lt_under_impl_63 self rhs := - letb x := (into self) : both _ _ (t_GCanvas) in - solve_lift (into (comp_lt_under_impl_14 x (into rhs))) : both (L1:|:L2) (I1:|:I2) (t_G). -Fail Next Obligation. - -Equations neg_under_impl_63 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := - neg_under_impl_63 self := - letb mod_val := (into (from_hex_under_impl_14 (ret_both (1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab : chString)))) : both _ _ (t_BigInt) in - letb s := (into self) : both _ _ (t_GCanvas) in - letb s := (into s) : both _ _ (t_BigInt) in - letb result := (into (mod_val .- s)) : both _ _ (t_GCanvas) in - solve_lift (into result) : both (L1 :|: fset [x_loc]) (I1) (t_G). -Fail Next Obligation. - -#[global] Instance t_G_t_PartialOrd : t_PartialOrd t_G t_G := { - partial_cmp (self : t_G) (other : t_G) := Option_Some (solve_lift (cmp self other)); -}. - -#[global] Instance t_G_t_Ord : t_Ord t_G := { - cmp (self : t_G) (other : t_G) := solve_lift (cmp (0 self) (0 other)); -}. - -#[global] Instance t_G_t_PartialEq : t_PartialEq t_G t_G := { - eq (self : t_G) (other : t_G) := solve_lift ((0 self) =.? (0 other)); -}. - -#[global] Instance t_G_t_Eq : t_Eq t_G := { -}. - -#[global] Instance t_G_t_Add : t_Add t_G t_G := { - t_Output := t_G; - add (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in - letb b := (into rhs) : both _ _ (t_GCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb c := (a .+ b) : both _ _ (t_Output) in - letb max := (into (from_hex_under_impl_14 (ret_both (1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab : chString)))) : both _ _ (t_BigUint) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_GCanvas) in - solve_lift (into d); -}. - -#[global] Instance t_G_t_Sub : t_Sub t_G t_G := { - t_Output := t_G; - sub (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in - letb b := (into rhs) : both _ _ (t_GCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb max := (into (from_hex_under_impl_14 (ret_both (1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab : chString)))) : both _ _ (t_BigUint) in - letb c := (ifb b >.? a - then ((clone max) .- b) .+ a - else a .- b) : both _ _ (t_Output) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_GCanvas) in - solve_lift (into d); -}. - -#[global] Instance t_G_t_Mul : t_Mul t_G t_G := { - t_Output := t_G; - mul (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in - letb b := (into rhs) : both _ _ (t_GCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb c := (a .* b) : both _ _ (t_Output) in - letb max := (into (from_hex_under_impl_14 (ret_both (1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab : chString)))) : both _ _ (t_BigUint) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_GCanvas) in - solve_lift (into d); -}. - -#[global] Instance t_G_t_Div : t_Div t_G t_G := { - t_Output := t_G; - div (self : t_G) (rhs : t_G) := solve_lift (self .* (inv_under_impl_57 rhs)); -}. - -#[global] Instance t_G_t_Rem : t_Rem t_G t_G := { - t_Output := t_G; - rem (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in - letb b := (into rhs) : both _ _ (t_GCanvas) in - letb a := (into a) : both _ _ (t_BigUint) in - letb b := (into b) : both _ _ (t_BigUint) in - letb c := (a .% b) : both _ _ (t_Output) in - letb max := (into (from_hex_under_impl_14 (ret_both (1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab : chString)))) : both _ _ (t_BigUint) in - letb d := (c .% max) : both _ _ (t_Output) in - letb d := (into d) : both _ _ (t_GCanvas) in - solve_lift (into d); -}. - -#[global] Instance t_G_t_Not : t_Not t_G := { - t_Output := t_G; - not (self : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in - solve_lift (into (not a)); -}. - -#[global] Instance t_G_t_BitOr : t_BitOr t_G t_G := { - t_Output := t_G; - bitor (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in - letb b := (into rhs) : both _ _ (t_GCanvas) in - solve_lift (into (a .| b)); -}. - -#[global] Instance t_G_t_BitXor : t_BitXor t_G t_G := { - t_Output := t_G; - bitxor (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in - letb b := (into rhs) : both _ _ (t_GCanvas) in - solve_lift (into (a .^ b)); -}. - -#[global] Instance t_G_t_BitAnd : t_BitAnd t_G t_G := { - t_Output := t_G; - bitand (self : t_G) (rhs : t_G) := letb a := (into self) : both _ _ (t_GCanvas) in - letb b := (into rhs) : both _ _ (t_GCanvas) in - solve_lift (into (a .& b)); -}. - -#[global] Instance t_G_t_Shr : t_Shr t_G uint_size := { - t_Output := t_G; - shr (self : t_G) (rhs : uint_size) := letb a := (into self) : both _ _ (t_GCanvas) in - solve_lift (into (a shift_right rhs)); -}. - -#[global] Instance t_G_t_Shl : t_Shl t_G uint_size := { - t_Output := t_G; - shl (self : t_G) (rhs : uint_size) := letb a := (into self) : both _ _ (t_GCanvas) in - solve_lift (into (a shift_left rhs)); -}. - -Equations inv_under_impl_57 {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [x_loc]) (I1) (t_G) := - inv_under_impl_57 self := - letb base := (into self) : both _ _ (t_GCanvas) in - solve_lift (into (inv_under_impl_26 base max_under_impl_63)) : both (L1 :|: fset [x_loc]) (I1) (t_G). -Fail Next Obligation. - -Equations pow_felem_under_impl_57 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (exp : both L2 I2 (t_G)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_G) := - pow_felem_under_impl_57 self exp := - letb base := (into self) : both _ _ (t_GCanvas) in - solve_lift (into (pow_felem_under_impl_26 base (into exp) max_under_impl_63)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_G). -Fail Next Obligation. - -Equations pow_under_impl_57 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_G)) (exp : both L2 I2 (int128)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_G) := - pow_under_impl_57 self exp := - letb base := (into self) : both _ _ (t_GCanvas) in - solve_lift (into (pow_under_impl_26 base exp max_under_impl_63)) : both (L1:|:L2 :|: fset [x_loc]) (I1:|:I2) (t_G). -Fail Next Obligation. - -Equations pow2_under_impl_57 {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (uint_size)) : both (L1) (I1) (t_G) := - pow2_under_impl_57 x := - solve_lift (into (pow2_under_impl_15 x)) : both (L1) (I1) (t_G). -Fail Next Obligation. - -Equations from_byte_seq_be_under_impl {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := - from_byte_seq_be_under_impl s := - solve_lift (into (from_be_bytes_under_impl_14 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - declassify_under_impl_2 x)))))) : both (L1 :|: fset [repr_loc]) (I1) (t_G). -Fail Next Obligation. - -Equations from_public_byte_seq_be_under_impl {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := - from_public_byte_seq_be_under_impl s := - solve_lift (into (from_be_bytes_under_impl_14 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - x)))))) : both (L1 :|: fset [repr_loc]) (I1) (t_G). -Fail Next Obligation. - -Equations to_byte_seq_be_under_impl {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_Seq (t_U8)) := - to_byte_seq_be_under_impl self := - solve_lift (from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_be_bytes_under_impl_63 self))) (fun x => - classify_under_impl_2 x)))) : both (L1) (I1) (t_Seq (t_U8)). -Fail Next Obligation. - -Equations to_public_byte_seq_be_under_impl {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1) (I1) (t_Seq (int8)) := - to_public_byte_seq_be_under_impl self := - solve_lift (from_vec_under_impl_52 (to_be_bytes_under_impl_63 self)) : both (L1) (I1) (t_Seq (int8)). -Fail Next Obligation. - -Equations from_byte_seq_le_under_impl {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := - from_byte_seq_le_under_impl s := - solve_lift (into (from_le_bytes_under_impl_14 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - declassify_under_impl_2 x)))))) : both (L1 :|: fset [repr_loc]) (I1) (t_G). -Fail Next Obligation. - -Equations from_public_byte_seq_le_under_impl {L1 : {fset Location}} {I1 : Interface} (s : both L1 I1 (A)) : both (L1 :|: fset [repr_loc]) (I1) (t_G) := - from_public_byte_seq_le_under_impl s := - solve_lift (into (from_le_bytes_under_impl_14 (as_slice_under_impl_1 (collect (map (iter s) (fun x => - x)))))) : both (L1 :|: fset [repr_loc]) (I1) (t_G). -Fail Next Obligation. - -Equations to_byte_seq_le_under_impl {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (t_U8)) := - to_byte_seq_le_under_impl self := - solve_lift (from_vec_under_impl_52 (collect (map (iter_under_impl (deref (to_le_bytes_under_impl_63 self))) (fun x => - classify_under_impl_2 x)))) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (t_U8)). -Fail Next Obligation. - -Equations to_public_byte_seq_le_under_impl {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_G)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (int8)) := - to_public_byte_seq_le_under_impl self := - solve_lift (from_vec_under_impl_52 (to_le_bytes_under_impl_63 self)) : both (L1 :|: fset [repr_loc]) (I1) (t_Seq (int8)). -Fail Next Obligation. - -Equations from_secret_literal_under_impl {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_U128)) : both (L1) (I1) (t_G) := - from_secret_literal_under_impl x := - solve_lift (into (from_literal_under_impl_15 (declassify_under_impl_126 x))) : both (L1) (I1) (t_G). -Fail Next Obligation. - -#[global] Instance t_G_t_NumericCopy : t_NumericCopy t_G := { -}. - -#[global] Instance t_G_t_UnsignedInteger : t_UnsignedInteger t_G := { -}. - -#[global] Instance t_G_t_UnsignedIntegerCopy : t_UnsignedIntegerCopy t_G := { -}. - -#[global] Instance t_G_t_Integer : t_Integer t_G := { - NUM_BITS := solve_lift (ret_both (384 : uint_size)); - ZERO := solve_lift (from_literal_under_impl_63 (ret_both (0 : int128))); - ONE := solve_lift (from_literal_under_impl_63 (ret_both (1 : int128))); - TWO := solve_lift (from_literal_under_impl_63 (ret_both (2 : int128))); - from_literal (val : int128) := solve_lift (from_literal_under_impl_63 val); - from_hex_string (s : t_String) := solve_lift (from_hex_under_impl_63 (deref (replace_under_impl_5 (deref s) (ret_both (0x : chString)) (ret_both ( : chString))))); - get_bit (self : t_G) (i : uint_size) := solve_lift ((self shift_right i) .& v_ONE); - set_bit (self : t_G) (b : t_G) (i : uint_size) := letb _ := (ifb ret_both (true : 'bool) - then letb _ := (ifb not (orb (equal (clone b) v_ONE) (equal (clone b) v_ZERO)) - then letb _ := (never_to_any (panic (ret_both (assertion failed: b.clone().equal(Self::ONE()) || b.clone().equal(Self::ZERO()) : chString)))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - letb tmp1 := (from_literal_under_impl_63 (not ((ret_both (1 : int128)) shift_left i))) : both _ _ (t_G) in - letb tmp2 := (b shift_left i) : both _ _ (t_Output) in - solve_lift ((self .& tmp1) .| tmp2); - set (self : t_G) (pos : uint_size) (y : t_G) (yi : uint_size) := letb b := (get_bit y yi) : both _ _ (t_G) in - solve_lift (set_bit self b pos); - rotate_left (self : t_G) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb _ := (never_to_any (panic (ret_both (assertion failed: n < Self::NUM_BITS : chString)))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - solve_lift (((clone self) shift_left n) .| (self shift_right ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- (ret_both (1 : uint_size)))))); - rotate_right (self : t_G) (n : uint_size) := letb _ := (ifb not (n <.? v_NUM_BITS) - then letb _ := (never_to_any (panic (ret_both (assertion failed: n < Self::NUM_BITS : chString)))) : both _ _ ('unit) in - ret_both (tt : 'unit) - else ret_both (tt : 'unit)) : both _ _ ('unit) in - solve_lift (((clone self) shift_right n) .| (self shift_left ((cast_int (neg (cast_int n))) .& (v_NUM_BITS .- (ret_both (1 : uint_size)))))); -}. - -#[global] Instance t_G_t_ModNumeric : t_ModNumeric t_G := { - sub_mod (self : t_G) (rhs : t_G) (n : t_G) := solve_lift (self .- rhs); - add_mod (self : t_G) (rhs : t_G) (n : t_G) := solve_lift (self .+ rhs); - mul_mod (self : t_G) (rhs : t_G) (n : t_G) := solve_lift (self .* rhs); - pow_mod (self : t_G) (exp : t_G) (n : t_G) := solve_lift (pow_felem_under_impl_57 self exp); - modulo (self : t_G) (n : t_G) := solve_lift (self .% n); - signed_modulo (self : t_G) (n : t_G) := solve_lift (modulo self n); - absolute (self : t_G) := self; -}. - -#[global] Instance t_G_t_Numeric : t_Numeric t_G := { - max_val := solve_lift (into (max_under_impl_63 .- (from_literal_under_impl_15 (ret_both (1 : int128))))); - wrap_add (self : t_G) (rhs : t_G) := solve_lift (self .+ rhs); - wrap_sub (self : t_G) (rhs : t_G) := solve_lift (self .- rhs); - wrap_mul (self : t_G) (rhs : t_G) := solve_lift (self .* rhs); - wrap_div (self : t_G) (rhs : t_G) := solve_lift (self ./ rhs); - exp (self : t_G) (exp : int32) := solve_lift (pow_under_impl_57 self (into exp)); - pow_self (self : t_G) (exp : t_G) := solve_lift (pow_felem_under_impl_57 self exp); - divide (self : t_G) (rhs : t_G) := solve_lift (self ./ rhs); - inv (self : t_G) (n : t_G) := solve_lift (inv_under_impl_57 self); - equal (self : t_G) (other : t_G) := solve_lift (self =.? other); - greater_than (self : t_G) (other : t_G) := solve_lift (self >.? other); - greater_than_or_equal (self : t_G) (other : t_G) := solve_lift (self >=.? other); - less_than (self : t_G) (other : t_G) := solve_lift (self <.? other); - less_than_or_equal (self : t_G) (other : t_G) := solve_lift (self <=.? other); - not_equal_bm (self : t_G) (other : t_G) := ifb solve_lift (self <> other) - then solve_lift ((v_ONE shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- v_ONE) - else solve_lift v_ZERO; - equal_bm (self : t_G) (other : t_G) := ifb solve_lift (self =.? other) - then solve_lift ((v_ONE shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- v_ONE) - else solve_lift v_ZERO; - greater_than_bm (self : t_G) (other : t_G) := ifb solve_lift (self >.? other) - then solve_lift ((v_ONE shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- v_ONE) - else solve_lift v_ZERO; - greater_than_or_equal_bm (self : t_G) (other : t_G) := ifb solve_lift (self >=.? other) - then solve_lift ((v_ONE shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- v_ONE) - else solve_lift v_ZERO; - less_than_bm (self : t_G) (other : t_G) := ifb solve_lift (self <.? other) - then solve_lift ((v_ONE shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- v_ONE) - else solve_lift v_ZERO; - less_than_or_equal_bm (self : t_G) (other : t_G) := ifb solve_lift (self <=.? other) - then solve_lift ((v_ONE shift_left ((ret_both (384 : uint_size)) .- (ret_both (1 : uint_size)))) .- v_ONE) - else solve_lift v_ZERO; -}. - -Definition t_Q : choice_type := - (int32). -Equations Build_t_Q {L : {fset Location}} {I : Interface} (f_v : both L I (int32)) : both L I (t_Q) := - Build_t_Q f_v := - bind_both f_v (fun f_v => - solve_lift (ret_both ((f_v) : (t_Q)))) : both L I (t_Q). -Fail Next Obligation. - -Notation t_Witness := (t_Q). - -Notation t_Statement := (t_G). - -Notation t_Message := (t_G). - -Notation t_Challenge := (t_Q). - -Notation t_Response := (t_Q). - -Notation t_Random := (t_Q). - -Notation t_Query := (t_Q). - -Require Import HashMap. -Export HashMap. - -Notation t_QueriesType := (t_HashMap (t_Q) (t_Q) (t_RandomState)). - -Equations random_oracle_query {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (QUERIES : both L1 I1 (t_HashMap (t_Q) (t_Q) (t_RandomState))) (q : both L2 I2 (t_Q)) (uniform_sample : both L3 I3 (t_Q)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ((t_HashMap (t_Q) (t_Q) (t_RandomState) × t_Q)) := - random_oracle_query QUERIES q uniform_sample := - solve_lift matchb get_under_impl_2 QUERIES q with - | Option_Some r => - prod_b (clone QUERIES,clone r) - | Option_None => - letb r := (uniform_sample) : both _ _ (t_Q) in - letb '(todo_fresh_var,QUERIES_temp) := (insert_under_impl_2 QUERIES q r) : both _ _ ((t_Option (t_Q) × t_HashMap (t_Q) (t_Q) (t_RandomState))) in - letb QUERIES := (QUERIES_temp) : both _ _ (t_HashMap (t_Q) (t_Q) (t_RandomState)) in - letb _ := (todo_fresh_var) : both _ _ (t_Option (t_Q)) in - prod_b (QUERIES,r) - end : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ((t_HashMap (t_Q) (t_Q) (t_RandomState) × t_Q)). -Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_template.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_template.v deleted file mode 100644 index 65fdc50..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_template.v +++ /dev/null @@ -1,165 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. - Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -(*Not implemented yet? todo(item)*) - -Require Import (* Hacspec_ovn_ *)Core. -Export (* Hacspec_ovn_ *)Core. - -Require Import (* Hacspec_ovn_ *)Hacspec_lib. -Export (* Hacspec_ovn_ *)Hacspec_lib. - -Class t_Group (Self : choice_type) := { - t_group_type : choice_type ; - t_group_type_t_Copy :> t_Copy (t_group_type) ; - t_group_type_t_Clone :> t_Clone (t_group_type) ; - t_group_type_t_PartialEq :> t_PartialEq (t_group_type) ; - t_group_type_t_Sized :> t_Sized (t_group_type) ; - q : forall {L I}, both L I uint_size ; - g : forall {L I}, both L I t_group_type ; - g_pow : forall {L I}, both L I uint_size -> both L I t_group_type ; - one : forall {L I}, both L I t_group_type ; - prod_tt : forall {L1 L2 I1 I2}, both L1 I1 t_group_type -> both L2 I2 t_group_type -> both (L1 :|: L2) (I1 :|: I2) t_group_type ; - div : forall {L1 L2 I1 I2}, both L1 I1 t_group_type -> both L2 I2 t_group_type -> both (L1 :|: L2) (I1 :|: I2) t_group_type ; - random_element : forall {L I}, both L I t_group_type ; -}. - -Definition t_eligible_votes : choice_type := - (uint_size). -Equations Build_t_eligible_votes {L : {fset Location}} {I : Interface} (f_v_id : both L I (uint_size)) : both L I (t_eligible_votes) := - Build_t_eligible_votes f_v_id := - bind_both f_v_id (fun f_v_id => - solve_lift (ret_both ((f_v_id) : (t_eligible_votes)))) : both L I (t_eligible_votes). -Fail Next Obligation. - -Equations n : both (fset []) ([interface ]) (uint_size) := - n := - solve_lift (ret_both (3 : uint_size)) : both (fset []) ([interface ]) (uint_size). -Fail Next Obligation. - -Equations v_P : both (fset []) ([interface ]) (nseq t_eligible_votes 3) := - v_P := - array_from_list [solve_lift (Build_t_eligible_votes (* Build_t_C_eligible_votes *) (ret_both (0 : uint_size))); - solve_lift (Build_t_eligible_votes (* Build_t_C_eligible_votes *) (ret_both (1 : uint_size))); - solve_lift (Build_t_eligible_votes (* Build_t_C_eligible_votes *) (ret_both (2 : uint_size)))] : both (fset []) ([interface ]) (nseq t_eligible_votes 3). -Fail Next Obligation. - -Equations select_private_voting_key (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := - select_private_voting_key G random := - solve_lift (random .% q) : both (L1) (I1) (uint_size). -Fail Next Obligation. - -Equations v_ZKP (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (xi : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := - v_ZKP G xi := - solve_lift (ret_both (0 : uint_size)) : both (L1) (I1) (uint_size). -Fail Next Obligation. - -Equations get_broadcast1 : both (fset []) ([interface ]) ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))) := - get_broadcast1 := - solve_lift (prod_b (new(* _under_impl *) : both fset0 fset0 _,new(* _under_impl *) : both fset0 fset0 _)) : both (fset []) ([interface ]) ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))). -Fail Next Obligation. - -Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (uint_size)) : both (L1) (I1) ('bool) := - check_valid zkp := - solve_lift (ret_both (true : 'bool)) : both (L1) (I1) ('bool). -Fail Next Obligation. - -Equations broadcast1 (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (t_group_type)) (zkp : both L2 I2 (uint_size)) (i : both L3 I3 (uint_size)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := - broadcast1 G xi zkp i := - solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). -Fail Next Obligation. - -Definition prod1_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := - (t_group_type ; 0%nat). -Equations register_vote (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (i : both L1 I1 (uint_size)) (random : both L2 I2 (uint_size)) : both (L1:|:L2 :|: fset [prod1_loc]) (I1:|:I2) ('unit) := - register_vote G i random := - letb xi := (select_private_voting_key G random) : both _ _ (uint_size) in - letb _ := (broadcast1 G (g_pow xi) (v_ZKP G xi) i) : both _ _ ('unit) in - letb _ := (ret_both (tt : 'unit)) : both _ _ ('unit) in - letb '(gs,zkps) := (get_broadcast1) : both _ _ ((t_Vec (uint_size) (t_Global) × t_Vec (uint_size) (t_Global))) in - (* letb _ := (other loop todo(term)) : both _ _ ('unit) in *) - letbm prod1 loc(prod1_loc) := (one) : both _ _ (t_group_type) in - letb prod1 := (foldi_both (into_iter (Build_t_Range (ret_both (1 : uint_size))(i .- (ret_both (1 : uint_size))))) (fun {L I _ _} =>fun j => - (ssp (fun prod1 => - solve_lift (prod_tt prod1 (g_pow (gs.a[j])))) )) prod1) : both _ _ (t_group_type) in - letb prod2 := (one) : both _ _ (t_group_type) in - letb prod1 := (foldi_both (into_iter (Build_t_Range (i .+ (ret_both (1 : uint_size)))n)) (fun {L I _ _} =>fun j => - (ssp (fun prod1 => - solve_lift (prod_tt prod1 (g_pow (gs.a[j])))) )) prod1) : both _ _ (t_group_type) in - letb Yi := (div prod1 prod2) : both _ _ (t_group_type) in - solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2 :|: fset [prod1_loc]) (I1:|:I2) ('unit). -Fail Next Obligation. - -Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {I1 : Interface} (vi : both L1 I1 ('bool)) : both (L1) (I1) (uint_size) := - v_ZKP_one_out_of_two vi := - solve_lift (ret_both (32 : uint_size)) : both (L1) (I1) (uint_size). -Fail Next Obligation. - -Equations broadcast2 (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (g_pow_xiyi : both L1 I1 (t_group_type)) (g_pow_vi : both L2 I2 (t_group_type)) (g_pow_vi_zkp : both L3 I3 (uint_size)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := - broadcast2 G g_pow_xiyi g_pow_vi g_pow_vi_zkp := - solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). -Fail Next Obligation. - -Equations get_broadcast2 (G : _) `{ t_Sized (G)} `{ t_Group (G)} : both (fset []) ([interface ]) ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))) := - get_broadcast2 G := - solve_lift (prod_b (new(* _under_impl *) : both fset0 fset0 _,new(* _under_impl *): both fset0 fset0 _,new(* _under_impl *): both fset0 fset0 _)) : both (fset []) ([interface ]) ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))). -Fail Next Obligation. - -Equations cast_vote (G : _) `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (uint_size)) (yi : both L2 I2 (uint_size)) (vi : both L3 I3 ('bool)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit) := - cast_vote G xi yi vi := - letb _ := (broadcast2 G (g_pow (xi .* yi)) (g_pow (ifb vi - then ret_both (1 : uint_size) - else ret_both (0 : uint_size))) (v_ZKP_one_out_of_two vi)) : both _ _ ('unit) in - letb _ := (ret_both (tt : 'unit)) : both _ _ ('unit) in - solve_lift (ret_both (tt : 'unit)) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) ('unit). -Fail Next Obligation. - -Definition vote_result_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := - (t_group_type ; 2%nat). -Definition tally_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := - (uint_size ; 1%nat). - -Definition len {A L I} := lift1_both (L := L) (I := I) (fun (x : chList A) => repr _ (@List.length A x) : uint32). - -Equations tally_votes (G : _) `{ t_Sized (G)} `{ t_Group (G)} : both (fset [tally_loc; vote_result_loc]) ([interface ]) (uint_size) := - tally_votes G := - letb '(g_pow_xi_yi,g_pow_vi,zkps) := (get_broadcast2 G) : both _ _ ((t_Vec (t_group_type) (t_Global) × t_Vec (t_group_type) (t_Global) × t_Vec (uint_size) (t_Global))) in - (* letb _ := (other loop todo(term)) : both _ _ ('unit) in *) - (* letbm vote_result loc(vote_result_loc) := (one) : both _ _ (t_group_type) in *) - (* letb vote_result := (foldi_both (into_iter (Build_t_Range (ret_both (0 : uint_size))(len(* _under_impl_1 *) g_pow_vi))) (fun {L I _ _} =>fun i => *) - (* (ssp (fun vote_result => *) - (* solve_lift (prod_tt vote_result (prod_tt (clone (g_pow_xi_yi.a[i])) (clone (g_pow_vi.a[i]))))) )) vote_result) : both _ _ (t_group_type) in *) - letbm tally loc(tally_loc) := (ret_both (0 : uint_size)) : both _ _ (uint_size) in - (* letb tally := (foldi_both (into_iter (Build_t_Range (ret_both (1 : uint_size))n)) (fun {L I _ _} =>fun i => *) - (* (ssp (fun tally => *) - (* (* ifb solve_lift ((g_pow tally) <> vote_result) *) *) - (* (* then ControlFlow_Continue (letb _ := (tally .+ (ret_both (1 : uint_size))) : both _ _ ('unit) in *) *) - (* solve_lift (ret_both (tt : 'unit)) (* ) *) *) - (* (* else letb hoist1 := (v_Break tally) : both _ _ (t_Never) in *) *) - (* (* ControlFlow_Continue (letb _ := (never_to_any hoist1) : both _ _ ('unit) in *) *) - (* (* tally) *)) )) tally) : both _ _ ('unit) in *) - solve_lift tally : both (fset [tally_loc; vote_result_loc]) ([interface ]) (uint_size). -Fail Next Obligation. diff --git a/ovn/src/ovn_smart.rs b/ovn/src/ovn_smart.rs new file mode 100644 index 0000000..df89684 --- /dev/null +++ b/ovn/src/ovn_smart.rs @@ -0,0 +1,246 @@ +#![no_std] + +// use core::*; +// use hacspec_lib::*; +// use creusot_contracts::*; + +use concordium_std::*; // {HasLogger, HasInitContext, Logger, HasContractState, Reject, Serial, Deserial, Read, ParseResult, Write}; +use concordium_std_derive::*; + +/** Interface for group implementation */ +pub trait Group { + type group_type: PartialEq + Eq + Clone + Copy + concordium_std::Serialize; + + const q: u32; // Prime order + const g: Self::group_type; // Generator (elemnent of group) + + fn g_pow(x: u32) -> Self::group_type; + fn pow(g: Self::group_type, x: u32) -> Self::group_type; + fn one() -> Self::group_type; + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type; + fn inv(x: Self::group_type) -> Self::group_type; + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; + // fn random_element() -> Self::group_type; +} + +struct z_17 {} +impl Group for z_17 { + type group_type = u32; + + const q: u32 = 17; // Prime order + const g: Self::group_type = 3; // Generator (elemnent of group) + + fn g_pow(x: u32) -> Self::group_type { + (Self::g ^ x) % Self::q + } + + fn pow(g: Self::group_type, x: u32) -> Self::group_type { + (Self::g ^ x) % Self::q + } + + fn one() -> Self::group_type { + 1 + } + + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { + (x * y) % Self::q + } + + fn inv(x: Self::group_type) -> Self::group_type { + let mut res = 0; + for i in 1..Self::q { + if Self::pow(Self::g, i) == x { + res = i + } + } + Self::q - res + } + + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { + Self::prod(x, Self::inv(y)) + } + // fn random_element() -> Self::group_type { + + // } +} + +// struct eligible_votes { +// v_id : u32, +// } + +// /** number of parties */ +// const n : u32 = 3u32; +// const P : [eligible_votes; 3] = // n = 3 +// [eligible_votes {v_id: 0}, +// eligible_votes {v_id: 1}, +// eligible_votes {v_id: 2}]; + +// use concordium_contracts_common::*; +// extern crate concordium_std; + +#[contract_state(contract = "OVN")] +#[derive(Serialize, SchemaType)] +struct OvnContractState { + broadcast1_a: [G::group_type; n], + broadcast1_b: [u32; n], + + broadcast2_a: [G::group_type; n], + broadcast2_b: [G::group_type; n], + broadcast2_c: [u32; n], + + tally: u32, +} + +#[init(contract = "OVN")] +pub fn init_ovn_contract(ctx: &impl HasInitContext) -> Result { + Ok(true) +} + +/** Currently randomness needs to be injected */ +pub fn select_private_voting_key(random: u32) -> u32 { + random % G::q // x_i \in_R Z_q; +} + +/** TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics */ +pub fn ZKP(xi: u32) -> u32 { + 0 +} + +#[derive(Serialize, SchemaType)] +struct RegisterParam { + i: u32, + xi: u32, +} + +type G = z_17; +const n: usize = 20; + +/** Primary function in round 1 */ +#[receive(contract = "OVN", name = "register", parameter = "RegisterParam")] +pub fn register_vote_pre( + ctx: &impl HasReceiveContext, + state: &mut OvnContractState, +) -> Result { + let params: RegisterParam = ctx.parameter_cursor().get()?; + // let xi = select_private_voting_key::(params.random); + state.broadcast1_a[params.i as usize] = G::g_pow(params.xi); + state.broadcast1_b[params.i as usize] = ZKP::(params.xi); + Ok(A::accept()) +} + +pub fn check_valid(zkp: u32) -> bool { + true +} + +/** Cramer, Damgård and Schoenmakers (CDS) technique */ +pub fn ZKP_one_out_of_two(vi: bool) -> u32 { + 32 // TODO +} + +#[derive(Serialize, SchemaType)] +struct CastVoteParam { + i: u32, + xi: u32, + vote: bool, +} +/** Primary function in round 2 */ +#[receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] +pub fn cast_vote( + ctx: &impl HasReceiveContext, + state: &mut OvnContractState, +) -> Result { + let params: CastVoteParam = ctx.parameter_cursor().get()?; + for zkp in state.broadcast1_b { + check_valid(zkp); + () + } + + let mut prod1 = G::one(); + for j in 0..(params.i - 1) as usize { + prod1 = G::prod(prod1, state.broadcast1_a[j]); + } + let prod2 = G::one(); + for j in (params.i + 1) as usize..n { + prod2 = G::prod(prod2, state.broadcast1_a[j]); + } + let Yi = G::div(prod1, prod2); + // implicityly: Y_i = g^y_i + + state.broadcast2_a[params.i as usize] = G::pow(Yi, params.xi); + state.broadcast2_b[params.i as usize] = G::g_pow(if params.vote { 1 } else { 0 }); + state.broadcast2_c[params.i as usize] = ZKP_one_out_of_two(params.vote); + + Ok(A::accept()) +} + +struct TallyParameter {} + +#[receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] +/** Anyone can tally the votes */ +pub fn tally_votes( + _: &impl HasReceiveContext, + state: &mut OvnContractState, +) -> Result { + let (g_pow_xi_yi, g_pow_vi, zkps) = + (state.broadcast2_a, state.broadcast2_b, state.broadcast2_c); + for zkp in zkps { + check_valid(zkp); + () + } + + let mut vote_result = G::one(); + for i in 0..g_pow_vi.len() { + vote_result = G::prod( + vote_result, + G::prod(g_pow_xi_yi[i].clone(), g_pow_vi[i].clone()), + ); + } + + let mut tally = 0; + for i in 1..n as u32 { + // Should be while, but is bounded by n anyways! + if G::g_pow(i) == vote_result { + tally = i; + } + } + state.tally = tally; + + Ok(A::accept()) +} + +// pub fn correctness(randomness : Vec, votes : Vec) -> bool { +// let mut xi = Vec::new(); +// for i in 0..n { +// xi.push(register_vote_pre::(i, randomness[i])) +// } +// let (gs, zkps) = get_broadcast1(); +// let mut Yi = Vec::new(); +// for i in 0..n { +// Yi.push(register_vote_post::(i, gs.clone(), zkps.clone())); +// } +// for i in 0..n { +// cast_vote::(xi[i], Yi[i], votes[i]) +// } +// let mut count = 0; +// for v in votes { +// if v { +// count = count + 1; // += 1 does not work correctly +// } +// } +// tally_votes::() == count +// } + +// extern crate quickcheck; +// #[macro_use(quickcheck)] +// extern crate quickcheck_macros; +// use quickcheck::*; + +// #[ensures(result == true)] +// pub fn temp () { + +// } + +// #[quickcheck] +// pub fn check_correctness(randomness : Vec, votes : Vec) -> bool { +// correctness::(randomness, votes); +// } diff --git a/ovn/src/ovn_template.rs b/ovn/src/ovn_template.rs index 198d6a2..df89684 100644 --- a/ovn/src/ovn_template.rs +++ b/ovn/src/ovn_template.rs @@ -1,209 +1,246 @@ -use core::*; -use hacspec_lib::*; -use creusot_contracts::*; +#![no_std] + +// use core::*; +// use hacspec_lib::*; +// use creusot_contracts::*; + +use concordium_std::*; // {HasLogger, HasInitContext, Logger, HasContractState, Reject, Serial, Deserial, Read, ParseResult, Write}; +use concordium_std_derive::*; /** Interface for group implementation */ pub trait Group { - type group_type : PartialEq + Eq + Clone + Copy; + type group_type: PartialEq + Eq + Clone + Copy + concordium_std::Serialize; - const q : usize; // Prime order - const g : Self::group_type; // Generator (elemnent of group) + const q: u32; // Prime order + const g: Self::group_type; // Generator (elemnent of group) - fn g_pow(x : usize) -> Self::group_type; - fn pow(g : Self::group_type, x : usize) -> Self::group_type; + fn g_pow(x: u32) -> Self::group_type; + fn pow(g: Self::group_type, x: u32) -> Self::group_type; fn one() -> Self::group_type; - fn prod(x : Self::group_type, y : Self::group_type) -> Self::group_type; - fn div(x : Self::group_type, y : Self::group_type) -> Self::group_type; - fn random_element() -> Self::group_type; + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type; + fn inv(x: Self::group_type) -> Self::group_type; + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; + // fn random_element() -> Self::group_type; +} + +struct z_17 {} +impl Group for z_17 { + type group_type = u32; + + const q: u32 = 17; // Prime order + const g: Self::group_type = 3; // Generator (elemnent of group) + + fn g_pow(x: u32) -> Self::group_type { + (Self::g ^ x) % Self::q + } + + fn pow(g: Self::group_type, x: u32) -> Self::group_type { + (Self::g ^ x) % Self::q + } + + fn one() -> Self::group_type { + 1 + } + + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { + (x * y) % Self::q + } + + fn inv(x: Self::group_type) -> Self::group_type { + let mut res = 0; + for i in 1..Self::q { + if Self::pow(Self::g, i) == x { + res = i + } + } + Self::q - res + } + + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { + Self::prod(x, Self::inv(y)) + } + // fn random_element() -> Self::group_type { + + // } } // struct eligible_votes { -// v_id : usize, +// v_id : u32, // } -/** number of parties */ -const n : usize = 3; +// /** number of parties */ +// const n : u32 = 3u32; // const P : [eligible_votes; 3] = // n = 3 // [eligible_votes {v_id: 0}, // eligible_votes {v_id: 1}, // eligible_votes {v_id: 2}]; -#[ensures(is_random_group_elem(random))] -#[requires(is_random(random))] -#[cfg(not(simple_test))] +// use concordium_contracts_common::*; +// extern crate concordium_std; + +#[contract_state(contract = "OVN")] +#[derive(Serialize, SchemaType)] +struct OvnContractState { + broadcast1_a: [G::group_type; n], + broadcast1_b: [u32; n], + + broadcast2_a: [G::group_type; n], + broadcast2_b: [G::group_type; n], + broadcast2_c: [u32; n], + + tally: u32, +} + +#[init(contract = "OVN")] +pub fn init_ovn_contract(ctx: &impl HasInitContext) -> Result { + Ok(true) +} + /** Currently randomness needs to be injected */ -pub fn select_private_voting_key (random : usize) -> usize { +pub fn select_private_voting_key(random: u32) -> u32 { random % G::q // x_i \in_R Z_q; } /** TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics */ -pub fn ZKP(xi : usize) -> usize { +pub fn ZKP(xi: u32) -> u32 { 0 } -/** State of bulletin board */ -pub fn get_broadcast1() -> (Vec, Vec) { - (Vec::new(), Vec::new()) +#[derive(Serialize, SchemaType)] +struct RegisterParam { + i: u32, + xi: u32, } -pub fn check_valid(zkp : usize) -> bool { +type G = z_17; +const n: usize = 20; + +/** Primary function in round 1 */ +#[receive(contract = "OVN", name = "register", parameter = "RegisterParam")] +pub fn register_vote_pre( + ctx: &impl HasReceiveContext, + state: &mut OvnContractState, +) -> Result { + let params: RegisterParam = ctx.parameter_cursor().get()?; + // let xi = select_private_voting_key::(params.random); + state.broadcast1_a[params.i as usize] = G::g_pow(params.xi); + state.broadcast1_b[params.i as usize] = ZKP::(params.xi); + Ok(A::accept()) +} + +pub fn check_valid(zkp: u32) -> bool { true } -pub fn broadcast1(xi : G::group_type, zkp : usize, i : usize) { - +/** Cramer, Damgård and Schoenmakers (CDS) technique */ +pub fn ZKP_one_out_of_two(vi: bool) -> u32 { + 32 // TODO } -/** Primary function in round 1 */ -pub fn register_vote_pre(i : usize, random : usize) -> usize { - let xi = select_private_voting_key::(random); - broadcast1::(G::g_pow(xi), ZKP::(xi), i); - xi +#[derive(Serialize, SchemaType)] +struct CastVoteParam { + i: u32, + xi: u32, + vote: bool, } - -/** Primary function in round 1 */ -pub fn register_vote_post(i : usize, gs : Vec, zkps : Vec) -> G::group_type { - for zkp in zkps { - check_valid(zkp); () +/** Primary function in round 2 */ +#[receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] +pub fn cast_vote( + ctx: &impl HasReceiveContext, + state: &mut OvnContractState, +) -> Result { + let params: CastVoteParam = ctx.parameter_cursor().get()?; + for zkp in state.broadcast1_b { + check_valid(zkp); + () } let mut prod1 = G::one(); - for j in 0..i-1 { - prod1 = G::prod(prod1, G::g_pow(gs[j])); + for j in 0..(params.i - 1) as usize { + prod1 = G::prod(prod1, state.broadcast1_a[j]); } let prod2 = G::one(); - for j in i+1..n { - prod1 = G::prod(prod1, G::g_pow(gs[j])); + for j in (params.i + 1) as usize..n { + prod2 = G::prod(prod2, state.broadcast1_a[j]); } let Yi = G::div(prod1, prod2); // implicityly: Y_i = g^y_i - Yi -} - -// Meta Round: - -// pub fn round1(user){ -// for x in user { -// register() -// } -// } - -/** Cramer, Damgård and Schoenmakers (CDS) technique */ -pub fn ZKP_one_out_of_two(vi : bool) -> usize { - 32 // TODO -} -pub fn broadcast2 (g_pow_xiyi : G::group_type, g_pow_vi : G::group_type, g_pow_vi_zkp : usize) { + state.broadcast2_a[params.i as usize] = G::pow(Yi, params.xi); + state.broadcast2_b[params.i as usize] = G::g_pow(if params.vote { 1 } else { 0 }); + state.broadcast2_c[params.i as usize] = ZKP_one_out_of_two(params.vote); + Ok(A::accept()) } -pub fn get_broadcast2 () -> (Vec,Vec,Vec) { - (Vec::new(),Vec::new(),Vec::new()) -} - -/** Primary function in round 2 */ -pub fn cast_vote(xi : usize, Yi : G::group_type, vi : bool) { - broadcast2::(G::pow(Yi, xi), G::g_pow(if vi { 1 } else { 0 }), ZKP_one_out_of_two(vi)); -} - -// Meta Round: - -// pub fn round2(){ -// for x in user { -// cast_vote() -// } -// } +struct TallyParameter {} +#[receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] /** Anyone can tally the votes */ -pub fn tally_votes() -> usize { - let (g_pow_xi_yi, g_pow_vi, zkps) = get_broadcast2::(); +pub fn tally_votes( + _: &impl HasReceiveContext, + state: &mut OvnContractState, +) -> Result { + let (g_pow_xi_yi, g_pow_vi, zkps) = + (state.broadcast2_a, state.broadcast2_b, state.broadcast2_c); for zkp in zkps { - check_valid(zkp); () + check_valid(zkp); + () } let mut vote_result = G::one(); for i in 0..g_pow_vi.len() { - vote_result = G::prod(vote_result, G::prod(g_pow_xi_yi[i].clone(), g_pow_vi[i].clone())); + vote_result = G::prod( + vote_result, + G::prod(g_pow_xi_yi[i].clone(), g_pow_vi[i].clone()), + ); } let mut tally = 0; - for i in 1..n { // Should be while, but is bounded by n anyways! + for i in 1..n as u32 { + // Should be while, but is bounded by n anyways! if G::g_pow(i) == vote_result { tally = i; } } - tally -} - -// Meta Round: + state.tally = tally; -// Tally - -/////////// -// Tests // -/////////// - -#[cfg(test)] -extern crate quickcheck; -#[cfg(test)] -#[macro_use(quickcheck)] -extern crate quickcheck_macros; - -#[cfg(test)] -use quickcheck::*; - -#[derive(Debug, Clone)] -struct votes { - elems: [bool;n] + Ok(A::accept()) } -#[cfg(test)] -impl Arbitrary for votes { - fn arbitrary(g: &mut Gen) -> votes { - let mut a: [bool; n] = [false; n]; - for i in 0..n { - a[i] = bool::arbitrary(g); - } - votes {elems: a} - } -} +// pub fn correctness(randomness : Vec, votes : Vec) -> bool { +// let mut xi = Vec::new(); +// for i in 0..n { +// xi.push(register_vote_pre::(i, randomness[i])) +// } +// let (gs, zkps) = get_broadcast1(); +// let mut Yi = Vec::new(); +// for i in 0..n { +// Yi.push(register_vote_post::(i, gs.clone(), zkps.clone())); +// } +// for i in 0..n { +// cast_vote::(xi[i], Yi[i], votes[i]) +// } +// let mut count = 0; +// for v in votes { +// if v { +// count = count + 1; // += 1 does not work correctly +// } +// } +// tally_votes::() == count +// } -#[derive(Debug, Clone)] -struct randomness { - elems: [usize;n] -} +// extern crate quickcheck; +// #[macro_use(quickcheck)] +// extern crate quickcheck_macros; +// use quickcheck::*; -#[cfg(test)] -impl Arbitrary for randomness { - fn arbitrary(g: &mut Gen) -> randomness { - let mut a: [usize; n] = [0; n]; - for i in 0..n { - a[i] = usize::arbitrary(g); - } - randomness {elems: a} - } -} +// #[ensures(result == true)] +// pub fn temp () { -#[cfg(test)] -#[quickcheck] -pub fn correctness(randomness : randomness, votes : votes) -> bool { - let mut xi = Vec::new(); - for i in 0..n { - xi.push(register_vote_pre::(i, randomness.elems[i])) - } - let (gs, zkps) = get_broadcast1(); - let mut Yi = Vec::new(); - for i in 0..n { - Yi.push(register_vote_post::(i, gs, zkps)); - } - for i in 0..n { - cast_vote::(xi[i], Yi[i], votes.elems[i]) - } - let mut count = 0; - for v in votes.elems { - if v { - count = count + 1; // += 1 does not work correctly - } - } - tally_votes::() == count -} +// } + +// #[quickcheck] +// pub fn check_correctness(randomness : Vec, votes : Vec) -> bool { +// correctness::(randomness, votes); +// } From bbcbe8a43e1f4d606772b8a6d619753d0b0e5ebc Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 22 Aug 2023 17:08:44 +0200 Subject: [PATCH 14/86] Smart contract version of OVN --- ovn/src/ovn_template.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ovn/src/ovn_template.rs b/ovn/src/ovn_template.rs index df89684..7301a0e 100644 --- a/ovn/src/ovn_template.rs +++ b/ovn/src/ovn_template.rs @@ -159,7 +159,7 @@ pub fn cast_vote( for j in 0..(params.i - 1) as usize { prod1 = G::prod(prod1, state.broadcast1_a[j]); } - let prod2 = G::one(); + let mut prod2 = G::one(); for j in (params.i + 1) as usize..n { prod2 = G::prod(prod2, state.broadcast1_a[j]); } From 1732675e14b7de868cf8304a1ce64bbe6a31480c Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 22 Aug 2023 17:36:23 +0200 Subject: [PATCH 15/86] Smart contract version of OVN --- ovn/src/ovn_smart.rs | 67 ++++---- ovn/src/ovn_template.rs | 329 ++++++++++++++++++---------------------- 2 files changed, 182 insertions(+), 214 deletions(-) diff --git a/ovn/src/ovn_smart.rs b/ovn/src/ovn_smart.rs index df89684..cc0c969 100644 --- a/ovn/src/ovn_smart.rs +++ b/ovn/src/ovn_smart.rs @@ -4,7 +4,7 @@ // use hacspec_lib::*; // use creusot_contracts::*; -use concordium_std::*; // {HasLogger, HasInitContext, Logger, HasContractState, Reject, Serial, Deserial, Read, ParseResult, Write}; +use concordium_std::*; // ::{HasLogger, HasInitContext, Logger, HasContractState, Reject, Serial, Deserial, Read, ParseResult, Write, Get, ParseError, HasReceiveContext, HasActions, Seek, Action, ReceiveContextExtern, ExternContext, Vec, to_bytes, test_infrastructure::InitContextTest}; use concordium_std_derive::*; /** Interface for group implementation */ @@ -23,7 +23,7 @@ pub trait Group { // fn random_element() -> Self::group_type; } -struct z_17 {} +pub struct z_17 {} impl Group for z_17 { type group_type = u32; @@ -80,7 +80,7 @@ impl Group for z_17 { #[contract_state(contract = "OVN")] #[derive(Serialize, SchemaType)] -struct OvnContractState { +pub struct OvnContractState { broadcast1_a: [G::group_type; n], broadcast1_b: [u32; n], @@ -107,7 +107,7 @@ pub fn ZKP(xi: u32) -> u32 { } #[derive(Serialize, SchemaType)] -struct RegisterParam { +pub struct RegisterParam { i: u32, xi: u32, } @@ -117,7 +117,7 @@ const n: usize = 20; /** Primary function in round 1 */ #[receive(contract = "OVN", name = "register", parameter = "RegisterParam")] -pub fn register_vote_pre( +pub fn register_vote( ctx: &impl HasReceiveContext, state: &mut OvnContractState, ) -> Result { @@ -138,7 +138,7 @@ pub fn ZKP_one_out_of_two(vi: bool) -> u32 { } #[derive(Serialize, SchemaType)] -struct CastVoteParam { +pub struct CastVoteParam { i: u32, xi: u32, vote: bool, @@ -159,7 +159,7 @@ pub fn cast_vote( for j in 0..(params.i - 1) as usize { prod1 = G::prod(prod1, state.broadcast1_a[j]); } - let prod2 = G::one(); + let mut prod2 = G::one(); for j in (params.i + 1) as usize..n { prod2 = G::prod(prod2, state.broadcast1_a[j]); } @@ -173,8 +173,7 @@ pub fn cast_vote( Ok(A::accept()) } -struct TallyParameter {} - +pub struct TallyParameter {} #[receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] /** Anyone can tally the votes */ pub fn tally_votes( @@ -208,39 +207,45 @@ pub fn tally_votes( Ok(A::accept()) } -// pub fn correctness(randomness : Vec, votes : Vec) -> bool { -// let mut xi = Vec::new(); +// #[cfg(test)] +// #[concordium_test] +// pub fn test_correctness() { +// let randomness : Vec = Vec::new(); +// let votes : Vec = Vec::new(); + +// // Setup the context +// let mut ctx = InitContextTest::empty(); +// // ctx.set_sender(ADDRESS_0); + +// let mut state = init_ovn_contract(); + +// let xis = Vec::new(); // for i in 0..n { -// xi.push(register_vote_pre::(i, randomness[i])) +// xis.push(select_private_voting_key::(randomness[i])); // } -// let (gs, zkps) = get_broadcast1(); -// let mut Yi = Vec::new(); + // for i in 0..n { -// Yi.push(register_vote_post::(i, gs.clone(), zkps.clone())); +// let parameter = RegisterParam { i, xi: xis[i] }; +// let parameter_bytes = to_bytes(¶meter); +// ctx.set_parameter(¶meter_bytes); + +// register_vote(ctx, state); // } + // for i in 0..n { -// cast_vote::(xi[i], Yi[i], votes[i]) +// let parameter = CastVoteParam { i, xi: xis[i], vote: votes[i] }; +// let parameter_bytes = to_bytes(¶meter); +// ctx.set_parameter(¶meter_bytes); + +// cast_vote(ctx, state); // } + // let mut count = 0; // for v in votes { // if v { // count = count + 1; // += 1 does not work correctly // } // } -// tally_votes::() == count -// } - -// extern crate quickcheck; -// #[macro_use(quickcheck)] -// extern crate quickcheck_macros; -// use quickcheck::*; - -// #[ensures(result == true)] -// pub fn temp () { - -// } -// #[quickcheck] -// pub fn check_correctness(randomness : Vec, votes : Vec) -> bool { -// correctness::(randomness, votes); +// claim_eq!(state.tally, count, "The tally should equal the number of positive votes"); // } diff --git a/ovn/src/ovn_template.rs b/ovn/src/ovn_template.rs index 7301a0e..198d6a2 100644 --- a/ovn/src/ovn_template.rs +++ b/ovn/src/ovn_template.rs @@ -1,246 +1,209 @@ -#![no_std] - -// use core::*; -// use hacspec_lib::*; -// use creusot_contracts::*; - -use concordium_std::*; // {HasLogger, HasInitContext, Logger, HasContractState, Reject, Serial, Deserial, Read, ParseResult, Write}; -use concordium_std_derive::*; +use core::*; +use hacspec_lib::*; +use creusot_contracts::*; /** Interface for group implementation */ pub trait Group { - type group_type: PartialEq + Eq + Clone + Copy + concordium_std::Serialize; + type group_type : PartialEq + Eq + Clone + Copy; - const q: u32; // Prime order - const g: Self::group_type; // Generator (elemnent of group) + const q : usize; // Prime order + const g : Self::group_type; // Generator (elemnent of group) - fn g_pow(x: u32) -> Self::group_type; - fn pow(g: Self::group_type, x: u32) -> Self::group_type; + fn g_pow(x : usize) -> Self::group_type; + fn pow(g : Self::group_type, x : usize) -> Self::group_type; fn one() -> Self::group_type; - fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type; - fn inv(x: Self::group_type) -> Self::group_type; - fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; - // fn random_element() -> Self::group_type; -} - -struct z_17 {} -impl Group for z_17 { - type group_type = u32; - - const q: u32 = 17; // Prime order - const g: Self::group_type = 3; // Generator (elemnent of group) - - fn g_pow(x: u32) -> Self::group_type { - (Self::g ^ x) % Self::q - } - - fn pow(g: Self::group_type, x: u32) -> Self::group_type { - (Self::g ^ x) % Self::q - } - - fn one() -> Self::group_type { - 1 - } - - fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { - (x * y) % Self::q - } - - fn inv(x: Self::group_type) -> Self::group_type { - let mut res = 0; - for i in 1..Self::q { - if Self::pow(Self::g, i) == x { - res = i - } - } - Self::q - res - } - - fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { - Self::prod(x, Self::inv(y)) - } - // fn random_element() -> Self::group_type { - - // } + fn prod(x : Self::group_type, y : Self::group_type) -> Self::group_type; + fn div(x : Self::group_type, y : Self::group_type) -> Self::group_type; + fn random_element() -> Self::group_type; } // struct eligible_votes { -// v_id : u32, +// v_id : usize, // } -// /** number of parties */ -// const n : u32 = 3u32; +/** number of parties */ +const n : usize = 3; // const P : [eligible_votes; 3] = // n = 3 // [eligible_votes {v_id: 0}, // eligible_votes {v_id: 1}, // eligible_votes {v_id: 2}]; -// use concordium_contracts_common::*; -// extern crate concordium_std; - -#[contract_state(contract = "OVN")] -#[derive(Serialize, SchemaType)] -struct OvnContractState { - broadcast1_a: [G::group_type; n], - broadcast1_b: [u32; n], - - broadcast2_a: [G::group_type; n], - broadcast2_b: [G::group_type; n], - broadcast2_c: [u32; n], - - tally: u32, -} - -#[init(contract = "OVN")] -pub fn init_ovn_contract(ctx: &impl HasInitContext) -> Result { - Ok(true) -} - +#[ensures(is_random_group_elem(random))] +#[requires(is_random(random))] +#[cfg(not(simple_test))] /** Currently randomness needs to be injected */ -pub fn select_private_voting_key(random: u32) -> u32 { +pub fn select_private_voting_key (random : usize) -> usize { random % G::q // x_i \in_R Z_q; } /** TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics */ -pub fn ZKP(xi: u32) -> u32 { +pub fn ZKP(xi : usize) -> usize { 0 } -#[derive(Serialize, SchemaType)] -struct RegisterParam { - i: u32, - xi: u32, +/** State of bulletin board */ +pub fn get_broadcast1() -> (Vec, Vec) { + (Vec::new(), Vec::new()) } -type G = z_17; -const n: usize = 20; - -/** Primary function in round 1 */ -#[receive(contract = "OVN", name = "register", parameter = "RegisterParam")] -pub fn register_vote_pre( - ctx: &impl HasReceiveContext, - state: &mut OvnContractState, -) -> Result { - let params: RegisterParam = ctx.parameter_cursor().get()?; - // let xi = select_private_voting_key::(params.random); - state.broadcast1_a[params.i as usize] = G::g_pow(params.xi); - state.broadcast1_b[params.i as usize] = ZKP::(params.xi); - Ok(A::accept()) -} - -pub fn check_valid(zkp: u32) -> bool { +pub fn check_valid(zkp : usize) -> bool { true } -/** Cramer, Damgård and Schoenmakers (CDS) technique */ -pub fn ZKP_one_out_of_two(vi: bool) -> u32 { - 32 // TODO +pub fn broadcast1(xi : G::group_type, zkp : usize, i : usize) { + } -#[derive(Serialize, SchemaType)] -struct CastVoteParam { - i: u32, - xi: u32, - vote: bool, +/** Primary function in round 1 */ +pub fn register_vote_pre(i : usize, random : usize) -> usize { + let xi = select_private_voting_key::(random); + broadcast1::(G::g_pow(xi), ZKP::(xi), i); + xi } -/** Primary function in round 2 */ -#[receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] -pub fn cast_vote( - ctx: &impl HasReceiveContext, - state: &mut OvnContractState, -) -> Result { - let params: CastVoteParam = ctx.parameter_cursor().get()?; - for zkp in state.broadcast1_b { - check_valid(zkp); - () + +/** Primary function in round 1 */ +pub fn register_vote_post(i : usize, gs : Vec, zkps : Vec) -> G::group_type { + for zkp in zkps { + check_valid(zkp); () } let mut prod1 = G::one(); - for j in 0..(params.i - 1) as usize { - prod1 = G::prod(prod1, state.broadcast1_a[j]); + for j in 0..i-1 { + prod1 = G::prod(prod1, G::g_pow(gs[j])); } - let mut prod2 = G::one(); - for j in (params.i + 1) as usize..n { - prod2 = G::prod(prod2, state.broadcast1_a[j]); + let prod2 = G::one(); + for j in i+1..n { + prod1 = G::prod(prod1, G::g_pow(gs[j])); } let Yi = G::div(prod1, prod2); // implicityly: Y_i = g^y_i + Yi +} + +// Meta Round: + +// pub fn round1(user){ +// for x in user { +// register() +// } +// } + +/** Cramer, Damgård and Schoenmakers (CDS) technique */ +pub fn ZKP_one_out_of_two(vi : bool) -> usize { + 32 // TODO +} - state.broadcast2_a[params.i as usize] = G::pow(Yi, params.xi); - state.broadcast2_b[params.i as usize] = G::g_pow(if params.vote { 1 } else { 0 }); - state.broadcast2_c[params.i as usize] = ZKP_one_out_of_two(params.vote); +pub fn broadcast2 (g_pow_xiyi : G::group_type, g_pow_vi : G::group_type, g_pow_vi_zkp : usize) { - Ok(A::accept()) } -struct TallyParameter {} +pub fn get_broadcast2 () -> (Vec,Vec,Vec) { + (Vec::new(),Vec::new(),Vec::new()) +} + +/** Primary function in round 2 */ +pub fn cast_vote(xi : usize, Yi : G::group_type, vi : bool) { + broadcast2::(G::pow(Yi, xi), G::g_pow(if vi { 1 } else { 0 }), ZKP_one_out_of_two(vi)); +} + +// Meta Round: + +// pub fn round2(){ +// for x in user { +// cast_vote() +// } +// } -#[receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] /** Anyone can tally the votes */ -pub fn tally_votes( - _: &impl HasReceiveContext, - state: &mut OvnContractState, -) -> Result { - let (g_pow_xi_yi, g_pow_vi, zkps) = - (state.broadcast2_a, state.broadcast2_b, state.broadcast2_c); +pub fn tally_votes() -> usize { + let (g_pow_xi_yi, g_pow_vi, zkps) = get_broadcast2::(); for zkp in zkps { - check_valid(zkp); - () + check_valid(zkp); () } let mut vote_result = G::one(); for i in 0..g_pow_vi.len() { - vote_result = G::prod( - vote_result, - G::prod(g_pow_xi_yi[i].clone(), g_pow_vi[i].clone()), - ); + vote_result = G::prod(vote_result, G::prod(g_pow_xi_yi[i].clone(), g_pow_vi[i].clone())); } let mut tally = 0; - for i in 1..n as u32 { - // Should be while, but is bounded by n anyways! + for i in 1..n { // Should be while, but is bounded by n anyways! if G::g_pow(i) == vote_result { tally = i; } } - state.tally = tally; - - Ok(A::accept()) + tally } -// pub fn correctness(randomness : Vec, votes : Vec) -> bool { -// let mut xi = Vec::new(); -// for i in 0..n { -// xi.push(register_vote_pre::(i, randomness[i])) -// } -// let (gs, zkps) = get_broadcast1(); -// let mut Yi = Vec::new(); -// for i in 0..n { -// Yi.push(register_vote_post::(i, gs.clone(), zkps.clone())); -// } -// for i in 0..n { -// cast_vote::(xi[i], Yi[i], votes[i]) -// } -// let mut count = 0; -// for v in votes { -// if v { -// count = count + 1; // += 1 does not work correctly -// } -// } -// tally_votes::() == count -// } +// Meta Round: -// extern crate quickcheck; -// #[macro_use(quickcheck)] -// extern crate quickcheck_macros; -// use quickcheck::*; +// Tally -// #[ensures(result == true)] -// pub fn temp () { +/////////// +// Tests // +/////////// -// } +#[cfg(test)] +extern crate quickcheck; +#[cfg(test)] +#[macro_use(quickcheck)] +extern crate quickcheck_macros; -// #[quickcheck] -// pub fn check_correctness(randomness : Vec, votes : Vec) -> bool { -// correctness::(randomness, votes); -// } +#[cfg(test)] +use quickcheck::*; + +#[derive(Debug, Clone)] +struct votes { + elems: [bool;n] +} + +#[cfg(test)] +impl Arbitrary for votes { + fn arbitrary(g: &mut Gen) -> votes { + let mut a: [bool; n] = [false; n]; + for i in 0..n { + a[i] = bool::arbitrary(g); + } + votes {elems: a} + } +} + +#[derive(Debug, Clone)] +struct randomness { + elems: [usize;n] +} + +#[cfg(test)] +impl Arbitrary for randomness { + fn arbitrary(g: &mut Gen) -> randomness { + let mut a: [usize; n] = [0; n]; + for i in 0..n { + a[i] = usize::arbitrary(g); + } + randomness {elems: a} + } +} + +#[cfg(test)] +#[quickcheck] +pub fn correctness(randomness : randomness, votes : votes) -> bool { + let mut xi = Vec::new(); + for i in 0..n { + xi.push(register_vote_pre::(i, randomness.elems[i])) + } + let (gs, zkps) = get_broadcast1(); + let mut Yi = Vec::new(); + for i in 0..n { + Yi.push(register_vote_post::(i, gs, zkps)); + } + for i in 0..n { + cast_vote::(xi[i], Yi[i], votes.elems[i]) + } + let mut count = 0; + for v in votes.elems { + if v { + count = count + 1; // += 1 does not work correctly + } + } + tally_votes::() == count +} From 648283054e5c5bf17670b08a9b7faeaf68833502 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 23 Aug 2023 14:39:13 +0200 Subject: [PATCH 16/86] Fixed based on feedback --- ovn/src/ovn_smart.rs | 139 ++++++++++++++++-------- ovn/src/ovn_template.rs | 229 +++++++++++++--------------------------- 2 files changed, 170 insertions(+), 198 deletions(-) diff --git a/ovn/src/ovn_smart.rs b/ovn/src/ovn_smart.rs index cc0c969..cd1203a 100644 --- a/ovn/src/ovn_smart.rs +++ b/ovn/src/ovn_smart.rs @@ -81,12 +81,13 @@ impl Group for z_17 { #[contract_state(contract = "OVN")] #[derive(Serialize, SchemaType)] pub struct OvnContractState { - broadcast1_a: [G::group_type; n], - broadcast1_b: [u32; n], + g_pow_xis: [G::group_type; n], + zkp_xis: [u32; n], - broadcast2_a: [G::group_type; n], - broadcast2_b: [G::group_type; n], - broadcast2_c: [u32; n], + commit_vis: [u32; n], + + g_pow_xi_yi_vis: [G::group_type; n], + zkp_vis: [u32; n], tally: u32, } @@ -102,7 +103,7 @@ pub fn select_private_voting_key(random: u32) -> u32 { } /** TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics */ -pub fn ZKP(xi: u32) -> u32 { +pub fn ZKP(g_pow_xi: G::group_type, xi: u32) -> u32 { 0 } @@ -122,57 +123,101 @@ pub fn register_vote( state: &mut OvnContractState, ) -> Result { let params: RegisterParam = ctx.parameter_cursor().get()?; + // let xi = select_private_voting_key::(params.random); - state.broadcast1_a[params.i as usize] = G::g_pow(params.xi); - state.broadcast1_b[params.i as usize] = ZKP::(params.xi); + let g_pow_xi = G::g_pow(params.xi); + let zkp_xi = ZKP::(g_pow_xi, params.xi); + + state.g_pow_xis[params.i as usize] = g_pow_xi; + state.zkp_xis[params.i as usize] = zkp_xi; Ok(A::accept()) } -pub fn check_valid(zkp: u32) -> bool { - true +#[derive(Serialize, SchemaType)] +pub struct CastVoteParam { + i: u32, + xi: u32, + vote: bool, } -/** Cramer, Damgård and Schoenmakers (CDS) technique */ -pub fn ZKP_one_out_of_two(vi: bool) -> u32 { - 32 // TODO +pub fn check_valid(zkp: u32) -> bool { + true } -#[derive(Serialize, SchemaType)] -pub struct CastVoteParam { +pub fn compute_group_element_for_vote( i: u32, xi: u32, vote: bool, + xis: [G::group_type; n], +) -> G::group_type { + let mut prod1 = G::one(); + for j in 0..(i - 1) as usize { + prod1 = G::prod(prod1, xis[j]); + } + let mut prod2 = G::one(); + for j in (i + 1) as usize..n { + prod2 = G::prod(prod2, xis[j]); + } + let Yi = G::div(prod1, prod2); + // implicityly: Y_i = g^y_i + G::prod(G::pow(Yi, xi), G::g_pow(if vote { 1 } else { 0 })) } -/** Primary function in round 2 */ -#[receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] -pub fn cast_vote( + +pub fn commit_to(x: G::group_type) -> u32 { + 0 +} + +/** Commitment before round 2 */ +#[receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] +pub fn commit_to_vote( ctx: &impl HasReceiveContext, state: &mut OvnContractState, ) -> Result { let params: CastVoteParam = ctx.parameter_cursor().get()?; - for zkp in state.broadcast1_b { + for zkp in state.zkp_xis { check_valid(zkp); () } - let mut prod1 = G::one(); - for j in 0..(params.i - 1) as usize { - prod1 = G::prod(prod1, state.broadcast1_a[j]); - } - let mut prod2 = G::one(); - for j in (params.i + 1) as usize..n { - prod2 = G::prod(prod2, state.broadcast1_a[j]); - } - let Yi = G::div(prod1, prod2); - // implicityly: Y_i = g^y_i + let g_pow_xi_yi_vi = + compute_group_element_for_vote::(params.i, params.xi, params.vote, state.g_pow_xis); + let commit_vi = commit_to::(g_pow_xi_yi_vi); + + state.commit_vis[params.i as usize] = commit_vi; + Ok(A::accept()) +} + +/** Cramer, Damgård and Schoenmakers (CDS) technique */ +pub fn ZKP_one_out_of_two(g_pow_vi: G::group_type, vi: bool) -> u32 { + 32 // TODO +} + +/** Primary function in round 2, also opens commitment */ +#[receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] +pub fn cast_vote( + ctx: &impl HasReceiveContext, + state: &mut OvnContractState, +) -> Result { + let params: CastVoteParam = ctx.parameter_cursor().get()?; + + let g_pow_xi_yi_vi = + compute_group_element_for_vote::(params.i, params.xi, params.vote, state.g_pow_xis); + let zkp_vi = ZKP_one_out_of_two::(g_pow_xi_yi_vi, params.vote); - state.broadcast2_a[params.i as usize] = G::pow(Yi, params.xi); - state.broadcast2_b[params.i as usize] = G::g_pow(if params.vote { 1 } else { 0 }); - state.broadcast2_c[params.i as usize] = ZKP_one_out_of_two(params.vote); + state.g_pow_xi_yi_vis[params.i as usize] = g_pow_xi_yi_vi; + state.zkp_vis[params.i as usize] = zkp_vi; Ok(A::accept()) } +pub fn check_valid2(g_pow_xi_yi_vi: G::group_type, zkp: u32) -> bool { + true +} + +pub fn check_commitment(g_pow_xi_yi_vi: G::group_type, zkp: u32) -> bool { + true +} + pub struct TallyParameter {} #[receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] /** Anyone can tally the votes */ @@ -180,23 +225,19 @@ pub fn tally_votes( _: &impl HasReceiveContext, state: &mut OvnContractState, ) -> Result { - let (g_pow_xi_yi, g_pow_vi, zkps) = - (state.broadcast2_a, state.broadcast2_b, state.broadcast2_c); - for zkp in zkps { - check_valid(zkp); + for i in 0..n { + check_valid2::(state.g_pow_xi_yi_vis[i], state.zkp_vis[i]); + check_commitment::(state.g_pow_xi_yi_vis[i], state.commit_vis[i]); () } let mut vote_result = G::one(); - for i in 0..g_pow_vi.len() { - vote_result = G::prod( - vote_result, - G::prod(g_pow_xi_yi[i].clone(), g_pow_vi[i].clone()), - ); + for g_pow_vote in state.g_pow_xi_yi_vis { + vote_result = G::prod(vote_result, g_pow_vote); } let mut tally = 0; - for i in 1..n as u32 { + for i in 0..n as u32 { // Should be while, but is bounded by n anyways! if G::g_pow(i) == vote_result { tally = i; @@ -237,9 +278,23 @@ pub fn tally_votes( // let parameter_bytes = to_bytes(¶meter); // ctx.set_parameter(¶meter_bytes); +// commit_to_vote(ctx, state); +// } + +// for i in 0..n { +// let parameter = CastVoteParam { i, xi: xis[i], vote: votes[i] }; +// let parameter_bytes = to_bytes(¶meter); +// ctx.set_parameter(¶meter_bytes); + // cast_vote(ctx, state); // } +// let parameter = TallyParameter {}; +// let parameter_bytes = to_bytes(¶meter); +// ctx.set_parameter(¶meter_bytes); + +// tally_votes(ctx, state); + // let mut count = 0; // for v in votes { // if v { diff --git a/ovn/src/ovn_template.rs b/ovn/src/ovn_template.rs index 198d6a2..9cf00fa 100644 --- a/ovn/src/ovn_template.rs +++ b/ovn/src/ovn_template.rs @@ -1,209 +1,126 @@ -use core::*; -use hacspec_lib::*; -use creusot_contracts::*; - /** Interface for group implementation */ pub trait Group { - type group_type : PartialEq + Eq + Clone + Copy; + type group_type: PartialEq + Eq + Clone + Copy + concordium_std::Serialize; - const q : usize; // Prime order - const g : Self::group_type; // Generator (elemnent of group) + const q: u32; // Prime order + const g: Self::group_type; // Generator (elemnent of group) - fn g_pow(x : usize) -> Self::group_type; - fn pow(g : Self::group_type, x : usize) -> Self::group_type; + fn g_pow(x: u32) -> Self::group_type; + fn pow(g: Self::group_type, x: u32) -> Self::group_type; fn one() -> Self::group_type; - fn prod(x : Self::group_type, y : Self::group_type) -> Self::group_type; - fn div(x : Self::group_type, y : Self::group_type) -> Self::group_type; - fn random_element() -> Self::group_type; + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type; + fn inv(x: Self::group_type) -> Self::group_type; + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; + // fn random_element() -> Self::group_type; } -// struct eligible_votes { -// v_id : usize, -// } - -/** number of parties */ -const n : usize = 3; -// const P : [eligible_votes; 3] = // n = 3 -// [eligible_votes {v_id: 0}, -// eligible_votes {v_id: 1}, -// eligible_votes {v_id: 2}]; - -#[ensures(is_random_group_elem(random))] -#[requires(is_random(random))] -#[cfg(not(simple_test))] /** Currently randomness needs to be injected */ -pub fn select_private_voting_key (random : usize) -> usize { +pub fn select_private_voting_key(random: u32) -> u32 { random % G::q // x_i \in_R Z_q; } /** TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics */ -pub fn ZKP(xi : usize) -> usize { +pub fn ZKP(g_pow_xi: G::group_type, xi: u32) -> u32 { 0 } -/** State of bulletin board */ -pub fn get_broadcast1() -> (Vec, Vec) { - (Vec::new(), Vec::new()) -} - -pub fn check_valid(zkp : usize) -> bool { - true -} - -pub fn broadcast1(xi : G::group_type, zkp : usize, i : usize) { - -} - /** Primary function in round 1 */ -pub fn register_vote_pre(i : usize, random : usize) -> usize { +pub fn register_vote(i: u32, random: u32) -> () { let xi = select_private_voting_key::(random); - broadcast1::(G::g_pow(xi), ZKP::(xi), i); - xi + let g_pow_xi = G::g_pow(xi); + let zkp_xi = ZKP::(g_pow_xi, xi); + + broadcast1(g_pow_xi, zkp_xi); } -/** Primary function in round 1 */ -pub fn register_vote_post(i : usize, gs : Vec, zkps : Vec) -> G::group_type { - for zkp in zkps { - check_valid(zkp); () - } +pub fn check_valid(zkp: u32) -> bool { + true +} +pub fn compute_group_element_for_vote( + i: u32, + xi: u32, + vote: bool, + xis: [G::group_type; n], +) -> G::group_type { let mut prod1 = G::one(); - for j in 0..i-1 { - prod1 = G::prod(prod1, G::g_pow(gs[j])); + for j in 0..(i - 1) as usize { + prod1 = G::prod(prod1, xis[j]); } - let prod2 = G::one(); - for j in i+1..n { - prod1 = G::prod(prod1, G::g_pow(gs[j])); + let mut prod2 = G::one(); + for j in (i + 1) as usize..n { + prod2 = G::prod(prod2, xis[j]); } let Yi = G::div(prod1, prod2); // implicityly: Y_i = g^y_i - Yi + G::prod(G::pow(Yi, xi), G::g_pow(if vote { 1 } else { 0 })) +} + +pub fn commit_to(x: G::group_type) -> u32 { + 0 } -// Meta Round: +/** Commitment before round 2 */ +pub fn commit_to_vote(i: u32, xi: u32, vote: bool) -> () { + let (g_pow_xis, zkp_xis) = get_broadcast1(); + + for zkp in zkp_xis { + check_valid(zkp); + () + } + + let g_pow_xi_yi_vi = compute_group_element_for_vote::(i, xi, vote, g_pow_xis); + let commit_vi = commit_to::(g_pow_xi_yi_vi); -// pub fn round1(user){ -// for x in user { -// register() -// } -// } + broadcast_commit(commit_vi); +} /** Cramer, Damgård and Schoenmakers (CDS) technique */ -pub fn ZKP_one_out_of_two(vi : bool) -> usize { +pub fn ZKP_one_out_of_two(g_pow_vi: G::group_type, vi: bool) -> u32 { 32 // TODO } -pub fn broadcast2 (g_pow_xiyi : G::group_type, g_pow_vi : G::group_type, g_pow_vi_zkp : usize) { +/** Primary function in round 2, also opens commitment */ +pub fn cast_vote(i: u32, xi: u32, vote: bool) -> () { + let (g_pow_xis, zkp_xis) = get_broadcast1(); -} + let g_pow_xi_yi_vi = compute_group_element_for_vote::(i, xi, vote, g_pow_xis); + let zkp_vi = ZKP_one_out_of_two::(g_pow_xi_yi_vi, vote); -pub fn get_broadcast2 () -> (Vec,Vec,Vec) { - (Vec::new(),Vec::new(),Vec::new()) + broadcast_2(g_pow_xi_yi_vi, zkp_vi); } -/** Primary function in round 2 */ -pub fn cast_vote(xi : usize, Yi : G::group_type, vi : bool) { - broadcast2::(G::pow(Yi, xi), G::g_pow(if vi { 1 } else { 0 }), ZKP_one_out_of_two(vi)); +pub fn check_valid2(g_pow_xi_yi_vi: G::group_type, zkp: u32) -> bool { + true } -// Meta Round: - -// pub fn round2(){ -// for x in user { -// cast_vote() -// } -// } +pub fn check_commitment(g_pow_xi_yi_vi: G::group_type, zkp: u32) -> bool { + true +} /** Anyone can tally the votes */ -pub fn tally_votes() -> usize { - let (g_pow_xi_yi, g_pow_vi, zkps) = get_broadcast2::(); - for zkp in zkps { - check_valid(zkp); () +pub fn tally_votes() -> u32 { + let (g_pow_xi_yi_vis, zkp_vis) = get_broadcast2(); + let commit_vis = get_broadcast_commit(); + + for i in 0..n { + check_valid2(g_pow_xi_yi_vis[i], zkp_vis[i]); + check_commitment(g_pow_xi_yi_vis[i], commit_vis[i]); + () } let mut vote_result = G::one(); - for i in 0..g_pow_vi.len() { - vote_result = G::prod(vote_result, G::prod(g_pow_xi_yi[i].clone(), g_pow_vi[i].clone())); + for g_pow_vote in g_pow_xi_yi_vis { + vote_result = G::prod(vote_result, g_pow_vote); } let mut tally = 0; - for i in 1..n { // Should be while, but is bounded by n anyways! + for i in 0..n as u32 { + // Should be while, but is bounded by n anyways! if G::g_pow(i) == vote_result { tally = i; } } - tally -} - -// Meta Round: - -// Tally - -/////////// -// Tests // -/////////// - -#[cfg(test)] -extern crate quickcheck; -#[cfg(test)] -#[macro_use(quickcheck)] -extern crate quickcheck_macros; - -#[cfg(test)] -use quickcheck::*; -#[derive(Debug, Clone)] -struct votes { - elems: [bool;n] -} - -#[cfg(test)] -impl Arbitrary for votes { - fn arbitrary(g: &mut Gen) -> votes { - let mut a: [bool; n] = [false; n]; - for i in 0..n { - a[i] = bool::arbitrary(g); - } - votes {elems: a} - } -} - -#[derive(Debug, Clone)] -struct randomness { - elems: [usize;n] -} - -#[cfg(test)] -impl Arbitrary for randomness { - fn arbitrary(g: &mut Gen) -> randomness { - let mut a: [usize; n] = [0; n]; - for i in 0..n { - a[i] = usize::arbitrary(g); - } - randomness {elems: a} - } -} - -#[cfg(test)] -#[quickcheck] -pub fn correctness(randomness : randomness, votes : votes) -> bool { - let mut xi = Vec::new(); - for i in 0..n { - xi.push(register_vote_pre::(i, randomness.elems[i])) - } - let (gs, zkps) = get_broadcast1(); - let mut Yi = Vec::new(); - for i in 0..n { - Yi.push(register_vote_post::(i, gs, zkps)); - } - for i in 0..n { - cast_vote::(xi[i], Yi[i], votes.elems[i]) - } - let mut count = 0; - for v in votes.elems { - if v { - count = count + 1; // += 1 does not work correctly - } - } - tally_votes::() == count + tally } From dd432adccb96ab8e1bd2185f52d7e9a49b2e18ab Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 23 Aug 2023 14:41:35 +0200 Subject: [PATCH 17/86] Fixed based on feedback --- ovn/src/ovn_template.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ovn/src/ovn_template.rs b/ovn/src/ovn_template.rs index 9cf00fa..514f16e 100644 --- a/ovn/src/ovn_template.rs +++ b/ovn/src/ovn_template.rs @@ -104,8 +104,8 @@ pub fn tally_votes() -> u32 { let commit_vis = get_broadcast_commit(); for i in 0..n { - check_valid2(g_pow_xi_yi_vis[i], zkp_vis[i]); - check_commitment(g_pow_xi_yi_vis[i], commit_vis[i]); + check_valid2::(g_pow_xi_yi_vis[i], zkp_vis[i]); + check_commitment::(g_pow_xi_yi_vis[i], commit_vis[i]); () } From 3df71486de8661e414cb49e4d00893112008ad94 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 23 Aug 2023 14:58:18 +0200 Subject: [PATCH 18/86] Add concordium execution impl in hacspec --- Cargo.toml | 2 + concordium-derive/Cargo.toml | 32 + concordium-derive/src/lib.rs | 1474 ++++++++ concordium/Cargo.toml | 28 + concordium/src/concordium.rs | 139 + concordium/src/concordium_impls.rs | 1048 ++++++ concordium/src/concordium_prims.rs | 502 +++ concordium/src/concordium_traits.rs | 272 ++ concordium/src/concordium_types.rs | 357 ++ concordium/src/constants.rs | 8 + concordium/src/test_infrastructure.rs | 839 +++++ ovn/Cargo.toml | 8 +- ovn/concordium.org | 4786 +++++++++++++++++++++++++ ovn/concordium_derive.org | 1530 ++++++++ ovn/src/ovn_smart.rs | 6 +- 15 files changed, 11026 insertions(+), 5 deletions(-) create mode 100644 concordium-derive/Cargo.toml create mode 100644 concordium-derive/src/lib.rs create mode 100644 concordium/Cargo.toml create mode 100644 concordium/src/concordium.rs create mode 100644 concordium/src/concordium_impls.rs create mode 100644 concordium/src/concordium_prims.rs create mode 100644 concordium/src/concordium_traits.rs create mode 100644 concordium/src/concordium_types.rs create mode 100644 concordium/src/constants.rs create mode 100644 concordium/src/test_infrastructure.rs create mode 100644 ovn/concordium.org create mode 100644 ovn/concordium_derive.org diff --git a/Cargo.toml b/Cargo.toml index bfafcd2..d3f6283 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,4 +24,6 @@ members = [ # "halo2", # "weierstrass-curves", "ovn", + # "concordium", + # "concordium-derive", ] diff --git a/concordium-derive/Cargo.toml b/concordium-derive/Cargo.toml new file mode 100644 index 0000000..cbe9231 --- /dev/null +++ b/concordium-derive/Cargo.toml @@ -0,0 +1,32 @@ +[package] +name = "hacspec-concordium-derive" +version = "0.1.0" +authors = [""] +edition = "2018" + +[lib] +path = "src/lib.rs" +proc-macro = true + +[dependencies] +hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } +# hacspec-attributes = { path = "../../utils/attributes", version = "0.1.0-beta.1" , features = ["print_attributes", "hacspec_unsafe"] } # , features = ["hacspec_unsafe"] , , optional = true +creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "7763b3ae77205fba83182b9a6c3e69ad0b12fec7" } +concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850" , version = "=2.0.0" , default-features = false } +# hacspec-concordium = { path = "../concordium" } +syn = { version = "1.0.63", features = [ "full", "extra-traits" ] } +quote = "=1.0.0" +proc-macro2 = "1.0" + +# Reduce code size, at the cost of performance in allocation heavy-code. +wee_alloc="0.4.5" + +# [features] +# use_attributes = ["hacspec-attributes/print_attributes", "hacspec-attributes/hacspec_unsafe"] + +[dev-dependencies] +# hacspec-dev = { path = "../../utils/dev" } +criterion = "0.3" +rand = "0.8" +quickcheck = "1" +quickcheck_macros = "1" diff --git a/concordium-derive/src/lib.rs b/concordium-derive/src/lib.rs new file mode 100644 index 0000000..a1742af --- /dev/null +++ b/concordium-derive/src/lib.rs @@ -0,0 +1,1474 @@ +// #![no_std] +extern crate proc_macro; +extern crate syn; +#[macro_use] +extern crate quote; + +use concordium_contracts_common::*; +use proc_macro::TokenStream; +use proc_macro2::Span; +use quote::ToTokens; +#[cfg(feature = "build-schema")] +use std::collections::HashMap; +use std::{convert::TryFrom, ops::Neg}; +use syn::{ + parse::Parser, parse_macro_input, punctuated::*, spanned::Spanned, DataEnum, Ident, Meta, Token, +}; + +// use hacspec_concordium::*; + +/// A helper to report meaningful compilation errors +/// - If applied to an Ok value they simply return the underlying value. +/// - If applied to `Err(e)` then `e` is turned into a compiler error. +fn unwrap_or_report(v: syn::Result) -> TokenStream { + match v { + Ok(ts) => ts, + Err(e) => e.to_compile_error().into(), + } +} + +fn attach_error(mut v: syn::Result, msg: &str) -> syn::Result { + if let Err(e) = v.as_mut() { + let span = e.span(); + e.combine(syn::Error::new(span, msg)); + } + v +} + +/// Get the name item from a list, if available and a string literal. +/// If the named item does not have the expected (string) value, this will +/// return an Err. If the item does not exist the return value is Ok(None). +/// FIXME: Ensure there is only one. +fn get_attribute_value<'a, I: IntoIterator>( + iter: I, + name: &str, +) -> syn::Result> { + for attr in iter.into_iter() { + match attr { + Meta::NameValue(mnv) => { + if mnv.path.is_ident(name) { + if let syn::Lit::Str(lit) = &mnv.lit { + return Ok(Some(lit)); + } else { + return Err(syn::Error::new( + mnv.span(), + format!("The `{}` attribute must be a string literal.", name), + )); + } + } + } + Meta::Path(p) => { + if p.is_ident(name) { + return Err(syn::Error::new( + attr.span(), + format!("The `{}` attribute must have a string literal value.", name), + )); + } + } + Meta::List(p) => { + if p.path.is_ident(name) { + return Err(syn::Error::new( + attr.span(), + format!("The `{}` attribute must have a string literal value.", name), + )); + } + } + } + } + Ok(None) +} + +// Return whether a attribute item is present. +fn contains_attribute<'a, I: IntoIterator>(iter: I, name: &str) -> bool { + iter.into_iter().any(|attr| attr.path().is_ident(name)) +} + +/// Derive the appropriate export for an annotated init function. +/// +/// This macro requires the following items to be present +/// - `contract=""` where *\* is the name of the smart contract and +/// the generated function is exported as this name prefixed with *init_*. The +/// name should be unique in the module, as a contract can only have one +/// init-function. +/// +/// The annotated function must be of a specific type, which depends on the +/// enabled attributes. *Without* any of the optional attributes the function +/// must have a signature of +/// +/// ```ignore +/// #[init(contract = "my_contract")] +/// fn some_init(ctx: &impl HasInitContext) -> InitResult {...} +/// ``` +/// +/// Where the trait `HasInitContext` and the type `InitResult` are exposed from +/// `concordium-std` and `MyState` is the user-defined type for the contract +/// state. +/// +/// # Optional attributes +/// +/// ## `payable`: Make function accept an amount of GTU +/// Without setting the `payable` attribute, the generated function will reject +/// any non-zero amount of GTU supplied with the transaction. This means we are +/// required to explicitly mark our functions as `payable`, if they are to +/// accept GTU. +/// +/// Setting the `payable` attribute changes the required signature to include an +/// extra argument of type `Amount`, allowing the function to access the amount +/// of GTU supplied with the transaction. +/// +/// ### Example +/// ```ignore +/// #[init(contract = "my_contract", payable)] +/// fn some_init(ctx: &impl HasInitContext, amount: Amount) -> InitResult {...} +/// ``` +/// +/// ## `enable_logger`: Function can access event logging +/// Setting the `enable_logger` attribute changes the required signature to +/// include an extra argument `&mut impl HasLogger`, allowing the function to +/// log events. +/// +/// +/// ### Example +/// ```ignore +/// #[init(contract = "my_contract", enable_logger)] +/// fn some_init(ctx: &impl HasInitContext, logger: &mut impl HasLogger) -> InitResult {...} +/// ``` +/// +/// ## `low_level`: Manually deal with writing state bytes +/// Setting the `low_level` attribute disables the generated code for +/// serializing the contract state. +/// +/// If `low_level` is set, the signature must contain an extra argument of type +/// `&mut ContractState` found in `concordium-std`, which gives access to +/// manipulating the contract state bytes directly. This means there is no need +/// to return the contract state and the return type becomes `InitResult<()>`. +/// +/// ### Example +/// ```ignore +/// #[init(contract = "my_contract", low_level)] +/// fn some_init(ctx: &impl HasInitContext, state: &mut ContractState) -> InitResult<()> {...} +/// ``` +/// +/// ## `parameter=""`: Generate schema for parameter +/// To make schema generation to include the parameter for this function, add +/// the attribute `parameter` and set it equal to a string literal containing +/// the name of the type used for the parameter. The parameter type must +/// implement the SchemaType trait, which for most cases can be derived +/// automatically. +/// +/// ### Example +/// ```ignore +/// #[derive(SchemaType)] +/// struct MyParam { ... } +/// +/// #[init(contract = "my_contract", parameter = "MyParam")] +/// ``` +#[proc_macro_attribute] +pub fn init(attr: TokenStream, item: TokenStream) -> TokenStream { + unwrap_or_report(init_worker(attr, item)) +} + +fn init_worker(attr: TokenStream, item: TokenStream) -> syn::Result { + let attrs = Punctuated::::parse_terminated.parse(attr)?; + + let contract_name = get_attribute_value(attrs.iter(), "contract")?.ok_or_else(|| { + syn::Error::new( + Span::call_site(), + "A name for the contract must be provided, using the contract attribute. For example, \ + #[init(contract = \"my-contract\")]", + ) + })?; + + let ast: syn::ItemFn = + attach_error(syn::parse(item), "#[init] can only be applied to functions.")?; + + let fn_name = &ast.sig.ident; + let rust_export_fn_name = format_ident!("export_{}", fn_name); + let wasm_export_fn_name = format!("init_{}", contract_name.value()); + + if let Err(e) = ContractName::is_valid_contract_name(&wasm_export_fn_name) { + return Err(syn::Error::new(contract_name.span(), e)); + } + + let amount_ident = format_ident!("amount"); + + // Accumulate a list of required arguments, if the function contains a + // different number of arguments, than elements in this vector, then the + // strings are displayed as the expected arguments. + let mut required_args = vec!["ctx: &impl HasInitContext"]; + + let (setup_fn_optional_args, fn_optional_args) = + contract_function_optional_args_tokens(&attrs, &amount_ident, &mut required_args); + + let mut out = if contains_attribute(attrs.iter(), "low_level") { + required_args.push("state: &mut ContractState"); + quote! { + #[export_name = #wasm_export_fn_name] + pub extern "C" fn #rust_export_fn_name(#amount_ident: hacspec_concordium::Amount) -> i32 { + use hacspec_concordium::{trap, ExternContext, InitContextExtern, ContractState}; + #setup_fn_optional_args + let ctx = ExternContext::::open(()); + let mut state = ContractState::open(()); + match #fn_name(&ctx, #(#fn_optional_args, )* &mut state) { + Ok(()) => 0, + Err(reject) => { + let code = Reject::from(reject).error_code.get(); + if code < 0 { + code + } else { + trap() // precondition violation + } + } + } + } + } + } else { + quote! { + #[export_name = #wasm_export_fn_name] + pub extern "C" fn #rust_export_fn_name(amount: hacspec_concordium::Amount) -> i32 { + use hacspec_concordium::{trap, ExternContext, InitContextExtern, ContractState}; + #setup_fn_optional_args + let ctx = ExternContext::::open(()); + match #fn_name(&ctx, #(#fn_optional_args),*) { + Ok(state) => { + let mut state_bytes = ContractState::open(()); + if state.serial(&mut state_bytes).is_err() { + trap() // Could not initialize contract. + }; + 0 + } + Err(reject) => { + let code = Reject::from(reject).error_code.get(); + if code < 0 { + code + } else { + trap() // precondition violation + } + } + } + } + } + }; + + let arg_count = ast.sig.inputs.len(); + if arg_count != required_args.len() { + return Err(syn::Error::new( + ast.sig.inputs.span(), + format!( + "Incorrect number of function arguments, the expected arguments are ({}) ", + required_args.join(", ") + ), + )); + } + + // Embed schema if 'parameter' attribute is set + let parameter_option = get_attribute_value(attrs.iter(), "parameter")?.map(|a| a.value()); + out.extend(contract_function_schema_tokens( + parameter_option, + rust_export_fn_name, + wasm_export_fn_name, + )); + + ast.to_tokens(&mut out); + + Ok(out.into()) +} + +/// Derive the appropriate export for an annotated receive function. +/// +/// This macro requires the following items to be present +/// - `contract = ""` where *\* is the name of +/// the smart contract. +/// - `name = ""` where *\* is the name of the +/// receive function. The generated function is exported as +/// `.`. Contract name and receive name is +/// required to be unique in the module. +/// +/// The annotated function must be of a specific type, which depends on the +/// enabled attributes. *Without* any of the optional attributes the function +/// must have a signature of +/// +/// ```ignore +/// #[receive(contract = "my_contract", name = "some_receive")] +/// fn contract_receive(ctx: &impl HasReceiveContext, state: &mut MyState) -> ReceiveResult {...} +/// ``` +/// +/// Where the `HasAction`, `HasReceiveContext` traits and the type +/// `ReceiveResult` are exposed from `concordium-std` and `MyState` is the +/// user-defined type for the contract state. +/// +/// # Optional attributes +/// +/// ## `payable`: Make function accept an amount of GTU +/// Without setting the `payable` attribute, the function will reject any +/// non-zero amount of GTU, supplied with the transaction. This means we are +/// required to explicitly mark our functions as `payable`, if they are to +/// accept GTU. +/// +/// Setting the `payable` attribute changes the required signature to include an +/// extra argument of type `Amount`, allowing the function to access the amount +/// of GTU supplied with the transaction. +/// +/// ### Example +/// ```ignore +/// #[receive(contract = "my_contract", name = "some_receive", payable)] +/// fn contract_receive(ctx: &impl HasReceiveContext, amount: Amount, state: &mut MyState) -> ReceiveResult {...} +/// ``` +/// +/// ## `enable_logger`: Function can access event logging +/// Setting the `enable_logger` attribute changes the required signature to +/// include an extra argument `&mut impl HasLogger`, allowing the function to +/// log events. +/// +/// +/// ### Example +/// ```ignore +/// #[receive(contract = "my_contract", name = "some_receive", enable_logger)] +/// fn contract_receive(ctx: &impl HasReceiveContext, logger: &mut impl HasLogger, state: &mut MyState) -> ReceiveResult {...} +/// ``` +/// +/// ## `low_level`: Manually deal with writing state bytes +/// Setting the `low_level` attribute disables the generated code for +/// serializing the contract state. +/// +/// If `low_level` is set, instead of the user-defined state type in the +/// signature, the state argument becomes the type `&mut ContractState` found in +/// `concordium-std`, which gives access to manipulating the contract state +/// bytes directly. +/// +/// ### Example +/// ```ignore +/// #[receive(contract = "my_contract", name = "some_receive", low_level)] +/// fn contract_receive(ctx: &impl HasReceiveContext, state: &mut ContractState) -> ReceiveResult {...} +/// ``` +/// +/// ## `parameter=""`: Generate schema for parameter +/// To make schema generation include the parameter for this function, add +/// the attribute `parameter` and set it equal to a string literal containing +/// the name of the type used for the parameter. The parameter type must +/// implement the SchemaType trait, which for most cases can be derived +/// automatically. +/// +/// ### Example +/// ```ignore +/// #[derive(SchemaType)] +/// struct MyParam { ... } +/// +/// #[receive(contract = "my_contract", name = "some_receive", parameter = "MyParam")] +/// fn contract_receive(ctx: &impl HasReceiveContext, state: &mut MyState) -> ReceiveResult {...} +/// ``` +#[proc_macro_attribute] +pub fn receive(attr: TokenStream, item: TokenStream) -> TokenStream { + unwrap_or_report(receive_worker(attr, item)) +} + +fn receive_worker(attr: TokenStream, item: TokenStream) -> syn::Result { + let attrs = Punctuated::::parse_terminated.parse(attr)?; + + let contract_name = get_attribute_value(attrs.iter(), "contract")?.ok_or_else(|| { + syn::Error::new( + Span::call_site(), + "The name of the associated contract must be provided, using the 'contract' \ + attribute.\n\nFor example, #[receive(contract = \"my-contract\")]", + ) + })?; + + let name = get_attribute_value(attrs.iter(), "name")?.ok_or_else(|| { + syn::Error::new( + Span::call_site(), + "A name for the receive function must be provided, using the 'name' attribute.\n\nFor \ + example, #[receive(name = \"func-name\", ...)]", + ) + })?; + + let ast: syn::ItemFn = + attach_error(syn::parse(item), "#[receive] can only be applied to functions.")?; + + let fn_name = &ast.sig.ident; + let rust_export_fn_name = format_ident!("export_{}", fn_name); + let wasm_export_fn_name = format!("{}.{}", contract_name.value(), name.value()); + + // Validate the contract name independently to ensure that it doesn't contain a + // '.' as this causes a subtle error when receive names are being split. + let contract_name_validation = + ContractName::is_valid_contract_name(&format!("init_{}", contract_name.value())) + .map_err(|e| syn::Error::new(contract_name.span(), e)); + + let receive_name_validation = ReceiveName::is_valid_receive_name(&wasm_export_fn_name) + .map_err(|e| syn::Error::new(name.span(), e)); + + match (contract_name_validation, receive_name_validation) { + (Err(mut e0), Err(e1)) => { + e0.combine(e1); + return Err(e0); + } + (Err(e), _) => return Err(e), + (_, Err(e)) => return Err(e), + _ => (), + }; + + let amount_ident = format_ident!("amount"); + + // Accumulate a list of required arguments, if the function contains a + // different number of arguments, than elements in this vector, then the + // strings are displayed as the expected arguments. + let mut required_args = vec!["ctx: &impl HasReceiveContext"]; + + let (setup_fn_optional_args, fn_optional_args) = + contract_function_optional_args_tokens(&attrs, &amount_ident, &mut required_args); + + let mut out = if contains_attribute(&attrs, "low_level") { + required_args.push("state: &mut ContractState"); + quote! { + #[export_name = #wasm_export_fn_name] + pub extern "C" fn #rust_export_fn_name(#amount_ident: hacspec_concordium::Amount) -> i32 { + use hacspec_concordium::{SeekFrom, ContractState, Logger, ReceiveContextExtern, ExternContext}; + #setup_fn_optional_args + let ctx = ExternContext::::open(()); + let mut state = ContractState::open(()); + let res: Result = #fn_name(&ctx, #(#fn_optional_args, )* &mut state); + match res { + Ok(act) => { + act.tag() as i32 + } + Err(reject) => { + let code = Reject::from(reject).error_code.get(); + if code < 0 { + code + } else { + trap() // precondition violation + } + } + } + } + } + } else { + required_args.push("state: &mut MyState"); + + quote! { + #[export_name = #wasm_export_fn_name] + pub extern "C" fn #rust_export_fn_name(#amount_ident: hacspec_concordium::Amount) -> i32 { + use hacspec_concordium::{SeekFrom, ContractState, Logger, trap}; + #setup_fn_optional_args + let ctx = ExternContext::::open(()); + let mut state_bytes = ContractState::open(()); + if let Ok(mut state) = (&mut state_bytes).get() { + let res: Result = #fn_name(&ctx, #(#fn_optional_args, )* &mut state); + match res { + Ok(act) => { + let res = state_bytes + .seek(SeekFrom::Start(0)) + .and_then(|_| state.serial(&mut state_bytes)); + if res.is_err() { + trap() // could not serialize state. + } else { + act.tag() as i32 + } + } + Err(reject) => { + let code = Reject::from(reject).error_code.get(); + if code < 0 { + code + } else { + trap() // precondition violation + } + } + } + } else { + trap() // Could not fully read state. + } + } + } + }; + + let arg_count = ast.sig.inputs.len(); + if arg_count != required_args.len() { + return Err(syn::Error::new( + ast.sig.inputs.span(), + format!( + "Incorrect number of function arguments, the expected arguments are ({}) ", + required_args.join(", ") + ), + )); + } + + // Embed schema if 'parameter' attribute is set + let parameter_option = get_attribute_value(attrs.iter(), "parameter")?.map(|a| a.value()); + out.extend(contract_function_schema_tokens( + parameter_option, + rust_export_fn_name, + wasm_export_fn_name, + )); + // add the original function to the output as well. + ast.to_tokens(&mut out); + Ok(out.into()) +} + +/// Generate tokens for some of the optional arguments, based on the attributes. +/// Returns a pair, where the first entry is tokens for setting up the arguments +/// and the second entry is a Vec of the argument names as tokens. +/// +/// It also mutates a vector of required arguments with the expected type +/// signature of each. +fn contract_function_optional_args_tokens<'a, I: Copy + IntoIterator>( + attrs: I, + amount_ident: &syn::Ident, + required_args: &mut Vec<&str>, +) -> (proc_macro2::TokenStream, Vec) { + let mut setup_fn_args = proc_macro2::TokenStream::new(); + let mut fn_args = vec![]; + if contains_attribute(attrs, "payable") { + required_args.push("amount: Amount"); + fn_args.push(quote!(#amount_ident)); + } else { + setup_fn_args.extend(quote! { + if #amount_ident.micro_ccd != 0 { + return -1; + } + }); + }; + + if contains_attribute(attrs, "enable_logger") { + required_args.push("logger: &mut impl HasLogger"); + let logger_ident = format_ident!("logger"); + setup_fn_args.extend(quote!(let mut #logger_ident = hacspec_concordium::Logger::init();)); + fn_args.push(quote!(&mut #logger_ident)); + } + (setup_fn_args, fn_args) +} + +#[cfg(feature = "build-schema")] +fn contract_function_schema_tokens( + parameter_option: Option, + rust_name: syn::Ident, + wasm_name: String, +) -> proc_macro2::TokenStream { + match parameter_option { + Some(parameter_ty) => { + let parameter_ident = syn::Ident::new(¶meter_ty, Span::call_site()); + let schema_name = format!("concordium_schema_function_{}", wasm_name); + let schema_ident = format_ident!("concordium_schema_function_{}", rust_name); + quote! { + #[export_name = #schema_name] + pub extern "C" fn #schema_ident() -> *mut u8 { + let schema = <#parameter_ident as schema::SchemaType>::get_type(); + let schema_bytes = hacspec_concordium::to_bytes(&schema); + hacspec_concordium::put_in_memory(&schema_bytes) + } + } + } + None => proc_macro2::TokenStream::new(), + } +} + +#[cfg(not(feature = "build-schema"))] +fn contract_function_schema_tokens( + _parameter_option: Option, + _rust_name: syn::Ident, + _wasm_name: String, +) -> proc_macro2::TokenStream { + proc_macro2::TokenStream::new() +} + +/// Derive the Deserial trait. See the documentation of `derive(Serial)` for +/// details and limitations. +/// +/// In addition to the attributes supported by `derive(Serial)`, this derivation +/// macro supports the `ensure_ordered` attribute. If applied to a field the +/// of type `BTreeMap` or `BTreeSet` deserialization will additionally ensure +/// that the keys are in strictly increasing order. By default deserialization +/// only ensures uniqueness. +/// +/// # Example +/// ``` ignore +/// #[derive(Deserial)] +/// struct Foo { +/// #[concordium(size_length = 1, ensure_ordered)] +/// bar: BTreeSet, +/// } +/// ``` +#[proc_macro_derive(Deserial, attributes(concordium))] +pub fn deserial_derive(input: TokenStream) -> TokenStream { + let ast = parse_macro_input!(input); + unwrap_or_report(impl_deserial(&ast)) +} + +/// The prefix used in field attributes: `#[concordium(attr = "something")]` +const CONCORDIUM_FIELD_ATTRIBUTE: &str = "concordium"; + +/// A list of valid concordium field attributes +const VALID_CONCORDIUM_FIELD_ATTRIBUTES: [&str; 3] = ["size_length", "ensure_ordered", "rename"]; + +fn get_concordium_field_attributes(attributes: &[syn::Attribute]) -> syn::Result> { + attributes + .iter() + // Keep only concordium attributes + .flat_map(|attr| match attr.parse_meta() { + Ok(syn::Meta::List(list)) if list.path.is_ident(CONCORDIUM_FIELD_ATTRIBUTE) => { + list.nested + } + _ => syn::punctuated::Punctuated::new(), + }) + // Ensure only valid attributes and unwrap NestedMeta + .map(|nested| match nested { + syn::NestedMeta::Meta(meta) => { + let path = meta.path(); + if VALID_CONCORDIUM_FIELD_ATTRIBUTES.iter().any(|&attr| path.is_ident(attr)) { + Ok(meta) + } else { + Err(syn::Error::new(meta.span(), + format!("The attribute '{}' is not supported as a concordium field attribute.", + path.to_token_stream()) + )) + } + } + lit => Err(syn::Error::new(lit.span(), "Literals are not supported in a concordium field attribute.")), + }) + .collect() +} + +fn find_field_attribute_value( + attributes: &[syn::Attribute], + target_attr: &str, +) -> syn::Result> { + let target_attr = format_ident!("{}", target_attr); + let attr_values: Vec<_> = get_concordium_field_attributes(attributes)? + .into_iter() + .filter_map(|nested_meta| match nested_meta { + syn::Meta::NameValue(value) if value.path.is_ident(&target_attr) => Some(value.lit), + _ => None, + }) + .collect(); + if attr_values.is_empty() { + return Ok(None); + } + if attr_values.len() > 1 { + let mut init_error = syn::Error::new( + attr_values[1].span(), + format!("Attribute '{}' should only be specified once.", target_attr), + ); + for other in attr_values.iter().skip(2) { + init_error.combine(syn::Error::new( + other.span(), + format!("Attribute '{}' should only be specified once.", target_attr), + )) + } + Err(init_error) + } else { + Ok(Some(attr_values[0].clone())) + } +} + +fn find_length_attribute(attributes: &[syn::Attribute]) -> syn::Result> { + let value = match find_field_attribute_value(attributes, "size_length")? { + Some(v) => v, + None => return Ok(None), + }; + + // Save the span to be used in errors. + let value_span = value.span(); + + let value = match value { + syn::Lit::Int(int) => int, + _ => return Err(syn::Error::new(value_span, "Length attribute value must be an integer.")), + }; + let value = match value.base10_parse() { + Ok(v) => v, + _ => { + return Err(syn::Error::new( + value_span, + "Length attribute value must be a base 10 integer.", + )) + } + }; + match value { + 1 | 2 | 4 | 8 => Ok(Some(value)), + _ => Err(syn::Error::new(value_span, "Length info must be either 1, 2, 4, or 8.")), + } +} + +/// Find a 'rename' attribute and return its value and span. +/// Checks that the attribute is only defined once and that the value is a +/// string. +#[cfg(feature = "build-schema")] +fn find_rename_attribute(attributes: &[syn::Attribute]) -> syn::Result> { + let value = match find_field_attribute_value(attributes, "rename")? { + Some(v) => v, + None => return Ok(None), + }; + + match value { + syn::Lit::Str(value) => Ok(Some((value.value(), value.span()))), + _ => Err(syn::Error::new(value.span(), "Rename attribute value must be a string.")), + } +} + +/// Check for name collisions by inserting the name in the HashMap. +/// On collisions it returns a combined error pointing to the previous and new +/// definition. +#[cfg(feature = "build-schema")] +fn check_for_name_collisions( + used_names: &mut HashMap, + new_name: &str, + new_span: Span, +) -> syn::Result<()> { + if let Some(used_span) = used_names.insert(String::from(new_name), new_span) { + let error_msg = format!("the name `{}` is defined multiple times", new_name); + let mut error_at_first_def = syn::Error::new(used_span, &error_msg); + let error_at_second_def = syn::Error::new(new_span, &error_msg); + + // Combine the errors to show both at once + error_at_first_def.combine(error_at_second_def); + + return Err(error_at_first_def); + } + Ok(()) +} + +fn impl_deserial_field( + f: &syn::Field, + ident: &syn::Ident, + source: &syn::Ident, +) -> syn::Result { + let concordium_attributes = get_concordium_field_attributes(&f.attrs)?; + let ensure_ordered = contains_attribute(&concordium_attributes, "ensure_ordered"); + let size_length = find_length_attribute(&f.attrs)?; + let has_ctx = ensure_ordered || size_length.is_some(); + let ty = &f.ty; + if has_ctx { + // Default size length is u32, i.e. 4 bytes. + let l = format_ident!("U{}", 8 * size_length.unwrap_or(4)); + Ok(quote! { + let #ident = <#ty as hacspec_concordium::DeserialCtx>::deserial_ctx(hacspec_concordium::schema::SizeLength::#l, #ensure_ordered, #source)?; + }) + } else { + Ok(quote! { + let #ident = <#ty as Deserial>::deserial(#source)?; + }) + } +} + +fn impl_deserial(ast: &syn::DeriveInput) -> syn::Result { + let data_name = &ast.ident; + + let span = ast.span(); + + let read_ident = format_ident!("__R", span = span); + + let (impl_generics, ty_generics, where_clauses) = ast.generics.split_for_impl(); + + let source_ident = Ident::new("source", Span::call_site()); + + let body_tokens = match ast.data { + syn::Data::Struct(ref data) => { + let mut names = proc_macro2::TokenStream::new(); + let mut field_tokens = proc_macro2::TokenStream::new(); + let return_tokens = match data.fields { + syn::Fields::Named(_) => { + for field in data.fields.iter() { + let field_ident = field.ident.clone().unwrap(); // safe since named fields. + field_tokens.extend(impl_deserial_field( + field, + &field_ident, + &source_ident, + )); + names.extend(quote!(#field_ident,)) + } + quote!(Ok(#data_name{#names})) + } + syn::Fields::Unnamed(_) => { + for (i, f) in data.fields.iter().enumerate() { + let field_ident = format_ident!("x_{}", i); + field_tokens.extend(impl_deserial_field(f, &field_ident, &source_ident)); + names.extend(quote!(#field_ident,)) + } + quote!(Ok(#data_name(#names))) + } + _ => quote!(Ok(#data_name{})), + }; + quote! { + #field_tokens + #return_tokens + } + } + syn::Data::Enum(ref data) => { + let mut matches_tokens = proc_macro2::TokenStream::new(); + let source = Ident::new("source", Span::call_site()); + let size = if data.variants.len() <= 256 { + format_ident!("u8") + } else if data.variants.len() <= 256 * 256 { + format_ident!("u16") + } else { + return Err(syn::Error::new( + ast.span(), + "[derive(Deserial)]: Too many variants. Maximum 65536 are supported.", + )); + }; + for (i, variant) in data.variants.iter().enumerate() { + let (field_names, pattern) = match variant.fields { + syn::Fields::Named(_) => { + let field_names: Vec<_> = variant + .fields + .iter() + .map(|field| field.ident.clone().unwrap()) + .collect(); + (field_names.clone(), quote! { {#(#field_names),*} }) + } + syn::Fields::Unnamed(_) => { + let field_names: Vec<_> = variant + .fields + .iter() + .enumerate() + .map(|(i, _)| format_ident!("x_{}", i)) + .collect(); + (field_names.clone(), quote! { ( #(#field_names),* ) }) + } + syn::Fields::Unit => (Vec::new(), proc_macro2::TokenStream::new()), + }; + + let field_tokens: proc_macro2::TokenStream = field_names + .iter() + .zip(variant.fields.iter()) + .map(|(name, field)| impl_deserial_field(field, name, &source)) + .collect::>()?; + let idx_lit = syn::LitInt::new(i.to_string().as_str(), Span::call_site()); + let variant_ident = &variant.ident; + matches_tokens.extend(quote! { + #idx_lit => { + #field_tokens + Ok(#data_name::#variant_ident#pattern) + }, + }) + } + quote! { + let idx = #size::deserial(#source)?; + match idx { + #matches_tokens + _ => Err(Default::default()) + } + } + } + _ => unimplemented!("#[derive(Deserial)] is not implemented for union."), + }; + let gen = quote! { + #[automatically_derived] + impl #impl_generics Deserial for #data_name #ty_generics #where_clauses { + fn deserial<#read_ident: Read>(#source_ident: &mut #read_ident) -> ParseResult { + #body_tokens + } + } + }; + Ok(gen.into()) +} + +/// Derive the Serial trait for the type. +/// +/// If the type is a struct all fields must implement the Serial trait. If the +/// type is an enum then all fields of each of the enums must implement the +/// Serial trait. +/// +/// +/// Collections (Vec, BTreeMap, BTreeSet) and strings (String, str) are by +/// default serialized by prepending the number of elements as 4 bytes +/// little-endian. If this is too much or too little, fields of the above types +/// can be annotated with `size_length`. +/// +/// The value of this field is the number of bytes that will be used for +/// encoding the number of elements. Supported values are 1, 2, 4, 8. +/// +/// For BTreeMap and BTreeSet the serialize method will serialize values in +/// increasing order of keys. +/// +/// Fields of structs are serialized in the order they appear in the code. +/// +/// Enums can have no more than 65536 variants. They are serialized by using a +/// tag to indicate the variant, enumerating them in the order they are written +/// in source code. If the number of variants is less than or equal 256 then a +/// single byte is used to encode it. Otherwise two bytes are used for the tag, +/// encoded in little endian. +/// +/// # Example +/// ```ignore +/// #[derive(Serial)] +/// struct Foo { +/// #[concordium(size_length = 1)] +/// bar: BTreeSet, +/// } +/// ``` +#[proc_macro_derive(Serial, attributes(concordium))] +pub fn serial_derive(input: TokenStream) -> TokenStream { + let ast = parse_macro_input!(input); + unwrap_or_report(impl_serial(&ast)) +} + +fn impl_serial_field( + field: &syn::Field, + ident: &proc_macro2::TokenStream, + out: &syn::Ident, +) -> syn::Result { + if let Some(size_length) = find_length_attribute(&field.attrs)? { + let l = format_ident!("U{}", 8 * size_length); + Ok(quote!({ + use hacspec_concordium::SerialCtx; + #ident.serial_ctx(hacspec_concordium::schema::SizeLength::#l, #out)?; + })) + } else { + Ok(quote! { + #ident.serial(#out)?; + }) + } +} + +fn impl_serial(ast: &syn::DeriveInput) -> syn::Result { + let data_name = &ast.ident; + + let span = ast.span(); + + let write_ident = format_ident!("W", span = span); + + let (impl_generics, ty_generics, where_clauses) = ast.generics.split_for_impl(); + + let out_ident = format_ident!("out"); + + let body = match ast.data { + syn::Data::Struct(ref data) => { + let fields_tokens = match data.fields { + syn::Fields::Named(_) => { + data.fields + .iter() + .map(|field| { + let field_ident = field.ident.clone().unwrap(); // safe since named fields. + let field_ident = quote!(self.#field_ident); + impl_serial_field(field, &field_ident, &out_ident) + }) + .collect::>()? + } + syn::Fields::Unnamed(_) => data + .fields + .iter() + .enumerate() + .map(|(i, field)| { + let i = syn::LitInt::new(i.to_string().as_str(), Span::call_site()); + let field_ident = quote!(self.#i); + impl_serial_field(field, &field_ident, &out_ident) + }) + .collect::>()?, + syn::Fields::Unit => proc_macro2::TokenStream::new(), + }; + quote! { + #fields_tokens + Ok(()) + } + } + syn::Data::Enum(ref data) => { + let mut matches_tokens = proc_macro2::TokenStream::new(); + + let size = if data.variants.len() <= 256 { + format_ident!("u8") + } else if data.variants.len() <= 256 * 256 { + format_ident!("u16") + } else { + unimplemented!( + "[derive(Serial)]: Enums with more than 65536 variants are not supported." + ); + }; + + for (i, variant) in data.variants.iter().enumerate() { + let (field_names, pattern) = match variant.fields { + syn::Fields::Named(_) => { + let field_names: Vec<_> = variant + .fields + .iter() + .map(|field| field.ident.clone().unwrap()) + .collect(); + (field_names.clone(), quote! { {#(#field_names),*} }) + } + syn::Fields::Unnamed(_) => { + let field_names: Vec<_> = variant + .fields + .iter() + .enumerate() + .map(|(i, _)| format_ident!("x_{}", i)) + .collect(); + (field_names.clone(), quote! { (#(#field_names),*) }) + } + syn::Fields::Unit => (Vec::new(), proc_macro2::TokenStream::new()), + }; + let field_tokens: proc_macro2::TokenStream = field_names + .iter() + .zip(variant.fields.iter()) + .map(|(name, field)| impl_serial_field(field, "e!(#name), &out_ident)) + .collect::>()?; + + let idx_lit = + syn::LitInt::new(format!("{}{}", i, size).as_str(), Span::call_site()); + let variant_ident = &variant.ident; + + matches_tokens.extend(quote! { + #data_name::#variant_ident#pattern => { + #idx_lit.serial(#out_ident)?; + #field_tokens + }, + }) + } + quote! { + match self { + #matches_tokens + } + Ok(()) + } + } + _ => unimplemented!("#[derive(Serial)] is not implemented for union."), + }; + + let gen = quote! { + #[automatically_derived] + impl #impl_generics Serial for #data_name #ty_generics #where_clauses { + fn serial<#write_ident: Write>(&self, #out_ident: &mut #write_ident) -> Result<(), #write_ident::Err> { + #body + } + } + }; + Ok(gen.into()) +} + +/// A helper macro to derive both the Serial and Deserial traits. +/// `[derive(Serialize)]` is equivalent to `[derive(Serial,Deserial)]`, see +/// documentation of the latter two for details and options. +#[proc_macro_derive(Serialize, attributes(concordium))] +pub fn serialize_derive(input: TokenStream) -> TokenStream { + unwrap_or_report(serialize_derive_worker(input)) +} + +fn serialize_derive_worker(input: TokenStream) -> syn::Result { + let ast = syn::parse(input)?; + let mut tokens = impl_deserial(&ast)?; + tokens.extend(impl_serial(&ast)?); + Ok(tokens) +} + +/// Marks a type as the contract state. Currently only used for generating the +/// schema of the contract state. If the feature `build-schema` is not enabled +/// this has no effect. +/// +/// +/// # Example +/// ```ignore +/// #[contract_state(contract = "my_contract")] +/// #[derive(SchemaType)] +/// struct MyContractState { +/// ... +/// } +/// ``` +#[proc_macro_attribute] +pub fn contract_state(attr: TokenStream, item: TokenStream) -> TokenStream { + unwrap_or_report(contract_state_worker(attr, item)) +} + +#[cfg(feature = "build-schema")] +fn contract_state_worker(attr: TokenStream, item: TokenStream) -> syn::Result { + let mut out = proc_macro2::TokenStream::new(); + + let data_ident = if let Ok(ast) = syn::parse::(item.clone()) { + ast.to_tokens(&mut out); + ast.ident + } else if let Ok(ast) = syn::parse::(item.clone()) { + ast.to_tokens(&mut out); + ast.ident + } else if let Ok(ast) = syn::parse::(item.clone()) { + ast.to_tokens(&mut out); + ast.ident + } else { + return Err(syn::Error::new_spanned( + proc_macro2::TokenStream::from(item), + "#[contract_state] only supports structs, enums and type aliases.", + )); + }; + + let attrs = Punctuated::::parse_terminated.parse(attr)?; + + let contract_name = get_attribute_value(attrs.iter(), "contract")?.ok_or_else(|| { + syn::Error::new( + Span::call_site(), + "A name of the contract must be provided, using the 'contract' attribute.\n\nFor \ + example #[contract_state(contract = \"my-contract\")].", + ) + })?; + + let wasm_schema_name = format!("concordium_schema_state_{}", contract_name.value()); + let rust_schema_name = format_ident!("concordium_schema_state_{}", data_ident); + + let generate_schema_tokens = quote! { + #[allow(non_snake_case)] + #[export_name = #wasm_schema_name] + pub extern "C" fn #rust_schema_name() -> *mut u8 { + let schema = <#data_ident as hacspec_concordium::schema::SchemaType>::get_type(); + let schema_bytes = hacspec_concordium::to_bytes(&schema); + hacspec_concordium::put_in_memory(&schema_bytes) + } + }; + generate_schema_tokens.to_tokens(&mut out); + Ok(out.into()) +} + +#[cfg(not(feature = "build-schema"))] +fn contract_state_worker(_attr: TokenStream, item: TokenStream) -> syn::Result { + Ok(item) +} + +/// Derive the `SchemaType` trait for a type. +/// If the feature `build-schema` is not enabled this is a no-op, i.e., it does +/// not produce any code. +#[proc_macro_derive(SchemaType, attributes(size_length))] +pub fn schema_type_derive(input: TokenStream) -> TokenStream { + unwrap_or_report(schema_type_derive_worker(input)) +} + +#[cfg(feature = "build-schema")] +fn schema_type_derive_worker(input: TokenStream) -> syn::Result { + let ast: syn::DeriveInput = syn::parse(input)?; + + let data_name = &ast.ident; + + let body = match ast.data { + syn::Data::Struct(ref data) => { + let fields_tokens = schema_type_fields(&data.fields)?; + quote! { + hacspec_concordium::schema::Type::Struct(#fields_tokens) + } + } + syn::Data::Enum(ref data) => { + let mut used_variant_names = HashMap::new(); + let variant_tokens: Vec<_> = data + .variants + .iter() + .map(|variant| { + // Handle the 'rename' attribute. + let (variant_name, variant_span) = match find_rename_attribute(&variant.attrs)? + { + Some(name_and_span) => name_and_span, + None => (variant.ident.to_string(), variant.ident.span()), + }; + check_for_name_collisions( + &mut used_variant_names, + &variant_name, + variant_span, + )?; + + let fields_tokens = schema_type_fields(&variant.fields)?; + Ok(quote! { + (hacspec_concordium::String::from(#variant_name), #fields_tokens) + }) + }) + .collect::>()?; + quote! { + hacspec_concordium::schema::Type::Enum(hacspec_concordium::Vec::from([ #(#variant_tokens),* ])) + } + } + _ => syn::Error::new(ast.span(), "Union is not supported").to_compile_error(), + }; + + let out = quote! { + #[automatically_derived] + impl hacspec_concordium::schema::SchemaType for #data_name { + fn get_type() -> hacspec_concordium::schema::Type { + #body + } + } + }; + Ok(out.into()) +} + +#[cfg(not(feature = "build-schema"))] +fn schema_type_derive_worker(_input: TokenStream) -> syn::Result { + Ok(TokenStream::new()) +} + +#[cfg(feature = "build-schema")] +fn schema_type_field_type(field: &syn::Field) -> syn::Result { + let field_type = &field.ty; + if let Some(l) = find_length_attribute(&field.attrs)? { + let size = format_ident!("U{}", 8 * l); + Ok(quote! { + <#field_type as hacspec_concordium::schema::SchemaType>::get_type().set_size_length(hacspec_concordium::schema::SizeLength::#size) + }) + } else { + Ok(quote! { + <#field_type as hacspec_concordium::schema::SchemaType>::get_type() + }) + } +} + +#[cfg(feature = "build-schema")] +fn schema_type_fields(fields: &syn::Fields) -> syn::Result { + match fields { + syn::Fields::Named(_) => { + let mut used_field_names = HashMap::new(); + let fields_tokens: Vec<_> = fields + .iter() + .map(|field| { + // Handle the 'rename' attribute. + let (field_name, field_span) = match find_rename_attribute(&field.attrs)? { + Some(name_and_span) => name_and_span, + None => (field.ident.clone().unwrap().to_string(), field.ident.span()), // safe since named fields. + }; + check_for_name_collisions(&mut used_field_names, &field_name, field_span)?; + + let field_schema_type = schema_type_field_type(&field)?; + Ok(quote! { + (hacspec_concordium::String::from(#field_name), #field_schema_type) + }) + }) + .collect::>()?; + Ok( + quote! { hacspec_concordium::schema::Fields::Named(hacspec_concordium::Vec::from([ #(#fields_tokens),* ])) }, + ) + } + syn::Fields::Unnamed(_) => { + let fields_tokens: Vec<_> = + fields.iter().map(schema_type_field_type).collect::>()?; + Ok(quote! { hacspec_concordium::schema::Fields::Unnamed([ #(#fields_tokens),* ].to_vec()) }) + } + syn::Fields::Unit => Ok(quote! { hacspec_concordium::schema::Fields::None }), + } +} + +/// We reserve a number of error codes for custom errors, such as ParseError, +/// that are provided by concordium-std. These reserved error codes can have +/// indices i32::MIN, i32::MIN + 1, ..., RESERVED_ERROR_CODES +const RESERVED_ERROR_CODES: i32 = i32::MIN + 100; + +/// Derive the conversion of enums that represent error types into the Reject +/// struct which can be used as the error type of init and receive functions. +/// Creating custom enums for error types can provide meaningful error messages +/// to the user of the smart contract. +/// +/// Note that at the moment, we can only derive fieldless enums. +/// +/// The conversion will map the first variant to error code -1, second to -2, +/// etc. +/// +/// ### Example +/// ```ignore +/// #[derive(Clone, Copy, Reject)] +/// enum MyError { +/// IllegalState, // receives error code -1 +/// WrongSender, // receives error code -2 +/// // TimeExpired(time: Timestamp), /* currently not supported */ +/// ... +/// } +/// ``` +/// ```ignore +/// #[receive(contract = "my_contract", name = "some_receive")] +/// fn receive(ctx: &impl HasReceiveContext, state: &mut MyState) +/// -> Result {...} +/// ``` +#[proc_macro_derive(Reject, attributes(from))] +pub fn reject_derive(input: TokenStream) -> TokenStream { + unwrap_or_report(reject_derive_worker(input)) +} + +fn reject_derive_worker(input: TokenStream) -> syn::Result { + let ast: syn::DeriveInput = syn::parse(input)?; + let enum_data = match &ast.data { + syn::Data::Enum(data) => Ok(data), + _ => Err(syn::Error::new(ast.span(), "Reject can only be derived for enums.")), + }?; + let enum_ident = &ast.ident; + + // Ensure that the number of enum variants fits into the number of error codes + // we can generate. + let too_many_variants = format!( + "Error enum {} cannot have more than {} variants.", + enum_ident, + RESERVED_ERROR_CODES.neg() + ); + match i32::try_from(enum_data.variants.len()) { + Ok(n) if n <= RESERVED_ERROR_CODES.neg() => (), + _ => { + return Err(syn::Error::new(ast.span(), &too_many_variants)); + } + }; + + let variant_error_conversions = generate_variant_error_conversions(&enum_data, &enum_ident)?; + + let gen = quote! { + /// The from implementation maps the first variant to -1, second to -2, etc. + /// NB: This differs from the cast `variant as i32` since we cannot easily modify + /// the variant tags in the derive macro itself. + #[automatically_derived] + impl From<#enum_ident> for Reject { + #[inline(always)] + fn from(e: #enum_ident) -> Self { + Reject { error_code: unsafe { hacspec_concordium::num::NonZeroI32::new_unchecked(-(e as i32) - 1) } } + } + } + + #(#variant_error_conversions)* + }; + Ok(gen.into()) +} + +/// Generate error conversions for enum variants e.g. for converting +/// `ParseError` to `MyParseErrorWrapper` in +/// +/// ```ignore +/// enum MyErrorType { +/// #[from(ParseError)] +/// MyParseErrorWrapper, +/// ... +/// } +/// ``` +fn generate_variant_error_conversions( + enum_data: &DataEnum, + enum_name: &syn::Ident, +) -> syn::Result> { + Ok(enum_data + .variants + .iter() + .map(|variant| { + // in the future we might incorporate explicit discriminants, + // but the general case of this requires evaluating constant expressions, + // which is not easily supported at the moment. + if let Some((_, discriminant)) = variant.discriminant.as_ref() { + return Err(syn::Error::new( + discriminant.span(), + "Explicit discriminants are not yet supported.", + )); + } + let variant_attributes = variant.attrs.iter(); + variant_attributes + .map(move |attr| { + parse_attr_and_gen_error_conversions(attr, enum_name, &variant.ident) + }) + .collect::>>() + }) + .collect::>>()? + .into_iter() + .flatten() + .flatten() + .collect()) +} + +/// Generate error conversion for a given enum variant. +fn parse_attr_and_gen_error_conversions( + attr: &syn::Attribute, + enum_name: &syn::Ident, + variant_name: &syn::Ident, +) -> syn::Result> { + let wrong_from_usage = |x: &dyn Spanned| { + syn::Error::new( + x.span(), + "The `from` attribute expects a list of error types, e.g.: #[from(ParseError)].", + ) + }; + match attr.parse_meta() { + Ok(syn::Meta::List(list)) if list.path.is_ident("from") => { + let mut from_error_names = vec![]; + for nested in list.nested.iter() { + // check that all items in the list are paths + match nested { + syn::NestedMeta::Meta(meta) => match meta { + Meta::Path(from_error) => { + let ident = from_error + .get_ident() + .ok_or_else(|| wrong_from_usage(from_error))?; + from_error_names.push(ident); + } + other => return Err(wrong_from_usage(&other)), + }, + syn::NestedMeta::Lit(l) => return Err(wrong_from_usage(&l)), + } + } + Ok(from_error_token_stream(&from_error_names, &enum_name, variant_name).collect()) + } + Ok(syn::Meta::NameValue(mnv)) if mnv.path.is_ident("from") => Err(wrong_from_usage(&mnv)), + _ => Ok(vec![]), + } +} + +/// Generating the conversion code a la +/// ```ignore +/// impl From for MyErrorType { +/// fn from(x: ParseError) -> Self { +/// MyError::MyParseErrorWrapper +/// } +/// } +/// ``` +fn from_error_token_stream<'a>( + paths: &'a [&'a syn::Ident], + enum_name: &'a syn::Ident, + variant_name: &'a syn::Ident, +) -> impl Iterator + 'a { + paths.iter().map(move |from_error| { + quote! { + impl From<#from_error> for #enum_name { + #[inline] + fn from(fe: #from_error) -> Self { + #enum_name::#variant_name + } + }} + }) +} + +#[proc_macro_attribute] +/// Derive the appropriate export for an annotated test function, when feature +/// "wasm-test" is enabled, otherwise behaves like `#[test]`. +pub fn concordium_test(attr: TokenStream, item: TokenStream) -> TokenStream { + unwrap_or_report(concordium_test_worker(attr, item)) +} + +/// Derive the appropriate export for an annotated test function, when feature +/// "wasm-test" is enabled, otherwise behaves like `#[test]`. +#[cfg(feature = "wasm-test")] +fn concordium_test_worker(_attr: TokenStream, item: TokenStream) -> syn::Result { + let test_fn_ast: syn::ItemFn = + attach_error(syn::parse(item), "#[concordium_test] can only be applied to functions.")?; + + let test_fn_name = &test_fn_ast.sig.ident; + let rust_export_fn_name = format_ident!("concordium_test_{}", test_fn_name); + let wasm_export_fn_name = format!("concordium_test {}", test_fn_name); + + let test_fn = quote! { + // Setup test function + #test_fn_ast + + // Export test function in wasm + #[export_name = #wasm_export_fn_name] + pub extern "C" fn #rust_export_fn_name() { + #test_fn_name() + } + }; + Ok(test_fn.into()) +} + +/// Derive the appropriate export for an annotated test function, when feature +/// "wasm-test" is enabled, otherwise behaves like `#[test]`. +#[cfg(not(feature = "wasm-test"))] +fn concordium_test_worker(_attr: TokenStream, item: TokenStream) -> syn::Result { + let test_fn_ast: syn::ItemFn = + attach_error(syn::parse(item), "#[concordium_test] can only be applied to functions.")?; + + let test_fn = quote! { + #[test] + #test_fn_ast + }; + Ok(test_fn.into()) +} + +/// Sets the cfg for testing targeting either Wasm and native. +#[cfg(feature = "wasm-test")] +#[proc_macro_attribute] +pub fn concordium_cfg_test(_attr: TokenStream, item: TokenStream) -> TokenStream { item } + +/// Sets the cfg for testing targeting either Wasm and native. +#[cfg(not(feature = "wasm-test"))] +#[proc_macro_attribute] +pub fn concordium_cfg_test(_attr: TokenStream, item: TokenStream) -> TokenStream { + let item = proc_macro2::TokenStream::from(item); + let out = quote! { + #[cfg(test)] + #item + }; + out.into() +} diff --git a/concordium/Cargo.toml b/concordium/Cargo.toml new file mode 100644 index 0000000..bd98bca --- /dev/null +++ b/concordium/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "hacspec-concordium" +version = "0.1.0" +authors = [""] +edition = "2018" + +[lib] +path = "src/concordium.rs" + +[dependencies] +hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } +# hacspec-attributes = { path = "../../utils/attributes", version = "0.1.0-beta.1" , features = ["print_attributes", "hacspec_unsafe"] } # , features = ["hacspec_unsafe"] , , optional = true +creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "7763b3ae77205fba83182b9a6c3e69ad0b12fec7" } +concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850", version = "=2.0.0", default-features = false } +hacspec-concordium-derive = { path = "../concordium-derive" } + +# Reduce code size, at the cost of performance in allocation heavy-code. +wee_alloc="0.4.5" + +# [features] +# use_attributes = ["hacspec-attributes/print_attributes", "hacspec-attributes/hacspec_unsafe"] + +[dev-dependencies] +# hacspec-dev = { path = "../../utils/dev" } +criterion = "0.3" +rand = "0.8" +quickcheck = "1" +quickcheck_macros = "1" diff --git a/concordium/src/concordium.rs b/concordium/src/concordium.rs new file mode 100644 index 0000000..16d2265 --- /dev/null +++ b/concordium/src/concordium.rs @@ -0,0 +1,139 @@ +#![cfg_attr( + not(feature = "std"), + no_std, + feature(alloc_error_handler, core_intrinsics) +)] + +#[cfg(not(feature = "hacspec"))] +#[cfg(not(feature = "std"))] +pub extern crate alloc; + +// TODO: +// #[cfg(not(feature = "hacspec"))] +// #[cfg(not(feature = "std"))] +// #[alloc_error_handler] +// fn on_oom(_layout: alloc::alloc::Layout) -> ! { +// #[cfg(target_arch = "wasm32")] +// unsafe { +// core::arch::wasm32::unreachable() +// } +// #[cfg(not(target_arch = "wasm32"))] +// loop {} +// } + +/// Terminate execution immediately without panicking. +/// When the `std` feature is enabled this is just [std::process::abort](https://doc.rust-lang.org/std/process/fn.abort.html). +/// When `std` is not present and the target architecture is `wasm32` this will +/// simply emit the [unreachable](https://doc.rust-lang.org/core/arch/wasm32/fn.unreachable.html) instruction. +#[cfg(not(feature = "hacspec"))] +#[cfg(feature = "std")] +pub use std::process::abort as trap; +#[cfg(not(feature = "hacspec"))] +#[cfg(all(not(feature = "std"), target_arch = "wasm32"))] +#[inline(always)] +pub fn trap() -> ! { + unsafe { core::arch::wasm32::unreachable() } +} +#[cfg(not(feature = "hacspec"))] +#[cfg(all(not(feature = "std"), not(target_arch = "wasm32")))] +#[inline(always)] +pub fn trap() -> ! { + core::intrinsics::abort() +} + +// TODO: +// #[cfg(not(feature = "hacspec"))] +// #[cfg(not(feature = "std"))] +// #[panic_handler] +// fn abort_panic(_info: &core::panic::PanicInfo) -> ! { +// #[cfg(target_arch = "wasm32")] +// unsafe { +// core::arch::wasm32::unreachable() +// } +// #[cfg(not(target_arch = "wasm32"))] +// loop {} +// } + +// Provide some re-exports to make it easier to use the library. +// This should be expanded in the future. +/// Re-export. +#[cfg(not(feature = "hacspec"))] +#[cfg(not(feature = "std"))] +pub use alloc::{borrow::ToOwned, string, string::String, string::ToString, vec, vec::Vec}; +/// Re-export. +#[cfg(not(feature = "hacspec"))] +#[cfg(not(feature = "std"))] +pub use core::{convert, hash, marker, mem, num, result::*}; +#[cfg(not(feature = "hacspec"))] +#[cfg(feature = "std")] +pub(crate) use std::vec; + +/// Re-export. +#[cfg(not(feature = "hacspec"))] +#[cfg(feature = "std")] +pub use std::{convert, hash, marker, mem, num, string::String, vec::Vec}; + +#[cfg(not(feature = "hacspec"))] +#[cfg(not(feature = "std"))] +pub use alloc::collections; +#[cfg(not(feature = "hacspec"))] +#[cfg(feature = "std")] +pub use std::collections; + +pub mod constants; +mod concordium_prims; +mod concordium_types; +mod concordium_traits; +mod concordium_impls; + +pub mod test_infrastructure; + +use concordium_prims::*; // TODO: Does not re-export anything, nothing is public enough (removed pub) +pub use concordium_types::*; +pub use concordium_traits::*; +pub use concordium_impls::*; + +// TODO: Package into module +// #[cfg(not(feature = "hacspec"))] +// pub mod collections { +// #[cfg(not(feature = "std"))] +// use alloc::collections; +// #[cfg(feature = "std")] +// use std::collections; + +// pub use collections::*; +// pub use collections::{BTreeMap, BTreeSet}; +// pub use concordium_contracts_common::{HashMap, HashSet}; +// } + +#[cfg(not(feature = "hacspec"))] +extern crate concordium_contracts_common; +#[cfg(not(feature = "hacspec"))] +/// Chain constants that impose limits on various aspects of smart contract +/// execution. +pub use concordium_contracts_common::*; + +// TODO: Need derive +#[cfg(not(feature = "hacspec"))] +extern crate hacspec_concordium_derive; +#[cfg(not(feature = "hacspec"))] +pub use hacspec_concordium_derive::*; + +#[cfg(not(feature = "hacspec"))] +extern crate wee_alloc; +// Use `wee_alloc` as the global allocator to reduce code size. +#[cfg(not(feature = "hacspec"))] +#[global_allocator] +static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; + +#[cfg(not(feature = "hacspec"))] +extern crate hacspec_lib; +// pub use hacspec_lib::*; + +// #[cfg(feature = "hacspec")] +// use hacspec_attributes::*; + +#[cfg(not(feature = "hacspec"))] +extern crate creusot_contracts; +#[cfg(not(feature = "hacspec"))] +use creusot_contracts::*; // {ensures, trusted}; // requires, diff --git a/concordium/src/concordium_impls.rs b/concordium/src/concordium_impls.rs new file mode 100644 index 0000000..feeed53 --- /dev/null +++ b/concordium/src/concordium_impls.rs @@ -0,0 +1,1048 @@ +#[cfg(not(feature = "hacspec"))] +use crate::{ + // collections::{BTreeMap, BTreeSet}, + convert::{self}, // , TryFrom, TryInto + // hash::Hash, + num::NonZeroI32, + trap, + vec::Vec, + // String, + * +}; + +#[cfg(not(feature = "hacspec"))] +extern crate hacspec_lib; + +use hacspec_lib::*; + +#[cfg(not(feature = "hacspec"))] +use hacspec_lib::Seq; // TODO: fix name collision + +use concordium_prims::*; +use concordium_types::*; +use concordium_traits::*; + +pub type RejectHacspec = i32; + +pub fn reject_impl_deafult() -> RejectHacspec { + -2_147_483_648i32 // i32::MIN +} + +pub fn new_reject_impl(x: i32) -> Option:: { // Option + // TODO: fix 'identifier is not a constant' error (Seems to be fixed by some import?) + if x < 0i32 { + Option::::Some(x) + } else { + Option::::None + } +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +#[ensures(!(result == 0i32))] +pub fn non_zero_i32(v : i32) -> NonZeroI32 { + unsafe { NonZeroI32::new_unchecked(v) } +} + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_hacspec_to_rust_reject(hacspec_reject: RejectHacspec) -> Reject { + Reject { + error_code: non_zero_i32(hacspec_reject), + } +} + +#[ensures(!(result == 0i32))] // != +pub fn reject_impl_convert_from_unit() -> RejectHacspec { + -2_147_483_648i32 + 1i32 // i32::MIN +} + +#[ensures(!(result == 0i32))] // != +pub fn reject_impl_convert_from_parse_error() -> RejectHacspec { + -2_147_483_648i32 + 2i32 // i32::MIN +} + +#[cfg(not(feature = "hacspec"))] +impl convert::From<()> for Reject { + #[inline(always)] + fn from(_: ()) -> Self { + coerce_hacspec_to_rust_reject(reject_impl_convert_from_unit()) + } +} + +#[cfg(not(feature = "hacspec"))] +impl convert::From for Reject { + #[inline(always)] + fn from(_: ParseError) -> Self { + coerce_hacspec_to_rust_reject(reject_impl_convert_from_parse_error()) + } +} + +#[ensures(!(result == 0i32))] // != +pub fn reject_impl_from_log_error(le: LogError) -> RejectHacspec { + match le { + LogError::Full => -2_147_483_648i32 + 3i32, // i32::MIN + LogError::Malformed => -2_147_483_648i32 + 4i32, // i32::MIN + } +} + +#[cfg(not(feature = "hacspec"))] +/// Full is mapped to i32::MIN+3, Malformed is mapped to i32::MIN+4. +impl From for Reject { + #[inline(always)] + fn from(le: LogError) -> Self { + coerce_hacspec_to_rust_reject(reject_impl_from_log_error(le)) + } +} + +#[derive(Clone)] // , Debug, PartialEq, Eq +pub enum NewContractNameError { + NewContractNameErrorMissingInitPrefix, + NewContractNameErrorTooLong, + NewContractNameErrorContainsDot, + NewContractNameErrorInvalidCharacters, +} + +#[ensures(!(result == 0i32))] // != +pub fn reject_impl_from_new_contract_name_error(nre: NewContractNameError) -> RejectHacspec { + match nre { + NewContractNameError::NewContractNameErrorMissingInitPrefix => -2_147_483_648i32 + 5i32, // i32::MIN + NewContractNameError::NewContractNameErrorTooLong => -2_147_483_648i32 + 6i32, // i32::MIN + NewContractNameError::NewContractNameErrorContainsDot => -2_147_483_648i32 + 9i32, // i32::MIN + NewContractNameError::NewContractNameErrorInvalidCharacters => -2_147_483_648i32 + 10i32, // i32::MIN + } +} + +#[cfg(not(feature = "hacspec"))] +/// MissingInitPrefix is mapped to i32::MIN + 5, +/// TooLong to i32::MIN + 6, +/// ContainsDot to i32::MIN + 9, and +/// InvalidCharacters to i32::MIN + 10. +impl From for Reject { + fn from(nre: NewContractNameError) -> Self { + coerce_hacspec_to_rust_reject(reject_impl_from_new_contract_name_error(nre)) + } +} + +#[derive(Clone)] // , Debug, PartialEq, Eq +pub enum NewReceiveNameError { + NewReceiveNameErrorMissingDotSeparator, + NewReceiveNameErrorTooLong, + NewReceiveNameErrorInvalidCharacters, +} + +#[ensures(!(result == 0i32))] // != +pub fn reject_impl_from_new_receive_name_error(nre: NewReceiveNameError) -> RejectHacspec { + match nre { + NewReceiveNameError::NewReceiveNameErrorMissingDotSeparator => -2_147_483_648i32 + 7i32, // i32::MIN + NewReceiveNameError::NewReceiveNameErrorTooLong => -2_147_483_648i32 + 8i32, // i32::MIN + NewReceiveNameError::NewReceiveNameErrorInvalidCharacters => -2_147_483_648i32 + 11i32, // i32::MIN + } +} + +#[cfg(not(feature = "hacspec"))] +/// MissingDotSeparator is mapped to i32::MIN + 7, +/// TooLong to i32::MIN + 8, and +/// InvalidCharacters to i32::MIN + 11. +impl From for Reject { + fn from(nre: NewReceiveNameError) -> Self { + coerce_hacspec_to_rust_reject(reject_impl_from_new_receive_name_error(nre)) + } +} + +#[ensures(!(result == 0i32))] // != +pub fn reject_impl_from_not_payable_error() -> RejectHacspec { + -2_147_483_648i32 + 12i32 // i32::MIN +} + +#[cfg(not(feature = "hacspec"))] +/// The error code is i32::MIN + 12 +impl From for Reject { + #[inline(always)] + fn from(_: NotPayableError) -> Self { + coerce_hacspec_to_rust_reject(reject_impl_from_not_payable_error()) + } +} + +pub type ContractStateHacspec = u32; + +#[derive(Copy, Clone)] // , Debug, PartialEq, Eq +pub enum SeekFromHacspec { + /// Sets the offset to the provided number of bytes. + Start(u64), + + /// Sets the offset to the size of this object plus the specified number of + /// bytes. + /// + /// It is possible to seek beyond the end of an object, but it's an error to + /// seek before byte 0. + End(i64), + + /// Sets the offset to the current position plus the specified number of + /// bytes. + /// + /// It is possible to seek beyond the end of an object, but it's an error to + /// seek before byte 0. + Current(i64), +} + +pub type U32Option = Option; +pub type I64Option = Option; + +// #[requires(forall pos === SeekFrom::End(delta) ==> exists current_position.checked_add(delta as u32) == U32Option::Some(b))] +pub fn contract_state_impl_seek(current_position: ContractStateHacspec, end : u32, pos: SeekFromHacspec) -> Result<(ContractStateHacspec, u64), ()> { + match pos { + SeekFromHacspec::Start(offset) => Result::<(ContractStateHacspec, u64), ()>::Ok((offset as u32, offset)), + SeekFromHacspec::End(delta) => { + if delta >= 0_i64 { + match current_position.checked_add(delta as u32) { + U32Option::Some(b) => Result::<(ContractStateHacspec, u64), ()>::Ok((b, b as u64)), + U32Option::None => Result::<(ContractStateHacspec, u64), ()>::Err(()), + } + } else { + match delta.checked_abs() { + I64Option::Some(before) => + { + if (before as u32) <= end { + Result::<(ContractStateHacspec, u64), ()>::Ok(((end - (before as u32)), (end - (before as u32)) as u64)) + } + else { + Result::<(ContractStateHacspec, u64), ()>::Err(()) + } + } + I64Option::None => Result::<(ContractStateHacspec, u64), ()>::Err(()), + } + } + } + SeekFromHacspec::Current(delta) => { + if delta >= 0_i64 { + match current_position.checked_add(delta as u32) { + U32Option::Some(offset) => Result::<(ContractStateHacspec, u64), ()>::Ok((offset, offset as u64)), + U32Option::None => Result::<(ContractStateHacspec, u64), ()>::Err(()), + } + } else { + match delta.checked_abs() { + I64Option::Some(b) => match current_position.checked_sub(b as u32) { + U32Option::Some(offset) => Result::<(ContractStateHacspec, u64), ()>::Ok((offset, offset as u64)), + U32Option::None => Result::<(ContractStateHacspec, u64), ()>::Err(()), + }, + I64Option::None => Result::<(ContractStateHacspec, u64), ()>::Err(()), + } + } + } + } +} + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_rust_to_hacspec_contract_state( + rust_contract_state: &mut ContractState, +) -> ContractStateHacspec { + rust_contract_state.current_position.clone() +} + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_hacspec_to_rust_contract_state( + rust_contract_state: &mut ContractState, + hacspec_contract_state: ContractStateHacspec, +) { + rust_contract_state.current_position = hacspec_contract_state; +} + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_hacspec_to_rust_seek_result( + rust_contract_state: &mut ContractState, + hacspec_seek_result: Result<(ContractStateHacspec, u64), ()>, +) -> Result { + let (hacspec_result, rust_result) = hacspec_seek_result?; + coerce_hacspec_to_rust_contract_state(rust_contract_state, hacspec_result); + Ok(rust_result) +} + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_rust_to_hacspec_seek_from(rust_seek_from: SeekFrom) -> SeekFromHacspec { + match rust_seek_from { + SeekFrom::Start(v) => SeekFromHacspec::Start(v), + SeekFrom::End(v) => SeekFromHacspec::End(v), + SeekFrom::Current(v) => SeekFromHacspec::Current(v), + } +} + +#[cfg(not(feature = "hacspec"))] +/// # Contract state trait implementations. +impl Seek for ContractState { + type Err = (); + + fn seek(&mut self, pos: SeekFrom) -> Result { + let contract_state = coerce_rust_to_hacspec_contract_state(self); + coerce_hacspec_to_rust_seek_result( + self, + contract_state_impl_seek( + contract_state, + self.size(), + coerce_rust_to_hacspec_seek_from(pos), + ), + ) + } +} + +pub fn contract_state_impl_read_read( + current_position: ContractStateHacspec, + buf : PublicByteSeq, +) -> (ContractStateHacspec, usize) { + let (_buf, num_read) = load_state_hacspec(buf, current_position); + (current_position + num_read, num_read as usize) +} + +/// Read a u32 in little-endian format. This is optimized to not +/// initialize a dummy value before calling an external function. +pub fn contract_state_impl_read_read_u64( + current_position: ContractStateHacspec, +) -> (ContractStateHacspec, Result) { + // let mut bytes: MaybeUninit<[u8; 8]> = MaybeUninit::uninit(); + let buf = PublicByteSeq::new(8); + let (buf, num_read) = load_state_hacspec(buf, current_position); + (current_position + num_read, + if num_read == 8u32 { + Result::::Ok(u64_from_le_bytes(u64Word::from_seq(&buf))) + } else { + Result::::Err(()) + }) // num_read as u64 +} + +/// Read a u32 in little-endian format. This is optimized to not +/// initialize a dummy value before calling an external function. +pub fn contract_state_impl_read_read_u32( + current_position: ContractStateHacspec, +) -> (ContractStateHacspec, Result) { + // let mut bytes: MaybeUninit<[u8; 4]> = MaybeUninit::uninit(); + let buf = PublicByteSeq::new(4); + let (buf, num_read) = load_state_hacspec(buf, current_position); + (current_position + num_read, + if num_read == 4u32 { + Result::::Ok(u32_from_le_bytes(u32Word::from_seq(&buf))) + } else { + Result::::Err(()) + }) // num_read as u64 +} + +/// Read a u8 in little-endian format. This is optimized to not +/// initialize a dummy value before calling an external function. +pub fn contract_state_impl_read_read_u8( + current_position: ContractStateHacspec, +) -> (ContractStateHacspec, Result) { + let buf = PublicByteSeq::new(1); + let (buf, num_read) = load_state_hacspec(buf, current_position); + (current_position + num_read, + if num_read == 1u32 { + Result::::Ok(buf[0]) + } else { + Result::::Err(()) + }) // num_read as u64 +} + +#[cfg(not(feature = "hacspec"))] +impl Read for ContractState { + fn read(&mut self, buf: &mut [u8]) -> ParseResult { + let (cs, nr) = contract_state_impl_read_read( + coerce_rust_to_hacspec_contract_state(self), + coerce_rust_to_hacspec_public_byte_seq(buf), + ); + coerce_hacspec_to_rust_contract_state(self, cs); + Ok(nr) + } + + // TODO: !! Probably incorrect !! + /// Read a `u32` in little-endian format. This is optimized to not + /// initialize a dummy value before calling an external function. + fn read_u64(&mut self) -> ParseResult { + let (cs, nr) = + contract_state_impl_read_read_u64(coerce_rust_to_hacspec_contract_state(self)); + coerce_hacspec_to_rust_contract_state(self, cs); + match nr { + Result::::Ok(a) => ParseResult::::Ok(a), + Result::::Err(_) => ParseResult::::Err(ParseError::default()), + } + } + + /// Read a `u32` in little-endian format. This is optimized to not + /// initialize a dummy value before calling an external function. + fn read_u32(&mut self) -> ParseResult { + let (cs, nr) = + contract_state_impl_read_read_u32(coerce_rust_to_hacspec_contract_state(self)); + coerce_hacspec_to_rust_contract_state(self, cs); + match nr { + Result::::Ok(a) => ParseResult::::Ok(a), + Result::::Err(_) => ParseResult::::Err(ParseError::default()), + } + } + + /// Read a `u8` in little-endian format. This is optimized to not + /// initialize a dummy value before calling an external function. + fn read_u8(&mut self) -> ParseResult { + let (cs, nr) = + contract_state_impl_read_read_u8(coerce_rust_to_hacspec_contract_state(self)); + coerce_hacspec_to_rust_contract_state(self, cs); + match nr { + Result::::Ok(a) => ParseResult::::Ok(a), + Result::::Err(_) => ParseResult::::Err(ParseError::default()), + } + } +} + +pub fn contract_state_impl_write( + current_position: ContractStateHacspec, + buf: PublicByteSeq, +) -> Result<(ContractStateHacspec, usize), ()> { + if current_position.checked_add(buf.len() as u32).is_none() { + Result::<(ContractStateHacspec, usize), ()>::Err(())?; + } + let (_buf, num_bytes) = write_state_hacspec(buf, current_position); + Result::<(ContractStateHacspec, usize), ()>::Ok(( + current_position + num_bytes, + num_bytes as usize, + )) +} + +#[cfg(not(feature = "hacspec"))] +impl Write for ContractState { + type Err = (); + + fn write(&mut self, buf: &[u8]) -> Result { + let (cs, nr) = contract_state_impl_write( + coerce_rust_to_hacspec_contract_state(self), + coerce_rust_to_hacspec_public_byte_seq(buf), + )?; + coerce_hacspec_to_rust_contract_state(self, cs); + Ok(nr) + } +} + +pub fn has_contract_state_impl_for_contract_state_open() -> ContractStateHacspec { + 0_u32 +} + +pub fn has_contract_state_impl_for_contract_state_reserve( + len: u32, +) -> bool { + let cur_size = state_size_hacspec(); + if cur_size < len { + resize_state_hacspec(len) == 1_u32 + } else { + true + } +} + +pub fn has_contract_state_impl_for_contract_state_truncate( + current_position : ContractStateHacspec, + cur_size: u32, + new_size: u32, +) -> ContractStateHacspec { + if cur_size > new_size { + resize_state_hacspec(new_size); + } + if new_size < current_position { + new_size + } + else { + current_position + } +} + +#[cfg(not(feature = "hacspec"))] +impl HasContractState<()> for ContractState { + type ContractStateData = (); + + #[inline(always)] + fn open(_: Self::ContractStateData) -> Self { + ContractState { + current_position: has_contract_state_impl_for_contract_state_open(), + } + } + + fn reserve(&mut self, len: u32) -> bool { + has_contract_state_impl_for_contract_state_reserve(len) + } + + #[inline(always)] + fn size(&self) -> u32 { + state_size_hacspec() + } + + fn truncate(&mut self, new_size: u32) { + let current_position = coerce_rust_to_hacspec_contract_state(self); + coerce_hacspec_to_rust_contract_state( + self, + has_contract_state_impl_for_contract_state_truncate( + current_position, + self.size(), + new_size, + ), + ) + } +} + +pub type ParameterHacspec = u32; + +pub fn read_impl_for_parameter_read( + current_position: ParameterHacspec, + buf: PublicByteSeq, +) -> (ParameterHacspec, usize) { + let (_buf, num_read) = get_parameter_section_hacspec(buf, current_position); + (current_position + num_read, num_read as usize) +} + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_rust_to_hacspec_parameter( + rust_parameter: &mut concordium_types::Parameter, +) -> ParameterHacspec { + rust_parameter.current_position.clone() +} + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_hacspec_to_rust_parameter( + rust_parameter: &mut concordium_types::Parameter, + hacspec_parameter: ParameterHacspec, +) { + rust_parameter.current_position = hacspec_parameter; +} + + +#[cfg(not(feature = "hacspec"))] +/// # Trait implementations for Parameter +impl Read for concordium_types::Parameter { + fn read(&mut self, buf: &mut [u8]) -> ParseResult { + let (cs, nr) = read_impl_for_parameter_read( + coerce_rust_to_hacspec_parameter(self), + coerce_rust_to_hacspec_public_byte_seq(buf), + ); + coerce_hacspec_to_rust_parameter(self, cs); + Ok(nr) + } +} + +#[cfg(not(feature = "hacspec"))] +impl HasParameter for concordium_types::Parameter { + #[inline(always)] + fn size(&self) -> u32 { + get_parameter_size_hacspec() + } +} + +#[cfg(not(feature = "hacspec"))] +/// # Trait implementations for the chain metadata. +impl HasChainMetadata for ChainMetaExtern { + #[inline(always)] + fn slot_time(&self) -> SlotTime { + Timestamp::from_timestamp_millis(get_slot_time_hacspec() ) + } +} + +// pub struct AttributeTag(pub u8); +pub type AttributesCursorHacspec = (u32, u16); + +// pub fn has_policy_impl_for_policy_attributes_cursor_next_test( +// policy_attribute_items: AttributesCursorHacspec, +// ) -> bool { +// let (_, remaining_items) = policy_attribute_items; +// remaining_items == 0_u16 +// } + +// pub fn has_policy_impl_for_policy_attributes_cursor_next_tag_invalid( +// policy_attribute_items: AttributesCursorHacspec, +// tag_value_len_1: u8, +// num_read: u32, +// ) -> (AttributesCursorHacspec, bool) { +// let (current_position, remaining_items) = policy_attribute_items; +// let policy_attribute_items = (current_position + num_read, remaining_items); +// (policy_attribute_items, tag_value_len_1 > 31_u8) +// } + +pub fn has_policy_impl_for_policy_attributes_cursor_next_item( + policy_attribute_items: AttributesCursorHacspec, + buf: PublicByteSeq, +) -> Option<(AttributesCursorHacspec, (u8, u8))> { + + let (mut current_position, mut remaining_items) = policy_attribute_items; + + if remaining_items == 0u16 { + Option::<(AttributesCursorHacspec, (u8, u8))>::None?; + } + + let (tag_value_len, num_read) = get_policy_section_hacspec(PublicByteSeq::new(2), current_position); + current_position = current_position + num_read; + + if tag_value_len[1] > 31u8 { + // Should not happen because all attributes fit into 31 bytes. + Option::<(AttributesCursorHacspec, (u8, u8))>::None?; + } + + let (_buf, num_read) = get_policy_section_hacspec(buf, current_position); + current_position = current_position + num_read; + remaining_items = remaining_items - 1u16; + Option::<(AttributesCursorHacspec, (u8, u8))>::Some(((current_position, remaining_items), (tag_value_len[0], tag_value_len[1]))) +} + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_rust_to_hacspec_attributes_cursor( + rust_attributes_cursor: &mut AttributesCursor, +) -> AttributesCursorHacspec { + ( + rust_attributes_cursor.current_position.clone(), + rust_attributes_cursor.remaining_items.clone(), + ) +} + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_hacspec_to_rust_attributes_cursor( + rust_attributes_cursor: &mut AttributesCursor, + hacspec_attributes_cursor: AttributesCursorHacspec, +) { + let (current_position, remaining_items) = hacspec_attributes_cursor; + rust_attributes_cursor.current_position = current_position; + rust_attributes_cursor.remaining_items = remaining_items; +} + +// TODO: Creusot issues? +#[cfg(not(feature = "hacspec"))] +impl HasPolicy for Policy { + fn identity_provider(&self) -> IdentityProvider { + self.identity_provider + } + + fn created_at(&self) -> Timestamp { + self.created_at + } + + fn valid_to(&self) -> Timestamp { + self.valid_to + } + + fn next_item(&mut self, buf: &mut [u8; 31]) -> Option<(AttributeTag, u8)> { + let (ac, (at, v)) = has_policy_impl_for_policy_attributes_cursor_next_item( + coerce_rust_to_hacspec_attributes_cursor(&mut self.items), + coerce_rust_to_hacspec_public_byte_seq(&mut buf[..]), + )?; + coerce_hacspec_to_rust_attributes_cursor(&mut self.items, ac); + Some((AttributeTag(at), v)) + } +} + +#[cfg(not(feature = "hacspec"))] +/// An iterator over policies using host functions to supply the data. +/// The main interface to using this type is via the methods of the [Iterator](https://doc.rust-lang.org/std/iter/trait.Iterator.html) +/// and [ExactSizeIterator](https://doc.rust-lang.org/std/iter/trait.ExactSizeIterator.html) traits. +pub struct PoliciesIterator { + /// Position in the policies binary serialization. + pos: u32, + /// Number of remaining items in the stream. + remaining_items: u16, +} + +pub type PoliciesIteratorHacspec = (u32, u16); + +// TODO: use PolicyAttributesCursorHacspec for implementation above instead of just AttributesCursorHacspec +pub type PolicyAttributesCursorHacspec = (u32, u64, u64, AttributesCursorHacspec); // IdentityProvider, Timestamp, Timestamp, AttributesCursor + +// TODO: Fix creusot issues? +fn iterator_impl_for_policies_iterator_next( + policies_iterator: PoliciesIteratorHacspec, +) -> Option<(PoliciesIteratorHacspec, PolicyAttributesCursorHacspec)> { + let (mut pos, remaining_items) = policies_iterator; + if remaining_items == 0u16 { + Option::<(PoliciesIteratorHacspec, PolicyAttributesCursorHacspec)>::None?; + } + + // 2 for total size of this section, 4 for identity_provider, + // 8 bytes for created_at, 8 for valid_to, and 2 for + // the length + let (buf, _) = get_policy_section_hacspec(PublicByteSeq::new(2 + 4 + 8 + 8 + 2), pos); + let skip_part: PublicByteSeq = buf.slice_range(0..2); + let ip_part: PublicByteSeq = buf.slice_range(2..2 + 4); + let created_at_part: PublicByteSeq = buf.slice_range(2 + 4..2 + 4 + 8); + let valid_to_part: PublicByteSeq = buf.slice_range(2 + 4 + 8..2 + 4 + 8 + 8); + let len_part: PublicByteSeq = buf.slice_range(2 + 4 + 8 + 8..2 + 4 + 8 + 8 + 2); + let identity_provider = u32_from_le_bytes(u32Word::from_seq(&ip_part)); // IdentityProvider = u32 // UnsignedPublicInteger + let created_at = u64_from_le_bytes(u64Word::from_seq(&created_at_part)); // Timestamp = Timestamp::from_timestamp_millis(u64) + let valid_to = u64_from_le_bytes(u64Word::from_seq(&valid_to_part)); // Timestamp = u64) + let mut remaining_items = u16_from_le_bytes(u16Word::from_seq(&len_part)); + let attributes_start = pos + 2u32 + 4u32 + 8u32 + 8u32 + 2u32; + pos = pos + (u16_from_le_bytes(u16Word::from_seq(&skip_part)) as u32) + 2u32; + remaining_items = remaining_items - 1u16; + Option::<(PoliciesIteratorHacspec, PolicyAttributesCursorHacspec)>::Some(( + (pos, remaining_items), + ( + identity_provider, + created_at, + valid_to, + (attributes_start, remaining_items), + ), + )) +} + +// TODO: Fix creusot issues? +#[cfg(not(feature = "hacspec"))] +impl Iterator for PoliciesIterator { + type Item = Policy; + + fn next(&mut self) -> Option { + let ((pos, remaining_items), (identity_provider, created_at, valid_to, (cp, ri))) = + iterator_impl_for_policies_iterator_next((self.pos, self.remaining_items))?; + + // TODO: make into coerce function + self.pos = pos; + self.remaining_items = remaining_items; + + Some(Policy { + identity_provider, + created_at: Timestamp::from_timestamp_millis(created_at), + valid_to: Timestamp::from_timestamp_millis(valid_to), + items: AttributesCursor { + current_position: cp, + remaining_items: ri, + }, + }) + } + + fn size_hint(&self) -> (usize, Option) { + let rem = self.remaining_items as usize; + (rem, Some(rem)) + } +} + +#[cfg(not(feature = "hacspec"))] +impl ExactSizeIterator for PoliciesIterator { + #[inline(always)] + fn len(&self) -> usize { + self.remaining_items.into() // as usize + } +} + +#[cfg(not(feature = "hacspec"))] +impl HasCommonData for ExternContext { + type MetadataType = ChainMetaExtern; + type ParamType = concordium_types::Parameter; + type PolicyIteratorType = PoliciesIterator; + type PolicyType = Policy; + + // TODO: fix creusot issue + #[inline(always)] + fn metadata(&self) -> &Self::MetadataType { + &ChainMetaExtern {} + } + + fn policies(&self) -> PoliciesIterator { + let (buf, _) = get_policy_section_hacspec(PublicByteSeq::new(2), 0); + PoliciesIterator { + pos: 2, // 2 because we already read 2 bytes. + remaining_items: u16_from_le_bytes(u16Word::from_seq(&buf)), + } + } + + #[inline(always)] + fn parameter_cursor(&self) -> Self::ParamType { + concordium_types::Parameter { + current_position: 0, + } + } +} + +#[cfg(not(feature = "hacspec"))] +/// # Trait implementations for the init context +impl HasInitContext for ExternContext { + type InitData = (); + + /// Create a new init context by using an external call. + fn open(_: Self::InitData) -> Self { + ExternContext::default() + } + + #[inline(always)] + fn init_origin(&self) -> AccountAddress { + let mut address : [u8; ACCOUNT_ADDRESS_SIZE] = Default::default(); + let temp = coerce_hacspec_to_rust_public_byte_seq(get_init_origin_hacspec( + PublicByteSeq::new(ACCOUNT_ADDRESS_SIZE), + )); + address.clone_from_slice(temp.as_slice()); + AccountAddress(address) + } +} + +#[cfg(not(feature = "hacspec"))] +/// # Trait implementations for the receive context +impl HasReceiveContext for ExternContext { + type ReceiveData = (); + + /// Create a new receive context + fn open(_: Self::ReceiveData) -> Self { + ExternContext::default() + } + + // TODO: Make usable by creusot + #[inline(always)] + fn invoker(&self) -> AccountAddress { + let mut address: [u8; ACCOUNT_ADDRESS_SIZE] = Default::default(); + address.clone_from_slice( + &mut coerce_hacspec_to_rust_public_byte_seq(get_receive_invoker_hacspec( + PublicByteSeq::new(ACCOUNT_ADDRESS_SIZE), + ))[..], + ); + AccountAddress(address) + } + + // TODO: Make usable by creusot + #[inline(always)] + fn self_address(&self) -> ContractAddress { + let mut address: [u8; ACCOUNT_ADDRESS_SIZE] = Default::default(); + address.clone_from_slice( + &mut coerce_hacspec_to_rust_public_byte_seq(get_receive_self_address_hacspec( + PublicByteSeq::new(ACCOUNT_ADDRESS_SIZE), + ))[..], + ); + match concordium_contracts_common::from_bytes(&address) { + Ok(v) => v, + Err(_) => trap(), + } + } + + #[inline(always)] + fn self_balance(&self) -> Amount { + Amount::from_micro_ccd(get_receive_self_balance_hacspec()) + } + + // TODO: Make usable by creusot + // TODO: Remove/replace unsafe code ! + #[inline(always)] + fn sender(&self) -> Address { + let ptr : *mut u8 = (&mut coerce_hacspec_to_rust_public_byte_seq(get_receive_sender_hacspec( + PublicByteSeq::new(ACCOUNT_ADDRESS_SIZE), + ))[..]).as_mut_ptr(); + let tag = unsafe { *ptr }; + match tag { + 0u8 => { + match concordium_contracts_common::from_bytes(unsafe { core::slice::from_raw_parts( + ptr.add(1), + ACCOUNT_ADDRESS_SIZE, + )} ) { + Ok(v) => Address::Account(v), + Err(_) => trap(), + } + } + 1u8 => match concordium_contracts_common::from_bytes(unsafe { core::slice::from_raw_parts(ptr.add(1), 16) }) { + Ok(v) => Address::Contract(v), + Err(_) => trap(), + }, + _ => trap(), // unreachable!("Host violated precondition."), + } + } + + // TODO: Make usable by creusot + #[inline(always)] + fn owner(&self) -> AccountAddress { + let mut address: [u8; ACCOUNT_ADDRESS_SIZE] = Default::default(); + address.clone_from_slice( + &mut coerce_hacspec_to_rust_public_byte_seq(get_receive_self_address_hacspec( + PublicByteSeq::new(ACCOUNT_ADDRESS_SIZE), + ))[..], + ); + AccountAddress(address) + } +} + +#[cfg(not(feature = "hacspec"))] +/// #Implementations of the logger. +impl HasLogger for Logger { + #[inline(always)] + fn init() -> Self { + Self { _private: () } + } + + fn log_raw(&mut self, event: &[u8]) -> Result<(), LogError> { + let (_, res) = log_event_hacspec(coerce_rust_to_hacspec_public_byte_seq(event)); + match res { + 1 => Ok(()), + 0 => Err(LogError::Full), + _ => Err(LogError::Malformed), + } + } +} + +// #[cfg(feature = "hacspec")] +array!(UserAddress, 32, u8); + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_hacspec_to_rust_account_address(ua: UserAddress) -> AccountAddress { + AccountAddress([ + ua[0], ua[1], ua[2], ua[3], ua[4], ua[5], ua[6], ua[7], ua[8], ua[9], ua[10], ua[11], + ua[12], ua[13], ua[14], ua[15], ua[16], ua[17], ua[18], ua[19], ua[20], ua[21], ua[22], + ua[23], ua[24], ua[25], ua[26], ua[27], ua[28], ua[29], ua[30], ua[31], + ]) +} + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_rust_to_hacspec_account_address(aa: &AccountAddress) -> UserAddress { + UserAddress::from_native_slice(&aa.0) +} + +// #[cfg(feature = "hacspec")] +// #[cfg_attr(feature = "use_attributes", in_hacspec(Action))] +pub enum HasAction { + Accept(), + SimpleTransfer(UserAddress, u64), + // TODO: add send_raw + SendRaw( + UserAddress, + String, // TODO: Should be ReceiveName => string + u64, + PublicByteSeq, + ), + // AND_THEN(HasAction, HasAction), + // OR_ELSE(HasAction, HasAction) +} +#[cfg(feature = "hacspec")] +pub type ListAction = Seq; + +// #[cfg(feature = "hacspec")] +pub fn accept_action() -> HasAction { + HasAction::Accept() +} + +// pub type ContextState = (Context, ()); + +// #[cfg(feature = "hacspec")] +// #[init(contract = "auction")] +// pub fn auction_init(ctx : Context) -> ContextState { +// // Always succeeds +// (ctx, ()) +// } + +// pub fn auction_init2(ctx : Context) -> ContextState { +// // Always succeeds +// (ctx, ()) +// } + +// Owner, Sender, Balance, Data / time +pub struct Context(pub UserAddress, pub UserAddress, pub u64, pub u64); + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_rust_to_hacspec_context(ctx: &impl HasReceiveContext) -> Context { + Context( + coerce_rust_to_hacspec_account_address(&ctx.owner()), + match ctx.sender() { + Address::Contract(_) => panic!(), + Address::Account(account_address) => coerce_rust_to_hacspec_account_address(&account_address), + }, + ctx.self_balance().micro_ccd, + ctx.metadata().slot_time().timestamp_millis(), + ) +} + +#[cfg(not(feature = "hacspec"))] +/// #Implementation of actions. +/// These actions are implemented by direct calls to host functions. +impl HasActions for Action { + #[inline(always)] + fn accept() -> Self { + Action { + _private: accept_hacspec(), + } + } + + #[inline(always)] + fn simple_transfer(acc: &AccountAddress, amount: Amount) -> Self { + let res = simple_transfer_hacspec(coerce_rust_to_hacspec_public_byte_seq(&acc.0), amount.micro_ccd); + Action { _private: res } + } + + #[inline(always)] + fn send_raw( + ca: &ContractAddress, + receive_name: ReceiveName, + amount: Amount, + parameter: &[u8], + ) -> Self { + let receive_bytes = receive_name.get_chain_name().as_bytes(); + let res = + send_hacspec( + ca.index, + ca.subindex, + coerce_rust_to_hacspec_public_byte_seq(&receive_bytes), + amount.micro_ccd, + coerce_rust_to_hacspec_public_byte_seq(¶meter), + ); + Action { _private: res } + } + + #[inline(always)] + fn and_then(self, then: Self) -> Self { + let res = combine_and_hacspec(self._private, then._private); + Action { _private: res } + } + + #[inline(always)] + fn or_else(self, el: Self) -> Self { + let res = combine_or_hacspec(self._private, el._private); + Action { _private: res } + } +} + +// TODO: Define functionality in hacspec instead! +#[cfg(not(feature = "hacspec"))] +/// Allocates a Vec of bytes prepended with its length as a `u32` into memory, +/// and prevents them from being dropped. Returns the pointer. +/// Used to pass bytes from a Wasm module to its host. +#[doc(hidden)] +pub fn put_in_memory(input: &[u8]) -> *mut u8 { + let bytes_length = input.len() as u32; + let mut bytes = concordium_contracts_common::to_bytes(&bytes_length); + bytes.extend_from_slice(input); + let ptr = bytes.as_mut_ptr(); + #[cfg(feature = "std")] + ::std::mem::forget(bytes); + #[cfg(not(feature = "std"))] + core::mem::forget(bytes); + ptr +} + +// #[cfg(feature = "hacspec")] +/// Wrapper for +/// [HasActions::send_raw](../trait.HasActions.html#tymethod.send_raw), which +/// automatically serializes the parameter. Note that if the parameter is +/// already a byte array or convertible to a byte array without allocations it +/// is preferrable to use [send_raw](../trait.HasActions.html#tymethod.send_raw). +/// It is more efficient and avoids memory allocations. +pub fn send_wrap_hacspec( + ca_index: u64, + ca_subindex: u64, + receive_name_bytes: PublicByteSeq, + amount: u64, + param_bytes: PublicByteSeq, +) -> u32 { + send_hacspec( + ca_index, + ca_subindex, + receive_name_bytes, + amount, + param_bytes, + ) +} + + +// TODO: Get functionlity of everything into hacspec +#[allow(dead_code)] +#[cfg(not(feature = "hacspec"))] +/// Wrapper for +/// [HasActions::send_raw](../trait.HasActions.html#tymethod.send_raw), which +/// automatically serializes the parameter. Note that if the parameter is +/// already a byte array or convertible to a byte array without allocations it +/// is preferrable to use [send_raw](../trait.HasActions.html#tymethod.send_raw). +/// It is more efficient and avoids memory allocations. +pub fn send_wrap( + ca: &ContractAddress, + receive_name: ReceiveName, + amount: Amount, + parameter: &P, +) -> A { + let param_bytes = concordium_contracts_common::to_bytes(parameter); + A::send_raw(ca, receive_name, amount, ¶m_bytes) +} + + diff --git a/concordium/src/concordium_prims.rs b/concordium/src/concordium_prims.rs new file mode 100644 index 0000000..f652e2b --- /dev/null +++ b/concordium/src/concordium_prims.rs @@ -0,0 +1,502 @@ +#[cfg(not(feature = "hacspec"))] +use crate::*; + +use hacspec_lib::*; + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_rust_to_hacspec_public_byte_seq(buf: &[u8]) -> PublicByteSeq { + PublicByteSeq::from_native_slice(buf) +} + +// TODO: Make creusot friendly version +#[cfg(not(feature = "hacspec"))] +pub fn coerce_hacspec_to_rust_public_byte_seq(buf: PublicByteSeq) -> Vec { + // buf.native_slice().iter().collect(); + let mut temp_vec: Vec = Vec::new(); + for i in 0..buf.len() { + temp_vec.push(buf.index(i).clone()) + } + temp_vec +} + +#[cfg(not(feature = "hacspec"))] +extern "C" { + pub(crate) fn accept() -> u32; +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn accept_creusot() -> u32 { + unsafe { accept() } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn accept_hacspec() -> u32 { + 1u32 +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn accept_hacspec() -> u32 { + accept_creusot() +} + +#[cfg(not(feature = "hacspec"))] +extern "C" { + // Basic action to send tokens to an account. + pub(crate) fn simple_transfer(addr_bytes: *const u8, amount: u64) -> u32; +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn simple_transfer_creusot(addr_bytes: *const u8, amount: u64) -> u32 { + unsafe { simple_transfer(addr_bytes, amount) } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn simple_transfer_hacspec(buf: PublicByteSeq, amount: u64) -> u32 { + 1u32 +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn simple_transfer_hacspec(buf: PublicByteSeq, amount: u64) -> u32 { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(buf.clone())[..]; + simple_transfer_creusot(temp.as_ptr(), amount) +} + +#[cfg(not(feature = "hacspec"))] +extern "C" { + // Send a message to a smart contract. + pub(crate) fn send( + addr_index: u64, + addr_subindex: u64, + receive_name: *const u8, + receive_name_len: u32, + amount: u64, + parameter: *const u8, + parameter_len: u32, + ) -> u32; +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn send_creusot( + addr_index: u64, + addr_subindex: u64, + receive_name: *const u8, + receive_name_len: u32, + amount: u64, + parameter: *const u8, + parameter_len: u32, + ) -> u32 { + unsafe { send(addr_index, addr_subindex, receive_name, receive_name_len, amount, parameter, parameter_len) } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn send_hacspec( + addr_index: u64, + addr_subindex: u64, + receive_name: PublicByteSeq, + amount: u64, + parameter: PublicByteSeq, + ) -> u32 { + 1u32 +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn send_hacspec( + addr_index: u64, + addr_subindex: u64, + receive_name: PublicByteSeq, + amount: u64, + parameter: PublicByteSeq, + ) -> u32 { + let temp_receive_name = &mut coerce_hacspec_to_rust_public_byte_seq(receive_name.clone())[..]; + let temp_parameter = &mut coerce_hacspec_to_rust_public_byte_seq(parameter.clone())[..]; + send_creusot(addr_index, addr_subindex, temp_receive_name.as_ptr(), receive_name.len() as u32, amount, temp_parameter.as_ptr(), parameter.len() as u32) +} + +#[cfg(not(feature = "hacspec"))] +extern "C" { + // Combine two actions using normal sequencing. This is using the stack of + // actions already produced. + pub(crate) fn combine_and(l: u32, r: u32) -> u32; +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn combine_and_creusot(l: u32, r: u32) -> u32 { + unsafe { combine_and(l, r) } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn combine_and_hacspec(l: u32, r: u32) -> u32 { + 1u32 +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn combine_and_hacspec(l: u32, r: u32) -> u32 { + combine_and_creusot(l,r) +} + +#[cfg(not(feature = "hacspec"))] +extern "C" { + // Combine two actions using normal sequencing. This is using the stack of + // actions already produced. + pub(crate) fn combine_or(l: u32, r: u32) -> u32; +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn combine_or_creusot(l: u32, r: u32) -> u32 { + unsafe { combine_or(l, r) } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn combine_or_hacspec(l: u32, r: u32) -> u32 { + 1u32 +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn combine_or_hacspec(l: u32, r: u32) -> u32 { + combine_or_creusot(l,r) +} + +#[cfg(not(feature = "hacspec"))] +extern "C" { + // Get the size of the parameter to the method (either init or receive). + pub(crate) fn get_parameter_size() -> u32; +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn get_parameter_size_creusot() -> u32 { + unsafe { get_parameter_size() } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn get_parameter_size_hacspec() -> u32 { + 1u32 +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn get_parameter_size_hacspec() -> u32 { + get_parameter_size_creusot() +} + +#[cfg(not(feature = "hacspec"))] +extern "C" { + // Write a section of the parameter to the given location. Return the number + // of bytes written. The location is assumed to contain enough memory to + // write the requested length into. + pub(crate) fn get_parameter_section(param_bytes: *mut u8, length: u32, offset: u32) -> u32; +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn get_parameter_section_creusot(start: *mut u8, length: u32, offset: u32) -> u32 { + unsafe { get_parameter_section(start, length, offset) } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn get_parameter_section_hacspec(buf: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { + (buf, 1u32) +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn get_parameter_section_hacspec(buf: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(buf.clone())[..]; + let result = get_parameter_section_creusot(temp.as_mut_ptr(), buf.len() as u32, offset); + ( + coerce_rust_to_hacspec_public_byte_seq(&temp), + result, + ) +} + +#[cfg(not(feature = "hacspec"))] +extern "C" { + // Write a section of the policy to the given location. Return the number + // of bytes written. The location is assumed to contain enough memory to + // write the requested length into. + pub(crate) fn get_policy_section(policy_bytes: *mut u8, length: u32, offset: u32) -> u32; +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn get_policy_section_creusot(policy_bytes: *mut u8, length: u32, offset: u32) -> u32 { + unsafe { get_policy_section(policy_bytes, length, offset) } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn get_policy_section_hacspec(policy_bytes: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { + (policy_bytes, 1u32) +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn get_policy_section_hacspec(policy_bytes: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(policy_bytes.clone())[..]; + let result = get_policy_section_creusot(temp.as_mut_ptr(), policy_bytes.len() as u32, offset); + ( + coerce_rust_to_hacspec_public_byte_seq(&temp), + result, + ) +} + +#[cfg(not(feature = "hacspec"))] +extern "C" { + // Add a log item. Return values are + // - -1 if logging failed due to the message being too long + // - 0 if the log is already full + // - 1 if data was successfully logged. + pub(crate) fn log_event(start: *const u8, length: u32) -> i32; +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn log_event_creusot(start: *const u8, length: u32) -> i32 { + unsafe { log_event(start, length) } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn log_event_hacspec(start: PublicByteSeq) -> (PublicByteSeq, i32) { + (start, 1i32) +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn log_event_hacspec(start: PublicByteSeq) -> (PublicByteSeq, i32) { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(start.clone())[..]; + let result = log_event_creusot(temp.as_ptr(), start.len() as u32); + (coerce_rust_to_hacspec_public_byte_seq(&temp), result) +} + +#[cfg(not(feature = "hacspec"))] +extern "C" { + pub(crate) fn load_state(start: *mut u8, length: u32, offset: u32) -> u32; +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn load_state_creusot(start: *mut u8, length: u32, offset: u32) -> u32 { + unsafe { load_state(start, length, offset) } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn load_state_hacspec(buf: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { + (buf, 1u32) +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn load_state_hacspec(buf: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(buf.clone())[..]; + let result = load_state_creusot(temp.as_mut_ptr(), buf.len() as u32, offset); + (coerce_rust_to_hacspec_public_byte_seq(&temp), result) +} + +#[cfg(not(feature = "hacspec"))] +extern "C" { + pub(crate) fn write_state(start: *mut u8, length: u32, offset: u32) -> u32; +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn write_state_creusot(start: *mut u8, length: u32, offset: u32) -> u32 { + unsafe { write_state(start, length, offset) } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn write_state_hacspec(buf: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { + (buf, 1u32) +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn write_state_hacspec(buf: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(buf.clone())[..]; + let result = write_state_creusot(temp.as_mut_ptr(), buf.len() as u32, offset); + (coerce_rust_to_hacspec_public_byte_seq(&temp), result) +} + +#[cfg(not(feature = "hacspec"))] +extern "C" { + // Resize state to the new value (truncate if new size is smaller). Return 0 if + // this was unsuccesful (new state too big), or 1 if successful. + pub(crate) fn resize_state(new_size: u32) -> u32; // returns 0 or 1. + // get current state size in bytes. +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn resize_state_creusot(new_size: u32) -> u32 { + unsafe { resize_state(new_size) } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn resize_state_hacspec(new_size: u32) -> u32 { + 1u32 +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn resize_state_hacspec(new_size: u32) -> u32 { + resize_state_creusot(new_size) +} + +#[cfg(not(feature = "hacspec"))] +extern "C" { + pub(crate) fn state_size() -> u32; +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn state_size_creusot() -> u32 { + unsafe { state_size() } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn state_size_hacspec() -> u32 { + 1u32 +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn state_size_hacspec() -> u32 { + state_size_creusot() +} + +#[cfg(not(feature = "hacspec"))] +extern "C" { + // Getter for the init context. + /// Address of the sender, 32 bytes + pub(crate) fn get_init_origin(start: *mut u8); +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn get_init_origin_creusot(start: *mut u8) { + unsafe { get_init_origin(start) } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn get_init_origin_hacspec(start: PublicByteSeq) -> PublicByteSeq { + start +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn get_init_origin_hacspec(start: PublicByteSeq) -> PublicByteSeq { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(start.clone())[..]; + get_init_origin_creusot(temp.as_mut_ptr()); + coerce_rust_to_hacspec_public_byte_seq(&temp) +} + +#[cfg(not(feature = "hacspec"))] +extern "C" { + /// Invoker of the top-level transaction, AccountAddress. + pub(crate) fn get_receive_invoker(start: *mut u8); +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn get_receive_invoker_creusot(start: *mut u8) { + unsafe { get_receive_invoker(start) } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn get_receive_invoker_hacspec(start: PublicByteSeq) -> PublicByteSeq { + start +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn get_receive_invoker_hacspec(start: PublicByteSeq) -> PublicByteSeq { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(start.clone())[..]; + get_receive_invoker_creusot(temp.as_mut_ptr()); + coerce_rust_to_hacspec_public_byte_seq(&temp) +} + +#[cfg(not(feature = "hacspec"))] +extern "C" { + /// Address of the contract itself, ContractAddress. + pub(crate) fn get_receive_self_address(start: *mut u8); +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn get_receive_self_address_creusot(start: *mut u8) { + unsafe { get_receive_self_address(start) } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn get_receive_self_address_hacspec(start: PublicByteSeq) -> PublicByteSeq { + start +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn get_receive_self_address_hacspec(start: PublicByteSeq) -> PublicByteSeq { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(start.clone())[..]; + get_receive_self_address_creusot(temp.as_mut_ptr()); + coerce_rust_to_hacspec_public_byte_seq(&temp) +} + +#[cfg(not(feature = "hacspec"))] +extern "C" { + /// Self-balance of the contract, returns the amount + pub(crate) fn get_receive_self_balance() -> u64; +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn get_receive_self_balance_creusot() -> u64 { + unsafe { get_receive_self_balance() } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn get_receive_self_balance_hacspec() -> u64 { + 1u64 +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn get_receive_self_balance_hacspec() -> u64 { + get_receive_self_balance_creusot() +} + +#[cfg(not(feature = "hacspec"))] +extern "C" { + /// Immediate sender of the message (either contract or account). + pub(crate) fn get_receive_sender(start: *mut u8); +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn get_receive_sender_creusot(start: *mut u8) { + unsafe { get_receive_sender(start) } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn get_receive_sender_hacspec(start: PublicByteSeq) -> PublicByteSeq { + start +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn get_receive_sender_hacspec(start: PublicByteSeq) -> PublicByteSeq { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(start.clone())[..]; + get_receive_sender_creusot(temp.as_mut_ptr()); + coerce_rust_to_hacspec_public_byte_seq(&temp) +} + +#[cfg(not(feature = "hacspec"))] +extern "C" { + // Getters for the chain meta data + /// Slot time (in milliseconds) from chain meta data + pub(crate) fn get_slot_time() -> u64; +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn get_slot_time_creusot() -> u64 { + unsafe { get_slot_time() } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn get_slot_time_hacspec() -> u64 { + 1u64 +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn get_slot_time_hacspec() -> u64 { + get_slot_time_creusot() +} diff --git a/concordium/src/concordium_traits.rs b/concordium/src/concordium_traits.rs new file mode 100644 index 0000000..df1a61f --- /dev/null +++ b/concordium/src/concordium_traits.rs @@ -0,0 +1,272 @@ +#[cfg(not(feature = "hacspec"))] +use crate::*; + +// //! This module implements traits for the contract interface. +// //! This allows setting-up mock objects for testing individual +// //! contract invocations. + +#[cfg(not(feature = "hacspec"))] +/// Objects which can access parameters to contracts. +/// +/// This trait has a Read supertrait which means that structured parameters can +/// be directly deserialized by using `.get()` function from the `Get` trait. +/// +/// The reuse of `Read` methods is the reason for the slightly strange choice of +/// methods of this trait. +pub trait HasParameter: Read { + /// Get the size of the parameter to the method. + fn size(&self) -> u32; +} + +#[cfg(not(feature = "hacspec"))] +/// Objects which can access chain metadata. +pub trait HasChainMetadata { + /// Get time in milliseconds at the beginning of this block. + fn slot_time(&self) -> SlotTime; +} + +#[cfg(not(feature = "hacspec"))] +/// A type which has access to a policy of a credential. +/// Since policies can be large this is deliberately written in a relatively +/// low-level style to enable efficient traversal of all the attributes without +/// any allocations. +pub trait HasPolicy { + /// Identity provider who signed the identity object the credential is + /// derived from. + fn identity_provider(&self) -> IdentityProvider; + /// Beginning of the month in milliseconds since unix epoch when the + /// credential was created. + fn created_at(&self) -> Timestamp; + /// Beginning of the month where the credential is no longer valid, in + /// milliseconds since unix epoch. + fn valid_to(&self) -> Timestamp; + /// Get the next attribute, storing it in the provided buffer. + /// The return value, if `Some`, is a pair of an attribute tag, and the + /// length, `n` of the attribute value. In this case, the attribute + /// value is written in the first `n` bytes of the provided buffer. The + /// rest of the buffer is unchanged. + /// + /// The reason this function is added here, and we don't simply implement + /// an Iterator for this type is that with the supplied buffer we can + /// iterate through the elements more efficiently, without any allocations, + /// the consumer being responsible for allocating the buffer. + fn next_item(&mut self, buf: &mut [u8; 31]) -> Option<(AttributeTag, u8)>; +} + +#[cfg(not(feature = "hacspec"))] +/// Common data accessible to both init and receive methods. +pub trait HasCommonData { + type PolicyType: HasPolicy; + type MetadataType: HasChainMetadata; + type ParamType: HasParameter + Read; + type PolicyIteratorType: ExactSizeIterator; + /// Policies of the sender of the message. + /// For init methods this is the would-be creator of the contract, + /// for the receive this is the policies of the immediate sender. + /// + /// In the latter case, if the sender is an account then it is the policies + /// of the account, if it is a contract then it is the policies of the + /// creator of the contract. + fn policies(&self) -> Self::PolicyIteratorType; + /// Get the reference to chain metadata + fn metadata(&self) -> &Self::MetadataType; + /// Get the cursor to the parameter. + fn parameter_cursor(&self) -> Self::ParamType; +} + +#[cfg(not(feature = "hacspec"))] +/// Types which can act as init contexts. +pub trait HasInitContext: HasCommonData { + /// Data needed to open the context. + type InitData; + /// Open the init context for reading and accessing values. + fn open(data: Self::InitData) -> Self; + /// Who invoked this init call. + fn init_origin(&self) -> AccountAddress; +} + +#[cfg(not(feature = "hacspec"))] +/// Types which can act as receive contexts. +pub trait HasReceiveContext: HasCommonData { + type ReceiveData; + + /// Open the receive context for reading and accessing values. + fn open(data: Self::ReceiveData) -> Self; + /// Who is the account that initiated the top-level transaction this + /// invocation is a part of. + fn invoker(&self) -> AccountAddress; + /// The address of the contract being invoked. + fn self_address(&self) -> ContractAddress; + /// Balance on the contract before the call was made. + fn self_balance(&self) -> Amount; + /// The immediate sender of the message. In general different from the + /// invoker. + fn sender(&self) -> Address; + /// Account which created the contract instance. + fn owner(&self) -> AccountAddress; +} + +#[cfg(not(feature = "hacspec"))] +/// A type that can serve as the contract state type. +pub trait HasContractState +where + Self: Read, + Self: Write, + Self: Seek, { + type ContractStateData; + /// Open the contract state. Only one instance can be opened at the same + /// time. + fn open(_: Self::ContractStateData) -> Self; + + /// Get the current size of contract state. + fn size(&self) -> u32; + + /// Truncate the state to the given size. If the given size is more than the + /// current state size this operation does nothing. The new position is at + /// most at the end of the stream. + fn truncate(&mut self, new_size: u32); + + /// Make sure that the memory size is at least that many bytes in size. + /// Returns true iff this was successful. The new bytes are initialized as + /// 0. + fn reserve(&mut self, len: u32) -> bool; +} + +#[cfg(not(feature = "hacspec"))] +/// Objects which can serve as loggers. +/// +/// Logging functionality can be used by smart contracts to record events that +/// might be of interest to external parties. These events are not used on the +/// chain, and cannot be observed by other contracts, but they are stored by the +/// node, and can be queried to provide information to off-chain actors. +pub trait HasLogger { + /// Initialize a logger. + fn init() -> Self; + + /// Log the given slice as-is. If logging is not successful an error will be + /// returned. + fn log_raw(&mut self, event: &[u8]) -> Result<(), LogError>; + + #[inline(always)] + /// Log a serializable event by serializing it with a supplied serializer. + fn log(&mut self, event: &S) -> Result<(), LogError> { + let mut out = Vec::new(); + if event.serial(&mut out).is_err() { + trap(); // should not happen + } + self.log_raw(&out) + } +} + +#[cfg(not(feature = "hacspec"))] +/// An object that can serve to construct actions. +/// +/// The actions that a smart contract can produce as a +/// result of its execution. These actions form a tree and are executed by +/// the scheduler in the predefined order. +pub trait HasActions { + /// Default accept action. + fn accept() -> Self; + + /// Send a given amount to an account. + fn simple_transfer(acc: &AccountAddress, amount: Amount) -> Self; + + /// Send a message to a contract. + fn send_raw( + ca: &ContractAddress, + receive_name: ReceiveName, + amount: Amount, + parameter: &[u8], + ) -> Self; + + /// If the execution of the first action succeeds, run the second action + /// as well. + fn and_then(self, then: Self) -> Self; + + /// If the execution of the first action fails, try the second. + fn or_else(self, el: Self) -> Self; +} + +#[cfg(not(feature = "hacspec"))] +/// Add optimized unwrap behaviour that aborts the process instead of +/// panicking. +pub trait UnwrapAbort { + /// The underlying result type of the unwrap, in case of success. + type Unwrap; + /// Unwrap or call [trap](../fn.trap.html). In contrast to + /// the unwrap methods on [Option::unwrap](https://doc.rust-lang.org/std/option/enum.Option.html#method.unwrap) + /// this method will tend to produce smaller code, at the cost of the + /// ability to handle the panic. + /// This is intended to be used only in `Wasm` code, where panics cannot be + /// handled anyhow. + fn unwrap_abort(self) -> Self::Unwrap; +} + +#[cfg(not(feature = "hacspec"))] +/// Analogue of the `expect` methods on types such as [Option](https://doc.rust-lang.org/std/option/enum.Option.html), +/// but useful in a Wasm setting. +pub trait ExpectReport { + type Unwrap; + /// Like the default `expect` on, e.g., `Result`, but calling + /// [fail](macro.fail.html) with the given message, instead of `panic`. + fn expect_report(self, msg: &str) -> Self::Unwrap; +} + +#[cfg(not(feature = "hacspec"))] +/// Analogue of the `expect_err` methods on [Result](https://doc.rust-lang.org/std/result/enum.Result.html), +/// but useful in a Wasm setting. +pub trait ExpectErrReport { + type Unwrap; + /// Like the default `expect_err` on, e.g., `Result`, but calling + /// [fail](macro.fail.html) with the given message, instead of `panic`. + fn expect_err_report(self, msg: &str) -> Self::Unwrap; +} + +#[cfg(not(feature = "hacspec"))] +/// Analogue of the `expect_none` methods on [Option](https://doc.rust-lang.org/std/option/enum.Option.html), +/// but useful in a Wasm setting. +pub trait ExpectNoneReport { + /// Like the default `expect_none_report` on, e.g., `Option`, but calling + /// [fail](macro.fail.html) with the given message, instead of `panic`. + fn expect_none_report(self, msg: &str); +} + +#[cfg(not(feature = "hacspec"))] +/// The `SerialCtx` trait provides a means of writing structures into byte-sinks +/// (`Write`) using contextual information. +/// The contextual information is: +/// +/// - `size_length`: The number of bytes used to record the length of the +/// data. +pub trait SerialCtx { + /// Attempt to write the structure into the provided writer, failing if + /// if the length cannot be represented in the provided `size_length` or + /// only part of the structure could be written. + /// + /// NB: We use Result instead of Option for better composability with other + /// constructs. + fn serial_ctx( + &self, + size_length: schema::SizeLength, + out: &mut W, + ) -> Result<(), W::Err>; +} + +#[cfg(not(feature = "hacspec"))] +/// The `DeserialCtx` trait provides a means of reading structures from +/// byte-sources (`Read`) using contextual information. +/// The contextual information is: +/// +/// - `size_length`: The expected number of bytes used for the length of the +/// data. +/// - `ensure_ordered`: Whether the ordering should be ensured, for example +/// that keys in `BTreeMap` and `BTreeSet` are in strictly increasing order. +pub trait DeserialCtx: Sized { + /// Attempt to read a structure from a given source and context, failing if + /// an error occurs during deserialization or reading. + fn deserial_ctx( + size_length: schema::SizeLength, + ensure_ordered: bool, + source: &mut R, + ) -> ParseResult; +} diff --git a/concordium/src/concordium_types.rs b/concordium/src/concordium_types.rs new file mode 100644 index 0000000..e2ed836 --- /dev/null +++ b/concordium/src/concordium_types.rs @@ -0,0 +1,357 @@ +#[cfg(not(feature = "hacspec"))] +use crate::num::NonZeroI32; + +#[cfg(not(feature = "hacspec"))] +/// A type representing the constract state bytes. +#[derive(Default)] +pub struct ContractState { + pub(crate) current_position: u32, +} + +#[cfg(not(feature = "hacspec"))] +#[derive(Default)] +/// A type representing the parameter to init and receive methods. +pub struct Parameter { + pub(crate) current_position: u32, +} + +#[cfg(not(feature = "hacspec"))] +/// A type representing the attributes, lazily acquired from the host. +#[derive(Default)] +pub struct AttributesCursor { + /// Current position of the cursor, starting from 0. + /// Note that this is only for the variable attributes. + /// `created_at` and `valid_to` will require. + pub(crate) current_position: u32, + /// The number of remaining items in the policy. + pub(crate) remaining_items: u16, +} + +#[cfg(not(feature = "hacspec"))] +/// A type representing the logger. +#[derive(Default)] +pub struct Logger { + pub(crate) _private: (), +} + +// #[cfg(not(feature = "hacspec"))] +/// Errors that can occur during logging. +#[derive(Debug, Copy, Clone, Eq, PartialEq)] +#[repr(u8)] +pub enum LogError { + /// The log is full. + Full, + /// The message to log was malformed (e.g., too long) + Malformed, +} + +#[cfg(not(feature = "hacspec"))] +/// Error triggered when a non-zero amount of CCD is sent to a contract +/// init or receive function that is not marked as `payable`. +#[derive(Clone, Copy, Debug)] +pub struct NotPayableError; + +#[cfg(not(feature = "hacspec"))] +/// Actions that can be produced at the end of a contract execution. This +/// type is deliberately not cloneable so that we can enforce that +/// `and_then` and `or_else` can only be used when more than one event is +/// created. +/// +/// This type is marked as `must_use` since functions that produce +/// values of the type are effectful. +#[must_use] +pub struct Action { + pub(crate) _private: u32, +} + +#[cfg(not(feature = "hacspec"))] +impl Action { + pub fn tag(&self) -> u32 { + self._private + } +} + +#[cfg(not(feature = "hacspec"))] +/// An error message, signalling rejection of a smart contract invocation. +/// The client will see the error code as a reject reason; if a schema is +/// provided, the error message corresponding to the error code will be +/// displayed. The valid range for an error code is from i32::MIN to -1. +#[derive(Debug, Eq, PartialEq)] // TODO: Creusot issue re-add "Debug" attribute +#[repr(transparent)] +pub struct Reject { + pub error_code: NonZeroI32, +} + +#[cfg(not(feature = "hacspec"))] +/// Default error is i32::MIN. +impl Default for Reject { + #[inline(always)] + fn default() -> Self { + Self { + error_code: unsafe { NonZeroI32::new_unchecked(i32::MIN) }, + } + } +} + +#[cfg(not(feature = "hacspec"))] +impl Reject { + /// This returns `None` for all values >= 0 and `Some` otherwise. + pub fn new(x: i32) -> Option { + if x < 0 { + let error_code = unsafe { NonZeroI32::new_unchecked(x) }; + Some(Reject { error_code }) + } else { + None + } + } +} + +// Macros for failing a contract function + +#[cfg(not(feature = "hacspec"))] +/// The `bail` macro can be used for cleaner error handling. If the function has +/// result type `Result` invoking `bail` will terminate execution early with an +/// error. +/// If an argument is supplied, this will be used as the error, otherwise it +/// requires the type `E` in `Result<_, E>` to implement the `Default` trait. +#[macro_export] +macro_rules! bail { + () => {{ + return Err(Default::default()); + }}; + ($arg:expr) => {{ + // format_err!-like formatting + // logs are only retained in case of rejection when testing. + return Err($arg); + }}; +} + +#[cfg(not(feature = "hacspec"))] +/// The `ensure` macro can be used for cleaner error handling. It is analogous +/// to `assert`, but instead of panicking it uses `bail` to terminate execution +/// of the function early. +#[macro_export] +macro_rules! ensure { + ($p:expr) => { + if !$p { + $crate::bail!(); + } + }; + ($p:expr, $arg:expr) => {{ + if !$p { + $crate::bail!($arg); + } + }}; +} + +#[cfg(not(feature = "hacspec"))] +/// ## Variants of `ensure` for ease of use in certain contexts. +/// Ensure the first two arguments are equal, using `bail` otherwise. +#[macro_export] +macro_rules! ensure_eq { + ($l:expr, $r:expr) => { + $crate::ensure!($l == $r) + }; + ($l:expr, $r:expr, $arg:expr) => { + $crate::ensure!($l == $r, $arg) + }; +} + +#[cfg(not(feature = "hacspec"))] +#[macro_export] +/// Ensure the first two arguments are __not__ equal, using `bail` otherwise. +macro_rules! ensure_ne { + ($l:expr, $r:expr) => { + $crate::ensure!($l != $r) + }; + ($l:expr, $r:expr, $arg:expr) => { + $crate::ensure!($l != $r, $arg) + }; +} + +// Macros for failing a test + +#[cfg(not(feature = "hacspec"))] +/// The `fail` macro is used for testing as a substitute for the panic macro. +/// It reports back error information to the host. +/// Used only in testing. +#[cfg(feature = "std")] +#[macro_export] +macro_rules! fail { + () => { + { + $crate::test_infrastructure::report_error("", file!(), line!(), column!()); + panic!() + } + }; + ($($arg:tt),+) => { + { + let msg = format!($($arg),+); + $crate::test_infrastructure::report_error(&msg, file!(), line!(), column!()); + panic!("{}", msg) + } + }; +} + +#[cfg(not(feature = "hacspec"))] +/// The `fail` macro is used for testing as a substitute for the panic macro. +/// It reports back error information to the host. +/// Used only in testing. +#[cfg(not(feature = "std"))] +#[macro_export] +macro_rules! fail { + () => { + { + $crate::test_infrastructure::report_error("", file!(), line!(), column!()); + panic!() + } + }; + ($($arg:tt),+) => { + { + let msg = &$crate::alloc::format!($($arg),+); + $crate::test_infrastructure::report_error(&msg, file!(), line!(), column!()); + panic!("{}", msg) + } + }; +} + +#[cfg(not(feature = "hacspec"))] +/// The `claim` macro is used for testing as a substitute for the assert macro. +/// It checks the condition and if false it reports back an error. +/// Used only in testing. +#[macro_export] +macro_rules! claim { + ($cond:expr) => { + if !$cond { + $crate::fail!() + } + }; + ($cond:expr,) => { + if !$cond { + $crate::fail!() + } + }; + ($cond:expr, $($arg:tt),+) => { + if !$cond { + $crate::fail!($($arg),+) + } + }; +} + +#[cfg(not(feature = "hacspec"))] +/// Ensure the first two arguments are equal, just like `assert_eq!`, otherwise +/// reports an error. Used only in testing. +#[macro_export] +macro_rules! claim_eq { + ($left:expr, $right:expr) => { + $crate::claim!($left == $right, "left and right are not equal\nleft: {:?}\nright: {:?}", $left, $right) + }; + ($left:expr, $right:expr,) => { + $crate::claim_eq!($left, $right) + }; + ($left:expr, $right:expr, $($arg:tt),+) => { + $crate::claim!($left == $right, $($arg),+) + }; +} + +#[cfg(not(feature = "hacspec"))] +/// Ensure the first two arguments are *not* equal, just like `assert_ne!`, +/// otherwise reports an error. +/// Used only in testing. +#[macro_export] +macro_rules! claim_ne { + ($left:expr, $right:expr) => { + $crate::claim!($left != $right) + }; + ($left:expr, $right:expr,) => { + $crate::claim!($left != $right) + }; + ($left:expr, $right:expr, $($arg:tt),+) => { + $crate::claim!($left != $right, $($arg),+) + }; +} + +#[cfg(not(feature = "hacspec"))] +/// The expected return type of the receive method of a smart contract. +/// +/// Optionally, to define a custom type for error instead of using +/// Reject, allowing to track the reason for rejection, *but only in unit +/// tests*. +/// +/// See also the documentation for [bail!](macro.bail.html) for how to use +/// custom error types. +/// +/// # Example +/// Defining a custom error type +/// // ```rust +/// // enum MyCustomError { +/// // SomeError +/// // } +/// // +/// // #[receive(contract = "mycontract", name = "receive")] +/// // fn contract_receive( +/// // ctx: &R, +/// // receive_amount: Amount, +/// // logger: &mut L, +/// // state: &mut State, +/// // ) -> Result { ... } +/// // ``` +pub type ReceiveResult = Result; + +#[cfg(not(feature = "hacspec"))] +/// The expected return type of the init method of the smart contract, +/// parametrized by the state type of the smart contract. +/// +/// Optionally, to define a custom type for error instead of using Reject, +/// allowing the track the reason for rejection, *but only in unit tests*. +/// +/// See also the documentation for [bail!](macro.bail.html) for how to use +/// custom error types. +/// +/// # Example +/// Defining a custom error type +/// // ```rust +/// // enum MyCustomError { +/// // SomeError +/// // } +/// // +/// // #[init(contract = "mycontract")] +/// // fn contract_init( +/// // ctx: &R, +/// // receive_amount: Amount, +/// // logger: &mut L, +/// // ) -> Result { ... } +/// // ``` +pub type InitResult = Result; + +#[cfg(not(feature = "hacspec"))] +/// Context backed by host functions. +#[derive(Default)] +#[doc(hidden)] +pub struct ExternContext { + marker: crate::marker::PhantomData, +} + +#[cfg(not(feature = "hacspec"))] +#[doc(hidden)] +pub struct ChainMetaExtern {} + +#[cfg(not(feature = "hacspec"))] +#[derive(Default)] +#[doc(hidden)] +pub struct InitContextExtern; +#[cfg(not(feature = "hacspec"))] +#[derive(Default)] +#[doc(hidden)] +pub struct ReceiveContextExtern; + +#[cfg(not(feature = "hacspec"))] +pub(crate) mod sealed { + use super::*; + /// Marker trait intended to indicate which context type we have. + /// This is deliberately a sealed trait, so that it is only implementable + /// by types in this crate. + pub trait ContextType {} + impl ContextType for InitContextExtern {} + impl ContextType for ReceiveContextExtern {} +} diff --git a/concordium/src/constants.rs b/concordium/src/constants.rs new file mode 100644 index 0000000..23d5262 --- /dev/null +++ b/concordium/src/constants.rs @@ -0,0 +1,8 @@ +/// Maximum size of the contract state in bytes. +pub const MAX_CONTRACT_STATE_SIZE: u32 = 16384u32; + +/// Maximum log size. +pub const MAX_LOG_SIZE: usize = 512usize; + +/// Maximum number of log items. +pub const MAX_NUM_LOGS: usize = 64usize; diff --git a/concordium/src/test_infrastructure.rs b/concordium/src/test_infrastructure.rs new file mode 100644 index 0000000..9126af6 --- /dev/null +++ b/concordium/src/test_infrastructure.rs @@ -0,0 +1,839 @@ +//! The test infrastructure module provides alternative implementations of +//! `HasInitContext`, `HasReceiveContext`, `HasParameter`, `HasActions`, and +//! `HasContractState` traits intended for testing. +//! +//! They allow writing unit tests directly in contract modules with little to no +//! external tooling, depending on what is required. +//! +//! +//! # Example +//! +//! ```rust +//! // Some contract +//! #[init(contract = "noop")] +//! fn contract_init( +//! ctx: &I, +//! ) -> InitResult { ... } +//! +//! #[receive(contract = "noop", name = "receive", payable, enable_logger)] +//! fn contract_receive( +//! ctx: &R, +//! amount: Amount, +//! logger: &mut L, +//! state: &mut State, +//! ) -> ReceiveResult { ... } +//! +//! #[cfg(test)] +//! mod tests { +//! use super::*; +//! use concordium_sc_base::test_infrastructure::*; +//! #[test] +//! fn test_init() { +//! let mut ctx = InitContextTest::empty(); +//! ctx.set_init_origin(AccountAddress([0u8; 32])); +//! ... +//! let result = contract_init(&ctx); +//! claim!(...) +//! ... +//! } +//! +//! #[test] +//! fn test_receive() { +//! let mut ctx = ReceiveContextTest::empty(); +//! ctx.set_owner(AccountAddress([0u8; 32])); +//! ... +//! let mut logger = LogRecorder::init(); +//! let result: ReceiveResult = contract_receive(&ctx, 0, &mut logger, state); +//! claim!(...) +//! ... +//! } +//! } +//! ``` +#[cfg(not(feature = "hacspec"))] +use crate::{constants::MAX_CONTRACT_STATE_SIZE, *}; + +#[cfg(not(feature = "hacspec"))] +#[cfg(not(feature = "std"))] +use alloc::boxed::Box; +#[cfg(not(feature = "hacspec"))] +use convert::TryInto; +#[cfg(not(feature = "hacspec"))] +#[cfg(not(feature = "std"))] +use core::{cmp, num}; +#[cfg(not(feature = "hacspec"))] +#[cfg(feature = "std")] +use std::{boxed::Box, cmp, num}; + +#[cfg(not(feature = "hacspec"))] +/// Placeholder for the context chain meta data. +/// All the fields are optionally set and the getting an unset field will result +/// in test failing. +/// For most cases it is used as part of either +/// [`InitContextTest`](struct.InitContextTest.html) or +/// [`ReceiveContextTest`](struct.ReceiveContextTest.html). +/// Use only in unit tests! +/// +/// Defaults to having all of the fields unset +#[derive(Default, Clone)] +pub struct ChainMetaTest { + pub(crate) slot_time: Option, +} + +#[cfg(not(feature = "hacspec"))] +/// Policy type used by init and receive contexts for testing. +/// This type should not be used directly, but rather through +/// its `HasPolicy` interface. +#[derive(Debug, Clone)] +pub struct TestPolicy { + /// Current position in the vector of policies. Used to implement + /// `next_item`. + position: usize, + policy: OwnedPolicy, +} + +#[cfg(not(feature = "hacspec"))] +impl TestPolicy { + fn new(policy: OwnedPolicy) -> Self { + Self { + position: 0, + policy, + } + } +} + +#[cfg(not(feature = "hacspec"))] +/// Placeholder for the common data shared between the `InitContext` and +/// `ReceiveContext`. This type is a technicality, see `InitContext` and +/// `ReceiveContext` for the types to use. +/// +/// # Default +/// Defaults to having all the fields unset, and constructing +/// [`ChainMetaTest`](struct.ChainMetaTest.html) using default. +#[derive(Default, Clone)] +#[doc(hidden)] +pub struct CommonDataTest<'a> { + pub(crate) metadata: ChainMetaTest, + pub(crate) parameter: Option<&'a [u8]>, + /// Policy of the creator. We keep the `Option` wrapper + /// in order that the user can be warned that they are using a policy. + /// Thus there is a distinction between `Some(Vec::new())` and `None`. + pub(crate) policies: Option>, +} + +#[cfg(not(feature = "hacspec"))] +/// Context used for testing. The type parameter C is used to determine whether +/// this will be an init or receive context. +#[derive(Default, Clone)] +pub struct ContextTest<'a, C> { + pub(crate) common: CommonDataTest<'a>, + pub(crate) custom: C, +} + +/// Placeholder for the initial context. All the fields can be set optionally +/// and the getting an unset field will result in calling +/// [`fail!`](../macro.fail.html). Use only in tests! +/// +/// # Setters +/// Every field has a setter function prefixed with `set_`. + +/// ### Example +/// Creating an empty context and setting the `init_origin`. +/// ``` +/// let mut ctx = InitContextTest::empty(); +/// ctx.set_init_origin(AccountAddress([0u8; 32])); +/// ``` +/// ## Set chain meta data +/// Chain meta data is set using setters on the context or by setters on a +/// mutable reference of [`ChainMetaTest`](struct.ChainMetaTest.html). +/// +/// ### Example +/// Creating an empty context and setting the `slot_time` metadata. +/// ``` +/// let mut ctx = InitContextTest::empty(); +/// ctx.set_metadata_slot_time(1609459200); +/// ``` +/// or +/// ``` +/// let mut ctx = InitContextTest::empty(); +/// ctx.metadata_mut().set_slot_time(1609459200); +/// ``` +/// +/// # Use case example +/// +/// ```rust +/// #[init(contract = "noop")] +/// fn contract_init( +/// ctx: &I, +/// _amount: Amount, +/// _logger: &mut L, +/// ) -> InitResult<()> { +/// let init_origin = ctx.init_origin(); +/// let parameter: SomeParameterType = ctx.parameter_cursor().get()?; +/// Ok(()) +/// } +/// +/// #[cfg(test)] +/// mod tests { +/// use super::*; +/// use concordium_sc_base::test_infrastructure::*; +/// #[test] +/// fn test() { +/// let mut ctx = InitContextTest::empty(); +/// ctx.set_init_origin(AccountAddress([0u8; 32])); +/// ... +/// let result = contract_init(&ctx, 0, &mut logger); +/// // Reads the init_origin without any problems. +/// // But then fails because the parameter is not set. +/// } +/// } +/// ``` +#[cfg(not(feature = "hacspec"))] +pub type InitContextTest<'a> = ContextTest<'a, InitOnlyDataTest>; + +#[cfg(not(feature = "hacspec"))] +#[derive(Default)] +#[doc(hidden)] +pub struct InitOnlyDataTest { + init_origin: Option, +} + +/// Placeholder for the receiving context. All the fields can be set optionally +/// and the getting an unset field will result in calling +/// [`fail!`](../macro.fail.html). Use only in tests! +/// +/// # Setters +/// Every field have a setter function prefixed with `set_`. +/// +/// ### Example +/// Creating an empty context and setting the `init_origin`. +/// ``` +/// let owner = AccountAddress([0u8; 32]); +/// let mut ctx = ReceiveContextTest::empty(); +/// ctx.set_owner(owner); +/// ctx.set_sender(Address::Account(owner)); +/// ``` +/// ## Set chain meta data +/// Chain meta data is set using setters on the context or by setters on a +/// mutable reference of [`ChainMetaTest`](struct.ChainMetaTest.html). +/// +/// ### Example +/// Creating an empty context and setting the `slot_time` metadata. +/// ``` +/// let mut ctx = ReceiveContextTest::empty(); +/// ctx.set_metadata_slot_time(1609459200); +/// ``` +/// or +/// ``` +/// let mut ctx = ReceiveContextTest::empty(); +/// ctx.metadata_mut().set_slot_time(1609459200); +/// ``` +/// +/// # Use case example +/// Creating a context for running unit tests +/// ```rust +/// #[receive(contract = "mycontract", name = "receive")] +/// fn contract_receive( +/// ctx: &R, +/// amount: Amount, +/// logger: &mut L, +/// state: &mut State, +/// ) -> ReceiveResult { +/// ensure!(ctx.sender().matches_account(&ctx.owner()), "Only the owner can increment."); +/// Ok(A::accept()) +/// } +/// +/// #[cfg(test)] +/// mod tests { +/// use super::*; +/// use concordium_sc_base::test_infrastructure::*; +/// #[test] +/// fn test() { +/// let owner = AccountAddress([0u8; 32]); +/// let mut ctx = ReceiveContextTest::empty(); +/// ctx.set_owner(owner); +/// ctx.set_sender(Address::Account(owner)); +/// ... +/// let result: ReceiveResult = contract_receive(&ctx, 0, &mut logger, state); +/// } +/// } +/// ``` +#[cfg(not(feature = "hacspec"))] +pub type ReceiveContextTest<'a> = ContextTest<'a, ReceiveOnlyDataTest>; + +#[cfg(not(feature = "hacspec"))] +#[derive(Default)] +#[doc(hidden)] +pub struct ReceiveOnlyDataTest { + pub(crate) invoker: Option, + pub(crate) self_address: Option, + pub(crate) self_balance: Option, + pub(crate) sender: Option
, + pub(crate) owner: Option, +} + +#[cfg(not(feature = "hacspec"))] +// Setters for testing-context +impl ChainMetaTest { + /// Create an `ChainMetaTest` where every field is unset, and getting any of + /// the fields will result in [`fail!`](../macro.fail.html). + pub fn empty() -> Self { Default::default() } + + /// Set the block slot time + pub fn set_slot_time(&mut self, value: SlotTime) -> &mut Self { + self.slot_time = Some(value); + self + } +} + +#[cfg(not(feature = "hacspec"))] +impl<'a, C> ContextTest<'a, C> { + /// Push a new sender policy to the context. + /// When the first policy is pushed this will set the policy vector + /// to 'Some', even if it was undefined previously. + pub fn push_policy(&mut self, value: OwnedPolicy) -> &mut Self { + if let Some(policies) = self.common.policies.as_mut() { + policies.push(TestPolicy::new(value)); + } else { + self.common.policies = Some(vec![TestPolicy::new(value)]) + } + self + } + + /// Set the policies to be defined, but an empty list. + /// Such a situation can not realistically happen on the chain, + /// but we provide functionality for it in case smart contract + /// writers wish to program defensively. + pub fn empty_policies(&mut self) -> &mut Self { + self.common.policies = Some(Vec::new()); + self + } + + pub fn set_parameter(&mut self, value: &'a [u8]) -> &mut Self { + self.common.parameter = Some(value); + self + } + + /// Get a mutable reference to the chain meta data placeholder + pub fn metadata_mut(&mut self) -> &mut ChainMetaTest { &mut self.common.metadata } + + /// Set the metadata block slot time + pub fn set_metadata_slot_time(&mut self, value: SlotTime) -> &mut Self { + self.metadata_mut().set_slot_time(value); + self + } +} + +#[cfg(not(feature = "hacspec"))] +impl<'a> InitContextTest<'a> { + /// Create an `InitContextTest` where every field is unset, and getting any + /// of the fields will result in [`fail!`](../macro.fail.html). + pub fn empty() -> Self { Default::default() } + + /// Set `init_origin` in the `InitContextTest` + pub fn set_init_origin(&mut self, value: AccountAddress) -> &mut Self { + self.custom.init_origin = Some(value); + self + } +} + +#[cfg(not(feature = "hacspec"))] +impl<'a> ReceiveContextTest<'a> { + /// Create a `ReceiveContextTest` where every field is unset, and getting + /// any of the fields will result in [`fail!`](../macro.fail.html). + pub fn empty() -> Self { Default::default() } + + pub fn set_invoker(&mut self, value: AccountAddress) -> &mut Self { + self.custom.invoker = Some(value); + self + } + + pub fn set_self_address(&mut self, value: ContractAddress) -> &mut Self { + self.custom.self_address = Some(value); + self + } + + pub fn set_self_balance(&mut self, value: Amount) -> &mut Self { + self.custom.self_balance = Some(value); + self + } + + pub fn set_sender(&mut self, value: Address) -> &mut Self { + self.custom.sender = Some(value); + self + } + + pub fn set_owner(&mut self, value: AccountAddress) -> &mut Self { + self.custom.owner = Some(value); + self + } +} + +#[cfg(not(feature = "hacspec"))] +// Error handling when unwrapping +fn unwrap_ctx_field(opt: Option, name: &str) -> A { + match opt { + Some(v) => v, + None => fail!( + "Unset field on test context '{}', make sure to set all the field necessary for the \ + contract", + name + ), + } +} + +#[cfg(not(feature = "hacspec"))] +// Getters for testing-context +impl HasChainMetadata for ChainMetaTest { + fn slot_time(&self) -> SlotTime { unwrap_ctx_field(self.slot_time, "metadata.slot_time") } +} + +#[cfg(not(feature = "hacspec"))] +impl HasPolicy for TestPolicy { + fn identity_provider(&self) -> IdentityProvider { self.policy.identity_provider } + + fn created_at(&self) -> Timestamp { self.policy.created_at } + + fn valid_to(&self) -> Timestamp { self.policy.valid_to } + + fn next_item(&mut self, buf: &mut [u8; 31]) -> Option<(AttributeTag, u8)> { + if let Some(item) = self.policy.items.get(self.position) { + let len = item.1.len(); + buf[0..len].copy_from_slice(&item.1); + self.position += 1; + Some((item.0, len as u8)) + } else { + None + } + } +} + +#[cfg(not(feature = "hacspec"))] +impl<'a, C> HasCommonData for ContextTest<'a, C> { + type MetadataType = ChainMetaTest; + type ParamType = Cursor<&'a [u8]>; + type PolicyIteratorType = crate::vec::IntoIter; + type PolicyType = TestPolicy; + + fn parameter_cursor(&self) -> Self::ParamType { + Cursor::new(unwrap_ctx_field(self.common.parameter, "parameter")) + } + + fn metadata(&self) -> &Self::MetadataType { &self.common.metadata } + + fn policies(&self) -> Self::PolicyIteratorType { + unwrap_ctx_field(self.common.policies.clone(), "policies").into_iter() + } +} + +#[cfg(not(feature = "hacspec"))] +impl<'a> HasInitContext for InitContextTest<'a> { + type InitData = (); + + fn open(_data: Self::InitData) -> Self { InitContextTest::default() } + + fn init_origin(&self) -> AccountAddress { + unwrap_ctx_field(self.custom.init_origin, "init_origin") + } +} + +#[cfg(not(feature = "hacspec"))] +impl<'a> HasReceiveContext for ReceiveContextTest<'a> { + type ReceiveData = (); + + fn open(_data: Self::ReceiveData) -> Self { ReceiveContextTest::default() } + + fn invoker(&self) -> AccountAddress { unwrap_ctx_field(self.custom.invoker, "invoker") } + + fn self_address(&self) -> ContractAddress { + unwrap_ctx_field(self.custom.self_address, "self_address") + } + + fn self_balance(&self) -> Amount { unwrap_ctx_field(self.custom.self_balance, "self_balance") } + + fn sender(&self) -> Address { unwrap_ctx_field(self.custom.sender, "sender") } + + fn owner(&self) -> AccountAddress { unwrap_ctx_field(self.custom.owner, "owner") } +} + +#[cfg(not(feature = "hacspec"))] +impl<'a> HasParameter for Cursor<&'a [u8]> { + fn size(&self) -> u32 { self.data.len() as u32 } +} + +/// A logger that simply accumulates all the logged items to be inspected at the +/// end of execution. +#[cfg(not(feature = "hacspec"))] +pub struct LogRecorder { + pub logs: Vec>, +} + +#[cfg(not(feature = "hacspec"))] +impl HasLogger for LogRecorder { + fn init() -> Self { + Self { + logs: Vec::new(), + } + } + + fn log_raw(&mut self, event: &[u8]) -> Result<(), LogError> { + if event.len() > constants::MAX_LOG_SIZE { + return Err(LogError::Malformed); + } + if self.logs.len() >= constants::MAX_NUM_LOGS { + return Err(LogError::Full); + } + self.logs.push(event.to_vec()); + Ok(()) + } +} + +#[cfg(not(feature = "hacspec"))] +/// An actions tree, used to provide a simpler presentation for testing. +#[derive(Eq, PartialEq, Debug)] +pub enum ActionsTree { + Accept, + SimpleTransfer { + to: AccountAddress, + amount: Amount, + }, + Send { + to: ContractAddress, + receive_name: OwnedReceiveName, + amount: Amount, + parameter: Vec, + }, + AndThen { + left: Box, + right: Box, + }, + OrElse { + left: Box, + right: Box, + }, +} + +#[cfg(not(feature = "hacspec"))] +impl HasActions for ActionsTree { + fn accept() -> Self { ActionsTree::Accept } + + fn simple_transfer(acc: &AccountAddress, amount: Amount) -> Self { + ActionsTree::SimpleTransfer { + to: *acc, + amount, + } + } + + fn send_raw( + ca: &ContractAddress, + receive_name: ReceiveName, + amount: Amount, + parameter: &[u8], + ) -> Self { + ActionsTree::Send { + to: *ca, + receive_name: receive_name.to_owned(), + amount, + parameter: parameter.to_vec(), + } + } + + fn and_then(self, then: Self) -> Self { + ActionsTree::AndThen { + left: Box::new(self), + right: Box::new(then), + } + } + + fn or_else(self, el: Self) -> Self { + ActionsTree::OrElse { + left: Box::new(self), + right: Box::new(el), + } + } +} + +#[cfg(not(feature = "hacspec"))] +/// Reports back an error to the host when compiled to wasm +/// Used internally, not meant to be called directly by contract writers +#[doc(hidden)] +#[cfg(all(feature = "wasm-test", target_arch = "wasm32"))] +pub fn report_error(message: &str, filename: &str, line: u32, column: u32) { + let msg_bytes = message.as_bytes(); + let filename_bytes = filename.as_bytes(); + unsafe { + crate::prims::report_error( + msg_bytes.as_ptr(), + msg_bytes.len() as u32, + filename_bytes.as_ptr(), + filename_bytes.len() as u32, + line, + column, + ) + }; +} + +#[cfg(not(feature = "hacspec"))] +/// Reports back an error to the host when compiled to wasm +/// Used internally, not meant to be called directly by contract writers +#[doc(hidden)] +#[cfg(not(all(feature = "wasm-test", target_arch = "wasm32")))] +pub fn report_error(_message: &str, _filename: &str, _line: u32, _column: u32) {} + +/// Contract state for testing, mimicking the operations the scheduler allows, +/// including the limit on the size of the maximum size of the contract state. +#[cfg(not(feature = "hacspec"))] +pub struct ContractStateTest { + pub cursor: Cursor, +} + +#[cfg(not(feature = "hacspec"))] +/// A borrowed instantiation of `ContractStateTest`. +pub type ContractStateTestBorrowed<'a> = ContractStateTest<&'a mut Vec>; + +#[cfg(not(feature = "hacspec"))] +/// An owned variant that can be more convenient for testing since the type +/// itself owns the data. +pub type ContractStateTestOwned = ContractStateTest>; + +#[cfg(not(feature = "hacspec"))] +#[derive(Debug, PartialEq, Eq)] +/// An error that is raised when operating with `Seek`, `Write`, or `Read` trait +/// methods of the `ContractStateTest` type. +pub enum ContractStateError { + /// The computation of the new offset would result in an overflow. + Overflow, + /// An error occurred when writing to the contract state. + Write, + /// The new offset would be out of bounds of the state. + Offset, + /// Some other error occurred. + Default, +} + +#[cfg(not(feature = "hacspec"))] +impl> Read for ContractStateTest { + fn read(&mut self, buf: &mut [u8]) -> ParseResult { self.cursor.read(buf) } +} + +#[cfg(not(feature = "hacspec"))] +impl>> Write for ContractStateTest { + type Err = ContractStateError; + + fn write(&mut self, buf: &[u8]) -> Result { + // The chain automatically resizes the state up until MAX_CONTRACT_STATE_SIZE. + let end = cmp::min(MAX_CONTRACT_STATE_SIZE as usize, self.cursor.offset + buf.len()); + if self.cursor.data.as_mut().len() < end { + self.cursor.data.as_mut().resize(end as usize, 0u8); + } + let data = &mut self.cursor.data.as_mut()[self.cursor.offset..]; + let to_write = cmp::min(data.len(), buf.len()); + data[..to_write].copy_from_slice(&buf[..to_write]); + self.cursor.offset += to_write; + Ok(to_write) + } +} + +#[cfg(not(feature = "hacspec"))] +impl> + AsMut<[u8]> + AsRef<[u8]>> HasContractState + for ContractStateTest +{ + type ContractStateData = T; + + fn open(data: Self::ContractStateData) -> Self { + Self { + cursor: Cursor::new(data), + } + } + + fn size(&self) -> u32 { self.cursor.data.as_ref().len() as u32 } + + fn truncate(&mut self, new_size: u32) { + if self.size() > new_size { + let new_size = new_size as usize; + let data: &mut Vec = self.cursor.data.as_mut(); + data.truncate(new_size); + if self.cursor.offset > new_size { + self.cursor.offset = new_size + } + } + } + + fn reserve(&mut self, len: u32) -> bool { + if len <= constants::MAX_CONTRACT_STATE_SIZE { + if self.size() < len { + let data: &mut Vec = self.cursor.data.as_mut(); + data.resize(len as usize, 0u8); + } + true + } else { + false + } + } +} + +#[cfg(not(feature = "hacspec"))] +impl Default for ContractStateError { + fn default() -> Self { Self::Default } +} + +#[cfg(not(feature = "hacspec"))] +impl From for ContractStateError { + fn from(_: num::TryFromIntError) -> Self { ContractStateError::Overflow } +} + +#[cfg(not(feature = "hacspec"))] +impl> Seek for ContractStateTest { + type Err = ContractStateError; + + fn seek(&mut self, pos: SeekFrom) -> Result { + use ContractStateError::*; + match pos { + SeekFrom::Start(x) => { + // We can set the position to just after the end of the current length. + let new_offset = x.try_into()?; + if new_offset <= self.cursor.data.as_ref().len() { + self.cursor.offset = new_offset; + Ok(x) + } else { + Err(Offset) + } + } + SeekFrom::End(x) => { + // cannot seek beyond end, nor before beginning + if x <= 0 { + let end: u32 = self.cursor.data.as_ref().len().try_into()?; + let minus_x = x.checked_abs().ok_or(Overflow)?; + if let Some(new_pos) = end.checked_sub(minus_x.try_into()?) { + self.cursor.offset = new_pos.try_into()?; + Ok(u64::from(new_pos)) + } else { + Err(Offset) + } + } else { + Err(Offset) + } + } + SeekFrom::Current(x) => match x { + 0 => Ok(self.cursor.offset.try_into()?), + x if x > 0 => { + let x = x.try_into()?; + let new_pos = self.cursor.offset.checked_add(x).ok_or(Overflow)?; + if new_pos <= self.cursor.data.as_ref().len() { + self.cursor.offset = new_pos; + new_pos.try_into().map_err(Self::Err::from) + } else { + Err(Offset) + } + } + x => { + let x = (-x).try_into()?; + let new_pos = self.cursor.offset.checked_sub(x).ok_or(Overflow)?; + self.cursor.offset = new_pos; + new_pos.try_into().map_err(Self::Err::from) + } + }, + } + } +} + +#[cfg(not(feature = "hacspec"))] +#[cfg(test)] +mod test { + use concordium_contracts_common::{Read, Seek, SeekFrom, Write}; + + use super::ContractStateTest; + use crate::{constants, traits::HasContractState}; + + #[test] + // Perform a number of operations from Seek, Read, Write and HasContractState + // classes on the ContractStateTest structure and check that they behave as + // specified. + fn test_contract_state() { + let data = vec![1; 100]; + let mut state = ContractStateTest::open(data); + assert_eq!(state.seek(SeekFrom::Start(100)), Ok(100), "Seeking to the end failed."); + assert_eq!( + state.seek(SeekFrom::Current(0)), + Ok(100), + "Seeking from current position with offset 0 failed." + ); + assert!( + state.seek(SeekFrom::Current(1)).is_err(), + "Seeking from current position with offset 1 succeeded." + ); + assert_eq!(state.cursor.offset, 100, "Cursor position changed on failed seek."); + assert_eq!( + state.seek(SeekFrom::Current(-1)), + Ok(99), + "Seeking from current position backwards with offset 1 failed." + ); + assert!(state.seek(SeekFrom::Current(-100)).is_err(), "Seeking beyond beginning succeeds"); + assert_eq!(state.seek(SeekFrom::Current(-99)), Ok(0), "Seeking to the beginning fails."); + assert_eq!(state.seek(SeekFrom::End(0)), Ok(100), "Seeking from end fails."); + assert!( + state.seek(SeekFrom::End(1)).is_err(), + "Seeking beyond the end succeeds but should fail." + ); + assert_eq!(state.cursor.offset, 100, "Cursor position changed on failed seek."); + assert_eq!( + state.seek(SeekFrom::End(-20)), + Ok(80), + "Seeking from end leads to incorrect position." + ); + assert_eq!(state.write(&[0; 21]), Ok(21), "Writing writes an incorrect amount of data."); + assert_eq!(state.cursor.offset, 101, "After writing the cursor is at the end."); + assert_eq!(state.write(&[0; 21]), Ok(21), "Writing again writes incorrect amount of data."); + let mut buf = [0; 30]; + assert_eq!(state.read(&mut buf), Ok(0), "Reading from the end should read 0 bytes."); + assert_eq!(state.seek(SeekFrom::End(-20)), Ok(102)); + assert_eq!(state.read(&mut buf), Ok(20), "Reading from offset 80 should read 20 bytes."); + assert_eq!(&buf[0..20], &state.cursor.data[80..100], "Incorrect data was read."); + assert_eq!( + state.cursor.offset, 122, + "After reading the offset is in the correct position." + ); + assert!(state.reserve(222), "Could not increase state to 222."); + assert!( + !state.reserve(constants::MAX_CONTRACT_STATE_SIZE + 1), + "State should not be resizable beyond max limit." + ); + assert_eq!(state.write(&[2; 100]), Ok(100), "Should have written 100 bytes."); + assert_eq!(state.cursor.offset, 222, "After writing the offset should be 200."); + state.truncate(50); + assert_eq!(state.cursor.offset, 50, "After truncation the state should be 50."); + assert!(state.reserve(constants::MAX_CONTRACT_STATE_SIZE), "Could not increase state MAX."); + assert_eq!( + state.seek(SeekFrom::End(0)), + Ok(u64::from(constants::MAX_CONTRACT_STATE_SIZE)), + "State should be full now." + ); + assert_eq!( + state.write(&[1; 1000]), + Ok(0), + "Writing at the end after truncation should do nothing." + ); + assert_eq!( + state.cursor.data.len(), + constants::MAX_CONTRACT_STATE_SIZE as usize, + "State size should not increase beyond max." + ) + } + + #[test] + fn test_contract_state_write() { + let data = vec![0u8; 10]; + let mut state = ContractStateTest::open(data); + assert_eq!(state.write(&1u64.to_le_bytes()), Ok(8), "Incorrect number of bytes written."); + assert_eq!( + state.write(&2u64.to_le_bytes()), + Ok(8), + "State should be resized automatically." + ); + assert_eq!(state.cursor.offset, 16, "Pos should be at the end."); + assert_eq!( + state.cursor.data, + vec![1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0], + "Correct data was written." + ); + } +} diff --git a/ovn/Cargo.toml b/ovn/Cargo.toml index 5c6b9f3..902d95c 100644 --- a/ovn/Cargo.toml +++ b/ovn/Cargo.toml @@ -11,8 +11,12 @@ path = "src/ovn_smart.rs" # hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } # creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "1cca2320e262b2ec9d28b3c84cba759c96829898" } # branch = master # concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850" , version = "=2.0.0" , default-features = false } # 0cffb859f736ff6726fa38600428a415d800d7b6 -concordium-std = { git = "https://github.com/Concordium/concordium-rust-smart-contracts", rev = "4d4b024b547a1f120f6d6951cbc409c94f8f146a" , version = "*" , default-features = false } # 0cffb859f736ff6726fa38600428a415d800d7b6 -concordium-std-derive = { git = "https://github.com/Concordium/concordium-rust-smart-contracts", rev = "4d4b024b547a1f120f6d6951cbc409c94f8f146a" , version = "*" , default-features = false } # 0cffb859f736ff6726fa38600428a415d800d7b6 + +# concordium-std = { git = "https://github.com/Concordium/concordium-rust-smart-contracts", rev = "4d4b024b547a1f120f6d6951cbc409c94f8f146a" , version = "*" , default-features = false } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a +# concordium-std-derive = { git = "https://github.com/Concordium/concordium-rust-smart-contracts", rev = "4d4b024b547a1f120f6d6951cbc409c94f8f146a" , version = "*" , default-features = false } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a + +hacspec-concordium = { path = "../concordium" } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a +hacspec-concordium-derive = { path = "../concordium-derive" } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a quickcheck = "1" quickcheck_macros = "1" diff --git a/ovn/concordium.org b/ovn/concordium.org new file mode 100644 index 0000000..41ef0e6 --- /dev/null +++ b/ovn/concordium.org @@ -0,0 +1,4786 @@ +#+TITLE: Concordium Smartcontract Infrastructure Implementations +#+AUTHOR: Lasse Letager Hansen + +# (rev: 4d4b024b547a1f120f6d6951cbc409c94f8f146a) + +#+HTML_HEAD: +#+PROPERTY: header-args:coq :session *Coq* + +# C-c C-v t - export this files +# C-c C-v b - create results / run this file +# C-c C-v s - create results / run subtree + +* General information +:PROPERTIES: +:header-args: sh :eval never :results output silent +:END: +** Resulting output +#+begin_src sh +cargo clean +#+end_src + +#+begin_src sh +cargo install --path language +#+end_src + +#+begin_src sh +cargo build +#+end_src + +#+begin_src sh +cargo hacspec -e v --dir coq/src --org-file concordium.org hacspec-concordium --vc-update --vc-dir coq/_vc +#+end_src + +* Concordium specification +** Config +#+BEGIN_SRC toml :tangle ../concordium/Cargo.toml :mkdirp yes :eval never +[package] +name = "hacspec-concordium" +version = "0.1.0" +authors = [""] +edition = "2018" + +[lib] +path = "src/concordium.rs" + +[dependencies] +hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } +# hacspec-attributes = { path = "../../utils/attributes", version = "0.1.0-beta.1" , features = ["print_attributes", "hacspec_unsafe"] } # , features = ["hacspec_unsafe"] , , optional = true +creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "7763b3ae77205fba83182b9a6c3e69ad0b12fec7" } +concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850", version = "=2.0.0", default-features = false } +hacspec-concordium-derive = { path = "../concordium-derive" } + +# Reduce code size, at the cost of performance in allocation heavy-code. +wee_alloc="0.4.5" + +# [features] +# use_attributes = ["hacspec-attributes/print_attributes", "hacspec-attributes/hacspec_unsafe"] + +[dev-dependencies] +# hacspec-dev = { path = "../../utils/dev" } +criterion = "0.3" +rand = "0.8" +quickcheck = "1" +quickcheck_macros = "1" +#+END_SRC +*** Imports +#+BEGIN_SRC rust :tangle ../concordium/src/concordium.rs :mkdirp yes :eval never +#![cfg_attr( + not(feature = "std"), + no_std, + feature(alloc_error_handler, core_intrinsics) +)] + +#[cfg(not(feature = "hacspec"))] +#[cfg(not(feature = "std"))] +pub extern crate alloc; + +// TODO: +// #[cfg(not(feature = "hacspec"))] +// #[cfg(not(feature = "std"))] +// #[alloc_error_handler] +// fn on_oom(_layout: alloc::alloc::Layout) -> ! { +// #[cfg(target_arch = "wasm32")] +// unsafe { +// core::arch::wasm32::unreachable() +// } +// #[cfg(not(target_arch = "wasm32"))] +// loop {} +// } + +/// Terminate execution immediately without panicking. +/// When the `std` feature is enabled this is just [std::process::abort](https://doc.rust-lang.org/std/process/fn.abort.html). +/// When `std` is not present and the target architecture is `wasm32` this will +/// simply emit the [unreachable](https://doc.rust-lang.org/core/arch/wasm32/fn.unreachable.html) instruction. +#[cfg(not(feature = "hacspec"))] +#[cfg(feature = "std")] +pub use std::process::abort as trap; +#[cfg(not(feature = "hacspec"))] +#[cfg(all(not(feature = "std"), target_arch = "wasm32"))] +#[inline(always)] +pub fn trap() -> ! { + unsafe { core::arch::wasm32::unreachable() } +} +#[cfg(not(feature = "hacspec"))] +#[cfg(all(not(feature = "std"), not(target_arch = "wasm32")))] +#[inline(always)] +pub fn trap() -> ! { + core::intrinsics::abort() +} + +// TODO: +// #[cfg(not(feature = "hacspec"))] +// #[cfg(not(feature = "std"))] +// #[panic_handler] +// fn abort_panic(_info: &core::panic::PanicInfo) -> ! { +// #[cfg(target_arch = "wasm32")] +// unsafe { +// core::arch::wasm32::unreachable() +// } +// #[cfg(not(target_arch = "wasm32"))] +// loop {} +// } + +// Provide some re-exports to make it easier to use the library. +// This should be expanded in the future. +/// Re-export. +#[cfg(not(feature = "hacspec"))] +#[cfg(not(feature = "std"))] +pub use alloc::{borrow::ToOwned, string, string::String, string::ToString, vec, vec::Vec}; +/// Re-export. +#[cfg(not(feature = "hacspec"))] +#[cfg(not(feature = "std"))] +pub use core::{convert, hash, marker, mem, num, result::*}; +#[cfg(not(feature = "hacspec"))] +#[cfg(feature = "std")] +pub(crate) use std::vec; + +/// Re-export. +#[cfg(not(feature = "hacspec"))] +#[cfg(feature = "std")] +pub use std::{convert, hash, marker, mem, num, string::String, vec::Vec}; + +#[cfg(not(feature = "hacspec"))] +#[cfg(not(feature = "std"))] +pub use alloc::collections; +#[cfg(not(feature = "hacspec"))] +#[cfg(feature = "std")] +pub use std::collections; + +pub mod constants; +mod concordium_prims; +mod concordium_types; +mod concordium_traits; +mod concordium_impls; + +pub mod test_infrastructure; + +use concordium_prims::*; // TODO: Does not re-export anything, nothing is public enough (removed pub) +pub use concordium_types::*; +pub use concordium_traits::*; +pub use concordium_impls::*; + +// TODO: Package into module +// #[cfg(not(feature = "hacspec"))] +// pub mod collections { +// #[cfg(not(feature = "std"))] +// use alloc::collections; +// #[cfg(feature = "std")] +// use std::collections; + +// pub use collections::*; +// pub use collections::{BTreeMap, BTreeSet}; +// pub use concordium_contracts_common::{HashMap, HashSet}; +// } + +#[cfg(not(feature = "hacspec"))] +extern crate concordium_contracts_common; +#[cfg(not(feature = "hacspec"))] +/// Chain constants that impose limits on various aspects of smart contract +/// execution. +pub use concordium_contracts_common::*; + +// TODO: Need derive +#[cfg(not(feature = "hacspec"))] +extern crate hacspec_concordium_derive; +#[cfg(not(feature = "hacspec"))] +pub use hacspec_concordium_derive::*; + +#[cfg(not(feature = "hacspec"))] +extern crate wee_alloc; +// Use `wee_alloc` as the global allocator to reduce code size. +#[cfg(not(feature = "hacspec"))] +#[global_allocator] +static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; + +#[cfg(not(feature = "hacspec"))] +extern crate hacspec_lib; +// pub use hacspec_lib::*; + +// #[cfg(feature = "hacspec")] +// use hacspec_attributes::*; + +#[cfg(not(feature = "hacspec"))] +extern crate creusot_contracts; +#[cfg(not(feature = "hacspec"))] +use creusot_contracts::*; // {ensures, trusted}; // requires, +#+END_SRC + +** Coq code + +#+begin_src elisp :var SOURCE-CODE-FILE="Hacspec_Concordium.v" :results output silent :tangle no +(org-babel-detangle SOURCE-CODE-FILE) +#+end_src + +*** concordium - Coq code +:PROPERTIES: +:header-args: coq :tangle Hacspec_Concordium.v :mkdirp yes :comments link +:header-args: coq :eval never :results output silent +:END: + +#+begin_src coq + +(** This file was automatically generated using Hacspec **) +Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +From Coq Require Import List. +Import ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. +Open Scope hacspec_scope. +#+end_src + +#+begin_src coq +Require Import Concordium_Prims. +Export Concordium_Prims. +#+end_src + +#+begin_src coq +Require Import Concordium_Types. +Export Concordium_Types. +#+end_src + +#+begin_src coq +Require Import Concordium_Traits. +Export Concordium_Traits. +#+end_src + +#+begin_src coq +Require Import Concordium_Impls. +Export Concordium_Impls. +#+end_src +# 5 code sections + +* Concordium "Types" specification +** Rust code +:PROPERTIES: +:header-args: :tangle ../concordium/src/concordium_types.rs :mkdirp yes :eval never +:END: + +*** Imports +#+BEGIN_SRC rust +#[cfg(not(feature = "hacspec"))] +use crate::num::NonZeroI32; +#+END_SRC + +*** Types code +#+BEGIN_SRC rust +#[cfg(not(feature = "hacspec"))] +/// A type representing the constract state bytes. +#[derive(Default)] +pub struct ContractState { + pub(crate) current_position: u32, +} + +#[cfg(not(feature = "hacspec"))] +#[derive(Default)] +/// A type representing the parameter to init and receive methods. +pub struct Parameter { + pub(crate) current_position: u32, +} + +#[cfg(not(feature = "hacspec"))] +/// A type representing the attributes, lazily acquired from the host. +#[derive(Default)] +pub struct AttributesCursor { + /// Current position of the cursor, starting from 0. + /// Note that this is only for the variable attributes. + /// `created_at` and `valid_to` will require. + pub(crate) current_position: u32, + /// The number of remaining items in the policy. + pub(crate) remaining_items: u16, +} + +#[cfg(not(feature = "hacspec"))] +/// A type representing the logger. +#[derive(Default)] +pub struct Logger { + pub(crate) _private: (), +} + +// #[cfg(not(feature = "hacspec"))] +/// Errors that can occur during logging. +#[derive(Debug, Copy, Clone, Eq, PartialEq)] +#[repr(u8)] +pub enum LogError { + /// The log is full. + Full, + /// The message to log was malformed (e.g., too long) + Malformed, +} + +#[cfg(not(feature = "hacspec"))] +/// Error triggered when a non-zero amount of CCD is sent to a contract +/// init or receive function that is not marked as `payable`. +#[derive(Clone, Copy, Debug)] +pub struct NotPayableError; + +#[cfg(not(feature = "hacspec"))] +/// Actions that can be produced at the end of a contract execution. This +/// type is deliberately not cloneable so that we can enforce that +/// `and_then` and `or_else` can only be used when more than one event is +/// created. +/// +/// This type is marked as `must_use` since functions that produce +/// values of the type are effectful. +#[must_use] +pub struct Action { + pub(crate) _private: u32, +} + +#[cfg(not(feature = "hacspec"))] +impl Action { + pub fn tag(&self) -> u32 { + self._private + } +} + +#[cfg(not(feature = "hacspec"))] +/// An error message, signalling rejection of a smart contract invocation. +/// The client will see the error code as a reject reason; if a schema is +/// provided, the error message corresponding to the error code will be +/// displayed. The valid range for an error code is from i32::MIN to -1. +#[derive(Debug, Eq, PartialEq)] // TODO: Creusot issue re-add "Debug" attribute +#[repr(transparent)] +pub struct Reject { + pub error_code: NonZeroI32, +} + +#[cfg(not(feature = "hacspec"))] +/// Default error is i32::MIN. +impl Default for Reject { + #[inline(always)] + fn default() -> Self { + Self { + error_code: unsafe { NonZeroI32::new_unchecked(i32::MIN) }, + } + } +} + +#[cfg(not(feature = "hacspec"))] +impl Reject { + /// This returns `None` for all values >= 0 and `Some` otherwise. + pub fn new(x: i32) -> Option { + if x < 0 { + let error_code = unsafe { NonZeroI32::new_unchecked(x) }; + Some(Reject { error_code }) + } else { + None + } + } +} + +// Macros for failing a contract function + +#[cfg(not(feature = "hacspec"))] +/// The `bail` macro can be used for cleaner error handling. If the function has +/// result type `Result` invoking `bail` will terminate execution early with an +/// error. +/// If an argument is supplied, this will be used as the error, otherwise it +/// requires the type `E` in `Result<_, E>` to implement the `Default` trait. +#[macro_export] +macro_rules! bail { + () => {{ + return Err(Default::default()); + }}; + ($arg:expr) => {{ + // format_err!-like formatting + // logs are only retained in case of rejection when testing. + return Err($arg); + }}; +} + +#[cfg(not(feature = "hacspec"))] +/// The `ensure` macro can be used for cleaner error handling. It is analogous +/// to `assert`, but instead of panicking it uses `bail` to terminate execution +/// of the function early. +#[macro_export] +macro_rules! ensure { + ($p:expr) => { + if !$p { + $crate::bail!(); + } + }; + ($p:expr, $arg:expr) => {{ + if !$p { + $crate::bail!($arg); + } + }}; +} + +#[cfg(not(feature = "hacspec"))] +/// ## Variants of `ensure` for ease of use in certain contexts. +/// Ensure the first two arguments are equal, using `bail` otherwise. +#[macro_export] +macro_rules! ensure_eq { + ($l:expr, $r:expr) => { + $crate::ensure!($l == $r) + }; + ($l:expr, $r:expr, $arg:expr) => { + $crate::ensure!($l == $r, $arg) + }; +} + +#[cfg(not(feature = "hacspec"))] +#[macro_export] +/// Ensure the first two arguments are __not__ equal, using `bail` otherwise. +macro_rules! ensure_ne { + ($l:expr, $r:expr) => { + $crate::ensure!($l != $r) + }; + ($l:expr, $r:expr, $arg:expr) => { + $crate::ensure!($l != $r, $arg) + }; +} + +// Macros for failing a test + +#[cfg(not(feature = "hacspec"))] +/// The `fail` macro is used for testing as a substitute for the panic macro. +/// It reports back error information to the host. +/// Used only in testing. +#[cfg(feature = "std")] +#[macro_export] +macro_rules! fail { + () => { + { + $crate::test_infrastructure::report_error("", file!(), line!(), column!()); + panic!() + } + }; + ($($arg:tt),+) => { + { + let msg = format!($($arg),+); + $crate::test_infrastructure::report_error(&msg, file!(), line!(), column!()); + panic!("{}", msg) + } + }; +} + +#[cfg(not(feature = "hacspec"))] +/// The `fail` macro is used for testing as a substitute for the panic macro. +/// It reports back error information to the host. +/// Used only in testing. +#[cfg(not(feature = "std"))] +#[macro_export] +macro_rules! fail { + () => { + { + $crate::test_infrastructure::report_error("", file!(), line!(), column!()); + panic!() + } + }; + ($($arg:tt),+) => { + { + let msg = &$crate::alloc::format!($($arg),+); + $crate::test_infrastructure::report_error(&msg, file!(), line!(), column!()); + panic!("{}", msg) + } + }; +} + +#[cfg(not(feature = "hacspec"))] +/// The `claim` macro is used for testing as a substitute for the assert macro. +/// It checks the condition and if false it reports back an error. +/// Used only in testing. +#[macro_export] +macro_rules! claim { + ($cond:expr) => { + if !$cond { + $crate::fail!() + } + }; + ($cond:expr,) => { + if !$cond { + $crate::fail!() + } + }; + ($cond:expr, $($arg:tt),+) => { + if !$cond { + $crate::fail!($($arg),+) + } + }; +} + +#[cfg(not(feature = "hacspec"))] +/// Ensure the first two arguments are equal, just like `assert_eq!`, otherwise +/// reports an error. Used only in testing. +#[macro_export] +macro_rules! claim_eq { + ($left:expr, $right:expr) => { + $crate::claim!($left == $right, "left and right are not equal\nleft: {:?}\nright: {:?}", $left, $right) + }; + ($left:expr, $right:expr,) => { + $crate::claim_eq!($left, $right) + }; + ($left:expr, $right:expr, $($arg:tt),+) => { + $crate::claim!($left == $right, $($arg),+) + }; +} + +#[cfg(not(feature = "hacspec"))] +/// Ensure the first two arguments are *not* equal, just like `assert_ne!`, +/// otherwise reports an error. +/// Used only in testing. +#[macro_export] +macro_rules! claim_ne { + ($left:expr, $right:expr) => { + $crate::claim!($left != $right) + }; + ($left:expr, $right:expr,) => { + $crate::claim!($left != $right) + }; + ($left:expr, $right:expr, $($arg:tt),+) => { + $crate::claim!($left != $right, $($arg),+) + }; +} + +#[cfg(not(feature = "hacspec"))] +/// The expected return type of the receive method of a smart contract. +/// +/// Optionally, to define a custom type for error instead of using +/// Reject, allowing to track the reason for rejection, *but only in unit +/// tests*. +/// +/// See also the documentation for [bail!](macro.bail.html) for how to use +/// custom error types. +/// +/// # Example +/// Defining a custom error type +/// // ```rust +/// // enum MyCustomError { +/// // SomeError +/// // } +/// // +/// // #[receive(contract = "mycontract", name = "receive")] +/// // fn contract_receive( +/// // ctx: &R, +/// // receive_amount: Amount, +/// // logger: &mut L, +/// // state: &mut State, +/// // ) -> Result { ... } +/// // ``` +pub type ReceiveResult = Result; + +#[cfg(not(feature = "hacspec"))] +/// The expected return type of the init method of the smart contract, +/// parametrized by the state type of the smart contract. +/// +/// Optionally, to define a custom type for error instead of using Reject, +/// allowing the track the reason for rejection, *but only in unit tests*. +/// +/// See also the documentation for [bail!](macro.bail.html) for how to use +/// custom error types. +/// +/// # Example +/// Defining a custom error type +/// // ```rust +/// // enum MyCustomError { +/// // SomeError +/// // } +/// // +/// // #[init(contract = "mycontract")] +/// // fn contract_init( +/// // ctx: &R, +/// // receive_amount: Amount, +/// // logger: &mut L, +/// // ) -> Result { ... } +/// // ``` +pub type InitResult = Result; + +#[cfg(not(feature = "hacspec"))] +/// Context backed by host functions. +#[derive(Default)] +#[doc(hidden)] +pub struct ExternContext { + marker: crate::marker::PhantomData, +} + +#[cfg(not(feature = "hacspec"))] +#[doc(hidden)] +pub struct ChainMetaExtern {} + +#[cfg(not(feature = "hacspec"))] +#[derive(Default)] +#[doc(hidden)] +pub struct InitContextExtern; +#[cfg(not(feature = "hacspec"))] +#[derive(Default)] +#[doc(hidden)] +pub struct ReceiveContextExtern; + +#[cfg(not(feature = "hacspec"))] +pub(crate) mod sealed { + use super::*; + /// Marker trait intended to indicate which context type we have. + /// This is deliberately a sealed trait, so that it is only implementable + /// by types in this crate. + pub trait ContextType {} + impl ContextType for InitContextExtern {} + impl ContextType for ReceiveContextExtern {} +} +#+END_SRC + +** Coq code + +#+begin_src elisp :var SOURCE-CODE-FILE="Concordium_Types.v" :results output silent :tangle no +(org-babel-detangle SOURCE-CODE-FILE) +#+end_src + +*** concordium_types - Coq code +:PROPERTIES: +:header-args: coq :tangle Concordium_Types.v :mkdirp yes :comments link +:header-args: coq :eval never :results output silent +:END: + +#+begin_src coq + +(** This file was automatically generated using Hacspec **) +Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +From Coq Require Import List. +Import ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. +Open Scope hacspec_scope. +#+end_src + +#+begin_src coq +Inductive log_error_t := +| Full : log_error_t +| Malformed : log_error_t. + +Definition eqb_log_error_t (x y : log_error_t) : bool := +match x with + | Full => match y with | Full=> true | _ => false end + | Malformed => match y with | Malformed=> true | _ => false end + end. + +Definition eqb_leibniz_log_error_t (x y : log_error_t) : eqb_log_error_t x y = true <-> x = y. +Proof. split. intros; destruct x ; destruct y ; try (f_equal ; apply eqb_leibniz) ; easy. intros ; subst ; destruct y ; try reflexivity ; try (apply eqb_refl). Qed. + +Instance eq_dec_log_error_t : EqDec (log_error_t) := + Build_EqDec (log_error_t) (eqb_log_error_t) (eqb_leibniz_log_error_t). +#+end_src + +* Concordium "Traits" specification +** Rust code +:PROPERTIES: +:header-args: rust :tangle ../concordium/src/concordium_traits.rs :mkdirp yes :eval never +:END: +*** Imports +#+BEGIN_SRC rust +#[cfg(not(feature = "hacspec"))] +use crate::*; +#+END_SRC + +*** Traits code +#+BEGIN_SRC rust +// //! This module implements traits for the contract interface. +// //! This allows setting-up mock objects for testing individual +// //! contract invocations. + +#[cfg(not(feature = "hacspec"))] +/// Objects which can access parameters to contracts. +/// +/// This trait has a Read supertrait which means that structured parameters can +/// be directly deserialized by using `.get()` function from the `Get` trait. +/// +/// The reuse of `Read` methods is the reason for the slightly strange choice of +/// methods of this trait. +pub trait HasParameter: Read { + /// Get the size of the parameter to the method. + fn size(&self) -> u32; +} + +#[cfg(not(feature = "hacspec"))] +/// Objects which can access chain metadata. +pub trait HasChainMetadata { + /// Get time in milliseconds at the beginning of this block. + fn slot_time(&self) -> SlotTime; +} + +#[cfg(not(feature = "hacspec"))] +/// A type which has access to a policy of a credential. +/// Since policies can be large this is deliberately written in a relatively +/// low-level style to enable efficient traversal of all the attributes without +/// any allocations. +pub trait HasPolicy { + /// Identity provider who signed the identity object the credential is + /// derived from. + fn identity_provider(&self) -> IdentityProvider; + /// Beginning of the month in milliseconds since unix epoch when the + /// credential was created. + fn created_at(&self) -> Timestamp; + /// Beginning of the month where the credential is no longer valid, in + /// milliseconds since unix epoch. + fn valid_to(&self) -> Timestamp; + /// Get the next attribute, storing it in the provided buffer. + /// The return value, if `Some`, is a pair of an attribute tag, and the + /// length, `n` of the attribute value. In this case, the attribute + /// value is written in the first `n` bytes of the provided buffer. The + /// rest of the buffer is unchanged. + /// + /// The reason this function is added here, and we don't simply implement + /// an Iterator for this type is that with the supplied buffer we can + /// iterate through the elements more efficiently, without any allocations, + /// the consumer being responsible for allocating the buffer. + fn next_item(&mut self, buf: &mut [u8; 31]) -> Option<(AttributeTag, u8)>; +} + +#[cfg(not(feature = "hacspec"))] +/// Common data accessible to both init and receive methods. +pub trait HasCommonData { + type PolicyType: HasPolicy; + type MetadataType: HasChainMetadata; + type ParamType: HasParameter + Read; + type PolicyIteratorType: ExactSizeIterator; + /// Policies of the sender of the message. + /// For init methods this is the would-be creator of the contract, + /// for the receive this is the policies of the immediate sender. + /// + /// In the latter case, if the sender is an account then it is the policies + /// of the account, if it is a contract then it is the policies of the + /// creator of the contract. + fn policies(&self) -> Self::PolicyIteratorType; + /// Get the reference to chain metadata + fn metadata(&self) -> &Self::MetadataType; + /// Get the cursor to the parameter. + fn parameter_cursor(&self) -> Self::ParamType; +} + +#[cfg(not(feature = "hacspec"))] +/// Types which can act as init contexts. +pub trait HasInitContext: HasCommonData { + /// Data needed to open the context. + type InitData; + /// Open the init context for reading and accessing values. + fn open(data: Self::InitData) -> Self; + /// Who invoked this init call. + fn init_origin(&self) -> AccountAddress; +} + +#[cfg(not(feature = "hacspec"))] +/// Types which can act as receive contexts. +pub trait HasReceiveContext: HasCommonData { + type ReceiveData; + + /// Open the receive context for reading and accessing values. + fn open(data: Self::ReceiveData) -> Self; + /// Who is the account that initiated the top-level transaction this + /// invocation is a part of. + fn invoker(&self) -> AccountAddress; + /// The address of the contract being invoked. + fn self_address(&self) -> ContractAddress; + /// Balance on the contract before the call was made. + fn self_balance(&self) -> Amount; + /// The immediate sender of the message. In general different from the + /// invoker. + fn sender(&self) -> Address; + /// Account which created the contract instance. + fn owner(&self) -> AccountAddress; +} + +#[cfg(not(feature = "hacspec"))] +/// A type that can serve as the contract state type. +pub trait HasContractState +where + Self: Read, + Self: Write, + Self: Seek, { + type ContractStateData; + /// Open the contract state. Only one instance can be opened at the same + /// time. + fn open(_: Self::ContractStateData) -> Self; + + /// Get the current size of contract state. + fn size(&self) -> u32; + + /// Truncate the state to the given size. If the given size is more than the + /// current state size this operation does nothing. The new position is at + /// most at the end of the stream. + fn truncate(&mut self, new_size: u32); + + /// Make sure that the memory size is at least that many bytes in size. + /// Returns true iff this was successful. The new bytes are initialized as + /// 0. + fn reserve(&mut self, len: u32) -> bool; +} + +#[cfg(not(feature = "hacspec"))] +/// Objects which can serve as loggers. +/// +/// Logging functionality can be used by smart contracts to record events that +/// might be of interest to external parties. These events are not used on the +/// chain, and cannot be observed by other contracts, but they are stored by the +/// node, and can be queried to provide information to off-chain actors. +pub trait HasLogger { + /// Initialize a logger. + fn init() -> Self; + + /// Log the given slice as-is. If logging is not successful an error will be + /// returned. + fn log_raw(&mut self, event: &[u8]) -> Result<(), LogError>; + + #[inline(always)] + /// Log a serializable event by serializing it with a supplied serializer. + fn log(&mut self, event: &S) -> Result<(), LogError> { + let mut out = Vec::new(); + if event.serial(&mut out).is_err() { + trap(); // should not happen + } + self.log_raw(&out) + } +} + +#[cfg(not(feature = "hacspec"))] +/// An object that can serve to construct actions. +/// +/// The actions that a smart contract can produce as a +/// result of its execution. These actions form a tree and are executed by +/// the scheduler in the predefined order. +pub trait HasActions { + /// Default accept action. + fn accept() -> Self; + + /// Send a given amount to an account. + fn simple_transfer(acc: &AccountAddress, amount: Amount) -> Self; + + /// Send a message to a contract. + fn send_raw( + ca: &ContractAddress, + receive_name: ReceiveName, + amount: Amount, + parameter: &[u8], + ) -> Self; + + /// If the execution of the first action succeeds, run the second action + /// as well. + fn and_then(self, then: Self) -> Self; + + /// If the execution of the first action fails, try the second. + fn or_else(self, el: Self) -> Self; +} + +#[cfg(not(feature = "hacspec"))] +/// Add optimized unwrap behaviour that aborts the process instead of +/// panicking. +pub trait UnwrapAbort { + /// The underlying result type of the unwrap, in case of success. + type Unwrap; + /// Unwrap or call [trap](../fn.trap.html). In contrast to + /// the unwrap methods on [Option::unwrap](https://doc.rust-lang.org/std/option/enum.Option.html#method.unwrap) + /// this method will tend to produce smaller code, at the cost of the + /// ability to handle the panic. + /// This is intended to be used only in `Wasm` code, where panics cannot be + /// handled anyhow. + fn unwrap_abort(self) -> Self::Unwrap; +} + +#[cfg(not(feature = "hacspec"))] +/// Analogue of the `expect` methods on types such as [Option](https://doc.rust-lang.org/std/option/enum.Option.html), +/// but useful in a Wasm setting. +pub trait ExpectReport { + type Unwrap; + /// Like the default `expect` on, e.g., `Result`, but calling + /// [fail](macro.fail.html) with the given message, instead of `panic`. + fn expect_report(self, msg: &str) -> Self::Unwrap; +} + +#[cfg(not(feature = "hacspec"))] +/// Analogue of the `expect_err` methods on [Result](https://doc.rust-lang.org/std/result/enum.Result.html), +/// but useful in a Wasm setting. +pub trait ExpectErrReport { + type Unwrap; + /// Like the default `expect_err` on, e.g., `Result`, but calling + /// [fail](macro.fail.html) with the given message, instead of `panic`. + fn expect_err_report(self, msg: &str) -> Self::Unwrap; +} + +#[cfg(not(feature = "hacspec"))] +/// Analogue of the `expect_none` methods on [Option](https://doc.rust-lang.org/std/option/enum.Option.html), +/// but useful in a Wasm setting. +pub trait ExpectNoneReport { + /// Like the default `expect_none_report` on, e.g., `Option`, but calling + /// [fail](macro.fail.html) with the given message, instead of `panic`. + fn expect_none_report(self, msg: &str); +} + +#[cfg(not(feature = "hacspec"))] +/// The `SerialCtx` trait provides a means of writing structures into byte-sinks +/// (`Write`) using contextual information. +/// The contextual information is: +/// +/// - `size_length`: The number of bytes used to record the length of the +/// data. +pub trait SerialCtx { + /// Attempt to write the structure into the provided writer, failing if + /// if the length cannot be represented in the provided `size_length` or + /// only part of the structure could be written. + /// + /// NB: We use Result instead of Option for better composability with other + /// constructs. + fn serial_ctx( + &self, + size_length: schema::SizeLength, + out: &mut W, + ) -> Result<(), W::Err>; +} + +#[cfg(not(feature = "hacspec"))] +/// The `DeserialCtx` trait provides a means of reading structures from +/// byte-sources (`Read`) using contextual information. +/// The contextual information is: +/// +/// - `size_length`: The expected number of bytes used for the length of the +/// data. +/// - `ensure_ordered`: Whether the ordering should be ensured, for example +/// that keys in `BTreeMap` and `BTreeSet` are in strictly increasing order. +pub trait DeserialCtx: Sized { + /// Attempt to read a structure from a given source and context, failing if + /// an error occurs during deserialization or reading. + fn deserial_ctx( + size_length: schema::SizeLength, + ensure_ordered: bool, + source: &mut R, + ) -> ParseResult; +} +#+END_SRC + +** Coq code + +#+begin_src elisp :var SOURCE-CODE-FILE="Concordium_Traits.v" :results output silent :tangle no +(org-babel-detangle SOURCE-CODE-FILE) +#+end_src + +*** concordium_traits - Coq code +:PROPERTIES: +:header-args: coq :tangle Concordium_Traits.v :mkdirp yes :comments link +:header-args: coq :eval never :results output silent +:END: + +#+begin_src coq + +(** This file was automatically generated using Hacspec **) +Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +From Coq Require Import List. +Import ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. +Open Scope hacspec_scope. +#+end_src + +* Concordium "Prims" specification +** Rust code +:PROPERTIES: +:header-args: rust :tangle ../concordium/src/concordium_prims.rs :mkdirp yes :eval never +:END: + +*** Imports +#+BEGIN_SRC rust +#[cfg(not(feature = "hacspec"))] +use crate::*; + +use hacspec_lib::*; +#+END_SRC + +*** Externs +Coerce for public byte sequences. +#+begin_src rust + #[cfg(not(feature = "hacspec"))] + pub fn coerce_rust_to_hacspec_public_byte_seq(buf: &[u8]) -> PublicByteSeq { + PublicByteSeq::from_native_slice(buf) + } + + // TODO: Make creusot friendly version + #[cfg(not(feature = "hacspec"))] + pub fn coerce_hacspec_to_rust_public_byte_seq(buf: PublicByteSeq) -> Vec { + // buf.native_slice().iter().collect(); + let mut temp_vec: Vec = Vec::new(); + for i in 0..buf.len() { + temp_vec.push(buf.index(i).clone()) + } + temp_vec + } +#+end_src + +Extern accept +#+begin_src rust + #[cfg(not(feature = "hacspec"))] + extern "C" { + pub(crate) fn accept() -> u32; + } + + #[cfg(not(feature = "hacspec"))] + #[trusted] + pub(crate) fn accept_creusot() -> u32 { + unsafe { accept() } + } + + #[cfg(feature = "hacspec")] + pub(crate) fn accept_hacspec() -> u32 { + 1u32 + } + + #[cfg(not(feature = "hacspec"))] + pub(crate) fn accept_hacspec() -> u32 { + accept_creusot() + } + +#+end_src +Extern simple transfer +#+begin_src rust + #[cfg(not(feature = "hacspec"))] + extern "C" { + // Basic action to send tokens to an account. + pub(crate) fn simple_transfer(addr_bytes: *const u8, amount: u64) -> u32; + } + + #[cfg(not(feature = "hacspec"))] + #[trusted] + pub(crate) fn simple_transfer_creusot(addr_bytes: *const u8, amount: u64) -> u32 { + unsafe { simple_transfer(addr_bytes, amount) } + } + + #[cfg(feature = "hacspec")] + pub(crate) fn simple_transfer_hacspec(buf: PublicByteSeq, amount: u64) -> u32 { + 1u32 + } + + #[cfg(not(feature = "hacspec"))] + pub(crate) fn simple_transfer_hacspec(buf: PublicByteSeq, amount: u64) -> u32 { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(buf.clone())[..]; + simple_transfer_creusot(temp.as_ptr(), amount) + } + +#+end_src +Extern send +#+begin_src rust + #[cfg(not(feature = "hacspec"))] + extern "C" { + // Send a message to a smart contract. + pub(crate) fn send( + addr_index: u64, + addr_subindex: u64, + receive_name: *const u8, + receive_name_len: u32, + amount: u64, + parameter: *const u8, + parameter_len: u32, + ) -> u32; + } + + #[cfg(not(feature = "hacspec"))] + #[trusted] + pub(crate) fn send_creusot( + addr_index: u64, + addr_subindex: u64, + receive_name: *const u8, + receive_name_len: u32, + amount: u64, + parameter: *const u8, + parameter_len: u32, + ) -> u32 { + unsafe { send(addr_index, addr_subindex, receive_name, receive_name_len, amount, parameter, parameter_len) } + } + + #[cfg(feature = "hacspec")] + pub(crate) fn send_hacspec( + addr_index: u64, + addr_subindex: u64, + receive_name: PublicByteSeq, + amount: u64, + parameter: PublicByteSeq, + ) -> u32 { + 1u32 + } + + #[cfg(not(feature = "hacspec"))] + pub(crate) fn send_hacspec( + addr_index: u64, + addr_subindex: u64, + receive_name: PublicByteSeq, + amount: u64, + parameter: PublicByteSeq, + ) -> u32 { + let temp_receive_name = &mut coerce_hacspec_to_rust_public_byte_seq(receive_name.clone())[..]; + let temp_parameter = &mut coerce_hacspec_to_rust_public_byte_seq(parameter.clone())[..]; + send_creusot(addr_index, addr_subindex, temp_receive_name.as_ptr(), receive_name.len() as u32, amount, temp_parameter.as_ptr(), parameter.len() as u32) + } + +#+end_src +Extern combine and +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +extern "C" { + // Combine two actions using normal sequencing. This is using the stack of + // actions already produced. + pub(crate) fn combine_and(l: u32, r: u32) -> u32; +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn combine_and_creusot(l: u32, r: u32) -> u32 { + unsafe { combine_and(l, r) } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn combine_and_hacspec(l: u32, r: u32) -> u32 { + 1u32 +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn combine_and_hacspec(l: u32, r: u32) -> u32 { + combine_and_creusot(l,r) +} + +#+end_src +Extern combine or +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +extern "C" { + // Combine two actions using normal sequencing. This is using the stack of + // actions already produced. + pub(crate) fn combine_or(l: u32, r: u32) -> u32; +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn combine_or_creusot(l: u32, r: u32) -> u32 { + unsafe { combine_or(l, r) } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn combine_or_hacspec(l: u32, r: u32) -> u32 { + 1u32 +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn combine_or_hacspec(l: u32, r: u32) -> u32 { + combine_or_creusot(l,r) +} + +#+end_src +Extern parameter size +#+begin_src rust + #[cfg(not(feature = "hacspec"))] + extern "C" { + // Get the size of the parameter to the method (either init or receive). + pub(crate) fn get_parameter_size() -> u32; + } + + #[cfg(not(feature = "hacspec"))] + #[trusted] + pub(crate) fn get_parameter_size_creusot() -> u32 { + unsafe { get_parameter_size() } + } + + #[cfg(feature = "hacspec")] + pub(crate) fn get_parameter_size_hacspec() -> u32 { + 1u32 + } + + #[cfg(not(feature = "hacspec"))] + pub(crate) fn get_parameter_size_hacspec() -> u32 { + get_parameter_size_creusot() + } + +#+end_src +Extern for parameter section +#+begin_src rust + #[cfg(not(feature = "hacspec"))] + extern "C" { + // Write a section of the parameter to the given location. Return the number + // of bytes written. The location is assumed to contain enough memory to + // write the requested length into. + pub(crate) fn get_parameter_section(param_bytes: *mut u8, length: u32, offset: u32) -> u32; + } + + #[cfg(not(feature = "hacspec"))] + #[trusted] + pub(crate) fn get_parameter_section_creusot(start: *mut u8, length: u32, offset: u32) -> u32 { + unsafe { get_parameter_section(start, length, offset) } + } + + #[cfg(feature = "hacspec")] + pub(crate) fn get_parameter_section_hacspec(buf: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { + (buf, 1u32) + } + + #[cfg(not(feature = "hacspec"))] + pub(crate) fn get_parameter_section_hacspec(buf: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(buf.clone())[..]; + let result = get_parameter_section_creusot(temp.as_mut_ptr(), buf.len() as u32, offset); + ( + coerce_rust_to_hacspec_public_byte_seq(&temp), + result, + ) + } + +#+end_src +Get policy section extern +#+begin_src rust + #[cfg(not(feature = "hacspec"))] + extern "C" { + // Write a section of the policy to the given location. Return the number + // of bytes written. The location is assumed to contain enough memory to + // write the requested length into. + pub(crate) fn get_policy_section(policy_bytes: *mut u8, length: u32, offset: u32) -> u32; + } + + #[cfg(not(feature = "hacspec"))] + #[trusted] + pub(crate) fn get_policy_section_creusot(policy_bytes: *mut u8, length: u32, offset: u32) -> u32 { + unsafe { get_policy_section(policy_bytes, length, offset) } + } + + #[cfg(feature = "hacspec")] + pub(crate) fn get_policy_section_hacspec(policy_bytes: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { + (policy_bytes, 1u32) + } + + #[cfg(not(feature = "hacspec"))] + pub(crate) fn get_policy_section_hacspec(policy_bytes: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(policy_bytes.clone())[..]; + let result = get_policy_section_creusot(temp.as_mut_ptr(), policy_bytes.len() as u32, offset); + ( + coerce_rust_to_hacspec_public_byte_seq(&temp), + result, + ) + } + +#+end_src +Log event extern +#+begin_src rust + #[cfg(not(feature = "hacspec"))] + extern "C" { + // Add a log item. Return values are + // - -1 if logging failed due to the message being too long + // - 0 if the log is already full + // - 1 if data was successfully logged. + pub(crate) fn log_event(start: *const u8, length: u32) -> i32; + } + + #[cfg(not(feature = "hacspec"))] + #[trusted] + pub(crate) fn log_event_creusot(start: *const u8, length: u32) -> i32 { + unsafe { log_event(start, length) } + } + + #[cfg(feature = "hacspec")] + pub(crate) fn log_event_hacspec(start: PublicByteSeq) -> (PublicByteSeq, i32) { + (start, 1i32) + } + + #[cfg(not(feature = "hacspec"))] + pub(crate) fn log_event_hacspec(start: PublicByteSeq) -> (PublicByteSeq, i32) { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(start.clone())[..]; + let result = log_event_creusot(temp.as_ptr(), start.len() as u32); + (coerce_rust_to_hacspec_public_byte_seq(&temp), result) + } + +#+end_src +Load state extern +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +extern "C" { + pub(crate) fn load_state(start: *mut u8, length: u32, offset: u32) -> u32; +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn load_state_creusot(start: *mut u8, length: u32, offset: u32) -> u32 { + unsafe { load_state(start, length, offset) } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn load_state_hacspec(buf: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { + (buf, 1u32) +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn load_state_hacspec(buf: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(buf.clone())[..]; + let result = load_state_creusot(temp.as_mut_ptr(), buf.len() as u32, offset); + (coerce_rust_to_hacspec_public_byte_seq(&temp), result) +} +#+end_src +Write state extern +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +extern "C" { + pub(crate) fn write_state(start: *mut u8, length: u32, offset: u32) -> u32; +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn write_state_creusot(start: *mut u8, length: u32, offset: u32) -> u32 { + unsafe { write_state(start, length, offset) } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn write_state_hacspec(buf: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { + (buf, 1u32) +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn write_state_hacspec(buf: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(buf.clone())[..]; + let result = write_state_creusot(temp.as_mut_ptr(), buf.len() as u32, offset); + (coerce_rust_to_hacspec_public_byte_seq(&temp), result) +} +#+end_src +Resize state extern +#+begin_src rust + #[cfg(not(feature = "hacspec"))] + extern "C" { + // Resize state to the new value (truncate if new size is smaller). Return 0 if + // this was unsuccesful (new state too big), or 1 if successful. + pub(crate) fn resize_state(new_size: u32) -> u32; // returns 0 or 1. + // get current state size in bytes. + } + + #[cfg(not(feature = "hacspec"))] + #[trusted] + pub(crate) fn resize_state_creusot(new_size: u32) -> u32 { + unsafe { resize_state(new_size) } + } + + #[cfg(feature = "hacspec")] + pub(crate) fn resize_state_hacspec(new_size: u32) -> u32 { + 1u32 + } + + #[cfg(not(feature = "hacspec"))] + pub(crate) fn resize_state_hacspec(new_size: u32) -> u32 { + resize_state_creusot(new_size) + } +#+end_src +State size extern +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +extern "C" { + pub(crate) fn state_size() -> u32; +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn state_size_creusot() -> u32 { + unsafe { state_size() } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn state_size_hacspec() -> u32 { + 1u32 +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn state_size_hacspec() -> u32 { + state_size_creusot() +} +#+end_src +Get init origin extern +#+begin_src rust + #[cfg(not(feature = "hacspec"))] + extern "C" { + // Getter for the init context. + /// Address of the sender, 32 bytes + pub(crate) fn get_init_origin(start: *mut u8); + } + + #[cfg(not(feature = "hacspec"))] + #[trusted] + pub(crate) fn get_init_origin_creusot(start: *mut u8) { + unsafe { get_init_origin(start) } + } + + #[cfg(feature = "hacspec")] + pub(crate) fn get_init_origin_hacspec(start: PublicByteSeq) -> PublicByteSeq { + start + } + + #[cfg(not(feature = "hacspec"))] + pub(crate) fn get_init_origin_hacspec(start: PublicByteSeq) -> PublicByteSeq { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(start.clone())[..]; + get_init_origin_creusot(temp.as_mut_ptr()); + coerce_rust_to_hacspec_public_byte_seq(&temp) + } + +#+end_src +Get receive invoker extern +#+begin_src rust + #[cfg(not(feature = "hacspec"))] + extern "C" { + /// Invoker of the top-level transaction, AccountAddress. + pub(crate) fn get_receive_invoker(start: *mut u8); + } + + #[cfg(not(feature = "hacspec"))] + #[trusted] + pub(crate) fn get_receive_invoker_creusot(start: *mut u8) { + unsafe { get_receive_invoker(start) } + } + + #[cfg(feature = "hacspec")] + pub(crate) fn get_receive_invoker_hacspec(start: PublicByteSeq) -> PublicByteSeq { + start + } + + #[cfg(not(feature = "hacspec"))] + pub(crate) fn get_receive_invoker_hacspec(start: PublicByteSeq) -> PublicByteSeq { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(start.clone())[..]; + get_receive_invoker_creusot(temp.as_mut_ptr()); + coerce_rust_to_hacspec_public_byte_seq(&temp) + } + +#+end_src +Get receive self address extern +#+begin_src rust + #[cfg(not(feature = "hacspec"))] + extern "C" { + /// Address of the contract itself, ContractAddress. + pub(crate) fn get_receive_self_address(start: *mut u8); + } + + #[cfg(not(feature = "hacspec"))] + #[trusted] + pub(crate) fn get_receive_self_address_creusot(start: *mut u8) { + unsafe { get_receive_self_address(start) } + } + + #[cfg(feature = "hacspec")] + pub(crate) fn get_receive_self_address_hacspec(start: PublicByteSeq) -> PublicByteSeq { + start + } + + #[cfg(not(feature = "hacspec"))] + pub(crate) fn get_receive_self_address_hacspec(start: PublicByteSeq) -> PublicByteSeq { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(start.clone())[..]; + get_receive_self_address_creusot(temp.as_mut_ptr()); + coerce_rust_to_hacspec_public_byte_seq(&temp) + } + +#+end_src +Get receive self balance extern +#+begin_src rust + #[cfg(not(feature = "hacspec"))] + extern "C" { + /// Self-balance of the contract, returns the amount + pub(crate) fn get_receive_self_balance() -> u64; + } + + #[cfg(not(feature = "hacspec"))] + #[trusted] + pub(crate) fn get_receive_self_balance_creusot() -> u64 { + unsafe { get_receive_self_balance() } + } + + #[cfg(feature = "hacspec")] + pub(crate) fn get_receive_self_balance_hacspec() -> u64 { + 1u64 + } + + #[cfg(not(feature = "hacspec"))] + pub(crate) fn get_receive_self_balance_hacspec() -> u64 { + get_receive_self_balance_creusot() + } + +#+end_src +Get receive sender extern +#+begin_src rust + #[cfg(not(feature = "hacspec"))] + extern "C" { + /// Immediate sender of the message (either contract or account). + pub(crate) fn get_receive_sender(start: *mut u8); + } + + #[cfg(not(feature = "hacspec"))] + #[trusted] + pub(crate) fn get_receive_sender_creusot(start: *mut u8) { + unsafe { get_receive_sender(start) } + } + + #[cfg(feature = "hacspec")] + pub(crate) fn get_receive_sender_hacspec(start: PublicByteSeq) -> PublicByteSeq { + start + } + + #[cfg(not(feature = "hacspec"))] + pub(crate) fn get_receive_sender_hacspec(start: PublicByteSeq) -> PublicByteSeq { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(start.clone())[..]; + get_receive_sender_creusot(temp.as_mut_ptr()); + coerce_rust_to_hacspec_public_byte_seq(&temp) + } + +#+end_src +Get receive owner extern (unused) +#+begin_src rust :tangle no +#[cfg(not(feature = "hacspec"))] +extern "C" { + /// Owner of the contract, AccountAddress. + pub(crate) fn get_receive_owner(start: *mut u8); +} + +#[cfg(not(feature = "hacspec"))] +#[trusted] +pub(crate) fn get_receive_owner_creusot(start: *mut u8) { + unsafe { get_receive_owner(start) } +} + +#[cfg(feature = "hacspec")] +pub(crate) fn get_receive_owner_hacspec(start: PublicByteSeq) -> PublicByteSeq { + start +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn get_receive_owner_hacspec(start: PublicByteSeq) -> PublicByteSeq { + let temp = &mut coerce_hacspec_to_rust_public_byte_seq(start.clone())[..]; + get_receive_owner_creusot(temp.as_mut_ptr()); + coerce_rust_to_hacspec_public_byte_seq(&temp) +} +#+end_src +Get slot time extern +#+begin_src rust + #[cfg(not(feature = "hacspec"))] + extern "C" { + // Getters for the chain meta data + /// Slot time (in milliseconds) from chain meta data + pub(crate) fn get_slot_time() -> u64; + } + + #[cfg(not(feature = "hacspec"))] + #[trusted] + pub(crate) fn get_slot_time_creusot() -> u64 { + unsafe { get_slot_time() } + } + + #[cfg(feature = "hacspec")] + pub(crate) fn get_slot_time_hacspec() -> u64 { + 1u64 + } + + #[cfg(not(feature = "hacspec"))] + pub(crate) fn get_slot_time_hacspec() -> u64 { + get_slot_time_creusot() + } +#+end_src +Report Error (TODO) + +** Coq code + +#+begin_src elisp :var SOURCE-CODE-FILE="Concordium_Prims.v" :results output silent :tangle no +(org-babel-detangle SOURCE-CODE-FILE) +#+end_src + +*** concordium_prims - Coq code +:PROPERTIES: +:header-args: coq :tangle Concordium_Prims.v :mkdirp yes :comments link +:header-args: coq :eval never :results output silent +:END: + +#+begin_src coq + +(** This file was automatically generated using Hacspec **) +Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +From Coq Require Import List. +Import ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. +Open Scope hacspec_scope. +#+end_src + +#+begin_src coq +Require Import Hacspec_Lib. +Export Hacspec_Lib. +#+end_src + +#+begin_src coq +Definition accept_hacspec : int32 := + @repr WORDSIZE32 1. +#+end_src + +#+begin_src coq +Definition simple_transfer_hacspec + (buf_0 : public_byte_seq) + (amount_1 : int64): int32 := + @repr WORDSIZE32 1. +#+end_src + +#+begin_src coq +Definition send_hacspec + (addr_index_2 : int64) + (addr_subindex_3 : int64) + (receive_name_4 : public_byte_seq) + (amount_5 : int64) + (parameter_6 : public_byte_seq): int32 := + @repr WORDSIZE32 1. +#+end_src + +#+begin_src coq +Definition combine_and_hacspec (l_7 : int32) (r_8 : int32): int32 := + @repr WORDSIZE32 1. +#+end_src + +#+begin_src coq +Definition combine_or_hacspec (l_9 : int32) (r_10 : int32): int32 := + @repr WORDSIZE32 1. +#+end_src + +#+begin_src coq +Definition get_parameter_size_hacspec : int32 := + @repr WORDSIZE32 1. +#+end_src + +#+begin_src coq +Definition get_parameter_section_hacspec + (buf_11 : public_byte_seq) + (offset_12 : int32): (public_byte_seq ∏ int32) := + (buf_11, @repr WORDSIZE32 1). +#+end_src + +#+begin_src coq +Definition get_policy_section_hacspec + (policy_bytes_13 : public_byte_seq) + (offset_14 : int32): (public_byte_seq ∏ int32) := + (policy_bytes_13, @repr WORDSIZE32 1). +#+end_src + +#+begin_src coq +Definition log_event_hacspec + (start_15 : public_byte_seq): (public_byte_seq ∏ int32) := + (start_15, @repr WORDSIZE32 1). +#+end_src + +#+begin_src coq +Definition load_state_hacspec + (buf_16 : public_byte_seq) + (offset_17 : int32): (public_byte_seq ∏ int32) := + (buf_16, @repr WORDSIZE32 1). +#+end_src + +#+begin_src coq +Definition write_state_hacspec + (buf_18 : public_byte_seq) + (offset_19 : int32): (public_byte_seq ∏ int32) := + (buf_18, @repr WORDSIZE32 1). +#+end_src + +#+begin_src coq +Definition resize_state_hacspec (new_size_20 : int32): int32 := + @repr WORDSIZE32 1. +#+end_src + +#+begin_src coq +Definition state_size_hacspec : int32 := + @repr WORDSIZE32 1. +#+end_src + +#+begin_src coq +Definition get_init_origin_hacspec + (start_21 : public_byte_seq): public_byte_seq := + start_21. +#+end_src + +#+begin_src coq +Definition get_receive_invoker_hacspec + (start_22 : public_byte_seq): public_byte_seq := + start_22. +#+end_src + +#+begin_src coq +Definition get_receive_self_address_hacspec + (start_23 : public_byte_seq): public_byte_seq := + start_23. +#+end_src + +#+begin_src coq +Definition get_receive_self_balance_hacspec : int64 := + @repr WORDSIZE64 1. +#+end_src + +#+begin_src coq +Definition get_receive_sender_hacspec + (start_24 : public_byte_seq): public_byte_seq := + start_24. +#+end_src + +#+begin_src coq +Definition get_slot_time_hacspec : int64 := + @repr WORDSIZE64 1. +#+end_src +# 21 code sections + +* Concordium "Impls" specification +** Rust code +:PROPERTIES: +:header-args: :tangle ../concordium/src/concordium_impls.rs :mkdirp yes :eval never +:END: + +*** Imports +#+BEGIN_SRC rust +#[cfg(not(feature = "hacspec"))] +use crate::{ + // collections::{BTreeMap, BTreeSet}, + convert::{self}, // , TryFrom, TryInto + // hash::Hash, + num::NonZeroI32, + trap, + vec::Vec, + // String, + ,* +}; + +#[cfg(not(feature = "hacspec"))] +extern crate hacspec_lib; + +use hacspec_lib::*; + +#[cfg(not(feature = "hacspec"))] +use hacspec_lib::Seq; // TODO: fix name collision + +use concordium_prims::*; +use concordium_types::*; +use concordium_traits::*; +#+END_SRC + +*** Reject +We modle reject as the underlying data, that is the src_rust[:eval never]{i32} error code. The default constructor is i32 min. +#+begin_src rust +pub type RejectHacspec = i32; + +pub fn reject_impl_deafult() -> RejectHacspec { + -2_147_483_648i32 // i32::MIN +} + +#+end_src +We then implement the new operations for Reject. +#+begin_src rust +pub fn new_reject_impl(x: i32) -> Option:: { // Option + // TODO: fix 'identifier is not a constant' error (Seems to be fixed by some import?) + if x < 0i32 { + Option::::Some(x) + } else { + Option::::None + } +} + +#+end_src +We define the coercion function for Reject, and implement the traits +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +#[trusted] +#[ensures(!(result == 0i32))] +pub fn non_zero_i32(v : i32) -> NonZeroI32 { + unsafe { NonZeroI32::new_unchecked(v) } +} + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_hacspec_to_rust_reject(hacspec_reject: RejectHacspec) -> Reject { + Reject { + error_code: non_zero_i32(hacspec_reject), + } +} +#+end_src + +**** Reject - From trait +We modle the unsafe block with unchecked non zero as a precondition using requires giving us the hacspec equivalent +#+begin_src rust +#[ensures(!(result == 0i32))] // != +pub fn reject_impl_convert_from_unit() -> RejectHacspec { + -2_147_483_648i32 + 1i32 // i32::MIN +} + +#[ensures(!(result == 0i32))] // != +pub fn reject_impl_convert_from_parse_error() -> RejectHacspec { + -2_147_483_648i32 + 2i32 // i32::MIN +} +#+end_src +We then implement the traits +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +impl convert::From<()> for Reject { + #[inline(always)] + fn from(_: ()) -> Self { + coerce_hacspec_to_rust_reject(reject_impl_convert_from_unit()) + } +} + +#[cfg(not(feature = "hacspec"))] +impl convert::From for Reject { + #[inline(always)] + fn from(_: ParseError) -> Self { + coerce_hacspec_to_rust_reject(reject_impl_convert_from_parse_error()) + } +} +#+end_src +We define a log error type and function converting from it to the reject type +#+begin_src rust +#[ensures(!(result == 0i32))] // != +pub fn reject_impl_from_log_error(le: LogError) -> RejectHacspec { + match le { + LogError::Full => -2_147_483_648i32 + 3i32, // i32::MIN + LogError::Malformed => -2_147_483_648i32 + 4i32, // i32::MIN + } +} + +#+end_src +We then implement the traits +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +/// Full is mapped to i32::MIN+3, Malformed is mapped to i32::MIN+4. +impl From for Reject { + #[inline(always)] + fn from(le: LogError) -> Self { + coerce_hacspec_to_rust_reject(reject_impl_from_log_error(le)) + } +} + +#+end_src +We define a type for new contract name errors and conversion from it to reject +#+begin_src rust +#[derive(Clone)] // , Debug, PartialEq, Eq +pub enum NewContractNameError { + NewContractNameErrorMissingInitPrefix, + NewContractNameErrorTooLong, + NewContractNameErrorContainsDot, + NewContractNameErrorInvalidCharacters, +} + +#[ensures(!(result == 0i32))] // != +pub fn reject_impl_from_new_contract_name_error(nre: NewContractNameError) -> RejectHacspec { + match nre { + NewContractNameError::NewContractNameErrorMissingInitPrefix => -2_147_483_648i32 + 5i32, // i32::MIN + NewContractNameError::NewContractNameErrorTooLong => -2_147_483_648i32 + 6i32, // i32::MIN + NewContractNameError::NewContractNameErrorContainsDot => -2_147_483_648i32 + 9i32, // i32::MIN + NewContractNameError::NewContractNameErrorInvalidCharacters => -2_147_483_648i32 + 10i32, // i32::MIN + } +} + +#+end_src +We then implement the traits +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +/// MissingInitPrefix is mapped to i32::MIN + 5, +/// TooLong to i32::MIN + 6, +/// ContainsDot to i32::MIN + 9, and +/// InvalidCharacters to i32::MIN + 10. +impl From for Reject { + fn from(nre: NewContractNameError) -> Self { + coerce_hacspec_to_rust_reject(reject_impl_from_new_contract_name_error(nre)) + } +} + +#+end_src +We define a type for new receive name errors and conversion from it to reject +#+begin_src rust +#[derive(Clone)] // , Debug, PartialEq, Eq +pub enum NewReceiveNameError { + NewReceiveNameErrorMissingDotSeparator, + NewReceiveNameErrorTooLong, + NewReceiveNameErrorInvalidCharacters, +} + +#[ensures(!(result == 0i32))] // != +pub fn reject_impl_from_new_receive_name_error(nre: NewReceiveNameError) -> RejectHacspec { + match nre { + NewReceiveNameError::NewReceiveNameErrorMissingDotSeparator => -2_147_483_648i32 + 7i32, // i32::MIN + NewReceiveNameError::NewReceiveNameErrorTooLong => -2_147_483_648i32 + 8i32, // i32::MIN + NewReceiveNameError::NewReceiveNameErrorInvalidCharacters => -2_147_483_648i32 + 11i32, // i32::MIN + } +} + +#+end_src +We then implement the traits +#+begin_src rust + #[cfg(not(feature = "hacspec"))] + /// MissingDotSeparator is mapped to i32::MIN + 7, + /// TooLong to i32::MIN + 8, and + /// InvalidCharacters to i32::MIN + 11. + impl From for Reject { + fn from(nre: NewReceiveNameError) -> Self { + coerce_hacspec_to_rust_reject(reject_impl_from_new_receive_name_error(nre)) + } + } + +#+end_src + +We then implement the traits +#+begin_src rust +#[ensures(!(result == 0i32))] // != +pub fn reject_impl_from_not_payable_error() -> RejectHacspec { + -2_147_483_648i32 + 12i32 // i32::MIN +} +#+end_src + +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +/// The error code is i32::MIN + 12 +impl From for Reject { + #[inline(always)] + fn from(_: NotPayableError) -> Self { + coerce_hacspec_to_rust_reject(reject_impl_from_not_payable_error()) + } +} +#+end_src + +*** Contract state +We define contract state as its inner state namely the current position of the src_rust[:eval never]{u32} type. +#+begin_src rust + pub type ContractStateHacspec = u32; + +#+end_src +**** Contract State -- Seek +#+begin_src rust +#[derive(Copy, Clone)] // , Debug, PartialEq, Eq +pub enum SeekFromHacspec { + /// Sets the offset to the provided number of bytes. + Start(u64), + + /// Sets the offset to the size of this object plus the specified number of + /// bytes. + /// + /// It is possible to seek beyond the end of an object, but it's an error to + /// seek before byte 0. + End(i64), + + /// Sets the offset to the current position plus the specified number of + /// bytes. + /// + /// It is possible to seek beyond the end of an object, but it's an error to + /// seek before byte 0. + Current(i64), +} + +pub type U32Option = Option; +pub type I64Option = Option; + +// #[requires(forall pos === SeekFrom::End(delta) ==> exists current_position.checked_add(delta as u32) == U32Option::Some(b))] +pub fn contract_state_impl_seek(current_position: ContractStateHacspec, end : u32, pos: SeekFromHacspec) -> Result<(ContractStateHacspec, u64), ()> { + match pos { + SeekFromHacspec::Start(offset) => Result::<(ContractStateHacspec, u64), ()>::Ok((offset as u32, offset)), + SeekFromHacspec::End(delta) => { + if delta >= 0_i64 { + match current_position.checked_add(delta as u32) { + U32Option::Some(b) => Result::<(ContractStateHacspec, u64), ()>::Ok((b, b as u64)), + U32Option::None => Result::<(ContractStateHacspec, u64), ()>::Err(()), + } + } else { + match delta.checked_abs() { + I64Option::Some(before) => + { + if (before as u32) <= end { + Result::<(ContractStateHacspec, u64), ()>::Ok(((end - (before as u32)), (end - (before as u32)) as u64)) + } + else { + Result::<(ContractStateHacspec, u64), ()>::Err(()) + } + } + I64Option::None => Result::<(ContractStateHacspec, u64), ()>::Err(()), + } + } + } + SeekFromHacspec::Current(delta) => { + if delta >= 0_i64 { + match current_position.checked_add(delta as u32) { + U32Option::Some(offset) => Result::<(ContractStateHacspec, u64), ()>::Ok((offset, offset as u64)), + U32Option::None => Result::<(ContractStateHacspec, u64), ()>::Err(()), + } + } else { + match delta.checked_abs() { + I64Option::Some(b) => match current_position.checked_sub(b as u32) { + U32Option::Some(offset) => Result::<(ContractStateHacspec, u64), ()>::Ok((offset, offset as u64)), + U32Option::None => Result::<(ContractStateHacspec, u64), ()>::Err(()), + }, + I64Option::None => Result::<(ContractStateHacspec, u64), ()>::Err(()), + } + } + } + } +} +#+end_src +We then implement the traits +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +pub fn coerce_rust_to_hacspec_contract_state( + rust_contract_state: &mut ContractState, +) -> ContractStateHacspec { + rust_contract_state.current_position.clone() +} + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_hacspec_to_rust_contract_state( + rust_contract_state: &mut ContractState, + hacspec_contract_state: ContractStateHacspec, +) { + rust_contract_state.current_position = hacspec_contract_state; +} + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_hacspec_to_rust_seek_result( + rust_contract_state: &mut ContractState, + hacspec_seek_result: Result<(ContractStateHacspec, u64), ()>, +) -> Result { + let (hacspec_result, rust_result) = hacspec_seek_result?; + coerce_hacspec_to_rust_contract_state(rust_contract_state, hacspec_result); + Ok(rust_result) +} + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_rust_to_hacspec_seek_from(rust_seek_from: SeekFrom) -> SeekFromHacspec { + match rust_seek_from { + SeekFrom::Start(v) => SeekFromHacspec::Start(v), + SeekFrom::End(v) => SeekFromHacspec::End(v), + SeekFrom::Current(v) => SeekFromHacspec::Current(v), + } +} + +#[cfg(not(feature = "hacspec"))] +/// # Contract state trait implementations. +impl Seek for ContractState { + type Err = (); + + fn seek(&mut self, pos: SeekFrom) -> Result { + let contract_state = coerce_rust_to_hacspec_contract_state(self); + coerce_hacspec_to_rust_seek_result( + self, + contract_state_impl_seek( + contract_state, + self.size(), + coerce_rust_to_hacspec_seek_from(pos), + ), + ) + } +} +#+end_src +**** Contract State -- Read +#+begin_src rust +pub fn contract_state_impl_read_read( + current_position: ContractStateHacspec, + buf : PublicByteSeq, +) -> (ContractStateHacspec, usize) { + let (_buf, num_read) = load_state_hacspec(buf, current_position); + (current_position + num_read, num_read as usize) +} + +/// Read a u32 in little-endian format. This is optimized to not +/// initialize a dummy value before calling an external function. +pub fn contract_state_impl_read_read_u64( + current_position: ContractStateHacspec, +) -> (ContractStateHacspec, Result) { + // let mut bytes: MaybeUninit<[u8; 8]> = MaybeUninit::uninit(); + let buf = PublicByteSeq::new(8); + let (buf, num_read) = load_state_hacspec(buf, current_position); + (current_position + num_read, + if num_read == 8u32 { + Result::::Ok(u64_from_le_bytes(u64Word::from_seq(&buf))) + } else { + Result::::Err(()) + }) // num_read as u64 +} + +/// Read a u32 in little-endian format. This is optimized to not +/// initialize a dummy value before calling an external function. +pub fn contract_state_impl_read_read_u32( + current_position: ContractStateHacspec, +) -> (ContractStateHacspec, Result) { + // let mut bytes: MaybeUninit<[u8; 4]> = MaybeUninit::uninit(); + let buf = PublicByteSeq::new(4); + let (buf, num_read) = load_state_hacspec(buf, current_position); + (current_position + num_read, + if num_read == 4u32 { + Result::::Ok(u32_from_le_bytes(u32Word::from_seq(&buf))) + } else { + Result::::Err(()) + }) // num_read as u64 +} + +/// Read a u8 in little-endian format. This is optimized to not +/// initialize a dummy value before calling an external function. +pub fn contract_state_impl_read_read_u8( + current_position: ContractStateHacspec, +) -> (ContractStateHacspec, Result) { + let buf = PublicByteSeq::new(1); + let (buf, num_read) = load_state_hacspec(buf, current_position); + (current_position + num_read, + if num_read == 1u32 { + Result::::Ok(buf[0]) + } else { + Result::::Err(()) + }) // num_read as u64 +} + +#+end_src +We then implement the traits +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +impl Read for ContractState { + fn read(&mut self, buf: &mut [u8]) -> ParseResult { + let (cs, nr) = contract_state_impl_read_read( + coerce_rust_to_hacspec_contract_state(self), + coerce_rust_to_hacspec_public_byte_seq(buf), + ); + coerce_hacspec_to_rust_contract_state(self, cs); + Ok(nr) + } + + // TODO: !! Probably incorrect !! + /// Read a `u32` in little-endian format. This is optimized to not + /// initialize a dummy value before calling an external function. + fn read_u64(&mut self) -> ParseResult { + let (cs, nr) = + contract_state_impl_read_read_u64(coerce_rust_to_hacspec_contract_state(self)); + coerce_hacspec_to_rust_contract_state(self, cs); + match nr { + Result::::Ok(a) => ParseResult::::Ok(a), + Result::::Err(_) => ParseResult::::Err(ParseError::default()), + } + } + + /// Read a `u32` in little-endian format. This is optimized to not + /// initialize a dummy value before calling an external function. + fn read_u32(&mut self) -> ParseResult { + let (cs, nr) = + contract_state_impl_read_read_u32(coerce_rust_to_hacspec_contract_state(self)); + coerce_hacspec_to_rust_contract_state(self, cs); + match nr { + Result::::Ok(a) => ParseResult::::Ok(a), + Result::::Err(_) => ParseResult::::Err(ParseError::default()), + } + } + + /// Read a `u8` in little-endian format. This is optimized to not + /// initialize a dummy value before calling an external function. + fn read_u8(&mut self) -> ParseResult { + let (cs, nr) = + contract_state_impl_read_read_u8(coerce_rust_to_hacspec_contract_state(self)); + coerce_hacspec_to_rust_contract_state(self, cs); + match nr { + Result::::Ok(a) => ParseResult::::Ok(a), + Result::::Err(_) => ParseResult::::Err(ParseError::default()), + } + } +} +#+end_src + +**** Contract State -- Write +#+begin_src rust +pub fn contract_state_impl_write( + current_position: ContractStateHacspec, + buf: PublicByteSeq, +) -> Result<(ContractStateHacspec, usize), ()> { + if current_position.checked_add(buf.len() as u32).is_none() { + Result::<(ContractStateHacspec, usize), ()>::Err(())?; + } + let (_buf, num_bytes) = write_state_hacspec(buf, current_position); + Result::<(ContractStateHacspec, usize), ()>::Ok(( + current_position + num_bytes, + num_bytes as usize, + )) +} + +#+end_src +We then implement the traits +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +impl Write for ContractState { + type Err = (); + + fn write(&mut self, buf: &[u8]) -> Result { + let (cs, nr) = contract_state_impl_write( + coerce_rust_to_hacspec_contract_state(self), + coerce_rust_to_hacspec_public_byte_seq(buf), + )?; + coerce_hacspec_to_rust_contract_state(self, cs); + Ok(nr) + } +} +#+end_src + +**** Contract State -- Misc. + +#+begin_src rust +pub fn has_contract_state_impl_for_contract_state_open() -> ContractStateHacspec { + 0_u32 +} + +pub fn has_contract_state_impl_for_contract_state_reserve( + len: u32, +) -> bool { + let cur_size = state_size_hacspec(); + if cur_size < len { + resize_state_hacspec(len) == 1_u32 + } else { + true + } +} + +pub fn has_contract_state_impl_for_contract_state_truncate( + current_position : ContractStateHacspec, + cur_size: u32, + new_size: u32, +) -> ContractStateHacspec { + if cur_size > new_size { + resize_state_hacspec(new_size); + } + if new_size < current_position { + new_size + } + else { + current_position + } +} +#+end_src +We then implement the traits +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +impl HasContractState<()> for ContractState { + type ContractStateData = (); + + #[inline(always)] + fn open(_: Self::ContractStateData) -> Self { + ContractState { + current_position: has_contract_state_impl_for_contract_state_open(), + } + } + + fn reserve(&mut self, len: u32) -> bool { + has_contract_state_impl_for_contract_state_reserve(len) + } + + #[inline(always)] + fn size(&self) -> u32 { + state_size_hacspec() + } + + fn truncate(&mut self, new_size: u32) { + let current_position = coerce_rust_to_hacspec_contract_state(self); + coerce_hacspec_to_rust_contract_state( + self, + has_contract_state_impl_for_contract_state_truncate( + current_position, + self.size(), + new_size, + ), + ) + } +} + +#+end_src + +*** Parameter +We define parameter +#+begin_src rust + pub type ParameterHacspec = u32; + + pub fn read_impl_for_parameter_read( + current_position: ParameterHacspec, + buf: PublicByteSeq, + ) -> (ParameterHacspec, usize) { + let (_buf, num_read) = get_parameter_section_hacspec(buf, current_position); + (current_position + num_read, num_read as usize) + } + +#+end_src +We then implement the traits +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +pub fn coerce_rust_to_hacspec_parameter( + rust_parameter: &mut concordium_types::Parameter, +) -> ParameterHacspec { + rust_parameter.current_position.clone() +} + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_hacspec_to_rust_parameter( + rust_parameter: &mut concordium_types::Parameter, + hacspec_parameter: ParameterHacspec, +) { + rust_parameter.current_position = hacspec_parameter; +} + + +#[cfg(not(feature = "hacspec"))] +/// # Trait implementations for Parameter +impl Read for concordium_types::Parameter { + fn read(&mut self, buf: &mut [u8]) -> ParseResult { + let (cs, nr) = read_impl_for_parameter_read( + coerce_rust_to_hacspec_parameter(self), + coerce_rust_to_hacspec_public_byte_seq(buf), + ); + coerce_hacspec_to_rust_parameter(self, cs); + Ok(nr) + } +} + +#[cfg(not(feature = "hacspec"))] +impl HasParameter for concordium_types::Parameter { + #[inline(always)] + fn size(&self) -> u32 { + get_parameter_size_hacspec() + } +} +#+end_src +*** ChainMetaExtern +We define and implement traits for ~ChainMetaExtern~. +#+begin_src rust + #[cfg(not(feature = "hacspec"))] + /// # Trait implementations for the chain metadata. + impl HasChainMetadata for ChainMetaExtern { + #[inline(always)] + fn slot_time(&self) -> SlotTime { + Timestamp::from_timestamp_millis(get_slot_time_hacspec() ) + } + } +#+end_src + +*** AttributesCursor +#+begin_src rust + // pub struct AttributeTag(pub u8); + pub type AttributesCursorHacspec = (u32, u16); + + // pub fn has_policy_impl_for_policy_attributes_cursor_next_test( + // policy_attribute_items: AttributesCursorHacspec, + // ) -> bool { + // let (_, remaining_items) = policy_attribute_items; + // remaining_items == 0_u16 + // } + + // pub fn has_policy_impl_for_policy_attributes_cursor_next_tag_invalid( + // policy_attribute_items: AttributesCursorHacspec, + // tag_value_len_1: u8, + // num_read: u32, + // ) -> (AttributesCursorHacspec, bool) { + // let (current_position, remaining_items) = policy_attribute_items; + // let policy_attribute_items = (current_position + num_read, remaining_items); + // (policy_attribute_items, tag_value_len_1 > 31_u8) + // } + + pub fn has_policy_impl_for_policy_attributes_cursor_next_item( + policy_attribute_items: AttributesCursorHacspec, + buf: PublicByteSeq, + ) -> Option<(AttributesCursorHacspec, (u8, u8))> { + + let (mut current_position, mut remaining_items) = policy_attribute_items; + + if remaining_items == 0u16 { + Option::<(AttributesCursorHacspec, (u8, u8))>::None?; + } + + let (tag_value_len, num_read) = get_policy_section_hacspec(PublicByteSeq::new(2), current_position); + current_position = current_position + num_read; + + if tag_value_len[1] > 31u8 { + // Should not happen because all attributes fit into 31 bytes. + Option::<(AttributesCursorHacspec, (u8, u8))>::None?; + } + + let (_buf, num_read) = get_policy_section_hacspec(buf, current_position); + current_position = current_position + num_read; + remaining_items = remaining_items - 1u16; + Option::<(AttributesCursorHacspec, (u8, u8))>::Some(((current_position, remaining_items), (tag_value_len[0], tag_value_len[1]))) + } + +#+end_src +We then define traits +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +pub fn coerce_rust_to_hacspec_attributes_cursor( + rust_attributes_cursor: &mut AttributesCursor, +) -> AttributesCursorHacspec { + ( + rust_attributes_cursor.current_position.clone(), + rust_attributes_cursor.remaining_items.clone(), + ) +} + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_hacspec_to_rust_attributes_cursor( + rust_attributes_cursor: &mut AttributesCursor, + hacspec_attributes_cursor: AttributesCursorHacspec, +) { + let (current_position, remaining_items) = hacspec_attributes_cursor; + rust_attributes_cursor.current_position = current_position; + rust_attributes_cursor.remaining_items = remaining_items; +} + +// TODO: Creusot issues? +#[cfg(not(feature = "hacspec"))] +impl HasPolicy for Policy { + fn identity_provider(&self) -> IdentityProvider { + self.identity_provider + } + + fn created_at(&self) -> Timestamp { + self.created_at + } + + fn valid_to(&self) -> Timestamp { + self.valid_to + } + + fn next_item(&mut self, buf: &mut [u8; 31]) -> Option<(AttributeTag, u8)> { + let (ac, (at, v)) = has_policy_impl_for_policy_attributes_cursor_next_item( + coerce_rust_to_hacspec_attributes_cursor(&mut self.items), + coerce_rust_to_hacspec_public_byte_seq(&mut buf[..]), + )?; + coerce_hacspec_to_rust_attributes_cursor(&mut self.items, ac); + Some((AttributeTag(at), v)) + } +} +#+end_src + +*** Policy iterator +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +/// An iterator over policies using host functions to supply the data. +/// The main interface to using this type is via the methods of the [Iterator](https://doc.rust-lang.org/std/iter/trait.Iterator.html) +/// and [ExactSizeIterator](https://doc.rust-lang.org/std/iter/trait.ExactSizeIterator.html) traits. +pub struct PoliciesIterator { + /// Position in the policies binary serialization. + pos: u32, + /// Number of remaining items in the stream. + remaining_items: u16, +} + +pub type PoliciesIteratorHacspec = (u32, u16); + +// TODO: use PolicyAttributesCursorHacspec for implementation above instead of just AttributesCursorHacspec +pub type PolicyAttributesCursorHacspec = (u32, u64, u64, AttributesCursorHacspec); // IdentityProvider, Timestamp, Timestamp, AttributesCursor + +// TODO: Fix creusot issues? +fn iterator_impl_for_policies_iterator_next( + policies_iterator: PoliciesIteratorHacspec, +) -> Option<(PoliciesIteratorHacspec, PolicyAttributesCursorHacspec)> { + let (mut pos, remaining_items) = policies_iterator; + if remaining_items == 0u16 { + Option::<(PoliciesIteratorHacspec, PolicyAttributesCursorHacspec)>::None?; + } + + // 2 for total size of this section, 4 for identity_provider, + // 8 bytes for created_at, 8 for valid_to, and 2 for + // the length + let (buf, _) = get_policy_section_hacspec(PublicByteSeq::new(2 + 4 + 8 + 8 + 2), pos); + let skip_part: PublicByteSeq = buf.slice_range(0..2); + let ip_part: PublicByteSeq = buf.slice_range(2..2 + 4); + let created_at_part: PublicByteSeq = buf.slice_range(2 + 4..2 + 4 + 8); + let valid_to_part: PublicByteSeq = buf.slice_range(2 + 4 + 8..2 + 4 + 8 + 8); + let len_part: PublicByteSeq = buf.slice_range(2 + 4 + 8 + 8..2 + 4 + 8 + 8 + 2); + let identity_provider = u32_from_le_bytes(u32Word::from_seq(&ip_part)); // IdentityProvider = u32 // UnsignedPublicInteger + let created_at = u64_from_le_bytes(u64Word::from_seq(&created_at_part)); // Timestamp = Timestamp::from_timestamp_millis(u64) + let valid_to = u64_from_le_bytes(u64Word::from_seq(&valid_to_part)); // Timestamp = u64) + let mut remaining_items = u16_from_le_bytes(u16Word::from_seq(&len_part)); + let attributes_start = pos + 2u32 + 4u32 + 8u32 + 8u32 + 2u32; + pos = pos + (u16_from_le_bytes(u16Word::from_seq(&skip_part)) as u32) + 2u32; + remaining_items = remaining_items - 1u16; + Option::<(PoliciesIteratorHacspec, PolicyAttributesCursorHacspec)>::Some(( + (pos, remaining_items), + ( + identity_provider, + created_at, + valid_to, + (attributes_start, remaining_items), + ), + )) +} + +// TODO: Fix creusot issues? +#[cfg(not(feature = "hacspec"))] +impl Iterator for PoliciesIterator { + type Item = Policy; + + fn next(&mut self) -> Option { + let ((pos, remaining_items), (identity_provider, created_at, valid_to, (cp, ri))) = + iterator_impl_for_policies_iterator_next((self.pos, self.remaining_items))?; + + // TODO: make into coerce function + self.pos = pos; + self.remaining_items = remaining_items; + + Some(Policy { + identity_provider, + created_at: Timestamp::from_timestamp_millis(created_at), + valid_to: Timestamp::from_timestamp_millis(valid_to), + items: AttributesCursor { + current_position: cp, + remaining_items: ri, + }, + }) + } + + fn size_hint(&self) -> (usize, Option) { + let rem = self.remaining_items as usize; + (rem, Some(rem)) + } +} + +#[cfg(not(feature = "hacspec"))] +impl ExactSizeIterator for PoliciesIterator { + #[inline(always)] + fn len(&self) -> usize { + self.remaining_items.into() // as usize + } +} +#+end_src + +*** External context +#+begin_src rust + +#[cfg(not(feature = "hacspec"))] +impl HasCommonData for ExternContext { + type MetadataType = ChainMetaExtern; + type ParamType = concordium_types::Parameter; + type PolicyIteratorType = PoliciesIterator; + type PolicyType = Policy; + + // TODO: fix creusot issue + #[inline(always)] + fn metadata(&self) -> &Self::MetadataType { + &ChainMetaExtern {} + } + + fn policies(&self) -> PoliciesIterator { + let (buf, _) = get_policy_section_hacspec(PublicByteSeq::new(2), 0); + PoliciesIterator { + pos: 2, // 2 because we already read 2 bytes. + remaining_items: u16_from_le_bytes(u16Word::from_seq(&buf)), + } + } + + #[inline(always)] + fn parameter_cursor(&self) -> Self::ParamType { + concordium_types::Parameter { + current_position: 0, + } + } +} + +#[cfg(not(feature = "hacspec"))] +/// # Trait implementations for the init context +impl HasInitContext for ExternContext { + type InitData = (); + + /// Create a new init context by using an external call. + fn open(_: Self::InitData) -> Self { + ExternContext::default() + } + + #[inline(always)] + fn init_origin(&self) -> AccountAddress { + let mut address : [u8; ACCOUNT_ADDRESS_SIZE] = Default::default(); + let temp = coerce_hacspec_to_rust_public_byte_seq(get_init_origin_hacspec( + PublicByteSeq::new(ACCOUNT_ADDRESS_SIZE), + )); + address.clone_from_slice(temp.as_slice()); + AccountAddress(address) + } +} + +#[cfg(not(feature = "hacspec"))] +/// # Trait implementations for the receive context +impl HasReceiveContext for ExternContext { + type ReceiveData = (); + + /// Create a new receive context + fn open(_: Self::ReceiveData) -> Self { + ExternContext::default() + } + + // TODO: Make usable by creusot + #[inline(always)] + fn invoker(&self) -> AccountAddress { + let mut address: [u8; ACCOUNT_ADDRESS_SIZE] = Default::default(); + address.clone_from_slice( + &mut coerce_hacspec_to_rust_public_byte_seq(get_receive_invoker_hacspec( + PublicByteSeq::new(ACCOUNT_ADDRESS_SIZE), + ))[..], + ); + AccountAddress(address) + } + + // TODO: Make usable by creusot + #[inline(always)] + fn self_address(&self) -> ContractAddress { + let mut address: [u8; ACCOUNT_ADDRESS_SIZE] = Default::default(); + address.clone_from_slice( + &mut coerce_hacspec_to_rust_public_byte_seq(get_receive_self_address_hacspec( + PublicByteSeq::new(ACCOUNT_ADDRESS_SIZE), + ))[..], + ); + match concordium_contracts_common::from_bytes(&address) { + Ok(v) => v, + Err(_) => trap(), + } + } + + #[inline(always)] + fn self_balance(&self) -> Amount { + Amount::from_micro_ccd(get_receive_self_balance_hacspec()) + } + + // TODO: Make usable by creusot + // TODO: Remove/replace unsafe code ! + #[inline(always)] + fn sender(&self) -> Address { + let ptr : *mut u8 = (&mut coerce_hacspec_to_rust_public_byte_seq(get_receive_sender_hacspec( + PublicByteSeq::new(ACCOUNT_ADDRESS_SIZE), + ))[..]).as_mut_ptr(); + let tag = unsafe { *ptr }; + match tag { + 0u8 => { + match concordium_contracts_common::from_bytes(unsafe { core::slice::from_raw_parts( + ptr.add(1), + ACCOUNT_ADDRESS_SIZE, + )} ) { + Ok(v) => Address::Account(v), + Err(_) => trap(), + } + } + 1u8 => match concordium_contracts_common::from_bytes(unsafe { core::slice::from_raw_parts(ptr.add(1), 16) }) { + Ok(v) => Address::Contract(v), + Err(_) => trap(), + }, + _ => trap(), // unreachable!("Host violated precondition."), + } + } + + // TODO: Make usable by creusot + #[inline(always)] + fn owner(&self) -> AccountAddress { + let mut address: [u8; ACCOUNT_ADDRESS_SIZE] = Default::default(); + address.clone_from_slice( + &mut coerce_hacspec_to_rust_public_byte_seq(get_receive_self_address_hacspec( + PublicByteSeq::new(ACCOUNT_ADDRESS_SIZE), + ))[..], + ); + AccountAddress(address) + } +} +#+end_src + +*** Logger +#+begin_src rust + #[cfg(not(feature = "hacspec"))] + /// #Implementations of the logger. + impl HasLogger for Logger { + #[inline(always)] + fn init() -> Self { + Self { _private: () } + } + + fn log_raw(&mut self, event: &[u8]) -> Result<(), LogError> { + let (_, res) = log_event_hacspec(coerce_rust_to_hacspec_public_byte_seq(event)); + match res { + 1 => Ok(()), + 0 => Err(LogError::Full), + _ => Err(LogError::Malformed), + } + } + } +#+end_src +*** Action +#+begin_src rust :eval never +// #[cfg(feature = "hacspec")] +array!(UserAddress, 32, u8); + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_hacspec_to_rust_account_address(ua: UserAddress) -> AccountAddress { + AccountAddress([ + ua[0], ua[1], ua[2], ua[3], ua[4], ua[5], ua[6], ua[7], ua[8], ua[9], ua[10], ua[11], + ua[12], ua[13], ua[14], ua[15], ua[16], ua[17], ua[18], ua[19], ua[20], ua[21], ua[22], + ua[23], ua[24], ua[25], ua[26], ua[27], ua[28], ua[29], ua[30], ua[31], + ]) +} + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_rust_to_hacspec_account_address(aa: &AccountAddress) -> UserAddress { + UserAddress::from_native_slice(&aa.0) +} + +#+end_src + +#+begin_src rust + +// #[cfg(feature = "hacspec")] +// #[cfg_attr(feature = "use_attributes", in_hacspec(Action))] +pub enum HasAction { + Accept(), + SimpleTransfer(UserAddress, u64), + // TODO: add send_raw + SendRaw( + UserAddress, + String, // TODO: Should be ReceiveName => string + u64, + PublicByteSeq, + ), + // AND_THEN(HasAction, HasAction), + // OR_ELSE(HasAction, HasAction) +} +#[cfg(feature = "hacspec")] +pub type ListAction = Seq; + +// #[cfg(feature = "hacspec")] +pub fn accept_action() -> HasAction { + HasAction::Accept() +} + +// pub type ContextState = (Context, ()); + +// #[cfg(feature = "hacspec")] +// #[init(contract = "auction")] +// pub fn auction_init(ctx : Context) -> ContextState { +// // Always succeeds +// (ctx, ()) +// } + +// pub fn auction_init2(ctx : Context) -> ContextState { +// // Always succeeds +// (ctx, ()) +// } + +// Owner, Sender, Balance, Data / time +pub struct Context(pub UserAddress, pub UserAddress, pub u64, pub u64); + +#[cfg(not(feature = "hacspec"))] +pub fn coerce_rust_to_hacspec_context(ctx: &impl HasReceiveContext) -> Context { + Context( + coerce_rust_to_hacspec_account_address(&ctx.owner()), + match ctx.sender() { + Address::Contract(_) => panic!(), + Address::Account(account_address) => coerce_rust_to_hacspec_account_address(&account_address), + }, + ctx.self_balance().micro_ccd, + ctx.metadata().slot_time().timestamp_millis(), + ) +} + +#[cfg(not(feature = "hacspec"))] +/// #Implementation of actions. +/// These actions are implemented by direct calls to host functions. +impl HasActions for Action { + #[inline(always)] + fn accept() -> Self { + Action { + _private: accept_hacspec(), + } + } + + #[inline(always)] + fn simple_transfer(acc: &AccountAddress, amount: Amount) -> Self { + let res = simple_transfer_hacspec(coerce_rust_to_hacspec_public_byte_seq(&acc.0), amount.micro_ccd); + Action { _private: res } + } + + #[inline(always)] + fn send_raw( + ca: &ContractAddress, + receive_name: ReceiveName, + amount: Amount, + parameter: &[u8], + ) -> Self { + let receive_bytes = receive_name.get_chain_name().as_bytes(); + let res = + send_hacspec( + ca.index, + ca.subindex, + coerce_rust_to_hacspec_public_byte_seq(&receive_bytes), + amount.micro_ccd, + coerce_rust_to_hacspec_public_byte_seq(¶meter), + ); + Action { _private: res } + } + + #[inline(always)] + fn and_then(self, then: Self) -> Self { + let res = combine_and_hacspec(self._private, then._private); + Action { _private: res } + } + + #[inline(always)] + fn or_else(self, el: Self) -> Self { + let res = combine_or_hacspec(self._private, el._private); + Action { _private: res } + } +} +#+end_src + +*** Used as is +# TODO: Get functionlity of everything into hacspec +#+begin_src rust +// TODO: Define functionality in hacspec instead! +#[cfg(not(feature = "hacspec"))] +/// Allocates a Vec of bytes prepended with its length as a `u32` into memory, +/// and prevents them from being dropped. Returns the pointer. +/// Used to pass bytes from a Wasm module to its host. +#[doc(hidden)] +pub fn put_in_memory(input: &[u8]) -> *mut u8 { + let bytes_length = input.len() as u32; + let mut bytes = concordium_contracts_common::to_bytes(&bytes_length); + bytes.extend_from_slice(input); + let ptr = bytes.as_mut_ptr(); + #[cfg(feature = "std")] + ::std::mem::forget(bytes); + #[cfg(not(feature = "std"))] + core::mem::forget(bytes); + ptr +} + +#+end_src + +# TODO: Get functionlity of everything into hacspec +#+begin_src rust +// #[cfg(feature = "hacspec")] +/// Wrapper for +/// [HasActions::send_raw](../trait.HasActions.html#tymethod.send_raw), which +/// automatically serializes the parameter. Note that if the parameter is +/// already a byte array or convertible to a byte array without allocations it +/// is preferrable to use [send_raw](../trait.HasActions.html#tymethod.send_raw). +/// It is more efficient and avoids memory allocations. +pub fn send_wrap_hacspec( + ca_index: u64, + ca_subindex: u64, + receive_name_bytes: PublicByteSeq, + amount: u64, + param_bytes: PublicByteSeq, +) -> u32 { + send_hacspec( + ca_index, + ca_subindex, + receive_name_bytes, + amount, + param_bytes, + ) +} + + +// TODO: Get functionlity of everything into hacspec +#[allow(dead_code)] +#[cfg(not(feature = "hacspec"))] +/// Wrapper for +/// [HasActions::send_raw](../trait.HasActions.html#tymethod.send_raw), which +/// automatically serializes the parameter. Note that if the parameter is +/// already a byte array or convertible to a byte array without allocations it +/// is preferrable to use [send_raw](../trait.HasActions.html#tymethod.send_raw). +/// It is more efficient and avoids memory allocations. +pub fn send_wrap( + ca: &ContractAddress, + receive_name: ReceiveName, + amount: Amount, + parameter: &P, +) -> A { + let param_bytes = concordium_contracts_common::to_bytes(parameter); + A::send_raw(ca, receive_name, amount, ¶m_bytes) +} +#+end_src + +*** Remaining todo +:PROPERTIES: +:header-args: rust :tangle no :eval never +:END: + + +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +impl UnwrapAbort for Result { + type Unwrap = A; + + #[inline] + fn unwrap_abort(self) -> Self::Unwrap { + match self { + Ok(x) => x, + Err(_) => trap(), + } + } +} + +#+end_src + +#+begin_src rust +// TODO: +// #[cfg(not(feature = "hacspec"))] +// #[cfg(not(feature = "std"))] +// use crate::concordium_contracts_common::fmt; // core::fmt; + +#[cfg(not(feature = "hacspec"))] +#[cfg(feature = "std")] +use std::fmt; + +#[cfg(not(feature = "hacspec"))] +#[cfg(feature = "std")] +impl ExpectReport for Result { + type Unwrap = A; + + fn expect_report(self, msg: &str) -> Self::Unwrap { + match self { + Ok(x) => x, + Err(e) => fail!("{}: {:?}", msg, e), + } + } +} + +#+end_src + +#+begin_src rust +// TODO: +#[cfg(not(feature = "hacspec"))] +#[cfg(feature = "std")] +impl ExpectErrReport for Result { + type Unwrap = E; + + fn expect_err_report(self, msg: &str) -> Self::Unwrap { + match self { + Ok(a) => fail!("{}: {:?}", msg, a), + Err(e) => e, + } + } +} + +#+end_src + +#+begin_src rust + #[cfg(not(feature = "hacspec"))] + impl UnwrapAbort for Option { + type Unwrap = A; + + #[inline(always)] + fn unwrap_abort(self) -> Self::Unwrap { + self.unwrap_or_else(|| trap()) + } + } + +#+end_src + +#+begin_src rust + // TODO: + #[cfg(not(feature = "hacspec"))] + impl ExpectReport for Option { + type Unwrap = A; + + fn expect_report(self, msg: &str) -> Self::Unwrap { + match self { + Some(v) => v, + None => fail!("{}", msg), + } + } + } + +#+end_src + +#+begin_src rust +// TODO: +#[cfg(not(feature = "hacspec"))] +#[cfg(feature = "std")] +impl ExpectNoneReport for Option { + fn expect_none_report(self, msg: &str) { + if let Some(x) = self { + fail!("{}: {:?}", msg, x) + } + } +} + +#+end_src + +#+begin_src rust +// TODO: Remove / is not in concordium-std?? +#[cfg(not(feature = "hacspec"))] +/// Write a [BTreeSet](https://doc.rust-lang.org/std/collections/struct.BTreeSet.html) as an ascending list of keys, without the length information. +pub fn serial_set_no_length( + map: &BTreeSet, + out: &mut W, +) -> Result<(), W::Err> { + for k in map.iter() { + k.serial(out)?; + } + Ok(()) +} + +#[cfg(not(feature = "hacspec"))] +impl SerialCtx for BTreeSet { + fn serial_ctx( + &self, + size_len: concordium_contracts_common::schema::SizeLength, + out: &mut W, + ) -> Result<(), W::Err> { + concordium_contracts_common::schema::serial_length(self.len(), size_len, out)?; + // concordium_std:: + serial_set_no_length(self, out) + } +} + +#+end_src + +#+begin_src rust +// TODO: Remove / is not in concordium-std?? +#[cfg(not(feature = "hacspec"))] +/// Read a [BTreeSet](https://doc.rust-lang.org/std/collections/struct.BTreeSet.html) as a list of keys, given some length. +/// NB: This ensures there are no duplicates, hence the specialized type. +/// Moreover this will only succeed if keys are listed in order. +pub fn deserial_set_no_length( + source: &mut R, + len: usize, +) -> ParseResult> { + let mut out = BTreeSet::new(); + let mut prev = None; + for _ in 0..len { + let key = source.get()?; + let next = Some(key); + if next <= prev { + return Err(ParseError::default()); + } + out.insert(key); + prev = next; + } + Ok(out) +} + +// TODO: Remove / is not in concordium-std?? +#[cfg(not(feature = "hacspec"))] +/// Read a [BTreeSet](https://doc.rust-lang.org/std/collections/struct.BTreeSet.html) as an list of key-value pairs given some length. +/// Slightly faster version of `deserial_set_no_length` as it is skipping the +/// order checking. The only check that is made to the set is that there are no +/// duplicates. +pub fn deserial_set_no_length_no_order_check( + source: &mut R, + len: usize, +) -> ParseResult> { + let mut out = BTreeSet::new(); + for _ in 0..len { + let key = source.get()?; + if !out.insert(key) { + return Err(ParseError::default()); + } + } + Ok(out) +} + +#[cfg(not(feature = "hacspec"))] +impl DeserialCtx for BTreeSet { + fn deserial_ctx( + size_len: concordium_contracts_common::schema::SizeLength, + ensure_ordered: bool, + source: &mut R, + ) -> ParseResult { + let len = concordium_contracts_common::schema::deserial_length(source, size_len)?; + if ensure_ordered { + // concordium_std:: + deserial_set_no_length(source, len) + } else { + // concordium_std:: + deserial_set_no_length_no_order_check(source, len) + } + } +} +#+end_src + +#+begin_src rust +// TODO: Remove / is not in concordium-std?? +#[cfg(not(feature = "hacspec"))] +/// Write a Map as a list of key-value pairs ordered by the key, without the +/// length information. +pub fn serial_map_no_length( + map: &BTreeMap, + out: &mut W, +) -> Result<(), W::Err> { + for (k, v) in map.iter() { + k.serial(out)?; + v.serial(out)?; + } + Ok(()) +} + +#[cfg(not(feature = "hacspec"))] +impl SerialCtx for BTreeMap { + fn serial_ctx( + &self, + size_len: concordium_contracts_common::schema::SizeLength, + out: &mut W, + ) -> Result<(), W::Err> { + concordium_contracts_common::schema::serial_length(self.len(), size_len, out)?; + // concordium_std:: + serial_map_no_length(self, out) + } +} + +#+end_src + +#+begin_src rust +// TODO: Remove / is not in concordium-std?? +#[cfg(not(feature = "hacspec"))] +/// Read a [BTreeMap](https://doc.rust-lang.org/std/collections/struct.BTreeMap.html) as a list of key-value pairs given some length. +/// NB: This ensures there are no duplicates, hence the specialized type. +/// Moreover this will only succeed if keys are listed in order. +pub fn deserial_map_no_length( + source: &mut R, + len: usize, +) -> ParseResult> { + let mut out = BTreeMap::new(); + let mut x = None; + for _ in 0..len { + let k = source.get()?; + let v = source.get()?; + match x { + None => { + out.insert(k, v); + } + Some(kk) => { + if k > kk { + out.insert(k, v); + } else { + return Err(ParseError::default()); + } + } + } + x = Some(k); + } + Ok(out) +} + +// TODO: Remove / is not in concordium-std?? +#[cfg(not(feature = "hacspec"))] +/// Read a [BTreeMap](https://doc.rust-lang.org/std/collections/struct.BTreeMap.html) as a list of key-value pairs given some length. +/// Slightly faster version of `deserial_map_no_length` as it is skipping the +/// order checking +pub fn deserial_map_no_length_no_order_check( + source: &mut R, + len: usize, +) -> ParseResult> { + let mut out = BTreeMap::new(); + for _ in 0..len { + let k = source.get()?; + let v = source.get()?; + if out.insert(k, v).is_some() { + return Err(ParseError::default()); + } + } + Ok(out) +} + +#[cfg(not(feature = "hacspec"))] +impl DeserialCtx for BTreeMap { + fn deserial_ctx( + size_len: concordium_contracts_common::schema::SizeLength, + ensure_ordered: bool, + source: &mut R, + ) -> ParseResult { + let len = concordium_contracts_common::schema::deserial_length(source, size_len)?; + if ensure_ordered { + // concordium_std:: + deserial_map_no_length(source, len) + } else { + // concordium_std:: + deserial_map_no_length_no_order_check(source, len) + } + } +} + +#+end_src + +#+begin_src rust +// TODO: Remove / is not in concordium-std?? +#[cfg(not(feature = "hacspec"))] +/// Write a [HashSet](https://doc.rust-lang.org/std/collections/struct.HashSet.html) as a list of keys in no particular order, without the length information. +pub fn serial_hashset_no_length( + map: &HashSet, + out: &mut W, +) -> Result<(), W::Err> { + for k in map.iter() { + k.serial(out)?; + } + Ok(()) +} + +#[cfg(not(feature = "hacspec"))] +/// Serialization for HashSet given a size_len. +/// Values are not serialized in any particular order. +impl SerialCtx for HashSet { + fn serial_ctx( + &self, + size_len: concordium_contracts_common::schema::SizeLength, + out: &mut W, + ) -> Result<(), W::Err> { + concordium_contracts_common::schema::serial_length(self.len(), size_len, out)?; + // concordium_std:: + serial_hashset_no_length(self, out) + } +} + +#+end_src + +#+begin_src rust +// TODO: Remove / is not in concordium-std?? +#[cfg(not(feature = "hacspec"))] +/// Read a [HashSet](https://doc.rust-lang.org/std/collections/struct.HashSet.html) as a list of keys, given some length. +/// NB: This ensures there are no duplicates. +pub fn deserial_hashset_no_length( + source: &mut R, + len: usize, +) -> ParseResult> { + let mut out = HashSet::default(); + for _ in 0..len { + let key = source.get()?; + if !out.insert(key) { + return Err(ParseError::default()); + } + } + Ok(out) +} + +#[cfg(not(feature = "hacspec"))] +/// Deserialization for HashSet given a size_len. +/// Values are not verified to be in any particular order and setting +/// ensure_ordering have no effect. +impl DeserialCtx for HashSet { + fn deserial_ctx( + size_len: concordium_contracts_common::schema::SizeLength, + _ensure_ordered: bool, + source: &mut R, + ) -> ParseResult { + let len = concordium_contracts_common::schema::deserial_length(source, size_len)?; + deserial_hashset_no_length(source, len) + } +} + +#+end_src + +#+begin_src rust +// TODO: Remove / is not in concordium-std?? +#[cfg(not(feature = "hacspec"))] +/// Write a HashMap as a list of key-value pairs in to particular order, without +/// the length information. +pub fn serial_hashmap_no_length( + map: &HashMap, + out: &mut W, +) -> Result<(), W::Err> { + for (k, v) in map.iter() { + k.serial(out)?; + v.serial(out)?; + } + Ok(()) +} + +#[cfg(not(feature = "hacspec"))] +/// Serialization for HashMap given a size_len. +/// Keys are not serialized in any particular order. +impl SerialCtx for HashMap { + fn serial_ctx( + &self, + size_len: concordium_contracts_common::schema::SizeLength, + out: &mut W, + ) -> Result<(), W::Err> { + concordium_contracts_common::schema::serial_length(self.len(), size_len, out)?; + serial_hashmap_no_length(self, out) + } +} + +#+end_src + +#+begin_src rust +// TODO: Remove / is not in concordium-std?? +#[cfg(not(feature = "hacspec"))] +/// Read a [HashMap](https://doc.rust-lang.org/std/collections/struct.HashMap.html) as a list of key-value pairs given some length. +pub fn deserial_hashmap_no_length( + source: &mut R, + len: usize, +) -> ParseResult> { + let mut out = HashMap::default(); + for _ in 0..len { + let k = source.get()?; + let v = source.get()?; + if out.insert(k, v).is_some() { + return Err(ParseError::default()); + } + } + Ok(out) +} + +#[cfg(not(feature = "hacspec"))] +/// Deserialization for HashMap given a size_len. +/// Keys are not verified to be in any particular order and setting +/// ensure_ordering have no effect. +impl DeserialCtx for HashMap { + fn deserial_ctx( + size_len: concordium_contracts_common::schema::SizeLength, + _ensure_ordered: bool, + source: &mut R, + ) -> ParseResult { + let len = concordium_contracts_common::schema::deserial_length(source, size_len)?; + // concordium_std:: + deserial_hashmap_no_length(source, len) + } +} +#+end_src + +#+begin_src rust +// TODO: Remove / is not in concordium-std?? +#[cfg(not(feature = "hacspec"))] +/// Write a slice of elements, without including length information. +/// This is intended to be used either when the length is statically known, +/// or when the length is serialized independently as part of a bigger +/// structure. +pub fn serial_vector_no_length(xs: &[T], out: &mut W) -> Result<(), W::Err> { + for x in xs { + x.serial(out)?; + } + Ok(()) +} + +#[cfg(not(feature = "hacspec"))] +impl SerialCtx for &[T] { + fn serial_ctx( + &self, + size_len: concordium_contracts_common::schema::SizeLength, + out: &mut W, + ) -> Result<(), W::Err> { + concordium_contracts_common::schema::serial_length(self.len(), size_len, out)?; + serial_vector_no_length(self, out) + } +} + +#[cfg(not(feature = "hacspec"))] +impl SerialCtx for Vec { + fn serial_ctx( + &self, + size_len: schema::SizeLength, + out: &mut W, + ) -> Result<(), W::Err> { + self.as_slice().serial_ctx(size_len, out) + } +} + +#+end_src + +#+begin_src rust +// TODO: Remove / is not in concordium-std?? +#[cfg(not(feature = "hacspec"))] +pub(crate) static MAX_PREALLOCATED_CAPACITY: usize = 4096; + +// TODO: Remove / is not in concordium-std?? +#[cfg(not(feature = "hacspec"))] +/// Read a vector given a length. +pub fn deserial_vector_no_length( + reader: &mut R, + len: usize, +) -> ParseResult> { + let mut vec = Vec::with_capacity(core::cmp::min(len, MAX_PREALLOCATED_CAPACITY)); + for _ in 0..len { + vec.push(T::deserial(reader)?); + } + Ok(vec) +} + +#[cfg(not(feature = "hacspec"))] +impl DeserialCtx for Vec { + fn deserial_ctx( + size_len: concordium_contracts_common::schema::SizeLength, + _ensure_ordered: bool, + source: &mut R, + ) -> ParseResult { + let len = concordium_contracts_common::schema::deserial_length(source, size_len)?; + deserial_vector_no_length(source, len) + } +} +#+end_src + +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +impl SerialCtx for &str { + fn serial_ctx( + &self, + size_len: concordium_contracts_common::schema::SizeLength, + out: &mut W, + ) -> Result<(), W::Err> { + concordium_contracts_common::schema::serial_length(self.len(), size_len, out)?; + serial_vector_no_length(&self.as_bytes().to_vec(), out) + } +} +#+end_src + +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +impl SerialCtx for String { + fn serial_ctx( + &self, + size_len: concordium_contracts_common::schema::SizeLength, + out: &mut W, + ) -> Result<(), W::Err> { + self.as_str().serial_ctx(size_len, out) + } +} +#+end_src + +#+begin_src rust +#[cfg(not(feature = "hacspec"))] +impl DeserialCtx for String { + fn deserial_ctx( + size_len: concordium_contracts_common::schema::SizeLength, + _ensure_ordered: bool, + source: &mut R, + ) -> ParseResult { + let len = concordium_contracts_common::schema::deserial_length(source, size_len)?; + let bytes = deserial_vector_no_length(source, len)?; + let res = String::from_utf8(bytes).map_err(|_| ParseError::default())?; + Ok(res) + } +} +#+end_src + +*** Rust Tests +#+begin_src rust + +#+end_src + +** Coq code + +#+begin_src elisp :var SOURCE-CODE-FILE="Concordium_Impls.v" :results output silent :tangle no +(org-babel-detangle SOURCE-CODE-FILE) +#+end_src + +*** concordium_impls - Coq code +:PROPERTIES: +:header-args: coq :tangle Concordium_Impls.v :mkdirp yes :comments link +:header-args: coq :eval never :results output silent +:END: + +#+begin_src coq + +(** This file was automatically generated using Hacspec **) +Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +From Coq Require Import List. +Import ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. +Open Scope hacspec_scope. +#+end_src + +#+begin_src coq +Require Import Hacspec_Lib. +Export Hacspec_Lib. +#+end_src + +#+begin_src coq +Require Import Concordium_Prims. +Export Concordium_Prims. +#+end_src + +#+begin_src coq +Require Import Concordium_Types. +Export Concordium_Types. +#+end_src + +#+begin_src coq +Require Import Concordium_Traits. +Export Concordium_Traits. +#+end_src + +#+begin_src coq +Notation "'reject_hacspec_t'" := (int32) : hacspec_scope. +#+end_src + +#+begin_src coq +Definition reject_impl_deafult : reject_hacspec_t := + min_v. +#+end_src + +#+begin_src coq +Definition new_reject_impl (x_25 : int32): (option int32) := + (if ((x_25) <.? (@repr WORDSIZE32 0)):bool then (@Some int32 (x_25)) else ( + @None int32)). +#+end_src + +#+begin_src coq +Definition reject_impl_convert_from_unit : reject_hacspec_t := + (min_v) .+ (@repr WORDSIZE32 1). + + +Theorem ensures_reject_impl_convert_from_unit : forall result_26 , + @reject_impl_convert_from_unit = result_26 -> + ~ ((result_26) =.? (@repr WORDSIZE32 0)). + Proof. Admitted. +#+end_src + +#+begin_src coq +Definition reject_impl_convert_from_parse_error : reject_hacspec_t := + (min_v) .+ (@repr WORDSIZE32 2). + + +Theorem ensures_reject_impl_convert_from_parse_error : forall result_26 , + @reject_impl_convert_from_parse_error = result_26 -> + ~ ((result_26) =.? (@repr WORDSIZE32 0)). + Proof. Admitted. +#+end_src + +#+begin_src coq +Definition reject_impl_from_log_error (le_27 : log_error_t): reject_hacspec_t := + match le_27 with + | Full => (min_v) .+ (@repr WORDSIZE32 3) + | Malformed => (min_v) .+ (@repr WORDSIZE32 4) + end. + + +Theorem ensures_reject_impl_from_log_error : forall result_26 ( + le_27 : log_error_t), + @reject_impl_from_log_error le_27 = result_26 -> + ~ ((result_26) =.? (@repr WORDSIZE32 0)). + Proof. Admitted. +#+end_src + +#+begin_src coq +Inductive new_contract_name_error_t := +| NewContractNameErrorMissingInitPrefix : new_contract_name_error_t +| NewContractNameErrorTooLong : new_contract_name_error_t +| NewContractNameErrorContainsDot : new_contract_name_error_t +| NewContractNameErrorInvalidCharacters : new_contract_name_error_t. +#+end_src + +#+begin_src coq +Definition reject_impl_from_new_contract_name_error + (nre_28 : new_contract_name_error_t): reject_hacspec_t := + match nre_28 with + | NewContractNameErrorMissingInitPrefix => (min_v) .+ (@repr WORDSIZE32 5) + | NewContractNameErrorTooLong => (min_v) .+ (@repr WORDSIZE32 6) + | NewContractNameErrorContainsDot => (min_v) .+ (@repr WORDSIZE32 9) + | NewContractNameErrorInvalidCharacters => (min_v) .+ (@repr WORDSIZE32 10) + end. + + +Theorem ensures_reject_impl_from_new_contract_name_error : forall result_26 ( + nre_28 : new_contract_name_error_t), + @reject_impl_from_new_contract_name_error nre_28 = result_26 -> + ~ ((result_26) =.? (@repr WORDSIZE32 0)). + Proof. Admitted. +#+end_src + +#+begin_src coq +Inductive new_receive_name_error_t := +| NewReceiveNameErrorMissingDotSeparator : new_receive_name_error_t +| NewReceiveNameErrorTooLong : new_receive_name_error_t +| NewReceiveNameErrorInvalidCharacters : new_receive_name_error_t. +#+end_src + +#+begin_src coq +Definition reject_impl_from_new_receive_name_error + (nre_29 : new_receive_name_error_t): reject_hacspec_t := + match nre_29 with + | NewReceiveNameErrorMissingDotSeparator => (min_v) .+ (@repr WORDSIZE32 7) + | NewReceiveNameErrorTooLong => (min_v) .+ (@repr WORDSIZE32 8) + | NewReceiveNameErrorInvalidCharacters => (min_v) .+ (@repr WORDSIZE32 11) + end. + + +Theorem ensures_reject_impl_from_new_receive_name_error : forall result_26 ( + nre_29 : new_receive_name_error_t), + @reject_impl_from_new_receive_name_error nre_29 = result_26 -> + ~ ((result_26) =.? (@repr WORDSIZE32 0)). + Proof. Admitted. +#+end_src + +#+begin_src coq +Definition reject_impl_from_not_payable_error : reject_hacspec_t := + (min_v) .+ (@repr WORDSIZE32 12). + + +Theorem ensures_reject_impl_from_not_payable_error : forall result_26 , + @reject_impl_from_not_payable_error = result_26 -> + ~ ((result_26) =.? (@repr WORDSIZE32 0)). + Proof. Admitted. +#+end_src + +#+begin_src coq +Notation "'contract_state_hacspec_t'" := (int32) : hacspec_scope. +#+end_src + +#+begin_src coq +Inductive seek_from_hacspec_t := +| Start : int64 -> seek_from_hacspec_t +| End : int64 -> seek_from_hacspec_t +| Current : int64 -> seek_from_hacspec_t. +#+end_src + +#+begin_src coq +Notation "'uint32_option_t'" := ((option int32)) : hacspec_scope. +#+end_src + +#+begin_src coq +Notation "'iint64_option_t'" := ((option int64)) : hacspec_scope. +#+end_src + +#+begin_src coq +Definition contract_state_impl_seek + (current_position_30 : contract_state_hacspec_t) + (end_31 : int32) + (pos_32 : seek_from_hacspec_t): (result (contract_state_hacspec_t ∏ int64 + ) unit) := + match pos_32 with + | Start offset_33 => @Ok (contract_state_hacspec_t ∏ int64) unit (( + @cast _ uint32 _ (offset_33), + offset_33 + )) + | End delta_34 => (if ((delta_34) >=.? (@repr WORDSIZE64 0)):bool then ( + match pub_uint32_checked_add (current_position_30) (@cast _ uint32 _ ( + delta_34)) with + | Some b_35 => @Ok (contract_state_hacspec_t ∏ int64) unit (( + b_35, + @cast _ uint64 _ (b_35) + )) + | None => @Err (contract_state_hacspec_t ∏ int64) unit (tt) + end) else (match pub_int64_checked_abs (delta_34) with + | Some before_36 => (if ((@cast _ uint32 _ (before_36)) <=.? ( + end_31)):bool then (@Ok (contract_state_hacspec_t ∏ int64) unit (( + (end_31) .- (@cast _ uint32 _ (before_36)), + @cast _ uint64 _ ((end_31) .- (@cast _ uint32 _ (before_36))) + ))) else (@Err (contract_state_hacspec_t ∏ int64) unit (tt))) + | None => @Err (contract_state_hacspec_t ∏ int64) unit (tt) + end)) + | Current delta_37 => (if ((delta_37) >=.? (@repr WORDSIZE64 0)):bool then ( + match pub_uint32_checked_add (current_position_30) (@cast _ uint32 _ ( + delta_37)) with + | Some offset_38 => @Ok (contract_state_hacspec_t ∏ int64) unit (( + offset_38, + @cast _ uint64 _ (offset_38) + )) + | None => @Err (contract_state_hacspec_t ∏ int64) unit (tt) + end) else (match pub_int64_checked_abs (delta_37) with + | Some b_39 => match pub_uint32_checked_sub (current_position_30) ( + @cast _ uint32 _ (b_39)) with + | Some offset_40 => @Ok (contract_state_hacspec_t ∏ int64) unit (( + offset_40, + @cast _ uint64 _ (offset_40) + )) + | None => @Err (contract_state_hacspec_t ∏ int64) unit (tt) + end + | None => @Err (contract_state_hacspec_t ∏ int64) unit (tt) + end)) + end. +#+end_src + +#+begin_src coq +Definition contract_state_impl_read_read + (current_position_41 : contract_state_hacspec_t) + (buf_42 : public_byte_seq): (contract_state_hacspec_t ∏ uint_size) := + let '(buf_43, num_read_44) := + load_state_hacspec (buf_42) (current_position_41) in + ((current_position_41) .+ (num_read_44), @cast _ uint32 _ (num_read_44)). +#+end_src + +#+begin_src coq +Definition contract_state_impl_read_read_u64 + (current_position_45 : contract_state_hacspec_t): ( + contract_state_hacspec_t ∏ + (result int64 unit) + ) := + let buf_46 : seq int8 := + seq_new_ (default) (usize 8) in + let '(buf_47, num_read_48) := + load_state_hacspec (buf_46) (current_position_45) in + ( + (current_position_45) .+ (num_read_48), + (if ((num_read_48) =.? (@repr WORDSIZE32 8)):bool then (@Ok int64 unit ( + u64_from_le_bytes (array_from_seq (8) (buf_47)))) else ( + @Err int64 unit (tt))) + ). +#+end_src + +#+begin_src coq +Definition contract_state_impl_read_read_u32 + (current_position_49 : contract_state_hacspec_t): ( + contract_state_hacspec_t ∏ + (result int32 unit) + ) := + let buf_50 : seq int8 := + seq_new_ (default) (usize 4) in + let '(buf_51, num_read_52) := + load_state_hacspec (buf_50) (current_position_49) in + ( + (current_position_49) .+ (num_read_52), + (if ((num_read_52) =.? (@repr WORDSIZE32 4)):bool then (@Ok int32 unit ( + u32_from_le_bytes (array_from_seq (4) (buf_51)))) else ( + @Err int32 unit (tt))) + ). +#+end_src + +#+begin_src coq +Definition contract_state_impl_read_read_u8 + (current_position_53 : contract_state_hacspec_t): ( + contract_state_hacspec_t ∏ + (result int8 unit) + ) := + let buf_54 : seq int8 := + seq_new_ (default) (usize 1) in + let '(buf_55, num_read_56) := + load_state_hacspec (buf_54) (current_position_53) in + ( + (current_position_53) .+ (num_read_56), + (if ((num_read_56) =.? (@repr WORDSIZE32 1)):bool then (@Ok int8 unit ( + seq_index (buf_55) (usize 0))) else (@Err int8 unit (tt))) + ). +#+end_src + +#+begin_src coq +Definition contract_state_impl_write + (current_position_57 : contract_state_hacspec_t) + (buf_58 : public_byte_seq): (result (contract_state_hacspec_t ∏ uint_size + ) unit) := + ifbnd option_is_none (pub_uint32_checked_add (current_position_57) (pub_u32 ( + seq_len (buf_58)))) : bool + thenbnd (bind (@Err (contract_state_hacspec_t ∏ uint_size) unit (tt)) ( + fun _ => Ok (tt))) + else (tt) >> (fun 'tt => + let '(buf_59, num_bytes_60) := + write_state_hacspec (buf_58) (current_position_57) in + @Ok (contract_state_hacspec_t ∏ uint_size) unit (( + (current_position_57) .+ (num_bytes_60), + @cast _ uint32 _ (num_bytes_60) + ))). +#+end_src + +#+begin_src coq +Definition has_contract_state_impl_for_contract_state_open + : contract_state_hacspec_t := + @repr WORDSIZE32 0. +#+end_src + +#+begin_src coq +Definition has_contract_state_impl_for_contract_state_reserve + (len_61 : int32): bool := + let cur_size_62 : int32 := + state_size_hacspec in + (if ((cur_size_62) <.? (len_61)):bool then ((resize_state_hacspec ( + len_61)) =.? (@repr WORDSIZE32 1)) else (true)). +#+end_src + +#+begin_src coq +Definition has_contract_state_impl_for_contract_state_truncate + (current_position_63 : contract_state_hacspec_t) + (cur_size_64 : int32) + (new_size_65 : int32): contract_state_hacspec_t := + let 'tt := + if (cur_size_64) >.? (new_size_65):bool then (let _ : int32 := + resize_state_hacspec (new_size_65) in + tt) else (tt) in + (if ((new_size_65) <.? (current_position_63)):bool then (new_size_65) else ( + current_position_63)). +#+end_src + +#+begin_src coq +Notation "'parameter_hacspec_t'" := (int32) : hacspec_scope. +#+end_src + +#+begin_src coq +Definition read_impl_for_parameter_read + (current_position_66 : parameter_hacspec_t) + (buf_67 : public_byte_seq): (parameter_hacspec_t ∏ uint_size) := + let '(buf_68, num_read_69) := + get_parameter_section_hacspec (buf_67) (current_position_66) in + ((current_position_66) .+ (num_read_69), @cast _ uint32 _ (num_read_69)). +#+end_src + +#+begin_src coq +Notation "'attributes_cursor_hacspec_t'" := ((int32 ∏ int16)) : hacspec_scope. +#+end_src + +#+begin_src coq +Definition has_policy_impl_for_policy_attributes_cursor_next_item + (policy_attribute_items_70 : attributes_cursor_hacspec_t) + (buf_71 : public_byte_seq): (option ( + attributes_cursor_hacspec_t ∏ + (int8 ∏ int8) + )) := + let '(current_position_72, remaining_items_73) := + policy_attribute_items_70 in + ifbnd (remaining_items_73) =.? (@repr WORDSIZE16 0) : bool + thenbnd (bind (@None (attributes_cursor_hacspec_t ∏ (int8 ∏ int8))) ( + fun _ => Some (tt))) + else (tt) >> (fun 'tt => + let '(tag_value_len_74, num_read_75) := + get_policy_section_hacspec (seq_new_ (default) (usize 2)) ( + current_position_72) in + let current_position_72 := + (current_position_72) .+ (num_read_75) in + ifbnd (seq_index (tag_value_len_74) (usize 1)) >.? (@repr WORDSIZE8 31) : bool + thenbnd (bind (@None (attributes_cursor_hacspec_t ∏ (int8 ∏ int8))) ( + fun _ => Some (tt))) + else (tt) >> (fun 'tt => + let '(buf_76, num_read_77) := + get_policy_section_hacspec (buf_71) (current_position_72) in + let current_position_72 := + (current_position_72) .+ (num_read_77) in + let remaining_items_73 := + (remaining_items_73) .- (@repr WORDSIZE16 1) in + @Some (attributes_cursor_hacspec_t ∏ (int8 ∏ int8)) (( + (current_position_72, remaining_items_73), + ( + seq_index (tag_value_len_74) (usize 0), + seq_index (tag_value_len_74) (usize 1) + ) + )))). +#+end_src + +#+begin_src coq +Notation "'policies_iterator_hacspec_t'" := ((int32 ∏ int16)) : hacspec_scope. +#+end_src + +#+begin_src coq +Notation "'policy_attributes_cursor_hacspec_t'" := (( + int32 ∏ + int64 ∏ + int64 ∏ + attributes_cursor_hacspec_t + )) : hacspec_scope. +#+end_src + +#+begin_src coq +Definition iterator_impl_for_policies_iterator_next + (policies_iterator_78 : policies_iterator_hacspec_t): (option ( + policies_iterator_hacspec_t ∏ + policy_attributes_cursor_hacspec_t + )) := + let '(pos_79, remaining_items_80) := + policies_iterator_78 in + ifbnd (remaining_items_80) =.? (@repr WORDSIZE16 0) : bool + thenbnd (bind (@None ( + policies_iterator_hacspec_t ∏ + policy_attributes_cursor_hacspec_t + )) (fun _ => Some (tt))) + else (tt) >> (fun 'tt => + let '(buf_81, _) := + get_policy_section_hacspec (seq_new_ (default) (((((usize 2) + ( + usize 4)) + (usize 8)) + (usize 8)) + (usize 2))) (pos_79) in + let skip_part_82 : public_byte_seq := + seq_slice_range (buf_81) ((usize 0, usize 2)) in + let ip_part_83 : public_byte_seq := + seq_slice_range (buf_81) ((usize 2, (usize 2) + (usize 4))) in + let created_at_part_84 : public_byte_seq := + seq_slice_range (buf_81) (( + (usize 2) + (usize 4), + ((usize 2) + (usize 4)) + (usize 8) + )) in + let valid_to_part_85 : public_byte_seq := + seq_slice_range (buf_81) (( + ((usize 2) + (usize 4)) + (usize 8), + (((usize 2) + (usize 4)) + (usize 8)) + (usize 8) + )) in + let len_part_86 : public_byte_seq := + seq_slice_range (buf_81) (( + (((usize 2) + (usize 4)) + (usize 8)) + (usize 8), + ((((usize 2) + (usize 4)) + (usize 8)) + (usize 8)) + (usize 2) + )) in + let identity_provider_87 : int32 := + u32_from_le_bytes (array_from_seq (4) (ip_part_83)) in + let created_at_88 : int64 := + u64_from_le_bytes (array_from_seq (8) (created_at_part_84)) in + let valid_to_89 : int64 := + u64_from_le_bytes (array_from_seq (8) (valid_to_part_85)) in + let remaining_items_90 : int16 := + u16_from_le_bytes (array_from_seq (2) (len_part_86)) in + let attributes_start_91 : int32 := + (((((pos_79) .+ (@repr WORDSIZE32 2)) .+ (@repr WORDSIZE32 4)) .+ ( + @repr WORDSIZE32 8)) .+ (@repr WORDSIZE32 8)) .+ ( + @repr WORDSIZE32 2) in + let pos_79 := + ((pos_79) .+ (@cast _ uint32 _ (u16_from_le_bytes (array_from_seq (2) ( + skip_part_82))))) .+ (@repr WORDSIZE32 2) in + let remaining_items_90 := + (remaining_items_90) .- (@repr WORDSIZE16 1) in + @Some (policies_iterator_hacspec_t ∏ policy_attributes_cursor_hacspec_t) (( + (pos_79, remaining_items_90), + ( + identity_provider_87, + created_at_88, + valid_to_89, + (attributes_start_91, remaining_items_90) + ) + ))). +#+end_src + +#+begin_src coq +Definition user_address_t := nseq (int8) (usize 32). +#+end_src + +#+begin_src coq +Inductive has_action_t := +| Accept : unit -> has_action_t +| SimpleTransfer : (user_address_t ∏ int64) -> has_action_t. +#+end_src + +#+begin_src coq +Notation "'list_action_t'" := (seq has_action_t) : hacspec_scope. +#+end_src + +#+begin_src coq +Definition accept_action : has_action_t := + Accept (tt). +#+end_src + +#+begin_src coq +Inductive context_t := +| Context : (user_address_t ∏ user_address_t ∏ int64 ∏ int64 +) -> context_t. +#+end_src +# 41 code sections + +* Concordium "Constants" specification +** Rust code +:PROPERTIES: +:header-args: :tangle ../concordium/src/constants.rs :mkdirp yes :eval never +:END: + +#+begin_src rust +/// Maximum size of the contract state in bytes. +pub const MAX_CONTRACT_STATE_SIZE: u32 = 16384u32; + +/// Maximum log size. +pub const MAX_LOG_SIZE: usize = 512usize; + +/// Maximum number of log items. +pub const MAX_NUM_LOGS: usize = 64usize; +#+end_src + +* Concordium "Test infrastructure" specification +** Rust code +:PROPERTIES: +:header-args: :tangle ../concordium/src/test_infrastructure.rs :mkdirp yes :eval never +:END: + +#+begin_src rust +//! The test infrastructure module provides alternative implementations of +//! `HasInitContext`, `HasReceiveContext`, `HasParameter`, `HasActions`, and +//! `HasContractState` traits intended for testing. +//! +//! They allow writing unit tests directly in contract modules with little to no +//! external tooling, depending on what is required. +//! +//! +//! # Example +//! +//! ```rust +//! // Some contract +//! #[init(contract = "noop")] +//! fn contract_init( +//! ctx: &I, +//! ) -> InitResult { ... } +//! +//! #[receive(contract = "noop", name = "receive", payable, enable_logger)] +//! fn contract_receive( +//! ctx: &R, +//! amount: Amount, +//! logger: &mut L, +//! state: &mut State, +//! ) -> ReceiveResult { ... } +//! +//! #[cfg(test)] +//! mod tests { +//! use super::*; +//! use concordium_sc_base::test_infrastructure::*; +//! #[test] +//! fn test_init() { +//! let mut ctx = InitContextTest::empty(); +//! ctx.set_init_origin(AccountAddress([0u8; 32])); +//! ... +//! let result = contract_init(&ctx); +//! claim!(...) +//! ... +//! } +//! +//! #[test] +//! fn test_receive() { +//! let mut ctx = ReceiveContextTest::empty(); +//! ctx.set_owner(AccountAddress([0u8; 32])); +//! ... +//! let mut logger = LogRecorder::init(); +//! let result: ReceiveResult = contract_receive(&ctx, 0, &mut logger, state); +//! claim!(...) +//! ... +//! } +//! } +//! ``` +#[cfg(not(feature = "hacspec"))] +use crate::{constants::MAX_CONTRACT_STATE_SIZE, *}; + +#[cfg(not(feature = "hacspec"))] +#[cfg(not(feature = "std"))] +use alloc::boxed::Box; +#[cfg(not(feature = "hacspec"))] +use convert::TryInto; +#[cfg(not(feature = "hacspec"))] +#[cfg(not(feature = "std"))] +use core::{cmp, num}; +#[cfg(not(feature = "hacspec"))] +#[cfg(feature = "std")] +use std::{boxed::Box, cmp, num}; + +#[cfg(not(feature = "hacspec"))] +/// Placeholder for the context chain meta data. +/// All the fields are optionally set and the getting an unset field will result +/// in test failing. +/// For most cases it is used as part of either +/// [`InitContextTest`](struct.InitContextTest.html) or +/// [`ReceiveContextTest`](struct.ReceiveContextTest.html). +/// Use only in unit tests! +/// +/// Defaults to having all of the fields unset +#[derive(Default, Clone)] +pub struct ChainMetaTest { + pub(crate) slot_time: Option, +} + +#[cfg(not(feature = "hacspec"))] +/// Policy type used by init and receive contexts for testing. +/// This type should not be used directly, but rather through +/// its `HasPolicy` interface. +#[derive(Debug, Clone)] +pub struct TestPolicy { + /// Current position in the vector of policies. Used to implement + /// `next_item`. + position: usize, + policy: OwnedPolicy, +} + +#[cfg(not(feature = "hacspec"))] +impl TestPolicy { + fn new(policy: OwnedPolicy) -> Self { + Self { + position: 0, + policy, + } + } +} + +#[cfg(not(feature = "hacspec"))] +/// Placeholder for the common data shared between the `InitContext` and +/// `ReceiveContext`. This type is a technicality, see `InitContext` and +/// `ReceiveContext` for the types to use. +/// +/// # Default +/// Defaults to having all the fields unset, and constructing +/// [`ChainMetaTest`](struct.ChainMetaTest.html) using default. +#[derive(Default, Clone)] +#[doc(hidden)] +pub struct CommonDataTest<'a> { + pub(crate) metadata: ChainMetaTest, + pub(crate) parameter: Option<&'a [u8]>, + /// Policy of the creator. We keep the `Option` wrapper + /// in order that the user can be warned that they are using a policy. + /// Thus there is a distinction between `Some(Vec::new())` and `None`. + pub(crate) policies: Option>, +} + +#[cfg(not(feature = "hacspec"))] +/// Context used for testing. The type parameter C is used to determine whether +/// this will be an init or receive context. +#[derive(Default, Clone)] +pub struct ContextTest<'a, C> { + pub(crate) common: CommonDataTest<'a>, + pub(crate) custom: C, +} + +/// Placeholder for the initial context. All the fields can be set optionally +/// and the getting an unset field will result in calling +/// [`fail!`](../macro.fail.html). Use only in tests! +/// +/// # Setters +/// Every field has a setter function prefixed with `set_`. + +/// ### Example +/// Creating an empty context and setting the `init_origin`. +/// ``` +/// let mut ctx = InitContextTest::empty(); +/// ctx.set_init_origin(AccountAddress([0u8; 32])); +/// ``` +/// ## Set chain meta data +/// Chain meta data is set using setters on the context or by setters on a +/// mutable reference of [`ChainMetaTest`](struct.ChainMetaTest.html). +/// +/// ### Example +/// Creating an empty context and setting the `slot_time` metadata. +/// ``` +/// let mut ctx = InitContextTest::empty(); +/// ctx.set_metadata_slot_time(1609459200); +/// ``` +/// or +/// ``` +/// let mut ctx = InitContextTest::empty(); +/// ctx.metadata_mut().set_slot_time(1609459200); +/// ``` +/// +/// # Use case example +/// +/// ```rust +/// #[init(contract = "noop")] +/// fn contract_init( +/// ctx: &I, +/// _amount: Amount, +/// _logger: &mut L, +/// ) -> InitResult<()> { +/// let init_origin = ctx.init_origin(); +/// let parameter: SomeParameterType = ctx.parameter_cursor().get()?; +/// Ok(()) +/// } +/// +/// #[cfg(test)] +/// mod tests { +/// use super::*; +/// use concordium_sc_base::test_infrastructure::*; +/// #[test] +/// fn test() { +/// let mut ctx = InitContextTest::empty(); +/// ctx.set_init_origin(AccountAddress([0u8; 32])); +/// ... +/// let result = contract_init(&ctx, 0, &mut logger); +/// // Reads the init_origin without any problems. +/// // But then fails because the parameter is not set. +/// } +/// } +/// ``` +#[cfg(not(feature = "hacspec"))] +pub type InitContextTest<'a> = ContextTest<'a, InitOnlyDataTest>; + +#[cfg(not(feature = "hacspec"))] +#[derive(Default)] +#[doc(hidden)] +pub struct InitOnlyDataTest { + init_origin: Option, +} + +/// Placeholder for the receiving context. All the fields can be set optionally +/// and the getting an unset field will result in calling +/// [`fail!`](../macro.fail.html). Use only in tests! +/// +/// # Setters +/// Every field have a setter function prefixed with `set_`. +/// +/// ### Example +/// Creating an empty context and setting the `init_origin`. +/// ``` +/// let owner = AccountAddress([0u8; 32]); +/// let mut ctx = ReceiveContextTest::empty(); +/// ctx.set_owner(owner); +/// ctx.set_sender(Address::Account(owner)); +/// ``` +/// ## Set chain meta data +/// Chain meta data is set using setters on the context or by setters on a +/// mutable reference of [`ChainMetaTest`](struct.ChainMetaTest.html). +/// +/// ### Example +/// Creating an empty context and setting the `slot_time` metadata. +/// ``` +/// let mut ctx = ReceiveContextTest::empty(); +/// ctx.set_metadata_slot_time(1609459200); +/// ``` +/// or +/// ``` +/// let mut ctx = ReceiveContextTest::empty(); +/// ctx.metadata_mut().set_slot_time(1609459200); +/// ``` +/// +/// # Use case example +/// Creating a context for running unit tests +/// ```rust +/// #[receive(contract = "mycontract", name = "receive")] +/// fn contract_receive( +/// ctx: &R, +/// amount: Amount, +/// logger: &mut L, +/// state: &mut State, +/// ) -> ReceiveResult { +/// ensure!(ctx.sender().matches_account(&ctx.owner()), "Only the owner can increment."); +/// Ok(A::accept()) +/// } +/// +/// #[cfg(test)] +/// mod tests { +/// use super::*; +/// use concordium_sc_base::test_infrastructure::*; +/// #[test] +/// fn test() { +/// let owner = AccountAddress([0u8; 32]); +/// let mut ctx = ReceiveContextTest::empty(); +/// ctx.set_owner(owner); +/// ctx.set_sender(Address::Account(owner)); +/// ... +/// let result: ReceiveResult = contract_receive(&ctx, 0, &mut logger, state); +/// } +/// } +/// ``` +#[cfg(not(feature = "hacspec"))] +pub type ReceiveContextTest<'a> = ContextTest<'a, ReceiveOnlyDataTest>; + +#[cfg(not(feature = "hacspec"))] +#[derive(Default)] +#[doc(hidden)] +pub struct ReceiveOnlyDataTest { + pub(crate) invoker: Option, + pub(crate) self_address: Option, + pub(crate) self_balance: Option, + pub(crate) sender: Option
, + pub(crate) owner: Option, +} + +#[cfg(not(feature = "hacspec"))] +// Setters for testing-context +impl ChainMetaTest { + /// Create an `ChainMetaTest` where every field is unset, and getting any of + /// the fields will result in [`fail!`](../macro.fail.html). + pub fn empty() -> Self { Default::default() } + + /// Set the block slot time + pub fn set_slot_time(&mut self, value: SlotTime) -> &mut Self { + self.slot_time = Some(value); + self + } +} + +#[cfg(not(feature = "hacspec"))] +impl<'a, C> ContextTest<'a, C> { + /// Push a new sender policy to the context. + /// When the first policy is pushed this will set the policy vector + /// to 'Some', even if it was undefined previously. + pub fn push_policy(&mut self, value: OwnedPolicy) -> &mut Self { + if let Some(policies) = self.common.policies.as_mut() { + policies.push(TestPolicy::new(value)); + } else { + self.common.policies = Some(vec![TestPolicy::new(value)]) + } + self + } + + /// Set the policies to be defined, but an empty list. + /// Such a situation can not realistically happen on the chain, + /// but we provide functionality for it in case smart contract + /// writers wish to program defensively. + pub fn empty_policies(&mut self) -> &mut Self { + self.common.policies = Some(Vec::new()); + self + } + + pub fn set_parameter(&mut self, value: &'a [u8]) -> &mut Self { + self.common.parameter = Some(value); + self + } + + /// Get a mutable reference to the chain meta data placeholder + pub fn metadata_mut(&mut self) -> &mut ChainMetaTest { &mut self.common.metadata } + + /// Set the metadata block slot time + pub fn set_metadata_slot_time(&mut self, value: SlotTime) -> &mut Self { + self.metadata_mut().set_slot_time(value); + self + } +} + +#[cfg(not(feature = "hacspec"))] +impl<'a> InitContextTest<'a> { + /// Create an `InitContextTest` where every field is unset, and getting any + /// of the fields will result in [`fail!`](../macro.fail.html). + pub fn empty() -> Self { Default::default() } + + /// Set `init_origin` in the `InitContextTest` + pub fn set_init_origin(&mut self, value: AccountAddress) -> &mut Self { + self.custom.init_origin = Some(value); + self + } +} + +#[cfg(not(feature = "hacspec"))] +impl<'a> ReceiveContextTest<'a> { + /// Create a `ReceiveContextTest` where every field is unset, and getting + /// any of the fields will result in [`fail!`](../macro.fail.html). + pub fn empty() -> Self { Default::default() } + + pub fn set_invoker(&mut self, value: AccountAddress) -> &mut Self { + self.custom.invoker = Some(value); + self + } + + pub fn set_self_address(&mut self, value: ContractAddress) -> &mut Self { + self.custom.self_address = Some(value); + self + } + + pub fn set_self_balance(&mut self, value: Amount) -> &mut Self { + self.custom.self_balance = Some(value); + self + } + + pub fn set_sender(&mut self, value: Address) -> &mut Self { + self.custom.sender = Some(value); + self + } + + pub fn set_owner(&mut self, value: AccountAddress) -> &mut Self { + self.custom.owner = Some(value); + self + } +} + +#[cfg(not(feature = "hacspec"))] +// Error handling when unwrapping +fn unwrap_ctx_field(opt: Option, name: &str) -> A { + match opt { + Some(v) => v, + None => fail!( + "Unset field on test context '{}', make sure to set all the field necessary for the \ + contract", + name + ), + } +} + +#[cfg(not(feature = "hacspec"))] +// Getters for testing-context +impl HasChainMetadata for ChainMetaTest { + fn slot_time(&self) -> SlotTime { unwrap_ctx_field(self.slot_time, "metadata.slot_time") } +} + +#[cfg(not(feature = "hacspec"))] +impl HasPolicy for TestPolicy { + fn identity_provider(&self) -> IdentityProvider { self.policy.identity_provider } + + fn created_at(&self) -> Timestamp { self.policy.created_at } + + fn valid_to(&self) -> Timestamp { self.policy.valid_to } + + fn next_item(&mut self, buf: &mut [u8; 31]) -> Option<(AttributeTag, u8)> { + if let Some(item) = self.policy.items.get(self.position) { + let len = item.1.len(); + buf[0..len].copy_from_slice(&item.1); + self.position += 1; + Some((item.0, len as u8)) + } else { + None + } + } +} + +#[cfg(not(feature = "hacspec"))] +impl<'a, C> HasCommonData for ContextTest<'a, C> { + type MetadataType = ChainMetaTest; + type ParamType = Cursor<&'a [u8]>; + type PolicyIteratorType = crate::vec::IntoIter; + type PolicyType = TestPolicy; + + fn parameter_cursor(&self) -> Self::ParamType { + Cursor::new(unwrap_ctx_field(self.common.parameter, "parameter")) + } + + fn metadata(&self) -> &Self::MetadataType { &self.common.metadata } + + fn policies(&self) -> Self::PolicyIteratorType { + unwrap_ctx_field(self.common.policies.clone(), "policies").into_iter() + } +} + +#[cfg(not(feature = "hacspec"))] +impl<'a> HasInitContext for InitContextTest<'a> { + type InitData = (); + + fn open(_data: Self::InitData) -> Self { InitContextTest::default() } + + fn init_origin(&self) -> AccountAddress { + unwrap_ctx_field(self.custom.init_origin, "init_origin") + } +} + +#[cfg(not(feature = "hacspec"))] +impl<'a> HasReceiveContext for ReceiveContextTest<'a> { + type ReceiveData = (); + + fn open(_data: Self::ReceiveData) -> Self { ReceiveContextTest::default() } + + fn invoker(&self) -> AccountAddress { unwrap_ctx_field(self.custom.invoker, "invoker") } + + fn self_address(&self) -> ContractAddress { + unwrap_ctx_field(self.custom.self_address, "self_address") + } + + fn self_balance(&self) -> Amount { unwrap_ctx_field(self.custom.self_balance, "self_balance") } + + fn sender(&self) -> Address { unwrap_ctx_field(self.custom.sender, "sender") } + + fn owner(&self) -> AccountAddress { unwrap_ctx_field(self.custom.owner, "owner") } +} + +#[cfg(not(feature = "hacspec"))] +impl<'a> HasParameter for Cursor<&'a [u8]> { + fn size(&self) -> u32 { self.data.len() as u32 } +} + +/// A logger that simply accumulates all the logged items to be inspected at the +/// end of execution. +#[cfg(not(feature = "hacspec"))] +pub struct LogRecorder { + pub logs: Vec>, +} + +#[cfg(not(feature = "hacspec"))] +impl HasLogger for LogRecorder { + fn init() -> Self { + Self { + logs: Vec::new(), + } + } + + fn log_raw(&mut self, event: &[u8]) -> Result<(), LogError> { + if event.len() > constants::MAX_LOG_SIZE { + return Err(LogError::Malformed); + } + if self.logs.len() >= constants::MAX_NUM_LOGS { + return Err(LogError::Full); + } + self.logs.push(event.to_vec()); + Ok(()) + } +} + +#[cfg(not(feature = "hacspec"))] +/// An actions tree, used to provide a simpler presentation for testing. +#[derive(Eq, PartialEq, Debug)] +pub enum ActionsTree { + Accept, + SimpleTransfer { + to: AccountAddress, + amount: Amount, + }, + Send { + to: ContractAddress, + receive_name: OwnedReceiveName, + amount: Amount, + parameter: Vec, + }, + AndThen { + left: Box, + right: Box, + }, + OrElse { + left: Box, + right: Box, + }, +} + +#[cfg(not(feature = "hacspec"))] +impl HasActions for ActionsTree { + fn accept() -> Self { ActionsTree::Accept } + + fn simple_transfer(acc: &AccountAddress, amount: Amount) -> Self { + ActionsTree::SimpleTransfer { + to: *acc, + amount, + } + } + + fn send_raw( + ca: &ContractAddress, + receive_name: ReceiveName, + amount: Amount, + parameter: &[u8], + ) -> Self { + ActionsTree::Send { + to: *ca, + receive_name: receive_name.to_owned(), + amount, + parameter: parameter.to_vec(), + } + } + + fn and_then(self, then: Self) -> Self { + ActionsTree::AndThen { + left: Box::new(self), + right: Box::new(then), + } + } + + fn or_else(self, el: Self) -> Self { + ActionsTree::OrElse { + left: Box::new(self), + right: Box::new(el), + } + } +} + +#[cfg(not(feature = "hacspec"))] +/// Reports back an error to the host when compiled to wasm +/// Used internally, not meant to be called directly by contract writers +#[doc(hidden)] +#[cfg(all(feature = "wasm-test", target_arch = "wasm32"))] +pub fn report_error(message: &str, filename: &str, line: u32, column: u32) { + let msg_bytes = message.as_bytes(); + let filename_bytes = filename.as_bytes(); + unsafe { + crate::prims::report_error( + msg_bytes.as_ptr(), + msg_bytes.len() as u32, + filename_bytes.as_ptr(), + filename_bytes.len() as u32, + line, + column, + ) + }; +} + +#[cfg(not(feature = "hacspec"))] +/// Reports back an error to the host when compiled to wasm +/// Used internally, not meant to be called directly by contract writers +#[doc(hidden)] +#[cfg(not(all(feature = "wasm-test", target_arch = "wasm32")))] +pub fn report_error(_message: &str, _filename: &str, _line: u32, _column: u32) {} + +/// Contract state for testing, mimicking the operations the scheduler allows, +/// including the limit on the size of the maximum size of the contract state. +#[cfg(not(feature = "hacspec"))] +pub struct ContractStateTest { + pub cursor: Cursor, +} + +#[cfg(not(feature = "hacspec"))] +/// A borrowed instantiation of `ContractStateTest`. +pub type ContractStateTestBorrowed<'a> = ContractStateTest<&'a mut Vec>; + +#[cfg(not(feature = "hacspec"))] +/// An owned variant that can be more convenient for testing since the type +/// itself owns the data. +pub type ContractStateTestOwned = ContractStateTest>; + +#[cfg(not(feature = "hacspec"))] +#[derive(Debug, PartialEq, Eq)] +/// An error that is raised when operating with `Seek`, `Write`, or `Read` trait +/// methods of the `ContractStateTest` type. +pub enum ContractStateError { + /// The computation of the new offset would result in an overflow. + Overflow, + /// An error occurred when writing to the contract state. + Write, + /// The new offset would be out of bounds of the state. + Offset, + /// Some other error occurred. + Default, +} + +#[cfg(not(feature = "hacspec"))] +impl> Read for ContractStateTest { + fn read(&mut self, buf: &mut [u8]) -> ParseResult { self.cursor.read(buf) } +} + +#[cfg(not(feature = "hacspec"))] +impl>> Write for ContractStateTest { + type Err = ContractStateError; + + fn write(&mut self, buf: &[u8]) -> Result { + // The chain automatically resizes the state up until MAX_CONTRACT_STATE_SIZE. + let end = cmp::min(MAX_CONTRACT_STATE_SIZE as usize, self.cursor.offset + buf.len()); + if self.cursor.data.as_mut().len() < end { + self.cursor.data.as_mut().resize(end as usize, 0u8); + } + let data = &mut self.cursor.data.as_mut()[self.cursor.offset..]; + let to_write = cmp::min(data.len(), buf.len()); + data[..to_write].copy_from_slice(&buf[..to_write]); + self.cursor.offset += to_write; + Ok(to_write) + } +} + +#[cfg(not(feature = "hacspec"))] +impl> + AsMut<[u8]> + AsRef<[u8]>> HasContractState + for ContractStateTest +{ + type ContractStateData = T; + + fn open(data: Self::ContractStateData) -> Self { + Self { + cursor: Cursor::new(data), + } + } + + fn size(&self) -> u32 { self.cursor.data.as_ref().len() as u32 } + + fn truncate(&mut self, new_size: u32) { + if self.size() > new_size { + let new_size = new_size as usize; + let data: &mut Vec = self.cursor.data.as_mut(); + data.truncate(new_size); + if self.cursor.offset > new_size { + self.cursor.offset = new_size + } + } + } + + fn reserve(&mut self, len: u32) -> bool { + if len <= constants::MAX_CONTRACT_STATE_SIZE { + if self.size() < len { + let data: &mut Vec = self.cursor.data.as_mut(); + data.resize(len as usize, 0u8); + } + true + } else { + false + } + } +} + +#[cfg(not(feature = "hacspec"))] +impl Default for ContractStateError { + fn default() -> Self { Self::Default } +} + +#[cfg(not(feature = "hacspec"))] +impl From for ContractStateError { + fn from(_: num::TryFromIntError) -> Self { ContractStateError::Overflow } +} + +#[cfg(not(feature = "hacspec"))] +impl> Seek for ContractStateTest { + type Err = ContractStateError; + + fn seek(&mut self, pos: SeekFrom) -> Result { + use ContractStateError::*; + match pos { + SeekFrom::Start(x) => { + // We can set the position to just after the end of the current length. + let new_offset = x.try_into()?; + if new_offset <= self.cursor.data.as_ref().len() { + self.cursor.offset = new_offset; + Ok(x) + } else { + Err(Offset) + } + } + SeekFrom::End(x) => { + // cannot seek beyond end, nor before beginning + if x <= 0 { + let end: u32 = self.cursor.data.as_ref().len().try_into()?; + let minus_x = x.checked_abs().ok_or(Overflow)?; + if let Some(new_pos) = end.checked_sub(minus_x.try_into()?) { + self.cursor.offset = new_pos.try_into()?; + Ok(u64::from(new_pos)) + } else { + Err(Offset) + } + } else { + Err(Offset) + } + } + SeekFrom::Current(x) => match x { + 0 => Ok(self.cursor.offset.try_into()?), + x if x > 0 => { + let x = x.try_into()?; + let new_pos = self.cursor.offset.checked_add(x).ok_or(Overflow)?; + if new_pos <= self.cursor.data.as_ref().len() { + self.cursor.offset = new_pos; + new_pos.try_into().map_err(Self::Err::from) + } else { + Err(Offset) + } + } + x => { + let x = (-x).try_into()?; + let new_pos = self.cursor.offset.checked_sub(x).ok_or(Overflow)?; + self.cursor.offset = new_pos; + new_pos.try_into().map_err(Self::Err::from) + } + }, + } + } +} + +#[cfg(not(feature = "hacspec"))] +#[cfg(test)] +mod test { + use concordium_contracts_common::{Read, Seek, SeekFrom, Write}; + + use super::ContractStateTest; + use crate::{constants, traits::HasContractState}; + + #[test] + // Perform a number of operations from Seek, Read, Write and HasContractState + // classes on the ContractStateTest structure and check that they behave as + // specified. + fn test_contract_state() { + let data = vec![1; 100]; + let mut state = ContractStateTest::open(data); + assert_eq!(state.seek(SeekFrom::Start(100)), Ok(100), "Seeking to the end failed."); + assert_eq!( + state.seek(SeekFrom::Current(0)), + Ok(100), + "Seeking from current position with offset 0 failed." + ); + assert!( + state.seek(SeekFrom::Current(1)).is_err(), + "Seeking from current position with offset 1 succeeded." + ); + assert_eq!(state.cursor.offset, 100, "Cursor position changed on failed seek."); + assert_eq!( + state.seek(SeekFrom::Current(-1)), + Ok(99), + "Seeking from current position backwards with offset 1 failed." + ); + assert!(state.seek(SeekFrom::Current(-100)).is_err(), "Seeking beyond beginning succeeds"); + assert_eq!(state.seek(SeekFrom::Current(-99)), Ok(0), "Seeking to the beginning fails."); + assert_eq!(state.seek(SeekFrom::End(0)), Ok(100), "Seeking from end fails."); + assert!( + state.seek(SeekFrom::End(1)).is_err(), + "Seeking beyond the end succeeds but should fail." + ); + assert_eq!(state.cursor.offset, 100, "Cursor position changed on failed seek."); + assert_eq!( + state.seek(SeekFrom::End(-20)), + Ok(80), + "Seeking from end leads to incorrect position." + ); + assert_eq!(state.write(&[0; 21]), Ok(21), "Writing writes an incorrect amount of data."); + assert_eq!(state.cursor.offset, 101, "After writing the cursor is at the end."); + assert_eq!(state.write(&[0; 21]), Ok(21), "Writing again writes incorrect amount of data."); + let mut buf = [0; 30]; + assert_eq!(state.read(&mut buf), Ok(0), "Reading from the end should read 0 bytes."); + assert_eq!(state.seek(SeekFrom::End(-20)), Ok(102)); + assert_eq!(state.read(&mut buf), Ok(20), "Reading from offset 80 should read 20 bytes."); + assert_eq!(&buf[0..20], &state.cursor.data[80..100], "Incorrect data was read."); + assert_eq!( + state.cursor.offset, 122, + "After reading the offset is in the correct position." + ); + assert!(state.reserve(222), "Could not increase state to 222."); + assert!( + !state.reserve(constants::MAX_CONTRACT_STATE_SIZE + 1), + "State should not be resizable beyond max limit." + ); + assert_eq!(state.write(&[2; 100]), Ok(100), "Should have written 100 bytes."); + assert_eq!(state.cursor.offset, 222, "After writing the offset should be 200."); + state.truncate(50); + assert_eq!(state.cursor.offset, 50, "After truncation the state should be 50."); + assert!(state.reserve(constants::MAX_CONTRACT_STATE_SIZE), "Could not increase state MAX."); + assert_eq!( + state.seek(SeekFrom::End(0)), + Ok(u64::from(constants::MAX_CONTRACT_STATE_SIZE)), + "State should be full now." + ); + assert_eq!( + state.write(&[1; 1000]), + Ok(0), + "Writing at the end after truncation should do nothing." + ); + assert_eq!( + state.cursor.data.len(), + constants::MAX_CONTRACT_STATE_SIZE as usize, + "State size should not increase beyond max." + ) + } + + #[test] + fn test_contract_state_write() { + let data = vec![0u8; 10]; + let mut state = ContractStateTest::open(data); + assert_eq!(state.write(&1u64.to_le_bytes()), Ok(8), "Incorrect number of bytes written."); + assert_eq!( + state.write(&2u64.to_le_bytes()), + Ok(8), + "State should be resized automatically." + ); + assert_eq!(state.cursor.offset, 16, "Pos should be at the end."); + assert_eq!( + state.cursor.data, + vec![1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0], + "Correct data was written." + ); + } +} +#+end_src diff --git a/ovn/concordium_derive.org b/ovn/concordium_derive.org new file mode 100644 index 0000000..841b7dd --- /dev/null +++ b/ovn/concordium_derive.org @@ -0,0 +1,1530 @@ +#+TITLE: Concordium Smartcontract Infrastructure Implementations +#+AUTHOR: Lasse Letager Hansen + +#+HTML_HEAD: +#+PROPERTY: header-args:coq :session *Coq* + +# C-c C-v t - export this files +# C-c C-v b - create results / run this file +# C-c C-v s - create results / run subtree + +* Concordium derive +** Config +#+BEGIN_SRC toml :tangle ../concordium-derive/Cargo.toml :mkdirp yes :eval never +[package] +name = "hacspec-concordium-derive" +version = "0.1.0" +authors = [""] +edition = "2018" + +[lib] +path = "src/lib.rs" +proc-macro = true + +[dependencies] +hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } +# hacspec-attributes = { path = "../../utils/attributes", version = "0.1.0-beta.1" , features = ["print_attributes", "hacspec_unsafe"] } # , features = ["hacspec_unsafe"] , , optional = true +creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "7763b3ae77205fba83182b9a6c3e69ad0b12fec7" } +concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850" , version = "=2.0.0" , default-features = false } +# hacspec-concordium = { path = "../concordium" } +syn = { version = "1.0.63", features = [ "full", "extra-traits" ] } +quote = "=1.0.0" +proc-macro2 = "1.0" + +# Reduce code size, at the cost of performance in allocation heavy-code. +wee_alloc="0.4.5" + +# [features] +# use_attributes = ["hacspec-attributes/print_attributes", "hacspec-attributes/hacspec_unsafe"] + +[dev-dependencies] +# hacspec-dev = { path = "../../utils/dev" } +criterion = "0.3" +rand = "0.8" +quickcheck = "1" +quickcheck_macros = "1" +#+END_SRC + +** Rust code +:PROPERTIES: +:header-args: :tangle ../concordium-derive/src/lib.rs :mkdirp yes +:END: + +*** Imports +#+BEGIN_SRC rust :eval never + // #![no_std] + extern crate proc_macro; + extern crate syn; + #[macro_use] + extern crate quote; + + use concordium_contracts_common::*; + use proc_macro::TokenStream; + use proc_macro2::Span; + use quote::ToTokens; + #[cfg(feature = "build-schema")] + use std::collections::HashMap; + use std::{convert::TryFrom, ops::Neg}; + use syn::{ + parse::Parser, parse_macro_input, punctuated::*, spanned::Spanned, DataEnum, Ident, Meta, Token, + }; + + // use hacspec_concordium::*; + + /// A helper to report meaningful compilation errors + /// - If applied to an Ok value they simply return the underlying value. + /// - If applied to `Err(e)` then `e` is turned into a compiler error. + fn unwrap_or_report(v: syn::Result) -> TokenStream { + match v { + Ok(ts) => ts, + Err(e) => e.to_compile_error().into(), + } + } + + fn attach_error(mut v: syn::Result, msg: &str) -> syn::Result { + if let Err(e) = v.as_mut() { + let span = e.span(); + e.combine(syn::Error::new(span, msg)); + } + v + } + + /// Get the name item from a list, if available and a string literal. + /// If the named item does not have the expected (string) value, this will + /// return an Err. If the item does not exist the return value is Ok(None). + /// FIXME: Ensure there is only one. + fn get_attribute_value<'a, I: IntoIterator>( + iter: I, + name: &str, + ) -> syn::Result> { + for attr in iter.into_iter() { + match attr { + Meta::NameValue(mnv) => { + if mnv.path.is_ident(name) { + if let syn::Lit::Str(lit) = &mnv.lit { + return Ok(Some(lit)); + } else { + return Err(syn::Error::new( + mnv.span(), + format!("The `{}` attribute must be a string literal.", name), + )); + } + } + } + Meta::Path(p) => { + if p.is_ident(name) { + return Err(syn::Error::new( + attr.span(), + format!("The `{}` attribute must have a string literal value.", name), + )); + } + } + Meta::List(p) => { + if p.path.is_ident(name) { + return Err(syn::Error::new( + attr.span(), + format!("The `{}` attribute must have a string literal value.", name), + )); + } + } + } + } + Ok(None) + } + + // Return whether a attribute item is present. + fn contains_attribute<'a, I: IntoIterator>(iter: I, name: &str) -> bool { + iter.into_iter().any(|attr| attr.path().is_ident(name)) + } + + /// Derive the appropriate export for an annotated init function. + /// + /// This macro requires the following items to be present + /// - `contract=""` where *\* is the name of the smart contract and + /// the generated function is exported as this name prefixed with *init_*. The + /// name should be unique in the module, as a contract can only have one + /// init-function. + /// + /// The annotated function must be of a specific type, which depends on the + /// enabled attributes. *Without* any of the optional attributes the function + /// must have a signature of + /// + /// ```ignore + /// #[init(contract = "my_contract")] + /// fn some_init(ctx: &impl HasInitContext) -> InitResult {...} + /// ``` + /// + /// Where the trait `HasInitContext` and the type `InitResult` are exposed from + /// `concordium-std` and `MyState` is the user-defined type for the contract + /// state. + /// + /// # Optional attributes + /// + /// ## `payable`: Make function accept an amount of GTU + /// Without setting the `payable` attribute, the generated function will reject + /// any non-zero amount of GTU supplied with the transaction. This means we are + /// required to explicitly mark our functions as `payable`, if they are to + /// accept GTU. + /// + /// Setting the `payable` attribute changes the required signature to include an + /// extra argument of type `Amount`, allowing the function to access the amount + /// of GTU supplied with the transaction. + /// + /// ### Example + /// ```ignore + /// #[init(contract = "my_contract", payable)] + /// fn some_init(ctx: &impl HasInitContext, amount: Amount) -> InitResult {...} + /// ``` + /// + /// ## `enable_logger`: Function can access event logging + /// Setting the `enable_logger` attribute changes the required signature to + /// include an extra argument `&mut impl HasLogger`, allowing the function to + /// log events. + /// + /// + /// ### Example + /// ```ignore + /// #[init(contract = "my_contract", enable_logger)] + /// fn some_init(ctx: &impl HasInitContext, logger: &mut impl HasLogger) -> InitResult {...} + /// ``` + /// + /// ## `low_level`: Manually deal with writing state bytes + /// Setting the `low_level` attribute disables the generated code for + /// serializing the contract state. + /// + /// If `low_level` is set, the signature must contain an extra argument of type + /// `&mut ContractState` found in `concordium-std`, which gives access to + /// manipulating the contract state bytes directly. This means there is no need + /// to return the contract state and the return type becomes `InitResult<()>`. + /// + /// ### Example + /// ```ignore + /// #[init(contract = "my_contract", low_level)] + /// fn some_init(ctx: &impl HasInitContext, state: &mut ContractState) -> InitResult<()> {...} + /// ``` + /// + /// ## `parameter=""`: Generate schema for parameter + /// To make schema generation to include the parameter for this function, add + /// the attribute `parameter` and set it equal to a string literal containing + /// the name of the type used for the parameter. The parameter type must + /// implement the SchemaType trait, which for most cases can be derived + /// automatically. + /// + /// ### Example + /// ```ignore + /// #[derive(SchemaType)] + /// struct MyParam { ... } + /// + /// #[init(contract = "my_contract", parameter = "MyParam")] + /// ``` + #[proc_macro_attribute] + pub fn init(attr: TokenStream, item: TokenStream) -> TokenStream { + unwrap_or_report(init_worker(attr, item)) + } + + fn init_worker(attr: TokenStream, item: TokenStream) -> syn::Result { + let attrs = Punctuated::::parse_terminated.parse(attr)?; + + let contract_name = get_attribute_value(attrs.iter(), "contract")?.ok_or_else(|| { + syn::Error::new( + Span::call_site(), + "A name for the contract must be provided, using the contract attribute. For example, \ + #[init(contract = \"my-contract\")]", + ) + })?; + + let ast: syn::ItemFn = + attach_error(syn::parse(item), "#[init] can only be applied to functions.")?; + + let fn_name = &ast.sig.ident; + let rust_export_fn_name = format_ident!("export_{}", fn_name); + let wasm_export_fn_name = format!("init_{}", contract_name.value()); + + if let Err(e) = ContractName::is_valid_contract_name(&wasm_export_fn_name) { + return Err(syn::Error::new(contract_name.span(), e)); + } + + let amount_ident = format_ident!("amount"); + + // Accumulate a list of required arguments, if the function contains a + // different number of arguments, than elements in this vector, then the + // strings are displayed as the expected arguments. + let mut required_args = vec!["ctx: &impl HasInitContext"]; + + let (setup_fn_optional_args, fn_optional_args) = + contract_function_optional_args_tokens(&attrs, &amount_ident, &mut required_args); + + let mut out = if contains_attribute(attrs.iter(), "low_level") { + required_args.push("state: &mut ContractState"); + quote! { + #[export_name = #wasm_export_fn_name] + pub extern "C" fn #rust_export_fn_name(#amount_ident: hacspec_concordium::Amount) -> i32 { + use hacspec_concordium::{trap, ExternContext, InitContextExtern, ContractState}; + #setup_fn_optional_args + let ctx = ExternContext::::open(()); + let mut state = ContractState::open(()); + match #fn_name(&ctx, #(#fn_optional_args, )* &mut state) { + Ok(()) => 0, + Err(reject) => { + let code = Reject::from(reject).error_code.get(); + if code < 0 { + code + } else { + trap() // precondition violation + } + } + } + } + } + } else { + quote! { + #[export_name = #wasm_export_fn_name] + pub extern "C" fn #rust_export_fn_name(amount: hacspec_concordium::Amount) -> i32 { + use hacspec_concordium::{trap, ExternContext, InitContextExtern, ContractState}; + #setup_fn_optional_args + let ctx = ExternContext::::open(()); + match #fn_name(&ctx, #(#fn_optional_args),*) { + Ok(state) => { + let mut state_bytes = ContractState::open(()); + if state.serial(&mut state_bytes).is_err() { + trap() // Could not initialize contract. + }; + 0 + } + Err(reject) => { + let code = Reject::from(reject).error_code.get(); + if code < 0 { + code + } else { + trap() // precondition violation + } + } + } + } + } + }; + + let arg_count = ast.sig.inputs.len(); + if arg_count != required_args.len() { + return Err(syn::Error::new( + ast.sig.inputs.span(), + format!( + "Incorrect number of function arguments, the expected arguments are ({}) ", + required_args.join(", ") + ), + )); + } + + // Embed schema if 'parameter' attribute is set + let parameter_option = get_attribute_value(attrs.iter(), "parameter")?.map(|a| a.value()); + out.extend(contract_function_schema_tokens( + parameter_option, + rust_export_fn_name, + wasm_export_fn_name, + )); + + ast.to_tokens(&mut out); + + Ok(out.into()) + } + + /// Derive the appropriate export for an annotated receive function. + /// + /// This macro requires the following items to be present + /// - `contract = ""` where *\* is the name of + /// the smart contract. + /// - `name = ""` where *\* is the name of the + /// receive function. The generated function is exported as + /// `.`. Contract name and receive name is + /// required to be unique in the module. + /// + /// The annotated function must be of a specific type, which depends on the + /// enabled attributes. *Without* any of the optional attributes the function + /// must have a signature of + /// + /// ```ignore + /// #[receive(contract = "my_contract", name = "some_receive")] + /// fn contract_receive(ctx: &impl HasReceiveContext, state: &mut MyState) -> ReceiveResult {...} + /// ``` + /// + /// Where the `HasAction`, `HasReceiveContext` traits and the type + /// `ReceiveResult` are exposed from `concordium-std` and `MyState` is the + /// user-defined type for the contract state. + /// + /// # Optional attributes + /// + /// ## `payable`: Make function accept an amount of GTU + /// Without setting the `payable` attribute, the function will reject any + /// non-zero amount of GTU, supplied with the transaction. This means we are + /// required to explicitly mark our functions as `payable`, if they are to + /// accept GTU. + /// + /// Setting the `payable` attribute changes the required signature to include an + /// extra argument of type `Amount`, allowing the function to access the amount + /// of GTU supplied with the transaction. + /// + /// ### Example + /// ```ignore + /// #[receive(contract = "my_contract", name = "some_receive", payable)] + /// fn contract_receive(ctx: &impl HasReceiveContext, amount: Amount, state: &mut MyState) -> ReceiveResult {...} + /// ``` + /// + /// ## `enable_logger`: Function can access event logging + /// Setting the `enable_logger` attribute changes the required signature to + /// include an extra argument `&mut impl HasLogger`, allowing the function to + /// log events. + /// + /// + /// ### Example + /// ```ignore + /// #[receive(contract = "my_contract", name = "some_receive", enable_logger)] + /// fn contract_receive(ctx: &impl HasReceiveContext, logger: &mut impl HasLogger, state: &mut MyState) -> ReceiveResult {...} + /// ``` + /// + /// ## `low_level`: Manually deal with writing state bytes + /// Setting the `low_level` attribute disables the generated code for + /// serializing the contract state. + /// + /// If `low_level` is set, instead of the user-defined state type in the + /// signature, the state argument becomes the type `&mut ContractState` found in + /// `concordium-std`, which gives access to manipulating the contract state + /// bytes directly. + /// + /// ### Example + /// ```ignore + /// #[receive(contract = "my_contract", name = "some_receive", low_level)] + /// fn contract_receive(ctx: &impl HasReceiveContext, state: &mut ContractState) -> ReceiveResult {...} + /// ``` + /// + /// ## `parameter=""`: Generate schema for parameter + /// To make schema generation include the parameter for this function, add + /// the attribute `parameter` and set it equal to a string literal containing + /// the name of the type used for the parameter. The parameter type must + /// implement the SchemaType trait, which for most cases can be derived + /// automatically. + /// + /// ### Example + /// ```ignore + /// #[derive(SchemaType)] + /// struct MyParam { ... } + /// + /// #[receive(contract = "my_contract", name = "some_receive", parameter = "MyParam")] + /// fn contract_receive(ctx: &impl HasReceiveContext, state: &mut MyState) -> ReceiveResult {...} + /// ``` + #[proc_macro_attribute] + pub fn receive(attr: TokenStream, item: TokenStream) -> TokenStream { + unwrap_or_report(receive_worker(attr, item)) + } + + fn receive_worker(attr: TokenStream, item: TokenStream) -> syn::Result { + let attrs = Punctuated::::parse_terminated.parse(attr)?; + + let contract_name = get_attribute_value(attrs.iter(), "contract")?.ok_or_else(|| { + syn::Error::new( + Span::call_site(), + "The name of the associated contract must be provided, using the 'contract' \ + attribute.\n\nFor example, #[receive(contract = \"my-contract\")]", + ) + })?; + + let name = get_attribute_value(attrs.iter(), "name")?.ok_or_else(|| { + syn::Error::new( + Span::call_site(), + "A name for the receive function must be provided, using the 'name' attribute.\n\nFor \ + example, #[receive(name = \"func-name\", ...)]", + ) + })?; + + let ast: syn::ItemFn = + attach_error(syn::parse(item), "#[receive] can only be applied to functions.")?; + + let fn_name = &ast.sig.ident; + let rust_export_fn_name = format_ident!("export_{}", fn_name); + let wasm_export_fn_name = format!("{}.{}", contract_name.value(), name.value()); + + // Validate the contract name independently to ensure that it doesn't contain a + // '.' as this causes a subtle error when receive names are being split. + let contract_name_validation = + ContractName::is_valid_contract_name(&format!("init_{}", contract_name.value())) + .map_err(|e| syn::Error::new(contract_name.span(), e)); + + let receive_name_validation = ReceiveName::is_valid_receive_name(&wasm_export_fn_name) + .map_err(|e| syn::Error::new(name.span(), e)); + + match (contract_name_validation, receive_name_validation) { + (Err(mut e0), Err(e1)) => { + e0.combine(e1); + return Err(e0); + } + (Err(e), _) => return Err(e), + (_, Err(e)) => return Err(e), + _ => (), + }; + + let amount_ident = format_ident!("amount"); + + // Accumulate a list of required arguments, if the function contains a + // different number of arguments, than elements in this vector, then the + // strings are displayed as the expected arguments. + let mut required_args = vec!["ctx: &impl HasReceiveContext"]; + + let (setup_fn_optional_args, fn_optional_args) = + contract_function_optional_args_tokens(&attrs, &amount_ident, &mut required_args); + + let mut out = if contains_attribute(&attrs, "low_level") { + required_args.push("state: &mut ContractState"); + quote! { + #[export_name = #wasm_export_fn_name] + pub extern "C" fn #rust_export_fn_name(#amount_ident: hacspec_concordium::Amount) -> i32 { + use hacspec_concordium::{SeekFrom, ContractState, Logger, ReceiveContextExtern, ExternContext}; + #setup_fn_optional_args + let ctx = ExternContext::::open(()); + let mut state = ContractState::open(()); + let res: Result = #fn_name(&ctx, #(#fn_optional_args, )* &mut state); + match res { + Ok(act) => { + act.tag() as i32 + } + Err(reject) => { + let code = Reject::from(reject).error_code.get(); + if code < 0 { + code + } else { + trap() // precondition violation + } + } + } + } + } + } else { + required_args.push("state: &mut MyState"); + + quote! { + #[export_name = #wasm_export_fn_name] + pub extern "C" fn #rust_export_fn_name(#amount_ident: hacspec_concordium::Amount) -> i32 { + use hacspec_concordium::{SeekFrom, ContractState, Logger, trap}; + #setup_fn_optional_args + let ctx = ExternContext::::open(()); + let mut state_bytes = ContractState::open(()); + if let Ok(mut state) = (&mut state_bytes).get() { + let res: Result = #fn_name(&ctx, #(#fn_optional_args, )* &mut state); + match res { + Ok(act) => { + let res = state_bytes + .seek(SeekFrom::Start(0)) + .and_then(|_| state.serial(&mut state_bytes)); + if res.is_err() { + trap() // could not serialize state. + } else { + act.tag() as i32 + } + } + Err(reject) => { + let code = Reject::from(reject).error_code.get(); + if code < 0 { + code + } else { + trap() // precondition violation + } + } + } + } else { + trap() // Could not fully read state. + } + } + } + }; + + let arg_count = ast.sig.inputs.len(); + if arg_count != required_args.len() { + return Err(syn::Error::new( + ast.sig.inputs.span(), + format!( + "Incorrect number of function arguments, the expected arguments are ({}) ", + required_args.join(", ") + ), + )); + } + + // Embed schema if 'parameter' attribute is set + let parameter_option = get_attribute_value(attrs.iter(), "parameter")?.map(|a| a.value()); + out.extend(contract_function_schema_tokens( + parameter_option, + rust_export_fn_name, + wasm_export_fn_name, + )); + // add the original function to the output as well. + ast.to_tokens(&mut out); + Ok(out.into()) + } + + /// Generate tokens for some of the optional arguments, based on the attributes. + /// Returns a pair, where the first entry is tokens for setting up the arguments + /// and the second entry is a Vec of the argument names as tokens. + /// + /// It also mutates a vector of required arguments with the expected type + /// signature of each. + fn contract_function_optional_args_tokens<'a, I: Copy + IntoIterator>( + attrs: I, + amount_ident: &syn::Ident, + required_args: &mut Vec<&str>, + ) -> (proc_macro2::TokenStream, Vec) { + let mut setup_fn_args = proc_macro2::TokenStream::new(); + let mut fn_args = vec![]; + if contains_attribute(attrs, "payable") { + required_args.push("amount: Amount"); + fn_args.push(quote!(#amount_ident)); + } else { + setup_fn_args.extend(quote! { + if #amount_ident.micro_ccd != 0 { + return -1; + } + }); + }; + + if contains_attribute(attrs, "enable_logger") { + required_args.push("logger: &mut impl HasLogger"); + let logger_ident = format_ident!("logger"); + setup_fn_args.extend(quote!(let mut #logger_ident = hacspec_concordium::Logger::init();)); + fn_args.push(quote!(&mut #logger_ident)); + } + (setup_fn_args, fn_args) + } + + #[cfg(feature = "build-schema")] + fn contract_function_schema_tokens( + parameter_option: Option, + rust_name: syn::Ident, + wasm_name: String, + ) -> proc_macro2::TokenStream { + match parameter_option { + Some(parameter_ty) => { + let parameter_ident = syn::Ident::new(¶meter_ty, Span::call_site()); + let schema_name = format!("concordium_schema_function_{}", wasm_name); + let schema_ident = format_ident!("concordium_schema_function_{}", rust_name); + quote! { + #[export_name = #schema_name] + pub extern "C" fn #schema_ident() -> *mut u8 { + let schema = <#parameter_ident as schema::SchemaType>::get_type(); + let schema_bytes = hacspec_concordium::to_bytes(&schema); + hacspec_concordium::put_in_memory(&schema_bytes) + } + } + } + None => proc_macro2::TokenStream::new(), + } + } + + #[cfg(not(feature = "build-schema"))] + fn contract_function_schema_tokens( + _parameter_option: Option, + _rust_name: syn::Ident, + _wasm_name: String, + ) -> proc_macro2::TokenStream { + proc_macro2::TokenStream::new() + } + + /// Derive the Deserial trait. See the documentation of `derive(Serial)` for + /// details and limitations. + /// + /// In addition to the attributes supported by `derive(Serial)`, this derivation + /// macro supports the `ensure_ordered` attribute. If applied to a field the + /// of type `BTreeMap` or `BTreeSet` deserialization will additionally ensure + /// that the keys are in strictly increasing order. By default deserialization + /// only ensures uniqueness. + /// + /// # Example + /// ``` ignore + /// #[derive(Deserial)] + /// struct Foo { + /// #[concordium(size_length = 1, ensure_ordered)] + /// bar: BTreeSet, + /// } + /// ``` + #[proc_macro_derive(Deserial, attributes(concordium))] + pub fn deserial_derive(input: TokenStream) -> TokenStream { + let ast = parse_macro_input!(input); + unwrap_or_report(impl_deserial(&ast)) + } + + /// The prefix used in field attributes: `#[concordium(attr = "something")]` + const CONCORDIUM_FIELD_ATTRIBUTE: &str = "concordium"; + + /// A list of valid concordium field attributes + const VALID_CONCORDIUM_FIELD_ATTRIBUTES: [&str; 3] = ["size_length", "ensure_ordered", "rename"]; + + fn get_concordium_field_attributes(attributes: &[syn::Attribute]) -> syn::Result> { + attributes + .iter() + // Keep only concordium attributes + .flat_map(|attr| match attr.parse_meta() { + Ok(syn::Meta::List(list)) if list.path.is_ident(CONCORDIUM_FIELD_ATTRIBUTE) => { + list.nested + } + _ => syn::punctuated::Punctuated::new(), + }) + // Ensure only valid attributes and unwrap NestedMeta + .map(|nested| match nested { + syn::NestedMeta::Meta(meta) => { + let path = meta.path(); + if VALID_CONCORDIUM_FIELD_ATTRIBUTES.iter().any(|&attr| path.is_ident(attr)) { + Ok(meta) + } else { + Err(syn::Error::new(meta.span(), + format!("The attribute '{}' is not supported as a concordium field attribute.", + path.to_token_stream()) + )) + } + } + lit => Err(syn::Error::new(lit.span(), "Literals are not supported in a concordium field attribute.")), + }) + .collect() + } + + fn find_field_attribute_value( + attributes: &[syn::Attribute], + target_attr: &str, + ) -> syn::Result> { + let target_attr = format_ident!("{}", target_attr); + let attr_values: Vec<_> = get_concordium_field_attributes(attributes)? + .into_iter() + .filter_map(|nested_meta| match nested_meta { + syn::Meta::NameValue(value) if value.path.is_ident(&target_attr) => Some(value.lit), + _ => None, + }) + .collect(); + if attr_values.is_empty() { + return Ok(None); + } + if attr_values.len() > 1 { + let mut init_error = syn::Error::new( + attr_values[1].span(), + format!("Attribute '{}' should only be specified once.", target_attr), + ); + for other in attr_values.iter().skip(2) { + init_error.combine(syn::Error::new( + other.span(), + format!("Attribute '{}' should only be specified once.", target_attr), + )) + } + Err(init_error) + } else { + Ok(Some(attr_values[0].clone())) + } + } + + fn find_length_attribute(attributes: &[syn::Attribute]) -> syn::Result> { + let value = match find_field_attribute_value(attributes, "size_length")? { + Some(v) => v, + None => return Ok(None), + }; + + // Save the span to be used in errors. + let value_span = value.span(); + + let value = match value { + syn::Lit::Int(int) => int, + _ => return Err(syn::Error::new(value_span, "Length attribute value must be an integer.")), + }; + let value = match value.base10_parse() { + Ok(v) => v, + _ => { + return Err(syn::Error::new( + value_span, + "Length attribute value must be a base 10 integer.", + )) + } + }; + match value { + 1 | 2 | 4 | 8 => Ok(Some(value)), + _ => Err(syn::Error::new(value_span, "Length info must be either 1, 2, 4, or 8.")), + } + } + + /// Find a 'rename' attribute and return its value and span. + /// Checks that the attribute is only defined once and that the value is a + /// string. + #[cfg(feature = "build-schema")] + fn find_rename_attribute(attributes: &[syn::Attribute]) -> syn::Result> { + let value = match find_field_attribute_value(attributes, "rename")? { + Some(v) => v, + None => return Ok(None), + }; + + match value { + syn::Lit::Str(value) => Ok(Some((value.value(), value.span()))), + _ => Err(syn::Error::new(value.span(), "Rename attribute value must be a string.")), + } + } + + /// Check for name collisions by inserting the name in the HashMap. + /// On collisions it returns a combined error pointing to the previous and new + /// definition. + #[cfg(feature = "build-schema")] + fn check_for_name_collisions( + used_names: &mut HashMap, + new_name: &str, + new_span: Span, + ) -> syn::Result<()> { + if let Some(used_span) = used_names.insert(String::from(new_name), new_span) { + let error_msg = format!("the name `{}` is defined multiple times", new_name); + let mut error_at_first_def = syn::Error::new(used_span, &error_msg); + let error_at_second_def = syn::Error::new(new_span, &error_msg); + + // Combine the errors to show both at once + error_at_first_def.combine(error_at_second_def); + + return Err(error_at_first_def); + } + Ok(()) + } + + fn impl_deserial_field( + f: &syn::Field, + ident: &syn::Ident, + source: &syn::Ident, + ) -> syn::Result { + let concordium_attributes = get_concordium_field_attributes(&f.attrs)?; + let ensure_ordered = contains_attribute(&concordium_attributes, "ensure_ordered"); + let size_length = find_length_attribute(&f.attrs)?; + let has_ctx = ensure_ordered || size_length.is_some(); + let ty = &f.ty; + if has_ctx { + // Default size length is u32, i.e. 4 bytes. + let l = format_ident!("U{}", 8 * size_length.unwrap_or(4)); + Ok(quote! { + let #ident = <#ty as hacspec_concordium::DeserialCtx>::deserial_ctx(hacspec_concordium::schema::SizeLength::#l, #ensure_ordered, #source)?; + }) + } else { + Ok(quote! { + let #ident = <#ty as Deserial>::deserial(#source)?; + }) + } + } + + fn impl_deserial(ast: &syn::DeriveInput) -> syn::Result { + let data_name = &ast.ident; + + let span = ast.span(); + + let read_ident = format_ident!("__R", span = span); + + let (impl_generics, ty_generics, where_clauses) = ast.generics.split_for_impl(); + + let source_ident = Ident::new("source", Span::call_site()); + + let body_tokens = match ast.data { + syn::Data::Struct(ref data) => { + let mut names = proc_macro2::TokenStream::new(); + let mut field_tokens = proc_macro2::TokenStream::new(); + let return_tokens = match data.fields { + syn::Fields::Named(_) => { + for field in data.fields.iter() { + let field_ident = field.ident.clone().unwrap(); // safe since named fields. + field_tokens.extend(impl_deserial_field( + field, + &field_ident, + &source_ident, + )); + names.extend(quote!(#field_ident,)) + } + quote!(Ok(#data_name{#names})) + } + syn::Fields::Unnamed(_) => { + for (i, f) in data.fields.iter().enumerate() { + let field_ident = format_ident!("x_{}", i); + field_tokens.extend(impl_deserial_field(f, &field_ident, &source_ident)); + names.extend(quote!(#field_ident,)) + } + quote!(Ok(#data_name(#names))) + } + _ => quote!(Ok(#data_name{})), + }; + quote! { + #field_tokens + #return_tokens + } + } + syn::Data::Enum(ref data) => { + let mut matches_tokens = proc_macro2::TokenStream::new(); + let source = Ident::new("source", Span::call_site()); + let size = if data.variants.len() <= 256 { + format_ident!("u8") + } else if data.variants.len() <= 256 * 256 { + format_ident!("u16") + } else { + return Err(syn::Error::new( + ast.span(), + "[derive(Deserial)]: Too many variants. Maximum 65536 are supported.", + )); + }; + for (i, variant) in data.variants.iter().enumerate() { + let (field_names, pattern) = match variant.fields { + syn::Fields::Named(_) => { + let field_names: Vec<_> = variant + .fields + .iter() + .map(|field| field.ident.clone().unwrap()) + .collect(); + (field_names.clone(), quote! { {#(#field_names),*} }) + } + syn::Fields::Unnamed(_) => { + let field_names: Vec<_> = variant + .fields + .iter() + .enumerate() + .map(|(i, _)| format_ident!("x_{}", i)) + .collect(); + (field_names.clone(), quote! { ( #(#field_names),* ) }) + } + syn::Fields::Unit => (Vec::new(), proc_macro2::TokenStream::new()), + }; + + let field_tokens: proc_macro2::TokenStream = field_names + .iter() + .zip(variant.fields.iter()) + .map(|(name, field)| impl_deserial_field(field, name, &source)) + .collect::>()?; + let idx_lit = syn::LitInt::new(i.to_string().as_str(), Span::call_site()); + let variant_ident = &variant.ident; + matches_tokens.extend(quote! { + #idx_lit => { + #field_tokens + Ok(#data_name::#variant_ident#pattern) + }, + }) + } + quote! { + let idx = #size::deserial(#source)?; + match idx { + #matches_tokens + _ => Err(Default::default()) + } + } + } + _ => unimplemented!("#[derive(Deserial)] is not implemented for union."), + }; + let gen = quote! { + #[automatically_derived] + impl #impl_generics Deserial for #data_name #ty_generics #where_clauses { + fn deserial<#read_ident: Read>(#source_ident: &mut #read_ident) -> ParseResult { + #body_tokens + } + } + }; + Ok(gen.into()) + } + + /// Derive the Serial trait for the type. + /// + /// If the type is a struct all fields must implement the Serial trait. If the + /// type is an enum then all fields of each of the enums must implement the + /// Serial trait. + /// + /// + /// Collections (Vec, BTreeMap, BTreeSet) and strings (String, str) are by + /// default serialized by prepending the number of elements as 4 bytes + /// little-endian. If this is too much or too little, fields of the above types + /// can be annotated with `size_length`. + /// + /// The value of this field is the number of bytes that will be used for + /// encoding the number of elements. Supported values are 1, 2, 4, 8. + /// + /// For BTreeMap and BTreeSet the serialize method will serialize values in + /// increasing order of keys. + /// + /// Fields of structs are serialized in the order they appear in the code. + /// + /// Enums can have no more than 65536 variants. They are serialized by using a + /// tag to indicate the variant, enumerating them in the order they are written + /// in source code. If the number of variants is less than or equal 256 then a + /// single byte is used to encode it. Otherwise two bytes are used for the tag, + /// encoded in little endian. + /// + /// # Example + /// ```ignore + /// #[derive(Serial)] + /// struct Foo { + /// #[concordium(size_length = 1)] + /// bar: BTreeSet, + /// } + /// ``` + #[proc_macro_derive(Serial, attributes(concordium))] + pub fn serial_derive(input: TokenStream) -> TokenStream { + let ast = parse_macro_input!(input); + unwrap_or_report(impl_serial(&ast)) + } + + fn impl_serial_field( + field: &syn::Field, + ident: &proc_macro2::TokenStream, + out: &syn::Ident, + ) -> syn::Result { + if let Some(size_length) = find_length_attribute(&field.attrs)? { + let l = format_ident!("U{}", 8 * size_length); + Ok(quote!({ + use hacspec_concordium::SerialCtx; + #ident.serial_ctx(hacspec_concordium::schema::SizeLength::#l, #out)?; + })) + } else { + Ok(quote! { + #ident.serial(#out)?; + }) + } + } + + fn impl_serial(ast: &syn::DeriveInput) -> syn::Result { + let data_name = &ast.ident; + + let span = ast.span(); + + let write_ident = format_ident!("W", span = span); + + let (impl_generics, ty_generics, where_clauses) = ast.generics.split_for_impl(); + + let out_ident = format_ident!("out"); + + let body = match ast.data { + syn::Data::Struct(ref data) => { + let fields_tokens = match data.fields { + syn::Fields::Named(_) => { + data.fields + .iter() + .map(|field| { + let field_ident = field.ident.clone().unwrap(); // safe since named fields. + let field_ident = quote!(self.#field_ident); + impl_serial_field(field, &field_ident, &out_ident) + }) + .collect::>()? + } + syn::Fields::Unnamed(_) => data + .fields + .iter() + .enumerate() + .map(|(i, field)| { + let i = syn::LitInt::new(i.to_string().as_str(), Span::call_site()); + let field_ident = quote!(self.#i); + impl_serial_field(field, &field_ident, &out_ident) + }) + .collect::>()?, + syn::Fields::Unit => proc_macro2::TokenStream::new(), + }; + quote! { + #fields_tokens + Ok(()) + } + } + syn::Data::Enum(ref data) => { + let mut matches_tokens = proc_macro2::TokenStream::new(); + + let size = if data.variants.len() <= 256 { + format_ident!("u8") + } else if data.variants.len() <= 256 * 256 { + format_ident!("u16") + } else { + unimplemented!( + "[derive(Serial)]: Enums with more than 65536 variants are not supported." + ); + }; + + for (i, variant) in data.variants.iter().enumerate() { + let (field_names, pattern) = match variant.fields { + syn::Fields::Named(_) => { + let field_names: Vec<_> = variant + .fields + .iter() + .map(|field| field.ident.clone().unwrap()) + .collect(); + (field_names.clone(), quote! { {#(#field_names),*} }) + } + syn::Fields::Unnamed(_) => { + let field_names: Vec<_> = variant + .fields + .iter() + .enumerate() + .map(|(i, _)| format_ident!("x_{}", i)) + .collect(); + (field_names.clone(), quote! { (#(#field_names),*) }) + } + syn::Fields::Unit => (Vec::new(), proc_macro2::TokenStream::new()), + }; + let field_tokens: proc_macro2::TokenStream = field_names + .iter() + .zip(variant.fields.iter()) + .map(|(name, field)| impl_serial_field(field, "e!(#name), &out_ident)) + .collect::>()?; + + let idx_lit = + syn::LitInt::new(format!("{}{}", i, size).as_str(), Span::call_site()); + let variant_ident = &variant.ident; + + matches_tokens.extend(quote! { + #data_name::#variant_ident#pattern => { + #idx_lit.serial(#out_ident)?; + #field_tokens + }, + }) + } + quote! { + match self { + #matches_tokens + } + Ok(()) + } + } + _ => unimplemented!("#[derive(Serial)] is not implemented for union."), + }; + + let gen = quote! { + #[automatically_derived] + impl #impl_generics Serial for #data_name #ty_generics #where_clauses { + fn serial<#write_ident: Write>(&self, #out_ident: &mut #write_ident) -> Result<(), #write_ident::Err> { + #body + } + } + }; + Ok(gen.into()) + } + + /// A helper macro to derive both the Serial and Deserial traits. + /// `[derive(Serialize)]` is equivalent to `[derive(Serial,Deserial)]`, see + /// documentation of the latter two for details and options. + #[proc_macro_derive(Serialize, attributes(concordium))] + pub fn serialize_derive(input: TokenStream) -> TokenStream { + unwrap_or_report(serialize_derive_worker(input)) + } + + fn serialize_derive_worker(input: TokenStream) -> syn::Result { + let ast = syn::parse(input)?; + let mut tokens = impl_deserial(&ast)?; + tokens.extend(impl_serial(&ast)?); + Ok(tokens) + } + + /// Marks a type as the contract state. Currently only used for generating the + /// schema of the contract state. If the feature `build-schema` is not enabled + /// this has no effect. + /// + /// + /// # Example + /// ```ignore + /// #[contract_state(contract = "my_contract")] + /// #[derive(SchemaType)] + /// struct MyContractState { + /// ... + /// } + /// ``` + #[proc_macro_attribute] + pub fn contract_state(attr: TokenStream, item: TokenStream) -> TokenStream { + unwrap_or_report(contract_state_worker(attr, item)) + } + + #[cfg(feature = "build-schema")] + fn contract_state_worker(attr: TokenStream, item: TokenStream) -> syn::Result { + let mut out = proc_macro2::TokenStream::new(); + + let data_ident = if let Ok(ast) = syn::parse::(item.clone()) { + ast.to_tokens(&mut out); + ast.ident + } else if let Ok(ast) = syn::parse::(item.clone()) { + ast.to_tokens(&mut out); + ast.ident + } else if let Ok(ast) = syn::parse::(item.clone()) { + ast.to_tokens(&mut out); + ast.ident + } else { + return Err(syn::Error::new_spanned( + proc_macro2::TokenStream::from(item), + "#[contract_state] only supports structs, enums and type aliases.", + )); + }; + + let attrs = Punctuated::::parse_terminated.parse(attr)?; + + let contract_name = get_attribute_value(attrs.iter(), "contract")?.ok_or_else(|| { + syn::Error::new( + Span::call_site(), + "A name of the contract must be provided, using the 'contract' attribute.\n\nFor \ + example #[contract_state(contract = \"my-contract\")].", + ) + })?; + + let wasm_schema_name = format!("concordium_schema_state_{}", contract_name.value()); + let rust_schema_name = format_ident!("concordium_schema_state_{}", data_ident); + + let generate_schema_tokens = quote! { + #[allow(non_snake_case)] + #[export_name = #wasm_schema_name] + pub extern "C" fn #rust_schema_name() -> *mut u8 { + let schema = <#data_ident as hacspec_concordium::schema::SchemaType>::get_type(); + let schema_bytes = hacspec_concordium::to_bytes(&schema); + hacspec_concordium::put_in_memory(&schema_bytes) + } + }; + generate_schema_tokens.to_tokens(&mut out); + Ok(out.into()) + } + + #[cfg(not(feature = "build-schema"))] + fn contract_state_worker(_attr: TokenStream, item: TokenStream) -> syn::Result { + Ok(item) + } + + /// Derive the `SchemaType` trait for a type. + /// If the feature `build-schema` is not enabled this is a no-op, i.e., it does + /// not produce any code. + #[proc_macro_derive(SchemaType, attributes(size_length))] + pub fn schema_type_derive(input: TokenStream) -> TokenStream { + unwrap_or_report(schema_type_derive_worker(input)) + } + + #[cfg(feature = "build-schema")] + fn schema_type_derive_worker(input: TokenStream) -> syn::Result { + let ast: syn::DeriveInput = syn::parse(input)?; + + let data_name = &ast.ident; + + let body = match ast.data { + syn::Data::Struct(ref data) => { + let fields_tokens = schema_type_fields(&data.fields)?; + quote! { + hacspec_concordium::schema::Type::Struct(#fields_tokens) + } + } + syn::Data::Enum(ref data) => { + let mut used_variant_names = HashMap::new(); + let variant_tokens: Vec<_> = data + .variants + .iter() + .map(|variant| { + // Handle the 'rename' attribute. + let (variant_name, variant_span) = match find_rename_attribute(&variant.attrs)? + { + Some(name_and_span) => name_and_span, + None => (variant.ident.to_string(), variant.ident.span()), + }; + check_for_name_collisions( + &mut used_variant_names, + &variant_name, + variant_span, + )?; + + let fields_tokens = schema_type_fields(&variant.fields)?; + Ok(quote! { + (hacspec_concordium::String::from(#variant_name), #fields_tokens) + }) + }) + .collect::>()?; + quote! { + hacspec_concordium::schema::Type::Enum(hacspec_concordium::Vec::from([ #(#variant_tokens),* ])) + } + } + _ => syn::Error::new(ast.span(), "Union is not supported").to_compile_error(), + }; + + let out = quote! { + #[automatically_derived] + impl hacspec_concordium::schema::SchemaType for #data_name { + fn get_type() -> hacspec_concordium::schema::Type { + #body + } + } + }; + Ok(out.into()) + } + + #[cfg(not(feature = "build-schema"))] + fn schema_type_derive_worker(_input: TokenStream) -> syn::Result { + Ok(TokenStream::new()) + } + + #[cfg(feature = "build-schema")] + fn schema_type_field_type(field: &syn::Field) -> syn::Result { + let field_type = &field.ty; + if let Some(l) = find_length_attribute(&field.attrs)? { + let size = format_ident!("U{}", 8 * l); + Ok(quote! { + <#field_type as hacspec_concordium::schema::SchemaType>::get_type().set_size_length(hacspec_concordium::schema::SizeLength::#size) + }) + } else { + Ok(quote! { + <#field_type as hacspec_concordium::schema::SchemaType>::get_type() + }) + } + } + + #[cfg(feature = "build-schema")] + fn schema_type_fields(fields: &syn::Fields) -> syn::Result { + match fields { + syn::Fields::Named(_) => { + let mut used_field_names = HashMap::new(); + let fields_tokens: Vec<_> = fields + .iter() + .map(|field| { + // Handle the 'rename' attribute. + let (field_name, field_span) = match find_rename_attribute(&field.attrs)? { + Some(name_and_span) => name_and_span, + None => (field.ident.clone().unwrap().to_string(), field.ident.span()), // safe since named fields. + }; + check_for_name_collisions(&mut used_field_names, &field_name, field_span)?; + + let field_schema_type = schema_type_field_type(&field)?; + Ok(quote! { + (hacspec_concordium::String::from(#field_name), #field_schema_type) + }) + }) + .collect::>()?; + Ok( + quote! { hacspec_concordium::schema::Fields::Named(hacspec_concordium::Vec::from([ #(#fields_tokens),* ])) }, + ) + } + syn::Fields::Unnamed(_) => { + let fields_tokens: Vec<_> = + fields.iter().map(schema_type_field_type).collect::>()?; + Ok(quote! { hacspec_concordium::schema::Fields::Unnamed([ #(#fields_tokens),* ].to_vec()) }) + } + syn::Fields::Unit => Ok(quote! { hacspec_concordium::schema::Fields::None }), + } + } + + /// We reserve a number of error codes for custom errors, such as ParseError, + /// that are provided by concordium-std. These reserved error codes can have + /// indices i32::MIN, i32::MIN + 1, ..., RESERVED_ERROR_CODES + const RESERVED_ERROR_CODES: i32 = i32::MIN + 100; + + /// Derive the conversion of enums that represent error types into the Reject + /// struct which can be used as the error type of init and receive functions. + /// Creating custom enums for error types can provide meaningful error messages + /// to the user of the smart contract. + /// + /// Note that at the moment, we can only derive fieldless enums. + /// + /// The conversion will map the first variant to error code -1, second to -2, + /// etc. + /// + /// ### Example + /// ```ignore + /// #[derive(Clone, Copy, Reject)] + /// enum MyError { + /// IllegalState, // receives error code -1 + /// WrongSender, // receives error code -2 + /// // TimeExpired(time: Timestamp), /* currently not supported */ + /// ... + /// } + /// ``` + /// ```ignore + /// #[receive(contract = "my_contract", name = "some_receive")] + /// fn receive(ctx: &impl HasReceiveContext, state: &mut MyState) + /// -> Result {...} + /// ``` + #[proc_macro_derive(Reject, attributes(from))] + pub fn reject_derive(input: TokenStream) -> TokenStream { + unwrap_or_report(reject_derive_worker(input)) + } + + fn reject_derive_worker(input: TokenStream) -> syn::Result { + let ast: syn::DeriveInput = syn::parse(input)?; + let enum_data = match &ast.data { + syn::Data::Enum(data) => Ok(data), + _ => Err(syn::Error::new(ast.span(), "Reject can only be derived for enums.")), + }?; + let enum_ident = &ast.ident; + + // Ensure that the number of enum variants fits into the number of error codes + // we can generate. + let too_many_variants = format!( + "Error enum {} cannot have more than {} variants.", + enum_ident, + RESERVED_ERROR_CODES.neg() + ); + match i32::try_from(enum_data.variants.len()) { + Ok(n) if n <= RESERVED_ERROR_CODES.neg() => (), + _ => { + return Err(syn::Error::new(ast.span(), &too_many_variants)); + } + }; + + let variant_error_conversions = generate_variant_error_conversions(&enum_data, &enum_ident)?; + + let gen = quote! { + /// The from implementation maps the first variant to -1, second to -2, etc. + /// NB: This differs from the cast `variant as i32` since we cannot easily modify + /// the variant tags in the derive macro itself. + #[automatically_derived] + impl From<#enum_ident> for Reject { + #[inline(always)] + fn from(e: #enum_ident) -> Self { + Reject { error_code: unsafe { hacspec_concordium::num::NonZeroI32::new_unchecked(-(e as i32) - 1) } } + } + } + + #(#variant_error_conversions)* + }; + Ok(gen.into()) + } + + /// Generate error conversions for enum variants e.g. for converting + /// `ParseError` to `MyParseErrorWrapper` in + /// + /// ```ignore + /// enum MyErrorType { + /// #[from(ParseError)] + /// MyParseErrorWrapper, + /// ... + /// } + /// ``` + fn generate_variant_error_conversions( + enum_data: &DataEnum, + enum_name: &syn::Ident, + ) -> syn::Result> { + Ok(enum_data + .variants + .iter() + .map(|variant| { + // in the future we might incorporate explicit discriminants, + // but the general case of this requires evaluating constant expressions, + // which is not easily supported at the moment. + if let Some((_, discriminant)) = variant.discriminant.as_ref() { + return Err(syn::Error::new( + discriminant.span(), + "Explicit discriminants are not yet supported.", + )); + } + let variant_attributes = variant.attrs.iter(); + variant_attributes + .map(move |attr| { + parse_attr_and_gen_error_conversions(attr, enum_name, &variant.ident) + }) + .collect::>>() + }) + .collect::>>()? + .into_iter() + .flatten() + .flatten() + .collect()) + } + + /// Generate error conversion for a given enum variant. + fn parse_attr_and_gen_error_conversions( + attr: &syn::Attribute, + enum_name: &syn::Ident, + variant_name: &syn::Ident, + ) -> syn::Result> { + let wrong_from_usage = |x: &dyn Spanned| { + syn::Error::new( + x.span(), + "The `from` attribute expects a list of error types, e.g.: #[from(ParseError)].", + ) + }; + match attr.parse_meta() { + Ok(syn::Meta::List(list)) if list.path.is_ident("from") => { + let mut from_error_names = vec![]; + for nested in list.nested.iter() { + // check that all items in the list are paths + match nested { + syn::NestedMeta::Meta(meta) => match meta { + Meta::Path(from_error) => { + let ident = from_error + .get_ident() + .ok_or_else(|| wrong_from_usage(from_error))?; + from_error_names.push(ident); + } + other => return Err(wrong_from_usage(&other)), + }, + syn::NestedMeta::Lit(l) => return Err(wrong_from_usage(&l)), + } + } + Ok(from_error_token_stream(&from_error_names, &enum_name, variant_name).collect()) + } + Ok(syn::Meta::NameValue(mnv)) if mnv.path.is_ident("from") => Err(wrong_from_usage(&mnv)), + _ => Ok(vec![]), + } + } + + /// Generating the conversion code a la + /// ```ignore + /// impl From for MyErrorType { + /// fn from(x: ParseError) -> Self { + /// MyError::MyParseErrorWrapper + /// } + /// } + /// ``` + fn from_error_token_stream<'a>( + paths: &'a [&'a syn::Ident], + enum_name: &'a syn::Ident, + variant_name: &'a syn::Ident, + ) -> impl Iterator + 'a { + paths.iter().map(move |from_error| { + quote! { + impl From<#from_error> for #enum_name { + #[inline] + fn from(fe: #from_error) -> Self { + #enum_name::#variant_name + } + }} + }) + } + + #[proc_macro_attribute] + /// Derive the appropriate export for an annotated test function, when feature + /// "wasm-test" is enabled, otherwise behaves like `#[test]`. + pub fn concordium_test(attr: TokenStream, item: TokenStream) -> TokenStream { + unwrap_or_report(concordium_test_worker(attr, item)) + } + + /// Derive the appropriate export for an annotated test function, when feature + /// "wasm-test" is enabled, otherwise behaves like `#[test]`. + #[cfg(feature = "wasm-test")] + fn concordium_test_worker(_attr: TokenStream, item: TokenStream) -> syn::Result { + let test_fn_ast: syn::ItemFn = + attach_error(syn::parse(item), "#[concordium_test] can only be applied to functions.")?; + + let test_fn_name = &test_fn_ast.sig.ident; + let rust_export_fn_name = format_ident!("concordium_test_{}", test_fn_name); + let wasm_export_fn_name = format!("concordium_test {}", test_fn_name); + + let test_fn = quote! { + // Setup test function + #test_fn_ast + + // Export test function in wasm + #[export_name = #wasm_export_fn_name] + pub extern "C" fn #rust_export_fn_name() { + #test_fn_name() + } + }; + Ok(test_fn.into()) + } + + /// Derive the appropriate export for an annotated test function, when feature + /// "wasm-test" is enabled, otherwise behaves like `#[test]`. + #[cfg(not(feature = "wasm-test"))] + fn concordium_test_worker(_attr: TokenStream, item: TokenStream) -> syn::Result { + let test_fn_ast: syn::ItemFn = + attach_error(syn::parse(item), "#[concordium_test] can only be applied to functions.")?; + + let test_fn = quote! { + #[test] + #test_fn_ast + }; + Ok(test_fn.into()) + } + + /// Sets the cfg for testing targeting either Wasm and native. + #[cfg(feature = "wasm-test")] + #[proc_macro_attribute] + pub fn concordium_cfg_test(_attr: TokenStream, item: TokenStream) -> TokenStream { item } + + /// Sets the cfg for testing targeting either Wasm and native. + #[cfg(not(feature = "wasm-test"))] + #[proc_macro_attribute] + pub fn concordium_cfg_test(_attr: TokenStream, item: TokenStream) -> TokenStream { + let item = proc_macro2::TokenStream::from(item); + let out = quote! { + #[cfg(test)] + #item + }; + out.into() + } +#+END_SRC + diff --git a/ovn/src/ovn_smart.rs b/ovn/src/ovn_smart.rs index cd1203a..5396d3c 100644 --- a/ovn/src/ovn_smart.rs +++ b/ovn/src/ovn_smart.rs @@ -4,12 +4,12 @@ // use hacspec_lib::*; // use creusot_contracts::*; -use concordium_std::*; // ::{HasLogger, HasInitContext, Logger, HasContractState, Reject, Serial, Deserial, Read, ParseResult, Write, Get, ParseError, HasReceiveContext, HasActions, Seek, Action, ReceiveContextExtern, ExternContext, Vec, to_bytes, test_infrastructure::InitContextTest}; -use concordium_std_derive::*; +use hacspec_concordium::*; // ::{HasLogger, HasInitContext, Logger, HasContractState, Reject, Serial, Deserial, Read, ParseResult, Write, Get, ParseError, HasReceiveContext, HasActions, Seek, Action, ReceiveContextExtern, ExternContext, Vec, to_bytes, test_infrastructure::InitContextTest}; +use hacspec_concordium_derive::*; /** Interface for group implementation */ pub trait Group { - type group_type: PartialEq + Eq + Clone + Copy + concordium_std::Serialize; + type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; const q: u32; // Prime order const g: Self::group_type; // Generator (elemnent of group) From 9525a61c8910e8a3f034f4af95e0ca5713e10fb8 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 23 Aug 2023 16:25:24 +0200 Subject: [PATCH 19/86] Working modification on concordium --- ovn/Cargo.toml | 1 + ovn/concordium_derive.org | 2951 +++++++++-------- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 726 ++-- .../extraction/Hacspec_ovn_Export_cast_vote.v | 4 +- .../Hacspec_ovn_Export_commit_to_vote.v | 60 + .../Hacspec_ovn_Export_init_ovn_contract.v | 4 +- .../Hacspec_ovn_Export_register_vote.v | 60 + .../Hacspec_ovn_Export_tally_votes.v | 4 +- ovn/src/ovn_smart.rs | 45 +- ovn/src/ovn_smart_concordium.rs | 306 ++ 10 files changed, 2364 insertions(+), 1797 deletions(-) create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_commit_to_vote.v create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote.v create mode 100644 ovn/src/ovn_smart_concordium.rs diff --git a/ovn/Cargo.toml b/ovn/Cargo.toml index 902d95c..4d8bed1 100644 --- a/ovn/Cargo.toml +++ b/ovn/Cargo.toml @@ -9,6 +9,7 @@ path = "src/ovn_smart.rs" [dependencies] # hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } +# hax-lib-macros = { git = "https://github.com/hacspec/hacspec-v2.git" } # creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "1cca2320e262b2ec9d28b3c84cba759c96829898" } # branch = master # concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850" , version = "=2.0.0" , default-features = false } # 0cffb859f736ff6726fa38600428a415d800d7b6 diff --git a/ovn/concordium_derive.org b/ovn/concordium_derive.org index 841b7dd..46f359f 100644 --- a/ovn/concordium_derive.org +++ b/ovn/concordium_derive.org @@ -51,1480 +51,1483 @@ quickcheck_macros = "1" :END: *** Imports + #+BEGIN_SRC rust :eval never - // #![no_std] - extern crate proc_macro; - extern crate syn; - #[macro_use] - extern crate quote; - - use concordium_contracts_common::*; - use proc_macro::TokenStream; - use proc_macro2::Span; - use quote::ToTokens; - #[cfg(feature = "build-schema")] - use std::collections::HashMap; - use std::{convert::TryFrom, ops::Neg}; - use syn::{ - parse::Parser, parse_macro_input, punctuated::*, spanned::Spanned, DataEnum, Ident, Meta, Token, - }; - - // use hacspec_concordium::*; - - /// A helper to report meaningful compilation errors - /// - If applied to an Ok value they simply return the underlying value. - /// - If applied to `Err(e)` then `e` is turned into a compiler error. - fn unwrap_or_report(v: syn::Result) -> TokenStream { - match v { - Ok(ts) => ts, - Err(e) => e.to_compile_error().into(), - } - } - - fn attach_error(mut v: syn::Result, msg: &str) -> syn::Result { - if let Err(e) = v.as_mut() { - let span = e.span(); - e.combine(syn::Error::new(span, msg)); - } - v - } - - /// Get the name item from a list, if available and a string literal. - /// If the named item does not have the expected (string) value, this will - /// return an Err. If the item does not exist the return value is Ok(None). - /// FIXME: Ensure there is only one. - fn get_attribute_value<'a, I: IntoIterator>( - iter: I, - name: &str, - ) -> syn::Result> { - for attr in iter.into_iter() { - match attr { - Meta::NameValue(mnv) => { - if mnv.path.is_ident(name) { - if let syn::Lit::Str(lit) = &mnv.lit { - return Ok(Some(lit)); - } else { - return Err(syn::Error::new( - mnv.span(), - format!("The `{}` attribute must be a string literal.", name), - )); - } - } - } - Meta::Path(p) => { - if p.is_ident(name) { - return Err(syn::Error::new( - attr.span(), - format!("The `{}` attribute must have a string literal value.", name), - )); - } - } - Meta::List(p) => { - if p.path.is_ident(name) { - return Err(syn::Error::new( - attr.span(), - format!("The `{}` attribute must have a string literal value.", name), - )); - } - } - } - } - Ok(None) - } - - // Return whether a attribute item is present. - fn contains_attribute<'a, I: IntoIterator>(iter: I, name: &str) -> bool { - iter.into_iter().any(|attr| attr.path().is_ident(name)) - } - - /// Derive the appropriate export for an annotated init function. - /// - /// This macro requires the following items to be present - /// - `contract=""` where *\* is the name of the smart contract and - /// the generated function is exported as this name prefixed with *init_*. The - /// name should be unique in the module, as a contract can only have one - /// init-function. - /// - /// The annotated function must be of a specific type, which depends on the - /// enabled attributes. *Without* any of the optional attributes the function - /// must have a signature of - /// - /// ```ignore - /// #[init(contract = "my_contract")] - /// fn some_init(ctx: &impl HasInitContext) -> InitResult {...} - /// ``` - /// - /// Where the trait `HasInitContext` and the type `InitResult` are exposed from - /// `concordium-std` and `MyState` is the user-defined type for the contract - /// state. - /// - /// # Optional attributes - /// - /// ## `payable`: Make function accept an amount of GTU - /// Without setting the `payable` attribute, the generated function will reject - /// any non-zero amount of GTU supplied with the transaction. This means we are - /// required to explicitly mark our functions as `payable`, if they are to - /// accept GTU. - /// - /// Setting the `payable` attribute changes the required signature to include an - /// extra argument of type `Amount`, allowing the function to access the amount - /// of GTU supplied with the transaction. - /// - /// ### Example - /// ```ignore - /// #[init(contract = "my_contract", payable)] - /// fn some_init(ctx: &impl HasInitContext, amount: Amount) -> InitResult {...} - /// ``` - /// - /// ## `enable_logger`: Function can access event logging - /// Setting the `enable_logger` attribute changes the required signature to - /// include an extra argument `&mut impl HasLogger`, allowing the function to - /// log events. - /// - /// - /// ### Example - /// ```ignore - /// #[init(contract = "my_contract", enable_logger)] - /// fn some_init(ctx: &impl HasInitContext, logger: &mut impl HasLogger) -> InitResult {...} - /// ``` - /// - /// ## `low_level`: Manually deal with writing state bytes - /// Setting the `low_level` attribute disables the generated code for - /// serializing the contract state. - /// - /// If `low_level` is set, the signature must contain an extra argument of type - /// `&mut ContractState` found in `concordium-std`, which gives access to - /// manipulating the contract state bytes directly. This means there is no need - /// to return the contract state and the return type becomes `InitResult<()>`. - /// - /// ### Example - /// ```ignore - /// #[init(contract = "my_contract", low_level)] - /// fn some_init(ctx: &impl HasInitContext, state: &mut ContractState) -> InitResult<()> {...} - /// ``` - /// - /// ## `parameter=""`: Generate schema for parameter - /// To make schema generation to include the parameter for this function, add - /// the attribute `parameter` and set it equal to a string literal containing - /// the name of the type used for the parameter. The parameter type must - /// implement the SchemaType trait, which for most cases can be derived - /// automatically. - /// - /// ### Example - /// ```ignore - /// #[derive(SchemaType)] - /// struct MyParam { ... } - /// - /// #[init(contract = "my_contract", parameter = "MyParam")] - /// ``` - #[proc_macro_attribute] - pub fn init(attr: TokenStream, item: TokenStream) -> TokenStream { - unwrap_or_report(init_worker(attr, item)) - } - - fn init_worker(attr: TokenStream, item: TokenStream) -> syn::Result { - let attrs = Punctuated::::parse_terminated.parse(attr)?; - - let contract_name = get_attribute_value(attrs.iter(), "contract")?.ok_or_else(|| { - syn::Error::new( - Span::call_site(), - "A name for the contract must be provided, using the contract attribute. For example, \ - #[init(contract = \"my-contract\")]", - ) - })?; - - let ast: syn::ItemFn = - attach_error(syn::parse(item), "#[init] can only be applied to functions.")?; - - let fn_name = &ast.sig.ident; - let rust_export_fn_name = format_ident!("export_{}", fn_name); - let wasm_export_fn_name = format!("init_{}", contract_name.value()); - - if let Err(e) = ContractName::is_valid_contract_name(&wasm_export_fn_name) { - return Err(syn::Error::new(contract_name.span(), e)); - } - - let amount_ident = format_ident!("amount"); - - // Accumulate a list of required arguments, if the function contains a - // different number of arguments, than elements in this vector, then the - // strings are displayed as the expected arguments. - let mut required_args = vec!["ctx: &impl HasInitContext"]; - - let (setup_fn_optional_args, fn_optional_args) = - contract_function_optional_args_tokens(&attrs, &amount_ident, &mut required_args); - - let mut out = if contains_attribute(attrs.iter(), "low_level") { - required_args.push("state: &mut ContractState"); - quote! { - #[export_name = #wasm_export_fn_name] - pub extern "C" fn #rust_export_fn_name(#amount_ident: hacspec_concordium::Amount) -> i32 { - use hacspec_concordium::{trap, ExternContext, InitContextExtern, ContractState}; - #setup_fn_optional_args - let ctx = ExternContext::::open(()); - let mut state = ContractState::open(()); - match #fn_name(&ctx, #(#fn_optional_args, )* &mut state) { - Ok(()) => 0, - Err(reject) => { - let code = Reject::from(reject).error_code.get(); - if code < 0 { - code - } else { - trap() // precondition violation - } - } - } - } - } - } else { - quote! { - #[export_name = #wasm_export_fn_name] - pub extern "C" fn #rust_export_fn_name(amount: hacspec_concordium::Amount) -> i32 { - use hacspec_concordium::{trap, ExternContext, InitContextExtern, ContractState}; - #setup_fn_optional_args - let ctx = ExternContext::::open(()); - match #fn_name(&ctx, #(#fn_optional_args),*) { - Ok(state) => { - let mut state_bytes = ContractState::open(()); - if state.serial(&mut state_bytes).is_err() { - trap() // Could not initialize contract. - }; - 0 - } - Err(reject) => { - let code = Reject::from(reject).error_code.get(); - if code < 0 { - code - } else { - trap() // precondition violation - } - } - } - } - } - }; - - let arg_count = ast.sig.inputs.len(); - if arg_count != required_args.len() { - return Err(syn::Error::new( - ast.sig.inputs.span(), - format!( - "Incorrect number of function arguments, the expected arguments are ({}) ", - required_args.join(", ") - ), - )); - } - - // Embed schema if 'parameter' attribute is set - let parameter_option = get_attribute_value(attrs.iter(), "parameter")?.map(|a| a.value()); - out.extend(contract_function_schema_tokens( - parameter_option, - rust_export_fn_name, - wasm_export_fn_name, - )); - - ast.to_tokens(&mut out); - - Ok(out.into()) - } - - /// Derive the appropriate export for an annotated receive function. - /// - /// This macro requires the following items to be present - /// - `contract = ""` where *\* is the name of - /// the smart contract. - /// - `name = ""` where *\* is the name of the - /// receive function. The generated function is exported as - /// `.`. Contract name and receive name is - /// required to be unique in the module. - /// - /// The annotated function must be of a specific type, which depends on the - /// enabled attributes. *Without* any of the optional attributes the function - /// must have a signature of - /// - /// ```ignore - /// #[receive(contract = "my_contract", name = "some_receive")] - /// fn contract_receive(ctx: &impl HasReceiveContext, state: &mut MyState) -> ReceiveResult {...} - /// ``` - /// - /// Where the `HasAction`, `HasReceiveContext` traits and the type - /// `ReceiveResult` are exposed from `concordium-std` and `MyState` is the - /// user-defined type for the contract state. - /// - /// # Optional attributes - /// - /// ## `payable`: Make function accept an amount of GTU - /// Without setting the `payable` attribute, the function will reject any - /// non-zero amount of GTU, supplied with the transaction. This means we are - /// required to explicitly mark our functions as `payable`, if they are to - /// accept GTU. - /// - /// Setting the `payable` attribute changes the required signature to include an - /// extra argument of type `Amount`, allowing the function to access the amount - /// of GTU supplied with the transaction. - /// - /// ### Example - /// ```ignore - /// #[receive(contract = "my_contract", name = "some_receive", payable)] - /// fn contract_receive(ctx: &impl HasReceiveContext, amount: Amount, state: &mut MyState) -> ReceiveResult {...} - /// ``` - /// - /// ## `enable_logger`: Function can access event logging - /// Setting the `enable_logger` attribute changes the required signature to - /// include an extra argument `&mut impl HasLogger`, allowing the function to - /// log events. - /// - /// - /// ### Example - /// ```ignore - /// #[receive(contract = "my_contract", name = "some_receive", enable_logger)] - /// fn contract_receive(ctx: &impl HasReceiveContext, logger: &mut impl HasLogger, state: &mut MyState) -> ReceiveResult {...} - /// ``` - /// - /// ## `low_level`: Manually deal with writing state bytes - /// Setting the `low_level` attribute disables the generated code for - /// serializing the contract state. - /// - /// If `low_level` is set, instead of the user-defined state type in the - /// signature, the state argument becomes the type `&mut ContractState` found in - /// `concordium-std`, which gives access to manipulating the contract state - /// bytes directly. - /// - /// ### Example - /// ```ignore - /// #[receive(contract = "my_contract", name = "some_receive", low_level)] - /// fn contract_receive(ctx: &impl HasReceiveContext, state: &mut ContractState) -> ReceiveResult {...} - /// ``` - /// - /// ## `parameter=""`: Generate schema for parameter - /// To make schema generation include the parameter for this function, add - /// the attribute `parameter` and set it equal to a string literal containing - /// the name of the type used for the parameter. The parameter type must - /// implement the SchemaType trait, which for most cases can be derived - /// automatically. - /// - /// ### Example - /// ```ignore - /// #[derive(SchemaType)] - /// struct MyParam { ... } - /// - /// #[receive(contract = "my_contract", name = "some_receive", parameter = "MyParam")] - /// fn contract_receive(ctx: &impl HasReceiveContext, state: &mut MyState) -> ReceiveResult {...} - /// ``` - #[proc_macro_attribute] - pub fn receive(attr: TokenStream, item: TokenStream) -> TokenStream { - unwrap_or_report(receive_worker(attr, item)) - } - - fn receive_worker(attr: TokenStream, item: TokenStream) -> syn::Result { - let attrs = Punctuated::::parse_terminated.parse(attr)?; - - let contract_name = get_attribute_value(attrs.iter(), "contract")?.ok_or_else(|| { - syn::Error::new( - Span::call_site(), - "The name of the associated contract must be provided, using the 'contract' \ - attribute.\n\nFor example, #[receive(contract = \"my-contract\")]", - ) - })?; - - let name = get_attribute_value(attrs.iter(), "name")?.ok_or_else(|| { - syn::Error::new( - Span::call_site(), - "A name for the receive function must be provided, using the 'name' attribute.\n\nFor \ - example, #[receive(name = \"func-name\", ...)]", - ) - })?; - - let ast: syn::ItemFn = - attach_error(syn::parse(item), "#[receive] can only be applied to functions.")?; - - let fn_name = &ast.sig.ident; - let rust_export_fn_name = format_ident!("export_{}", fn_name); - let wasm_export_fn_name = format!("{}.{}", contract_name.value(), name.value()); - - // Validate the contract name independently to ensure that it doesn't contain a - // '.' as this causes a subtle error when receive names are being split. - let contract_name_validation = - ContractName::is_valid_contract_name(&format!("init_{}", contract_name.value())) - .map_err(|e| syn::Error::new(contract_name.span(), e)); - - let receive_name_validation = ReceiveName::is_valid_receive_name(&wasm_export_fn_name) - .map_err(|e| syn::Error::new(name.span(), e)); - - match (contract_name_validation, receive_name_validation) { - (Err(mut e0), Err(e1)) => { - e0.combine(e1); - return Err(e0); - } - (Err(e), _) => return Err(e), - (_, Err(e)) => return Err(e), - _ => (), - }; - - let amount_ident = format_ident!("amount"); - - // Accumulate a list of required arguments, if the function contains a - // different number of arguments, than elements in this vector, then the - // strings are displayed as the expected arguments. - let mut required_args = vec!["ctx: &impl HasReceiveContext"]; - - let (setup_fn_optional_args, fn_optional_args) = - contract_function_optional_args_tokens(&attrs, &amount_ident, &mut required_args); - - let mut out = if contains_attribute(&attrs, "low_level") { - required_args.push("state: &mut ContractState"); - quote! { - #[export_name = #wasm_export_fn_name] - pub extern "C" fn #rust_export_fn_name(#amount_ident: hacspec_concordium::Amount) -> i32 { - use hacspec_concordium::{SeekFrom, ContractState, Logger, ReceiveContextExtern, ExternContext}; - #setup_fn_optional_args - let ctx = ExternContext::::open(()); - let mut state = ContractState::open(()); - let res: Result = #fn_name(&ctx, #(#fn_optional_args, )* &mut state); - match res { - Ok(act) => { - act.tag() as i32 - } - Err(reject) => { - let code = Reject::from(reject).error_code.get(); - if code < 0 { - code - } else { - trap() // precondition violation - } - } - } - } - } - } else { - required_args.push("state: &mut MyState"); - - quote! { - #[export_name = #wasm_export_fn_name] - pub extern "C" fn #rust_export_fn_name(#amount_ident: hacspec_concordium::Amount) -> i32 { - use hacspec_concordium::{SeekFrom, ContractState, Logger, trap}; - #setup_fn_optional_args - let ctx = ExternContext::::open(()); - let mut state_bytes = ContractState::open(()); - if let Ok(mut state) = (&mut state_bytes).get() { - let res: Result = #fn_name(&ctx, #(#fn_optional_args, )* &mut state); - match res { - Ok(act) => { - let res = state_bytes - .seek(SeekFrom::Start(0)) - .and_then(|_| state.serial(&mut state_bytes)); - if res.is_err() { - trap() // could not serialize state. - } else { - act.tag() as i32 - } - } - Err(reject) => { - let code = Reject::from(reject).error_code.get(); - if code < 0 { - code - } else { - trap() // precondition violation - } - } - } - } else { - trap() // Could not fully read state. - } - } - } - }; - - let arg_count = ast.sig.inputs.len(); - if arg_count != required_args.len() { - return Err(syn::Error::new( - ast.sig.inputs.span(), - format!( - "Incorrect number of function arguments, the expected arguments are ({}) ", - required_args.join(", ") - ), - )); - } - - // Embed schema if 'parameter' attribute is set - let parameter_option = get_attribute_value(attrs.iter(), "parameter")?.map(|a| a.value()); - out.extend(contract_function_schema_tokens( - parameter_option, - rust_export_fn_name, - wasm_export_fn_name, - )); - // add the original function to the output as well. - ast.to_tokens(&mut out); - Ok(out.into()) - } - - /// Generate tokens for some of the optional arguments, based on the attributes. - /// Returns a pair, where the first entry is tokens for setting up the arguments - /// and the second entry is a Vec of the argument names as tokens. - /// - /// It also mutates a vector of required arguments with the expected type - /// signature of each. - fn contract_function_optional_args_tokens<'a, I: Copy + IntoIterator>( - attrs: I, - amount_ident: &syn::Ident, - required_args: &mut Vec<&str>, - ) -> (proc_macro2::TokenStream, Vec) { - let mut setup_fn_args = proc_macro2::TokenStream::new(); - let mut fn_args = vec![]; - if contains_attribute(attrs, "payable") { - required_args.push("amount: Amount"); - fn_args.push(quote!(#amount_ident)); - } else { - setup_fn_args.extend(quote! { - if #amount_ident.micro_ccd != 0 { - return -1; - } - }); - }; - - if contains_attribute(attrs, "enable_logger") { - required_args.push("logger: &mut impl HasLogger"); - let logger_ident = format_ident!("logger"); - setup_fn_args.extend(quote!(let mut #logger_ident = hacspec_concordium::Logger::init();)); - fn_args.push(quote!(&mut #logger_ident)); - } - (setup_fn_args, fn_args) - } - - #[cfg(feature = "build-schema")] - fn contract_function_schema_tokens( - parameter_option: Option, - rust_name: syn::Ident, - wasm_name: String, - ) -> proc_macro2::TokenStream { - match parameter_option { - Some(parameter_ty) => { - let parameter_ident = syn::Ident::new(¶meter_ty, Span::call_site()); - let schema_name = format!("concordium_schema_function_{}", wasm_name); - let schema_ident = format_ident!("concordium_schema_function_{}", rust_name); - quote! { - #[export_name = #schema_name] - pub extern "C" fn #schema_ident() -> *mut u8 { - let schema = <#parameter_ident as schema::SchemaType>::get_type(); - let schema_bytes = hacspec_concordium::to_bytes(&schema); - hacspec_concordium::put_in_memory(&schema_bytes) - } - } - } - None => proc_macro2::TokenStream::new(), - } - } - - #[cfg(not(feature = "build-schema"))] - fn contract_function_schema_tokens( - _parameter_option: Option, - _rust_name: syn::Ident, - _wasm_name: String, - ) -> proc_macro2::TokenStream { - proc_macro2::TokenStream::new() - } - - /// Derive the Deserial trait. See the documentation of `derive(Serial)` for - /// details and limitations. - /// - /// In addition to the attributes supported by `derive(Serial)`, this derivation - /// macro supports the `ensure_ordered` attribute. If applied to a field the - /// of type `BTreeMap` or `BTreeSet` deserialization will additionally ensure - /// that the keys are in strictly increasing order. By default deserialization - /// only ensures uniqueness. - /// - /// # Example - /// ``` ignore - /// #[derive(Deserial)] - /// struct Foo { - /// #[concordium(size_length = 1, ensure_ordered)] - /// bar: BTreeSet, - /// } - /// ``` - #[proc_macro_derive(Deserial, attributes(concordium))] - pub fn deserial_derive(input: TokenStream) -> TokenStream { - let ast = parse_macro_input!(input); - unwrap_or_report(impl_deserial(&ast)) - } - - /// The prefix used in field attributes: `#[concordium(attr = "something")]` - const CONCORDIUM_FIELD_ATTRIBUTE: &str = "concordium"; - - /// A list of valid concordium field attributes - const VALID_CONCORDIUM_FIELD_ATTRIBUTES: [&str; 3] = ["size_length", "ensure_ordered", "rename"]; - - fn get_concordium_field_attributes(attributes: &[syn::Attribute]) -> syn::Result> { - attributes - .iter() - // Keep only concordium attributes - .flat_map(|attr| match attr.parse_meta() { - Ok(syn::Meta::List(list)) if list.path.is_ident(CONCORDIUM_FIELD_ATTRIBUTE) => { - list.nested - } - _ => syn::punctuated::Punctuated::new(), - }) - // Ensure only valid attributes and unwrap NestedMeta - .map(|nested| match nested { - syn::NestedMeta::Meta(meta) => { - let path = meta.path(); - if VALID_CONCORDIUM_FIELD_ATTRIBUTES.iter().any(|&attr| path.is_ident(attr)) { - Ok(meta) - } else { - Err(syn::Error::new(meta.span(), - format!("The attribute '{}' is not supported as a concordium field attribute.", - path.to_token_stream()) - )) - } - } - lit => Err(syn::Error::new(lit.span(), "Literals are not supported in a concordium field attribute.")), - }) - .collect() - } - - fn find_field_attribute_value( - attributes: &[syn::Attribute], - target_attr: &str, - ) -> syn::Result> { - let target_attr = format_ident!("{}", target_attr); - let attr_values: Vec<_> = get_concordium_field_attributes(attributes)? - .into_iter() - .filter_map(|nested_meta| match nested_meta { - syn::Meta::NameValue(value) if value.path.is_ident(&target_attr) => Some(value.lit), - _ => None, - }) - .collect(); - if attr_values.is_empty() { - return Ok(None); - } - if attr_values.len() > 1 { - let mut init_error = syn::Error::new( - attr_values[1].span(), - format!("Attribute '{}' should only be specified once.", target_attr), - ); - for other in attr_values.iter().skip(2) { - init_error.combine(syn::Error::new( - other.span(), - format!("Attribute '{}' should only be specified once.", target_attr), - )) - } - Err(init_error) - } else { - Ok(Some(attr_values[0].clone())) - } - } - - fn find_length_attribute(attributes: &[syn::Attribute]) -> syn::Result> { - let value = match find_field_attribute_value(attributes, "size_length")? { - Some(v) => v, - None => return Ok(None), - }; - - // Save the span to be used in errors. - let value_span = value.span(); - - let value = match value { - syn::Lit::Int(int) => int, - _ => return Err(syn::Error::new(value_span, "Length attribute value must be an integer.")), - }; - let value = match value.base10_parse() { - Ok(v) => v, - _ => { - return Err(syn::Error::new( - value_span, - "Length attribute value must be a base 10 integer.", - )) - } - }; - match value { - 1 | 2 | 4 | 8 => Ok(Some(value)), - _ => Err(syn::Error::new(value_span, "Length info must be either 1, 2, 4, or 8.")), - } - } - - /// Find a 'rename' attribute and return its value and span. - /// Checks that the attribute is only defined once and that the value is a - /// string. - #[cfg(feature = "build-schema")] - fn find_rename_attribute(attributes: &[syn::Attribute]) -> syn::Result> { - let value = match find_field_attribute_value(attributes, "rename")? { - Some(v) => v, - None => return Ok(None), - }; - - match value { - syn::Lit::Str(value) => Ok(Some((value.value(), value.span()))), - _ => Err(syn::Error::new(value.span(), "Rename attribute value must be a string.")), - } - } - - /// Check for name collisions by inserting the name in the HashMap. - /// On collisions it returns a combined error pointing to the previous and new - /// definition. - #[cfg(feature = "build-schema")] - fn check_for_name_collisions( - used_names: &mut HashMap, - new_name: &str, - new_span: Span, - ) -> syn::Result<()> { - if let Some(used_span) = used_names.insert(String::from(new_name), new_span) { - let error_msg = format!("the name `{}` is defined multiple times", new_name); - let mut error_at_first_def = syn::Error::new(used_span, &error_msg); - let error_at_second_def = syn::Error::new(new_span, &error_msg); - - // Combine the errors to show both at once - error_at_first_def.combine(error_at_second_def); - - return Err(error_at_first_def); - } - Ok(()) - } - - fn impl_deserial_field( - f: &syn::Field, - ident: &syn::Ident, - source: &syn::Ident, - ) -> syn::Result { - let concordium_attributes = get_concordium_field_attributes(&f.attrs)?; - let ensure_ordered = contains_attribute(&concordium_attributes, "ensure_ordered"); - let size_length = find_length_attribute(&f.attrs)?; - let has_ctx = ensure_ordered || size_length.is_some(); - let ty = &f.ty; - if has_ctx { - // Default size length is u32, i.e. 4 bytes. - let l = format_ident!("U{}", 8 * size_length.unwrap_or(4)); - Ok(quote! { - let #ident = <#ty as hacspec_concordium::DeserialCtx>::deserial_ctx(hacspec_concordium::schema::SizeLength::#l, #ensure_ordered, #source)?; - }) - } else { - Ok(quote! { - let #ident = <#ty as Deserial>::deserial(#source)?; - }) - } - } - - fn impl_deserial(ast: &syn::DeriveInput) -> syn::Result { - let data_name = &ast.ident; - - let span = ast.span(); - - let read_ident = format_ident!("__R", span = span); - - let (impl_generics, ty_generics, where_clauses) = ast.generics.split_for_impl(); - - let source_ident = Ident::new("source", Span::call_site()); - - let body_tokens = match ast.data { - syn::Data::Struct(ref data) => { - let mut names = proc_macro2::TokenStream::new(); - let mut field_tokens = proc_macro2::TokenStream::new(); - let return_tokens = match data.fields { - syn::Fields::Named(_) => { - for field in data.fields.iter() { - let field_ident = field.ident.clone().unwrap(); // safe since named fields. - field_tokens.extend(impl_deserial_field( - field, - &field_ident, - &source_ident, - )); - names.extend(quote!(#field_ident,)) - } - quote!(Ok(#data_name{#names})) - } - syn::Fields::Unnamed(_) => { - for (i, f) in data.fields.iter().enumerate() { - let field_ident = format_ident!("x_{}", i); - field_tokens.extend(impl_deserial_field(f, &field_ident, &source_ident)); - names.extend(quote!(#field_ident,)) - } - quote!(Ok(#data_name(#names))) - } - _ => quote!(Ok(#data_name{})), - }; - quote! { - #field_tokens - #return_tokens - } - } - syn::Data::Enum(ref data) => { - let mut matches_tokens = proc_macro2::TokenStream::new(); - let source = Ident::new("source", Span::call_site()); - let size = if data.variants.len() <= 256 { - format_ident!("u8") - } else if data.variants.len() <= 256 * 256 { - format_ident!("u16") - } else { - return Err(syn::Error::new( - ast.span(), - "[derive(Deserial)]: Too many variants. Maximum 65536 are supported.", - )); - }; - for (i, variant) in data.variants.iter().enumerate() { - let (field_names, pattern) = match variant.fields { - syn::Fields::Named(_) => { - let field_names: Vec<_> = variant - .fields - .iter() - .map(|field| field.ident.clone().unwrap()) - .collect(); - (field_names.clone(), quote! { {#(#field_names),*} }) - } - syn::Fields::Unnamed(_) => { - let field_names: Vec<_> = variant - .fields - .iter() - .enumerate() - .map(|(i, _)| format_ident!("x_{}", i)) - .collect(); - (field_names.clone(), quote! { ( #(#field_names),* ) }) - } - syn::Fields::Unit => (Vec::new(), proc_macro2::TokenStream::new()), - }; - - let field_tokens: proc_macro2::TokenStream = field_names - .iter() - .zip(variant.fields.iter()) - .map(|(name, field)| impl_deserial_field(field, name, &source)) - .collect::>()?; - let idx_lit = syn::LitInt::new(i.to_string().as_str(), Span::call_site()); - let variant_ident = &variant.ident; - matches_tokens.extend(quote! { - #idx_lit => { - #field_tokens - Ok(#data_name::#variant_ident#pattern) - }, - }) - } - quote! { - let idx = #size::deserial(#source)?; - match idx { - #matches_tokens - _ => Err(Default::default()) - } - } - } - _ => unimplemented!("#[derive(Deserial)] is not implemented for union."), - }; - let gen = quote! { - #[automatically_derived] - impl #impl_generics Deserial for #data_name #ty_generics #where_clauses { - fn deserial<#read_ident: Read>(#source_ident: &mut #read_ident) -> ParseResult { - #body_tokens - } - } - }; - Ok(gen.into()) - } - - /// Derive the Serial trait for the type. - /// - /// If the type is a struct all fields must implement the Serial trait. If the - /// type is an enum then all fields of each of the enums must implement the - /// Serial trait. - /// - /// - /// Collections (Vec, BTreeMap, BTreeSet) and strings (String, str) are by - /// default serialized by prepending the number of elements as 4 bytes - /// little-endian. If this is too much or too little, fields of the above types - /// can be annotated with `size_length`. - /// - /// The value of this field is the number of bytes that will be used for - /// encoding the number of elements. Supported values are 1, 2, 4, 8. - /// - /// For BTreeMap and BTreeSet the serialize method will serialize values in - /// increasing order of keys. - /// - /// Fields of structs are serialized in the order they appear in the code. - /// - /// Enums can have no more than 65536 variants. They are serialized by using a - /// tag to indicate the variant, enumerating them in the order they are written - /// in source code. If the number of variants is less than or equal 256 then a - /// single byte is used to encode it. Otherwise two bytes are used for the tag, - /// encoded in little endian. - /// - /// # Example - /// ```ignore - /// #[derive(Serial)] - /// struct Foo { - /// #[concordium(size_length = 1)] - /// bar: BTreeSet, - /// } - /// ``` - #[proc_macro_derive(Serial, attributes(concordium))] - pub fn serial_derive(input: TokenStream) -> TokenStream { - let ast = parse_macro_input!(input); - unwrap_or_report(impl_serial(&ast)) - } - - fn impl_serial_field( - field: &syn::Field, - ident: &proc_macro2::TokenStream, - out: &syn::Ident, - ) -> syn::Result { - if let Some(size_length) = find_length_attribute(&field.attrs)? { - let l = format_ident!("U{}", 8 * size_length); - Ok(quote!({ - use hacspec_concordium::SerialCtx; - #ident.serial_ctx(hacspec_concordium::schema::SizeLength::#l, #out)?; - })) - } else { - Ok(quote! { - #ident.serial(#out)?; - }) - } - } - - fn impl_serial(ast: &syn::DeriveInput) -> syn::Result { - let data_name = &ast.ident; - - let span = ast.span(); - - let write_ident = format_ident!("W", span = span); - - let (impl_generics, ty_generics, where_clauses) = ast.generics.split_for_impl(); - - let out_ident = format_ident!("out"); - - let body = match ast.data { - syn::Data::Struct(ref data) => { - let fields_tokens = match data.fields { - syn::Fields::Named(_) => { - data.fields - .iter() - .map(|field| { - let field_ident = field.ident.clone().unwrap(); // safe since named fields. - let field_ident = quote!(self.#field_ident); - impl_serial_field(field, &field_ident, &out_ident) - }) - .collect::>()? - } - syn::Fields::Unnamed(_) => data - .fields - .iter() - .enumerate() - .map(|(i, field)| { - let i = syn::LitInt::new(i.to_string().as_str(), Span::call_site()); - let field_ident = quote!(self.#i); - impl_serial_field(field, &field_ident, &out_ident) - }) - .collect::>()?, - syn::Fields::Unit => proc_macro2::TokenStream::new(), - }; - quote! { - #fields_tokens - Ok(()) - } - } - syn::Data::Enum(ref data) => { - let mut matches_tokens = proc_macro2::TokenStream::new(); - - let size = if data.variants.len() <= 256 { - format_ident!("u8") - } else if data.variants.len() <= 256 * 256 { - format_ident!("u16") - } else { - unimplemented!( - "[derive(Serial)]: Enums with more than 65536 variants are not supported." - ); - }; - - for (i, variant) in data.variants.iter().enumerate() { - let (field_names, pattern) = match variant.fields { - syn::Fields::Named(_) => { - let field_names: Vec<_> = variant - .fields - .iter() - .map(|field| field.ident.clone().unwrap()) - .collect(); - (field_names.clone(), quote! { {#(#field_names),*} }) - } - syn::Fields::Unnamed(_) => { - let field_names: Vec<_> = variant - .fields - .iter() - .enumerate() - .map(|(i, _)| format_ident!("x_{}", i)) - .collect(); - (field_names.clone(), quote! { (#(#field_names),*) }) - } - syn::Fields::Unit => (Vec::new(), proc_macro2::TokenStream::new()), - }; - let field_tokens: proc_macro2::TokenStream = field_names - .iter() - .zip(variant.fields.iter()) - .map(|(name, field)| impl_serial_field(field, "e!(#name), &out_ident)) - .collect::>()?; - - let idx_lit = - syn::LitInt::new(format!("{}{}", i, size).as_str(), Span::call_site()); - let variant_ident = &variant.ident; - - matches_tokens.extend(quote! { - #data_name::#variant_ident#pattern => { - #idx_lit.serial(#out_ident)?; - #field_tokens - }, - }) - } - quote! { - match self { - #matches_tokens - } - Ok(()) - } - } - _ => unimplemented!("#[derive(Serial)] is not implemented for union."), - }; - - let gen = quote! { - #[automatically_derived] - impl #impl_generics Serial for #data_name #ty_generics #where_clauses { - fn serial<#write_ident: Write>(&self, #out_ident: &mut #write_ident) -> Result<(), #write_ident::Err> { - #body - } - } - }; - Ok(gen.into()) - } - - /// A helper macro to derive both the Serial and Deserial traits. - /// `[derive(Serialize)]` is equivalent to `[derive(Serial,Deserial)]`, see - /// documentation of the latter two for details and options. - #[proc_macro_derive(Serialize, attributes(concordium))] - pub fn serialize_derive(input: TokenStream) -> TokenStream { - unwrap_or_report(serialize_derive_worker(input)) - } - - fn serialize_derive_worker(input: TokenStream) -> syn::Result { - let ast = syn::parse(input)?; - let mut tokens = impl_deserial(&ast)?; - tokens.extend(impl_serial(&ast)?); - Ok(tokens) - } - - /// Marks a type as the contract state. Currently only used for generating the - /// schema of the contract state. If the feature `build-schema` is not enabled - /// this has no effect. - /// - /// - /// # Example - /// ```ignore - /// #[contract_state(contract = "my_contract")] - /// #[derive(SchemaType)] - /// struct MyContractState { - /// ... - /// } - /// ``` - #[proc_macro_attribute] - pub fn contract_state(attr: TokenStream, item: TokenStream) -> TokenStream { - unwrap_or_report(contract_state_worker(attr, item)) - } - - #[cfg(feature = "build-schema")] - fn contract_state_worker(attr: TokenStream, item: TokenStream) -> syn::Result { - let mut out = proc_macro2::TokenStream::new(); - - let data_ident = if let Ok(ast) = syn::parse::(item.clone()) { - ast.to_tokens(&mut out); - ast.ident - } else if let Ok(ast) = syn::parse::(item.clone()) { - ast.to_tokens(&mut out); - ast.ident - } else if let Ok(ast) = syn::parse::(item.clone()) { - ast.to_tokens(&mut out); - ast.ident - } else { - return Err(syn::Error::new_spanned( - proc_macro2::TokenStream::from(item), - "#[contract_state] only supports structs, enums and type aliases.", - )); - }; - - let attrs = Punctuated::::parse_terminated.parse(attr)?; - - let contract_name = get_attribute_value(attrs.iter(), "contract")?.ok_or_else(|| { - syn::Error::new( - Span::call_site(), - "A name of the contract must be provided, using the 'contract' attribute.\n\nFor \ - example #[contract_state(contract = \"my-contract\")].", - ) - })?; - - let wasm_schema_name = format!("concordium_schema_state_{}", contract_name.value()); - let rust_schema_name = format_ident!("concordium_schema_state_{}", data_ident); - - let generate_schema_tokens = quote! { - #[allow(non_snake_case)] - #[export_name = #wasm_schema_name] - pub extern "C" fn #rust_schema_name() -> *mut u8 { - let schema = <#data_ident as hacspec_concordium::schema::SchemaType>::get_type(); - let schema_bytes = hacspec_concordium::to_bytes(&schema); - hacspec_concordium::put_in_memory(&schema_bytes) - } - }; - generate_schema_tokens.to_tokens(&mut out); - Ok(out.into()) - } - - #[cfg(not(feature = "build-schema"))] - fn contract_state_worker(_attr: TokenStream, item: TokenStream) -> syn::Result { - Ok(item) - } - - /// Derive the `SchemaType` trait for a type. - /// If the feature `build-schema` is not enabled this is a no-op, i.e., it does - /// not produce any code. - #[proc_macro_derive(SchemaType, attributes(size_length))] - pub fn schema_type_derive(input: TokenStream) -> TokenStream { - unwrap_or_report(schema_type_derive_worker(input)) - } - - #[cfg(feature = "build-schema")] - fn schema_type_derive_worker(input: TokenStream) -> syn::Result { - let ast: syn::DeriveInput = syn::parse(input)?; - - let data_name = &ast.ident; - - let body = match ast.data { - syn::Data::Struct(ref data) => { - let fields_tokens = schema_type_fields(&data.fields)?; - quote! { - hacspec_concordium::schema::Type::Struct(#fields_tokens) - } - } - syn::Data::Enum(ref data) => { - let mut used_variant_names = HashMap::new(); - let variant_tokens: Vec<_> = data - .variants - .iter() - .map(|variant| { - // Handle the 'rename' attribute. - let (variant_name, variant_span) = match find_rename_attribute(&variant.attrs)? - { - Some(name_and_span) => name_and_span, - None => (variant.ident.to_string(), variant.ident.span()), - }; - check_for_name_collisions( - &mut used_variant_names, - &variant_name, - variant_span, - )?; - - let fields_tokens = schema_type_fields(&variant.fields)?; - Ok(quote! { - (hacspec_concordium::String::from(#variant_name), #fields_tokens) - }) - }) - .collect::>()?; - quote! { - hacspec_concordium::schema::Type::Enum(hacspec_concordium::Vec::from([ #(#variant_tokens),* ])) - } - } - _ => syn::Error::new(ast.span(), "Union is not supported").to_compile_error(), - }; - - let out = quote! { - #[automatically_derived] - impl hacspec_concordium::schema::SchemaType for #data_name { - fn get_type() -> hacspec_concordium::schema::Type { - #body - } - } - }; - Ok(out.into()) - } - - #[cfg(not(feature = "build-schema"))] - fn schema_type_derive_worker(_input: TokenStream) -> syn::Result { - Ok(TokenStream::new()) - } - - #[cfg(feature = "build-schema")] - fn schema_type_field_type(field: &syn::Field) -> syn::Result { - let field_type = &field.ty; - if let Some(l) = find_length_attribute(&field.attrs)? { - let size = format_ident!("U{}", 8 * l); - Ok(quote! { - <#field_type as hacspec_concordium::schema::SchemaType>::get_type().set_size_length(hacspec_concordium::schema::SizeLength::#size) - }) - } else { - Ok(quote! { - <#field_type as hacspec_concordium::schema::SchemaType>::get_type() - }) - } - } - - #[cfg(feature = "build-schema")] - fn schema_type_fields(fields: &syn::Fields) -> syn::Result { - match fields { - syn::Fields::Named(_) => { - let mut used_field_names = HashMap::new(); - let fields_tokens: Vec<_> = fields - .iter() - .map(|field| { - // Handle the 'rename' attribute. - let (field_name, field_span) = match find_rename_attribute(&field.attrs)? { - Some(name_and_span) => name_and_span, - None => (field.ident.clone().unwrap().to_string(), field.ident.span()), // safe since named fields. - }; - check_for_name_collisions(&mut used_field_names, &field_name, field_span)?; - - let field_schema_type = schema_type_field_type(&field)?; - Ok(quote! { - (hacspec_concordium::String::from(#field_name), #field_schema_type) - }) - }) - .collect::>()?; - Ok( - quote! { hacspec_concordium::schema::Fields::Named(hacspec_concordium::Vec::from([ #(#fields_tokens),* ])) }, - ) - } - syn::Fields::Unnamed(_) => { - let fields_tokens: Vec<_> = - fields.iter().map(schema_type_field_type).collect::>()?; - Ok(quote! { hacspec_concordium::schema::Fields::Unnamed([ #(#fields_tokens),* ].to_vec()) }) - } - syn::Fields::Unit => Ok(quote! { hacspec_concordium::schema::Fields::None }), - } - } - - /// We reserve a number of error codes for custom errors, such as ParseError, - /// that are provided by concordium-std. These reserved error codes can have - /// indices i32::MIN, i32::MIN + 1, ..., RESERVED_ERROR_CODES - const RESERVED_ERROR_CODES: i32 = i32::MIN + 100; - - /// Derive the conversion of enums that represent error types into the Reject - /// struct which can be used as the error type of init and receive functions. - /// Creating custom enums for error types can provide meaningful error messages - /// to the user of the smart contract. - /// - /// Note that at the moment, we can only derive fieldless enums. - /// - /// The conversion will map the first variant to error code -1, second to -2, - /// etc. - /// - /// ### Example - /// ```ignore - /// #[derive(Clone, Copy, Reject)] - /// enum MyError { - /// IllegalState, // receives error code -1 - /// WrongSender, // receives error code -2 - /// // TimeExpired(time: Timestamp), /* currently not supported */ - /// ... - /// } - /// ``` - /// ```ignore - /// #[receive(contract = "my_contract", name = "some_receive")] - /// fn receive(ctx: &impl HasReceiveContext, state: &mut MyState) - /// -> Result {...} - /// ``` - #[proc_macro_derive(Reject, attributes(from))] - pub fn reject_derive(input: TokenStream) -> TokenStream { - unwrap_or_report(reject_derive_worker(input)) - } - - fn reject_derive_worker(input: TokenStream) -> syn::Result { - let ast: syn::DeriveInput = syn::parse(input)?; - let enum_data = match &ast.data { - syn::Data::Enum(data) => Ok(data), - _ => Err(syn::Error::new(ast.span(), "Reject can only be derived for enums.")), - }?; - let enum_ident = &ast.ident; - - // Ensure that the number of enum variants fits into the number of error codes - // we can generate. - let too_many_variants = format!( - "Error enum {} cannot have more than {} variants.", - enum_ident, - RESERVED_ERROR_CODES.neg() - ); - match i32::try_from(enum_data.variants.len()) { - Ok(n) if n <= RESERVED_ERROR_CODES.neg() => (), - _ => { - return Err(syn::Error::new(ast.span(), &too_many_variants)); - } - }; - - let variant_error_conversions = generate_variant_error_conversions(&enum_data, &enum_ident)?; - - let gen = quote! { - /// The from implementation maps the first variant to -1, second to -2, etc. - /// NB: This differs from the cast `variant as i32` since we cannot easily modify - /// the variant tags in the derive macro itself. - #[automatically_derived] - impl From<#enum_ident> for Reject { - #[inline(always)] - fn from(e: #enum_ident) -> Self { - Reject { error_code: unsafe { hacspec_concordium::num::NonZeroI32::new_unchecked(-(e as i32) - 1) } } - } - } - - #(#variant_error_conversions)* - }; - Ok(gen.into()) - } - - /// Generate error conversions for enum variants e.g. for converting - /// `ParseError` to `MyParseErrorWrapper` in - /// - /// ```ignore - /// enum MyErrorType { - /// #[from(ParseError)] - /// MyParseErrorWrapper, - /// ... - /// } - /// ``` - fn generate_variant_error_conversions( - enum_data: &DataEnum, - enum_name: &syn::Ident, - ) -> syn::Result> { - Ok(enum_data - .variants - .iter() - .map(|variant| { - // in the future we might incorporate explicit discriminants, - // but the general case of this requires evaluating constant expressions, - // which is not easily supported at the moment. - if let Some((_, discriminant)) = variant.discriminant.as_ref() { - return Err(syn::Error::new( - discriminant.span(), - "Explicit discriminants are not yet supported.", - )); - } - let variant_attributes = variant.attrs.iter(); - variant_attributes - .map(move |attr| { - parse_attr_and_gen_error_conversions(attr, enum_name, &variant.ident) - }) - .collect::>>() - }) - .collect::>>()? - .into_iter() - .flatten() - .flatten() - .collect()) - } - - /// Generate error conversion for a given enum variant. - fn parse_attr_and_gen_error_conversions( - attr: &syn::Attribute, - enum_name: &syn::Ident, - variant_name: &syn::Ident, - ) -> syn::Result> { - let wrong_from_usage = |x: &dyn Spanned| { - syn::Error::new( - x.span(), - "The `from` attribute expects a list of error types, e.g.: #[from(ParseError)].", - ) - }; - match attr.parse_meta() { - Ok(syn::Meta::List(list)) if list.path.is_ident("from") => { - let mut from_error_names = vec![]; - for nested in list.nested.iter() { - // check that all items in the list are paths - match nested { - syn::NestedMeta::Meta(meta) => match meta { - Meta::Path(from_error) => { - let ident = from_error - .get_ident() - .ok_or_else(|| wrong_from_usage(from_error))?; - from_error_names.push(ident); - } - other => return Err(wrong_from_usage(&other)), - }, - syn::NestedMeta::Lit(l) => return Err(wrong_from_usage(&l)), - } - } - Ok(from_error_token_stream(&from_error_names, &enum_name, variant_name).collect()) - } - Ok(syn::Meta::NameValue(mnv)) if mnv.path.is_ident("from") => Err(wrong_from_usage(&mnv)), - _ => Ok(vec![]), - } - } - - /// Generating the conversion code a la - /// ```ignore - /// impl From for MyErrorType { - /// fn from(x: ParseError) -> Self { - /// MyError::MyParseErrorWrapper - /// } - /// } - /// ``` - fn from_error_token_stream<'a>( - paths: &'a [&'a syn::Ident], - enum_name: &'a syn::Ident, - variant_name: &'a syn::Ident, - ) -> impl Iterator + 'a { - paths.iter().map(move |from_error| { - quote! { - impl From<#from_error> for #enum_name { - #[inline] - fn from(fe: #from_error) -> Self { - #enum_name::#variant_name - } - }} - }) - } - - #[proc_macro_attribute] - /// Derive the appropriate export for an annotated test function, when feature - /// "wasm-test" is enabled, otherwise behaves like `#[test]`. - pub fn concordium_test(attr: TokenStream, item: TokenStream) -> TokenStream { - unwrap_or_report(concordium_test_worker(attr, item)) - } - - /// Derive the appropriate export for an annotated test function, when feature - /// "wasm-test" is enabled, otherwise behaves like `#[test]`. - #[cfg(feature = "wasm-test")] - fn concordium_test_worker(_attr: TokenStream, item: TokenStream) -> syn::Result { - let test_fn_ast: syn::ItemFn = - attach_error(syn::parse(item), "#[concordium_test] can only be applied to functions.")?; - - let test_fn_name = &test_fn_ast.sig.ident; - let rust_export_fn_name = format_ident!("concordium_test_{}", test_fn_name); - let wasm_export_fn_name = format!("concordium_test {}", test_fn_name); - - let test_fn = quote! { - // Setup test function - #test_fn_ast - - // Export test function in wasm - #[export_name = #wasm_export_fn_name] - pub extern "C" fn #rust_export_fn_name() { - #test_fn_name() - } - }; - Ok(test_fn.into()) - } - - /// Derive the appropriate export for an annotated test function, when feature - /// "wasm-test" is enabled, otherwise behaves like `#[test]`. - #[cfg(not(feature = "wasm-test"))] - fn concordium_test_worker(_attr: TokenStream, item: TokenStream) -> syn::Result { - let test_fn_ast: syn::ItemFn = - attach_error(syn::parse(item), "#[concordium_test] can only be applied to functions.")?; - - let test_fn = quote! { - #[test] - #test_fn_ast - }; - Ok(test_fn.into()) - } - - /// Sets the cfg for testing targeting either Wasm and native. - #[cfg(feature = "wasm-test")] - #[proc_macro_attribute] - pub fn concordium_cfg_test(_attr: TokenStream, item: TokenStream) -> TokenStream { item } - - /// Sets the cfg for testing targeting either Wasm and native. - #[cfg(not(feature = "wasm-test"))] - #[proc_macro_attribute] - pub fn concordium_cfg_test(_attr: TokenStream, item: TokenStream) -> TokenStream { - let item = proc_macro2::TokenStream::from(item); - let out = quote! { - #[cfg(test)] - #item - }; - out.into() - } +// #![no_std] +extern crate proc_macro; +extern crate syn; +#[macro_use] +extern crate quote; + +use concordium_contracts_common::*; +use proc_macro::TokenStream; +use proc_macro2::Span; +use quote::ToTokens; +#[cfg(feature = "build-schema")] +use std::collections::HashMap; +use std::{convert::TryFrom, ops::Neg}; +use syn::{ + parse::Parser, parse_macro_input, punctuated::*, spanned::Spanned, DataEnum, Ident, Meta, Token, +}; + +// use hacspec_concordium::*; + +/// A helper to report meaningful compilation errors +/// - If applied to an Ok value they simply return the underlying value. +/// - If applied to `Err(e)` then `e` is turned into a compiler error. +fn unwrap_or_report(v: syn::Result) -> TokenStream { + match v { + Ok(ts) => ts, + Err(e) => e.to_compile_error().into(), + } +} + +fn attach_error(mut v: syn::Result, msg: &str) -> syn::Result { + if let Err(e) = v.as_mut() { + let span = e.span(); + e.combine(syn::Error::new(span, msg)); + } + v +} + +/// Get the name item from a list, if available and a string literal. +/// If the named item does not have the expected (string) value, this will +/// return an Err. If the item does not exist the return value is Ok(None). +/// FIXME: Ensure there is only one. +fn get_attribute_value<'a, I: IntoIterator>( + iter: I, + name: &str, +) -> syn::Result> { + for attr in iter.into_iter() { + match attr { + Meta::NameValue(mnv) => { + if mnv.path.is_ident(name) { + if let syn::Lit::Str(lit) = &mnv.lit { + return Ok(Some(lit)); + } else { + return Err(syn::Error::new( + mnv.span(), + format!("The `{}` attribute must be a string literal.", name), + )); + } + } + } + Meta::Path(p) => { + if p.is_ident(name) { + return Err(syn::Error::new( + attr.span(), + format!("The `{}` attribute must have a string literal value.", name), + )); + } + } + Meta::List(p) => { + if p.path.is_ident(name) { + return Err(syn::Error::new( + attr.span(), + format!("The `{}` attribute must have a string literal value.", name), + )); + } + } + } + } + Ok(None) +} + +// Return whether a attribute item is present. +fn contains_attribute<'a, I: IntoIterator>(iter: I, name: &str) -> bool { + iter.into_iter().any(|attr| attr.path().is_ident(name)) +} + +/// Derive the appropriate export for an annotated init function. +/// +/// This macro requires the following items to be present +/// - `contract=""` where *\* is the name of the smart contract and +/// the generated function is exported as this name prefixed with *init_*. The +/// name should be unique in the module, as a contract can only have one +/// init-function. +/// +/// The annotated function must be of a specific type, which depends on the +/// enabled attributes. *Without* any of the optional attributes the function +/// must have a signature of +/// +/// ```ignore +/// #[init(contract = "my_contract")] +/// fn some_init(ctx: &impl HasInitContext) -> InitResult {...} +/// ``` +/// +/// Where the trait `HasInitContext` and the type `InitResult` are exposed from +/// `concordium-std` and `MyState` is the user-defined type for the contract +/// state. +/// +/// # Optional attributes +/// +/// ## `payable`: Make function accept an amount of GTU +/// Without setting the `payable` attribute, the generated function will reject +/// any non-zero amount of GTU supplied with the transaction. This means we are +/// required to explicitly mark our functions as `payable`, if they are to +/// accept GTU. +/// +/// Setting the `payable` attribute changes the required signature to include an +/// extra argument of type `Amount`, allowing the function to access the amount +/// of GTU supplied with the transaction. +/// +/// ### Example +/// ```ignore +/// #[init(contract = "my_contract", payable)] +/// fn some_init(ctx: &impl HasInitContext, amount: Amount) -> InitResult {...} +/// ``` +/// +/// ## `enable_logger`: Function can access event logging +/// Setting the `enable_logger` attribute changes the required signature to +/// include an extra argument `&mut impl HasLogger`, allowing the function to +/// log events. +/// +/// +/// ### Example +/// ```ignore +/// #[init(contract = "my_contract", enable_logger)] +/// fn some_init(ctx: &impl HasInitContext, logger: &mut impl HasLogger) -> InitResult {...} +/// ``` +/// +/// ## `low_level`: Manually deal with writing state bytes +/// Setting the `low_level` attribute disables the generated code for +/// serializing the contract state. +/// +/// If `low_level` is set, the signature must contain an extra argument of type +/// `&mut ContractState` found in `concordium-std`, which gives access to +/// manipulating the contract state bytes directly. This means there is no need +/// to return the contract state and the return type becomes `InitResult<()>`. +/// +/// ### Example +/// ```ignore +/// #[init(contract = "my_contract", low_level)] +/// fn some_init(ctx: &impl HasInitContext, state: &mut ContractState) -> InitResult<()> {...} +/// ``` +/// +/// ## `parameter=""`: Generate schema for parameter +/// To make schema generation to include the parameter for this function, add +/// the attribute `parameter` and set it equal to a string literal containing +/// the name of the type used for the parameter. The parameter type must +/// implement the SchemaType trait, which for most cases can be derived +/// automatically. +/// +/// ### Example +/// ```ignore +/// #[derive(SchemaType)] +/// struct MyParam { ... } +/// +/// #[init(contract = "my_contract", parameter = "MyParam")] +/// ``` +#[proc_macro_attribute] +pub fn init(attr: TokenStream, item: TokenStream) -> TokenStream { + unwrap_or_report(init_worker(attr, item)) +} + +fn init_worker(attr: TokenStream, item: TokenStream) -> syn::Result { + let attrs = Punctuated::::parse_terminated.parse(attr)?; + + let contract_name = get_attribute_value(attrs.iter(), "contract")?.ok_or_else(|| { + syn::Error::new( + Span::call_site(), + "A name for the contract must be provided, using the contract attribute. For example, \ + #[init(contract = \"my-contract\")]", + ) + })?; + + let ast: syn::ItemFn = + attach_error(syn::parse(item), "#[init] can only be applied to functions.")?; + + let fn_name = &ast.sig.ident; + let rust_export_fn_name = format_ident!("export_{}", fn_name); + let wasm_export_fn_name = format!("init_{}", contract_name.value()); + + if let Err(e) = ContractName::is_valid_contract_name(&wasm_export_fn_name) { + return Err(syn::Error::new(contract_name.span(), e)); + } + + let amount_ident = format_ident!("amount"); + + // Accumulate a list of required arguments, if the function contains a + // different number of arguments, than elements in this vector, then the + // strings are displayed as the expected arguments. + let mut required_args = vec!["ctx: &impl HasInitContext"]; + + let (setup_fn_optional_args, fn_optional_args) = + contract_function_optional_args_tokens(&attrs, &amount_ident, &mut required_args); + + let mut out = if contains_attribute(attrs.iter(), "low_level") { + required_args.push("state: ContractState"); + quote! { + #[export_name = #wasm_export_fn_name] + pub extern "C" fn #rust_export_fn_name(#amount_ident: hacspec_concordium::Amount) -> i32 { + use hacspec_concordium::{trap, ExternContext, InitContextExtern, ContractState}; + #setup_fn_optional_args + let ctx = ExternContext::::open(()); + let mut state = ContractState::open(()); + match #fn_name(&ctx, #(#fn_optional_args, )* &mut state) { + Ok(()) => 0, + Err(reject) => { + let code = Reject::from(reject).error_code.get(); + if code < 0 { + code + } else { + trap() // precondition violation + } + } + } + } + } + } else { + quote! { + #[export_name = #wasm_export_fn_name] + pub extern "C" fn #rust_export_fn_name(amount: hacspec_concordium::Amount) -> i32 { + use hacspec_concordium::{trap, ExternContext, InitContextExtern, ContractState}; + #setup_fn_optional_args + let ctx = ExternContext::::open(()); + match #fn_name(&ctx, #(#fn_optional_args),*) { + Ok(state) => { + let mut state_bytes = ContractState::open(()); + if state.serial(&mut state_bytes).is_err() { + trap() // Could not initialize contract. + }; + 0 + } + Err(reject) => { + let code = Reject::from(reject).error_code.get(); + if code < 0 { + code + } else { + trap() // precondition violation + } + } + } + } + } + }; + + let arg_count = ast.sig.inputs.len(); + if arg_count != required_args.len() { + return Err(syn::Error::new( + ast.sig.inputs.span(), + format!( + "Incorrect number of function arguments, the expected arguments are ({}) ", + required_args.join(", ") + ), + )); + } + + // Embed schema if 'parameter' attribute is set + let parameter_option = get_attribute_value(attrs.iter(), "parameter")?.map(|a| a.value()); + out.extend(contract_function_schema_tokens( + parameter_option, + rust_export_fn_name, + wasm_export_fn_name, + )); + + ast.to_tokens(&mut out); + + Ok(out.into()) +} + +/// Derive the appropriate export for an annotated receive function. +/// +/// This macro requires the following items to be present +/// - `contract = ""` where *\* is the name of +/// the smart contract. +/// - `name = ""` where *\* is the name of the +/// receive function. The generated function is exported as +/// `.`. Contract name and receive name is +/// required to be unique in the module. +/// +/// The annotated function must be of a specific type, which depends on the +/// enabled attributes. *Without* any of the optional attributes the function +/// must have a signature of +/// +/// ```ignore +/// #[receive(contract = "my_contract", name = "some_receive")] +/// fn contract_receive(ctx: &impl HasReceiveContext, state: &mut MyState) -> ReceiveResult {...} +/// ``` +/// +/// Where the `HasAction`, `HasReceiveContext` traits and the type +/// `ReceiveResult` are exposed from `concordium-std` and `MyState` is the +/// user-defined type for the contract state. +/// +/// # Optional attributes +/// +/// ## `payable`: Make function accept an amount of GTU +/// Without setting the `payable` attribute, the function will reject any +/// non-zero amount of GTU, supplied with the transaction. This means we are +/// required to explicitly mark our functions as `payable`, if they are to +/// accept GTU. +/// +/// Setting the `payable` attribute changes the required signature to include an +/// extra argument of type `Amount`, allowing the function to access the amount +/// of GTU supplied with the transaction. +/// +/// ### Example +/// ```ignore +/// #[receive(contract = "my_contract", name = "some_receive", payable)] +/// fn contract_receive(ctx: &impl HasReceiveContext, amount: Amount, state: &mut MyState) -> ReceiveResult {...} +/// ``` +/// +/// ## `enable_logger`: Function can access event logging +/// Setting the `enable_logger` attribute changes the required signature to +/// include an extra argument `&mut impl HasLogger`, allowing the function to +/// log events. +/// +/// +/// ### Example +/// ```ignore +/// #[receive(contract = "my_contract", name = "some_receive", enable_logger)] +/// fn contract_receive(ctx: &impl HasReceiveContext, logger: &mut impl HasLogger, state: &mut MyState) -> ReceiveResult {...} +/// ``` +/// +/// ## `low_level`: Manually deal with writing state bytes +/// Setting the `low_level` attribute disables the generated code for +/// serializing the contract state. +/// +/// If `low_level` is set, instead of the user-defined state type in the +/// signature, the state argument becomes the type `&mut ContractState` found in +/// `concordium-std`, which gives access to manipulating the contract state +/// bytes directly. +/// +/// ### Example +/// ```ignore +/// #[receive(contract = "my_contract", name = "some_receive", low_level)] +/// fn contract_receive(ctx: &impl HasReceiveContext, state: &mut ContractState) -> ReceiveResult {...} +/// ``` +/// +/// ## `parameter=""`: Generate schema for parameter +/// To make schema generation include the parameter for this function, add +/// the attribute `parameter` and set it equal to a string literal containing +/// the name of the type used for the parameter. The parameter type must +/// implement the SchemaType trait, which for most cases can be derived +/// automatically. +/// +/// ### Example +/// ```ignore +/// #[derive(SchemaType)] +/// struct MyParam { ... } +/// +/// #[receive(contract = "my_contract", name = "some_receive", parameter = "MyParam")] +/// fn contract_receive(ctx: &impl HasReceiveContext, state: &mut MyState) -> ReceiveResult {...} +/// ``` +#[proc_macro_attribute] +pub fn receive(attr: TokenStream, item: TokenStream) -> TokenStream { + unwrap_or_report(receive_worker(attr, item)) +} + +fn receive_worker(attr: TokenStream, item: TokenStream) -> syn::Result { + let attrs = Punctuated::::parse_terminated.parse(attr)?; + + let contract_name = get_attribute_value(attrs.iter(), "contract")?.ok_or_else(|| { + syn::Error::new( + Span::call_site(), + "The name of the associated contract must be provided, using the 'contract' \ + attribute.\n\nFor example, #[receive(contract = \"my-contract\")]", + ) + })?; + + let name = get_attribute_value(attrs.iter(), "name")?.ok_or_else(|| { + syn::Error::new( + Span::call_site(), + "A name for the receive function must be provided, using the 'name' attribute.\n\nFor \ + example, #[receive(name = \"func-name\", ...)]", + ) + })?; + + let ast: syn::ItemFn = + attach_error(syn::parse(item), "#[receive] can only be applied to functions.")?; + + let fn_name = &ast.sig.ident; + let rust_export_fn_name = format_ident!("export_{}", fn_name); + let wasm_export_fn_name = format!("{}.{}", contract_name.value(), name.value()); + + // Validate the contract name independently to ensure that it doesn't contain a + // '.' as this causes a subtle error when receive names are being split. + let contract_name_validation = + ContractName::is_valid_contract_name(&format!("init_{}", contract_name.value())) + .map_err(|e| syn::Error::new(contract_name.span(), e)); + + let receive_name_validation = ReceiveName::is_valid_receive_name(&wasm_export_fn_name) + .map_err(|e| syn::Error::new(name.span(), e)); + + match (contract_name_validation, receive_name_validation) { + (Err(mut e0), Err(e1)) => { + e0.combine(e1); + return Err(e0); + } + (Err(e), _) => return Err(e), + (_, Err(e)) => return Err(e), + _ => (), + }; + + let amount_ident = format_ident!("amount"); + + // Accumulate a list of required arguments, if the function contains a + // different number of arguments, than elements in this vector, then the + // strings are displayed as the expected arguments. + let mut required_args = vec!["ctx: &impl HasReceiveContext"]; + + let (setup_fn_optional_args, fn_optional_args) = + contract_function_optional_args_tokens(&attrs, &amount_ident, &mut required_args); + + let mut out = if contains_attribute(&attrs, "low_level") { + required_args.push("state: ContractState"); + quote! { + #[export_name = #wasm_export_fn_name] + pub extern "C" fn #rust_export_fn_name(#amount_ident: hacspec_concordium::Amount) -> i32 { + use hacspec_concordium::{SeekFrom, ContractState, Logger, ReceiveContextExtern, ExternContext}; + #setup_fn_optional_args + let ctx = ExternContext::::open(()); + let mut state = ContractState::open(()); + let res: Result<(Action, _), _> = #fn_name(&ctx, #(#fn_optional_args, )* state); + match res { + Ok((act, state_res)) => { + state = state_res; + act.tag() as i32 + } + Err(reject) => { + let code = Reject::from(reject).error_code.get(); + if code < 0 { + code + } else { + trap() // precondition violation + } + } + } + } + } + } else { + required_args.push("state: MyState"); + + quote! { + #[export_name = #wasm_export_fn_name] + pub extern "C" fn #rust_export_fn_name(#amount_ident: hacspec_concordium::Amount) -> i32 { + use hacspec_concordium::{SeekFrom, ContractState, Logger, trap}; + #setup_fn_optional_args + let ctx = ExternContext::::open(()); + let mut state_bytes = ContractState::open(()); + if let Ok(mut state) = (&mut state_bytes).get() { + let res : Result<(Action, _), _> = #fn_name(&ctx, #(#fn_optional_args, )* state); + match res { + Ok((act, state_res)) => { + state = state_res; + let res = state_bytes + .seek(SeekFrom::Start(0)) + .and_then(|_| state.serial(&mut state_bytes)); + if res.is_err() { + trap() // could not serialize state. + } else { + act.tag() as i32 + } + } + Err(reject) => { + let code = Reject::from(reject).error_code.get(); + if code < 0 { + code + } else { + trap() // precondition violation + } + } + } + } else { + trap() // Could not fully read state. + } + } + } + }; + + let arg_count = ast.sig.inputs.len(); + if arg_count != required_args.len() { + return Err(syn::Error::new( + ast.sig.inputs.span(), + format!( + "Incorrect number of function arguments, the expected arguments are ({}) ", + required_args.join(", ") + ), + )); + } + + // Embed schema if 'parameter' attribute is set + let parameter_option = get_attribute_value(attrs.iter(), "parameter")?.map(|a| a.value()); + out.extend(contract_function_schema_tokens( + parameter_option, + rust_export_fn_name, + wasm_export_fn_name, + )); + // add the original function to the output as well. + ast.to_tokens(&mut out); + Ok(out.into()) +} + +/// Generate tokens for some of the optional arguments, based on the attributes. +/// Returns a pair, where the first entry is tokens for setting up the arguments +/// and the second entry is a Vec of the argument names as tokens. +/// +/// It also mutates a vector of required arguments with the expected type +/// signature of each. +fn contract_function_optional_args_tokens<'a, I: Copy + IntoIterator>( + attrs: I, + amount_ident: &syn::Ident, + required_args: &mut Vec<&str>, +) -> (proc_macro2::TokenStream, Vec) { + let mut setup_fn_args = proc_macro2::TokenStream::new(); + let mut fn_args = vec![]; + if contains_attribute(attrs, "payable") { + required_args.push("amount: Amount"); + fn_args.push(quote!(#amount_ident)); + } else { + setup_fn_args.extend(quote! { + if #amount_ident.micro_ccd != 0 { + return -1; + } + }); + }; + + if contains_attribute(attrs, "enable_logger") { + required_args.push("logger: impl HasLogger"); + let logger_ident = format_ident!("logger"); + setup_fn_args.extend(quote!(let mut #logger_ident = hacspec_concordium::Logger::init();)); + fn_args.push(quote!(&mut #logger_ident)); + } + (setup_fn_args, fn_args) +} + +#[cfg(feature = "build-schema")] +fn contract_function_schema_tokens( + parameter_option: Option, + rust_name: syn::Ident, + wasm_name: String, +) -> proc_macro2::TokenStream { + match parameter_option { + Some(parameter_ty) => { + let parameter_ident = syn::Ident::new(¶meter_ty, Span::call_site()); + let schema_name = format!("concordium_schema_function_{}", wasm_name); + let schema_ident = format_ident!("concordium_schema_function_{}", rust_name); + quote! { + #[export_name = #schema_name] + pub extern "C" fn #schema_ident() -> *mut u8 { + let schema = <#parameter_ident as schema::SchemaType>::get_type(); + let schema_bytes = hacspec_concordium::to_bytes(&schema); + hacspec_concordium::put_in_memory(&schema_bytes) + } + } + } + None => proc_macro2::TokenStream::new(), + } +} + +#[cfg(not(feature = "build-schema"))] +fn contract_function_schema_tokens( + _parameter_option: Option, + _rust_name: syn::Ident, + _wasm_name: String, +) -> proc_macro2::TokenStream { + proc_macro2::TokenStream::new() +} + +/// Derive the Deserial trait. See the documentation of `derive(Serial)` for +/// details and limitations. +/// +/// In addition to the attributes supported by `derive(Serial)`, this derivation +/// macro supports the `ensure_ordered` attribute. If applied to a field the +/// of type `BTreeMap` or `BTreeSet` deserialization will additionally ensure +/// that the keys are in strictly increasing order. By default deserialization +/// only ensures uniqueness. +/// +/// # Example +/// ``` ignore +/// #[derive(Deserial)] +/// struct Foo { +/// #[concordium(size_length = 1, ensure_ordered)] +/// bar: BTreeSet, +/// } +/// ``` +#[proc_macro_derive(Deserial, attributes(concordium))] +pub fn deserial_derive(input: TokenStream) -> TokenStream { + let ast = parse_macro_input!(input); + unwrap_or_report(impl_deserial(&ast)) +} + +/// The prefix used in field attributes: `#[concordium(attr = "something")]` +const CONCORDIUM_FIELD_ATTRIBUTE: &str = "concordium"; + +/// A list of valid concordium field attributes +const VALID_CONCORDIUM_FIELD_ATTRIBUTES: [&str; 3] = ["size_length", "ensure_ordered", "rename"]; + +fn get_concordium_field_attributes(attributes: &[syn::Attribute]) -> syn::Result> { + attributes + .iter() + // Keep only concordium attributes + .flat_map(|attr| match attr.parse_meta() { + Ok(syn::Meta::List(list)) if list.path.is_ident(CONCORDIUM_FIELD_ATTRIBUTE) => { + list.nested + } + _ => syn::punctuated::Punctuated::new(), + }) + // Ensure only valid attributes and unwrap NestedMeta + .map(|nested| match nested { + syn::NestedMeta::Meta(meta) => { + let path = meta.path(); + if VALID_CONCORDIUM_FIELD_ATTRIBUTES.iter().any(|&attr| path.is_ident(attr)) { + Ok(meta) + } else { + Err(syn::Error::new(meta.span(), + format!("The attribute '{}' is not supported as a concordium field attribute.", + path.to_token_stream()) + )) + } + } + lit => Err(syn::Error::new(lit.span(), "Literals are not supported in a concordium field attribute.")), + }) + .collect() +} + +fn find_field_attribute_value( + attributes: &[syn::Attribute], + target_attr: &str, +) -> syn::Result> { + let target_attr = format_ident!("{}", target_attr); + let attr_values: Vec<_> = get_concordium_field_attributes(attributes)? + .into_iter() + .filter_map(|nested_meta| match nested_meta { + syn::Meta::NameValue(value) if value.path.is_ident(&target_attr) => Some(value.lit), + _ => None, + }) + .collect(); + if attr_values.is_empty() { + return Ok(None); + } + if attr_values.len() > 1 { + let mut init_error = syn::Error::new( + attr_values[1].span(), + format!("Attribute '{}' should only be specified once.", target_attr), + ); + for other in attr_values.iter().skip(2) { + init_error.combine(syn::Error::new( + other.span(), + format!("Attribute '{}' should only be specified once.", target_attr), + )) + } + Err(init_error) + } else { + Ok(Some(attr_values[0].clone())) + } +} + +fn find_length_attribute(attributes: &[syn::Attribute]) -> syn::Result> { + let value = match find_field_attribute_value(attributes, "size_length")? { + Some(v) => v, + None => return Ok(None), + }; + + // Save the span to be used in errors. + let value_span = value.span(); + + let value = match value { + syn::Lit::Int(int) => int, + _ => return Err(syn::Error::new(value_span, "Length attribute value must be an integer.")), + }; + let value = match value.base10_parse() { + Ok(v) => v, + _ => { + return Err(syn::Error::new( + value_span, + "Length attribute value must be a base 10 integer.", + )) + } + }; + match value { + 1 | 2 | 4 | 8 => Ok(Some(value)), + _ => Err(syn::Error::new(value_span, "Length info must be either 1, 2, 4, or 8.")), + } +} + +/// Find a 'rename' attribute and return its value and span. +/// Checks that the attribute is only defined once and that the value is a +/// string. +#[cfg(feature = "build-schema")] +fn find_rename_attribute(attributes: &[syn::Attribute]) -> syn::Result> { + let value = match find_field_attribute_value(attributes, "rename")? { + Some(v) => v, + None => return Ok(None), + }; + + match value { + syn::Lit::Str(value) => Ok(Some((value.value(), value.span()))), + _ => Err(syn::Error::new(value.span(), "Rename attribute value must be a string.")), + } +} + +/// Check for name collisions by inserting the name in the HashMap. +/// On collisions it returns a combined error pointing to the previous and new +/// definition. +#[cfg(feature = "build-schema")] +fn check_for_name_collisions( + used_names: &mut HashMap, + new_name: &str, + new_span: Span, +) -> syn::Result<()> { + if let Some(used_span) = used_names.insert(String::from(new_name), new_span) { + let error_msg = format!("the name `{}` is defined multiple times", new_name); + let mut error_at_first_def = syn::Error::new(used_span, &error_msg); + let error_at_second_def = syn::Error::new(new_span, &error_msg); + + // Combine the errors to show both at once + error_at_first_def.combine(error_at_second_def); + + return Err(error_at_first_def); + } + Ok(()) +} + +fn impl_deserial_field( + f: &syn::Field, + ident: &syn::Ident, + source: &syn::Ident, +) -> syn::Result { + let concordium_attributes = get_concordium_field_attributes(&f.attrs)?; + let ensure_ordered = contains_attribute(&concordium_attributes, "ensure_ordered"); + let size_length = find_length_attribute(&f.attrs)?; + let has_ctx = ensure_ordered || size_length.is_some(); + let ty = &f.ty; + if has_ctx { + // Default size length is u32, i.e. 4 bytes. + let l = format_ident!("U{}", 8 * size_length.unwrap_or(4)); + Ok(quote! { + let #ident = <#ty as hacspec_concordium::DeserialCtx>::deserial_ctx(hacspec_concordium::schema::SizeLength::#l, #ensure_ordered, #source)?; + }) + } else { + Ok(quote! { + let #ident = <#ty as Deserial>::deserial(#source)?; + }) + } +} + +fn impl_deserial(ast: &syn::DeriveInput) -> syn::Result { + let data_name = &ast.ident; + + let span = ast.span(); + + let read_ident = format_ident!("__R", span = span); + + let (impl_generics, ty_generics, where_clauses) = ast.generics.split_for_impl(); + + let source_ident = Ident::new("source", Span::call_site()); + + let body_tokens = match ast.data { + syn::Data::Struct(ref data) => { + let mut names = proc_macro2::TokenStream::new(); + let mut field_tokens = proc_macro2::TokenStream::new(); + let return_tokens = match data.fields { + syn::Fields::Named(_) => { + for field in data.fields.iter() { + let field_ident = field.ident.clone().unwrap(); // safe since named fields. + field_tokens.extend(impl_deserial_field( + field, + &field_ident, + &source_ident, + )); + names.extend(quote!(#field_ident,)) + } + quote!(Ok(#data_name{#names})) + } + syn::Fields::Unnamed(_) => { + for (i, f) in data.fields.iter().enumerate() { + let field_ident = format_ident!("x_{}", i); + field_tokens.extend(impl_deserial_field(f, &field_ident, &source_ident)); + names.extend(quote!(#field_ident,)) + } + quote!(Ok(#data_name(#names))) + } + _ => quote!(Ok(#data_name{})), + }; + quote! { + #field_tokens + #return_tokens + } + } + syn::Data::Enum(ref data) => { + let mut matches_tokens = proc_macro2::TokenStream::new(); + let source = Ident::new("source", Span::call_site()); + let size = if data.variants.len() <= 256 { + format_ident!("u8") + } else if data.variants.len() <= 256 * 256 { + format_ident!("u16") + } else { + return Err(syn::Error::new( + ast.span(), + "[derive(Deserial)]: Too many variants. Maximum 65536 are supported.", + )); + }; + for (i, variant) in data.variants.iter().enumerate() { + let (field_names, pattern) = match variant.fields { + syn::Fields::Named(_) => { + let field_names: Vec<_> = variant + .fields + .iter() + .map(|field| field.ident.clone().unwrap()) + .collect(); + (field_names.clone(), quote! { {#(#field_names),*} }) + } + syn::Fields::Unnamed(_) => { + let field_names: Vec<_> = variant + .fields + .iter() + .enumerate() + .map(|(i, _)| format_ident!("x_{}", i)) + .collect(); + (field_names.clone(), quote! { ( #(#field_names),* ) }) + } + syn::Fields::Unit => (Vec::new(), proc_macro2::TokenStream::new()), + }; + + let field_tokens: proc_macro2::TokenStream = field_names + .iter() + .zip(variant.fields.iter()) + .map(|(name, field)| impl_deserial_field(field, name, &source)) + .collect::>()?; + let idx_lit = syn::LitInt::new(i.to_string().as_str(), Span::call_site()); + let variant_ident = &variant.ident; + matches_tokens.extend(quote! { + #idx_lit => { + #field_tokens + Ok(#data_name::#variant_ident#pattern) + }, + }) + } + quote! { + let idx = #size::deserial(#source)?; + match idx { + #matches_tokens + _ => Err(Default::default()) + } + } + } + _ => unimplemented!("#[derive(Deserial)] is not implemented for union."), + }; + let gen = quote! { + #[automatically_derived] + impl #impl_generics Deserial for #data_name #ty_generics #where_clauses { + fn deserial<#read_ident: Read>(#source_ident: &mut #read_ident) -> ParseResult { + #body_tokens + } + } + }; + Ok(gen.into()) +} + +/// Derive the Serial trait for the type. +/// +/// If the type is a struct all fields must implement the Serial trait. If the +/// type is an enum then all fields of each of the enums must implement the +/// Serial trait. +/// +/// +/// Collections (Vec, BTreeMap, BTreeSet) and strings (String, str) are by +/// default serialized by prepending the number of elements as 4 bytes +/// little-endian. If this is too much or too little, fields of the above types +/// can be annotated with `size_length`. +/// +/// The value of this field is the number of bytes that will be used for +/// encoding the number of elements. Supported values are 1, 2, 4, 8. +/// +/// For BTreeMap and BTreeSet the serialize method will serialize values in +/// increasing order of keys. +/// +/// Fields of structs are serialized in the order they appear in the code. +/// +/// Enums can have no more than 65536 variants. They are serialized by using a +/// tag to indicate the variant, enumerating them in the order they are written +/// in source code. If the number of variants is less than or equal 256 then a +/// single byte is used to encode it. Otherwise two bytes are used for the tag, +/// encoded in little endian. +/// +/// # Example +/// ```ignore +/// #[derive(Serial)] +/// struct Foo { +/// #[concordium(size_length = 1)] +/// bar: BTreeSet, +/// } +/// ``` +#[proc_macro_derive(Serial, attributes(concordium))] +pub fn serial_derive(input: TokenStream) -> TokenStream { + let ast = parse_macro_input!(input); + unwrap_or_report(impl_serial(&ast)) +} + +fn impl_serial_field( + field: &syn::Field, + ident: &proc_macro2::TokenStream, + out: &syn::Ident, +) -> syn::Result { + if let Some(size_length) = find_length_attribute(&field.attrs)? { + let l = format_ident!("U{}", 8 * size_length); + Ok(quote!({ + use hacspec_concordium::SerialCtx; + #ident.serial_ctx(hacspec_concordium::schema::SizeLength::#l, #out)?; + })) + } else { + Ok(quote! { + #ident.serial(#out)?; + }) + } +} + +fn impl_serial(ast: &syn::DeriveInput) -> syn::Result { + let data_name = &ast.ident; + + let span = ast.span(); + + let write_ident = format_ident!("W", span = span); + + let (impl_generics, ty_generics, where_clauses) = ast.generics.split_for_impl(); + + let out_ident = format_ident!("out"); + + let body = match ast.data { + syn::Data::Struct(ref data) => { + let fields_tokens = match data.fields { + syn::Fields::Named(_) => { + data.fields + .iter() + .map(|field| { + let field_ident = field.ident.clone().unwrap(); // safe since named fields. + let field_ident = quote!(self.#field_ident); + impl_serial_field(field, &field_ident, &out_ident) + }) + .collect::>()? + } + syn::Fields::Unnamed(_) => data + .fields + .iter() + .enumerate() + .map(|(i, field)| { + let i = syn::LitInt::new(i.to_string().as_str(), Span::call_site()); + let field_ident = quote!(self.#i); + impl_serial_field(field, &field_ident, &out_ident) + }) + .collect::>()?, + syn::Fields::Unit => proc_macro2::TokenStream::new(), + }; + quote! { + #fields_tokens + Ok(()) + } + } + syn::Data::Enum(ref data) => { + let mut matches_tokens = proc_macro2::TokenStream::new(); + + let size = if data.variants.len() <= 256 { + format_ident!("u8") + } else if data.variants.len() <= 256 * 256 { + format_ident!("u16") + } else { + unimplemented!( + "[derive(Serial)]: Enums with more than 65536 variants are not supported." + ); + }; + + for (i, variant) in data.variants.iter().enumerate() { + let (field_names, pattern) = match variant.fields { + syn::Fields::Named(_) => { + let field_names: Vec<_> = variant + .fields + .iter() + .map(|field| field.ident.clone().unwrap()) + .collect(); + (field_names.clone(), quote! { {#(#field_names),*} }) + } + syn::Fields::Unnamed(_) => { + let field_names: Vec<_> = variant + .fields + .iter() + .enumerate() + .map(|(i, _)| format_ident!("x_{}", i)) + .collect(); + (field_names.clone(), quote! { (#(#field_names),*) }) + } + syn::Fields::Unit => (Vec::new(), proc_macro2::TokenStream::new()), + }; + let field_tokens: proc_macro2::TokenStream = field_names + .iter() + .zip(variant.fields.iter()) + .map(|(name, field)| impl_serial_field(field, "e!(#name), &out_ident)) + .collect::>()?; + + let idx_lit = + syn::LitInt::new(format!("{}{}", i, size).as_str(), Span::call_site()); + let variant_ident = &variant.ident; + + matches_tokens.extend(quote! { + #data_name::#variant_ident#pattern => { + #idx_lit.serial(#out_ident)?; + #field_tokens + }, + }) + } + quote! { + match self { + #matches_tokens + } + Ok(()) + } + } + _ => unimplemented!("#[derive(Serial)] is not implemented for union."), + }; + + let gen = quote! { + #[automatically_derived] + impl #impl_generics Serial for #data_name #ty_generics #where_clauses { + fn serial<#write_ident: Write>(&self, #out_ident: &mut #write_ident) -> Result<(), #write_ident::Err> { + #body + } + } + }; + Ok(gen.into()) +} + +/// A helper macro to derive both the Serial and Deserial traits. +/// `[derive(Serialize)]` is equivalent to `[derive(Serial,Deserial)]`, see +/// documentation of the latter two for details and options. +#[proc_macro_derive(Serialize, attributes(concordium))] +pub fn serialize_derive(input: TokenStream) -> TokenStream { + unwrap_or_report(serialize_derive_worker(input)) +} + +fn serialize_derive_worker(input: TokenStream) -> syn::Result { + let ast = syn::parse(input)?; + let mut tokens = impl_deserial(&ast)?; + tokens.extend(impl_serial(&ast)?); + Ok(tokens) +} + +/// Marks a type as the contract state. Currently only used for generating the +/// schema of the contract state. If the feature `build-schema` is not enabled +/// this has no effect. +/// +/// +/// # Example +/// ```ignore +/// #[contract_state(contract = "my_contract")] +/// #[derive(SchemaType)] +/// struct MyContractState { +/// ... +/// } +/// ``` +#[proc_macro_attribute] +pub fn contract_state(attr: TokenStream, item: TokenStream) -> TokenStream { + unwrap_or_report(contract_state_worker(attr, item)) +} + +#[cfg(feature = "build-schema")] +fn contract_state_worker(attr: TokenStream, item: TokenStream) -> syn::Result { + let mut out = proc_macro2::TokenStream::new(); + + let data_ident = if let Ok(ast) = syn::parse::(item.clone()) { + ast.to_tokens(&mut out); + ast.ident + } else if let Ok(ast) = syn::parse::(item.clone()) { + ast.to_tokens(&mut out); + ast.ident + } else if let Ok(ast) = syn::parse::(item.clone()) { + ast.to_tokens(&mut out); + ast.ident + } else { + return Err(syn::Error::new_spanned( + proc_macro2::TokenStream::from(item), + "#[contract_state] only supports structs, enums and type aliases.", + )); + }; + + let attrs = Punctuated::::parse_terminated.parse(attr)?; + + let contract_name = get_attribute_value(attrs.iter(), "contract")?.ok_or_else(|| { + syn::Error::new( + Span::call_site(), + "A name of the contract must be provided, using the 'contract' attribute.\n\nFor \ + example #[contract_state(contract = \"my-contract\")].", + ) + })?; + + let wasm_schema_name = format!("concordium_schema_state_{}", contract_name.value()); + let rust_schema_name = format_ident!("concordium_schema_state_{}", data_ident); + + let generate_schema_tokens = quote! { + #[allow(non_snake_case)] + #[export_name = #wasm_schema_name] + pub extern "C" fn #rust_schema_name() -> *mut u8 { + let schema = <#data_ident as hacspec_concordium::schema::SchemaType>::get_type(); + let schema_bytes = hacspec_concordium::to_bytes(&schema); + hacspec_concordium::put_in_memory(&schema_bytes) + } + }; + generate_schema_tokens.to_tokens(&mut out); + Ok(out.into()) +} + +#[cfg(not(feature = "build-schema"))] +fn contract_state_worker(_attr: TokenStream, item: TokenStream) -> syn::Result { + Ok(item) +} + +/// Derive the `SchemaType` trait for a type. +/// If the feature `build-schema` is not enabled this is a no-op, i.e., it does +/// not produce any code. +#[proc_macro_derive(SchemaType, attributes(size_length))] +pub fn schema_type_derive(input: TokenStream) -> TokenStream { + unwrap_or_report(schema_type_derive_worker(input)) +} + +#[cfg(feature = "build-schema")] +fn schema_type_derive_worker(input: TokenStream) -> syn::Result { + let ast: syn::DeriveInput = syn::parse(input)?; + + let data_name = &ast.ident; + + let body = match ast.data { + syn::Data::Struct(ref data) => { + let fields_tokens = schema_type_fields(&data.fields)?; + quote! { + hacspec_concordium::schema::Type::Struct(#fields_tokens) + } + } + syn::Data::Enum(ref data) => { + let mut used_variant_names = HashMap::new(); + let variant_tokens: Vec<_> = data + .variants + .iter() + .map(|variant| { + // Handle the 'rename' attribute. + let (variant_name, variant_span) = match find_rename_attribute(&variant.attrs)? + { + Some(name_and_span) => name_and_span, + None => (variant.ident.to_string(), variant.ident.span()), + }; + check_for_name_collisions( + &mut used_variant_names, + &variant_name, + variant_span, + )?; + + let fields_tokens = schema_type_fields(&variant.fields)?; + Ok(quote! { + (hacspec_concordium::String::from(#variant_name), #fields_tokens) + }) + }) + .collect::>()?; + quote! { + hacspec_concordium::schema::Type::Enum(hacspec_concordium::Vec::from([ #(#variant_tokens),* ])) + } + } + _ => syn::Error::new(ast.span(), "Union is not supported").to_compile_error(), + }; + + let out = quote! { + #[automatically_derived] + impl hacspec_concordium::schema::SchemaType for #data_name { + fn get_type() -> hacspec_concordium::schema::Type { + #body + } + } + }; + Ok(out.into()) +} + +#[cfg(not(feature = "build-schema"))] +fn schema_type_derive_worker(_input: TokenStream) -> syn::Result { + Ok(TokenStream::new()) +} + +#[cfg(feature = "build-schema")] +fn schema_type_field_type(field: &syn::Field) -> syn::Result { + let field_type = &field.ty; + if let Some(l) = find_length_attribute(&field.attrs)? { + let size = format_ident!("U{}", 8 * l); + Ok(quote! { + <#field_type as hacspec_concordium::schema::SchemaType>::get_type().set_size_length(hacspec_concordium::schema::SizeLength::#size) + }) + } else { + Ok(quote! { + <#field_type as hacspec_concordium::schema::SchemaType>::get_type() + }) + } +} + +#[cfg(feature = "build-schema")] +fn schema_type_fields(fields: &syn::Fields) -> syn::Result { + match fields { + syn::Fields::Named(_) => { + let mut used_field_names = HashMap::new(); + let fields_tokens: Vec<_> = fields + .iter() + .map(|field| { + // Handle the 'rename' attribute. + let (field_name, field_span) = match find_rename_attribute(&field.attrs)? { + Some(name_and_span) => name_and_span, + None => (field.ident.clone().unwrap().to_string(), field.ident.span()), // safe since named fields. + }; + check_for_name_collisions(&mut used_field_names, &field_name, field_span)?; + + let field_schema_type = schema_type_field_type(&field)?; + Ok(quote! { + (hacspec_concordium::String::from(#field_name), #field_schema_type) + }) + }) + .collect::>()?; + Ok( + quote! { hacspec_concordium::schema::Fields::Named(hacspec_concordium::Vec::from([ #(#fields_tokens),* ])) }, + ) + } + syn::Fields::Unnamed(_) => { + let fields_tokens: Vec<_> = + fields.iter().map(schema_type_field_type).collect::>()?; + Ok(quote! { hacspec_concordium::schema::Fields::Unnamed([ #(#fields_tokens),* ].to_vec()) }) + } + syn::Fields::Unit => Ok(quote! { hacspec_concordium::schema::Fields::None }), + } +} + +/// We reserve a number of error codes for custom errors, such as ParseError, +/// that are provided by concordium-std. These reserved error codes can have +/// indices i32::MIN, i32::MIN + 1, ..., RESERVED_ERROR_CODES +const RESERVED_ERROR_CODES: i32 = i32::MIN + 100; + +/// Derive the conversion of enums that represent error types into the Reject +/// struct which can be used as the error type of init and receive functions. +/// Creating custom enums for error types can provide meaningful error messages +/// to the user of the smart contract. +/// +/// Note that at the moment, we can only derive fieldless enums. +/// +/// The conversion will map the first variant to error code -1, second to -2, +/// etc. +/// +/// ### Example +/// ```ignore +/// #[derive(Clone, Copy, Reject)] +/// enum MyError { +/// IllegalState, // receives error code -1 +/// WrongSender, // receives error code -2 +/// // TimeExpired(time: Timestamp), /* currently not supported */ +/// ... +/// } +/// ``` +/// ```ignore +/// #[receive(contract = "my_contract", name = "some_receive")] +/// fn receive(ctx: &impl HasReceiveContext, state: &mut MyState) +/// -> Result {...} +/// ``` +#[proc_macro_derive(Reject, attributes(from))] +pub fn reject_derive(input: TokenStream) -> TokenStream { + unwrap_or_report(reject_derive_worker(input)) +} + +fn reject_derive_worker(input: TokenStream) -> syn::Result { + let ast: syn::DeriveInput = syn::parse(input)?; + let enum_data = match &ast.data { + syn::Data::Enum(data) => Ok(data), + _ => Err(syn::Error::new(ast.span(), "Reject can only be derived for enums.")), + }?; + let enum_ident = &ast.ident; + + // Ensure that the number of enum variants fits into the number of error codes + // we can generate. + let too_many_variants = format!( + "Error enum {} cannot have more than {} variants.", + enum_ident, + RESERVED_ERROR_CODES.neg() + ); + match i32::try_from(enum_data.variants.len()) { + Ok(n) if n <= RESERVED_ERROR_CODES.neg() => (), + _ => { + return Err(syn::Error::new(ast.span(), &too_many_variants)); + } + }; + + let variant_error_conversions = generate_variant_error_conversions(&enum_data, &enum_ident)?; + + let gen = quote! { + /// The from implementation maps the first variant to -1, second to -2, etc. + /// NB: This differs from the cast `variant as i32` since we cannot easily modify + /// the variant tags in the derive macro itself. + #[automatically_derived] + impl From<#enum_ident> for Reject { + #[inline(always)] + fn from(e: #enum_ident) -> Self { + Reject { error_code: unsafe { hacspec_concordium::num::NonZeroI32::new_unchecked(-(e as i32) - 1) } } + } + } + + #(#variant_error_conversions)* + }; + Ok(gen.into()) +} + +/// Generate error conversions for enum variants e.g. for converting +/// `ParseError` to `MyParseErrorWrapper` in +/// +/// ```ignore +/// enum MyErrorType { +/// #[from(ParseError)] +/// MyParseErrorWrapper, +/// ... +/// } +/// ``` +fn generate_variant_error_conversions( + enum_data: &DataEnum, + enum_name: &syn::Ident, +) -> syn::Result> { + Ok(enum_data + .variants + .iter() + .map(|variant| { + // in the future we might incorporate explicit discriminants, + // but the general case of this requires evaluating constant expressions, + // which is not easily supported at the moment. + if let Some((_, discriminant)) = variant.discriminant.as_ref() { + return Err(syn::Error::new( + discriminant.span(), + "Explicit discriminants are not yet supported.", + )); + } + let variant_attributes = variant.attrs.iter(); + variant_attributes + .map(move |attr| { + parse_attr_and_gen_error_conversions(attr, enum_name, &variant.ident) + }) + .collect::>>() + }) + .collect::>>()? + .into_iter() + .flatten() + .flatten() + .collect()) +} + +/// Generate error conversion for a given enum variant. +fn parse_attr_and_gen_error_conversions( + attr: &syn::Attribute, + enum_name: &syn::Ident, + variant_name: &syn::Ident, +) -> syn::Result> { + let wrong_from_usage = |x: &dyn Spanned| { + syn::Error::new( + x.span(), + "The `from` attribute expects a list of error types, e.g.: #[from(ParseError)].", + ) + }; + match attr.parse_meta() { + Ok(syn::Meta::List(list)) if list.path.is_ident("from") => { + let mut from_error_names = vec![]; + for nested in list.nested.iter() { + // check that all items in the list are paths + match nested { + syn::NestedMeta::Meta(meta) => match meta { + Meta::Path(from_error) => { + let ident = from_error + .get_ident() + .ok_or_else(|| wrong_from_usage(from_error))?; + from_error_names.push(ident); + } + other => return Err(wrong_from_usage(&other)), + }, + syn::NestedMeta::Lit(l) => return Err(wrong_from_usage(&l)), + } + } + Ok(from_error_token_stream(&from_error_names, &enum_name, variant_name).collect()) + } + Ok(syn::Meta::NameValue(mnv)) if mnv.path.is_ident("from") => Err(wrong_from_usage(&mnv)), + _ => Ok(vec![]), + } +} + +/// Generating the conversion code a la +/// ```ignore +/// impl From for MyErrorType { +/// fn from(x: ParseError) -> Self { +/// MyError::MyParseErrorWrapper +/// } +/// } +/// ``` +fn from_error_token_stream<'a>( + paths: &'a [&'a syn::Ident], + enum_name: &'a syn::Ident, + variant_name: &'a syn::Ident, +) -> impl Iterator + 'a { + paths.iter().map(move |from_error| { + quote! { + impl From<#from_error> for #enum_name { + #[inline] + fn from(fe: #from_error) -> Self { + #enum_name::#variant_name + } + }} + }) +} + +#[proc_macro_attribute] +/// Derive the appropriate export for an annotated test function, when feature +/// "wasm-test" is enabled, otherwise behaves like `#[test]`. +pub fn concordium_test(attr: TokenStream, item: TokenStream) -> TokenStream { + unwrap_or_report(concordium_test_worker(attr, item)) +} + +/// Derive the appropriate export for an annotated test function, when feature +/// "wasm-test" is enabled, otherwise behaves like `#[test]`. +#[cfg(feature = "wasm-test")] +fn concordium_test_worker(_attr: TokenStream, item: TokenStream) -> syn::Result { + let test_fn_ast: syn::ItemFn = + attach_error(syn::parse(item), "#[concordium_test] can only be applied to functions.")?; + + let test_fn_name = &test_fn_ast.sig.ident; + let rust_export_fn_name = format_ident!("concordium_test_{}", test_fn_name); + let wasm_export_fn_name = format!("concordium_test {}", test_fn_name); + + let test_fn = quote! { + // Setup test function + #test_fn_ast + + // Export test function in wasm + #[export_name = #wasm_export_fn_name] + pub extern "C" fn #rust_export_fn_name() { + #test_fn_name() + } + }; + Ok(test_fn.into()) +} + +/// Derive the appropriate export for an annotated test function, when feature +/// "wasm-test" is enabled, otherwise behaves like `#[test]`. +#[cfg(not(feature = "wasm-test"))] +fn concordium_test_worker(_attr: TokenStream, item: TokenStream) -> syn::Result { + let test_fn_ast: syn::ItemFn = + attach_error(syn::parse(item), "#[concordium_test] can only be applied to functions.")?; + + let test_fn = quote! { + #[test] + #test_fn_ast + }; + Ok(test_fn.into()) +} + +/// Sets the cfg for testing targeting either Wasm and native. +#[cfg(feature = "wasm-test")] +#[proc_macro_attribute] +pub fn concordium_cfg_test(_attr: TokenStream, item: TokenStream) -> TokenStream { item } + +/// Sets the cfg for testing targeting either Wasm and native. +#[cfg(not(feature = "wasm-test"))] +#[proc_macro_attribute] +pub fn concordium_cfg_test(_attr: TokenStream, item: TokenStream) -> TokenStream { + let item = proc_macro2::TokenStream::from(item); + let out = quote! { + #[cfg(test)] + #item + }; + out.into() +} #+END_SRC diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 80ac907..cdd3783 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -44,14 +44,14 @@ Tool: macro_use _ **) (** Tool: no_std _ Tool: feature _ register_tool Tool: register_tool _ _hax **) -Require Import Concordium_std. -Export Concordium_std. +Require Import Hacspec_concordium. +Export Hacspec_concordium. (** Tool: no_std _ Tool: feature _ register_tool Tool: register_tool _ _hax **) -Require Import Concordium_std_derive. -Export Concordium_std_derive. +Require Import Hacspec_concordium_derive. +Export Hacspec_concordium_derive. (** Tool: no_std _ Tool: feature _ register_tool @@ -112,7 +112,7 @@ Definition state_bytes_loc : Location := Equations export_init_ovn_contract {L1 : {fset Location}} {I1 : Interface} (amount : both L1 I1 (t_Amount)) : both (L1 :|: fset [state_bytes_loc]) (I1) (int32) := export_init_ovn_contract amount := solve_lift (run (letb _ := ifb (f_micro_ccd amount) <> (ret_both (0 : int64)) - then letb hoist1 := v_Break (get_under_impl_56 (f_error_code (from NotPayableError))) :of: t_Never in + then letb hoist1 := v_Break (ret_both (1 : int32)) :of: t_Never in ControlFlow_Continue (never_to_any hoist1) else ControlFlow_Continue (ret_both (tt : 'unit)) :of: 'unit in ControlFlow_Continue (letb ctx := open (ret_both (tt : 'unit)) :of: t_ExternContext (t_InitContextExtern) in @@ -156,9 +156,9 @@ Fail Next Obligation. Tool: feature _ register_tool Tool: register_tool _ _hax DocComment: TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics **) -Equations v_ZKP {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (xi : both L1 I1 (int32)) : both (L1) (I1) (int32) := - v_ZKP xi := - solve_lift (ret_both (0 : int32)) : both (L1) (I1) (int32). +Equations v_ZKP {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi : both L1 I1 (t_group_type)) (xi : both L2 I2 (int32)) : both (L1:|:L2) (I1:|:I2) (int32) := + v_ZKP g_pow_xi xi := + solve_lift (ret_both (0 : int32)) : both (L1:|:L2) (I1:|:I2) (int32). Fail Next Obligation. (** Tool: no_std _ @@ -190,8 +190,8 @@ Fail Next Obligation. Tool: feature _ register_tool Tool: register_tool _ _hax Tool: export_name _ **) -Equations export_register_vote_pre {L1 : {fset Location}} {I1 : Interface} (amount : both L1 I1 (t_Amount)) : both (L1) (I1) (int32) := - export_register_vote_pre amount := +Equations export_register_vote {L1 : {fset Location}} {I1 : Interface} (amount : both L1 I1 (t_Amount)) : both (L1) (I1) (int32) := + export_register_vote amount := solve_lift (failure (ret_both ((LocalMutation) The bindings ["state_bytes"] cannot be mutated here: they don't belong to the closure scope, and this is not allowed. : chString)) (ret_both ({ let _: tuple0 = { @@ -200,27 +200,21 @@ Equations export_register_vote_pre {L1 : {fset Location}} {I1 : Interface} (amou 0, ) { { - let hoist4: rust_primitives::hax::t_Never = { - (return core::num::nonzero::get_under_impl_56( - proj_concordium_std::types::Reject::f_error_code( - core::convert::From::from(concordium_std::types::NotPayableError()), - ), - )) - }; + let hoist4: rust_primitives::hax::t_Never = { (return 1) }; rust_primitives::hax::never_to_any(hoist4) } }) }; { - let ctx: concordium_std::types::t_ExternContext< - concordium_std::types::t_ReceiveContextExtern, - > = { concordium_std::traits::HasReceiveContext::open(Tuple0()) }; + let ctx: hacspec_concordium::concordium_types::t_ExternContext< + hacspec_concordium::concordium_types::t_ReceiveContextExtern, + > = { hacspec_concordium::concordium_traits::HasReceiveContext::open(Tuple0()) }; { - let mut state_bytes: concordium_std::types::t_ContractState = - { concordium_std::traits::HasContractState::open(Tuple0()) }; + let mut state_bytes: hacspec_concordium::concordium_types::t_ContractState = + { hacspec_concordium::concordium_traits::HasContractState::open(Tuple0()) }; { let Tuple2(tmp0, out): tuple2< - concordium_std::types::t_ContractState, + hacspec_concordium::concordium_types::t_ContractState, core::result::t_Result< hacspec_ovn::t_OvnContractState< hacspec_ovn::t_z_17_, @@ -233,7 +227,7 @@ Equations export_register_vote_pre {L1 : {fset Location}} {I1 : Interface} (amou let _: tuple0 = { (state_bytes = tmp0) }; { let hoist7: tuple2< - concordium_std::types::t_ContractState, + hacspec_concordium::concordium_types::t_ContractState, core::result::t_Result< hacspec_ovn::t_OvnContractState< hacspec_ovn::t_z_17_, @@ -244,69 +238,83 @@ Equations export_register_vote_pre {L1 : {fset Location}} {I1 : Interface} (amou > = { out }; (match hoist7 { core::result::Result_Ok(mut state) => { - { - let Tuple2(tmp0, out): tuple2< + let pat_ascription!( + res as core::result::t_Result< + tuple2< + hacspec_concordium::concordium_types::t_Action, + hacspec_ovn::t_OvnContractState< + hacspec_ovn::t_z_17_, + generic_value!(todo), + >, + >, + concordium_contracts_common::types::t_ParseError, + > + ): core::result::t_Result< + tuple2< + hacspec_concordium::concordium_types::t_Action, hacspec_ovn::t_OvnContractState< hacspec_ovn::t_z_17_, generic_value!(todo), >, - core::result::t_Result< - concordium_std::types::t_Action, - concordium_contracts_common::types::t_ParseError, - >, - > = { hacspec_ovn::register_vote_pre(ctx, state) }; - { - let _: tuple0 = { (state = tmp0) }; + >, + concordium_contracts_common::types::t_ParseError, + > = { hacspec_ovn::register_vote(ctx, state) }; + (match res { + core::result::Result_Ok(Tuple2(act, state_res)) => { + let _: tuple0 = { (state = state_res) }; { - // Note: rhs.typ=tuple2, core::result::t_Result> - let pat_ascription!(res as core::result::t_Result): core::result::t_Result = {out}; - (match res { - core::result::Result_Ok(act) => { - let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Seek::seek(state_bytes,concordium_contracts_common::traits::SeekFrom_Start(0))}; + let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Seek::seek(state_bytes,concordium_contracts_common::traits::SeekFrom_Start(0))}; + { + let _: tuple0 = { (state_bytes = tmp0) }; + { + let hoist6: tuple2> = {out}; { - let _: tuple0 = - { (state_bytes = tmp0) }; - { - let hoist6: tuple2> = {out}; - { - let hoist5: arrow!(int -> core::result::t_Result) = { - (|_| { - let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Serial::serial(state,state_bytes)}; - { - let _: tuple0 = { - (state_bytes = - tmp0) - }; - out - } - }) - }; + let hoist5: arrow!(int -> core::result::t_Result) = { + (|_| { + let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Serial::serial(state,state_bytes)}; { - let res: core::result::t_Result = {core::result::and_then_under_impl(hoist6,hoist5)}; - (if core::result::is_err_under_impl(res){rust_primitives::hax::never_to_any(concordium_std::trap())} else {cast(concordium_std::types::tag_under_impl(act))}) + let _: tuple0 = { + (state_bytes = tmp0) + }; + out } - } + }) + }; + { + let res: core::result::t_Result< + tuple0, + tuple0, + > = { + core::result::and_then_under_impl(hoist6,hoist5) + }; + (if core::result::is_err_under_impl( + res, + ) { + rust_primitives::hax::never_to_any(hacspec_concordium::trap()) + } else { + cast(hacspec_concordium::concordium_types::tag_under_impl(act)) + }) } } } - core::result::Result_Err(reject) => { - let code: int = { - core::num::nonzero::get_under_impl_56(proj_concordium_std::types::Reject::f_error_code(core::convert::From::from(reject))) - }; - (if core::cmp::PartialOrd::lt(code, 0) { - code - } else { - rust_primitives::hax::never_to_any( - concordium_std::trap(), - ) - }) - } - }) + } } } - } + core::result::Result_Err(reject) => { + let code: int = { + core::num::nonzero::get_under_impl_56(proj_hacspec_concordium::concordium_types::Reject::f_error_code(core::convert::From::from(reject))) + }; + (if core::cmp::PartialOrd::lt(code, 0) { + code + } else { + rust_primitives::hax::never_to_any( + hacspec_concordium::trap(), + ) + }) + } + }) } - _ => rust_primitives::hax::never_to_any(concordium_std::trap()), + _ => rust_primitives::hax::never_to_any(hacspec_concordium::trap()), }) } } @@ -316,34 +324,20 @@ Equations export_register_vote_pre {L1 : {fset Location}} {I1 : Interface} (amou } : chString))) : both (L1) (I1) (int32). Fail Next Obligation. -(*(RefMut) The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* - - -####################################################### -########### WARNING: Failed running rustfmt ########### -#### STDOUT: - -#### STDERR: -error: expected identifier, found keyword `impl` - --> :1:125 - | -1 | ..._vote_pre(ctx: &impl HasReceiveContext,state: &mut hacspec_ovn::t_OvnCont... - | ^^^^ expected identifier, found keyword - -error: expected one of `,`, `:`, `=`, or `>`, found `HasReceiveContext` - --> :1:130 - | -1 | ...Anonymous: 'unk, Anonymous: 'unk, impl HasReceiveContext>(ctx: &impl HasReceiveContext,state: &mut hacspec_ovn::t_OvnContractState` -####################################################### - -*/ +(*item error backend*) -#[no_std()]#[feature(register_tool)]#[register_tool(_hax)]#[doc()]fn register_vote_pre(ctx: &impl HasReceiveContext,state: &mut hacspec_ovn::t_OvnContractState) -> core::result::t_Result where A:core::marker::t_Sized,A:core::marker::t_Sized,A:concordium_std::traits::t_HasActions,A:concordium_std::traits::t_HasReceiveContext,impl HasReceiveContext:core::marker::t_Sized,impl HasReceiveContext:core::marker::t_Sized,impl HasReceiveContext:concordium_std::traits::t_HasActions,impl HasReceiveContext:concordium_std::traits::t_HasReceiveContext{{let pat_ascription!(params as hacspec_ovn::t_RegisterParam): hacspec_ovn::t_RegisterParam = {(match core::ops::try_trait::Try::branch(concordium_contracts_common::traits::Get::get(&mut (concordium_std::traits::HasCommonData::parameter_cursor(&(deref(ctx)))))) {core::ops::control_flow::ControlFlow_Break(residual) => {rust_primitives::hax::never_to_any((return core::ops::try_trait::FromResidual::from_residual(residual)))},core::ops::control_flow::ControlFlow_Continue(val) => {val}})};{let _: tuple0 = {(deref(state).f_broadcast1_a[cast(proj_hacspec_ovn::RegisterParam::f_i(params))] = hacspec_ovn::Group::g_pow(proj_hacspec_ovn::RegisterParam::f_xi(params)))};{let _: tuple0 = {(deref(state).f_broadcast1_b[cast(proj_hacspec_ovn::RegisterParam::f_i(params))] = hacspec_ovn::v_ZKP(proj_hacspec_ovn::RegisterParam::f_xi(params)))};{core::result::Result_Ok(concordium_std::traits::HasActions::accept())}}}}} todo(item)*) +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Definition t_CastVoteParam : choice_type := + (int32 × int32 × 'bool). +Equations Build_t_CastVoteParam {L : {fset Location}} {I : Interface} (f_i : both L I (int32)) (f_xi : both L I (int32)) (f_vote : both L I ('bool)) : both L I (t_CastVoteParam) := + Build_t_CastVoteParam f_i f_xi f_vote := + bind_both f_vote (fun f_vote => + bind_both f_xi (fun f_xi => + bind_both f_i (fun f_i => + solve_lift (ret_both ((f_i,f_xi,f_vote) : (t_CastVoteParam)))))) : both L I (t_CastVoteParam). +Fail Next Obligation. (** Tool: no_std _ Tool: feature _ register_tool @@ -355,32 +349,41 @@ Fail Next Obligation. (** Tool: no_std _ Tool: feature _ register_tool -Tool: register_tool _ _hax -DocComment: Cramer, Damgård and Schoenmakers (CDS) technique **) -Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {I1 : Interface} (vi : both L1 I1 ('bool)) : both (L1) (I1) (int32) := - v_ZKP_one_out_of_two vi := - solve_lift (ret_both (32 : int32)) : both (L1) (I1) (int32). +Tool: register_tool _ _hax **) +Definition prod2_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := + (t_group_type ; 3%nat). +Definition prod1_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := + (t_group_type ; 2%nat). +Equations compute_group_element_for_vote {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq t_group_type 20)) : both (L1:|:L2:|:L3:|:L4 :|: fset [prod1_loc; prod2_loc]) (I1:|:I2:|:I3:|:I4) (t_group_type) := + compute_group_element_for_vote i xi vote xis := + letbm prod1 loc(prod1_loc) := one :of: t_group_type in + letb prod1 := foldi_both_list (into_iter (Build_t_Range (ret_both (0 : uint_size)) (cast_int (i .- (ret_both (1 : int32)))))) (fun {L I _ _} =>fun j => + ssp (fun prod1 => + solve_lift (prod prod1 (xis.a[j])))) prod1 :of: t_group_type in + letbm prod2 loc(prod2_loc) := one :of: t_group_type in + letb prod2 := foldi_both_list (into_iter (Build_t_Range (cast_int (i .+ (ret_both (1 : int32)))) n)) (fun {L I _ _} =>fun j => + ssp (fun prod2 => + solve_lift (prod prod2 (xis.a[j])))) prod2 :of: t_group_type in + letb Yi := div prod1 prod2 :of: t_group_type in + solve_lift (prod (pow Yi xi) (g_pow (ifb vote + then ret_both (1 : int32) + else ret_both (0 : int32)))) : both (L1:|:L2:|:L3:|:L4 :|: fset [prod1_loc; prod2_loc]) (I1:|:I2:|:I3:|:I4) (t_group_type). Fail Next Obligation. (** Tool: no_std _ Tool: feature _ register_tool Tool: register_tool _ _hax **) -Definition t_CastVoteParam : choice_type := - (int32 × int32 × 'bool). -Equations Build_t_CastVoteParam {L : {fset Location}} {I : Interface} (f_i : both L I (int32)) (f_xi : both L I (int32)) (f_vote : both L I ('bool)) : both L I (t_CastVoteParam) := - Build_t_CastVoteParam f_i f_xi f_vote := - bind_both f_vote (fun f_vote => - bind_both f_xi (fun f_xi => - bind_both f_i (fun f_i => - solve_lift (ret_both ((f_i,f_xi,f_vote) : (t_CastVoteParam)))))) : both L I (t_CastVoteParam). +Equations commit_to {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_group_type)) : both (L1) (I1) (int32) := + commit_to x := + solve_lift (ret_both (0 : int32)) : both (L1) (I1) (int32). Fail Next Obligation. (** Tool: no_std _ Tool: feature _ register_tool Tool: register_tool _ _hax Tool: export_name _ **) -Equations export_cast_vote {L1 : {fset Location}} {I1 : Interface} (amount : both L1 I1 (t_Amount)) : both (L1) (I1) (int32) := - export_cast_vote amount := +Equations export_commit_to_vote {L1 : {fset Location}} {I1 : Interface} (amount : both L1 I1 (t_Amount)) : both (L1) (I1) (int32) := + export_commit_to_vote amount := solve_lift (failure (ret_both ((LocalMutation) The bindings ["state_bytes"] cannot be mutated here: they don't belong to the closure scope, and this is not allowed. : chString)) (ret_both ({ let _: tuple0 = { @@ -389,27 +392,21 @@ Equations export_cast_vote {L1 : {fset Location}} {I1 : Interface} (amount : bot 0, ) { { - let hoist8: rust_primitives::hax::t_Never = { - (return core::num::nonzero::get_under_impl_56( - proj_concordium_std::types::Reject::f_error_code( - core::convert::From::from(concordium_std::types::NotPayableError()), - ), - )) - }; - rust_primitives::hax::never_to_any(hoist8) + let hoist9: rust_primitives::hax::t_Never = { (return 1) }; + rust_primitives::hax::never_to_any(hoist9) } }) }; { - let ctx: concordium_std::types::t_ExternContext< - concordium_std::types::t_ReceiveContextExtern, - > = { concordium_std::traits::HasReceiveContext::open(Tuple0()) }; + let ctx: hacspec_concordium::concordium_types::t_ExternContext< + hacspec_concordium::concordium_types::t_ReceiveContextExtern, + > = { hacspec_concordium::concordium_traits::HasReceiveContext::open(Tuple0()) }; { - let mut state_bytes: concordium_std::types::t_ContractState = - { concordium_std::traits::HasContractState::open(Tuple0()) }; + let mut state_bytes: hacspec_concordium::concordium_types::t_ContractState = + { hacspec_concordium::concordium_traits::HasContractState::open(Tuple0()) }; { let Tuple2(tmp0, out): tuple2< - concordium_std::types::t_ContractState, + hacspec_concordium::concordium_types::t_ContractState, core::result::t_Result< hacspec_ovn::t_OvnContractState< hacspec_ovn::t_z_17_, @@ -421,8 +418,8 @@ Equations export_cast_vote {L1 : {fset Location}} {I1 : Interface} (amount : bot { let _: tuple0 = { (state_bytes = tmp0) }; { - let hoist11: tuple2< - concordium_std::types::t_ContractState, + let hoist12: tuple2< + hacspec_concordium::concordium_types::t_ContractState, core::result::t_Result< hacspec_ovn::t_OvnContractState< hacspec_ovn::t_z_17_, @@ -431,71 +428,85 @@ Equations export_cast_vote {L1 : {fset Location}} {I1 : Interface} (amount : bot concordium_contracts_common::types::t_ParseError, >, > = { out }; - (match hoist11 { + (match hoist12 { core::result::Result_Ok(mut state) => { - { - let Tuple2(tmp0, out): tuple2< + let pat_ascription!( + res as core::result::t_Result< + tuple2< + hacspec_concordium::concordium_types::t_Action, + hacspec_ovn::t_OvnContractState< + hacspec_ovn::t_z_17_, + generic_value!(todo), + >, + >, + concordium_contracts_common::types::t_ParseError, + > + ): core::result::t_Result< + tuple2< + hacspec_concordium::concordium_types::t_Action, hacspec_ovn::t_OvnContractState< hacspec_ovn::t_z_17_, generic_value!(todo), >, - core::result::t_Result< - concordium_std::types::t_Action, - concordium_contracts_common::types::t_ParseError, - >, - > = { hacspec_ovn::cast_vote(ctx, state) }; - { - let _: tuple0 = { (state = tmp0) }; + >, + concordium_contracts_common::types::t_ParseError, + > = { hacspec_ovn::commit_to_vote(ctx, state) }; + (match res { + core::result::Result_Ok(Tuple2(act, state_res)) => { + let _: tuple0 = { (state = state_res) }; { - // Note: rhs.typ=tuple2, core::result::t_Result> - let pat_ascription!(res as core::result::t_Result): core::result::t_Result = {out}; - (match res { - core::result::Result_Ok(act) => { - let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Seek::seek(state_bytes,concordium_contracts_common::traits::SeekFrom_Start(0))}; + let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Seek::seek(state_bytes,concordium_contracts_common::traits::SeekFrom_Start(0))}; + { + let _: tuple0 = { (state_bytes = tmp0) }; + { + let hoist11: tuple2> = {out}; { - let _: tuple0 = - { (state_bytes = tmp0) }; - { - let hoist10: tuple2> = {out}; - { - let hoist9: arrow!(int -> core::result::t_Result) = { - (|_| { - let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Serial::serial(state,state_bytes)}; - { - let _: tuple0 = { - (state_bytes = - tmp0) - }; - out - } - }) - }; + let hoist10: arrow!(int -> core::result::t_Result) = { + (|_| { + let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Serial::serial(state,state_bytes)}; { - let res: core::result::t_Result = {core::result::and_then_under_impl(hoist10,hoist9)}; - (if core::result::is_err_under_impl(res){rust_primitives::hax::never_to_any(concordium_std::trap())} else {cast(concordium_std::types::tag_under_impl(act))}) + let _: tuple0 = { + (state_bytes = tmp0) + }; + out } - } + }) + }; + { + let res: core::result::t_Result< + tuple0, + tuple0, + > = { + core::result::and_then_under_impl(hoist11,hoist10) + }; + (if core::result::is_err_under_impl( + res, + ) { + rust_primitives::hax::never_to_any(hacspec_concordium::trap()) + } else { + cast(hacspec_concordium::concordium_types::tag_under_impl(act)) + }) } } } - core::result::Result_Err(reject) => { - let code: int = { - core::num::nonzero::get_under_impl_56(proj_concordium_std::types::Reject::f_error_code(core::convert::From::from(reject))) - }; - (if core::cmp::PartialOrd::lt(code, 0) { - code - } else { - rust_primitives::hax::never_to_any( - concordium_std::trap(), - ) - }) - } - }) + } } } - } + core::result::Result_Err(reject) => { + let code: int = { + core::num::nonzero::get_under_impl_56(proj_hacspec_concordium::concordium_types::Reject::f_error_code(core::convert::From::from(reject))) + }; + (if core::cmp::PartialOrd::lt(code, 0) { + code + } else { + rust_primitives::hax::never_to_any( + hacspec_concordium::trap(), + ) + }) + } + }) } - _ => rust_primitives::hax::never_to_any(concordium_std::trap()), + _ => rust_primitives::hax::never_to_any(hacspec_concordium::trap()), }) } } @@ -505,34 +516,172 @@ Equations export_cast_vote {L1 : {fset Location}} {I1 : Interface} (amount : bot } : chString))) : both (L1) (I1) (int32). Fail Next Obligation. -(*(RefMut) The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* - +(*item error backend*) -####################################################### -########### WARNING: Failed running rustfmt ########### -#### STDOUT: +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax +DocComment: Cramer, Damgård and Schoenmakers (CDS) technique **) +Equations v_ZKP_one_out_of_two {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (t_group_type)) (vi : both L2 I2 ('bool)) : both (L1:|:L2) (I1:|:I2) (int32) := + v_ZKP_one_out_of_two g_pow_vi vi := + solve_lift (ret_both (32 : int32)) : both (L1:|:L2) (I1:|:I2) (int32). +Fail Next Obligation. -#### STDERR: -error: expected identifier, found keyword `impl` - --> :1:117 - | -1 | ...cast_vote(ctx: &impl HasReceiveContext,state: &mut hacspec_ovn::t_OvnCont... - | ^^^^ expected identifier, found keyword +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax +Tool: export_name _ **) +Equations export_cast_vote {L1 : {fset Location}} {I1 : Interface} (amount : both L1 I1 (t_Amount)) : both (L1) (I1) (int32) := + export_cast_vote amount := + solve_lift (failure (ret_both ((LocalMutation) The bindings ["state_bytes"] cannot be mutated here: they don't belong to the closure scope, and this is not allowed. + : chString)) (ret_both ({ + let _: tuple0 = { + (if core::cmp::PartialEq::ne( + proj_concordium_contracts_common::types::Amount::f_micro_ccd(amount), + 0, + ) { + { + let hoist14: rust_primitives::hax::t_Never = { (return 1) }; + rust_primitives::hax::never_to_any(hoist14) + } + }) + }; + { + let ctx: hacspec_concordium::concordium_types::t_ExternContext< + hacspec_concordium::concordium_types::t_ReceiveContextExtern, + > = { hacspec_concordium::concordium_traits::HasReceiveContext::open(Tuple0()) }; + { + let mut state_bytes: hacspec_concordium::concordium_types::t_ContractState = + { hacspec_concordium::concordium_traits::HasContractState::open(Tuple0()) }; + { + let Tuple2(tmp0, out): tuple2< + hacspec_concordium::concordium_types::t_ContractState, + core::result::t_Result< + hacspec_ovn::t_OvnContractState< + hacspec_ovn::t_z_17_, + generic_value!(todo), + >, + concordium_contracts_common::types::t_ParseError, + >, + > = { concordium_contracts_common::traits::Get::get(state_bytes) }; + { + let _: tuple0 = { (state_bytes = tmp0) }; + { + let hoist17: tuple2< + hacspec_concordium::concordium_types::t_ContractState, + core::result::t_Result< + hacspec_ovn::t_OvnContractState< + hacspec_ovn::t_z_17_, + generic_value!(todo), + >, + concordium_contracts_common::types::t_ParseError, + >, + > = { out }; + (match hoist17 { + core::result::Result_Ok(mut state) => { + let pat_ascription!( + res as core::result::t_Result< + tuple2< + hacspec_concordium::concordium_types::t_Action, + hacspec_ovn::t_OvnContractState< + hacspec_ovn::t_z_17_, + generic_value!(todo), + >, + >, + concordium_contracts_common::types::t_ParseError, + > + ): core::result::t_Result< + tuple2< + hacspec_concordium::concordium_types::t_Action, + hacspec_ovn::t_OvnContractState< + hacspec_ovn::t_z_17_, + generic_value!(todo), + >, + >, + concordium_contracts_common::types::t_ParseError, + > = { hacspec_ovn::cast_vote(ctx, state) }; + (match res { + core::result::Result_Ok(Tuple2(act, state_res)) => { + let _: tuple0 = { (state = state_res) }; + { + let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Seek::seek(state_bytes,concordium_contracts_common::traits::SeekFrom_Start(0))}; + { + let _: tuple0 = { (state_bytes = tmp0) }; + { + let hoist16: tuple2> = {out}; + { + let hoist15: arrow!(int -> core::result::t_Result) = { + (|_| { + let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Serial::serial(state,state_bytes)}; + { + let _: tuple0 = { + (state_bytes = tmp0) + }; + out + } + }) + }; + { + let res: core::result::t_Result< + tuple0, + tuple0, + > = { + core::result::and_then_under_impl(hoist16,hoist15) + }; + (if core::result::is_err_under_impl( + res, + ) { + rust_primitives::hax::never_to_any(hacspec_concordium::trap()) + } else { + cast(hacspec_concordium::concordium_types::tag_under_impl(act)) + }) + } + } + } + } + } + } + core::result::Result_Err(reject) => { + let code: int = { + core::num::nonzero::get_under_impl_56(proj_hacspec_concordium::concordium_types::Reject::f_error_code(core::convert::From::from(reject))) + }; + (if core::cmp::PartialOrd::lt(code, 0) { + code + } else { + rust_primitives::hax::never_to_any( + hacspec_concordium::trap(), + ) + }) + } + }) + } + _ => rust_primitives::hax::never_to_any(hacspec_concordium::trap()), + }) + } + } + } + } + } + } : chString))) : both (L1) (I1) (int32). +Fail Next Obligation. -error: expected one of `,`, `:`, `=`, or `>`, found `HasReceiveContext` - --> :1:122 - | -1 | ...Anonymous: 'unk, Anonymous: 'unk, impl HasReceiveContext>(ctx: &impl HasReceiveContext,state: &mut hacspec_ovn::t_OvnContractState` -####################################################### +(*item error backend*) -*/ +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Equations check_valid2 {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (t_group_type)) (zkp : both L2 I2 (int32)) : both (L1:|:L2) (I1:|:I2) ('bool) := + check_valid2 g_pow_xi_yi_vi zkp := + solve_lift (ret_both (true : 'bool)) : both (L1:|:L2) (I1:|:I2) ('bool). +Fail Next Obligation. -#[no_std()]#[feature(register_tool)]#[register_tool(_hax)]#[doc()]fn cast_vote(ctx: &impl HasReceiveContext,state: &mut hacspec_ovn::t_OvnContractState) -> core::result::t_Result where A:core::marker::t_Sized,A:core::marker::t_Sized,A:concordium_std::traits::t_HasActions,A:concordium_std::traits::t_HasReceiveContext,impl HasReceiveContext:core::marker::t_Sized,impl HasReceiveContext:core::marker::t_Sized,impl HasReceiveContext:concordium_std::traits::t_HasActions,impl HasReceiveContext:concordium_std::traits::t_HasReceiveContext{{let pat_ascription!(params as hacspec_ovn::t_CastVoteParam): hacspec_ovn::t_CastVoteParam = {(match core::ops::try_trait::Try::branch(concordium_contracts_common::traits::Get::get(&mut (concordium_std::traits::HasCommonData::parameter_cursor(&(deref(ctx)))))) {core::ops::control_flow::ControlFlow_Break(residual) => {rust_primitives::hax::never_to_any((return core::ops::try_trait::FromResidual::from_residual(residual)))},core::ops::control_flow::ControlFlow_Continue(val) => {val}})};{let _: tuple0 = {{for zkp in (core::iter::traits::collect::IntoIterator::into_iter(proj_hacspec_ovn::OvnContractState::f_broadcast1_b(deref(state)))) { {let _: bool = {hacspec_ovn::check_valid(zkp)};{Tuple0()}} }}};{let mut prod1: int = {hacspec_ovn::Group::one()};{let _: tuple0 = {{for j in (core::iter::traits::collect::IntoIterator::into_iter(core::ops::range::Range{f_start:0,f_end:cast(core::ops::arith::Sub::sub(proj_hacspec_ovn::CastVoteParam::f_i(params),1)),})) { (prod1 = hacspec_ovn::Group::prod(prod1,core::ops::index::Index::index(proj_hacspec_ovn::OvnContractState::f_broadcast1_a(deref(state)),j))) }}};{let prod2: int = {hacspec_ovn::Group::one()};{let _: tuple0 = {{for j in (core::iter::traits::collect::IntoIterator::into_iter(core::ops::range::Range{f_start:cast(core::ops::arith::Add::add(proj_hacspec_ovn::CastVoteParam::f_i(params),1)),f_end:hacspec_ovn::n,})) { (prod2 = hacspec_ovn::Group::prod(prod2,core::ops::index::Index::index(proj_hacspec_ovn::OvnContractState::f_broadcast1_a(deref(state)),j))) }}};{let Yi: int = {hacspec_ovn::Group::div(prod1,prod2)};{let _: tuple0 = {(deref(state).f_broadcast2_a[cast(proj_hacspec_ovn::CastVoteParam::f_i(params))] = hacspec_ovn::Group::pow(Yi,proj_hacspec_ovn::CastVoteParam::f_xi(params)))};{let _: tuple0 = {(deref(state).f_broadcast2_b[cast(proj_hacspec_ovn::CastVoteParam::f_i(params))] = hacspec_ovn::Group::g_pow((if proj_hacspec_ovn::CastVoteParam::f_vote(params){{1}} else {{0}})))};{let _: tuple0 = {(deref(state).f_broadcast2_c[cast(proj_hacspec_ovn::CastVoteParam::f_i(params))] = hacspec_ovn::v_ZKP_one_out_of_two(proj_hacspec_ovn::CastVoteParam::f_vote(params)))};{core::result::Result_Ok(concordium_std::traits::HasActions::accept())}}}}}}}}}}}} todo(item)*) +(** Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Equations check_commitment {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (t_group_type)) (zkp : both L2 I2 (int32)) : both (L1:|:L2) (I1:|:I2) ('bool) := + check_commitment g_pow_xi_yi_vi zkp := + solve_lift (ret_both (true : 'bool)) : both (L1:|:L2) (I1:|:I2) ('bool). +Fail Next Obligation. (** Tool: no_std _ Tool: feature _ register_tool @@ -558,27 +707,21 @@ Equations export_tally_votes {L1 : {fset Location}} {I1 : Interface} (amount : b 0, ) { { - let hoist12: rust_primitives::hax::t_Never = { - (return core::num::nonzero::get_under_impl_56( - proj_concordium_std::types::Reject::f_error_code( - core::convert::From::from(concordium_std::types::NotPayableError()), - ), - )) - }; - rust_primitives::hax::never_to_any(hoist12) + let hoist19: rust_primitives::hax::t_Never = { (return 1) }; + rust_primitives::hax::never_to_any(hoist19) } }) }; { - let ctx: concordium_std::types::t_ExternContext< - concordium_std::types::t_ReceiveContextExtern, - > = { concordium_std::traits::HasReceiveContext::open(Tuple0()) }; + let ctx: hacspec_concordium::concordium_types::t_ExternContext< + hacspec_concordium::concordium_types::t_ReceiveContextExtern, + > = { hacspec_concordium::concordium_traits::HasReceiveContext::open(Tuple0()) }; { - let mut state_bytes: concordium_std::types::t_ContractState = - { concordium_std::traits::HasContractState::open(Tuple0()) }; + let mut state_bytes: hacspec_concordium::concordium_types::t_ContractState = + { hacspec_concordium::concordium_traits::HasContractState::open(Tuple0()) }; { let Tuple2(tmp0, out): tuple2< - concordium_std::types::t_ContractState, + hacspec_concordium::concordium_types::t_ContractState, core::result::t_Result< hacspec_ovn::t_OvnContractState< hacspec_ovn::t_z_17_, @@ -590,8 +733,8 @@ Equations export_tally_votes {L1 : {fset Location}} {I1 : Interface} (amount : b { let _: tuple0 = { (state_bytes = tmp0) }; { - let hoist15: tuple2< - concordium_std::types::t_ContractState, + let hoist22: tuple2< + hacspec_concordium::concordium_types::t_ContractState, core::result::t_Result< hacspec_ovn::t_OvnContractState< hacspec_ovn::t_z_17_, @@ -600,71 +743,85 @@ Equations export_tally_votes {L1 : {fset Location}} {I1 : Interface} (amount : b concordium_contracts_common::types::t_ParseError, >, > = { out }; - (match hoist15 { + (match hoist22 { core::result::Result_Ok(mut state) => { - { - let Tuple2(tmp0, out): tuple2< + let pat_ascription!( + res as core::result::t_Result< + tuple2< + hacspec_concordium::concordium_types::t_Action, + hacspec_ovn::t_OvnContractState< + hacspec_ovn::t_z_17_, + generic_value!(todo), + >, + >, + concordium_contracts_common::types::t_ParseError, + > + ): core::result::t_Result< + tuple2< + hacspec_concordium::concordium_types::t_Action, hacspec_ovn::t_OvnContractState< hacspec_ovn::t_z_17_, generic_value!(todo), >, - core::result::t_Result< - concordium_std::types::t_Action, - concordium_contracts_common::types::t_ParseError, - >, - > = { hacspec_ovn::tally_votes(ctx, state) }; - { - let _: tuple0 = { (state = tmp0) }; + >, + concordium_contracts_common::types::t_ParseError, + > = { hacspec_ovn::tally_votes(ctx, state) }; + (match res { + core::result::Result_Ok(Tuple2(act, state_res)) => { + let _: tuple0 = { (state = state_res) }; { - // Note: rhs.typ=tuple2, core::result::t_Result> - let pat_ascription!(res as core::result::t_Result): core::result::t_Result = {out}; - (match res { - core::result::Result_Ok(act) => { - let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Seek::seek(state_bytes,concordium_contracts_common::traits::SeekFrom_Start(0))}; + let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Seek::seek(state_bytes,concordium_contracts_common::traits::SeekFrom_Start(0))}; + { + let _: tuple0 = { (state_bytes = tmp0) }; + { + let hoist21: tuple2> = {out}; { - let _: tuple0 = - { (state_bytes = tmp0) }; - { - let hoist14: tuple2> = {out}; - { - let hoist13: arrow!(int -> core::result::t_Result) = { - (|_| { - let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Serial::serial(state,state_bytes)}; - { - let _: tuple0 = { - (state_bytes = - tmp0) - }; - out - } - }) - }; + let hoist20: arrow!(int -> core::result::t_Result) = { + (|_| { + let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Serial::serial(state,state_bytes)}; { - let res: core::result::t_Result = {core::result::and_then_under_impl(hoist14,hoist13)}; - (if core::result::is_err_under_impl(res){rust_primitives::hax::never_to_any(concordium_std::trap())} else {cast(concordium_std::types::tag_under_impl(act))}) + let _: tuple0 = { + (state_bytes = tmp0) + }; + out } - } + }) + }; + { + let res: core::result::t_Result< + tuple0, + tuple0, + > = { + core::result::and_then_under_impl(hoist21,hoist20) + }; + (if core::result::is_err_under_impl( + res, + ) { + rust_primitives::hax::never_to_any(hacspec_concordium::trap()) + } else { + cast(hacspec_concordium::concordium_types::tag_under_impl(act)) + }) } } } - core::result::Result_Err(reject) => { - let code: int = { - core::num::nonzero::get_under_impl_56(proj_concordium_std::types::Reject::f_error_code(core::convert::From::from(reject))) - }; - (if core::cmp::PartialOrd::lt(code, 0) { - code - } else { - rust_primitives::hax::never_to_any( - concordium_std::trap(), - ) - }) - } - }) + } } } - } + core::result::Result_Err(reject) => { + let code: int = { + core::num::nonzero::get_under_impl_56(proj_hacspec_concordium::concordium_types::Reject::f_error_code(core::convert::From::from(reject))) + }; + (if core::cmp::PartialOrd::lt(code, 0) { + code + } else { + rust_primitives::hax::never_to_any( + hacspec_concordium::trap(), + ) + }) + } + }) } - _ => rust_primitives::hax::never_to_any(concordium_std::trap()), + _ => rust_primitives::hax::never_to_any(hacspec_concordium::trap()), }) } } @@ -674,31 +831,4 @@ Equations export_tally_votes {L1 : {fset Location}} {I1 : Interface} (amount : b } : chString))) : both (L1) (I1) (int32). Fail Next Obligation. -(*(RefMut) The mutation of this &mut is not allowed here. - -Last available AST for this item: - -/* - - -####################################################### -########### WARNING: Failed running rustfmt ########### -#### STDOUT: - -#### STDERR: -error: expected identifier, found keyword `impl` - --> :1:119 - | -1 | ...lly_votes(_: &impl HasReceiveContext,state: &mut hacspec_ovn::t_OvnContra... - | ^^^^ expected identifier, found keyword - -error: expected one of `,`, `:`, `=`, or `>`, found `HasReceiveContext` - --> :1:124 - | -1 | ...Anonymous: 'unk, Anonymous: 'unk, impl HasReceiveContext>(_: &impl HasReceiveContext,state: &mut hacspec_ovn::t_OvnContractState` -####################################################### - -*/ - -#[no_std()]#[feature(register_tool)]#[register_tool(_hax)]#[doc()]fn tally_votes(_: &impl HasReceiveContext,state: &mut hacspec_ovn::t_OvnContractState) -> core::result::t_Result where A:core::marker::t_Sized,A:core::marker::t_Sized,A:concordium_std::traits::t_HasActions,A:concordium_std::traits::t_HasReceiveContext,impl HasReceiveContext:core::marker::t_Sized,impl HasReceiveContext:core::marker::t_Sized,impl HasReceiveContext:concordium_std::traits::t_HasActions,impl HasReceiveContext:concordium_std::traits::t_HasReceiveContext{{let Tuple3(g_pow_xi_yi, g_pow_vi, zkps): tuple3<[int;20], [int;20], [int;20]> = {Tuple3(proj_hacspec_ovn::OvnContractState::f_broadcast2_a(deref(state)),proj_hacspec_ovn::OvnContractState::f_broadcast2_b(deref(state)),proj_hacspec_ovn::OvnContractState::f_broadcast2_c(deref(state)))};{let _: tuple0 = {{for zkp in (core::iter::traits::collect::IntoIterator::into_iter(zkps)) { {let _: bool = {hacspec_ovn::check_valid(zkp)};{Tuple0()}} }}};{let mut vote_result: int = {hacspec_ovn::Group::one()};{let _: tuple0 = {{for i in (core::iter::traits::collect::IntoIterator::into_iter(core::ops::range::Range{f_start:0,f_end:core::slice::len_under_impl(rust_primitives::unsize(&(g_pow_vi))),})) { (vote_result = hacspec_ovn::Group::prod(vote_result,hacspec_ovn::Group::prod(core::clone::Clone::clone(&(core::ops::index::Index::index(g_pow_xi_yi,i))),core::clone::Clone::clone(&(core::ops::index::Index::index(g_pow_vi,i)))))) }}};{let mut tally: int = {0};{let _: tuple0 = {{for i in (core::iter::traits::collect::IntoIterator::into_iter(core::ops::range::Range{f_start:1,f_end:cast(hacspec_ovn::n),})) { {(if core::cmp::PartialEq::eq(hacspec_ovn::Group::g_pow(i),vote_result){{let _: tuple0 = {(tally = i)};Tuple0}})} }}};{let _: tuple0 = {(deref(state).f_tally = tally)};{core::result::Result_Ok(concordium_std::traits::HasActions::accept())}}}}}}}}} todo(item)*) +(*item error backend*) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_cast_vote.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_cast_vote.v index 55b3e69..cd256b5 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_cast_vote.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_cast_vote.v @@ -28,8 +28,8 @@ Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. Tool: no_std _ Tool: feature _ register_tool Tool: register_tool _ _hax **) -Require Import Concordium_std. -Export Concordium_std. +Require Import Hacspec_concordium. +Export Hacspec_concordium. (** Tool: export_name _ Tool: no_std _ diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_commit_to_vote.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_commit_to_vote.v new file mode 100644 index 0000000..cd256b5 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_commit_to_vote.v @@ -0,0 +1,60 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. + Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import Hacspec_concordium. +Export Hacspec_concordium. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import SeekFrom. +Export SeekFrom. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import ContractState. +Export ContractState. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import Logger. +Export Logger. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import trap. +Export trap. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_init_ovn_contract.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_init_ovn_contract.v index 4cc4a43..ce40928 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_init_ovn_contract.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_init_ovn_contract.v @@ -28,8 +28,8 @@ Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. Tool: no_std _ Tool: feature _ register_tool Tool: register_tool _ _hax **) -Require Import Concordium_std. -Export Concordium_std. +Require Import Hacspec_concordium. +Export Hacspec_concordium. (** Tool: export_name _ Tool: no_std _ diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote.v new file mode 100644 index 0000000..cd256b5 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote.v @@ -0,0 +1,60 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. + Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import Hacspec_concordium. +Export Hacspec_concordium. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import SeekFrom. +Export SeekFrom. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import ContractState. +Export ContractState. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import Logger. +Export Logger. + +(** Tool: export_name _ +Tool: no_std _ +Tool: feature _ register_tool +Tool: register_tool _ _hax **) +Require Import trap. +Export trap. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_tally_votes.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_tally_votes.v index 55b3e69..cd256b5 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_tally_votes.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_tally_votes.v @@ -28,8 +28,8 @@ Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. Tool: no_std _ Tool: feature _ register_tool Tool: register_tool _ _hax **) -Require Import Concordium_std. -Export Concordium_std. +Require Import Hacspec_concordium. +Export Hacspec_concordium. (** Tool: export_name _ Tool: no_std _ diff --git a/ovn/src/ovn_smart.rs b/ovn/src/ovn_smart.rs index 5396d3c..47d00e6 100644 --- a/ovn/src/ovn_smart.rs +++ b/ovn/src/ovn_smart.rs @@ -23,6 +23,7 @@ pub trait Group { // fn random_element() -> Self::group_type; } +#[derive(Clone, Copy)] pub struct z_17 {} impl Group for z_17 { type group_type = u32; @@ -79,7 +80,7 @@ impl Group for z_17 { // extern crate concordium_std; #[contract_state(contract = "OVN")] -#[derive(Serialize, SchemaType)] +#[derive(Serialize, SchemaType, Clone, Copy)] pub struct OvnContractState { g_pow_xis: [G::group_type; n], zkp_xis: [u32; n], @@ -120,17 +121,19 @@ const n: usize = 20; #[receive(contract = "OVN", name = "register", parameter = "RegisterParam")] pub fn register_vote( ctx: &impl HasReceiveContext, - state: &mut OvnContractState, -) -> Result { + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { let params: RegisterParam = ctx.parameter_cursor().get()?; // let xi = select_private_voting_key::(params.random); let g_pow_xi = G::g_pow(params.xi); let zkp_xi = ZKP::(g_pow_xi, params.xi); - state.g_pow_xis[params.i as usize] = g_pow_xi; - state.zkp_xis[params.i as usize] = zkp_xi; - Ok(A::accept()) + let mut state_ret = state.clone(); + state_ret.g_pow_xis[params.i as usize] = g_pow_xi; + state_ret.zkp_xis[params.i as usize] = zkp_xi; + + Ok((A::accept(), state_ret)) } #[derive(Serialize, SchemaType)] @@ -171,8 +174,8 @@ pub fn commit_to(x: G::group_type) -> u32 { #[receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] pub fn commit_to_vote( ctx: &impl HasReceiveContext, - state: &mut OvnContractState, -) -> Result { + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { let params: CastVoteParam = ctx.parameter_cursor().get()?; for zkp in state.zkp_xis { check_valid(zkp); @@ -183,8 +186,9 @@ pub fn commit_to_vote( compute_group_element_for_vote::(params.i, params.xi, params.vote, state.g_pow_xis); let commit_vi = commit_to::(g_pow_xi_yi_vi); - state.commit_vis[params.i as usize] = commit_vi; - Ok(A::accept()) + let mut state_ret = state.clone(); + state_ret.commit_vis[params.i as usize] = commit_vi; + Ok((A::accept(), state_ret)) } /** Cramer, Damgård and Schoenmakers (CDS) technique */ @@ -196,18 +200,19 @@ pub fn ZKP_one_out_of_two(g_pow_vi: G::group_type, vi: bool) -> u32 { #[receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] pub fn cast_vote( ctx: &impl HasReceiveContext, - state: &mut OvnContractState, -) -> Result { + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { let params: CastVoteParam = ctx.parameter_cursor().get()?; let g_pow_xi_yi_vi = compute_group_element_for_vote::(params.i, params.xi, params.vote, state.g_pow_xis); let zkp_vi = ZKP_one_out_of_two::(g_pow_xi_yi_vi, params.vote); - state.g_pow_xi_yi_vis[params.i as usize] = g_pow_xi_yi_vi; - state.zkp_vis[params.i as usize] = zkp_vi; + let mut state_ret = state.clone(); + state_ret.g_pow_xi_yi_vis[params.i as usize] = g_pow_xi_yi_vi; + state_ret.zkp_vis[params.i as usize] = zkp_vi; - Ok(A::accept()) + Ok((A::accept(),state_ret)) } pub fn check_valid2(g_pow_xi_yi_vi: G::group_type, zkp: u32) -> bool { @@ -223,8 +228,8 @@ pub struct TallyParameter {} /** Anyone can tally the votes */ pub fn tally_votes( _: &impl HasReceiveContext, - state: &mut OvnContractState, -) -> Result { + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { for i in 0..n { check_valid2::(state.g_pow_xi_yi_vis[i], state.zkp_vis[i]); check_commitment::(state.g_pow_xi_yi_vis[i], state.commit_vis[i]); @@ -243,9 +248,11 @@ pub fn tally_votes( tally = i; } } - state.tally = tally; - Ok(A::accept()) + let mut state_ret = state.clone(); + state_ret.tally = tally; + + Ok((A::accept(), state_ret)) } // #[cfg(test)] diff --git a/ovn/src/ovn_smart_concordium.rs b/ovn/src/ovn_smart_concordium.rs new file mode 100644 index 0000000..cd1203a --- /dev/null +++ b/ovn/src/ovn_smart_concordium.rs @@ -0,0 +1,306 @@ +#![no_std] + +// use core::*; +// use hacspec_lib::*; +// use creusot_contracts::*; + +use concordium_std::*; // ::{HasLogger, HasInitContext, Logger, HasContractState, Reject, Serial, Deserial, Read, ParseResult, Write, Get, ParseError, HasReceiveContext, HasActions, Seek, Action, ReceiveContextExtern, ExternContext, Vec, to_bytes, test_infrastructure::InitContextTest}; +use concordium_std_derive::*; + +/** Interface for group implementation */ +pub trait Group { + type group_type: PartialEq + Eq + Clone + Copy + concordium_std::Serialize; + + const q: u32; // Prime order + const g: Self::group_type; // Generator (elemnent of group) + + fn g_pow(x: u32) -> Self::group_type; + fn pow(g: Self::group_type, x: u32) -> Self::group_type; + fn one() -> Self::group_type; + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type; + fn inv(x: Self::group_type) -> Self::group_type; + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; + // fn random_element() -> Self::group_type; +} + +pub struct z_17 {} +impl Group for z_17 { + type group_type = u32; + + const q: u32 = 17; // Prime order + const g: Self::group_type = 3; // Generator (elemnent of group) + + fn g_pow(x: u32) -> Self::group_type { + (Self::g ^ x) % Self::q + } + + fn pow(g: Self::group_type, x: u32) -> Self::group_type { + (Self::g ^ x) % Self::q + } + + fn one() -> Self::group_type { + 1 + } + + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { + (x * y) % Self::q + } + + fn inv(x: Self::group_type) -> Self::group_type { + let mut res = 0; + for i in 1..Self::q { + if Self::pow(Self::g, i) == x { + res = i + } + } + Self::q - res + } + + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { + Self::prod(x, Self::inv(y)) + } + // fn random_element() -> Self::group_type { + + // } +} + +// struct eligible_votes { +// v_id : u32, +// } + +// /** number of parties */ +// const n : u32 = 3u32; +// const P : [eligible_votes; 3] = // n = 3 +// [eligible_votes {v_id: 0}, +// eligible_votes {v_id: 1}, +// eligible_votes {v_id: 2}]; + +// use concordium_contracts_common::*; +// extern crate concordium_std; + +#[contract_state(contract = "OVN")] +#[derive(Serialize, SchemaType)] +pub struct OvnContractState { + g_pow_xis: [G::group_type; n], + zkp_xis: [u32; n], + + commit_vis: [u32; n], + + g_pow_xi_yi_vis: [G::group_type; n], + zkp_vis: [u32; n], + + tally: u32, +} + +#[init(contract = "OVN")] +pub fn init_ovn_contract(ctx: &impl HasInitContext) -> Result { + Ok(true) +} + +/** Currently randomness needs to be injected */ +pub fn select_private_voting_key(random: u32) -> u32 { + random % G::q // x_i \in_R Z_q; +} + +/** TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics */ +pub fn ZKP(g_pow_xi: G::group_type, xi: u32) -> u32 { + 0 +} + +#[derive(Serialize, SchemaType)] +pub struct RegisterParam { + i: u32, + xi: u32, +} + +type G = z_17; +const n: usize = 20; + +/** Primary function in round 1 */ +#[receive(contract = "OVN", name = "register", parameter = "RegisterParam")] +pub fn register_vote( + ctx: &impl HasReceiveContext, + state: &mut OvnContractState, +) -> Result { + let params: RegisterParam = ctx.parameter_cursor().get()?; + + // let xi = select_private_voting_key::(params.random); + let g_pow_xi = G::g_pow(params.xi); + let zkp_xi = ZKP::(g_pow_xi, params.xi); + + state.g_pow_xis[params.i as usize] = g_pow_xi; + state.zkp_xis[params.i as usize] = zkp_xi; + Ok(A::accept()) +} + +#[derive(Serialize, SchemaType)] +pub struct CastVoteParam { + i: u32, + xi: u32, + vote: bool, +} + +pub fn check_valid(zkp: u32) -> bool { + true +} + +pub fn compute_group_element_for_vote( + i: u32, + xi: u32, + vote: bool, + xis: [G::group_type; n], +) -> G::group_type { + let mut prod1 = G::one(); + for j in 0..(i - 1) as usize { + prod1 = G::prod(prod1, xis[j]); + } + let mut prod2 = G::one(); + for j in (i + 1) as usize..n { + prod2 = G::prod(prod2, xis[j]); + } + let Yi = G::div(prod1, prod2); + // implicityly: Y_i = g^y_i + G::prod(G::pow(Yi, xi), G::g_pow(if vote { 1 } else { 0 })) +} + +pub fn commit_to(x: G::group_type) -> u32 { + 0 +} + +/** Commitment before round 2 */ +#[receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] +pub fn commit_to_vote( + ctx: &impl HasReceiveContext, + state: &mut OvnContractState, +) -> Result { + let params: CastVoteParam = ctx.parameter_cursor().get()?; + for zkp in state.zkp_xis { + check_valid(zkp); + () + } + + let g_pow_xi_yi_vi = + compute_group_element_for_vote::(params.i, params.xi, params.vote, state.g_pow_xis); + let commit_vi = commit_to::(g_pow_xi_yi_vi); + + state.commit_vis[params.i as usize] = commit_vi; + Ok(A::accept()) +} + +/** Cramer, Damgård and Schoenmakers (CDS) technique */ +pub fn ZKP_one_out_of_two(g_pow_vi: G::group_type, vi: bool) -> u32 { + 32 // TODO +} + +/** Primary function in round 2, also opens commitment */ +#[receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] +pub fn cast_vote( + ctx: &impl HasReceiveContext, + state: &mut OvnContractState, +) -> Result { + let params: CastVoteParam = ctx.parameter_cursor().get()?; + + let g_pow_xi_yi_vi = + compute_group_element_for_vote::(params.i, params.xi, params.vote, state.g_pow_xis); + let zkp_vi = ZKP_one_out_of_two::(g_pow_xi_yi_vi, params.vote); + + state.g_pow_xi_yi_vis[params.i as usize] = g_pow_xi_yi_vi; + state.zkp_vis[params.i as usize] = zkp_vi; + + Ok(A::accept()) +} + +pub fn check_valid2(g_pow_xi_yi_vi: G::group_type, zkp: u32) -> bool { + true +} + +pub fn check_commitment(g_pow_xi_yi_vi: G::group_type, zkp: u32) -> bool { + true +} + +pub struct TallyParameter {} +#[receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] +/** Anyone can tally the votes */ +pub fn tally_votes( + _: &impl HasReceiveContext, + state: &mut OvnContractState, +) -> Result { + for i in 0..n { + check_valid2::(state.g_pow_xi_yi_vis[i], state.zkp_vis[i]); + check_commitment::(state.g_pow_xi_yi_vis[i], state.commit_vis[i]); + () + } + + let mut vote_result = G::one(); + for g_pow_vote in state.g_pow_xi_yi_vis { + vote_result = G::prod(vote_result, g_pow_vote); + } + + let mut tally = 0; + for i in 0..n as u32 { + // Should be while, but is bounded by n anyways! + if G::g_pow(i) == vote_result { + tally = i; + } + } + state.tally = tally; + + Ok(A::accept()) +} + +// #[cfg(test)] +// #[concordium_test] +// pub fn test_correctness() { +// let randomness : Vec = Vec::new(); +// let votes : Vec = Vec::new(); + +// // Setup the context +// let mut ctx = InitContextTest::empty(); +// // ctx.set_sender(ADDRESS_0); + +// let mut state = init_ovn_contract(); + +// let xis = Vec::new(); +// for i in 0..n { +// xis.push(select_private_voting_key::(randomness[i])); +// } + +// for i in 0..n { +// let parameter = RegisterParam { i, xi: xis[i] }; +// let parameter_bytes = to_bytes(¶meter); +// ctx.set_parameter(¶meter_bytes); + +// register_vote(ctx, state); +// } + +// for i in 0..n { +// let parameter = CastVoteParam { i, xi: xis[i], vote: votes[i] }; +// let parameter_bytes = to_bytes(¶meter); +// ctx.set_parameter(¶meter_bytes); + +// commit_to_vote(ctx, state); +// } + +// for i in 0..n { +// let parameter = CastVoteParam { i, xi: xis[i], vote: votes[i] }; +// let parameter_bytes = to_bytes(¶meter); +// ctx.set_parameter(¶meter_bytes); + +// cast_vote(ctx, state); +// } + +// let parameter = TallyParameter {}; +// let parameter_bytes = to_bytes(¶meter); +// ctx.set_parameter(¶meter_bytes); + +// tally_votes(ctx, state); + +// let mut count = 0; +// for v in votes { +// if v { +// count = count + 1; // += 1 does not work correctly +// } +// } + +// claim_eq!(state.tally, count, "The tally should equal the number of positive votes"); +// } From 20787d5b67a01251751ebc6a2d24fb32356a8822 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Fri, 15 Sep 2023 13:12:40 +0200 Subject: [PATCH 20/86] Almost there --- ovn/Cargo.toml | 4 + ovn/concordium.org | 100 +- ovn/concordium_derive.org | 6 +- ovn/proofs/ssprove/extraction/ConCertLib.v | 140 +++ ovn/proofs/ssprove/extraction/Core.v | 169 ---- ovn/proofs/ssprove/extraction/Hacspec_lib.v | 200 +++- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 948 ++++-------------- .../Hacspec_ovn_Export_register_vote.v | 7 + .../ssprove/extraction/Hacspec_ovn_concert.v | 361 +++++++ ovn/proofs/ssprove/extraction/_CoqProject | 7 +- ovn/proofs/ssprove/extraction/missing.org | 25 + ovn/src/ovn_smart.rs | 208 ++-- 12 files changed, 1123 insertions(+), 1052 deletions(-) create mode 100644 ovn/proofs/ssprove/extraction/ConCertLib.v create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_concert.v create mode 100644 ovn/proofs/ssprove/extraction/missing.org diff --git a/ovn/Cargo.toml b/ovn/Cargo.toml index 4d8bed1..5b09ad8 100644 --- a/ovn/Cargo.toml +++ b/ovn/Cargo.toml @@ -9,6 +9,7 @@ path = "src/ovn_smart.rs" [dependencies] # hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } +hax-lib-macros = { path = "../../hacspec-v2/hax-lib-macros/" } # hax-lib-macros = { git = "https://github.com/hacspec/hacspec-v2.git" } # creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "1cca2320e262b2ec9d28b3c84cba759c96829898" } # branch = master # concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850" , version = "=2.0.0" , default-features = false } # 0cffb859f736ff6726fa38600428a415d800d7b6 @@ -25,3 +26,6 @@ quickcheck_macros = "1" [dev-dependencies] criterion = "0.4" rand = "0.8" + +[features] +hax_compilation = [] diff --git a/ovn/concordium.org b/ovn/concordium.org index 41ef0e6..2591944 100644 --- a/ovn/concordium.org +++ b/ovn/concordium.org @@ -46,7 +46,7 @@ path = "src/concordium.rs" [dependencies] hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } # hacspec-attributes = { path = "../../utils/attributes", version = "0.1.0-beta.1" , features = ["print_attributes", "hacspec_unsafe"] } # , features = ["hacspec_unsafe"] , , optional = true -creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "7763b3ae77205fba83182b9a6c3e69ad0b12fec7" } +# creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "7763b3ae77205fba83182b9a6c3e69ad0b12fec7" } concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850", version = "=2.0.0", default-features = false } hacspec-concordium-derive = { path = "../concordium-derive" } @@ -200,10 +200,10 @@ extern crate hacspec_lib; // #[cfg(feature = "hacspec")] // use hacspec_attributes::*; -#[cfg(not(feature = "hacspec"))] -extern crate creusot_contracts; -#[cfg(not(feature = "hacspec"))] -use creusot_contracts::*; // {ensures, trusted}; // requires, +// #[cfg(not(feature = "hacspec"))] +// extern crate creusot_contracts; +// #[cfg(not(feature = "hacspec"))] +// use creusot_contracts::*; // {ensures, trusted}; // requires, #+END_SRC ** Coq code @@ -1007,27 +1007,27 @@ Coerce for public byte sequences. Extern accept #+begin_src rust - #[cfg(not(feature = "hacspec"))] - extern "C" { - pub(crate) fn accept() -> u32; - } +#[cfg(not(feature = "hacspec"))] +extern "C" { + pub(crate) fn accept() -> u32; +} - #[cfg(not(feature = "hacspec"))] - #[trusted] - pub(crate) fn accept_creusot() -> u32 { - unsafe { accept() } - } +#[cfg(not(feature = "hacspec"))] +// #[trusted] +pub(crate) fn accept_creusot() -> u32 { + unsafe { accept() } +} - #[cfg(feature = "hacspec")] - pub(crate) fn accept_hacspec() -> u32 { - 1u32 - } +#[cfg(feature = "hacspec")] +pub(crate) fn accept_hacspec() -> u32 { + 1u32 +} + +#[cfg(not(feature = "hacspec"))] +pub(crate) fn accept_hacspec() -> u32 { + accept_creusot() +} - #[cfg(not(feature = "hacspec"))] - pub(crate) fn accept_hacspec() -> u32 { - accept_creusot() - } - #+end_src Extern simple transfer #+begin_src rust @@ -1038,7 +1038,7 @@ Extern simple transfer } #[cfg(not(feature = "hacspec"))] - #[trusted] + // #[trusted] pub(crate) fn simple_transfer_creusot(addr_bytes: *const u8, amount: u64) -> u32 { unsafe { simple_transfer(addr_bytes, amount) } } @@ -1072,7 +1072,7 @@ Extern send } #[cfg(not(feature = "hacspec"))] - #[trusted] + // #[trusted] pub(crate) fn send_creusot( addr_index: u64, addr_subindex: u64, @@ -1120,7 +1120,7 @@ extern "C" { } #[cfg(not(feature = "hacspec"))] -#[trusted] +// #[trusted] pub(crate) fn combine_and_creusot(l: u32, r: u32) -> u32 { unsafe { combine_and(l, r) } } @@ -1146,7 +1146,7 @@ extern "C" { } #[cfg(not(feature = "hacspec"))] -#[trusted] +// #[trusted] pub(crate) fn combine_or_creusot(l: u32, r: u32) -> u32 { unsafe { combine_or(l, r) } } @@ -1171,7 +1171,7 @@ Extern parameter size } #[cfg(not(feature = "hacspec"))] - #[trusted] + // #[trusted] pub(crate) fn get_parameter_size_creusot() -> u32 { unsafe { get_parameter_size() } } @@ -1198,7 +1198,7 @@ Extern for parameter section } #[cfg(not(feature = "hacspec"))] - #[trusted] + // #[trusted] pub(crate) fn get_parameter_section_creusot(start: *mut u8, length: u32, offset: u32) -> u32 { unsafe { get_parameter_section(start, length, offset) } } @@ -1230,7 +1230,7 @@ Get policy section extern } #[cfg(not(feature = "hacspec"))] - #[trusted] + // #[trusted] pub(crate) fn get_policy_section_creusot(policy_bytes: *mut u8, length: u32, offset: u32) -> u32 { unsafe { get_policy_section(policy_bytes, length, offset) } } @@ -1263,7 +1263,7 @@ Log event extern } #[cfg(not(feature = "hacspec"))] - #[trusted] + // #[trusted] pub(crate) fn log_event_creusot(start: *const u8, length: u32) -> i32 { unsafe { log_event(start, length) } } @@ -1289,7 +1289,7 @@ extern "C" { } #[cfg(not(feature = "hacspec"))] -#[trusted] +// #[trusted] pub(crate) fn load_state_creusot(start: *mut u8, length: u32, offset: u32) -> u32 { unsafe { load_state(start, length, offset) } } @@ -1314,7 +1314,7 @@ extern "C" { } #[cfg(not(feature = "hacspec"))] -#[trusted] +// #[trusted] pub(crate) fn write_state_creusot(start: *mut u8, length: u32, offset: u32) -> u32 { unsafe { write_state(start, length, offset) } } @@ -1342,7 +1342,7 @@ Resize state extern } #[cfg(not(feature = "hacspec"))] - #[trusted] + // #[trusted] pub(crate) fn resize_state_creusot(new_size: u32) -> u32 { unsafe { resize_state(new_size) } } @@ -1365,7 +1365,7 @@ extern "C" { } #[cfg(not(feature = "hacspec"))] -#[trusted] +// #[trusted] pub(crate) fn state_size_creusot() -> u32 { unsafe { state_size() } } @@ -1390,7 +1390,7 @@ Get init origin extern } #[cfg(not(feature = "hacspec"))] - #[trusted] + // #[trusted] pub(crate) fn get_init_origin_creusot(start: *mut u8) { unsafe { get_init_origin(start) } } @@ -1417,7 +1417,7 @@ Get receive invoker extern } #[cfg(not(feature = "hacspec"))] - #[trusted] + // #[trusted] pub(crate) fn get_receive_invoker_creusot(start: *mut u8) { unsafe { get_receive_invoker(start) } } @@ -1444,7 +1444,7 @@ Get receive self address extern } #[cfg(not(feature = "hacspec"))] - #[trusted] + // #[trusted] pub(crate) fn get_receive_self_address_creusot(start: *mut u8) { unsafe { get_receive_self_address(start) } } @@ -1471,7 +1471,7 @@ Get receive self balance extern } #[cfg(not(feature = "hacspec"))] - #[trusted] + // #[trusted] pub(crate) fn get_receive_self_balance_creusot() -> u64 { unsafe { get_receive_self_balance() } } @@ -1496,7 +1496,7 @@ Get receive sender extern } #[cfg(not(feature = "hacspec"))] - #[trusted] + // #[trusted] pub(crate) fn get_receive_sender_creusot(start: *mut u8) { unsafe { get_receive_sender(start) } } @@ -1523,7 +1523,7 @@ extern "C" { } #[cfg(not(feature = "hacspec"))] -#[trusted] +// #[trusted] pub(crate) fn get_receive_owner_creusot(start: *mut u8) { unsafe { get_receive_owner(start) } } @@ -1550,7 +1550,7 @@ Get slot time extern } #[cfg(not(feature = "hacspec"))] - #[trusted] + // #[trusted] pub(crate) fn get_slot_time_creusot() -> u64 { unsafe { get_slot_time() } } @@ -1770,8 +1770,8 @@ pub fn new_reject_impl(x: i32) -> Option:: { // Option We define the coercion function for Reject, and implement the traits #+begin_src rust #[cfg(not(feature = "hacspec"))] -#[trusted] -#[ensures(!(result == 0i32))] +// #[trusted] +// #[ensures(!(result == 0i32))] pub fn non_zero_i32(v : i32) -> NonZeroI32 { unsafe { NonZeroI32::new_unchecked(v) } } @@ -1787,12 +1787,12 @@ pub fn coerce_hacspec_to_rust_reject(hacspec_reject: RejectHacspec) -> Reject { **** Reject - From trait We modle the unsafe block with unchecked non zero as a precondition using requires giving us the hacspec equivalent #+begin_src rust -#[ensures(!(result == 0i32))] // != +// #[ensures(!(result == 0i32))] // != pub fn reject_impl_convert_from_unit() -> RejectHacspec { -2_147_483_648i32 + 1i32 // i32::MIN } -#[ensures(!(result == 0i32))] // != +// #[ensures(!(result == 0i32))] // != pub fn reject_impl_convert_from_parse_error() -> RejectHacspec { -2_147_483_648i32 + 2i32 // i32::MIN } @@ -1817,7 +1817,7 @@ impl convert::From for Reject { #+end_src We define a log error type and function converting from it to the reject type #+begin_src rust -#[ensures(!(result == 0i32))] // != +// #[ensures(!(result == 0i32))] // != pub fn reject_impl_from_log_error(le: LogError) -> RejectHacspec { match le { LogError::Full => -2_147_483_648i32 + 3i32, // i32::MIN @@ -1848,7 +1848,7 @@ pub enum NewContractNameError { NewContractNameErrorInvalidCharacters, } -#[ensures(!(result == 0i32))] // != +// #[ensures(!(result == 0i32))] // != pub fn reject_impl_from_new_contract_name_error(nre: NewContractNameError) -> RejectHacspec { match nre { NewContractNameError::NewContractNameErrorMissingInitPrefix => -2_147_483_648i32 + 5i32, // i32::MIN @@ -1882,7 +1882,7 @@ pub enum NewReceiveNameError { NewReceiveNameErrorInvalidCharacters, } -#[ensures(!(result == 0i32))] // != +// #[ensures(!(result == 0i32))] // != pub fn reject_impl_from_new_receive_name_error(nre: NewReceiveNameError) -> RejectHacspec { match nre { NewReceiveNameError::NewReceiveNameErrorMissingDotSeparator => -2_147_483_648i32 + 7i32, // i32::MIN @@ -1908,7 +1908,7 @@ We then implement the traits We then implement the traits #+begin_src rust -#[ensures(!(result == 0i32))] // != +// #[ensures(!(result == 0i32))] // != pub fn reject_impl_from_not_payable_error() -> RejectHacspec { -2_147_483_648i32 + 12i32 // i32::MIN } diff --git a/ovn/concordium_derive.org b/ovn/concordium_derive.org index 46f359f..0a33d01 100644 --- a/ovn/concordium_derive.org +++ b/ovn/concordium_derive.org @@ -24,12 +24,12 @@ proc-macro = true [dependencies] hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } # hacspec-attributes = { path = "../../utils/attributes", version = "0.1.0-beta.1" , features = ["print_attributes", "hacspec_unsafe"] } # , features = ["hacspec_unsafe"] , , optional = true -creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "7763b3ae77205fba83182b9a6c3e69ad0b12fec7" } +# creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "7763b3ae77205fba83182b9a6c3e69ad0b12fec7" } concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850" , version = "=2.0.0" , default-features = false } # hacspec-concordium = { path = "../concordium" } syn = { version = "1.0.63", features = [ "full", "extra-traits" ] } -quote = "=1.0.0" -proc-macro2 = "1.0" +quote = "*" # "=1.0.0" +proc-macro2 = "*" # "1.0" # Reduce code size, at the cost of performance in allocation heavy-code. wee_alloc="0.4.5" diff --git a/ovn/proofs/ssprove/extraction/ConCertLib.v b/ovn/proofs/ssprove/extraction/ConCertLib.v new file mode 100644 index 0000000..4b0dbf3 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/ConCertLib.v @@ -0,0 +1,140 @@ +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. + Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +From Coq Require Import Morphisms ZArith. +From Coq Require Import List. +Import ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. +Open Scope hacspec_scope. + +(* From QuickChick Require Import QuickChick. *) +(* Require Import QuickChickLib. *) + +From ConCert.Execution Require Import Serializable. +From ConCert.Execution Require Import Blockchain. + +(* Require Import Hacspec_Concordium. *) +(* Export Hacspec_Concordium. *) + +Global Program Instance int_serializable {ws : wsize} : Serializable (int ws) := + {| serialize m := (serialize (unsigned m)) ; + deserialize l := option_map (fun (x : Z) => @repr ws x) (deserialize l) |}. +Next Obligation. + intros. hnf. rewrite deserialize_serialize. + unfold option_map. now rewrite wrepr_unsigned. +Defined. + +(* Global Program Instance nseq_serializable len : Serializable (nseq int8 len) := *) +(* {| serialize m := (serialize (nat_from_be_bytes m)) ; *) +(* deserialize l := option_map (fun (x : nat) => nat_to_be_bytes x) (deserialize l) |}. *) +(* Next Obligation. *) +(* intros. cbn. rewrite deserialize_serialize. cbn. rewrite nat_to_from_be_bytes. reflexivity. *) +(* Defined. *) + +(* Global Program Instance nseq_countable len : countable.Countable (nseq int8 len) := *) +(* {| *) +(* countable.encode := fun X : nseq int8 _ => countable.encode (nat_from_be_bytes X); *) +(* countable.decode := fun H : positive => option_map (@nat_to_be_bytes _) (countable.decode H : option nat); *) +(* |}. *) +(* Next Obligation. *) +(* intros. *) +(* rewrite countable.decode_encode. *) +(* cbn. *) +(* now rewrite nat_to_from_be_bytes. *) +(* Qed. *) + +Instance BaseTypes : ChainBase := {| + Address := int32; + address_eqb := Hacspec_Lib_Comparable.eqb ; + address_eqb_spec := Hacspec_Lib_Comparable.eqbP ; + (* address_eqdec x y := (EqDecIsDecidable x y); *) + address_countable := (* nseq_countable *) _; + address_serializable := (* nseq_serializable *) _; + address_is_contract := (fun x => Nat.even ((* nat_from_be_bytes x *) Z.to_nat (unsigned x))); |}. + +(* Definition context_t_from_context (ctx : ContractCallContext) : context_t := *) +(* (ctx.(ctx_from), ctx.(ctx_origin), repr (ctx.(ctx_amount))). *) + +(* Definition accept (ctx : ContractCallContext) := act_transfer ctx.(ctx_origin) ctx.(ctx_amount). *) + +(* Definition has_action_t := ActionBody. *) + +(* Definition action_body_t := ActionBody. *) +(* Definition list_action_t := list ActionBody. *) +(* Definition ACT_TRANSFER (p : Address ∏ int64) := act_transfer (fst p) (unsigned (snd p)). *) +(* Instance d_ab : Default ActionBody := {| default := act_transfer (array_new_ (default : int8) 32) 0 |}. *) + +(* Program Definition to_action_body (ctx : ContractCallContext) (y : has_action_t) : ActionBody := *) +(* match y with *) +(* | (Accept _) => act_transfer (ctx.(ctx_from)) (ctx.(ctx_amount)) *) +(* | (SimpleTransfer (ua, i)) => act_transfer (ua) (i) *) +(* | (SendRaw (ua, receive_name, amount, data)) => *) +(* act_call (ua) (amount) (list_rect (fun _ : list int8 => SerializedValue) *) +(* (build_ser_value ser_unit tt) *) +(* (fun a _ IHdata => *) +(* build_ser_value *) +(* (ser_pair ser_int (ser_value_type IHdata)) *) +(* (unsigned a, ser_value IHdata)) *) +(* data) *) +(* end. *) +(* Instance default_has_action : Default has_action_t := {| default := Accept tt |}. *) + +(* Global Instance serializable_has_action_t : Serializable has_action_t := *) +(* Derive Serializable has_action_t_rect. *) +(* Global Instance show_has_action_t : Show (has_action_t) := *) +(* @Build_Show (has_action_t) (fun x => *) +(* match x with *) +(* Accept a => ("Accept" ++ show a)%string *) +(* | SimpleTransfer a => ("SimpleTransfer" ++ show a)%string *) +(* | SendRaw a => ("SendRaw" ++ show a)%string *) +(* end). *) +(* Definition g_has_action_t : G (has_action_t) := oneOf_ (bindGen arbitrary (fun a => returnGen (Accept a))) [bindGen arbitrary (fun a => returnGen (Accept a));bindGen arbitrary (fun a => returnGen (SimpleTransfer a))]. *) +(* Global Instance gen_has_action_t : Gen (has_action_t) := Build_Gen has_action_t g_has_action_t. *) + +(* Definition to_action_body_list (ctx : ContractCallContext) {X} (k : option (X ∏ list has_action_t)) : ResultMonad.result (X ∏ list ActionBody) unit := *) +(* match (option_map (fun '(x, y) => (x, List.map (to_action_body ctx) y)) k) with *) +(* Some a => ResultMonad.Ok a *) +(* | None => ResultMonad.Err tt *) +(* end. *) + + +(* Instance show_user_address_t : Show (user_address_t) := Build_Show (user_address_t) show. *) +(* Definition g_user_address_t : G (user_address_t) := arbitrary. *) +(* Instance gen_user_address_t : Gen (user_address_t) := Build_Gen user_address_t g_user_address_t. *) + +(* Global Instance serializable_context_t : Serializable context_t := *) +(* Derive Serializable context_t_rect. *) +(* Global Instance show_context_t : Show (context_t) := *) +(* @Build_Show (context_t) (fun x => *) +(* match x with *) +(* Context a => ("Context" ++ show a)%string *) +(* end). *) +(* Definition g_context_t : G (context_t) := oneOf_ (bindGen arbitrary (fun a => returnGen (Context a))) [bindGen arbitrary (fun a => returnGen (Context a))]. *) +(* Global Instance gen_context_t : Gen (context_t) := Build_Gen context_t g_context_t. *) diff --git a/ovn/proofs/ssprove/extraction/Core.v b/ovn/proofs/ssprove/extraction/Core.v index 0f7bb8f..30f08d3 100644 --- a/ovn/proofs/ssprove/extraction/Core.v +++ b/ovn/proofs/ssprove/extraction/Core.v @@ -37,172 +37,3 @@ Open Scope nat_scope. (* Require Import Hacspec_Lib_Comparable. *) Import choice.Choice.Exports. - -Class t_TryFrom (A : choice_type) := TryFrom : A -> A. -Class t_Into (A : choice_type) := Into : A -> A. -Class t_PartialEq (A : choice_type) := PartialEq : A -> A. -Class t_Copy (A : choice_type) := Copy : A -> A. -Class t_Clone (A : choice_type) := Clone : A -> A. -Class t_Sized (A : choice_type) := Sized : A -> A. -Definition t_Option : choice_type -> choice_type := chOption. -Inductive vec_typ := -| t_Global. -Definition t_Vec : choice_type -> vec_typ -> choice_type := fun A _ => chList A. - -Class t_Default A := { default : A }. - -#[global] Instance bool_copy : t_Copy 'bool := {Copy x := x}. -#[global] Instance bool_clone : t_Clone 'bool := {Clone x := x}. -#[global] Instance bool_sized : t_Sized 'bool := {Sized x := x}. - -Definition ilog2 {WS} {L I} (x : both L I (int WS)) : both L I (int WS) := x. (* TODO *) - -Definition collect {A} {L I} (x : both L I (chList A)) : both L I (t_Vec A t_Global) := x. - - -Equations swap_both_list {A L I} (x : list (both L I A)) : both L I (chList A) := - swap_both_list x := - (List.fold_left (fun (x : both L I (chList A)) y => - bind_both x (fun x' => - bind_both y (fun y' => - solve_lift (ret_both ((y' :: x') : chList A))))) x (solve_lift (ret_both ([] : chList A)))). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Equations match_list {A B : choice_type} {L I} (x : both L I (chList A)) (f : list A -> B) : both L I B := - match_list x f := - bind_both x (fun x' => solve_lift (ret_both (f x'))). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Equations map {A B} {L I} (x : both L I (chList A)) (f : both L I A -> both L I B) : both L I (chList B) := - map x f := - bind_both x (fun x' => swap_both_list (List.map (fun y => f (solve_lift (ret_both y))) x')). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Definition cloned {A} {L I} (x : both L I (chList A)) : both L I (chList A) := x. - -Equations iter {A L I} (x : both L I (seq A)) : both L I (chList A) := - iter x := - bind_both x (fun x' => solve_lift (ret_both (seq_to_list _ x' : chList A))). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Definition dedup {A} {L I} (x : both L I (t_Vec A t_Global)) : both L I (t_Vec A t_Global) := x. - -Definition t_String := Coq.Strings.String.string. -Program Definition new {A L I} : both L I (t_Vec A t_Global) := solve_lift (ret_both ([] : chList A)). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Definition enumerate {A} {L I} (x : both L I (t_Vec A t_Global)) : both L I (t_Vec A t_Global) := x. - -Definition t_Result A B := result B A. -Inductive ControlFlow {L I} (A : choice_type) (B : choice_type) := -| ControlFlow_Continue (val : both L I A) -| ControlFlow_Break (val : both L I B). - -Definition run {A B : choice_type} {L I} (x : ControlFlow A B) : both L I (t_Result A B) := - match x with - | ControlFlow_Continue v => Ok v - | ControlFlow_Break v => Err v - end. - -(* Program Definition build_under_impl_1 {A B} : (t_Result A B) := *) -(* run (letb layers := (match branch (build_tree_under_impl_1 partial_layers depth) with *) -(* | ControlFlow_Break residual => letb hoist1 := (v_Break (from_residual residual)) : both _ _ (t_Never) in *) -(* ControlFlow_Continue (never_to_any hoist1) *) -(* | ControlFlow_Continue val => ControlFlow_Continue val *) -(* end) in *) -(* ControlFlow_Continue (Result_Ok (Build_PartialTree layers))). *) -(* Fail Next Obligation. *) - -(** How to handle enums: **) - -(* Inductive t_ErrorKind : Type := *) -(* | ErrorKind_SerializedProofSizeIsIncorrectt_ErrorKind *) -(* | ErrorKind_NotEnoughHelperNodest_ErrorKind *) -(* | ErrorKind_HashConversionErrort_ErrorKind *) -(* | ErrorKind_NotEnoughHashesToCalculateRoott_ErrorKind *) -(* | ErrorKind_LeavesIndicesCountMismatcht_ErrorKind. *) - -Definition t_ErrorKind : choice_type := chFin (mkpos 5). -Program Definition ErrorKind_SerializedProofSizeIsIncorrect {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=0) eq_refl : t_ErrorKind)). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Program Definition ErrorKind_NotEnoughHelperNodes {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=1) eq_refl : t_ErrorKind)). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Program Definition ErrorKind_HashConversionError {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=2) eq_refl : t_ErrorKind)). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Program Definition ErrorKind_NotEnoughHashesToCalculateRoot {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=3) eq_refl : t_ErrorKind)). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Program Definition ErrorKind_LeavesIndicesCountMismatch {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=4) eq_refl : t_ErrorKind)). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -(** How to handle records: **) -(* TODO: Remove them as a phase? *) - -(* Record t_Error : Type := { *) -(* f_kind1 : t_ErrorKind *) -(* f_kind2 : t_ErrorKind *) -(* }. *) - -Definition t_Error : choice_type := t_ErrorKind × t_ErrorKind. -(* Uncurry is Build_.. fn *) -Equations Build_Error {L I} {f_kind1 : both L I t_ErrorKind} {f_kind2 : both L I t_ErrorKind} : both L I t_Error := - Build_Error (f_kind1 := x) (f_kind2 := y) := - bind_both x (fun x' => - bind_both y (fun y' => - solve_lift (ret_both ((x', y') : t_Error)))). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. -Definition f_kind1 (v : t_Error) := fst v. -Definition f_kind2 (v : t_Error) := snd v. -(* Make into tuple struct with named projctions! *) - -(*** More functions *) -Definition t_Drain : choice_type -> vec_typ -> choice_type := t_Vec. -Inductive t_Range := RangeFull. -Equations drain : forall {L I A}, both L I (t_Vec A t_Global) -> t_Range -> both L I (t_Drain A t_Global × t_Vec A t_Global) := - drain x _ := - bind_both x (fun x' => solve_lift (ret_both ((x', []) : (t_Drain A t_Global × t_Vec A t_Global)))). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. -Notation t_Rev := id. -Equations rev {L I A} (x : both L I (chList A)) : both L I (chList A) := rev x := bind_both x (fun x => solve_lift (ret_both (List.rev x : chList _))). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Definition pop {L I A} : both L I (chList A) -> both L I (chOption A × t_Vec A (t_Global)) := - lift1_both (fun (x : chList A) => (List.hd_error x , List.tl x) : (chOption A × t_Vec A (t_Global))). - -Definition push {L1 L2 I1 I2 A} : both L1 I1 (t_Vec A t_Global) -> both L2 I2 A -> both (L1 :|: L2) (I1 :|: I2) (t_Vec A (t_Global)) := - lift2_both (fun (x : chList A) y => y :: x : chList A). - -Notation Option_Some := Some. -Definition append {L1 L2 I1 I2} {A : choice_type} (l : both L1 I1 (chList A)) (x : both L2 I2 (chList A)) : both (L2 :|: L1) (I2 :|: I1) (chList A × chList A) := - lift2_both (fun (x : chList A) (y : chList A) => (app y x, []) : chList A × chList A) x l. - -Notation clone := id. -Definition seq_unzip {A B} (s : chList (A × B)) : chList A × chList B := (seq.unzip1 s, seq.unzip2 s). -Definition unzip {L I} {A B} : both L I (chList (A × B)) -> both L I (chList A × chList B) := lift1_both seq_unzip. -Equations deref {L I A} : both L I (t_Vec A t_Global) -> both L I (seq A) := - deref X := bind_both X (fun x : t_Vec A t_Global => solve_lift (ret_both (seq_from_list A x))). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. -Definition t_Never := False. -Notation v_Break := id. -Notation Result_Err := Err. -Definition never_to_any := tt. -Notation Result_Ok := Ok. - -Notation "'ret_both' 'tt'" := (ret_both (tt : 'unit)). diff --git a/ovn/proofs/ssprove/extraction/Hacspec_lib.v b/ovn/proofs/ssprove/extraction/Hacspec_lib.v index 3456657..f1ee22b 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_lib.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_lib.v @@ -279,11 +279,13 @@ Defined. Notation " x '.a[' a ']'" := (array_index (n_seq_array_or_seq x _) a) (at level 40). -Program Definition (* Equations *) array_upd {A: choice_type} {len : uint_size} {L I} (s: both L I (nseq A len)) {WS} (i: both L I (@int WS)) (new_v: both L I A) : both L I (nseq A len) := +Program Definition (* Equations *) array_upd {A: choice_type} {len : uint_size} {L1 L2 L3 I1 I2 I3} (s: both L1 I1 (nseq A len)) {WS} (i: both L2 I2 (@int WS)) (new_v: both L3 I3 A) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (nseq A len) := (* array_upd s i new_v := *) Hacspec_Lib.array_upd s i new_v. Fail Next Obligation. Notation " x '.a[' i ']<-' a" := (array_upd x i a) (at level 40). +Notation update_at := array_upd. + (* Definition update {A : Type} `{Default A} {len slen} (s : nseq A len) {WS} (start : @int WS) (start_a : array_or_seq A slen) : nseq A len := *) (* array_update (a := A) (len := len) s (unsigned start) (as_seq start_a). *) @@ -358,6 +360,7 @@ Notation classify := id. Notation U64_from_U8 := uint64_from_uint8. (* Definition Build_Range_t (a b : nat) := (a,b). (* match (b - a)%nat with O => [] | S n => match b with | O => [] | S b' => Build_Range_t a b' ++ [b] end end. *) *) Definition Build_t_Range {WS L1 L2 I1 I2} (a : both L1 I1 (int WS)) (b : both L2 I2 (int WS)) := (a,b). +Notation Build_Range := Build_t_Range. Notation declassify_eq := eq. Notation String_t := String.string. @@ -377,4 +380,199 @@ Notation "a <> b" := (negb (eqb a b)). Notation "'not'" := (negb). Notation "x ':of:' y" := (x : both _ _ y) (at level 100). Notation "x ':of0:' y" := (x : both (fset []) (fset []) y) (at level 100). + +Class t_Serialize (Self : choice_type). +Class t_Deserial (Self : choice_type). +Class t_Serial (Self : choice_type). +Notation "'t_Eq'" := (EqDec). (** end of: Should be moved to Hacspec_Lib.v **) + +Definition t_Result A B := result B A. + +(** Should be part of core.V **) + +Class t_Sized (A : choice_type) := Sized : A -> A. +Class t_TryFrom (A : choice_type) := TryFrom : A -> A. +Class t_Into (A : choice_type) := Into : A -> A. +Class t_PartialEq (A : choice_type) := PartialEq : A -> A. +Class t_Copy (A : choice_type) := Copy : A -> A. +Class t_Clone (A : choice_type) := Clone : A -> A. +Definition t_Option : choice_type -> choice_type := chOption. +Inductive vec_typ := +| t_Global. +Definition t_Vec : choice_type -> vec_typ -> choice_type := fun A _ => chList A. + +Class t_Default A := { default : A }. + +#[global] Instance bool_copy : t_Copy 'bool := {Copy x := x}. +#[global] Instance bool_clone : t_Clone 'bool := {Clone x := x}. +#[global] Instance bool_sized : t_Sized 'bool := {Sized x := x}. + +Definition ilog2 {WS} {L I} (x : both L I (int WS)) : both L I (int WS) := x. (* TODO *) + +Definition collect {A} {L I} (x : both L I (chList A)) : both L I (t_Vec A t_Global) := x. + + +Equations swap_both_list {A L I} (x : list (both L I A)) : both L I (chList A) := + swap_both_list x := + (List.fold_left (fun (x : both L I (chList A)) y => + bind_both x (fun x' => + bind_both y (fun y' => + solve_lift (ret_both ((y' :: x') : chList A))))) x (solve_lift (ret_both ([] : chList A)))). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Equations match_list {A B : choice_type} {L I} (x : both L I (chList A)) (f : list A -> B) : both L I B := + match_list x f := + bind_both x (fun x' => solve_lift (ret_both (f x'))). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Equations map {A B} {L I} (x : both L I (chList A)) (f : both L I A -> both L I B) : both L I (chList B) := + map x f := + bind_both x (fun x' => swap_both_list (List.map (fun y => f (solve_lift (ret_both y))) x')). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Definition cloned {A} {L I} (x : both L I (chList A)) : both L I (chList A) := x. + +Equations iter {A L I} (x : both L I (seq A)) : both L I (chList A) := + iter x := + bind_both x (fun x' => solve_lift (ret_both (Hacspec_Lib_Pre.seq_to_list _ x' : chList A))). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Definition dedup {A} {L I} (x : both L I (t_Vec A t_Global)) : both L I (t_Vec A t_Global) := x. + +Definition t_String := Coq.Strings.String.string. +Program Definition new {A L I} : both L I (t_Vec A t_Global) := solve_lift (ret_both ([] : chList A)). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Definition enumerate {A} {L I} (x : both L I (t_Vec A t_Global)) : both L I (t_Vec A t_Global) := x. + +Inductive ControlFlow {L I} (A : choice_type) (B : choice_type) := +| ControlFlow_Continue (val : both L I A) +| ControlFlow_Break (val : both L I B). + +Definition run {A B : choice_type} {L I} (x : ControlFlow A B) : both L I (t_Result A B) := + match x with + | ControlFlow_Continue v => Ok v + | ControlFlow_Break v => Err v + end. + +(* Program Definition build_under_impl_1 {A B} : (t_Result A B) := *) +(* run (letb layers := (match branch (build_tree_under_impl_1 partial_layers depth) with *) +(* | ControlFlow_Break residual => letb hoist1 := (v_Break (from_residual residual)) : both _ _ (t_Never) in *) +(* ControlFlow_Continue (never_to_any hoist1) *) +(* | ControlFlow_Continue val => ControlFlow_Continue val *) +(* end) in *) +(* ControlFlow_Continue (Result_Ok (Build_PartialTree layers))). *) +(* Fail Next Obligation. *) + +(** How to handle enums: **) + +(* Inductive t_ErrorKind : Type := *) +(* | ErrorKind_SerializedProofSizeIsIncorrectt_ErrorKind *) +(* | ErrorKind_NotEnoughHelperNodest_ErrorKind *) +(* | ErrorKind_HashConversionErrort_ErrorKind *) +(* | ErrorKind_NotEnoughHashesToCalculateRoott_ErrorKind *) +(* | ErrorKind_LeavesIndicesCountMismatcht_ErrorKind. *) + +Definition t_ErrorKind : choice_type := chFin (mkpos 5). +Program Definition ErrorKind_SerializedProofSizeIsIncorrect {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=0) eq_refl : t_ErrorKind)). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Program Definition ErrorKind_NotEnoughHelperNodes {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=1) eq_refl : t_ErrorKind)). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Program Definition ErrorKind_HashConversionError {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=2) eq_refl : t_ErrorKind)). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Program Definition ErrorKind_NotEnoughHashesToCalculateRoot {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=3) eq_refl : t_ErrorKind)). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Program Definition ErrorKind_LeavesIndicesCountMismatch {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=4) eq_refl : t_ErrorKind)). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +(** How to handle records: **) +(* TODO: Remove them as a phase? *) + +(* Record t_Error : Type := { *) +(* f_kind1 : t_ErrorKind *) +(* f_kind2 : t_ErrorKind *) +(* }. *) + +Definition t_Error : choice_type := t_ErrorKind × t_ErrorKind. +(* Uncurry is Build_.. fn *) +Equations Build_Error {L I} {f_kind1 : both L I t_ErrorKind} {f_kind2 : both L I t_ErrorKind} : both L I t_Error := + Build_Error (f_kind1 := x) (f_kind2 := y) := + bind_both x (fun x' => + bind_both y (fun y' => + solve_lift (ret_both ((x', y') : t_Error)))). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. +Definition f_kind1 (v : t_Error) := fst v. +Definition f_kind2 (v : t_Error) := snd v. +(* Make into tuple struct with named projctions! *) + +(*** More functions *) +Definition t_Drain : choice_type -> vec_typ -> choice_type := t_Vec. +Inductive t_Range := RangeFull. +Equations drain : forall {L I A}, both L I (t_Vec A t_Global) -> t_Range -> both L I (t_Drain A t_Global × t_Vec A t_Global) := + drain x _ := + bind_both x (fun x' => solve_lift (ret_both ((x', []) : (t_Drain A t_Global × t_Vec A t_Global)))). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. +Notation t_Rev := id. +Equations rev {L I A} (x : both L I (chList A)) : both L I (chList A) := rev x := bind_both x (fun x => solve_lift (ret_both (List.rev x : chList _))). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Definition pop {L I A} : both L I (chList A) -> both L I (chOption A × t_Vec A (t_Global)) := + lift1_both (fun (x : chList A) => (List.hd_error x , List.tl x) : (chOption A × t_Vec A (t_Global))). + +Definition push {L1 L2 I1 I2 A} : both L1 I1 (t_Vec A t_Global) -> both L2 I2 A -> both (L1 :|: L2) (I1 :|: I2) (t_Vec A (t_Global)) := + lift2_both (fun (x : chList A) y => y :: x : chList A). + +Notation Option_Some := Some. +Definition append {L1 L2 I1 I2} {A : choice_type} (l : both L1 I1 (chList A)) (x : both L2 I2 (chList A)) : both (L2 :|: L1) (I2 :|: I1) (chList A × chList A) := + lift2_both (fun (x : chList A) (y : chList A) => (app y x, []) : chList A × chList A) x l. + +Notation clone := id. +Definition seq_unzip {A B} (s : chList (A × B)) : chList A × chList B := (seq.unzip1 s, seq.unzip2 s). +Definition unzip {L I} {A B} : both L I (chList (A × B)) -> both L I (chList A × chList B) := lift1_both seq_unzip. +Equations deref {L I A} : both L I (t_Vec A t_Global) -> both L I (seq A) := + deref X := bind_both X (fun x : t_Vec A t_Global => solve_lift (ret_both (Hacspec_Lib_Pre.seq_from_list A x))). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. +Definition t_Never := False. +Notation v_Break := id. +Notation Result_Err := Err. +Definition never_to_any := tt. +Notation Result_Ok := Ok. + +Notation "'ret_both' 'tt'" := (ret_both (tt : 'unit)). + +(** Should be part of concordium.v **) +Class HasInitContext (Self : choice_type). +Class t_HasInitContext (Self : choice_type) (something : choice_type). +Class t_HasActions (Self : choice_type) := {accept : forall {L I}, both L I Self}. +Class HasReceiveContext (Self : choice_type). +Definition t_ParamType := 'unit. +Definition t_ParseError := 'unit. +(* (t_RegisterParam) *) +Class t_HasReceiveContext (Self : choice_type) (something : choice_type) := { get : forall {Ctx L I}, both L I (t_ParamType × t_Result Ctx (t_ParseError)) }. +Arguments get {Self} {something} (t_HasReceiveContext) {Ctx} {L} {I}. + +Definition parameter_cursor {T : _} `{ t_Sized (T)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (T)} `{ t_HasReceiveContext (T) ('unit)} {L1 : {fset Location}} {I1 : Interface} (ctx : both L1 I1 (T)) : t_HasReceiveContext (T) ('unit) := _. + + +Definition Continuation B A := (A -> B) -> B. +Definition monad_ret {B A} (x : A) : Continuation B A := fun f => f x. +Definition monad_bind {B A C} (x : Continuation B A) (f : A -> Continuation B C) : Continuation B C := (fun g : C -> B => x (fun y : A => f y g)). diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index cdd3783..8421a7e 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -24,811 +24,285 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax -Tool: prelude_import _ **) - -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax -Tool: macro_use _ **) (*Not implemented yet? todo(item)*) -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax -Tool: macro_use _ **) (*Not implemented yet? todo(item)*) -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import Hacspec_concordium. -Export Hacspec_concordium. - -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import Hacspec_concordium_derive. -Export Hacspec_concordium_derive. - -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax -DocComment: Interface for group implementation **) Class t_Group (Self : choice_type) := { t_group_type : choice_type ; - t_group_type_t_Group :> t_Group (t_group_type) ; - q : forall {L0 I0}, both L0 I0 (int32) ; - g : forall {L0 I0}, both L0 I0 (t_group_type) ; - g_pow : forall {L0 I0}, both L0 I0 (int32) -> both L0 I0 (t_group_type) ; - pow : forall {L0 L1 I0 I1}, both L0 I0 (t_group_type) -> both L1 I1 (int32) -> both (L0 :|: L1) (I0 :|: I1) (t_group_type) ; - one : forall {L0 I0}, both L0 I0 (t_group_type) ; - prod : forall {L0 L1 I0 I1}, both L0 I0 (t_group_type) -> both L1 I1 (t_group_type) -> both (L0 :|: L1) (I0 :|: I1) (t_group_type) ; - inv : forall {L0 I0}, both L0 I0 (t_group_type) -> both L0 I0 (t_group_type) ; - div : forall {L0 L1 I0 I1}, both L0 I0 (t_group_type) -> both L1 I1 (t_group_type) -> both (L0 :|: L1) (I0 :|: I1) (t_group_type) ; + t_group_type_t_Serialize :> t_Serialize (t_group_type) ; + t_group_type_t_Deserial :> t_Deserial (t_group_type) ; + t_group_type_t_Serial :> t_Serial (t_group_type) ; + t_group_type_t_Copy :> t_Copy (t_group_type) ; + t_group_type_t_Clone :> t_Clone (t_group_type) ; + t_group_type_t_Eq :> t_Eq (t_group_type) ; + t_group_type_t_PartialEq :> t_PartialEq (t_group_type) ; + t_group_type_t_Sized :> t_Sized (t_group_type) ; + q : forall {L1 I1}, both L1 I1 (int32) ; + g : forall {L1 I1}, both L1 I1 (t_group_type) ; + g_pow_loc : {fset Location} ; + g_pow : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: g_pow_loc) I1 (t_group_type) ; + pow_loc : {fset Location} ; + pow : forall {L1 L2 I1 I2}, both L1 I1 (t_group_type) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: pow_loc) (I1 :|: I2) (t_group_type) ; + one_loc : {fset Location} ; + one : forall {L1 I1}, both (L1 :|: one_loc) I1 (t_group_type) ; + prod_loc : {fset Location} ; + prod : forall {L1 L2 I1 I2}, both L1 I1 (t_group_type) -> both L2 I2 (t_group_type) -> both (L1 :|: L2 :|: prod_loc) (I1 :|: I2) (t_group_type) ; + inv_loc : {fset Location} ; + inv : forall {L1 I1}, both L1 I1 (t_group_type) -> both (L1 :|: inv_loc) I1 (t_group_type) ; + div_loc : {fset Location} ; + div : forall {L1 L2 I1 I2}, both L1 I1 (t_group_type) -> both L2 I2 (t_group_type) -> both (L1 :|: L2 :|: div_loc) (I1 :|: I2) (t_group_type) ; }. -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) Definition t_z_17_ : choice_type := 'unit. -Equations Build_t_z_17_ {L : {fset Location}} {I : Interface} : both L I (t_z_17_) := +Equations Build_t_z_17_ : both(fset []) (fset []) (t_z_17_) := Build_t_z_17_ := - solve_lift (ret_both ((!TODO empty tuple!) : (t_z_17_))) : both L I (t_z_17_). + solve_lift (ret_both ((_) : (t_z_17_))) : both(fset []) (fset []) (t_z_17_). Fail Next Obligation. -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -#[global] Instance t_z_17__t_Group : t_Group t_z_17_ := { - t_group_type := int32; - q := solve_lift (ret_both (17 : int32)); - g := solve_lift (ret_both (3 : int32)); - g_pow (x : int32) := solve_lift ((g .^ x) .% q); - pow (g : int32) (x : int32) := solve_lift ((g .^ x) .% q); - one := solve_lift (ret_both (1 : int32)); - prod (x : int32) (y : int32) := solve_lift ((x .* y) .% q); - inv (x : int32) := letbm res loc(res_loc) := ret_both (0 : int32) :of: int32 in - letb res := foldi_both_list (into_iter (Build_t_Range (ret_both (1 : int32)) q)) (fun {L I _ _} =>fun i => - ssp (fun res => - solve_lift (ifb (pow g i) =.? x - then i - else res))) res :of: int32 in - solve_lift (q .- res); - div (x : int32) (y : int32) := solve_lift (prod x (inv y)); -}. +Definition res_loc : Location := + (int32 ; 0%nat). +#[global] Program Instance t_z_17__t_Group : t_Group t_z_17_ := + let t_group_type := int32 : choice_type in + let q := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (17 : int32)) : both L I (int32) in + let g := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (3 : int32)) : both L I (int32) in + let g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift ((g .^ x) .% q) : both L1 I1 (int32) in + let pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: L2) (I1 :|: I2) (int32) in + let one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both L I (int32) in + let prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% q) : both (L1 :|: L2) (I1 :|: I2) (int32) in + let inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => letb res loc(res_loc) := ret_both (0 : int32) in + letb res := foldi_both (into_iter (Build_Range (f_start := ret_both (1 : int32)) (f_end := q))) (fun {L I _ _} =>fun i => + ssp (fun res => + solve_lift (ifb (g_pow i) =.? x + then letb res := i in + res + else res))) res in + solve_lift res : both (L1 :|: fset [res_loc]) I1 (int32) in + let div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (prod x (inv y)) : both (L1 :|: L2 :|: fset [res_loc]) (I1 :|: I2) (int32) in + {| t_group_type := (@t_group_type); + q := (@q); + g := (@g); + g_pow_loc := (fset [] : {fset Location}); + g_pow := (@g_pow); + pow_loc := (fset [] : {fset Location}); + pow := (@pow); + one_loc := (fset [] : {fset Location}); + one := (@one); + prod_loc := (fset [] : {fset Location}); + prod := (@prod); + inv_loc := (fset [res_loc] : {fset Location}); + inv := (@inv); + div_loc := (fset [res_loc] : {fset Location}); + div := (@div)|}. +Solve All Obligations with exact int_eqdec. +Fail Next Obligation. -(*item error backend*) +Notation "'t_G'" := (t_z_17_). -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax -Tool: export_name _ **) -Definition state_bytes_loc : Location := - (t_ContractState ; 0%nat). -Equations export_init_ovn_contract {L1 : {fset Location}} {I1 : Interface} (amount : both L1 I1 (t_Amount)) : both (L1 :|: fset [state_bytes_loc]) (I1) (int32) := - export_init_ovn_contract amount := - solve_lift (run (letb _ := ifb (f_micro_ccd amount) <> (ret_both (0 : int64)) - then letb hoist1 := v_Break (ret_both (1 : int32)) :of: t_Never in - ControlFlow_Continue (never_to_any hoist1) - else ControlFlow_Continue (ret_both (tt : 'unit)) :of: 'unit in - ControlFlow_Continue (letb ctx := open (ret_both (tt : 'unit)) :of: t_ExternContext (t_InitContextExtern) in - matchb init_ovn_contract ctx with - | Result_Ok state => - letbm state_bytes loc(state_bytes_loc) := open (ret_both (tt : 'unit)) :of: t_ContractState in - letb '(tmp0,out) := serial state state_bytes :of: (t_ContractState × t_Result ('unit) (t_Err)) in - letb state_bytes := tmp0 :of: t_ContractState in - letb hoist2 := out :of: (t_ContractState × t_Result ('unit) (t_Err)) in - letb hoist3 := is_err_under_impl hoist2 :of: 'bool in - letb _ := ifb hoist3 - then never_to_any trap - else ret_both (tt : 'unit) :of: 'unit in - ret_both (0 : int32) - | Result_Err reject => - letb code := get_under_impl_56 (f_error_code (from reject)) :of: int32 in - ifb code <.? (ret_both (0 : int32)) - then code - else never_to_any trap - end))) : both (L1 :|: fset [state_bytes_loc]) (I1) (int32). +Equations n {L : {fset Location}} {I : Interface} : both L I (uint_size) := + n := + solve_lift (ret_both (20 : uint_size)) : both L I (uint_size). Fail Next Obligation. -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Equations init_ovn_contract {impl HasInitContext : _} `{ t_Sized (impl HasInitContext)} `{ t_HasInitContext (impl HasInitContext) ('unit)} {L1 : {fset Location}} {I1 : Interface} (ctx : both L1 I1 (impl HasInitContext)) : both (L1) (I1) (t_Result ('bool) ('unit)) := +Definition t_OvnContractState : choice_type := + (nseq t_group_type 20 × nseq int32 20 × nseq int32 20 × nseq t_group_type 20 × nseq int32 20 × int32). +Equations f_g_pow_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq t_group_type 20) := + f_g_pow_xis s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq t_group_type 20))) : both L I (nseq t_group_type 20). +Fail Next Obligation. +Equations f_zkp_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := + f_zkp_xis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq int32 20))) : both L I (nseq int32 20). +Fail Next Obligation. +Equations f_commit_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := + f_commit_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : nseq int32 20))) : both L I (nseq int32 20). +Fail Next Obligation. +Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq t_group_type 20) := + f_g_pow_xi_yi_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : nseq t_group_type 20))) : both L I (nseq t_group_type 20). +Fail Next Obligation. +Equations f_zkp_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := + f_zkp_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : nseq int32 20))) : both L I (nseq int32 20). +Fail Next Obligation. +Equations f_tally {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (int32) := + f_tally s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {f_g_pow_xis : both L0 I0 (nseq t_group_type 20)} {f_zkp_xis : both L1 I1 (nseq int32 20)} {f_commit_vis : both L2 I2 (nseq int32 20)} {f_g_pow_xi_yi_vis : both L3 I3 (nseq t_group_type 20)} {f_zkp_vis : both L4 I4 (nseq int32 20)} {f_tally : both L5 I5 (int32)} : both(L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := + Build_t_OvnContractState := + bind_both f_tally (fun f_tally => + bind_both f_zkp_vis (fun f_zkp_vis => + bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => + bind_both f_commit_vis (fun f_commit_vis => + bind_both f_zkp_xis (fun f_zkp_xis => + bind_both f_g_pow_xis (fun f_g_pow_xis => + solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both(L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). +Fail Next Obligation. +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). +Definition state_OVN {L : {fset Location}} {I : Interface} (f_g_pow_xis : both L I (nseq t_group_type 20)) (f_zkp_xis : both L I (nseq int32 20)) (f_commit_vis : both L I (nseq int32 20)) (f_g_pow_xi_yi_vis : both L I (nseq t_group_type 20)) (f_zkp_vis : both L I (nseq int32 20)) (f_tally : both L I (int32)) : choice_type := + t_OvnContractState. + +Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {T : _} `{ t_Sized (T)} `{ t_HasInitContext (T) ('unit)} (ctx : both L1 I1 (T)) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)) := init_ovn_contract ctx := - Result_Ok (solve_lift (ret_both (true : 'bool))) : both (L1) (I1) (t_Result ('bool) ('unit)). + Result_Ok (solve_lift (Build_OvnContractState (f_g_pow_xis := repeat one (ret_both (20 : uint_size))) (f_zkp_xis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_commit_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_g_pow_xi_yi_vis := repeat one (ret_both (20 : uint_size))) (f_zkp_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)). Fail Next Obligation. +Definition init_OVN : choice_type := + st. -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax -DocComment: Currently randomness needs to be injected **) -Equations select_private_voting_key {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) : both (L1) (I1) (int32) := +Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) : both L1 I1 (int32) := select_private_voting_key random := - solve_lift (random .% q) : both (L1) (I1) (int32). + solve_lift (random .% q) : both L1 I1 (int32). Fail Next Obligation. -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax -DocComment: TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics **) -Equations v_ZKP {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi : both L1 I1 (t_group_type)) (xi : both L2 I2 (int32)) : both (L1:|:L2) (I1:|:I2) (int32) := +Equations v_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi : both L1 I1 (int32)) (xi : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) (int32) := v_ZKP g_pow_xi xi := - solve_lift (ret_both (0 : int32)) : both (L1:|:L2) (I1:|:I2) (int32). + solve_lift (ret_both (0 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). Fail Next Obligation. -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) Definition t_RegisterParam : choice_type := (int32 × int32). -Equations Build_t_RegisterParam {L : {fset Location}} {I : Interface} (f_i : both L I (int32)) (f_xi : both L I (int32)) : both L I (t_RegisterParam) := - Build_t_RegisterParam f_i f_xi := +Equations f_i {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := + f_i s := + bind_both s (fun x => + solve_lift (ret_both (fst x : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_xi {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := + f_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_i : both L0 I0 (int32)} {f_xi : both L1 I1 (int32)} : both(L0:|:L1) (I0:|:I1) (t_RegisterParam) := + Build_t_RegisterParam := bind_both f_xi (fun f_xi => bind_both f_i (fun f_i => - solve_lift (ret_both ((f_i,f_xi) : (t_RegisterParam))))) : both L I (t_RegisterParam). + solve_lift (ret_both ((f_i,f_xi) : (t_RegisterParam))))) : both(L0:|:L1) (I0:|:I1) (t_RegisterParam). Fail Next Obligation. +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_i' ':=' y ')'" := (Build_t_RegisterParam (f_i := y) (f_xi := f_xi x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_xi' ':=' y ')'" := (Build_t_RegisterParam (f_i := f_i x) (f_xi := y)). -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Notation t_G := (t_z_17_). - -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Equations n : both (fset []) ([interface ]) (uint_size) := - n := - solve_lift (ret_both (20 : uint_size)) : both (fset []) ([interface ]) (uint_size). +Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {T : _} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} (ctx : both L1 I1 (T)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := + register_vote ctx state := + Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. +Definition receive_OVN_register (RegisterParam : _) (st : state_OVN) : choice_type := + register_vote st. -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax -Tool: export_name _ **) -Equations export_register_vote {L1 : {fset Location}} {I1 : Interface} (amount : both L1 I1 (t_Amount)) : both (L1) (I1) (int32) := - export_register_vote amount := - solve_lift (failure (ret_both ((LocalMutation) The bindings ["state_bytes"] cannot be mutated here: they don't belong to the closure scope, and this is not allowed. - : chString)) (ret_both ({ - let _: tuple0 = { - (if core::cmp::PartialEq::ne( - proj_concordium_contracts_common::types::Amount::f_micro_ccd(amount), - 0, - ) { - { - let hoist4: rust_primitives::hax::t_Never = { (return 1) }; - rust_primitives::hax::never_to_any(hoist4) - } - }) - }; - { - let ctx: hacspec_concordium::concordium_types::t_ExternContext< - hacspec_concordium::concordium_types::t_ReceiveContextExtern, - > = { hacspec_concordium::concordium_traits::HasReceiveContext::open(Tuple0()) }; - { - let mut state_bytes: hacspec_concordium::concordium_types::t_ContractState = - { hacspec_concordium::concordium_traits::HasContractState::open(Tuple0()) }; - { - let Tuple2(tmp0, out): tuple2< - hacspec_concordium::concordium_types::t_ContractState, - core::result::t_Result< - hacspec_ovn::t_OvnContractState< - hacspec_ovn::t_z_17_, - generic_value!(todo), - >, - concordium_contracts_common::types::t_ParseError, - >, - > = { concordium_contracts_common::traits::Get::get(state_bytes) }; - { - let _: tuple0 = { (state_bytes = tmp0) }; - { - let hoist7: tuple2< - hacspec_concordium::concordium_types::t_ContractState, - core::result::t_Result< - hacspec_ovn::t_OvnContractState< - hacspec_ovn::t_z_17_, - generic_value!(todo), - >, - concordium_contracts_common::types::t_ParseError, - >, - > = { out }; - (match hoist7 { - core::result::Result_Ok(mut state) => { - let pat_ascription!( - res as core::result::t_Result< - tuple2< - hacspec_concordium::concordium_types::t_Action, - hacspec_ovn::t_OvnContractState< - hacspec_ovn::t_z_17_, - generic_value!(todo), - >, - >, - concordium_contracts_common::types::t_ParseError, - > - ): core::result::t_Result< - tuple2< - hacspec_concordium::concordium_types::t_Action, - hacspec_ovn::t_OvnContractState< - hacspec_ovn::t_z_17_, - generic_value!(todo), - >, - >, - concordium_contracts_common::types::t_ParseError, - > = { hacspec_ovn::register_vote(ctx, state) }; - (match res { - core::result::Result_Ok(Tuple2(act, state_res)) => { - let _: tuple0 = { (state = state_res) }; - { - let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Seek::seek(state_bytes,concordium_contracts_common::traits::SeekFrom_Start(0))}; - { - let _: tuple0 = { (state_bytes = tmp0) }; - { - let hoist6: tuple2> = {out}; - { - let hoist5: arrow!(int -> core::result::t_Result) = { - (|_| { - let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Serial::serial(state,state_bytes)}; - { - let _: tuple0 = { - (state_bytes = tmp0) - }; - out - } - }) - }; - { - let res: core::result::t_Result< - tuple0, - tuple0, - > = { - core::result::and_then_under_impl(hoist6,hoist5) - }; - (if core::result::is_err_under_impl( - res, - ) { - rust_primitives::hax::never_to_any(hacspec_concordium::trap()) - } else { - cast(hacspec_concordium::concordium_types::tag_under_impl(act)) - }) - } - } - } - } - } - } - core::result::Result_Err(reject) => { - let code: int = { - core::num::nonzero::get_under_impl_56(proj_hacspec_concordium::concordium_types::Reject::f_error_code(core::convert::From::from(reject))) - }; - (if core::cmp::PartialOrd::lt(code, 0) { - code - } else { - rust_primitives::hax::never_to_any( - hacspec_concordium::trap(), - ) - }) - } - }) - } - _ => rust_primitives::hax::never_to_any(hacspec_concordium::trap()), - }) - } - } - } - } - } - } : chString))) : both (L1) (I1) (int32). -Fail Next Obligation. - -(*item error backend*) - -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) Definition t_CastVoteParam : choice_type := (int32 × int32 × 'bool). -Equations Build_t_CastVoteParam {L : {fset Location}} {I : Interface} (f_i : both L I (int32)) (f_xi : both L I (int32)) (f_vote : both L I ('bool)) : both L I (t_CastVoteParam) := - Build_t_CastVoteParam f_i f_xi f_vote := +Equations f_i {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_i s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_xi {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_vote {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I ('bool) := + f_vote s := + bind_both s (fun x => + solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). +Fail Next Obligation. +Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_i : both L0 I0 (int32)} {f_xi : both L1 I1 (int32)} {f_vote : both L2 I2 ('bool)} : both(L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := + Build_t_CastVoteParam := bind_both f_vote (fun f_vote => bind_both f_xi (fun f_xi => bind_both f_i (fun f_i => - solve_lift (ret_both ((f_i,f_xi,f_vote) : (t_CastVoteParam)))))) : both L I (t_CastVoteParam). + solve_lift (ret_both ((f_i,f_xi,f_vote) : (t_CastVoteParam)))))) : both(L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). Fail Next Obligation. +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_i' ':=' y ')'" := (Build_t_CastVoteParam (f_i := y) (f_xi := f_xi x) (f_vote := f_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_i := f_i x) (f_xi := y) (f_vote := f_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_i := f_i x) (f_xi := f_xi x) (f_vote := y)). -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (int32)) : both (L1) (I1) ('bool) := +Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (int32)) : both L1 I1 ('bool) := check_valid zkp := - solve_lift (ret_both (true : 'bool)) : both (L1) (I1) ('bool). + solve_lift (ret_both (true : 'bool)) : both L1 I1 ('bool). Fail Next Obligation. -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Definition prod2_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := - (t_group_type ; 3%nat). -Definition prod1_loc {G : _} `{ t_Sized (G)} `{ t_Group (G)} : Location := - (t_group_type ; 2%nat). -Equations compute_group_element_for_vote {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq t_group_type 20)) : both (L1:|:L2:|:L3:|:L4 :|: fset [prod1_loc; prod2_loc]) (I1:|:I2:|:I3:|:I4) (t_group_type) := +Definition prod2_loc : Location := + (int32 ; 2%nat). +Definition prod1_loc : Location := + (int32 ; 1%nat). +Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq int32 20)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32) := compute_group_element_for_vote i xi vote xis := - letbm prod1 loc(prod1_loc) := one :of: t_group_type in - letb prod1 := foldi_both_list (into_iter (Build_t_Range (ret_both (0 : uint_size)) (cast_int (i .- (ret_both (1 : int32)))))) (fun {L I _ _} =>fun j => - ssp (fun prod1 => - solve_lift (prod prod1 (xis.a[j])))) prod1 :of: t_group_type in - letbm prod2 loc(prod2_loc) := one :of: t_group_type in - letb prod2 := foldi_both_list (into_iter (Build_t_Range (cast_int (i .+ (ret_both (1 : int32)))) n)) (fun {L I _ _} =>fun j => - ssp (fun prod2 => - solve_lift (prod prod2 (xis.a[j])))) prod2 :of: t_group_type in - letb Yi := div prod1 prod2 :of: t_group_type in + letb prod1 loc(prod1_loc) := one in + letb prod1 := foldi_both (into_iter (Build_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun {L I _ _} =>fun j => + ssp (fun prod1 => + solve_lift (prod prod1 (xis.a[j])))) prod1 in + letb prod2 loc(prod2_loc) := one in + letb prod2 := foldi_both (into_iter (Build_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun {L I _ _} =>fun j => + ssp (fun prod2 => + solve_lift (prod prod2 (xis.a[j])))) prod2 in + letb Yi := div prod1 prod2 in solve_lift (prod (pow Yi xi) (g_pow (ifb vote then ret_both (1 : int32) - else ret_both (0 : int32)))) : both (L1:|:L2:|:L3:|:L4 :|: fset [prod1_loc; prod2_loc]) (I1:|:I2:|:I3:|:I4) (t_group_type). + else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32). Fail Next Obligation. -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Equations commit_to {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_group_type)) : both (L1) (I1) (int32) := +Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) : both L1 I1 (int32) := commit_to x := - solve_lift (ret_both (0 : int32)) : both (L1) (I1) (int32). + solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). Fail Next Obligation. -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax -Tool: export_name _ **) -Equations export_commit_to_vote {L1 : {fset Location}} {I1 : Interface} (amount : both L1 I1 (t_Amount)) : both (L1) (I1) (int32) := - export_commit_to_vote amount := - solve_lift (failure (ret_both ((LocalMutation) The bindings ["state_bytes"] cannot be mutated here: they don't belong to the closure scope, and this is not allowed. - : chString)) (ret_both ({ - let _: tuple0 = { - (if core::cmp::PartialEq::ne( - proj_concordium_contracts_common::types::Amount::f_micro_ccd(amount), - 0, - ) { - { - let hoist9: rust_primitives::hax::t_Never = { (return 1) }; - rust_primitives::hax::never_to_any(hoist9) - } - }) - }; - { - let ctx: hacspec_concordium::concordium_types::t_ExternContext< - hacspec_concordium::concordium_types::t_ReceiveContextExtern, - > = { hacspec_concordium::concordium_traits::HasReceiveContext::open(Tuple0()) }; - { - let mut state_bytes: hacspec_concordium::concordium_types::t_ContractState = - { hacspec_concordium::concordium_traits::HasContractState::open(Tuple0()) }; - { - let Tuple2(tmp0, out): tuple2< - hacspec_concordium::concordium_types::t_ContractState, - core::result::t_Result< - hacspec_ovn::t_OvnContractState< - hacspec_ovn::t_z_17_, - generic_value!(todo), - >, - concordium_contracts_common::types::t_ParseError, - >, - > = { concordium_contracts_common::traits::Get::get(state_bytes) }; - { - let _: tuple0 = { (state_bytes = tmp0) }; - { - let hoist12: tuple2< - hacspec_concordium::concordium_types::t_ContractState, - core::result::t_Result< - hacspec_ovn::t_OvnContractState< - hacspec_ovn::t_z_17_, - generic_value!(todo), - >, - concordium_contracts_common::types::t_ParseError, - >, - > = { out }; - (match hoist12 { - core::result::Result_Ok(mut state) => { - let pat_ascription!( - res as core::result::t_Result< - tuple2< - hacspec_concordium::concordium_types::t_Action, - hacspec_ovn::t_OvnContractState< - hacspec_ovn::t_z_17_, - generic_value!(todo), - >, - >, - concordium_contracts_common::types::t_ParseError, - > - ): core::result::t_Result< - tuple2< - hacspec_concordium::concordium_types::t_Action, - hacspec_ovn::t_OvnContractState< - hacspec_ovn::t_z_17_, - generic_value!(todo), - >, - >, - concordium_contracts_common::types::t_ParseError, - > = { hacspec_ovn::commit_to_vote(ctx, state) }; - (match res { - core::result::Result_Ok(Tuple2(act, state_res)) => { - let _: tuple0 = { (state = state_res) }; - { - let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Seek::seek(state_bytes,concordium_contracts_common::traits::SeekFrom_Start(0))}; - { - let _: tuple0 = { (state_bytes = tmp0) }; - { - let hoist11: tuple2> = {out}; - { - let hoist10: arrow!(int -> core::result::t_Result) = { - (|_| { - let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Serial::serial(state,state_bytes)}; - { - let _: tuple0 = { - (state_bytes = tmp0) - }; - out - } - }) - }; - { - let res: core::result::t_Result< - tuple0, - tuple0, - > = { - core::result::and_then_under_impl(hoist11,hoist10) - }; - (if core::result::is_err_under_impl( - res, - ) { - rust_primitives::hax::never_to_any(hacspec_concordium::trap()) - } else { - cast(hacspec_concordium::concordium_types::tag_under_impl(act)) - }) - } - } - } - } - } - } - core::result::Result_Err(reject) => { - let code: int = { - core::num::nonzero::get_under_impl_56(proj_hacspec_concordium::concordium_types::Reject::f_error_code(core::convert::From::from(reject))) - }; - (if core::cmp::PartialOrd::lt(code, 0) { - code - } else { - rust_primitives::hax::never_to_any( - hacspec_concordium::trap(), - ) - }) - } - }) - } - _ => rust_primitives::hax::never_to_any(hacspec_concordium::trap()), - }) - } - } - } - } - } - } : chString))) : both (L1) (I1) (int32). +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {impl HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (ctx : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := + commit_to_vote ctx state := + Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. +Definition receive_OVN_commit_to_vote (CastVoteParam : _) (st : state_OVN) : choice_type := + commit_to_vote st. -(*item error backend*) - -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax -DocComment: Cramer, Damgård and Schoenmakers (CDS) technique **) -Equations v_ZKP_one_out_of_two {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (t_group_type)) (vi : both L2 I2 ('bool)) : both (L1:|:L2) (I1:|:I2) (int32) := +Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (int32)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := v_ZKP_one_out_of_two g_pow_vi vi := - solve_lift (ret_both (32 : int32)) : both (L1:|:L2) (I1:|:I2) (int32). + solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). Fail Next Obligation. -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax -Tool: export_name _ **) -Equations export_cast_vote {L1 : {fset Location}} {I1 : Interface} (amount : both L1 I1 (t_Amount)) : both (L1) (I1) (int32) := - export_cast_vote amount := - solve_lift (failure (ret_both ((LocalMutation) The bindings ["state_bytes"] cannot be mutated here: they don't belong to the closure scope, and this is not allowed. - : chString)) (ret_both ({ - let _: tuple0 = { - (if core::cmp::PartialEq::ne( - proj_concordium_contracts_common::types::Amount::f_micro_ccd(amount), - 0, - ) { - { - let hoist14: rust_primitives::hax::t_Never = { (return 1) }; - rust_primitives::hax::never_to_any(hoist14) - } - }) - }; - { - let ctx: hacspec_concordium::concordium_types::t_ExternContext< - hacspec_concordium::concordium_types::t_ReceiveContextExtern, - > = { hacspec_concordium::concordium_traits::HasReceiveContext::open(Tuple0()) }; - { - let mut state_bytes: hacspec_concordium::concordium_types::t_ContractState = - { hacspec_concordium::concordium_traits::HasContractState::open(Tuple0()) }; - { - let Tuple2(tmp0, out): tuple2< - hacspec_concordium::concordium_types::t_ContractState, - core::result::t_Result< - hacspec_ovn::t_OvnContractState< - hacspec_ovn::t_z_17_, - generic_value!(todo), - >, - concordium_contracts_common::types::t_ParseError, - >, - > = { concordium_contracts_common::traits::Get::get(state_bytes) }; - { - let _: tuple0 = { (state_bytes = tmp0) }; - { - let hoist17: tuple2< - hacspec_concordium::concordium_types::t_ContractState, - core::result::t_Result< - hacspec_ovn::t_OvnContractState< - hacspec_ovn::t_z_17_, - generic_value!(todo), - >, - concordium_contracts_common::types::t_ParseError, - >, - > = { out }; - (match hoist17 { - core::result::Result_Ok(mut state) => { - let pat_ascription!( - res as core::result::t_Result< - tuple2< - hacspec_concordium::concordium_types::t_Action, - hacspec_ovn::t_OvnContractState< - hacspec_ovn::t_z_17_, - generic_value!(todo), - >, - >, - concordium_contracts_common::types::t_ParseError, - > - ): core::result::t_Result< - tuple2< - hacspec_concordium::concordium_types::t_Action, - hacspec_ovn::t_OvnContractState< - hacspec_ovn::t_z_17_, - generic_value!(todo), - >, - >, - concordium_contracts_common::types::t_ParseError, - > = { hacspec_ovn::cast_vote(ctx, state) }; - (match res { - core::result::Result_Ok(Tuple2(act, state_res)) => { - let _: tuple0 = { (state = state_res) }; - { - let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Seek::seek(state_bytes,concordium_contracts_common::traits::SeekFrom_Start(0))}; - { - let _: tuple0 = { (state_bytes = tmp0) }; - { - let hoist16: tuple2> = {out}; - { - let hoist15: arrow!(int -> core::result::t_Result) = { - (|_| { - let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Serial::serial(state,state_bytes)}; - { - let _: tuple0 = { - (state_bytes = tmp0) - }; - out - } - }) - }; - { - let res: core::result::t_Result< - tuple0, - tuple0, - > = { - core::result::and_then_under_impl(hoist16,hoist15) - }; - (if core::result::is_err_under_impl( - res, - ) { - rust_primitives::hax::never_to_any(hacspec_concordium::trap()) - } else { - cast(hacspec_concordium::concordium_types::tag_under_impl(act)) - }) - } - } - } - } - } - } - core::result::Result_Err(reject) => { - let code: int = { - core::num::nonzero::get_under_impl_56(proj_hacspec_concordium::concordium_types::Reject::f_error_code(core::convert::From::from(reject))) - }; - (if core::cmp::PartialOrd::lt(code, 0) { - code - } else { - rust_primitives::hax::never_to_any( - hacspec_concordium::trap(), - ) - }) - } - }) - } - _ => rust_primitives::hax::never_to_any(hacspec_concordium::trap()), - }) - } - } - } - } - } - } : chString))) : both (L1) (I1) (int32). +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {impl HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (ctx : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := + cast_vote ctx state := + Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. +Definition receive_OVN_cast_vote (CastVoteParam : _) (st : state_OVN) : choice_type := + cast_vote st. -(*item error backend*) - -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Equations check_valid2 {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (t_group_type)) (zkp : both L2 I2 (int32)) : both (L1:|:L2) (I1:|:I2) ('bool) := +Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := check_valid2 g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1:|:L2) (I1:|:I2) ('bool). + solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). Fail Next Obligation. -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Equations check_commitment {G : _} `{ t_Sized (G)} `{ t_Group (G)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (t_group_type)) (zkp : both L2 I2 (int32)) : both (L1:|:L2) (I1:|:I2) ('bool) := +Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := check_commitment g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1:|:L2) (I1:|:I2) ('bool). + solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). Fail Next Obligation. -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) Definition t_TallyParameter : choice_type := 'unit. -Equations Build_t_TallyParameter {L : {fset Location}} {I : Interface} : both L I (t_TallyParameter) := +Equations Build_t_TallyParameter : both(fset []) (fset []) (t_TallyParameter) := Build_t_TallyParameter := - solve_lift (ret_both ((!TODO empty tuple!) : (t_TallyParameter))) : both L I (t_TallyParameter). + solve_lift (ret_both ((_) : (t_TallyParameter))) : both(fset []) (fset []) (t_TallyParameter). Fail Next Obligation. -(** Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax -Tool: export_name _ **) -Equations export_tally_votes {L1 : {fset Location}} {I1 : Interface} (amount : both L1 I1 (t_Amount)) : both (L1) (I1) (int32) := - export_tally_votes amount := - solve_lift (failure (ret_both ((LocalMutation) The bindings ["state_bytes"] cannot be mutated here: they don't belong to the closure scope, and this is not allowed. - : chString)) (ret_both ({ - let _: tuple0 = { - (if core::cmp::PartialEq::ne( - proj_concordium_contracts_common::types::Amount::f_micro_ccd(amount), - 0, - ) { - { - let hoist19: rust_primitives::hax::t_Never = { (return 1) }; - rust_primitives::hax::never_to_any(hoist19) - } - }) - }; - { - let ctx: hacspec_concordium::concordium_types::t_ExternContext< - hacspec_concordium::concordium_types::t_ReceiveContextExtern, - > = { hacspec_concordium::concordium_traits::HasReceiveContext::open(Tuple0()) }; - { - let mut state_bytes: hacspec_concordium::concordium_types::t_ContractState = - { hacspec_concordium::concordium_traits::HasContractState::open(Tuple0()) }; - { - let Tuple2(tmp0, out): tuple2< - hacspec_concordium::concordium_types::t_ContractState, - core::result::t_Result< - hacspec_ovn::t_OvnContractState< - hacspec_ovn::t_z_17_, - generic_value!(todo), - >, - concordium_contracts_common::types::t_ParseError, - >, - > = { concordium_contracts_common::traits::Get::get(state_bytes) }; - { - let _: tuple0 = { (state_bytes = tmp0) }; - { - let hoist22: tuple2< - hacspec_concordium::concordium_types::t_ContractState, - core::result::t_Result< - hacspec_ovn::t_OvnContractState< - hacspec_ovn::t_z_17_, - generic_value!(todo), - >, - concordium_contracts_common::types::t_ParseError, - >, - > = { out }; - (match hoist22 { - core::result::Result_Ok(mut state) => { - let pat_ascription!( - res as core::result::t_Result< - tuple2< - hacspec_concordium::concordium_types::t_Action, - hacspec_ovn::t_OvnContractState< - hacspec_ovn::t_z_17_, - generic_value!(todo), - >, - >, - concordium_contracts_common::types::t_ParseError, - > - ): core::result::t_Result< - tuple2< - hacspec_concordium::concordium_types::t_Action, - hacspec_ovn::t_OvnContractState< - hacspec_ovn::t_z_17_, - generic_value!(todo), - >, - >, - concordium_contracts_common::types::t_ParseError, - > = { hacspec_ovn::tally_votes(ctx, state) }; - (match res { - core::result::Result_Ok(Tuple2(act, state_res)) => { - let _: tuple0 = { (state = state_res) }; - { - let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Seek::seek(state_bytes,concordium_contracts_common::traits::SeekFrom_Start(0))}; - { - let _: tuple0 = { (state_bytes = tmp0) }; - { - let hoist21: tuple2> = {out}; - { - let hoist20: arrow!(int -> core::result::t_Result) = { - (|_| { - let Tuple2(tmp0, out): tuple2> = {concordium_contracts_common::traits::Serial::serial(state,state_bytes)}; - { - let _: tuple0 = { - (state_bytes = tmp0) - }; - out - } - }) - }; - { - let res: core::result::t_Result< - tuple0, - tuple0, - > = { - core::result::and_then_under_impl(hoist21,hoist20) - }; - (if core::result::is_err_under_impl( - res, - ) { - rust_primitives::hax::never_to_any(hacspec_concordium::trap()) - } else { - cast(hacspec_concordium::concordium_types::tag_under_impl(act)) - }) - } - } - } - } - } - } - core::result::Result_Err(reject) => { - let code: int = { - core::num::nonzero::get_under_impl_56(proj_hacspec_concordium::concordium_types::Reject::f_error_code(core::convert::From::from(reject))) - }; - (if core::cmp::PartialOrd::lt(code, 0) { - code - } else { - rust_primitives::hax::never_to_any( - hacspec_concordium::trap(), - ) - }) - } - }) - } - _ => rust_primitives::hax::never_to_any(hacspec_concordium::trap()), - }) - } - } - } - } - } - } : chString))) : both (L1) (I1) (int32). +Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {impl HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (_ : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := + tally_votes _ state := + Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. - -(*item error backend*) +Definition receive_OVN_tally (TallyParameter : _) (st : state_OVN) : choice_type := + tally_votes st. +Inductive Msg: Type := +| register : Msg +| commit_to_vote : Msg +| cast_vote : Msg +| tally : Msg. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote.v index cd256b5..82a133f 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote.v @@ -23,10 +23,13 @@ Open Scope hacspec_scope. Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. +Require Import Core. +Require Import Hacspec_lib. (** Tool: export_name _ Tool: no_std _ Tool: feature _ register_tool +Tool: register_tool _ hax Tool: register_tool _ _hax **) Require Import Hacspec_concordium. Export Hacspec_concordium. @@ -34,6 +37,7 @@ Export Hacspec_concordium. (** Tool: export_name _ Tool: no_std _ Tool: feature _ register_tool +Tool: register_tool _ hax Tool: register_tool _ _hax **) Require Import SeekFrom. Export SeekFrom. @@ -41,6 +45,7 @@ Export SeekFrom. (** Tool: export_name _ Tool: no_std _ Tool: feature _ register_tool +Tool: register_tool _ hax Tool: register_tool _ _hax **) Require Import ContractState. Export ContractState. @@ -48,6 +53,7 @@ Export ContractState. (** Tool: export_name _ Tool: no_std _ Tool: feature _ register_tool +Tool: register_tool _ hax Tool: register_tool _ _hax **) Require Import Logger. Export Logger. @@ -55,6 +61,7 @@ Export Logger. (** Tool: export_name _ Tool: no_std _ Tool: feature _ register_tool +Tool: register_tool _ hax Tool: register_tool _ _hax **) Require Import trap. Export trap. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_concert.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_concert.v new file mode 100644 index 0000000..0f5df76 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_concert.v @@ -0,0 +1,361 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. + Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +Class t_Group (Self : choice_type) := { + t_group_type : choice_type ; + t_group_type_t_Serialize :> t_Serialize (t_group_type) ; + t_group_type_t_Deserial :> t_Deserial (t_group_type) ; + t_group_type_t_Serial :> t_Serial (t_group_type) ; + t_group_type_t_Copy :> t_Copy (t_group_type) ; + t_group_type_t_Clone :> t_Clone (t_group_type) ; + t_group_type_t_Eq :> t_Eq (t_group_type) ; + t_group_type_t_PartialEq :> t_PartialEq (t_group_type) ; + t_group_type_t_Sized :> t_Sized (t_group_type) ; + q : forall {L1 I1}, both L1 I1 (int32) ; + g : forall {L1 I1}, both L1 I1 (t_group_type) ; + g_pow_loc : {fset Location} ; + g_pow : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: g_pow_loc) I1 (t_group_type) ; + pow_loc : {fset Location} ; + pow : forall {L1 L2 I1 I2}, both L1 I1 (t_group_type) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: pow_loc) (I1 :|: I2) (t_group_type) ; + one_loc : {fset Location} ; + one : forall {L1 I1}, both (L1 :|: one_loc) I1 (t_group_type) ; + prod_loc : {fset Location} ; + prod : forall {L1 L2 I1 I2}, both L1 I1 (t_group_type) -> both L2 I2 (t_group_type) -> both (L1 :|: L2 :|: prod_loc) (I1 :|: I2) (t_group_type) ; + inv_loc : {fset Location} ; + inv : forall {L1 I1}, both L1 I1 (t_group_type) -> both (L1 :|: inv_loc) I1 (t_group_type) ; + div_loc : {fset Location} ; + div : forall {L1 L2 I1 I2}, both L1 I1 (t_group_type) -> both L2 I2 (t_group_type) -> both (L1 :|: L2 :|: div_loc) (I1 :|: I2) (t_group_type) ; +}. + +Definition t_z_17_ : choice_type := + 'unit. +Equations Build_t_z_17_ : both(fset []) (fset []) (t_z_17_) := + Build_t_z_17_ := + solve_lift (ret_both ((_) : (t_z_17_))) : both(fset []) (fset []) (t_z_17_). +Fail Next Obligation. + +Definition res_loc : Location := + (int32 ; 0%nat). +#[global] Program Instance t_z_17__t_Group : t_Group t_z_17_ := + let t_group_type := int32 : choice_type in + let q := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (17 : int32)) : both L I (int32) in + let g := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (3 : int32)) : both L I (int32) in + let g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift ((g .^ x) .% q) : both L1 I1 (int32) in + let pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: L2) (I1 :|: I2) (int32) in + let one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both L I (int32) in + let prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% q) : both (L1 :|: L2) (I1 :|: I2) (int32) in + let inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => letb res loc(res_loc) := ret_both (0 : int32) in + letb res := foldi_both (into_iter (Build_Range (f_start := ret_both (1 : int32)) (f_end := q))) (fun {L I _ _} =>fun i => + ssp (fun res => + solve_lift (ifb (g_pow i) =.? x + then letb res := i in + res + else res))) res in + solve_lift res : both (L1 :|: fset [res_loc]) I1 (int32) in + let div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (prod x (inv y)) : both (L1 :|: L2 :|: fset [res_loc]) (I1 :|: I2) (int32) in + {| t_group_type := (@t_group_type); + q := (@q); + g := (@g); + g_pow_loc := (fset [] : {fset Location}); + g_pow := (@g_pow); + pow_loc := (fset [] : {fset Location}); + pow := (@pow); + one_loc := (fset [] : {fset Location}); + one := (@one); + prod_loc := (fset [] : {fset Location}); + prod := (@prod); + inv_loc := (fset [res_loc] : {fset Location}); + inv := (@inv); + div_loc := (fset [res_loc] : {fset Location}); + div := (@div)|}. +Solve All Obligations with exact int_eqdec. +Fail Next Obligation. + +Notation "'t_G'" := (t_z_17_). + +Equations n {L : {fset Location}} {I : Interface} : both L I (uint_size) := + n := + solve_lift (ret_both (20 : uint_size)) : both L I (uint_size). +Fail Next Obligation. + +Definition t_OvnContractState : choice_type := + (nseq t_group_type 20 × nseq int32 20 × nseq int32 20 × nseq t_group_type 20 × nseq int32 20 × int32). +Equations f_g_pow_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq t_group_type 20) := + f_g_pow_xis s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq t_group_type 20))) : both L I (nseq t_group_type 20). +Fail Next Obligation. +Equations f_zkp_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := + f_zkp_xis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq int32 20))) : both L I (nseq int32 20). +Fail Next Obligation. +Equations f_commit_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := + f_commit_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : nseq int32 20))) : both L I (nseq int32 20). +Fail Next Obligation. +Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq t_group_type 20) := + f_g_pow_xi_yi_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : nseq t_group_type 20))) : both L I (nseq t_group_type 20). +Fail Next Obligation. +Equations f_zkp_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := + f_zkp_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : nseq int32 20))) : both L I (nseq int32 20). +Fail Next Obligation. +Equations f_tally {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (int32) := + f_tally s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {f_g_pow_xis : both L0 I0 (nseq t_group_type 20)} {f_zkp_xis : both L1 I1 (nseq int32 20)} {f_commit_vis : both L2 I2 (nseq int32 20)} {f_g_pow_xi_yi_vis : both L3 I3 (nseq t_group_type 20)} {f_zkp_vis : both L4 I4 (nseq int32 20)} {f_tally : both L5 I5 (int32)} : both(L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := + Build_t_OvnContractState := + bind_both f_tally (fun f_tally => + bind_both f_zkp_vis (fun f_zkp_vis => + bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => + bind_both f_commit_vis (fun f_commit_vis => + bind_both f_zkp_xis (fun f_zkp_xis => + bind_both f_g_pow_xis (fun f_g_pow_xis => + solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both(L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). +Fail Next Obligation. +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). +Definition state_OVN : choice_type := + t_OvnContractState. + +Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {T : _} `{ t_Sized (T)} `{ t_HasInitContext (T) ('unit)} (ctx : both L1 I1 (T)) : both L1 I1 (t_Result ('bool) ('unit)) := + init_ovn_contract ctx := + Result_Ok (solve_lift (ret_both (true : 'bool))) : both L1 I1 (t_Result ('bool) ('unit)). +Fail Next Obligation. + +From ConCert.Utils Require Import Extras. +From ConCert.Utils Require Import Automation. +From ConCert.Execution Require Import Serializable. +From ConCert.Execution Require Import Blockchain. +From ConCert.Execution Require Import ContractCommon. + +Require Import ConCertLib. +(* Definition Setup := *) +Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (setup : unit) : ResultMonad.result state_OVN state_OVN. +Proof. + pose ctx.(ctx_from). + pose ctx.(ctx_origin). + pose (repr U32 ctx.(ctx_amount)). + + pose ((ctx.(ctx_from), ctx.(ctx_origin), repr ctx.(ctx_amount), 0 (* TODO *))). + apply ResultMonad.Ok. + eapply Build_t_OvnContractState. + Unshelve. + all: solve_ssprove_obligations. + Chain -> + ContractCallContext -> + state_OVN -> ResultMonad.result state_OVN state_OVN +(* st. *) + +Inductive Msg: Type := +| register : Msg +| commit_to_vote : Msg +| cast_vote : Msg +| tally : Msg. + +Print ChainBase. +Check @Contract. +(* Setup Msg State Error *) +(* Serializable Setup -> Serializable Msg -> Serializable State -> Serializable Error *) +Check build_contract. + +(* Instance BaseTypes : ChainBase := {| *) +(* Address := nseq int8 (usize 32); *) +(* address_eqb a b := a =.? b ; *) +(* address_eqb_spec a b := _ ;(* Bool.iff_reflect (a = b) (a array_eq b) (symmetry (eqb_leibniz a b)); *) *) +(* (* address_eqdec x y := (EqDecIsDecidable x y); *) *) +(* address_countable := nseq_countable _; *) +(* address_serializable := nseq_serializable _; *) +(* address_is_contract := (fun x => Nat.even (nat_from_be_bytes x)); |}. *) + +Instance serializeable_msg : Serializable Msg. +Admitted. + +Instance serializeable_state_ovn : Serializable state_OVN. +Admitted. + +Definition auction_contract : Contract _ (* Setup *) Msg state_OVN _. +Proof. + apply build_contract. + + apply init_OVN. + build_contract _ _. + + + +Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) : both L1 I1 (int32) := + select_private_voting_key random := + solve_lift (random .% q) : both L1 I1 (int32). +Fail Next Obligation. + +Equations v_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi : both L1 I1 (int32)) (xi : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) (int32) := + v_ZKP g_pow_xi xi := + solve_lift (ret_both (0 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). +Fail Next Obligation. + +Definition t_RegisterParam : choice_type := + (int32 × int32). +Equations f_i {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := + f_i s := + bind_both s (fun x => + solve_lift (ret_both (fst x : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_xi {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := + f_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_i : both L0 I0 (int32)} {f_xi : both L1 I1 (int32)} : both(L0:|:L1) (I0:|:I1) (t_RegisterParam) := + Build_t_RegisterParam := + bind_both f_xi (fun f_xi => + bind_both f_i (fun f_i => + solve_lift (ret_both ((f_i,f_xi) : (t_RegisterParam))))) : both(L0:|:L1) (I0:|:I1) (t_RegisterParam). +Fail Next Obligation. +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_i' ':=' y ')'" := (Build_t_RegisterParam (f_i := y) (f_xi := f_xi x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_xi' ':=' y ')'" := (Build_t_RegisterParam (f_i := f_i x) (f_xi := y)). + +Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {T : _} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} (ctx : both L1 I1 (T)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := + register_vote ctx state := + Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. +Definition receive_OVN_register (RegisterParam : _) (st : state_OVN) : choice_type := + register_vote st. + +Definition t_CastVoteParam : choice_type := + (int32 × int32 × 'bool). +Equations f_i {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_i s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_xi {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_vote {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I ('bool) := + f_vote s := + bind_both s (fun x => + solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). +Fail Next Obligation. +Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_i : both L0 I0 (int32)} {f_xi : both L1 I1 (int32)} {f_vote : both L2 I2 ('bool)} : both(L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := + Build_t_CastVoteParam := + bind_both f_vote (fun f_vote => + bind_both f_xi (fun f_xi => + bind_both f_i (fun f_i => + solve_lift (ret_both ((f_i,f_xi,f_vote) : (t_CastVoteParam)))))) : both(L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). +Fail Next Obligation. +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_i' ':=' y ')'" := (Build_t_CastVoteParam (f_i := y) (f_xi := f_xi x) (f_vote := f_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_i := f_i x) (f_xi := y) (f_vote := f_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_i := f_i x) (f_xi := f_xi x) (f_vote := y)). + +Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (int32)) : both L1 I1 ('bool) := + check_valid zkp := + solve_lift (ret_both (true : 'bool)) : both L1 I1 ('bool). +Fail Next Obligation. + +Definition prod2_loc : Location := + (int32 ; 2%nat). +Definition prod1_loc : Location := + (int32 ; 1%nat). +Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq int32 20)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32) := + compute_group_element_for_vote i xi vote xis := + letb prod1 loc(prod1_loc) := one in + letb prod1 := foldi_both (into_iter (Build_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun {L I _ _} =>fun j => + ssp (fun prod1 => + solve_lift (prod prod1 (xis.a[j])))) prod1 in + letb prod2 loc(prod2_loc) := one in + letb prod2 := foldi_both (into_iter (Build_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun {L I _ _} =>fun j => + ssp (fun prod2 => + solve_lift (prod prod2 (xis.a[j])))) prod2 in + letb Yi := div prod1 prod2 in + solve_lift (prod (pow Yi xi) (g_pow (ifb vote + then ret_both (1 : int32) + else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32). +Fail Next Obligation. + +Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) : both L1 I1 (int32) := + commit_to x := + solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). +Fail Next Obligation. + +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {impl HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (ctx : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := + commit_to_vote ctx state := + Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. +Definition receive_OVN_commit_to_vote (CastVoteParam : _) (st : state_OVN) : choice_type := + commit_to_vote st. + +Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (int32)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := + v_ZKP_one_out_of_two g_pow_vi vi := + solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). +Fail Next Obligation. + +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {impl HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (ctx : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := + cast_vote ctx state := + Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. +Definition receive_OVN_cast_vote (CastVoteParam : _) (st : state_OVN) : choice_type := + cast_vote st. + +Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + check_valid2 g_pow_xi_yi_vi zkp := + solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + check_commitment g_pow_xi_yi_vi zkp := + solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Definition t_TallyParameter : choice_type := + 'unit. +Equations Build_t_TallyParameter : both(fset []) (fset []) (t_TallyParameter) := + Build_t_TallyParameter := + solve_lift (ret_both ((_) : (t_TallyParameter))) : both(fset []) (fset []) (t_TallyParameter). +Fail Next Obligation. + +Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {impl HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (_ : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := + tally_votes _ state := + Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. +Definition receive_OVN_tally (TallyParameter : _) (st : state_OVN) : choice_type := + tally_votes st. diff --git a/ovn/proofs/ssprove/extraction/_CoqProject b/ovn/proofs/ssprove/extraction/_CoqProject index 2773cce..bdc2924 100644 --- a/ovn/proofs/ssprove/extraction/_CoqProject +++ b/ovn/proofs/ssprove/extraction/_CoqProject @@ -10,9 +10,10 @@ DDH.v OVN.v # Written by hand -Hacspec_lib.v -Core.v -HashMap.v +# Hacspec_lib.v +# Core.v +# HashMap.v +ConCertLib.v # Translated # Hacspec_ovn_Schnorr_Random_oracle.v diff --git a/ovn/proofs/ssprove/extraction/missing.org b/ovn/proofs/ssprove/extraction/missing.org new file mode 100644 index 0000000..50172cb --- /dev/null +++ b/ovn/proofs/ssprove/extraction/missing.org @@ -0,0 +1,25 @@ +better handling of +#+begin_src coq +foldi_both(* _list *) +#+end_src + +Named projections for records/structs: +#+begin_src coq +Definition t_RegisterParam : choice_type := + (int32 × int32). +Equations Build_t_RegisterParam {L : {fset Location}} {I : Interface} (f_i : both L I (int32)) (f_xi : both L I (int32)) : both L I (t_RegisterParam) := + Build_t_RegisterParam f_i f_xi := + bind_both f_xi (fun f_xi => + bind_both f_i (fun f_i => + solve_lift (ret_both ((f_i,f_xi) : (t_RegisterParam))))) : both L I (t_RegisterParam). +Fail Next Obligation. +(* Missing V *) +Equations f_i {L : {fset Location}} {I : Interface} (param : both L I (t_RegisterParam)) : both L I (int32) := + f_i param := + bind_both param (fun x => solve_lift ret_both (fst x : int32)) . +Fail Next Obligation. +Equations f_xi {L : {fset Location}} {I : Interface} (param : both L I (t_RegisterParam)) : both L I (int32) := + f_xi param := + bind_both param (fun x => solve_lift ret_both (snd x : int32)) . +Fail Next Obligation. +#+end_src diff --git a/ovn/src/ovn_smart.rs b/ovn/src/ovn_smart.rs index 47d00e6..aadaa9f 100644 --- a/ovn/src/ovn_smart.rs +++ b/ovn/src/ovn_smart.rs @@ -1,10 +1,15 @@ #![no_std] +#![feature(register_tool)] +#![register_tool(hax)] -// use core::*; -// use hacspec_lib::*; -// use creusot_contracts::*; +#[hax_lib_macros::skip] +extern crate hax_lib_macros; +#[hax_lib_macros::skip] +use hax_lib_macros::*; -use hacspec_concordium::*; // ::{HasLogger, HasInitContext, Logger, HasContractState, Reject, Serial, Deserial, Read, ParseResult, Write, Get, ParseError, HasReceiveContext, HasActions, Seek, Action, ReceiveContextExtern, ExternContext, Vec, to_bytes, test_infrastructure::InitContextTest}; +#[skip] +use hacspec_concordium::*; +#[skip] use hacspec_concordium_derive::*; /** Interface for group implementation */ @@ -50,11 +55,12 @@ impl Group for z_17 { fn inv(x: Self::group_type) -> Self::group_type { let mut res = 0; for i in 1..Self::q { - if Self::pow(Self::g, i) == x { - res = i + if Self::g_pow(i) == x { + res = i; } } - Self::q - res + res + // [0, 1, 9, 6, 13, 7, 3, 5, 15, 2, 12, 14, 10, 4, 11, 8, 16][x as usize] } fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { @@ -65,6 +71,9 @@ impl Group for z_17 { // } } +type G = z_17; +const n: usize = 20; + // struct eligible_votes { // v_id : u32, // } @@ -79,32 +88,46 @@ impl Group for z_17 { // use concordium_contracts_common::*; // extern crate concordium_std; -#[contract_state(contract = "OVN")] + +#[hax::contract_state(contract = "OVN")] +// #[cfg_attr(not(feature = "hax_compilation"), contract_state(contract = "OVN"))] #[derive(Serialize, SchemaType, Clone, Copy)] -pub struct OvnContractState { - g_pow_xis: [G::group_type; n], +pub struct OvnContractState/* */ { + g_pow_xis: [/*G*/::group_type; n], zkp_xis: [u32; n], commit_vis: [u32; n], - g_pow_xi_yi_vis: [G::group_type; n], + g_pow_xi_yi_vis: [/*G*/::group_type; n], zkp_vis: [u32; n], tally: u32, } -#[init(contract = "OVN")] -pub fn init_ovn_contract(ctx: &impl HasInitContext) -> Result { - Ok(true) +#[hax::init(contract = "OVN")] +// #[cfg_attr(not(feature = "hax_compilation"), init(contract = "OVN"))] +// pub fn init_ovn_contract(ctx: &impl HasInitContext) -> Result { +pub fn init_ovn_contract(ctx:&T) -> InitResult { + Ok(OvnContractState { + g_pow_xis: [G::one(); n], + zkp_xis: [0; n], + + commit_vis: [0; n], + + g_pow_xi_yi_vis: [G::one(); n], + zkp_vis: [0; n], + + tally: 0, + }) } /** Currently randomness needs to be injected */ -pub fn select_private_voting_key(random: u32) -> u32 { +pub fn select_private_voting_key/* */(random: u32) -> u32 { random % G::q // x_i \in_R Z_q; } /** TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics */ -pub fn ZKP(g_pow_xi: G::group_type, xi: u32) -> u32 { +pub fn ZKP/* */(g_pow_xi: /*G*/::group_type, xi: u32) -> u32 { 0 } @@ -114,26 +137,26 @@ pub struct RegisterParam { xi: u32, } -type G = z_17; -const n: usize = 20; - /** Primary function in round 1 */ -#[receive(contract = "OVN", name = "register", parameter = "RegisterParam")] -pub fn register_vote( - ctx: &impl HasReceiveContext, - state: OvnContractState, -) -> Result<(A, OvnContractState), ParseError> { - let params: RegisterParam = ctx.parameter_cursor().get()?; - - // let xi = select_private_voting_key::(params.random); - let g_pow_xi = G::g_pow(params.xi); - let zkp_xi = ZKP::(g_pow_xi, params.xi); - - let mut state_ret = state.clone(); - state_ret.g_pow_xis[params.i as usize] = g_pow_xi; - state_ret.zkp_xis[params.i as usize] = zkp_xi; - - Ok((A::accept(), state_ret)) +#[hax::receive(contract = "OVN", name = "register", parameter = "RegisterParam")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "register", parameter = "RegisterParam"))] +// pub fn register_vote( +// ctx: &impl HasReceiveContext, +// state: OvnContractState/* */, +// ) -> Result<(A, OvnContractState/* */), ParseError> { +pub fn register_vote( + ctx: &T, + state: OvnContractState/* */, +) -> Result<(A, OvnContractState/* */), ParseError> { + // let params : RegisterParam = ctx.parameter_cursor().get()?; // Result? + // let g_pow_xi = G::g_pow(params.xi); + // let zkp_xi = ZKP/* :: */(g_pow_xi, params.xi); + + // let mut state_ret = state.clone(); + // state_ret.g_pow_xis[params.i as usize] = g_pow_xi; + // state_ret.zkp_xis[params.i as usize] = zkp_xi; + + Ok((A::accept(), state/*_ret*/)) } #[derive(Serialize, SchemaType)] @@ -147,12 +170,12 @@ pub fn check_valid(zkp: u32) -> bool { true } -pub fn compute_group_element_for_vote( +pub fn compute_group_element_for_vote/* */( i: u32, xi: u32, vote: bool, - xis: [G::group_type; n], -) -> G::group_type { + xis: [/*G*/::group_type; n], +) -> /*G*/::group_type { let mut prod1 = G::one(); for j in 0..(i - 1) as usize { prod1 = G::prod(prod1, xis[j]); @@ -166,93 +189,100 @@ pub fn compute_group_element_for_vote( G::prod(G::pow(Yi, xi), G::g_pow(if vote { 1 } else { 0 })) } -pub fn commit_to(x: G::group_type) -> u32 { +pub fn commit_to/* */(x: /*G*/::group_type) -> u32 { 0 } /** Commitment before round 2 */ -#[receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] +#[hax::receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam"))] pub fn commit_to_vote( ctx: &impl HasReceiveContext, - state: OvnContractState, -) -> Result<(A, OvnContractState), ParseError> { - let params: CastVoteParam = ctx.parameter_cursor().get()?; - for zkp in state.zkp_xis { - check_valid(zkp); - () - } + state: OvnContractState/* */, +) -> Result<(A, OvnContractState/* */), ParseError> { + // let params: CastVoteParam = ctx.parameter_cursor().get()?; + // for zkp in state.zkp_xis { + // check_valid(zkp); + // () + // } - let g_pow_xi_yi_vi = - compute_group_element_for_vote::(params.i, params.xi, params.vote, state.g_pow_xis); - let commit_vi = commit_to::(g_pow_xi_yi_vi); + // let g_pow_xi_yi_vi = + // compute_group_element_for_vote/*:: */(params.i, params.xi, params.vote, state.g_pow_xis); + // let commit_vi = commit_to/*:: */(g_pow_xi_yi_vi); - let mut state_ret = state.clone(); - state_ret.commit_vis[params.i as usize] = commit_vi; - Ok((A::accept(), state_ret)) + // let mut state_ret = state.clone(); + // state_ret.commit_vis[params.i as usize] = commit_vi; + Ok((A::accept(), state/*_ret*/)) } /** Cramer, Damgård and Schoenmakers (CDS) technique */ -pub fn ZKP_one_out_of_two(g_pow_vi: G::group_type, vi: bool) -> u32 { +pub fn ZKP_one_out_of_two/* */(g_pow_vi: /*G*/::group_type, vi: bool) -> u32 { 32 // TODO } /** Primary function in round 2, also opens commitment */ -#[receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] +#[hax::receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam"))] pub fn cast_vote( ctx: &impl HasReceiveContext, - state: OvnContractState, -) -> Result<(A, OvnContractState), ParseError> { - let params: CastVoteParam = ctx.parameter_cursor().get()?; + state: OvnContractState/* */, +) -> Result<(A, OvnContractState/* */), ParseError> { + // let params: CastVoteParam = ctx.parameter_cursor().get()?; - let g_pow_xi_yi_vi = - compute_group_element_for_vote::(params.i, params.xi, params.vote, state.g_pow_xis); - let zkp_vi = ZKP_one_out_of_two::(g_pow_xi_yi_vi, params.vote); + // let g_pow_xi_yi_vi = + // compute_group_element_for_vote/*:: */(params.i, params.xi, params.vote, state.g_pow_xis); + // let zkp_vi = ZKP_one_out_of_two/*:: */(g_pow_xi_yi_vi, params.vote); - let mut state_ret = state.clone(); - state_ret.g_pow_xi_yi_vis[params.i as usize] = g_pow_xi_yi_vi; - state_ret.zkp_vis[params.i as usize] = zkp_vi; + // let mut state_ret = state.clone(); - Ok((A::accept(),state_ret)) + // let mut g_pow_xi_yi_vis_temp = state_ret.g_pow_xi_yi_vis.clone(); + // g_pow_xi_yi_vis_temp[params.i as usize] = g_pow_xi_yi_vi; + // state_ret.g_pow_xi_yi_vis = g_pow_xi_yi_vis_temp; + + // state_ret.zkp_vis[params.i as usize] = zkp_vi; + + Ok((A::accept(),state/*_ret*/)) } -pub fn check_valid2(g_pow_xi_yi_vi: G::group_type, zkp: u32) -> bool { +pub fn check_valid2/* */(g_pow_xi_yi_vi: /*G*/::group_type, zkp: u32) -> bool { true } -pub fn check_commitment(g_pow_xi_yi_vi: G::group_type, zkp: u32) -> bool { +pub fn check_commitment/* */(g_pow_xi_yi_vi: /*G*/::group_type, zkp: u32) -> bool { true } pub struct TallyParameter {} -#[receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] +#[hax::receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "tally", parameter = "TallyParameter"))] /** Anyone can tally the votes */ pub fn tally_votes( _: &impl HasReceiveContext, - state: OvnContractState, -) -> Result<(A, OvnContractState), ParseError> { - for i in 0..n { - check_valid2::(state.g_pow_xi_yi_vis[i], state.zkp_vis[i]); - check_commitment::(state.g_pow_xi_yi_vis[i], state.commit_vis[i]); - () - } + state: OvnContractState/* */, +) -> Result<(A, OvnContractState/* */), ParseError> { + // for i in 0..n { + // check_valid2/*:: */(state.g_pow_xi_yi_vis[i], state.zkp_vis[i]); + // check_commitment/*:: */(state.g_pow_xi_yi_vis[i], state.commit_vis[i]); + // () + // } - let mut vote_result = G::one(); - for g_pow_vote in state.g_pow_xi_yi_vis { - vote_result = G::prod(vote_result, g_pow_vote); - } + // let mut vote_result = G::one(); + // for g_pow_vote in state.g_pow_xi_yi_vis { + // vote_result = G::prod(vote_result, g_pow_vote); + // } - let mut tally = 0; - for i in 0..n as u32 { - // Should be while, but is bounded by n anyways! - if G::g_pow(i) == vote_result { - tally = i; - } - } + // let mut tally = 0; + // for i in 0..n as u32 { + // // Should be while, but is bounded by n anyways! + // if G::g_pow(i) == vote_result { + // tally = i; + // } + // } - let mut state_ret = state.clone(); - state_ret.tally = tally; + // let mut state_ret = state.clone(); + // state_ret.tally = tally; - Ok((A::accept(), state_ret)) + Ok((A::accept(), state/*_ret*/)) } // #[cfg(test)] From 1de68258ac0ca6a99e7e8e82dde4b5b39c2f7d9a Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 20 Sep 2023 15:18:33 +0200 Subject: [PATCH 21/86] Contract type defined --- Cargo.toml | 4 +- concordium-derive/Cargo.toml | 6 +- concordium-derive/src/lib.rs | 18 +- concordium/Cargo.toml | 8 +- .../ssprove/extraction/Hacspec_concordium.v | 146 +++ .../Hacspec_concordium_Concordium_impls.v | 176 +++ .../Hacspec_concordium_Concordium_prims.v | 29 + .../Hacspec_concordium_Concordium_traits.v | 169 +++ .../Hacspec_concordium_Concordium_types.v | 216 ++++ ...cspec_concordium_Concordium_types_Sealed.v | 41 + .../extraction/Hacspec_concordium_Constants.v | 40 + concordium/src/concordium.rs | 80 +- concordium/src/concordium_impls.rs | 1048 ----------------- concordium/src/concordium_prims.rs | 396 +------ concordium/src/concordium_traits.rs | 66 +- concordium/src/concordium_types.rs | 59 +- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 206 +++- .../ssprove/extraction/Hacspec_ovn_concert.v | 77 +- ovn/src/ovn_smart.rs | 30 +- rust-toolchain.toml | 2 +- 20 files changed, 1101 insertions(+), 1716 deletions(-) create mode 100644 concordium/proofs/ssprove/extraction/Hacspec_concordium.v create mode 100644 concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_impls.v create mode 100644 concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_prims.v create mode 100644 concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_traits.v create mode 100644 concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types.v create mode 100644 concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types_Sealed.v create mode 100644 concordium/proofs/ssprove/extraction/Hacspec_concordium_Constants.v diff --git a/Cargo.toml b/Cargo.toml index d3f6283..85fcc7e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,6 @@ members = [ # "halo2", # "weierstrass-curves", "ovn", - # "concordium", - # "concordium-derive", + "concordium", + "concordium-derive", ] diff --git a/concordium-derive/Cargo.toml b/concordium-derive/Cargo.toml index cbe9231..1a7a6ad 100644 --- a/concordium-derive/Cargo.toml +++ b/concordium-derive/Cargo.toml @@ -11,12 +11,12 @@ proc-macro = true [dependencies] hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } # hacspec-attributes = { path = "../../utils/attributes", version = "0.1.0-beta.1" , features = ["print_attributes", "hacspec_unsafe"] } # , features = ["hacspec_unsafe"] , , optional = true -creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "7763b3ae77205fba83182b9a6c3e69ad0b12fec7" } +# creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "7763b3ae77205fba83182b9a6c3e69ad0b12fec7" } concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850" , version = "=2.0.0" , default-features = false } # hacspec-concordium = { path = "../concordium" } syn = { version = "1.0.63", features = [ "full", "extra-traits" ] } -quote = "=1.0.0" -proc-macro2 = "1.0" +quote = "*" # "=1.0.0" +proc-macro2 = "*" # "1.0" # Reduce code size, at the cost of performance in allocation heavy-code. wee_alloc="0.4.5" diff --git a/concordium-derive/src/lib.rs b/concordium-derive/src/lib.rs index a1742af..3bb9b96 100644 --- a/concordium-derive/src/lib.rs +++ b/concordium-derive/src/lib.rs @@ -201,7 +201,7 @@ fn init_worker(attr: TokenStream, item: TokenStream) -> syn::Result contract_function_optional_args_tokens(&attrs, &amount_ident, &mut required_args); let mut out = if contains_attribute(attrs.iter(), "low_level") { - required_args.push("state: &mut ContractState"); + required_args.push("state: ContractState"); quote! { #[export_name = #wasm_export_fn_name] pub extern "C" fn #rust_export_fn_name(#amount_ident: hacspec_concordium::Amount) -> i32 { @@ -418,7 +418,7 @@ fn receive_worker(attr: TokenStream, item: TokenStream) -> syn::Result i32 { @@ -426,9 +426,10 @@ fn receive_worker(attr: TokenStream, item: TokenStream) -> syn::Result::open(()); let mut state = ContractState::open(()); - let res: Result = #fn_name(&ctx, #(#fn_optional_args, )* &mut state); + let res: Result<(Action, _), _> = #fn_name(&ctx, #(#fn_optional_args, )* state); match res { - Ok(act) => { + Ok((act, state_res)) => { + state = state_res; act.tag() as i32 } Err(reject) => { @@ -443,7 +444,7 @@ fn receive_worker(attr: TokenStream, item: TokenStream) -> syn::Result syn::Result::open(()); let mut state_bytes = ContractState::open(()); if let Ok(mut state) = (&mut state_bytes).get() { - let res: Result = #fn_name(&ctx, #(#fn_optional_args, )* &mut state); + let res : Result<(Action, _), _> = #fn_name(&ctx, #(#fn_optional_args, )* state); match res { - Ok(act) => { + Ok((act, state_res)) => { + state = state_res; let res = state_bytes .seek(SeekFrom::Start(0)) .and_then(|_| state.serial(&mut state_bytes)); @@ -529,7 +531,7 @@ fn contract_function_optional_args_tokens<'a, I: Copy + IntoIterator solve_lift reject_impl_convert_from_unit : both L1 I1 (t_Reject) in + {| from_loc := (fset [] : {fset Location}); + from := (@from)|}. +Fail Next Obligation. + +#[global] Program Instance t_Reject_t_From : t_From t_Reject t_ParseError := + let from := fun {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 (t_ParseError)) => solve_lift reject_impl_convert_from_parse_error : both L1 I1 (t_Reject) in + {| from_loc := (fset [] : {fset Location}); + from := (@from)|}. +Fail Next Obligation. + +Equations reject_impl_from_log_error {L1 : {fset Location}} {I1 : Interface} (le : both L1 I1 (t_LogError)) : both L1 I1 (t_Reject) := + reject_impl_from_log_error le := + solve_lift matchb le with + | LogError_Full => + Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (3 : int32)))) + | LogError_Malformed => + Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (4 : int32)))) + end : both L1 I1 (t_Reject). +Fail Next Obligation. + +#[global] Program Instance t_Reject_t_From : t_From t_Reject t_LogError := + let from := fun {L1 : {fset Location}} {I1 : Interface} (le : both L1 I1 (t_LogError)) => solve_lift (reject_impl_from_log_error le) : both L1 I1 (t_Reject) in + {| from_loc := (fset [] : {fset Location}); + from := (@from)|}. +Fail Next Obligation. + +Definition t_NewContractNameError : choice_type := + chFin (mkpos 4). +Equations NewContractNameError_NewContractNameErrorMissingInitPrefix {L : {fset Location}} {I : Interface} : both L I t_NewContractNameError := + NewContractNameError_NewContractNameErrorMissingInitPrefix := + solve_lift ret_both (fintype.Ordinal (n:=4) (m:=0) eq_refl : t_NewContractNameError) : both L I t_NewContractNameError. +Fail Next Obligation. +Equations NewContractNameError_NewContractNameErrorTooLong {L : {fset Location}} {I : Interface} : both L I t_NewContractNameError := + NewContractNameError_NewContractNameErrorTooLong := + solve_lift ret_both (fintype.Ordinal (n:=4) (m:=1) eq_refl : t_NewContractNameError) : both L I t_NewContractNameError. +Fail Next Obligation. +Equations NewContractNameError_NewContractNameErrorContainsDot {L : {fset Location}} {I : Interface} : both L I t_NewContractNameError := + NewContractNameError_NewContractNameErrorContainsDot := + solve_lift ret_both (fintype.Ordinal (n:=4) (m:=2) eq_refl : t_NewContractNameError) : both L I t_NewContractNameError. +Fail Next Obligation. +Equations NewContractNameError_NewContractNameErrorInvalidCharacters {L : {fset Location}} {I : Interface} : both L I t_NewContractNameError := + NewContractNameError_NewContractNameErrorInvalidCharacters := + solve_lift ret_both (fintype.Ordinal (n:=4) (m:=3) eq_refl : t_NewContractNameError) : both L I t_NewContractNameError. +Fail Next Obligation. + +Equations reject_impl_from_new_contract_name_error {L1 : {fset Location}} {I1 : Interface} (nre : both L1 I1 (t_NewContractNameError)) : both L1 I1 (t_Reject) := + reject_impl_from_new_contract_name_error nre := + solve_lift matchb nre with + | NewContractNameError_NewContractNameErrorMissingInitPrefix => + Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (5 : int32)))) + | NewContractNameError_NewContractNameErrorTooLong => + Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (6 : int32)))) + | NewContractNameError_NewContractNameErrorContainsDot => + Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (9 : int32)))) + | NewContractNameError_NewContractNameErrorInvalidCharacters => + Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (10 : int32)))) + end : both L1 I1 (t_Reject). +Fail Next Obligation. + +#[global] Program Instance t_Reject_t_From : t_From t_Reject t_NewContractNameError := + let from := fun {L1 : {fset Location}} {I1 : Interface} (nre : both L1 I1 (t_NewContractNameError)) => solve_lift (reject_impl_from_new_contract_name_error nre) : both L1 I1 (t_Reject) in + {| from_loc := (fset [] : {fset Location}); + from := (@from)|}. +Fail Next Obligation. + +Definition t_NewReceiveNameError : choice_type := + chFin (mkpos 3). +Equations NewReceiveNameError_NewReceiveNameErrorMissingDotSeparator {L : {fset Location}} {I : Interface} : both L I t_NewReceiveNameError := + NewReceiveNameError_NewReceiveNameErrorMissingDotSeparator := + solve_lift ret_both (fintype.Ordinal (n:=3) (m:=0) eq_refl : t_NewReceiveNameError) : both L I t_NewReceiveNameError. +Fail Next Obligation. +Equations NewReceiveNameError_NewReceiveNameErrorTooLong {L : {fset Location}} {I : Interface} : both L I t_NewReceiveNameError := + NewReceiveNameError_NewReceiveNameErrorTooLong := + solve_lift ret_both (fintype.Ordinal (n:=3) (m:=1) eq_refl : t_NewReceiveNameError) : both L I t_NewReceiveNameError. +Fail Next Obligation. +Equations NewReceiveNameError_NewReceiveNameErrorInvalidCharacters {L : {fset Location}} {I : Interface} : both L I t_NewReceiveNameError := + NewReceiveNameError_NewReceiveNameErrorInvalidCharacters := + solve_lift ret_both (fintype.Ordinal (n:=3) (m:=2) eq_refl : t_NewReceiveNameError) : both L I t_NewReceiveNameError. +Fail Next Obligation. + +Equations reject_impl_from_new_receive_name_error {L1 : {fset Location}} {I1 : Interface} (nre : both L1 I1 (t_NewReceiveNameError)) : both L1 I1 (t_Reject) := + reject_impl_from_new_receive_name_error nre := + solve_lift matchb nre with + | NewReceiveNameError_NewReceiveNameErrorMissingDotSeparator => + Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (7 : int32)))) + | NewReceiveNameError_NewReceiveNameErrorTooLong => + Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (8 : int32)))) + | NewReceiveNameError_NewReceiveNameErrorInvalidCharacters => + Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (11 : int32)))) + end : both L1 I1 (t_Reject). +Fail Next Obligation. + +#[global] Program Instance t_Reject_t_From : t_From t_Reject t_NewReceiveNameError := + let from := fun {L1 : {fset Location}} {I1 : Interface} (nre : both L1 I1 (t_NewReceiveNameError)) => solve_lift (reject_impl_from_new_receive_name_error nre) : both L1 I1 (t_Reject) in + {| from_loc := (fset [] : {fset Location}); + from := (@from)|}. +Fail Next Obligation. + +Equations reject_impl_from_not_payable_error {L : {fset Location}} {I : Interface} : both L I (t_Reject) := + reject_impl_from_not_payable_error := + solve_lift (Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (12 : int32))))) : both L I (t_Reject). +Fail Next Obligation. + +#[global] Program Instance t_Reject_t_From : t_From t_Reject t_NotPayableError := + let from := fun {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 (t_NotPayableError)) => solve_lift reject_impl_from_not_payable_error : both L1 I1 (t_Reject) in + {| from_loc := (fset [] : {fset Location}); + from := (@from)|}. +Fail Next Obligation. diff --git a/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_prims.v b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_prims.v new file mode 100644 index 0000000..ea58ff7 --- /dev/null +++ b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_prims.v @@ -0,0 +1,29 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. + Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Crate. +Export Crate. +Inductive Msg: Type :=. diff --git a/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_traits.v b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_traits.v new file mode 100644 index 0000000..12f69a5 --- /dev/null +++ b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_traits.v @@ -0,0 +1,169 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. + Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Crate. +Export Crate. + +Class t_HasParameter (Self : choice_type) := { + size_loc : {fset Location} ; + size : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: size_loc) I1 (int32) ; +}. + +Class t_HasChainMetadata (Self : choice_type) := { + slot_time_loc : {fset Location} ; + slot_time : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: slot_time_loc) I1 (t_Timestamp) ; +}. + +Class t_HasPolicy (Self : choice_type) := { + identity_provider_loc : {fset Location} ; + identity_provider : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: identity_provider_loc) I1 (int32) ; + created_at_loc : {fset Location} ; + created_at : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: created_at_loc) I1 (t_Timestamp) ; + valid_to_loc : {fset Location} ; + valid_to : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: valid_to_loc) I1 (t_Timestamp) ; + next_item_loc : {fset Location} ; + next_item : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (nseq int8 31) -> both (L1 :|: L2 :|: next_item_loc) (I1 :|: I2) ((t_Option ((t_AttributeTag × int8)) × nseq int8 31 × Self)) ; +}. + +Class t_HasCommonData (Self : choice_type) := { + t_PolicyType : choice_type ; + t_PolicyType_t_HasPolicy :> t_HasPolicy (t_PolicyType) ; + t_PolicyType_t_Sized :> t_Sized (t_PolicyType) ; + t_MetadataType : choice_type ; + t_MetadataType_t_HasChainMetadata :> t_HasChainMetadata (t_MetadataType) ; + t_MetadataType_t_Sized :> t_Sized (t_MetadataType) ; + t_ParamType : choice_type ; + t_ParamType_t_Read :> t_Read (t_ParamType) ; + t_ParamType_t_HasParameter :> t_HasParameter (t_ParamType) ; + t_ParamType_t_Sized :> t_Sized (t_ParamType) ; + t_PolicyIteratorType : choice_type ; + t_PolicyIteratorType_t_ExactSizeIterator :> t_ExactSizeIterator (t_PolicyIteratorType) ; + t_PolicyIteratorType_t_Iterator :> t_Iterator (t_PolicyIteratorType) ; + t_PolicyIteratorType_t_Sized :> t_Sized (t_PolicyIteratorType) ; + policies_loc : {fset Location} ; + policies : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: policies_loc) I1 (t_PolicyIteratorType) ; + metadata_loc : {fset Location} ; + metadata : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: metadata_loc) I1 (t_MetadataType) ; + parameter_cursor_loc : {fset Location} ; + parameter_cursor : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: parameter_cursor_loc) I1 (t_ParamType) ; +}. + +Class t_HasInitContext (Self : choice_type) := { + t_InitData : choice_type ; + t_InitData_t_Sized :> t_Sized (t_InitData) ; + open_loc : {fset Location} ; + open : forall {L1 I1}, both L1 I1 (t_InitData) -> both (L1 :|: open_loc) I1 (Self) ; + init_origin_loc : {fset Location} ; + init_origin : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: init_origin_loc) I1 (t_AccountAddress) ; +}. + +Class t_HasReceiveContext (Self : choice_type) := { + t_ReceiveData : choice_type ; + t_ReceiveData_t_Sized :> t_Sized (t_ReceiveData) ; + open_loc : {fset Location} ; + open : forall {L1 I1}, both L1 I1 (t_ReceiveData) -> both (L1 :|: open_loc) I1 (Self) ; + invoker_loc : {fset Location} ; + invoker : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: invoker_loc) I1 (t_AccountAddress) ; + self_address_loc : {fset Location} ; + self_address : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: self_address_loc) I1 (t_ContractAddress) ; + self_balance_loc : {fset Location} ; + self_balance : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: self_balance_loc) I1 (t_Amount) ; + sender_loc : {fset Location} ; + sender : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: sender_loc) I1 (t_Address) ; + owner_loc : {fset Location} ; + owner : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: owner_loc) I1 (t_AccountAddress) ; +}. + +Class t_HasContractState (Self : choice_type) := { + t_ContractStateData : choice_type ; + t_ContractStateData_t_Sized :> t_Sized (t_ContractStateData) ; + open_loc : {fset Location} ; + open : forall {L1 I1}, both L1 I1 (t_ContractStateData) -> both (L1 :|: open_loc) I1 (Self) ; + size_loc : {fset Location} ; + size : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: size_loc) I1 (int32) ; + truncate_loc : {fset Location} ; + truncate : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: truncate_loc) (I1 :|: I2) (Self) ; + reserve_loc : {fset Location} ; + reserve : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: reserve_loc) (I1 :|: I2) (('bool × Self)) ; +}. + +Class t_HasLogger (Self : choice_type) := { + init_loc : {fset Location} ; + init : forall {L1 I1}, both (L1 :|: init_loc) I1 (Self) ; + log_raw_loc : {fset Location} ; + log_raw : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (seq int8) -> both (L1 :|: L2 :|: log_raw_loc) (I1 :|: I2) ((t_Result ('unit) (t_LogError) × Self)) ; + log_loc : {fset Location} ; + log : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (S) -> both (L1 :|: L2 :|: log_loc) (I1 :|: I2) ((t_Result ('unit) (t_LogError) × Self)) ; +}. + +Class t_HasActions (Self : choice_type) := { + accept_loc : {fset Location} ; + accept : forall {L1 I1}, both (L1 :|: accept_loc) I1 (Self) ; + simple_transfer_loc : {fset Location} ; + simple_transfer : forall {L1 L2 I1 I2}, both L1 I1 (t_AccountAddress) -> both L2 I2 (t_Amount) -> both (L1 :|: L2 :|: simple_transfer_loc) (I1 :|: I2) (Self) ; + send_raw_loc : {fset Location} ; + send_raw : forall {L1 L2 L3 L4 I1 I2 I3 I4}, both L1 I1 (t_ContractAddress) -> both L2 I2 (t_ReceiveName) -> both L3 I3 (t_Amount) -> both L4 I4 (seq int8) -> both (L1 :|: L2 :|: L3 :|: L4 :|: send_raw_loc) (I1 :|: I2 :|: I3 :|: I4) (Self) ; + and_then_loc : {fset Location} ; + and_then : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (Self) -> both (L1 :|: L2 :|: and_then_loc) (I1 :|: I2) (Self) ; + or_else_loc : {fset Location} ; + or_else : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (Self) -> both (L1 :|: L2 :|: or_else_loc) (I1 :|: I2) (Self) ; +}. + +Class t_UnwrapAbort (Self : choice_type) := { + t_Unwrap : choice_type ; + t_Unwrap_t_Sized :> t_Sized (t_Unwrap) ; + unwrap_abort_loc : {fset Location} ; + unwrap_abort : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: unwrap_abort_loc) I1 (t_Unwrap) ; +}. + +Class t_ExpectReport (Self : choice_type) := { + t_Unwrap : choice_type ; + t_Unwrap_t_Sized :> t_Sized (t_Unwrap) ; + expect_report_loc : {fset Location} ; + expect_report : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (chString) -> both (L1 :|: L2 :|: expect_report_loc) (I1 :|: I2) (t_Unwrap) ; +}. + +Class t_ExpectErrReport (Self : choice_type) := { + t_Unwrap : choice_type ; + t_Unwrap_t_Sized :> t_Sized (t_Unwrap) ; + expect_err_report_loc : {fset Location} ; + expect_err_report : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (chString) -> both (L1 :|: L2 :|: expect_err_report_loc) (I1 :|: I2) (t_Unwrap) ; +}. + +Class t_ExpectNoneReport (Self : choice_type) := { + expect_none_report_loc : {fset Location} ; + expect_none_report : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (chString) -> both (L1 :|: L2 :|: expect_none_report_loc) (I1 :|: I2) ('unit) ; +}. + +Class t_SerialCtx (Self : choice_type) := { + serial_ctx_loc : {fset Location} ; + serial_ctx : forall {L1 L2 L3 I1 I2 I3}, both L1 I1 (Self) -> both L2 I2 (t_SizeLength) -> both L3 I3 (W) -> both (L1 :|: L2 :|: L3 :|: serial_ctx_loc) (I1 :|: I2 :|: I3) ((t_Result ('unit) (t_Err) × W)) ; +}. + +Class t_DeserialCtx (Self : choice_type) := { + deserial_ctx_loc : {fset Location} ; + deserial_ctx : forall {L1 L2 L3 I1 I2 I3}, both L1 I1 (t_SizeLength) -> both L2 I2 ('bool) -> both L3 I3 (R) -> both (L1 :|: L2 :|: L3 :|: deserial_ctx_loc) (I1 :|: I2 :|: I3) ((t_Result (Self) (t_ParseError) × R)) ; +}. diff --git a/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types.v b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types.v new file mode 100644 index 0000000..a7241e5 --- /dev/null +++ b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types.v @@ -0,0 +1,216 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. + Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Crate_Num. +Export Crate_Num. + +Definition t_ContractState : choice_type := + (int32). +Equations f_current_contract_state_position {L : {fset Location}} {I : Interface} (s : both L I (t_ContractState)) : both L I (int32) := + f_current_contract_state_position s := + bind_both s (fun x => + solve_lift (ret_both (x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_ContractState {L0 : {fset Location}} {I0 : Interface} {f_current_contract_state_position : both L0 I0 (int32)} : both L0 I0 (t_ContractState) := + Build_t_ContractState := + bind_both f_current_contract_state_position (fun f_current_contract_state_position => + solve_lift (ret_both ((f_current_contract_state_position) : (t_ContractState)))) : both L0 I0 (t_ContractState). +Fail Next Obligation. +Notation "'Build_t_ContractState' '[' x ']' '(' 'f_current_contract_state_position' ':=' y ')'" := (Build_t_ContractState (f_current_contract_state_position := y)). + +Definition t_Parameter : choice_type := + (int32). +Equations f_current_parameter_position {L : {fset Location}} {I : Interface} (s : both L I (t_Parameter)) : both L I (int32) := + f_current_parameter_position s := + bind_both s (fun x => + solve_lift (ret_both (x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_Parameter {L0 : {fset Location}} {I0 : Interface} {f_current_parameter_position : both L0 I0 (int32)} : both L0 I0 (t_Parameter) := + Build_t_Parameter := + bind_both f_current_parameter_position (fun f_current_parameter_position => + solve_lift (ret_both ((f_current_parameter_position) : (t_Parameter)))) : both L0 I0 (t_Parameter). +Fail Next Obligation. +Notation "'Build_t_Parameter' '[' x ']' '(' 'f_current_parameter_position' ':=' y ')'" := (Build_t_Parameter (f_current_parameter_position := y)). + +Definition t_AttributesCursor : choice_type := + (int32 × int16). +Equations f_current_attribute_cursor_position {L : {fset Location}} {I : Interface} (s : both L I (t_AttributesCursor)) : both L I (int32) := + f_current_attribute_cursor_position s := + bind_both s (fun x => + solve_lift (ret_both (fst x : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_remaining_items {L : {fset Location}} {I : Interface} (s : both L I (t_AttributesCursor)) : both L I (int16) := + f_remaining_items s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int16))) : both L I (int16). +Fail Next Obligation. +Equations Build_t_AttributesCursor {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_current_attribute_cursor_position : both L0 I0 (int32)} {f_remaining_items : both L1 I1 (int16)} : both (L0:|:L1) (I0:|:I1) (t_AttributesCursor) := + Build_t_AttributesCursor := + bind_both f_remaining_items (fun f_remaining_items => + bind_both f_current_attribute_cursor_position (fun f_current_attribute_cursor_position => + solve_lift (ret_both ((f_current_attribute_cursor_position,f_remaining_items) : (t_AttributesCursor))))) : both (L0:|:L1) (I0:|:I1) (t_AttributesCursor). +Fail Next Obligation. +Notation "'Build_t_AttributesCursor' '[' x ']' '(' 'f_current_attribute_cursor_position' ':=' y ')'" := (Build_t_AttributesCursor (f_current_attribute_cursor_position := y) (f_remaining_items := f_remaining_items x)). +Notation "'Build_t_AttributesCursor' '[' x ']' '(' 'f_remaining_items' ':=' y ')'" := (Build_t_AttributesCursor (f_current_attribute_cursor_position := f_current_attribute_cursor_position x) (f_remaining_items := y)). + +Definition t_Logger : choice_type := + ('unit). +Equations f__private_logger {L : {fset Location}} {I : Interface} (s : both L I (t_Logger)) : both L I ('unit) := + f__private_logger s := + bind_both s (fun x => + solve_lift (ret_both (x : 'unit))) : both L I ('unit). +Fail Next Obligation. +Equations Build_t_Logger {L0 : {fset Location}} {I0 : Interface} {f__private_logger : both L0 I0 ('unit)} : both L0 I0 (t_Logger) := + Build_t_Logger := + bind_both f__private_logger (fun f__private_logger => + solve_lift (ret_both ((f__private_logger) : (t_Logger)))) : both L0 I0 (t_Logger). +Fail Next Obligation. +Notation "'Build_t_Logger' '[' x ']' '(' 'f__private_logger' ':=' y ')'" := (Build_t_Logger (f__private_logger := y)). + +Definition t_LogError : choice_type := + chFin (mkpos 2). +Equations LogError_Full {L : {fset Location}} {I : Interface} : both L I t_LogError := + LogError_Full := + solve_lift ret_both (fintype.Ordinal (n:=2) (m:=0) eq_refl : t_LogError) : both L I t_LogError. +Fail Next Obligation. +Equations LogError_Malformed {L : {fset Location}} {I : Interface} : both L I t_LogError := + LogError_Malformed := + solve_lift ret_both (fintype.Ordinal (n:=2) (m:=1) eq_refl : t_LogError) : both L I t_LogError. +Fail Next Obligation. + +Definition t_NotPayableError : choice_type := + 'unit. +Equations Build_t_NotPayableError : both (fset []) (fset []) (t_NotPayableError) := + Build_t_NotPayableError := + solve_lift (ret_both ((_) : (t_NotPayableError))) : both (fset []) (fset []) (t_NotPayableError). +Fail Next Obligation. + +Definition t_Action : choice_type := + (int32). +Equations f__private_action {L : {fset Location}} {I : Interface} (s : both L I (t_Action)) : both L I (int32) := + f__private_action s := + bind_both s (fun x => + solve_lift (ret_both (x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_Action {L0 : {fset Location}} {I0 : Interface} {f__private_action : both L0 I0 (int32)} : both L0 I0 (t_Action) := + Build_t_Action := + bind_both f__private_action (fun f__private_action => + solve_lift (ret_both ((f__private_action) : (t_Action)))) : both L0 I0 (t_Action). +Fail Next Obligation. +Notation "'Build_t_Action' '[' x ']' '(' 'f__private_action' ':=' y ')'" := (Build_t_Action (f__private_action := y)). + +Equations tag_under_impl {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Action)) : both L1 I1 (int32) := + tag_under_impl self := + solve_lift (f__private_action self) : both L1 I1 (int32). +Fail Next Obligation. + +Equations v___ {L : {fset Location}} {I : Interface} : both L I ('unit) := + v___ := + solve_lift (ret_both (tt : 'unit)) : both L I ('unit). +Fail Next Obligation. + +Equations refinement_under___ {L1 : {fset Location}} {I1 : Interface} (error_code : both L1 I1 (t_NonZeroI32)) : both L1 I1 ('bool) := + refinement_under___ error_code := + solve_lift (ret_both (true : 'bool)) : both L1 I1 ('bool). +Fail Next Obligation. + +Definition t_Reject : choice_type := + (t_NonZeroI32). +Equations f_error_code {L : {fset Location}} {I : Interface} (s : both L I (t_Reject)) : both L I (t_NonZeroI32) := + f_error_code s := + bind_both s (fun x => + solve_lift (ret_both (x : t_NonZeroI32))) : both L I (t_NonZeroI32). +Fail Next Obligation. +Equations Build_t_Reject {L0 : {fset Location}} {I0 : Interface} {f_error_code : both L0 I0 (t_NonZeroI32)} : both L0 I0 (t_Reject) := + Build_t_Reject := + bind_both f_error_code (fun f_error_code => + solve_lift (ret_both ((f_error_code) : (t_Reject)))) : both L0 I0 (t_Reject). +Fail Next Obligation. +Notation "'Build_t_Reject' '[' x ']' '(' 'f_error_code' ':=' y ')'" := (Build_t_Reject (f_error_code := y)). + +#[global] Program Instance t_Reject_t_Default : t_Default t_Reject := + + {| |}. +Fail Next Obligation. + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +Definition t_ReceiveResult {A : _} : choice_type := + t_Result (A) (t_Reject). + +Definition t_InitResult {S : _} : choice_type := + t_Result (S) (t_Reject). + +Definition t_ExternContext {T : _} `{ t_Sized (T)} `{ t_ContextType (T)} : choice_type := + (t_PhantomData (T)). +Equations f_marker {L : {fset Location}} {I : Interface} {T : _} `{ t_Sized (T)} `{ t_ContextType (T)} (s : both L I (t_ExternContext)) : both L I (t_PhantomData (T)) := + f_marker s := + bind_both s (fun x => + solve_lift (ret_both (x : t_PhantomData (T)))) : both L I (t_PhantomData (T)). +Fail Next Obligation. +Equations Build_t_ExternContext {L0 : {fset Location}} {I0 : Interface} {T : _} `{ t_Sized (T)} `{ t_ContextType (T)} {f_marker : both L0 I0 (t_PhantomData (T))} : both L0 I0 (t_ExternContext) := + Build_t_ExternContext := + bind_both f_marker (fun f_marker => + solve_lift (ret_both ((f_marker) : (t_ExternContext)))) : both L0 I0 (t_ExternContext). +Fail Next Obligation. +Notation "'Build_t_ExternContext' '[' x ']' '(' 'f_marker' ':=' y ')'" := (Build_t_ExternContext (f_marker := y)). + +Definition t_ChainMetaExtern : choice_type := + 'unit. +Equations Build_t_ChainMetaExtern : both (fset []) (fset []) (t_ChainMetaExtern) := + Build_t_ChainMetaExtern := + solve_lift (ret_both ((_) : (t_ChainMetaExtern))) : both (fset []) (fset []) (t_ChainMetaExtern). +Fail Next Obligation. + +Definition t_InitContextExtern : choice_type := + 'unit. +Equations Build_t_InitContextExtern : both (fset []) (fset []) (t_InitContextExtern) := + Build_t_InitContextExtern := + solve_lift (ret_both ((_) : (t_InitContextExtern))) : both (fset []) (fset []) (t_InitContextExtern). +Fail Next Obligation. + +Definition t_ReceiveContextExtern : choice_type := + 'unit. +Equations Build_t_ReceiveContextExtern : both (fset []) (fset []) (t_ReceiveContextExtern) := + Build_t_ReceiveContextExtern := + solve_lift (ret_both ((_) : (t_ReceiveContextExtern))) : both (fset []) (fset []) (t_ReceiveContextExtern). +Fail Next Obligation. + +(*Not implemented yet? todo(item)*) diff --git a/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types_Sealed.v b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types_Sealed.v new file mode 100644 index 0000000..c811594 --- /dev/null +++ b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types_Sealed.v @@ -0,0 +1,41 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. + Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Super. +Export Super. + +Class t_ContextType (Self : choice_type) := { +}. + +#[global] Program Instance t_InitContextExtern_t_ContextType : t_ContextType t_InitContextExtern := + + {| |}. +Fail Next Obligation. + +#[global] Program Instance t_ReceiveContextExtern_t_ContextType : t_ContextType t_ReceiveContextExtern := + + {| |}. +Fail Next Obligation. diff --git a/concordium/proofs/ssprove/extraction/Hacspec_concordium_Constants.v b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Constants.v new file mode 100644 index 0000000..a0cffe6 --- /dev/null +++ b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Constants.v @@ -0,0 +1,40 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. + Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Equations v_MAX_CONTRACT_STATE_SIZE {L : {fset Location}} {I : Interface} : both L I (int32) := + v_MAX_CONTRACT_STATE_SIZE := + solve_lift (ret_both (16384 : int32)) : both L I (int32). +Fail Next Obligation. + +Equations v_MAX_LOG_SIZE {L : {fset Location}} {I : Interface} : both L I (uint_size) := + v_MAX_LOG_SIZE := + solve_lift (ret_both (512 : uint_size)) : both L I (uint_size). +Fail Next Obligation. + +Equations v_MAX_NUM_LOGS {L : {fset Location}} {I : Interface} : both L I (uint_size) := + v_MAX_NUM_LOGS := + solve_lift (ret_both (64 : uint_size)) : both L I (uint_size). +Fail Next Obligation. diff --git a/concordium/src/concordium.rs b/concordium/src/concordium.rs index 16d2265..0d6aea0 100644 --- a/concordium/src/concordium.rs +++ b/concordium/src/concordium.rs @@ -3,24 +3,18 @@ no_std, feature(alloc_error_handler, core_intrinsics) )] +#![feature(register_tool)] +#![register_tool(hax)] + +#[hax_lib_macros::skip] +extern crate hax_lib_macros; +#[hax_lib_macros::skip] +use hax_lib_macros::*; #[cfg(not(feature = "hacspec"))] #[cfg(not(feature = "std"))] pub extern crate alloc; -// TODO: -// #[cfg(not(feature = "hacspec"))] -// #[cfg(not(feature = "std"))] -// #[alloc_error_handler] -// fn on_oom(_layout: alloc::alloc::Layout) -> ! { -// #[cfg(target_arch = "wasm32")] -// unsafe { -// core::arch::wasm32::unreachable() -// } -// #[cfg(not(target_arch = "wasm32"))] -// loop {} -// } - /// Terminate execution immediately without panicking. /// When the `std` feature is enabled this is just [std::process::abort](https://doc.rust-lang.org/std/process/fn.abort.html). /// When `std` is not present and the target architecture is `wasm32` this will @@ -41,19 +35,6 @@ pub fn trap() -> ! { core::intrinsics::abort() } -// TODO: -// #[cfg(not(feature = "hacspec"))] -// #[cfg(not(feature = "std"))] -// #[panic_handler] -// fn abort_panic(_info: &core::panic::PanicInfo) -> ! { -// #[cfg(target_arch = "wasm32")] -// unsafe { -// core::arch::wasm32::unreachable() -// } -// #[cfg(not(target_arch = "wasm32"))] -// loop {} -// } - // Provide some re-exports to make it easier to use the library. // This should be expanded in the future. /// Re-export. @@ -64,47 +45,21 @@ pub use alloc::{borrow::ToOwned, string, string::String, string::ToString, vec, #[cfg(not(feature = "hacspec"))] #[cfg(not(feature = "std"))] pub use core::{convert, hash, marker, mem, num, result::*}; -#[cfg(not(feature = "hacspec"))] -#[cfg(feature = "std")] -pub(crate) use std::vec; - -/// Re-export. -#[cfg(not(feature = "hacspec"))] -#[cfg(feature = "std")] -pub use std::{convert, hash, marker, mem, num, string::String, vec::Vec}; #[cfg(not(feature = "hacspec"))] #[cfg(not(feature = "std"))] pub use alloc::collections; -#[cfg(not(feature = "hacspec"))] -#[cfg(feature = "std")] -pub use std::collections; pub mod constants; mod concordium_prims; mod concordium_types; mod concordium_traits; -mod concordium_impls; -pub mod test_infrastructure; +// pub mod test_infrastructure; use concordium_prims::*; // TODO: Does not re-export anything, nothing is public enough (removed pub) pub use concordium_types::*; pub use concordium_traits::*; -pub use concordium_impls::*; - -// TODO: Package into module -// #[cfg(not(feature = "hacspec"))] -// pub mod collections { -// #[cfg(not(feature = "std"))] -// use alloc::collections; -// #[cfg(feature = "std")] -// use std::collections; - -// pub use collections::*; -// pub use collections::{BTreeMap, BTreeSet}; -// pub use concordium_contracts_common::{HashMap, HashSet}; -// } #[cfg(not(feature = "hacspec"))] extern crate concordium_contracts_common; @@ -118,22 +73,3 @@ pub use concordium_contracts_common::*; extern crate hacspec_concordium_derive; #[cfg(not(feature = "hacspec"))] pub use hacspec_concordium_derive::*; - -#[cfg(not(feature = "hacspec"))] -extern crate wee_alloc; -// Use `wee_alloc` as the global allocator to reduce code size. -#[cfg(not(feature = "hacspec"))] -#[global_allocator] -static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; - -#[cfg(not(feature = "hacspec"))] -extern crate hacspec_lib; -// pub use hacspec_lib::*; - -// #[cfg(feature = "hacspec")] -// use hacspec_attributes::*; - -#[cfg(not(feature = "hacspec"))] -extern crate creusot_contracts; -#[cfg(not(feature = "hacspec"))] -use creusot_contracts::*; // {ensures, trusted}; // requires, diff --git a/concordium/src/concordium_impls.rs b/concordium/src/concordium_impls.rs index feeed53..e69de29 100644 --- a/concordium/src/concordium_impls.rs +++ b/concordium/src/concordium_impls.rs @@ -1,1048 +0,0 @@ -#[cfg(not(feature = "hacspec"))] -use crate::{ - // collections::{BTreeMap, BTreeSet}, - convert::{self}, // , TryFrom, TryInto - // hash::Hash, - num::NonZeroI32, - trap, - vec::Vec, - // String, - * -}; - -#[cfg(not(feature = "hacspec"))] -extern crate hacspec_lib; - -use hacspec_lib::*; - -#[cfg(not(feature = "hacspec"))] -use hacspec_lib::Seq; // TODO: fix name collision - -use concordium_prims::*; -use concordium_types::*; -use concordium_traits::*; - -pub type RejectHacspec = i32; - -pub fn reject_impl_deafult() -> RejectHacspec { - -2_147_483_648i32 // i32::MIN -} - -pub fn new_reject_impl(x: i32) -> Option:: { // Option - // TODO: fix 'identifier is not a constant' error (Seems to be fixed by some import?) - if x < 0i32 { - Option::::Some(x) - } else { - Option::::None - } -} - -#[cfg(not(feature = "hacspec"))] -#[trusted] -#[ensures(!(result == 0i32))] -pub fn non_zero_i32(v : i32) -> NonZeroI32 { - unsafe { NonZeroI32::new_unchecked(v) } -} - -#[cfg(not(feature = "hacspec"))] -pub fn coerce_hacspec_to_rust_reject(hacspec_reject: RejectHacspec) -> Reject { - Reject { - error_code: non_zero_i32(hacspec_reject), - } -} - -#[ensures(!(result == 0i32))] // != -pub fn reject_impl_convert_from_unit() -> RejectHacspec { - -2_147_483_648i32 + 1i32 // i32::MIN -} - -#[ensures(!(result == 0i32))] // != -pub fn reject_impl_convert_from_parse_error() -> RejectHacspec { - -2_147_483_648i32 + 2i32 // i32::MIN -} - -#[cfg(not(feature = "hacspec"))] -impl convert::From<()> for Reject { - #[inline(always)] - fn from(_: ()) -> Self { - coerce_hacspec_to_rust_reject(reject_impl_convert_from_unit()) - } -} - -#[cfg(not(feature = "hacspec"))] -impl convert::From for Reject { - #[inline(always)] - fn from(_: ParseError) -> Self { - coerce_hacspec_to_rust_reject(reject_impl_convert_from_parse_error()) - } -} - -#[ensures(!(result == 0i32))] // != -pub fn reject_impl_from_log_error(le: LogError) -> RejectHacspec { - match le { - LogError::Full => -2_147_483_648i32 + 3i32, // i32::MIN - LogError::Malformed => -2_147_483_648i32 + 4i32, // i32::MIN - } -} - -#[cfg(not(feature = "hacspec"))] -/// Full is mapped to i32::MIN+3, Malformed is mapped to i32::MIN+4. -impl From for Reject { - #[inline(always)] - fn from(le: LogError) -> Self { - coerce_hacspec_to_rust_reject(reject_impl_from_log_error(le)) - } -} - -#[derive(Clone)] // , Debug, PartialEq, Eq -pub enum NewContractNameError { - NewContractNameErrorMissingInitPrefix, - NewContractNameErrorTooLong, - NewContractNameErrorContainsDot, - NewContractNameErrorInvalidCharacters, -} - -#[ensures(!(result == 0i32))] // != -pub fn reject_impl_from_new_contract_name_error(nre: NewContractNameError) -> RejectHacspec { - match nre { - NewContractNameError::NewContractNameErrorMissingInitPrefix => -2_147_483_648i32 + 5i32, // i32::MIN - NewContractNameError::NewContractNameErrorTooLong => -2_147_483_648i32 + 6i32, // i32::MIN - NewContractNameError::NewContractNameErrorContainsDot => -2_147_483_648i32 + 9i32, // i32::MIN - NewContractNameError::NewContractNameErrorInvalidCharacters => -2_147_483_648i32 + 10i32, // i32::MIN - } -} - -#[cfg(not(feature = "hacspec"))] -/// MissingInitPrefix is mapped to i32::MIN + 5, -/// TooLong to i32::MIN + 6, -/// ContainsDot to i32::MIN + 9, and -/// InvalidCharacters to i32::MIN + 10. -impl From for Reject { - fn from(nre: NewContractNameError) -> Self { - coerce_hacspec_to_rust_reject(reject_impl_from_new_contract_name_error(nre)) - } -} - -#[derive(Clone)] // , Debug, PartialEq, Eq -pub enum NewReceiveNameError { - NewReceiveNameErrorMissingDotSeparator, - NewReceiveNameErrorTooLong, - NewReceiveNameErrorInvalidCharacters, -} - -#[ensures(!(result == 0i32))] // != -pub fn reject_impl_from_new_receive_name_error(nre: NewReceiveNameError) -> RejectHacspec { - match nre { - NewReceiveNameError::NewReceiveNameErrorMissingDotSeparator => -2_147_483_648i32 + 7i32, // i32::MIN - NewReceiveNameError::NewReceiveNameErrorTooLong => -2_147_483_648i32 + 8i32, // i32::MIN - NewReceiveNameError::NewReceiveNameErrorInvalidCharacters => -2_147_483_648i32 + 11i32, // i32::MIN - } -} - -#[cfg(not(feature = "hacspec"))] -/// MissingDotSeparator is mapped to i32::MIN + 7, -/// TooLong to i32::MIN + 8, and -/// InvalidCharacters to i32::MIN + 11. -impl From for Reject { - fn from(nre: NewReceiveNameError) -> Self { - coerce_hacspec_to_rust_reject(reject_impl_from_new_receive_name_error(nre)) - } -} - -#[ensures(!(result == 0i32))] // != -pub fn reject_impl_from_not_payable_error() -> RejectHacspec { - -2_147_483_648i32 + 12i32 // i32::MIN -} - -#[cfg(not(feature = "hacspec"))] -/// The error code is i32::MIN + 12 -impl From for Reject { - #[inline(always)] - fn from(_: NotPayableError) -> Self { - coerce_hacspec_to_rust_reject(reject_impl_from_not_payable_error()) - } -} - -pub type ContractStateHacspec = u32; - -#[derive(Copy, Clone)] // , Debug, PartialEq, Eq -pub enum SeekFromHacspec { - /// Sets the offset to the provided number of bytes. - Start(u64), - - /// Sets the offset to the size of this object plus the specified number of - /// bytes. - /// - /// It is possible to seek beyond the end of an object, but it's an error to - /// seek before byte 0. - End(i64), - - /// Sets the offset to the current position plus the specified number of - /// bytes. - /// - /// It is possible to seek beyond the end of an object, but it's an error to - /// seek before byte 0. - Current(i64), -} - -pub type U32Option = Option; -pub type I64Option = Option; - -// #[requires(forall pos === SeekFrom::End(delta) ==> exists current_position.checked_add(delta as u32) == U32Option::Some(b))] -pub fn contract_state_impl_seek(current_position: ContractStateHacspec, end : u32, pos: SeekFromHacspec) -> Result<(ContractStateHacspec, u64), ()> { - match pos { - SeekFromHacspec::Start(offset) => Result::<(ContractStateHacspec, u64), ()>::Ok((offset as u32, offset)), - SeekFromHacspec::End(delta) => { - if delta >= 0_i64 { - match current_position.checked_add(delta as u32) { - U32Option::Some(b) => Result::<(ContractStateHacspec, u64), ()>::Ok((b, b as u64)), - U32Option::None => Result::<(ContractStateHacspec, u64), ()>::Err(()), - } - } else { - match delta.checked_abs() { - I64Option::Some(before) => - { - if (before as u32) <= end { - Result::<(ContractStateHacspec, u64), ()>::Ok(((end - (before as u32)), (end - (before as u32)) as u64)) - } - else { - Result::<(ContractStateHacspec, u64), ()>::Err(()) - } - } - I64Option::None => Result::<(ContractStateHacspec, u64), ()>::Err(()), - } - } - } - SeekFromHacspec::Current(delta) => { - if delta >= 0_i64 { - match current_position.checked_add(delta as u32) { - U32Option::Some(offset) => Result::<(ContractStateHacspec, u64), ()>::Ok((offset, offset as u64)), - U32Option::None => Result::<(ContractStateHacspec, u64), ()>::Err(()), - } - } else { - match delta.checked_abs() { - I64Option::Some(b) => match current_position.checked_sub(b as u32) { - U32Option::Some(offset) => Result::<(ContractStateHacspec, u64), ()>::Ok((offset, offset as u64)), - U32Option::None => Result::<(ContractStateHacspec, u64), ()>::Err(()), - }, - I64Option::None => Result::<(ContractStateHacspec, u64), ()>::Err(()), - } - } - } - } -} - -#[cfg(not(feature = "hacspec"))] -pub fn coerce_rust_to_hacspec_contract_state( - rust_contract_state: &mut ContractState, -) -> ContractStateHacspec { - rust_contract_state.current_position.clone() -} - -#[cfg(not(feature = "hacspec"))] -pub fn coerce_hacspec_to_rust_contract_state( - rust_contract_state: &mut ContractState, - hacspec_contract_state: ContractStateHacspec, -) { - rust_contract_state.current_position = hacspec_contract_state; -} - -#[cfg(not(feature = "hacspec"))] -pub fn coerce_hacspec_to_rust_seek_result( - rust_contract_state: &mut ContractState, - hacspec_seek_result: Result<(ContractStateHacspec, u64), ()>, -) -> Result { - let (hacspec_result, rust_result) = hacspec_seek_result?; - coerce_hacspec_to_rust_contract_state(rust_contract_state, hacspec_result); - Ok(rust_result) -} - -#[cfg(not(feature = "hacspec"))] -pub fn coerce_rust_to_hacspec_seek_from(rust_seek_from: SeekFrom) -> SeekFromHacspec { - match rust_seek_from { - SeekFrom::Start(v) => SeekFromHacspec::Start(v), - SeekFrom::End(v) => SeekFromHacspec::End(v), - SeekFrom::Current(v) => SeekFromHacspec::Current(v), - } -} - -#[cfg(not(feature = "hacspec"))] -/// # Contract state trait implementations. -impl Seek for ContractState { - type Err = (); - - fn seek(&mut self, pos: SeekFrom) -> Result { - let contract_state = coerce_rust_to_hacspec_contract_state(self); - coerce_hacspec_to_rust_seek_result( - self, - contract_state_impl_seek( - contract_state, - self.size(), - coerce_rust_to_hacspec_seek_from(pos), - ), - ) - } -} - -pub fn contract_state_impl_read_read( - current_position: ContractStateHacspec, - buf : PublicByteSeq, -) -> (ContractStateHacspec, usize) { - let (_buf, num_read) = load_state_hacspec(buf, current_position); - (current_position + num_read, num_read as usize) -} - -/// Read a u32 in little-endian format. This is optimized to not -/// initialize a dummy value before calling an external function. -pub fn contract_state_impl_read_read_u64( - current_position: ContractStateHacspec, -) -> (ContractStateHacspec, Result) { - // let mut bytes: MaybeUninit<[u8; 8]> = MaybeUninit::uninit(); - let buf = PublicByteSeq::new(8); - let (buf, num_read) = load_state_hacspec(buf, current_position); - (current_position + num_read, - if num_read == 8u32 { - Result::::Ok(u64_from_le_bytes(u64Word::from_seq(&buf))) - } else { - Result::::Err(()) - }) // num_read as u64 -} - -/// Read a u32 in little-endian format. This is optimized to not -/// initialize a dummy value before calling an external function. -pub fn contract_state_impl_read_read_u32( - current_position: ContractStateHacspec, -) -> (ContractStateHacspec, Result) { - // let mut bytes: MaybeUninit<[u8; 4]> = MaybeUninit::uninit(); - let buf = PublicByteSeq::new(4); - let (buf, num_read) = load_state_hacspec(buf, current_position); - (current_position + num_read, - if num_read == 4u32 { - Result::::Ok(u32_from_le_bytes(u32Word::from_seq(&buf))) - } else { - Result::::Err(()) - }) // num_read as u64 -} - -/// Read a u8 in little-endian format. This is optimized to not -/// initialize a dummy value before calling an external function. -pub fn contract_state_impl_read_read_u8( - current_position: ContractStateHacspec, -) -> (ContractStateHacspec, Result) { - let buf = PublicByteSeq::new(1); - let (buf, num_read) = load_state_hacspec(buf, current_position); - (current_position + num_read, - if num_read == 1u32 { - Result::::Ok(buf[0]) - } else { - Result::::Err(()) - }) // num_read as u64 -} - -#[cfg(not(feature = "hacspec"))] -impl Read for ContractState { - fn read(&mut self, buf: &mut [u8]) -> ParseResult { - let (cs, nr) = contract_state_impl_read_read( - coerce_rust_to_hacspec_contract_state(self), - coerce_rust_to_hacspec_public_byte_seq(buf), - ); - coerce_hacspec_to_rust_contract_state(self, cs); - Ok(nr) - } - - // TODO: !! Probably incorrect !! - /// Read a `u32` in little-endian format. This is optimized to not - /// initialize a dummy value before calling an external function. - fn read_u64(&mut self) -> ParseResult { - let (cs, nr) = - contract_state_impl_read_read_u64(coerce_rust_to_hacspec_contract_state(self)); - coerce_hacspec_to_rust_contract_state(self, cs); - match nr { - Result::::Ok(a) => ParseResult::::Ok(a), - Result::::Err(_) => ParseResult::::Err(ParseError::default()), - } - } - - /// Read a `u32` in little-endian format. This is optimized to not - /// initialize a dummy value before calling an external function. - fn read_u32(&mut self) -> ParseResult { - let (cs, nr) = - contract_state_impl_read_read_u32(coerce_rust_to_hacspec_contract_state(self)); - coerce_hacspec_to_rust_contract_state(self, cs); - match nr { - Result::::Ok(a) => ParseResult::::Ok(a), - Result::::Err(_) => ParseResult::::Err(ParseError::default()), - } - } - - /// Read a `u8` in little-endian format. This is optimized to not - /// initialize a dummy value before calling an external function. - fn read_u8(&mut self) -> ParseResult { - let (cs, nr) = - contract_state_impl_read_read_u8(coerce_rust_to_hacspec_contract_state(self)); - coerce_hacspec_to_rust_contract_state(self, cs); - match nr { - Result::::Ok(a) => ParseResult::::Ok(a), - Result::::Err(_) => ParseResult::::Err(ParseError::default()), - } - } -} - -pub fn contract_state_impl_write( - current_position: ContractStateHacspec, - buf: PublicByteSeq, -) -> Result<(ContractStateHacspec, usize), ()> { - if current_position.checked_add(buf.len() as u32).is_none() { - Result::<(ContractStateHacspec, usize), ()>::Err(())?; - } - let (_buf, num_bytes) = write_state_hacspec(buf, current_position); - Result::<(ContractStateHacspec, usize), ()>::Ok(( - current_position + num_bytes, - num_bytes as usize, - )) -} - -#[cfg(not(feature = "hacspec"))] -impl Write for ContractState { - type Err = (); - - fn write(&mut self, buf: &[u8]) -> Result { - let (cs, nr) = contract_state_impl_write( - coerce_rust_to_hacspec_contract_state(self), - coerce_rust_to_hacspec_public_byte_seq(buf), - )?; - coerce_hacspec_to_rust_contract_state(self, cs); - Ok(nr) - } -} - -pub fn has_contract_state_impl_for_contract_state_open() -> ContractStateHacspec { - 0_u32 -} - -pub fn has_contract_state_impl_for_contract_state_reserve( - len: u32, -) -> bool { - let cur_size = state_size_hacspec(); - if cur_size < len { - resize_state_hacspec(len) == 1_u32 - } else { - true - } -} - -pub fn has_contract_state_impl_for_contract_state_truncate( - current_position : ContractStateHacspec, - cur_size: u32, - new_size: u32, -) -> ContractStateHacspec { - if cur_size > new_size { - resize_state_hacspec(new_size); - } - if new_size < current_position { - new_size - } - else { - current_position - } -} - -#[cfg(not(feature = "hacspec"))] -impl HasContractState<()> for ContractState { - type ContractStateData = (); - - #[inline(always)] - fn open(_: Self::ContractStateData) -> Self { - ContractState { - current_position: has_contract_state_impl_for_contract_state_open(), - } - } - - fn reserve(&mut self, len: u32) -> bool { - has_contract_state_impl_for_contract_state_reserve(len) - } - - #[inline(always)] - fn size(&self) -> u32 { - state_size_hacspec() - } - - fn truncate(&mut self, new_size: u32) { - let current_position = coerce_rust_to_hacspec_contract_state(self); - coerce_hacspec_to_rust_contract_state( - self, - has_contract_state_impl_for_contract_state_truncate( - current_position, - self.size(), - new_size, - ), - ) - } -} - -pub type ParameterHacspec = u32; - -pub fn read_impl_for_parameter_read( - current_position: ParameterHacspec, - buf: PublicByteSeq, -) -> (ParameterHacspec, usize) { - let (_buf, num_read) = get_parameter_section_hacspec(buf, current_position); - (current_position + num_read, num_read as usize) -} - -#[cfg(not(feature = "hacspec"))] -pub fn coerce_rust_to_hacspec_parameter( - rust_parameter: &mut concordium_types::Parameter, -) -> ParameterHacspec { - rust_parameter.current_position.clone() -} - -#[cfg(not(feature = "hacspec"))] -pub fn coerce_hacspec_to_rust_parameter( - rust_parameter: &mut concordium_types::Parameter, - hacspec_parameter: ParameterHacspec, -) { - rust_parameter.current_position = hacspec_parameter; -} - - -#[cfg(not(feature = "hacspec"))] -/// # Trait implementations for Parameter -impl Read for concordium_types::Parameter { - fn read(&mut self, buf: &mut [u8]) -> ParseResult { - let (cs, nr) = read_impl_for_parameter_read( - coerce_rust_to_hacspec_parameter(self), - coerce_rust_to_hacspec_public_byte_seq(buf), - ); - coerce_hacspec_to_rust_parameter(self, cs); - Ok(nr) - } -} - -#[cfg(not(feature = "hacspec"))] -impl HasParameter for concordium_types::Parameter { - #[inline(always)] - fn size(&self) -> u32 { - get_parameter_size_hacspec() - } -} - -#[cfg(not(feature = "hacspec"))] -/// # Trait implementations for the chain metadata. -impl HasChainMetadata for ChainMetaExtern { - #[inline(always)] - fn slot_time(&self) -> SlotTime { - Timestamp::from_timestamp_millis(get_slot_time_hacspec() ) - } -} - -// pub struct AttributeTag(pub u8); -pub type AttributesCursorHacspec = (u32, u16); - -// pub fn has_policy_impl_for_policy_attributes_cursor_next_test( -// policy_attribute_items: AttributesCursorHacspec, -// ) -> bool { -// let (_, remaining_items) = policy_attribute_items; -// remaining_items == 0_u16 -// } - -// pub fn has_policy_impl_for_policy_attributes_cursor_next_tag_invalid( -// policy_attribute_items: AttributesCursorHacspec, -// tag_value_len_1: u8, -// num_read: u32, -// ) -> (AttributesCursorHacspec, bool) { -// let (current_position, remaining_items) = policy_attribute_items; -// let policy_attribute_items = (current_position + num_read, remaining_items); -// (policy_attribute_items, tag_value_len_1 > 31_u8) -// } - -pub fn has_policy_impl_for_policy_attributes_cursor_next_item( - policy_attribute_items: AttributesCursorHacspec, - buf: PublicByteSeq, -) -> Option<(AttributesCursorHacspec, (u8, u8))> { - - let (mut current_position, mut remaining_items) = policy_attribute_items; - - if remaining_items == 0u16 { - Option::<(AttributesCursorHacspec, (u8, u8))>::None?; - } - - let (tag_value_len, num_read) = get_policy_section_hacspec(PublicByteSeq::new(2), current_position); - current_position = current_position + num_read; - - if tag_value_len[1] > 31u8 { - // Should not happen because all attributes fit into 31 bytes. - Option::<(AttributesCursorHacspec, (u8, u8))>::None?; - } - - let (_buf, num_read) = get_policy_section_hacspec(buf, current_position); - current_position = current_position + num_read; - remaining_items = remaining_items - 1u16; - Option::<(AttributesCursorHacspec, (u8, u8))>::Some(((current_position, remaining_items), (tag_value_len[0], tag_value_len[1]))) -} - -#[cfg(not(feature = "hacspec"))] -pub fn coerce_rust_to_hacspec_attributes_cursor( - rust_attributes_cursor: &mut AttributesCursor, -) -> AttributesCursorHacspec { - ( - rust_attributes_cursor.current_position.clone(), - rust_attributes_cursor.remaining_items.clone(), - ) -} - -#[cfg(not(feature = "hacspec"))] -pub fn coerce_hacspec_to_rust_attributes_cursor( - rust_attributes_cursor: &mut AttributesCursor, - hacspec_attributes_cursor: AttributesCursorHacspec, -) { - let (current_position, remaining_items) = hacspec_attributes_cursor; - rust_attributes_cursor.current_position = current_position; - rust_attributes_cursor.remaining_items = remaining_items; -} - -// TODO: Creusot issues? -#[cfg(not(feature = "hacspec"))] -impl HasPolicy for Policy { - fn identity_provider(&self) -> IdentityProvider { - self.identity_provider - } - - fn created_at(&self) -> Timestamp { - self.created_at - } - - fn valid_to(&self) -> Timestamp { - self.valid_to - } - - fn next_item(&mut self, buf: &mut [u8; 31]) -> Option<(AttributeTag, u8)> { - let (ac, (at, v)) = has_policy_impl_for_policy_attributes_cursor_next_item( - coerce_rust_to_hacspec_attributes_cursor(&mut self.items), - coerce_rust_to_hacspec_public_byte_seq(&mut buf[..]), - )?; - coerce_hacspec_to_rust_attributes_cursor(&mut self.items, ac); - Some((AttributeTag(at), v)) - } -} - -#[cfg(not(feature = "hacspec"))] -/// An iterator over policies using host functions to supply the data. -/// The main interface to using this type is via the methods of the [Iterator](https://doc.rust-lang.org/std/iter/trait.Iterator.html) -/// and [ExactSizeIterator](https://doc.rust-lang.org/std/iter/trait.ExactSizeIterator.html) traits. -pub struct PoliciesIterator { - /// Position in the policies binary serialization. - pos: u32, - /// Number of remaining items in the stream. - remaining_items: u16, -} - -pub type PoliciesIteratorHacspec = (u32, u16); - -// TODO: use PolicyAttributesCursorHacspec for implementation above instead of just AttributesCursorHacspec -pub type PolicyAttributesCursorHacspec = (u32, u64, u64, AttributesCursorHacspec); // IdentityProvider, Timestamp, Timestamp, AttributesCursor - -// TODO: Fix creusot issues? -fn iterator_impl_for_policies_iterator_next( - policies_iterator: PoliciesIteratorHacspec, -) -> Option<(PoliciesIteratorHacspec, PolicyAttributesCursorHacspec)> { - let (mut pos, remaining_items) = policies_iterator; - if remaining_items == 0u16 { - Option::<(PoliciesIteratorHacspec, PolicyAttributesCursorHacspec)>::None?; - } - - // 2 for total size of this section, 4 for identity_provider, - // 8 bytes for created_at, 8 for valid_to, and 2 for - // the length - let (buf, _) = get_policy_section_hacspec(PublicByteSeq::new(2 + 4 + 8 + 8 + 2), pos); - let skip_part: PublicByteSeq = buf.slice_range(0..2); - let ip_part: PublicByteSeq = buf.slice_range(2..2 + 4); - let created_at_part: PublicByteSeq = buf.slice_range(2 + 4..2 + 4 + 8); - let valid_to_part: PublicByteSeq = buf.slice_range(2 + 4 + 8..2 + 4 + 8 + 8); - let len_part: PublicByteSeq = buf.slice_range(2 + 4 + 8 + 8..2 + 4 + 8 + 8 + 2); - let identity_provider = u32_from_le_bytes(u32Word::from_seq(&ip_part)); // IdentityProvider = u32 // UnsignedPublicInteger - let created_at = u64_from_le_bytes(u64Word::from_seq(&created_at_part)); // Timestamp = Timestamp::from_timestamp_millis(u64) - let valid_to = u64_from_le_bytes(u64Word::from_seq(&valid_to_part)); // Timestamp = u64) - let mut remaining_items = u16_from_le_bytes(u16Word::from_seq(&len_part)); - let attributes_start = pos + 2u32 + 4u32 + 8u32 + 8u32 + 2u32; - pos = pos + (u16_from_le_bytes(u16Word::from_seq(&skip_part)) as u32) + 2u32; - remaining_items = remaining_items - 1u16; - Option::<(PoliciesIteratorHacspec, PolicyAttributesCursorHacspec)>::Some(( - (pos, remaining_items), - ( - identity_provider, - created_at, - valid_to, - (attributes_start, remaining_items), - ), - )) -} - -// TODO: Fix creusot issues? -#[cfg(not(feature = "hacspec"))] -impl Iterator for PoliciesIterator { - type Item = Policy; - - fn next(&mut self) -> Option { - let ((pos, remaining_items), (identity_provider, created_at, valid_to, (cp, ri))) = - iterator_impl_for_policies_iterator_next((self.pos, self.remaining_items))?; - - // TODO: make into coerce function - self.pos = pos; - self.remaining_items = remaining_items; - - Some(Policy { - identity_provider, - created_at: Timestamp::from_timestamp_millis(created_at), - valid_to: Timestamp::from_timestamp_millis(valid_to), - items: AttributesCursor { - current_position: cp, - remaining_items: ri, - }, - }) - } - - fn size_hint(&self) -> (usize, Option) { - let rem = self.remaining_items as usize; - (rem, Some(rem)) - } -} - -#[cfg(not(feature = "hacspec"))] -impl ExactSizeIterator for PoliciesIterator { - #[inline(always)] - fn len(&self) -> usize { - self.remaining_items.into() // as usize - } -} - -#[cfg(not(feature = "hacspec"))] -impl HasCommonData for ExternContext { - type MetadataType = ChainMetaExtern; - type ParamType = concordium_types::Parameter; - type PolicyIteratorType = PoliciesIterator; - type PolicyType = Policy; - - // TODO: fix creusot issue - #[inline(always)] - fn metadata(&self) -> &Self::MetadataType { - &ChainMetaExtern {} - } - - fn policies(&self) -> PoliciesIterator { - let (buf, _) = get_policy_section_hacspec(PublicByteSeq::new(2), 0); - PoliciesIterator { - pos: 2, // 2 because we already read 2 bytes. - remaining_items: u16_from_le_bytes(u16Word::from_seq(&buf)), - } - } - - #[inline(always)] - fn parameter_cursor(&self) -> Self::ParamType { - concordium_types::Parameter { - current_position: 0, - } - } -} - -#[cfg(not(feature = "hacspec"))] -/// # Trait implementations for the init context -impl HasInitContext for ExternContext { - type InitData = (); - - /// Create a new init context by using an external call. - fn open(_: Self::InitData) -> Self { - ExternContext::default() - } - - #[inline(always)] - fn init_origin(&self) -> AccountAddress { - let mut address : [u8; ACCOUNT_ADDRESS_SIZE] = Default::default(); - let temp = coerce_hacspec_to_rust_public_byte_seq(get_init_origin_hacspec( - PublicByteSeq::new(ACCOUNT_ADDRESS_SIZE), - )); - address.clone_from_slice(temp.as_slice()); - AccountAddress(address) - } -} - -#[cfg(not(feature = "hacspec"))] -/// # Trait implementations for the receive context -impl HasReceiveContext for ExternContext { - type ReceiveData = (); - - /// Create a new receive context - fn open(_: Self::ReceiveData) -> Self { - ExternContext::default() - } - - // TODO: Make usable by creusot - #[inline(always)] - fn invoker(&self) -> AccountAddress { - let mut address: [u8; ACCOUNT_ADDRESS_SIZE] = Default::default(); - address.clone_from_slice( - &mut coerce_hacspec_to_rust_public_byte_seq(get_receive_invoker_hacspec( - PublicByteSeq::new(ACCOUNT_ADDRESS_SIZE), - ))[..], - ); - AccountAddress(address) - } - - // TODO: Make usable by creusot - #[inline(always)] - fn self_address(&self) -> ContractAddress { - let mut address: [u8; ACCOUNT_ADDRESS_SIZE] = Default::default(); - address.clone_from_slice( - &mut coerce_hacspec_to_rust_public_byte_seq(get_receive_self_address_hacspec( - PublicByteSeq::new(ACCOUNT_ADDRESS_SIZE), - ))[..], - ); - match concordium_contracts_common::from_bytes(&address) { - Ok(v) => v, - Err(_) => trap(), - } - } - - #[inline(always)] - fn self_balance(&self) -> Amount { - Amount::from_micro_ccd(get_receive_self_balance_hacspec()) - } - - // TODO: Make usable by creusot - // TODO: Remove/replace unsafe code ! - #[inline(always)] - fn sender(&self) -> Address { - let ptr : *mut u8 = (&mut coerce_hacspec_to_rust_public_byte_seq(get_receive_sender_hacspec( - PublicByteSeq::new(ACCOUNT_ADDRESS_SIZE), - ))[..]).as_mut_ptr(); - let tag = unsafe { *ptr }; - match tag { - 0u8 => { - match concordium_contracts_common::from_bytes(unsafe { core::slice::from_raw_parts( - ptr.add(1), - ACCOUNT_ADDRESS_SIZE, - )} ) { - Ok(v) => Address::Account(v), - Err(_) => trap(), - } - } - 1u8 => match concordium_contracts_common::from_bytes(unsafe { core::slice::from_raw_parts(ptr.add(1), 16) }) { - Ok(v) => Address::Contract(v), - Err(_) => trap(), - }, - _ => trap(), // unreachable!("Host violated precondition."), - } - } - - // TODO: Make usable by creusot - #[inline(always)] - fn owner(&self) -> AccountAddress { - let mut address: [u8; ACCOUNT_ADDRESS_SIZE] = Default::default(); - address.clone_from_slice( - &mut coerce_hacspec_to_rust_public_byte_seq(get_receive_self_address_hacspec( - PublicByteSeq::new(ACCOUNT_ADDRESS_SIZE), - ))[..], - ); - AccountAddress(address) - } -} - -#[cfg(not(feature = "hacspec"))] -/// #Implementations of the logger. -impl HasLogger for Logger { - #[inline(always)] - fn init() -> Self { - Self { _private: () } - } - - fn log_raw(&mut self, event: &[u8]) -> Result<(), LogError> { - let (_, res) = log_event_hacspec(coerce_rust_to_hacspec_public_byte_seq(event)); - match res { - 1 => Ok(()), - 0 => Err(LogError::Full), - _ => Err(LogError::Malformed), - } - } -} - -// #[cfg(feature = "hacspec")] -array!(UserAddress, 32, u8); - -#[cfg(not(feature = "hacspec"))] -pub fn coerce_hacspec_to_rust_account_address(ua: UserAddress) -> AccountAddress { - AccountAddress([ - ua[0], ua[1], ua[2], ua[3], ua[4], ua[5], ua[6], ua[7], ua[8], ua[9], ua[10], ua[11], - ua[12], ua[13], ua[14], ua[15], ua[16], ua[17], ua[18], ua[19], ua[20], ua[21], ua[22], - ua[23], ua[24], ua[25], ua[26], ua[27], ua[28], ua[29], ua[30], ua[31], - ]) -} - -#[cfg(not(feature = "hacspec"))] -pub fn coerce_rust_to_hacspec_account_address(aa: &AccountAddress) -> UserAddress { - UserAddress::from_native_slice(&aa.0) -} - -// #[cfg(feature = "hacspec")] -// #[cfg_attr(feature = "use_attributes", in_hacspec(Action))] -pub enum HasAction { - Accept(), - SimpleTransfer(UserAddress, u64), - // TODO: add send_raw - SendRaw( - UserAddress, - String, // TODO: Should be ReceiveName => string - u64, - PublicByteSeq, - ), - // AND_THEN(HasAction, HasAction), - // OR_ELSE(HasAction, HasAction) -} -#[cfg(feature = "hacspec")] -pub type ListAction = Seq; - -// #[cfg(feature = "hacspec")] -pub fn accept_action() -> HasAction { - HasAction::Accept() -} - -// pub type ContextState = (Context, ()); - -// #[cfg(feature = "hacspec")] -// #[init(contract = "auction")] -// pub fn auction_init(ctx : Context) -> ContextState { -// // Always succeeds -// (ctx, ()) -// } - -// pub fn auction_init2(ctx : Context) -> ContextState { -// // Always succeeds -// (ctx, ()) -// } - -// Owner, Sender, Balance, Data / time -pub struct Context(pub UserAddress, pub UserAddress, pub u64, pub u64); - -#[cfg(not(feature = "hacspec"))] -pub fn coerce_rust_to_hacspec_context(ctx: &impl HasReceiveContext) -> Context { - Context( - coerce_rust_to_hacspec_account_address(&ctx.owner()), - match ctx.sender() { - Address::Contract(_) => panic!(), - Address::Account(account_address) => coerce_rust_to_hacspec_account_address(&account_address), - }, - ctx.self_balance().micro_ccd, - ctx.metadata().slot_time().timestamp_millis(), - ) -} - -#[cfg(not(feature = "hacspec"))] -/// #Implementation of actions. -/// These actions are implemented by direct calls to host functions. -impl HasActions for Action { - #[inline(always)] - fn accept() -> Self { - Action { - _private: accept_hacspec(), - } - } - - #[inline(always)] - fn simple_transfer(acc: &AccountAddress, amount: Amount) -> Self { - let res = simple_transfer_hacspec(coerce_rust_to_hacspec_public_byte_seq(&acc.0), amount.micro_ccd); - Action { _private: res } - } - - #[inline(always)] - fn send_raw( - ca: &ContractAddress, - receive_name: ReceiveName, - amount: Amount, - parameter: &[u8], - ) -> Self { - let receive_bytes = receive_name.get_chain_name().as_bytes(); - let res = - send_hacspec( - ca.index, - ca.subindex, - coerce_rust_to_hacspec_public_byte_seq(&receive_bytes), - amount.micro_ccd, - coerce_rust_to_hacspec_public_byte_seq(¶meter), - ); - Action { _private: res } - } - - #[inline(always)] - fn and_then(self, then: Self) -> Self { - let res = combine_and_hacspec(self._private, then._private); - Action { _private: res } - } - - #[inline(always)] - fn or_else(self, el: Self) -> Self { - let res = combine_or_hacspec(self._private, el._private); - Action { _private: res } - } -} - -// TODO: Define functionality in hacspec instead! -#[cfg(not(feature = "hacspec"))] -/// Allocates a Vec of bytes prepended with its length as a `u32` into memory, -/// and prevents them from being dropped. Returns the pointer. -/// Used to pass bytes from a Wasm module to its host. -#[doc(hidden)] -pub fn put_in_memory(input: &[u8]) -> *mut u8 { - let bytes_length = input.len() as u32; - let mut bytes = concordium_contracts_common::to_bytes(&bytes_length); - bytes.extend_from_slice(input); - let ptr = bytes.as_mut_ptr(); - #[cfg(feature = "std")] - ::std::mem::forget(bytes); - #[cfg(not(feature = "std"))] - core::mem::forget(bytes); - ptr -} - -// #[cfg(feature = "hacspec")] -/// Wrapper for -/// [HasActions::send_raw](../trait.HasActions.html#tymethod.send_raw), which -/// automatically serializes the parameter. Note that if the parameter is -/// already a byte array or convertible to a byte array without allocations it -/// is preferrable to use [send_raw](../trait.HasActions.html#tymethod.send_raw). -/// It is more efficient and avoids memory allocations. -pub fn send_wrap_hacspec( - ca_index: u64, - ca_subindex: u64, - receive_name_bytes: PublicByteSeq, - amount: u64, - param_bytes: PublicByteSeq, -) -> u32 { - send_hacspec( - ca_index, - ca_subindex, - receive_name_bytes, - amount, - param_bytes, - ) -} - - -// TODO: Get functionlity of everything into hacspec -#[allow(dead_code)] -#[cfg(not(feature = "hacspec"))] -/// Wrapper for -/// [HasActions::send_raw](../trait.HasActions.html#tymethod.send_raw), which -/// automatically serializes the parameter. Note that if the parameter is -/// already a byte array or convertible to a byte array without allocations it -/// is preferrable to use [send_raw](../trait.HasActions.html#tymethod.send_raw). -/// It is more efficient and avoids memory allocations. -pub fn send_wrap( - ca: &ContractAddress, - receive_name: ReceiveName, - amount: Amount, - parameter: &P, -) -> A { - let param_bytes = concordium_contracts_common::to_bytes(parameter); - A::send_raw(ca, receive_name, amount, ¶m_bytes) -} - - diff --git a/concordium/src/concordium_prims.rs b/concordium/src/concordium_prims.rs index f652e2b..02028ff 100644 --- a/concordium/src/concordium_prims.rs +++ b/concordium/src/concordium_prims.rs @@ -1,69 +1,23 @@ -#[cfg(not(feature = "hacspec"))] -use crate::*; - -use hacspec_lib::*; +#![feature(register_tool)] +#![register_tool(hax)] -#[cfg(not(feature = "hacspec"))] -pub fn coerce_rust_to_hacspec_public_byte_seq(buf: &[u8]) -> PublicByteSeq { - PublicByteSeq::from_native_slice(buf) -} +#[hax_lib_macros::skip] +extern crate hax_lib_macros; +#[hax_lib_macros::skip] +use hax_lib_macros::*; -// TODO: Make creusot friendly version -#[cfg(not(feature = "hacspec"))] -pub fn coerce_hacspec_to_rust_public_byte_seq(buf: PublicByteSeq) -> Vec { - // buf.native_slice().iter().collect(); - let mut temp_vec: Vec = Vec::new(); - for i in 0..buf.len() { - temp_vec.push(buf.index(i).clone()) - } - temp_vec -} +#[skip] +use crate::*; -#[cfg(not(feature = "hacspec"))] extern "C" { pub(crate) fn accept() -> u32; } -#[cfg(not(feature = "hacspec"))] -#[trusted] -pub(crate) fn accept_creusot() -> u32 { - unsafe { accept() } -} - -#[cfg(feature = "hacspec")] -pub(crate) fn accept_hacspec() -> u32 { - 1u32 -} - -#[cfg(not(feature = "hacspec"))] -pub(crate) fn accept_hacspec() -> u32 { - accept_creusot() -} - -#[cfg(not(feature = "hacspec"))] extern "C" { // Basic action to send tokens to an account. pub(crate) fn simple_transfer(addr_bytes: *const u8, amount: u64) -> u32; } -#[cfg(not(feature = "hacspec"))] -#[trusted] -pub(crate) fn simple_transfer_creusot(addr_bytes: *const u8, amount: u64) -> u32 { - unsafe { simple_transfer(addr_bytes, amount) } -} - -#[cfg(feature = "hacspec")] -pub(crate) fn simple_transfer_hacspec(buf: PublicByteSeq, amount: u64) -> u32 { - 1u32 -} - -#[cfg(not(feature = "hacspec"))] -pub(crate) fn simple_transfer_hacspec(buf: PublicByteSeq, amount: u64) -> u32 { - let temp = &mut coerce_hacspec_to_rust_public_byte_seq(buf.clone())[..]; - simple_transfer_creusot(temp.as_ptr(), amount) -} - -#[cfg(not(feature = "hacspec"))] extern "C" { // Send a message to a smart contract. pub(crate) fn send( @@ -77,113 +31,23 @@ extern "C" { ) -> u32; } -#[cfg(not(feature = "hacspec"))] -#[trusted] -pub(crate) fn send_creusot( - addr_index: u64, - addr_subindex: u64, - receive_name: *const u8, - receive_name_len: u32, - amount: u64, - parameter: *const u8, - parameter_len: u32, - ) -> u32 { - unsafe { send(addr_index, addr_subindex, receive_name, receive_name_len, amount, parameter, parameter_len) } -} - -#[cfg(feature = "hacspec")] -pub(crate) fn send_hacspec( - addr_index: u64, - addr_subindex: u64, - receive_name: PublicByteSeq, - amount: u64, - parameter: PublicByteSeq, - ) -> u32 { - 1u32 -} - -#[cfg(not(feature = "hacspec"))] -pub(crate) fn send_hacspec( - addr_index: u64, - addr_subindex: u64, - receive_name: PublicByteSeq, - amount: u64, - parameter: PublicByteSeq, - ) -> u32 { - let temp_receive_name = &mut coerce_hacspec_to_rust_public_byte_seq(receive_name.clone())[..]; - let temp_parameter = &mut coerce_hacspec_to_rust_public_byte_seq(parameter.clone())[..]; - send_creusot(addr_index, addr_subindex, temp_receive_name.as_ptr(), receive_name.len() as u32, amount, temp_parameter.as_ptr(), parameter.len() as u32) -} - -#[cfg(not(feature = "hacspec"))] extern "C" { // Combine two actions using normal sequencing. This is using the stack of // actions already produced. pub(crate) fn combine_and(l: u32, r: u32) -> u32; } -#[cfg(not(feature = "hacspec"))] -#[trusted] -pub(crate) fn combine_and_creusot(l: u32, r: u32) -> u32 { - unsafe { combine_and(l, r) } -} - -#[cfg(feature = "hacspec")] -pub(crate) fn combine_and_hacspec(l: u32, r: u32) -> u32 { - 1u32 -} - -#[cfg(not(feature = "hacspec"))] -pub(crate) fn combine_and_hacspec(l: u32, r: u32) -> u32 { - combine_and_creusot(l,r) -} - -#[cfg(not(feature = "hacspec"))] extern "C" { // Combine two actions using normal sequencing. This is using the stack of // actions already produced. pub(crate) fn combine_or(l: u32, r: u32) -> u32; } -#[cfg(not(feature = "hacspec"))] -#[trusted] -pub(crate) fn combine_or_creusot(l: u32, r: u32) -> u32 { - unsafe { combine_or(l, r) } -} - -#[cfg(feature = "hacspec")] -pub(crate) fn combine_or_hacspec(l: u32, r: u32) -> u32 { - 1u32 -} - -#[cfg(not(feature = "hacspec"))] -pub(crate) fn combine_or_hacspec(l: u32, r: u32) -> u32 { - combine_or_creusot(l,r) -} - -#[cfg(not(feature = "hacspec"))] extern "C" { // Get the size of the parameter to the method (either init or receive). pub(crate) fn get_parameter_size() -> u32; } -#[cfg(not(feature = "hacspec"))] -#[trusted] -pub(crate) fn get_parameter_size_creusot() -> u32 { - unsafe { get_parameter_size() } -} - -#[cfg(feature = "hacspec")] -pub(crate) fn get_parameter_size_hacspec() -> u32 { - 1u32 -} - -#[cfg(not(feature = "hacspec"))] -pub(crate) fn get_parameter_size_hacspec() -> u32 { - get_parameter_size_creusot() -} - -#[cfg(not(feature = "hacspec"))] extern "C" { // Write a section of the parameter to the given location. Return the number // of bytes written. The location is assumed to contain enough memory to @@ -191,28 +55,6 @@ extern "C" { pub(crate) fn get_parameter_section(param_bytes: *mut u8, length: u32, offset: u32) -> u32; } -#[cfg(not(feature = "hacspec"))] -#[trusted] -pub(crate) fn get_parameter_section_creusot(start: *mut u8, length: u32, offset: u32) -> u32 { - unsafe { get_parameter_section(start, length, offset) } -} - -#[cfg(feature = "hacspec")] -pub(crate) fn get_parameter_section_hacspec(buf: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { - (buf, 1u32) -} - -#[cfg(not(feature = "hacspec"))] -pub(crate) fn get_parameter_section_hacspec(buf: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { - let temp = &mut coerce_hacspec_to_rust_public_byte_seq(buf.clone())[..]; - let result = get_parameter_section_creusot(temp.as_mut_ptr(), buf.len() as u32, offset); - ( - coerce_rust_to_hacspec_public_byte_seq(&temp), - result, - ) -} - -#[cfg(not(feature = "hacspec"))] extern "C" { // Write a section of the policy to the given location. Return the number // of bytes written. The location is assumed to contain enough memory to @@ -220,28 +62,6 @@ extern "C" { pub(crate) fn get_policy_section(policy_bytes: *mut u8, length: u32, offset: u32) -> u32; } -#[cfg(not(feature = "hacspec"))] -#[trusted] -pub(crate) fn get_policy_section_creusot(policy_bytes: *mut u8, length: u32, offset: u32) -> u32 { - unsafe { get_policy_section(policy_bytes, length, offset) } -} - -#[cfg(feature = "hacspec")] -pub(crate) fn get_policy_section_hacspec(policy_bytes: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { - (policy_bytes, 1u32) -} - -#[cfg(not(feature = "hacspec"))] -pub(crate) fn get_policy_section_hacspec(policy_bytes: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { - let temp = &mut coerce_hacspec_to_rust_public_byte_seq(policy_bytes.clone())[..]; - let result = get_policy_section_creusot(temp.as_mut_ptr(), policy_bytes.len() as u32, offset); - ( - coerce_rust_to_hacspec_public_byte_seq(&temp), - result, - ) -} - -#[cfg(not(feature = "hacspec"))] extern "C" { // Add a log item. Return values are // - -1 if logging failed due to the message being too long @@ -250,71 +70,14 @@ extern "C" { pub(crate) fn log_event(start: *const u8, length: u32) -> i32; } -#[cfg(not(feature = "hacspec"))] -#[trusted] -pub(crate) fn log_event_creusot(start: *const u8, length: u32) -> i32 { - unsafe { log_event(start, length) } -} - -#[cfg(feature = "hacspec")] -pub(crate) fn log_event_hacspec(start: PublicByteSeq) -> (PublicByteSeq, i32) { - (start, 1i32) -} - -#[cfg(not(feature = "hacspec"))] -pub(crate) fn log_event_hacspec(start: PublicByteSeq) -> (PublicByteSeq, i32) { - let temp = &mut coerce_hacspec_to_rust_public_byte_seq(start.clone())[..]; - let result = log_event_creusot(temp.as_ptr(), start.len() as u32); - (coerce_rust_to_hacspec_public_byte_seq(&temp), result) -} - -#[cfg(not(feature = "hacspec"))] extern "C" { pub(crate) fn load_state(start: *mut u8, length: u32, offset: u32) -> u32; } -#[cfg(not(feature = "hacspec"))] -#[trusted] -pub(crate) fn load_state_creusot(start: *mut u8, length: u32, offset: u32) -> u32 { - unsafe { load_state(start, length, offset) } -} - -#[cfg(feature = "hacspec")] -pub(crate) fn load_state_hacspec(buf: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { - (buf, 1u32) -} - -#[cfg(not(feature = "hacspec"))] -pub(crate) fn load_state_hacspec(buf: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { - let temp = &mut coerce_hacspec_to_rust_public_byte_seq(buf.clone())[..]; - let result = load_state_creusot(temp.as_mut_ptr(), buf.len() as u32, offset); - (coerce_rust_to_hacspec_public_byte_seq(&temp), result) -} - -#[cfg(not(feature = "hacspec"))] extern "C" { pub(crate) fn write_state(start: *mut u8, length: u32, offset: u32) -> u32; } -#[cfg(not(feature = "hacspec"))] -#[trusted] -pub(crate) fn write_state_creusot(start: *mut u8, length: u32, offset: u32) -> u32 { - unsafe { write_state(start, length, offset) } -} - -#[cfg(feature = "hacspec")] -pub(crate) fn write_state_hacspec(buf: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { - (buf, 1u32) -} - -#[cfg(not(feature = "hacspec"))] -pub(crate) fn write_state_hacspec(buf: PublicByteSeq, offset: u32) -> (PublicByteSeq, u32) { - let temp = &mut coerce_hacspec_to_rust_public_byte_seq(buf.clone())[..]; - let result = write_state_creusot(temp.as_mut_ptr(), buf.len() as u32, offset); - (coerce_rust_to_hacspec_public_byte_seq(&temp), result) -} - -#[cfg(not(feature = "hacspec"))] extern "C" { // Resize state to the new value (truncate if new size is smaller). Return 0 if // this was unsuccesful (new state too big), or 1 if successful. @@ -322,181 +85,38 @@ extern "C" { // get current state size in bytes. } -#[cfg(not(feature = "hacspec"))] -#[trusted] -pub(crate) fn resize_state_creusot(new_size: u32) -> u32 { - unsafe { resize_state(new_size) } -} - -#[cfg(feature = "hacspec")] -pub(crate) fn resize_state_hacspec(new_size: u32) -> u32 { - 1u32 -} - -#[cfg(not(feature = "hacspec"))] -pub(crate) fn resize_state_hacspec(new_size: u32) -> u32 { - resize_state_creusot(new_size) -} - -#[cfg(not(feature = "hacspec"))] extern "C" { pub(crate) fn state_size() -> u32; } -#[cfg(not(feature = "hacspec"))] -#[trusted] -pub(crate) fn state_size_creusot() -> u32 { - unsafe { state_size() } -} - -#[cfg(feature = "hacspec")] -pub(crate) fn state_size_hacspec() -> u32 { - 1u32 -} - -#[cfg(not(feature = "hacspec"))] -pub(crate) fn state_size_hacspec() -> u32 { - state_size_creusot() -} - -#[cfg(not(feature = "hacspec"))] extern "C" { // Getter for the init context. /// Address of the sender, 32 bytes pub(crate) fn get_init_origin(start: *mut u8); } -#[cfg(not(feature = "hacspec"))] -#[trusted] -pub(crate) fn get_init_origin_creusot(start: *mut u8) { - unsafe { get_init_origin(start) } -} - -#[cfg(feature = "hacspec")] -pub(crate) fn get_init_origin_hacspec(start: PublicByteSeq) -> PublicByteSeq { - start -} - -#[cfg(not(feature = "hacspec"))] -pub(crate) fn get_init_origin_hacspec(start: PublicByteSeq) -> PublicByteSeq { - let temp = &mut coerce_hacspec_to_rust_public_byte_seq(start.clone())[..]; - get_init_origin_creusot(temp.as_mut_ptr()); - coerce_rust_to_hacspec_public_byte_seq(&temp) -} - -#[cfg(not(feature = "hacspec"))] extern "C" { /// Invoker of the top-level transaction, AccountAddress. pub(crate) fn get_receive_invoker(start: *mut u8); } -#[cfg(not(feature = "hacspec"))] -#[trusted] -pub(crate) fn get_receive_invoker_creusot(start: *mut u8) { - unsafe { get_receive_invoker(start) } -} - -#[cfg(feature = "hacspec")] -pub(crate) fn get_receive_invoker_hacspec(start: PublicByteSeq) -> PublicByteSeq { - start -} - -#[cfg(not(feature = "hacspec"))] -pub(crate) fn get_receive_invoker_hacspec(start: PublicByteSeq) -> PublicByteSeq { - let temp = &mut coerce_hacspec_to_rust_public_byte_seq(start.clone())[..]; - get_receive_invoker_creusot(temp.as_mut_ptr()); - coerce_rust_to_hacspec_public_byte_seq(&temp) -} - -#[cfg(not(feature = "hacspec"))] extern "C" { /// Address of the contract itself, ContractAddress. pub(crate) fn get_receive_self_address(start: *mut u8); } -#[cfg(not(feature = "hacspec"))] -#[trusted] -pub(crate) fn get_receive_self_address_creusot(start: *mut u8) { - unsafe { get_receive_self_address(start) } -} - -#[cfg(feature = "hacspec")] -pub(crate) fn get_receive_self_address_hacspec(start: PublicByteSeq) -> PublicByteSeq { - start -} - -#[cfg(not(feature = "hacspec"))] -pub(crate) fn get_receive_self_address_hacspec(start: PublicByteSeq) -> PublicByteSeq { - let temp = &mut coerce_hacspec_to_rust_public_byte_seq(start.clone())[..]; - get_receive_self_address_creusot(temp.as_mut_ptr()); - coerce_rust_to_hacspec_public_byte_seq(&temp) -} - -#[cfg(not(feature = "hacspec"))] extern "C" { /// Self-balance of the contract, returns the amount pub(crate) fn get_receive_self_balance() -> u64; } -#[cfg(not(feature = "hacspec"))] -#[trusted] -pub(crate) fn get_receive_self_balance_creusot() -> u64 { - unsafe { get_receive_self_balance() } -} - -#[cfg(feature = "hacspec")] -pub(crate) fn get_receive_self_balance_hacspec() -> u64 { - 1u64 -} - -#[cfg(not(feature = "hacspec"))] -pub(crate) fn get_receive_self_balance_hacspec() -> u64 { - get_receive_self_balance_creusot() -} - -#[cfg(not(feature = "hacspec"))] extern "C" { /// Immediate sender of the message (either contract or account). pub(crate) fn get_receive_sender(start: *mut u8); } -#[cfg(not(feature = "hacspec"))] -#[trusted] -pub(crate) fn get_receive_sender_creusot(start: *mut u8) { - unsafe { get_receive_sender(start) } -} - -#[cfg(feature = "hacspec")] -pub(crate) fn get_receive_sender_hacspec(start: PublicByteSeq) -> PublicByteSeq { - start -} - -#[cfg(not(feature = "hacspec"))] -pub(crate) fn get_receive_sender_hacspec(start: PublicByteSeq) -> PublicByteSeq { - let temp = &mut coerce_hacspec_to_rust_public_byte_seq(start.clone())[..]; - get_receive_sender_creusot(temp.as_mut_ptr()); - coerce_rust_to_hacspec_public_byte_seq(&temp) -} - -#[cfg(not(feature = "hacspec"))] extern "C" { // Getters for the chain meta data /// Slot time (in milliseconds) from chain meta data pub(crate) fn get_slot_time() -> u64; } - -#[cfg(not(feature = "hacspec"))] -#[trusted] -pub(crate) fn get_slot_time_creusot() -> u64 { - unsafe { get_slot_time() } -} - -#[cfg(feature = "hacspec")] -pub(crate) fn get_slot_time_hacspec() -> u64 { - 1u64 -} - -#[cfg(not(feature = "hacspec"))] -pub(crate) fn get_slot_time_hacspec() -> u64 { - get_slot_time_creusot() -} diff --git a/concordium/src/concordium_traits.rs b/concordium/src/concordium_traits.rs index df1a61f..ff629de 100644 --- a/concordium/src/concordium_traits.rs +++ b/concordium/src/concordium_traits.rs @@ -1,11 +1,9 @@ -#[cfg(not(feature = "hacspec"))] -use crate::*; - // //! This module implements traits for the contract interface. // //! This allows setting-up mock objects for testing individual // //! contract invocations. -#[cfg(not(feature = "hacspec"))] +use crate::*; + /// Objects which can access parameters to contracts. /// /// This trait has a Read supertrait which means that structured parameters can @@ -18,14 +16,13 @@ pub trait HasParameter: Read { fn size(&self) -> u32; } -#[cfg(not(feature = "hacspec"))] /// Objects which can access chain metadata. pub trait HasChainMetadata { /// Get time in milliseconds at the beginning of this block. fn slot_time(&self) -> SlotTime; } -#[cfg(not(feature = "hacspec"))] + /// A type which has access to a policy of a credential. /// Since policies can be large this is deliberately written in a relatively /// low-level style to enable efficient traversal of all the attributes without @@ -50,10 +47,10 @@ pub trait HasPolicy { /// an Iterator for this type is that with the supplied buffer we can /// iterate through the elements more efficiently, without any allocations, /// the consumer being responsible for allocating the buffer. - fn next_item(&mut self, buf: &mut [u8; 31]) -> Option<(AttributeTag, u8)>; + fn next_item(self, buf: [u8; 31]) -> (Option<(AttributeTag, u8)>, [u8; 31], Self); } -#[cfg(not(feature = "hacspec"))] + /// Common data accessible to both init and receive methods. pub trait HasCommonData { type PolicyType: HasPolicy; @@ -74,7 +71,7 @@ pub trait HasCommonData { fn parameter_cursor(&self) -> Self::ParamType; } -#[cfg(not(feature = "hacspec"))] + /// Types which can act as init contexts. pub trait HasInitContext: HasCommonData { /// Data needed to open the context. @@ -85,7 +82,7 @@ pub trait HasInitContext: HasCommonData { fn init_origin(&self) -> AccountAddress; } -#[cfg(not(feature = "hacspec"))] + /// Types which can act as receive contexts. pub trait HasReceiveContext: HasCommonData { type ReceiveData; @@ -106,7 +103,7 @@ pub trait HasReceiveContext: HasCommonData { fn owner(&self) -> AccountAddress; } -#[cfg(not(feature = "hacspec"))] + /// A type that can serve as the contract state type. pub trait HasContractState where @@ -124,15 +121,15 @@ where /// Truncate the state to the given size. If the given size is more than the /// current state size this operation does nothing. The new position is at /// most at the end of the stream. - fn truncate(&mut self, new_size: u32); + fn truncate(&self, new_size: u32) -> Self; /// Make sure that the memory size is at least that many bytes in size. /// Returns true iff this was successful. The new bytes are initialized as /// 0. - fn reserve(&mut self, len: u32) -> bool; + fn reserve(&self, len: u32) -> (bool, Self); } -#[cfg(not(feature = "hacspec"))] + /// Objects which can serve as loggers. /// /// Logging functionality can be used by smart contracts to record events that @@ -145,20 +142,21 @@ pub trait HasLogger { /// Log the given slice as-is. If logging is not successful an error will be /// returned. - fn log_raw(&mut self, event: &[u8]) -> Result<(), LogError>; + fn log_raw(&self, event: &[u8]) -> (Result<(), LogError>, Self); - #[inline(always)] + // #[inline(always)] /// Log a serializable event by serializing it with a supplied serializer. - fn log(&mut self, event: &S) -> Result<(), LogError> { - let mut out = Vec::new(); - if event.serial(&mut out).is_err() { - trap(); // should not happen - } - self.log_raw(&out) - } + fn log(&self, event: &S) -> (Result<(), LogError>, Self); + // { + // let mut out = Vec::new(); + // if event.serial(&mut out).is_err() { + // trap(); // should not happen + // } + // self.log_raw(&out) + // } } -#[cfg(not(feature = "hacspec"))] + /// An object that can serve to construct actions. /// /// The actions that a smart contract can produce as a @@ -187,7 +185,7 @@ pub trait HasActions { fn or_else(self, el: Self) -> Self; } -#[cfg(not(feature = "hacspec"))] + /// Add optimized unwrap behaviour that aborts the process instead of /// panicking. pub trait UnwrapAbort { @@ -202,7 +200,7 @@ pub trait UnwrapAbort { fn unwrap_abort(self) -> Self::Unwrap; } -#[cfg(not(feature = "hacspec"))] + /// Analogue of the `expect` methods on types such as [Option](https://doc.rust-lang.org/std/option/enum.Option.html), /// but useful in a Wasm setting. pub trait ExpectReport { @@ -212,7 +210,7 @@ pub trait ExpectReport { fn expect_report(self, msg: &str) -> Self::Unwrap; } -#[cfg(not(feature = "hacspec"))] + /// Analogue of the `expect_err` methods on [Result](https://doc.rust-lang.org/std/result/enum.Result.html), /// but useful in a Wasm setting. pub trait ExpectErrReport { @@ -222,7 +220,7 @@ pub trait ExpectErrReport { fn expect_err_report(self, msg: &str) -> Self::Unwrap; } -#[cfg(not(feature = "hacspec"))] + /// Analogue of the `expect_none` methods on [Option](https://doc.rust-lang.org/std/option/enum.Option.html), /// but useful in a Wasm setting. pub trait ExpectNoneReport { @@ -231,7 +229,7 @@ pub trait ExpectNoneReport { fn expect_none_report(self, msg: &str); } -#[cfg(not(feature = "hacspec"))] + /// The `SerialCtx` trait provides a means of writing structures into byte-sinks /// (`Write`) using contextual information. /// The contextual information is: @@ -248,11 +246,11 @@ pub trait SerialCtx { fn serial_ctx( &self, size_length: schema::SizeLength, - out: &mut W, - ) -> Result<(), W::Err>; + out: &W, + ) -> (Result<(), W::Err>, W); } -#[cfg(not(feature = "hacspec"))] + /// The `DeserialCtx` trait provides a means of reading structures from /// byte-sources (`Read`) using contextual information. /// The contextual information is: @@ -267,6 +265,6 @@ pub trait DeserialCtx: Sized { fn deserial_ctx( size_length: schema::SizeLength, ensure_ordered: bool, - source: &mut R, - ) -> ParseResult; + source: &R, + ) -> (ParseResult, R); } diff --git a/concordium/src/concordium_types.rs b/concordium/src/concordium_types.rs index e2ed836..8db60b5 100644 --- a/concordium/src/concordium_types.rs +++ b/concordium/src/concordium_types.rs @@ -1,41 +1,44 @@ -#[cfg(not(feature = "hacspec"))] -use crate::num::NonZeroI32; +#![feature(register_tool)] +#![register_tool(hax)] + +#[hax_lib_macros::skip] +extern crate hax_lib_macros; +#[hax_lib_macros::skip] +use hax_lib_macros::*; + +// #[skip] +use crate::num::*; -#[cfg(not(feature = "hacspec"))] /// A type representing the constract state bytes. #[derive(Default)] pub struct ContractState { - pub(crate) current_position: u32, + pub(crate) current_contract_state_position: u32, } -#[cfg(not(feature = "hacspec"))] #[derive(Default)] /// A type representing the parameter to init and receive methods. pub struct Parameter { - pub(crate) current_position: u32, + pub(crate) current_parameter_position: u32, } -#[cfg(not(feature = "hacspec"))] /// A type representing the attributes, lazily acquired from the host. #[derive(Default)] pub struct AttributesCursor { /// Current position of the cursor, starting from 0. /// Note that this is only for the variable attributes. /// `created_at` and `valid_to` will require. - pub(crate) current_position: u32, + pub(crate) current_attribute_cursor_position: u32, /// The number of remaining items in the policy. pub(crate) remaining_items: u16, } -#[cfg(not(feature = "hacspec"))] /// A type representing the logger. #[derive(Default)] pub struct Logger { - pub(crate) _private: (), + pub(crate) _private_logger: (), } -// #[cfg(not(feature = "hacspec"))] -/// Errors that can occur during logging. +// /// Errors that can occur during logging. #[derive(Debug, Copy, Clone, Eq, PartialEq)] #[repr(u8)] pub enum LogError { @@ -45,13 +48,11 @@ pub enum LogError { Malformed, } -#[cfg(not(feature = "hacspec"))] /// Error triggered when a non-zero amount of CCD is sent to a contract /// init or receive function that is not marked as `payable`. #[derive(Clone, Copy, Debug)] pub struct NotPayableError; -#[cfg(not(feature = "hacspec"))] /// Actions that can be produced at the end of a contract execution. This /// type is deliberately not cloneable so that we can enforce that /// `and_then` and `or_else` can only be used when more than one event is @@ -61,41 +62,41 @@ pub struct NotPayableError; /// values of the type are effectful. #[must_use] pub struct Action { - pub(crate) _private: u32, + pub(crate) _private_action: u32, } -#[cfg(not(feature = "hacspec"))] impl Action { pub fn tag(&self) -> u32 { - self._private + self._private_action } } -#[cfg(not(feature = "hacspec"))] /// An error message, signalling rejection of a smart contract invocation. /// The client will see the error code as a reject reason; if a schema is /// provided, the error message corresponding to the error code will be /// displayed. The valid range for an error code is from i32::MIN to -1. #[derive(Debug, Eq, PartialEq)] // TODO: Creusot issue re-add "Debug" attribute #[repr(transparent)] +#[hax_lib_macros::hax_attributes] pub struct Reject { + #[refine(true)] pub error_code: NonZeroI32, } -#[cfg(not(feature = "hacspec"))] /// Default error is i32::MIN. impl Default for Reject { #[inline(always)] + #[skip] // TODO: Unsafe fn default() -> Self { Self { - error_code: unsafe { NonZeroI32::new_unchecked(i32::MIN) }, + error_code: unsafe {NonZeroI32::new_unchecked(i32::MIN)}, } } } -#[cfg(not(feature = "hacspec"))] impl Reject { /// This returns `None` for all values >= 0 and `Some` otherwise. + #[skip] pub fn new(x: i32) -> Option { if x < 0 { let error_code = unsafe { NonZeroI32::new_unchecked(x) }; @@ -108,7 +109,6 @@ impl Reject { // Macros for failing a contract function -#[cfg(not(feature = "hacspec"))] /// The `bail` macro can be used for cleaner error handling. If the function has /// result type `Result` invoking `bail` will terminate execution early with an /// error. @@ -126,7 +126,6 @@ macro_rules! bail { }}; } -#[cfg(not(feature = "hacspec"))] /// The `ensure` macro can be used for cleaner error handling. It is analogous /// to `assert`, but instead of panicking it uses `bail` to terminate execution /// of the function early. @@ -144,7 +143,6 @@ macro_rules! ensure { }}; } -#[cfg(not(feature = "hacspec"))] /// ## Variants of `ensure` for ease of use in certain contexts. /// Ensure the first two arguments are equal, using `bail` otherwise. #[macro_export] @@ -157,7 +155,6 @@ macro_rules! ensure_eq { }; } -#[cfg(not(feature = "hacspec"))] #[macro_export] /// Ensure the first two arguments are __not__ equal, using `bail` otherwise. macro_rules! ensure_ne { @@ -171,7 +168,6 @@ macro_rules! ensure_ne { // Macros for failing a test -#[cfg(not(feature = "hacspec"))] /// The `fail` macro is used for testing as a substitute for the panic macro. /// It reports back error information to the host. /// Used only in testing. @@ -193,7 +189,6 @@ macro_rules! fail { }; } -#[cfg(not(feature = "hacspec"))] /// The `fail` macro is used for testing as a substitute for the panic macro. /// It reports back error information to the host. /// Used only in testing. @@ -215,7 +210,6 @@ macro_rules! fail { }; } -#[cfg(not(feature = "hacspec"))] /// The `claim` macro is used for testing as a substitute for the assert macro. /// It checks the condition and if false it reports back an error. /// Used only in testing. @@ -238,7 +232,6 @@ macro_rules! claim { }; } -#[cfg(not(feature = "hacspec"))] /// Ensure the first two arguments are equal, just like `assert_eq!`, otherwise /// reports an error. Used only in testing. #[macro_export] @@ -254,7 +247,6 @@ macro_rules! claim_eq { }; } -#[cfg(not(feature = "hacspec"))] /// Ensure the first two arguments are *not* equal, just like `assert_ne!`, /// otherwise reports an error. /// Used only in testing. @@ -271,7 +263,6 @@ macro_rules! claim_ne { }; } -#[cfg(not(feature = "hacspec"))] /// The expected return type of the receive method of a smart contract. /// /// Optionally, to define a custom type for error instead of using @@ -298,7 +289,6 @@ macro_rules! claim_ne { /// // ``` pub type ReceiveResult = Result; -#[cfg(not(feature = "hacspec"))] /// The expected return type of the init method of the smart contract, /// parametrized by the state type of the smart contract. /// @@ -324,7 +314,6 @@ pub type ReceiveResult = Result; /// // ``` pub type InitResult = Result; -#[cfg(not(feature = "hacspec"))] /// Context backed by host functions. #[derive(Default)] #[doc(hidden)] @@ -332,20 +321,16 @@ pub struct ExternContext { marker: crate::marker::PhantomData, } -#[cfg(not(feature = "hacspec"))] #[doc(hidden)] pub struct ChainMetaExtern {} -#[cfg(not(feature = "hacspec"))] #[derive(Default)] #[doc(hidden)] pub struct InitContextExtern; -#[cfg(not(feature = "hacspec"))] #[derive(Default)] #[doc(hidden)] pub struct ReceiveContextExtern; -#[cfg(not(feature = "hacspec"))] pub(crate) mod sealed { use super::*; /// Marker trait intended to indicate which context type we have. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 8421a7e..68f7ca5 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -53,16 +53,41 @@ Class t_Group (Self : choice_type) := { div_loc : {fset Location} ; div : forall {L1 L2 I1 I2}, both L1 I1 (t_group_type) -> both L2 I2 (t_group_type) -> both (L1 :|: L2 :|: div_loc) (I1 :|: I2) (t_group_type) ; }. +Hint Unfold g_pow_loc. +Hint Unfold pow_loc. +Hint Unfold one_loc. +Hint Unfold prod_loc. +Hint Unfold inv_loc. +Hint Unfold div_loc. Definition t_z_17_ : choice_type := 'unit. -Equations Build_t_z_17_ : both(fset []) (fset []) (t_z_17_) := +Equations Build_t_z_17_ : both (fset []) (fset []) (t_z_17_) := Build_t_z_17_ := - solve_lift (ret_both ((_) : (t_z_17_))) : both(fset []) (fset []) (t_z_17_). + solve_lift (ret_both ((_) : (t_z_17_))) : both (fset []) (fset []) (t_z_17_). Fail Next Obligation. Definition res_loc : Location := (int32 ; 0%nat). + +Equations foldi_both + {acc: choice_type} + {L1 L2 L3 I1 I2 I3} + {L I} + `{is_true (fsubset L1 L)} `{is_true (fsubset I1 I)} + `{is_true (fsubset L2 L)} `{is_true (fsubset I2 I)} + `{is_true (fsubset L3 L)} `{is_true (fsubset I3 I)} + (lo_hi: both L2 I2 uint_size * both L3 I3 uint_size) + (f: both (L2 :|: L3) (I2 :|: I3) uint_size -> + both L I acc -> + both L I acc) + (init: both L1 I1 acc) + : both L I (acc) := + foldi_both lo_hi f init := + foldi (fst lo_hi) (snd lo_hi) (@f) (init). +Solve All Obligations with intros ; solve_ssprove_obligations. +Fail Next Obligation. + #[global] Program Instance t_z_17__t_Group : t_Group t_z_17_ := let t_group_type := int32 : choice_type in let q := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (17 : int32)) : both L I (int32) in @@ -72,13 +97,13 @@ Definition res_loc : Location := let one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both L I (int32) in let prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% q) : both (L1 :|: L2) (I1 :|: I2) (int32) in let inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => letb res loc(res_loc) := ret_both (0 : int32) in - letb res := foldi_both (into_iter (Build_Range (f_start := ret_both (1 : int32)) (f_end := q))) (fun {L I _ _} =>fun i => + letb res := foldi_both (into_iter (Build_t_Range (f_start := ret_both (1 : int32)) (f_end := q))) ((* fun {L I _ _} => *)fun i => ssp (fun res => solve_lift (ifb (g_pow i) =.? x then letb res := i in res else res))) res in - solve_lift res : both (L1 :|: fset [res_loc]) I1 (int32) in + res : both (L1 :|: fset [res_loc]) I1 (int32) in let div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (prod x (inv y)) : both (L1 :|: L2 :|: fset [res_loc]) (I1 :|: I2) (int32) in {| t_group_type := (@t_group_type); q := (@q); @@ -94,9 +119,10 @@ Definition res_loc : Location := inv_loc := (fset [res_loc] : {fset Location}); inv := (@inv); div_loc := (fset [res_loc] : {fset Location}); - div := (@div)|}. + div := (@div)|}. Solve All Obligations with exact int_eqdec. Fail Next Obligation. +Hint Unfold t_z_17__t_Group. Notation "'t_G'" := (t_z_17_). @@ -137,7 +163,7 @@ Equations f_tally {L : {fset Location}} {I : Interface} (s : both L I (t_OvnCont bind_both s (fun x => solve_lift (ret_both (snd x : int32))) : both L I (int32). Fail Next Obligation. -Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {f_g_pow_xis : both L0 I0 (nseq t_group_type 20)} {f_zkp_xis : both L1 I1 (nseq int32 20)} {f_commit_vis : both L2 I2 (nseq int32 20)} {f_g_pow_xi_yi_vis : both L3 I3 (nseq t_group_type 20)} {f_zkp_vis : both L4 I4 (nseq int32 20)} {f_tally : both L5 I5 (int32)} : both(L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := +Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {f_g_pow_xis : both L0 I0 (nseq t_group_type 20)} {f_zkp_xis : both L1 I1 (nseq int32 20)} {f_commit_vis : both L2 I2 (nseq int32 20)} {f_g_pow_xi_yi_vis : both L3 I3 (nseq t_group_type 20)} {f_zkp_vis : both L4 I4 (nseq int32 20)} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := Build_t_OvnContractState := bind_both f_tally (fun f_tally => bind_both f_zkp_vis (fun f_zkp_vis => @@ -145,7 +171,7 @@ Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} bind_both f_commit_vis (fun f_commit_vis => bind_both f_zkp_xis (fun f_zkp_xis => bind_both f_g_pow_xis (fun f_g_pow_xis => - solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both(L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). + solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). Fail Next Obligation. Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). @@ -153,15 +179,11 @@ Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). -Definition state_OVN {L : {fset Location}} {I : Interface} (f_g_pow_xis : both L I (nseq t_group_type 20)) (f_zkp_xis : both L I (nseq int32 20)) (f_commit_vis : both L I (nseq int32 20)) (f_g_pow_xi_yi_vis : both L I (nseq t_group_type 20)) (f_zkp_vis : both L I (nseq int32 20)) (f_tally : both L I (int32)) : choice_type := - t_OvnContractState. Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {T : _} `{ t_Sized (T)} `{ t_HasInitContext (T) ('unit)} (ctx : both L1 I1 (T)) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)) := init_ovn_contract ctx := - Result_Ok (solve_lift (Build_OvnContractState (f_g_pow_xis := repeat one (ret_both (20 : uint_size))) (f_zkp_xis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_commit_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_g_pow_xi_yi_vis := repeat one (ret_both (20 : uint_size))) (f_zkp_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)). + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat one (ret_both (20 : uint_size))) (f_zkp_xis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_commit_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_g_pow_xi_yi_vis := repeat one (ret_both (20 : uint_size))) (f_zkp_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)). Fail Next Obligation. -Definition init_OVN : choice_type := - st. Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) : both L1 I1 (int32) := select_private_voting_key random := @@ -175,59 +197,57 @@ Fail Next Obligation. Definition t_RegisterParam : choice_type := (int32 × int32). -Equations f_i {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := - f_i s := +Equations f_rp_i {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := + f_rp_i s := bind_both s (fun x => solve_lift (ret_both (fst x : int32))) : both L I (int32). Fail Next Obligation. -Equations f_xi {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := - f_xi s := +Equations f_rp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := + f_rp_xi s := bind_both s (fun x => solve_lift (ret_both (snd x : int32))) : both L I (int32). Fail Next Obligation. -Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_i : both L0 I0 (int32)} {f_xi : both L1 I1 (int32)} : both(L0:|:L1) (I0:|:I1) (t_RegisterParam) := +Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (int32)} : both (L0:|:L1) (I0:|:I1) (t_RegisterParam) := Build_t_RegisterParam := - bind_both f_xi (fun f_xi => - bind_both f_i (fun f_i => - solve_lift (ret_both ((f_i,f_xi) : (t_RegisterParam))))) : both(L0:|:L1) (I0:|:I1) (t_RegisterParam). + bind_both f_rp_xi (fun f_rp_xi => + bind_both f_rp_i (fun f_rp_i => + solve_lift (ret_both ((f_rp_i,f_rp_xi) : (t_RegisterParam))))) : both (L0:|:L1) (I0:|:I1) (t_RegisterParam). Fail Next Obligation. -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_i' ':=' y ')'" := (Build_t_RegisterParam (f_i := y) (f_xi := f_xi x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_xi' ':=' y ')'" := (Build_t_RegisterParam (f_i := f_i x) (f_xi := y)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y)). Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {T : _} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} (ctx : both L1 I1 (T)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := register_vote ctx state := Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. -Definition receive_OVN_register (RegisterParam : _) (st : state_OVN) : choice_type := - register_vote st. Definition t_CastVoteParam : choice_type := (int32 × int32 × 'bool). -Equations f_i {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_i s := +Equations f_cvp_i {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_i s := bind_both s (fun x => solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). Fail Next Obligation. -Equations f_xi {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_xi s := +Equations f_cvp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_xi s := bind_both s (fun x => solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). Fail Next Obligation. -Equations f_vote {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I ('bool) := - f_vote s := +Equations f_cvp_vote {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I ('bool) := + f_cvp_vote s := bind_both s (fun x => solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). Fail Next Obligation. -Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_i : both L0 I0 (int32)} {f_xi : both L1 I1 (int32)} {f_vote : both L2 I2 ('bool)} : both(L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := +Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (int32)} {f_cvp_vote : both L2 I2 ('bool)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := Build_t_CastVoteParam := - bind_both f_vote (fun f_vote => - bind_both f_xi (fun f_xi => - bind_both f_i (fun f_i => - solve_lift (ret_both ((f_i,f_xi,f_vote) : (t_CastVoteParam)))))) : both(L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). + bind_both f_cvp_vote (fun f_cvp_vote => + bind_both f_cvp_xi (fun f_cvp_xi => + bind_both f_cvp_i (fun f_cvp_i => + solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_vote) : (t_CastVoteParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). Fail Next Obligation. -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_i' ':=' y ')'" := (Build_t_CastVoteParam (f_i := y) (f_xi := f_xi x) (f_vote := f_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_i := f_i x) (f_xi := y) (f_vote := f_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_i := f_i x) (f_xi := f_xi x) (f_vote := y)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := y)). Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (int32)) : both L1 I1 ('bool) := check_valid zkp := @@ -238,20 +258,38 @@ Definition prod2_loc : Location := (int32 ; 2%nat). Definition prod1_loc : Location := (int32 ; 1%nat). + +Equations foldi_both_ + {acc: choice_type} + {L1 L2 L3 I1 I2 I3} + {L I} + `{is_true (fsubset (L1 :|: L2 :|: L3) L)} `{is_true (fsubset (I1 :|: I2 :|: I3) I)} + (lo_hi: both L2 I2 uint_size * both L3 I3 uint_size) + (f: both (L2 :|: L3) (I2 :|: I3) uint_size -> + both L I acc -> + both L I acc) + (init: both L1 I1 acc) + : both L I (acc) := + foldi_both_ lo_hi f init := + foldi (fst lo_hi) (snd lo_hi) (@f) (init). +Solve All Obligations with intros ; (solve_ssprove_obligations || solve_fsubset_trans). +Solve All Obligations with solve_ssprove_obligations ; solve_fsubset_trans. +Fail Next Obligation. + Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq int32 20)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32) := compute_group_element_for_vote i xi vote xis := - letb prod1 loc(prod1_loc) := one in - letb prod1 := foldi_both (into_iter (Build_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun {L I _ _} =>fun j => + (letb prod1 loc(prod1_loc) := one in + letb prod1 := foldi_both_ (into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) ((* fun {L I _ _} => *)fun j => ssp (fun prod1 => - solve_lift (prod prod1 (xis.a[j])))) prod1 in + solve_lift (prod prod1 (xis.a[j])) : both (L1 :|: L4 :|: fset [prod1_loc]) (I1 :|: I4) _)) prod1 in letb prod2 loc(prod2_loc) := one in - letb prod2 := foldi_both (into_iter (Build_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun {L I _ _} =>fun j => + letb prod2 := foldi_both (into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) ((* fun {L I _ _} => *)fun j => ssp (fun prod2 => - solve_lift (prod prod2 (xis.a[j])))) prod2 in + solve_lift (prod prod2 (xis.a[j])) : both (L1 :|: L4 :|: fset [prod2_loc]) (I1 :|: I4) _ )) prod2 in letb Yi := div prod1 prod2 in solve_lift (prod (pow Yi xi) (g_pow (ifb vote then ret_both (1 : int32) - else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32). + else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32)). Fail Next Obligation. Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) : both L1 I1 (int32) := @@ -259,24 +297,20 @@ Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). Fail Next Obligation. -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {impl HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (ctx : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} (ctx : both L1 I1 ((* impl *) HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := commit_to_vote ctx state := Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. -Definition receive_OVN_commit_to_vote (CastVoteParam : _) (st : state_OVN) : choice_type := - commit_to_vote st. Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (int32)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := v_ZKP_one_out_of_two g_pow_vi vi := solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). Fail Next Obligation. -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {impl HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (ctx : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} (ctx : both L1 I1 ((* impl *) HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := cast_vote ctx state := Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. -Definition receive_OVN_cast_vote (CastVoteParam : _) (st : state_OVN) : choice_type := - cast_vote st. Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := check_valid2 g_pow_xi_yi_vi zkp := @@ -290,19 +324,71 @@ Fail Next Obligation. Definition t_TallyParameter : choice_type := 'unit. -Equations Build_t_TallyParameter : both(fset []) (fset []) (t_TallyParameter) := +Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := Build_t_TallyParameter := - solve_lift (ret_both ((_) : (t_TallyParameter))) : both(fset []) (fset []) (t_TallyParameter). + solve_lift (ret_both ((_) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). Fail Next Obligation. -Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {impl HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (_ : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := +Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} (_ : both L1 I1 ((* impl *) HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := tally_votes _ state := Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. -Definition receive_OVN_tally (TallyParameter : _) (st : state_OVN) : choice_type := - tally_votes st. -Inductive Msg: Type := -| register : Msg -| commit_to_vote : Msg -| cast_vote : Msg -| tally : Msg. + +Definition state_OVN : choice_type := + t_OvnContractState. + +From ConCert.Utils Require Import Extras. +From ConCert.Utils Require Import Automation. +From ConCert.Execution Require Import Serializable. +From ConCert.Execution Require Import Blockchain. +From ConCert.Execution Require Import ContractCommon. +Require Import ConCertLib. + +Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN) (state_OVN) := + ResultMonad.Ok st. + +Instance sized_RegisterParam : t_Sized t_RegisterParam := { Sized := id }. +Instance has_receive_context_RegisterParam : t_HasReceiveContext t_RegisterParam 'unit. +Admitted. + + +Equations receive_OVN_register {L1 L2 I1 I2} {A : _} {T : _} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} (RegisterParam : both L1 I1 t_RegisterParam) (st : both L2 I2 state_OVN) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := + receive_OVN_register RegisterParam st := + register_vote RegisterParam (st). + +(* Definition receive_OVN_commit_to_vote (CastVoteParam : _) (st : state_OVN) : choice_type := *) +(* commit_to_vote CastVoteParam st. *) + +(* Definition receive_OVN_cast_vote (CastVoteParam : _) (st : state_OVN) : choice_type := *) +(* cast_vote st. *) + +(* Definition receive_OVN_tally (TallyParameter : _) (st : state_OVN) : choice_type := *) +(* tally_votes st. *) + +Inductive Msg_OVN: Type := +| msg_register : Msg_OVN +| msg_commit_to_vote : Msg_OVN +| msg_cast_vote : Msg_OVN +| msg_tally : Msg_OVN. +Definition receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) state_OVN := + match msg with + | Some msg_register => + ResultMonad.Ok (st, []) + | Some msg_commit_to_vote => + ResultMonad.Ok (st, []) + | Some msg_cast_vote => + ResultMonad.Ok (st, []) + | Some msg_tally => + ResultMonad.Ok (st, []) + | _ => + ResultMonad.Err st + end. + +Instance serialize_state_OVN : Serializable state_OVN. +Admitted. + +Instance serialize_msg_OVN : Serializable Msg_OVN. +Admitted. + +Definition contract_OVN : Contract state_OVN Msg_OVN state_OVN state_OVN := + build_contract init_OVN receive_OVN. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_concert.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_concert.v index 0f5df76..6c152c0 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_concert.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_concert.v @@ -96,7 +96,7 @@ Definition res_loc : Location := div_loc := (fset [res_loc] : {fset Location}); div := (@div)|}. Solve All Obligations with exact int_eqdec. -Fail Next Obligation. +Fail Next Obligation. Notation "'t_G'" := (t_z_17_). @@ -166,59 +166,44 @@ From ConCert.Utils Require Import Automation. From ConCert.Execution Require Import Serializable. From ConCert.Execution Require Import Blockchain. From ConCert.Execution Require Import ContractCommon. +Require Import ConCertLib. + +Instance int_default {WS} : Default (int WS) := {| default := 0 |}. +Instance nseq_default {A : choice_type} {len} `{Default A} : Default (nseq_ A len) := {| + default := eq_rect (Datatypes.length (List.repeat default len)) + (fun n : nat => nseq_ A n) (Hacspec_Lib_Pre.array_from_list (List.repeat default len)) len (List.repeat_length default len) + |}. +Program Instance both_default {A : choice_type} `{Default A} : Default (both (fset []) (fset []) A) := {| + default := ret_both default + |}. +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. Require Import ConCertLib. (* Definition Setup := *) -Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (setup : unit) : ResultMonad.result state_OVN state_OVN. -Proof. - pose ctx.(ctx_from). - pose ctx.(ctx_origin). - pose (repr U32 ctx.(ctx_amount)). - - pose ((ctx.(ctx_from), ctx.(ctx_origin), repr ctx.(ctx_amount), 0 (* TODO *))). - apply ResultMonad.Ok. - eapply Build_t_OvnContractState. - Unshelve. - all: solve_ssprove_obligations. - Chain -> - ContractCallContext -> - state_OVN -> ResultMonad.result state_OVN state_OVN -(* st. *) - -Inductive Msg: Type := -| register : Msg -| commit_to_vote : Msg -| cast_vote : Msg -| tally : Msg. - -Print ChainBase. -Check @Contract. -(* Setup Msg State Error *) -(* Serializable Setup -> Serializable Msg -> Serializable State -> Serializable Error *) -Check build_contract. - -(* Instance BaseTypes : ChainBase := {| *) -(* Address := nseq int8 (usize 32); *) -(* address_eqb a b := a =.? b ; *) -(* address_eqb_spec a b := _ ;(* Bool.iff_reflect (a = b) (a array_eq b) (symmetry (eqb_leibniz a b)); *) *) -(* (* address_eqdec x y := (EqDecIsDecidable x y); *) *) -(* address_countable := nseq_countable _; *) -(* address_serializable := nseq_serializable _; *) -(* address_is_contract := (fun x => Nat.even (nat_from_be_bytes x)); |}. *) - -Instance serializeable_msg : Serializable Msg. +Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result state_OVN state_OVN := + ResultMonad.Ok st. + +Inductive OVN_Msg: Type := +| register : OVN_Msg +| commit_to_vote : OVN_Msg +| cast_vote : OVN_Msg +| tally : OVN_Msg. + +Definition OVN_receive (chain : Chain) (ctx : ContractCallContext) (state : state_OVN) (msg : Datatypes.option OVN_Msg) : ResultMonad.result (state_OVN * list ActionBody) state_OVN := + match msg with + | Some register => ResultMonad.Ok (state, []) + | Some v => ResultMonad.Ok (state, []) + | None => ResultMonad.Err state + end. + +Instance serializeable_msg : Serializable OVN_Msg. Admitted. Instance serializeable_state_ovn : Serializable state_OVN. Admitted. -Definition auction_contract : Contract _ (* Setup *) Msg state_OVN _. -Proof. - apply build_contract. - - apply init_OVN. - build_contract _ _. - +Definition auction_contract : Contract _ (* Setup *) OVN_Msg state_OVN _ := build_contract init_OVN OVN_receive. Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) : both L1 I1 (int32) := diff --git a/ovn/src/ovn_smart.rs b/ovn/src/ovn_smart.rs index aadaa9f..dadcaaf 100644 --- a/ovn/src/ovn_smart.rs +++ b/ovn/src/ovn_smart.rs @@ -133,8 +133,8 @@ pub fn ZKP/* */(g_pow_xi: /*G*/::group_type, xi: u32) #[derive(Serialize, SchemaType)] pub struct RegisterParam { - i: u32, - xi: u32, + rp_i: u32, + rp_xi: u32, } /** Primary function in round 1 */ @@ -149,21 +149,21 @@ pub fn register_vote( state: OvnContractState/* */, ) -> Result<(A, OvnContractState/* */), ParseError> { // let params : RegisterParam = ctx.parameter_cursor().get()?; // Result? - // let g_pow_xi = G::g_pow(params.xi); - // let zkp_xi = ZKP/* :: */(g_pow_xi, params.xi); + // let g_pow_xi = G::g_pow(params.rp_xi); + // let zkp_xi = ZKP/* :: */(g_pow_xi, params.rp_xi); // let mut state_ret = state.clone(); - // state_ret.g_pow_xis[params.i as usize] = g_pow_xi; - // state_ret.zkp_xis[params.i as usize] = zkp_xi; + // state_ret.g_pow_xis[params.rp_i as usize] = g_pow_xi; + // state_ret.zkp_xis[params.rp_i as usize] = zkp_xi; Ok((A::accept(), state/*_ret*/)) } #[derive(Serialize, SchemaType)] pub struct CastVoteParam { - i: u32, - xi: u32, - vote: bool, + cvp_i: u32, + cvp_xi: u32, + cvp_vote: bool, } pub fn check_valid(zkp: u32) -> bool { @@ -207,11 +207,11 @@ pub fn commit_to_vote( // } // let g_pow_xi_yi_vi = - // compute_group_element_for_vote/*:: */(params.i, params.xi, params.vote, state.g_pow_xis); + // compute_group_element_for_vote/*:: */(params.cvp_i, params.cvp_xi, params.cvp_vote, state.g_pow_xis); // let commit_vi = commit_to/*:: */(g_pow_xi_yi_vi); // let mut state_ret = state.clone(); - // state_ret.commit_vis[params.i as usize] = commit_vi; + // state_ret.commit_vis[params.cvp_i as usize] = commit_vi; Ok((A::accept(), state/*_ret*/)) } @@ -230,16 +230,16 @@ pub fn cast_vote( // let params: CastVoteParam = ctx.parameter_cursor().get()?; // let g_pow_xi_yi_vi = - // compute_group_element_for_vote/*:: */(params.i, params.xi, params.vote, state.g_pow_xis); - // let zkp_vi = ZKP_one_out_of_two/*:: */(g_pow_xi_yi_vi, params.vote); + // compute_group_element_for_vote/*:: */(params.cvp_i, params.cvp_xi, params.cvp_vote, state.g_pow_xis); + // let zkp_vi = ZKP_one_out_of_two/*:: */(g_pow_xi_yi_vi, params.cvp_vote); // let mut state_ret = state.clone(); // let mut g_pow_xi_yi_vis_temp = state_ret.g_pow_xi_yi_vis.clone(); - // g_pow_xi_yi_vis_temp[params.i as usize] = g_pow_xi_yi_vi; + // g_pow_xi_yi_vis_temp[params.cvp_i as usize] = g_pow_xi_yi_vi; // state_ret.g_pow_xi_yi_vis = g_pow_xi_yi_vis_temp; - // state_ret.zkp_vis[params.i as usize] = zkp_vi; + // state_ret.zkp_vis[params.cvp_i as usize] = zkp_vi; Ok((A::accept(),state/*_ret*/)) } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 0a765b4..94ea93e 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2022-12-06" +channel = "nightly-2023-01-07" components = [ "rustc-dev", "llvm-tools-preview" , "rust-analysis" , "rust-src" , "rustfmt" ] From 7631e4214e1ec254ae1519c290264a31b6c3f978 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 27 Sep 2023 22:58:13 +0200 Subject: [PATCH 22/86] Better ovn --- ovn/proofs/ssprove/extraction/ConCertLib.v | 488 +++++++++++++----- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 183 +++---- .../extraction/Hacspec_ovn_semi_work.v | 409 +++++++++++++++ 3 files changed, 848 insertions(+), 232 deletions(-) create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_semi_work.v diff --git a/ovn/proofs/ssprove/extraction/ConCertLib.v b/ovn/proofs/ssprove/extraction/ConCertLib.v index 4b0dbf3..8f1a76e 100644 --- a/ovn/proofs/ssprove/extraction/ConCertLib.v +++ b/ovn/proofs/ssprove/extraction/ConCertLib.v @@ -1,140 +1,378 @@ -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. +From Crypt Require Import choice_type . From Jasmin Require Import word. - From Coq Require Import ZArith. -From Coq Require Import Strings.String. - Import List.ListNotations. -Open Scope list_scope. Open Scope Z_scope. -Open Scope bool_scope. -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. Open Scope hacspec_scope. Import choice.Choice.Exports. -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -From Coq Require Import Morphisms ZArith. -From Coq Require Import List. -Import ListNotations. -Open Scope Z_scope. -Open Scope bool_scope. -Open Scope hacspec_scope. - -(* From QuickChick Require Import QuickChick. *) -(* Require Import QuickChickLib. *) - From ConCert.Execution Require Import Serializable. -From ConCert.Execution Require Import Blockchain. - -(* Require Import Hacspec_Concordium. *) -(* Export Hacspec_Concordium. *) -Global Program Instance int_serializable {ws : wsize} : Serializable (int ws) := - {| serialize m := (serialize (unsigned m)) ; - deserialize l := option_map (fun (x : Z) => @repr ws x) (deserialize l) |}. +Program Definition serialize_by_other {A B} (f_to : B -> A) (f_from : A -> B) `(forall m, f_from (f_to m) = m) `{Serializable A} : Serializable B := + {| + serialize m := serialize (f_to m); + deserialize m := option_map f_from (deserialize m) ; + |}. Next Obligation. intros. hnf. rewrite deserialize_serialize. - unfold option_map. now rewrite wrepr_unsigned. + unfold option_map. now f_equal. Defined. -(* Global Program Instance nseq_serializable len : Serializable (nseq int8 len) := *) -(* {| serialize m := (serialize (nat_from_be_bytes m)) ; *) -(* deserialize l := option_map (fun (x : nat) => nat_to_be_bytes x) (deserialize l) |}. *) -(* Next Obligation. *) -(* intros. cbn. rewrite deserialize_serialize. cbn. rewrite nat_to_from_be_bytes. reflexivity. *) -(* Defined. *) - -(* Global Program Instance nseq_countable len : countable.Countable (nseq int8 len) := *) -(* {| *) -(* countable.encode := fun X : nseq int8 _ => countable.encode (nat_from_be_bytes X); *) -(* countable.decode := fun H : positive => option_map (@nat_to_be_bytes _) (countable.decode H : option nat); *) -(* |}. *) -(* Next Obligation. *) -(* intros. *) -(* rewrite countable.decode_encode. *) -(* cbn. *) -(* now rewrite nat_to_from_be_bytes. *) -(* Qed. *) - -Instance BaseTypes : ChainBase := {| - Address := int32; - address_eqb := Hacspec_Lib_Comparable.eqb ; - address_eqb_spec := Hacspec_Lib_Comparable.eqbP ; - (* address_eqdec x y := (EqDecIsDecidable x y); *) - address_countable := (* nseq_countable *) _; - address_serializable := (* nseq_serializable *) _; - address_is_contract := (fun x => Nat.even ((* nat_from_be_bytes x *) Z.to_nat (unsigned x))); |}. - -(* Definition context_t_from_context (ctx : ContractCallContext) : context_t := *) -(* (ctx.(ctx_from), ctx.(ctx_origin), repr (ctx.(ctx_amount))). *) - -(* Definition accept (ctx : ContractCallContext) := act_transfer ctx.(ctx_origin) ctx.(ctx_amount). *) - -(* Definition has_action_t := ActionBody. *) - -(* Definition action_body_t := ActionBody. *) -(* Definition list_action_t := list ActionBody. *) -(* Definition ACT_TRANSFER (p : Address ∏ int64) := act_transfer (fst p) (unsigned (snd p)). *) -(* Instance d_ab : Default ActionBody := {| default := act_transfer (array_new_ (default : int8) 32) 0 |}. *) - -(* Program Definition to_action_body (ctx : ContractCallContext) (y : has_action_t) : ActionBody := *) -(* match y with *) -(* | (Accept _) => act_transfer (ctx.(ctx_from)) (ctx.(ctx_amount)) *) -(* | (SimpleTransfer (ua, i)) => act_transfer (ua) (i) *) -(* | (SendRaw (ua, receive_name, amount, data)) => *) -(* act_call (ua) (amount) (list_rect (fun _ : list int8 => SerializedValue) *) -(* (build_ser_value ser_unit tt) *) -(* (fun a _ IHdata => *) -(* build_ser_value *) -(* (ser_pair ser_int (ser_value_type IHdata)) *) -(* (unsigned a, ser_value IHdata)) *) -(* data) *) -(* end. *) -(* Instance default_has_action : Default has_action_t := {| default := Accept tt |}. *) - -(* Global Instance serializable_has_action_t : Serializable has_action_t := *) -(* Derive Serializable has_action_t_rect. *) -(* Global Instance show_has_action_t : Show (has_action_t) := *) -(* @Build_Show (has_action_t) (fun x => *) -(* match x with *) -(* Accept a => ("Accept" ++ show a)%string *) -(* | SimpleTransfer a => ("SimpleTransfer" ++ show a)%string *) -(* | SendRaw a => ("SendRaw" ++ show a)%string *) -(* end). *) -(* Definition g_has_action_t : G (has_action_t) := oneOf_ (bindGen arbitrary (fun a => returnGen (Accept a))) [bindGen arbitrary (fun a => returnGen (Accept a));bindGen arbitrary (fun a => returnGen (SimpleTransfer a))]. *) -(* Global Instance gen_has_action_t : Gen (has_action_t) := Build_Gen has_action_t g_has_action_t. *) - -(* Definition to_action_body_list (ctx : ContractCallContext) {X} (k : option (X ∏ list has_action_t)) : ResultMonad.result (X ∏ list ActionBody) unit := *) -(* match (option_map (fun '(x, y) => (x, List.map (to_action_body ctx) y)) k) with *) -(* Some a => ResultMonad.Ok a *) -(* | None => ResultMonad.Err tt *) -(* end. *) - - -(* Instance show_user_address_t : Show (user_address_t) := Build_Show (user_address_t) show. *) -(* Definition g_user_address_t : G (user_address_t) := arbitrary. *) -(* Instance gen_user_address_t : Gen (user_address_t) := Build_Gen user_address_t g_user_address_t. *) - -(* Global Instance serializable_context_t : Serializable context_t := *) -(* Derive Serializable context_t_rect. *) -(* Global Instance show_context_t : Show (context_t) := *) -(* @Build_Show (context_t) (fun x => *) -(* match x with *) -(* Context a => ("Context" ++ show a)%string *) -(* end). *) -(* Definition g_context_t : G (context_t) := oneOf_ (bindGen arbitrary (fun a => returnGen (Context a))) [bindGen arbitrary (fun a => returnGen (Context a))]. *) -(* Global Instance gen_context_t : Gen (context_t) := Build_Gen context_t g_context_t. *) +#[global] Instance hacspec_int_serializable {ws : wsize} : Serializable (int ws) := serialize_by_other (unsigned) (@repr ws) (@wrepr_unsigned ws). + +Lemma eqtype_ord_ext : + forall n, forall x y : fintype.ordinal n, (@eqtype.eq_op + (ord.Ord.eqType + (@ord.Ord.clone _ + (ord.ordinal_ordType n) + _ + id)) x y) = (@eqtype.eq_op ssrnat.nat_eqType (fintype.nat_of_ord x) (fintype.nat_of_ord y)). +Proof. + intros. + destruct x. + simpl. + destruct y. + simpl. + reflexivity. +Qed. + +Theorem lift_set_commute : + forall {A : choice_type} {len} (a : nseq_ A (S len)) (b : fintype.ordinal (S len)) (c : A), + @lift_nseq A (S _) (fmap.setm a b c) = + fmap.setm (@lift_nseq A (S _) a) (lift_ordinal _ b) c. +Proof. + clear ; intros ; fold chElement in *. + simpl in b. + unfold lift_nseq. + apply fmap.eq_fmap. intros x ; simpl in x. + rewrite fmap.setmE. + unfold fmap.getm. + simpl fmap.FMap.fmval. + destruct a ; induction fmval ; simpl lift_fval. + - now rewrite (lift_fval_equation_2 _ (len) (b, c) nil). + - { + destruct x , b. + rewrite (eqtype_ord_ext (S (S (len)))). + simpl eqtype.eq_op. + destruct eqtype.eq_op eqn:eq_o at 2. + + apply (ssrbool.elimT eqtype.eqP) in eq_o. + subst. + destruct ord.Ord.lt. + * simpl. + rewrite (lift_fval_equation_2 _ (len)). + simpl. + rewrite (eqtype_ord_ext (S (S ( len)))). + simpl. + rewrite eqtype.eq_refl. + reflexivity. + * rewrite (eqtype_ord_ext (S (len))). + simpl. + set (eqtype.eq_op _ _). + destruct b eqn:eq_b_o ; subst b. + -- apply (ssrbool.elimT eqtype.eqP) in eq_b_o. + subst. + rewrite (lift_fval_equation_2 _ (len)). + simpl. + rewrite (eqtype_ord_ext (S (S (len)))). + simpl. + rewrite eqtype.eq_refl. + reflexivity. + -- rewrite (lift_fval_equation_2 _ (len)). + simpl. + rewrite (eqtype_ord_ext (S (S (len)))). + simpl. + destruct (fst _). + simpl in *. + rewrite ssrnat.eqSS. + rewrite eq_b_o. + + rewrite IHfmval. + rewrite (eqtype_ord_ext (S (S (len)))). + simpl. + rewrite eqtype.eq_refl. + reflexivity. + + (* apply (path_sorted_tl _). *) + { + intros. + destruct fmval. reflexivity. + - cbn. + cbn in i. + destruct (seq.unzip1 fmval). + + reflexivity. + + cbn in i. + now rewrite LocationUtility.is_true_split_and in i. + } + + destruct ord.Ord.lt. + * simpl. + rewrite (lift_fval_equation_2 _ (len)). + simpl. + rewrite (eqtype_ord_ext (S (S (len)))). + simpl. + rewrite eq_o. + reflexivity. + * rewrite (eqtype_ord_ext (S (len))). + simpl. + set (eqtype.eq_op _ _). + destruct b eqn:eq_b_o ; subst b. + -- apply (ssrbool.elimT eqtype.eqP) in eq_b_o. + subst. + rewrite (lift_fval_equation_2 _ (len)). + simpl. + rewrite (eqtype_ord_ext (S (S (len)))). + simpl. + rewrite eq_o. + rewrite (lift_fval_equation_2 _ (len)). + simpl. + rewrite (eqtype_ord_ext (S (S (len)))). + simpl. + unfold lift_ordinal. + destruct (fst _). + simpl. + simpl in eq_o. + rewrite eq_o. + reflexivity. + -- rewrite (lift_fval_equation_2 _ (len)). + simpl. + rewrite (eqtype_ord_ext (S (S (len)))). + simpl. + destruct a. + destruct s. + simpl in *. + set (b := eqtype.eq_op _ _) ; destruct b eqn:eq_m_o ; subst b. + ++ apply (ssrbool.elimT eqtype.eqP) in eq_m_o. + subst. + rewrite (lift_fval_equation_2 _ (len)). + simpl. + rewrite (eqtype_ord_ext (S (S (len)))). + simpl. + now rewrite eqtype.eq_refl. + ++ rewrite IHfmval. + rewrite (eqtype_ord_ext (S (S (len)))). + simpl. + rewrite eq_o. + rewrite (lift_fval_equation_2 _ (len)). + simpl. + rewrite (eqtype_ord_ext (S (S (len)))). + simpl. + rewrite eq_m_o. + reflexivity. + (* apply (path_sorted_tl _). *) + { + intros. + destruct fmval. reflexivity. + - cbn. + cbn in i. + destruct (seq.unzip1 fmval). + + reflexivity. + + cbn in i. + now rewrite LocationUtility.is_true_split_and in i. + } + } +Qed. + +Theorem array_from_list_helper_inverse : forall {A} len (m : nseq_ A (S len)), + array_from_option_list_helper + (nseq_hd_option m) + (array_to_option_list (nseq_tl m)) len = m. +Proof. + intros. + induction len. + - unfold nseq_tl. + unfold nseq_hd_option. + rewrite array_to_option_list_equation_1. + destruct m, fmval. + + now apply fmap.eq_fmap. + + apply fmap.eq_fmap. intros x ; simpl in x. + + unfold fmap.getm at 2 ; simpl. + destruct (fst _), m ; [ | discriminate ] ; simpl. + rewrite array_from_option_list_helper_equation_1. + unfold setm_option. + rewrite fmap.setmE. + now destruct x , m ; [ | discriminate ] ; simpl. + - rewrite array_to_option_list_equation_2. + + assert (forall (T : ord.Ord.type) (S : choice_type) + (m : @fmap.FMap.fmap_of T S + (ssreflect.Phant (ord.Ord.sort T -> S))) + (k : ord.Ord.sort T) (v : chOption S) (k' : ord.Ord.sort T), + @fmap.getm T S (setm_option m k v) k' = + match v with + | Some v => @fmap.getm T S (fmap.setm m k v) k' + | None => @fmap.getm T S m k' + end) by now destruct v. + + rewrite array_from_option_list_helper_equation_3. + rewrite (IHlen (nseq_tl m)). + + clear. + + apply fmap.eq_fmap. + intros x ; simpl in x. + destruct m ; induction fmval. + + now unfold fmap.getm ; cbn ; rewrite lift_fval_equation_1. + + { + specialize (IHfmval (path_sorted_tl i)). + unfold nseq_hd_option in *. + simpl. + destruct a. + destruct s. + unfold fmap.getm at 2. + simpl. + destruct m. + { + setoid_rewrite <- IHfmval ; clear. + + setoid_rewrite fmap.setmE. + rewrite !(eqtype_ord_ext (S (S len))). + simpl eqtype.eq_op. + replace (_ - _)%nat with O by (set (temp := nseq_tl _) ; rewrite <- (array_to_length_option_list_is_len A len temp) at 1; now rewrite Nat.sub_diag). + + destruct x , m ; [ reflexivity | ]. + rewrite tl_fmap_equation_2. + unfold setm_option. + destruct fmval ; [reflexivity | ]. + simpl. + destruct p, s. + simpl. + destruct m0 ; [ discriminate | ]. + + rewrite tl_fmap_equation_3. + + unfold fmap.getm. + simpl. + + set (@fmap.getm_def _ _). + set (lift_fval _). + set (lift_fval _). + assert (l = l0) ; [ subst l l0 | now rewrite H ]. + f_equal. + + now apply lower_fval_ext_list. + } + { + setoid_rewrite <- IHfmval ; clear. + unfold setm_option. + unfold fmap.getm. + simpl. + + rewrite tl_fmap_equation_3. + destruct (eqtype.eq_op _ _) eqn:eq_o. + - apply (ssrbool.elimT eqtype.eqP) in eq_o. + rewrite eq_o. + + subst. + simpl. + + rewrite lower_fval_equation_2. + rewrite lift_fval_equation_2. + simpl. + + rewrite !(eqtype_ord_ext (S (S len))). + simpl. + rewrite eqtype.eq_refl. + reflexivity. + - unfold setm_option. + destruct fmval. + + (* discriminate. *) + rewrite tl_fmap_equation_1. + simpl. + + rewrite lower_fval_equation_2. + rewrite lift_fval_equation_2. + simpl. + + rewrite lower_fval_equation_1. + simpl. + + rewrite !(eqtype_ord_ext (S (S len))). + simpl. + rewrite !(eqtype_ord_ext (S (S len))) in eq_o. + simpl in eq_o. + rewrite eq_o. + simpl. + reflexivity. + + destruct p , s. + destruct m0 ; [ discriminate | ]. + simpl. + + rewrite lower_fval_equation_2. + rewrite lift_fval_equation_2. + simpl. + + rewrite lower_fval_equation_2. + rewrite lift_fval_equation_2. + simpl. + + rewrite tl_fmap_equation_3. + simpl. + + rewrite lower_fval_equation_2. + rewrite lift_fval_equation_2. + simpl. + + rewrite !(eqtype_ord_ext (S (S len))). + simpl. + + rewrite (eqtype_ord_ext (S (S len))) in eq_o. + simpl in eq_o. + rewrite eq_o. + + apply (ssrbool.elimF eqtype.eqP) in eq_o. + + destruct (eqtype.eq_op _ _) eqn:eq_o2 ; [ reflexivity | ]. + + + simpl. + + set (@fmap.getm_def _ _). + set (lift_fval _). + set (lift_fval _). + assert (l = l0) ; [ subst l l0 | now rewrite H ]. + f_equal. + apply lower_fval_ext_list. + apply (path_sorted_tl (path_sorted_tl i)). + apply (path_sorted_tl (path_sorted_tl i)). + reflexivity. + } + } +Qed. + +Theorem array_from_list_to_list_unit : forall {A} len (m : nseq_ A len), + array_from_option_list' (array_to_option_list m) len = m. +Proof. + intros. + induction len. + - now destruct m. (* unit element equailty *) + - simpl. + pose (resize_to_length_idemp (array_to_option_list m)). + rewrite (array_to_length_option_list_is_len A (S len) m) in e. + rewrite <- e ; clear e. + rewrite array_to_option_list_equation_2. + specialize (IHlen (nseq_tl m)). + apply array_from_list_helper_inverse. +Qed. + +Definition defaulted_nseq {A len} (m : nseq_ A (S len)) := + forall i, match fmap.getm m i with + | Some x => x <> chCanonical A + | None => True + end. + +#[global] Instance nseq_serializable {A : choice_type} {len} `{Serializable A} : Serializable (nseq_ A len) := + serialize_by_other (array_to_option_list) (fun x => array_from_option_list' x len) (array_from_list_to_list_unit len). + +Ltac serialize_enum := intros ; autounfold ; repeat apply @product_serializable ; fold chElement. + +(* From ConCert.Execution Require Import Blockchain. *) + +(* Instance BaseTypes : ConCert.Execution.Blockchain.ChainBase := *) +(* {| *) +(* Address := nat; *) +(* address_eqb := Nat.eqb ; *) +(* address_eqb_spec := Nat.eqb_spec; *) +(* address_is_contract := Nat.even; *) +(* |}. *) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 68f7ca5..739fc75 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -3,12 +3,12 @@ Set Warnings "-notation-overridden,-ambiguous-paths". From Crypt Require Import choice_type Package Prelude. Import PackageNotation. From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. +From mathcomp Require Import word_ssrZ word. From Jasmin Require Import word. From Coq Require Import ZArith. From Coq Require Import Strings.String. - Import List.ListNotations. +Import List.ListNotations. Open Scope list_scope. Open Scope Z_scope. Open Scope bool_scope. @@ -22,6 +22,9 @@ From Hacspec Require Import Hacspec_Lib. Open Scope hacspec_scope. Import choice.Choice.Exports. +Require Import ConCertLib. +From ConCert.Execution Require Import Serializable. + Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. (*Not implemented yet? todo(item)*) @@ -70,42 +73,23 @@ Fail Next Obligation. Definition res_loc : Location := (int32 ; 0%nat). -Equations foldi_both - {acc: choice_type} - {L1 L2 L3 I1 I2 I3} - {L I} - `{is_true (fsubset L1 L)} `{is_true (fsubset I1 I)} - `{is_true (fsubset L2 L)} `{is_true (fsubset I2 I)} - `{is_true (fsubset L3 L)} `{is_true (fsubset I3 I)} - (lo_hi: both L2 I2 uint_size * both L3 I3 uint_size) - (f: both (L2 :|: L3) (I2 :|: I3) uint_size -> - both L I acc -> - both L I acc) - (init: both L1 I1 acc) - : both L I (acc) := - foldi_both lo_hi f init := - foldi (fst lo_hi) (snd lo_hi) (@f) (init). -Solve All Obligations with intros ; solve_ssprove_obligations. -Fail Next Obligation. - #[global] Program Instance t_z_17__t_Group : t_Group t_z_17_ := let t_group_type := int32 : choice_type in let q := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (17 : int32)) : both L I (int32) in let g := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (3 : int32)) : both L I (int32) in - let g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift ((g .^ x) .% q) : both L1 I1 (int32) in - let pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: L2) (I1 :|: I2) (int32) in - let one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both L I (int32) in - let prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% q) : both (L1 :|: L2) (I1 :|: I2) (int32) in + let g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift (((@g (fset []) (fset [])) .^ x) .% (@q (fset[]) (fset[]))) : both (L1 :|: fset []) I1 (int32) in + let pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((g .^ x) .% (@q (fset[]) (fset[]))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + let one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I (int32) in + let prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% (@q (fset[]) (fset[]))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in let inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => letb res loc(res_loc) := ret_both (0 : int32) in - letb res := foldi_both (into_iter (Build_t_Range (f_start := ret_both (1 : int32)) (f_end := q))) ((* fun {L I _ _} => *)fun i => + letb res := foldi_both (into_iter (Build_t_Range (f_start := ret_both (1 : int32)) (f_end := (@q (fset[]) (fset[]))))) (fun i => ssp (fun res => solve_lift (ifb (g_pow i) =.? x then letb res := i in res else res))) res in - res : both (L1 :|: fset [res_loc]) I1 (int32) in - let div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (prod x (inv y)) : both (L1 :|: L2 :|: fset [res_loc]) (I1 :|: I2) (int32) in - {| t_group_type := (@t_group_type); + (* solve_lift *) res : both (L1 :|: fset [res_loc]) I1 (int32) in + let div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (prod x (inv y)) : both (L1 :|: L2 :|: fset [res_loc]) (I1 :|: I2) (int32) in{| t_group_type := (@t_group_type); q := (@q); g := (@g); g_pow_loc := (fset [] : {fset Location}); @@ -119,8 +103,9 @@ Fail Next Obligation. inv_loc := (fset [res_loc] : {fset Location}); inv := (@inv); div_loc := (fset [res_loc] : {fset Location}); - div := (@div)|}. -Solve All Obligations with exact int_eqdec. + div := (@div); + t_group_type_t_Eq := int_eqdec + |}. Fail Next Obligation. Hint Unfold t_z_17__t_Group. @@ -179,6 +164,14 @@ Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). +Definition state_OVN : choice_type := + t_OvnContractState. +Hint Unfold t_OvnContractState. +Hint Unfold state_OVN. + +#[global] Program Instance serializable_state_OVN : Serializable state_OVN := + ltac:(serialize_enum). +Solve All Obligations with exact nseq_serializable || exact hacspec_int_serializable. Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {T : _} `{ t_Sized (T)} `{ t_HasInitContext (T) ('unit)} (ctx : both L1 I1 (T)) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)) := init_ovn_contract ctx := @@ -220,6 +213,8 @@ Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Inte register_vote ctx state := Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. +Definition receive_OVN_register (ctx : RegisterParam) (st : both _ _ (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := + register_vote ctx st. Definition t_CastVoteParam : choice_type := (int32 × int32 × 'bool). @@ -258,38 +253,20 @@ Definition prod2_loc : Location := (int32 ; 2%nat). Definition prod1_loc : Location := (int32 ; 1%nat). - -Equations foldi_both_ - {acc: choice_type} - {L1 L2 L3 I1 I2 I3} - {L I} - `{is_true (fsubset (L1 :|: L2 :|: L3) L)} `{is_true (fsubset (I1 :|: I2 :|: I3) I)} - (lo_hi: both L2 I2 uint_size * both L3 I3 uint_size) - (f: both (L2 :|: L3) (I2 :|: I3) uint_size -> - both L I acc -> - both L I acc) - (init: both L1 I1 acc) - : both L I (acc) := - foldi_both_ lo_hi f init := - foldi (fst lo_hi) (snd lo_hi) (@f) (init). -Solve All Obligations with intros ; (solve_ssprove_obligations || solve_fsubset_trans). -Solve All Obligations with solve_ssprove_obligations ; solve_fsubset_trans. -Fail Next Obligation. - Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq int32 20)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32) := compute_group_element_for_vote i xi vote xis := - (letb prod1 loc(prod1_loc) := one in - letb prod1 := foldi_both_ (into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) ((* fun {L I _ _} => *)fun j => + letb prod1 loc(prod1_loc) := one in + letb prod1 := foldi_both (into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun j => ssp (fun prod1 => - solve_lift (prod prod1 (xis.a[j])) : both (L1 :|: L4 :|: fset [prod1_loc]) (I1 :|: I4) _)) prod1 in + solve_lift (prod prod1 (xis.a[j])))) prod1 in letb prod2 loc(prod2_loc) := one in - letb prod2 := foldi_both (into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) ((* fun {L I _ _} => *)fun j => + letb prod2 := foldi_both (into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun j => ssp (fun prod2 => - solve_lift (prod prod2 (xis.a[j])) : both (L1 :|: L4 :|: fset [prod2_loc]) (I1 :|: I4) _ )) prod2 in + solve_lift (prod prod2 (xis.a[j])))) prod2 in letb Yi := div prod1 prod2 in solve_lift (prod (pow Yi xi) (g_pow (ifb vote then ret_both (1 : int32) - else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32)). + else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32). Fail Next Obligation. Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) : both L1 I1 (int32) := @@ -297,20 +274,24 @@ Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). Fail Next Obligation. -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} (ctx : both L1 I1 ((* impl *) HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {impl HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (ctx : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := commit_to_vote ctx state := Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. +Definition receive_OVN_commit_to_vote (ctx : CastVoteParam) (st : both _ _ (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := + commit_to_vote ctx st. Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (int32)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := v_ZKP_one_out_of_two g_pow_vi vi := solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). Fail Next Obligation. -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} (ctx : both L1 I1 ((* impl *) HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {impl HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (ctx : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := cast_vote ctx state := Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. +Definition receive_OVN_cast_vote (ctx : CastVoteParam) (st : both _ _ (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := + cast_vote ctx st. Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := check_valid2 g_pow_xi_yi_vi zkp := @@ -329,66 +310,54 @@ Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) : solve_lift (ret_both ((_) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). Fail Next Obligation. -Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} (_ : both L1 I1 ((* impl *) HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := +Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {impl HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (_ : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := tally_votes _ state := Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. +Definition receive_OVN_tally (ctx : TallyParameter) (st : both _ _ (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := + tally_votes ctx st. -Definition state_OVN : choice_type := - t_OvnContractState. - -From ConCert.Utils Require Import Extras. -From ConCert.Utils Require Import Automation. -From ConCert.Execution Require Import Serializable. From ConCert.Execution Require Import Blockchain. -From ConCert.Execution Require Import ContractCommon. -Require Import ConCertLib. - -Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN) (state_OVN) := - ResultMonad.Ok st. - -Instance sized_RegisterParam : t_Sized t_RegisterParam := { Sized := id }. -Instance has_receive_context_RegisterParam : t_HasReceiveContext t_RegisterParam 'unit. -Admitted. - - -Equations receive_OVN_register {L1 L2 I1 I2} {A : _} {T : _} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} (RegisterParam : both L1 I1 t_RegisterParam) (st : both L2 I2 state_OVN) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := - receive_OVN_register RegisterParam st := - register_vote RegisterParam (st). -(* Definition receive_OVN_commit_to_vote (CastVoteParam : _) (st : state_OVN) : choice_type := *) -(* commit_to_vote CastVoteParam st. *) - -(* Definition receive_OVN_cast_vote (CastVoteParam : _) (st : state_OVN) : choice_type := *) -(* cast_vote st. *) - -(* Definition receive_OVN_tally (TallyParameter : _) (st : state_OVN) : choice_type := *) -(* tally_votes st. *) +Instance BaseTypes : ConCert.Execution.Blockchain.ChainBase := + {| + Address := nat; + address_eqb := Nat.eqb ; + address_eqb_spec := Nat.eqb_spec; + address_is_contract := Nat.even; + |}. +Definition init_OVN {L : {fset Location}} {I : Interface} (chain : Chain) (ctx : ContractCallContext) (st : both L I (state_OVN)) : ResultMonad.result (both L I (state_OVN)) (t_ParseError) := + ResultMonad.Ok st. Inductive Msg_OVN: Type := -| msg_register : Msg_OVN -| msg_commit_to_vote : Msg_OVN -| msg_cast_vote : Msg_OVN -| msg_tally : Msg_OVN. -Definition receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) state_OVN := - match msg with - | Some msg_register => - ResultMonad.Ok (st, []) - | Some msg_commit_to_vote => - ResultMonad.Ok (st, []) - | Some msg_cast_vote => - ResultMonad.Ok (st, []) - | Some msg_tally => - ResultMonad.Ok (st, []) +| msg_OVN_register : RegisterParam -> : Msg_OVN +| msg_OVN_commit_to_vote : CastVoteParam -> : Msg_OVN +| msg_OVN_cast_vote : CastVoteParam -> : Msg_OVN +| msg_OVN_tally : TallyParameter -> : Msg_OVN. +Definition receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : both L I (state_OVN)) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) state_OVN := + matchb msg with + | Some msg_OVN_register val => + match (is_pure (both_prog (receive_OVN_register val (st)))) with + | inl x => ResultMonad.Ok (solve_lift ret_both (fst x), []) + | inr x => ResultMonad.Err x + end + | Some msg_OVN_commit_to_vote val => + match (is_pure (both_prog (receive_OVN_commit_to_vote val (st)))) with + | inl x => ResultMonad.Ok (solve_lift ret_both (fst x), []) + | inr x => ResultMonad.Err x + end + | Some msg_OVN_cast_vote val => + match (is_pure (both_prog (receive_OVN_cast_vote val (st)))) with + | inl x => ResultMonad.Ok (solve_lift ret_both (fst x), []) + | inr x => ResultMonad.Err x + end + | Some msg_OVN_tally val => + match (is_pure (both_prog (receive_OVN_tally val (st)))) with + | inl x => ResultMonad.Ok (solve_lift ret_both (fst x), []) + | inr x => ResultMonad.Err x + end | _ => ResultMonad.Err st end. - -Instance serialize_state_OVN : Serializable state_OVN. -Admitted. - -Instance serialize_msg_OVN : Serializable Msg_OVN. -Admitted. - -Definition contract_OVN : Contract state_OVN Msg_OVN state_OVN state_OVN := +Definition contract_OVN : Contract (state_OVN) (Msg_OVN) (state_OVN) (t_ParseError) := build_contract init_OVN receive_OVN. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_semi_work.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_semi_work.v new file mode 100644 index 0000000..9a341aa --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_semi_work.v @@ -0,0 +1,409 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. + Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +Class t_Group (Self : choice_type) := { + t_group_type : choice_type ; + t_group_type_t_Serialize :> t_Serialize (t_group_type) ; + t_group_type_t_Deserial :> t_Deserial (t_group_type) ; + t_group_type_t_Serial :> t_Serial (t_group_type) ; + t_group_type_t_Copy :> t_Copy (t_group_type) ; + t_group_type_t_Clone :> t_Clone (t_group_type) ; + t_group_type_t_Eq :> t_Eq (t_group_type) ; + t_group_type_t_PartialEq :> t_PartialEq (t_group_type) ; + t_group_type_t_Sized :> t_Sized (t_group_type) ; + q : forall {L1 I1}, both L1 I1 (int32) ; + g : forall {L1 I1}, both L1 I1 (t_group_type) ; + g_pow_loc : {fset Location} ; + g_pow : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: g_pow_loc) I1 (t_group_type) ; + pow_loc : {fset Location} ; + pow : forall {L1 L2 I1 I2}, both L1 I1 (t_group_type) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: pow_loc) (I1 :|: I2) (t_group_type) ; + one_loc : {fset Location} ; + one : forall {L1 I1}, both (L1 :|: one_loc) I1 (t_group_type) ; + prod_loc : {fset Location} ; + prod : forall {L1 L2 I1 I2}, both L1 I1 (t_group_type) -> both L2 I2 (t_group_type) -> both (L1 :|: L2 :|: prod_loc) (I1 :|: I2) (t_group_type) ; + inv_loc : {fset Location} ; + inv : forall {L1 I1}, both L1 I1 (t_group_type) -> both (L1 :|: inv_loc) I1 (t_group_type) ; + div_loc : {fset Location} ; + div : forall {L1 L2 I1 I2}, both L1 I1 (t_group_type) -> both L2 I2 (t_group_type) -> both (L1 :|: L2 :|: div_loc) (I1 :|: I2) (t_group_type) ; +}. +Hint Unfold g_pow_loc. +Hint Unfold pow_loc. +Hint Unfold one_loc. +Hint Unfold prod_loc. +Hint Unfold inv_loc. +Hint Unfold div_loc. + +Definition t_z_17_ : choice_type := + 'unit. +Equations Build_t_z_17_ : both (fset []) (fset []) (t_z_17_) := + Build_t_z_17_ := + solve_lift (ret_both ((_) : (t_z_17_))) : both (fset []) (fset []) (t_z_17_). +Fail Next Obligation. + +Definition res_loc : Location := + (int32 ; 0%nat). + +Equations foldi_both + {acc: choice_type} + {L1 L2 L3 I1 I2 I3} + {L I} + `{is_true (fsubset L1 L)} `{is_true (fsubset I1 I)} + `{is_true (fsubset L2 L)} `{is_true (fsubset I2 I)} + `{is_true (fsubset L3 L)} `{is_true (fsubset I3 I)} + (lo_hi: both L2 I2 uint_size * both L3 I3 uint_size) + (f: both (L2 :|: L3) (I2 :|: I3) uint_size -> + both L I acc -> + both L I acc) + (init: both L1 I1 acc) + : both L I (acc) := + foldi_both lo_hi f init := + foldi (fst lo_hi) (snd lo_hi) (@f) (init). +Solve All Obligations with intros ; solve_ssprove_obligations. +Fail Next Obligation. + +#[global] Program Instance t_z_17__t_Group : t_Group t_z_17_ := + let t_group_type := int32 : choice_type in + let q := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (17 : int32)) : both L I (int32) in + let g := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (3 : int32)) : both L I (int32) in + let g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift ((g .^ x) .% q) : both L1 I1 (int32) in + let pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: L2) (I1 :|: I2) (int32) in + let one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both L I (int32) in + let prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% q) : both (L1 :|: L2) (I1 :|: I2) (int32) in + let inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => letb res loc(res_loc) := ret_both (0 : int32) in + letb res := foldi_both (into_iter (Build_t_Range (f_start := ret_both (1 : int32)) (f_end := q))) ((* fun {L I _ _} => *)fun i => + ssp (fun res => + solve_lift (ifb (g_pow i) =.? x + then letb res := i in + res + else res))) res in + res : both (L1 :|: fset [res_loc]) I1 (int32) in + let div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (prod x (inv y)) : both (L1 :|: L2 :|: fset [res_loc]) (I1 :|: I2) (int32) in + {| t_group_type := (@t_group_type); + q := (@q); + g := (@g); + g_pow_loc := (fset [] : {fset Location}); + g_pow := (@g_pow); + pow_loc := (fset [] : {fset Location}); + pow := (@pow); + one_loc := (fset [] : {fset Location}); + one := (@one); + prod_loc := (fset [] : {fset Location}); + prod := (@prod); + inv_loc := (fset [res_loc] : {fset Location}); + inv := (@inv); + div_loc := (fset [res_loc] : {fset Location}); + div := (@div)|}. +Solve All Obligations with exact int_eqdec. +Fail Next Obligation. +Hint Unfold t_z_17__t_Group. + +Notation "'t_G'" := (t_z_17_). + +Equations n {L : {fset Location}} {I : Interface} : both L I (uint_size) := + n := + solve_lift (ret_both (20 : uint_size)) : both L I (uint_size). +Fail Next Obligation. + +Definition t_OvnContractState : choice_type := + (nseq t_group_type 20 × nseq int32 20 × nseq int32 20 × nseq t_group_type 20 × nseq int32 20 × int32). +Equations f_g_pow_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq t_group_type 20) := + f_g_pow_xis s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq t_group_type 20))) : both L I (nseq t_group_type 20). +Fail Next Obligation. +Equations f_zkp_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := + f_zkp_xis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq int32 20))) : both L I (nseq int32 20). +Fail Next Obligation. +Equations f_commit_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := + f_commit_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : nseq int32 20))) : both L I (nseq int32 20). +Fail Next Obligation. +Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq t_group_type 20) := + f_g_pow_xi_yi_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : nseq t_group_type 20))) : both L I (nseq t_group_type 20). +Fail Next Obligation. +Equations f_zkp_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := + f_zkp_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : nseq int32 20))) : both L I (nseq int32 20). +Fail Next Obligation. +Equations f_tally {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (int32) := + f_tally s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {f_g_pow_xis : both L0 I0 (nseq t_group_type 20)} {f_zkp_xis : both L1 I1 (nseq int32 20)} {f_commit_vis : both L2 I2 (nseq int32 20)} {f_g_pow_xi_yi_vis : both L3 I3 (nseq t_group_type 20)} {f_zkp_vis : both L4 I4 (nseq int32 20)} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := + Build_t_OvnContractState := + bind_both f_tally (fun f_tally => + bind_both f_zkp_vis (fun f_zkp_vis => + bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => + bind_both f_commit_vis (fun f_commit_vis => + bind_both f_zkp_xis (fun f_zkp_xis => + bind_both f_g_pow_xis (fun f_g_pow_xis => + solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). +Fail Next Obligation. +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). + +Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {T : _} `{ t_Sized (T)} `{ t_HasInitContext (T) ('unit)} (ctx : both L1 I1 (T)) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)) := + init_ovn_contract ctx := + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat one (ret_both (20 : uint_size))) (f_zkp_xis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_commit_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_g_pow_xi_yi_vis := repeat one (ret_both (20 : uint_size))) (f_zkp_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)). +Fail Next Obligation. + +Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) : both L1 I1 (int32) := + select_private_voting_key random := + solve_lift (random .% q) : both L1 I1 (int32). +Fail Next Obligation. + +Equations v_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi : both L1 I1 (int32)) (xi : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) (int32) := + v_ZKP g_pow_xi xi := + solve_lift (ret_both (0 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). +Fail Next Obligation. + +Definition t_RegisterParam : choice_type := + (int32 × int32). +Equations f_rp_i {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := + f_rp_i s := + bind_both s (fun x => + solve_lift (ret_both (fst x : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_rp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := + f_rp_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (int32)} : both (L0:|:L1) (I0:|:I1) (t_RegisterParam) := + Build_t_RegisterParam := + bind_both f_rp_xi (fun f_rp_xi => + bind_both f_rp_i (fun f_rp_i => + solve_lift (ret_both ((f_rp_i,f_rp_xi) : (t_RegisterParam))))) : both (L0:|:L1) (I0:|:I1) (t_RegisterParam). +Fail Next Obligation. +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y)). + +Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {T : _} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} (ctx : both L1 I1 (T)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := + register_vote ctx state := + Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. + +Definition t_CastVoteParam : choice_type := + (int32 × int32 × 'bool). +Equations f_cvp_i {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_i s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_cvp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_cvp_vote {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I ('bool) := + f_cvp_vote s := + bind_both s (fun x => + solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). +Fail Next Obligation. +Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (int32)} {f_cvp_vote : both L2 I2 ('bool)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := + Build_t_CastVoteParam := + bind_both f_cvp_vote (fun f_cvp_vote => + bind_both f_cvp_xi (fun f_cvp_xi => + bind_both f_cvp_i (fun f_cvp_i => + solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_vote) : (t_CastVoteParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). +Fail Next Obligation. +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := y)). + +Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (int32)) : both L1 I1 ('bool) := + check_valid zkp := + solve_lift (ret_both (true : 'bool)) : both L1 I1 ('bool). +Fail Next Obligation. + +Definition prod2_loc : Location := + (int32 ; 2%nat). +Definition prod1_loc : Location := + (int32 ; 1%nat). + +Equations foldi_both_ + {acc: choice_type} + {L1 L2 L3 I1 I2 I3} + {L I} + `{is_true (fsubset (L1 :|: L2 :|: L3) L)} `{is_true (fsubset (I1 :|: I2 :|: I3) I)} + (lo_hi: both L2 I2 uint_size * both L3 I3 uint_size) + (f: both (L2 :|: L3) (I2 :|: I3) uint_size -> + both L I acc -> + both L I acc) + (init: both L1 I1 acc) + : both L I (acc) := + foldi_both_ lo_hi f init := + foldi (fst lo_hi) (snd lo_hi) (@f) (init). +Solve All Obligations with intros ; (solve_ssprove_obligations || solve_fsubset_trans). +Solve All Obligations with solve_ssprove_obligations ; solve_fsubset_trans. +Fail Next Obligation. + +Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq int32 20)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32) := + compute_group_element_for_vote i xi vote xis := + (letb prod1 loc(prod1_loc) := one in + letb prod1 := foldi_both_ (into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) ((* fun {L I _ _} => *)fun j => + ssp (fun prod1 => + solve_lift (prod prod1 (xis.a[j])) : both (L1 :|: L4 :|: fset [prod1_loc]) (I1 :|: I4) _)) prod1 in + letb prod2 loc(prod2_loc) := one in + letb prod2 := foldi_both (into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) ((* fun {L I _ _} => *)fun j => + ssp (fun prod2 => + solve_lift (prod prod2 (xis.a[j])) : both (L1 :|: L4 :|: fset [prod2_loc]) (I1 :|: I4) _ )) prod2 in + letb Yi := div prod1 prod2 in + solve_lift (prod (pow Yi xi) (g_pow (ifb vote + then ret_both (1 : int32) + else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32)). +Fail Next Obligation. + +Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) : both L1 I1 (int32) := + commit_to x := + solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). +Fail Next Obligation. + +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} (ctx : both L1 I1 ((* impl *) HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := + commit_to_vote ctx state := + Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. + +Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (int32)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := + v_ZKP_one_out_of_two g_pow_vi vi := + solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). +Fail Next Obligation. + +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} (ctx : both L1 I1 ((* impl *) HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := + cast_vote ctx state := + Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. + +Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + check_valid2 g_pow_xi_yi_vi zkp := + solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + check_commitment g_pow_xi_yi_vi zkp := + solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Definition t_TallyParameter : choice_type := + 'unit. +Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := + Build_t_TallyParameter := + solve_lift (ret_both ((_) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). +Fail Next Obligation. + +Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} (_ : both L1 I1 ((* impl *) HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := + tally_votes _ state := + Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. + +Definition state_OVN : choice_type := + t_OvnContractState. + +From ConCert.Utils Require Import Extras. +From ConCert.Utils Require Import Automation. +From ConCert.Execution Require Import Serializable. +From ConCert.Execution Require Import Blockchain. +From ConCert.Execution Require Import ContractCommon. +Require Import ConCertLib. + +Definition init_OVN {L I} (chain : Chain) (ctx : ContractCallContext) (st : both L I state_OVN) : ResultMonad.result (both L I state_OVN) t_ParseError := + ResultMonad.Ok st. + +Instance sized_RegisterParam : t_Sized t_RegisterParam := { Sized := id }. +Instance has_receive_context_RegisterParam : t_HasReceiveContext t_RegisterParam 'unit. +Admitted. + + +Equations receive_OVN_register {L1 L2 I1 I2} {A : _} {T : _} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} (RegisterParam : both L1 I1 t_RegisterParam) (st : both L2 I2 state_OVN) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := + receive_OVN_register RegisterParam st := + register_vote RegisterParam (st). + +(* Definition receive_OVN_commit_to_vote (CastVoteParam : _) (st : state_OVN) : choice_type := *) +(* commit_to_vote CastVoteParam st. *) + +(* Definition receive_OVN_cast_vote (CastVoteParam : _) (st : state_OVN) : choice_type := *) +(* cast_vote st. *) + +(* Definition receive_OVN_tally (TallyParameter : _) (st : state_OVN) : choice_type := *) +(* tally_votes st. *) + + +Instance sized_state_OVN : t_Sized state_OVN := { Sized := id }. +(* Instance has_receive_context_RegisterParam : t_HasReceiveContext t_RegisterParam 'unit. *) +(* Admitted. *) + +Instance has_actions_state_ovn : t_HasActions state_OVN. +Admitted. + +Inductive Msg_OVN: Type := +| msg_register : forall {L I}, both L I t_RegisterParam -> Msg_OVN +| msg_commit_to_vote : Msg_OVN +| msg_cast_vote : Msg_OVN +| msg_tally : Msg_OVN. +Equations receive_OVN {L I} (chain : Chain) (ctx : ContractCallContext) (st : both L I state_OVN) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (both L I state_OVN * list ActionBody) t_ParseError := + receive_OVN chain ctx st msg := + match msg with + | Some (msg_register val) => + match (is_pure (both_prog (receive_OVN_register val (st)))) with + | inl x => ResultMonad.Ok (solve_lift ret_both (fst x), []) + | inr x => ResultMonad.Err x + end + (* ResultMonad.Ok (solve_lift receive_OVN_register _ (st), []) *) + (* | Some msg_commit_to_vote => *) + (* ResultMonad.Ok (st, []) *) + (* | Some msg_cast_vote => *) + (* ResultMonad.Ok (st, []) *) + (* | Some msg_tally => *) + (* ResultMonad.Ok (st, []) *) + | _ => + ResultMonad.Err _ + end. +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Instance serialize_state_OVN {L I} : Serializable (both L I state_OVN). +Admitted. + +Instance serialize_msg_OVN : Serializable Msg_OVN. +Admitted. + +Program Definition contract_OVN {L I} : Contract (both L I state_OVN) Msg_OVN (both L I state_OVN) t_ParseError := + build_contract init_OVN receive_OVN. From 6845d5454d2e4192212f7f6f4f18ab6d4b6e74d8 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Thu, 28 Sep 2023 16:51:33 +0200 Subject: [PATCH 23/86] Working contract state --- ovn/proofs/ssprove/extraction/ConCertLib.v | 26 +++++ ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 110 +++++++++++++++----- 2 files changed, 108 insertions(+), 28 deletions(-) diff --git a/ovn/proofs/ssprove/extraction/ConCertLib.v b/ovn/proofs/ssprove/extraction/ConCertLib.v index 8f1a76e..97a98e7 100644 --- a/ovn/proofs/ssprove/extraction/ConCertLib.v +++ b/ovn/proofs/ssprove/extraction/ConCertLib.v @@ -20,6 +20,18 @@ Next Obligation. unfold option_map. now f_equal. Defined. +Program Definition serialize_by_other_option {A B} (f_to : B -> Datatypes.option A) (f_from : Datatypes.option A -> Datatypes.option B) `(forall m, f_from (f_to m) = Some m) `{Serializable A} : Serializable B := + {| + serialize m := serialize (f_to m); + deserialize m := match (deserialize m) with + | Some m => f_from m + | _ => None + end; + |}. +Next Obligation. + intros. hnf. rewrite deserialize_serialize. now f_equal. +Defined. + #[global] Instance hacspec_int_serializable {ws : wsize} : Serializable (int ws) := serialize_by_other (unsigned) (@repr ws) (@wrepr_unsigned ws). Lemma eqtype_ord_ext : @@ -376,3 +388,17 @@ Ltac serialize_enum := intros ; autounfold ; repeat apply @product_serializable (* address_eqb_spec := Nat.eqb_spec; *) (* address_is_contract := Nat.even; *) (* |}. *) + +Theorem both_ext_prog : + forall {L I A} (x y : both L I A), both_prog x = both_prog y <-> x = y. +Proof. + intros L I A [both_x valid_x eq_x] [both_y valid_y eq_y] ; simpl. + split. + - intros ; subst. + f_equal ; easy. + - easy. +Qed. + +Instance serializable_both {L I} {A : choice_type} `{Serializable A} : Serializable (both L I A). +Proof. +Admitted. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 739fc75..2dba088 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -213,7 +213,12 @@ Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Inte register_vote ctx state := Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. -Definition receive_OVN_register (ctx : RegisterParam) (st : both _ _ (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := +Instance t_sized_register : t_Sized t_RegisterParam. +Admitted. +Instance t_has_receive_context_register : t_HasReceiveContext t_RegisterParam 'unit . +Admitted. +Equations receive_OVN_register {L1 L2 I1 I2} {A : _} `{ t_Sized (A)}`{ t_HasActions (A)} (ctx : both L1 I1 t_RegisterParam) (st : both L2 I2 (state_OVN)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × state_OVN)) (t_ParseError)) := + receive_OVN_register ctx st := register_vote ctx st. Definition t_CastVoteParam : choice_type := @@ -255,18 +260,18 @@ Definition prod1_loc : Location := (int32 ; 1%nat). Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq int32 20)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32) := compute_group_element_for_vote i xi vote xis := - letb prod1 loc(prod1_loc) := one in - letb prod1 := foldi_both (into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun j => + (letb prod1 loc(prod1_loc) := one in + letb prod1 := foldi_both (L := (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc])) (I := I1 :|: I2 :|: I3 :|: I4) (into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := U32) (i .- (ret_both (1 : int32)))))) (fun j => ssp (fun prod1 => - solve_lift (prod prod1 (xis.a[j])))) prod1 in + solve_lift (prod prod1 (xis.a[j])))) prod1 in letb prod2 loc(prod2_loc) := one in - letb prod2 := foldi_both (into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun j => + letb prod2 := foldi_both (L := (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc])) (I := I1 :|: I2 :|: I3 :|: I4) (into_iter (Build_t_Range (f_start := cast_int (WS2 := U32) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun j => ssp (fun prod2 => solve_lift (prod prod2 (xis.a[j])))) prod2 in letb Yi := div prod1 prod2 in solve_lift (prod (pow Yi xi) (g_pow (ifb vote then ret_both (1 : int32) - else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32). + else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32)). Fail Next Obligation. Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) : both L1 I1 (int32) := @@ -274,11 +279,15 @@ Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). Fail Next Obligation. -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {impl HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (ctx : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (ctx : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := commit_to_vote ctx state := Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. -Definition receive_OVN_commit_to_vote (ctx : CastVoteParam) (st : both _ _ (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := +Instance t_sized_cast_vote_param : t_Sized t_CastVoteParam. +Admitted. +Instance t_has_receive_cast_vote_param : t_HasReceiveContext t_CastVoteParam 'unit . +Admitted. +Definition receive_OVN_commit_to_vote {L1 L2 I1 I2} {A : _} `{ t_Sized (A)}`{ t_HasActions (A)} (ctx : both L1 I1 t_CastVoteParam) (st : both L2 I2 (state_OVN)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × state_OVN)) (t_ParseError)) := commit_to_vote ctx st. Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (int32)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := @@ -286,11 +295,12 @@ Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). Fail Next Obligation. -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {impl HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (ctx : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (ctx : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := cast_vote ctx state := Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. -Definition receive_OVN_cast_vote (ctx : CastVoteParam) (st : both _ _ (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := + +Definition receive_OVN_cast_vote {L1 L2 I1 I2} {A : _} `{ t_Sized (A)}`{ t_HasActions (A)} (ctx : both L1 I1 t_CastVoteParam) (st : both L2 I2 (state_OVN)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × state_OVN)) (t_ParseError)) := cast_vote ctx st. Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := @@ -310,11 +320,16 @@ Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) : solve_lift (ret_both ((_) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). Fail Next Obligation. -Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {impl HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (_ : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := +Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (_ : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := tally_votes _ state := Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. -Definition receive_OVN_tally (ctx : TallyParameter) (st : both _ _ (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := + +Instance t_sized_TallyParameter : t_Sized t_TallyParameter. +Admitted. +Instance t_has_receive_context_TallyParameter : t_HasReceiveContext t_TallyParameter 'unit . +Admitted. +Definition receive_OVN_tally {L1 L2 I1 I2} {A : _} `{ t_Sized (A)}`{ t_HasActions (A)} (ctx : both L1 I1 t_TallyParameter) (st : both L2 I2 (state_OVN)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × state_OVN)) (t_ParseError)) := tally_votes ctx st. From ConCert.Execution Require Import Blockchain. @@ -327,37 +342,76 @@ Instance BaseTypes : ConCert.Execution.Blockchain.ChainBase := address_is_contract := Nat.even; |}. +Instance t_sized_state_OVN : t_Sized state_OVN. +Admitted. + +Instance t_HasActions_state_OVN : t_HasActions state_OVN. +Admitted. + + Definition init_OVN {L : {fset Location}} {I : Interface} (chain : Chain) (ctx : ContractCallContext) (st : both L I (state_OVN)) : ResultMonad.result (both L I (state_OVN)) (t_ParseError) := ResultMonad.Ok st. Inductive Msg_OVN: Type := -| msg_OVN_register : RegisterParam -> : Msg_OVN -| msg_OVN_commit_to_vote : CastVoteParam -> : Msg_OVN -| msg_OVN_cast_vote : CastVoteParam -> : Msg_OVN -| msg_OVN_tally : TallyParameter -> : Msg_OVN. -Definition receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : both L I (state_OVN)) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) state_OVN := - matchb msg with - | Some msg_OVN_register val => - match (is_pure (both_prog (receive_OVN_register val (st)))) with +| msg_OVN_register : t_RegisterParam -> Msg_OVN +| msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN +| msg_OVN_cast_vote : t_CastVoteParam -> Msg_OVN +| msg_OVN_tally : t_TallyParameter -> Msg_OVN. +Equations receive_OVN {L I} (chain : Chain) (ctx : ContractCallContext) (st : both L I (state_OVN)) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (both L I state_OVN * list ActionBody) t_ParseError := + receive_OVN chain ctx st msg := + match msg with + | Some (msg_OVN_register val) => + match (is_pure (both_prog (receive_OVN_register (ret_both val) (st)))) with | inl x => ResultMonad.Ok (solve_lift ret_both (fst x), []) | inr x => ResultMonad.Err x end - | Some msg_OVN_commit_to_vote val => - match (is_pure (both_prog (receive_OVN_commit_to_vote val (st)))) with + | Some (msg_OVN_commit_to_vote val) => + match (is_pure (both_prog (receive_OVN_commit_to_vote (ret_both val) (st)))) with | inl x => ResultMonad.Ok (solve_lift ret_both (fst x), []) | inr x => ResultMonad.Err x end - | Some msg_OVN_cast_vote val => - match (is_pure (both_prog (receive_OVN_cast_vote val (st)))) with + | Some (msg_OVN_cast_vote val) => + match (is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (st)))) with | inl x => ResultMonad.Ok (solve_lift ret_both (fst x), []) | inr x => ResultMonad.Err x end - | Some msg_OVN_tally val => - match (is_pure (both_prog (receive_OVN_tally val (st)))) with + | Some (msg_OVN_tally val) => + match (is_pure (both_prog (receive_OVN_tally (ret_both val) (st)))) with | inl x => ResultMonad.Ok (solve_lift ret_both (fst x), []) | inr x => ResultMonad.Err x end | _ => - ResultMonad.Err st + ResultMonad.Err tt end. -Definition contract_OVN : Contract (state_OVN) (Msg_OVN) (state_OVN) (t_ParseError) := +Fail Next Obligation. + +Inductive temp: Type := +| temp_OVN : temp. + +Instance serializable_both {L I} {A : choice_type} `{Serializable A} : Serializable (both L I A). +Proof. +Admitted. + +Instance serializable_Msg_OVN : Serializable Msg_OVN := + (@serialize_by_other_option (Datatypes.option t_RegisterParam * + Datatypes.option t_CastVoteParam * + Datatypes.option t_CastVoteParam * + Datatypes.option t_TallyParameter) + _ + (fun m => match m with + | @msg_OVN_register v => Some (Some v, None, None, None) + | @msg_OVN_commit_to_vote v => Some (None, Some v, None, None) + | @msg_OVN_cast_vote v => Some (None, None, Some v, None) + | @msg_OVN_tally v => Some (None, None, None, Some v) + end + ) + (fun m => match m with + | Some (Some v, _, _, _) => Some (msg_OVN_register v) + | Some (_, Some v, _, _) => Some (msg_OVN_commit_to_vote v) + | Some (_, _, Some v, _) => Some (msg_OVN_cast_vote v) + | Some (_, _, _, Some v) => Some (msg_OVN_tally v) + | _ => None + end) + (ltac:(destruct m ; reflexivity)) _). + +Definition contract_OVN {L I} : Contract (both L I state_OVN) (Msg_OVN) (both L I state_OVN) (t_ParseError) := build_contract init_OVN receive_OVN. From df7a6e54f4dfcb41b047e1d3dc33f593a092db26 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 3 Oct 2023 13:49:26 +0200 Subject: [PATCH 24/86] Parse more of ovn --- ovn/src/ovn_smart.rs | 150 +++++++++++++++++++++---------------------- 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/ovn/src/ovn_smart.rs b/ovn/src/ovn_smart.rs index dadcaaf..f6bb2f3 100644 --- a/ovn/src/ovn_smart.rs +++ b/ovn/src/ovn_smart.rs @@ -14,45 +14,45 @@ use hacspec_concordium_derive::*; /** Interface for group implementation */ pub trait Group { - type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; + type GroupType: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; const q: u32; // Prime order - const g: Self::group_type; // Generator (elemnent of group) - - fn g_pow(x: u32) -> Self::group_type; - fn pow(g: Self::group_type, x: u32) -> Self::group_type; - fn one() -> Self::group_type; - fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type; - fn inv(x: Self::group_type) -> Self::group_type; - fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; - // fn random_element() -> Self::group_type; + const g: Self::GroupType; // Generator (elemnent of group) + + fn g_pow(x: u32) -> Self::GroupType; + fn pow(g: Self::GroupType, x: u32) -> Self::GroupType; + fn one() -> Self::GroupType; + fn prod(x: Self::GroupType, y: Self::GroupType) -> Self::GroupType; + fn inv(x: Self::GroupType) -> Self::GroupType; + fn div(x: Self::GroupType, y: Self::GroupType) -> Self::GroupType; + // fn random_element() -> Self::GroupType; } #[derive(Clone, Copy)] pub struct z_17 {} impl Group for z_17 { - type group_type = u32; + type GroupType = u32; const q: u32 = 17; // Prime order - const g: Self::group_type = 3; // Generator (elemnent of group) + const g: Self::GroupType = 3; // Generator (elemnent of group) - fn g_pow(x: u32) -> Self::group_type { + fn g_pow(x: u32) -> Self::GroupType { (Self::g ^ x) % Self::q } - fn pow(g: Self::group_type, x: u32) -> Self::group_type { + fn pow(g: Self::GroupType, x: u32) -> Self::GroupType { (Self::g ^ x) % Self::q } - fn one() -> Self::group_type { + fn one() -> Self::GroupType { 1 } - fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { + fn prod(x: Self::GroupType, y: Self::GroupType) -> Self::GroupType { (x * y) % Self::q } - fn inv(x: Self::group_type) -> Self::group_type { + fn inv(x: Self::GroupType) -> Self::GroupType { let mut res = 0; for i in 1..Self::q { if Self::g_pow(i) == x { @@ -63,10 +63,10 @@ impl Group for z_17 { // [0, 1, 9, 6, 13, 7, 3, 5, 15, 2, 12, 14, 10, 4, 11, 8, 16][x as usize] } - fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { + fn div(x: Self::GroupType, y: Self::GroupType) -> Self::GroupType { Self::prod(x, Self::inv(y)) } - // fn random_element() -> Self::group_type { + // fn random_element() -> Self::GroupType { // } } @@ -93,12 +93,12 @@ const n: usize = 20; // #[cfg_attr(not(feature = "hax_compilation"), contract_state(contract = "OVN"))] #[derive(Serialize, SchemaType, Clone, Copy)] pub struct OvnContractState/* */ { - g_pow_xis: [/*G*/::group_type; n], + g_pow_xis: [/*G*/::GroupType; n], zkp_xis: [u32; n], commit_vis: [u32; n], - g_pow_xi_yi_vis: [/*G*/::group_type; n], + g_pow_xi_yi_vis: [/*G*/::GroupType; n], zkp_vis: [u32; n], tally: u32, @@ -127,7 +127,7 @@ pub fn select_private_voting_key/* */(random: u32) -> u32 { } /** TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics */ -pub fn ZKP/* */(g_pow_xi: /*G*/::group_type, xi: u32) -> u32 { +pub fn ZKP/* */(g_pow_xi: /*G*/::GroupType, xi: u32) -> u32 { 0 } @@ -148,15 +148,15 @@ pub fn register_vote( ctx: &T, state: OvnContractState/* */, ) -> Result<(A, OvnContractState/* */), ParseError> { - // let params : RegisterParam = ctx.parameter_cursor().get()?; // Result? - // let g_pow_xi = G::g_pow(params.rp_xi); - // let zkp_xi = ZKP/* :: */(g_pow_xi, params.rp_xi); + let params : RegisterParam = ctx.parameter_cursor().get()?; // Result? + let g_pow_xi = G::g_pow(params.rp_xi); + let zkp_xi = ZKP/* :: */(g_pow_xi, params.rp_xi); - // let mut state_ret = state.clone(); - // state_ret.g_pow_xis[params.rp_i as usize] = g_pow_xi; - // state_ret.zkp_xis[params.rp_i as usize] = zkp_xi; + let mut state_ret = state.clone(); + state_ret.g_pow_xis[params.rp_i as usize] = g_pow_xi; + state_ret.zkp_xis[params.rp_i as usize] = zkp_xi; - Ok((A::accept(), state/*_ret*/)) + Ok((A::accept(), state_ret)) } #[derive(Serialize, SchemaType)] @@ -174,8 +174,8 @@ pub fn compute_group_element_for_vote/* */( i: u32, xi: u32, vote: bool, - xis: [/*G*/::group_type; n], -) -> /*G*/::group_type { + xis: [/*G*/::GroupType; n], +) -> /*G*/::GroupType { let mut prod1 = G::one(); for j in 0..(i - 1) as usize { prod1 = G::prod(prod1, xis[j]); @@ -189,7 +189,7 @@ pub fn compute_group_element_for_vote/* */( G::prod(G::pow(Yi, xi), G::g_pow(if vote { 1 } else { 0 })) } -pub fn commit_to/* */(x: /*G*/::group_type) -> u32 { +pub fn commit_to/* */(x: /*G*/::GroupType) -> u32 { 0 } @@ -200,23 +200,23 @@ pub fn commit_to_vote( ctx: &impl HasReceiveContext, state: OvnContractState/* */, ) -> Result<(A, OvnContractState/* */), ParseError> { - // let params: CastVoteParam = ctx.parameter_cursor().get()?; - // for zkp in state.zkp_xis { - // check_valid(zkp); - // () - // } + let params: CastVoteParam = ctx.parameter_cursor().get()?; + for zkp in state.zkp_xis { + check_valid(zkp); + () + } - // let g_pow_xi_yi_vi = - // compute_group_element_for_vote/*:: */(params.cvp_i, params.cvp_xi, params.cvp_vote, state.g_pow_xis); - // let commit_vi = commit_to/*:: */(g_pow_xi_yi_vi); + let g_pow_xi_yi_vi = + compute_group_element_for_vote/*:: */(params.cvp_i, params.cvp_xi, params.cvp_vote, state.g_pow_xis); + let commit_vi = commit_to/*:: */(g_pow_xi_yi_vi); - // let mut state_ret = state.clone(); - // state_ret.commit_vis[params.cvp_i as usize] = commit_vi; - Ok((A::accept(), state/*_ret*/)) + let mut state_ret = state.clone(); + state_ret.commit_vis[params.cvp_i as usize] = commit_vi; + Ok((A::accept(), state_ret)) } /** Cramer, Damgård and Schoenmakers (CDS) technique */ -pub fn ZKP_one_out_of_two/* */(g_pow_vi: /*G*/::group_type, vi: bool) -> u32 { +pub fn ZKP_one_out_of_two/* */(g_pow_vi: /*G*/::GroupType, vi: bool) -> u32 { 32 // TODO } @@ -227,28 +227,28 @@ pub fn cast_vote( ctx: &impl HasReceiveContext, state: OvnContractState/* */, ) -> Result<(A, OvnContractState/* */), ParseError> { - // let params: CastVoteParam = ctx.parameter_cursor().get()?; + let params: CastVoteParam = ctx.parameter_cursor().get()?; - // let g_pow_xi_yi_vi = - // compute_group_element_for_vote/*:: */(params.cvp_i, params.cvp_xi, params.cvp_vote, state.g_pow_xis); - // let zkp_vi = ZKP_one_out_of_two/*:: */(g_pow_xi_yi_vi, params.cvp_vote); + let g_pow_xi_yi_vi = + compute_group_element_for_vote/*:: */(params.cvp_i, params.cvp_xi, params.cvp_vote, state.g_pow_xis); + let zkp_vi = ZKP_one_out_of_two/*:: */(g_pow_xi_yi_vi, params.cvp_vote); - // let mut state_ret = state.clone(); + let mut state_ret = state.clone(); - // let mut g_pow_xi_yi_vis_temp = state_ret.g_pow_xi_yi_vis.clone(); - // g_pow_xi_yi_vis_temp[params.cvp_i as usize] = g_pow_xi_yi_vi; - // state_ret.g_pow_xi_yi_vis = g_pow_xi_yi_vis_temp; + let mut g_pow_xi_yi_vis_temp = state_ret.g_pow_xi_yi_vis.clone(); + g_pow_xi_yi_vis_temp[params.cvp_i as usize] = g_pow_xi_yi_vi; + state_ret.g_pow_xi_yi_vis = g_pow_xi_yi_vis_temp; - // state_ret.zkp_vis[params.cvp_i as usize] = zkp_vi; + state_ret.zkp_vis[params.cvp_i as usize] = zkp_vi; - Ok((A::accept(),state/*_ret*/)) + Ok((A::accept(),state_ret)) } -pub fn check_valid2/* */(g_pow_xi_yi_vi: /*G*/::group_type, zkp: u32) -> bool { +pub fn check_valid2/* */(g_pow_xi_yi_vi: /*G*/::GroupType, zkp: u32) -> bool { true } -pub fn check_commitment/* */(g_pow_xi_yi_vi: /*G*/::group_type, zkp: u32) -> bool { +pub fn check_commitment/* */(g_pow_xi_yi_vi: /*G*/::GroupType, zkp: u32) -> bool { true } @@ -260,29 +260,29 @@ pub fn tally_votes( _: &impl HasReceiveContext, state: OvnContractState/* */, ) -> Result<(A, OvnContractState/* */), ParseError> { - // for i in 0..n { - // check_valid2/*:: */(state.g_pow_xi_yi_vis[i], state.zkp_vis[i]); - // check_commitment/*:: */(state.g_pow_xi_yi_vis[i], state.commit_vis[i]); - // () - // } + for i in 0..n { + check_valid2/*:: */(state.g_pow_xi_yi_vis[i], state.zkp_vis[i]); + check_commitment/*:: */(state.g_pow_xi_yi_vis[i], state.commit_vis[i]); + () + } - // let mut vote_result = G::one(); - // for g_pow_vote in state.g_pow_xi_yi_vis { - // vote_result = G::prod(vote_result, g_pow_vote); - // } + let mut vote_result = G::one(); + for g_pow_vote in state.g_pow_xi_yi_vis { + vote_result = G::prod(vote_result, g_pow_vote); + } - // let mut tally = 0; - // for i in 0..n as u32 { - // // Should be while, but is bounded by n anyways! - // if G::g_pow(i) == vote_result { - // tally = i; - // } - // } + let mut tally = 0; + for i in 0..n as u32 { + // Should be while, but is bounded by n anyways! + if G::g_pow(i) == vote_result { + tally = i; + } + } - // let mut state_ret = state.clone(); - // state_ret.tally = tally; + let mut state_ret = state.clone(); + state_ret.tally = tally; - Ok((A::accept(), state/*_ret*/)) + Ok((A::accept(), state_ret)) } // #[cfg(test)] From a1e12d8b72f4e3c2789afeff330da75e90972cb7 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 10 Oct 2023 15:16:52 +0200 Subject: [PATCH 25/86] Few admits for serialization left --- ovn/proofs/ssprove/extraction/ConCertLib.v | 100 ++++++- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 304 +++++++++++--------- ovn/proofs/ssprove/extraction/_CoqProject | 14 +- ovn/src/ovn_smart.rs | 93 +++--- 4 files changed, 313 insertions(+), 198 deletions(-) diff --git a/ovn/proofs/ssprove/extraction/ConCertLib.v b/ovn/proofs/ssprove/extraction/ConCertLib.v index 97a98e7..d0a3ad8 100644 --- a/ovn/proofs/ssprove/extraction/ConCertLib.v +++ b/ovn/proofs/ssprove/extraction/ConCertLib.v @@ -25,11 +25,11 @@ Program Definition serialize_by_other_option {A B} (f_to : B -> Datatypes.option serialize m := serialize (f_to m); deserialize m := match (deserialize m) with | Some m => f_from m - | _ => None + | None => None end; |}. Next Obligation. - intros. hnf. rewrite deserialize_serialize. now f_equal. + intros. hnf. simpl. rewrite deserialize_serialize. now f_equal. Defined. #[global] Instance hacspec_int_serializable {ws : wsize} : Serializable (int ws) := serialize_by_other (unsigned) (@repr ws) (@wrepr_unsigned ws). @@ -379,15 +379,18 @@ Definition defaulted_nseq {A len} (m : nseq_ A (S len)) := Ltac serialize_enum := intros ; autounfold ; repeat apply @product_serializable ; fold chElement. -(* From ConCert.Execution Require Import Blockchain. *) +From ConCert.Execution Require Import Blockchain. -(* Instance BaseTypes : ConCert.Execution.Blockchain.ChainBase := *) -(* {| *) -(* Address := nat; *) -(* address_eqb := Nat.eqb ; *) -(* address_eqb_spec := Nat.eqb_spec; *) -(* address_is_contract := Nat.even; *) -(* |}. *) +#[global] Instance BaseTypes : ConCert.Execution.Blockchain.ChainBase := + {| + Address := nat; + address_eqb := Nat.eqb ; + address_eqb_spec := Nat.eqb_spec; + address_is_contract := Nat.even; + |}. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import Hacspec_Lib. Theorem both_ext_prog : forall {L I A} (x y : both L I A), both_prog x = both_prog y <-> x = y. @@ -399,6 +402,83 @@ Proof. - easy. Qed. +Print pkg_core_definition.typed_raw_function. + +Instance serializable_code {L I} {A : choice_type} `{Serializable A} : Serializable (pkg_core_definition.code L I A). +Proof. +Admitted. + Instance serializable_both {L I} {A : choice_type} `{Serializable A} : Serializable (both L I A). Proof. + (* refine {| serialize *) + (* '{| both_prog := *) + (* {| *) + (* is_state := is_state; *) + (* is_pure := is_pure *) + (* |} ; *) + (* both_prog_valid := *) + (* {| *) + (* is_valid_code := is_valid_code ; *) + (* is_valid_both := is_valid_both *) + (* |} ; *) + (* p_eq := p_eq |} := *) + (* serialize *) + (* (is_pure, *) + (* {| *) + (* pkg_core_definition.prog := is_state; *) + (* pkg_core_definition.prog_valid := is_valid_code |}, *) + (* is_valid_both, *) + (* p_eq) ; *) + (* deserialize x := *) + (* option_map (fun y => solve_lift ret_both y) (deserialize x) *) + (* |}. *) + (* Unshelve. *) + (* 2:{ *) + (* eapply product_serializable. *) + (* Unshelve. *) + (* eapply product_serializable. *) + (* Unshelve. *) + (* simpl. *) + (* eapply product_serializable. *) + (* Unshelve. *) + (* } *) + + (* eapply (@serialize_by_other *) + (* (A * pkg_core_definition.code L I A * valid_both) *) + (* (both L I A) *) + (* (fun x => (is_pure x, {| pkg_core_definition.prog := is_state x; pkg_core_definition.prog_valid := is_valid_code (both_prog_valid x) |})) *) + (* (fun '(z , {| pkg_core_definition.prog := y ; pkg_core_definition.prog_valid := x |}) => *) + (* _ *) + (* )). *) + (* Unshelve. *) + (* 3:{ *) + (* epose {| is_pure := z ; is_state := y |}. *) + (* assert (y = is_state r) by reflexivity. *) + (* rewrite H0 in *. *) + (* eapply {| *) + (* both_prog := r ; *) + (* both_prog_valid := {| is_valid_code := x |} *) + (* |}. *) + (* } *) + + (* intros. *) + (* destruct m. *) + (* apply both_ext_prog. *) + (* simpl. *) + (* destruct both_prog. *) + (* simpl. *) + (* reflexivity. *) + (* apply product_serializable. *) + (* Unshelve. *) + + (* - apply y. *) + (* - destruct y. *) + (* simpl. *) + (* destruct prog. *) + (* simpl. *) + (* eapply both_valid_ret. *) + + (* apply both *) + Admitted. +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 2dba088..28a00c8 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -22,9 +22,6 @@ From Hacspec Require Import Hacspec_Lib. Open Scope hacspec_scope. Import choice.Choice.Exports. -Require Import ConCertLib. -From ConCert.Execution Require Import Serializable. - Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. (*Not implemented yet? todo(item)*) @@ -41,8 +38,8 @@ Class t_Group (Self : choice_type) := { t_group_type_t_Eq :> t_Eq (t_group_type) ; t_group_type_t_PartialEq :> t_PartialEq (t_group_type) ; t_group_type_t_Sized :> t_Sized (t_group_type) ; - q : forall {L1 I1}, both L1 I1 (int32) ; - g : forall {L1 I1}, both L1 I1 (t_group_type) ; + q : both (fset[]) (fset[]) (int32) ; + g : both (fset[]) (fset[]) (t_group_type) ; g_pow_loc : {fset Location} ; g_pow : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: g_pow_loc) I1 (t_group_type) ; pow_loc : {fset Location} ; @@ -72,24 +69,25 @@ Fail Next Obligation. Definition res_loc : Location := (int32 ; 0%nat). - #[global] Program Instance t_z_17__t_Group : t_Group t_z_17_ := let t_group_type := int32 : choice_type in - let q := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (17 : int32)) : both L I (int32) in - let g := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (3 : int32)) : both L I (int32) in - let g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift (((@g (fset []) (fset [])) .^ x) .% (@q (fset[]) (fset[]))) : both (L1 :|: fset []) I1 (int32) in - let pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((g .^ x) .% (@q (fset[]) (fset[]))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + let q := ret_both (17 : int32) : both (fset []) (fset []) (int32) in + let g := ret_both (3 : int32) : both (fset []) (fset []) (int32) in + let g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: fset []) I1 (int32) in + let pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in let one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I (int32) in - let prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% (@q (fset[]) (fset[]))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + let prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in let inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => letb res loc(res_loc) := ret_both (0 : int32) in - letb res := foldi_both (into_iter (Build_t_Range (f_start := ret_both (1 : int32)) (f_end := (@q (fset[]) (fset[]))))) (fun i => + letb res := foldi_both_list (into_iter (Build_t_Range (f_start := ret_both (1 : int32)) (f_end := q))) (fun i => ssp (fun res => + letb i_computation := i in solve_lift (ifb (g_pow i) =.? x - then letb res := i in + then letb res := i_computation in res - else res))) res in - (* solve_lift *) res : both (L1 :|: fset [res_loc]) I1 (int32) in - let div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (prod x (inv y)) : both (L1 :|: L2 :|: fset [res_loc]) (I1 :|: I2) (int32) in{| t_group_type := (@t_group_type); + else res) : both (*2*)(L1:|:fset [res_loc;res_loc]) (I1) (int32))) res in + solve_lift res : both (L1 :|: fset [res_loc]) I1 (int32) in + let div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (prod x (inv y)) : both (L1 :|: L2 :|: fset [res_loc]) (I1 :|: I2) (int32) in + {| t_group_type := (@t_group_type); q := (@q); g := (@g); g_pow_loc := (fset [] : {fset Location}); @@ -103,9 +101,8 @@ Definition res_loc : Location := inv_loc := (fset [res_loc] : {fset Location}); inv := (@inv); div_loc := (fset [res_loc] : {fset Location}); - div := (@div); - t_group_type_t_Eq := int_eqdec - |}. + div := (@div)|}. +Solve All Obligations with exact int_eqdec. Fail Next Obligation. Hint Unfold t_z_17__t_Group. @@ -164,14 +161,6 @@ Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). -Definition state_OVN : choice_type := - t_OvnContractState. -Hint Unfold t_OvnContractState. -Hint Unfold state_OVN. - -#[global] Program Instance serializable_state_OVN : Serializable state_OVN := - ltac:(serialize_enum). -Solve All Obligations with exact nseq_serializable || exact hacspec_int_serializable. Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {T : _} `{ t_Sized (T)} `{ t_HasInitContext (T) ('unit)} (ctx : both L1 I1 (T)) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)) := init_ovn_contract ctx := @@ -209,17 +198,25 @@ Fail Next Obligation. Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x)). Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y)). -Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {T : _} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} (ctx : both L1 I1 (T)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := +Definition register_vote_state_ret_loc {A : _} {T : _} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} : Location := + (t_OvnContractState ; 1%nat). +Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {T : _} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} (ctx : both L1 I1 (T)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := register_vote ctx state := - Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. -Instance t_sized_register : t_Sized t_RegisterParam. -Admitted. -Instance t_has_receive_context_register : t_HasReceiveContext t_RegisterParam 'unit . -Admitted. -Equations receive_OVN_register {L1 L2 I1 I2} {A : _} `{ t_Sized (A)}`{ t_HasActions (A)} (ctx : both L1 I1 t_RegisterParam) (st : both L2 I2 (state_OVN)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × state_OVN)) (t_ParseError)) := - receive_OVN_register ctx st := - register_vote ctx st. + solve_lift (run (letb '(_,out) := get (parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((A × t_OvnContractState)) (t_ParseError))] (params:t_RegisterParam) := matchb branch out with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code (t_Result ((A × t_OvnContractState)) (t_ParseError))] hoist1 := v_Break (from_residual residual) in + ControlFlow_Continue (never_to_any hoist1) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb g_pow_xi := g_pow (f_rp_xi params) in + letb zkp_xi := v_ZKP g_pow_xi (f_rp_xi params) in + letb register_vote_state_ret loc(register_vote_state_ret_loc) := clone state in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in + Result_Ok (prod_b (accept,register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. Definition t_CastVoteParam : choice_type := (int32 × int32 × 'bool). @@ -254,24 +251,24 @@ Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 solve_lift (ret_both (true : 'bool)) : both L1 I1 ('bool). Fail Next Obligation. -Definition prod2_loc : Location := - (int32 ; 2%nat). Definition prod1_loc : Location := - (int32 ; 1%nat). -Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq int32 20)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32) := + (int32 ; 2%nat). +Definition prod2_loc : Location := + (int32 ; 3%nat). +Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq int32 20)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod1_loc;prod2_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32) := compute_group_element_for_vote i xi vote xis := - (letb prod1 loc(prod1_loc) := one in - letb prod1 := foldi_both (L := (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc])) (I := I1 :|: I2 :|: I3 :|: I4) (into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := U32) (i .- (ret_both (1 : int32)))))) (fun j => + letb prod1 loc(prod1_loc) := one in + letb prod1 := foldi_both_list (into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun j => ssp (fun prod1 => - solve_lift (prod prod1 (xis.a[j])))) prod1 in + solve_lift (prod prod1 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod1_loc;prod1_loc]) (I1:|:I4:|:I1) (t_group_type))) prod1 in letb prod2 loc(prod2_loc) := one in - letb prod2 := foldi_both (L := (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc])) (I := I1 :|: I2 :|: I3 :|: I4) (into_iter (Build_t_Range (f_start := cast_int (WS2 := U32) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun j => + letb prod2 := foldi_both_list (into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun j => ssp (fun prod2 => - solve_lift (prod prod2 (xis.a[j])))) prod2 in + solve_lift (prod prod2 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod2_loc;prod2_loc]) (I1:|:I4:|:I1) (t_group_type))) prod2 in letb Yi := div prod1 prod2 in solve_lift (prod (pow Yi xi) (g_pow (ifb vote then ret_both (1 : int32) - else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32)). + else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod1_loc;prod2_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32). Fail Next Obligation. Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) : both L1 I1 (int32) := @@ -279,30 +276,54 @@ Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). Fail Next Obligation. -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (ctx : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := +Definition commit_to_vote_state_ret_loc {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} : Location := + (t_OvnContractState ; 4%nat). +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} (ctx : both L1 I1 ((* impl *) HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := commit_to_vote ctx state := - Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). + solve_lift (run (letb '(_,out) := get (parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb branch out with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code (t_Result ((A × t_OvnContractState)) (t_ParseError))] hoist2 := v_Break (from_residual residual) in + ControlFlow_Continue (never_to_any hoist2) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb _ := foldi_both_list (into_iter (f_zkp_xis state)) (fun zkp => + ssp (fun _ => + letb _ := check_valid zkp in + solve_lift (ret_both (tt : 'unit)) : both (*0*)(L2:|:fset []) (I2) ('unit))) (ret_both (tt : 'unit)) in + letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in + letb commit_vi := commit_to g_pow_xi_yi_vi in + letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := clone state in + letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in + Result_Ok (prod_b (accept,commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. -Instance t_sized_cast_vote_param : t_Sized t_CastVoteParam. -Admitted. -Instance t_has_receive_cast_vote_param : t_HasReceiveContext t_CastVoteParam 'unit . -Admitted. -Definition receive_OVN_commit_to_vote {L1 L2 I1 I2} {A : _} `{ t_Sized (A)}`{ t_HasActions (A)} (ctx : both L1 I1 t_CastVoteParam) (st : both L2 I2 (state_OVN)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × state_OVN)) (t_ParseError)) := - commit_to_vote ctx st. Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (int32)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := v_ZKP_one_out_of_two g_pow_vi vi := solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). Fail Next Obligation. -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (ctx : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := +Definition cast_vote_state_ret_loc {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} : Location := + (t_OvnContractState ; 5%nat). +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} (ctx : both L1 I1 ((* impl *) HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := cast_vote ctx state := - Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). + solve_lift (run (letb '(_,out) := get (parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb branch out with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code (t_Result ((A × t_OvnContractState)) (t_ParseError))] hoist3 := v_Break (from_residual residual) in + ControlFlow_Continue (never_to_any hoist3) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in + letb zkp_vi := v_ZKP_one_out_of_two g_pow_xi_yi_vi (f_cvp_vote params) in + letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := clone state in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in + Result_Ok (prod_b (accept,cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. -Definition receive_OVN_cast_vote {L1 L2 I1 I2} {A : _} `{ t_Sized (A)}`{ t_HasActions (A)} (ctx : both L1 I1 t_CastVoteParam) (st : both L2 I2 (state_OVN)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × state_OVN)) (t_ParseError)) := - cast_vote ctx st. - Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := check_valid2 g_pow_xi_yi_vi zkp := solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). @@ -320,98 +341,115 @@ Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) : solve_lift (ret_both ((_) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). Fail Next Obligation. -Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (_ : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := +Definition tally_loc {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} : Location := + (int32 ; 6%nat). +Definition tally_votes_state_ret_loc {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} : Location := + (t_OvnContractState ; 7%nat). +Definition vote_result_loc {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} : Location := + (t_group_type ; 8%nat). +Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} (_ : both L1 I1 ((* impl *) HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := tally_votes _ state := - Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. + letb _ := foldi_both_list (into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + ssp (fun _ => + letb _ := check_valid2 ((f_g_pow_xi_yi_vis state).a[i]) ((f_zkp_vis state).a[i]) in + letb _ := check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i]) in + solve_lift (ret_both (tt : 'unit)) : both (*0*)(L2:|:fset []) (I2) ('unit))) (ret_both (tt : 'unit)) in + letb (vote_result) loc(vote_result_loc) := one in + letb vote_result := foldi_both_list (into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => + ssp (fun vote_result => + solve_lift (prod vote_result g_pow_vote) : both (*2*)(L2:|:L2:|:fset [vote_result_loc;vote_result_loc]) (I2:|:I2) (t_group_type))) vote_result in + letb tally loc(tally_loc) := ret_both (0 : int32) in + letb tally := foldi_both_list (into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => + ssp (fun tally => + solve_lift (ifb (g_pow i) =.? vote_result + then letb tally := i in + tally + else tally) : both (*3*)(L2 :|: fset [tally_loc;vote_result_loc;tally_loc]) ((I2 :|: fset [])) (int32))) tally in + letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := clone state in + letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in + Result_Ok (solve_lift (prod_b (accept,tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. + +(** Concert lib part **) +From ConCert.Utils Require Import Extras. +Export Extras. +From ConCert.Utils Require Import Automation. +Export Automation. +From ConCert.Execution Require Import Serializable. +Export Serializable. +From ConCert.Execution Require Import Blockchain. +Export Blockchain. +From ConCert.Execution Require Import ContractCommon. +Export ContractCommon. +From ConCert.Execution Require Import Serializable. +Export Serializable. +Require Import ConCertLib. +Export ConCertLib. -Instance t_sized_TallyParameter : t_Sized t_TallyParameter. -Admitted. -Instance t_has_receive_context_TallyParameter : t_HasReceiveContext t_TallyParameter 'unit . -Admitted. -Definition receive_OVN_tally {L1 L2 I1 I2} {A : _} `{ t_Sized (A)}`{ t_HasActions (A)} (ctx : both L1 I1 t_TallyParameter) (st : both L2 I2 (state_OVN)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × state_OVN)) (t_ParseError)) := - tally_votes ctx st. +Definition state_OVN : choice_type := + t_OvnContractState. -From ConCert.Execution Require Import Blockchain. +Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : (state_OVN)) : ResultMonad.result ((state_OVN)) (t_ParseError) := + ResultMonad.Ok st. -Instance BaseTypes : ConCert.Execution.Blockchain.ChainBase := - {| - Address := nat; - address_eqb := Nat.eqb ; - address_eqb_spec := Nat.eqb_spec; - address_is_contract := Nat.even; - |}. +#[global] Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit. Admitted. +#[global] Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam. Admitted. +Definition receive_OVN_register {A : _} {T : _} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_RegisterParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := + register_vote ctx st. + +#[global] Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit. Admitted. +#[global] Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam. Admitted. +Definition receive_OVN_commit_to_vote {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := + commit_to_vote ctx st. -Instance t_sized_state_OVN : t_Sized state_OVN. -Admitted. +(* #[global] Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit. Admitted. *) +(* #[global] Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam. Admitted. *) +Definition receive_OVN_cast_vote {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := + cast_vote ctx st. -Instance t_HasActions_state_OVN : t_HasActions state_OVN. -Admitted. +#[global] Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit. Admitted. +#[global] Instance t_TallyParameter_t_Sized : t_Sized t_TallyParameter. Admitted. +Definition receive_OVN_tally {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_TallyParameter)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := + tally_votes ctx st. +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Definition init_OVN {L : {fset Location}} {I : Interface} (chain : Chain) (ctx : ContractCallContext) (st : both L I (state_OVN)) : ResultMonad.result (both L I (state_OVN)) (t_ParseError) := - ResultMonad.Ok st. Inductive Msg_OVN: Type := | msg_OVN_register : t_RegisterParam -> Msg_OVN | msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN | msg_OVN_cast_vote : t_CastVoteParam -> Msg_OVN | msg_OVN_tally : t_TallyParameter -> Msg_OVN. -Equations receive_OVN {L I} (chain : Chain) (ctx : ContractCallContext) (st : both L I (state_OVN)) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (both L I state_OVN * list ActionBody) t_ParseError := - receive_OVN chain ctx st msg := - match msg with - | Some (msg_OVN_register val) => - match (is_pure (both_prog (receive_OVN_register (ret_both val) (st)))) with - | inl x => ResultMonad.Ok (solve_lift ret_both (fst x), []) +#[global] Instance state_OVN_t_HasReceiveContext : t_HasReceiveContext state_OVN 'unit. Admitted. +#[global] Instance state_OVN_t_Sized : t_Sized state_OVN. Admitted. +#[global] Instance state_OVN_t_HasActions : t_HasActions state_OVN. Admitted. +Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : (state_OVN)) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := + receive_OVN chain ctx st msg := + match msg with + | Some (msg_OVN_register val) => + match (is_pure (both_prog (receive_OVN_register (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) | inr x => ResultMonad.Err x end - | Some (msg_OVN_commit_to_vote val) => - match (is_pure (both_prog (receive_OVN_commit_to_vote (ret_both val) (st)))) with - | inl x => ResultMonad.Ok (solve_lift ret_both (fst x), []) + | Some (msg_OVN_commit_to_vote val) => + match (is_pure (both_prog (receive_OVN_commit_to_vote (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) | inr x => ResultMonad.Err x end - | Some (msg_OVN_cast_vote val) => - match (is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (st)))) with - | inl x => ResultMonad.Ok (solve_lift ret_both (fst x), []) + | Some (msg_OVN_cast_vote val) => + match (is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) | inr x => ResultMonad.Err x end - | Some (msg_OVN_tally val) => - match (is_pure (both_prog (receive_OVN_tally (ret_both val) (st)))) with - | inl x => ResultMonad.Ok (solve_lift ret_both (fst x), []) + | Some (msg_OVN_tally val) => + match (is_pure (both_prog (receive_OVN_tally (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) | inr x => ResultMonad.Err x end - | _ => - ResultMonad.Err tt - end. -Fail Next Obligation. - -Inductive temp: Type := -| temp_OVN : temp. - -Instance serializable_both {L I} {A : choice_type} `{Serializable A} : Serializable (both L I A). -Proof. -Admitted. - -Instance serializable_Msg_OVN : Serializable Msg_OVN := - (@serialize_by_other_option (Datatypes.option t_RegisterParam * - Datatypes.option t_CastVoteParam * - Datatypes.option t_CastVoteParam * - Datatypes.option t_TallyParameter) - _ - (fun m => match m with - | @msg_OVN_register v => Some (Some v, None, None, None) - | @msg_OVN_commit_to_vote v => Some (None, Some v, None, None) - | @msg_OVN_cast_vote v => Some (None, None, Some v, None) - | @msg_OVN_tally v => Some (None, None, None, Some v) - end - ) - (fun m => match m with - | Some (Some v, _, _, _) => Some (msg_OVN_register v) - | Some (_, Some v, _, _) => Some (msg_OVN_commit_to_vote v) - | Some (_, _, Some v, _) => Some (msg_OVN_cast_vote v) - | Some (_, _, _, Some v) => Some (msg_OVN_tally v) - | _ => None - end) - (ltac:(destruct m ; reflexivity)) _). - -Definition contract_OVN {L I} : Contract (both L I state_OVN) (Msg_OVN) (both L I state_OVN) (t_ParseError) := + | _ => + ResultMonad.Err tt + end : ResultMonad.result (state_OVN * list ActionBody) t_ParseError. +Fail Next Obligation. +#[global] Instance state_OVN_Serializable : Serializable state_OVN. Admitted. +#[global] Instance Msg_OVN_Serializable : Serializable Msg_OVN. Admitted. +Definition contract_OVN : Contract ((state_OVN)) (Msg_OVN) ((state_OVN)) (t_ParseError) := build_contract init_OVN receive_OVN. diff --git a/ovn/proofs/ssprove/extraction/_CoqProject b/ovn/proofs/ssprove/extraction/_CoqProject index bdc2924..e92c278 100644 --- a/ovn/proofs/ssprove/extraction/_CoqProject +++ b/ovn/proofs/ssprove/extraction/_CoqProject @@ -2,13 +2,6 @@ -arg -w -arg all -# Taken from Crypt (as branches are not merged!) -pkg_advantage.v -SigmaProtocol.v -Schnorr.v -DDH.v -OVN.v - # Written by hand # Hacspec_lib.v # Core.v @@ -20,5 +13,12 @@ ConCertLib.v # Hacspec_ovn_Schnorr.v Hacspec_ovn.v +# Taken from Crypt (as branches are not merged!) +pkg_advantage.v +SigmaProtocol.v +Schnorr.v +DDH.v +OVN.v + # Equality proof between the two versions! ovn_eq_proof.v \ No newline at end of file diff --git a/ovn/src/ovn_smart.rs b/ovn/src/ovn_smart.rs index f6bb2f3..200e9b3 100644 --- a/ovn/src/ovn_smart.rs +++ b/ovn/src/ovn_smart.rs @@ -14,59 +14,60 @@ use hacspec_concordium_derive::*; /** Interface for group implementation */ pub trait Group { - type GroupType: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; + type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; const q: u32; // Prime order - const g: Self::GroupType; // Generator (elemnent of group) - - fn g_pow(x: u32) -> Self::GroupType; - fn pow(g: Self::GroupType, x: u32) -> Self::GroupType; - fn one() -> Self::GroupType; - fn prod(x: Self::GroupType, y: Self::GroupType) -> Self::GroupType; - fn inv(x: Self::GroupType) -> Self::GroupType; - fn div(x: Self::GroupType, y: Self::GroupType) -> Self::GroupType; - // fn random_element() -> Self::GroupType; + const g: Self::group_type; // Generator (elemnent of group) + + fn g_pow(x: u32) -> Self::group_type; + fn pow(g: Self::group_type, x: u32) -> Self::group_type; + fn one() -> Self::group_type; + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type; + fn inv(x: Self::group_type) -> Self::group_type; + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; + // fn random_element() -> Self::group_type; } #[derive(Clone, Copy)] pub struct z_17 {} impl Group for z_17 { - type GroupType = u32; + type group_type = u32; const q: u32 = 17; // Prime order - const g: Self::GroupType = 3; // Generator (elemnent of group) + const g: Self::group_type = 3; // Generator (elemnent of group) - fn g_pow(x: u32) -> Self::GroupType { + fn g_pow(x: u32) -> Self::group_type { (Self::g ^ x) % Self::q } - fn pow(g: Self::GroupType, x: u32) -> Self::GroupType { + fn pow(g: Self::group_type, x: u32) -> Self::group_type { (Self::g ^ x) % Self::q } - fn one() -> Self::GroupType { + fn one() -> Self::group_type { 1 } - fn prod(x: Self::GroupType, y: Self::GroupType) -> Self::GroupType { + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { (x * y) % Self::q } - fn inv(x: Self::GroupType) -> Self::GroupType { + fn inv(x: Self::group_type) -> Self::group_type { let mut res = 0; for i in 1..Self::q { + let i_computation = i; if Self::g_pow(i) == x { - res = i; + res = i_computation; } } res // [0, 1, 9, 6, 13, 7, 3, 5, 15, 2, 12, 14, 10, 4, 11, 8, 16][x as usize] } - fn div(x: Self::GroupType, y: Self::GroupType) -> Self::GroupType { + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { Self::prod(x, Self::inv(y)) } - // fn random_element() -> Self::GroupType { + // fn random_element() -> Self::group_type { // } } @@ -93,12 +94,12 @@ const n: usize = 20; // #[cfg_attr(not(feature = "hax_compilation"), contract_state(contract = "OVN"))] #[derive(Serialize, SchemaType, Clone, Copy)] pub struct OvnContractState/* */ { - g_pow_xis: [/*G*/::GroupType; n], + g_pow_xis: [/*G*/::group_type; n], zkp_xis: [u32; n], commit_vis: [u32; n], - g_pow_xi_yi_vis: [/*G*/::GroupType; n], + g_pow_xi_yi_vis: [/*G*/::group_type; n], zkp_vis: [u32; n], tally: u32, @@ -127,7 +128,7 @@ pub fn select_private_voting_key/* */(random: u32) -> u32 { } /** TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics */ -pub fn ZKP/* */(g_pow_xi: /*G*/::GroupType, xi: u32) -> u32 { +pub fn ZKP/* */(g_pow_xi: /*G*/::group_type, xi: u32) -> u32 { 0 } @@ -152,11 +153,11 @@ pub fn register_vote( let g_pow_xi = G::g_pow(params.rp_xi); let zkp_xi = ZKP/* :: */(g_pow_xi, params.rp_xi); - let mut state_ret = state.clone(); - state_ret.g_pow_xis[params.rp_i as usize] = g_pow_xi; - state_ret.zkp_xis[params.rp_i as usize] = zkp_xi; + let mut register_vote_state_ret = state.clone(); + register_vote_state_ret.g_pow_xis[params.rp_i as usize] = g_pow_xi; + register_vote_state_ret.zkp_xis[params.rp_i as usize] = zkp_xi; - Ok((A::accept(), state_ret)) + Ok((A::accept(), register_vote_state_ret)) } #[derive(Serialize, SchemaType)] @@ -174,8 +175,8 @@ pub fn compute_group_element_for_vote/* */( i: u32, xi: u32, vote: bool, - xis: [/*G*/::GroupType; n], -) -> /*G*/::GroupType { + xis: [/*G*/::group_type; n], +) -> /*G*/::group_type { let mut prod1 = G::one(); for j in 0..(i - 1) as usize { prod1 = G::prod(prod1, xis[j]); @@ -189,7 +190,7 @@ pub fn compute_group_element_for_vote/* */( G::prod(G::pow(Yi, xi), G::g_pow(if vote { 1 } else { 0 })) } -pub fn commit_to/* */(x: /*G*/::GroupType) -> u32 { +pub fn commit_to/* */(x: /*G*/::group_type) -> u32 { 0 } @@ -210,13 +211,13 @@ pub fn commit_to_vote( compute_group_element_for_vote/*:: */(params.cvp_i, params.cvp_xi, params.cvp_vote, state.g_pow_xis); let commit_vi = commit_to/*:: */(g_pow_xi_yi_vi); - let mut state_ret = state.clone(); - state_ret.commit_vis[params.cvp_i as usize] = commit_vi; - Ok((A::accept(), state_ret)) + let mut commit_to_vote_state_ret = state.clone(); + commit_to_vote_state_ret.commit_vis[params.cvp_i as usize] = commit_vi; + Ok((A::accept(), commit_to_vote_state_ret)) } /** Cramer, Damgård and Schoenmakers (CDS) technique */ -pub fn ZKP_one_out_of_two/* */(g_pow_vi: /*G*/::GroupType, vi: bool) -> u32 { +pub fn ZKP_one_out_of_two/* */(g_pow_vi: /*G*/::group_type, vi: bool) -> u32 { 32 // TODO } @@ -233,22 +234,18 @@ pub fn cast_vote( compute_group_element_for_vote/*:: */(params.cvp_i, params.cvp_xi, params.cvp_vote, state.g_pow_xis); let zkp_vi = ZKP_one_out_of_two/*:: */(g_pow_xi_yi_vi, params.cvp_vote); - let mut state_ret = state.clone(); + let mut cast_vote_state_ret = state.clone(); + cast_vote_state_ret.g_pow_xi_yi_vis[params.cvp_i as usize] = g_pow_xi_yi_vi; + cast_vote_state_ret.zkp_vis[params.cvp_i as usize] = zkp_vi; - let mut g_pow_xi_yi_vis_temp = state_ret.g_pow_xi_yi_vis.clone(); - g_pow_xi_yi_vis_temp[params.cvp_i as usize] = g_pow_xi_yi_vi; - state_ret.g_pow_xi_yi_vis = g_pow_xi_yi_vis_temp; - - state_ret.zkp_vis[params.cvp_i as usize] = zkp_vi; - - Ok((A::accept(),state_ret)) + Ok((A::accept(),cast_vote_state_ret)) } -pub fn check_valid2/* */(g_pow_xi_yi_vi: /*G*/::GroupType, zkp: u32) -> bool { +pub fn check_valid2/* */(g_pow_xi_yi_vi: /*G*/::group_type, zkp: u32) -> bool { true } -pub fn check_commitment/* */(g_pow_xi_yi_vi: /*G*/::GroupType, zkp: u32) -> bool { +pub fn check_commitment/* */(g_pow_xi_yi_vi: /*G*/::group_type, zkp: u32) -> bool { true } @@ -266,7 +263,7 @@ pub fn tally_votes( () } - let mut vote_result = G::one(); + let mut vote_result = /*G*/ G::one(); for g_pow_vote in state.g_pow_xi_yi_vis { vote_result = G::prod(vote_result, g_pow_vote); } @@ -279,10 +276,10 @@ pub fn tally_votes( } } - let mut state_ret = state.clone(); - state_ret.tally = tally; + let mut tally_votes_state_ret = state.clone(); + tally_votes_state_ret.tally = tally; - Ok((A::accept(), state_ret)) + Ok((A::accept(), tally_votes_state_ret)) } // #[cfg(test)] From 47f7f5ebc51fa13f49232fa265340942457029ba Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 10 Oct 2023 15:50:17 +0200 Subject: [PATCH 26/86] Removed some admits --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 28a00c8..5fd56d4 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -392,13 +392,15 @@ Definition state_OVN : choice_type := Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : (state_OVN)) : ResultMonad.result ((state_OVN)) (t_ParseError) := ResultMonad.Ok st. -#[global] Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit. Admitted. -#[global] Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam. Admitted. +(* Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. *) + +#[global] Program Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit := { get x L I := (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) }. +#[global] Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam := { Sized x := x }. Definition receive_OVN_register {A : _} {T : _} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_RegisterParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := register_vote ctx st. -#[global] Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit. Admitted. -#[global] Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam. Admitted. +#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := { get x L I := (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) }. +#[global] Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := { Sized x := x }. Definition receive_OVN_commit_to_vote {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := commit_to_vote ctx st. @@ -407,20 +409,18 @@ Definition receive_OVN_commit_to_vote {A : _} {(* impl *) HasReceiveContext : _} Definition receive_OVN_cast_vote {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := cast_vote ctx st. -#[global] Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit. Admitted. -#[global] Instance t_TallyParameter_t_Sized : t_Sized t_TallyParameter. Admitted. +#[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := { get x L I := (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) }. +#[global] Instance t_TallyParameter_t_Sized : t_Sized t_TallyParameter := { Sized x := x }. Definition receive_OVN_tally {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_TallyParameter)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := tally_votes ctx st. -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - Inductive Msg_OVN: Type := | msg_OVN_register : t_RegisterParam -> Msg_OVN | msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN | msg_OVN_cast_vote : t_CastVoteParam -> Msg_OVN | msg_OVN_tally : t_TallyParameter -> Msg_OVN. -#[global] Instance state_OVN_t_HasReceiveContext : t_HasReceiveContext state_OVN 'unit. Admitted. -#[global] Instance state_OVN_t_Sized : t_Sized state_OVN. Admitted. +#[global] Program Instance state_OVN_t_HasReceiveContext : t_HasReceiveContext state_OVN 'unit := { get x L I := (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) }. +#[global] Instance state_OVN_t_Sized : t_Sized state_OVN := { Sized x := x }. #[global] Instance state_OVN_t_HasActions : t_HasActions state_OVN. Admitted. Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : (state_OVN)) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := receive_OVN chain ctx st msg := @@ -449,7 +449,7 @@ Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : (state_O ResultMonad.Err tt end : ResultMonad.result (state_OVN * list ActionBody) t_ParseError. Fail Next Obligation. -#[global] Instance state_OVN_Serializable : Serializable state_OVN. Admitted. +#[global] Instance state_OVN_Serializable : Serializable state_OVN := _. #[global] Instance Msg_OVN_Serializable : Serializable Msg_OVN. Admitted. Definition contract_OVN : Contract ((state_OVN)) (Msg_OVN) ((state_OVN)) (t_ParseError) := build_contract init_OVN receive_OVN. From 01f7b81c69c9779c6b5001e847e8eabb531be9cc Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 11 Oct 2023 10:08:47 +0200 Subject: [PATCH 27/86] Cleanup --- ovn/Cargo.toml | 2 +- ovn/src/ovn.rs | 641 +++++++++++++++---------------- ovn/src/ovn_old.rs | 147 ------- ovn/src/ovn_smart.rs | 340 ---------------- ovn/src/ovn_smart_concordium.rs | 306 --------------- ovn/src/ovn_template.rs | 126 ------ ovn/src/schnorr.rs | 102 ----- ovn/src/schnorr/random_oracle.rs | 88 ----- 8 files changed, 306 insertions(+), 1446 deletions(-) delete mode 100644 ovn/src/ovn_old.rs delete mode 100644 ovn/src/ovn_smart.rs delete mode 100644 ovn/src/ovn_smart_concordium.rs delete mode 100644 ovn/src/ovn_template.rs delete mode 100644 ovn/src/schnorr.rs delete mode 100644 ovn/src/schnorr/random_oracle.rs diff --git a/ovn/Cargo.toml b/ovn/Cargo.toml index 5b09ad8..a0c5191 100644 --- a/ovn/Cargo.toml +++ b/ovn/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Lasse Letager Hanse "] edition = "2018" [lib] -path = "src/ovn_smart.rs" +path = "src/ovn.rs" [dependencies] # hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } diff --git a/ovn/src/ovn.rs b/ovn/src/ovn.rs index 474f06b..200e9b3 100644 --- a/ovn/src/ovn.rs +++ b/ovn/src/ovn.rs @@ -1,371 +1,340 @@ -/**************************/ -/*** Random Oracle file ***/ -/**************************/ - -use hacspec_lib::*; - -// INIT , QUERY (RO (RandomOracle) OracleParams) -// Definition RO : package RO_locs [interface] RO_exports := -// [package -// #def #[ INIT ] (_ : 'unit) : 'unit -// { -// #put queries_loc := emptym ;; -// ret Datatypes.tt -// } ; -// #def #[ QUERY ] (q : 'query) : 'random -// { -// queries ← get queries_loc ;; -// match queries q with -// | Some r => -// ret r -// | None => -// r ← sample uniform i_random ;; -// #put queries_loc := setm queries q r ;; -// ret r -// end -// } -// ]. - -pub fn random_oracle_init(_ : ()) -> () { - () +#![no_std] +#![feature(register_tool)] +#![register_tool(hax)] + +#[hax_lib_macros::skip] +extern crate hax_lib_macros; +#[hax_lib_macros::skip] +use hax_lib_macros::*; + +#[skip] +use hacspec_concordium::*; +#[skip] +use hacspec_concordium_derive::*; + +/** Interface for group implementation */ +pub trait Group { + type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; + + const q: u32; // Prime order + const g: Self::group_type; // Generator (elemnent of group) + + fn g_pow(x: u32) -> Self::group_type; + fn pow(g: Self::group_type, x: u32) -> Self::group_type; + fn one() -> Self::group_type; + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type; + fn inv(x: Self::group_type) -> Self::group_type; + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; + // fn random_element() -> Self::group_type; } -// #[derive(PartialEq, Eq, Clone, Copy)] -// pub struct G{ -// pub v : u32 -// } -public_nat_mod!( //Custom Macro - defining a newtype with some functions - well defined macro's have library functions built in - type_name: G, - type_of_canvas: GCanvas, - bit_size_of_field: 384, //381 with 3 extra bits - modulo_value: "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" //0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab -); - -// #[derive(PartialEq, Eq, Clone, Copy, Hash)] -// pub struct Q { -// pub v : u32 -// } -// Order of G -public_nat_mod!( //Custom Macro - defining a newtype with some functions - well defined macro's have library functions built in - type_name: Q, - type_of_canvas: QCanvas, - bit_size_of_field: 384, //381 with 3 extra bits - modulo_value: "2566" // TODO Order of group G! -); - -pub type Witness = Q; -pub type Statement = G; -pub type Message = G; -pub type Challenge = Q; -pub type Response = Q; - -pub type Random = Challenge; // (Statement, Message); -pub type Query = Challenge; - -// pub fn sample_uniform () -> Random { -// uniform_sample -// // (G{v: 1}, G{v: 1})// (Statement::ONE(), Message::ONE()) -// } +#[derive(Clone, Copy)] +pub struct z_17 {} +impl Group for z_17 { + type group_type = u32; -use std::collections::HashMap; + const q: u32 = 17; // Prime order + const g: Self::group_type = 3; // Generator (elemnent of group) -use std::hash::*; -// use std::hash::{Hash, Hasher}; -impl Hash for Query { - fn hash (&self, state: &mut H) { + fn g_pow(x: u32) -> Self::group_type { + (Self::g ^ x) % Self::q + } + fn pow(g: Self::group_type, x: u32) -> Self::group_type { + (Self::g ^ x) % Self::q } -} + fn one() -> Self::group_type { + 1 + } + + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { + (x * y) % Self::q + } -pub type QueriesType = HashMap; -// static ref QUERIES : HashMap = HashMap::new(); -// chQuery := 'fin #|Query| -// chRandom := 'fin #|Random| -pub fn random_oracle_query(mut QUERIES : QueriesType, q : Query, uniform_sample : Random) -> (QueriesType, Random) { - match QUERIES.get(&q) - { - Some (r) => (QUERIES.clone(), r.clone()), - None => { - let r = uniform_sample; - QUERIES.insert(q, r); - (QUERIES, r) + fn inv(x: Self::group_type) -> Self::group_type { + let mut res = 0; + for i in 1..Self::q { + let i_computation = i; + if Self::g_pow(i) == x { + res = i_computation; + } } + res + // [0, 1, 9, 6, 13, 7, 3, 5, 15, 2, 12, 14, 10, 4, 11, 8, 16][x as usize] } + + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { + Self::prod(x, Self::inv(y)) + } + // fn random_element() -> Self::group_type { + + // } } -/********************/ -/*** Schnorr file ***/ -/********************/ - -// use hacspec_lib::*; -// use std::collections::HashMap; - -// pub mod random_oracle; -// use random_oracle::*; -// type Transcript = (Message, Challenge, Response); - -// Sigma1.Sigma.RUN and Sigma1.Sigma.VERIFY: (Schnorr, RO (RandomOracle) OracleParams) -// Definition Fiat_Shamir : -// package Sigma_locs -// [interface -// #val #[ INIT ] : 'unit → 'unit ; -// #val #[ QUERY ] : 'query → 'random -// ] -// [interface -// #val #[ VERIFY ] : chTranscript → 'bool ; -// #val #[ RUN ] : chRelation → chTranscript -// ] -// := -// [package -// #def #[ VERIFY ] (t : chTranscript) : 'bool -// { -// #import {sig #[ QUERY ] : 'query → 'random } as RO_query ;; -// let '(h,a,e,z) := t in -// e ← RO_query (prod_assoc (h, a)) ;; -// ret (otf (Verify h a e z)) -// } ; -// #def #[ RUN ] (hw : chRelation) : chTranscript -// { -// #import {sig #[ INIT ] : 'unit → 'unit } as RO_init ;; -// #import {sig #[ QUERY ] : 'query → 'random } as RO_query ;; -// let '(h,w) := hw in -// #assert (R (otf h) (otf w)) ;; -// a ← Commit h w ;; -// RO_init Datatypes.tt ;; -// e ← RO_query (prod_assoc (h, a)) ;; -// z ← Response h w a e ;; -// @ret choiceTranscript (h,a,e,z) -// } -// ]. - -pub type Transcript = (Statement , Message , Challenge , Response); - -fn prod_assoc (sm : (Statement, Message)) -> // random_oracle:: -Query { - let (statement, message) = sm; - // Proof. - // cbn. intros [statement message]. - // rewrite !card_prod. - // apply mxvec_index. all: assumption. - // Qed. - // random_oracle:: - Q::ONE()// {v: 1} - // random_oracle::Query::ONE() +type G = z_17; +const n: usize = 20; + +// struct eligible_votes { +// v_id : u32, +// } + +// /** number of parties */ +// const n : u32 = 3u32; +// const P : [eligible_votes; 3] = // n = 3 +// [eligible_votes {v_id: 0}, +// eligible_votes {v_id: 1}, +// eligible_votes {v_id: 2}]; + +// use concordium_contracts_common::*; +// extern crate concordium_std; + + +#[hax::contract_state(contract = "OVN")] +// #[cfg_attr(not(feature = "hax_compilation"), contract_state(contract = "OVN"))] +#[derive(Serialize, SchemaType, Clone, Copy)] +pub struct OvnContractState/* */ { + g_pow_xis: [/*G*/::group_type; n], + zkp_xis: [u32; n], + + commit_vis: [u32; n], + + g_pow_xi_yi_vis: [/*G*/::group_type; n], + zkp_vis: [u32; n], + + tally: u32, } -// Verify_schamir -fn verify (h : Statement, a : Message, e : Challenge, z : Response) -> bool { - // fto (g ^+ (otf z) == (otf a) * (otf h) ^+ (otf e)) - false +#[hax::init(contract = "OVN")] +// #[cfg_attr(not(feature = "hax_compilation"), init(contract = "OVN"))] +// pub fn init_ovn_contract(ctx: &impl HasInitContext) -> Result { +pub fn init_ovn_contract(ctx:&T) -> InitResult { + Ok(OvnContractState { + g_pow_xis: [G::one(); n], + zkp_xis: [0; n], + + commit_vis: [0; n], + + g_pow_xi_yi_vis: [G::one(); n], + zkp_vis: [0; n], + + tally: 0, + }) } -pub fn fiat_shamir_verify(t : Transcript, uniform_sample : Random) -> bool { - let QUERIES = HashMap::new(); - let (h,a,e,z) = t; - let (QUERIES, eu) = // random_oracle:: - random_oracle_query (QUERIES, prod_assoc ((h, a)), uniform_sample); - // e <- eu; - // otf ( - verify (h, a, e, z) - // ) +/** Currently randomness needs to be injected */ +pub fn select_private_voting_key/* */(random: u32) -> u32 { + random % G::q // x_i \in_R Z_q; } -pub type Relation = (Statement, Witness); - -fn Commit (h : Statement, w : Witness, uniform_sample : Random) -> Message { - // r ← sample uniform i_witness ;; - let r = uniform_sample; - // #put commit_loc := r ;; - let mut commit = r; - // ret (fto (g ^+ (otf r))) - // G{v: 1} - G::ONE() - // Message::ONE() +/** TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics */ +pub fn ZKP/* */(g_pow_xi: /*G*/::group_type, xi: u32) -> u32 { + 0 } +#[derive(Serialize, SchemaType)] +pub struct RegisterParam { + rp_i: u32, + rp_xi: u32, +} -fn Response (h : Statement, w : Witness, a : Message, e : Challenge) -> Response { - // r ← get commit_loc ;; - // ret (fto (otf r + otf e * otf w)) - Q::ONE()// {v: 1} - // Response::ONE() +/** Primary function in round 1 */ +#[hax::receive(contract = "OVN", name = "register", parameter = "RegisterParam")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "register", parameter = "RegisterParam"))] +// pub fn register_vote( +// ctx: &impl HasReceiveContext, +// state: OvnContractState/* */, +// ) -> Result<(A, OvnContractState/* */), ParseError> { +pub fn register_vote( + ctx: &T, + state: OvnContractState/* */, +) -> Result<(A, OvnContractState/* */), ParseError> { + let params : RegisterParam = ctx.parameter_cursor().get()?; // Result? + let g_pow_xi = G::g_pow(params.rp_xi); + let zkp_xi = ZKP/* :: */(g_pow_xi, params.rp_xi); + + let mut register_vote_state_ret = state.clone(); + register_vote_state_ret.g_pow_xis[params.rp_i as usize] = g_pow_xi; + register_vote_state_ret.zkp_xis[params.rp_i as usize] = zkp_xi; + + Ok((A::accept(), register_vote_state_ret)) } -pub fn fiat_shamir_run(hw : Relation, uniform_sample_1 : Random, uniform_sample_2 : Random) -> Transcript { - let QUERIES = HashMap::new(); - // #import {sig #[ INIT ] : 'unit → 'unit } as RO_init ;; - // #import {sig #[ QUERY ] : 'query → 'random } as RO_query ;; - let (h,w) = hw; - // #assert (R (otf h) (otf w)) ;; - let a = Commit(h, w, uniform_sample_1); - // random_oracle:: - random_oracle_init(()); - let (QUERIES, eu) = // random_oracle:: - random_oracle_query(QUERIES, prod_assoc((h, a)), uniform_sample_2); - let e = Q::ONE()// {v: 1} - ; // Challenge::ONE(); // Should be e <- eu - let z = Response (h, w, a, e); - (h,a,e,z) +#[derive(Serialize, SchemaType)] +pub struct CastVoteParam { + cvp_i: u32, + cvp_xi: u32, + cvp_vote: bool, } -// use hacspec_lib::*; - -// mod schnorr; -// use schnorr::*; - -// (Exec_i i j m) ∘ (par ((P_i i b) ∘ (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) - -// Init, construct, vote: -// -// Definition P_i (i : pid) (b : bool): -// package (P_i_locs i) -// Sigma1_I -// P_i_E := -// [package -// #def #[ INIT ] (_ : 'unit) : 'public_key -// { -// #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; -// #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; -// x ← sample uniform i_secret ;; -// #put (skey_loc i) := x ;; -// let y := (fto (g ^+ (otf x))) : public in -// zkp ← ZKP (y, x) ;; -// ret (y, zkp) -// } -// ; -// #def #[ CONSTRUCT ] (m : 'public_keys) : 'unit -// { -// #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; -// #assert (size (domm m) == n) ;; -// let key := fto (compute_key m i) in -// #put (ckey_loc i) := key ;; -// @ret 'unit Datatypes.tt -// } -// ; -// #def #[ VOTE ] (v : 'bool) : 'public -// { -// skey ← get (skey_loc i) ;; -// ckey ← get (ckey_loc i) ;; -// if b then -// let vote := (otf ckey ^+ skey * g ^+ v) in -// @ret 'public (fto vote) -// else -// let vote := (otf ckey ^+ skey * g ^+ (negb v)) in -// @ret 'public (fto vote) -// } -// ]. +pub fn check_valid(zkp: u32) -> bool { + true +} -type Secret = // schnorr::random_oracle:: -Q; // Zp_finComRingType (Zp_trunc #[g]); -// pub fn sample_uniform () -> Secret { -// schnorr::random_oracle::Q{v: 1} // Secret::ONE() -// } +pub fn compute_group_element_for_vote/* */( + i: u32, + xi: u32, + vote: bool, + xis: [/*G*/::group_type; n], +) -> /*G*/::group_type { + let mut prod1 = G::one(); + for j in 0..(i - 1) as usize { + prod1 = G::prod(prod1, xis[j]); + } + let mut prod2 = G::one(); + for j in (i + 1) as usize..n { + prod2 = G::prod(prod2, xis[j]); + } + let Yi = G::div(prod1, prod2); + // implicityly: Y_i = g^y_i + G::prod(G::pow(Yi, xi), G::g_pow(if vote { 1 } else { 0 })) +} -type public = // schnorr::random_oracle:: -G; -type public_key = (public, // schnorr:: - Transcript); // (public, (schnorr::random_oracle::Message , schnorr::random_oracle::Challenge , schnorr::random_oracle::Response)) -fn p_i_init(_: (), uniform_sample : Secret, uniform_sample_R1 : // schnorr::random_oracle:: - Random, uniform_sample_R2 : // schnorr::random_oracle:: - Random) -> public_key { - // #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; - // #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; - // x ← sample uniform i_secret ;; - let x = uniform_sample; // sample_uniform(); - // #put (skey_loc i) := x ;; - // let y := (fto (g ^+ (otf x))) : public in - let y = // schnorr::random_oracle:: - G::ONE() // {v: 1} - ; // public::ONE(); - // zkp ← ZKP (y, x) ;; - let zkp = // schnorr:: - fiat_shamir_run((y, x), uniform_sample_R1, uniform_sample_R2); - (y, zkp) +pub fn commit_to/* */(x: /*G*/::group_type) -> u32 { + 0 } -// fn compute_key (m : chMap pid (chProd public choiceTranscript1), i : pid) { -// let low := \prod_(k <- domm m | (k < i)%ord) (get_value m k); -// let high := \prod_(k <- domm m | (i < k)%ord) (get_value m k); -// low * invg high -// } +/** Commitment before round 2 */ +#[hax::receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam"))] +pub fn commit_to_vote( + ctx: &impl HasReceiveContext, + state: OvnContractState/* */, +) -> Result<(A, OvnContractState/* */), ParseError> { + let params: CastVoteParam = ctx.parameter_cursor().get()?; + for zkp in state.zkp_xis { + check_valid(zkp); + () + } -// Order of G -public_nat_mod!( //Custom Macro - defining a newtype with some functions - well defined macro's have library functions built in - type_name: N, - type_of_canvas: NCanvas, - bit_size_of_field: 384, //381 with 3 extra bits - modulo_value: "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" //0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab -); - -type pid = N; -// use std::collections::HashMap; - -type public_keys = HashMap; // TODO -fn p_i_construct(m: public_keys) -> () { - // #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; - // #assert (size (domm m) == n) ;; - // let key := fto (compute_key m i) in - // #put (ckey_loc i) := key ;; - // @ret 'unit Datatypes.tt - () + let g_pow_xi_yi_vi = + compute_group_element_for_vote/*:: */(params.cvp_i, params.cvp_xi, params.cvp_vote, state.g_pow_xis); + let commit_vi = commit_to/*:: */(g_pow_xi_yi_vi); + + let mut commit_to_vote_state_ret = state.clone(); + commit_to_vote_state_ret.commit_vis[params.cvp_i as usize] = commit_vi; + Ok((A::accept(), commit_to_vote_state_ret)) } -fn p_i_vote(v: bool) -> public { - // skey ← get (skey_loc i) ;; - // ckey ← get (ckey_loc i) ;; - // if b then - // let vote := (otf ckey ^+ skey * g ^+ v) in - // @ret 'public (fto vote) - // else - // let vote := (otf ckey ^+ skey * g ^+ (negb v)) in - // @ret 'public (fto vote) - // schnorr::random_oracle:: - G::ONE()// {v: 1} - // public::ONE() +/** Cramer, Damgård and Schoenmakers (CDS) technique */ +pub fn ZKP_one_out_of_two/* */(g_pow_vi: /*G*/::group_type, vi: bool) -> u32 { + 32 // TODO } -// Exec_i -// [package -// #def #[ Exec i ] (v : 'bool) : 'public -// { -// #import {sig #[ INIT ] : 'unit → 'public_key} as Init ;; -// #import {sig #[ CONSTRUCT ] : 'public_keys → 'unit} as Construct ;; -// #import {sig #[ VOTE ] : 'bool → 'public} as Vote ;; -// #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; -// pk ← Init Datatypes.tt ;; -// x ← sample uniform i_secret ;; -// let y := (fto (g ^+ (otf x))) : public in -// zkp ← ZKP (y, x) ;; -// let m' := setm (setm m j (y, zkp)) i pk in -// Construct m' ;; -// vote ← Vote v ;; -// @ret 'public vote -// } -// ] - -fn exec(v : bool,uniform_sample : Secret, uniform_sample_R1 : // schnorr::random_oracle:: - Random, uniform_sample_R2 : // schnorr::random_oracle:: - Random) -> public { - // #import {sig #[ INIT ] : 'unit → 'public_key} as Init ;; - // #import {sig #[ CONSTRUCT ] : 'public_keys → 'unit} as Construct ;; - // #import {sig #[ VOTE ] : 'bool → 'public} as Vote ;; - // #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; - // pk ← Init Datatypes.tt ;; - // x ← sample uniform i_secret ;; - let x = uniform_sample; - // let y := (fto (g ^+ (otf x))) : public in - let y = // schnorr::random_oracle:: - G::ONE()// {v: 1} - ; // public::ONE(); - // zkp ← ZKP (y, x) ;; - let zkp = // schnorr:: - fiat_shamir_run((y, x),uniform_sample_R1,uniform_sample_R2); - // let m' := setm (setm m j (y, zkp)) i pk in - // Construct m' ;; - // vote ← Vote v ;; - let vote = p_i_vote (v); - // @ret 'public vote - vote +/** Primary function in round 2, also opens commitment */ +#[hax::receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam"))] +pub fn cast_vote( + ctx: &impl HasReceiveContext, + state: OvnContractState/* */, +) -> Result<(A, OvnContractState/* */), ParseError> { + let params: CastVoteParam = ctx.parameter_cursor().get()?; + + let g_pow_xi_yi_vi = + compute_group_element_for_vote/*:: */(params.cvp_i, params.cvp_xi, params.cvp_vote, state.g_pow_xis); + let zkp_vi = ZKP_one_out_of_two/*:: */(g_pow_xi_yi_vi, params.cvp_vote); + + let mut cast_vote_state_ret = state.clone(); + cast_vote_state_ret.g_pow_xi_yi_vis[params.cvp_i as usize] = g_pow_xi_yi_vi; + cast_vote_state_ret.zkp_vis[params.cvp_i as usize] = zkp_vi; + + Ok((A::accept(),cast_vote_state_ret)) +} + +pub fn check_valid2/* */(g_pow_xi_yi_vi: /*G*/::group_type, zkp: u32) -> bool { + true } + +pub fn check_commitment/* */(g_pow_xi_yi_vi: /*G*/::group_type, zkp: u32) -> bool { + true +} + +pub struct TallyParameter {} +#[hax::receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "tally", parameter = "TallyParameter"))] +/** Anyone can tally the votes */ +pub fn tally_votes( + _: &impl HasReceiveContext, + state: OvnContractState/* */, +) -> Result<(A, OvnContractState/* */), ParseError> { + for i in 0..n { + check_valid2/*:: */(state.g_pow_xi_yi_vis[i], state.zkp_vis[i]); + check_commitment/*:: */(state.g_pow_xi_yi_vis[i], state.commit_vis[i]); + () + } + + let mut vote_result = /*G*/ G::one(); + for g_pow_vote in state.g_pow_xi_yi_vis { + vote_result = G::prod(vote_result, g_pow_vote); + } + + let mut tally = 0; + for i in 0..n as u32 { + // Should be while, but is bounded by n anyways! + if G::g_pow(i) == vote_result { + tally = i; + } + } + + let mut tally_votes_state_ret = state.clone(); + tally_votes_state_ret.tally = tally; + + Ok((A::accept(), tally_votes_state_ret)) +} + +// #[cfg(test)] +// #[concordium_test] +// pub fn test_correctness() { +// let randomness : Vec = Vec::new(); +// let votes : Vec = Vec::new(); + +// // Setup the context +// let mut ctx = InitContextTest::empty(); +// // ctx.set_sender(ADDRESS_0); + +// let mut state = init_ovn_contract(); + +// let xis = Vec::new(); +// for i in 0..n { +// xis.push(select_private_voting_key::(randomness[i])); +// } + +// for i in 0..n { +// let parameter = RegisterParam { i, xi: xis[i] }; +// let parameter_bytes = to_bytes(¶meter); +// ctx.set_parameter(¶meter_bytes); + +// register_vote(ctx, state); +// } + +// for i in 0..n { +// let parameter = CastVoteParam { i, xi: xis[i], vote: votes[i] }; +// let parameter_bytes = to_bytes(¶meter); +// ctx.set_parameter(¶meter_bytes); + +// commit_to_vote(ctx, state); +// } + +// for i in 0..n { +// let parameter = CastVoteParam { i, xi: xis[i], vote: votes[i] }; +// let parameter_bytes = to_bytes(¶meter); +// ctx.set_parameter(¶meter_bytes); + +// cast_vote(ctx, state); +// } + +// let parameter = TallyParameter {}; +// let parameter_bytes = to_bytes(¶meter); +// ctx.set_parameter(¶meter_bytes); + +// tally_votes(ctx, state); + +// let mut count = 0; +// for v in votes { +// if v { +// count = count + 1; // += 1 does not work correctly +// } +// } + +// claim_eq!(state.tally, count, "The tally should equal the number of positive votes"); +// } diff --git a/ovn/src/ovn_old.rs b/ovn/src/ovn_old.rs deleted file mode 100644 index f2b5876..0000000 --- a/ovn/src/ovn_old.rs +++ /dev/null @@ -1,147 +0,0 @@ -use hacspec_lib::*; - -mod schnorr; -use schnorr::*; - -// (Exec_i i j m) ∘ (par ((P_i i b) ∘ (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) - -// Init, construct, vote: -// -// Definition P_i (i : pid) (b : bool): -// package (P_i_locs i) -// Sigma1_I -// P_i_E := -// [package -// #def #[ INIT ] (_ : 'unit) : 'public_key -// { -// #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; -// #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; -// x ← sample uniform i_secret ;; -// #put (skey_loc i) := x ;; -// let y := (fto (g ^+ (otf x))) : public in -// zkp ← ZKP (y, x) ;; -// ret (y, zkp) -// } -// ; -// #def #[ CONSTRUCT ] (m : 'public_keys) : 'unit -// { -// #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; -// #assert (size (domm m) == n) ;; -// let key := fto (compute_key m i) in -// #put (ckey_loc i) := key ;; -// @ret 'unit Datatypes.tt -// } -// ; -// #def #[ VOTE ] (v : 'bool) : 'public -// { -// skey ← get (skey_loc i) ;; -// ckey ← get (ckey_loc i) ;; -// if b then -// let vote := (otf ckey ^+ skey * g ^+ v) in -// @ret 'public (fto vote) -// else -// let vote := (otf ckey ^+ skey * g ^+ (negb v)) in -// @ret 'public (fto vote) -// } -// ]. - -type Secret = schnorr::random_oracle::Q; // Zp_finComRingType (Zp_trunc #[g]); -// pub fn sample_uniform () -> Secret { -// schnorr::random_oracle::Q{v: 1} // Secret::ONE() -// } - -type public = schnorr::random_oracle::G; -type public_key = (public, schnorr::Transcript); // (public, (schnorr::random_oracle::Message , schnorr::random_oracle::Challenge , schnorr::random_oracle::Response)) -fn p_i_init(_: (), uniform_sample : Secret, uniform_sample_R1 : schnorr::random_oracle::Random, uniform_sample_R2 : schnorr::random_oracle::Random) -> public_key { - // #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; - // #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; - // x ← sample uniform i_secret ;; - let x = uniform_sample; // sample_uniform(); - // #put (skey_loc i) := x ;; - // let y := (fto (g ^+ (otf x))) : public in - let y = schnorr::random_oracle::G::ONE() // {v: 1} - ; // public::ONE(); - // zkp ← ZKP (y, x) ;; - let zkp = schnorr::fiat_shamir_run((y, x), uniform_sample_R1, uniform_sample_R2); - (y, zkp) -} - -// fn compute_key (m : chMap pid (chProd public choiceTranscript1), i : pid) { -// let low := \prod_(k <- domm m | (k < i)%ord) (get_value m k); -// let high := \prod_(k <- domm m | (i < k)%ord) (get_value m k); -// low * invg high -// } - -// Order of G -public_nat_mod!( //Custom Macro - defining a newtype with some functions - well defined macro's have library functions built in - type_name: N, - type_of_canvas: NCanvas, - bit_size_of_field: 384, //381 with 3 extra bits - modulo_value: "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" //0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab -); - -type pid = N; -use std::collections::HashMap; - -type public_keys = HashMap; // TODO -fn p_i_construct(m: public_keys) -> () { - // #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; - // #assert (size (domm m) == n) ;; - // let key := fto (compute_key m i) in - // #put (ckey_loc i) := key ;; - // @ret 'unit Datatypes.tt - () -} - -fn p_i_vote(v: bool) -> public { - // skey ← get (skey_loc i) ;; - // ckey ← get (ckey_loc i) ;; - // if b then - // let vote := (otf ckey ^+ skey * g ^+ v) in - // @ret 'public (fto vote) - // else - // let vote := (otf ckey ^+ skey * g ^+ (negb v)) in - // @ret 'public (fto vote) - schnorr::random_oracle::G::ONE()// {v: 1} - // public::ONE() -} - -// Exec_i -// [package -// #def #[ Exec i ] (v : 'bool) : 'public -// { -// #import {sig #[ INIT ] : 'unit → 'public_key} as Init ;; -// #import {sig #[ CONSTRUCT ] : 'public_keys → 'unit} as Construct ;; -// #import {sig #[ VOTE ] : 'bool → 'public} as Vote ;; -// #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; -// pk ← Init Datatypes.tt ;; -// x ← sample uniform i_secret ;; -// let y := (fto (g ^+ (otf x))) : public in -// zkp ← ZKP (y, x) ;; -// let m' := setm (setm m j (y, zkp)) i pk in -// Construct m' ;; -// vote ← Vote v ;; -// @ret 'public vote -// } -// ] - -fn exec(v : bool,uniform_sample : Secret, uniform_sample_R1 : schnorr::random_oracle::Random, uniform_sample_R2 : schnorr::random_oracle::Random) -> public { - // #import {sig #[ INIT ] : 'unit → 'public_key} as Init ;; - // #import {sig #[ CONSTRUCT ] : 'public_keys → 'unit} as Construct ;; - // #import {sig #[ VOTE ] : 'bool → 'public} as Vote ;; - // #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; - // pk ← Init Datatypes.tt ;; - // x ← sample uniform i_secret ;; - let x = uniform_sample; - // let y := (fto (g ^+ (otf x))) : public in - let y = schnorr::random_oracle::G::ONE()// {v: 1} - ; // public::ONE(); - // zkp ← ZKP (y, x) ;; - let zkp = schnorr::fiat_shamir_run((y, x),uniform_sample_R1,uniform_sample_R2); - // let m' := setm (setm m j (y, zkp)) i pk in - // Construct m' ;; - // vote ← Vote v ;; - let vote = p_i_vote (v); - // @ret 'public vote - vote -} diff --git a/ovn/src/ovn_smart.rs b/ovn/src/ovn_smart.rs deleted file mode 100644 index 200e9b3..0000000 --- a/ovn/src/ovn_smart.rs +++ /dev/null @@ -1,340 +0,0 @@ -#![no_std] -#![feature(register_tool)] -#![register_tool(hax)] - -#[hax_lib_macros::skip] -extern crate hax_lib_macros; -#[hax_lib_macros::skip] -use hax_lib_macros::*; - -#[skip] -use hacspec_concordium::*; -#[skip] -use hacspec_concordium_derive::*; - -/** Interface for group implementation */ -pub trait Group { - type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; - - const q: u32; // Prime order - const g: Self::group_type; // Generator (elemnent of group) - - fn g_pow(x: u32) -> Self::group_type; - fn pow(g: Self::group_type, x: u32) -> Self::group_type; - fn one() -> Self::group_type; - fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type; - fn inv(x: Self::group_type) -> Self::group_type; - fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; - // fn random_element() -> Self::group_type; -} - -#[derive(Clone, Copy)] -pub struct z_17 {} -impl Group for z_17 { - type group_type = u32; - - const q: u32 = 17; // Prime order - const g: Self::group_type = 3; // Generator (elemnent of group) - - fn g_pow(x: u32) -> Self::group_type { - (Self::g ^ x) % Self::q - } - - fn pow(g: Self::group_type, x: u32) -> Self::group_type { - (Self::g ^ x) % Self::q - } - - fn one() -> Self::group_type { - 1 - } - - fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { - (x * y) % Self::q - } - - fn inv(x: Self::group_type) -> Self::group_type { - let mut res = 0; - for i in 1..Self::q { - let i_computation = i; - if Self::g_pow(i) == x { - res = i_computation; - } - } - res - // [0, 1, 9, 6, 13, 7, 3, 5, 15, 2, 12, 14, 10, 4, 11, 8, 16][x as usize] - } - - fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { - Self::prod(x, Self::inv(y)) - } - // fn random_element() -> Self::group_type { - - // } -} - -type G = z_17; -const n: usize = 20; - -// struct eligible_votes { -// v_id : u32, -// } - -// /** number of parties */ -// const n : u32 = 3u32; -// const P : [eligible_votes; 3] = // n = 3 -// [eligible_votes {v_id: 0}, -// eligible_votes {v_id: 1}, -// eligible_votes {v_id: 2}]; - -// use concordium_contracts_common::*; -// extern crate concordium_std; - - -#[hax::contract_state(contract = "OVN")] -// #[cfg_attr(not(feature = "hax_compilation"), contract_state(contract = "OVN"))] -#[derive(Serialize, SchemaType, Clone, Copy)] -pub struct OvnContractState/* */ { - g_pow_xis: [/*G*/::group_type; n], - zkp_xis: [u32; n], - - commit_vis: [u32; n], - - g_pow_xi_yi_vis: [/*G*/::group_type; n], - zkp_vis: [u32; n], - - tally: u32, -} - -#[hax::init(contract = "OVN")] -// #[cfg_attr(not(feature = "hax_compilation"), init(contract = "OVN"))] -// pub fn init_ovn_contract(ctx: &impl HasInitContext) -> Result { -pub fn init_ovn_contract(ctx:&T) -> InitResult { - Ok(OvnContractState { - g_pow_xis: [G::one(); n], - zkp_xis: [0; n], - - commit_vis: [0; n], - - g_pow_xi_yi_vis: [G::one(); n], - zkp_vis: [0; n], - - tally: 0, - }) -} - -/** Currently randomness needs to be injected */ -pub fn select_private_voting_key/* */(random: u32) -> u32 { - random % G::q // x_i \in_R Z_q; -} - -/** TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics */ -pub fn ZKP/* */(g_pow_xi: /*G*/::group_type, xi: u32) -> u32 { - 0 -} - -#[derive(Serialize, SchemaType)] -pub struct RegisterParam { - rp_i: u32, - rp_xi: u32, -} - -/** Primary function in round 1 */ -#[hax::receive(contract = "OVN", name = "register", parameter = "RegisterParam")] -// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "register", parameter = "RegisterParam"))] -// pub fn register_vote( -// ctx: &impl HasReceiveContext, -// state: OvnContractState/* */, -// ) -> Result<(A, OvnContractState/* */), ParseError> { -pub fn register_vote( - ctx: &T, - state: OvnContractState/* */, -) -> Result<(A, OvnContractState/* */), ParseError> { - let params : RegisterParam = ctx.parameter_cursor().get()?; // Result? - let g_pow_xi = G::g_pow(params.rp_xi); - let zkp_xi = ZKP/* :: */(g_pow_xi, params.rp_xi); - - let mut register_vote_state_ret = state.clone(); - register_vote_state_ret.g_pow_xis[params.rp_i as usize] = g_pow_xi; - register_vote_state_ret.zkp_xis[params.rp_i as usize] = zkp_xi; - - Ok((A::accept(), register_vote_state_ret)) -} - -#[derive(Serialize, SchemaType)] -pub struct CastVoteParam { - cvp_i: u32, - cvp_xi: u32, - cvp_vote: bool, -} - -pub fn check_valid(zkp: u32) -> bool { - true -} - -pub fn compute_group_element_for_vote/* */( - i: u32, - xi: u32, - vote: bool, - xis: [/*G*/::group_type; n], -) -> /*G*/::group_type { - let mut prod1 = G::one(); - for j in 0..(i - 1) as usize { - prod1 = G::prod(prod1, xis[j]); - } - let mut prod2 = G::one(); - for j in (i + 1) as usize..n { - prod2 = G::prod(prod2, xis[j]); - } - let Yi = G::div(prod1, prod2); - // implicityly: Y_i = g^y_i - G::prod(G::pow(Yi, xi), G::g_pow(if vote { 1 } else { 0 })) -} - -pub fn commit_to/* */(x: /*G*/::group_type) -> u32 { - 0 -} - -/** Commitment before round 2 */ -#[hax::receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] -// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam"))] -pub fn commit_to_vote( - ctx: &impl HasReceiveContext, - state: OvnContractState/* */, -) -> Result<(A, OvnContractState/* */), ParseError> { - let params: CastVoteParam = ctx.parameter_cursor().get()?; - for zkp in state.zkp_xis { - check_valid(zkp); - () - } - - let g_pow_xi_yi_vi = - compute_group_element_for_vote/*:: */(params.cvp_i, params.cvp_xi, params.cvp_vote, state.g_pow_xis); - let commit_vi = commit_to/*:: */(g_pow_xi_yi_vi); - - let mut commit_to_vote_state_ret = state.clone(); - commit_to_vote_state_ret.commit_vis[params.cvp_i as usize] = commit_vi; - Ok((A::accept(), commit_to_vote_state_ret)) -} - -/** Cramer, Damgård and Schoenmakers (CDS) technique */ -pub fn ZKP_one_out_of_two/* */(g_pow_vi: /*G*/::group_type, vi: bool) -> u32 { - 32 // TODO -} - -/** Primary function in round 2, also opens commitment */ -#[hax::receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] -// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam"))] -pub fn cast_vote( - ctx: &impl HasReceiveContext, - state: OvnContractState/* */, -) -> Result<(A, OvnContractState/* */), ParseError> { - let params: CastVoteParam = ctx.parameter_cursor().get()?; - - let g_pow_xi_yi_vi = - compute_group_element_for_vote/*:: */(params.cvp_i, params.cvp_xi, params.cvp_vote, state.g_pow_xis); - let zkp_vi = ZKP_one_out_of_two/*:: */(g_pow_xi_yi_vi, params.cvp_vote); - - let mut cast_vote_state_ret = state.clone(); - cast_vote_state_ret.g_pow_xi_yi_vis[params.cvp_i as usize] = g_pow_xi_yi_vi; - cast_vote_state_ret.zkp_vis[params.cvp_i as usize] = zkp_vi; - - Ok((A::accept(),cast_vote_state_ret)) -} - -pub fn check_valid2/* */(g_pow_xi_yi_vi: /*G*/::group_type, zkp: u32) -> bool { - true -} - -pub fn check_commitment/* */(g_pow_xi_yi_vi: /*G*/::group_type, zkp: u32) -> bool { - true -} - -pub struct TallyParameter {} -#[hax::receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] -// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "tally", parameter = "TallyParameter"))] -/** Anyone can tally the votes */ -pub fn tally_votes( - _: &impl HasReceiveContext, - state: OvnContractState/* */, -) -> Result<(A, OvnContractState/* */), ParseError> { - for i in 0..n { - check_valid2/*:: */(state.g_pow_xi_yi_vis[i], state.zkp_vis[i]); - check_commitment/*:: */(state.g_pow_xi_yi_vis[i], state.commit_vis[i]); - () - } - - let mut vote_result = /*G*/ G::one(); - for g_pow_vote in state.g_pow_xi_yi_vis { - vote_result = G::prod(vote_result, g_pow_vote); - } - - let mut tally = 0; - for i in 0..n as u32 { - // Should be while, but is bounded by n anyways! - if G::g_pow(i) == vote_result { - tally = i; - } - } - - let mut tally_votes_state_ret = state.clone(); - tally_votes_state_ret.tally = tally; - - Ok((A::accept(), tally_votes_state_ret)) -} - -// #[cfg(test)] -// #[concordium_test] -// pub fn test_correctness() { -// let randomness : Vec = Vec::new(); -// let votes : Vec = Vec::new(); - -// // Setup the context -// let mut ctx = InitContextTest::empty(); -// // ctx.set_sender(ADDRESS_0); - -// let mut state = init_ovn_contract(); - -// let xis = Vec::new(); -// for i in 0..n { -// xis.push(select_private_voting_key::(randomness[i])); -// } - -// for i in 0..n { -// let parameter = RegisterParam { i, xi: xis[i] }; -// let parameter_bytes = to_bytes(¶meter); -// ctx.set_parameter(¶meter_bytes); - -// register_vote(ctx, state); -// } - -// for i in 0..n { -// let parameter = CastVoteParam { i, xi: xis[i], vote: votes[i] }; -// let parameter_bytes = to_bytes(¶meter); -// ctx.set_parameter(¶meter_bytes); - -// commit_to_vote(ctx, state); -// } - -// for i in 0..n { -// let parameter = CastVoteParam { i, xi: xis[i], vote: votes[i] }; -// let parameter_bytes = to_bytes(¶meter); -// ctx.set_parameter(¶meter_bytes); - -// cast_vote(ctx, state); -// } - -// let parameter = TallyParameter {}; -// let parameter_bytes = to_bytes(¶meter); -// ctx.set_parameter(¶meter_bytes); - -// tally_votes(ctx, state); - -// let mut count = 0; -// for v in votes { -// if v { -// count = count + 1; // += 1 does not work correctly -// } -// } - -// claim_eq!(state.tally, count, "The tally should equal the number of positive votes"); -// } diff --git a/ovn/src/ovn_smart_concordium.rs b/ovn/src/ovn_smart_concordium.rs deleted file mode 100644 index cd1203a..0000000 --- a/ovn/src/ovn_smart_concordium.rs +++ /dev/null @@ -1,306 +0,0 @@ -#![no_std] - -// use core::*; -// use hacspec_lib::*; -// use creusot_contracts::*; - -use concordium_std::*; // ::{HasLogger, HasInitContext, Logger, HasContractState, Reject, Serial, Deserial, Read, ParseResult, Write, Get, ParseError, HasReceiveContext, HasActions, Seek, Action, ReceiveContextExtern, ExternContext, Vec, to_bytes, test_infrastructure::InitContextTest}; -use concordium_std_derive::*; - -/** Interface for group implementation */ -pub trait Group { - type group_type: PartialEq + Eq + Clone + Copy + concordium_std::Serialize; - - const q: u32; // Prime order - const g: Self::group_type; // Generator (elemnent of group) - - fn g_pow(x: u32) -> Self::group_type; - fn pow(g: Self::group_type, x: u32) -> Self::group_type; - fn one() -> Self::group_type; - fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type; - fn inv(x: Self::group_type) -> Self::group_type; - fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; - // fn random_element() -> Self::group_type; -} - -pub struct z_17 {} -impl Group for z_17 { - type group_type = u32; - - const q: u32 = 17; // Prime order - const g: Self::group_type = 3; // Generator (elemnent of group) - - fn g_pow(x: u32) -> Self::group_type { - (Self::g ^ x) % Self::q - } - - fn pow(g: Self::group_type, x: u32) -> Self::group_type { - (Self::g ^ x) % Self::q - } - - fn one() -> Self::group_type { - 1 - } - - fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { - (x * y) % Self::q - } - - fn inv(x: Self::group_type) -> Self::group_type { - let mut res = 0; - for i in 1..Self::q { - if Self::pow(Self::g, i) == x { - res = i - } - } - Self::q - res - } - - fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { - Self::prod(x, Self::inv(y)) - } - // fn random_element() -> Self::group_type { - - // } -} - -// struct eligible_votes { -// v_id : u32, -// } - -// /** number of parties */ -// const n : u32 = 3u32; -// const P : [eligible_votes; 3] = // n = 3 -// [eligible_votes {v_id: 0}, -// eligible_votes {v_id: 1}, -// eligible_votes {v_id: 2}]; - -// use concordium_contracts_common::*; -// extern crate concordium_std; - -#[contract_state(contract = "OVN")] -#[derive(Serialize, SchemaType)] -pub struct OvnContractState { - g_pow_xis: [G::group_type; n], - zkp_xis: [u32; n], - - commit_vis: [u32; n], - - g_pow_xi_yi_vis: [G::group_type; n], - zkp_vis: [u32; n], - - tally: u32, -} - -#[init(contract = "OVN")] -pub fn init_ovn_contract(ctx: &impl HasInitContext) -> Result { - Ok(true) -} - -/** Currently randomness needs to be injected */ -pub fn select_private_voting_key(random: u32) -> u32 { - random % G::q // x_i \in_R Z_q; -} - -/** TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics */ -pub fn ZKP(g_pow_xi: G::group_type, xi: u32) -> u32 { - 0 -} - -#[derive(Serialize, SchemaType)] -pub struct RegisterParam { - i: u32, - xi: u32, -} - -type G = z_17; -const n: usize = 20; - -/** Primary function in round 1 */ -#[receive(contract = "OVN", name = "register", parameter = "RegisterParam")] -pub fn register_vote( - ctx: &impl HasReceiveContext, - state: &mut OvnContractState, -) -> Result { - let params: RegisterParam = ctx.parameter_cursor().get()?; - - // let xi = select_private_voting_key::(params.random); - let g_pow_xi = G::g_pow(params.xi); - let zkp_xi = ZKP::(g_pow_xi, params.xi); - - state.g_pow_xis[params.i as usize] = g_pow_xi; - state.zkp_xis[params.i as usize] = zkp_xi; - Ok(A::accept()) -} - -#[derive(Serialize, SchemaType)] -pub struct CastVoteParam { - i: u32, - xi: u32, - vote: bool, -} - -pub fn check_valid(zkp: u32) -> bool { - true -} - -pub fn compute_group_element_for_vote( - i: u32, - xi: u32, - vote: bool, - xis: [G::group_type; n], -) -> G::group_type { - let mut prod1 = G::one(); - for j in 0..(i - 1) as usize { - prod1 = G::prod(prod1, xis[j]); - } - let mut prod2 = G::one(); - for j in (i + 1) as usize..n { - prod2 = G::prod(prod2, xis[j]); - } - let Yi = G::div(prod1, prod2); - // implicityly: Y_i = g^y_i - G::prod(G::pow(Yi, xi), G::g_pow(if vote { 1 } else { 0 })) -} - -pub fn commit_to(x: G::group_type) -> u32 { - 0 -} - -/** Commitment before round 2 */ -#[receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] -pub fn commit_to_vote( - ctx: &impl HasReceiveContext, - state: &mut OvnContractState, -) -> Result { - let params: CastVoteParam = ctx.parameter_cursor().get()?; - for zkp in state.zkp_xis { - check_valid(zkp); - () - } - - let g_pow_xi_yi_vi = - compute_group_element_for_vote::(params.i, params.xi, params.vote, state.g_pow_xis); - let commit_vi = commit_to::(g_pow_xi_yi_vi); - - state.commit_vis[params.i as usize] = commit_vi; - Ok(A::accept()) -} - -/** Cramer, Damgård and Schoenmakers (CDS) technique */ -pub fn ZKP_one_out_of_two(g_pow_vi: G::group_type, vi: bool) -> u32 { - 32 // TODO -} - -/** Primary function in round 2, also opens commitment */ -#[receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] -pub fn cast_vote( - ctx: &impl HasReceiveContext, - state: &mut OvnContractState, -) -> Result { - let params: CastVoteParam = ctx.parameter_cursor().get()?; - - let g_pow_xi_yi_vi = - compute_group_element_for_vote::(params.i, params.xi, params.vote, state.g_pow_xis); - let zkp_vi = ZKP_one_out_of_two::(g_pow_xi_yi_vi, params.vote); - - state.g_pow_xi_yi_vis[params.i as usize] = g_pow_xi_yi_vi; - state.zkp_vis[params.i as usize] = zkp_vi; - - Ok(A::accept()) -} - -pub fn check_valid2(g_pow_xi_yi_vi: G::group_type, zkp: u32) -> bool { - true -} - -pub fn check_commitment(g_pow_xi_yi_vi: G::group_type, zkp: u32) -> bool { - true -} - -pub struct TallyParameter {} -#[receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] -/** Anyone can tally the votes */ -pub fn tally_votes( - _: &impl HasReceiveContext, - state: &mut OvnContractState, -) -> Result { - for i in 0..n { - check_valid2::(state.g_pow_xi_yi_vis[i], state.zkp_vis[i]); - check_commitment::(state.g_pow_xi_yi_vis[i], state.commit_vis[i]); - () - } - - let mut vote_result = G::one(); - for g_pow_vote in state.g_pow_xi_yi_vis { - vote_result = G::prod(vote_result, g_pow_vote); - } - - let mut tally = 0; - for i in 0..n as u32 { - // Should be while, but is bounded by n anyways! - if G::g_pow(i) == vote_result { - tally = i; - } - } - state.tally = tally; - - Ok(A::accept()) -} - -// #[cfg(test)] -// #[concordium_test] -// pub fn test_correctness() { -// let randomness : Vec = Vec::new(); -// let votes : Vec = Vec::new(); - -// // Setup the context -// let mut ctx = InitContextTest::empty(); -// // ctx.set_sender(ADDRESS_0); - -// let mut state = init_ovn_contract(); - -// let xis = Vec::new(); -// for i in 0..n { -// xis.push(select_private_voting_key::(randomness[i])); -// } - -// for i in 0..n { -// let parameter = RegisterParam { i, xi: xis[i] }; -// let parameter_bytes = to_bytes(¶meter); -// ctx.set_parameter(¶meter_bytes); - -// register_vote(ctx, state); -// } - -// for i in 0..n { -// let parameter = CastVoteParam { i, xi: xis[i], vote: votes[i] }; -// let parameter_bytes = to_bytes(¶meter); -// ctx.set_parameter(¶meter_bytes); - -// commit_to_vote(ctx, state); -// } - -// for i in 0..n { -// let parameter = CastVoteParam { i, xi: xis[i], vote: votes[i] }; -// let parameter_bytes = to_bytes(¶meter); -// ctx.set_parameter(¶meter_bytes); - -// cast_vote(ctx, state); -// } - -// let parameter = TallyParameter {}; -// let parameter_bytes = to_bytes(¶meter); -// ctx.set_parameter(¶meter_bytes); - -// tally_votes(ctx, state); - -// let mut count = 0; -// for v in votes { -// if v { -// count = count + 1; // += 1 does not work correctly -// } -// } - -// claim_eq!(state.tally, count, "The tally should equal the number of positive votes"); -// } diff --git a/ovn/src/ovn_template.rs b/ovn/src/ovn_template.rs deleted file mode 100644 index 514f16e..0000000 --- a/ovn/src/ovn_template.rs +++ /dev/null @@ -1,126 +0,0 @@ -/** Interface for group implementation */ -pub trait Group { - type group_type: PartialEq + Eq + Clone + Copy + concordium_std::Serialize; - - const q: u32; // Prime order - const g: Self::group_type; // Generator (elemnent of group) - - fn g_pow(x: u32) -> Self::group_type; - fn pow(g: Self::group_type, x: u32) -> Self::group_type; - fn one() -> Self::group_type; - fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type; - fn inv(x: Self::group_type) -> Self::group_type; - fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; - // fn random_element() -> Self::group_type; -} - -/** Currently randomness needs to be injected */ -pub fn select_private_voting_key(random: u32) -> u32 { - random % G::q // x_i \in_R Z_q; -} - -/** TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics */ -pub fn ZKP(g_pow_xi: G::group_type, xi: u32) -> u32 { - 0 -} - -/** Primary function in round 1 */ -pub fn register_vote(i: u32, random: u32) -> () { - let xi = select_private_voting_key::(random); - let g_pow_xi = G::g_pow(xi); - let zkp_xi = ZKP::(g_pow_xi, xi); - - broadcast1(g_pow_xi, zkp_xi); -} - -pub fn check_valid(zkp: u32) -> bool { - true -} - -pub fn compute_group_element_for_vote( - i: u32, - xi: u32, - vote: bool, - xis: [G::group_type; n], -) -> G::group_type { - let mut prod1 = G::one(); - for j in 0..(i - 1) as usize { - prod1 = G::prod(prod1, xis[j]); - } - let mut prod2 = G::one(); - for j in (i + 1) as usize..n { - prod2 = G::prod(prod2, xis[j]); - } - let Yi = G::div(prod1, prod2); - // implicityly: Y_i = g^y_i - G::prod(G::pow(Yi, xi), G::g_pow(if vote { 1 } else { 0 })) -} - -pub fn commit_to(x: G::group_type) -> u32 { - 0 -} - -/** Commitment before round 2 */ -pub fn commit_to_vote(i: u32, xi: u32, vote: bool) -> () { - let (g_pow_xis, zkp_xis) = get_broadcast1(); - - for zkp in zkp_xis { - check_valid(zkp); - () - } - - let g_pow_xi_yi_vi = compute_group_element_for_vote::(i, xi, vote, g_pow_xis); - let commit_vi = commit_to::(g_pow_xi_yi_vi); - - broadcast_commit(commit_vi); -} - -/** Cramer, Damgård and Schoenmakers (CDS) technique */ -pub fn ZKP_one_out_of_two(g_pow_vi: G::group_type, vi: bool) -> u32 { - 32 // TODO -} - -/** Primary function in round 2, also opens commitment */ -pub fn cast_vote(i: u32, xi: u32, vote: bool) -> () { - let (g_pow_xis, zkp_xis) = get_broadcast1(); - - let g_pow_xi_yi_vi = compute_group_element_for_vote::(i, xi, vote, g_pow_xis); - let zkp_vi = ZKP_one_out_of_two::(g_pow_xi_yi_vi, vote); - - broadcast_2(g_pow_xi_yi_vi, zkp_vi); -} - -pub fn check_valid2(g_pow_xi_yi_vi: G::group_type, zkp: u32) -> bool { - true -} - -pub fn check_commitment(g_pow_xi_yi_vi: G::group_type, zkp: u32) -> bool { - true -} - -/** Anyone can tally the votes */ -pub fn tally_votes() -> u32 { - let (g_pow_xi_yi_vis, zkp_vis) = get_broadcast2(); - let commit_vis = get_broadcast_commit(); - - for i in 0..n { - check_valid2::(g_pow_xi_yi_vis[i], zkp_vis[i]); - check_commitment::(g_pow_xi_yi_vis[i], commit_vis[i]); - () - } - - let mut vote_result = G::one(); - for g_pow_vote in g_pow_xi_yi_vis { - vote_result = G::prod(vote_result, g_pow_vote); - } - - let mut tally = 0; - for i in 0..n as u32 { - // Should be while, but is bounded by n anyways! - if G::g_pow(i) == vote_result { - tally = i; - } - } - - tally -} diff --git a/ovn/src/schnorr.rs b/ovn/src/schnorr.rs deleted file mode 100644 index 954a9ee..0000000 --- a/ovn/src/schnorr.rs +++ /dev/null @@ -1,102 +0,0 @@ -use hacspec_lib::*; -use std::collections::HashMap; - -pub mod random_oracle; -use random_oracle::*; -// type Transcript = (Message, Challenge, Response); - -// Sigma1.Sigma.RUN and Sigma1.Sigma.VERIFY: (Schnorr, RO (RandomOracle) OracleParams) -// Definition Fiat_Shamir : -// package Sigma_locs -// [interface -// #val #[ INIT ] : 'unit → 'unit ; -// #val #[ QUERY ] : 'query → 'random -// ] -// [interface -// #val #[ VERIFY ] : chTranscript → 'bool ; -// #val #[ RUN ] : chRelation → chTranscript -// ] -// := -// [package -// #def #[ VERIFY ] (t : chTranscript) : 'bool -// { -// #import {sig #[ QUERY ] : 'query → 'random } as RO_query ;; -// let '(h,a,e,z) := t in -// e ← RO_query (prod_assoc (h, a)) ;; -// ret (otf (Verify h a e z)) -// } ; -// #def #[ RUN ] (hw : chRelation) : chTranscript -// { -// #import {sig #[ INIT ] : 'unit → 'unit } as RO_init ;; -// #import {sig #[ QUERY ] : 'query → 'random } as RO_query ;; -// let '(h,w) := hw in -// #assert (R (otf h) (otf w)) ;; -// a ← Commit h w ;; -// RO_init Datatypes.tt ;; -// e ← RO_query (prod_assoc (h, a)) ;; -// z ← Response h w a e ;; -// @ret choiceTranscript (h,a,e,z) -// } -// ]. - -pub type Transcript = (Statement , Message , Challenge , Response); - -fn prod_assoc (sm : (Statement, Message)) -> random_oracle::Query { - let (statement, message) = sm; - // Proof. - // cbn. intros [statement message]. - // rewrite !card_prod. - // apply mxvec_index. all: assumption. - // Qed. - random_oracle::Q{v: 1} // random_oracle::Query::ONE() -} - -// Verify_schamir -fn verify (h : Statement, a : Message, e : Challenge, z : Response) -> bool { - // fto (g ^+ (otf z) == (otf a) * (otf h) ^+ (otf e)) - false -} - -pub fn fiat_shamir_verify(t : Transcript, uniform_sample : Random) -> bool { - let QUERIES = HashMap::new(); - let (h,a,e,z) = t; - let (QUERIES, eu) = random_oracle::random_oracle_query (QUERIES, prod_assoc ((h, a)), uniform_sample); - // e <- eu; - // otf ( - verify (h, a, e, z) - // ) -} - -pub type Relation = (Statement, Witness); - -fn Commit (h : Statement, w : Witness, uniform_sample : Random) -> Message { - // r ← sample uniform i_witness ;; - let r = uniform_sample; - // #put commit_loc := r ;; - let mut commit = r; - // ret (fto (g ^+ (otf r))) - // G{v: 1} - G::ONE() - // Message::ONE() -} - - -fn Response (h : Statement, w : Witness, a : Message, e : Challenge) -> Response { - // r ← get commit_loc ;; - // ret (fto (otf r + otf e * otf w)) - Q{v: 1} // Response::ONE() -} - -pub fn fiat_shamir_run(hw : Relation, uniform_sample_1 : Random, uniform_sample_2 : Random) -> Transcript { - let QUERIES = HashMap::new(); - // #import {sig #[ INIT ] : 'unit → 'unit } as RO_init ;; - // #import {sig #[ QUERY ] : 'query → 'random } as RO_query ;; - let (h,w) = hw; - // #assert (R (otf h) (otf w)) ;; - let a = Commit(h, w, uniform_sample_1); - random_oracle::random_oracle_init(()); - let (QUERIES, eu) = random_oracle::random_oracle_query(QUERIES, prod_assoc((h, a)), uniform_sample_2); - let e = Q{v: 1}; // Challenge::ONE(); // Should be e <- eu - let z = Response (h, w, a, e); - (h,a,e,z) -} diff --git a/ovn/src/schnorr/random_oracle.rs b/ovn/src/schnorr/random_oracle.rs deleted file mode 100644 index c3286f0..0000000 --- a/ovn/src/schnorr/random_oracle.rs +++ /dev/null @@ -1,88 +0,0 @@ -use hacspec_lib::*; - -// INIT , QUERY (RO (RandomOracle) OracleParams) -// Definition RO : package RO_locs [interface] RO_exports := -// [package -// #def #[ INIT ] (_ : 'unit) : 'unit -// { -// #put queries_loc := emptym ;; -// ret Datatypes.tt -// } ; -// #def #[ QUERY ] (q : 'query) : 'random -// { -// queries ← get queries_loc ;; -// match queries q with -// | Some r => -// ret r -// | None => -// r ← sample uniform i_random ;; -// #put queries_loc := setm queries q r ;; -// ret r -// end -// } -// ]. - -pub fn random_oracle_init(_ : ()) -> () { - () -} - -// #[derive(PartialEq, Eq, Clone, Copy)] -// pub struct G{ -// pub v : u32 -// } -public_nat_mod!( //Custom Macro - defining a newtype with some functions - well defined macro's have library functions built in - type_name: G, - type_of_canvas: GCanvas, - bit_size_of_field: 384, //381 with 3 extra bits - modulo_value: "1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" //0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab -); - -#[derive(PartialEq, Eq, Clone, Copy, Hash)] -pub struct Q { - pub v : u32 -} -// // Order of G -// public_nat_mod!( //Custom Macro - defining a newtype with some functions - well defined macro's have library functions built in -// type_name: Q, -// type_of_canvas: QCanvas, -// bit_size_of_field: 384, //381 with 3 extra bits -// modulo_value: "2566" // TODO Order of group G! -// ); - -pub type Witness = Q; -pub type Statement = G; -pub type Message = G; -pub type Challenge = Q; -pub type Response = Q; - -pub type Random = Challenge; // (Statement, Message); -pub type Query = Challenge; - -// pub fn sample_uniform () -> Random { -// uniform_sample -// // (G{v: 1}, G{v: 1})// (Statement::ONE(), Message::ONE()) -// } - -use std::collections::HashMap; - -// use std::hash::{Hash, Hasher}; -// impl Hash for Query { -// fn hash (&self, state: &mut H) { - -// } -// } - -pub type QueriesType = HashMap; -// static ref QUERIES : HashMap = HashMap::new(); -// chQuery := 'fin #|Query| -// chRandom := 'fin #|Random| -pub fn random_oracle_query(mut QUERIES : QueriesType, q : Query, uniform_sample : Random) -> (QueriesType, Random) { - match QUERIES.get(&q) { - Some (r) => (QUERIES.clone(), r.clone()), - None => { - let r = uniform_sample; - QUERIES.insert(q, r); - (QUERIES, r) - } - } -} From fd7823ef6d0a9a6f318ef54e91e8fac4cdd0e999 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 11 Oct 2023 10:09:55 +0200 Subject: [PATCH 28/86] Cleanup --- .../extraction/Hacspec_ovn_Export_cast_vote.v | 60 --- .../Hacspec_ovn_Export_commit_to_vote.v | 60 --- .../Hacspec_ovn_Export_init_ovn_contract.v | 60 --- .../Hacspec_ovn_Export_register_vote.v | 67 --- .../Hacspec_ovn_Export_register_vote_pre.v | 60 --- .../Hacspec_ovn_Export_tally_votes.v | 60 --- .../ssprove/extraction/Hacspec_ovn_concert.v | 346 --------------- .../extraction/Hacspec_ovn_semi_work.v | 409 ------------------ 8 files changed, 1122 deletions(-) delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_cast_vote.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_commit_to_vote.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_init_ovn_contract.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote_pre.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_tally_votes.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_concert.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_semi_work.v diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_cast_vote.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_cast_vote.v deleted file mode 100644 index cd256b5..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_cast_vote.v +++ /dev/null @@ -1,60 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. - Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import Hacspec_concordium. -Export Hacspec_concordium. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import SeekFrom. -Export SeekFrom. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import ContractState. -Export ContractState. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import Logger. -Export Logger. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import trap. -Export trap. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_commit_to_vote.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_commit_to_vote.v deleted file mode 100644 index cd256b5..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_commit_to_vote.v +++ /dev/null @@ -1,60 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. - Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import Hacspec_concordium. -Export Hacspec_concordium. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import SeekFrom. -Export SeekFrom. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import ContractState. -Export ContractState. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import Logger. -Export Logger. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import trap. -Export trap. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_init_ovn_contract.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_init_ovn_contract.v deleted file mode 100644 index ce40928..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_init_ovn_contract.v +++ /dev/null @@ -1,60 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. - Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import Hacspec_concordium. -Export Hacspec_concordium. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import trap. -Export trap. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import ExternContext. -Export ExternContext. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import InitContextExtern. -Export InitContextExtern. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import ContractState. -Export ContractState. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote.v deleted file mode 100644 index 82a133f..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote.v +++ /dev/null @@ -1,67 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. - Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Require Import Core. -Require Import Hacspec_lib. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ hax -Tool: register_tool _ _hax **) -Require Import Hacspec_concordium. -Export Hacspec_concordium. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ hax -Tool: register_tool _ _hax **) -Require Import SeekFrom. -Export SeekFrom. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ hax -Tool: register_tool _ _hax **) -Require Import ContractState. -Export ContractState. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ hax -Tool: register_tool _ _hax **) -Require Import Logger. -Export Logger. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ hax -Tool: register_tool _ _hax **) -Require Import trap. -Export trap. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote_pre.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote_pre.v deleted file mode 100644 index 55b3e69..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_register_vote_pre.v +++ /dev/null @@ -1,60 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. - Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import Concordium_std. -Export Concordium_std. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import SeekFrom. -Export SeekFrom. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import ContractState. -Export ContractState. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import Logger. -Export Logger. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import trap. -Export trap. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_tally_votes.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_tally_votes.v deleted file mode 100644 index cd256b5..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Export_tally_votes.v +++ /dev/null @@ -1,60 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. - Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import Hacspec_concordium. -Export Hacspec_concordium. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import SeekFrom. -Export SeekFrom. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import ContractState. -Export ContractState. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import Logger. -Export Logger. - -(** Tool: export_name _ -Tool: no_std _ -Tool: feature _ register_tool -Tool: register_tool _ _hax **) -Require Import trap. -Export trap. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_concert.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_concert.v deleted file mode 100644 index 6c152c0..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_concert.v +++ /dev/null @@ -1,346 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. - Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -Class t_Group (Self : choice_type) := { - t_group_type : choice_type ; - t_group_type_t_Serialize :> t_Serialize (t_group_type) ; - t_group_type_t_Deserial :> t_Deserial (t_group_type) ; - t_group_type_t_Serial :> t_Serial (t_group_type) ; - t_group_type_t_Copy :> t_Copy (t_group_type) ; - t_group_type_t_Clone :> t_Clone (t_group_type) ; - t_group_type_t_Eq :> t_Eq (t_group_type) ; - t_group_type_t_PartialEq :> t_PartialEq (t_group_type) ; - t_group_type_t_Sized :> t_Sized (t_group_type) ; - q : forall {L1 I1}, both L1 I1 (int32) ; - g : forall {L1 I1}, both L1 I1 (t_group_type) ; - g_pow_loc : {fset Location} ; - g_pow : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: g_pow_loc) I1 (t_group_type) ; - pow_loc : {fset Location} ; - pow : forall {L1 L2 I1 I2}, both L1 I1 (t_group_type) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: pow_loc) (I1 :|: I2) (t_group_type) ; - one_loc : {fset Location} ; - one : forall {L1 I1}, both (L1 :|: one_loc) I1 (t_group_type) ; - prod_loc : {fset Location} ; - prod : forall {L1 L2 I1 I2}, both L1 I1 (t_group_type) -> both L2 I2 (t_group_type) -> both (L1 :|: L2 :|: prod_loc) (I1 :|: I2) (t_group_type) ; - inv_loc : {fset Location} ; - inv : forall {L1 I1}, both L1 I1 (t_group_type) -> both (L1 :|: inv_loc) I1 (t_group_type) ; - div_loc : {fset Location} ; - div : forall {L1 L2 I1 I2}, both L1 I1 (t_group_type) -> both L2 I2 (t_group_type) -> both (L1 :|: L2 :|: div_loc) (I1 :|: I2) (t_group_type) ; -}. - -Definition t_z_17_ : choice_type := - 'unit. -Equations Build_t_z_17_ : both(fset []) (fset []) (t_z_17_) := - Build_t_z_17_ := - solve_lift (ret_both ((_) : (t_z_17_))) : both(fset []) (fset []) (t_z_17_). -Fail Next Obligation. - -Definition res_loc : Location := - (int32 ; 0%nat). -#[global] Program Instance t_z_17__t_Group : t_Group t_z_17_ := - let t_group_type := int32 : choice_type in - let q := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (17 : int32)) : both L I (int32) in - let g := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (3 : int32)) : both L I (int32) in - let g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift ((g .^ x) .% q) : both L1 I1 (int32) in - let pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: L2) (I1 :|: I2) (int32) in - let one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both L I (int32) in - let prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% q) : both (L1 :|: L2) (I1 :|: I2) (int32) in - let inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => letb res loc(res_loc) := ret_both (0 : int32) in - letb res := foldi_both (into_iter (Build_Range (f_start := ret_both (1 : int32)) (f_end := q))) (fun {L I _ _} =>fun i => - ssp (fun res => - solve_lift (ifb (g_pow i) =.? x - then letb res := i in - res - else res))) res in - solve_lift res : both (L1 :|: fset [res_loc]) I1 (int32) in - let div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (prod x (inv y)) : both (L1 :|: L2 :|: fset [res_loc]) (I1 :|: I2) (int32) in - {| t_group_type := (@t_group_type); - q := (@q); - g := (@g); - g_pow_loc := (fset [] : {fset Location}); - g_pow := (@g_pow); - pow_loc := (fset [] : {fset Location}); - pow := (@pow); - one_loc := (fset [] : {fset Location}); - one := (@one); - prod_loc := (fset [] : {fset Location}); - prod := (@prod); - inv_loc := (fset [res_loc] : {fset Location}); - inv := (@inv); - div_loc := (fset [res_loc] : {fset Location}); - div := (@div)|}. -Solve All Obligations with exact int_eqdec. -Fail Next Obligation. - -Notation "'t_G'" := (t_z_17_). - -Equations n {L : {fset Location}} {I : Interface} : both L I (uint_size) := - n := - solve_lift (ret_both (20 : uint_size)) : both L I (uint_size). -Fail Next Obligation. - -Definition t_OvnContractState : choice_type := - (nseq t_group_type 20 × nseq int32 20 × nseq int32 20 × nseq t_group_type 20 × nseq int32 20 × int32). -Equations f_g_pow_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq t_group_type 20) := - f_g_pow_xis s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq t_group_type 20))) : both L I (nseq t_group_type 20). -Fail Next Obligation. -Equations f_zkp_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := - f_zkp_xis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq int32 20))) : both L I (nseq int32 20). -Fail Next Obligation. -Equations f_commit_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := - f_commit_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : nseq int32 20))) : both L I (nseq int32 20). -Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq t_group_type 20) := - f_g_pow_xi_yi_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : nseq t_group_type 20))) : both L I (nseq t_group_type 20). -Fail Next Obligation. -Equations f_zkp_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := - f_zkp_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : nseq int32 20))) : both L I (nseq int32 20). -Fail Next Obligation. -Equations f_tally {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (int32) := - f_tally s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). -Fail Next Obligation. -Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {f_g_pow_xis : both L0 I0 (nseq t_group_type 20)} {f_zkp_xis : both L1 I1 (nseq int32 20)} {f_commit_vis : both L2 I2 (nseq int32 20)} {f_g_pow_xi_yi_vis : both L3 I3 (nseq t_group_type 20)} {f_zkp_vis : both L4 I4 (nseq int32 20)} {f_tally : both L5 I5 (int32)} : both(L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := - Build_t_OvnContractState := - bind_both f_tally (fun f_tally => - bind_both f_zkp_vis (fun f_zkp_vis => - bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => - bind_both f_commit_vis (fun f_commit_vis => - bind_both f_zkp_xis (fun f_zkp_xis => - bind_both f_g_pow_xis (fun f_g_pow_xis => - solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both(L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). -Fail Next Obligation. -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). -Definition state_OVN : choice_type := - t_OvnContractState. - -Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {T : _} `{ t_Sized (T)} `{ t_HasInitContext (T) ('unit)} (ctx : both L1 I1 (T)) : both L1 I1 (t_Result ('bool) ('unit)) := - init_ovn_contract ctx := - Result_Ok (solve_lift (ret_both (true : 'bool))) : both L1 I1 (t_Result ('bool) ('unit)). -Fail Next Obligation. - -From ConCert.Utils Require Import Extras. -From ConCert.Utils Require Import Automation. -From ConCert.Execution Require Import Serializable. -From ConCert.Execution Require Import Blockchain. -From ConCert.Execution Require Import ContractCommon. -Require Import ConCertLib. - -Instance int_default {WS} : Default (int WS) := {| default := 0 |}. -Instance nseq_default {A : choice_type} {len} `{Default A} : Default (nseq_ A len) := {| - default := eq_rect (Datatypes.length (List.repeat default len)) - (fun n : nat => nseq_ A n) (Hacspec_Lib_Pre.array_from_list (List.repeat default len)) len (List.repeat_length default len) - |}. -Program Instance both_default {A : choice_type} `{Default A} : Default (both (fset []) (fset []) A) := {| - default := ret_both default - |}. -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Require Import ConCertLib. -(* Definition Setup := *) -Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result state_OVN state_OVN := - ResultMonad.Ok st. - -Inductive OVN_Msg: Type := -| register : OVN_Msg -| commit_to_vote : OVN_Msg -| cast_vote : OVN_Msg -| tally : OVN_Msg. - -Definition OVN_receive (chain : Chain) (ctx : ContractCallContext) (state : state_OVN) (msg : Datatypes.option OVN_Msg) : ResultMonad.result (state_OVN * list ActionBody) state_OVN := - match msg with - | Some register => ResultMonad.Ok (state, []) - | Some v => ResultMonad.Ok (state, []) - | None => ResultMonad.Err state - end. - -Instance serializeable_msg : Serializable OVN_Msg. -Admitted. - -Instance serializeable_state_ovn : Serializable state_OVN. -Admitted. - -Definition auction_contract : Contract _ (* Setup *) OVN_Msg state_OVN _ := build_contract init_OVN OVN_receive. - - -Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) : both L1 I1 (int32) := - select_private_voting_key random := - solve_lift (random .% q) : both L1 I1 (int32). -Fail Next Obligation. - -Equations v_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi : both L1 I1 (int32)) (xi : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) (int32) := - v_ZKP g_pow_xi xi := - solve_lift (ret_both (0 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). -Fail Next Obligation. - -Definition t_RegisterParam : choice_type := - (int32 × int32). -Equations f_i {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := - f_i s := - bind_both s (fun x => - solve_lift (ret_both (fst x : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_xi {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := - f_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). -Fail Next Obligation. -Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_i : both L0 I0 (int32)} {f_xi : both L1 I1 (int32)} : both(L0:|:L1) (I0:|:I1) (t_RegisterParam) := - Build_t_RegisterParam := - bind_both f_xi (fun f_xi => - bind_both f_i (fun f_i => - solve_lift (ret_both ((f_i,f_xi) : (t_RegisterParam))))) : both(L0:|:L1) (I0:|:I1) (t_RegisterParam). -Fail Next Obligation. -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_i' ':=' y ')'" := (Build_t_RegisterParam (f_i := y) (f_xi := f_xi x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_xi' ':=' y ')'" := (Build_t_RegisterParam (f_i := f_i x) (f_xi := y)). - -Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {T : _} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} (ctx : both L1 I1 (T)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := - register_vote ctx state := - Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. -Definition receive_OVN_register (RegisterParam : _) (st : state_OVN) : choice_type := - register_vote st. - -Definition t_CastVoteParam : choice_type := - (int32 × int32 × 'bool). -Equations f_i {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_i s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_xi {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_vote {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I ('bool) := - f_vote s := - bind_both s (fun x => - solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). -Fail Next Obligation. -Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_i : both L0 I0 (int32)} {f_xi : both L1 I1 (int32)} {f_vote : both L2 I2 ('bool)} : both(L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := - Build_t_CastVoteParam := - bind_both f_vote (fun f_vote => - bind_both f_xi (fun f_xi => - bind_both f_i (fun f_i => - solve_lift (ret_both ((f_i,f_xi,f_vote) : (t_CastVoteParam)))))) : both(L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). -Fail Next Obligation. -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_i' ':=' y ')'" := (Build_t_CastVoteParam (f_i := y) (f_xi := f_xi x) (f_vote := f_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_i := f_i x) (f_xi := y) (f_vote := f_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_i := f_i x) (f_xi := f_xi x) (f_vote := y)). - -Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (int32)) : both L1 I1 ('bool) := - check_valid zkp := - solve_lift (ret_both (true : 'bool)) : both L1 I1 ('bool). -Fail Next Obligation. - -Definition prod2_loc : Location := - (int32 ; 2%nat). -Definition prod1_loc : Location := - (int32 ; 1%nat). -Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq int32 20)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32) := - compute_group_element_for_vote i xi vote xis := - letb prod1 loc(prod1_loc) := one in - letb prod1 := foldi_both (into_iter (Build_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun {L I _ _} =>fun j => - ssp (fun prod1 => - solve_lift (prod prod1 (xis.a[j])))) prod1 in - letb prod2 loc(prod2_loc) := one in - letb prod2 := foldi_both (into_iter (Build_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun {L I _ _} =>fun j => - ssp (fun prod2 => - solve_lift (prod prod2 (xis.a[j])))) prod2 in - letb Yi := div prod1 prod2 in - solve_lift (prod (pow Yi xi) (g_pow (ifb vote - then ret_both (1 : int32) - else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32). -Fail Next Obligation. - -Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) : both L1 I1 (int32) := - commit_to x := - solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). -Fail Next Obligation. - -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {impl HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (ctx : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := - commit_to_vote ctx state := - Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. -Definition receive_OVN_commit_to_vote (CastVoteParam : _) (st : state_OVN) : choice_type := - commit_to_vote st. - -Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (int32)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := - v_ZKP_one_out_of_two g_pow_vi vi := - solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). -Fail Next Obligation. - -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {impl HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (ctx : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := - cast_vote ctx state := - Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. -Definition receive_OVN_cast_vote (CastVoteParam : _) (st : state_OVN) : choice_type := - cast_vote st. - -Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - check_valid2 g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - check_commitment g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Definition t_TallyParameter : choice_type := - 'unit. -Equations Build_t_TallyParameter : both(fset []) (fset []) (t_TallyParameter) := - Build_t_TallyParameter := - solve_lift (ret_both ((_) : (t_TallyParameter))) : both(fset []) (fset []) (t_TallyParameter). -Fail Next Obligation. - -Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {impl HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized (impl HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext (impl HasReceiveContext) ('unit)} (_ : both L1 I1 (impl HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := - tally_votes _ state := - Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. -Definition receive_OVN_tally (TallyParameter : _) (st : state_OVN) : choice_type := - tally_votes st. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_semi_work.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_semi_work.v deleted file mode 100644 index 9a341aa..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_semi_work.v +++ /dev/null @@ -1,409 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. - Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -Class t_Group (Self : choice_type) := { - t_group_type : choice_type ; - t_group_type_t_Serialize :> t_Serialize (t_group_type) ; - t_group_type_t_Deserial :> t_Deserial (t_group_type) ; - t_group_type_t_Serial :> t_Serial (t_group_type) ; - t_group_type_t_Copy :> t_Copy (t_group_type) ; - t_group_type_t_Clone :> t_Clone (t_group_type) ; - t_group_type_t_Eq :> t_Eq (t_group_type) ; - t_group_type_t_PartialEq :> t_PartialEq (t_group_type) ; - t_group_type_t_Sized :> t_Sized (t_group_type) ; - q : forall {L1 I1}, both L1 I1 (int32) ; - g : forall {L1 I1}, both L1 I1 (t_group_type) ; - g_pow_loc : {fset Location} ; - g_pow : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: g_pow_loc) I1 (t_group_type) ; - pow_loc : {fset Location} ; - pow : forall {L1 L2 I1 I2}, both L1 I1 (t_group_type) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: pow_loc) (I1 :|: I2) (t_group_type) ; - one_loc : {fset Location} ; - one : forall {L1 I1}, both (L1 :|: one_loc) I1 (t_group_type) ; - prod_loc : {fset Location} ; - prod : forall {L1 L2 I1 I2}, both L1 I1 (t_group_type) -> both L2 I2 (t_group_type) -> both (L1 :|: L2 :|: prod_loc) (I1 :|: I2) (t_group_type) ; - inv_loc : {fset Location} ; - inv : forall {L1 I1}, both L1 I1 (t_group_type) -> both (L1 :|: inv_loc) I1 (t_group_type) ; - div_loc : {fset Location} ; - div : forall {L1 L2 I1 I2}, both L1 I1 (t_group_type) -> both L2 I2 (t_group_type) -> both (L1 :|: L2 :|: div_loc) (I1 :|: I2) (t_group_type) ; -}. -Hint Unfold g_pow_loc. -Hint Unfold pow_loc. -Hint Unfold one_loc. -Hint Unfold prod_loc. -Hint Unfold inv_loc. -Hint Unfold div_loc. - -Definition t_z_17_ : choice_type := - 'unit. -Equations Build_t_z_17_ : both (fset []) (fset []) (t_z_17_) := - Build_t_z_17_ := - solve_lift (ret_both ((_) : (t_z_17_))) : both (fset []) (fset []) (t_z_17_). -Fail Next Obligation. - -Definition res_loc : Location := - (int32 ; 0%nat). - -Equations foldi_both - {acc: choice_type} - {L1 L2 L3 I1 I2 I3} - {L I} - `{is_true (fsubset L1 L)} `{is_true (fsubset I1 I)} - `{is_true (fsubset L2 L)} `{is_true (fsubset I2 I)} - `{is_true (fsubset L3 L)} `{is_true (fsubset I3 I)} - (lo_hi: both L2 I2 uint_size * both L3 I3 uint_size) - (f: both (L2 :|: L3) (I2 :|: I3) uint_size -> - both L I acc -> - both L I acc) - (init: both L1 I1 acc) - : both L I (acc) := - foldi_both lo_hi f init := - foldi (fst lo_hi) (snd lo_hi) (@f) (init). -Solve All Obligations with intros ; solve_ssprove_obligations. -Fail Next Obligation. - -#[global] Program Instance t_z_17__t_Group : t_Group t_z_17_ := - let t_group_type := int32 : choice_type in - let q := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (17 : int32)) : both L I (int32) in - let g := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (3 : int32)) : both L I (int32) in - let g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift ((g .^ x) .% q) : both L1 I1 (int32) in - let pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: L2) (I1 :|: I2) (int32) in - let one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both L I (int32) in - let prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% q) : both (L1 :|: L2) (I1 :|: I2) (int32) in - let inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => letb res loc(res_loc) := ret_both (0 : int32) in - letb res := foldi_both (into_iter (Build_t_Range (f_start := ret_both (1 : int32)) (f_end := q))) ((* fun {L I _ _} => *)fun i => - ssp (fun res => - solve_lift (ifb (g_pow i) =.? x - then letb res := i in - res - else res))) res in - res : both (L1 :|: fset [res_loc]) I1 (int32) in - let div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (prod x (inv y)) : both (L1 :|: L2 :|: fset [res_loc]) (I1 :|: I2) (int32) in - {| t_group_type := (@t_group_type); - q := (@q); - g := (@g); - g_pow_loc := (fset [] : {fset Location}); - g_pow := (@g_pow); - pow_loc := (fset [] : {fset Location}); - pow := (@pow); - one_loc := (fset [] : {fset Location}); - one := (@one); - prod_loc := (fset [] : {fset Location}); - prod := (@prod); - inv_loc := (fset [res_loc] : {fset Location}); - inv := (@inv); - div_loc := (fset [res_loc] : {fset Location}); - div := (@div)|}. -Solve All Obligations with exact int_eqdec. -Fail Next Obligation. -Hint Unfold t_z_17__t_Group. - -Notation "'t_G'" := (t_z_17_). - -Equations n {L : {fset Location}} {I : Interface} : both L I (uint_size) := - n := - solve_lift (ret_both (20 : uint_size)) : both L I (uint_size). -Fail Next Obligation. - -Definition t_OvnContractState : choice_type := - (nseq t_group_type 20 × nseq int32 20 × nseq int32 20 × nseq t_group_type 20 × nseq int32 20 × int32). -Equations f_g_pow_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq t_group_type 20) := - f_g_pow_xis s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq t_group_type 20))) : both L I (nseq t_group_type 20). -Fail Next Obligation. -Equations f_zkp_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := - f_zkp_xis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq int32 20))) : both L I (nseq int32 20). -Fail Next Obligation. -Equations f_commit_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := - f_commit_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : nseq int32 20))) : both L I (nseq int32 20). -Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq t_group_type 20) := - f_g_pow_xi_yi_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : nseq t_group_type 20))) : both L I (nseq t_group_type 20). -Fail Next Obligation. -Equations f_zkp_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := - f_zkp_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : nseq int32 20))) : both L I (nseq int32 20). -Fail Next Obligation. -Equations f_tally {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (int32) := - f_tally s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). -Fail Next Obligation. -Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {f_g_pow_xis : both L0 I0 (nseq t_group_type 20)} {f_zkp_xis : both L1 I1 (nseq int32 20)} {f_commit_vis : both L2 I2 (nseq int32 20)} {f_g_pow_xi_yi_vis : both L3 I3 (nseq t_group_type 20)} {f_zkp_vis : both L4 I4 (nseq int32 20)} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := - Build_t_OvnContractState := - bind_both f_tally (fun f_tally => - bind_both f_zkp_vis (fun f_zkp_vis => - bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => - bind_both f_commit_vis (fun f_commit_vis => - bind_both f_zkp_xis (fun f_zkp_xis => - bind_both f_g_pow_xis (fun f_g_pow_xis => - solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). -Fail Next Obligation. -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). - -Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {T : _} `{ t_Sized (T)} `{ t_HasInitContext (T) ('unit)} (ctx : both L1 I1 (T)) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)) := - init_ovn_contract ctx := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat one (ret_both (20 : uint_size))) (f_zkp_xis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_commit_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_g_pow_xi_yi_vis := repeat one (ret_both (20 : uint_size))) (f_zkp_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)). -Fail Next Obligation. - -Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) : both L1 I1 (int32) := - select_private_voting_key random := - solve_lift (random .% q) : both L1 I1 (int32). -Fail Next Obligation. - -Equations v_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi : both L1 I1 (int32)) (xi : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) (int32) := - v_ZKP g_pow_xi xi := - solve_lift (ret_both (0 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). -Fail Next Obligation. - -Definition t_RegisterParam : choice_type := - (int32 × int32). -Equations f_rp_i {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := - f_rp_i s := - bind_both s (fun x => - solve_lift (ret_both (fst x : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_rp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := - f_rp_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). -Fail Next Obligation. -Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (int32)} : both (L0:|:L1) (I0:|:I1) (t_RegisterParam) := - Build_t_RegisterParam := - bind_both f_rp_xi (fun f_rp_xi => - bind_both f_rp_i (fun f_rp_i => - solve_lift (ret_both ((f_rp_i,f_rp_xi) : (t_RegisterParam))))) : both (L0:|:L1) (I0:|:I1) (t_RegisterParam). -Fail Next Obligation. -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y)). - -Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {T : _} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} (ctx : both L1 I1 (T)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := - register_vote ctx state := - Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. - -Definition t_CastVoteParam : choice_type := - (int32 × int32 × 'bool). -Equations f_cvp_i {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_i s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_cvp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_cvp_vote {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I ('bool) := - f_cvp_vote s := - bind_both s (fun x => - solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). -Fail Next Obligation. -Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (int32)} {f_cvp_vote : both L2 I2 ('bool)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := - Build_t_CastVoteParam := - bind_both f_cvp_vote (fun f_cvp_vote => - bind_both f_cvp_xi (fun f_cvp_xi => - bind_both f_cvp_i (fun f_cvp_i => - solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_vote) : (t_CastVoteParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). -Fail Next Obligation. -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := y)). - -Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (int32)) : both L1 I1 ('bool) := - check_valid zkp := - solve_lift (ret_both (true : 'bool)) : both L1 I1 ('bool). -Fail Next Obligation. - -Definition prod2_loc : Location := - (int32 ; 2%nat). -Definition prod1_loc : Location := - (int32 ; 1%nat). - -Equations foldi_both_ - {acc: choice_type} - {L1 L2 L3 I1 I2 I3} - {L I} - `{is_true (fsubset (L1 :|: L2 :|: L3) L)} `{is_true (fsubset (I1 :|: I2 :|: I3) I)} - (lo_hi: both L2 I2 uint_size * both L3 I3 uint_size) - (f: both (L2 :|: L3) (I2 :|: I3) uint_size -> - both L I acc -> - both L I acc) - (init: both L1 I1 acc) - : both L I (acc) := - foldi_both_ lo_hi f init := - foldi (fst lo_hi) (snd lo_hi) (@f) (init). -Solve All Obligations with intros ; (solve_ssprove_obligations || solve_fsubset_trans). -Solve All Obligations with solve_ssprove_obligations ; solve_fsubset_trans. -Fail Next Obligation. - -Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq int32 20)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32) := - compute_group_element_for_vote i xi vote xis := - (letb prod1 loc(prod1_loc) := one in - letb prod1 := foldi_both_ (into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) ((* fun {L I _ _} => *)fun j => - ssp (fun prod1 => - solve_lift (prod prod1 (xis.a[j])) : both (L1 :|: L4 :|: fset [prod1_loc]) (I1 :|: I4) _)) prod1 in - letb prod2 loc(prod2_loc) := one in - letb prod2 := foldi_both (into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) ((* fun {L I _ _} => *)fun j => - ssp (fun prod2 => - solve_lift (prod prod2 (xis.a[j])) : both (L1 :|: L4 :|: fset [prod2_loc]) (I1 :|: I4) _ )) prod2 in - letb Yi := div prod1 prod2 in - solve_lift (prod (pow Yi xi) (g_pow (ifb vote - then ret_both (1 : int32) - else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod2_loc;prod1_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32)). -Fail Next Obligation. - -Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) : both L1 I1 (int32) := - commit_to x := - solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). -Fail Next Obligation. - -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} (ctx : both L1 I1 ((* impl *) HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := - commit_to_vote ctx state := - Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. - -Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (int32)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := - v_ZKP_one_out_of_two g_pow_vi vi := - solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). -Fail Next Obligation. - -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} (ctx : both L1 I1 ((* impl *) HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := - cast_vote ctx state := - Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. - -Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - check_valid2 g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - check_commitment g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Definition t_TallyParameter : choice_type := - 'unit. -Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := - Build_t_TallyParameter := - solve_lift (ret_both ((_) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). -Fail Next Obligation. - -Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} (_ : both L1 I1 ((* impl *) HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := - tally_votes _ state := - Result_Ok (solve_lift (prod_b (accept,state))) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. - -Definition state_OVN : choice_type := - t_OvnContractState. - -From ConCert.Utils Require Import Extras. -From ConCert.Utils Require Import Automation. -From ConCert.Execution Require Import Serializable. -From ConCert.Execution Require Import Blockchain. -From ConCert.Execution Require Import ContractCommon. -Require Import ConCertLib. - -Definition init_OVN {L I} (chain : Chain) (ctx : ContractCallContext) (st : both L I state_OVN) : ResultMonad.result (both L I state_OVN) t_ParseError := - ResultMonad.Ok st. - -Instance sized_RegisterParam : t_Sized t_RegisterParam := { Sized := id }. -Instance has_receive_context_RegisterParam : t_HasReceiveContext t_RegisterParam 'unit. -Admitted. - - -Equations receive_OVN_register {L1 L2 I1 I2} {A : _} {T : _} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} (RegisterParam : both L1 I1 t_RegisterParam) (st : both L2 I2 state_OVN) : both (L1 :|: L2) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := - receive_OVN_register RegisterParam st := - register_vote RegisterParam (st). - -(* Definition receive_OVN_commit_to_vote (CastVoteParam : _) (st : state_OVN) : choice_type := *) -(* commit_to_vote CastVoteParam st. *) - -(* Definition receive_OVN_cast_vote (CastVoteParam : _) (st : state_OVN) : choice_type := *) -(* cast_vote st. *) - -(* Definition receive_OVN_tally (TallyParameter : _) (st : state_OVN) : choice_type := *) -(* tally_votes st. *) - - -Instance sized_state_OVN : t_Sized state_OVN := { Sized := id }. -(* Instance has_receive_context_RegisterParam : t_HasReceiveContext t_RegisterParam 'unit. *) -(* Admitted. *) - -Instance has_actions_state_ovn : t_HasActions state_OVN. -Admitted. - -Inductive Msg_OVN: Type := -| msg_register : forall {L I}, both L I t_RegisterParam -> Msg_OVN -| msg_commit_to_vote : Msg_OVN -| msg_cast_vote : Msg_OVN -| msg_tally : Msg_OVN. -Equations receive_OVN {L I} (chain : Chain) (ctx : ContractCallContext) (st : both L I state_OVN) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (both L I state_OVN * list ActionBody) t_ParseError := - receive_OVN chain ctx st msg := - match msg with - | Some (msg_register val) => - match (is_pure (both_prog (receive_OVN_register val (st)))) with - | inl x => ResultMonad.Ok (solve_lift ret_both (fst x), []) - | inr x => ResultMonad.Err x - end - (* ResultMonad.Ok (solve_lift receive_OVN_register _ (st), []) *) - (* | Some msg_commit_to_vote => *) - (* ResultMonad.Ok (st, []) *) - (* | Some msg_cast_vote => *) - (* ResultMonad.Ok (st, []) *) - (* | Some msg_tally => *) - (* ResultMonad.Ok (st, []) *) - | _ => - ResultMonad.Err _ - end. -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Instance serialize_state_OVN {L I} : Serializable (both L I state_OVN). -Admitted. - -Instance serialize_msg_OVN : Serializable Msg_OVN. -Admitted. - -Program Definition contract_OVN {L I} : Contract (both L I state_OVN) Msg_OVN (both L I state_OVN) t_ParseError := - build_contract init_OVN receive_OVN. From b11332d7f13b9cd605562ac09983747b92d13693 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 11 Oct 2023 10:14:05 +0200 Subject: [PATCH 29/86] Cleanup --- ovn/src/ovn.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/ovn/src/ovn.rs b/ovn/src/ovn.rs index 200e9b3..a84723a 100644 --- a/ovn/src/ovn.rs +++ b/ovn/src/ovn.rs @@ -1,4 +1,4 @@ -#![no_std] +x#![no_std] #![feature(register_tool)] #![register_tool(hax)] @@ -25,7 +25,6 @@ pub trait Group { fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type; fn inv(x: Self::group_type) -> Self::group_type; fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; - // fn random_element() -> Self::group_type; } #[derive(Clone, Copy)] @@ -67,9 +66,6 @@ impl Group for z_17 { fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { Self::prod(x, Self::inv(y)) } - // fn random_element() -> Self::group_type { - - // } } type G = z_17; @@ -141,15 +137,11 @@ pub struct RegisterParam { /** Primary function in round 1 */ #[hax::receive(contract = "OVN", name = "register", parameter = "RegisterParam")] // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "register", parameter = "RegisterParam"))] -// pub fn register_vote( -// ctx: &impl HasReceiveContext, -// state: OvnContractState/* */, -// ) -> Result<(A, OvnContractState/* */), ParseError> { -pub fn register_vote( - ctx: &T, +pub fn register_vote( + ctx: &impl HasReceiveContext, state: OvnContractState/* */, ) -> Result<(A, OvnContractState/* */), ParseError> { - let params : RegisterParam = ctx.parameter_cursor().get()?; // Result? + let params : RegisterParam = ctx.parameter_cursor().get()?; let g_pow_xi = G::g_pow(params.rp_xi); let zkp_xi = ZKP/* :: */(g_pow_xi, params.rp_xi); From c4d8844b4a6757d83f16edfe4b25f42b35900d3b Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 11 Oct 2023 10:16:37 +0200 Subject: [PATCH 30/86] Cleanup --- ovn/src/ovn.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ovn/src/ovn.rs b/ovn/src/ovn.rs index a84723a..9584587 100644 --- a/ovn/src/ovn.rs +++ b/ovn/src/ovn.rs @@ -1,4 +1,4 @@ -x#![no_std] +#![no_std] #![feature(register_tool)] #![register_tool(hax)] @@ -103,8 +103,7 @@ pub struct OvnContractState/* */ { #[hax::init(contract = "OVN")] // #[cfg_attr(not(feature = "hax_compilation"), init(contract = "OVN"))] -// pub fn init_ovn_contract(ctx: &impl HasInitContext) -> Result { -pub fn init_ovn_contract(ctx:&T) -> InitResult { +pub fn init_ovn_contract(_: &impl HasInitContext) -> InitResult { Ok(OvnContractState { g_pow_xis: [G::one(); n], zkp_xis: [0; n], From 2c4d8a3e6301c3caef2379e4c47fc6ce175f5ee9 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Fri, 24 Nov 2023 13:47:17 +0100 Subject: [PATCH 31/86] WIP --- Cargo.toml | 1 + .../extraction/Hacspec_aes_jazz.semantics | 170 ++ .../semantics/extraction/Hacspec_aes_jazz.v | 64 + concordium/hax_frontend_export.json | 1 + .../Hacspec_concordium.Concordium_traits.v | 61 + ...cspec_concordium.Concordium_types.Sealed.v | 17 + .../Hacspec_concordium.Concordium_types.v | 85 + .../extraction/Hacspec_concordium.Constants.v | 15 + .../coq/extraction/Hacspec_concordium.v | 105 + .../Hacspec_concordium.Concordium_traits.fst | 173 ++ ...pec_concordium.Concordium_types.Sealed.fst | 13 + .../Hacspec_concordium.Concordium_types.fst | 53 + .../Hacspec_concordium.Constants.fst | 9 + .../fstar/extraction/Hacspec_concordium.fst | 5 + .../ssprove/extraction/Hacspec_concordium.v | 7 +- .../Hacspec_concordium_Concordium_impls.v | 176 -- .../Hacspec_concordium_Concordium_traits.v | 231 +- .../Hacspec_concordium_Concordium_types.v | 45 +- ...cspec_concordium_Concordium_types_Sealed.v | 12 +- .../extraction/Hacspec_concordium_Constants.v | 4 +- concordium/src/concordium.rs | 4 +- concordium/src/concordium_prims.rs | 9 +- concordium/src/concordium_types.rs | 34 +- ovn/proofs/fstar/extraction/Hacspec_ovn.fst | 508 +++ .../extraction/Hacspec_ovn.semantics | 117 + ovn/proofs/ssprove/extraction/ConCertLib.v | 18 +- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 706 +++-- .../ssprove/extraction/Hacspec_ovn_fixes.v | 501 +++ .../ssprove/extraction/Hacspec_ovn_working.v | 598 ++++ ovn/src/ovn.rs | 43 +- wCCD/Cargo.toml | 33 + wCCD/proofs/ssprove/extraction/Hacspec_wccd.v | 846 +++++ .../ssprove/extraction/Hacspec_wccd_Cis1.v | 1881 ++++++++++++ .../Hacspec_wccd_Export_contract_balance_of.v | 21 +- .../Hacspec_wccd_Export_contract_init.v | 40 + ...Hacspec_wccd_Export_contract_operator_of.v | 40 + ...spec_wccd_Export_contract_token_metadata.v | 40 + .../Hacspec_wccd_Export_contract_transfer.v | 40 + .../Hacspec_wccd_Export_contract_unwrap.v | 40 + ...pec_wccd_Export_contract_update_operator.v | 40 + .../Hacspec_wccd_Export_contract_wrap.v | 40 + wCCD/src/cis1.rs | 1038 +++++++ wCCD/src/wccd.rs | 908 ++++++ wCCD/wccd.org | 2713 +++++++++++++++++ 44 files changed, 10875 insertions(+), 630 deletions(-) create mode 100644 aes_jazz/proofs/semantics/extraction/Hacspec_aes_jazz.semantics create mode 100644 aes_jazz/proofs/semantics/extraction/Hacspec_aes_jazz.v create mode 100644 concordium/hax_frontend_export.json create mode 100644 concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_traits.v create mode 100644 concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_types.Sealed.v create mode 100644 concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_types.v create mode 100644 concordium/proofs/coq/extraction/Hacspec_concordium.Constants.v create mode 100644 concordium/proofs/coq/extraction/Hacspec_concordium.v create mode 100644 concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_traits.fst create mode 100644 concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_types.Sealed.fst create mode 100644 concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_types.fst create mode 100644 concordium/proofs/fstar/extraction/Hacspec_concordium.Constants.fst create mode 100644 concordium/proofs/fstar/extraction/Hacspec_concordium.fst delete mode 100644 concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_impls.v create mode 100644 ovn/proofs/fstar/extraction/Hacspec_ovn.fst create mode 100644 ovn/proofs/semantics/extraction/Hacspec_ovn.semantics create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_fixes.v create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_working.v create mode 100644 wCCD/Cargo.toml create mode 100644 wCCD/proofs/ssprove/extraction/Hacspec_wccd.v create mode 100644 wCCD/proofs/ssprove/extraction/Hacspec_wccd_Cis1.v rename concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_prims.v => wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_balance_of.v (71%) create mode 100644 wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_init.v create mode 100644 wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_operator_of.v create mode 100644 wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_token_metadata.v create mode 100644 wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_transfer.v create mode 100644 wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_unwrap.v create mode 100644 wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_update_operator.v create mode 100644 wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_wrap.v create mode 100644 wCCD/src/cis1.rs create mode 100644 wCCD/src/wccd.rs create mode 100644 wCCD/wccd.org diff --git a/Cargo.toml b/Cargo.toml index 85fcc7e..9e4633b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,4 +26,5 @@ members = [ "ovn", "concordium", "concordium-derive", + "wCCD", ] diff --git a/aes_jazz/proofs/semantics/extraction/Hacspec_aes_jazz.semantics b/aes_jazz/proofs/semantics/extraction/Hacspec_aes_jazz.semantics new file mode 100644 index 0000000..f3ee6ca --- /dev/null +++ b/aes_jazz/proofs/semantics/extraction/Hacspec_aes_jazz.semantics @@ -0,0 +1,170 @@ +(* Automatically Generated Functional Semantics *) +Import Usestd prelude rust_2018 + +(Unimplemented NotImplementedYet) + +Import Usehacspec_lib + +Macro public_bytes((SBox, 256)) + +Macro public_bytes((RCon, 15)) + +Macro public_bytes((PBytes256, 256)) + +Definition v_SBOX := + λ (), SBox [99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22] + +Definition v_RCON := + λ (), RCon [141,1,2,4,8,16,32,64,128,27,54,108,216,171,77] + +Definition index_u32 := + λ (s : int) (i : int), + cast ((rem ((shr s) ((mul i) 32))) ((shl 1) 32)) + +Definition index_u8 := + λ (s : int) (i : int), + cast ((rem ((shr s) ((mul i) 8))) ((shl 1) 8)) + +Definition rebuild_u32 := + λ (s0 : int) (s1 : int) (s2 : int) (s3 : int), + (bitor (cast s0)) ((bitor ((shl (cast s1)) 8)) ((bitor ((shl (cast s2)) 16)) ((shl (cast s3)) 24))) + +Definition rebuild_u128 := + λ (s0 : int) (s1 : int) (s2 : int) (s3 : int), + (bitor (cast s0)) ((bitor ((shl (cast s1)) 32)) ((bitor ((shl (cast s2)) 64)) ((shl (cast s3)) 96))) + +Definition subword := + λ (v : int), + (((rebuild_u32 ((index v_SBOX) ((index_u8 v) 0))) ((index v_SBOX) ((index_u8 v) 1))) ((index v_SBOX) ((index_u8 v) 2))) ((index v_SBOX) ((index_u8 v) 3)) + +Definition rotword := + λ (v : int), + (((rebuild_u32 ((index_u8 v) 1)) ((index_u8 v) 2)) ((index_u8 v) 3)) ((index_u8 v) 0) + +Definition vpshufd1 := + λ (s : int) (o : int) (i : int), + (index_u32 ((shr s) ((mul 32) (cast ((rem ((shr o) ((mul 2) i))) 4))))) 0 + +Definition vpshufd := + λ (s : int) (o : int), + let d1 : int := ((vpshufd1 s) o) 0 in + let d2 : int := ((vpshufd1 s) o) 1 in + let d3 : int := ((vpshufd1 s) o) 2 in + let d4 : int := ((vpshufd1 s) o) 3 in + (((rebuild_u128 d1) d2) d3) d4 + +Definition vshufps := + λ (s1 : int) (s2 : int) (o : int), + let d1 : int := ((vpshufd1 s1) o) 0 in + let d2 : int := ((vpshufd1 s1) o) 1 in + let d3 : int := ((vpshufd1 s2) o) 2 in + let d4 : int := ((vpshufd1 s2) o) 3 in + (((rebuild_u128 d1) d2) d3) d4 + +Definition key_combine := + λ (rkey : int) (temp1 : int) (temp2 : int), + let temp1 := (vpshufd temp1) 255 in + let temp2 := ((vshufps temp2) rkey) 16 in + let rkey := (bitxor rkey) temp2 in + let temp2 := ((vshufps temp2) rkey) 140 in + let rkey := (bitxor rkey) temp2 in + let rkey := (bitxor rkey) temp1 in + (rkey,temp2)is2 + +Definition aeskeygenassist := + λ (v1 : int) (v2 : int), + let x1 := (index_u32 v1) 1 in + let x3 := (index_u32 v1) 3 in + let y0 := subword x1 in + let y1 := (bitxor (rotword y0)) (cast v2) in + let y2 := subword x3 in + let y3 := (bitxor (rotword y2)) (cast v2) in + (((rebuild_u128 y0) y1) y2) y3 + +Definition key_expand := + λ (rcon : int) (rkey : int) (temp2 : int), + let temp1 := (aeskeygenassist rkey) rcon in + ((key_combine rkey) temp1) temp2 + +TypeDefinition t_KeyList :=t_Seq_t + +Definition keys_expand := + λ (key : int), + let rkeys : t_Seq_t := new_under_impl_41 0 in + let key := key in + let rkeys := (push_under_impl_41 rkeys) key in + let temp2 : int := 0 in + let (key,rkeys,temp2) := ((fold (into_iter Range[f_start := 1][f_end := 11])) (key,rkeys,temp2)is3) (λ (key,rkeys,temp2) round, + let rcon := (index v_RCON) round in + let (key_temp,temp2_temp) := ((key_expand rcon) key) temp2 in + let key := key_temp in + let temp2 := temp2_temp in + let rkeys := (push_under_impl_41 rkeys) key in + (key,rkeys,temp2)is3) in + rkeys + +Definition subbytes := + λ (s : int), + (((rebuild_u128 (subword ((index_u32 s) 0))) (subword ((index_u32 s) 1))) (subword ((index_u32 s) 2))) (subword ((index_u32 s) 3)) + +Definition matrix_index := + λ (s : int) (i : int) (j : int), + (index_u8 ((index_u32 s) j)) i + +Definition shiftrows := + λ (s : int), + (((rebuild_u128 ((((rebuild_u32 (((matrix_index s) 0) 0)) (((matrix_index s) 1) 1)) (((matrix_index s) 2) 2)) (((matrix_index s) 3) 3))) ((((rebuild_u32 (((matrix_index s) 0) 1)) (((matrix_index s) 1) 2)) (((matrix_index s) 2) 3)) (((matrix_index s) 3) 0))) ((((rebuild_u32 (((matrix_index s) 0) 2)) (((matrix_index s) 1) 3)) (((matrix_index s) 2) 0)) (((matrix_index s) 3) 1))) ((((rebuild_u32 (((matrix_index s) 0) 3)) (((matrix_index s) 1) 0)) (((matrix_index s) 2) 1)) (((matrix_index s) 3) 2)) + +Definition xtime := + λ (x : int), + let x1 := (shl x) 1 in + let x7 := (shr x) 7 in + let x71 := (bitand x7) 1 in + let x711b := (mul x71) 27 in + (bitxor x1) x711b + +Definition mixcolumn := + λ (c : int) (state : int), + let s0 := ((matrix_index state) 0) c in + let s1 := ((matrix_index state) 1) c in + let s2 := ((matrix_index state) 2) c in + let s3 := ((matrix_index state) 3) c in + let tmp := (bitxor ((bitxor ((bitxor s0) s1)) s2)) s3 in + let r0 := (bitxor ((bitxor s0) tmp)) (xtime ((bitxor s0) s1)) in + let r1 := (bitxor ((bitxor s1) tmp)) (xtime ((bitxor s1) s2)) in + let r2 := (bitxor ((bitxor s2) tmp)) (xtime ((bitxor s2) s3)) in + let r3 := (bitxor ((bitxor s3) tmp)) (xtime ((bitxor s3) s0)) in + (((rebuild_u32 r0) r1) r2) r3 + +Definition mixcolumns := + λ (state : int), + let c0 := (mixcolumn 0) state in + let c1 := (mixcolumn 1) state in + let c2 := (mixcolumn 2) state in + let c3 := (mixcolumn 3) state in + (((rebuild_u128 c0) c1) c2) c3 + +Definition aesenc := + λ (state : int) (rkey : int), + let state := shiftrows state in + let state := subbytes state in + let state := mixcolumns state in + (bitxor state) rkey + +Definition aesenclast := + λ (state : int) (rkey : int), + let state := shiftrows state in + let state := subbytes state in + (bitxor state) rkey + +Definition aes_rounds := + λ (rkeys : t_Seq_t) (inp : int), + let state : int := (bitxor inp) ((index rkeys) 0) in + let state := ((fold (into_iter Range[f_start := 1][f_end := 10])) state) (λ state round, + (aesenc state) ((index rkeys) round)) in + (aesenclast state) ((index rkeys) 10) + +Definition aes := + λ (key : int) (inp : int), + let rkeys := keys_expand key in + (aes_rounds rkeys) inp diff --git a/aes_jazz/proofs/semantics/extraction/Hacspec_aes_jazz.v b/aes_jazz/proofs/semantics/extraction/Hacspec_aes_jazz.v new file mode 100644 index 0000000..efc26b0 --- /dev/null +++ b/aes_jazz/proofs/semantics/extraction/Hacspec_aes_jazz.v @@ -0,0 +1,64 @@ +(* Automatically Generated Functional Semantics *) +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string + +decl x to string diff --git a/concordium/hax_frontend_export.json b/concordium/hax_frontend_export.json new file mode 100644 index 0000000..ae721b5 --- /dev/null +++ b/concordium/hax_frontend_export.json @@ -0,0 +1 @@ +[{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":0}],"index":[0,1]},"span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":0},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":0},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":0},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":["Err"],"segments":[{"ident":["core",{"lo":{"line":1,"col":0},"hi":{"line":1,"col":0},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":0}],"index":[0,1]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[],"index":[1,0]}]},"args":null,"infer_args":false},{"ident":["prelude",{"lo":{"line":1,"col":0},"hi":{"line":1,"col":0},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":0}],"index":[0,1]},"local_id":2},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[{"data":{"TypeNs":"prelude"},"disambiguator":0}],"index":[1,922]}]},"args":null,"infer_args":false},{"ident":["rust_2018",{"lo":{"line":1,"col":0},"hi":{"line":1,"col":0},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":0}],"index":[0,1]},"local_id":3},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[{"data":{"TypeNs":"prelude"},"disambiguator":0},{"data":{"TypeNs":"rust_2018"},"disambiguator":0}],"index":[1,1002]}]},"args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"prelude_import","args":"Empty","tokens":null},"tokens":null}},"id":38,"style":"Outer","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":0},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"core"},"disambiguator":0}],"index":[0,2]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"core"},"disambiguator":0}],"index":[0,2]},"span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":0},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":0},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"ExternCrate":null},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"macro_use","args":"Empty","tokens":null},"tokens":null}},"id":37,"style":"Outer","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":0},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"compiler_builtins"},"disambiguator":0}],"index":[0,3]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"compiler_builtins"},"disambiguator":0}],"index":[0,3]},"span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":0},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":0},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"ExternCrate":null},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"macro_use","args":"Empty","tokens":null},"tokens":null}},"id":36,"style":"Outer","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":0},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"hax_lib_macros"},"disambiguator":0}],"index":[0,166]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"hax_lib_macros"},"disambiguator":0}],"index":[0,166]},"span":{"lo":{"line":10,"col":0},"hi":{"line":10,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":10,"col":0},"hi":{"line":10,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"ExternCrate":null},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::skip","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:9:1: 9:24 (#7), close: concordium/src/concordium.rs:9:1: 9:24 (#7) }"}},"delim":"Parenthesis","tokens":""}},"tokens":null},"tokens":null}},"id":351,"style":"Outer","span":{"lo":{"line":9,"col":0},"hi":{"line":9,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":21}],"index":[0,167]},"span":{"lo":{"line":12,"col":0},"hi":{"line":12,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":12,"col":0},"hi":{"line":12,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":12,"col":4},"hi":{"line":12,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hax_lib_macros","path":[],"index":[9,0]}]}],"segments":[{"ident":["hax_lib_macros",{"lo":{"line":12,"col":4},"hi":{"line":12,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":21}],"index":[0,167]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hax_lib_macros","path":[],"index":[9,0]}]},"args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::skip","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:11:1: 11:24 (#10), close: concordium/src/concordium.rs:11:1: 11:24 (#10) }"}},"delim":"Parenthesis","tokens":""}},"tokens":null},"tokens":null}},"id":353,"style":"Outer","span":{"lo":{"line":11,"col":0},"hi":{"line":11,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"alloc"},"disambiguator":0}],"index":[0,4]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"alloc"},"disambiguator":0}],"index":[0,4]},"span":{"lo":{"line":16,"col":0},"hi":{"line":16,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":16,"col":0},"hi":{"line":16,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"ExternCrate":null},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:14:6: 14:7 (#0), close: concordium/src/concordium.rs:14:31: 14:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":5,"style":"Outer","span":{"lo":{"line":14,"col":0},"hi":{"line":14,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:15:6: 15:7 (#0), close: concordium/src/concordium.rs:15:27: 15:28 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"std\")"}},"tokens":null},"tokens":null}},"id":6,"style":"Outer","span":{"lo":{"line":15,"col":0},"hi":{"line":15,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"ValueNs":"trap"},"disambiguator":0}],"index":[0,5]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"ValueNs":"trap"},"disambiguator":0}],"index":[0,5]},"span":{"lo":{"line":34,"col":0},"hi":{"line":36,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":34,"col":0},"hi":{"line":36,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Fn":[{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":34,"col":18},"hi":{"line":34,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"span":{"lo":{"line":34,"col":11},"hi":{"line":34,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[],"ret":"Never","body":{"ty":"Never","span":{"lo":{"line":34,"col":19},"hi":{"line":36,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":6,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":34,"col":19},"hi":{"line":36,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"stmts":[],"expr":{"ty":"Never","span":{"lo":{"line":35,"col":4},"hi":{"line":35,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[],"output":"Never","c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"RustIntrinsic"}}},"bound_vars":[]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[],"output":"Never","c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"RustIntrinsic"}}},"bound_vars":[]}},"span":{"lo":{"line":35,"col":4},"hi":{"line":35,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"abort"},"disambiguator":0}],"index":[1,1246]}}},"hir_id":null,"attributes":[]},"args":[],"from_hir_call":true,"fn_span":{"lo":{"line":35,"col":4},"hi":{"line":35,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"impl":null}},"hir_id":[5,1],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[5,7],"attributes":[]},"sig_span":{"lo":{"line":34,"col":0},"hi":{"line":34,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:31:6: 31:7 (#0), close: concordium/src/concordium.rs:31:31: 31:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":16,"style":"Outer","span":{"lo":{"line":31,"col":0},"hi":{"line":31,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:32:6: 32:7 (#0), close: concordium/src/concordium.rs:32:61: 32:62 (#0) }"}},"delim":"Parenthesis","tokens":"all(not(feature = \"std\"), not(target_arch = \"wasm32\"))"}},"tokens":null},"tokens":null}},"id":17,"style":"Outer","span":{"lo":{"line":32,"col":0},"hi":{"line":32,"col":62},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"inline","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:33:9: 33:10 (#0), close: concordium/src/concordium.rs:33:16: 33:17 (#0) }"}},"delim":"Parenthesis","tokens":"always"}},"tokens":null},"tokens":null}},"id":18,"style":"Outer","span":{"lo":{"line":33,"col":0},"hi":{"line":33,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":1}],"index":[0,6]},"span":{"lo":{"line":43,"col":0},"hi":{"line":43,"col":90},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":43,"col":0},"hi":{"line":43,"col":90},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":43,"col":8},"hi":{"line":43,"col":89},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[],"segments":[{"ident":["alloc",{"lo":{"line":43,"col":8},"hi":{"line":43,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":1}],"index":[0,6]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"alloc","path":[],"index":[4,0]}]},"args":null,"infer_args":false}],"rename":null},"ListStem"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Re-export."]},"id":19,"style":"Outer","span":{"lo":{"line":40,"col":0},"hi":{"line":40,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:41:6: 41:7 (#0), close: concordium/src/concordium.rs:41:31: 41:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":20,"style":"Outer","span":{"lo":{"line":41,"col":0},"hi":{"line":41,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:42:6: 42:7 (#0), close: concordium/src/concordium.rs:42:27: 42:28 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"std\")"}},"tokens":null},"tokens":null}},"id":21,"style":"Outer","span":{"lo":{"line":42,"col":0},"hi":{"line":42,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":2}],"index":[0,7]},"span":{"lo":{"line":43,"col":16},"hi":{"line":43,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":43,"col":16},"hi":{"line":43,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":43,"col":16},"hi":{"line":43,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Trait"}},{"krate":"alloc","path":[{"data":{"TypeNs":"borrow"},"disambiguator":0},{"data":{"TypeNs":"ToOwned"},"disambiguator":0}],"index":[4,680]}]}],"segments":[{"ident":["alloc",{"lo":{"line":43,"col":8},"hi":{"line":43,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":2}],"index":[0,7]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"alloc","path":[],"index":[4,0]}]},"args":null,"infer_args":false},{"ident":["borrow",{"lo":{"line":43,"col":16},"hi":{"line":43,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":2}],"index":[0,7]},"local_id":2},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"alloc","path":[{"data":{"TypeNs":"borrow"},"disambiguator":0}],"index":[4,661]}]},"args":null,"infer_args":false},{"ident":["ToOwned",{"lo":{"line":43,"col":24},"hi":{"line":43,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":2}],"index":[0,7]},"local_id":3},"res":"Err","args":null,"infer_args":false}],"rename":"ToOwned"},"Single"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Re-export."]},"id":19,"style":"Outer","span":{"lo":{"line":40,"col":0},"hi":{"line":40,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:41:6: 41:7 (#0), close: concordium/src/concordium.rs:41:31: 41:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":20,"style":"Outer","span":{"lo":{"line":41,"col":0},"hi":{"line":41,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:42:6: 42:7 (#0), close: concordium/src/concordium.rs:42:27: 42:28 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"std\")"}},"tokens":null},"tokens":null}},"id":21,"style":"Outer","span":{"lo":{"line":42,"col":0},"hi":{"line":42,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":3}],"index":[0,8]},"span":{"lo":{"line":43,"col":33},"hi":{"line":43,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":43,"col":33},"hi":{"line":43,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":43,"col":33},"hi":{"line":43,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"alloc","path":[{"data":{"TypeNs":"string"},"disambiguator":0}],"index":[4,5410]}]}],"segments":[{"ident":["alloc",{"lo":{"line":43,"col":8},"hi":{"line":43,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":3}],"index":[0,8]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"alloc","path":[],"index":[4,0]}]},"args":null,"infer_args":false},{"ident":["string",{"lo":{"line":43,"col":33},"hi":{"line":43,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":3}],"index":[0,8]},"local_id":2},"res":"Err","args":null,"infer_args":false}],"rename":"string"},"Single"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Re-export."]},"id":19,"style":"Outer","span":{"lo":{"line":40,"col":0},"hi":{"line":40,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:41:6: 41:7 (#0), close: concordium/src/concordium.rs:41:31: 41:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":20,"style":"Outer","span":{"lo":{"line":41,"col":0},"hi":{"line":41,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:42:6: 42:7 (#0), close: concordium/src/concordium.rs:42:27: 42:28 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"std\")"}},"tokens":null},"tokens":null}},"id":21,"style":"Outer","span":{"lo":{"line":42,"col":0},"hi":{"line":42,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":4}],"index":[0,9]},"span":{"lo":{"line":43,"col":41},"hi":{"line":43,"col":55},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":43,"col":41},"hi":{"line":43,"col":55},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":43,"col":41},"hi":{"line":43,"col":55},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Struct"}},{"krate":"alloc","path":[{"data":{"TypeNs":"string"},"disambiguator":0},{"data":{"TypeNs":"String"},"disambiguator":0}],"index":[4,7255]}]}],"segments":[{"ident":["alloc",{"lo":{"line":43,"col":8},"hi":{"line":43,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":4}],"index":[0,9]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"alloc","path":[],"index":[4,0]}]},"args":null,"infer_args":false},{"ident":["string",{"lo":{"line":43,"col":41},"hi":{"line":43,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":4}],"index":[0,9]},"local_id":2},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"alloc","path":[{"data":{"TypeNs":"string"},"disambiguator":0}],"index":[4,5410]}]},"args":null,"infer_args":false},{"ident":["String",{"lo":{"line":43,"col":49},"hi":{"line":43,"col":55},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":4}],"index":[0,9]},"local_id":3},"res":"Err","args":null,"infer_args":false}],"rename":"String"},"Single"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Re-export."]},"id":19,"style":"Outer","span":{"lo":{"line":40,"col":0},"hi":{"line":40,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:41:6: 41:7 (#0), close: concordium/src/concordium.rs:41:31: 41:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":20,"style":"Outer","span":{"lo":{"line":41,"col":0},"hi":{"line":41,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:42:6: 42:7 (#0), close: concordium/src/concordium.rs:42:27: 42:28 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"std\")"}},"tokens":null},"tokens":null}},"id":21,"style":"Outer","span":{"lo":{"line":42,"col":0},"hi":{"line":42,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":5}],"index":[0,10]},"span":{"lo":{"line":43,"col":57},"hi":{"line":43,"col":73},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":43,"col":57},"hi":{"line":43,"col":73},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":43,"col":57},"hi":{"line":43,"col":73},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Trait"}},{"krate":"alloc","path":[{"data":{"TypeNs":"string"},"disambiguator":0},{"data":{"TypeNs":"ToString"},"disambiguator":0}],"index":[4,5642]}]}],"segments":[{"ident":["alloc",{"lo":{"line":43,"col":8},"hi":{"line":43,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":5}],"index":[0,10]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"alloc","path":[],"index":[4,0]}]},"args":null,"infer_args":false},{"ident":["string",{"lo":{"line":43,"col":57},"hi":{"line":43,"col":63},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":5}],"index":[0,10]},"local_id":2},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"alloc","path":[{"data":{"TypeNs":"string"},"disambiguator":0}],"index":[4,5410]}]},"args":null,"infer_args":false},{"ident":["ToString",{"lo":{"line":43,"col":65},"hi":{"line":43,"col":73},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":5}],"index":[0,10]},"local_id":3},"res":"Err","args":null,"infer_args":false}],"rename":"ToString"},"Single"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Re-export."]},"id":19,"style":"Outer","span":{"lo":{"line":40,"col":0},"hi":{"line":40,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:41:6: 41:7 (#0), close: concordium/src/concordium.rs:41:31: 41:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":20,"style":"Outer","span":{"lo":{"line":41,"col":0},"hi":{"line":41,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:42:6: 42:7 (#0), close: concordium/src/concordium.rs:42:27: 42:28 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"std\")"}},"tokens":null},"tokens":null}},"id":21,"style":"Outer","span":{"lo":{"line":42,"col":0},"hi":{"line":42,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":6}],"index":[0,11]},"span":{"lo":{"line":43,"col":75},"hi":{"line":43,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":43,"col":75},"hi":{"line":43,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":43,"col":75},"hi":{"line":43,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"alloc","path":[{"data":{"TypeNs":"vec"},"disambiguator":0}],"index":[4,6116]}]},{"Def":[{"DefKind":{"todo":"Macro(Bang)"}},{"krate":"alloc","path":[{"data":{"TypeNs":"macros"},"disambiguator":0},{"data":{"MacroNs":"vec"},"disambiguator":0}],"index":[4,5]}]}],"segments":[{"ident":["alloc",{"lo":{"line":43,"col":8},"hi":{"line":43,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":6}],"index":[0,11]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"alloc","path":[],"index":[4,0]}]},"args":null,"infer_args":false},{"ident":["vec",{"lo":{"line":43,"col":75},"hi":{"line":43,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":6}],"index":[0,11]},"local_id":2},"res":"Err","args":null,"infer_args":false}],"rename":"vec"},"Single"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Re-export."]},"id":19,"style":"Outer","span":{"lo":{"line":40,"col":0},"hi":{"line":40,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:41:6: 41:7 (#0), close: concordium/src/concordium.rs:41:31: 41:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":20,"style":"Outer","span":{"lo":{"line":41,"col":0},"hi":{"line":41,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:42:6: 42:7 (#0), close: concordium/src/concordium.rs:42:27: 42:28 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"std\")"}},"tokens":null},"tokens":null}},"id":21,"style":"Outer","span":{"lo":{"line":42,"col":0},"hi":{"line":42,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":7}],"index":[0,12]},"span":{"lo":{"line":43,"col":80},"hi":{"line":43,"col":88},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":43,"col":80},"hi":{"line":43,"col":88},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":43,"col":80},"hi":{"line":43,"col":88},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Struct"}},{"krate":"alloc","path":[{"data":{"TypeNs":"vec"},"disambiguator":0},{"data":{"TypeNs":"Vec"},"disambiguator":0}],"index":[4,6696]}]}],"segments":[{"ident":["alloc",{"lo":{"line":43,"col":8},"hi":{"line":43,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":7}],"index":[0,12]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"alloc","path":[],"index":[4,0]}]},"args":null,"infer_args":false},{"ident":["vec",{"lo":{"line":43,"col":80},"hi":{"line":43,"col":83},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":7}],"index":[0,12]},"local_id":2},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"alloc","path":[{"data":{"TypeNs":"vec"},"disambiguator":0}],"index":[4,6116]}]},"args":null,"infer_args":false},{"ident":["Vec",{"lo":{"line":43,"col":85},"hi":{"line":43,"col":88},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":7}],"index":[0,12]},"local_id":3},"res":"Err","args":null,"infer_args":false}],"rename":"Vec"},"Single"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Re-export."]},"id":19,"style":"Outer","span":{"lo":{"line":40,"col":0},"hi":{"line":40,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:41:6: 41:7 (#0), close: concordium/src/concordium.rs:41:31: 41:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":20,"style":"Outer","span":{"lo":{"line":41,"col":0},"hi":{"line":41,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:42:6: 42:7 (#0), close: concordium/src/concordium.rs:42:27: 42:28 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"std\")"}},"tokens":null},"tokens":null}},"id":21,"style":"Outer","span":{"lo":{"line":42,"col":0},"hi":{"line":42,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":8}],"index":[0,13]},"span":{"lo":{"line":47,"col":0},"hi":{"line":47,"col":59},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":47,"col":0},"hi":{"line":47,"col":59},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":47,"col":8},"hi":{"line":47,"col":58},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[],"segments":[{"ident":["core",{"lo":{"line":47,"col":8},"hi":{"line":47,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":8}],"index":[0,13]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[],"index":[1,0]}]},"args":null,"infer_args":false}],"rename":null},"ListStem"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Re-export."]},"id":22,"style":"Outer","span":{"lo":{"line":44,"col":0},"hi":{"line":44,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:45:6: 45:7 (#0), close: concordium/src/concordium.rs:45:31: 45:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":23,"style":"Outer","span":{"lo":{"line":45,"col":0},"hi":{"line":45,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:46:6: 46:7 (#0), close: concordium/src/concordium.rs:46:27: 46:28 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"std\")"}},"tokens":null},"tokens":null}},"id":24,"style":"Outer","span":{"lo":{"line":46,"col":0},"hi":{"line":46,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":9}],"index":[0,14]},"span":{"lo":{"line":47,"col":15},"hi":{"line":47,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":47,"col":15},"hi":{"line":47,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":47,"col":15},"hi":{"line":47,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[{"data":{"TypeNs":"convert"},"disambiguator":0}],"index":[1,2455]}]}],"segments":[{"ident":["core",{"lo":{"line":47,"col":8},"hi":{"line":47,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":9}],"index":[0,14]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[],"index":[1,0]}]},"args":null,"infer_args":false},{"ident":["convert",{"lo":{"line":47,"col":15},"hi":{"line":47,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":9}],"index":[0,14]},"local_id":2},"res":"Err","args":null,"infer_args":false}],"rename":"convert"},"Single"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Re-export."]},"id":22,"style":"Outer","span":{"lo":{"line":44,"col":0},"hi":{"line":44,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:45:6: 45:7 (#0), close: concordium/src/concordium.rs:45:31: 45:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":23,"style":"Outer","span":{"lo":{"line":45,"col":0},"hi":{"line":45,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:46:6: 46:7 (#0), close: concordium/src/concordium.rs:46:27: 46:28 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"std\")"}},"tokens":null},"tokens":null}},"id":24,"style":"Outer","span":{"lo":{"line":46,"col":0},"hi":{"line":46,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":10}],"index":[0,15]},"span":{"lo":{"line":47,"col":24},"hi":{"line":47,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":47,"col":24},"hi":{"line":47,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":47,"col":24},"hi":{"line":47,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[{"data":{"TypeNs":"hash"},"disambiguator":0}],"index":[1,9308]}]}],"segments":[{"ident":["core",{"lo":{"line":47,"col":8},"hi":{"line":47,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":10}],"index":[0,15]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[],"index":[1,0]}]},"args":null,"infer_args":false},{"ident":["hash",{"lo":{"line":47,"col":24},"hi":{"line":47,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":10}],"index":[0,15]},"local_id":2},"res":"Err","args":null,"infer_args":false}],"rename":"hash"},"Single"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Re-export."]},"id":22,"style":"Outer","span":{"lo":{"line":44,"col":0},"hi":{"line":44,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:45:6: 45:7 (#0), close: concordium/src/concordium.rs:45:31: 45:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":23,"style":"Outer","span":{"lo":{"line":45,"col":0},"hi":{"line":45,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:46:6: 46:7 (#0), close: concordium/src/concordium.rs:46:27: 46:28 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"std\")"}},"tokens":null},"tokens":null}},"id":24,"style":"Outer","span":{"lo":{"line":46,"col":0},"hi":{"line":46,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":11}],"index":[0,16]},"span":{"lo":{"line":47,"col":30},"hi":{"line":47,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":47,"col":30},"hi":{"line":47,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":47,"col":30},"hi":{"line":47,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0}],"index":[1,2675]}]}],"segments":[{"ident":["core",{"lo":{"line":47,"col":8},"hi":{"line":47,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":11}],"index":[0,16]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[],"index":[1,0]}]},"args":null,"infer_args":false},{"ident":["marker",{"lo":{"line":47,"col":30},"hi":{"line":47,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":11}],"index":[0,16]},"local_id":2},"res":"Err","args":null,"infer_args":false}],"rename":"marker"},"Single"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Re-export."]},"id":22,"style":"Outer","span":{"lo":{"line":44,"col":0},"hi":{"line":44,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:45:6: 45:7 (#0), close: concordium/src/concordium.rs:45:31: 45:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":23,"style":"Outer","span":{"lo":{"line":45,"col":0},"hi":{"line":45,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:46:6: 46:7 (#0), close: concordium/src/concordium.rs:46:27: 46:28 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"std\")"}},"tokens":null},"tokens":null}},"id":24,"style":"Outer","span":{"lo":{"line":46,"col":0},"hi":{"line":46,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":12}],"index":[0,17]},"span":{"lo":{"line":47,"col":38},"hi":{"line":47,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":47,"col":38},"hi":{"line":47,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":47,"col":38},"hi":{"line":47,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[{"data":{"TypeNs":"mem"},"disambiguator":0}],"index":[1,1467]}]}],"segments":[{"ident":["core",{"lo":{"line":47,"col":8},"hi":{"line":47,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":12}],"index":[0,17]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[],"index":[1,0]}]},"args":null,"infer_args":false},{"ident":["mem",{"lo":{"line":47,"col":38},"hi":{"line":47,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":12}],"index":[0,17]},"local_id":2},"res":"Err","args":null,"infer_args":false}],"rename":"mem"},"Single"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Re-export."]},"id":22,"style":"Outer","span":{"lo":{"line":44,"col":0},"hi":{"line":44,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:45:6: 45:7 (#0), close: concordium/src/concordium.rs:45:31: 45:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":23,"style":"Outer","span":{"lo":{"line":45,"col":0},"hi":{"line":45,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:46:6: 46:7 (#0), close: concordium/src/concordium.rs:46:27: 46:28 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"std\")"}},"tokens":null},"tokens":null}},"id":24,"style":"Outer","span":{"lo":{"line":46,"col":0},"hi":{"line":46,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":13}],"index":[0,18]},"span":{"lo":{"line":47,"col":43},"hi":{"line":47,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":47,"col":43},"hi":{"line":47,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":47,"col":43},"hi":{"line":47,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0}],"index":[1,294]}]}],"segments":[{"ident":["core",{"lo":{"line":47,"col":8},"hi":{"line":47,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":13}],"index":[0,18]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[],"index":[1,0]}]},"args":null,"infer_args":false},{"ident":["num",{"lo":{"line":47,"col":43},"hi":{"line":47,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":13}],"index":[0,18]},"local_id":2},"res":"Err","args":null,"infer_args":false}],"rename":"num"},"Single"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Re-export."]},"id":22,"style":"Outer","span":{"lo":{"line":44,"col":0},"hi":{"line":44,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:45:6: 45:7 (#0), close: concordium/src/concordium.rs:45:31: 45:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":23,"style":"Outer","span":{"lo":{"line":45,"col":0},"hi":{"line":45,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:46:6: 46:7 (#0), close: concordium/src/concordium.rs:46:27: 46:28 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"std\")"}},"tokens":null},"tokens":null}},"id":24,"style":"Outer","span":{"lo":{"line":46,"col":0},"hi":{"line":46,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":14}],"index":[0,19]},"span":{"lo":{"line":47,"col":48},"hi":{"line":47,"col":57},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":47,"col":48},"hi":{"line":47,"col":57},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":47,"col":48},"hi":{"line":47,"col":54},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0}],"index":[1,8464]}]}],"segments":[{"ident":["core",{"lo":{"line":47,"col":8},"hi":{"line":47,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":14}],"index":[0,19]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[],"index":[1,0]}]},"args":null,"infer_args":false},{"ident":["result",{"lo":{"line":47,"col":48},"hi":{"line":47,"col":54},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":14}],"index":[0,19]},"local_id":2},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0}],"index":[1,8464]}]},"args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Re-export."]},"id":22,"style":"Outer","span":{"lo":{"line":44,"col":0},"hi":{"line":44,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:45:6: 45:7 (#0), close: concordium/src/concordium.rs:45:31: 45:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":23,"style":"Outer","span":{"lo":{"line":45,"col":0},"hi":{"line":45,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:46:6: 46:7 (#0), close: concordium/src/concordium.rs:46:27: 46:28 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"std\")"}},"tokens":null},"tokens":null}},"id":24,"style":"Outer","span":{"lo":{"line":46,"col":0},"hi":{"line":46,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":15}],"index":[0,20]},"span":{"lo":{"line":51,"col":0},"hi":{"line":51,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":51,"col":0},"hi":{"line":51,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":51,"col":8},"hi":{"line":51,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"alloc","path":[{"data":{"TypeNs":"collections"},"disambiguator":0}],"index":[4,757]}]}],"segments":[{"ident":["alloc",{"lo":{"line":51,"col":8},"hi":{"line":51,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":15}],"index":[0,20]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"alloc","path":[],"index":[4,0]}]},"args":null,"infer_args":false},{"ident":["collections",{"lo":{"line":51,"col":15},"hi":{"line":51,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":15}],"index":[0,20]},"local_id":2},"res":"Err","args":null,"infer_args":false}],"rename":"collections"},"Single"]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:49:6: 49:7 (#0), close: concordium/src/concordium.rs:49:31: 49:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":25,"style":"Outer","span":{"lo":{"line":49,"col":0},"hi":{"line":49,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:50:6: 50:7 (#0), close: concordium/src/concordium.rs:50:27: 50:28 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"std\")"}},"tokens":null},"tokens":null}},"id":26,"style":"Outer","span":{"lo":{"line":50,"col":0},"hi":{"line":50,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"constants"},"disambiguator":0}],"index":[0,21]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"constants"},"disambiguator":0}],"index":[0,21]},"span":{"lo":{"line":53,"col":0},"hi":{"line":53,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":53,"col":0},"hi":{"line":53,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Mod":[{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"constants"},"disambiguator":0},{"data":{"ValueNs":"MAX_CONTRACT_STATE_SIZE"},"disambiguator":0}],"index":[0,22]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"constants"},"disambiguator":0},{"data":{"ValueNs":"MAX_CONTRACT_STATE_SIZE"},"disambiguator":0}],"index":[0,22]},"span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}},"vis_span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}},"kind":{"Const":[{"Uint":"U32"},{"ty":{"Uint":"U32"},"span":{"lo":{"line":2,"col":41},"hi":{"line":2,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}},"contents":{"Literal":{"lit":{"node":{"Int":[16384,{"Unsigned":"U32"}]},"span":{"lo":{"line":2,"col":41},"hi":{"line":2,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}}},"neg":false}},"hir_id":[22,3],"attributes":[]}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Maximum size of the contract state in bytes."]},"id":41,"style":"Outer","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"constants"},"disambiguator":0},{"data":{"ValueNs":"MAX_LOG_SIZE"},"disambiguator":0}],"index":[0,23]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"constants"},"disambiguator":0},{"data":{"ValueNs":"MAX_LOG_SIZE"},"disambiguator":0}],"index":[0,23]},"span":{"lo":{"line":5,"col":0},"hi":{"line":5,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}},"vis_span":{"lo":{"line":5,"col":0},"hi":{"line":5,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}},"kind":{"Const":[{"Uint":"Usize"},{"ty":{"Uint":"Usize"},"span":{"lo":{"line":5,"col":32},"hi":{"line":5,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}},"contents":{"Literal":{"lit":{"node":{"Int":[512,{"Unsigned":"Usize"}]},"span":{"lo":{"line":5,"col":32},"hi":{"line":5,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}}},"neg":false}},"hir_id":[23,3],"attributes":[]}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Maximum log size."]},"id":42,"style":"Outer","span":{"lo":{"line":4,"col":0},"hi":{"line":4,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"constants"},"disambiguator":0},{"data":{"ValueNs":"MAX_NUM_LOGS"},"disambiguator":0}],"index":[0,24]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"constants"},"disambiguator":0},{"data":{"ValueNs":"MAX_NUM_LOGS"},"disambiguator":0}],"index":[0,24]},"span":{"lo":{"line":8,"col":0},"hi":{"line":8,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}},"vis_span":{"lo":{"line":8,"col":0},"hi":{"line":8,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}},"kind":{"Const":[{"Uint":"Usize"},{"ty":{"Uint":"Usize"},"span":{"lo":{"line":8,"col":32},"hi":{"line":8,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}},"contents":{"Literal":{"lit":{"node":{"Int":[64,{"Unsigned":"Usize"}]},"span":{"lo":{"line":8,"col":32},"hi":{"line":8,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}}},"neg":false}},"hir_id":[24,3],"attributes":[]}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Maximum number of log items."]},"id":43,"style":"Outer","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]}]},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"constants"},"disambiguator":0},{"data":{"ValueNs":"MAX_CONTRACT_STATE_SIZE"},"disambiguator":0}],"index":[0,22]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"constants"},"disambiguator":0},{"data":{"ValueNs":"MAX_CONTRACT_STATE_SIZE"},"disambiguator":0}],"index":[0,22]},"span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}},"vis_span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}},"kind":{"Const":[{"Uint":"U32"},{"ty":{"Uint":"U32"},"span":{"lo":{"line":2,"col":41},"hi":{"line":2,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}},"contents":{"Literal":{"lit":{"node":{"Int":[16384,{"Unsigned":"U32"}]},"span":{"lo":{"line":2,"col":41},"hi":{"line":2,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}}},"neg":false}},"hir_id":[22,3],"attributes":[]}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Maximum size of the contract state in bytes."]},"id":41,"style":"Outer","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"constants"},"disambiguator":0},{"data":{"ValueNs":"MAX_LOG_SIZE"},"disambiguator":0}],"index":[0,23]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"constants"},"disambiguator":0},{"data":{"ValueNs":"MAX_LOG_SIZE"},"disambiguator":0}],"index":[0,23]},"span":{"lo":{"line":5,"col":0},"hi":{"line":5,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}},"vis_span":{"lo":{"line":5,"col":0},"hi":{"line":5,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}},"kind":{"Const":[{"Uint":"Usize"},{"ty":{"Uint":"Usize"},"span":{"lo":{"line":5,"col":32},"hi":{"line":5,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}},"contents":{"Literal":{"lit":{"node":{"Int":[512,{"Unsigned":"Usize"}]},"span":{"lo":{"line":5,"col":32},"hi":{"line":5,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}}},"neg":false}},"hir_id":[23,3],"attributes":[]}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Maximum log size."]},"id":42,"style":"Outer","span":{"lo":{"line":4,"col":0},"hi":{"line":4,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"constants"},"disambiguator":0},{"data":{"ValueNs":"MAX_NUM_LOGS"},"disambiguator":0}],"index":[0,24]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"constants"},"disambiguator":0},{"data":{"ValueNs":"MAX_NUM_LOGS"},"disambiguator":0}],"index":[0,24]},"span":{"lo":{"line":8,"col":0},"hi":{"line":8,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}},"vis_span":{"lo":{"line":8,"col":0},"hi":{"line":8,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}},"kind":{"Const":[{"Uint":"Usize"},{"ty":{"Uint":"Usize"},"span":{"lo":{"line":8,"col":32},"hi":{"line":8,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}},"contents":{"Literal":{"lit":{"node":{"Int":[64,{"Unsigned":"Usize"}]},"span":{"lo":{"line":8,"col":32},"hi":{"line":8,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}}},"neg":false}},"hir_id":[24,3],"attributes":[]}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Maximum number of log items."]},"id":43,"style":"Outer","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/constants.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0}],"index":[0,25]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0}],"index":[0,25]},"span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Mod":[{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":{"TypeNs":"hax_lib_macros"},"disambiguator":0}],"index":[0,168]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":{"TypeNs":"hax_lib_macros"},"disambiguator":0}],"index":[0,168]},"span":{"lo":{"line":5,"col":0},"hi":{"line":5,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":5,"col":0},"hi":{"line":5,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ExternCrate":null},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::skip","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:4:1: 4:24 (#13), close: concordium/src/concordium_prims.rs:4:1: 4:24 (#13) }"}},"delim":"Parenthesis","tokens":""}},"tokens":null},"tokens":null}},"id":355,"style":"Outer","span":{"lo":{"line":4,"col":0},"hi":{"line":4,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"Use","disambiguator":0}],"index":[0,169]},"span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":7,"col":4},"hi":{"line":7,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hax_lib_macros","path":[],"index":[9,0]}]}],"segments":[{"ident":["hax_lib_macros",{"lo":{"line":7,"col":4},"hi":{"line":7,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"Use","disambiguator":0}],"index":[0,169]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hax_lib_macros","path":[],"index":[9,0]}]},"args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::skip","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:6:1: 6:24 (#16), close: concordium/src/concordium_prims.rs:6:1: 6:24 (#16) }"}},"delim":"Parenthesis","tokens":""}},"tokens":null},"tokens":null}},"id":357,"style":"Outer","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"Use","disambiguator":1}],"index":[0,241]},"span":{"lo":{"line":10,"col":0},"hi":{"line":10,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":10,"col":0},"hi":{"line":10,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":10,"col":4},"hi":{"line":10,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hacspec_concordium","path":[],"index":[0,0]}]}],"segments":[{"ident":["crate",{"lo":{"line":10,"col":4},"hi":{"line":10,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"Use","disambiguator":1}],"index":[0,241]},"local_id":1},"res":"Err","args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::skip","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:9:1: 9:8 (#55), close: concordium/src/concordium_prims.rs:9:1: 9:8 (#55) }"}},"delim":"Parenthesis","tokens":""}},"tokens":null},"tokens":null}},"id":448,"style":"Outer","span":{"lo":{"line":9,"col":0},"hi":{"line":9,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0}],"index":[0,26]},"span":{"lo":{"line":12,"col":0},"hi":{"line":14,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":12,"col":0},"hi":{"line":14,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["accept",{"lo":{"line":13,"col":18},"hi":{"line":13,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":13,"col":33},"hi":{"line":13,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":13,"col":24},"hi":{"line":13,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"accept"},"disambiguator":0}],"index":[0,27]},"span":{"lo":{"line":13,"col":4},"hi":{"line":13,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":13,"col":4},"hi":{"line":13,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":1}],"index":[0,28]},"span":{"lo":{"line":16,"col":0},"hi":{"line":19,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":16,"col":0},"hi":{"line":19,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["simple_transfer",{"lo":{"line":18,"col":16},"hi":{"line":18,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":false}},{"Uint":"U64"}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["addr_bytes",{"lo":{"line":18,"col":32},"hi":{"line":18,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["amount",{"lo":{"line":18,"col":55},"hi":{"line":18,"col":61},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":18,"col":74},"hi":{"line":18,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":18,"col":31},"hi":{"line":18,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":1},{"data":{"ValueNs":"simple_transfer"},"disambiguator":0}],"index":[0,29]},"span":{"lo":{"line":18,"col":2},"hi":{"line":18,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":18,"col":2},"hi":{"line":18,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":2}],"index":[0,30]},"span":{"lo":{"line":21,"col":0},"hi":{"line":32,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":21,"col":0},"hi":{"line":32,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["send",{"lo":{"line":23,"col":16},"hi":{"line":23,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"Uint":"U64"},{"Uint":"U64"},{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":false}},{"Uint":"U32"},{"Uint":"U64"},{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":false}},{"Uint":"U32"}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["addr_index",{"lo":{"line":24,"col":6},"hi":{"line":24,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["addr_subindex",{"lo":{"line":25,"col":6},"hi":{"line":25,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["receive_name",{"lo":{"line":26,"col":6},"hi":{"line":26,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["receive_name_len",{"lo":{"line":27,"col":6},"hi":{"line":27,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["amount",{"lo":{"line":28,"col":6},"hi":{"line":28,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["parameter",{"lo":{"line":29,"col":6},"hi":{"line":29,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["parameter_len",{"lo":{"line":30,"col":6},"hi":{"line":30,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":31,"col":10},"hi":{"line":31,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":23,"col":20},"hi":{"line":23,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":2},{"data":{"ValueNs":"send"},"disambiguator":0}],"index":[0,31]},"span":{"lo":{"line":23,"col":2},"hi":{"line":31,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":23,"col":2},"hi":{"line":23,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":3}],"index":[0,32]},"span":{"lo":{"line":34,"col":0},"hi":{"line":38,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":34,"col":0},"hi":{"line":38,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["combine_and",{"lo":{"line":37,"col":16},"hi":{"line":37,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"Uint":"U32"},{"Uint":"U32"}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["l",{"lo":{"line":37,"col":28},"hi":{"line":37,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["r",{"lo":{"line":37,"col":36},"hi":{"line":37,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":37,"col":50},"hi":{"line":37,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":37,"col":27},"hi":{"line":37,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":3},{"data":{"ValueNs":"combine_and"},"disambiguator":0}],"index":[0,33]},"span":{"lo":{"line":37,"col":2},"hi":{"line":37,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":37,"col":2},"hi":{"line":37,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":4}],"index":[0,34]},"span":{"lo":{"line":40,"col":0},"hi":{"line":44,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":40,"col":0},"hi":{"line":44,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["combine_or",{"lo":{"line":43,"col":16},"hi":{"line":43,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"Uint":"U32"},{"Uint":"U32"}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["l",{"lo":{"line":43,"col":27},"hi":{"line":43,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["r",{"lo":{"line":43,"col":35},"hi":{"line":43,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":43,"col":49},"hi":{"line":43,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":43,"col":26},"hi":{"line":43,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":4},{"data":{"ValueNs":"combine_or"},"disambiguator":0}],"index":[0,35]},"span":{"lo":{"line":43,"col":2},"hi":{"line":43,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":43,"col":2},"hi":{"line":43,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":5}],"index":[0,36]},"span":{"lo":{"line":46,"col":0},"hi":{"line":49,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":46,"col":0},"hi":{"line":49,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["get_parameter_size",{"lo":{"line":48,"col":18},"hi":{"line":48,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":48,"col":45},"hi":{"line":48,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":48,"col":36},"hi":{"line":48,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":5},{"data":{"ValueNs":"get_parameter_size"},"disambiguator":0}],"index":[0,37]},"span":{"lo":{"line":48,"col":4},"hi":{"line":48,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":48,"col":4},"hi":{"line":48,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":6}],"index":[0,38]},"span":{"lo":{"line":51,"col":0},"hi":{"line":56,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":51,"col":0},"hi":{"line":56,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["get_parameter_section",{"lo":{"line":55,"col":18},"hi":{"line":55,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":true}},{"Uint":"U32"},{"Uint":"U32"}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["param_bytes",{"lo":{"line":55,"col":40},"hi":{"line":55,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["length",{"lo":{"line":55,"col":62},"hi":{"line":55,"col":68},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["offset",{"lo":{"line":55,"col":75},"hi":{"line":55,"col":81},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":55,"col":94},"hi":{"line":55,"col":94},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":55,"col":39},"hi":{"line":55,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":6},{"data":{"ValueNs":"get_parameter_section"},"disambiguator":0}],"index":[0,39]},"span":{"lo":{"line":55,"col":4},"hi":{"line":55,"col":95},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":55,"col":4},"hi":{"line":55,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":7}],"index":[0,40]},"span":{"lo":{"line":58,"col":0},"hi":{"line":63,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":58,"col":0},"hi":{"line":63,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["get_policy_section",{"lo":{"line":62,"col":16},"hi":{"line":62,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":true}},{"Uint":"U32"},{"Uint":"U32"}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["policy_bytes",{"lo":{"line":62,"col":35},"hi":{"line":62,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["length",{"lo":{"line":62,"col":58},"hi":{"line":62,"col":64},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["offset",{"lo":{"line":62,"col":71},"hi":{"line":62,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":62,"col":90},"hi":{"line":62,"col":90},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":62,"col":34},"hi":{"line":62,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":7},{"data":{"ValueNs":"get_policy_section"},"disambiguator":0}],"index":[0,41]},"span":{"lo":{"line":62,"col":2},"hi":{"line":62,"col":91},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":62,"col":2},"hi":{"line":62,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":8}],"index":[0,42]},"span":{"lo":{"line":65,"col":0},"hi":{"line":71,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":65,"col":0},"hi":{"line":71,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["log_event",{"lo":{"line":70,"col":18},"hi":{"line":70,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":false}},{"Uint":"U32"}],"output":{"Return":{"Int":"I32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["start",{"lo":{"line":70,"col":28},"hi":{"line":70,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["length",{"lo":{"line":70,"col":46},"hi":{"line":70,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":70,"col":65},"hi":{"line":70,"col":65},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":70,"col":27},"hi":{"line":70,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":8},{"data":{"ValueNs":"log_event"},"disambiguator":0}],"index":[0,43]},"span":{"lo":{"line":70,"col":4},"hi":{"line":70,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":70,"col":4},"hi":{"line":70,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":9}],"index":[0,44]},"span":{"lo":{"line":73,"col":0},"hi":{"line":75,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":73,"col":0},"hi":{"line":75,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["load_state",{"lo":{"line":74,"col":18},"hi":{"line":74,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":true}},{"Uint":"U32"},{"Uint":"U32"}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["start",{"lo":{"line":74,"col":29},"hi":{"line":74,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["length",{"lo":{"line":74,"col":45},"hi":{"line":74,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["offset",{"lo":{"line":74,"col":58},"hi":{"line":74,"col":64},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":74,"col":77},"hi":{"line":74,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":74,"col":28},"hi":{"line":74,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":9},{"data":{"ValueNs":"load_state"},"disambiguator":0}],"index":[0,45]},"span":{"lo":{"line":74,"col":4},"hi":{"line":74,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":74,"col":4},"hi":{"line":74,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":10}],"index":[0,46]},"span":{"lo":{"line":77,"col":0},"hi":{"line":79,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":77,"col":0},"hi":{"line":79,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["write_state",{"lo":{"line":78,"col":18},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":true}},{"Uint":"U32"},{"Uint":"U32"}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["start",{"lo":{"line":78,"col":30},"hi":{"line":78,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["length",{"lo":{"line":78,"col":46},"hi":{"line":78,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["offset",{"lo":{"line":78,"col":59},"hi":{"line":78,"col":65},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":78,"col":78},"hi":{"line":78,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":78,"col":29},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":10},{"data":{"ValueNs":"write_state"},"disambiguator":0}],"index":[0,47]},"span":{"lo":{"line":78,"col":4},"hi":{"line":78,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":78,"col":4},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":11}],"index":[0,48]},"span":{"lo":{"line":81,"col":0},"hi":{"line":86,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":81,"col":0},"hi":{"line":86,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["resize_state",{"lo":{"line":84,"col":18},"hi":{"line":84,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"Uint":"U32"}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["new_size",{"lo":{"line":84,"col":31},"hi":{"line":84,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":84,"col":52},"hi":{"line":84,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":84,"col":30},"hi":{"line":84,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":11},{"data":{"ValueNs":"resize_state"},"disambiguator":0}],"index":[0,49]},"span":{"lo":{"line":84,"col":4},"hi":{"line":84,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":84,"col":4},"hi":{"line":84,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":12}],"index":[0,50]},"span":{"lo":{"line":88,"col":0},"hi":{"line":90,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":88,"col":0},"hi":{"line":90,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["state_size",{"lo":{"line":89,"col":18},"hi":{"line":89,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":89,"col":37},"hi":{"line":89,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":89,"col":28},"hi":{"line":89,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":12},{"data":{"ValueNs":"state_size"},"disambiguator":0}],"index":[0,51]},"span":{"lo":{"line":89,"col":4},"hi":{"line":89,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":89,"col":4},"hi":{"line":89,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":13}],"index":[0,52]},"span":{"lo":{"line":92,"col":0},"hi":{"line":96,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":92,"col":0},"hi":{"line":96,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["get_init_origin",{"lo":{"line":95,"col":16},"hi":{"line":95,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":true}}],"output":{"DefaultReturn":{"lo":{"line":95,"col":47},"hi":{"line":95,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["start",{"lo":{"line":95,"col":32},"hi":{"line":95,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":95,"col":47},"hi":{"line":95,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":95,"col":31},"hi":{"line":95,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":13},{"data":{"ValueNs":"get_init_origin"},"disambiguator":0}],"index":[0,53]},"span":{"lo":{"line":95,"col":2},"hi":{"line":95,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":95,"col":2},"hi":{"line":95,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":14}],"index":[0,54]},"span":{"lo":{"line":98,"col":0},"hi":{"line":101,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":98,"col":0},"hi":{"line":101,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["get_receive_invoker",{"lo":{"line":100,"col":16},"hi":{"line":100,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":true}}],"output":{"DefaultReturn":{"lo":{"line":100,"col":51},"hi":{"line":100,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["start",{"lo":{"line":100,"col":36},"hi":{"line":100,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":100,"col":51},"hi":{"line":100,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":100,"col":35},"hi":{"line":100,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":14},{"data":{"ValueNs":"get_receive_invoker"},"disambiguator":0}],"index":[0,55]},"span":{"lo":{"line":100,"col":2},"hi":{"line":100,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":100,"col":2},"hi":{"line":100,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":15}],"index":[0,56]},"span":{"lo":{"line":103,"col":0},"hi":{"line":106,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":103,"col":0},"hi":{"line":106,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["get_receive_self_address",{"lo":{"line":105,"col":16},"hi":{"line":105,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":true}}],"output":{"DefaultReturn":{"lo":{"line":105,"col":56},"hi":{"line":105,"col":56},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["start",{"lo":{"line":105,"col":41},"hi":{"line":105,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":105,"col":56},"hi":{"line":105,"col":56},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":105,"col":40},"hi":{"line":105,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":15},{"data":{"ValueNs":"get_receive_self_address"},"disambiguator":0}],"index":[0,57]},"span":{"lo":{"line":105,"col":2},"hi":{"line":105,"col":57},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":105,"col":2},"hi":{"line":105,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":16}],"index":[0,58]},"span":{"lo":{"line":108,"col":0},"hi":{"line":111,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":108,"col":0},"hi":{"line":111,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["get_receive_self_balance",{"lo":{"line":110,"col":16},"hi":{"line":110,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[],"output":{"Return":{"Uint":"U64"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":110,"col":49},"hi":{"line":110,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":110,"col":40},"hi":{"line":110,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":16},{"data":{"ValueNs":"get_receive_self_balance"},"disambiguator":0}],"index":[0,59]},"span":{"lo":{"line":110,"col":2},"hi":{"line":110,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":110,"col":2},"hi":{"line":110,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":17}],"index":[0,60]},"span":{"lo":{"line":113,"col":0},"hi":{"line":116,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":113,"col":0},"hi":{"line":116,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["get_receive_sender",{"lo":{"line":115,"col":16},"hi":{"line":115,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":true}}],"output":{"DefaultReturn":{"lo":{"line":115,"col":50},"hi":{"line":115,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["start",{"lo":{"line":115,"col":35},"hi":{"line":115,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":115,"col":50},"hi":{"line":115,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":115,"col":34},"hi":{"line":115,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":17},{"data":{"ValueNs":"get_receive_sender"},"disambiguator":0}],"index":[0,61]},"span":{"lo":{"line":115,"col":2},"hi":{"line":115,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":115,"col":2},"hi":{"line":115,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":18}],"index":[0,62]},"span":{"lo":{"line":118,"col":0},"hi":{"line":122,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":118,"col":0},"hi":{"line":122,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["get_slot_time",{"lo":{"line":121,"col":16},"hi":{"line":121,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[],"output":{"Return":{"Uint":"U64"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":121,"col":38},"hi":{"line":121,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":121,"col":29},"hi":{"line":121,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":18},{"data":{"ValueNs":"get_slot_time"},"disambiguator":0}],"index":[0,63]},"span":{"lo":{"line":121,"col":2},"hi":{"line":121,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":121,"col":2},"hi":{"line":121,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]}]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":{"TypeNs":"hax_lib_macros"},"disambiguator":0}],"index":[0,168]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":{"TypeNs":"hax_lib_macros"},"disambiguator":0}],"index":[0,168]},"span":{"lo":{"line":5,"col":0},"hi":{"line":5,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":5,"col":0},"hi":{"line":5,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ExternCrate":null},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::skip","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:4:1: 4:24 (#13), close: concordium/src/concordium_prims.rs:4:1: 4:24 (#13) }"}},"delim":"Parenthesis","tokens":""}},"tokens":null},"tokens":null}},"id":355,"style":"Outer","span":{"lo":{"line":4,"col":0},"hi":{"line":4,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"Use","disambiguator":0}],"index":[0,169]},"span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":7,"col":4},"hi":{"line":7,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hax_lib_macros","path":[],"index":[9,0]}]}],"segments":[{"ident":["hax_lib_macros",{"lo":{"line":7,"col":4},"hi":{"line":7,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"Use","disambiguator":0}],"index":[0,169]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hax_lib_macros","path":[],"index":[9,0]}]},"args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::skip","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:6:1: 6:24 (#16), close: concordium/src/concordium_prims.rs:6:1: 6:24 (#16) }"}},"delim":"Parenthesis","tokens":""}},"tokens":null},"tokens":null}},"id":357,"style":"Outer","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"Use","disambiguator":1}],"index":[0,241]},"span":{"lo":{"line":10,"col":0},"hi":{"line":10,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":10,"col":0},"hi":{"line":10,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":10,"col":4},"hi":{"line":10,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hacspec_concordium","path":[],"index":[0,0]}]}],"segments":[{"ident":["crate",{"lo":{"line":10,"col":4},"hi":{"line":10,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"Use","disambiguator":1}],"index":[0,241]},"local_id":1},"res":"Err","args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::skip","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:9:1: 9:8 (#55), close: concordium/src/concordium_prims.rs:9:1: 9:8 (#55) }"}},"delim":"Parenthesis","tokens":""}},"tokens":null},"tokens":null}},"id":448,"style":"Outer","span":{"lo":{"line":9,"col":0},"hi":{"line":9,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0}],"index":[0,26]},"span":{"lo":{"line":12,"col":0},"hi":{"line":14,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":12,"col":0},"hi":{"line":14,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["accept",{"lo":{"line":13,"col":18},"hi":{"line":13,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":13,"col":33},"hi":{"line":13,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":13,"col":24},"hi":{"line":13,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"accept"},"disambiguator":0}],"index":[0,27]},"span":{"lo":{"line":13,"col":4},"hi":{"line":13,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":13,"col":4},"hi":{"line":13,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":1}],"index":[0,28]},"span":{"lo":{"line":16,"col":0},"hi":{"line":19,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":16,"col":0},"hi":{"line":19,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["simple_transfer",{"lo":{"line":18,"col":16},"hi":{"line":18,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":false}},{"Uint":"U64"}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["addr_bytes",{"lo":{"line":18,"col":32},"hi":{"line":18,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["amount",{"lo":{"line":18,"col":55},"hi":{"line":18,"col":61},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":18,"col":74},"hi":{"line":18,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":18,"col":31},"hi":{"line":18,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":1},{"data":{"ValueNs":"simple_transfer"},"disambiguator":0}],"index":[0,29]},"span":{"lo":{"line":18,"col":2},"hi":{"line":18,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":18,"col":2},"hi":{"line":18,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":2}],"index":[0,30]},"span":{"lo":{"line":21,"col":0},"hi":{"line":32,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":21,"col":0},"hi":{"line":32,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["send",{"lo":{"line":23,"col":16},"hi":{"line":23,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"Uint":"U64"},{"Uint":"U64"},{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":false}},{"Uint":"U32"},{"Uint":"U64"},{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":false}},{"Uint":"U32"}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["addr_index",{"lo":{"line":24,"col":6},"hi":{"line":24,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["addr_subindex",{"lo":{"line":25,"col":6},"hi":{"line":25,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["receive_name",{"lo":{"line":26,"col":6},"hi":{"line":26,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["receive_name_len",{"lo":{"line":27,"col":6},"hi":{"line":27,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["amount",{"lo":{"line":28,"col":6},"hi":{"line":28,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["parameter",{"lo":{"line":29,"col":6},"hi":{"line":29,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["parameter_len",{"lo":{"line":30,"col":6},"hi":{"line":30,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":31,"col":10},"hi":{"line":31,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":23,"col":20},"hi":{"line":23,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":2},{"data":{"ValueNs":"send"},"disambiguator":0}],"index":[0,31]},"span":{"lo":{"line":23,"col":2},"hi":{"line":31,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":23,"col":2},"hi":{"line":23,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":3}],"index":[0,32]},"span":{"lo":{"line":34,"col":0},"hi":{"line":38,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":34,"col":0},"hi":{"line":38,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["combine_and",{"lo":{"line":37,"col":16},"hi":{"line":37,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"Uint":"U32"},{"Uint":"U32"}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["l",{"lo":{"line":37,"col":28},"hi":{"line":37,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["r",{"lo":{"line":37,"col":36},"hi":{"line":37,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":37,"col":50},"hi":{"line":37,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":37,"col":27},"hi":{"line":37,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":3},{"data":{"ValueNs":"combine_and"},"disambiguator":0}],"index":[0,33]},"span":{"lo":{"line":37,"col":2},"hi":{"line":37,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":37,"col":2},"hi":{"line":37,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":4}],"index":[0,34]},"span":{"lo":{"line":40,"col":0},"hi":{"line":44,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":40,"col":0},"hi":{"line":44,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["combine_or",{"lo":{"line":43,"col":16},"hi":{"line":43,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"Uint":"U32"},{"Uint":"U32"}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["l",{"lo":{"line":43,"col":27},"hi":{"line":43,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["r",{"lo":{"line":43,"col":35},"hi":{"line":43,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":43,"col":49},"hi":{"line":43,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":43,"col":26},"hi":{"line":43,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":4},{"data":{"ValueNs":"combine_or"},"disambiguator":0}],"index":[0,35]},"span":{"lo":{"line":43,"col":2},"hi":{"line":43,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":43,"col":2},"hi":{"line":43,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":5}],"index":[0,36]},"span":{"lo":{"line":46,"col":0},"hi":{"line":49,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":46,"col":0},"hi":{"line":49,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["get_parameter_size",{"lo":{"line":48,"col":18},"hi":{"line":48,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":48,"col":45},"hi":{"line":48,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":48,"col":36},"hi":{"line":48,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":5},{"data":{"ValueNs":"get_parameter_size"},"disambiguator":0}],"index":[0,37]},"span":{"lo":{"line":48,"col":4},"hi":{"line":48,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":48,"col":4},"hi":{"line":48,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":6}],"index":[0,38]},"span":{"lo":{"line":51,"col":0},"hi":{"line":56,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":51,"col":0},"hi":{"line":56,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["get_parameter_section",{"lo":{"line":55,"col":18},"hi":{"line":55,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":true}},{"Uint":"U32"},{"Uint":"U32"}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["param_bytes",{"lo":{"line":55,"col":40},"hi":{"line":55,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["length",{"lo":{"line":55,"col":62},"hi":{"line":55,"col":68},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["offset",{"lo":{"line":55,"col":75},"hi":{"line":55,"col":81},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":55,"col":94},"hi":{"line":55,"col":94},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":55,"col":39},"hi":{"line":55,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":6},{"data":{"ValueNs":"get_parameter_section"},"disambiguator":0}],"index":[0,39]},"span":{"lo":{"line":55,"col":4},"hi":{"line":55,"col":95},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":55,"col":4},"hi":{"line":55,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":7}],"index":[0,40]},"span":{"lo":{"line":58,"col":0},"hi":{"line":63,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":58,"col":0},"hi":{"line":63,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["get_policy_section",{"lo":{"line":62,"col":16},"hi":{"line":62,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":true}},{"Uint":"U32"},{"Uint":"U32"}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["policy_bytes",{"lo":{"line":62,"col":35},"hi":{"line":62,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["length",{"lo":{"line":62,"col":58},"hi":{"line":62,"col":64},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["offset",{"lo":{"line":62,"col":71},"hi":{"line":62,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":62,"col":90},"hi":{"line":62,"col":90},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":62,"col":34},"hi":{"line":62,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":7},{"data":{"ValueNs":"get_policy_section"},"disambiguator":0}],"index":[0,41]},"span":{"lo":{"line":62,"col":2},"hi":{"line":62,"col":91},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":62,"col":2},"hi":{"line":62,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":8}],"index":[0,42]},"span":{"lo":{"line":65,"col":0},"hi":{"line":71,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":65,"col":0},"hi":{"line":71,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["log_event",{"lo":{"line":70,"col":18},"hi":{"line":70,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":false}},{"Uint":"U32"}],"output":{"Return":{"Int":"I32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["start",{"lo":{"line":70,"col":28},"hi":{"line":70,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["length",{"lo":{"line":70,"col":46},"hi":{"line":70,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":70,"col":65},"hi":{"line":70,"col":65},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":70,"col":27},"hi":{"line":70,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":8},{"data":{"ValueNs":"log_event"},"disambiguator":0}],"index":[0,43]},"span":{"lo":{"line":70,"col":4},"hi":{"line":70,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":70,"col":4},"hi":{"line":70,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":9}],"index":[0,44]},"span":{"lo":{"line":73,"col":0},"hi":{"line":75,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":73,"col":0},"hi":{"line":75,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["load_state",{"lo":{"line":74,"col":18},"hi":{"line":74,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":true}},{"Uint":"U32"},{"Uint":"U32"}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["start",{"lo":{"line":74,"col":29},"hi":{"line":74,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["length",{"lo":{"line":74,"col":45},"hi":{"line":74,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["offset",{"lo":{"line":74,"col":58},"hi":{"line":74,"col":64},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":74,"col":77},"hi":{"line":74,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":74,"col":28},"hi":{"line":74,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":9},{"data":{"ValueNs":"load_state"},"disambiguator":0}],"index":[0,45]},"span":{"lo":{"line":74,"col":4},"hi":{"line":74,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":74,"col":4},"hi":{"line":74,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":10}],"index":[0,46]},"span":{"lo":{"line":77,"col":0},"hi":{"line":79,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":77,"col":0},"hi":{"line":79,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["write_state",{"lo":{"line":78,"col":18},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":true}},{"Uint":"U32"},{"Uint":"U32"}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["start",{"lo":{"line":78,"col":30},"hi":{"line":78,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["length",{"lo":{"line":78,"col":46},"hi":{"line":78,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],["offset",{"lo":{"line":78,"col":59},"hi":{"line":78,"col":65},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":78,"col":78},"hi":{"line":78,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":78,"col":29},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":10},{"data":{"ValueNs":"write_state"},"disambiguator":0}],"index":[0,47]},"span":{"lo":{"line":78,"col":4},"hi":{"line":78,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":78,"col":4},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":11}],"index":[0,48]},"span":{"lo":{"line":81,"col":0},"hi":{"line":86,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":81,"col":0},"hi":{"line":86,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["resize_state",{"lo":{"line":84,"col":18},"hi":{"line":84,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"Uint":"U32"}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["new_size",{"lo":{"line":84,"col":31},"hi":{"line":84,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":84,"col":52},"hi":{"line":84,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":84,"col":30},"hi":{"line":84,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":11},{"data":{"ValueNs":"resize_state"},"disambiguator":0}],"index":[0,49]},"span":{"lo":{"line":84,"col":4},"hi":{"line":84,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":84,"col":4},"hi":{"line":84,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":12}],"index":[0,50]},"span":{"lo":{"line":88,"col":0},"hi":{"line":90,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":88,"col":0},"hi":{"line":90,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["state_size",{"lo":{"line":89,"col":18},"hi":{"line":89,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":89,"col":37},"hi":{"line":89,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":89,"col":28},"hi":{"line":89,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":12},{"data":{"ValueNs":"state_size"},"disambiguator":0}],"index":[0,51]},"span":{"lo":{"line":89,"col":4},"hi":{"line":89,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":89,"col":4},"hi":{"line":89,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":13}],"index":[0,52]},"span":{"lo":{"line":92,"col":0},"hi":{"line":96,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":92,"col":0},"hi":{"line":96,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["get_init_origin",{"lo":{"line":95,"col":16},"hi":{"line":95,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":true}}],"output":{"DefaultReturn":{"lo":{"line":95,"col":47},"hi":{"line":95,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["start",{"lo":{"line":95,"col":32},"hi":{"line":95,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":95,"col":47},"hi":{"line":95,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":95,"col":31},"hi":{"line":95,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":13},{"data":{"ValueNs":"get_init_origin"},"disambiguator":0}],"index":[0,53]},"span":{"lo":{"line":95,"col":2},"hi":{"line":95,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":95,"col":2},"hi":{"line":95,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":14}],"index":[0,54]},"span":{"lo":{"line":98,"col":0},"hi":{"line":101,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":98,"col":0},"hi":{"line":101,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["get_receive_invoker",{"lo":{"line":100,"col":16},"hi":{"line":100,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":true}}],"output":{"DefaultReturn":{"lo":{"line":100,"col":51},"hi":{"line":100,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["start",{"lo":{"line":100,"col":36},"hi":{"line":100,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":100,"col":51},"hi":{"line":100,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":100,"col":35},"hi":{"line":100,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":14},{"data":{"ValueNs":"get_receive_invoker"},"disambiguator":0}],"index":[0,55]},"span":{"lo":{"line":100,"col":2},"hi":{"line":100,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":100,"col":2},"hi":{"line":100,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":15}],"index":[0,56]},"span":{"lo":{"line":103,"col":0},"hi":{"line":106,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":103,"col":0},"hi":{"line":106,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["get_receive_self_address",{"lo":{"line":105,"col":16},"hi":{"line":105,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":true}}],"output":{"DefaultReturn":{"lo":{"line":105,"col":56},"hi":{"line":105,"col":56},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["start",{"lo":{"line":105,"col":41},"hi":{"line":105,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":105,"col":56},"hi":{"line":105,"col":56},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":105,"col":40},"hi":{"line":105,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":15},{"data":{"ValueNs":"get_receive_self_address"},"disambiguator":0}],"index":[0,57]},"span":{"lo":{"line":105,"col":2},"hi":{"line":105,"col":57},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":105,"col":2},"hi":{"line":105,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":16}],"index":[0,58]},"span":{"lo":{"line":108,"col":0},"hi":{"line":111,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":108,"col":0},"hi":{"line":111,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["get_receive_self_balance",{"lo":{"line":110,"col":16},"hi":{"line":110,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[],"output":{"Return":{"Uint":"U64"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":110,"col":49},"hi":{"line":110,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":110,"col":40},"hi":{"line":110,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":16},{"data":{"ValueNs":"get_receive_self_balance"},"disambiguator":0}],"index":[0,59]},"span":{"lo":{"line":110,"col":2},"hi":{"line":110,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":110,"col":2},"hi":{"line":110,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":17}],"index":[0,60]},"span":{"lo":{"line":113,"col":0},"hi":{"line":116,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":113,"col":0},"hi":{"line":116,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["get_receive_sender",{"lo":{"line":115,"col":16},"hi":{"line":115,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[{"RawPtr":{"ty":{"Uint":"U8"},"mutbl":true}}],"output":{"DefaultReturn":{"lo":{"line":115,"col":50},"hi":{"line":115,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[["start",{"lo":{"line":115,"col":35},"hi":{"line":115,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}]],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":115,"col":50},"hi":{"line":115,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":115,"col":34},"hi":{"line":115,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":17},{"data":{"ValueNs":"get_receive_sender"},"disambiguator":0}],"index":[0,61]},"span":{"lo":{"line":115,"col":2},"hi":{"line":115,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":115,"col":2},"hi":{"line":115,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":18}],"index":[0,62]},"span":{"lo":{"line":118,"col":0},"hi":{"line":122,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":118,"col":0},"hi":{"line":122,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"kind":{"ForeignMod":{"abi":{"Abi":{"todo":"C { unwind: false }"}},"items":[{"ident":["get_slot_time",{"lo":{"line":121,"col":16},"hi":{"line":121,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}],"kind":{"Fn":[{"inputs":[],"output":{"Return":{"Uint":"U64"}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},[],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":121,"col":38},"hi":{"line":121,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"span":{"lo":{"line":121,"col":29},"hi":{"line":121,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0},{"data":"ForeignMod","disambiguator":18},{"data":{"ValueNs":"get_slot_time"},"disambiguator":0}],"index":[0,63]},"span":{"lo":{"line":121,"col":2},"hi":{"line":121,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}},"vis_span":{"lo":{"line":121,"col":2},"hi":{"line":121,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:1:11: 1:12 (#0), close: concordium/src/concordium_prims.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":44,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_prims.rs:2:17: 2:18 (#0), close: concordium/src/concordium_prims.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":45,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_prims.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,64]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,64]},"span":{"lo":{"line":55,"col":0},"hi":{"line":55,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":55,"col":0},"hi":{"line":55,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Mod":[{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"hax_lib_macros"},"disambiguator":0}],"index":[0,170]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"hax_lib_macros"},"disambiguator":0}],"index":[0,170]},"span":{"lo":{"line":5,"col":0},"hi":{"line":5,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":5,"col":0},"hi":{"line":5,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"ExternCrate":null},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::skip","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:4:1: 4:24 (#19), close: concordium/src/concordium_types.rs:4:1: 4:24 (#19) }"}},"delim":"Parenthesis","tokens":""}},"tokens":null},"tokens":null}},"id":359,"style":"Outer","span":{"lo":{"line":4,"col":0},"hi":{"line":4,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Use","disambiguator":0}],"index":[0,171]},"span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":7,"col":4},"hi":{"line":7,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hax_lib_macros","path":[],"index":[9,0]}]}],"segments":[{"ident":["hax_lib_macros",{"lo":{"line":7,"col":4},"hi":{"line":7,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Use","disambiguator":0}],"index":[0,171]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hax_lib_macros","path":[],"index":[9,0]}]},"args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::skip","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:6:1: 6:24 (#22), close: concordium/src/concordium_types.rs:6:1: 6:24 (#22) }"}},"delim":"Parenthesis","tokens":""}},"tokens":null},"tokens":null}},"id":361,"style":"Outer","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Use","disambiguator":1}],"index":[0,240]},"span":{"lo":{"line":10,"col":0},"hi":{"line":10,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":10,"col":0},"hi":{"line":10,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":10,"col":4},"hi":{"line":10,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0}],"index":[1,294]}]}],"segments":[{"ident":["crate",{"lo":{"line":10,"col":4},"hi":{"line":10,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Use","disambiguator":1}],"index":[0,240]},"local_id":1},"res":"Err","args":null,"infer_args":false},{"ident":["num",{"lo":{"line":10,"col":11},"hi":{"line":10,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Use","disambiguator":1}],"index":[0,240]},"local_id":2},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0}],"index":[1,294]}]},"args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::skip","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:9:1: 9:8 (#52), close: concordium/src/concordium_types.rs:9:1: 9:8 (#52) }"}},"delim":"Parenthesis","tokens":""}},"tokens":null},"tokens":null}},"id":446,"style":"Outer","span":{"lo":{"line":9,"col":0},"hi":{"line":9,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]},"span":{"lo":{"line":14,"col":0},"hi":{"line":16,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":14,"col":0},"hi":{"line":16,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Struct":[[{"span":{"lo":{"line":15,"col":4},"hi":{"line":15,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":15,"col":4},"hi":{"line":15,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"ident":["current_contract_state_position",{"lo":{"line":15,"col":15},"hi":{"line":15,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]},"local_id":3},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0},{"data":{"ValueNs":"current_contract_state_position"},"disambiguator":0}],"index":[0,173]},"ty":{"Uint":"U32"},"attributes":[]}],false]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":14,"col":24},"hi":{"line":14,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":14,"col":24},"hi":{"line":14,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," A type representing the constract state bytes."]},"id":60,"style":"Outer","span":{"lo":{"line":12,"col":0},"hi":{"line":12,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":3}],"index":[0,174]},"span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":14,"col":24},"hi":{"line":14,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":14,"col":24},"hi":{"line":14,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]}}},"items":[{"ident":["default",{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":3},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[0,175]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[],"ret":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]}}},"body":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]}}},"span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":10,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]}}},"span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,172]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]},"variant_index":0,"typ_is_record":true,"variant_is_record":true,"typ_is_struct":true},"user_ty":null,"fields":[{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0},{"data":{"ValueNs":"current_contract_state_position"},"disambiguator":0}],"index":[0,173]},"value":{"ty":{"Uint":"U32"},"span":{"lo":{"line":15,"col":4},"hi":{"line":15,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Uint":"U32"},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Uint":"U32"},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"span":{"lo":{"line":15,"col":4},"hi":{"line":15,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[1,2588]}}},"hir_id":null,"attributes":[]},"args":[],"from_hir_call":true,"fn_span":{"lo":{"line":15,"col":4},"hi":{"line":15,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":{"impl":{"Concrete":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":"Impl","disambiguator":6}],"index":[1,32027]},"generics":[]}},"args":[]}}},"hir_id":[175,4],"attributes":[]}}],"base":null}},"hir_id":[175,1],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[175,11],"attributes":[]},"sig_span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":371,"style":"Outer","span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":372,"style":"Outer","span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":372,"style":"Outer","span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Default"]},"call_site":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":185,"col":0},"hi":{"line":185,"col":17},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/default.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/default.rs"}}}},"allow_internal_unstable":["core_intrinsics"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"MacroNs":"Default"},"disambiguator":0}],"index":[1,2591]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0}],"index":[1,2586]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]},"span":{"lo":{"line":20,"col":0},"hi":{"line":22,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":20,"col":0},"hi":{"line":22,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Struct":[[{"span":{"lo":{"line":21,"col":4},"hi":{"line":21,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":21,"col":4},"hi":{"line":21,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"ident":["current_parameter_position",{"lo":{"line":21,"col":15},"hi":{"line":21,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]},"local_id":3},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0},{"data":{"ValueNs":"current_parameter_position"},"disambiguator":0}],"index":[0,177]},"ty":{"Uint":"U32"},"attributes":[]}],false]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":20,"col":20},"hi":{"line":20,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":20,"col":20},"hi":{"line":20,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," A type representing the parameter to init and receive methods."]},"id":63,"style":"Outer","span":{"lo":{"line":19,"col":0},"hi":{"line":19,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":4}],"index":[0,178]},"span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":20,"col":20},"hi":{"line":20,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":20,"col":20},"hi":{"line":20,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]}}},"items":[{"ident":["default",{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":4},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[0,179]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[],"ret":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]}}},"body":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]}}},"span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":10,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]}}},"span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,176]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]},"variant_index":0,"typ_is_record":true,"variant_is_record":true,"typ_is_struct":true},"user_ty":null,"fields":[{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0},{"data":{"ValueNs":"current_parameter_position"},"disambiguator":0}],"index":[0,177]},"value":{"ty":{"Uint":"U32"},"span":{"lo":{"line":21,"col":4},"hi":{"line":21,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Uint":"U32"},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Uint":"U32"},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"span":{"lo":{"line":21,"col":4},"hi":{"line":21,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[1,2588]}}},"hir_id":null,"attributes":[]},"args":[],"from_hir_call":true,"fn_span":{"lo":{"line":21,"col":4},"hi":{"line":21,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":{"impl":{"Concrete":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":"Impl","disambiguator":6}],"index":[1,32027]},"generics":[]}},"args":[]}}},"hir_id":[179,4],"attributes":[]}}],"base":null}},"hir_id":[179,1],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[179,11],"attributes":[]},"sig_span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":373,"style":"Outer","span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":374,"style":"Outer","span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":374,"style":"Outer","span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Default"]},"call_site":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":185,"col":0},"hi":{"line":185,"col":17},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/default.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/default.rs"}}}},"allow_internal_unstable":["core_intrinsics"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"MacroNs":"Default"},"disambiguator":0}],"index":[1,2591]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0}],"index":[1,2586]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]},"span":{"lo":{"line":26,"col":0},"hi":{"line":33,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":26,"col":0},"hi":{"line":33,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Struct":[[{"span":{"lo":{"line":30,"col":4},"hi":{"line":30,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":30,"col":4},"hi":{"line":30,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"ident":["current_attribute_cursor_position",{"lo":{"line":30,"col":15},"hi":{"line":30,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]},"local_id":3},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0},{"data":{"ValueNs":"current_attribute_cursor_position"},"disambiguator":0}],"index":[0,181]},"ty":{"Uint":"U32"},"attributes":[{"kind":{"DocComment":["Line"," Current position of the cursor, starting from 0."]},"id":66,"style":"Outer","span":{"lo":{"line":27,"col":4},"hi":{"line":27,"col":56},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Note that this is only for the variable attributes."]},"id":67,"style":"Outer","span":{"lo":{"line":28,"col":4},"hi":{"line":28,"col":59},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," `created_at` and `valid_to` will require."]},"id":68,"style":"Outer","span":{"lo":{"line":29,"col":4},"hi":{"line":29,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},{"span":{"lo":{"line":32,"col":4},"hi":{"line":32,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":32,"col":4},"hi":{"line":32,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"ident":["remaining_items",{"lo":{"line":32,"col":15},"hi":{"line":32,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]},"local_id":6},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0},{"data":{"ValueNs":"remaining_items"},"disambiguator":0}],"index":[0,182]},"ty":{"Uint":"U16"},"attributes":[{"kind":{"DocComment":["Line"," The number of remaining items in the policy."]},"id":69,"style":"Outer","span":{"lo":{"line":31,"col":4},"hi":{"line":31,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]}],false]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":26,"col":27},"hi":{"line":26,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":26,"col":27},"hi":{"line":26,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," A type representing the attributes, lazily acquired from the host."]},"id":64,"style":"Outer","span":{"lo":{"line":24,"col":0},"hi":{"line":24,"col":70},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":5}],"index":[0,183]},"span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":26,"col":27},"hi":{"line":26,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":26,"col":27},"hi":{"line":26,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]}}},"items":[{"ident":["default",{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":5},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[0,184]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[],"ret":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]}}},"body":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]}}},"span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":17,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]}}},"span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,180]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]},"variant_index":0,"typ_is_record":true,"variant_is_record":true,"typ_is_struct":true},"user_ty":null,"fields":[{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0},{"data":{"ValueNs":"current_attribute_cursor_position"},"disambiguator":0}],"index":[0,181]},"value":{"ty":{"Uint":"U32"},"span":{"lo":{"line":30,"col":4},"hi":{"line":30,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Uint":"U32"},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Uint":"U32"},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"span":{"lo":{"line":30,"col":4},"hi":{"line":30,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[1,2588]}}},"hir_id":null,"attributes":[]},"args":[],"from_hir_call":true,"fn_span":{"lo":{"line":30,"col":4},"hi":{"line":30,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":{"impl":{"Concrete":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":"Impl","disambiguator":6}],"index":[1,32027]},"generics":[]}},"args":[]}}},"hir_id":[184,4],"attributes":[]}},{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0},{"data":{"ValueNs":"remaining_items"},"disambiguator":0}],"index":[0,182]},"value":{"ty":{"Uint":"U16"},"span":{"lo":{"line":32,"col":4},"hi":{"line":32,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Uint":"U16"},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Uint":"U16"},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"span":{"lo":{"line":32,"col":4},"hi":{"line":32,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[1,2588]}}},"hir_id":null,"attributes":[]},"args":[],"from_hir_call":true,"fn_span":{"lo":{"line":32,"col":4},"hi":{"line":32,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":{"impl":{"Concrete":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":"Impl","disambiguator":5}],"index":[1,32025]},"generics":[]}},"args":[]}}},"hir_id":[184,11],"attributes":[]}}],"base":null}},"hir_id":[184,1],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[184,18],"attributes":[]},"sig_span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":375,"style":"Outer","span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":376,"style":"Outer","span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":376,"style":"Outer","span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Default"]},"call_site":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":185,"col":0},"hi":{"line":185,"col":17},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/default.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/default.rs"}}}},"allow_internal_unstable":["core_intrinsics"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"MacroNs":"Default"},"disambiguator":0}],"index":[1,2591]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0}],"index":[1,2586]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]},"span":{"lo":{"line":37,"col":0},"hi":{"line":39,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":37,"col":0},"hi":{"line":39,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Struct":[[{"span":{"lo":{"line":38,"col":4},"hi":{"line":38,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":38,"col":4},"hi":{"line":38,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"ident":["_private_logger",{"lo":{"line":38,"col":15},"hi":{"line":38,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]},"local_id":2},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0},{"data":{"ValueNs":"_private_logger"},"disambiguator":0}],"index":[0,186]},"ty":{"Tuple":[]},"attributes":[]}],false]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":37,"col":17},"hi":{"line":37,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":37,"col":17},"hi":{"line":37,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," A type representing the logger."]},"id":70,"style":"Outer","span":{"lo":{"line":35,"col":0},"hi":{"line":35,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":6}],"index":[0,187]},"span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":37,"col":17},"hi":{"line":37,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":37,"col":17},"hi":{"line":37,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]}}},"items":[{"ident":["default",{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":6},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[0,188]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[],"ret":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]}}},"body":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]}}},"span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":10,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]}}},"span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,185]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]},"variant_index":0,"typ_is_record":true,"variant_is_record":true,"typ_is_struct":true},"user_ty":null,"fields":[{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0},{"data":{"ValueNs":"_private_logger"},"disambiguator":0}],"index":[0,186]},"value":{"ty":{"Tuple":[]},"span":{"lo":{"line":38,"col":4},"hi":{"line":38,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Tuple":[]},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Tuple":[]},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"span":{"lo":{"line":38,"col":4},"hi":{"line":38,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[1,2588]}}},"hir_id":null,"attributes":[]},"args":[],"from_hir_call":true,"fn_span":{"lo":{"line":38,"col":4},"hi":{"line":38,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":{"impl":{"Concrete":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":"Impl","disambiguator":0}],"index":[1,32015]},"generics":[]}},"args":[]}}},"hir_id":[188,4],"attributes":[]}}],"base":null}},"hir_id":[188,1],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[188,11],"attributes":[]},"sig_span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":377,"style":"Outer","span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":378,"style":"Outer","span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":378,"style":"Outer","span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Default"]},"call_site":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":185,"col":0},"hi":{"line":185,"col":17},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/default.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/default.rs"}}}},"allow_internal_unstable":["core_intrinsics"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"MacroNs":"Default"},"disambiguator":0}],"index":[1,2591]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0}],"index":[1,2586]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]},"span":{"lo":{"line":44,"col":0},"hi":{"line":49,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":44,"col":0},"hi":{"line":49,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Enum":[[{"ident":["Full",{"lo":{"line":46,"col":4},"hi":{"line":46,"col":8},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0},{"data":{"TypeNs":"Full"},"disambiguator":0}],"index":[0,190]},"data":{"Unit":[{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]},"local_id":2},{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0},{"data":{"TypeNs":"Full"},"disambiguator":0},{"data":"Ctor","disambiguator":0}],"index":[0,191]}]},"disr_expr":null,"span":{"lo":{"line":46,"col":4},"hi":{"line":46,"col":8},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":[{"kind":{"DocComment":["Line"," The log is full."]},"id":74,"style":"Outer","span":{"lo":{"line":45,"col":4},"hi":{"line":45,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},{"ident":["Malformed",{"lo":{"line":48,"col":4},"hi":{"line":48,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]},"local_id":3},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0},{"data":{"TypeNs":"Malformed"},"disambiguator":0}],"index":[0,192]},"data":{"Unit":[{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]},"local_id":4},{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0},{"data":{"TypeNs":"Malformed"},"disambiguator":0},{"data":"Ctor","disambiguator":0}],"index":[0,193]}]},"disr_expr":null,"span":{"lo":{"line":48,"col":4},"hi":{"line":48,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":[{"kind":{"DocComment":["Line"," The message to log was malformed (e.g., too long)"]},"id":75,"style":"Outer","span":{"lo":{"line":47,"col":4},"hi":{"line":47,"col":57},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]}],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"repr","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:43:7: 43:8 (#0), close: concordium/src/concordium_types.rs:43:10: 43:11 (#0) }"}},"delim":"Parenthesis","tokens":"u8"}},"tokens":null},"tokens":null}},"id":73,"style":"Outer","span":{"lo":{"line":43,"col":0},"hi":{"line":43,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7}],"index":[0,194]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Debug"},"disambiguator":0}],"index":[1,9139]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"items":[{"ident":["fmt",{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":30},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,274]},"name":"Fresh","span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":31},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,275]},"name":"Fresh","span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":32},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[0,276]},"name":"Fresh","span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":1},"attributes":[]},{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"f","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":4}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"ty_span":null,"self_kind":null,"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":3},"attributes":[]}],"ret":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"body":{"ty":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":28,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53916]},"'_"]}}]}},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53917]},"'_"]}}]}},"Str",false]}],"output":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53916]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53917]},"'_"]}}]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53916]},"'_"]}}]}},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53917]},"'_"]}}]}},"Str",false]}],"output":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53916]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53917]},"'_"]}}]}},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0}],"index":[1,9184]}}},"hir_id":null,"attributes":[]},"args":[{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":{"Mut":{"allow_two_phase_borrow":true}},"arg":{"ty":{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"f","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":4}}}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[195,13],"attributes":[]},{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Match":{"scrutinee":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":2}}}},"hir_id":[195,16],"attributes":[]},"arms":[{"pattern":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"subpattern":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Variant":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,189]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0},{"data":{"TypeNs":"Full"},"disambiguator":0}],"index":[0,190]},"variant_index":0,"typ_is_record":false,"variant_is_record":false,"typ_is_struct":false},"substs":[],"subpatterns":[]}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]},"guard":null,"body":{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":"Str","span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Literal":{"lit":{"node":{"Str":["Full","Cooked"]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"neg":false}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[195,22],"attributes":[]},"lint_level":{"Explicit":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":21}},"scope":{"id":21,"data":"Node"},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":[]},{"pattern":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"subpattern":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Variant":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,189]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0},{"data":{"TypeNs":"Malformed"},"disambiguator":0}],"index":[0,192]},"variant_index":1,"typ_is_record":false,"variant_is_record":false,"typ_is_struct":false},"substs":[],"subpatterns":[]}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]},"guard":null,"body":{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":"Str","span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Literal":{"lit":{"node":{"Str":["Malformed","Cooked"]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"neg":false}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[195,27],"attributes":[]},"lint_level":{"Explicit":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":26}},"scope":{"id":26,"data":"Node"},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":[]}]}},"hir_id":[195,15],"attributes":[]}],"from_hir_call":true,"fn_span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":null}},"hir_id":[195,5],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[195,29],"attributes":[]},"sig_span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":395,"style":"Outer","span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":395,"style":"Outer","span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Debug"]},"call_site":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":588,"col":4},"hi":{"line":588,"col":19},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/fmt/mod.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/fmt/mod.rs"}}}},"allow_internal_unstable":["core_intrinsics","fmt_helpers_for_derive"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"macros"},"disambiguator":0},{"data":{"MacroNs":"Debug"},"disambiguator":0}],"index":[1,9142]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"macros"},"disambiguator":0}],"index":[1,9141]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":8}],"index":[0,196]},"span":{"lo":{"line":42,"col":16},"hi":{"line":42,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":16},"hi":{"line":42,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Copy"},"disambiguator":0}],"index":[1,2694]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"items":[]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":396,"style":"Outer","span":{"lo":{"line":42,"col":16},"hi":{"line":42,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Copy"]},"call_site":{"lo":{"line":42,"col":16},"hi":{"line":42,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":458,"col":0},"hi":{"line":458,"col":14},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/marker.rs"}}}},"allow_internal_unstable":["core_intrinsics","derive_clone_copy"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"MacroNs":"Copy"},"disambiguator":0}],"index":[1,2695]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0}],"index":[1,2675]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":9}],"index":[0,197]},"span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"clone"},"disambiguator":0},{"data":{"TypeNs":"Clone"},"disambiguator":0}],"index":[1,2262]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"items":[{"ident":["clone",{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":9},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,198]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":9},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,198]},"local_id":8},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":9},{"data":{"ValueNs":"clone"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,277]},"name":"Fresh","span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":9},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,198]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":9},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,198]},"local_id":1},"attributes":[]}],"ret":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"body":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":6,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":9},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,198]},"local_id":2}}}},"hir_id":[198,4],"attributes":[]}}},"hir_id":[198,3],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[198,7],"attributes":[]},"sig_span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":397,"style":"Outer","span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":398,"style":"Outer","span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":398,"style":"Outer","span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Clone"]},"call_site":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":138,"col":0},"hi":{"line":138,"col":15},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/clone.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/clone.rs"}}}},"allow_internal_unstable":["core_intrinsics","derive_clone_copy"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"clone"},"disambiguator":0},{"data":{"MacroNs":"Clone"},"disambiguator":0}],"index":[1,2265]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"clone"},"disambiguator":0}],"index":[1,2261]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":10}],"index":[0,199]},"span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"StructuralEq"},"disambiguator":0}],"index":[1,2693]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"items":[]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":402,"style":"Outer","span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Eq"]},"call_site":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":302,"col":0},"hi":{"line":302,"col":12},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/cmp.rs"}}}},"allow_internal_unstable":["core_intrinsics","derive_eq","structural_match","no_coverage"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"MacroNs":"Eq"},"disambiguator":0}],"index":[1,2317]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0}],"index":[1,2288]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":11}],"index":[0,200]},"span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"Eq"},"disambiguator":0}],"index":[1,2315]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"items":[{"ident":["assert_receiver_is_total_eq",{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":11},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0}],"index":[0,201]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":11},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0}],"index":[0,201]},"local_id":5},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":11},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,278]},"name":"Fresh","span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":11},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0}],"index":[0,201]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":11},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0}],"index":[0,201]},"local_id":1},"attributes":[]}],"ret":{"Tuple":[]},"body":{"ty":{"Tuple":[]},"span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":3,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":null,"safety_mode":"Safe"}},"hir_id":[201,4],"attributes":[]},"sig_span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":399,"style":"Outer","span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"doc","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:42:30: 42:32 (#31), close: concordium/src/concordium_types.rs:42:30: 42:32 (#31) }"}},"delim":"Parenthesis","tokens":"hidden"}},"tokens":null},"tokens":null}},"id":400,"style":"Outer","span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_coverage","args":"Empty","tokens":null},"tokens":null}},"id":401,"style":"Outer","span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":403,"style":"Outer","span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":403,"style":"Outer","span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Eq"]},"call_site":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":302,"col":0},"hi":{"line":302,"col":12},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/cmp.rs"}}}},"allow_internal_unstable":["core_intrinsics","derive_eq","structural_match","no_coverage"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"MacroNs":"Eq"},"disambiguator":0}],"index":[1,2317]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0}],"index":[1,2288]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":12}],"index":[0,202]},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"StructuralPartialEq"},"disambiguator":0}],"index":[1,2692]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"items":[]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":404,"style":"Outer","span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","PartialEq"]},"call_site":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":236,"col":0},"hi":{"line":236,"col":19},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/cmp.rs"}}}},"allow_internal_unstable":["core_intrinsics","structural_match"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"MacroNs":"PartialEq"},"disambiguator":0}],"index":[1,2314]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0}],"index":[1,2288]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13}],"index":[0,203]},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0}],"index":[1,2310]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"items":[{"ident":["eq",{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":32},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,279]},"name":"Fresh","span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":33},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,280]},"name":"Fresh","span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":1},"attributes":[]},{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"other","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":4}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"ty_span":null,"self_kind":null,"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":3},"attributes":[]}],"ret":"Bool","body":{"ty":"Bool","span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":30,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[{"kind":{"Let":{"remainder_scope":{"id":30,"data":{"Remainder":0}},"init_scope":{"id":5,"data":"Node"},"pattern":{"ty":{"Uint":"U8"},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"__self_tag","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":14}},"ty":{"Uint":"U8"},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"initializer":{"ty":{"Uint":"U8"},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51566]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]}],"output":{"Alias":["Projection",{"substs":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}],"trait_def_id":[{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0}],"index":[1,2734]},{"impl":{"Builtin":{"trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0}],"index":[1,2734]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]}}},"args":[]}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0},{"data":{"TypeNs":"Discriminant"},"disambiguator":0}],"index":[1,2735]}}]},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"RustIntrinsic"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51566]},"'_"]}}]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51566]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]}],"output":{"Alias":["Projection",{"substs":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}],"trait_def_id":[{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0}],"index":[1,2734]},{"impl":{"Builtin":{"trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0}],"index":[1,2734]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]}}},"args":[]}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0},{"data":{"TypeNs":"Discriminant"},"disambiguator":0}],"index":[1,2735]}}]},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"RustIntrinsic"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51566]},"'_"]}}]}},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0}],"index":[1,1415]}}},"hir_id":null,"attributes":[]},"args":[{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":2}}}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[204,11],"attributes":[]}],"from_hir_call":true,"fn_span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":null}},"hir_id":[204,6],"attributes":[]},"else_block":null,"lint_level":{"Explicit":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":13}},"attributes":[]}},"opt_destruction_scope":{"id":5,"data":"Destruction"}},{"kind":{"Let":{"remainder_scope":{"id":30,"data":{"Remainder":1}},"init_scope":{"id":15,"data":"Node"},"pattern":{"ty":{"Uint":"U8"},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"__arg1_tag","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":24}},"ty":{"Uint":"U8"},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"initializer":{"ty":{"Uint":"U8"},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51566]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]}],"output":{"Alias":["Projection",{"substs":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}],"trait_def_id":[{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0}],"index":[1,2734]},{"impl":{"Builtin":{"trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0}],"index":[1,2734]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]}}},"args":[]}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0},{"data":{"TypeNs":"Discriminant"},"disambiguator":0}],"index":[1,2735]}}]},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"RustIntrinsic"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51566]},"'_"]}}]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51566]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]}],"output":{"Alias":["Projection",{"substs":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}],"trait_def_id":[{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0}],"index":[1,2734]},{"impl":{"Builtin":{"trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0}],"index":[1,2734]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]}}},"args":[]}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0},{"data":{"TypeNs":"Discriminant"},"disambiguator":0}],"index":[1,2735]}}]},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"RustIntrinsic"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51566]},"'_"]}}]}},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0}],"index":[1,1415]}}},"hir_id":null,"attributes":[]},"args":[{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"other","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":4}}}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[204,21],"attributes":[]}],"from_hir_call":true,"fn_span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":null}},"hir_id":[204,16],"attributes":[]},"else_block":null,"lint_level":{"Explicit":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":23}},"attributes":[]}},"opt_destruction_scope":{"id":15,"data":"Destruction"}}],"expr":{"ty":"Bool","span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binary":{"op":"Eq","lhs":{"ty":{"Uint":"U8"},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"__self_tag","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":14}}}},"hir_id":[204,26],"attributes":[]},"rhs":{"ty":{"Uint":"U8"},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"__arg1_tag","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":24}}}},"hir_id":[204,28],"attributes":[]}}},"hir_id":[204,25],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[204,31],"attributes":[]},"sig_span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":405,"style":"Outer","span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":406,"style":"Outer","span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":406,"style":"Outer","span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","PartialEq"]},"call_site":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":236,"col":0},"hi":{"line":236,"col":19},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/cmp.rs"}}}},"allow_internal_unstable":["core_intrinsics","structural_match"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"MacroNs":"PartialEq"},"disambiguator":0}],"index":[1,2314]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0}],"index":[1,2288]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]},"span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Unit":[{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]},"local_id":1},{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0},{"data":"Ctor","disambiguator":0}],"index":[0,206]}]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":54,"col":26},"hi":{"line":54,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":54,"col":26},"hi":{"line":54,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Error triggered when a non-zero amount of CCD is sent to a contract"]},"id":76,"style":"Outer","span":{"lo":{"line":51,"col":0},"hi":{"line":51,"col":71},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," init or receive function that is not marked as `payable`."]},"id":77,"style":"Outer","span":{"lo":{"line":52,"col":0},"hi":{"line":52,"col":61},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":14}],"index":[0,207]},"span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":54,"col":26},"hi":{"line":54,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":54,"col":26},"hi":{"line":54,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"clone"},"disambiguator":0},{"data":{"TypeNs":"Clone"},"disambiguator":0}],"index":[1,2262]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},"items":[{"ident":["clone",{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":14},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,208]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":14},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,208]},"local_id":8},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":14},{"data":{"ValueNs":"clone"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,281]},"name":"Fresh","span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},false]},"span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":14},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,208]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":14},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,208]},"local_id":1},"attributes":[]}],"ret":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},"body":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},"span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":6,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},"span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},false]},"span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":14},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,208]},"local_id":2}}}},"hir_id":[208,4],"attributes":[]}}},"hir_id":[208,3],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[208,7],"attributes":[]},"sig_span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":407,"style":"Outer","span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":408,"style":"Outer","span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":408,"style":"Outer","span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Clone"]},"call_site":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":138,"col":0},"hi":{"line":138,"col":15},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/clone.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/clone.rs"}}}},"allow_internal_unstable":["core_intrinsics","derive_clone_copy"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"clone"},"disambiguator":0},{"data":{"MacroNs":"Clone"},"disambiguator":0}],"index":[1,2265]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"clone"},"disambiguator":0}],"index":[1,2261]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":15}],"index":[0,209]},"span":{"lo":{"line":53,"col":16},"hi":{"line":53,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":53,"col":16},"hi":{"line":53,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":54,"col":26},"hi":{"line":54,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":54,"col":26},"hi":{"line":54,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Copy"},"disambiguator":0}],"index":[1,2694]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},"items":[]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":409,"style":"Outer","span":{"lo":{"line":53,"col":16},"hi":{"line":53,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Copy"]},"call_site":{"lo":{"line":53,"col":16},"hi":{"line":53,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":458,"col":0},"hi":{"line":458,"col":14},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/marker.rs"}}}},"allow_internal_unstable":["core_intrinsics","derive_clone_copy"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"MacroNs":"Copy"},"disambiguator":0}],"index":[1,2695]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0}],"index":[1,2675]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16}],"index":[0,210]},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":54,"col":26},"hi":{"line":54,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":54,"col":26},"hi":{"line":54,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Debug"},"disambiguator":0}],"index":[1,9139]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},"items":[{"ident":["fmt",{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,211]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,211]},"local_id":18},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,282]},"name":"Fresh","span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,211]},"local_id":19},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,283]},"name":"Fresh","span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,211]},"local_id":20},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[0,284]},"name":"Fresh","span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},false]},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,211]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,211]},"local_id":1},"attributes":[]},{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"f","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,211]},"local_id":4}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"ty_span":null,"self_kind":null,"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,211]},"local_id":3},"attributes":[]}],"ret":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"body":{"ty":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":16,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53916]},"'_"]}}]}},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53917]},"'_"]}}]}},"Str",false]}],"output":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53916]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53917]},"'_"]}}]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53916]},"'_"]}}]}},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53917]},"'_"]}}]}},"Str",false]}],"output":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53916]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53917]},"'_"]}}]}},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0}],"index":[1,9184]}}},"hir_id":null,"attributes":[]},"args":[{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":{"Mut":{"allow_two_phase_borrow":true}},"arg":{"ty":{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"f","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,211]},"local_id":4}}}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[211,13],"attributes":[]},{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":"Str","span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Literal":{"lit":{"node":{"Str":["NotPayableError","Cooked"]},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"neg":false}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[211,15],"attributes":[]}],"from_hir_call":true,"fn_span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":null}},"hir_id":[211,5],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[211,17],"attributes":[]},"sig_span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":410,"style":"Outer","span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":410,"style":"Outer","span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Debug"]},"call_site":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":588,"col":4},"hi":{"line":588,"col":19},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/fmt/mod.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/fmt/mod.rs"}}}},"allow_internal_unstable":["core_intrinsics","fmt_helpers_for_derive"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"macros"},"disambiguator":0},{"data":{"MacroNs":"Debug"},"disambiguator":0}],"index":[1,9142]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"macros"},"disambiguator":0}],"index":[1,9141]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0}],"index":[0,65]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0}],"index":[0,65]},"span":{"lo":{"line":64,"col":0},"hi":{"line":66,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":64,"col":0},"hi":{"line":66,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Struct":[[{"span":{"lo":{"line":65,"col":4},"hi":{"line":65,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":65,"col":4},"hi":{"line":65,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"ident":["_private_action",{"lo":{"line":65,"col":15},"hi":{"line":65,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0}],"index":[0,65]},"local_id":3},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0},{"data":{"ValueNs":"_private_action"},"disambiguator":0}],"index":[0,66]},"ty":{"Uint":"U32"},"attributes":[]}],false]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":64,"col":17},"hi":{"line":64,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":64,"col":17},"hi":{"line":64,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Actions that can be produced at the end of a contract execution. This"]},"id":79,"style":"Outer","span":{"lo":{"line":56,"col":0},"hi":{"line":56,"col":73},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," type is deliberately not cloneable so that we can enforce that"]},"id":80,"style":"Outer","span":{"lo":{"line":57,"col":0},"hi":{"line":57,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," `and_then` and `or_else` can only be used when more than one event is"]},"id":81,"style":"Outer","span":{"lo":{"line":58,"col":0},"hi":{"line":58,"col":73},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," created."]},"id":82,"style":"Outer","span":{"lo":{"line":59,"col":0},"hi":{"line":59,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":83,"style":"Outer","span":{"lo":{"line":60,"col":0},"hi":{"line":60,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," This type is marked as `must_use` since functions that produce"]},"id":84,"style":"Outer","span":{"lo":{"line":61,"col":0},"hi":{"line":61,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," values of the type are effectful."]},"id":85,"style":"Outer","span":{"lo":{"line":62,"col":0},"hi":{"line":62,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"must_use","args":"Empty","tokens":null},"tokens":null}},"id":86,"style":"Outer","span":{"lo":{"line":63,"col":0},"hi":{"line":63,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":0}],"index":[0,67]},"span":{"lo":{"line":68,"col":0},"hi":{"line":72,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":68,"col":0},"hi":{"line":72,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":68,"col":11},"hi":{"line":68,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":68,"col":4},"hi":{"line":68,"col":4},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":null,"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0}],"index":[0,65]}}},"items":[{"ident":["tag",{"lo":{"line":69,"col":11},"hi":{"line":69,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":0},{"data":{"ValueNs":"tag"},"disambiguator":0}],"index":[0,68]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":0},{"data":{"ValueNs":"tag"},"disambiguator":0}],"index":[0,68]},"local_id":8},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":0},{"data":{"ValueNs":"tag"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,242]},"name":"Fresh","span":{"lo":{"line":69,"col":15},"hi":{"line":69,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":69,"col":28},"hi":{"line":69,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":69,"col":14},"hi":{"line":69,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0}],"index":[0,65]}}},false]},"span":{"lo":{"line":69,"col":15},"hi":{"line":69,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":0},{"data":{"ValueNs":"tag"},"disambiguator":0}],"index":[0,68]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0}],"index":[0,65]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0}],"index":[0,65]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":0},{"data":{"ValueNs":"tag"},"disambiguator":0}],"index":[0,68]},"local_id":1},"attributes":[]}],"ret":{"Uint":"U32"},"body":{"ty":{"Uint":"U32"},"span":{"lo":{"line":69,"col":29},"hi":{"line":71,"col":5},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":6,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":69,"col":29},"hi":{"line":71,"col":5},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Uint":"U32"},"span":{"lo":{"line":70,"col":8},"hi":{"line":70,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Field":{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0},{"data":{"ValueNs":"_private_action"},"disambiguator":0}],"index":[0,66]},"lhs":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0}],"index":[0,65]}}},"span":{"lo":{"line":70,"col":8},"hi":{"line":70,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0}],"index":[0,65]}}},false]},"span":{"lo":{"line":70,"col":8},"hi":{"line":70,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":0},{"data":{"ValueNs":"tag"},"disambiguator":0}],"index":[0,68]},"local_id":2}}}},"hir_id":null,"attributes":[]}}},"hir_id":[68,4],"attributes":[]}}},"hir_id":[68,3],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[68,7],"attributes":[]},"sig_span":{"lo":{"line":69,"col":4},"hi":{"line":69,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":69,"col":4},"hi":{"line":71,"col":5},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":69,"col":4},"hi":{"line":69,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"ValueNs":"_"},"disambiguator":0}],"index":[0,220]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"ValueNs":"_"},"disambiguator":0}],"index":[0,220]},"span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Const":[{"Tuple":[]},{"ty":{"Tuple":[]},"span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":4,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":null,"safety_mode":"Safe"}},"hir_id":[220,2],"attributes":[]}]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:80:1: 80:34 (#40), close: concordium/src/concordium_types.rs:80:1: 80:34 (#40) }"}},"delim":"Parenthesis","tokens":"hax_compilation"}},"tokens":null},"tokens":null}},"id":423,"style":"Outer","span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Attr","hax_lib_macros::hax_attributes"]},"call_site":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":74,"col":0},"hi":{"line":74,"col":19},"filename":{"Real":{"LocalPath":"/home/au538501/Documents/LocalHacspec/hacspec-v2/hax-lib-macros/src/lib.rs"}}},"allow_internal_unstable":null,"edition":"Edition2021","macro_def_id":{"krate":"hax_lib_macros","path":[{"data":{"MacroNs":"hax_attributes"},"disambiguator":0}],"index":[9,35]},"parent_module":{"krate":"hax_lib_macros","path":[],"index":[9,0]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]},"span":{"lo":{"line":81,"col":0},"hi":{"line":84,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":81,"col":0},"hi":{"line":84,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Struct":[[{"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"ident":["error_code",{"lo":{"line":83,"col":8},"hi":{"line":83,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]},"local_id":3},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0},{"data":{"ValueNs":"error_code"},"disambiguator":0}],"index":[0,223]},"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::uuid","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:80:1: 80:34 (#40), close: concordium/src/concordium_types.rs:80:1: 80:34 (#40) }"}},"delim":"Parenthesis","tokens":"\"47dd5abfb2084d42b68d2ab170d0aa95\""}},"tokens":null},"tokens":null}},"id":432,"style":"Outer","span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]}],false]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"doc","args":{"Todo":"Eq(concordium/src/concordium_types.rs:74:1: 74:75 (#0), Hir(MetaItemLit { symbol: \" An error message, signalling rejection of a smart contract invocation.\", suffix: None, kind: Str(\" An error message, signalling rejection of a smart contract invocation.\", Cooked), span: concordium/src/concordium_types.rs:74:1: 74:75 (#0) }))"},"tokens":null},"tokens":null}},"id":426,"style":"Outer","span":{"lo":{"line":74,"col":0},"hi":{"line":74,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"doc","args":{"Todo":"Eq(concordium/src/concordium_types.rs:75:1: 75:74 (#0), Hir(MetaItemLit { symbol: \" The client will see the error code as a reject reason; if a schema is\", suffix: None, kind: Str(\" The client will see the error code as a reject reason; if a schema is\", Cooked), span: concordium/src/concordium_types.rs:75:1: 75:74 (#0) }))"},"tokens":null},"tokens":null}},"id":427,"style":"Outer","span":{"lo":{"line":75,"col":0},"hi":{"line":75,"col":73},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"doc","args":{"Todo":"Eq(concordium/src/concordium_types.rs:76:1: 76:72 (#0), Hir(MetaItemLit { symbol: \" provided, the error message corresponding to the error code will be\", suffix: None, kind: Str(\" provided, the error message corresponding to the error code will be\", Cooked), span: concordium/src/concordium_types.rs:76:1: 76:72 (#0) }))"},"tokens":null},"tokens":null}},"id":428,"style":"Outer","span":{"lo":{"line":76,"col":0},"hi":{"line":76,"col":71},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"doc","args":{"Todo":"Eq(concordium/src/concordium_types.rs:77:1: 77:74 (#0), Hir(MetaItemLit { symbol: \" displayed. The valid range for an error code is from i32::MIN to -1.\", suffix: None, kind: Str(\" displayed. The valid range for an error code is from i32::MIN to -1.\", Cooked), span: concordium/src/concordium_types.rs:77:1: 77:74 (#0) }))"},"tokens":null},"tokens":null}},"id":429,"style":"Outer","span":{"lo":{"line":77,"col":0},"hi":{"line":77,"col":73},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"repr","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:79:7: 79:20 (#0), close: concordium/src/concordium_types.rs:79:7: 79:20 (#0) }"}},"delim":"Parenthesis","tokens":"transparent"}},"tokens":null},"tokens":null}},"id":430,"style":"Outer","span":{"lo":{"line":79,"col":0},"hi":{"line":79,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17}],"index":[0,212]},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Debug"},"disambiguator":0}],"index":[1,9139]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"items":[{"ident":["fmt",{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"local_id":24},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,285]},"name":"Fresh","span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"local_id":25},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,286]},"name":"Fresh","span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"local_id":26},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[0,287]},"name":"Fresh","span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"local_id":1},"attributes":[]},{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"f","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"local_id":4}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"ty_span":null,"self_kind":null,"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"local_id":3},"attributes":[]}],"ret":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"body":{"ty":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":22,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'b"},"disambiguator":0}],"index":[1,9200]},"'b"]}}]}},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53932]},"'_"]}}]}},"Str",false]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":2,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53933]},"'_"]}}]}},"Str",false]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":3,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[1,53934]},"'_"]}}]}},{"Dynamic":[[{"value":{"ExistentialPredicate":{"todo":"Trait(core::fmt::Debug)"}},"bound_vars":[]}],{"kind":{"ReLateBound":[0,{"var":3,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[1,53934]},"'_"]}}]}},"Dyn"]},false]}],"output":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'b"},"disambiguator":0}],"index":[1,9200]},"'b"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53932]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53933]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[1,53934]},"'_"]}}]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'b"},"disambiguator":0}],"index":[1,9200]},"'b"]}}]}},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53932]},"'_"]}}]}},"Str",false]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":2,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53933]},"'_"]}}]}},"Str",false]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":3,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[1,53934]},"'_"]}}]}},{"Dynamic":[[{"value":{"ExistentialPredicate":{"todo":"Trait(core::fmt::Debug)"}},"bound_vars":[]}],{"kind":{"ReLateBound":[0,{"var":3,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[1,53934]},"'_"]}}]}},"Dyn"]},false]}],"output":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'b"},"disambiguator":0}],"index":[1,9200]},"'b"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53932]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53933]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[1,53934]},"'_"]}}]}},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0}],"index":[1,9199]}}},"hir_id":null,"attributes":[]},"args":[{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":{"Mut":{"allow_two_phase_borrow":true}},"arg":{"ty":{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"f","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"local_id":4}}}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[213,13],"attributes":[]},{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":"Str","span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Literal":{"lit":{"node":{"Str":["Reject","Cooked"]},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"neg":false}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[213,15],"attributes":[]},{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":"Str","span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Literal":{"lit":{"node":{"Str":["error_code","Cooked"]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"neg":false}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[213,16],"attributes":[]},{"ty":{"Ref":[{"kind":"ReErased"},{"Dynamic":[[{"value":{"ExistentialPredicate":{"todo":"Trait(core::fmt::Debug)"}},"bound_vars":[]}],{"kind":"ReErased"},"Dyn"]},false]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Pointer":{"cast":"Unsize","source":{"ty":{"Ref":[{"kind":"ReErased"},{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]},false]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]},false]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Field":{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0},{"data":{"ValueNs":"error_code"},"disambiguator":0}],"index":[0,223]},"lhs":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"local_id":2}}}},"hir_id":null,"attributes":[]}}},"hir_id":[213,20],"attributes":[]}}},"hir_id":[213,19],"attributes":[]}}},"hir_id":[213,18],"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[213,17],"attributes":[]}],"from_hir_call":true,"fn_span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":null}},"hir_id":[213,5],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[213,23],"attributes":[]},"sig_span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":411,"style":"Outer","span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":411,"style":"Outer","span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Debug"]},"call_site":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":588,"col":4},"hi":{"line":588,"col":19},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/fmt/mod.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/fmt/mod.rs"}}}},"allow_internal_unstable":["core_intrinsics","fmt_helpers_for_derive"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"macros"},"disambiguator":0},{"data":{"MacroNs":"Debug"},"disambiguator":0}],"index":[1,9142]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"macros"},"disambiguator":0}],"index":[1,9141]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":18}],"index":[0,214]},"span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"StructuralEq"},"disambiguator":0}],"index":[1,2693]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"items":[]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":415,"style":"Outer","span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Eq"]},"call_site":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":302,"col":0},"hi":{"line":302,"col":12},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/cmp.rs"}}}},"allow_internal_unstable":["core_intrinsics","derive_eq","structural_match","no_coverage"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"MacroNs":"Eq"},"disambiguator":0}],"index":[1,2317]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0}],"index":[1,2288]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":19}],"index":[0,215]},"span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"Eq"},"disambiguator":0}],"index":[1,2315]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"items":[{"ident":["assert_receiver_is_total_eq",{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":19},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0}],"index":[0,216]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":19},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0}],"index":[0,216]},"local_id":14},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":19},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,288]},"name":"Fresh","span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":19},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0}],"index":[0,216]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":19},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0}],"index":[0,216]},"local_id":1},"attributes":[]}],"ret":{"Tuple":[]},"body":{"ty":{"Tuple":[]},"span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":12,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[{"kind":{"Let":{"remainder_scope":{"id":12,"data":{"Remainder":0}},"init_scope":{"id":3,"data":"Node"},"pattern":{"ty":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"AssertParamIsEq"},"disambiguator":0}],"index":[1,2318]}}},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"AscribeUserType":{"ascription":{"annotation":{"user_ty":{"max_universe":0,"variables":[],"value":{"Todo":"Ty(core::cmp::AssertParamIsEq)"}},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"inferred_ty":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"AssertParamIsEq"},"disambiguator":0}],"index":[1,2318]}}}},"variance":"Covariant"},"subpattern":{"ty":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"AssertParamIsEq"},"disambiguator":0}],"index":[1,2318]}}},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":"Wild","hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]},"initializer":null,"else_block":null,"lint_level":{"Explicit":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":19},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0}],"index":[0,216]},"local_id":10}},"attributes":[]}},"opt_destruction_scope":{"id":3,"data":"Destruction"}}],"expr":null,"safety_mode":"Safe"}},"hir_id":[216,13],"attributes":[]},"sig_span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":412,"style":"Outer","span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"doc","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:78:17: 78:19 (#37), close: concordium/src/concordium_types.rs:78:17: 78:19 (#37) }"}},"delim":"Parenthesis","tokens":"hidden"}},"tokens":null},"tokens":null}},"id":413,"style":"Outer","span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_coverage","args":"Empty","tokens":null},"tokens":null}},"id":414,"style":"Outer","span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":416,"style":"Outer","span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":416,"style":"Outer","span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Eq"]},"call_site":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":302,"col":0},"hi":{"line":302,"col":12},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/cmp.rs"}}}},"allow_internal_unstable":["core_intrinsics","derive_eq","structural_match","no_coverage"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"MacroNs":"Eq"},"disambiguator":0}],"index":[1,2317]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0}],"index":[1,2288]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":20}],"index":[0,217]},"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"StructuralPartialEq"},"disambiguator":0}],"index":[1,2692]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"items":[]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":417,"style":"Outer","span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","PartialEq"]},"call_site":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":236,"col":0},"hi":{"line":236,"col":19},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/cmp.rs"}}}},"allow_internal_unstable":["core_intrinsics","structural_match"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"MacroNs":"PartialEq"},"disambiguator":0}],"index":[1,2314]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0}],"index":[1,2288]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21}],"index":[0,218]},"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0}],"index":[1,2310]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"items":[{"ident":["eq",{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,219]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,219]},"local_id":14},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,289]},"name":"Fresh","span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,219]},"local_id":15},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,290]},"name":"Fresh","span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,219]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,219]},"local_id":1},"attributes":[]},{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"other","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,219]},"local_id":4}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"ty_span":null,"self_kind":null,"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,219]},"local_id":3},"attributes":[]}],"ret":"Bool","body":{"ty":"Bool","span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":12,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":"Bool","span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51736]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,51737]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]}],"output":"Bool","c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51736]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,51737]},"'_"]}}]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51736]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,51737]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]}],"output":"Bool","c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51736]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,51737]},"'_"]}}]}},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[1,2312]}}},"hir_id":null,"attributes":[]},"args":[{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Field":{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0},{"data":{"ValueNs":"error_code"},"disambiguator":0}],"index":[0,223]},"lhs":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,219]},"local_id":2}}}},"hir_id":null,"attributes":[]}}},"hir_id":[219,7],"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[219,6],"attributes":[]},{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Field":{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0},{"data":{"ValueNs":"error_code"},"disambiguator":0}],"index":[0,223]},"lhs":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"other","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,219]},"local_id":4}}}},"hir_id":null,"attributes":[]}}},"hir_id":[219,10],"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[219,9],"attributes":[]}],"from_hir_call":false,"fn_span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":{"impl":{"Concrete":{"id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":"Impl","disambiguator":209}],"index":[1,22494]},"generics":[]}},"args":[]}}},"hir_id":[219,5],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[219,13],"attributes":[]},"sig_span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":418,"style":"Outer","span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":419,"style":"Outer","span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":419,"style":"Outer","span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","PartialEq"]},"call_site":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":236,"col":0},"hi":{"line":236,"col":19},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/cmp.rs"}}}},"allow_internal_unstable":["core_intrinsics","structural_match"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"MacroNs":"PartialEq"},"disambiguator":0}],"index":[1,2314]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0}],"index":[1,2288]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":1}],"index":[0,69]},"span":{"lo":{"line":87,"col":0},"hi":{"line":95,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":87,"col":0},"hi":{"line":95,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":87,"col":23},"hi":{"line":87,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":87,"col":4},"hi":{"line":87,"col":4},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"items":[{"ident":["default",{"lo":{"line":90,"col":7},"hi":{"line":90,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":1},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[0,239]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":90,"col":24},"hi":{"line":90,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":90,"col":14},"hi":{"line":90,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[],"ret":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"body":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"span":{"lo":{"line":90,"col":25},"hi":{"line":94,"col":5},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":15,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":90,"col":25},"hi":{"line":94,"col":5},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"span":{"lo":{"line":91,"col":8},"hi":{"line":93,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,221]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]},"variant_index":0,"typ_is_record":true,"variant_is_record":true,"typ_is_struct":true},"user_ty":null,"fields":[{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0},{"data":{"ValueNs":"error_code"},"disambiguator":0}],"index":[0,223]},"value":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"span":{"lo":{"line":92,"col":24},"hi":{"line":92,"col":68},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":14,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":92,"col":24},"hi":{"line":92,"col":68},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"span":{"lo":{"line":92,"col":32},"hi":{"line":92,"col":67},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[{"Int":"I32"}],"output":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"c_variadic":false,"unsafety":"Unsafe","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[{"Int":"I32"}],"output":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"c_variadic":false,"unsafety":"Unsafe","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"span":{"lo":{"line":92,"col":32},"hi":{"line":92,"col":57},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":"Impl","disambiguator":56},{"data":{"ValueNs":"new_unchecked"},"disambiguator":0}],"index":[1,22145]}}},"hir_id":null,"attributes":[]},"args":[{"ty":{"Int":"I32"},"span":{"lo":{"line":92,"col":58},"hi":{"line":92,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"NamedConst":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":"Impl","disambiguator":2},{"data":{"ValueNs":"MIN"},"disambiguator":0}],"index":[1,28926]},"substs":[],"user_ty":null,"impl":null}},"hir_id":[239,10],"attributes":[]}],"from_hir_call":true,"fn_span":{"lo":{"line":92,"col":32},"hi":{"line":92,"col":67},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":null}},"hir_id":[239,5],"attributes":[]},"safety_mode":"ExplicitUnsafe"}},"hir_id":[239,4],"attributes":[]}}],"base":null}},"hir_id":[239,1],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[239,16],"attributes":[]},"sig_span":{"lo":{"line":90,"col":4},"hi":{"line":90,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":90,"col":4},"hi":{"line":94,"col":5},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":90,"col":4},"hi":{"line":90,"col":4},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::skip","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:89:5: 89:12 (#49), close: concordium/src/concordium_types.rs:89:5: 89:12 (#49) }"}},"delim":"Parenthesis","tokens":""}},"tokens":null},"tokens":null}},"id":444,"style":"Outer","span":{"lo":{"line":89,"col":4},"hi":{"line":89,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"inline","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:88:13: 88:14 (#0), close: concordium/src/concordium_types.rs:88:20: 88:21 (#0) }"}},"delim":"Parenthesis","tokens":"always"}},"tokens":null},"tokens":null}},"id":443,"style":"Outer","span":{"lo":{"line":88,"col":4},"hi":{"line":88,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Default error is i32::MIN."]},"id":95,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Default error is i32::MIN."]},"id":95,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":2}],"index":[0,70]},"span":{"lo":{"line":97,"col":0},"hi":{"line":108,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":97,"col":0},"hi":{"line":108,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":97,"col":11},"hi":{"line":97,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":97,"col":4},"hi":{"line":97,"col":4},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":null,"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"items":[{"ident":["new",{"lo":{"line":100,"col":11},"hi":{"line":100,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":2},{"data":{"ValueNs":"new"},"disambiguator":0}],"index":[0,238]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":100,"col":38},"hi":{"line":100,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":100,"col":14},"hi":{"line":100,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Int":"I32"},"span":{"lo":{"line":100,"col":15},"hi":{"line":100,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"x","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":2},{"data":{"ValueNs":"new"},"disambiguator":0}],"index":[0,238]},"local_id":2}},"ty":{"Int":"I32"},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Int":"I32"},"ty_span":{"lo":{"line":100,"col":18},"hi":{"line":100,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"self_kind":null,"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":2},{"data":{"ValueNs":"new"},"disambiguator":0}],"index":[0,238]},"local_id":1},"attributes":[]}],"ret":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]}}},"body":{"ty":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]}}},"span":{"lo":{"line":100,"col":39},"hi":{"line":107,"col":5},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":35,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":100,"col":39},"hi":{"line":107,"col":5},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]}}},"span":{"lo":{"line":101,"col":8},"hi":{"line":106,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"If":{"if_then_scope":{"id":30,"data":"IfThen"},"cond":{"ty":"Bool","span":{"lo":{"line":101,"col":11},"hi":{"line":101,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Use":{"source":{"ty":"Bool","span":{"lo":{"line":101,"col":11},"hi":{"line":101,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binary":{"op":"Lt","lhs":{"ty":{"Int":"I32"},"span":{"lo":{"line":101,"col":11},"hi":{"line":101,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"x","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":2},{"data":{"ValueNs":"new"},"disambiguator":0}],"index":[0,238]},"local_id":2}}}},"hir_id":[238,5],"attributes":[]},"rhs":{"ty":{"Int":"I32"},"span":{"lo":{"line":101,"col":15},"hi":{"line":101,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Literal":{"lit":{"node":{"Int":[0,"Unsuffixed"]},"span":{"lo":{"line":101,"col":15},"hi":{"line":101,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"neg":false}},"hir_id":[238,7],"attributes":[]}}},"hir_id":[238,4],"attributes":[]}}},"hir_id":[238,8],"attributes":[]},"then":{"ty":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]}}},"span":{"lo":{"line":101,"col":17},"hi":{"line":104,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":29,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":101,"col":17},"hi":{"line":104,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[{"kind":{"Let":{"remainder_scope":{"id":29,"data":{"Remainder":0}},"init_scope":{"id":9,"data":"Node"},"pattern":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"span":{"lo":{"line":102,"col":16},"hi":{"line":102,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"error_code","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":2},{"data":{"ValueNs":"new"},"disambiguator":0}],"index":[0,238]},"local_id":20}},"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"initializer":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"span":{"lo":{"line":102,"col":29},"hi":{"line":102,"col":68},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":18,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":102,"col":29},"hi":{"line":102,"col":68},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"span":{"lo":{"line":102,"col":38},"hi":{"line":102,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[{"Int":"I32"}],"output":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"c_variadic":false,"unsafety":"Unsafe","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[{"Int":"I32"}],"output":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"c_variadic":false,"unsafety":"Unsafe","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"span":{"lo":{"line":102,"col":38},"hi":{"line":102,"col":63},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":"Impl","disambiguator":56},{"data":{"ValueNs":"new_unchecked"},"disambiguator":0}],"index":[1,22145]}}},"hir_id":null,"attributes":[]},"args":[{"ty":{"Int":"I32"},"span":{"lo":{"line":102,"col":64},"hi":{"line":102,"col":65},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"x","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":2},{"data":{"ValueNs":"new"},"disambiguator":0}],"index":[0,238]},"local_id":2}}}},"hir_id":[238,16],"attributes":[]}],"from_hir_call":true,"fn_span":{"lo":{"line":102,"col":38},"hi":{"line":102,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":null}},"hir_id":[238,11],"attributes":[]},"safety_mode":"ExplicitUnsafe"}},"hir_id":[238,10],"attributes":[]},"else_block":null,"lint_level":{"Explicit":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":2},{"data":{"ValueNs":"new"},"disambiguator":0}],"index":[0,238]},"local_id":19}},"attributes":[]}},"opt_destruction_scope":{"id":9,"data":"Destruction"}}],"expr":{"ty":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]}}},"span":{"lo":{"line":103,"col":12},"hi":{"line":103,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0}],"index":[1,41362]},"typ":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]},"variant":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0},{"data":{"TypeNs":"Some"},"disambiguator":0}],"index":[1,41366]},"variant_index":1,"typ_is_record":false,"variant_is_record":false,"typ_is_struct":false},"user_ty":null,"fields":[{"field":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0},{"data":{"TypeNs":"Some"},"disambiguator":0},{"data":{"ValueNs":"0"},"disambiguator":0}],"index":[1,41368]},"value":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"span":{"lo":{"line":103,"col":17},"hi":{"line":103,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,221]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]},"variant_index":0,"typ_is_record":true,"variant_is_record":true,"typ_is_struct":true},"user_ty":null,"fields":[{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0},{"data":{"ValueNs":"error_code"},"disambiguator":0}],"index":[0,223]},"value":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"span":{"lo":{"line":103,"col":26},"hi":{"line":103,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"error_code","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":2},{"data":{"ValueNs":"new"},"disambiguator":0}],"index":[0,238]},"local_id":20}}}},"hir_id":[238,27],"attributes":[]}}],"base":null}},"hir_id":[238,24],"attributes":[]}}],"base":null}},"hir_id":[238,21],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[238,30],"attributes":[]},"else_opt":{"ty":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]}}},"span":{"lo":{"line":104,"col":15},"hi":{"line":106,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":34,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":104,"col":15},"hi":{"line":106,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]}}},"span":{"lo":{"line":105,"col":12},"hi":{"line":105,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0}],"index":[1,41362]},"typ":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]},"variant":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0},{"data":{"TypeNs":"None"},"disambiguator":0}],"index":[1,41364]},"variant_index":0,"typ_is_record":false,"variant_is_record":false,"typ_is_struct":false},"user_ty":null,"fields":[],"base":null}},"hir_id":[238,32],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[238,31],"attributes":[]}}},"hir_id":[238,3],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[238,36],"attributes":[]},"sig_span":{"lo":{"line":100,"col":4},"hi":{"line":100,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":100,"col":4},"hi":{"line":107,"col":5},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":100,"col":4},"hi":{"line":100,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::skip","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:99:5: 99:12 (#46), close: concordium/src/concordium_types.rs:99:5: 99:12 (#46) }"}},"delim":"Parenthesis","tokens":""}},"tokens":null},"tokens":null}},"id":441,"style":"Outer","span":{"lo":{"line":99,"col":4},"hi":{"line":99,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," This returns `None` for all values >= 0 and `Some` otherwise."]},"id":440,"style":"Outer","span":{"lo":{"line":98,"col":4},"hi":{"line":98,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"bail"},"disambiguator":0}],"index":[0,71]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"bail"},"disambiguator":0}],"index":[0,71]},"span":{"lo":{"line":118,"col":0},"hi":{"line":127,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":118,"col":0},"hi":{"line":127,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Macro":[{"body":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:118:19: 118:20 (#0), close: concordium/src/concordium_types.rs:127:1: 127:2 (#0) }"}},"delim":"Brace","tokens":"() => { { return Err(Default :: default()) ; } } ; ($arg : expr) =>\n{ { return Err($arg) ; } } ;"},"macro_rules":true},"Bang"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The `bail` macro can be used for cleaner error handling. If the function has"]},"id":100,"style":"Outer","span":{"lo":{"line":112,"col":0},"hi":{"line":112,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," result type `Result` invoking `bail` will terminate execution early with an"]},"id":101,"style":"Outer","span":{"lo":{"line":113,"col":0},"hi":{"line":113,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," error."]},"id":102,"style":"Outer","span":{"lo":{"line":114,"col":0},"hi":{"line":114,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," If an argument is supplied, this will be used as the error, otherwise it"]},"id":103,"style":"Outer","span":{"lo":{"line":115,"col":0},"hi":{"line":115,"col":76},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," requires the type `E` in `Result<_, E>` to implement the `Default` trait."]},"id":104,"style":"Outer","span":{"lo":{"line":116,"col":0},"hi":{"line":116,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"macro_export","args":"Empty","tokens":null},"tokens":null}},"id":105,"style":"Outer","span":{"lo":{"line":117,"col":0},"hi":{"line":117,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"ensure"},"disambiguator":0}],"index":[0,72]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"ensure"},"disambiguator":0}],"index":[0,72]},"span":{"lo":{"line":133,"col":0},"hi":{"line":144,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":133,"col":0},"hi":{"line":144,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Macro":[{"body":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:133:21: 133:22 (#0), close: concordium/src/concordium_types.rs:144:1: 144:2 (#0) }"}},"delim":"Brace","tokens":"($p : expr) => { if! $p { $crate :: bail! () ; } } ; ($p : expr, $arg : expr)\n=> { { if! $p { $crate :: bail! ($arg) ; } } } ;"},"macro_rules":true},"Bang"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The `ensure` macro can be used for cleaner error handling. It is analogous"]},"id":106,"style":"Outer","span":{"lo":{"line":129,"col":0},"hi":{"line":129,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," to `assert`, but instead of panicking it uses `bail` to terminate execution"]},"id":107,"style":"Outer","span":{"lo":{"line":130,"col":0},"hi":{"line":130,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," of the function early."]},"id":108,"style":"Outer","span":{"lo":{"line":131,"col":0},"hi":{"line":131,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"macro_export","args":"Empty","tokens":null},"tokens":null}},"id":109,"style":"Outer","span":{"lo":{"line":132,"col":0},"hi":{"line":132,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"ensure_eq"},"disambiguator":0}],"index":[0,73]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"ensure_eq"},"disambiguator":0}],"index":[0,73]},"span":{"lo":{"line":149,"col":0},"hi":{"line":156,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":149,"col":0},"hi":{"line":156,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Macro":[{"body":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:149:24: 149:25 (#0), close: concordium/src/concordium_types.rs:156:1: 156:2 (#0) }"}},"delim":"Brace","tokens":"($l : expr, $r : expr) => { $crate :: ensure! ($l == $r) } ;\n($l : expr, $r : expr, $arg : expr) => { $crate :: ensure! ($l == $r, $arg) }\n;"},"macro_rules":true},"Bang"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," ## Variants of `ensure` for ease of use in certain contexts."]},"id":110,"style":"Outer","span":{"lo":{"line":146,"col":0},"hi":{"line":146,"col":64},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Ensure the first two arguments are equal, using `bail` otherwise."]},"id":111,"style":"Outer","span":{"lo":{"line":147,"col":0},"hi":{"line":147,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"macro_export","args":"Empty","tokens":null},"tokens":null}},"id":112,"style":"Outer","span":{"lo":{"line":148,"col":0},"hi":{"line":148,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"ensure_ne"},"disambiguator":0}],"index":[0,74]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"ensure_ne"},"disambiguator":0}],"index":[0,74]},"span":{"lo":{"line":160,"col":0},"hi":{"line":167,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":160,"col":0},"hi":{"line":167,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Macro":[{"body":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:160:24: 160:25 (#0), close: concordium/src/concordium_types.rs:167:1: 167:2 (#0) }"}},"delim":"Brace","tokens":"($l : expr, $r : expr) => { $crate :: ensure! ($l != $r) } ;\n($l : expr, $r : expr, $arg : expr) => { $crate :: ensure! ($l != $r, $arg) }\n;"},"macro_rules":true},"Bang"]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"macro_export","args":"Empty","tokens":null},"tokens":null}},"id":113,"style":"Outer","span":{"lo":{"line":158,"col":0},"hi":{"line":158,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Ensure the first two arguments are __not__ equal, using `bail` otherwise."]},"id":114,"style":"Outer","span":{"lo":{"line":159,"col":0},"hi":{"line":159,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"fail"},"disambiguator":0}],"index":[0,75]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"fail"},"disambiguator":0}],"index":[0,75]},"span":{"lo":{"line":197,"col":0},"hi":{"line":211,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":197,"col":0},"hi":{"line":211,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Macro":[{"body":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:197:19: 197:20 (#0), close: concordium/src/concordium_types.rs:211:1: 211:2 (#0) }"}},"delim":"Brace","tokens":"() =>\n{\n {\n $crate :: test_infrastructure ::\n report_error(\"\", file! (), line! (), column! ()) ; panic! ()\n }\n} ; ($($arg : tt), +) =>\n{\n {\n let msg = & $crate :: alloc :: format! ($($arg), +) ; $crate ::\n test_infrastructure ::\n report_error(& msg, file! (), line! (), column! ()) ; panic!\n (\"{}\", msg)\n }\n} ;"},"macro_rules":true},"Bang"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The `fail` macro is used for testing as a substitute for the panic macro."]},"id":120,"style":"Outer","span":{"lo":{"line":192,"col":0},"hi":{"line":192,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," It reports back error information to the host."]},"id":121,"style":"Outer","span":{"lo":{"line":193,"col":0},"hi":{"line":193,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Used only in testing."]},"id":122,"style":"Outer","span":{"lo":{"line":194,"col":0},"hi":{"line":194,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:195:6: 195:7 (#0), close: concordium/src/concordium_types.rs:195:27: 195:28 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"std\")"}},"tokens":null},"tokens":null}},"id":123,"style":"Outer","span":{"lo":{"line":195,"col":0},"hi":{"line":195,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"macro_export","args":"Empty","tokens":null},"tokens":null}},"id":124,"style":"Outer","span":{"lo":{"line":196,"col":0},"hi":{"line":196,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"claim"},"disambiguator":0}],"index":[0,76]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"claim"},"disambiguator":0}],"index":[0,76]},"span":{"lo":{"line":217,"col":0},"hi":{"line":233,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":217,"col":0},"hi":{"line":233,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Macro":[{"body":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:217:20: 217:21 (#0), close: concordium/src/concordium_types.rs:233:1: 233:2 (#0) }"}},"delim":"Brace","tokens":"($cond : expr) => { if! $cond { $crate :: fail! () } } ; ($cond : expr,) =>\n{ if! $cond { $crate :: fail! () } } ; ($cond : expr, $($arg : tt), +) =>\n{ if! $cond { $crate :: fail! ($($arg), +) } } ;"},"macro_rules":true},"Bang"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The `claim` macro is used for testing as a substitute for the assert macro."]},"id":125,"style":"Outer","span":{"lo":{"line":213,"col":0},"hi":{"line":213,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," It checks the condition and if false it reports back an error."]},"id":126,"style":"Outer","span":{"lo":{"line":214,"col":0},"hi":{"line":214,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Used only in testing."]},"id":127,"style":"Outer","span":{"lo":{"line":215,"col":0},"hi":{"line":215,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"macro_export","args":"Empty","tokens":null},"tokens":null}},"id":128,"style":"Outer","span":{"lo":{"line":216,"col":0},"hi":{"line":216,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"claim_eq"},"disambiguator":0}],"index":[0,77]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"claim_eq"},"disambiguator":0}],"index":[0,77]},"span":{"lo":{"line":238,"col":0},"hi":{"line":248,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":238,"col":0},"hi":{"line":248,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Macro":[{"body":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:238:23: 238:24 (#0), close: concordium/src/concordium_types.rs:248:1: 248:2 (#0) }"}},"delim":"Brace","tokens":"($left : expr, $right : expr) =>\n{\n $crate :: claim!\n ($left == $right, \"left and right are not equal\\nleft: {:?}\\nright: {:?}\",\n $left, $right)\n} ; ($left : expr, $right : expr,) => { $crate :: claim_eq! ($left, $right) }\n; ($left : expr, $right : expr, $($arg : tt), +) =>\n{ $crate :: claim! ($left == $right, $($arg), +) } ;"},"macro_rules":true},"Bang"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Ensure the first two arguments are equal, just like `assert_eq!`, otherwise"]},"id":129,"style":"Outer","span":{"lo":{"line":235,"col":0},"hi":{"line":235,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," reports an error. Used only in testing."]},"id":130,"style":"Outer","span":{"lo":{"line":236,"col":0},"hi":{"line":236,"col":43},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"macro_export","args":"Empty","tokens":null},"tokens":null}},"id":131,"style":"Outer","span":{"lo":{"line":237,"col":0},"hi":{"line":237,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"claim_ne"},"disambiguator":0}],"index":[0,78]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"claim_ne"},"disambiguator":0}],"index":[0,78]},"span":{"lo":{"line":254,"col":0},"hi":{"line":264,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":254,"col":0},"hi":{"line":264,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Macro":[{"body":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:254:23: 254:24 (#0), close: concordium/src/concordium_types.rs:264:1: 264:2 (#0) }"}},"delim":"Brace","tokens":"($left : expr, $right : expr) => { $crate :: claim! ($left != $right) } ;\n($left : expr, $right : expr,) => { $crate :: claim! ($left != $right) } ;\n($left : expr, $right : expr, $($arg : tt), +) =>\n{ $crate :: claim! ($left != $right, $($arg), +) } ;"},"macro_rules":true},"Bang"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Ensure the first two arguments are *not* equal, just like `assert_ne!`,"]},"id":132,"style":"Outer","span":{"lo":{"line":250,"col":0},"hi":{"line":250,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," otherwise reports an error."]},"id":133,"style":"Outer","span":{"lo":{"line":251,"col":0},"hi":{"line":251,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Used only in testing."]},"id":134,"style":"Outer","span":{"lo":{"line":252,"col":0},"hi":{"line":252,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"macro_export","args":"Empty","tokens":null},"tokens":null}},"id":135,"style":"Outer","span":{"lo":{"line":253,"col":0},"hi":{"line":253,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveResult"},"disambiguator":0}],"index":[0,79]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveResult"},"disambiguator":0}],"index":[0,79]},"span":{"lo":{"line":290,"col":0},"hi":{"line":290,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":290,"col":0},"hi":{"line":290,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"TyAlias":[{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"A"}}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveResult"},"disambiguator":0}],"index":[0,79]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveResult"},"disambiguator":0},{"data":{"TypeNs":"A"},"disambiguator":0}],"index":[0,80]},"name":{"Plain":{"name":"A","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveResult"},"disambiguator":0}],"index":[0,79]},"local_id":1}}},"span":{"lo":{"line":290,"col":23},"hi":{"line":290,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":null,"synthetic":false}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":0,"name":"A"}}}]},"is_const":false,"is_positive":true}},"id":3652190691640089114}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":290,"col":25},"hi":{"line":290,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":290,"col":22},"hi":{"line":290,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The expected return type of the receive method of a smart contract."]},"id":136,"style":"Outer","span":{"lo":{"line":266,"col":0},"hi":{"line":266,"col":71},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":137,"style":"Outer","span":{"lo":{"line":267,"col":0},"hi":{"line":267,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Optionally, to define a custom type for error instead of using"]},"id":138,"style":"Outer","span":{"lo":{"line":268,"col":0},"hi":{"line":268,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Reject, allowing to track the reason for rejection, *but only in unit"]},"id":139,"style":"Outer","span":{"lo":{"line":269,"col":0},"hi":{"line":269,"col":73},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," tests*."]},"id":140,"style":"Outer","span":{"lo":{"line":270,"col":0},"hi":{"line":270,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":141,"style":"Outer","span":{"lo":{"line":271,"col":0},"hi":{"line":271,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," See also the documentation for [bail!](macro.bail.html) for how to use"]},"id":142,"style":"Outer","span":{"lo":{"line":272,"col":0},"hi":{"line":272,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," custom error types."]},"id":143,"style":"Outer","span":{"lo":{"line":273,"col":0},"hi":{"line":273,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":144,"style":"Outer","span":{"lo":{"line":274,"col":0},"hi":{"line":274,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," # Example"]},"id":145,"style":"Outer","span":{"lo":{"line":275,"col":0},"hi":{"line":275,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Defining a custom error type"]},"id":146,"style":"Outer","span":{"lo":{"line":276,"col":0},"hi":{"line":276,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // ```rust"]},"id":147,"style":"Outer","span":{"lo":{"line":277,"col":0},"hi":{"line":277,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // enum MyCustomError {"]},"id":148,"style":"Outer","span":{"lo":{"line":278,"col":0},"hi":{"line":278,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // SomeError"]},"id":149,"style":"Outer","span":{"lo":{"line":279,"col":0},"hi":{"line":279,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // }"]},"id":150,"style":"Outer","span":{"lo":{"line":280,"col":0},"hi":{"line":280,"col":8},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // "]},"id":151,"style":"Outer","span":{"lo":{"line":281,"col":0},"hi":{"line":281,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // #[receive(contract = \"mycontract\", name = \"receive\")]"]},"id":152,"style":"Outer","span":{"lo":{"line":282,"col":0},"hi":{"line":282,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // fn contract_receive("]},"id":153,"style":"Outer","span":{"lo":{"line":283,"col":0},"hi":{"line":283,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // ctx: &R,"]},"id":154,"style":"Outer","span":{"lo":{"line":284,"col":0},"hi":{"line":284,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // receive_amount: Amount,"]},"id":155,"style":"Outer","span":{"lo":{"line":285,"col":0},"hi":{"line":285,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // logger: &mut L,"]},"id":156,"style":"Outer","span":{"lo":{"line":286,"col":0},"hi":{"line":286,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // state: &mut State,"]},"id":157,"style":"Outer","span":{"lo":{"line":287,"col":0},"hi":{"line":287,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // ) -> Result { ... }"]},"id":158,"style":"Outer","span":{"lo":{"line":288,"col":0},"hi":{"line":288,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // ```"]},"id":159,"style":"Outer","span":{"lo":{"line":289,"col":0},"hi":{"line":289,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitResult"},"disambiguator":0}],"index":[0,81]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitResult"},"disambiguator":0}],"index":[0,81]},"span":{"lo":{"line":315,"col":0},"hi":{"line":315,"col":43},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":315,"col":0},"hi":{"line":315,"col":43},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"TyAlias":[{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"S"}}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitResult"},"disambiguator":0}],"index":[0,81]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitResult"},"disambiguator":0},{"data":{"TypeNs":"S"},"disambiguator":0}],"index":[0,82]},"name":{"Plain":{"name":"S","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitResult"},"disambiguator":0}],"index":[0,81]},"local_id":1}}},"span":{"lo":{"line":315,"col":20},"hi":{"line":315,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":null,"synthetic":false}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":0,"name":"S"}}}]},"is_const":false,"is_positive":true}},"id":676887403273334043}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":315,"col":22},"hi":{"line":315,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":315,"col":19},"hi":{"line":315,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The expected return type of the init method of the smart contract,"]},"id":160,"style":"Outer","span":{"lo":{"line":292,"col":0},"hi":{"line":292,"col":70},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," parametrized by the state type of the smart contract."]},"id":161,"style":"Outer","span":{"lo":{"line":293,"col":0},"hi":{"line":293,"col":57},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":162,"style":"Outer","span":{"lo":{"line":294,"col":0},"hi":{"line":294,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Optionally, to define a custom type for error instead of using Reject,"]},"id":163,"style":"Outer","span":{"lo":{"line":295,"col":0},"hi":{"line":295,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," allowing the track the reason for rejection, *but only in unit tests*."]},"id":164,"style":"Outer","span":{"lo":{"line":296,"col":0},"hi":{"line":296,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":165,"style":"Outer","span":{"lo":{"line":297,"col":0},"hi":{"line":297,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," See also the documentation for [bail!](macro.bail.html) for how to use"]},"id":166,"style":"Outer","span":{"lo":{"line":298,"col":0},"hi":{"line":298,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," custom error types."]},"id":167,"style":"Outer","span":{"lo":{"line":299,"col":0},"hi":{"line":299,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":168,"style":"Outer","span":{"lo":{"line":300,"col":0},"hi":{"line":300,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," # Example"]},"id":169,"style":"Outer","span":{"lo":{"line":301,"col":0},"hi":{"line":301,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Defining a custom error type"]},"id":170,"style":"Outer","span":{"lo":{"line":302,"col":0},"hi":{"line":302,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // ```rust"]},"id":171,"style":"Outer","span":{"lo":{"line":303,"col":0},"hi":{"line":303,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // enum MyCustomError {"]},"id":172,"style":"Outer","span":{"lo":{"line":304,"col":0},"hi":{"line":304,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // SomeError"]},"id":173,"style":"Outer","span":{"lo":{"line":305,"col":0},"hi":{"line":305,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // }"]},"id":174,"style":"Outer","span":{"lo":{"line":306,"col":0},"hi":{"line":306,"col":8},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // "]},"id":175,"style":"Outer","span":{"lo":{"line":307,"col":0},"hi":{"line":307,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // #[init(contract = \"mycontract\")]"]},"id":176,"style":"Outer","span":{"lo":{"line":308,"col":0},"hi":{"line":308,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // fn contract_init("]},"id":177,"style":"Outer","span":{"lo":{"line":309,"col":0},"hi":{"line":309,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // ctx: &R,"]},"id":178,"style":"Outer","span":{"lo":{"line":310,"col":0},"hi":{"line":310,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // receive_amount: Amount,"]},"id":179,"style":"Outer","span":{"lo":{"line":311,"col":0},"hi":{"line":311,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // logger: &mut L,"]},"id":180,"style":"Outer","span":{"lo":{"line":312,"col":0},"hi":{"line":312,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // ) -> Result { ... }"]},"id":181,"style":"Outer","span":{"lo":{"line":313,"col":0},"hi":{"line":313,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // ```"]},"id":182,"style":"Outer","span":{"lo":{"line":314,"col":0},"hi":{"line":314,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0}],"index":[0,83]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0}],"index":[0,83]},"span":{"lo":{"line":317,"col":0},"hi":{"line":325,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":317,"col":0},"hi":{"line":325,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Mod":[{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":"Use","disambiguator":0}],"index":[0,84]},"span":{"lo":{"line":318,"col":4},"hi":{"line":318,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":318,"col":4},"hi":{"line":318,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":318,"col":8},"hi":{"line":318,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,64]}]}],"segments":[{"ident":["super",{"lo":{"line":318,"col":8},"hi":{"line":318,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":"Use","disambiguator":0}],"index":[0,84]},"local_id":1},"res":"Err","args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"span":{"lo":{"line":322,"col":4},"hi":{"line":322,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":322,"col":4},"hi":{"line":322,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":4557742319775345286}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":322,"col":25},"hi":{"line":322,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":322,"col":25},"hi":{"line":322,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":4557742319775345286}}],[]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Marker trait intended to indicate which context type we have."]},"id":183,"style":"Outer","span":{"lo":{"line":319,"col":4},"hi":{"line":319,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," This is deliberately a sealed trait, so that it is only implementable"]},"id":184,"style":"Outer","span":{"lo":{"line":320,"col":4},"hi":{"line":320,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," by types in this crate."]},"id":185,"style":"Outer","span":{"lo":{"line":321,"col":4},"hi":{"line":321,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":"Impl","disambiguator":0}],"index":[0,86]},"span":{"lo":{"line":323,"col":4},"hi":{"line":323,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":323,"col":4},"hi":{"line":323,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":323,"col":42},"hi":{"line":323,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":323,"col":8},"hi":{"line":323,"col":8},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]}}},"items":[]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":"Impl","disambiguator":1}],"index":[0,87]},"span":{"lo":{"line":324,"col":4},"hi":{"line":324,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":324,"col":4},"hi":{"line":324,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":324,"col":45},"hi":{"line":324,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":324,"col":8},"hi":{"line":324,"col":8},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]}}},"items":[]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]}]},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]},"span":{"lo":{"line":330,"col":0},"hi":{"line":332,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":330,"col":0},"hi":{"line":332,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Struct":[[{"span":{"lo":{"line":331,"col":4},"hi":{"line":331,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":331,"col":4},"hi":{"line":331,"col":4},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"ident":["marker",{"lo":{"line":331,"col":4},"hi":{"line":331,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]},"local_id":14},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0},{"data":{"ValueNs":"marker"},"disambiguator":0}],"index":[0,226]},"ty":{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"PhantomData"},"disambiguator":0}],"index":[1,2704]}}},"attributes":[]}],false]},{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]},"local_id":7},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0},{"data":{"TypeNs":"T"},"disambiguator":0}],"index":[0,225]},"name":{"Plain":{"name":"T","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]},"local_id":7}}},"span":{"lo":{"line":330,"col":25},"hi":{"line":330,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":null,"synthetic":false}},"colon_span":{"lo":{"line":330,"col":26},"hi":{"line":330,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":[]}],"predicates":[{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]},"local_id":6},"span":{"lo":{"line":330,"col":26},"hi":{"line":330,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"origin":"GenericParam","bound_generic_params":[],"bounded_ty":{"Param":{"index":0,"name":"T"}}}}],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}]},"is_const":false,"is_positive":true}},"id":14597494069885551087}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}]},"is_const":false,"is_positive":true}},"id":11684441412359143739}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":330,"col":48},"hi":{"line":330,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":330,"col":24},"hi":{"line":330,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Context backed by host functions."]},"id":186,"style":"Outer","span":{"lo":{"line":327,"col":0},"hi":{"line":327,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"doc","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:329:6: 329:7 (#0), close: concordium/src/concordium_types.rs:329:13: 329:14 (#0) }"}},"delim":"Parenthesis","tokens":"hidden"}},"tokens":null},"tokens":null}},"id":188,"style":"Outer","span":{"lo":{"line":329,"col":0},"hi":{"line":329,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":22}],"index":[0,227]},"span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":22}],"index":[0,227]},"local_id":11},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":22},{"data":{"TypeNs":"T"},"disambiguator":0}],"index":[0,228]},"name":{"Plain":{"name":"T","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":22}],"index":[0,227]},"local_id":11}}},"span":{"lo":{"line":330,"col":25},"hi":{"line":330,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":null,"synthetic":false}},"colon_span":null,"attributes":[]}],"predicates":[{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":22}],"index":[0,227]},"local_id":10},"span":{"lo":{"line":330,"col":26},"hi":{"line":330,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"origin":"GenericParam","bound_generic_params":[],"bounded_ty":{"Param":{"index":0,"name":"T"}}}}],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}]},"is_const":false,"is_positive":true}},"id":14597494069885551087}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}]},"is_const":false,"is_positive":true}},"id":6057256109449739874}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}]},"is_const":false,"is_positive":true}},"id":11684441412359143739}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":330,"col":48},"hi":{"line":330,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":330,"col":24},"hi":{"line":330,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]}}}}]},"self_ty":{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]}}},"items":[{"ident":["default",{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":22},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[0,229]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}]},"is_const":false,"is_positive":true}},"id":14597494069885551087}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}]},"is_const":false,"is_positive":true}},"id":6057256109449739874}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}]},"is_const":false,"is_positive":true}},"id":11684441412359143739}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[],"ret":{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]}}},"body":{"ty":{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]}}},"span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":10,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]}}},"span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,224]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]},"variant_index":0,"typ_is_record":true,"variant_is_record":true,"typ_is_struct":true},"user_ty":null,"fields":[{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0},{"data":{"ValueNs":"marker"},"disambiguator":0}],"index":[0,226]},"value":{"ty":{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"PhantomData"},"disambiguator":0}],"index":[1,2704]}}},"span":{"lo":{"line":331,"col":4},"hi":{"line":331,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"PhantomData"},"disambiguator":0}],"index":[1,2704]}}},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"PhantomData"},"disambiguator":0}],"index":[1,2704]}}},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"span":{"lo":{"line":331,"col":4},"hi":{"line":331,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[1,2588]}}},"hir_id":null,"attributes":[]},"args":[],"from_hir_call":true,"fn_span":{"lo":{"line":331,"col":4},"hi":{"line":331,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":{"impl":{"Concrete":{"id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":"Impl","disambiguator":14}],"index":[1,2727]},"generics":[{"Type":{"Param":{"index":0,"name":"T"}}}]}},"args":[]}}},"hir_id":[229,4],"attributes":[]}}],"base":null}},"hir_id":[229,1],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[229,11],"attributes":[]},"sig_span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":433,"style":"Outer","span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":434,"style":"Outer","span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":434,"style":"Outer","span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Default"]},"call_site":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":185,"col":0},"hi":{"line":185,"col":17},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/default.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/default.rs"}}}},"allow_internal_unstable":["core_intrinsics"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"MacroNs":"Default"},"disambiguator":0}],"index":[1,2591]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0}],"index":[1,2586]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ChainMetaExtern"},"disambiguator":0}],"index":[0,88]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ChainMetaExtern"},"disambiguator":0}],"index":[0,88]},"span":{"lo":{"line":335,"col":0},"hi":{"line":335,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":335,"col":0},"hi":{"line":335,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Struct":[[],false]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":335,"col":26},"hi":{"line":335,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":335,"col":26},"hi":{"line":335,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"doc","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:334:6: 334:7 (#0), close: concordium/src/concordium_types.rs:334:13: 334:14 (#0) }"}},"delim":"Parenthesis","tokens":"hidden"}},"tokens":null},"tokens":null}},"id":189,"style":"Outer","span":{"lo":{"line":334,"col":0},"hi":{"line":334,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]},"span":{"lo":{"line":339,"col":0},"hi":{"line":339,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":339,"col":0},"hi":{"line":339,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Unit":[{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]},"local_id":1},{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0},{"data":"Ctor","disambiguator":0}],"index":[0,231]}]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":339,"col":28},"hi":{"line":339,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":339,"col":28},"hi":{"line":339,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"doc","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:338:6: 338:7 (#0), close: concordium/src/concordium_types.rs:338:13: 338:14 (#0) }"}},"delim":"Parenthesis","tokens":"hidden"}},"tokens":null},"tokens":null}},"id":191,"style":"Outer","span":{"lo":{"line":338,"col":0},"hi":{"line":338,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":23}],"index":[0,232]},"span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":339,"col":28},"hi":{"line":339,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":339,"col":28},"hi":{"line":339,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]}}},"items":[{"ident":["default",{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":23},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[0,233]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[],"ret":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]}}},"body":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]}}},"span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":3,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]}}},"span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,230]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]},"variant_index":0,"typ_is_record":false,"variant_is_record":false,"typ_is_struct":true},"user_ty":null,"fields":[],"base":null}},"hir_id":[233,1],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[233,4],"attributes":[]},"sig_span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":435,"style":"Outer","span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":436,"style":"Outer","span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":436,"style":"Outer","span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Default"]},"call_site":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":185,"col":0},"hi":{"line":185,"col":17},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/default.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/default.rs"}}}},"allow_internal_unstable":["core_intrinsics"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"MacroNs":"Default"},"disambiguator":0}],"index":[1,2591]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0}],"index":[1,2586]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]},"span":{"lo":{"line":342,"col":0},"hi":{"line":342,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":342,"col":0},"hi":{"line":342,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Unit":[{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]},"local_id":1},{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0},{"data":"Ctor","disambiguator":0}],"index":[0,235]}]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":342,"col":31},"hi":{"line":342,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":342,"col":31},"hi":{"line":342,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"doc","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:341:6: 341:7 (#0), close: concordium/src/concordium_types.rs:341:13: 341:14 (#0) }"}},"delim":"Parenthesis","tokens":"hidden"}},"tokens":null},"tokens":null}},"id":193,"style":"Outer","span":{"lo":{"line":341,"col":0},"hi":{"line":341,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":24}],"index":[0,236]},"span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":342,"col":31},"hi":{"line":342,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":342,"col":31},"hi":{"line":342,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]}}},"items":[{"ident":["default",{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":24},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[0,237]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[],"ret":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]}}},"body":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]}}},"span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":3,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]}}},"span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,234]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]},"variant_index":0,"typ_is_record":false,"variant_is_record":false,"typ_is_struct":true},"user_ty":null,"fields":[],"base":null}},"hir_id":[237,1],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[237,4],"attributes":[]},"sig_span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":437,"style":"Outer","span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":438,"style":"Outer","span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":438,"style":"Outer","span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Default"]},"call_site":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":185,"col":0},"hi":{"line":185,"col":17},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/default.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/default.rs"}}}},"allow_internal_unstable":["core_intrinsics"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"MacroNs":"Default"},"disambiguator":0}],"index":[1,2591]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0}],"index":[1,2586]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]}]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"hax_lib_macros"},"disambiguator":0}],"index":[0,170]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"hax_lib_macros"},"disambiguator":0}],"index":[0,170]},"span":{"lo":{"line":5,"col":0},"hi":{"line":5,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":5,"col":0},"hi":{"line":5,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"ExternCrate":null},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::skip","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:4:1: 4:24 (#19), close: concordium/src/concordium_types.rs:4:1: 4:24 (#19) }"}},"delim":"Parenthesis","tokens":""}},"tokens":null},"tokens":null}},"id":359,"style":"Outer","span":{"lo":{"line":4,"col":0},"hi":{"line":4,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Use","disambiguator":0}],"index":[0,171]},"span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":7,"col":4},"hi":{"line":7,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hax_lib_macros","path":[],"index":[9,0]}]}],"segments":[{"ident":["hax_lib_macros",{"lo":{"line":7,"col":4},"hi":{"line":7,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Use","disambiguator":0}],"index":[0,171]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hax_lib_macros","path":[],"index":[9,0]}]},"args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::skip","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:6:1: 6:24 (#22), close: concordium/src/concordium_types.rs:6:1: 6:24 (#22) }"}},"delim":"Parenthesis","tokens":""}},"tokens":null},"tokens":null}},"id":361,"style":"Outer","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Use","disambiguator":1}],"index":[0,240]},"span":{"lo":{"line":10,"col":0},"hi":{"line":10,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":10,"col":0},"hi":{"line":10,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":10,"col":4},"hi":{"line":10,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0}],"index":[1,294]}]}],"segments":[{"ident":["crate",{"lo":{"line":10,"col":4},"hi":{"line":10,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Use","disambiguator":1}],"index":[0,240]},"local_id":1},"res":"Err","args":null,"infer_args":false},{"ident":["num",{"lo":{"line":10,"col":11},"hi":{"line":10,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Use","disambiguator":1}],"index":[0,240]},"local_id":2},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0}],"index":[1,294]}]},"args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::skip","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:9:1: 9:8 (#52), close: concordium/src/concordium_types.rs:9:1: 9:8 (#52) }"}},"delim":"Parenthesis","tokens":""}},"tokens":null},"tokens":null}},"id":446,"style":"Outer","span":{"lo":{"line":9,"col":0},"hi":{"line":9,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]},"span":{"lo":{"line":14,"col":0},"hi":{"line":16,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":14,"col":0},"hi":{"line":16,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Struct":[[{"span":{"lo":{"line":15,"col":4},"hi":{"line":15,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":15,"col":4},"hi":{"line":15,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"ident":["current_contract_state_position",{"lo":{"line":15,"col":15},"hi":{"line":15,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]},"local_id":3},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0},{"data":{"ValueNs":"current_contract_state_position"},"disambiguator":0}],"index":[0,173]},"ty":{"Uint":"U32"},"attributes":[]}],false]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":14,"col":24},"hi":{"line":14,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":14,"col":24},"hi":{"line":14,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," A type representing the constract state bytes."]},"id":60,"style":"Outer","span":{"lo":{"line":12,"col":0},"hi":{"line":12,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":3}],"index":[0,174]},"span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":14,"col":24},"hi":{"line":14,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":14,"col":24},"hi":{"line":14,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]}}},"items":[{"ident":["default",{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":3},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[0,175]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[],"ret":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]}}},"body":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]}}},"span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":10,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]}}},"span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,172]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0}],"index":[0,172]},"variant_index":0,"typ_is_record":true,"variant_is_record":true,"typ_is_struct":true},"user_ty":null,"fields":[{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ContractState"},"disambiguator":0},{"data":{"ValueNs":"current_contract_state_position"},"disambiguator":0}],"index":[0,173]},"value":{"ty":{"Uint":"U32"},"span":{"lo":{"line":15,"col":4},"hi":{"line":15,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Uint":"U32"},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Uint":"U32"},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"span":{"lo":{"line":15,"col":4},"hi":{"line":15,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[1,2588]}}},"hir_id":null,"attributes":[]},"args":[],"from_hir_call":true,"fn_span":{"lo":{"line":15,"col":4},"hi":{"line":15,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":{"impl":{"Concrete":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":"Impl","disambiguator":6}],"index":[1,32027]},"generics":[]}},"args":[]}}},"hir_id":[175,4],"attributes":[]}}],"base":null}},"hir_id":[175,1],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[175,11],"attributes":[]},"sig_span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":371,"style":"Outer","span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":372,"style":"Outer","span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":372,"style":"Outer","span":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Default"]},"call_site":{"lo":{"line":13,"col":9},"hi":{"line":13,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":185,"col":0},"hi":{"line":185,"col":17},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/default.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/default.rs"}}}},"allow_internal_unstable":["core_intrinsics"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"MacroNs":"Default"},"disambiguator":0}],"index":[1,2591]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0}],"index":[1,2586]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]},"span":{"lo":{"line":20,"col":0},"hi":{"line":22,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":20,"col":0},"hi":{"line":22,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Struct":[[{"span":{"lo":{"line":21,"col":4},"hi":{"line":21,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":21,"col":4},"hi":{"line":21,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"ident":["current_parameter_position",{"lo":{"line":21,"col":15},"hi":{"line":21,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]},"local_id":3},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0},{"data":{"ValueNs":"current_parameter_position"},"disambiguator":0}],"index":[0,177]},"ty":{"Uint":"U32"},"attributes":[]}],false]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":20,"col":20},"hi":{"line":20,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":20,"col":20},"hi":{"line":20,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," A type representing the parameter to init and receive methods."]},"id":63,"style":"Outer","span":{"lo":{"line":19,"col":0},"hi":{"line":19,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":4}],"index":[0,178]},"span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":20,"col":20},"hi":{"line":20,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":20,"col":20},"hi":{"line":20,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]}}},"items":[{"ident":["default",{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":4},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[0,179]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[],"ret":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]}}},"body":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]}}},"span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":10,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]}}},"span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,176]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0}],"index":[0,176]},"variant_index":0,"typ_is_record":true,"variant_is_record":true,"typ_is_struct":true},"user_ty":null,"fields":[{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Parameter"},"disambiguator":0},{"data":{"ValueNs":"current_parameter_position"},"disambiguator":0}],"index":[0,177]},"value":{"ty":{"Uint":"U32"},"span":{"lo":{"line":21,"col":4},"hi":{"line":21,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Uint":"U32"},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Uint":"U32"},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"span":{"lo":{"line":21,"col":4},"hi":{"line":21,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[1,2588]}}},"hir_id":null,"attributes":[]},"args":[],"from_hir_call":true,"fn_span":{"lo":{"line":21,"col":4},"hi":{"line":21,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":{"impl":{"Concrete":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":"Impl","disambiguator":6}],"index":[1,32027]},"generics":[]}},"args":[]}}},"hir_id":[179,4],"attributes":[]}}],"base":null}},"hir_id":[179,1],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[179,11],"attributes":[]},"sig_span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":373,"style":"Outer","span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":374,"style":"Outer","span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":374,"style":"Outer","span":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Default"]},"call_site":{"lo":{"line":18,"col":9},"hi":{"line":18,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":185,"col":0},"hi":{"line":185,"col":17},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/default.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/default.rs"}}}},"allow_internal_unstable":["core_intrinsics"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"MacroNs":"Default"},"disambiguator":0}],"index":[1,2591]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0}],"index":[1,2586]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]},"span":{"lo":{"line":26,"col":0},"hi":{"line":33,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":26,"col":0},"hi":{"line":33,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Struct":[[{"span":{"lo":{"line":30,"col":4},"hi":{"line":30,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":30,"col":4},"hi":{"line":30,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"ident":["current_attribute_cursor_position",{"lo":{"line":30,"col":15},"hi":{"line":30,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]},"local_id":3},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0},{"data":{"ValueNs":"current_attribute_cursor_position"},"disambiguator":0}],"index":[0,181]},"ty":{"Uint":"U32"},"attributes":[{"kind":{"DocComment":["Line"," Current position of the cursor, starting from 0."]},"id":66,"style":"Outer","span":{"lo":{"line":27,"col":4},"hi":{"line":27,"col":56},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Note that this is only for the variable attributes."]},"id":67,"style":"Outer","span":{"lo":{"line":28,"col":4},"hi":{"line":28,"col":59},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," `created_at` and `valid_to` will require."]},"id":68,"style":"Outer","span":{"lo":{"line":29,"col":4},"hi":{"line":29,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},{"span":{"lo":{"line":32,"col":4},"hi":{"line":32,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":32,"col":4},"hi":{"line":32,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"ident":["remaining_items",{"lo":{"line":32,"col":15},"hi":{"line":32,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]},"local_id":6},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0},{"data":{"ValueNs":"remaining_items"},"disambiguator":0}],"index":[0,182]},"ty":{"Uint":"U16"},"attributes":[{"kind":{"DocComment":["Line"," The number of remaining items in the policy."]},"id":69,"style":"Outer","span":{"lo":{"line":31,"col":4},"hi":{"line":31,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]}],false]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":26,"col":27},"hi":{"line":26,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":26,"col":27},"hi":{"line":26,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," A type representing the attributes, lazily acquired from the host."]},"id":64,"style":"Outer","span":{"lo":{"line":24,"col":0},"hi":{"line":24,"col":70},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":5}],"index":[0,183]},"span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":26,"col":27},"hi":{"line":26,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":26,"col":27},"hi":{"line":26,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]}}},"items":[{"ident":["default",{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":5},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[0,184]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[],"ret":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]}}},"body":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]}}},"span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":17,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]}}},"span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,180]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0}],"index":[0,180]},"variant_index":0,"typ_is_record":true,"variant_is_record":true,"typ_is_struct":true},"user_ty":null,"fields":[{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0},{"data":{"ValueNs":"current_attribute_cursor_position"},"disambiguator":0}],"index":[0,181]},"value":{"ty":{"Uint":"U32"},"span":{"lo":{"line":30,"col":4},"hi":{"line":30,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Uint":"U32"},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Uint":"U32"},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"span":{"lo":{"line":30,"col":4},"hi":{"line":30,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[1,2588]}}},"hir_id":null,"attributes":[]},"args":[],"from_hir_call":true,"fn_span":{"lo":{"line":30,"col":4},"hi":{"line":30,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":{"impl":{"Concrete":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":"Impl","disambiguator":6}],"index":[1,32027]},"generics":[]}},"args":[]}}},"hir_id":[184,4],"attributes":[]}},{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"AttributesCursor"},"disambiguator":0},{"data":{"ValueNs":"remaining_items"},"disambiguator":0}],"index":[0,182]},"value":{"ty":{"Uint":"U16"},"span":{"lo":{"line":32,"col":4},"hi":{"line":32,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Uint":"U16"},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Uint":"U16"},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"span":{"lo":{"line":32,"col":4},"hi":{"line":32,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[1,2588]}}},"hir_id":null,"attributes":[]},"args":[],"from_hir_call":true,"fn_span":{"lo":{"line":32,"col":4},"hi":{"line":32,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":{"impl":{"Concrete":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":"Impl","disambiguator":5}],"index":[1,32025]},"generics":[]}},"args":[]}}},"hir_id":[184,11],"attributes":[]}}],"base":null}},"hir_id":[184,1],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[184,18],"attributes":[]},"sig_span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":375,"style":"Outer","span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":376,"style":"Outer","span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":376,"style":"Outer","span":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Default"]},"call_site":{"lo":{"line":25,"col":9},"hi":{"line":25,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":185,"col":0},"hi":{"line":185,"col":17},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/default.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/default.rs"}}}},"allow_internal_unstable":["core_intrinsics"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"MacroNs":"Default"},"disambiguator":0}],"index":[1,2591]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0}],"index":[1,2586]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]},"span":{"lo":{"line":37,"col":0},"hi":{"line":39,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":37,"col":0},"hi":{"line":39,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Struct":[[{"span":{"lo":{"line":38,"col":4},"hi":{"line":38,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":38,"col":4},"hi":{"line":38,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"ident":["_private_logger",{"lo":{"line":38,"col":15},"hi":{"line":38,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]},"local_id":2},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0},{"data":{"ValueNs":"_private_logger"},"disambiguator":0}],"index":[0,186]},"ty":{"Tuple":[]},"attributes":[]}],false]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":37,"col":17},"hi":{"line":37,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":37,"col":17},"hi":{"line":37,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," A type representing the logger."]},"id":70,"style":"Outer","span":{"lo":{"line":35,"col":0},"hi":{"line":35,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":6}],"index":[0,187]},"span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":37,"col":17},"hi":{"line":37,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":37,"col":17},"hi":{"line":37,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]}}},"items":[{"ident":["default",{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":6},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[0,188]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[],"ret":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]}}},"body":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]}}},"span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":10,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]}}},"span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,185]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0}],"index":[0,185]},"variant_index":0,"typ_is_record":true,"variant_is_record":true,"typ_is_struct":true},"user_ty":null,"fields":[{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Logger"},"disambiguator":0},{"data":{"ValueNs":"_private_logger"},"disambiguator":0}],"index":[0,186]},"value":{"ty":{"Tuple":[]},"span":{"lo":{"line":38,"col":4},"hi":{"line":38,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Tuple":[]},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Tuple":[]},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"span":{"lo":{"line":38,"col":4},"hi":{"line":38,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[1,2588]}}},"hir_id":null,"attributes":[]},"args":[],"from_hir_call":true,"fn_span":{"lo":{"line":38,"col":4},"hi":{"line":38,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":{"impl":{"Concrete":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":"Impl","disambiguator":0}],"index":[1,32015]},"generics":[]}},"args":[]}}},"hir_id":[188,4],"attributes":[]}}],"base":null}},"hir_id":[188,1],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[188,11],"attributes":[]},"sig_span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":377,"style":"Outer","span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":378,"style":"Outer","span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":378,"style":"Outer","span":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Default"]},"call_site":{"lo":{"line":36,"col":9},"hi":{"line":36,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":185,"col":0},"hi":{"line":185,"col":17},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/default.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/default.rs"}}}},"allow_internal_unstable":["core_intrinsics"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"MacroNs":"Default"},"disambiguator":0}],"index":[1,2591]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0}],"index":[1,2586]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]},"span":{"lo":{"line":44,"col":0},"hi":{"line":49,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":44,"col":0},"hi":{"line":49,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Enum":[[{"ident":["Full",{"lo":{"line":46,"col":4},"hi":{"line":46,"col":8},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0},{"data":{"TypeNs":"Full"},"disambiguator":0}],"index":[0,190]},"data":{"Unit":[{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]},"local_id":2},{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0},{"data":{"TypeNs":"Full"},"disambiguator":0},{"data":"Ctor","disambiguator":0}],"index":[0,191]}]},"disr_expr":null,"span":{"lo":{"line":46,"col":4},"hi":{"line":46,"col":8},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":[{"kind":{"DocComment":["Line"," The log is full."]},"id":74,"style":"Outer","span":{"lo":{"line":45,"col":4},"hi":{"line":45,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},{"ident":["Malformed",{"lo":{"line":48,"col":4},"hi":{"line":48,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]},"local_id":3},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0},{"data":{"TypeNs":"Malformed"},"disambiguator":0}],"index":[0,192]},"data":{"Unit":[{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]},"local_id":4},{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0},{"data":{"TypeNs":"Malformed"},"disambiguator":0},{"data":"Ctor","disambiguator":0}],"index":[0,193]}]},"disr_expr":null,"span":{"lo":{"line":48,"col":4},"hi":{"line":48,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":[{"kind":{"DocComment":["Line"," The message to log was malformed (e.g., too long)"]},"id":75,"style":"Outer","span":{"lo":{"line":47,"col":4},"hi":{"line":47,"col":57},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]}],{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"repr","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:43:7: 43:8 (#0), close: concordium/src/concordium_types.rs:43:10: 43:11 (#0) }"}},"delim":"Parenthesis","tokens":"u8"}},"tokens":null},"tokens":null}},"id":73,"style":"Outer","span":{"lo":{"line":43,"col":0},"hi":{"line":43,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7}],"index":[0,194]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Debug"},"disambiguator":0}],"index":[1,9139]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"items":[{"ident":["fmt",{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":30},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,274]},"name":"Fresh","span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":31},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,275]},"name":"Fresh","span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":32},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[0,276]},"name":"Fresh","span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":1},"attributes":[]},{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"f","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":4}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"ty_span":null,"self_kind":null,"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":3},"attributes":[]}],"ret":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"body":{"ty":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":28,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53916]},"'_"]}}]}},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53917]},"'_"]}}]}},"Str",false]}],"output":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53916]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53917]},"'_"]}}]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53916]},"'_"]}}]}},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53917]},"'_"]}}]}},"Str",false]}],"output":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53916]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53917]},"'_"]}}]}},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0}],"index":[1,9184]}}},"hir_id":null,"attributes":[]},"args":[{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":{"Mut":{"allow_two_phase_borrow":true}},"arg":{"ty":{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"f","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":4}}}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[195,13],"attributes":[]},{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Match":{"scrutinee":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":2}}}},"hir_id":[195,16],"attributes":[]},"arms":[{"pattern":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"subpattern":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Variant":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,189]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0},{"data":{"TypeNs":"Full"},"disambiguator":0}],"index":[0,190]},"variant_index":0,"typ_is_record":false,"variant_is_record":false,"typ_is_struct":false},"substs":[],"subpatterns":[]}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]},"guard":null,"body":{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":"Str","span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Literal":{"lit":{"node":{"Str":["Full","Cooked"]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"neg":false}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[195,22],"attributes":[]},"lint_level":{"Explicit":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":21}},"scope":{"id":21,"data":"Node"},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":[]},{"pattern":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"subpattern":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Variant":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,189]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0},{"data":{"TypeNs":"Malformed"},"disambiguator":0}],"index":[0,192]},"variant_index":1,"typ_is_record":false,"variant_is_record":false,"typ_is_struct":false},"substs":[],"subpatterns":[]}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]},"guard":null,"body":{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":"Str","span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Literal":{"lit":{"node":{"Str":["Malformed","Cooked"]},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"neg":false}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[195,27],"attributes":[]},"lint_level":{"Explicit":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,195]},"local_id":26}},"scope":{"id":26,"data":"Node"},"span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":[]}]}},"hir_id":[195,15],"attributes":[]}],"from_hir_call":true,"fn_span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":null}},"hir_id":[195,5],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[195,29],"attributes":[]},"sig_span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":395,"style":"Outer","span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":395,"style":"Outer","span":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Debug"]},"call_site":{"lo":{"line":42,"col":9},"hi":{"line":42,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":588,"col":4},"hi":{"line":588,"col":19},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/fmt/mod.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/fmt/mod.rs"}}}},"allow_internal_unstable":["core_intrinsics","fmt_helpers_for_derive"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"macros"},"disambiguator":0},{"data":{"MacroNs":"Debug"},"disambiguator":0}],"index":[1,9142]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"macros"},"disambiguator":0}],"index":[1,9141]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":8}],"index":[0,196]},"span":{"lo":{"line":42,"col":16},"hi":{"line":42,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":16},"hi":{"line":42,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Copy"},"disambiguator":0}],"index":[1,2694]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"items":[]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":396,"style":"Outer","span":{"lo":{"line":42,"col":16},"hi":{"line":42,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Copy"]},"call_site":{"lo":{"line":42,"col":16},"hi":{"line":42,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":458,"col":0},"hi":{"line":458,"col":14},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/marker.rs"}}}},"allow_internal_unstable":["core_intrinsics","derive_clone_copy"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"MacroNs":"Copy"},"disambiguator":0}],"index":[1,2695]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0}],"index":[1,2675]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":9}],"index":[0,197]},"span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"clone"},"disambiguator":0},{"data":{"TypeNs":"Clone"},"disambiguator":0}],"index":[1,2262]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"items":[{"ident":["clone",{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":9},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,198]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":9},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,198]},"local_id":8},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":9},{"data":{"ValueNs":"clone"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,277]},"name":"Fresh","span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":9},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,198]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":9},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,198]},"local_id":1},"attributes":[]}],"ret":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"body":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":6,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":9},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,198]},"local_id":2}}}},"hir_id":[198,4],"attributes":[]}}},"hir_id":[198,3],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[198,7],"attributes":[]},"sig_span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":397,"style":"Outer","span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":398,"style":"Outer","span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":398,"style":"Outer","span":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Clone"]},"call_site":{"lo":{"line":42,"col":22},"hi":{"line":42,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":138,"col":0},"hi":{"line":138,"col":15},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/clone.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/clone.rs"}}}},"allow_internal_unstable":["core_intrinsics","derive_clone_copy"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"clone"},"disambiguator":0},{"data":{"MacroNs":"Clone"},"disambiguator":0}],"index":[1,2265]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"clone"},"disambiguator":0}],"index":[1,2261]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":10}],"index":[0,199]},"span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"StructuralEq"},"disambiguator":0}],"index":[1,2693]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"items":[]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":402,"style":"Outer","span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Eq"]},"call_site":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":302,"col":0},"hi":{"line":302,"col":12},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/cmp.rs"}}}},"allow_internal_unstable":["core_intrinsics","derive_eq","structural_match","no_coverage"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"MacroNs":"Eq"},"disambiguator":0}],"index":[1,2317]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0}],"index":[1,2288]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":11}],"index":[0,200]},"span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"Eq"},"disambiguator":0}],"index":[1,2315]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"items":[{"ident":["assert_receiver_is_total_eq",{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":11},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0}],"index":[0,201]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":11},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0}],"index":[0,201]},"local_id":5},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":11},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,278]},"name":"Fresh","span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":11},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0}],"index":[0,201]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":11},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0}],"index":[0,201]},"local_id":1},"attributes":[]}],"ret":{"Tuple":[]},"body":{"ty":{"Tuple":[]},"span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":3,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":null,"safety_mode":"Safe"}},"hir_id":[201,4],"attributes":[]},"sig_span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":399,"style":"Outer","span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"doc","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:42:30: 42:32 (#31), close: concordium/src/concordium_types.rs:42:30: 42:32 (#31) }"}},"delim":"Parenthesis","tokens":"hidden"}},"tokens":null},"tokens":null}},"id":400,"style":"Outer","span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_coverage","args":"Empty","tokens":null},"tokens":null}},"id":401,"style":"Outer","span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":403,"style":"Outer","span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":403,"style":"Outer","span":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Eq"]},"call_site":{"lo":{"line":42,"col":29},"hi":{"line":42,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":302,"col":0},"hi":{"line":302,"col":12},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/cmp.rs"}}}},"allow_internal_unstable":["core_intrinsics","derive_eq","structural_match","no_coverage"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"MacroNs":"Eq"},"disambiguator":0}],"index":[1,2317]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0}],"index":[1,2288]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":12}],"index":[0,202]},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"StructuralPartialEq"},"disambiguator":0}],"index":[1,2692]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"items":[]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":404,"style":"Outer","span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","PartialEq"]},"call_site":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":236,"col":0},"hi":{"line":236,"col":19},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/cmp.rs"}}}},"allow_internal_unstable":["core_intrinsics","structural_match"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"MacroNs":"PartialEq"},"disambiguator":0}],"index":[1,2314]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0}],"index":[1,2288]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13}],"index":[0,203]},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":44,"col":17},"hi":{"line":44,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0}],"index":[1,2310]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"items":[{"ident":["eq",{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":32},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,279]},"name":"Fresh","span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":33},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,280]},"name":"Fresh","span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":1},"attributes":[]},{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"other","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":4}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"ty_span":null,"self_kind":null,"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":3},"attributes":[]}],"ret":"Bool","body":{"ty":"Bool","span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":30,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[{"kind":{"Let":{"remainder_scope":{"id":30,"data":{"Remainder":0}},"init_scope":{"id":5,"data":"Node"},"pattern":{"ty":{"Uint":"U8"},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"__self_tag","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":14}},"ty":{"Uint":"U8"},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"initializer":{"ty":{"Uint":"U8"},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51566]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]}],"output":{"Alias":["Projection",{"substs":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}],"trait_def_id":[{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0}],"index":[1,2734]},{"impl":{"Builtin":{"trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0}],"index":[1,2734]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]}}},"args":[]}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0},{"data":{"TypeNs":"Discriminant"},"disambiguator":0}],"index":[1,2735]}}]},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"RustIntrinsic"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51566]},"'_"]}}]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51566]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]}],"output":{"Alias":["Projection",{"substs":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}],"trait_def_id":[{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0}],"index":[1,2734]},{"impl":{"Builtin":{"trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0}],"index":[1,2734]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]}}},"args":[]}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0},{"data":{"TypeNs":"Discriminant"},"disambiguator":0}],"index":[1,2735]}}]},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"RustIntrinsic"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51566]},"'_"]}}]}},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0}],"index":[1,1415]}}},"hir_id":null,"attributes":[]},"args":[{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":2}}}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[204,11],"attributes":[]}],"from_hir_call":true,"fn_span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":null}},"hir_id":[204,6],"attributes":[]},"else_block":null,"lint_level":{"Explicit":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":13}},"attributes":[]}},"opt_destruction_scope":{"id":5,"data":"Destruction"}},{"kind":{"Let":{"remainder_scope":{"id":30,"data":{"Remainder":1}},"init_scope":{"id":15,"data":"Node"},"pattern":{"ty":{"Uint":"U8"},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"__arg1_tag","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":24}},"ty":{"Uint":"U8"},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"initializer":{"ty":{"Uint":"U8"},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51566]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]}],"output":{"Alias":["Projection",{"substs":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}],"trait_def_id":[{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0}],"index":[1,2734]},{"impl":{"Builtin":{"trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0}],"index":[1,2734]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]}}},"args":[]}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0},{"data":{"TypeNs":"Discriminant"},"disambiguator":0}],"index":[1,2735]}}]},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"RustIntrinsic"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51566]},"'_"]}}]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51566]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]}],"output":{"Alias":["Projection",{"substs":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}],"trait_def_id":[{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0}],"index":[1,2734]},{"impl":{"Builtin":{"trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0}],"index":[1,2734]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}]}}},"args":[]}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"DiscriminantKind"},"disambiguator":0},{"data":{"TypeNs":"Discriminant"},"disambiguator":0}],"index":[1,2735]}}]},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"RustIntrinsic"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51566]},"'_"]}}]}},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"intrinsics"},"disambiguator":0},{"data":"ForeignMod","disambiguator":0},{"data":{"ValueNs":"discriminant_value"},"disambiguator":0}],"index":[1,1415]}}},"hir_id":null,"attributes":[]},"args":[{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}},false]},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"other","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":4}}}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[204,21],"attributes":[]}],"from_hir_call":true,"fn_span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":null}},"hir_id":[204,16],"attributes":[]},"else_block":null,"lint_level":{"Explicit":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":23}},"attributes":[]}},"opt_destruction_scope":{"id":15,"data":"Destruction"}}],"expr":{"ty":"Bool","span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binary":{"op":"Eq","lhs":{"ty":{"Uint":"U8"},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"__self_tag","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":14}}}},"hir_id":[204,26],"attributes":[]},"rhs":{"ty":{"Uint":"U8"},"span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"__arg1_tag","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":13},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,204]},"local_id":24}}}},"hir_id":[204,28],"attributes":[]}}},"hir_id":[204,25],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[204,31],"attributes":[]},"sig_span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":405,"style":"Outer","span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":406,"style":"Outer","span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":406,"style":"Outer","span":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","PartialEq"]},"call_site":{"lo":{"line":42,"col":33},"hi":{"line":42,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":236,"col":0},"hi":{"line":236,"col":19},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/cmp.rs"}}}},"allow_internal_unstable":["core_intrinsics","structural_match"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"MacroNs":"PartialEq"},"disambiguator":0}],"index":[1,2314]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0}],"index":[1,2288]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]},"span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Unit":[{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]},"local_id":1},{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0},{"data":"Ctor","disambiguator":0}],"index":[0,206]}]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":54,"col":26},"hi":{"line":54,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":54,"col":26},"hi":{"line":54,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Error triggered when a non-zero amount of CCD is sent to a contract"]},"id":76,"style":"Outer","span":{"lo":{"line":51,"col":0},"hi":{"line":51,"col":71},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," init or receive function that is not marked as `payable`."]},"id":77,"style":"Outer","span":{"lo":{"line":52,"col":0},"hi":{"line":52,"col":61},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":14}],"index":[0,207]},"span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":54,"col":26},"hi":{"line":54,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":54,"col":26},"hi":{"line":54,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"clone"},"disambiguator":0},{"data":{"TypeNs":"Clone"},"disambiguator":0}],"index":[1,2262]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},"items":[{"ident":["clone",{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":14},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,208]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":14},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,208]},"local_id":8},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":14},{"data":{"ValueNs":"clone"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,281]},"name":"Fresh","span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},false]},"span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":14},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,208]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":14},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,208]},"local_id":1},"attributes":[]}],"ret":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},"body":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},"span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":6,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},"span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},false]},"span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":14},{"data":{"ValueNs":"clone"},"disambiguator":0}],"index":[0,208]},"local_id":2}}}},"hir_id":[208,4],"attributes":[]}}},"hir_id":[208,3],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[208,7],"attributes":[]},"sig_span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":407,"style":"Outer","span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":408,"style":"Outer","span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":408,"style":"Outer","span":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Clone"]},"call_site":{"lo":{"line":53,"col":9},"hi":{"line":53,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":138,"col":0},"hi":{"line":138,"col":15},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/clone.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/clone.rs"}}}},"allow_internal_unstable":["core_intrinsics","derive_clone_copy"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"clone"},"disambiguator":0},{"data":{"MacroNs":"Clone"},"disambiguator":0}],"index":[1,2265]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"clone"},"disambiguator":0}],"index":[1,2261]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":15}],"index":[0,209]},"span":{"lo":{"line":53,"col":16},"hi":{"line":53,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":53,"col":16},"hi":{"line":53,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":54,"col":26},"hi":{"line":54,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":54,"col":26},"hi":{"line":54,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Copy"},"disambiguator":0}],"index":[1,2694]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},"items":[]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":409,"style":"Outer","span":{"lo":{"line":53,"col":16},"hi":{"line":53,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Copy"]},"call_site":{"lo":{"line":53,"col":16},"hi":{"line":53,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":458,"col":0},"hi":{"line":458,"col":14},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/marker.rs"}}}},"allow_internal_unstable":["core_intrinsics","derive_clone_copy"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"MacroNs":"Copy"},"disambiguator":0}],"index":[1,2695]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0}],"index":[1,2675]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16}],"index":[0,210]},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":54,"col":26},"hi":{"line":54,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":54,"col":26},"hi":{"line":54,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Debug"},"disambiguator":0}],"index":[1,9139]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},"items":[{"ident":["fmt",{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,211]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,211]},"local_id":18},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,282]},"name":"Fresh","span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,211]},"local_id":19},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,283]},"name":"Fresh","span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,211]},"local_id":20},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[0,284]},"name":"Fresh","span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},false]},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,211]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"NotPayableError"},"disambiguator":0}],"index":[0,205]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,211]},"local_id":1},"attributes":[]},{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"f","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,211]},"local_id":4}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"ty_span":null,"self_kind":null,"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,211]},"local_id":3},"attributes":[]}],"ret":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"body":{"ty":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":16,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53916]},"'_"]}}]}},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53917]},"'_"]}}]}},"Str",false]}],"output":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53916]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53917]},"'_"]}}]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53916]},"'_"]}}]}},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53917]},"'_"]}}]}},"Str",false]}],"output":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53916]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53917]},"'_"]}}]}},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"write_str"},"disambiguator":0}],"index":[1,9184]}}},"hir_id":null,"attributes":[]},"args":[{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":{"Mut":{"allow_two_phase_borrow":true}},"arg":{"ty":{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"f","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":16},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,211]},"local_id":4}}}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[211,13],"attributes":[]},{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":"Str","span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Literal":{"lit":{"node":{"Str":["NotPayableError","Cooked"]},"span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"neg":false}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[211,15],"attributes":[]}],"from_hir_call":true,"fn_span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":null}},"hir_id":[211,5],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[211,17],"attributes":[]},"sig_span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":410,"style":"Outer","span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":410,"style":"Outer","span":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Debug"]},"call_site":{"lo":{"line":53,"col":22},"hi":{"line":53,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":588,"col":4},"hi":{"line":588,"col":19},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/fmt/mod.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/fmt/mod.rs"}}}},"allow_internal_unstable":["core_intrinsics","fmt_helpers_for_derive"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"macros"},"disambiguator":0},{"data":{"MacroNs":"Debug"},"disambiguator":0}],"index":[1,9142]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"macros"},"disambiguator":0}],"index":[1,9141]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0}],"index":[0,65]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0}],"index":[0,65]},"span":{"lo":{"line":64,"col":0},"hi":{"line":66,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":64,"col":0},"hi":{"line":66,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Struct":[[{"span":{"lo":{"line":65,"col":4},"hi":{"line":65,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":65,"col":4},"hi":{"line":65,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"ident":["_private_action",{"lo":{"line":65,"col":15},"hi":{"line":65,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0}],"index":[0,65]},"local_id":3},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0},{"data":{"ValueNs":"_private_action"},"disambiguator":0}],"index":[0,66]},"ty":{"Uint":"U32"},"attributes":[]}],false]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":64,"col":17},"hi":{"line":64,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":64,"col":17},"hi":{"line":64,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Actions that can be produced at the end of a contract execution. This"]},"id":79,"style":"Outer","span":{"lo":{"line":56,"col":0},"hi":{"line":56,"col":73},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," type is deliberately not cloneable so that we can enforce that"]},"id":80,"style":"Outer","span":{"lo":{"line":57,"col":0},"hi":{"line":57,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," `and_then` and `or_else` can only be used when more than one event is"]},"id":81,"style":"Outer","span":{"lo":{"line":58,"col":0},"hi":{"line":58,"col":73},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," created."]},"id":82,"style":"Outer","span":{"lo":{"line":59,"col":0},"hi":{"line":59,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":83,"style":"Outer","span":{"lo":{"line":60,"col":0},"hi":{"line":60,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," This type is marked as `must_use` since functions that produce"]},"id":84,"style":"Outer","span":{"lo":{"line":61,"col":0},"hi":{"line":61,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," values of the type are effectful."]},"id":85,"style":"Outer","span":{"lo":{"line":62,"col":0},"hi":{"line":62,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"must_use","args":"Empty","tokens":null},"tokens":null}},"id":86,"style":"Outer","span":{"lo":{"line":63,"col":0},"hi":{"line":63,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":0}],"index":[0,67]},"span":{"lo":{"line":68,"col":0},"hi":{"line":72,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":68,"col":0},"hi":{"line":72,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":68,"col":11},"hi":{"line":68,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":68,"col":4},"hi":{"line":68,"col":4},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":null,"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0}],"index":[0,65]}}},"items":[{"ident":["tag",{"lo":{"line":69,"col":11},"hi":{"line":69,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":0},{"data":{"ValueNs":"tag"},"disambiguator":0}],"index":[0,68]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":0},{"data":{"ValueNs":"tag"},"disambiguator":0}],"index":[0,68]},"local_id":8},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":0},{"data":{"ValueNs":"tag"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,242]},"name":"Fresh","span":{"lo":{"line":69,"col":15},"hi":{"line":69,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":69,"col":28},"hi":{"line":69,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":69,"col":14},"hi":{"line":69,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0}],"index":[0,65]}}},false]},"span":{"lo":{"line":69,"col":15},"hi":{"line":69,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":0},{"data":{"ValueNs":"tag"},"disambiguator":0}],"index":[0,68]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0}],"index":[0,65]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0}],"index":[0,65]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":0},{"data":{"ValueNs":"tag"},"disambiguator":0}],"index":[0,68]},"local_id":1},"attributes":[]}],"ret":{"Uint":"U32"},"body":{"ty":{"Uint":"U32"},"span":{"lo":{"line":69,"col":29},"hi":{"line":71,"col":5},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":6,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":69,"col":29},"hi":{"line":71,"col":5},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Uint":"U32"},"span":{"lo":{"line":70,"col":8},"hi":{"line":70,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Field":{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0},{"data":{"ValueNs":"_private_action"},"disambiguator":0}],"index":[0,66]},"lhs":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0}],"index":[0,65]}}},"span":{"lo":{"line":70,"col":8},"hi":{"line":70,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Action"},"disambiguator":0}],"index":[0,65]}}},false]},"span":{"lo":{"line":70,"col":8},"hi":{"line":70,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":0},{"data":{"ValueNs":"tag"},"disambiguator":0}],"index":[0,68]},"local_id":2}}}},"hir_id":null,"attributes":[]}}},"hir_id":[68,4],"attributes":[]}}},"hir_id":[68,3],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[68,7],"attributes":[]},"sig_span":{"lo":{"line":69,"col":4},"hi":{"line":69,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":69,"col":4},"hi":{"line":71,"col":5},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":69,"col":4},"hi":{"line":69,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"ValueNs":"_"},"disambiguator":0}],"index":[0,220]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"ValueNs":"_"},"disambiguator":0}],"index":[0,220]},"span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Const":[{"Tuple":[]},{"ty":{"Tuple":[]},"span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":4,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":null,"safety_mode":"Safe"}},"hir_id":[220,2],"attributes":[]}]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:80:1: 80:34 (#40), close: concordium/src/concordium_types.rs:80:1: 80:34 (#40) }"}},"delim":"Parenthesis","tokens":"hax_compilation"}},"tokens":null},"tokens":null}},"id":423,"style":"Outer","span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Attr","hax_lib_macros::hax_attributes"]},"call_site":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":74,"col":0},"hi":{"line":74,"col":19},"filename":{"Real":{"LocalPath":"/home/au538501/Documents/LocalHacspec/hacspec-v2/hax-lib-macros/src/lib.rs"}}},"allow_internal_unstable":null,"edition":"Edition2021","macro_def_id":{"krate":"hax_lib_macros","path":[{"data":{"MacroNs":"hax_attributes"},"disambiguator":0}],"index":[9,35]},"parent_module":{"krate":"hax_lib_macros","path":[],"index":[9,0]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"ValueNs":"_"},"disambiguator":0},{"data":{"ValueNs":"refinement"},"disambiguator":0}],"index":[0,222]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"ValueNs":"_"},"disambiguator":0},{"data":{"ValueNs":"refinement"},"disambiguator":0}],"index":[0,222]},"span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Fn":[{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":80,"col":33},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":80,"col":33},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"span":{"lo":{"line":83,"col":8},"hi":{"line":83,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"error_code","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"ValueNs":"_"},"disambiguator":0},{"data":{"ValueNs":"refinement"},"disambiguator":0}],"index":[0,222]},"local_id":2}},"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"ty_span":{"lo":{"line":83,"col":20},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"self_kind":null,"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"ValueNs":"_"},"disambiguator":0},{"data":{"ValueNs":"refinement"},"disambiguator":0}],"index":[0,222]},"local_id":1},"attributes":[]}],"ret":"Bool","body":{"ty":"Bool","span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":4,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":"Bool","span":{"lo":{"line":82,"col":13},"hi":{"line":82,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Literal":{"lit":{"node":{"Bool":true},"span":{"lo":{"line":82,"col":13},"hi":{"line":82,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"neg":false}},"hir_id":[222,3],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[222,5],"attributes":[]},"sig_span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::associated_with","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:80:1: 80:34 (#40), close: concordium/src/concordium_types.rs:80:1: 80:34 (#40) }"}},"delim":"Parenthesis","tokens":"\"47dd5abfb2084d42b68d2ab170d0aa95\", refinement"}},"tokens":null},"tokens":null}},"id":424,"style":"Outer","span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"_hax::late_skip","args":"Empty","tokens":null},"tokens":null}},"id":425,"style":"Outer","span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:80:1: 80:34 (#40), close: concordium/src/concordium_types.rs:80:1: 80:34 (#40) }"}},"delim":"Parenthesis","tokens":"hax_compilation"}},"tokens":null},"tokens":null}},"id":423,"style":"Outer","span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Attr","hax_lib_macros::hax_attributes"]},"call_site":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":74,"col":0},"hi":{"line":74,"col":19},"filename":{"Real":{"LocalPath":"/home/au538501/Documents/LocalHacspec/hacspec-v2/hax-lib-macros/src/lib.rs"}}},"allow_internal_unstable":null,"edition":"Edition2021","macro_def_id":{"krate":"hax_lib_macros","path":[{"data":{"MacroNs":"hax_attributes"},"disambiguator":0}],"index":[9,35]},"parent_module":{"krate":"hax_lib_macros","path":[],"index":[9,0]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]},"span":{"lo":{"line":81,"col":0},"hi":{"line":84,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":81,"col":0},"hi":{"line":84,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Struct":[[{"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"ident":["error_code",{"lo":{"line":83,"col":8},"hi":{"line":83,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]},"local_id":3},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0},{"data":{"ValueNs":"error_code"},"disambiguator":0}],"index":[0,223]},"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::uuid","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:80:1: 80:34 (#40), close: concordium/src/concordium_types.rs:80:1: 80:34 (#40) }"}},"delim":"Parenthesis","tokens":"\"47dd5abfb2084d42b68d2ab170d0aa95\""}},"tokens":null},"tokens":null}},"id":432,"style":"Outer","span":{"lo":{"line":80,"col":0},"hi":{"line":80,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]}],false]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"doc","args":{"Todo":"Eq(concordium/src/concordium_types.rs:74:1: 74:75 (#0), Hir(MetaItemLit { symbol: \" An error message, signalling rejection of a smart contract invocation.\", suffix: None, kind: Str(\" An error message, signalling rejection of a smart contract invocation.\", Cooked), span: concordium/src/concordium_types.rs:74:1: 74:75 (#0) }))"},"tokens":null},"tokens":null}},"id":426,"style":"Outer","span":{"lo":{"line":74,"col":0},"hi":{"line":74,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"doc","args":{"Todo":"Eq(concordium/src/concordium_types.rs:75:1: 75:74 (#0), Hir(MetaItemLit { symbol: \" The client will see the error code as a reject reason; if a schema is\", suffix: None, kind: Str(\" The client will see the error code as a reject reason; if a schema is\", Cooked), span: concordium/src/concordium_types.rs:75:1: 75:74 (#0) }))"},"tokens":null},"tokens":null}},"id":427,"style":"Outer","span":{"lo":{"line":75,"col":0},"hi":{"line":75,"col":73},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"doc","args":{"Todo":"Eq(concordium/src/concordium_types.rs:76:1: 76:72 (#0), Hir(MetaItemLit { symbol: \" provided, the error message corresponding to the error code will be\", suffix: None, kind: Str(\" provided, the error message corresponding to the error code will be\", Cooked), span: concordium/src/concordium_types.rs:76:1: 76:72 (#0) }))"},"tokens":null},"tokens":null}},"id":428,"style":"Outer","span":{"lo":{"line":76,"col":0},"hi":{"line":76,"col":71},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"doc","args":{"Todo":"Eq(concordium/src/concordium_types.rs:77:1: 77:74 (#0), Hir(MetaItemLit { symbol: \" displayed. The valid range for an error code is from i32::MIN to -1.\", suffix: None, kind: Str(\" displayed. The valid range for an error code is from i32::MIN to -1.\", Cooked), span: concordium/src/concordium_types.rs:77:1: 77:74 (#0) }))"},"tokens":null},"tokens":null}},"id":429,"style":"Outer","span":{"lo":{"line":77,"col":0},"hi":{"line":77,"col":73},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"repr","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:79:7: 79:20 (#0), close: concordium/src/concordium_types.rs:79:7: 79:20 (#0) }"}},"delim":"Parenthesis","tokens":"transparent"}},"tokens":null},"tokens":null}},"id":430,"style":"Outer","span":{"lo":{"line":79,"col":0},"hi":{"line":79,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17}],"index":[0,212]},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Debug"},"disambiguator":0}],"index":[1,9139]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"items":[{"ident":["fmt",{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"local_id":24},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,285]},"name":"Fresh","span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"local_id":25},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,286]},"name":"Fresh","span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"local_id":26},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[0,287]},"name":"Fresh","span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"local_id":1},"attributes":[]},{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"f","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"local_id":4}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"ty_span":null,"self_kind":null,"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"local_id":3},"attributes":[]}],"ret":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"body":{"ty":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":22,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'b"},"disambiguator":0}],"index":[1,9200]},"'b"]}}]}},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53932]},"'_"]}}]}},"Str",false]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":2,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53933]},"'_"]}}]}},"Str",false]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":3,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[1,53934]},"'_"]}}]}},{"Dynamic":[[{"value":{"ExistentialPredicate":{"todo":"Trait(core::fmt::Debug)"}},"bound_vars":[]}],{"kind":{"ReLateBound":[0,{"var":3,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[1,53934]},"'_"]}}]}},"Dyn"]},false]}],"output":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'b"},"disambiguator":0}],"index":[1,9200]},"'b"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53932]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53933]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[1,53934]},"'_"]}}]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'b"},"disambiguator":0}],"index":[1,9200]},"'b"]}}]}},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53932]},"'_"]}}]}},"Str",false]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":2,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53933]},"'_"]}}]}},"Str",false]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":3,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[1,53934]},"'_"]}}]}},{"Dynamic":[[{"value":{"ExistentialPredicate":{"todo":"Trait(core::fmt::Debug)"}},"bound_vars":[]}],{"kind":{"ReLateBound":[0,{"var":3,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[1,53934]},"'_"]}}]}},"Dyn"]},false]}],"output":{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[1,42444]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'b"},"disambiguator":0}],"index":[1,9200]},"'b"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,53932]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,53933]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[1,53934]},"'_"]}}]}},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":"Impl","disambiguator":7},{"data":{"ValueNs":"debug_struct_field1_finish"},"disambiguator":0}],"index":[1,9199]}}},"hir_id":null,"attributes":[]},"args":[{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":{"Mut":{"allow_two_phase_borrow":true}},"arg":{"ty":{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[{"Lifetime":{"kind":"ReErased"}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"Formatter"},"disambiguator":0}],"index":[1,9114]}}},true]},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"f","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"local_id":4}}}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[213,13],"attributes":[]},{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":"Str","span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Literal":{"lit":{"node":{"Str":["Reject","Cooked"]},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"neg":false}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[213,15],"attributes":[]},{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":"Str","span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},"Str",false]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Literal":{"lit":{"node":{"Str":["error_code","Cooked"]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"neg":false}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[213,16],"attributes":[]},{"ty":{"Ref":[{"kind":"ReErased"},{"Dynamic":[[{"value":{"ExistentialPredicate":{"todo":"Trait(core::fmt::Debug)"}},"bound_vars":[]}],{"kind":"ReErased"},"Dyn"]},false]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Pointer":{"cast":"Unsize","source":{"ty":{"Ref":[{"kind":"ReErased"},{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]},false]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]},false]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Field":{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0},{"data":{"ValueNs":"error_code"},"disambiguator":0}],"index":[0,223]},"lhs":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":17},{"data":{"ValueNs":"fmt"},"disambiguator":0}],"index":[0,213]},"local_id":2}}}},"hir_id":null,"attributes":[]}}},"hir_id":[213,20],"attributes":[]}}},"hir_id":[213,19],"attributes":[]}}},"hir_id":[213,18],"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[213,17],"attributes":[]}],"from_hir_call":true,"fn_span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":null}},"hir_id":[213,5],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[213,23],"attributes":[]},"sig_span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":411,"style":"Outer","span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":411,"style":"Outer","span":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Debug"]},"call_site":{"lo":{"line":78,"col":9},"hi":{"line":78,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":588,"col":4},"hi":{"line":588,"col":19},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/fmt/mod.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/fmt/mod.rs"}}}},"allow_internal_unstable":["core_intrinsics","fmt_helpers_for_derive"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"macros"},"disambiguator":0},{"data":{"MacroNs":"Debug"},"disambiguator":0}],"index":[1,9142]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"fmt"},"disambiguator":0},{"data":{"TypeNs":"macros"},"disambiguator":0}],"index":[1,9141]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":18}],"index":[0,214]},"span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"StructuralEq"},"disambiguator":0}],"index":[1,2693]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"items":[]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":415,"style":"Outer","span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Eq"]},"call_site":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":302,"col":0},"hi":{"line":302,"col":12},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/cmp.rs"}}}},"allow_internal_unstable":["core_intrinsics","derive_eq","structural_match","no_coverage"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"MacroNs":"Eq"},"disambiguator":0}],"index":[1,2317]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0}],"index":[1,2288]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":19}],"index":[0,215]},"span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"Eq"},"disambiguator":0}],"index":[1,2315]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"items":[{"ident":["assert_receiver_is_total_eq",{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":19},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0}],"index":[0,216]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":19},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0}],"index":[0,216]},"local_id":14},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":19},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,288]},"name":"Fresh","span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":19},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0}],"index":[0,216]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":19},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0}],"index":[0,216]},"local_id":1},"attributes":[]}],"ret":{"Tuple":[]},"body":{"ty":{"Tuple":[]},"span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":12,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[{"kind":{"Let":{"remainder_scope":{"id":12,"data":{"Remainder":0}},"init_scope":{"id":3,"data":"Node"},"pattern":{"ty":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"AssertParamIsEq"},"disambiguator":0}],"index":[1,2318]}}},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"AscribeUserType":{"ascription":{"annotation":{"user_ty":{"max_universe":0,"variables":[],"value":{"Todo":"Ty(core::cmp::AssertParamIsEq)"}},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"inferred_ty":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"AssertParamIsEq"},"disambiguator":0}],"index":[1,2318]}}}},"variance":"Covariant"},"subpattern":{"ty":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"AssertParamIsEq"},"disambiguator":0}],"index":[1,2318]}}},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":"Wild","hir_id":null,"attributes":[]}}},"hir_id":null,"attributes":[]},"initializer":null,"else_block":null,"lint_level":{"Explicit":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":19},{"data":{"ValueNs":"assert_receiver_is_total_eq"},"disambiguator":0}],"index":[0,216]},"local_id":10}},"attributes":[]}},"opt_destruction_scope":{"id":3,"data":"Destruction"}}],"expr":null,"safety_mode":"Safe"}},"hir_id":[216,13],"attributes":[]},"sig_span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":412,"style":"Outer","span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"doc","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:78:17: 78:19 (#37), close: concordium/src/concordium_types.rs:78:17: 78:19 (#37) }"}},"delim":"Parenthesis","tokens":"hidden"}},"tokens":null},"tokens":null}},"id":413,"style":"Outer","span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_coverage","args":"Empty","tokens":null},"tokens":null}},"id":414,"style":"Outer","span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":416,"style":"Outer","span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":416,"style":"Outer","span":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Eq"]},"call_site":{"lo":{"line":78,"col":16},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":302,"col":0},"hi":{"line":302,"col":12},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/cmp.rs"}}}},"allow_internal_unstable":["core_intrinsics","derive_eq","structural_match","no_coverage"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"MacroNs":"Eq"},"disambiguator":0}],"index":[1,2317]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0}],"index":[1,2288]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":20}],"index":[0,217]},"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"StructuralPartialEq"},"disambiguator":0}],"index":[1,2692]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"items":[]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":417,"style":"Outer","span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","PartialEq"]},"call_site":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":236,"col":0},"hi":{"line":236,"col":19},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/cmp.rs"}}}},"allow_internal_unstable":["core_intrinsics","structural_match"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"MacroNs":"PartialEq"},"disambiguator":0}],"index":[1,2314]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0}],"index":[1,2288]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21}],"index":[0,218]},"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":81,"col":17},"hi":{"line":81,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0}],"index":[1,2310]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"items":[{"ident":["eq",{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,219]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,219]},"local_id":14},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,289]},"name":"Fresh","span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,219]},"local_id":15},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,290]},"name":"Fresh","span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,219]},"local_id":2}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"ty_span":null,"self_kind":"ImmRef","hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,219]},"local_id":1},"attributes":[]},{"pat":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"other","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,219]},"local_id":4}},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"ty_span":null,"self_kind":null,"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,219]},"local_id":3},"attributes":[]}],"ret":"Bool","body":{"ty":"Bool","span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":12,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":"Bool","span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51736]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,51737]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]}],"output":"Bool","c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51736]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,51737]},"'_"]}}]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51736]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,51737]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]}],"output":"Bool","c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[1,51736]},"'_"]}},{"Region":{"BrNamed":[{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0},{"data":{"ValueNs":"eq"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[1,51737]},"'_"]}}]}},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"TypeNs":"PartialEq"},"disambiguator":0},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[1,2312]}}},"hir_id":null,"attributes":[]},"args":[{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Field":{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0},{"data":{"ValueNs":"error_code"},"disambiguator":0}],"index":[0,223]},"lhs":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"self","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,219]},"local_id":2}}}},"hir_id":null,"attributes":[]}}},"hir_id":[219,7],"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[219,6],"attributes":[]},{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},false]},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Borrow":{"borrow_kind":"Shared","arg":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Field":{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0},{"data":{"ValueNs":"error_code"},"disambiguator":0}],"index":[0,223]},"lhs":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Deref":{"arg":{"ty":{"Ref":[{"kind":"ReErased"},{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},false]},"span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"other","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":21},{"data":{"ValueNs":"eq"},"disambiguator":0}],"index":[0,219]},"local_id":4}}}},"hir_id":null,"attributes":[]}}},"hir_id":[219,10],"attributes":[]}}},"hir_id":null,"attributes":[]}}},"hir_id":[219,9],"attributes":[]}],"from_hir_call":false,"fn_span":{"lo":{"line":83,"col":4},"hi":{"line":83,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":{"impl":{"Concrete":{"id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":"Impl","disambiguator":209}],"index":[1,22494]},"generics":[]}},"args":[]}}},"hir_id":[219,5],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[219,13],"attributes":[]},"sig_span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":418,"style":"Outer","span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":419,"style":"Outer","span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":419,"style":"Outer","span":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","PartialEq"]},"call_site":{"lo":{"line":78,"col":20},"hi":{"line":78,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":236,"col":0},"hi":{"line":236,"col":19},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/cmp.rs"}}}},"allow_internal_unstable":["core_intrinsics","structural_match"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0},{"data":{"MacroNs":"PartialEq"},"disambiguator":0}],"index":[1,2314]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"cmp"},"disambiguator":0}],"index":[1,2288]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":1}],"index":[0,69]},"span":{"lo":{"line":87,"col":0},"hi":{"line":95,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":87,"col":0},"hi":{"line":95,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":87,"col":23},"hi":{"line":87,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":87,"col":4},"hi":{"line":87,"col":4},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"items":[{"ident":["default",{"lo":{"line":90,"col":7},"hi":{"line":90,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":1},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[0,239]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":90,"col":24},"hi":{"line":90,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":90,"col":14},"hi":{"line":90,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[],"ret":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"body":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"span":{"lo":{"line":90,"col":25},"hi":{"line":94,"col":5},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":15,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":90,"col":25},"hi":{"line":94,"col":5},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"span":{"lo":{"line":91,"col":8},"hi":{"line":93,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,221]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]},"variant_index":0,"typ_is_record":true,"variant_is_record":true,"typ_is_struct":true},"user_ty":null,"fields":[{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0},{"data":{"ValueNs":"error_code"},"disambiguator":0}],"index":[0,223]},"value":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"span":{"lo":{"line":92,"col":24},"hi":{"line":92,"col":68},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":14,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":92,"col":24},"hi":{"line":92,"col":68},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"span":{"lo":{"line":92,"col":32},"hi":{"line":92,"col":67},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[{"Int":"I32"}],"output":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"c_variadic":false,"unsafety":"Unsafe","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[{"Int":"I32"}],"output":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"c_variadic":false,"unsafety":"Unsafe","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"span":{"lo":{"line":92,"col":32},"hi":{"line":92,"col":57},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":"Impl","disambiguator":56},{"data":{"ValueNs":"new_unchecked"},"disambiguator":0}],"index":[1,22145]}}},"hir_id":null,"attributes":[]},"args":[{"ty":{"Int":"I32"},"span":{"lo":{"line":92,"col":58},"hi":{"line":92,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"NamedConst":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":"Impl","disambiguator":2},{"data":{"ValueNs":"MIN"},"disambiguator":0}],"index":[1,28926]},"substs":[],"user_ty":null,"impl":null}},"hir_id":[239,10],"attributes":[]}],"from_hir_call":true,"fn_span":{"lo":{"line":92,"col":32},"hi":{"line":92,"col":67},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":null}},"hir_id":[239,5],"attributes":[]},"safety_mode":"ExplicitUnsafe"}},"hir_id":[239,4],"attributes":[]}}],"base":null}},"hir_id":[239,1],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[239,16],"attributes":[]},"sig_span":{"lo":{"line":90,"col":4},"hi":{"line":90,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":90,"col":4},"hi":{"line":94,"col":5},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":90,"col":4},"hi":{"line":90,"col":4},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::skip","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:89:5: 89:12 (#49), close: concordium/src/concordium_types.rs:89:5: 89:12 (#49) }"}},"delim":"Parenthesis","tokens":""}},"tokens":null},"tokens":null}},"id":444,"style":"Outer","span":{"lo":{"line":89,"col":4},"hi":{"line":89,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"inline","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:88:13: 88:14 (#0), close: concordium/src/concordium_types.rs:88:20: 88:21 (#0) }"}},"delim":"Parenthesis","tokens":"always"}},"tokens":null},"tokens":null}},"id":443,"style":"Outer","span":{"lo":{"line":88,"col":4},"hi":{"line":88,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Default error is i32::MIN."]},"id":95,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Default error is i32::MIN."]},"id":95,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":2}],"index":[0,70]},"span":{"lo":{"line":97,"col":0},"hi":{"line":108,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":97,"col":0},"hi":{"line":108,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":97,"col":11},"hi":{"line":97,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":97,"col":4},"hi":{"line":97,"col":4},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":null,"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"items":[{"ident":["new",{"lo":{"line":100,"col":11},"hi":{"line":100,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":2},{"data":{"ValueNs":"new"},"disambiguator":0}],"index":[0,238]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":100,"col":38},"hi":{"line":100,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":100,"col":14},"hi":{"line":100,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[{"pat":{"ty":{"Int":"I32"},"span":{"lo":{"line":100,"col":15},"hi":{"line":100,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"x","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":2},{"data":{"ValueNs":"new"},"disambiguator":0}],"index":[0,238]},"local_id":2}},"ty":{"Int":"I32"},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"ty":{"Int":"I32"},"ty_span":{"lo":{"line":100,"col":18},"hi":{"line":100,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"self_kind":null,"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":2},{"data":{"ValueNs":"new"},"disambiguator":0}],"index":[0,238]},"local_id":1},"attributes":[]}],"ret":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]}}},"body":{"ty":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]}}},"span":{"lo":{"line":100,"col":39},"hi":{"line":107,"col":5},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":35,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":100,"col":39},"hi":{"line":107,"col":5},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]}}},"span":{"lo":{"line":101,"col":8},"hi":{"line":106,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"If":{"if_then_scope":{"id":30,"data":"IfThen"},"cond":{"ty":"Bool","span":{"lo":{"line":101,"col":11},"hi":{"line":101,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Use":{"source":{"ty":"Bool","span":{"lo":{"line":101,"col":11},"hi":{"line":101,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binary":{"op":"Lt","lhs":{"ty":{"Int":"I32"},"span":{"lo":{"line":101,"col":11},"hi":{"line":101,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"x","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":2},{"data":{"ValueNs":"new"},"disambiguator":0}],"index":[0,238]},"local_id":2}}}},"hir_id":[238,5],"attributes":[]},"rhs":{"ty":{"Int":"I32"},"span":{"lo":{"line":101,"col":15},"hi":{"line":101,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Literal":{"lit":{"node":{"Int":[0,"Unsuffixed"]},"span":{"lo":{"line":101,"col":15},"hi":{"line":101,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"neg":false}},"hir_id":[238,7],"attributes":[]}}},"hir_id":[238,4],"attributes":[]}}},"hir_id":[238,8],"attributes":[]},"then":{"ty":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]}}},"span":{"lo":{"line":101,"col":17},"hi":{"line":104,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":29,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":101,"col":17},"hi":{"line":104,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[{"kind":{"Let":{"remainder_scope":{"id":29,"data":{"Remainder":0}},"init_scope":{"id":9,"data":"Node"},"pattern":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"span":{"lo":{"line":102,"col":16},"hi":{"line":102,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Binding":{"mutability":false,"mode":"ByValue","var":{"name":"error_code","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":2},{"data":{"ValueNs":"new"},"disambiguator":0}],"index":[0,238]},"local_id":20}},"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"subpattern":null,"is_primary":true}},"hir_id":null,"attributes":[]},"initializer":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"span":{"lo":{"line":102,"col":29},"hi":{"line":102,"col":68},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":18,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":102,"col":29},"hi":{"line":102,"col":68},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"span":{"lo":{"line":102,"col":38},"hi":{"line":102,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[{"Int":"I32"}],"output":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"c_variadic":false,"unsafety":"Unsafe","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[{"Int":"I32"}],"output":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"c_variadic":false,"unsafety":"Unsafe","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"span":{"lo":{"line":102,"col":38},"hi":{"line":102,"col":63},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":"Impl","disambiguator":56},{"data":{"ValueNs":"new_unchecked"},"disambiguator":0}],"index":[1,22145]}}},"hir_id":null,"attributes":[]},"args":[{"ty":{"Int":"I32"},"span":{"lo":{"line":102,"col":64},"hi":{"line":102,"col":65},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"x","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":2},{"data":{"ValueNs":"new"},"disambiguator":0}],"index":[0,238]},"local_id":2}}}},"hir_id":[238,16],"attributes":[]}],"from_hir_call":true,"fn_span":{"lo":{"line":102,"col":38},"hi":{"line":102,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":null}},"hir_id":[238,11],"attributes":[]},"safety_mode":"ExplicitUnsafe"}},"hir_id":[238,10],"attributes":[]},"else_block":null,"lint_level":{"Explicit":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":2},{"data":{"ValueNs":"new"},"disambiguator":0}],"index":[0,238]},"local_id":19}},"attributes":[]}},"opt_destruction_scope":{"id":9,"data":"Destruction"}}],"expr":{"ty":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]}}},"span":{"lo":{"line":103,"col":12},"hi":{"line":103,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0}],"index":[1,41362]},"typ":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]},"variant":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0},{"data":{"TypeNs":"Some"},"disambiguator":0}],"index":[1,41366]},"variant_index":1,"typ_is_record":false,"variant_is_record":false,"typ_is_struct":false},"user_ty":null,"fields":[{"field":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0},{"data":{"TypeNs":"Some"},"disambiguator":0},{"data":{"ValueNs":"0"},"disambiguator":0}],"index":[1,41368]},"value":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}},"span":{"lo":{"line":103,"col":17},"hi":{"line":103,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,221]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]},"variant_index":0,"typ_is_record":true,"variant_is_record":true,"typ_is_struct":true},"user_ty":null,"fields":[{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0},{"data":{"ValueNs":"error_code"},"disambiguator":0}],"index":[0,223]},"value":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"num"},"disambiguator":0},{"data":{"TypeNs":"nonzero"},"disambiguator":0},{"data":{"TypeNs":"NonZeroI32"},"disambiguator":0}],"index":[1,22484]}}},"span":{"lo":{"line":103,"col":26},"hi":{"line":103,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"VarRef":{"id":{"name":"error_code","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":2},{"data":{"ValueNs":"new"},"disambiguator":0}],"index":[0,238]},"local_id":20}}}},"hir_id":[238,27],"attributes":[]}}],"base":null}},"hir_id":[238,24],"attributes":[]}}],"base":null}},"hir_id":[238,21],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[238,30],"attributes":[]},"else_opt":{"ty":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]}}},"span":{"lo":{"line":104,"col":15},"hi":{"line":106,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":34,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":104,"col":15},"hi":{"line":106,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]}}},"span":{"lo":{"line":105,"col":12},"hi":{"line":105,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0}],"index":[1,41362]},"typ":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]},"variant":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0},{"data":{"TypeNs":"None"},"disambiguator":0}],"index":[1,41364]},"variant_index":0,"typ_is_record":false,"variant_is_record":false,"typ_is_struct":false},"user_ty":null,"fields":[],"base":null}},"hir_id":[238,32],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[238,31],"attributes":[]}}},"hir_id":[238,3],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[238,36],"attributes":[]},"sig_span":{"lo":{"line":100,"col":4},"hi":{"line":100,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":100,"col":4},"hi":{"line":107,"col":5},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":100,"col":4},"hi":{"line":100,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"_hax::skip","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:99:5: 99:12 (#46), close: concordium/src/concordium_types.rs:99:5: 99:12 (#46) }"}},"delim":"Parenthesis","tokens":""}},"tokens":null},"tokens":null}},"id":441,"style":"Outer","span":{"lo":{"line":99,"col":4},"hi":{"line":99,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," This returns `None` for all values >= 0 and `Some` otherwise."]},"id":440,"style":"Outer","span":{"lo":{"line":98,"col":4},"hi":{"line":98,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"bail"},"disambiguator":0}],"index":[0,71]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"bail"},"disambiguator":0}],"index":[0,71]},"span":{"lo":{"line":118,"col":0},"hi":{"line":127,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":118,"col":0},"hi":{"line":127,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Macro":[{"body":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:118:19: 118:20 (#0), close: concordium/src/concordium_types.rs:127:1: 127:2 (#0) }"}},"delim":"Brace","tokens":"() => { { return Err(Default :: default()) ; } } ; ($arg : expr) =>\n{ { return Err($arg) ; } } ;"},"macro_rules":true},"Bang"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The `bail` macro can be used for cleaner error handling. If the function has"]},"id":100,"style":"Outer","span":{"lo":{"line":112,"col":0},"hi":{"line":112,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," result type `Result` invoking `bail` will terminate execution early with an"]},"id":101,"style":"Outer","span":{"lo":{"line":113,"col":0},"hi":{"line":113,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," error."]},"id":102,"style":"Outer","span":{"lo":{"line":114,"col":0},"hi":{"line":114,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," If an argument is supplied, this will be used as the error, otherwise it"]},"id":103,"style":"Outer","span":{"lo":{"line":115,"col":0},"hi":{"line":115,"col":76},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," requires the type `E` in `Result<_, E>` to implement the `Default` trait."]},"id":104,"style":"Outer","span":{"lo":{"line":116,"col":0},"hi":{"line":116,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"macro_export","args":"Empty","tokens":null},"tokens":null}},"id":105,"style":"Outer","span":{"lo":{"line":117,"col":0},"hi":{"line":117,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"ensure"},"disambiguator":0}],"index":[0,72]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"ensure"},"disambiguator":0}],"index":[0,72]},"span":{"lo":{"line":133,"col":0},"hi":{"line":144,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":133,"col":0},"hi":{"line":144,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Macro":[{"body":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:133:21: 133:22 (#0), close: concordium/src/concordium_types.rs:144:1: 144:2 (#0) }"}},"delim":"Brace","tokens":"($p : expr) => { if! $p { $crate :: bail! () ; } } ; ($p : expr, $arg : expr)\n=> { { if! $p { $crate :: bail! ($arg) ; } } } ;"},"macro_rules":true},"Bang"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The `ensure` macro can be used for cleaner error handling. It is analogous"]},"id":106,"style":"Outer","span":{"lo":{"line":129,"col":0},"hi":{"line":129,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," to `assert`, but instead of panicking it uses `bail` to terminate execution"]},"id":107,"style":"Outer","span":{"lo":{"line":130,"col":0},"hi":{"line":130,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," of the function early."]},"id":108,"style":"Outer","span":{"lo":{"line":131,"col":0},"hi":{"line":131,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"macro_export","args":"Empty","tokens":null},"tokens":null}},"id":109,"style":"Outer","span":{"lo":{"line":132,"col":0},"hi":{"line":132,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"ensure_eq"},"disambiguator":0}],"index":[0,73]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"ensure_eq"},"disambiguator":0}],"index":[0,73]},"span":{"lo":{"line":149,"col":0},"hi":{"line":156,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":149,"col":0},"hi":{"line":156,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Macro":[{"body":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:149:24: 149:25 (#0), close: concordium/src/concordium_types.rs:156:1: 156:2 (#0) }"}},"delim":"Brace","tokens":"($l : expr, $r : expr) => { $crate :: ensure! ($l == $r) } ;\n($l : expr, $r : expr, $arg : expr) => { $crate :: ensure! ($l == $r, $arg) }\n;"},"macro_rules":true},"Bang"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," ## Variants of `ensure` for ease of use in certain contexts."]},"id":110,"style":"Outer","span":{"lo":{"line":146,"col":0},"hi":{"line":146,"col":64},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Ensure the first two arguments are equal, using `bail` otherwise."]},"id":111,"style":"Outer","span":{"lo":{"line":147,"col":0},"hi":{"line":147,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"macro_export","args":"Empty","tokens":null},"tokens":null}},"id":112,"style":"Outer","span":{"lo":{"line":148,"col":0},"hi":{"line":148,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"ensure_ne"},"disambiguator":0}],"index":[0,74]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"ensure_ne"},"disambiguator":0}],"index":[0,74]},"span":{"lo":{"line":160,"col":0},"hi":{"line":167,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":160,"col":0},"hi":{"line":167,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Macro":[{"body":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:160:24: 160:25 (#0), close: concordium/src/concordium_types.rs:167:1: 167:2 (#0) }"}},"delim":"Brace","tokens":"($l : expr, $r : expr) => { $crate :: ensure! ($l != $r) } ;\n($l : expr, $r : expr, $arg : expr) => { $crate :: ensure! ($l != $r, $arg) }\n;"},"macro_rules":true},"Bang"]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"macro_export","args":"Empty","tokens":null},"tokens":null}},"id":113,"style":"Outer","span":{"lo":{"line":158,"col":0},"hi":{"line":158,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Ensure the first two arguments are __not__ equal, using `bail` otherwise."]},"id":114,"style":"Outer","span":{"lo":{"line":159,"col":0},"hi":{"line":159,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"fail"},"disambiguator":0}],"index":[0,75]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"fail"},"disambiguator":0}],"index":[0,75]},"span":{"lo":{"line":197,"col":0},"hi":{"line":211,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":197,"col":0},"hi":{"line":211,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Macro":[{"body":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:197:19: 197:20 (#0), close: concordium/src/concordium_types.rs:211:1: 211:2 (#0) }"}},"delim":"Brace","tokens":"() =>\n{\n {\n $crate :: test_infrastructure ::\n report_error(\"\", file! (), line! (), column! ()) ; panic! ()\n }\n} ; ($($arg : tt), +) =>\n{\n {\n let msg = & $crate :: alloc :: format! ($($arg), +) ; $crate ::\n test_infrastructure ::\n report_error(& msg, file! (), line! (), column! ()) ; panic!\n (\"{}\", msg)\n }\n} ;"},"macro_rules":true},"Bang"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The `fail` macro is used for testing as a substitute for the panic macro."]},"id":120,"style":"Outer","span":{"lo":{"line":192,"col":0},"hi":{"line":192,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," It reports back error information to the host."]},"id":121,"style":"Outer","span":{"lo":{"line":193,"col":0},"hi":{"line":193,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Used only in testing."]},"id":122,"style":"Outer","span":{"lo":{"line":194,"col":0},"hi":{"line":194,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:195:6: 195:7 (#0), close: concordium/src/concordium_types.rs:195:27: 195:28 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"std\")"}},"tokens":null},"tokens":null}},"id":123,"style":"Outer","span":{"lo":{"line":195,"col":0},"hi":{"line":195,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"macro_export","args":"Empty","tokens":null},"tokens":null}},"id":124,"style":"Outer","span":{"lo":{"line":196,"col":0},"hi":{"line":196,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"claim"},"disambiguator":0}],"index":[0,76]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"claim"},"disambiguator":0}],"index":[0,76]},"span":{"lo":{"line":217,"col":0},"hi":{"line":233,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":217,"col":0},"hi":{"line":233,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Macro":[{"body":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:217:20: 217:21 (#0), close: concordium/src/concordium_types.rs:233:1: 233:2 (#0) }"}},"delim":"Brace","tokens":"($cond : expr) => { if! $cond { $crate :: fail! () } } ; ($cond : expr,) =>\n{ if! $cond { $crate :: fail! () } } ; ($cond : expr, $($arg : tt), +) =>\n{ if! $cond { $crate :: fail! ($($arg), +) } } ;"},"macro_rules":true},"Bang"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The `claim` macro is used for testing as a substitute for the assert macro."]},"id":125,"style":"Outer","span":{"lo":{"line":213,"col":0},"hi":{"line":213,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," It checks the condition and if false it reports back an error."]},"id":126,"style":"Outer","span":{"lo":{"line":214,"col":0},"hi":{"line":214,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Used only in testing."]},"id":127,"style":"Outer","span":{"lo":{"line":215,"col":0},"hi":{"line":215,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"macro_export","args":"Empty","tokens":null},"tokens":null}},"id":128,"style":"Outer","span":{"lo":{"line":216,"col":0},"hi":{"line":216,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"claim_eq"},"disambiguator":0}],"index":[0,77]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"claim_eq"},"disambiguator":0}],"index":[0,77]},"span":{"lo":{"line":238,"col":0},"hi":{"line":248,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":238,"col":0},"hi":{"line":248,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Macro":[{"body":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:238:23: 238:24 (#0), close: concordium/src/concordium_types.rs:248:1: 248:2 (#0) }"}},"delim":"Brace","tokens":"($left : expr, $right : expr) =>\n{\n $crate :: claim!\n ($left == $right, \"left and right are not equal\\nleft: {:?}\\nright: {:?}\",\n $left, $right)\n} ; ($left : expr, $right : expr,) => { $crate :: claim_eq! ($left, $right) }\n; ($left : expr, $right : expr, $($arg : tt), +) =>\n{ $crate :: claim! ($left == $right, $($arg), +) } ;"},"macro_rules":true},"Bang"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Ensure the first two arguments are equal, just like `assert_eq!`, otherwise"]},"id":129,"style":"Outer","span":{"lo":{"line":235,"col":0},"hi":{"line":235,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," reports an error. Used only in testing."]},"id":130,"style":"Outer","span":{"lo":{"line":236,"col":0},"hi":{"line":236,"col":43},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"macro_export","args":"Empty","tokens":null},"tokens":null}},"id":131,"style":"Outer","span":{"lo":{"line":237,"col":0},"hi":{"line":237,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"claim_ne"},"disambiguator":0}],"index":[0,78]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"MacroNs":"claim_ne"},"disambiguator":0}],"index":[0,78]},"span":{"lo":{"line":254,"col":0},"hi":{"line":264,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":254,"col":0},"hi":{"line":264,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Macro":[{"body":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:254:23: 254:24 (#0), close: concordium/src/concordium_types.rs:264:1: 264:2 (#0) }"}},"delim":"Brace","tokens":"($left : expr, $right : expr) => { $crate :: claim! ($left != $right) } ;\n($left : expr, $right : expr,) => { $crate :: claim! ($left != $right) } ;\n($left : expr, $right : expr, $($arg : tt), +) =>\n{ $crate :: claim! ($left != $right, $($arg), +) } ;"},"macro_rules":true},"Bang"]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Ensure the first two arguments are *not* equal, just like `assert_ne!`,"]},"id":132,"style":"Outer","span":{"lo":{"line":250,"col":0},"hi":{"line":250,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," otherwise reports an error."]},"id":133,"style":"Outer","span":{"lo":{"line":251,"col":0},"hi":{"line":251,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Used only in testing."]},"id":134,"style":"Outer","span":{"lo":{"line":252,"col":0},"hi":{"line":252,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"macro_export","args":"Empty","tokens":null},"tokens":null}},"id":135,"style":"Outer","span":{"lo":{"line":253,"col":0},"hi":{"line":253,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveResult"},"disambiguator":0}],"index":[0,79]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveResult"},"disambiguator":0}],"index":[0,79]},"span":{"lo":{"line":290,"col":0},"hi":{"line":290,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":290,"col":0},"hi":{"line":290,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"TyAlias":[{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"A"}}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveResult"},"disambiguator":0}],"index":[0,79]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveResult"},"disambiguator":0},{"data":{"TypeNs":"A"},"disambiguator":0}],"index":[0,80]},"name":{"Plain":{"name":"A","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveResult"},"disambiguator":0}],"index":[0,79]},"local_id":1}}},"span":{"lo":{"line":290,"col":23},"hi":{"line":290,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":null,"synthetic":false}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":0,"name":"A"}}}]},"is_const":false,"is_positive":true}},"id":3652190691640089114}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":290,"col":25},"hi":{"line":290,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":290,"col":22},"hi":{"line":290,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The expected return type of the receive method of a smart contract."]},"id":136,"style":"Outer","span":{"lo":{"line":266,"col":0},"hi":{"line":266,"col":71},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":137,"style":"Outer","span":{"lo":{"line":267,"col":0},"hi":{"line":267,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Optionally, to define a custom type for error instead of using"]},"id":138,"style":"Outer","span":{"lo":{"line":268,"col":0},"hi":{"line":268,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Reject, allowing to track the reason for rejection, *but only in unit"]},"id":139,"style":"Outer","span":{"lo":{"line":269,"col":0},"hi":{"line":269,"col":73},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," tests*."]},"id":140,"style":"Outer","span":{"lo":{"line":270,"col":0},"hi":{"line":270,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":141,"style":"Outer","span":{"lo":{"line":271,"col":0},"hi":{"line":271,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," See also the documentation for [bail!](macro.bail.html) for how to use"]},"id":142,"style":"Outer","span":{"lo":{"line":272,"col":0},"hi":{"line":272,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," custom error types."]},"id":143,"style":"Outer","span":{"lo":{"line":273,"col":0},"hi":{"line":273,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":144,"style":"Outer","span":{"lo":{"line":274,"col":0},"hi":{"line":274,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," # Example"]},"id":145,"style":"Outer","span":{"lo":{"line":275,"col":0},"hi":{"line":275,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Defining a custom error type"]},"id":146,"style":"Outer","span":{"lo":{"line":276,"col":0},"hi":{"line":276,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // ```rust"]},"id":147,"style":"Outer","span":{"lo":{"line":277,"col":0},"hi":{"line":277,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // enum MyCustomError {"]},"id":148,"style":"Outer","span":{"lo":{"line":278,"col":0},"hi":{"line":278,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // SomeError"]},"id":149,"style":"Outer","span":{"lo":{"line":279,"col":0},"hi":{"line":279,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // }"]},"id":150,"style":"Outer","span":{"lo":{"line":280,"col":0},"hi":{"line":280,"col":8},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // "]},"id":151,"style":"Outer","span":{"lo":{"line":281,"col":0},"hi":{"line":281,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // #[receive(contract = \"mycontract\", name = \"receive\")]"]},"id":152,"style":"Outer","span":{"lo":{"line":282,"col":0},"hi":{"line":282,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // fn contract_receive("]},"id":153,"style":"Outer","span":{"lo":{"line":283,"col":0},"hi":{"line":283,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // ctx: &R,"]},"id":154,"style":"Outer","span":{"lo":{"line":284,"col":0},"hi":{"line":284,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // receive_amount: Amount,"]},"id":155,"style":"Outer","span":{"lo":{"line":285,"col":0},"hi":{"line":285,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // logger: &mut L,"]},"id":156,"style":"Outer","span":{"lo":{"line":286,"col":0},"hi":{"line":286,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // state: &mut State,"]},"id":157,"style":"Outer","span":{"lo":{"line":287,"col":0},"hi":{"line":287,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // ) -> Result { ... }"]},"id":158,"style":"Outer","span":{"lo":{"line":288,"col":0},"hi":{"line":288,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // ```"]},"id":159,"style":"Outer","span":{"lo":{"line":289,"col":0},"hi":{"line":289,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitResult"},"disambiguator":0}],"index":[0,81]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitResult"},"disambiguator":0}],"index":[0,81]},"span":{"lo":{"line":315,"col":0},"hi":{"line":315,"col":43},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":315,"col":0},"hi":{"line":315,"col":43},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"TyAlias":[{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"S"}}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"Reject"},"disambiguator":0}],"index":[0,221]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitResult"},"disambiguator":0}],"index":[0,81]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitResult"},"disambiguator":0},{"data":{"TypeNs":"S"},"disambiguator":0}],"index":[0,82]},"name":{"Plain":{"name":"S","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitResult"},"disambiguator":0}],"index":[0,81]},"local_id":1}}},"span":{"lo":{"line":315,"col":20},"hi":{"line":315,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":null,"synthetic":false}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":0,"name":"S"}}}]},"is_const":false,"is_positive":true}},"id":676887403273334043}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":315,"col":22},"hi":{"line":315,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":315,"col":19},"hi":{"line":315,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The expected return type of the init method of the smart contract,"]},"id":160,"style":"Outer","span":{"lo":{"line":292,"col":0},"hi":{"line":292,"col":70},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," parametrized by the state type of the smart contract."]},"id":161,"style":"Outer","span":{"lo":{"line":293,"col":0},"hi":{"line":293,"col":57},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":162,"style":"Outer","span":{"lo":{"line":294,"col":0},"hi":{"line":294,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Optionally, to define a custom type for error instead of using Reject,"]},"id":163,"style":"Outer","span":{"lo":{"line":295,"col":0},"hi":{"line":295,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," allowing the track the reason for rejection, *but only in unit tests*."]},"id":164,"style":"Outer","span":{"lo":{"line":296,"col":0},"hi":{"line":296,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":165,"style":"Outer","span":{"lo":{"line":297,"col":0},"hi":{"line":297,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," See also the documentation for [bail!](macro.bail.html) for how to use"]},"id":166,"style":"Outer","span":{"lo":{"line":298,"col":0},"hi":{"line":298,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," custom error types."]},"id":167,"style":"Outer","span":{"lo":{"line":299,"col":0},"hi":{"line":299,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":168,"style":"Outer","span":{"lo":{"line":300,"col":0},"hi":{"line":300,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," # Example"]},"id":169,"style":"Outer","span":{"lo":{"line":301,"col":0},"hi":{"line":301,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," Defining a custom error type"]},"id":170,"style":"Outer","span":{"lo":{"line":302,"col":0},"hi":{"line":302,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // ```rust"]},"id":171,"style":"Outer","span":{"lo":{"line":303,"col":0},"hi":{"line":303,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // enum MyCustomError {"]},"id":172,"style":"Outer","span":{"lo":{"line":304,"col":0},"hi":{"line":304,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // SomeError"]},"id":173,"style":"Outer","span":{"lo":{"line":305,"col":0},"hi":{"line":305,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // }"]},"id":174,"style":"Outer","span":{"lo":{"line":306,"col":0},"hi":{"line":306,"col":8},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // "]},"id":175,"style":"Outer","span":{"lo":{"line":307,"col":0},"hi":{"line":307,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // #[init(contract = \"mycontract\")]"]},"id":176,"style":"Outer","span":{"lo":{"line":308,"col":0},"hi":{"line":308,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // fn contract_init("]},"id":177,"style":"Outer","span":{"lo":{"line":309,"col":0},"hi":{"line":309,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // ctx: &R,"]},"id":178,"style":"Outer","span":{"lo":{"line":310,"col":0},"hi":{"line":310,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // receive_amount: Amount,"]},"id":179,"style":"Outer","span":{"lo":{"line":311,"col":0},"hi":{"line":311,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // logger: &mut L,"]},"id":180,"style":"Outer","span":{"lo":{"line":312,"col":0},"hi":{"line":312,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // ) -> Result { ... }"]},"id":181,"style":"Outer","span":{"lo":{"line":313,"col":0},"hi":{"line":313,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," // ```"]},"id":182,"style":"Outer","span":{"lo":{"line":314,"col":0},"hi":{"line":314,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0}],"index":[0,83]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0}],"index":[0,83]},"span":{"lo":{"line":317,"col":0},"hi":{"line":325,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":317,"col":0},"hi":{"line":325,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Mod":[{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":"Use","disambiguator":0}],"index":[0,84]},"span":{"lo":{"line":318,"col":4},"hi":{"line":318,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":318,"col":4},"hi":{"line":318,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":318,"col":8},"hi":{"line":318,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,64]}]}],"segments":[{"ident":["super",{"lo":{"line":318,"col":8},"hi":{"line":318,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":"Use","disambiguator":0}],"index":[0,84]},"local_id":1},"res":"Err","args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"span":{"lo":{"line":322,"col":4},"hi":{"line":322,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":322,"col":4},"hi":{"line":322,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":4557742319775345286}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":322,"col":25},"hi":{"line":322,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":322,"col":25},"hi":{"line":322,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":4557742319775345286}}],[]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Marker trait intended to indicate which context type we have."]},"id":183,"style":"Outer","span":{"lo":{"line":319,"col":4},"hi":{"line":319,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," This is deliberately a sealed trait, so that it is only implementable"]},"id":184,"style":"Outer","span":{"lo":{"line":320,"col":4},"hi":{"line":320,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," by types in this crate."]},"id":185,"style":"Outer","span":{"lo":{"line":321,"col":4},"hi":{"line":321,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":"Impl","disambiguator":0}],"index":[0,86]},"span":{"lo":{"line":323,"col":4},"hi":{"line":323,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":323,"col":4},"hi":{"line":323,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":323,"col":42},"hi":{"line":323,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":323,"col":8},"hi":{"line":323,"col":8},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]}}},"items":[]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":"Impl","disambiguator":1}],"index":[0,87]},"span":{"lo":{"line":324,"col":4},"hi":{"line":324,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":324,"col":4},"hi":{"line":324,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":324,"col":45},"hi":{"line":324,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":324,"col":8},"hi":{"line":324,"col":8},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]}}},"items":[]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]}]},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":"Use","disambiguator":0}],"index":[0,84]},"span":{"lo":{"line":318,"col":4},"hi":{"line":318,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":318,"col":4},"hi":{"line":318,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":318,"col":8},"hi":{"line":318,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,64]}]}],"segments":[{"ident":["super",{"lo":{"line":318,"col":8},"hi":{"line":318,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":"Use","disambiguator":0}],"index":[0,84]},"local_id":1},"res":"Err","args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"span":{"lo":{"line":322,"col":4},"hi":{"line":322,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":322,"col":4},"hi":{"line":322,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":4557742319775345286}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":322,"col":25},"hi":{"line":322,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":322,"col":25},"hi":{"line":322,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":4557742319775345286}}],[]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Marker trait intended to indicate which context type we have."]},"id":183,"style":"Outer","span":{"lo":{"line":319,"col":4},"hi":{"line":319,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," This is deliberately a sealed trait, so that it is only implementable"]},"id":184,"style":"Outer","span":{"lo":{"line":320,"col":4},"hi":{"line":320,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"DocComment":["Line"," by types in this crate."]},"id":185,"style":"Outer","span":{"lo":{"line":321,"col":4},"hi":{"line":321,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":"Impl","disambiguator":0}],"index":[0,86]},"span":{"lo":{"line":323,"col":4},"hi":{"line":323,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":323,"col":4},"hi":{"line":323,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":323,"col":42},"hi":{"line":323,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":323,"col":8},"hi":{"line":323,"col":8},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]}}},"items":[]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":"Impl","disambiguator":1}],"index":[0,87]},"span":{"lo":{"line":324,"col":4},"hi":{"line":324,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":324,"col":4},"hi":{"line":324,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":324,"col":45},"hi":{"line":324,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":324,"col":8},"hi":{"line":324,"col":8},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]}}},"items":[]}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]},"span":{"lo":{"line":330,"col":0},"hi":{"line":332,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":330,"col":0},"hi":{"line":332,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Struct":[[{"span":{"lo":{"line":331,"col":4},"hi":{"line":331,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":331,"col":4},"hi":{"line":331,"col":4},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"ident":["marker",{"lo":{"line":331,"col":4},"hi":{"line":331,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]},"local_id":14},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0},{"data":{"ValueNs":"marker"},"disambiguator":0}],"index":[0,226]},"ty":{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"PhantomData"},"disambiguator":0}],"index":[1,2704]}}},"attributes":[]}],false]},{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]},"local_id":7},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0},{"data":{"TypeNs":"T"},"disambiguator":0}],"index":[0,225]},"name":{"Plain":{"name":"T","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]},"local_id":7}}},"span":{"lo":{"line":330,"col":25},"hi":{"line":330,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":null,"synthetic":false}},"colon_span":{"lo":{"line":330,"col":26},"hi":{"line":330,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":[]}],"predicates":[{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]},"local_id":6},"span":{"lo":{"line":330,"col":26},"hi":{"line":330,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"origin":"GenericParam","bound_generic_params":[],"bounded_ty":{"Param":{"index":0,"name":"T"}}}}],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}]},"is_const":false,"is_positive":true}},"id":14597494069885551087}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}]},"is_const":false,"is_positive":true}},"id":11684441412359143739}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":330,"col":48},"hi":{"line":330,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":330,"col":24},"hi":{"line":330,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Context backed by host functions."]},"id":186,"style":"Outer","span":{"lo":{"line":327,"col":0},"hi":{"line":327,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"doc","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:329:6: 329:7 (#0), close: concordium/src/concordium_types.rs:329:13: 329:14 (#0) }"}},"delim":"Parenthesis","tokens":"hidden"}},"tokens":null},"tokens":null}},"id":188,"style":"Outer","span":{"lo":{"line":329,"col":0},"hi":{"line":329,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":22}],"index":[0,227]},"span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":22}],"index":[0,227]},"local_id":11},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":22},{"data":{"TypeNs":"T"},"disambiguator":0}],"index":[0,228]},"name":{"Plain":{"name":"T","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":22}],"index":[0,227]},"local_id":11}}},"span":{"lo":{"line":330,"col":25},"hi":{"line":330,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":null,"synthetic":false}},"colon_span":null,"attributes":[]}],"predicates":[{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":22}],"index":[0,227]},"local_id":10},"span":{"lo":{"line":330,"col":26},"hi":{"line":330,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"origin":"GenericParam","bound_generic_params":[],"bounded_ty":{"Param":{"index":0,"name":"T"}}}}],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}]},"is_const":false,"is_positive":true}},"id":14597494069885551087}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}]},"is_const":false,"is_positive":true}},"id":6057256109449739874}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}]},"is_const":false,"is_positive":true}},"id":11684441412359143739}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":330,"col":48},"hi":{"line":330,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":330,"col":24},"hi":{"line":330,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]}}}}]},"self_ty":{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]}}},"items":[{"ident":["default",{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":22},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[0,229]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}]},"is_const":false,"is_positive":true}},"id":14597494069885551087}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}]},"is_const":false,"is_positive":true}},"id":6057256109449739874}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"sealed"},"disambiguator":0},{"data":{"TypeNs":"ContextType"},"disambiguator":0}],"index":[0,85]},"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}]},"is_const":false,"is_positive":true}},"id":11684441412359143739}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[],"ret":{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]}}},"body":{"ty":{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]}}},"span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":10,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]}}},"span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,224]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0}],"index":[0,224]},"variant_index":0,"typ_is_record":true,"variant_is_record":true,"typ_is_struct":true},"user_ty":null,"fields":[{"field":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ExternContext"},"disambiguator":0},{"data":{"ValueNs":"marker"},"disambiguator":0}],"index":[0,226]},"value":{"ty":{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"PhantomData"},"disambiguator":0}],"index":[1,2704]}}},"span":{"lo":{"line":331,"col":4},"hi":{"line":331,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Call":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"PhantomData"},"disambiguator":0}],"index":[1,2704]}}},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"fun":{"ty":{"Arrow":{"value":{"inputs":[],"output":{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"T"}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"PhantomData"},"disambiguator":0}],"index":[1,2704]}}},"c_variadic":false,"unsafety":"Normal","abi":{"Abi":{"todo":"Rust"}}},"bound_vars":[]}},"span":{"lo":{"line":331,"col":4},"hi":{"line":331,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"GlobalName":{"id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[1,2588]}}},"hir_id":null,"attributes":[]},"args":[],"from_hir_call":true,"fn_span":{"lo":{"line":331,"col":4},"hi":{"line":331,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"impl":{"impl":{"Concrete":{"id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":"Impl","disambiguator":14}],"index":[1,2727]},"generics":[{"Type":{"Param":{"index":0,"name":"T"}}}]}},"args":[]}}},"hir_id":[229,4],"attributes":[]}}],"base":null}},"hir_id":[229,1],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[229,11],"attributes":[]},"sig_span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":433,"style":"Outer","span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":434,"style":"Outer","span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":434,"style":"Outer","span":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Default"]},"call_site":{"lo":{"line":328,"col":9},"hi":{"line":328,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":185,"col":0},"hi":{"line":185,"col":17},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/default.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/default.rs"}}}},"allow_internal_unstable":["core_intrinsics"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"MacroNs":"Default"},"disambiguator":0}],"index":[1,2591]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0}],"index":[1,2586]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ChainMetaExtern"},"disambiguator":0}],"index":[0,88]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ChainMetaExtern"},"disambiguator":0}],"index":[0,88]},"span":{"lo":{"line":335,"col":0},"hi":{"line":335,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":335,"col":0},"hi":{"line":335,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Struct":[[],false]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":335,"col":26},"hi":{"line":335,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":335,"col":26},"hi":{"line":335,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"doc","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:334:6: 334:7 (#0), close: concordium/src/concordium_types.rs:334:13: 334:14 (#0) }"}},"delim":"Parenthesis","tokens":"hidden"}},"tokens":null},"tokens":null}},"id":189,"style":"Outer","span":{"lo":{"line":334,"col":0},"hi":{"line":334,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]},"span":{"lo":{"line":339,"col":0},"hi":{"line":339,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":339,"col":0},"hi":{"line":339,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Unit":[{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]},"local_id":1},{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0},{"data":"Ctor","disambiguator":0}],"index":[0,231]}]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":339,"col":28},"hi":{"line":339,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":339,"col":28},"hi":{"line":339,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"doc","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:338:6: 338:7 (#0), close: concordium/src/concordium_types.rs:338:13: 338:14 (#0) }"}},"delim":"Parenthesis","tokens":"hidden"}},"tokens":null},"tokens":null}},"id":191,"style":"Outer","span":{"lo":{"line":338,"col":0},"hi":{"line":338,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":23}],"index":[0,232]},"span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":339,"col":28},"hi":{"line":339,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":339,"col":28},"hi":{"line":339,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]}}},"items":[{"ident":["default",{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":23},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[0,233]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[],"ret":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]}}},"body":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]}}},"span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":3,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]}}},"span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,230]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"InitContextExtern"},"disambiguator":0}],"index":[0,230]},"variant_index":0,"typ_is_record":false,"variant_is_record":false,"typ_is_struct":true},"user_ty":null,"fields":[],"base":null}},"hir_id":[233,1],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[233,4],"attributes":[]},"sig_span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":435,"style":"Outer","span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":436,"style":"Outer","span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":436,"style":"Outer","span":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Default"]},"call_site":{"lo":{"line":337,"col":9},"hi":{"line":337,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":185,"col":0},"hi":{"line":185,"col":17},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/default.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/default.rs"}}}},"allow_internal_unstable":["core_intrinsics"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"MacroNs":"Default"},"disambiguator":0}],"index":[1,2591]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0}],"index":[1,2586]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]},"span":{"lo":{"line":342,"col":0},"hi":{"line":342,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":342,"col":0},"hi":{"line":342,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Struct":[{"Unit":[{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]},"local_id":1},{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0},{"data":"Ctor","disambiguator":0}],"index":[0,235]}]},{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":342,"col":31},"hi":{"line":342,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":342,"col":31},"hi":{"line":342,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"doc","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:341:6: 341:7 (#0), close: concordium/src/concordium_types.rs:341:13: 341:14 (#0) }"}},"delim":"Parenthesis","tokens":"hidden"}},"tokens":null},"tokens":null}},"id":193,"style":"Outer","span":{"lo":{"line":341,"col":0},"hi":{"line":341,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":24}],"index":[0,236]},"span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"kind":{"Impl":{"unsafety":"Normal","polarity":"Positive","defaultness":"Final","defaultness_span":null,"constness":"NotConst","generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":342,"col":31},"hi":{"line":342,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":342,"col":31},"hi":{"line":342,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"of_trait":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]}}}}]},"self_ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]}}},"items":[{"ident":["default",{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":"Impl","disambiguator":24},{"data":{"ValueNs":"default"},"disambiguator":0}],"index":[0,237]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},"kind":{"Fn":{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"params":[],"ret":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]}}},"body":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]}}},"span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Block":{"targeted_by_break":false,"region_scope":{"id":3,"data":"Node"},"opt_destruction_scope":null,"span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"stmts":[],"expr":{"ty":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]}}},"span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"contents":{"Adt":{"info":{"type_namespace":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,234]},"typ":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]},"variant":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveContextExtern"},"disambiguator":0}],"index":[0,234]},"variant_index":0,"typ_is_record":false,"variant_is_record":false,"typ_is_struct":true},"user_ty":null,"fields":[],"base":null}},"hir_id":[237,1],"attributes":[]},"safety_mode":"Safe"}},"hir_id":[237,4],"attributes":[]},"sig_span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}},"defaultness":"Final","span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"vis_span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"inline","args":"Empty","tokens":null},"tokens":null}},"id":437,"style":"Outer","span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":438,"style":"Outer","span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]}},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"automatically_derived","args":"Empty","tokens":null},"tokens":null}},"id":438,"style":"Outer","span":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:1:11: 1:12 (#0), close: concordium/src/concordium_types.rs:1:25: 1:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":55,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium_types.rs:2:17: 2:18 (#0), close: concordium/src/concordium_types.rs:2:21: 2:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":56,"style":"Inner","span":{"lo":{"line":2,"col":0},"hi":{"line":2,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[{"kind":{"Macro":["Derive","Default"]},"call_site":{"lo":{"line":340,"col":9},"hi":{"line":340,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_types.rs"}}},"def_site":{"lo":{"line":185,"col":0},"hi":{"line":185,"col":17},"filename":{"Real":{"Remapped":{"local_path":"/home/au538501/.rustup/toolchains/nightly-2023-06-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/default.rs","virtual_name":"/rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library/core/src/default.rs"}}}},"allow_internal_unstable":["core_intrinsics"],"edition":"Edition2021","macro_def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"MacroNs":"Default"},"disambiguator":0}],"index":[1,2591]},"parent_module":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0}],"index":[1,2586]},"allow_internal_unsafe":false,"local_inner_macros":false,"collapse_debuginfo":false}]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0}],"index":[0,89]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0}],"index":[0,89]},"span":{"lo":{"line":56,"col":0},"hi":{"line":56,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":56,"col":0},"hi":{"line":56,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Mod":[{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":"Use","disambiguator":0}],"index":[0,90]},"span":{"lo":{"line":5,"col":0},"hi":{"line":5,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":5,"col":0},"hi":{"line":5,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":5,"col":4},"hi":{"line":5,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hacspec_concordium","path":[],"index":[0,0]}]}],"segments":[{"ident":["crate",{"lo":{"line":5,"col":4},"hi":{"line":5,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":"Use","disambiguator":0}],"index":[0,90]},"local_id":1},"res":"Err","args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0}],"index":[0,91]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0}],"index":[0,91]},"span":{"lo":{"line":14,"col":0},"hi":{"line":17,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":14,"col":0},"hi":{"line":17,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Read"},"disambiguator":0}],"index":[5,26]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":2437756474506696380}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0}],"index":[0,91]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":6468282439157936302}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":14,"col":28},"hi":{"line":14,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":14,"col":22},"hi":{"line":14,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Read"},"disambiguator":0}],"index":[5,26]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":2437756474506696380}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0}],"index":[0,91]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":6468282439157936302}}],[{"ident":["size",{"lo":{"line":16,"col":7},"hi":{"line":16,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0},{"data":{"ValueNs":"size"},"disambiguator":0}],"index":[0,92]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0},{"data":{"ValueNs":"size"},"disambiguator":0}],"index":[0,92]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0},{"data":{"ValueNs":"size"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,243]},"name":"Fresh","span":{"lo":{"line":16,"col":12},"hi":{"line":16,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":16,"col":25},"hi":{"line":16,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":16,"col":11},"hi":{"line":16,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0},{"data":{"ValueNs":"size"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,243]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":16,"col":4},"hi":{"line":16,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":16,"col":13},"hi":{"line":16,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":16,"col":4},"hi":{"line":16,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Get the size of the parameter to the method."]},"id":201,"style":"Outer","span":{"lo":{"line":15,"col":4},"hi":{"line":15,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Objects which can access parameters to contracts."]},"id":194,"style":"Outer","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":195,"style":"Outer","span":{"lo":{"line":8,"col":0},"hi":{"line":8,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," This trait has a Read supertrait which means that structured parameters can"]},"id":196,"style":"Outer","span":{"lo":{"line":9,"col":0},"hi":{"line":9,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," be directly deserialized by using `.get()` function from the `Get` trait."]},"id":197,"style":"Outer","span":{"lo":{"line":10,"col":0},"hi":{"line":10,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":198,"style":"Outer","span":{"lo":{"line":11,"col":0},"hi":{"line":11,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The reuse of `Read` methods is the reason for the slightly strange choice of"]},"id":199,"style":"Outer","span":{"lo":{"line":12,"col":0},"hi":{"line":12,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," methods of this trait."]},"id":200,"style":"Outer","span":{"lo":{"line":13,"col":0},"hi":{"line":13,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Objects which can access parameters to contracts."]},"id":194,"style":"Outer","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":195,"style":"Outer","span":{"lo":{"line":8,"col":0},"hi":{"line":8,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," This trait has a Read supertrait which means that structured parameters can"]},"id":196,"style":"Outer","span":{"lo":{"line":9,"col":0},"hi":{"line":9,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," be directly deserialized by using `.get()` function from the `Get` trait."]},"id":197,"style":"Outer","span":{"lo":{"line":10,"col":0},"hi":{"line":10,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":198,"style":"Outer","span":{"lo":{"line":11,"col":0},"hi":{"line":11,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The reuse of `Read` methods is the reason for the slightly strange choice of"]},"id":199,"style":"Outer","span":{"lo":{"line":12,"col":0},"hi":{"line":12,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," methods of this trait."]},"id":200,"style":"Outer","span":{"lo":{"line":13,"col":0},"hi":{"line":13,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0}],"index":[0,93]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0}],"index":[0,93]},"span":{"lo":{"line":20,"col":0},"hi":{"line":23,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":20,"col":0},"hi":{"line":23,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0}],"index":[0,93]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":10432781440892472764}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":20,"col":26},"hi":{"line":20,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":20,"col":26},"hi":{"line":20,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0}],"index":[0,93]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":10432781440892472764}}],[{"ident":["slot_time",{"lo":{"line":22,"col":7},"hi":{"line":22,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0},{"data":{"ValueNs":"slot_time"},"disambiguator":0}],"index":[0,94]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0},{"data":{"ValueNs":"slot_time"},"disambiguator":0}],"index":[0,94]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0},{"data":{"ValueNs":"slot_time"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,244]},"name":"Fresh","span":{"lo":{"line":22,"col":17},"hi":{"line":22,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":22,"col":35},"hi":{"line":22,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":22,"col":16},"hi":{"line":22,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0},{"data":{"ValueNs":"slot_time"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,244]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"Timestamp"},"disambiguator":0}],"index":[5,906]}}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":22,"col":4},"hi":{"line":22,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":22,"col":18},"hi":{"line":22,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":22,"col":4},"hi":{"line":22,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Get time in milliseconds at the beginning of this block."]},"id":203,"style":"Outer","span":{"lo":{"line":21,"col":4},"hi":{"line":21,"col":64},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Objects which can access chain metadata."]},"id":202,"style":"Outer","span":{"lo":{"line":19,"col":0},"hi":{"line":19,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Objects which can access chain metadata."]},"id":202,"style":"Outer","span":{"lo":{"line":19,"col":0},"hi":{"line":19,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0}],"index":[0,95]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0}],"index":[0,95]},"span":{"lo":{"line":30,"col":0},"hi":{"line":51,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":30,"col":0},"hi":{"line":51,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0}],"index":[0,95]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":9008509554905379750}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":30,"col":19},"hi":{"line":30,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":30,"col":19},"hi":{"line":30,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0}],"index":[0,95]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":9008509554905379750}}],[{"ident":["identity_provider",{"lo":{"line":33,"col":7},"hi":{"line":33,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"identity_provider"},"disambiguator":0}],"index":[0,96]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"identity_provider"},"disambiguator":0}],"index":[0,96]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"identity_provider"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,245]},"name":"Fresh","span":{"lo":{"line":33,"col":25},"hi":{"line":33,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":33,"col":51},"hi":{"line":33,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":33,"col":24},"hi":{"line":33,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"identity_provider"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,245]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":33,"col":4},"hi":{"line":33,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":33,"col":26},"hi":{"line":33,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":33,"col":4},"hi":{"line":33,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Identity provider who signed the identity object the credential is"]},"id":208,"style":"Outer","span":{"lo":{"line":31,"col":4},"hi":{"line":31,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," derived from."]},"id":209,"style":"Outer","span":{"lo":{"line":32,"col":4},"hi":{"line":32,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," A type which has access to a policy of a credential."]},"id":204,"style":"Outer","span":{"lo":{"line":26,"col":0},"hi":{"line":26,"col":56},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Since policies can be large this is deliberately written in a relatively"]},"id":205,"style":"Outer","span":{"lo":{"line":27,"col":0},"hi":{"line":27,"col":76},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," low-level style to enable efficient traversal of all the attributes without"]},"id":206,"style":"Outer","span":{"lo":{"line":28,"col":0},"hi":{"line":28,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," any allocations."]},"id":207,"style":"Outer","span":{"lo":{"line":29,"col":0},"hi":{"line":29,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["created_at",{"lo":{"line":36,"col":7},"hi":{"line":36,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"created_at"},"disambiguator":0}],"index":[0,97]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"created_at"},"disambiguator":0}],"index":[0,97]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"created_at"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,246]},"name":"Fresh","span":{"lo":{"line":36,"col":18},"hi":{"line":36,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":36,"col":37},"hi":{"line":36,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":36,"col":17},"hi":{"line":36,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"created_at"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,246]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"Timestamp"},"disambiguator":0}],"index":[5,906]}}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":36,"col":4},"hi":{"line":36,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":36,"col":19},"hi":{"line":36,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":36,"col":4},"hi":{"line":36,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Beginning of the month in milliseconds since unix epoch when the"]},"id":210,"style":"Outer","span":{"lo":{"line":34,"col":4},"hi":{"line":34,"col":72},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," credential was created."]},"id":211,"style":"Outer","span":{"lo":{"line":35,"col":4},"hi":{"line":35,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," A type which has access to a policy of a credential."]},"id":204,"style":"Outer","span":{"lo":{"line":26,"col":0},"hi":{"line":26,"col":56},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Since policies can be large this is deliberately written in a relatively"]},"id":205,"style":"Outer","span":{"lo":{"line":27,"col":0},"hi":{"line":27,"col":76},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," low-level style to enable efficient traversal of all the attributes without"]},"id":206,"style":"Outer","span":{"lo":{"line":28,"col":0},"hi":{"line":28,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," any allocations."]},"id":207,"style":"Outer","span":{"lo":{"line":29,"col":0},"hi":{"line":29,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["valid_to",{"lo":{"line":39,"col":7},"hi":{"line":39,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"valid_to"},"disambiguator":0}],"index":[0,98]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"valid_to"},"disambiguator":0}],"index":[0,98]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"valid_to"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,247]},"name":"Fresh","span":{"lo":{"line":39,"col":16},"hi":{"line":39,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":39,"col":35},"hi":{"line":39,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":39,"col":15},"hi":{"line":39,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"valid_to"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,247]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"Timestamp"},"disambiguator":0}],"index":[5,906]}}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":39,"col":4},"hi":{"line":39,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":39,"col":17},"hi":{"line":39,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":39,"col":4},"hi":{"line":39,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Beginning of the month where the credential is no longer valid, in"]},"id":212,"style":"Outer","span":{"lo":{"line":37,"col":4},"hi":{"line":37,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," milliseconds since unix epoch."]},"id":213,"style":"Outer","span":{"lo":{"line":38,"col":4},"hi":{"line":38,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," A type which has access to a policy of a credential."]},"id":204,"style":"Outer","span":{"lo":{"line":26,"col":0},"hi":{"line":26,"col":56},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Since policies can be large this is deliberately written in a relatively"]},"id":205,"style":"Outer","span":{"lo":{"line":27,"col":0},"hi":{"line":27,"col":76},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," low-level style to enable efficient traversal of all the attributes without"]},"id":206,"style":"Outer","span":{"lo":{"line":28,"col":0},"hi":{"line":28,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," any allocations."]},"id":207,"style":"Outer","span":{"lo":{"line":29,"col":0},"hi":{"line":29,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["next_item",{"lo":{"line":50,"col":7},"hi":{"line":50,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"next_item"},"disambiguator":0}],"index":[0,99]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":50,"col":85},"hi":{"line":50,"col":85},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":50,"col":16},"hi":{"line":50,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Param":{"index":0,"name":"Self"}},{"Array":[{"Uint":"U8"},{"ty":{"Uint":"Usize"},"span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":0},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"contents":{"Literal":{"Int":{"Uint":[31,"Usize"]}}},"hir_id":null,"attributes":[]}]}],"output":{"Return":{"Tuple":[{"Adt":{"generic_args":[{"Type":{"Tuple":[{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"AttributeTag"},"disambiguator":0}],"index":[5,1142]}}},{"Uint":"U8"}]}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]}}},{"Array":[{"Uint":"U8"},{"ty":{"Uint":"Usize"},"span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":0},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"contents":{"Literal":{"Int":{"Uint":[31,"Usize"]}}},"hir_id":null,"attributes":[]}]},{"Param":{"index":0,"name":"Self"}}]}},"c_variadic":false,"implicit_self":"Imm","lifetime_elision_allowed":false},"span":{"lo":{"line":50,"col":4},"hi":{"line":50,"col":86},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":50,"col":17},"hi":{"line":50,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["buf",{"lo":{"line":50,"col":23},"hi":{"line":50,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":50,"col":4},"hi":{"line":50,"col":86},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Get the next attribute, storing it in the provided buffer."]},"id":214,"style":"Outer","span":{"lo":{"line":40,"col":4},"hi":{"line":40,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The return value, if `Some`, is a pair of an attribute tag, and the"]},"id":215,"style":"Outer","span":{"lo":{"line":41,"col":4},"hi":{"line":41,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," length, `n` of the attribute value. In this case, the attribute"]},"id":216,"style":"Outer","span":{"lo":{"line":42,"col":4},"hi":{"line":42,"col":71},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," value is written in the first `n` bytes of the provided buffer. The"]},"id":217,"style":"Outer","span":{"lo":{"line":43,"col":4},"hi":{"line":43,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," rest of the buffer is unchanged."]},"id":218,"style":"Outer","span":{"lo":{"line":44,"col":4},"hi":{"line":44,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":219,"style":"Outer","span":{"lo":{"line":45,"col":4},"hi":{"line":45,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The reason this function is added here, and we don't simply implement"]},"id":220,"style":"Outer","span":{"lo":{"line":46,"col":4},"hi":{"line":46,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," an Iterator for this type is that with the supplied buffer we can"]},"id":221,"style":"Outer","span":{"lo":{"line":47,"col":4},"hi":{"line":47,"col":73},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," iterate through the elements more efficiently, without any allocations,"]},"id":222,"style":"Outer","span":{"lo":{"line":48,"col":4},"hi":{"line":48,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," the consumer being responsible for allocating the buffer."]},"id":223,"style":"Outer","span":{"lo":{"line":49,"col":4},"hi":{"line":49,"col":65},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," A type which has access to a policy of a credential."]},"id":204,"style":"Outer","span":{"lo":{"line":26,"col":0},"hi":{"line":26,"col":56},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Since policies can be large this is deliberately written in a relatively"]},"id":205,"style":"Outer","span":{"lo":{"line":27,"col":0},"hi":{"line":27,"col":76},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," low-level style to enable efficient traversal of all the attributes without"]},"id":206,"style":"Outer","span":{"lo":{"line":28,"col":0},"hi":{"line":28,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," any allocations."]},"id":207,"style":"Outer","span":{"lo":{"line":29,"col":0},"hi":{"line":29,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," A type which has access to a policy of a credential."]},"id":204,"style":"Outer","span":{"lo":{"line":26,"col":0},"hi":{"line":26,"col":56},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Since policies can be large this is deliberately written in a relatively"]},"id":205,"style":"Outer","span":{"lo":{"line":27,"col":0},"hi":{"line":27,"col":76},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," low-level style to enable efficient traversal of all the attributes without"]},"id":206,"style":"Outer","span":{"lo":{"line":28,"col":0},"hi":{"line":28,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," any allocations."]},"id":207,"style":"Outer","span":{"lo":{"line":29,"col":0},"hi":{"line":29,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},"span":{"lo":{"line":55,"col":0},"hi":{"line":72,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":55,"col":0},"hi":{"line":72,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":9900215877253420355}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":55,"col":23},"hi":{"line":55,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":55,"col":23},"hi":{"line":55,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":9900215877253420355}}],[{"ident":["PolicyType",{"lo":{"line":56,"col":9},"hi":{"line":56,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyType"},"disambiguator":0}],"index":[0,103]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0}],"index":[0,95]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyType"},"disambiguator":0}],"index":[0,103]}}]}}]},"is_const":false,"is_positive":true}},"id":2875386292472038087}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyType"},"disambiguator":0}],"index":[0,103]}}]}}]},"is_const":false,"is_positive":true}},"id":6518296602871724256}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":56,"col":30},"hi":{"line":56,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":56,"col":19},"hi":{"line":56,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0}],"index":[0,95]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyType"},"disambiguator":0}],"index":[0,103]}}]}}]},"is_const":false,"is_positive":true}},"id":2875386292472038087}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyType"},"disambiguator":0}],"index":[0,103]}}]}}]},"is_const":false,"is_positive":true}},"id":6518296602871724256}}],null]},"span":{"lo":{"line":56,"col":4},"hi":{"line":56,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"DocComment":["Line"," Common data accessible to both init and receive methods."]},"id":224,"style":"Outer","span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["MetadataType",{"lo":{"line":57,"col":9},"hi":{"line":57,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"MetadataType"},"disambiguator":0}],"index":[0,104]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0}],"index":[0,93]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"MetadataType"},"disambiguator":0}],"index":[0,104]}}]}}]},"is_const":false,"is_positive":true}},"id":1873832837790077758}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"MetadataType"},"disambiguator":0}],"index":[0,104]}}]}}]},"is_const":false,"is_positive":true}},"id":5350708720984506472}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":57,"col":39},"hi":{"line":57,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":57,"col":21},"hi":{"line":57,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0}],"index":[0,93]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"MetadataType"},"disambiguator":0}],"index":[0,104]}}]}}]},"is_const":false,"is_positive":true}},"id":1873832837790077758}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"MetadataType"},"disambiguator":0}],"index":[0,104]}}]}}]},"is_const":false,"is_positive":true}},"id":5350708720984506472}}],null]},"span":{"lo":{"line":57,"col":4},"hi":{"line":57,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"DocComment":["Line"," Common data accessible to both init and receive methods."]},"id":224,"style":"Outer","span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["ParamType",{"lo":{"line":58,"col":9},"hi":{"line":58,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"ParamType"},"disambiguator":0}],"index":[0,105]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Read"},"disambiguator":0}],"index":[5,26]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"ParamType"},"disambiguator":0}],"index":[0,105]}}]}}]},"is_const":false,"is_positive":true}},"id":1840492096314216500}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0}],"index":[0,91]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"ParamType"},"disambiguator":0}],"index":[0,105]}}]}}]},"is_const":false,"is_positive":true}},"id":6955721314586481954}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"ParamType"},"disambiguator":0}],"index":[0,105]}}]}}]},"is_const":false,"is_positive":true}},"id":13512498811560697081}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":58,"col":39},"hi":{"line":58,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":58,"col":18},"hi":{"line":58,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Read"},"disambiguator":0}],"index":[5,26]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"ParamType"},"disambiguator":0}],"index":[0,105]}}]}}]},"is_const":false,"is_positive":true}},"id":1840492096314216500}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0}],"index":[0,91]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"ParamType"},"disambiguator":0}],"index":[0,105]}}]}}]},"is_const":false,"is_positive":true}},"id":6955721314586481954}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"ParamType"},"disambiguator":0}],"index":[0,105]}}]}}]},"is_const":false,"is_positive":true}},"id":13512498811560697081}}],null]},"span":{"lo":{"line":58,"col":4},"hi":{"line":58,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"DocComment":["Line"," Common data accessible to both init and receive methods."]},"id":224,"style":"Outer","span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["PolicyIteratorType",{"lo":{"line":59,"col":9},"hi":{"line":59,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Projection":{"projection_ty":{"substs":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}],"trait_def_id":[{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"iterator"},"disambiguator":0},{"data":{"TypeNs":"Iterator"},"disambiguator":0}],"index":[1,7315]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[{"AssocItem":[{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]},"name":"PolicyIteratorType","kind":"Type","container":"TraitContainer","trait_item_def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]},"fn_has_self_parameter":false,"opt_rpitit_info":null},{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"exact_size"},"disambiguator":0},{"data":{"TypeNs":"ExactSizeIterator"},"disambiguator":0}],"index":[1,7260]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}]},{"Parent":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"iterator"},"disambiguator":0},{"data":{"TypeNs":"Iterator"},"disambiguator":0}],"index":[1,7315]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}}]}},"args":[]}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"iterator"},"disambiguator":0},{"data":{"TypeNs":"Iterator"},"disambiguator":0},{"data":{"TypeNs":"Item"},"disambiguator":0}],"index":[1,7316]}},"term":{"Ty":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyType"},"disambiguator":0}],"index":[0,103]}}]}}}},"id":16765557715264579028}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"exact_size"},"disambiguator":0},{"data":{"TypeNs":"ExactSizeIterator"},"disambiguator":0}],"index":[1,7260]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}},"id":2524192090353092294}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"iterator"},"disambiguator":0},{"data":{"TypeNs":"Iterator"},"disambiguator":0}],"index":[1,7315]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}},"id":7479269235389803660}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}},"id":10873437583130849907}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":59,"col":71},"hi":{"line":59,"col":71},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":59,"col":27},"hi":{"line":59,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Projection":{"projection_ty":{"substs":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}],"trait_def_id":[{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"iterator"},"disambiguator":0},{"data":{"TypeNs":"Iterator"},"disambiguator":0}],"index":[1,7315]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[{"AssocItem":[{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]},"name":"PolicyIteratorType","kind":"Type","container":"TraitContainer","trait_item_def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]},"fn_has_self_parameter":false,"opt_rpitit_info":null},{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"exact_size"},"disambiguator":0},{"data":{"TypeNs":"ExactSizeIterator"},"disambiguator":0}],"index":[1,7260]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}]},{"Parent":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"iterator"},"disambiguator":0},{"data":{"TypeNs":"Iterator"},"disambiguator":0}],"index":[1,7315]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}}]}},"args":[]}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"iterator"},"disambiguator":0},{"data":{"TypeNs":"Iterator"},"disambiguator":0},{"data":{"TypeNs":"Item"},"disambiguator":0}],"index":[1,7316]}},"term":{"Ty":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyType"},"disambiguator":0}],"index":[0,103]}}]}}}},"id":16765557715264579028}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"exact_size"},"disambiguator":0},{"data":{"TypeNs":"ExactSizeIterator"},"disambiguator":0}],"index":[1,7260]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}},"id":2524192090353092294}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"iterator"},"disambiguator":0},{"data":{"TypeNs":"Iterator"},"disambiguator":0}],"index":[1,7315]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}},"id":7479269235389803660}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}},"id":10873437583130849907}}],null]},"span":{"lo":{"line":59,"col":4},"hi":{"line":59,"col":72},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"DocComment":["Line"," Common data accessible to both init and receive methods."]},"id":224,"style":"Outer","span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["policies",{"lo":{"line":67,"col":7},"hi":{"line":67,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"policies"},"disambiguator":0}],"index":[0,107]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"policies"},"disambiguator":0}],"index":[0,107]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"policies"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,248]},"name":"Fresh","span":{"lo":{"line":67,"col":16},"hi":{"line":67,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":67,"col":50},"hi":{"line":67,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":67,"col":15},"hi":{"line":67,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"policies"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,248]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":67,"col":4},"hi":{"line":67,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":67,"col":17},"hi":{"line":67,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":67,"col":4},"hi":{"line":67,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Policies of the sender of the message."]},"id":225,"style":"Outer","span":{"lo":{"line":60,"col":4},"hi":{"line":60,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," For init methods this is the would-be creator of the contract,"]},"id":226,"style":"Outer","span":{"lo":{"line":61,"col":4},"hi":{"line":61,"col":70},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," for the receive this is the policies of the immediate sender."]},"id":227,"style":"Outer","span":{"lo":{"line":62,"col":4},"hi":{"line":62,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":228,"style":"Outer","span":{"lo":{"line":63,"col":4},"hi":{"line":63,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," In the latter case, if the sender is an account then it is the policies"]},"id":229,"style":"Outer","span":{"lo":{"line":64,"col":4},"hi":{"line":64,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," of the account, if it is a contract then it is the policies of the"]},"id":230,"style":"Outer","span":{"lo":{"line":65,"col":4},"hi":{"line":65,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," creator of the contract."]},"id":231,"style":"Outer","span":{"lo":{"line":66,"col":4},"hi":{"line":66,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Common data accessible to both init and receive methods."]},"id":224,"style":"Outer","span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["metadata",{"lo":{"line":69,"col":7},"hi":{"line":69,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"metadata"},"disambiguator":0}],"index":[0,108]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"metadata"},"disambiguator":0}],"index":[0,108]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"metadata"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,249]},"name":"Fresh","span":{"lo":{"line":69,"col":16},"hi":{"line":69,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":69,"col":45},"hi":{"line":69,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":69,"col":15},"hi":{"line":69,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"metadata"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,249]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"metadata"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,249]},"'_"]}}]}},{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"MetadataType"},"disambiguator":0}],"index":[0,104]}}]},false]}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":69,"col":4},"hi":{"line":69,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":69,"col":17},"hi":{"line":69,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":69,"col":4},"hi":{"line":69,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Get the reference to chain metadata"]},"id":232,"style":"Outer","span":{"lo":{"line":68,"col":4},"hi":{"line":68,"col":43},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Common data accessible to both init and receive methods."]},"id":224,"style":"Outer","span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["parameter_cursor",{"lo":{"line":71,"col":7},"hi":{"line":71,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"parameter_cursor"},"disambiguator":0}],"index":[0,109]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"parameter_cursor"},"disambiguator":0}],"index":[0,109]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"parameter_cursor"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,250]},"name":"Fresh","span":{"lo":{"line":71,"col":24},"hi":{"line":71,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":71,"col":49},"hi":{"line":71,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":71,"col":23},"hi":{"line":71,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"parameter_cursor"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,250]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"ParamType"},"disambiguator":0}],"index":[0,105]}}]}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":71,"col":4},"hi":{"line":71,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":71,"col":25},"hi":{"line":71,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":71,"col":4},"hi":{"line":71,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Get the cursor to the parameter."]},"id":233,"style":"Outer","span":{"lo":{"line":70,"col":4},"hi":{"line":70,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Common data accessible to both init and receive methods."]},"id":224,"style":"Outer","span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Common data accessible to both init and receive methods."]},"id":224,"style":"Outer","span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},"span":{"lo":{"line":76,"col":0},"hi":{"line":83,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":76,"col":0},"hi":{"line":83,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},"local_id":7},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[0,111]},"name":{"Plain":{"name":"Error","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},"local_id":7}}},"span":{"lo":{"line":76,"col":25},"hi":{"line":76,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":{"Tuple":[]},"synthetic":false}},"colon_span":{"lo":{"line":76,"col":30},"hi":{"line":76,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"attributes":[]}],"predicates":[{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},"local_id":5},"span":{"lo":{"line":76,"col":30},"hi":{"line":76,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"origin":"GenericParam","bound_generic_params":[],"bounded_ty":{"Param":{"index":1,"name":"Error"}}}}],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":9900215877253420355}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":13656839978771590325}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":468573141220163386}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":6451289350237964709}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":76,"col":60},"hi":{"line":76,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":76,"col":24},"hi":{"line":76,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":9900215877253420355}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":13656839978771590325}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":468573141220163386}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":6451289350237964709}}],[{"ident":["InitData",{"lo":{"line":78,"col":9},"hi":{"line":78,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"TypeNs":"InitData"},"disambiguator":0}],"index":[0,112]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},{"impl":{"LocalBound":{"clause_id":6451289350237964709,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"TypeNs":"InitData"},"disambiguator":0}],"index":[0,112]}}]}}]},"is_const":false,"is_positive":true}},"id":12058970868310053901}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":78,"col":17},"hi":{"line":78,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":78,"col":17},"hi":{"line":78,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},{"impl":{"LocalBound":{"clause_id":6451289350237964709,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"TypeNs":"InitData"},"disambiguator":0}],"index":[0,112]}}]}}]},"is_const":false,"is_positive":true}},"id":12058970868310053901}}],null]},"span":{"lo":{"line":78,"col":4},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Data needed to open the context."]},"id":235,"style":"Outer","span":{"lo":{"line":77,"col":4},"hi":{"line":77,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as init contexts."]},"id":234,"style":"Outer","span":{"lo":{"line":75,"col":0},"hi":{"line":75,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["open",{"lo":{"line":80,"col":7},"hi":{"line":80,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"ValueNs":"open"},"disambiguator":0}],"index":[0,113]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":80,"col":41},"hi":{"line":80,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":80,"col":11},"hi":{"line":80,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},{"impl":{"LocalBound":{"clause_id":6451289350237964709,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"TypeNs":"InitData"},"disambiguator":0}],"index":[0,112]}}]}],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},"span":{"lo":{"line":80,"col":4},"hi":{"line":80,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["data",{"lo":{"line":80,"col":12},"hi":{"line":80,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":80,"col":4},"hi":{"line":80,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Open the init context for reading and accessing values."]},"id":236,"style":"Outer","span":{"lo":{"line":79,"col":4},"hi":{"line":79,"col":63},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as init contexts."]},"id":234,"style":"Outer","span":{"lo":{"line":75,"col":0},"hi":{"line":75,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["init_origin",{"lo":{"line":82,"col":7},"hi":{"line":82,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"ValueNs":"init_origin"},"disambiguator":0}],"index":[0,114]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"ValueNs":"init_origin"},"disambiguator":0}],"index":[0,114]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"ValueNs":"init_origin"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,251]},"name":"Fresh","span":{"lo":{"line":82,"col":19},"hi":{"line":82,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":82,"col":43},"hi":{"line":82,"col":43},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":82,"col":18},"hi":{"line":82,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"ValueNs":"init_origin"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,251]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"AccountAddress"},"disambiguator":0}],"index":[5,964]}}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":82,"col":4},"hi":{"line":82,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":82,"col":20},"hi":{"line":82,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":82,"col":4},"hi":{"line":82,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Who invoked this init call."]},"id":237,"style":"Outer","span":{"lo":{"line":81,"col":4},"hi":{"line":81,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as init contexts."]},"id":234,"style":"Outer","span":{"lo":{"line":75,"col":0},"hi":{"line":75,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Types which can act as init contexts."]},"id":234,"style":"Outer","span":{"lo":{"line":75,"col":0},"hi":{"line":75,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},"span":{"lo":{"line":87,"col":0},"hi":{"line":104,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":87,"col":0},"hi":{"line":104,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},"local_id":7},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[0,116]},"name":{"Plain":{"name":"Error","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},"local_id":7}}},"span":{"lo":{"line":87,"col":28},"hi":{"line":87,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":{"Tuple":[]},"synthetic":false}},"colon_span":{"lo":{"line":87,"col":33},"hi":{"line":87,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"attributes":[]}],"predicates":[{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},"local_id":5},"span":{"lo":{"line":87,"col":33},"hi":{"line":87,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"origin":"GenericParam","bound_generic_params":[],"bounded_ty":{"Param":{"index":1,"name":"Error"}}}}],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":9900215877253420355}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":13656839978771590325}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":468573141220163386}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":3139667756981812396}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":87,"col":63},"hi":{"line":87,"col":63},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":87,"col":27},"hi":{"line":87,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":9900215877253420355}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":13656839978771590325}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":468573141220163386}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":3139667756981812396}}],[{"ident":["ReceiveData",{"lo":{"line":88,"col":9},"hi":{"line":88,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"TypeNs":"ReceiveData"},"disambiguator":0}],"index":[0,117]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},{"impl":{"LocalBound":{"clause_id":3139667756981812396,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"TypeNs":"ReceiveData"},"disambiguator":0}],"index":[0,117]}}]}}]},"is_const":false,"is_positive":true}},"id":16141720423459337414}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":88,"col":20},"hi":{"line":88,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":88,"col":20},"hi":{"line":88,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},{"impl":{"LocalBound":{"clause_id":3139667756981812396,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"TypeNs":"ReceiveData"},"disambiguator":0}],"index":[0,117]}}]}}]},"is_const":false,"is_positive":true}},"id":16141720423459337414}}],null]},"span":{"lo":{"line":88,"col":4},"hi":{"line":88,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as receive contexts."]},"id":238,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["open",{"lo":{"line":91,"col":7},"hi":{"line":91,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"open"},"disambiguator":0}],"index":[0,118]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":91,"col":44},"hi":{"line":91,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":91,"col":11},"hi":{"line":91,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},{"impl":{"LocalBound":{"clause_id":3139667756981812396,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"TypeNs":"ReceiveData"},"disambiguator":0}],"index":[0,117]}}]}],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},"span":{"lo":{"line":91,"col":4},"hi":{"line":91,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["data",{"lo":{"line":91,"col":12},"hi":{"line":91,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":91,"col":4},"hi":{"line":91,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Open the receive context for reading and accessing values."]},"id":239,"style":"Outer","span":{"lo":{"line":90,"col":4},"hi":{"line":90,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as receive contexts."]},"id":238,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["invoker",{"lo":{"line":94,"col":7},"hi":{"line":94,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"invoker"},"disambiguator":0}],"index":[0,119]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"invoker"},"disambiguator":0}],"index":[0,119]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"invoker"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,252]},"name":"Fresh","span":{"lo":{"line":94,"col":15},"hi":{"line":94,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":94,"col":39},"hi":{"line":94,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":94,"col":14},"hi":{"line":94,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"invoker"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,252]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"AccountAddress"},"disambiguator":0}],"index":[5,964]}}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":94,"col":4},"hi":{"line":94,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":94,"col":16},"hi":{"line":94,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":94,"col":4},"hi":{"line":94,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Who is the account that initiated the top-level transaction this"]},"id":240,"style":"Outer","span":{"lo":{"line":92,"col":4},"hi":{"line":92,"col":72},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," invocation is a part of."]},"id":241,"style":"Outer","span":{"lo":{"line":93,"col":4},"hi":{"line":93,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as receive contexts."]},"id":238,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["self_address",{"lo":{"line":96,"col":7},"hi":{"line":96,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"self_address"},"disambiguator":0}],"index":[0,120]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"self_address"},"disambiguator":0}],"index":[0,120]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"self_address"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,253]},"name":"Fresh","span":{"lo":{"line":96,"col":20},"hi":{"line":96,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":96,"col":45},"hi":{"line":96,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":96,"col":19},"hi":{"line":96,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"self_address"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,253]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"ContractAddress"},"disambiguator":0}],"index":[5,988]}}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":96,"col":4},"hi":{"line":96,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":96,"col":21},"hi":{"line":96,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":96,"col":4},"hi":{"line":96,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The address of the contract being invoked."]},"id":242,"style":"Outer","span":{"lo":{"line":95,"col":4},"hi":{"line":95,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as receive contexts."]},"id":238,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["self_balance",{"lo":{"line":98,"col":7},"hi":{"line":98,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"self_balance"},"disambiguator":0}],"index":[0,121]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"self_balance"},"disambiguator":0}],"index":[0,121]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"self_balance"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,254]},"name":"Fresh","span":{"lo":{"line":98,"col":20},"hi":{"line":98,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":98,"col":36},"hi":{"line":98,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":98,"col":19},"hi":{"line":98,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"self_balance"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,254]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"Amount"},"disambiguator":0}],"index":[5,862]}}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":98,"col":4},"hi":{"line":98,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":98,"col":21},"hi":{"line":98,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":98,"col":4},"hi":{"line":98,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Balance on the contract before the call was made."]},"id":243,"style":"Outer","span":{"lo":{"line":97,"col":4},"hi":{"line":97,"col":57},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as receive contexts."]},"id":238,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["sender",{"lo":{"line":101,"col":7},"hi":{"line":101,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"sender"},"disambiguator":0}],"index":[0,122]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"sender"},"disambiguator":0}],"index":[0,122]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"sender"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,255]},"name":"Fresh","span":{"lo":{"line":101,"col":14},"hi":{"line":101,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":101,"col":31},"hi":{"line":101,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":101,"col":13},"hi":{"line":101,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"sender"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,255]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"Address"},"disambiguator":0}],"index":[5,1009]}}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":101,"col":4},"hi":{"line":101,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":101,"col":15},"hi":{"line":101,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":101,"col":4},"hi":{"line":101,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The immediate sender of the message. In general different from the"]},"id":244,"style":"Outer","span":{"lo":{"line":99,"col":4},"hi":{"line":99,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," invoker."]},"id":245,"style":"Outer","span":{"lo":{"line":100,"col":4},"hi":{"line":100,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as receive contexts."]},"id":238,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["owner",{"lo":{"line":103,"col":7},"hi":{"line":103,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"owner"},"disambiguator":0}],"index":[0,123]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"owner"},"disambiguator":0}],"index":[0,123]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"owner"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,256]},"name":"Fresh","span":{"lo":{"line":103,"col":13},"hi":{"line":103,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":103,"col":37},"hi":{"line":103,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":103,"col":12},"hi":{"line":103,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"owner"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,256]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"AccountAddress"},"disambiguator":0}],"index":[5,964]}}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":103,"col":4},"hi":{"line":103,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":103,"col":14},"hi":{"line":103,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":103,"col":4},"hi":{"line":103,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Account which created the contract instance."]},"id":246,"style":"Outer","span":{"lo":{"line":102,"col":4},"hi":{"line":102,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as receive contexts."]},"id":238,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Types which can act as receive contexts."]},"id":238,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"span":{"lo":{"line":108,"col":0},"hi":{"line":130,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":108,"col":0},"hi":{"line":130,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"local_id":28},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[0,125]},"name":{"Plain":{"name":"Error","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"local_id":28}}},"span":{"lo":{"line":108,"col":27},"hi":{"line":108,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":{"Tuple":[]},"synthetic":false}},"colon_span":{"lo":{"line":108,"col":32},"hi":{"line":108,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"attributes":[]}],"predicates":[{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"local_id":5},"span":{"lo":{"line":108,"col":32},"hi":{"line":108,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"origin":"GenericParam","bound_generic_params":[],"bounded_ty":{"Param":{"index":1,"name":"Error"}}}},{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"local_id":6},"span":{"lo":{"line":110,"col":4},"hi":{"line":110,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"origin":"WhereClause","bound_generic_params":[],"bounded_ty":{"Param":{"index":0,"name":"Self"}}}},{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"local_id":11},"span":{"lo":{"line":111,"col":4},"hi":{"line":111,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"origin":"WhereClause","bound_generic_params":[],"bounded_ty":{"Param":{"index":0,"name":"Self"}}}},{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"local_id":19},"span":{"lo":{"line":112,"col":4},"hi":{"line":112,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"origin":"WhereClause","bound_generic_params":[],"bounded_ty":{"Param":{"index":0,"name":"Self"}}}}],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":13656839978771590325}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":468573141220163386}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Read"},"disambiguator":0}],"index":[5,26]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":2437756474506696380}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Write"},"disambiguator":0}],"index":[5,37]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":14362174564524012008}},{"Clause":{"kind":{"Projection":{"projection_ty":{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Write"},"disambiguator":0}],"index":[5,37]},{"impl":{"LocalBound":{"clause_id":14362174564524012008,"path":[]}},"args":[]}],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Write"},"disambiguator":0},{"data":{"TypeNs":"Err"},"disambiguator":0}],"index":[5,38]}},"term":{"Ty":{"Param":{"index":1,"name":"Error"}}}}},"id":4054745027042689359}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Seek"},"disambiguator":0}],"index":[5,22]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":1025623541863160082}},{"Clause":{"kind":{"Projection":{"projection_ty":{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Seek"},"disambiguator":0}],"index":[5,22]},{"impl":{"LocalBound":{"clause_id":1025623541863160082,"path":[]}},"args":[]}],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Seek"},"disambiguator":0},{"data":{"TypeNs":"Err"},"disambiguator":0}],"index":[5,23]}},"term":{"Ty":{"Param":{"index":1,"name":"Error"}}}}},"id":12486526404069431600}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":16350532459756314912}}],"has_where_clause_predicates":true,"where_clause_span":{"lo":{"line":109,"col":0},"hi":{"line":112,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":108,"col":26},"hi":{"line":108,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":13656839978771590325}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":468573141220163386}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Read"},"disambiguator":0}],"index":[5,26]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":2437756474506696380}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Write"},"disambiguator":0}],"index":[5,37]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":14362174564524012008}},{"Clause":{"kind":{"Projection":{"projection_ty":{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Write"},"disambiguator":0}],"index":[5,37]},{"impl":{"LocalBound":{"clause_id":14362174564524012008,"path":[]}},"args":[]}],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Write"},"disambiguator":0},{"data":{"TypeNs":"Err"},"disambiguator":0}],"index":[5,38]}},"term":{"Ty":{"Param":{"index":1,"name":"Error"}}}}},"id":4054745027042689359}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Seek"},"disambiguator":0}],"index":[5,22]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":1025623541863160082}},{"Clause":{"kind":{"Projection":{"projection_ty":{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Seek"},"disambiguator":0}],"index":[5,22]},{"impl":{"LocalBound":{"clause_id":1025623541863160082,"path":[]}},"args":[]}],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Seek"},"disambiguator":0},{"data":{"TypeNs":"Err"},"disambiguator":0}],"index":[5,23]}},"term":{"Ty":{"Param":{"index":1,"name":"Error"}}}}},"id":12486526404069431600}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":16350532459756314912}}],[{"ident":["ContractStateData",{"lo":{"line":113,"col":9},"hi":{"line":113,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"TypeNs":"ContractStateData"},"disambiguator":0}],"index":[0,126]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},{"impl":{"LocalBound":{"clause_id":16350532459756314912,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"TypeNs":"ContractStateData"},"disambiguator":0}],"index":[0,126]}}]}}]},"is_const":false,"is_positive":true}},"id":9003714832965411642}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":113,"col":26},"hi":{"line":113,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":113,"col":26},"hi":{"line":113,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},{"impl":{"LocalBound":{"clause_id":16350532459756314912,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"TypeNs":"ContractStateData"},"disambiguator":0}],"index":[0,126]}}]}}]},"is_const":false,"is_positive":true}},"id":9003714832965411642}}],null]},"span":{"lo":{"line":113,"col":4},"hi":{"line":113,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"DocComment":["Line"," A type that can serve as the contract state type."]},"id":247,"style":"Outer","span":{"lo":{"line":107,"col":0},"hi":{"line":107,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["open",{"lo":{"line":116,"col":7},"hi":{"line":116,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"open"},"disambiguator":0}],"index":[0,127]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":116,"col":47},"hi":{"line":116,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":116,"col":11},"hi":{"line":116,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},{"impl":{"LocalBound":{"clause_id":16350532459756314912,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"TypeNs":"ContractStateData"},"disambiguator":0}],"index":[0,126]}}]}],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},"span":{"lo":{"line":116,"col":4},"hi":{"line":116,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["",{"lo":{"line":116,"col":12},"hi":{"line":116,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":116,"col":4},"hi":{"line":116,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Open the contract state. Only one instance can be opened at the same"]},"id":248,"style":"Outer","span":{"lo":{"line":114,"col":4},"hi":{"line":114,"col":76},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," time."]},"id":249,"style":"Outer","span":{"lo":{"line":115,"col":4},"hi":{"line":115,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," A type that can serve as the contract state type."]},"id":247,"style":"Outer","span":{"lo":{"line":107,"col":0},"hi":{"line":107,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["size",{"lo":{"line":119,"col":7},"hi":{"line":119,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"size"},"disambiguator":0}],"index":[0,128]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"size"},"disambiguator":0}],"index":[0,128]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"size"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,257]},"name":"Fresh","span":{"lo":{"line":119,"col":12},"hi":{"line":119,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":119,"col":25},"hi":{"line":119,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":119,"col":11},"hi":{"line":119,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"size"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,257]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":119,"col":4},"hi":{"line":119,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":119,"col":13},"hi":{"line":119,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":119,"col":4},"hi":{"line":119,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Get the current size of contract state."]},"id":250,"style":"Outer","span":{"lo":{"line":118,"col":4},"hi":{"line":118,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," A type that can serve as the contract state type."]},"id":247,"style":"Outer","span":{"lo":{"line":107,"col":0},"hi":{"line":107,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["truncate",{"lo":{"line":124,"col":7},"hi":{"line":124,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"truncate"},"disambiguator":0}],"index":[0,129]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"truncate"},"disambiguator":0}],"index":[0,129]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"truncate"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,258]},"name":"Fresh","span":{"lo":{"line":124,"col":16},"hi":{"line":124,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":124,"col":45},"hi":{"line":124,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":124,"col":15},"hi":{"line":124,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"truncate"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,258]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]},{"Uint":"U32"}],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":124,"col":4},"hi":{"line":124,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":124,"col":17},"hi":{"line":124,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["new_size",{"lo":{"line":124,"col":23},"hi":{"line":124,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":124,"col":4},"hi":{"line":124,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Truncate the state to the given size. If the given size is more than the"]},"id":251,"style":"Outer","span":{"lo":{"line":121,"col":4},"hi":{"line":121,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," current state size this operation does nothing. The new position is at"]},"id":252,"style":"Outer","span":{"lo":{"line":122,"col":4},"hi":{"line":122,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," most at the end of the stream."]},"id":253,"style":"Outer","span":{"lo":{"line":123,"col":4},"hi":{"line":123,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," A type that can serve as the contract state type."]},"id":247,"style":"Outer","span":{"lo":{"line":107,"col":0},"hi":{"line":107,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["reserve",{"lo":{"line":129,"col":7},"hi":{"line":129,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"reserve"},"disambiguator":0}],"index":[0,130]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"reserve"},"disambiguator":0}],"index":[0,130]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"reserve"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,259]},"name":"Fresh","span":{"lo":{"line":129,"col":15},"hi":{"line":129,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":129,"col":47},"hi":{"line":129,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":129,"col":14},"hi":{"line":129,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"reserve"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,259]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]},{"Uint":"U32"}],"output":{"Return":{"Tuple":["Bool",{"Param":{"index":0,"name":"Self"}}]}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":129,"col":4},"hi":{"line":129,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":129,"col":16},"hi":{"line":129,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["len",{"lo":{"line":129,"col":22},"hi":{"line":129,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":129,"col":4},"hi":{"line":129,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Make sure that the memory size is at least that many bytes in size."]},"id":254,"style":"Outer","span":{"lo":{"line":126,"col":4},"hi":{"line":126,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Returns true iff this was successful. The new bytes are initialized as"]},"id":255,"style":"Outer","span":{"lo":{"line":127,"col":4},"hi":{"line":127,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," 0."]},"id":256,"style":"Outer","span":{"lo":{"line":128,"col":4},"hi":{"line":128,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," A type that can serve as the contract state type."]},"id":247,"style":"Outer","span":{"lo":{"line":107,"col":0},"hi":{"line":107,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," A type that can serve as the contract state type."]},"id":247,"style":"Outer","span":{"lo":{"line":107,"col":0},"hi":{"line":107,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0}],"index":[0,131]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0}],"index":[0,131]},"span":{"lo":{"line":139,"col":0},"hi":{"line":157,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":139,"col":0},"hi":{"line":157,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0}],"index":[0,131]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":17916136383929855154}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":139,"col":19},"hi":{"line":139,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":139,"col":19},"hi":{"line":139,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0}],"index":[0,131]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":17916136383929855154}}],[{"ident":["init",{"lo":{"line":141,"col":7},"hi":{"line":141,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"init"},"disambiguator":0}],"index":[0,132]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":141,"col":21},"hi":{"line":141,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":141,"col":11},"hi":{"line":141,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},"span":{"lo":{"line":141,"col":4},"hi":{"line":141,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[]]},"span":{"lo":{"line":141,"col":4},"hi":{"line":141,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Initialize a logger."]},"id":263,"style":"Outer","span":{"lo":{"line":140,"col":4},"hi":{"line":140,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Objects which can serve as loggers."]},"id":257,"style":"Outer","span":{"lo":{"line":133,"col":0},"hi":{"line":133,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":258,"style":"Outer","span":{"lo":{"line":134,"col":0},"hi":{"line":134,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Logging functionality can be used by smart contracts to record events that"]},"id":259,"style":"Outer","span":{"lo":{"line":135,"col":0},"hi":{"line":135,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," might be of interest to external parties. These events are not used on the"]},"id":260,"style":"Outer","span":{"lo":{"line":136,"col":0},"hi":{"line":136,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," chain, and cannot be observed by other contracts, but they are stored by the"]},"id":261,"style":"Outer","span":{"lo":{"line":137,"col":0},"hi":{"line":137,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," node, and can be queried to provide information to off-chain actors."]},"id":262,"style":"Outer","span":{"lo":{"line":138,"col":0},"hi":{"line":138,"col":72},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["log_raw",{"lo":{"line":145,"col":7},"hi":{"line":145,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log_raw"},"disambiguator":0}],"index":[0,133]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log_raw"},"disambiguator":0}],"index":[0,133]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,260]},"name":"Fresh","span":{"lo":{"line":145,"col":15},"hi":{"line":145,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log_raw"},"disambiguator":0}],"index":[0,133]},"local_id":2},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,261]},"name":"Fresh","span":{"lo":{"line":145,"col":29},"hi":{"line":145,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":145,"col":67},"hi":{"line":145,"col":67},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":145,"col":14},"hi":{"line":145,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,260]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,261]},"'_"]}}]}},{"Slice":{"Uint":"U8"}},false]}],"output":{"Return":{"Tuple":[{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},{"Param":{"index":0,"name":"Self"}}]}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":145,"col":4},"hi":{"line":145,"col":68},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":145,"col":16},"hi":{"line":145,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["event",{"lo":{"line":145,"col":22},"hi":{"line":145,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":145,"col":4},"hi":{"line":145,"col":68},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Log the given slice as-is. If logging is not successful an error will be"]},"id":264,"style":"Outer","span":{"lo":{"line":143,"col":4},"hi":{"line":143,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," returned."]},"id":265,"style":"Outer","span":{"lo":{"line":144,"col":4},"hi":{"line":144,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Objects which can serve as loggers."]},"id":257,"style":"Outer","span":{"lo":{"line":133,"col":0},"hi":{"line":133,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":258,"style":"Outer","span":{"lo":{"line":134,"col":0},"hi":{"line":134,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Logging functionality can be used by smart contracts to record events that"]},"id":259,"style":"Outer","span":{"lo":{"line":135,"col":0},"hi":{"line":135,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," might be of interest to external parties. These events are not used on the"]},"id":260,"style":"Outer","span":{"lo":{"line":136,"col":0},"hi":{"line":136,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," chain, and cannot be observed by other contracts, but they are stored by the"]},"id":261,"style":"Outer","span":{"lo":{"line":137,"col":0},"hi":{"line":137,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," node, and can be queried to provide information to off-chain actors."]},"id":262,"style":"Outer","span":{"lo":{"line":138,"col":0},"hi":{"line":138,"col":72},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["log",{"lo":{"line":149,"col":7},"hi":{"line":149,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0}],"index":[0,134]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0}],"index":[0,134]},"local_id":6},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0},{"data":{"TypeNs":"S"},"disambiguator":0}],"index":[0,135]},"name":{"Plain":{"name":"S","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0}],"index":[0,134]},"local_id":6}}},"span":{"lo":{"line":149,"col":11},"hi":{"line":149,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":null,"synthetic":false}},"colon_span":{"lo":{"line":149,"col":12},"hi":{"line":149,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0}],"index":[0,134]},"local_id":7},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,262]},"name":"Fresh","span":{"lo":{"line":149,"col":22},"hi":{"line":149,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0}],"index":[0,134]},"local_id":8},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,263]},"name":"Fresh","span":{"lo":{"line":149,"col":36},"hi":{"line":149,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0}],"index":[0,134]},"local_id":5},"span":{"lo":{"line":149,"col":12},"hi":{"line":149,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"origin":"GenericParam","bound_generic_params":[],"bounded_ty":{"Param":{"index":1,"name":"S"}}}}],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":1,"name":"S"}}}]},"is_const":false,"is_positive":true}},"id":9272273951847800647}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Serial"},"disambiguator":0}],"index":[5,55]},"generic_args":[{"Type":{"Param":{"index":1,"name":"S"}}}]},"is_const":false,"is_positive":true}},"id":9303391958149541291}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":149,"col":71},"hi":{"line":149,"col":71},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":149,"col":10},"hi":{"line":149,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,262]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,263]},"'_"]}}]}},{"Param":{"index":1,"name":"S"}},false]}],"output":{"Return":{"Tuple":[{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},{"Param":{"index":0,"name":"Self"}}]}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":149,"col":4},"hi":{"line":149,"col":72},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":149,"col":23},"hi":{"line":149,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["event",{"lo":{"line":149,"col":29},"hi":{"line":149,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":149,"col":4},"hi":{"line":149,"col":72},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Log a serializable event by serializing it with a supplied serializer."]},"id":266,"style":"Outer","span":{"lo":{"line":148,"col":4},"hi":{"line":148,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Objects which can serve as loggers."]},"id":257,"style":"Outer","span":{"lo":{"line":133,"col":0},"hi":{"line":133,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":258,"style":"Outer","span":{"lo":{"line":134,"col":0},"hi":{"line":134,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Logging functionality can be used by smart contracts to record events that"]},"id":259,"style":"Outer","span":{"lo":{"line":135,"col":0},"hi":{"line":135,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," might be of interest to external parties. These events are not used on the"]},"id":260,"style":"Outer","span":{"lo":{"line":136,"col":0},"hi":{"line":136,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," chain, and cannot be observed by other contracts, but they are stored by the"]},"id":261,"style":"Outer","span":{"lo":{"line":137,"col":0},"hi":{"line":137,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," node, and can be queried to provide information to off-chain actors."]},"id":262,"style":"Outer","span":{"lo":{"line":138,"col":0},"hi":{"line":138,"col":72},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Objects which can serve as loggers."]},"id":257,"style":"Outer","span":{"lo":{"line":133,"col":0},"hi":{"line":133,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":258,"style":"Outer","span":{"lo":{"line":134,"col":0},"hi":{"line":134,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Logging functionality can be used by smart contracts to record events that"]},"id":259,"style":"Outer","span":{"lo":{"line":135,"col":0},"hi":{"line":135,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," might be of interest to external parties. These events are not used on the"]},"id":260,"style":"Outer","span":{"lo":{"line":136,"col":0},"hi":{"line":136,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," chain, and cannot be observed by other contracts, but they are stored by the"]},"id":261,"style":"Outer","span":{"lo":{"line":137,"col":0},"hi":{"line":137,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," node, and can be queried to provide information to off-chain actors."]},"id":262,"style":"Outer","span":{"lo":{"line":138,"col":0},"hi":{"line":138,"col":72},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0}],"index":[0,136]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0}],"index":[0,136]},"span":{"lo":{"line":165,"col":0},"hi":{"line":186,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":165,"col":0},"hi":{"line":186,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0}],"index":[0,136]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":7643429660763269667}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":165,"col":20},"hi":{"line":165,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":165,"col":20},"hi":{"line":165,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0}],"index":[0,136]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":7643429660763269667}}],[{"ident":["accept",{"lo":{"line":167,"col":7},"hi":{"line":167,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"accept"},"disambiguator":0}],"index":[0,137]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":167,"col":23},"hi":{"line":167,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":167,"col":13},"hi":{"line":167,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},"span":{"lo":{"line":167,"col":4},"hi":{"line":167,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[]]},"span":{"lo":{"line":167,"col":4},"hi":{"line":167,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Default accept action."]},"id":272,"style":"Outer","span":{"lo":{"line":166,"col":4},"hi":{"line":166,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," An object that can serve to construct actions."]},"id":267,"style":"Outer","span":{"lo":{"line":160,"col":0},"hi":{"line":160,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":268,"style":"Outer","span":{"lo":{"line":161,"col":0},"hi":{"line":161,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The actions that a smart contract can produce as a"]},"id":269,"style":"Outer","span":{"lo":{"line":162,"col":0},"hi":{"line":162,"col":54},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," result of its execution. These actions form a tree and are executed by"]},"id":270,"style":"Outer","span":{"lo":{"line":163,"col":0},"hi":{"line":163,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," the scheduler in the predefined order."]},"id":271,"style":"Outer","span":{"lo":{"line":164,"col":0},"hi":{"line":164,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["simple_transfer",{"lo":{"line":170,"col":7},"hi":{"line":170,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"simple_transfer"},"disambiguator":0}],"index":[0,138]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"simple_transfer"},"disambiguator":0}],"index":[0,138]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"simple_transfer"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,264]},"name":"Fresh","span":{"lo":{"line":170,"col":28},"hi":{"line":170,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":170,"col":68},"hi":{"line":170,"col":68},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":170,"col":22},"hi":{"line":170,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"simple_transfer"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,264]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"AccountAddress"},"disambiguator":0}],"index":[5,964]}}},false]},{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"Amount"},"disambiguator":0}],"index":[5,862]}}}],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":true},"span":{"lo":{"line":170,"col":4},"hi":{"line":170,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["acc",{"lo":{"line":170,"col":23},"hi":{"line":170,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["amount",{"lo":{"line":170,"col":45},"hi":{"line":170,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":170,"col":4},"hi":{"line":170,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Send a given amount to an account."]},"id":273,"style":"Outer","span":{"lo":{"line":169,"col":4},"hi":{"line":169,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," An object that can serve to construct actions."]},"id":267,"style":"Outer","span":{"lo":{"line":160,"col":0},"hi":{"line":160,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":268,"style":"Outer","span":{"lo":{"line":161,"col":0},"hi":{"line":161,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The actions that a smart contract can produce as a"]},"id":269,"style":"Outer","span":{"lo":{"line":162,"col":0},"hi":{"line":162,"col":54},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," result of its execution. These actions form a tree and are executed by"]},"id":270,"style":"Outer","span":{"lo":{"line":163,"col":0},"hi":{"line":163,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," the scheduler in the predefined order."]},"id":271,"style":"Outer","span":{"lo":{"line":164,"col":0},"hi":{"line":164,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["send_raw",{"lo":{"line":173,"col":7},"hi":{"line":173,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0}],"index":[0,139]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0}],"index":[0,139]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,265]},"name":"Fresh","span":{"lo":{"line":174,"col":12},"hi":{"line":174,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0}],"index":[0,139]},"local_id":2},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,266]},"name":"Fresh","span":{"lo":{"line":175,"col":22},"hi":{"line":175,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0}],"index":[0,139]},"local_id":3},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[0,267]},"name":"Fresh","span":{"lo":{"line":177,"col":19},"hi":{"line":177,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":178,"col":13},"hi":{"line":178,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":173,"col":15},"hi":{"line":173,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,265]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"ContractAddress"},"disambiguator":0}],"index":[5,988]}}},false]},{"Adt":{"generic_args":[{"Lifetime":{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,266]},"'_"]}}]}}}],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveName"},"disambiguator":0}],"index":[5,1083]}}},{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"Amount"},"disambiguator":0}],"index":[5,862]}}},{"Ref":[{"kind":{"ReLateBound":[0,{"var":2,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[0,267]},"'_"]}}]}},{"Slice":{"Uint":"U8"}},false]}],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},"span":{"lo":{"line":173,"col":4},"hi":{"line":178,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["ca",{"lo":{"line":174,"col":8},"hi":{"line":174,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["receive_name",{"lo":{"line":175,"col":8},"hi":{"line":175,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["amount",{"lo":{"line":176,"col":8},"hi":{"line":176,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["parameter",{"lo":{"line":177,"col":8},"hi":{"line":177,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":173,"col":4},"hi":{"line":178,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Send a message to a contract."]},"id":274,"style":"Outer","span":{"lo":{"line":172,"col":4},"hi":{"line":172,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," An object that can serve to construct actions."]},"id":267,"style":"Outer","span":{"lo":{"line":160,"col":0},"hi":{"line":160,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":268,"style":"Outer","span":{"lo":{"line":161,"col":0},"hi":{"line":161,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The actions that a smart contract can produce as a"]},"id":269,"style":"Outer","span":{"lo":{"line":162,"col":0},"hi":{"line":162,"col":54},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," result of its execution. These actions form a tree and are executed by"]},"id":270,"style":"Outer","span":{"lo":{"line":163,"col":0},"hi":{"line":163,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," the scheduler in the predefined order."]},"id":271,"style":"Outer","span":{"lo":{"line":164,"col":0},"hi":{"line":164,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["and_then",{"lo":{"line":182,"col":7},"hi":{"line":182,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"and_then"},"disambiguator":0}],"index":[0,140]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":182,"col":41},"hi":{"line":182,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":182,"col":15},"hi":{"line":182,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Param":{"index":0,"name":"Self"}},{"Param":{"index":0,"name":"Self"}}],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"Imm","lifetime_elision_allowed":false},"span":{"lo":{"line":182,"col":4},"hi":{"line":182,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":182,"col":16},"hi":{"line":182,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["then",{"lo":{"line":182,"col":22},"hi":{"line":182,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":182,"col":4},"hi":{"line":182,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," If the execution of the first action succeeds, run the second action"]},"id":275,"style":"Outer","span":{"lo":{"line":180,"col":4},"hi":{"line":180,"col":76},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," as well."]},"id":276,"style":"Outer","span":{"lo":{"line":181,"col":4},"hi":{"line":181,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," An object that can serve to construct actions."]},"id":267,"style":"Outer","span":{"lo":{"line":160,"col":0},"hi":{"line":160,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":268,"style":"Outer","span":{"lo":{"line":161,"col":0},"hi":{"line":161,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The actions that a smart contract can produce as a"]},"id":269,"style":"Outer","span":{"lo":{"line":162,"col":0},"hi":{"line":162,"col":54},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," result of its execution. These actions form a tree and are executed by"]},"id":270,"style":"Outer","span":{"lo":{"line":163,"col":0},"hi":{"line":163,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," the scheduler in the predefined order."]},"id":271,"style":"Outer","span":{"lo":{"line":164,"col":0},"hi":{"line":164,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["or_else",{"lo":{"line":185,"col":7},"hi":{"line":185,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"or_else"},"disambiguator":0}],"index":[0,141]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":185,"col":38},"hi":{"line":185,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":185,"col":14},"hi":{"line":185,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Param":{"index":0,"name":"Self"}},{"Param":{"index":0,"name":"Self"}}],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"Imm","lifetime_elision_allowed":false},"span":{"lo":{"line":185,"col":4},"hi":{"line":185,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":185,"col":15},"hi":{"line":185,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["el",{"lo":{"line":185,"col":21},"hi":{"line":185,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":185,"col":4},"hi":{"line":185,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," If the execution of the first action fails, try the second."]},"id":277,"style":"Outer","span":{"lo":{"line":184,"col":4},"hi":{"line":184,"col":67},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," An object that can serve to construct actions."]},"id":267,"style":"Outer","span":{"lo":{"line":160,"col":0},"hi":{"line":160,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":268,"style":"Outer","span":{"lo":{"line":161,"col":0},"hi":{"line":161,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The actions that a smart contract can produce as a"]},"id":269,"style":"Outer","span":{"lo":{"line":162,"col":0},"hi":{"line":162,"col":54},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," result of its execution. These actions form a tree and are executed by"]},"id":270,"style":"Outer","span":{"lo":{"line":163,"col":0},"hi":{"line":163,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," the scheduler in the predefined order."]},"id":271,"style":"Outer","span":{"lo":{"line":164,"col":0},"hi":{"line":164,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," An object that can serve to construct actions."]},"id":267,"style":"Outer","span":{"lo":{"line":160,"col":0},"hi":{"line":160,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":268,"style":"Outer","span":{"lo":{"line":161,"col":0},"hi":{"line":161,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The actions that a smart contract can produce as a"]},"id":269,"style":"Outer","span":{"lo":{"line":162,"col":0},"hi":{"line":162,"col":54},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," result of its execution. These actions form a tree and are executed by"]},"id":270,"style":"Outer","span":{"lo":{"line":163,"col":0},"hi":{"line":163,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," the scheduler in the predefined order."]},"id":271,"style":"Outer","span":{"lo":{"line":164,"col":0},"hi":{"line":164,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0}],"index":[0,142]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0}],"index":[0,142]},"span":{"lo":{"line":191,"col":0},"hi":{"line":201,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":191,"col":0},"hi":{"line":201,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0}],"index":[0,142]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":18436060400986552328}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":191,"col":21},"hi":{"line":191,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":191,"col":21},"hi":{"line":191,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0}],"index":[0,142]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":18436060400986552328}}],[{"ident":["Unwrap",{"lo":{"line":193,"col":9},"hi":{"line":193,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,143]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0}],"index":[0,142]},{"impl":{"LocalBound":{"clause_id":18436060400986552328,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,143]}}]}}]},"is_const":false,"is_positive":true}},"id":7242937820828818005}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":193,"col":15},"hi":{"line":193,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":193,"col":15},"hi":{"line":193,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0}],"index":[0,142]},{"impl":{"LocalBound":{"clause_id":18436060400986552328,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,143]}}]}}]},"is_const":false,"is_positive":true}},"id":7242937820828818005}}],null]},"span":{"lo":{"line":193,"col":4},"hi":{"line":193,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The underlying result type of the unwrap, in case of success."]},"id":280,"style":"Outer","span":{"lo":{"line":192,"col":4},"hi":{"line":192,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Add optimized unwrap behaviour that aborts the process instead of"]},"id":278,"style":"Outer","span":{"lo":{"line":189,"col":0},"hi":{"line":189,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," panicking."]},"id":279,"style":"Outer","span":{"lo":{"line":190,"col":0},"hi":{"line":190,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["unwrap_abort",{"lo":{"line":200,"col":7},"hi":{"line":200,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0},{"data":{"ValueNs":"unwrap_abort"},"disambiguator":0}],"index":[0,144]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":200,"col":41},"hi":{"line":200,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":200,"col":19},"hi":{"line":200,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Param":{"index":0,"name":"Self"}}],"output":{"Return":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0}],"index":[0,142]},{"impl":{"LocalBound":{"clause_id":18436060400986552328,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,143]}}]}},"c_variadic":false,"implicit_self":"Imm","lifetime_elision_allowed":false},"span":{"lo":{"line":200,"col":4},"hi":{"line":200,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":200,"col":20},"hi":{"line":200,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":200,"col":4},"hi":{"line":200,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Unwrap or call [trap](../fn.trap.html). In contrast to"]},"id":281,"style":"Outer","span":{"lo":{"line":194,"col":4},"hi":{"line":194,"col":62},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," the unwrap methods on [Option::unwrap](https://doc.rust-lang.org/std/option/enum.Option.html#method.unwrap)"]},"id":282,"style":"Outer","span":{"lo":{"line":195,"col":4},"hi":{"line":195,"col":115},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," this method will tend to produce smaller code, at the cost of the"]},"id":283,"style":"Outer","span":{"lo":{"line":196,"col":4},"hi":{"line":196,"col":73},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," ability to handle the panic."]},"id":284,"style":"Outer","span":{"lo":{"line":197,"col":4},"hi":{"line":197,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," This is intended to be used only in `Wasm` code, where panics cannot be"]},"id":285,"style":"Outer","span":{"lo":{"line":198,"col":4},"hi":{"line":198,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," handled anyhow."]},"id":286,"style":"Outer","span":{"lo":{"line":199,"col":4},"hi":{"line":199,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Add optimized unwrap behaviour that aborts the process instead of"]},"id":278,"style":"Outer","span":{"lo":{"line":189,"col":0},"hi":{"line":189,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," panicking."]},"id":279,"style":"Outer","span":{"lo":{"line":190,"col":0},"hi":{"line":190,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Add optimized unwrap behaviour that aborts the process instead of"]},"id":278,"style":"Outer","span":{"lo":{"line":189,"col":0},"hi":{"line":189,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," panicking."]},"id":279,"style":"Outer","span":{"lo":{"line":190,"col":0},"hi":{"line":190,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0}],"index":[0,145]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0}],"index":[0,145]},"span":{"lo":{"line":206,"col":0},"hi":{"line":211,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":206,"col":0},"hi":{"line":211,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0}],"index":[0,145]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":4563165526448952423}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":206,"col":22},"hi":{"line":206,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":206,"col":22},"hi":{"line":206,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0}],"index":[0,145]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":4563165526448952423}}],[{"ident":["Unwrap",{"lo":{"line":207,"col":9},"hi":{"line":207,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,146]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0}],"index":[0,145]},{"impl":{"LocalBound":{"clause_id":4563165526448952423,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,146]}}]}}]},"is_const":false,"is_positive":true}},"id":6926846262952482198}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":207,"col":15},"hi":{"line":207,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":207,"col":15},"hi":{"line":207,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0}],"index":[0,145]},{"impl":{"LocalBound":{"clause_id":4563165526448952423,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,146]}}]}}]},"is_const":false,"is_positive":true}},"id":6926846262952482198}}],null]},"span":{"lo":{"line":207,"col":4},"hi":{"line":207,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"DocComment":["Line"," Analogue of the `expect` methods on types such as [Option](https://doc.rust-lang.org/std/option/enum.Option.html),"]},"id":287,"style":"Outer","span":{"lo":{"line":204,"col":0},"hi":{"line":204,"col":118},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," but useful in a Wasm setting."]},"id":288,"style":"Outer","span":{"lo":{"line":205,"col":0},"hi":{"line":205,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["expect_report",{"lo":{"line":210,"col":7},"hi":{"line":210,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0},{"data":{"ValueNs":"expect_report"},"disambiguator":0}],"index":[0,147]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0},{"data":{"ValueNs":"expect_report"},"disambiguator":0}],"index":[0,147]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0},{"data":{"ValueNs":"expect_report"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,268]},"name":"Fresh","span":{"lo":{"line":210,"col":32},"hi":{"line":210,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":210,"col":53},"hi":{"line":210,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":210,"col":20},"hi":{"line":210,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Param":{"index":0,"name":"Self"}},{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0},{"data":{"ValueNs":"expect_report"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,268]},"'_"]}}]}},"Str",false]}],"output":{"Return":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0}],"index":[0,145]},{"impl":{"LocalBound":{"clause_id":4563165526448952423,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,146]}}]}},"c_variadic":false,"implicit_self":"Imm","lifetime_elision_allowed":true},"span":{"lo":{"line":210,"col":4},"hi":{"line":210,"col":54},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":210,"col":21},"hi":{"line":210,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["msg",{"lo":{"line":210,"col":27},"hi":{"line":210,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":210,"col":4},"hi":{"line":210,"col":54},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Like the default `expect` on, e.g., `Result`, but calling"]},"id":289,"style":"Outer","span":{"lo":{"line":208,"col":4},"hi":{"line":208,"col":65},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," [fail](macro.fail.html) with the given message, instead of `panic`."]},"id":290,"style":"Outer","span":{"lo":{"line":209,"col":4},"hi":{"line":209,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Analogue of the `expect` methods on types such as [Option](https://doc.rust-lang.org/std/option/enum.Option.html),"]},"id":287,"style":"Outer","span":{"lo":{"line":204,"col":0},"hi":{"line":204,"col":118},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," but useful in a Wasm setting."]},"id":288,"style":"Outer","span":{"lo":{"line":205,"col":0},"hi":{"line":205,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Analogue of the `expect` methods on types such as [Option](https://doc.rust-lang.org/std/option/enum.Option.html),"]},"id":287,"style":"Outer","span":{"lo":{"line":204,"col":0},"hi":{"line":204,"col":118},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," but useful in a Wasm setting."]},"id":288,"style":"Outer","span":{"lo":{"line":205,"col":0},"hi":{"line":205,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0}],"index":[0,148]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0}],"index":[0,148]},"span":{"lo":{"line":216,"col":0},"hi":{"line":221,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":216,"col":0},"hi":{"line":221,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0}],"index":[0,148]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":18023446435381850670}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":216,"col":25},"hi":{"line":216,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":216,"col":25},"hi":{"line":216,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0}],"index":[0,148]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":18023446435381850670}}],[{"ident":["Unwrap",{"lo":{"line":217,"col":9},"hi":{"line":217,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,149]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0}],"index":[0,148]},{"impl":{"LocalBound":{"clause_id":18023446435381850670,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,149]}}]}}]},"is_const":false,"is_positive":true}},"id":8136654248162117203}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":217,"col":15},"hi":{"line":217,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":217,"col":15},"hi":{"line":217,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0}],"index":[0,148]},{"impl":{"LocalBound":{"clause_id":18023446435381850670,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,149]}}]}}]},"is_const":false,"is_positive":true}},"id":8136654248162117203}}],null]},"span":{"lo":{"line":217,"col":4},"hi":{"line":217,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"DocComment":["Line"," Analogue of the `expect_err` methods on [Result](https://doc.rust-lang.org/std/result/enum.Result.html),"]},"id":291,"style":"Outer","span":{"lo":{"line":214,"col":0},"hi":{"line":214,"col":108},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," but useful in a Wasm setting."]},"id":292,"style":"Outer","span":{"lo":{"line":215,"col":0},"hi":{"line":215,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["expect_err_report",{"lo":{"line":220,"col":7},"hi":{"line":220,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0},{"data":{"ValueNs":"expect_err_report"},"disambiguator":0}],"index":[0,150]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0},{"data":{"ValueNs":"expect_err_report"},"disambiguator":0}],"index":[0,150]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0},{"data":{"ValueNs":"expect_err_report"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,269]},"name":"Fresh","span":{"lo":{"line":220,"col":36},"hi":{"line":220,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":220,"col":57},"hi":{"line":220,"col":57},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":220,"col":24},"hi":{"line":220,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Param":{"index":0,"name":"Self"}},{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0},{"data":{"ValueNs":"expect_err_report"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,269]},"'_"]}}]}},"Str",false]}],"output":{"Return":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0}],"index":[0,148]},{"impl":{"LocalBound":{"clause_id":18023446435381850670,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,149]}}]}},"c_variadic":false,"implicit_self":"Imm","lifetime_elision_allowed":true},"span":{"lo":{"line":220,"col":4},"hi":{"line":220,"col":58},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":220,"col":25},"hi":{"line":220,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["msg",{"lo":{"line":220,"col":31},"hi":{"line":220,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":220,"col":4},"hi":{"line":220,"col":58},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Like the default `expect_err` on, e.g., `Result`, but calling"]},"id":293,"style":"Outer","span":{"lo":{"line":218,"col":4},"hi":{"line":218,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," [fail](macro.fail.html) with the given message, instead of `panic`."]},"id":294,"style":"Outer","span":{"lo":{"line":219,"col":4},"hi":{"line":219,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Analogue of the `expect_err` methods on [Result](https://doc.rust-lang.org/std/result/enum.Result.html),"]},"id":291,"style":"Outer","span":{"lo":{"line":214,"col":0},"hi":{"line":214,"col":108},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," but useful in a Wasm setting."]},"id":292,"style":"Outer","span":{"lo":{"line":215,"col":0},"hi":{"line":215,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Analogue of the `expect_err` methods on [Result](https://doc.rust-lang.org/std/result/enum.Result.html),"]},"id":291,"style":"Outer","span":{"lo":{"line":214,"col":0},"hi":{"line":214,"col":108},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," but useful in a Wasm setting."]},"id":292,"style":"Outer","span":{"lo":{"line":215,"col":0},"hi":{"line":215,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectNoneReport"},"disambiguator":0}],"index":[0,151]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectNoneReport"},"disambiguator":0}],"index":[0,151]},"span":{"lo":{"line":226,"col":0},"hi":{"line":230,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":226,"col":0},"hi":{"line":230,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectNoneReport"},"disambiguator":0}],"index":[0,151]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":6816229183596714811}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":226,"col":26},"hi":{"line":226,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":226,"col":26},"hi":{"line":226,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectNoneReport"},"disambiguator":0}],"index":[0,151]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":6816229183596714811}}],[{"ident":["expect_none_report",{"lo":{"line":229,"col":7},"hi":{"line":229,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectNoneReport"},"disambiguator":0},{"data":{"ValueNs":"expect_none_report"},"disambiguator":0}],"index":[0,152]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectNoneReport"},"disambiguator":0},{"data":{"ValueNs":"expect_none_report"},"disambiguator":0}],"index":[0,152]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectNoneReport"},"disambiguator":0},{"data":{"ValueNs":"expect_none_report"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,270]},"name":"Fresh","span":{"lo":{"line":229,"col":37},"hi":{"line":229,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":229,"col":42},"hi":{"line":229,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":229,"col":25},"hi":{"line":229,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Param":{"index":0,"name":"Self"}},{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectNoneReport"},"disambiguator":0},{"data":{"ValueNs":"expect_none_report"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,270]},"'_"]}}]}},"Str",false]}],"output":{"DefaultReturn":{"lo":{"line":229,"col":42},"hi":{"line":229,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"c_variadic":false,"implicit_self":"Imm","lifetime_elision_allowed":true},"span":{"lo":{"line":229,"col":4},"hi":{"line":229,"col":43},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":229,"col":26},"hi":{"line":229,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["msg",{"lo":{"line":229,"col":32},"hi":{"line":229,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":229,"col":4},"hi":{"line":229,"col":43},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Like the default `expect_none_report` on, e.g., `Option`, but calling"]},"id":297,"style":"Outer","span":{"lo":{"line":227,"col":4},"hi":{"line":227,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," [fail](macro.fail.html) with the given message, instead of `panic`."]},"id":298,"style":"Outer","span":{"lo":{"line":228,"col":4},"hi":{"line":228,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Analogue of the `expect_none` methods on [Option](https://doc.rust-lang.org/std/option/enum.Option.html),"]},"id":295,"style":"Outer","span":{"lo":{"line":224,"col":0},"hi":{"line":224,"col":109},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," but useful in a Wasm setting."]},"id":296,"style":"Outer","span":{"lo":{"line":225,"col":0},"hi":{"line":225,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Analogue of the `expect_none` methods on [Option](https://doc.rust-lang.org/std/option/enum.Option.html),"]},"id":295,"style":"Outer","span":{"lo":{"line":224,"col":0},"hi":{"line":224,"col":109},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," but useful in a Wasm setting."]},"id":296,"style":"Outer","span":{"lo":{"line":225,"col":0},"hi":{"line":225,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0}],"index":[0,153]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0}],"index":[0,153]},"span":{"lo":{"line":239,"col":0},"hi":{"line":251,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":239,"col":0},"hi":{"line":251,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0}],"index":[0,153]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":14884518810587756718}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":239,"col":19},"hi":{"line":239,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":239,"col":19},"hi":{"line":239,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0}],"index":[0,153]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":14884518810587756718}}],[{"ident":["serial_ctx",{"lo":{"line":246,"col":7},"hi":{"line":246,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0}],"index":[0,154]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0}],"index":[0,154]},"local_id":6},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0},{"data":{"TypeNs":"W"},"disambiguator":0}],"index":[0,155]},"name":{"Plain":{"name":"W","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0}],"index":[0,154]},"local_id":6}}},"span":{"lo":{"line":246,"col":18},"hi":{"line":246,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":null,"synthetic":false}},"colon_span":{"lo":{"line":246,"col":19},"hi":{"line":246,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0}],"index":[0,154]},"local_id":7},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,271]},"name":"Fresh","span":{"lo":{"line":247,"col":8},"hi":{"line":247,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0}],"index":[0,154]},"local_id":8},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,272]},"name":"Fresh","span":{"lo":{"line":249,"col":13},"hi":{"line":249,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0}],"index":[0,154]},"local_id":5},"span":{"lo":{"line":246,"col":19},"hi":{"line":246,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"origin":"GenericParam","bound_generic_params":[],"bounded_ty":{"Param":{"index":1,"name":"W"}}}}],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":1,"name":"W"}}}]},"is_const":false,"is_positive":true}},"id":12551622595042095548}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Write"},"disambiguator":0}],"index":[5,37]},"generic_args":[{"Type":{"Param":{"index":1,"name":"W"}}}]},"is_const":false,"is_positive":true}},"id":8183547936778835857}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":250,"col":32},"hi":{"line":250,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":246,"col":17},"hi":{"line":246,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,271]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]},{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"schema"},"disambiguator":0},{"data":{"TypeNs":"SizeLength"},"disambiguator":0}],"index":[5,761]}}},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,272]},"'_"]}}]}},{"Param":{"index":1,"name":"W"}},false]}],"output":{"Return":{"Tuple":[{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":1,"name":"W"}}}],"trait_def_id":[{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Write"},"disambiguator":0}],"index":[5,37]},{"impl":{"LocalBound":{"clause_id":8183547936778835857,"path":[]}},"args":[]}],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Write"},"disambiguator":0},{"data":{"TypeNs":"Err"},"disambiguator":0}],"index":[5,38]}}]}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},{"Param":{"index":1,"name":"W"}}]}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":246,"col":4},"hi":{"line":250,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":247,"col":9},"hi":{"line":247,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["size_length",{"lo":{"line":248,"col":8},"hi":{"line":248,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["out",{"lo":{"line":249,"col":8},"hi":{"line":249,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":246,"col":4},"hi":{"line":250,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Attempt to write the structure into the provided writer, failing if"]},"id":305,"style":"Outer","span":{"lo":{"line":240,"col":4},"hi":{"line":240,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," if the length cannot be represented in the provided `size_length` or"]},"id":306,"style":"Outer","span":{"lo":{"line":241,"col":4},"hi":{"line":241,"col":76},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," only part of the structure could be written."]},"id":307,"style":"Outer","span":{"lo":{"line":242,"col":4},"hi":{"line":242,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":308,"style":"Outer","span":{"lo":{"line":243,"col":4},"hi":{"line":243,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," NB: We use Result instead of Option for better composability with other"]},"id":309,"style":"Outer","span":{"lo":{"line":244,"col":4},"hi":{"line":244,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," constructs."]},"id":310,"style":"Outer","span":{"lo":{"line":245,"col":4},"hi":{"line":245,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," The `SerialCtx` trait provides a means of writing structures into byte-sinks"]},"id":299,"style":"Outer","span":{"lo":{"line":233,"col":0},"hi":{"line":233,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," (`Write`) using contextual information."]},"id":300,"style":"Outer","span":{"lo":{"line":234,"col":0},"hi":{"line":234,"col":43},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The contextual information is:"]},"id":301,"style":"Outer","span":{"lo":{"line":235,"col":0},"hi":{"line":235,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":302,"style":"Outer","span":{"lo":{"line":236,"col":0},"hi":{"line":236,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," - `size_length`: The number of bytes used to record the length of the"]},"id":303,"style":"Outer","span":{"lo":{"line":237,"col":0},"hi":{"line":237,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," data."]},"id":304,"style":"Outer","span":{"lo":{"line":238,"col":0},"hi":{"line":238,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The `SerialCtx` trait provides a means of writing structures into byte-sinks"]},"id":299,"style":"Outer","span":{"lo":{"line":233,"col":0},"hi":{"line":233,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," (`Write`) using contextual information."]},"id":300,"style":"Outer","span":{"lo":{"line":234,"col":0},"hi":{"line":234,"col":43},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The contextual information is:"]},"id":301,"style":"Outer","span":{"lo":{"line":235,"col":0},"hi":{"line":235,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":302,"style":"Outer","span":{"lo":{"line":236,"col":0},"hi":{"line":236,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," - `size_length`: The number of bytes used to record the length of the"]},"id":303,"style":"Outer","span":{"lo":{"line":237,"col":0},"hi":{"line":237,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," data."]},"id":304,"style":"Outer","span":{"lo":{"line":238,"col":0},"hi":{"line":238,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0}],"index":[0,156]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0}],"index":[0,156]},"span":{"lo":{"line":262,"col":0},"hi":{"line":270,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":262,"col":0},"hi":{"line":270,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":17322672367251655876}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0}],"index":[0,156]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":16635740711172919924}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":262,"col":28},"hi":{"line":262,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":262,"col":21},"hi":{"line":262,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":17322672367251655876}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0}],"index":[0,156]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":16635740711172919924}}],[{"ident":["deserial_ctx",{"lo":{"line":265,"col":7},"hi":{"line":265,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0},{"data":{"ValueNs":"deserial_ctx"},"disambiguator":0}],"index":[0,157]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0},{"data":{"ValueNs":"deserial_ctx"},"disambiguator":0}],"index":[0,157]},"local_id":6},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0},{"data":{"ValueNs":"deserial_ctx"},"disambiguator":0},{"data":{"TypeNs":"R"},"disambiguator":0}],"index":[0,158]},"name":{"Plain":{"name":"R","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0},{"data":{"ValueNs":"deserial_ctx"},"disambiguator":0}],"index":[0,157]},"local_id":6}}},"span":{"lo":{"line":265,"col":20},"hi":{"line":265,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":null,"synthetic":false}},"colon_span":{"lo":{"line":265,"col":21},"hi":{"line":265,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0},{"data":{"ValueNs":"deserial_ctx"},"disambiguator":0}],"index":[0,157]},"local_id":7},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0},{"data":{"ValueNs":"deserial_ctx"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,273]},"name":"Fresh","span":{"lo":{"line":268,"col":16},"hi":{"line":268,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0},{"data":{"ValueNs":"deserial_ctx"},"disambiguator":0}],"index":[0,157]},"local_id":5},"span":{"lo":{"line":265,"col":21},"hi":{"line":265,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"origin":"GenericParam","bound_generic_params":[],"bounded_ty":{"Param":{"index":1,"name":"R"}}}}],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":1,"name":"R"}}}]},"is_const":false,"is_positive":true}},"id":426491624962477427}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Read"},"disambiguator":0}],"index":[5,26]},"generic_args":[{"Type":{"Param":{"index":1,"name":"R"}}}]},"is_const":false,"is_positive":true}},"id":7941244948656693720}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":269,"col":31},"hi":{"line":269,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":265,"col":19},"hi":{"line":265,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"schema"},"disambiguator":0},{"data":{"TypeNs":"SizeLength"},"disambiguator":0}],"index":[5,761]}}},"Bool",{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0},{"data":{"ValueNs":"deserial_ctx"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,273]},"'_"]}}]}},{"Param":{"index":1,"name":"R"}},false]}],"output":{"Return":{"Tuple":[{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"ParseError"},"disambiguator":0}],"index":[5,1172]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},{"Param":{"index":1,"name":"R"}}]}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":true},"span":{"lo":{"line":265,"col":4},"hi":{"line":269,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["size_length",{"lo":{"line":266,"col":8},"hi":{"line":266,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["ensure_ordered",{"lo":{"line":267,"col":8},"hi":{"line":267,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["source",{"lo":{"line":268,"col":8},"hi":{"line":268,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":265,"col":4},"hi":{"line":269,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Attempt to read a structure from a given source and context, failing if"]},"id":319,"style":"Outer","span":{"lo":{"line":263,"col":4},"hi":{"line":263,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," an error occurs during deserialization or reading."]},"id":320,"style":"Outer","span":{"lo":{"line":264,"col":4},"hi":{"line":264,"col":58},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," The `DeserialCtx` trait provides a means of reading structures from"]},"id":311,"style":"Outer","span":{"lo":{"line":254,"col":0},"hi":{"line":254,"col":71},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," byte-sources (`Read`) using contextual information."]},"id":312,"style":"Outer","span":{"lo":{"line":255,"col":0},"hi":{"line":255,"col":55},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The contextual information is:"]},"id":313,"style":"Outer","span":{"lo":{"line":256,"col":0},"hi":{"line":256,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":314,"style":"Outer","span":{"lo":{"line":257,"col":0},"hi":{"line":257,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," - `size_length`: The expected number of bytes used for the length of the"]},"id":315,"style":"Outer","span":{"lo":{"line":258,"col":0},"hi":{"line":258,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," data."]},"id":316,"style":"Outer","span":{"lo":{"line":259,"col":0},"hi":{"line":259,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," - `ensure_ordered`: Whether the ordering should be ensured, for example"]},"id":317,"style":"Outer","span":{"lo":{"line":260,"col":0},"hi":{"line":260,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," that keys in `BTreeMap` and `BTreeSet` are in strictly increasing order."]},"id":318,"style":"Outer","span":{"lo":{"line":261,"col":0},"hi":{"line":261,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The `DeserialCtx` trait provides a means of reading structures from"]},"id":311,"style":"Outer","span":{"lo":{"line":254,"col":0},"hi":{"line":254,"col":71},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," byte-sources (`Read`) using contextual information."]},"id":312,"style":"Outer","span":{"lo":{"line":255,"col":0},"hi":{"line":255,"col":55},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The contextual information is:"]},"id":313,"style":"Outer","span":{"lo":{"line":256,"col":0},"hi":{"line":256,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":314,"style":"Outer","span":{"lo":{"line":257,"col":0},"hi":{"line":257,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," - `size_length`: The expected number of bytes used for the length of the"]},"id":315,"style":"Outer","span":{"lo":{"line":258,"col":0},"hi":{"line":258,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," data."]},"id":316,"style":"Outer","span":{"lo":{"line":259,"col":0},"hi":{"line":259,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," - `ensure_ordered`: Whether the ordering should be ensured, for example"]},"id":317,"style":"Outer","span":{"lo":{"line":260,"col":0},"hi":{"line":260,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," that keys in `BTreeMap` and `BTreeSet` are in strictly increasing order."]},"id":318,"style":"Outer","span":{"lo":{"line":261,"col":0},"hi":{"line":261,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]}]},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":"Use","disambiguator":0}],"index":[0,90]},"span":{"lo":{"line":5,"col":0},"hi":{"line":5,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":5,"col":0},"hi":{"line":5,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":5,"col":4},"hi":{"line":5,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hacspec_concordium","path":[],"index":[0,0]}]}],"segments":[{"ident":["crate",{"lo":{"line":5,"col":4},"hi":{"line":5,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":"Use","disambiguator":0}],"index":[0,90]},"local_id":1},"res":"Err","args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0}],"index":[0,91]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0}],"index":[0,91]},"span":{"lo":{"line":14,"col":0},"hi":{"line":17,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":14,"col":0},"hi":{"line":17,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Read"},"disambiguator":0}],"index":[5,26]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":2437756474506696380}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0}],"index":[0,91]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":6468282439157936302}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":14,"col":28},"hi":{"line":14,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":14,"col":22},"hi":{"line":14,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Read"},"disambiguator":0}],"index":[5,26]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":2437756474506696380}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0}],"index":[0,91]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":6468282439157936302}}],[{"ident":["size",{"lo":{"line":16,"col":7},"hi":{"line":16,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0},{"data":{"ValueNs":"size"},"disambiguator":0}],"index":[0,92]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0},{"data":{"ValueNs":"size"},"disambiguator":0}],"index":[0,92]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0},{"data":{"ValueNs":"size"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,243]},"name":"Fresh","span":{"lo":{"line":16,"col":12},"hi":{"line":16,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":16,"col":25},"hi":{"line":16,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":16,"col":11},"hi":{"line":16,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0},{"data":{"ValueNs":"size"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,243]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":16,"col":4},"hi":{"line":16,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":16,"col":13},"hi":{"line":16,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":16,"col":4},"hi":{"line":16,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Get the size of the parameter to the method."]},"id":201,"style":"Outer","span":{"lo":{"line":15,"col":4},"hi":{"line":15,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Objects which can access parameters to contracts."]},"id":194,"style":"Outer","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":195,"style":"Outer","span":{"lo":{"line":8,"col":0},"hi":{"line":8,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," This trait has a Read supertrait which means that structured parameters can"]},"id":196,"style":"Outer","span":{"lo":{"line":9,"col":0},"hi":{"line":9,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," be directly deserialized by using `.get()` function from the `Get` trait."]},"id":197,"style":"Outer","span":{"lo":{"line":10,"col":0},"hi":{"line":10,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":198,"style":"Outer","span":{"lo":{"line":11,"col":0},"hi":{"line":11,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The reuse of `Read` methods is the reason for the slightly strange choice of"]},"id":199,"style":"Outer","span":{"lo":{"line":12,"col":0},"hi":{"line":12,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," methods of this trait."]},"id":200,"style":"Outer","span":{"lo":{"line":13,"col":0},"hi":{"line":13,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Objects which can access parameters to contracts."]},"id":194,"style":"Outer","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":195,"style":"Outer","span":{"lo":{"line":8,"col":0},"hi":{"line":8,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," This trait has a Read supertrait which means that structured parameters can"]},"id":196,"style":"Outer","span":{"lo":{"line":9,"col":0},"hi":{"line":9,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," be directly deserialized by using `.get()` function from the `Get` trait."]},"id":197,"style":"Outer","span":{"lo":{"line":10,"col":0},"hi":{"line":10,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":198,"style":"Outer","span":{"lo":{"line":11,"col":0},"hi":{"line":11,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The reuse of `Read` methods is the reason for the slightly strange choice of"]},"id":199,"style":"Outer","span":{"lo":{"line":12,"col":0},"hi":{"line":12,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," methods of this trait."]},"id":200,"style":"Outer","span":{"lo":{"line":13,"col":0},"hi":{"line":13,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0}],"index":[0,93]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0}],"index":[0,93]},"span":{"lo":{"line":20,"col":0},"hi":{"line":23,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":20,"col":0},"hi":{"line":23,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0}],"index":[0,93]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":10432781440892472764}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":20,"col":26},"hi":{"line":20,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":20,"col":26},"hi":{"line":20,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0}],"index":[0,93]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":10432781440892472764}}],[{"ident":["slot_time",{"lo":{"line":22,"col":7},"hi":{"line":22,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0},{"data":{"ValueNs":"slot_time"},"disambiguator":0}],"index":[0,94]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0},{"data":{"ValueNs":"slot_time"},"disambiguator":0}],"index":[0,94]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0},{"data":{"ValueNs":"slot_time"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,244]},"name":"Fresh","span":{"lo":{"line":22,"col":17},"hi":{"line":22,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":22,"col":35},"hi":{"line":22,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":22,"col":16},"hi":{"line":22,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0},{"data":{"ValueNs":"slot_time"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,244]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"Timestamp"},"disambiguator":0}],"index":[5,906]}}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":22,"col":4},"hi":{"line":22,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":22,"col":18},"hi":{"line":22,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":22,"col":4},"hi":{"line":22,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Get time in milliseconds at the beginning of this block."]},"id":203,"style":"Outer","span":{"lo":{"line":21,"col":4},"hi":{"line":21,"col":64},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Objects which can access chain metadata."]},"id":202,"style":"Outer","span":{"lo":{"line":19,"col":0},"hi":{"line":19,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Objects which can access chain metadata."]},"id":202,"style":"Outer","span":{"lo":{"line":19,"col":0},"hi":{"line":19,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0}],"index":[0,95]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0}],"index":[0,95]},"span":{"lo":{"line":30,"col":0},"hi":{"line":51,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":30,"col":0},"hi":{"line":51,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0}],"index":[0,95]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":9008509554905379750}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":30,"col":19},"hi":{"line":30,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":30,"col":19},"hi":{"line":30,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0}],"index":[0,95]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":9008509554905379750}}],[{"ident":["identity_provider",{"lo":{"line":33,"col":7},"hi":{"line":33,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"identity_provider"},"disambiguator":0}],"index":[0,96]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"identity_provider"},"disambiguator":0}],"index":[0,96]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"identity_provider"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,245]},"name":"Fresh","span":{"lo":{"line":33,"col":25},"hi":{"line":33,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":33,"col":51},"hi":{"line":33,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":33,"col":24},"hi":{"line":33,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"identity_provider"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,245]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":33,"col":4},"hi":{"line":33,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":33,"col":26},"hi":{"line":33,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":33,"col":4},"hi":{"line":33,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Identity provider who signed the identity object the credential is"]},"id":208,"style":"Outer","span":{"lo":{"line":31,"col":4},"hi":{"line":31,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," derived from."]},"id":209,"style":"Outer","span":{"lo":{"line":32,"col":4},"hi":{"line":32,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," A type which has access to a policy of a credential."]},"id":204,"style":"Outer","span":{"lo":{"line":26,"col":0},"hi":{"line":26,"col":56},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Since policies can be large this is deliberately written in a relatively"]},"id":205,"style":"Outer","span":{"lo":{"line":27,"col":0},"hi":{"line":27,"col":76},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," low-level style to enable efficient traversal of all the attributes without"]},"id":206,"style":"Outer","span":{"lo":{"line":28,"col":0},"hi":{"line":28,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," any allocations."]},"id":207,"style":"Outer","span":{"lo":{"line":29,"col":0},"hi":{"line":29,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["created_at",{"lo":{"line":36,"col":7},"hi":{"line":36,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"created_at"},"disambiguator":0}],"index":[0,97]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"created_at"},"disambiguator":0}],"index":[0,97]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"created_at"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,246]},"name":"Fresh","span":{"lo":{"line":36,"col":18},"hi":{"line":36,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":36,"col":37},"hi":{"line":36,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":36,"col":17},"hi":{"line":36,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"created_at"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,246]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"Timestamp"},"disambiguator":0}],"index":[5,906]}}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":36,"col":4},"hi":{"line":36,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":36,"col":19},"hi":{"line":36,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":36,"col":4},"hi":{"line":36,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Beginning of the month in milliseconds since unix epoch when the"]},"id":210,"style":"Outer","span":{"lo":{"line":34,"col":4},"hi":{"line":34,"col":72},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," credential was created."]},"id":211,"style":"Outer","span":{"lo":{"line":35,"col":4},"hi":{"line":35,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," A type which has access to a policy of a credential."]},"id":204,"style":"Outer","span":{"lo":{"line":26,"col":0},"hi":{"line":26,"col":56},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Since policies can be large this is deliberately written in a relatively"]},"id":205,"style":"Outer","span":{"lo":{"line":27,"col":0},"hi":{"line":27,"col":76},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," low-level style to enable efficient traversal of all the attributes without"]},"id":206,"style":"Outer","span":{"lo":{"line":28,"col":0},"hi":{"line":28,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," any allocations."]},"id":207,"style":"Outer","span":{"lo":{"line":29,"col":0},"hi":{"line":29,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["valid_to",{"lo":{"line":39,"col":7},"hi":{"line":39,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"valid_to"},"disambiguator":0}],"index":[0,98]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"valid_to"},"disambiguator":0}],"index":[0,98]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"valid_to"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,247]},"name":"Fresh","span":{"lo":{"line":39,"col":16},"hi":{"line":39,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":39,"col":35},"hi":{"line":39,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":39,"col":15},"hi":{"line":39,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"valid_to"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,247]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"Timestamp"},"disambiguator":0}],"index":[5,906]}}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":39,"col":4},"hi":{"line":39,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":39,"col":17},"hi":{"line":39,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":39,"col":4},"hi":{"line":39,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Beginning of the month where the credential is no longer valid, in"]},"id":212,"style":"Outer","span":{"lo":{"line":37,"col":4},"hi":{"line":37,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," milliseconds since unix epoch."]},"id":213,"style":"Outer","span":{"lo":{"line":38,"col":4},"hi":{"line":38,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," A type which has access to a policy of a credential."]},"id":204,"style":"Outer","span":{"lo":{"line":26,"col":0},"hi":{"line":26,"col":56},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Since policies can be large this is deliberately written in a relatively"]},"id":205,"style":"Outer","span":{"lo":{"line":27,"col":0},"hi":{"line":27,"col":76},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," low-level style to enable efficient traversal of all the attributes without"]},"id":206,"style":"Outer","span":{"lo":{"line":28,"col":0},"hi":{"line":28,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," any allocations."]},"id":207,"style":"Outer","span":{"lo":{"line":29,"col":0},"hi":{"line":29,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["next_item",{"lo":{"line":50,"col":7},"hi":{"line":50,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0},{"data":{"ValueNs":"next_item"},"disambiguator":0}],"index":[0,99]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":50,"col":85},"hi":{"line":50,"col":85},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":50,"col":16},"hi":{"line":50,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Param":{"index":0,"name":"Self"}},{"Array":[{"Uint":"U8"},{"ty":{"Uint":"Usize"},"span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":0},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"contents":{"Literal":{"Int":{"Uint":[31,"Usize"]}}},"hir_id":null,"attributes":[]}]}],"output":{"Return":{"Tuple":[{"Adt":{"generic_args":[{"Type":{"Tuple":[{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"AttributeTag"},"disambiguator":0}],"index":[5,1142]}}},{"Uint":"U8"}]}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"option"},"disambiguator":0},{"data":{"TypeNs":"Option"},"disambiguator":0}],"index":[1,41362]}}},{"Array":[{"Uint":"U8"},{"ty":{"Uint":"Usize"},"span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":0},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"contents":{"Literal":{"Int":{"Uint":[31,"Usize"]}}},"hir_id":null,"attributes":[]}]},{"Param":{"index":0,"name":"Self"}}]}},"c_variadic":false,"implicit_self":"Imm","lifetime_elision_allowed":false},"span":{"lo":{"line":50,"col":4},"hi":{"line":50,"col":86},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":50,"col":17},"hi":{"line":50,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["buf",{"lo":{"line":50,"col":23},"hi":{"line":50,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":50,"col":4},"hi":{"line":50,"col":86},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Get the next attribute, storing it in the provided buffer."]},"id":214,"style":"Outer","span":{"lo":{"line":40,"col":4},"hi":{"line":40,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The return value, if `Some`, is a pair of an attribute tag, and the"]},"id":215,"style":"Outer","span":{"lo":{"line":41,"col":4},"hi":{"line":41,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," length, `n` of the attribute value. In this case, the attribute"]},"id":216,"style":"Outer","span":{"lo":{"line":42,"col":4},"hi":{"line":42,"col":71},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," value is written in the first `n` bytes of the provided buffer. The"]},"id":217,"style":"Outer","span":{"lo":{"line":43,"col":4},"hi":{"line":43,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," rest of the buffer is unchanged."]},"id":218,"style":"Outer","span":{"lo":{"line":44,"col":4},"hi":{"line":44,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":219,"style":"Outer","span":{"lo":{"line":45,"col":4},"hi":{"line":45,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The reason this function is added here, and we don't simply implement"]},"id":220,"style":"Outer","span":{"lo":{"line":46,"col":4},"hi":{"line":46,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," an Iterator for this type is that with the supplied buffer we can"]},"id":221,"style":"Outer","span":{"lo":{"line":47,"col":4},"hi":{"line":47,"col":73},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," iterate through the elements more efficiently, without any allocations,"]},"id":222,"style":"Outer","span":{"lo":{"line":48,"col":4},"hi":{"line":48,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," the consumer being responsible for allocating the buffer."]},"id":223,"style":"Outer","span":{"lo":{"line":49,"col":4},"hi":{"line":49,"col":65},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," A type which has access to a policy of a credential."]},"id":204,"style":"Outer","span":{"lo":{"line":26,"col":0},"hi":{"line":26,"col":56},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Since policies can be large this is deliberately written in a relatively"]},"id":205,"style":"Outer","span":{"lo":{"line":27,"col":0},"hi":{"line":27,"col":76},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," low-level style to enable efficient traversal of all the attributes without"]},"id":206,"style":"Outer","span":{"lo":{"line":28,"col":0},"hi":{"line":28,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," any allocations."]},"id":207,"style":"Outer","span":{"lo":{"line":29,"col":0},"hi":{"line":29,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," A type which has access to a policy of a credential."]},"id":204,"style":"Outer","span":{"lo":{"line":26,"col":0},"hi":{"line":26,"col":56},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Since policies can be large this is deliberately written in a relatively"]},"id":205,"style":"Outer","span":{"lo":{"line":27,"col":0},"hi":{"line":27,"col":76},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," low-level style to enable efficient traversal of all the attributes without"]},"id":206,"style":"Outer","span":{"lo":{"line":28,"col":0},"hi":{"line":28,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," any allocations."]},"id":207,"style":"Outer","span":{"lo":{"line":29,"col":0},"hi":{"line":29,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},"span":{"lo":{"line":55,"col":0},"hi":{"line":72,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":55,"col":0},"hi":{"line":72,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":9900215877253420355}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":55,"col":23},"hi":{"line":55,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":55,"col":23},"hi":{"line":55,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":9900215877253420355}}],[{"ident":["PolicyType",{"lo":{"line":56,"col":9},"hi":{"line":56,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyType"},"disambiguator":0}],"index":[0,103]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0}],"index":[0,95]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyType"},"disambiguator":0}],"index":[0,103]}}]}}]},"is_const":false,"is_positive":true}},"id":2875386292472038087}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyType"},"disambiguator":0}],"index":[0,103]}}]}}]},"is_const":false,"is_positive":true}},"id":6518296602871724256}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":56,"col":30},"hi":{"line":56,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":56,"col":19},"hi":{"line":56,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasPolicy"},"disambiguator":0}],"index":[0,95]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyType"},"disambiguator":0}],"index":[0,103]}}]}}]},"is_const":false,"is_positive":true}},"id":2875386292472038087}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyType"},"disambiguator":0}],"index":[0,103]}}]}}]},"is_const":false,"is_positive":true}},"id":6518296602871724256}}],null]},"span":{"lo":{"line":56,"col":4},"hi":{"line":56,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"DocComment":["Line"," Common data accessible to both init and receive methods."]},"id":224,"style":"Outer","span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["MetadataType",{"lo":{"line":57,"col":9},"hi":{"line":57,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"MetadataType"},"disambiguator":0}],"index":[0,104]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0}],"index":[0,93]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"MetadataType"},"disambiguator":0}],"index":[0,104]}}]}}]},"is_const":false,"is_positive":true}},"id":1873832837790077758}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"MetadataType"},"disambiguator":0}],"index":[0,104]}}]}}]},"is_const":false,"is_positive":true}},"id":5350708720984506472}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":57,"col":39},"hi":{"line":57,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":57,"col":21},"hi":{"line":57,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasChainMetadata"},"disambiguator":0}],"index":[0,93]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"MetadataType"},"disambiguator":0}],"index":[0,104]}}]}}]},"is_const":false,"is_positive":true}},"id":1873832837790077758}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"MetadataType"},"disambiguator":0}],"index":[0,104]}}]}}]},"is_const":false,"is_positive":true}},"id":5350708720984506472}}],null]},"span":{"lo":{"line":57,"col":4},"hi":{"line":57,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"DocComment":["Line"," Common data accessible to both init and receive methods."]},"id":224,"style":"Outer","span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["ParamType",{"lo":{"line":58,"col":9},"hi":{"line":58,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"ParamType"},"disambiguator":0}],"index":[0,105]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Read"},"disambiguator":0}],"index":[5,26]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"ParamType"},"disambiguator":0}],"index":[0,105]}}]}}]},"is_const":false,"is_positive":true}},"id":1840492096314216500}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0}],"index":[0,91]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"ParamType"},"disambiguator":0}],"index":[0,105]}}]}}]},"is_const":false,"is_positive":true}},"id":6955721314586481954}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"ParamType"},"disambiguator":0}],"index":[0,105]}}]}}]},"is_const":false,"is_positive":true}},"id":13512498811560697081}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":58,"col":39},"hi":{"line":58,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":58,"col":18},"hi":{"line":58,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Read"},"disambiguator":0}],"index":[5,26]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"ParamType"},"disambiguator":0}],"index":[0,105]}}]}}]},"is_const":false,"is_positive":true}},"id":1840492096314216500}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasParameter"},"disambiguator":0}],"index":[0,91]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"ParamType"},"disambiguator":0}],"index":[0,105]}}]}}]},"is_const":false,"is_positive":true}},"id":6955721314586481954}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"ParamType"},"disambiguator":0}],"index":[0,105]}}]}}]},"is_const":false,"is_positive":true}},"id":13512498811560697081}}],null]},"span":{"lo":{"line":58,"col":4},"hi":{"line":58,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"DocComment":["Line"," Common data accessible to both init and receive methods."]},"id":224,"style":"Outer","span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["PolicyIteratorType",{"lo":{"line":59,"col":9},"hi":{"line":59,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Projection":{"projection_ty":{"substs":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}],"trait_def_id":[{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"iterator"},"disambiguator":0},{"data":{"TypeNs":"Iterator"},"disambiguator":0}],"index":[1,7315]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[{"AssocItem":[{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]},"name":"PolicyIteratorType","kind":"Type","container":"TraitContainer","trait_item_def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]},"fn_has_self_parameter":false,"opt_rpitit_info":null},{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"exact_size"},"disambiguator":0},{"data":{"TypeNs":"ExactSizeIterator"},"disambiguator":0}],"index":[1,7260]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}]},{"Parent":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"iterator"},"disambiguator":0},{"data":{"TypeNs":"Iterator"},"disambiguator":0}],"index":[1,7315]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}}]}},"args":[]}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"iterator"},"disambiguator":0},{"data":{"TypeNs":"Iterator"},"disambiguator":0},{"data":{"TypeNs":"Item"},"disambiguator":0}],"index":[1,7316]}},"term":{"Ty":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyType"},"disambiguator":0}],"index":[0,103]}}]}}}},"id":16765557715264579028}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"exact_size"},"disambiguator":0},{"data":{"TypeNs":"ExactSizeIterator"},"disambiguator":0}],"index":[1,7260]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}},"id":2524192090353092294}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"iterator"},"disambiguator":0},{"data":{"TypeNs":"Iterator"},"disambiguator":0}],"index":[1,7315]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}},"id":7479269235389803660}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}},"id":10873437583130849907}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":59,"col":71},"hi":{"line":59,"col":71},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":59,"col":27},"hi":{"line":59,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Projection":{"projection_ty":{"substs":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}],"trait_def_id":[{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"iterator"},"disambiguator":0},{"data":{"TypeNs":"Iterator"},"disambiguator":0}],"index":[1,7315]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[{"AssocItem":[{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]},"name":"PolicyIteratorType","kind":"Type","container":"TraitContainer","trait_item_def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]},"fn_has_self_parameter":false,"opt_rpitit_info":null},{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"exact_size"},"disambiguator":0},{"data":{"TypeNs":"ExactSizeIterator"},"disambiguator":0}],"index":[1,7260]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}]},{"Parent":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"iterator"},"disambiguator":0},{"data":{"TypeNs":"Iterator"},"disambiguator":0}],"index":[1,7315]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}}]}},"args":[]}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"iterator"},"disambiguator":0},{"data":{"TypeNs":"Iterator"},"disambiguator":0},{"data":{"TypeNs":"Item"},"disambiguator":0}],"index":[1,7316]}},"term":{"Ty":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyType"},"disambiguator":0}],"index":[0,103]}}]}}}},"id":16765557715264579028}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"exact_size"},"disambiguator":0},{"data":{"TypeNs":"ExactSizeIterator"},"disambiguator":0}],"index":[1,7260]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}},"id":2524192090353092294}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"iter"},"disambiguator":0},{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"iterator"},"disambiguator":0},{"data":{"TypeNs":"Iterator"},"disambiguator":0}],"index":[1,7315]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}},"id":7479269235389803660}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}}]},"is_const":false,"is_positive":true}},"id":10873437583130849907}}],null]},"span":{"lo":{"line":59,"col":4},"hi":{"line":59,"col":72},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"DocComment":["Line"," Common data accessible to both init and receive methods."]},"id":224,"style":"Outer","span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["policies",{"lo":{"line":67,"col":7},"hi":{"line":67,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"policies"},"disambiguator":0}],"index":[0,107]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"policies"},"disambiguator":0}],"index":[0,107]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"policies"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,248]},"name":"Fresh","span":{"lo":{"line":67,"col":16},"hi":{"line":67,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":67,"col":50},"hi":{"line":67,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":67,"col":15},"hi":{"line":67,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"policies"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,248]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"PolicyIteratorType"},"disambiguator":0}],"index":[0,106]}}]}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":67,"col":4},"hi":{"line":67,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":67,"col":17},"hi":{"line":67,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":67,"col":4},"hi":{"line":67,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Policies of the sender of the message."]},"id":225,"style":"Outer","span":{"lo":{"line":60,"col":4},"hi":{"line":60,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," For init methods this is the would-be creator of the contract,"]},"id":226,"style":"Outer","span":{"lo":{"line":61,"col":4},"hi":{"line":61,"col":70},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," for the receive this is the policies of the immediate sender."]},"id":227,"style":"Outer","span":{"lo":{"line":62,"col":4},"hi":{"line":62,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":228,"style":"Outer","span":{"lo":{"line":63,"col":4},"hi":{"line":63,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," In the latter case, if the sender is an account then it is the policies"]},"id":229,"style":"Outer","span":{"lo":{"line":64,"col":4},"hi":{"line":64,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," of the account, if it is a contract then it is the policies of the"]},"id":230,"style":"Outer","span":{"lo":{"line":65,"col":4},"hi":{"line":65,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," creator of the contract."]},"id":231,"style":"Outer","span":{"lo":{"line":66,"col":4},"hi":{"line":66,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Common data accessible to both init and receive methods."]},"id":224,"style":"Outer","span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["metadata",{"lo":{"line":69,"col":7},"hi":{"line":69,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"metadata"},"disambiguator":0}],"index":[0,108]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"metadata"},"disambiguator":0}],"index":[0,108]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"metadata"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,249]},"name":"Fresh","span":{"lo":{"line":69,"col":16},"hi":{"line":69,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":69,"col":45},"hi":{"line":69,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":69,"col":15},"hi":{"line":69,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"metadata"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,249]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"metadata"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,249]},"'_"]}}]}},{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"MetadataType"},"disambiguator":0}],"index":[0,104]}}]},false]}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":69,"col":4},"hi":{"line":69,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":69,"col":17},"hi":{"line":69,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":69,"col":4},"hi":{"line":69,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Get the reference to chain metadata"]},"id":232,"style":"Outer","span":{"lo":{"line":68,"col":4},"hi":{"line":68,"col":43},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Common data accessible to both init and receive methods."]},"id":224,"style":"Outer","span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["parameter_cursor",{"lo":{"line":71,"col":7},"hi":{"line":71,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"parameter_cursor"},"disambiguator":0}],"index":[0,109]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"parameter_cursor"},"disambiguator":0}],"index":[0,109]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"parameter_cursor"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,250]},"name":"Fresh","span":{"lo":{"line":71,"col":24},"hi":{"line":71,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":71,"col":49},"hi":{"line":71,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":71,"col":23},"hi":{"line":71,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"ValueNs":"parameter_cursor"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,250]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},{"impl":{"LocalBound":{"clause_id":9900215877253420355,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0},{"data":{"TypeNs":"ParamType"},"disambiguator":0}],"index":[0,105]}}]}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":71,"col":4},"hi":{"line":71,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":71,"col":25},"hi":{"line":71,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":71,"col":4},"hi":{"line":71,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Get the cursor to the parameter."]},"id":233,"style":"Outer","span":{"lo":{"line":70,"col":4},"hi":{"line":70,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Common data accessible to both init and receive methods."]},"id":224,"style":"Outer","span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Common data accessible to both init and receive methods."]},"id":224,"style":"Outer","span":{"lo":{"line":54,"col":0},"hi":{"line":54,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},"span":{"lo":{"line":76,"col":0},"hi":{"line":83,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":76,"col":0},"hi":{"line":83,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},"local_id":7},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[0,111]},"name":{"Plain":{"name":"Error","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},"local_id":7}}},"span":{"lo":{"line":76,"col":25},"hi":{"line":76,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":{"Tuple":[]},"synthetic":false}},"colon_span":{"lo":{"line":76,"col":30},"hi":{"line":76,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"attributes":[]}],"predicates":[{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},"local_id":5},"span":{"lo":{"line":76,"col":30},"hi":{"line":76,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"origin":"GenericParam","bound_generic_params":[],"bounded_ty":{"Param":{"index":1,"name":"Error"}}}}],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":9900215877253420355}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":13656839978771590325}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":468573141220163386}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":6451289350237964709}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":76,"col":60},"hi":{"line":76,"col":60},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":76,"col":24},"hi":{"line":76,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":9900215877253420355}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":13656839978771590325}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":468573141220163386}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":6451289350237964709}}],[{"ident":["InitData",{"lo":{"line":78,"col":9},"hi":{"line":78,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"TypeNs":"InitData"},"disambiguator":0}],"index":[0,112]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},{"impl":{"LocalBound":{"clause_id":6451289350237964709,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"TypeNs":"InitData"},"disambiguator":0}],"index":[0,112]}}]}}]},"is_const":false,"is_positive":true}},"id":12058970868310053901}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":78,"col":17},"hi":{"line":78,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":78,"col":17},"hi":{"line":78,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},{"impl":{"LocalBound":{"clause_id":6451289350237964709,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"TypeNs":"InitData"},"disambiguator":0}],"index":[0,112]}}]}}]},"is_const":false,"is_positive":true}},"id":12058970868310053901}}],null]},"span":{"lo":{"line":78,"col":4},"hi":{"line":78,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Data needed to open the context."]},"id":235,"style":"Outer","span":{"lo":{"line":77,"col":4},"hi":{"line":77,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as init contexts."]},"id":234,"style":"Outer","span":{"lo":{"line":75,"col":0},"hi":{"line":75,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["open",{"lo":{"line":80,"col":7},"hi":{"line":80,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"ValueNs":"open"},"disambiguator":0}],"index":[0,113]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":80,"col":41},"hi":{"line":80,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":80,"col":11},"hi":{"line":80,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0}],"index":[0,110]},{"impl":{"LocalBound":{"clause_id":6451289350237964709,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"TypeNs":"InitData"},"disambiguator":0}],"index":[0,112]}}]}],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},"span":{"lo":{"line":80,"col":4},"hi":{"line":80,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["data",{"lo":{"line":80,"col":12},"hi":{"line":80,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":80,"col":4},"hi":{"line":80,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Open the init context for reading and accessing values."]},"id":236,"style":"Outer","span":{"lo":{"line":79,"col":4},"hi":{"line":79,"col":63},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as init contexts."]},"id":234,"style":"Outer","span":{"lo":{"line":75,"col":0},"hi":{"line":75,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["init_origin",{"lo":{"line":82,"col":7},"hi":{"line":82,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"ValueNs":"init_origin"},"disambiguator":0}],"index":[0,114]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"ValueNs":"init_origin"},"disambiguator":0}],"index":[0,114]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"ValueNs":"init_origin"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,251]},"name":"Fresh","span":{"lo":{"line":82,"col":19},"hi":{"line":82,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":82,"col":43},"hi":{"line":82,"col":43},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":82,"col":18},"hi":{"line":82,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasInitContext"},"disambiguator":0},{"data":{"ValueNs":"init_origin"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,251]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"AccountAddress"},"disambiguator":0}],"index":[5,964]}}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":82,"col":4},"hi":{"line":82,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":82,"col":20},"hi":{"line":82,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":82,"col":4},"hi":{"line":82,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Who invoked this init call."]},"id":237,"style":"Outer","span":{"lo":{"line":81,"col":4},"hi":{"line":81,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as init contexts."]},"id":234,"style":"Outer","span":{"lo":{"line":75,"col":0},"hi":{"line":75,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Types which can act as init contexts."]},"id":234,"style":"Outer","span":{"lo":{"line":75,"col":0},"hi":{"line":75,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},"span":{"lo":{"line":87,"col":0},"hi":{"line":104,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":87,"col":0},"hi":{"line":104,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},"local_id":7},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[0,116]},"name":{"Plain":{"name":"Error","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},"local_id":7}}},"span":{"lo":{"line":87,"col":28},"hi":{"line":87,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":{"Tuple":[]},"synthetic":false}},"colon_span":{"lo":{"line":87,"col":33},"hi":{"line":87,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"attributes":[]}],"predicates":[{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},"local_id":5},"span":{"lo":{"line":87,"col":33},"hi":{"line":87,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"origin":"GenericParam","bound_generic_params":[],"bounded_ty":{"Param":{"index":1,"name":"Error"}}}}],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":9900215877253420355}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":13656839978771590325}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":468573141220163386}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":3139667756981812396}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":87,"col":63},"hi":{"line":87,"col":63},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":87,"col":27},"hi":{"line":87,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasCommonData"},"disambiguator":0}],"index":[0,102]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":9900215877253420355}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":13656839978771590325}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":468573141220163386}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":3139667756981812396}}],[{"ident":["ReceiveData",{"lo":{"line":88,"col":9},"hi":{"line":88,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"TypeNs":"ReceiveData"},"disambiguator":0}],"index":[0,117]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},{"impl":{"LocalBound":{"clause_id":3139667756981812396,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"TypeNs":"ReceiveData"},"disambiguator":0}],"index":[0,117]}}]}}]},"is_const":false,"is_positive":true}},"id":16141720423459337414}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":88,"col":20},"hi":{"line":88,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":88,"col":20},"hi":{"line":88,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},{"impl":{"LocalBound":{"clause_id":3139667756981812396,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"TypeNs":"ReceiveData"},"disambiguator":0}],"index":[0,117]}}]}}]},"is_const":false,"is_positive":true}},"id":16141720423459337414}}],null]},"span":{"lo":{"line":88,"col":4},"hi":{"line":88,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as receive contexts."]},"id":238,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["open",{"lo":{"line":91,"col":7},"hi":{"line":91,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"open"},"disambiguator":0}],"index":[0,118]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":91,"col":44},"hi":{"line":91,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":91,"col":11},"hi":{"line":91,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0}],"index":[0,115]},{"impl":{"LocalBound":{"clause_id":3139667756981812396,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"TypeNs":"ReceiveData"},"disambiguator":0}],"index":[0,117]}}]}],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},"span":{"lo":{"line":91,"col":4},"hi":{"line":91,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["data",{"lo":{"line":91,"col":12},"hi":{"line":91,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":91,"col":4},"hi":{"line":91,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Open the receive context for reading and accessing values."]},"id":239,"style":"Outer","span":{"lo":{"line":90,"col":4},"hi":{"line":90,"col":66},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as receive contexts."]},"id":238,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["invoker",{"lo":{"line":94,"col":7},"hi":{"line":94,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"invoker"},"disambiguator":0}],"index":[0,119]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"invoker"},"disambiguator":0}],"index":[0,119]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"invoker"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,252]},"name":"Fresh","span":{"lo":{"line":94,"col":15},"hi":{"line":94,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":94,"col":39},"hi":{"line":94,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":94,"col":14},"hi":{"line":94,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"invoker"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,252]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"AccountAddress"},"disambiguator":0}],"index":[5,964]}}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":94,"col":4},"hi":{"line":94,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":94,"col":16},"hi":{"line":94,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":94,"col":4},"hi":{"line":94,"col":40},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Who is the account that initiated the top-level transaction this"]},"id":240,"style":"Outer","span":{"lo":{"line":92,"col":4},"hi":{"line":92,"col":72},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," invocation is a part of."]},"id":241,"style":"Outer","span":{"lo":{"line":93,"col":4},"hi":{"line":93,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as receive contexts."]},"id":238,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["self_address",{"lo":{"line":96,"col":7},"hi":{"line":96,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"self_address"},"disambiguator":0}],"index":[0,120]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"self_address"},"disambiguator":0}],"index":[0,120]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"self_address"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,253]},"name":"Fresh","span":{"lo":{"line":96,"col":20},"hi":{"line":96,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":96,"col":45},"hi":{"line":96,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":96,"col":19},"hi":{"line":96,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"self_address"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,253]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"ContractAddress"},"disambiguator":0}],"index":[5,988]}}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":96,"col":4},"hi":{"line":96,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":96,"col":21},"hi":{"line":96,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":96,"col":4},"hi":{"line":96,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The address of the contract being invoked."]},"id":242,"style":"Outer","span":{"lo":{"line":95,"col":4},"hi":{"line":95,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as receive contexts."]},"id":238,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["self_balance",{"lo":{"line":98,"col":7},"hi":{"line":98,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"self_balance"},"disambiguator":0}],"index":[0,121]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"self_balance"},"disambiguator":0}],"index":[0,121]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"self_balance"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,254]},"name":"Fresh","span":{"lo":{"line":98,"col":20},"hi":{"line":98,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":98,"col":36},"hi":{"line":98,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":98,"col":19},"hi":{"line":98,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"self_balance"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,254]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"Amount"},"disambiguator":0}],"index":[5,862]}}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":98,"col":4},"hi":{"line":98,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":98,"col":21},"hi":{"line":98,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":98,"col":4},"hi":{"line":98,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Balance on the contract before the call was made."]},"id":243,"style":"Outer","span":{"lo":{"line":97,"col":4},"hi":{"line":97,"col":57},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as receive contexts."]},"id":238,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["sender",{"lo":{"line":101,"col":7},"hi":{"line":101,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"sender"},"disambiguator":0}],"index":[0,122]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"sender"},"disambiguator":0}],"index":[0,122]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"sender"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,255]},"name":"Fresh","span":{"lo":{"line":101,"col":14},"hi":{"line":101,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":101,"col":31},"hi":{"line":101,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":101,"col":13},"hi":{"line":101,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"sender"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,255]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"Address"},"disambiguator":0}],"index":[5,1009]}}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":101,"col":4},"hi":{"line":101,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":101,"col":15},"hi":{"line":101,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":101,"col":4},"hi":{"line":101,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The immediate sender of the message. In general different from the"]},"id":244,"style":"Outer","span":{"lo":{"line":99,"col":4},"hi":{"line":99,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," invoker."]},"id":245,"style":"Outer","span":{"lo":{"line":100,"col":4},"hi":{"line":100,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as receive contexts."]},"id":238,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["owner",{"lo":{"line":103,"col":7},"hi":{"line":103,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"owner"},"disambiguator":0}],"index":[0,123]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"owner"},"disambiguator":0}],"index":[0,123]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"owner"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,256]},"name":"Fresh","span":{"lo":{"line":103,"col":13},"hi":{"line":103,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":103,"col":37},"hi":{"line":103,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":103,"col":12},"hi":{"line":103,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasReceiveContext"},"disambiguator":0},{"data":{"ValueNs":"owner"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,256]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"AccountAddress"},"disambiguator":0}],"index":[5,964]}}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":103,"col":4},"hi":{"line":103,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":103,"col":14},"hi":{"line":103,"col":18},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":103,"col":4},"hi":{"line":103,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Account which created the contract instance."]},"id":246,"style":"Outer","span":{"lo":{"line":102,"col":4},"hi":{"line":102,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Types which can act as receive contexts."]},"id":238,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Types which can act as receive contexts."]},"id":238,"style":"Outer","span":{"lo":{"line":86,"col":0},"hi":{"line":86,"col":44},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"span":{"lo":{"line":108,"col":0},"hi":{"line":130,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":108,"col":0},"hi":{"line":130,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"local_id":28},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"TypeNs":"Error"},"disambiguator":0}],"index":[0,125]},"name":{"Plain":{"name":"Error","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"local_id":28}}},"span":{"lo":{"line":108,"col":27},"hi":{"line":108,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":{"Tuple":[]},"synthetic":false}},"colon_span":{"lo":{"line":108,"col":32},"hi":{"line":108,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"attributes":[]}],"predicates":[{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"local_id":5},"span":{"lo":{"line":108,"col":32},"hi":{"line":108,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"origin":"GenericParam","bound_generic_params":[],"bounded_ty":{"Param":{"index":1,"name":"Error"}}}},{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"local_id":6},"span":{"lo":{"line":110,"col":4},"hi":{"line":110,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"origin":"WhereClause","bound_generic_params":[],"bounded_ty":{"Param":{"index":0,"name":"Self"}}}},{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"local_id":11},"span":{"lo":{"line":111,"col":4},"hi":{"line":111,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"origin":"WhereClause","bound_generic_params":[],"bounded_ty":{"Param":{"index":0,"name":"Self"}}}},{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"local_id":19},"span":{"lo":{"line":112,"col":4},"hi":{"line":112,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"origin":"WhereClause","bound_generic_params":[],"bounded_ty":{"Param":{"index":0,"name":"Self"}}}}],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":13656839978771590325}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":468573141220163386}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Read"},"disambiguator":0}],"index":[5,26]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":2437756474506696380}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Write"},"disambiguator":0}],"index":[5,37]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":14362174564524012008}},{"Clause":{"kind":{"Projection":{"projection_ty":{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Write"},"disambiguator":0}],"index":[5,37]},{"impl":{"LocalBound":{"clause_id":14362174564524012008,"path":[]}},"args":[]}],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Write"},"disambiguator":0},{"data":{"TypeNs":"Err"},"disambiguator":0}],"index":[5,38]}},"term":{"Ty":{"Param":{"index":1,"name":"Error"}}}}},"id":4054745027042689359}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Seek"},"disambiguator":0}],"index":[5,22]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":1025623541863160082}},{"Clause":{"kind":{"Projection":{"projection_ty":{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Seek"},"disambiguator":0}],"index":[5,22]},{"impl":{"LocalBound":{"clause_id":1025623541863160082,"path":[]}},"args":[]}],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Seek"},"disambiguator":0},{"data":{"TypeNs":"Err"},"disambiguator":0}],"index":[5,23]}},"term":{"Ty":{"Param":{"index":1,"name":"Error"}}}}},"id":12486526404069431600}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":16350532459756314912}}],"has_where_clause_predicates":true,"where_clause_span":{"lo":{"line":109,"col":0},"hi":{"line":112,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":108,"col":26},"hi":{"line":108,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":13656839978771590325}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"default"},"disambiguator":0},{"data":{"TypeNs":"Default"},"disambiguator":0}],"index":[1,2587]},"generic_args":[{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":468573141220163386}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Read"},"disambiguator":0}],"index":[5,26]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":2437756474506696380}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Write"},"disambiguator":0}],"index":[5,37]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":14362174564524012008}},{"Clause":{"kind":{"Projection":{"projection_ty":{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Write"},"disambiguator":0}],"index":[5,37]},{"impl":{"LocalBound":{"clause_id":14362174564524012008,"path":[]}},"args":[]}],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Write"},"disambiguator":0},{"data":{"TypeNs":"Err"},"disambiguator":0}],"index":[5,38]}},"term":{"Ty":{"Param":{"index":1,"name":"Error"}}}}},"id":4054745027042689359}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Seek"},"disambiguator":0}],"index":[5,22]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":1025623541863160082}},{"Clause":{"kind":{"Projection":{"projection_ty":{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Seek"},"disambiguator":0}],"index":[5,22]},{"impl":{"LocalBound":{"clause_id":1025623541863160082,"path":[]}},"args":[]}],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Seek"},"disambiguator":0},{"data":{"TypeNs":"Err"},"disambiguator":0}],"index":[5,23]}},"term":{"Ty":{"Param":{"index":1,"name":"Error"}}}}},"id":12486526404069431600}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}]},"is_const":false,"is_positive":true}},"id":16350532459756314912}}],[{"ident":["ContractStateData",{"lo":{"line":113,"col":9},"hi":{"line":113,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"TypeNs":"ContractStateData"},"disambiguator":0}],"index":[0,126]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},{"impl":{"LocalBound":{"clause_id":16350532459756314912,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"TypeNs":"ContractStateData"},"disambiguator":0}],"index":[0,126]}}]}}]},"is_const":false,"is_positive":true}},"id":9003714832965411642}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":113,"col":26},"hi":{"line":113,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":113,"col":26},"hi":{"line":113,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},{"impl":{"LocalBound":{"clause_id":16350532459756314912,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"TypeNs":"ContractStateData"},"disambiguator":0}],"index":[0,126]}}]}}]},"is_const":false,"is_positive":true}},"id":9003714832965411642}}],null]},"span":{"lo":{"line":113,"col":4},"hi":{"line":113,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"DocComment":["Line"," A type that can serve as the contract state type."]},"id":247,"style":"Outer","span":{"lo":{"line":107,"col":0},"hi":{"line":107,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["open",{"lo":{"line":116,"col":7},"hi":{"line":116,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"open"},"disambiguator":0}],"index":[0,127]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":116,"col":47},"hi":{"line":116,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":116,"col":11},"hi":{"line":116,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Param":{"index":1,"name":"Error"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0}],"index":[0,124]},{"impl":{"LocalBound":{"clause_id":16350532459756314912,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"TypeNs":"ContractStateData"},"disambiguator":0}],"index":[0,126]}}]}],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},"span":{"lo":{"line":116,"col":4},"hi":{"line":116,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["",{"lo":{"line":116,"col":12},"hi":{"line":116,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":116,"col":4},"hi":{"line":116,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Open the contract state. Only one instance can be opened at the same"]},"id":248,"style":"Outer","span":{"lo":{"line":114,"col":4},"hi":{"line":114,"col":76},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," time."]},"id":249,"style":"Outer","span":{"lo":{"line":115,"col":4},"hi":{"line":115,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," A type that can serve as the contract state type."]},"id":247,"style":"Outer","span":{"lo":{"line":107,"col":0},"hi":{"line":107,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["size",{"lo":{"line":119,"col":7},"hi":{"line":119,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"size"},"disambiguator":0}],"index":[0,128]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"size"},"disambiguator":0}],"index":[0,128]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"size"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,257]},"name":"Fresh","span":{"lo":{"line":119,"col":12},"hi":{"line":119,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":119,"col":25},"hi":{"line":119,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":119,"col":11},"hi":{"line":119,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"size"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,257]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]}],"output":{"Return":{"Uint":"U32"}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":119,"col":4},"hi":{"line":119,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":119,"col":13},"hi":{"line":119,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":119,"col":4},"hi":{"line":119,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Get the current size of contract state."]},"id":250,"style":"Outer","span":{"lo":{"line":118,"col":4},"hi":{"line":118,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," A type that can serve as the contract state type."]},"id":247,"style":"Outer","span":{"lo":{"line":107,"col":0},"hi":{"line":107,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["truncate",{"lo":{"line":124,"col":7},"hi":{"line":124,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"truncate"},"disambiguator":0}],"index":[0,129]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"truncate"},"disambiguator":0}],"index":[0,129]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"truncate"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,258]},"name":"Fresh","span":{"lo":{"line":124,"col":16},"hi":{"line":124,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":124,"col":45},"hi":{"line":124,"col":45},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":124,"col":15},"hi":{"line":124,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"truncate"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,258]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]},{"Uint":"U32"}],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":124,"col":4},"hi":{"line":124,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":124,"col":17},"hi":{"line":124,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["new_size",{"lo":{"line":124,"col":23},"hi":{"line":124,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":124,"col":4},"hi":{"line":124,"col":46},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Truncate the state to the given size. If the given size is more than the"]},"id":251,"style":"Outer","span":{"lo":{"line":121,"col":4},"hi":{"line":121,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," current state size this operation does nothing. The new position is at"]},"id":252,"style":"Outer","span":{"lo":{"line":122,"col":4},"hi":{"line":122,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," most at the end of the stream."]},"id":253,"style":"Outer","span":{"lo":{"line":123,"col":4},"hi":{"line":123,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," A type that can serve as the contract state type."]},"id":247,"style":"Outer","span":{"lo":{"line":107,"col":0},"hi":{"line":107,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["reserve",{"lo":{"line":129,"col":7},"hi":{"line":129,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"reserve"},"disambiguator":0}],"index":[0,130]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"reserve"},"disambiguator":0}],"index":[0,130]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"reserve"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,259]},"name":"Fresh","span":{"lo":{"line":129,"col":15},"hi":{"line":129,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":129,"col":47},"hi":{"line":129,"col":47},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":129,"col":14},"hi":{"line":129,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasContractState"},"disambiguator":0},{"data":{"ValueNs":"reserve"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,259]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]},{"Uint":"U32"}],"output":{"Return":{"Tuple":["Bool",{"Param":{"index":0,"name":"Self"}}]}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":129,"col":4},"hi":{"line":129,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":129,"col":16},"hi":{"line":129,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["len",{"lo":{"line":129,"col":22},"hi":{"line":129,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":129,"col":4},"hi":{"line":129,"col":48},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Make sure that the memory size is at least that many bytes in size."]},"id":254,"style":"Outer","span":{"lo":{"line":126,"col":4},"hi":{"line":126,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Returns true iff this was successful. The new bytes are initialized as"]},"id":255,"style":"Outer","span":{"lo":{"line":127,"col":4},"hi":{"line":127,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," 0."]},"id":256,"style":"Outer","span":{"lo":{"line":128,"col":4},"hi":{"line":128,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," A type that can serve as the contract state type."]},"id":247,"style":"Outer","span":{"lo":{"line":107,"col":0},"hi":{"line":107,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," A type that can serve as the contract state type."]},"id":247,"style":"Outer","span":{"lo":{"line":107,"col":0},"hi":{"line":107,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0}],"index":[0,131]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0}],"index":[0,131]},"span":{"lo":{"line":139,"col":0},"hi":{"line":157,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":139,"col":0},"hi":{"line":157,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0}],"index":[0,131]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":17916136383929855154}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":139,"col":19},"hi":{"line":139,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":139,"col":19},"hi":{"line":139,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0}],"index":[0,131]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":17916136383929855154}}],[{"ident":["init",{"lo":{"line":141,"col":7},"hi":{"line":141,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"init"},"disambiguator":0}],"index":[0,132]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":141,"col":21},"hi":{"line":141,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":141,"col":11},"hi":{"line":141,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},"span":{"lo":{"line":141,"col":4},"hi":{"line":141,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[]]},"span":{"lo":{"line":141,"col":4},"hi":{"line":141,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Initialize a logger."]},"id":263,"style":"Outer","span":{"lo":{"line":140,"col":4},"hi":{"line":140,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Objects which can serve as loggers."]},"id":257,"style":"Outer","span":{"lo":{"line":133,"col":0},"hi":{"line":133,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":258,"style":"Outer","span":{"lo":{"line":134,"col":0},"hi":{"line":134,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Logging functionality can be used by smart contracts to record events that"]},"id":259,"style":"Outer","span":{"lo":{"line":135,"col":0},"hi":{"line":135,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," might be of interest to external parties. These events are not used on the"]},"id":260,"style":"Outer","span":{"lo":{"line":136,"col":0},"hi":{"line":136,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," chain, and cannot be observed by other contracts, but they are stored by the"]},"id":261,"style":"Outer","span":{"lo":{"line":137,"col":0},"hi":{"line":137,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," node, and can be queried to provide information to off-chain actors."]},"id":262,"style":"Outer","span":{"lo":{"line":138,"col":0},"hi":{"line":138,"col":72},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["log_raw",{"lo":{"line":145,"col":7},"hi":{"line":145,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log_raw"},"disambiguator":0}],"index":[0,133]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log_raw"},"disambiguator":0}],"index":[0,133]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,260]},"name":"Fresh","span":{"lo":{"line":145,"col":15},"hi":{"line":145,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log_raw"},"disambiguator":0}],"index":[0,133]},"local_id":2},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,261]},"name":"Fresh","span":{"lo":{"line":145,"col":29},"hi":{"line":145,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":145,"col":67},"hi":{"line":145,"col":67},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":145,"col":14},"hi":{"line":145,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,260]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,261]},"'_"]}}]}},{"Slice":{"Uint":"U8"}},false]}],"output":{"Return":{"Tuple":[{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},{"Param":{"index":0,"name":"Self"}}]}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":145,"col":4},"hi":{"line":145,"col":68},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":145,"col":16},"hi":{"line":145,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["event",{"lo":{"line":145,"col":22},"hi":{"line":145,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":145,"col":4},"hi":{"line":145,"col":68},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Log the given slice as-is. If logging is not successful an error will be"]},"id":264,"style":"Outer","span":{"lo":{"line":143,"col":4},"hi":{"line":143,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," returned."]},"id":265,"style":"Outer","span":{"lo":{"line":144,"col":4},"hi":{"line":144,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Objects which can serve as loggers."]},"id":257,"style":"Outer","span":{"lo":{"line":133,"col":0},"hi":{"line":133,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":258,"style":"Outer","span":{"lo":{"line":134,"col":0},"hi":{"line":134,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Logging functionality can be used by smart contracts to record events that"]},"id":259,"style":"Outer","span":{"lo":{"line":135,"col":0},"hi":{"line":135,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," might be of interest to external parties. These events are not used on the"]},"id":260,"style":"Outer","span":{"lo":{"line":136,"col":0},"hi":{"line":136,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," chain, and cannot be observed by other contracts, but they are stored by the"]},"id":261,"style":"Outer","span":{"lo":{"line":137,"col":0},"hi":{"line":137,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," node, and can be queried to provide information to off-chain actors."]},"id":262,"style":"Outer","span":{"lo":{"line":138,"col":0},"hi":{"line":138,"col":72},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["log",{"lo":{"line":149,"col":7},"hi":{"line":149,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0}],"index":[0,134]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0}],"index":[0,134]},"local_id":6},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0},{"data":{"TypeNs":"S"},"disambiguator":0}],"index":[0,135]},"name":{"Plain":{"name":"S","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0}],"index":[0,134]},"local_id":6}}},"span":{"lo":{"line":149,"col":11},"hi":{"line":149,"col":12},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":null,"synthetic":false}},"colon_span":{"lo":{"line":149,"col":12},"hi":{"line":149,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0}],"index":[0,134]},"local_id":7},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,262]},"name":"Fresh","span":{"lo":{"line":149,"col":22},"hi":{"line":149,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0}],"index":[0,134]},"local_id":8},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,263]},"name":"Fresh","span":{"lo":{"line":149,"col":36},"hi":{"line":149,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0}],"index":[0,134]},"local_id":5},"span":{"lo":{"line":149,"col":12},"hi":{"line":149,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"origin":"GenericParam","bound_generic_params":[],"bounded_ty":{"Param":{"index":1,"name":"S"}}}}],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":1,"name":"S"}}}]},"is_const":false,"is_positive":true}},"id":9272273951847800647}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Serial"},"disambiguator":0}],"index":[5,55]},"generic_args":[{"Type":{"Param":{"index":1,"name":"S"}}}]},"is_const":false,"is_positive":true}},"id":9303391958149541291}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":149,"col":71},"hi":{"line":149,"col":71},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":149,"col":10},"hi":{"line":149,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,262]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasLogger"},"disambiguator":0},{"data":{"ValueNs":"log"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,263]},"'_"]}}]}},{"Param":{"index":1,"name":"S"}},false]}],"output":{"Return":{"Tuple":[{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0},{"data":{"TypeNs":"LogError"},"disambiguator":0}],"index":[0,189]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},{"Param":{"index":0,"name":"Self"}}]}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":149,"col":4},"hi":{"line":149,"col":72},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":149,"col":23},"hi":{"line":149,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["event",{"lo":{"line":149,"col":29},"hi":{"line":149,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":149,"col":4},"hi":{"line":149,"col":72},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Log a serializable event by serializing it with a supplied serializer."]},"id":266,"style":"Outer","span":{"lo":{"line":148,"col":4},"hi":{"line":148,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Objects which can serve as loggers."]},"id":257,"style":"Outer","span":{"lo":{"line":133,"col":0},"hi":{"line":133,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":258,"style":"Outer","span":{"lo":{"line":134,"col":0},"hi":{"line":134,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Logging functionality can be used by smart contracts to record events that"]},"id":259,"style":"Outer","span":{"lo":{"line":135,"col":0},"hi":{"line":135,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," might be of interest to external parties. These events are not used on the"]},"id":260,"style":"Outer","span":{"lo":{"line":136,"col":0},"hi":{"line":136,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," chain, and cannot be observed by other contracts, but they are stored by the"]},"id":261,"style":"Outer","span":{"lo":{"line":137,"col":0},"hi":{"line":137,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," node, and can be queried to provide information to off-chain actors."]},"id":262,"style":"Outer","span":{"lo":{"line":138,"col":0},"hi":{"line":138,"col":72},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Objects which can serve as loggers."]},"id":257,"style":"Outer","span":{"lo":{"line":133,"col":0},"hi":{"line":133,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":258,"style":"Outer","span":{"lo":{"line":134,"col":0},"hi":{"line":134,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," Logging functionality can be used by smart contracts to record events that"]},"id":259,"style":"Outer","span":{"lo":{"line":135,"col":0},"hi":{"line":135,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," might be of interest to external parties. These events are not used on the"]},"id":260,"style":"Outer","span":{"lo":{"line":136,"col":0},"hi":{"line":136,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," chain, and cannot be observed by other contracts, but they are stored by the"]},"id":261,"style":"Outer","span":{"lo":{"line":137,"col":0},"hi":{"line":137,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," node, and can be queried to provide information to off-chain actors."]},"id":262,"style":"Outer","span":{"lo":{"line":138,"col":0},"hi":{"line":138,"col":72},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0}],"index":[0,136]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0}],"index":[0,136]},"span":{"lo":{"line":165,"col":0},"hi":{"line":186,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":165,"col":0},"hi":{"line":186,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0}],"index":[0,136]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":7643429660763269667}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":165,"col":20},"hi":{"line":165,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":165,"col":20},"hi":{"line":165,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0}],"index":[0,136]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":7643429660763269667}}],[{"ident":["accept",{"lo":{"line":167,"col":7},"hi":{"line":167,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"accept"},"disambiguator":0}],"index":[0,137]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":167,"col":23},"hi":{"line":167,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":167,"col":13},"hi":{"line":167,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},"span":{"lo":{"line":167,"col":4},"hi":{"line":167,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[]]},"span":{"lo":{"line":167,"col":4},"hi":{"line":167,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Default accept action."]},"id":272,"style":"Outer","span":{"lo":{"line":166,"col":4},"hi":{"line":166,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," An object that can serve to construct actions."]},"id":267,"style":"Outer","span":{"lo":{"line":160,"col":0},"hi":{"line":160,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":268,"style":"Outer","span":{"lo":{"line":161,"col":0},"hi":{"line":161,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The actions that a smart contract can produce as a"]},"id":269,"style":"Outer","span":{"lo":{"line":162,"col":0},"hi":{"line":162,"col":54},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," result of its execution. These actions form a tree and are executed by"]},"id":270,"style":"Outer","span":{"lo":{"line":163,"col":0},"hi":{"line":163,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," the scheduler in the predefined order."]},"id":271,"style":"Outer","span":{"lo":{"line":164,"col":0},"hi":{"line":164,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["simple_transfer",{"lo":{"line":170,"col":7},"hi":{"line":170,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"simple_transfer"},"disambiguator":0}],"index":[0,138]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"simple_transfer"},"disambiguator":0}],"index":[0,138]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"simple_transfer"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,264]},"name":"Fresh","span":{"lo":{"line":170,"col":28},"hi":{"line":170,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":170,"col":68},"hi":{"line":170,"col":68},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":170,"col":22},"hi":{"line":170,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"simple_transfer"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,264]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"AccountAddress"},"disambiguator":0}],"index":[5,964]}}},false]},{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"Amount"},"disambiguator":0}],"index":[5,862]}}}],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":true},"span":{"lo":{"line":170,"col":4},"hi":{"line":170,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["acc",{"lo":{"line":170,"col":23},"hi":{"line":170,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["amount",{"lo":{"line":170,"col":45},"hi":{"line":170,"col":51},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":170,"col":4},"hi":{"line":170,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Send a given amount to an account."]},"id":273,"style":"Outer","span":{"lo":{"line":169,"col":4},"hi":{"line":169,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," An object that can serve to construct actions."]},"id":267,"style":"Outer","span":{"lo":{"line":160,"col":0},"hi":{"line":160,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":268,"style":"Outer","span":{"lo":{"line":161,"col":0},"hi":{"line":161,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The actions that a smart contract can produce as a"]},"id":269,"style":"Outer","span":{"lo":{"line":162,"col":0},"hi":{"line":162,"col":54},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," result of its execution. These actions form a tree and are executed by"]},"id":270,"style":"Outer","span":{"lo":{"line":163,"col":0},"hi":{"line":163,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," the scheduler in the predefined order."]},"id":271,"style":"Outer","span":{"lo":{"line":164,"col":0},"hi":{"line":164,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["send_raw",{"lo":{"line":173,"col":7},"hi":{"line":173,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0}],"index":[0,139]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0}],"index":[0,139]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,265]},"name":"Fresh","span":{"lo":{"line":174,"col":12},"hi":{"line":174,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0}],"index":[0,139]},"local_id":2},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,266]},"name":"Fresh","span":{"lo":{"line":175,"col":22},"hi":{"line":175,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0}],"index":[0,139]},"local_id":3},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[0,267]},"name":"Fresh","span":{"lo":{"line":177,"col":19},"hi":{"line":177,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":178,"col":13},"hi":{"line":178,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":173,"col":15},"hi":{"line":173,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,265]},"'_"]}}]}},{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"ContractAddress"},"disambiguator":0}],"index":[5,988]}}},false]},{"Adt":{"generic_args":[{"Lifetime":{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,266]},"'_"]}}]}}}],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"ReceiveName"},"disambiguator":0}],"index":[5,1083]}}},{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"Amount"},"disambiguator":0}],"index":[5,862]}}},{"Ref":[{"kind":{"ReLateBound":[0,{"var":2,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"send_raw"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":2}],"index":[0,267]},"'_"]}}]}},{"Slice":{"Uint":"U8"}},false]}],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":false},"span":{"lo":{"line":173,"col":4},"hi":{"line":178,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["ca",{"lo":{"line":174,"col":8},"hi":{"line":174,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["receive_name",{"lo":{"line":175,"col":8},"hi":{"line":175,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["amount",{"lo":{"line":176,"col":8},"hi":{"line":176,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["parameter",{"lo":{"line":177,"col":8},"hi":{"line":177,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":173,"col":4},"hi":{"line":178,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Send a message to a contract."]},"id":274,"style":"Outer","span":{"lo":{"line":172,"col":4},"hi":{"line":172,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," An object that can serve to construct actions."]},"id":267,"style":"Outer","span":{"lo":{"line":160,"col":0},"hi":{"line":160,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":268,"style":"Outer","span":{"lo":{"line":161,"col":0},"hi":{"line":161,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The actions that a smart contract can produce as a"]},"id":269,"style":"Outer","span":{"lo":{"line":162,"col":0},"hi":{"line":162,"col":54},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," result of its execution. These actions form a tree and are executed by"]},"id":270,"style":"Outer","span":{"lo":{"line":163,"col":0},"hi":{"line":163,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," the scheduler in the predefined order."]},"id":271,"style":"Outer","span":{"lo":{"line":164,"col":0},"hi":{"line":164,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["and_then",{"lo":{"line":182,"col":7},"hi":{"line":182,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"and_then"},"disambiguator":0}],"index":[0,140]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":182,"col":41},"hi":{"line":182,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":182,"col":15},"hi":{"line":182,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Param":{"index":0,"name":"Self"}},{"Param":{"index":0,"name":"Self"}}],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"Imm","lifetime_elision_allowed":false},"span":{"lo":{"line":182,"col":4},"hi":{"line":182,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":182,"col":16},"hi":{"line":182,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["then",{"lo":{"line":182,"col":22},"hi":{"line":182,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":182,"col":4},"hi":{"line":182,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," If the execution of the first action succeeds, run the second action"]},"id":275,"style":"Outer","span":{"lo":{"line":180,"col":4},"hi":{"line":180,"col":76},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," as well."]},"id":276,"style":"Outer","span":{"lo":{"line":181,"col":4},"hi":{"line":181,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," An object that can serve to construct actions."]},"id":267,"style":"Outer","span":{"lo":{"line":160,"col":0},"hi":{"line":160,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":268,"style":"Outer","span":{"lo":{"line":161,"col":0},"hi":{"line":161,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The actions that a smart contract can produce as a"]},"id":269,"style":"Outer","span":{"lo":{"line":162,"col":0},"hi":{"line":162,"col":54},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," result of its execution. These actions form a tree and are executed by"]},"id":270,"style":"Outer","span":{"lo":{"line":163,"col":0},"hi":{"line":163,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," the scheduler in the predefined order."]},"id":271,"style":"Outer","span":{"lo":{"line":164,"col":0},"hi":{"line":164,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["or_else",{"lo":{"line":185,"col":7},"hi":{"line":185,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"HasActions"},"disambiguator":0},{"data":{"ValueNs":"or_else"},"disambiguator":0}],"index":[0,141]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":185,"col":38},"hi":{"line":185,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":185,"col":14},"hi":{"line":185,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Param":{"index":0,"name":"Self"}},{"Param":{"index":0,"name":"Self"}}],"output":{"Return":{"Param":{"index":0,"name":"Self"}}},"c_variadic":false,"implicit_self":"Imm","lifetime_elision_allowed":false},"span":{"lo":{"line":185,"col":4},"hi":{"line":185,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":185,"col":15},"hi":{"line":185,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["el",{"lo":{"line":185,"col":21},"hi":{"line":185,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":185,"col":4},"hi":{"line":185,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," If the execution of the first action fails, try the second."]},"id":277,"style":"Outer","span":{"lo":{"line":184,"col":4},"hi":{"line":184,"col":67},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," An object that can serve to construct actions."]},"id":267,"style":"Outer","span":{"lo":{"line":160,"col":0},"hi":{"line":160,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":268,"style":"Outer","span":{"lo":{"line":161,"col":0},"hi":{"line":161,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The actions that a smart contract can produce as a"]},"id":269,"style":"Outer","span":{"lo":{"line":162,"col":0},"hi":{"line":162,"col":54},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," result of its execution. These actions form a tree and are executed by"]},"id":270,"style":"Outer","span":{"lo":{"line":163,"col":0},"hi":{"line":163,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," the scheduler in the predefined order."]},"id":271,"style":"Outer","span":{"lo":{"line":164,"col":0},"hi":{"line":164,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," An object that can serve to construct actions."]},"id":267,"style":"Outer","span":{"lo":{"line":160,"col":0},"hi":{"line":160,"col":50},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":268,"style":"Outer","span":{"lo":{"line":161,"col":0},"hi":{"line":161,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The actions that a smart contract can produce as a"]},"id":269,"style":"Outer","span":{"lo":{"line":162,"col":0},"hi":{"line":162,"col":54},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," result of its execution. These actions form a tree and are executed by"]},"id":270,"style":"Outer","span":{"lo":{"line":163,"col":0},"hi":{"line":163,"col":74},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," the scheduler in the predefined order."]},"id":271,"style":"Outer","span":{"lo":{"line":164,"col":0},"hi":{"line":164,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0}],"index":[0,142]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0}],"index":[0,142]},"span":{"lo":{"line":191,"col":0},"hi":{"line":201,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":191,"col":0},"hi":{"line":201,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0}],"index":[0,142]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":18436060400986552328}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":191,"col":21},"hi":{"line":191,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":191,"col":21},"hi":{"line":191,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0}],"index":[0,142]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":18436060400986552328}}],[{"ident":["Unwrap",{"lo":{"line":193,"col":9},"hi":{"line":193,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,143]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0}],"index":[0,142]},{"impl":{"LocalBound":{"clause_id":18436060400986552328,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,143]}}]}}]},"is_const":false,"is_positive":true}},"id":7242937820828818005}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":193,"col":15},"hi":{"line":193,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":193,"col":15},"hi":{"line":193,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0}],"index":[0,142]},{"impl":{"LocalBound":{"clause_id":18436060400986552328,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,143]}}]}}]},"is_const":false,"is_positive":true}},"id":7242937820828818005}}],null]},"span":{"lo":{"line":193,"col":4},"hi":{"line":193,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The underlying result type of the unwrap, in case of success."]},"id":280,"style":"Outer","span":{"lo":{"line":192,"col":4},"hi":{"line":192,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Add optimized unwrap behaviour that aborts the process instead of"]},"id":278,"style":"Outer","span":{"lo":{"line":189,"col":0},"hi":{"line":189,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," panicking."]},"id":279,"style":"Outer","span":{"lo":{"line":190,"col":0},"hi":{"line":190,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["unwrap_abort",{"lo":{"line":200,"col":7},"hi":{"line":200,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0},{"data":{"ValueNs":"unwrap_abort"},"disambiguator":0}],"index":[0,144]},"generics":{"params":[],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":200,"col":41},"hi":{"line":200,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":200,"col":19},"hi":{"line":200,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Param":{"index":0,"name":"Self"}}],"output":{"Return":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0}],"index":[0,142]},{"impl":{"LocalBound":{"clause_id":18436060400986552328,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"UnwrapAbort"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,143]}}]}},"c_variadic":false,"implicit_self":"Imm","lifetime_elision_allowed":false},"span":{"lo":{"line":200,"col":4},"hi":{"line":200,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":200,"col":20},"hi":{"line":200,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":200,"col":4},"hi":{"line":200,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Unwrap or call [trap](../fn.trap.html). In contrast to"]},"id":281,"style":"Outer","span":{"lo":{"line":194,"col":4},"hi":{"line":194,"col":62},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," the unwrap methods on [Option::unwrap](https://doc.rust-lang.org/std/option/enum.Option.html#method.unwrap)"]},"id":282,"style":"Outer","span":{"lo":{"line":195,"col":4},"hi":{"line":195,"col":115},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," this method will tend to produce smaller code, at the cost of the"]},"id":283,"style":"Outer","span":{"lo":{"line":196,"col":4},"hi":{"line":196,"col":73},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," ability to handle the panic."]},"id":284,"style":"Outer","span":{"lo":{"line":197,"col":4},"hi":{"line":197,"col":36},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," This is intended to be used only in `Wasm` code, where panics cannot be"]},"id":285,"style":"Outer","span":{"lo":{"line":198,"col":4},"hi":{"line":198,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," handled anyhow."]},"id":286,"style":"Outer","span":{"lo":{"line":199,"col":4},"hi":{"line":199,"col":23},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Add optimized unwrap behaviour that aborts the process instead of"]},"id":278,"style":"Outer","span":{"lo":{"line":189,"col":0},"hi":{"line":189,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," panicking."]},"id":279,"style":"Outer","span":{"lo":{"line":190,"col":0},"hi":{"line":190,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Add optimized unwrap behaviour that aborts the process instead of"]},"id":278,"style":"Outer","span":{"lo":{"line":189,"col":0},"hi":{"line":189,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," panicking."]},"id":279,"style":"Outer","span":{"lo":{"line":190,"col":0},"hi":{"line":190,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0}],"index":[0,145]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0}],"index":[0,145]},"span":{"lo":{"line":206,"col":0},"hi":{"line":211,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":206,"col":0},"hi":{"line":211,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0}],"index":[0,145]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":4563165526448952423}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":206,"col":22},"hi":{"line":206,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":206,"col":22},"hi":{"line":206,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0}],"index":[0,145]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":4563165526448952423}}],[{"ident":["Unwrap",{"lo":{"line":207,"col":9},"hi":{"line":207,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,146]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0}],"index":[0,145]},{"impl":{"LocalBound":{"clause_id":4563165526448952423,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,146]}}]}}]},"is_const":false,"is_positive":true}},"id":6926846262952482198}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":207,"col":15},"hi":{"line":207,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":207,"col":15},"hi":{"line":207,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0}],"index":[0,145]},{"impl":{"LocalBound":{"clause_id":4563165526448952423,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,146]}}]}}]},"is_const":false,"is_positive":true}},"id":6926846262952482198}}],null]},"span":{"lo":{"line":207,"col":4},"hi":{"line":207,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"DocComment":["Line"," Analogue of the `expect` methods on types such as [Option](https://doc.rust-lang.org/std/option/enum.Option.html),"]},"id":287,"style":"Outer","span":{"lo":{"line":204,"col":0},"hi":{"line":204,"col":118},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," but useful in a Wasm setting."]},"id":288,"style":"Outer","span":{"lo":{"line":205,"col":0},"hi":{"line":205,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["expect_report",{"lo":{"line":210,"col":7},"hi":{"line":210,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0},{"data":{"ValueNs":"expect_report"},"disambiguator":0}],"index":[0,147]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0},{"data":{"ValueNs":"expect_report"},"disambiguator":0}],"index":[0,147]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0},{"data":{"ValueNs":"expect_report"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,268]},"name":"Fresh","span":{"lo":{"line":210,"col":32},"hi":{"line":210,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":210,"col":53},"hi":{"line":210,"col":53},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":210,"col":20},"hi":{"line":210,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Param":{"index":0,"name":"Self"}},{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0},{"data":{"ValueNs":"expect_report"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,268]},"'_"]}}]}},"Str",false]}],"output":{"Return":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0}],"index":[0,145]},{"impl":{"LocalBound":{"clause_id":4563165526448952423,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectReport"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,146]}}]}},"c_variadic":false,"implicit_self":"Imm","lifetime_elision_allowed":true},"span":{"lo":{"line":210,"col":4},"hi":{"line":210,"col":54},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":210,"col":21},"hi":{"line":210,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["msg",{"lo":{"line":210,"col":27},"hi":{"line":210,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":210,"col":4},"hi":{"line":210,"col":54},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Like the default `expect` on, e.g., `Result`, but calling"]},"id":289,"style":"Outer","span":{"lo":{"line":208,"col":4},"hi":{"line":208,"col":65},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," [fail](macro.fail.html) with the given message, instead of `panic`."]},"id":290,"style":"Outer","span":{"lo":{"line":209,"col":4},"hi":{"line":209,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Analogue of the `expect` methods on types such as [Option](https://doc.rust-lang.org/std/option/enum.Option.html),"]},"id":287,"style":"Outer","span":{"lo":{"line":204,"col":0},"hi":{"line":204,"col":118},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," but useful in a Wasm setting."]},"id":288,"style":"Outer","span":{"lo":{"line":205,"col":0},"hi":{"line":205,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Analogue of the `expect` methods on types such as [Option](https://doc.rust-lang.org/std/option/enum.Option.html),"]},"id":287,"style":"Outer","span":{"lo":{"line":204,"col":0},"hi":{"line":204,"col":118},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," but useful in a Wasm setting."]},"id":288,"style":"Outer","span":{"lo":{"line":205,"col":0},"hi":{"line":205,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0}],"index":[0,148]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0}],"index":[0,148]},"span":{"lo":{"line":216,"col":0},"hi":{"line":221,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":216,"col":0},"hi":{"line":221,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0}],"index":[0,148]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":18023446435381850670}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":216,"col":25},"hi":{"line":216,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":216,"col":25},"hi":{"line":216,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0}],"index":[0,148]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":18023446435381850670}}],[{"ident":["Unwrap",{"lo":{"line":217,"col":9},"hi":{"line":217,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,149]},"generics":{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0}],"index":[0,148]},{"impl":{"LocalBound":{"clause_id":18023446435381850670,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,149]}}]}}]},"is_const":false,"is_positive":true}},"id":8136654248162117203}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":217,"col":15},"hi":{"line":217,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":217,"col":15},"hi":{"line":217,"col":15},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"Type":[[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0}],"index":[0,148]},{"impl":{"LocalBound":{"clause_id":18023446435381850670,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,149]}}]}}]},"is_const":false,"is_positive":true}},"id":8136654248162117203}}],null]},"span":{"lo":{"line":217,"col":4},"hi":{"line":217,"col":16},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"DocComment":["Line"," Analogue of the `expect_err` methods on [Result](https://doc.rust-lang.org/std/result/enum.Result.html),"]},"id":291,"style":"Outer","span":{"lo":{"line":214,"col":0},"hi":{"line":214,"col":108},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," but useful in a Wasm setting."]},"id":292,"style":"Outer","span":{"lo":{"line":215,"col":0},"hi":{"line":215,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}},{"ident":["expect_err_report",{"lo":{"line":220,"col":7},"hi":{"line":220,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0},{"data":{"ValueNs":"expect_err_report"},"disambiguator":0}],"index":[0,150]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0},{"data":{"ValueNs":"expect_err_report"},"disambiguator":0}],"index":[0,150]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0},{"data":{"ValueNs":"expect_err_report"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,269]},"name":"Fresh","span":{"lo":{"line":220,"col":36},"hi":{"line":220,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":220,"col":57},"hi":{"line":220,"col":57},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":220,"col":24},"hi":{"line":220,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Param":{"index":0,"name":"Self"}},{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0},{"data":{"ValueNs":"expect_err_report"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,269]},"'_"]}}]}},"Str",false]}],"output":{"Return":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":0,"name":"Self"}}}],"trait_def_id":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0}],"index":[0,148]},{"impl":{"LocalBound":{"clause_id":18023446435381850670,"path":[]}},"args":[]}],"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectErrReport"},"disambiguator":0},{"data":{"TypeNs":"Unwrap"},"disambiguator":0}],"index":[0,149]}}]}},"c_variadic":false,"implicit_self":"Imm","lifetime_elision_allowed":true},"span":{"lo":{"line":220,"col":4},"hi":{"line":220,"col":58},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":220,"col":25},"hi":{"line":220,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["msg",{"lo":{"line":220,"col":31},"hi":{"line":220,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":220,"col":4},"hi":{"line":220,"col":58},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Like the default `expect_err` on, e.g., `Result`, but calling"]},"id":293,"style":"Outer","span":{"lo":{"line":218,"col":4},"hi":{"line":218,"col":69},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," [fail](macro.fail.html) with the given message, instead of `panic`."]},"id":294,"style":"Outer","span":{"lo":{"line":219,"col":4},"hi":{"line":219,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Analogue of the `expect_err` methods on [Result](https://doc.rust-lang.org/std/result/enum.Result.html),"]},"id":291,"style":"Outer","span":{"lo":{"line":214,"col":0},"hi":{"line":214,"col":108},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," but useful in a Wasm setting."]},"id":292,"style":"Outer","span":{"lo":{"line":215,"col":0},"hi":{"line":215,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Analogue of the `expect_err` methods on [Result](https://doc.rust-lang.org/std/result/enum.Result.html),"]},"id":291,"style":"Outer","span":{"lo":{"line":214,"col":0},"hi":{"line":214,"col":108},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," but useful in a Wasm setting."]},"id":292,"style":"Outer","span":{"lo":{"line":215,"col":0},"hi":{"line":215,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectNoneReport"},"disambiguator":0}],"index":[0,151]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectNoneReport"},"disambiguator":0}],"index":[0,151]},"span":{"lo":{"line":226,"col":0},"hi":{"line":230,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":226,"col":0},"hi":{"line":230,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectNoneReport"},"disambiguator":0}],"index":[0,151]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":6816229183596714811}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":226,"col":26},"hi":{"line":226,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":226,"col":26},"hi":{"line":226,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectNoneReport"},"disambiguator":0}],"index":[0,151]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":6816229183596714811}}],[{"ident":["expect_none_report",{"lo":{"line":229,"col":7},"hi":{"line":229,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectNoneReport"},"disambiguator":0},{"data":{"ValueNs":"expect_none_report"},"disambiguator":0}],"index":[0,152]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectNoneReport"},"disambiguator":0},{"data":{"ValueNs":"expect_none_report"},"disambiguator":0}],"index":[0,152]},"local_id":1},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectNoneReport"},"disambiguator":0},{"data":{"ValueNs":"expect_none_report"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,270]},"name":"Fresh","span":{"lo":{"line":229,"col":37},"hi":{"line":229,"col":38},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[],"bounds":[],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":229,"col":42},"hi":{"line":229,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":229,"col":25},"hi":{"line":229,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Param":{"index":0,"name":"Self"}},{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"ExpectNoneReport"},"disambiguator":0},{"data":{"ValueNs":"expect_none_report"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,270]},"'_"]}}]}},"Str",false]}],"output":{"DefaultReturn":{"lo":{"line":229,"col":42},"hi":{"line":229,"col":42},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"c_variadic":false,"implicit_self":"Imm","lifetime_elision_allowed":true},"span":{"lo":{"line":229,"col":4},"hi":{"line":229,"col":43},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":229,"col":26},"hi":{"line":229,"col":30},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["msg",{"lo":{"line":229,"col":32},"hi":{"line":229,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":229,"col":4},"hi":{"line":229,"col":43},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Like the default `expect_none_report` on, e.g., `Option`, but calling"]},"id":297,"style":"Outer","span":{"lo":{"line":227,"col":4},"hi":{"line":227,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," [fail](macro.fail.html) with the given message, instead of `panic`."]},"id":298,"style":"Outer","span":{"lo":{"line":228,"col":4},"hi":{"line":228,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," Analogue of the `expect_none` methods on [Option](https://doc.rust-lang.org/std/option/enum.Option.html),"]},"id":295,"style":"Outer","span":{"lo":{"line":224,"col":0},"hi":{"line":224,"col":109},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," but useful in a Wasm setting."]},"id":296,"style":"Outer","span":{"lo":{"line":225,"col":0},"hi":{"line":225,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Analogue of the `expect_none` methods on [Option](https://doc.rust-lang.org/std/option/enum.Option.html),"]},"id":295,"style":"Outer","span":{"lo":{"line":224,"col":0},"hi":{"line":224,"col":109},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," but useful in a Wasm setting."]},"id":296,"style":"Outer","span":{"lo":{"line":225,"col":0},"hi":{"line":225,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0}],"index":[0,153]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0}],"index":[0,153]},"span":{"lo":{"line":239,"col":0},"hi":{"line":251,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":239,"col":0},"hi":{"line":251,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0}],"index":[0,153]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":14884518810587756718}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":239,"col":19},"hi":{"line":239,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":239,"col":19},"hi":{"line":239,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0}],"index":[0,153]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":14884518810587756718}}],[{"ident":["serial_ctx",{"lo":{"line":246,"col":7},"hi":{"line":246,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0}],"index":[0,154]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0}],"index":[0,154]},"local_id":6},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0},{"data":{"TypeNs":"W"},"disambiguator":0}],"index":[0,155]},"name":{"Plain":{"name":"W","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0}],"index":[0,154]},"local_id":6}}},"span":{"lo":{"line":246,"col":18},"hi":{"line":246,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":null,"synthetic":false}},"colon_span":{"lo":{"line":246,"col":19},"hi":{"line":246,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0}],"index":[0,154]},"local_id":7},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,271]},"name":"Fresh","span":{"lo":{"line":247,"col":8},"hi":{"line":247,"col":9},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0}],"index":[0,154]},"local_id":8},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,272]},"name":"Fresh","span":{"lo":{"line":249,"col":13},"hi":{"line":249,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0}],"index":[0,154]},"local_id":5},"span":{"lo":{"line":246,"col":19},"hi":{"line":246,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"origin":"GenericParam","bound_generic_params":[],"bounded_ty":{"Param":{"index":1,"name":"W"}}}}],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":1,"name":"W"}}}]},"is_const":false,"is_positive":true}},"id":12551622595042095548}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Write"},"disambiguator":0}],"index":[5,37]},"generic_args":[{"Type":{"Param":{"index":1,"name":"W"}}}]},"is_const":false,"is_positive":true}},"id":8183547936778835857}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":250,"col":32},"hi":{"line":250,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":246,"col":17},"hi":{"line":246,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,271]},"'_"]}}]}},{"Param":{"index":0,"name":"Self"}},false]},{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"schema"},"disambiguator":0},{"data":{"TypeNs":"SizeLength"},"disambiguator":0}],"index":[5,761]}}},{"Ref":[{"kind":{"ReLateBound":[0,{"var":1,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"SerialCtx"},"disambiguator":0},{"data":{"ValueNs":"serial_ctx"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":1}],"index":[0,272]},"'_"]}}]}},{"Param":{"index":1,"name":"W"}},false]}],"output":{"Return":{"Tuple":[{"Adt":{"generic_args":[{"Type":{"Tuple":[]}},{"Type":{"Alias":["Projection",{"substs":[{"Type":{"Param":{"index":1,"name":"W"}}}],"trait_def_id":[{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Write"},"disambiguator":0}],"index":[5,37]},{"impl":{"LocalBound":{"clause_id":8183547936778835857,"path":[]}},"args":[]}],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Write"},"disambiguator":0},{"data":{"TypeNs":"Err"},"disambiguator":0}],"index":[5,38]}}]}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},{"Param":{"index":1,"name":"W"}}]}},"c_variadic":false,"implicit_self":"ImmRef","lifetime_elision_allowed":true},"span":{"lo":{"line":246,"col":4},"hi":{"line":250,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["self",{"lo":{"line":247,"col":9},"hi":{"line":247,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["size_length",{"lo":{"line":248,"col":8},"hi":{"line":248,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["out",{"lo":{"line":249,"col":8},"hi":{"line":249,"col":11},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":246,"col":4},"hi":{"line":250,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Attempt to write the structure into the provided writer, failing if"]},"id":305,"style":"Outer","span":{"lo":{"line":240,"col":4},"hi":{"line":240,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," if the length cannot be represented in the provided `size_length` or"]},"id":306,"style":"Outer","span":{"lo":{"line":241,"col":4},"hi":{"line":241,"col":76},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," only part of the structure could be written."]},"id":307,"style":"Outer","span":{"lo":{"line":242,"col":4},"hi":{"line":242,"col":52},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":308,"style":"Outer","span":{"lo":{"line":243,"col":4},"hi":{"line":243,"col":7},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," NB: We use Result instead of Option for better composability with other"]},"id":309,"style":"Outer","span":{"lo":{"line":244,"col":4},"hi":{"line":244,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," constructs."]},"id":310,"style":"Outer","span":{"lo":{"line":245,"col":4},"hi":{"line":245,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," The `SerialCtx` trait provides a means of writing structures into byte-sinks"]},"id":299,"style":"Outer","span":{"lo":{"line":233,"col":0},"hi":{"line":233,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," (`Write`) using contextual information."]},"id":300,"style":"Outer","span":{"lo":{"line":234,"col":0},"hi":{"line":234,"col":43},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The contextual information is:"]},"id":301,"style":"Outer","span":{"lo":{"line":235,"col":0},"hi":{"line":235,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":302,"style":"Outer","span":{"lo":{"line":236,"col":0},"hi":{"line":236,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," - `size_length`: The number of bytes used to record the length of the"]},"id":303,"style":"Outer","span":{"lo":{"line":237,"col":0},"hi":{"line":237,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," data."]},"id":304,"style":"Outer","span":{"lo":{"line":238,"col":0},"hi":{"line":238,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The `SerialCtx` trait provides a means of writing structures into byte-sinks"]},"id":299,"style":"Outer","span":{"lo":{"line":233,"col":0},"hi":{"line":233,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," (`Write`) using contextual information."]},"id":300,"style":"Outer","span":{"lo":{"line":234,"col":0},"hi":{"line":234,"col":43},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The contextual information is:"]},"id":301,"style":"Outer","span":{"lo":{"line":235,"col":0},"hi":{"line":235,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":302,"style":"Outer","span":{"lo":{"line":236,"col":0},"hi":{"line":236,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," - `size_length`: The number of bytes used to record the length of the"]},"id":303,"style":"Outer","span":{"lo":{"line":237,"col":0},"hi":{"line":237,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," data."]},"id":304,"style":"Outer","span":{"lo":{"line":238,"col":0},"hi":{"line":238,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0}],"index":[0,156]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0}],"index":[0,156]},"span":{"lo":{"line":262,"col":0},"hi":{"line":270,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"vis_span":{"lo":{"line":262,"col":0},"hi":{"line":270,"col":1},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"kind":{"Trait":["No","Normal",{"params":[],"predicates":[],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":17322672367251655876}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0}],"index":[0,156]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":16635740711172919924}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":262,"col":28},"hi":{"line":262,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":262,"col":21},"hi":{"line":262,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":17322672367251655876}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0}],"index":[0,156]},"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}}]},"is_const":false,"is_positive":true}},"id":16635740711172919924}}],[{"ident":["deserial_ctx",{"lo":{"line":265,"col":7},"hi":{"line":265,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0},{"data":{"ValueNs":"deserial_ctx"},"disambiguator":0}],"index":[0,157]},"generics":{"params":[{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0},{"data":{"ValueNs":"deserial_ctx"},"disambiguator":0}],"index":[0,157]},"local_id":6},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0},{"data":{"ValueNs":"deserial_ctx"},"disambiguator":0},{"data":{"TypeNs":"R"},"disambiguator":0}],"index":[0,158]},"name":{"Plain":{"name":"R","id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0},{"data":{"ValueNs":"deserial_ctx"},"disambiguator":0}],"index":[0,157]},"local_id":6}}},"span":{"lo":{"line":265,"col":20},"hi":{"line":265,"col":21},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Type":{"default":null,"synthetic":false}},"colon_span":{"lo":{"line":265,"col":21},"hi":{"line":265,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"attributes":[]},{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0},{"data":{"ValueNs":"deserial_ctx"},"disambiguator":0}],"index":[0,157]},"local_id":7},"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0},{"data":{"ValueNs":"deserial_ctx"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,273]},"name":"Fresh","span":{"lo":{"line":268,"col":16},"hi":{"line":268,"col":17},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"pure_wrt_drop":false,"kind":{"Lifetime":{"kind":"Elided"}},"colon_span":null,"attributes":[]}],"predicates":[{"BoundPredicate":{"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0},{"data":{"ValueNs":"deserial_ctx"},"disambiguator":0}],"index":[0,157]},"local_id":5},"span":{"lo":{"line":265,"col":21},"hi":{"line":265,"col":27},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"origin":"GenericParam","bound_generic_params":[],"bounded_ty":{"Param":{"index":1,"name":"R"}}}}],"bounds":[{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"core","path":[{"data":{"TypeNs":"marker"},"disambiguator":0},{"data":{"TypeNs":"Sized"},"disambiguator":0}],"index":[1,2689]},"generic_args":[{"Type":{"Param":{"index":1,"name":"R"}}}]},"is_const":false,"is_positive":true}},"id":426491624962477427}},{"Clause":{"kind":{"Trait":{"trait_ref":{"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"traits"},"disambiguator":0},{"data":{"TypeNs":"Read"},"disambiguator":0}],"index":[5,26]},"generic_args":[{"Type":{"Param":{"index":1,"name":"R"}}}]},"is_const":false,"is_positive":true}},"id":7941244948656693720}}],"has_where_clause_predicates":false,"where_clause_span":{"lo":{"line":269,"col":31},"hi":{"line":269,"col":31},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"span":{"lo":{"line":265,"col":19},"hi":{"line":265,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},"kind":{"RequiredFn":[{"header":{"unsafety":"Normal","constness":"NotConst","asyncness":"NotAsync","abi":{"Abi":{"todo":"Rust"}}},"decl":{"inputs":[{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"schema"},"disambiguator":0},{"data":{"TypeNs":"SizeLength"},"disambiguator":0}],"index":[5,761]}}},"Bool",{"Ref":[{"kind":{"ReLateBound":[0,{"var":0,"kind":{"BrNamed":[{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0},{"data":{"TypeNs":"DeserialCtx"},"disambiguator":0},{"data":{"ValueNs":"deserial_ctx"},"disambiguator":0},{"data":{"LifetimeNs":"'_"},"disambiguator":0}],"index":[0,273]},"'_"]}}]}},{"Param":{"index":1,"name":"R"}},false]}],"output":{"Return":{"Tuple":[{"Adt":{"generic_args":[{"Type":{"Param":{"index":0,"name":"Self"}}},{"Type":{"Adt":{"generic_args":[],"def_id":{"krate":"concordium_contracts_common","path":[{"data":{"TypeNs":"types"},"disambiguator":0},{"data":{"TypeNs":"ParseError"},"disambiguator":0}],"index":[5,1172]}}}}],"def_id":{"krate":"core","path":[{"data":{"TypeNs":"result"},"disambiguator":0},{"data":{"TypeNs":"Result"},"disambiguator":0}],"index":[1,41506]}}},{"Param":{"index":1,"name":"R"}}]}},"c_variadic":false,"implicit_self":"None","lifetime_elision_allowed":true},"span":{"lo":{"line":265,"col":4},"hi":{"line":269,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},[["size_length",{"lo":{"line":266,"col":8},"hi":{"line":266,"col":19},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["ensure_ordered",{"lo":{"line":267,"col":8},"hi":{"line":267,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}],["source",{"lo":{"line":268,"col":8},"hi":{"line":268,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}]]]},"span":{"lo":{"line":265,"col":4},"hi":{"line":269,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}},"defaultness":{"Default":{"has_value":false}},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," Attempt to read a structure from a given source and context, failing if"]},"id":319,"style":"Outer","span":{"lo":{"line":263,"col":4},"hi":{"line":263,"col":79},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," an error occurs during deserialization or reading."]},"id":320,"style":"Outer","span":{"lo":{"line":264,"col":4},"hi":{"line":264,"col":58},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"DocComment":["Line"," The `DeserialCtx` trait provides a means of reading structures from"]},"id":311,"style":"Outer","span":{"lo":{"line":254,"col":0},"hi":{"line":254,"col":71},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," byte-sources (`Read`) using contextual information."]},"id":312,"style":"Outer","span":{"lo":{"line":255,"col":0},"hi":{"line":255,"col":55},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The contextual information is:"]},"id":313,"style":"Outer","span":{"lo":{"line":256,"col":0},"hi":{"line":256,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":314,"style":"Outer","span":{"lo":{"line":257,"col":0},"hi":{"line":257,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," - `size_length`: The expected number of bytes used for the length of the"]},"id":315,"style":"Outer","span":{"lo":{"line":258,"col":0},"hi":{"line":258,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," data."]},"id":316,"style":"Outer","span":{"lo":{"line":259,"col":0},"hi":{"line":259,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," - `ensure_ordered`: Whether the ordering should be ensured, for example"]},"id":317,"style":"Outer","span":{"lo":{"line":260,"col":0},"hi":{"line":260,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," that keys in `BTreeMap` and `BTreeSet` are in strictly increasing order."]},"id":318,"style":"Outer","span":{"lo":{"line":261,"col":0},"hi":{"line":261,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]}}]]},"attributes":{"attributes":[{"kind":{"DocComment":["Line"," The `DeserialCtx` trait provides a means of reading structures from"]},"id":311,"style":"Outer","span":{"lo":{"line":254,"col":0},"hi":{"line":254,"col":71},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," byte-sources (`Read`) using contextual information."]},"id":312,"style":"Outer","span":{"lo":{"line":255,"col":0},"hi":{"line":255,"col":55},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," The contextual information is:"]},"id":313,"style":"Outer","span":{"lo":{"line":256,"col":0},"hi":{"line":256,"col":34},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line",""]},"id":314,"style":"Outer","span":{"lo":{"line":257,"col":0},"hi":{"line":257,"col":3},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," - `size_length`: The expected number of bytes used for the length of the"]},"id":315,"style":"Outer","span":{"lo":{"line":258,"col":0},"hi":{"line":258,"col":78},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," data."]},"id":316,"style":"Outer","span":{"lo":{"line":259,"col":0},"hi":{"line":259,"col":13},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," - `ensure_ordered`: Whether the ordering should be ensured, for example"]},"id":317,"style":"Outer","span":{"lo":{"line":260,"col":0},"hi":{"line":260,"col":77},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}},{"kind":{"DocComment":["Line"," that keys in `BTreeMap` and `BTreeSet` are in strictly increasing order."]},"id":318,"style":"Outer","span":{"lo":{"line":261,"col":0},"hi":{"line":261,"col":80},"filename":{"Real":{"LocalPath":"concordium/src/concordium_traits.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":16}],"index":[0,159]},"span":{"lo":{"line":60,"col":0},"hi":{"line":60,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":60,"col":0},"hi":{"line":60,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":60,"col":4},"hi":{"line":60,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0}],"index":[0,25]}]}],"segments":[{"ident":["concordium_prims",{"lo":{"line":60,"col":4},"hi":{"line":60,"col":20},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":16}],"index":[0,159]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_prims"},"disambiguator":0}],"index":[0,25]}]},"args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":17}],"index":[0,160]},"span":{"lo":{"line":61,"col":0},"hi":{"line":61,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":61,"col":0},"hi":{"line":61,"col":28},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":61,"col":8},"hi":{"line":61,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,64]}]}],"segments":[{"ident":["concordium_types",{"lo":{"line":61,"col":8},"hi":{"line":61,"col":24},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":17}],"index":[0,160]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_types"},"disambiguator":0}],"index":[0,64]}]},"args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":18}],"index":[0,161]},"span":{"lo":{"line":62,"col":0},"hi":{"line":62,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":62,"col":0},"hi":{"line":62,"col":29},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":62,"col":8},"hi":{"line":62,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0}],"index":[0,89]}]}],"segments":[{"ident":["concordium_traits",{"lo":{"line":62,"col":8},"hi":{"line":62,"col":25},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":18}],"index":[0,161]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_traits"},"disambiguator":0}],"index":[0,89]}]},"args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_contracts_common"},"disambiguator":0}],"index":[0,162]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"concordium_contracts_common"},"disambiguator":0}],"index":[0,162]},"span":{"lo":{"line":65,"col":0},"hi":{"line":65,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":65,"col":0},"hi":{"line":65,"col":41},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"ExternCrate":null},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:64:6: 64:7 (#0), close: concordium/src/concordium.rs:64:31: 64:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":27,"style":"Outer","span":{"lo":{"line":64,"col":0},"hi":{"line":64,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":19}],"index":[0,163]},"span":{"lo":{"line":69,"col":0},"hi":{"line":69,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":69,"col":0},"hi":{"line":69,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":69,"col":8},"hi":{"line":69,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"concordium_contracts_common","path":[],"index":[5,0]}]}],"segments":[{"ident":["concordium_contracts_common",{"lo":{"line":69,"col":8},"hi":{"line":69,"col":35},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":19}],"index":[0,163]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"concordium_contracts_common","path":[],"index":[5,0]}]},"args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:66:6: 66:7 (#0), close: concordium/src/concordium.rs:66:31: 66:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":28,"style":"Outer","span":{"lo":{"line":66,"col":0},"hi":{"line":66,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"DocComment":["Line"," Chain constants that impose limits on various aspects of smart contract"]},"id":29,"style":"Outer","span":{"lo":{"line":67,"col":0},"hi":{"line":67,"col":75},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"DocComment":["Line"," execution."]},"id":30,"style":"Outer","span":{"lo":{"line":68,"col":0},"hi":{"line":68,"col":14},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"hacspec_concordium_derive"},"disambiguator":0}],"index":[0,164]},"owner_id":{"krate":"hacspec_concordium","path":[{"data":{"TypeNs":"hacspec_concordium_derive"},"disambiguator":0}],"index":[0,164]},"span":{"lo":{"line":73,"col":0},"hi":{"line":73,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":73,"col":0},"hi":{"line":73,"col":39},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"ExternCrate":null},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:72:6: 72:7 (#0), close: concordium/src/concordium.rs:72:31: 72:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":31,"style":"Outer","span":{"lo":{"line":72,"col":0},"hi":{"line":72,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]},{"def_id":null,"owner_id":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":20}],"index":[0,165]},"span":{"lo":{"line":75,"col":0},"hi":{"line":75,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"vis_span":{"lo":{"line":75,"col":0},"hi":{"line":75,"col":37},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"kind":{"Use":[{"span":{"lo":{"line":75,"col":8},"hi":{"line":75,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}},"res":[{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hacspec_concordium_derive","path":[],"index":[8,0]}]}],"segments":[{"ident":["hacspec_concordium_derive",{"lo":{"line":75,"col":8},"hi":{"line":75,"col":33},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}],"hir_id":{"owner":{"krate":"hacspec_concordium","path":[{"data":"Use","disambiguator":20}],"index":[0,165]},"local_id":1},"res":{"Def":[{"DefKind":{"todo":"Mod"}},{"krate":"hacspec_concordium_derive","path":[],"index":[8,0]}]},"args":null,"infer_args":false}],"rename":null},"Glob"]},"attributes":{"attributes":[{"kind":{"Normal":{"item":{"path":"cfg","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:74:6: 74:7 (#0), close: concordium/src/concordium.rs:74:31: 74:32 (#0) }"}},"delim":"Parenthesis","tokens":"not(feature = \"hacspec\")"}},"tokens":null},"tokens":null}},"id":32,"style":"Outer","span":{"lo":{"line":74,"col":0},"hi":{"line":74,"col":32},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}}],"parent_attributes":[{"kind":{"Normal":{"item":{"path":"no_std","args":"Empty","tokens":null},"tokens":null}},"id":39,"style":"Inner","span":{"lo":{"line":3,"col":4},"hi":{"line":3,"col":10},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:4:12: 4:13 (#0), close: concordium/src/concordium.rs:4:49: 4:50 (#0) }"}},"delim":"Parenthesis","tokens":"alloc_error_handler, core_intrinsics"}},"tokens":null},"tokens":null}},"id":40,"style":"Inner","span":{"lo":{"line":4,"col":4},"hi":{"line":4,"col":49},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"feature","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:6:11: 6:12 (#0), close: concordium/src/concordium.rs:6:25: 6:26 (#0) }"}},"delim":"Parenthesis","tokens":"register_tool"}},"tokens":null},"tokens":null}},"id":1,"style":"Inner","span":{"lo":{"line":6,"col":0},"hi":{"line":6,"col":26},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: concordium/src/concordium.rs:7:17: 7:18 (#0), close: concordium/src/concordium.rs:7:21: 7:22 (#0) }"}},"delim":"Parenthesis","tokens":"hax"}},"tokens":null},"tokens":null}},"id":2,"style":"Inner","span":{"lo":{"line":7,"col":0},"hi":{"line":7,"col":22},"filename":{"Real":{"LocalPath":"concordium/src/concordium.rs"}}}},{"kind":{"Normal":{"item":{"path":"register_tool","args":{"Delimited":{"dspan":{"DelimSpan":{"todo":"DelimSpan { open: :1:14: 1:15 (#0), close: :1:19: 1:20 (#0) }"}},"delim":"Parenthesis","tokens":"_hax"}},"tokens":null},"tokens":null}},"id":33,"style":"Inner","span":{"lo":{"line":1,"col":0},"hi":{"line":1,"col":19},"filename":{"CliCrateAttr":4528390502165333492}}}]},"expn_backtrace":[]}] \ No newline at end of file diff --git a/concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_traits.v b/concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_traits.v new file mode 100644 index 0000000..188602b --- /dev/null +++ b/concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_traits.v @@ -0,0 +1,61 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +Require Import Crate. + +Class t_HasParameter Self := { + f_size:Self -> int32 ; +}. + +Class t_HasChainMetadata Self := { + f_slot_time:Self -> t_Timestamp_t ; +}. + +Class t_HasPolicy Self := { + f_identity_provider:Self -> int32 ; + f_created_at:Self -> t_Timestamp_t ; + f_valid_to:Self -> t_Timestamp_t ; + f_next_item:Self -> nseq int8 TODO: Int.to_string length -> (t_Option_t (t_AttributeTag_t × int8) × nseq int8 TODO: Int.to_string length × Self) ; +}. + +(*item error backend*) + +(*item error backend*) + +(*item error backend*) + +(*item error backend*) + +Class t_HasLogger Self := { + f_init:Self ; + f_log_raw:Self -> seq int8 -> (t_Result_t (unit) (t_LogError_t) × Self) ; + f_log:Self -> S -> (t_Result_t (unit) (t_LogError_t) × Self) ; +}. + +Class t_HasActions Self := { + f_accept:Self ; + f_simple_transfer:t_AccountAddress_t -> t_Amount_t -> Self ; + f_send_raw:t_ContractAddress_t -> t_ReceiveName_t -> t_Amount_t -> seq int8 -> Self ; + f_and_then:Self -> Self -> Self ; + f_or_else:Self -> Self -> Self ; +}. + +(*item error backend*) + +(*item error backend*) + +(*item error backend*) + +(*item error backend*) + +Class t_SerialCtx Self := { + f_serial_ctx:Self -> t_SizeLength_t -> W -> (t_Result_t (unit) (_) × W) ; +}. + +Class t_DeserialCtx Self := { + f_deserial_ctx:t_SizeLength_t -> bool -> R -> (t_Result_t (Self) (t_ParseError_t) × R) ; +}. diff --git a/concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_types.Sealed.v b/concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_types.Sealed.v new file mode 100644 index 0000000..fe15f8c --- /dev/null +++ b/concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_types.Sealed.v @@ -0,0 +1,17 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +Require Import Super. + +Class t_ContextType Self := { +}. + +Instance t_InitContextExtern_t_t_ContextType : t_ContextType t_InitContextExtern_t := { +}. + +Instance t_ReceiveContextExtern_t_t_ContextType : t_ContextType t_ReceiveContextExtern_t := { +}. diff --git a/concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_types.v b/concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_types.v new file mode 100644 index 0000000..aec6be7 --- /dev/null +++ b/concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_types.v @@ -0,0 +1,85 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +Record t_ContractState : Type :={ + f_current_contract_state_position : int32; +}. + +Record t_Parameter : Type :={ + f_current_parameter_position : int32; +}. + +Record t_AttributesCursor : Type :={ + f_remaining_items : int16; + f_current_attribute_cursor_position : int32; +}. + +Record t_Logger : Type :={ + f__private_logger : unit; +}. + +Inductive t_LogError : Type := +| LogError_Fullt_LogError +| LogError_Malformedt_LogError. + +Record t_NotPayableError : Type :={ +}. + +Record t_Action : Type :={ + f__private_action : int32; +}. + +Definition impl__tag (self : t_Action_t) : int32 := + f__private_action self. + +Definition v____ : unit := + tt. + +Definition v______refinement (error_code : t_NonZeroI32_t) : bool := + true. + +Record t_Reject : Type :={ + f_error_code : t_NonZeroI32_t; +}. + +Instance t_Reject_t_t_Default : t_Default t_Reject_t := { +}. + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +Notation t_ReceiveResult_t := (t_Result_t (A) (t_Reject_t)). + +Notation t_InitResult_t := (t_Result_t (S) (t_Reject_t)). + +(*Not implemented yet? todo(item)*) + +Record t_ExternContext : Type :={ + f_marker : t_PhantomData_t T; +}. + +Record t_ChainMetaExtern : Type :={ +}. + +Record t_InitContextExtern : Type :={ +}. + +Record t_ReceiveContextExtern : Type :={ +}. diff --git a/concordium/proofs/coq/extraction/Hacspec_concordium.Constants.v b/concordium/proofs/coq/extraction/Hacspec_concordium.Constants.v new file mode 100644 index 0000000..35685ad --- /dev/null +++ b/concordium/proofs/coq/extraction/Hacspec_concordium.Constants.v @@ -0,0 +1,15 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +Definition v_MAX_CONTRACT_STATE_SIZE : int32 := + (@repr WORDSIZE32 16384). + +Definition v_MAX_LOG_SIZE : uint_size := + (@repr WORDSIZE32 512). + +Definition v_MAX_NUM_LOGS : uint_size := + (@repr WORDSIZE32 64). diff --git a/concordium/proofs/coq/extraction/Hacspec_concordium.v b/concordium/proofs/coq/extraction/Hacspec_concordium.v new file mode 100644 index 0000000..8899722 --- /dev/null +++ b/concordium/proofs/coq/extraction/Hacspec_concordium.v @@ -0,0 +1,105 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +Definition trap : t_Never_t := + abort. + +Require Import Alloc. + +Require Import Alloc. (* as ToOwned *) + +Require Import Alloc. (* as string *) + +Require Import Alloc. (* as String *) + +Require Import Alloc. (* as ToString *) + +Require Import Alloc. (* as vec *) + +Require Import Alloc. (* as Vec *) + +Require Import Core. + +Require Import Core. (* as convert *) + +Require Import Core. (* as hash *) + +Require Import Core. (* as marker *) + +Require Import Core. (* as mem *) + +Require Import Core. (* as num *) + +Require Import Core. + +Require Import Alloc. (* as collections *) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +Require Import Concordium_prims. + +Require Import Concordium_types. + +Require Import Concordium_traits. + +(*Not implemented yet? todo(item)*) + +Require Import Concordium_contracts_common. + +(*Not implemented yet? todo(item)*) + +Require Import Hacspec_concordium_derive. diff --git a/concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_traits.fst b/concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_traits.fst new file mode 100644 index 0000000..a8633b9 --- /dev/null +++ b/concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_traits.fst @@ -0,0 +1,173 @@ +module Hacspec_concordium.Concordium_traits +#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" +open Core + +class t_HasParameter (#v_Self: Type) = { + [@@@ FStar.Tactics.Typeclasses.no_method]_super_373553659:Concordium_contracts_common.Traits.t_Read + v_Self; + [@@@ FStar.Tactics.Typeclasses.no_method]_super_806558213:t_HasParameter v_Self; + f_size:v_Self -> u32 +} + +class t_HasChainMetadata (#v_Self: Type) = { + [@@@ FStar.Tactics.Typeclasses.no_method]_super_839676169:t_HasChainMetadata v_Self; + f_slot_time:v_Self -> Concordium_contracts_common.Types.t_Timestamp +} + +class t_HasPolicy (#v_Self: Type) = { + [@@@ FStar.Tactics.Typeclasses.no_method]_super_845917934:t_HasPolicy v_Self; + f_identity_provider:v_Self -> u32; + f_created_at:v_Self -> Concordium_contracts_common.Types.t_Timestamp; + f_valid_to:v_Self -> Concordium_contracts_common.Types.t_Timestamp; + f_next_item:v_Self -> array u8 (sz 31) + -> (Core.Option.t_Option (Concordium_contracts_common.Types.t_AttributeTag & u8) & + array u8 (sz 31) & + v_Self) +} + +class t_HasCommonData (#v_Self: Type) = { + [@@@ FStar.Tactics.Typeclasses.no_method]_super_454473913:t_HasCommonData v_Self; + f_PolicyType:Type; + f_PolicyType:t_HasPolicy i0.f_PolicyType; + f_PolicyType:Core.Marker.t_Sized i0.f_PolicyType; + f_MetadataType:Type; + f_MetadataType:t_HasChainMetadata i0.f_MetadataType; + f_MetadataType:Core.Marker.t_Sized i0.f_MetadataType; + f_ParamType:Type; + f_ParamType:Concordium_contracts_common.Traits.t_Read i0.f_ParamType; + f_ParamType:t_HasParameter i0.f_ParamType; + f_ParamType:Core.Marker.t_Sized i0.f_ParamType; + f_PolicyIteratorType:Type; + f_PolicyIteratorType:Core.Iter.Traits.Exact_size.t_ExactSizeIterator i0.f_PolicyIteratorType; + f_PolicyIteratorType:Core.Iter.Traits.Iterator.t_Iterator i0.f_PolicyIteratorType; + f_PolicyIteratorType:Core.Marker.t_Sized i0.f_PolicyIteratorType; + f_policies:v_Self -> i0.f_PolicyIteratorType; + f_metadata:v_Self -> i0.f_MetadataType; + f_parameter_cursor:v_Self -> i0.f_ParamType +} + +class t_HasInitContext (#v_Self: Type) (#v_Error: Type) = { + [@@@ FStar.Tactics.Typeclasses.no_method]_super_454473913:t_HasCommonData v_Self; + [@@@ FStar.Tactics.Typeclasses.no_method]_super_622119999:Core.Marker.t_Sized v_Error; + [@@@ FStar.Tactics.Typeclasses.no_method]_super_333404876:Core.Default.t_Default v_Error; + [@@@ FStar.Tactics.Typeclasses.no_method]_super_124264501:t_HasInitContext v_Self v_Error; + f_InitData:Type; + f_InitData:Core.Marker.t_Sized i3.f_InitData; + f_open:i3.f_InitData -> v_Self; + f_init_origin:v_Self -> Concordium_contracts_common.Types.t_AccountAddress +} + +class t_HasReceiveContext (#v_Self: Type) (#v_Error: Type) = { + [@@@ FStar.Tactics.Typeclasses.no_method]_super_454473913:t_HasCommonData v_Self; + [@@@ FStar.Tactics.Typeclasses.no_method]_super_622119999:Core.Marker.t_Sized v_Error; + [@@@ FStar.Tactics.Typeclasses.no_method]_super_333404876:Core.Default.t_Default v_Error; + [@@@ FStar.Tactics.Typeclasses.no_method]_super_524859029:t_HasReceiveContext v_Self v_Error; + f_ReceiveData:Type; + f_ReceiveData:Core.Marker.t_Sized i3.f_ReceiveData; + f_open:i3.f_ReceiveData -> v_Self; + f_invoker:v_Self -> Concordium_contracts_common.Types.t_AccountAddress; + f_self_address:v_Self -> Concordium_contracts_common.Types.t_ContractAddress; + f_self_balance:v_Self -> Concordium_contracts_common.Types.t_Amount; + f_sender:v_Self -> Concordium_contracts_common.Types.t_Address; + f_owner:v_Self -> Concordium_contracts_common.Types.t_AccountAddress +} + +class t_HasContractState (#v_Self: Type) (#v_Error: Type) = { + [@@@ FStar.Tactics.Typeclasses.no_method]_super_622119999:Core.Marker.t_Sized v_Error; + [@@@ FStar.Tactics.Typeclasses.no_method]_super_333404876:Core.Default.t_Default v_Error; + [@@@ FStar.Tactics.Typeclasses.no_method]_super_373553659:Concordium_contracts_common.Traits.t_Read + v_Self; + [@@@ FStar.Tactics.Typeclasses.no_method]_super_268178196:Concordium_contracts_common.Traits.t_Write + v_Self; + [@@@ FStar.Tactics.Typeclasses.no_method]_super_99959236:Concordium_contracts_common.Traits.t_Seek + v_Self; + [@@@ FStar.Tactics.Typeclasses.no_method]_super_34555314:t_HasContractState v_Self v_Error; + f_ContractStateData:Type; + f_ContractStateData:Core.Marker.t_Sized i5.f_ContractStateData; + f_open:i5.f_ContractStateData -> v_Self; + f_size:v_Self -> u32; + f_truncate:v_Self -> u32 -> v_Self; + f_reserve:v_Self -> u32 -> (bool & v_Self) +} + +class t_HasLogger (#v_Self: Type) = { + [@@@ FStar.Tactics.Typeclasses.no_method]_super_593170002:t_HasLogger v_Self; + f_init:v_Self; + f_log_raw:v_Self -> slice u8 + -> (Core.Result.t_Result Prims.unit Hacspec_concordium.Concordium_types.t_LogError & v_Self); + f_log: + #v_S: Type -> + {| _: Core.Marker.t_Sized v_S |} -> + {| _: Concordium_contracts_common.Traits.t_Serial v_S |} -> + v_Self -> + v_S + -> (Core.Result.t_Result Prims.unit Hacspec_concordium.Concordium_types.t_LogError & v_Self) +} + +class t_HasActions (#v_Self: Type) = { + [@@@ FStar.Tactics.Typeclasses.no_method]_super_790365329:t_HasActions v_Self; + f_accept:v_Self; + f_simple_transfer: + Concordium_contracts_common.Types.t_AccountAddress -> + Concordium_contracts_common.Types.t_Amount + -> v_Self; + f_send_raw: + Concordium_contracts_common.Types.t_ContractAddress -> + Concordium_contracts_common.Types.t_ReceiveName -> + Concordium_contracts_common.Types.t_Amount -> + slice u8 + -> v_Self; + f_and_then:v_Self -> v_Self -> v_Self; + f_or_else:v_Self -> v_Self -> v_Self +} + +class t_UnwrapAbort (#v_Self: Type) = { + [@@@ FStar.Tactics.Typeclasses.no_method]_super_72353824:t_UnwrapAbort v_Self; + f_Unwrap:Type; + f_Unwrap:Core.Marker.t_Sized i0.f_Unwrap; + f_unwrap_abort:v_Self -> i0.f_Unwrap +} + +class t_ExpectReport (#v_Self: Type) = { + [@@@ FStar.Tactics.Typeclasses.no_method]_super_875898860:t_ExpectReport v_Self; + f_Unwrap:Type; + f_Unwrap:Core.Marker.t_Sized i0.f_Unwrap; + f_expect_report:v_Self -> string -> i0.f_Unwrap +} + +class t_ExpectErrReport (#v_Self: Type) = { + [@@@ FStar.Tactics.Typeclasses.no_method]_super_650373357:t_ExpectErrReport v_Self; + f_Unwrap:Type; + f_Unwrap:Core.Marker.t_Sized i0.f_Unwrap; + f_expect_err_report:v_Self -> string -> i0.f_Unwrap +} + +class t_ExpectNoneReport (#v_Self: Type) = { + [@@@ FStar.Tactics.Typeclasses.no_method]_super_122739808:t_ExpectNoneReport v_Self; + f_expect_none_report:v_Self -> string -> Prims.unit +} + +class t_SerialCtx (#v_Self: Type) = { + [@@@ FStar.Tactics.Typeclasses.no_method]_super_728516819:t_SerialCtx v_Self; + f_serial_ctx: + #v_W: Type -> + {| _: Core.Marker.t_Sized v_W |} -> + {| _: Concordium_contracts_common.Traits.t_Write v_W |} -> + v_Self -> + Concordium_contracts_common.Schema.t_SizeLength -> + v_W + -> (Core.Result.t_Result Prims.unit i2.f_Err & v_W) +} + +class t_DeserialCtx (#v_Self: Type) = { + [@@@ FStar.Tactics.Typeclasses.no_method]_super_529871881:Core.Marker.t_Sized v_Self; + [@@@ FStar.Tactics.Typeclasses.no_method]_super_120498864:t_DeserialCtx v_Self; + f_deserial_ctx: + #v_R: Type -> + {| _: Core.Marker.t_Sized v_R |} -> + {| _: Concordium_contracts_common.Traits.t_Read v_R |} -> + Concordium_contracts_common.Schema.t_SizeLength -> + bool -> + v_R + -> (Core.Result.t_Result v_Self Concordium_contracts_common.Types.t_ParseError & v_R) +} \ No newline at end of file diff --git a/concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_types.Sealed.fst b/concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_types.Sealed.fst new file mode 100644 index 0000000..bfb32d6 --- /dev/null +++ b/concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_types.Sealed.fst @@ -0,0 +1,13 @@ +module Hacspec_concordium.Concordium_types.Sealed +#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" +open Core + +class t_ContextType (#v_Self: Type) = { + [@@@ FStar.Tactics.Typeclasses.no_method]_super_734339128:t_ContextType v_Self +} + +let impl: t_ContextType Hacspec_concordium.Concordium_types.t_InitContextExtern = + { __marker_trait = () } + +let impl_1: t_ContextType Hacspec_concordium.Concordium_types.t_ReceiveContextExtern = + { __marker_trait = () } \ No newline at end of file diff --git a/concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_types.fst b/concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_types.fst new file mode 100644 index 0000000..7db36df --- /dev/null +++ b/concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_types.fst @@ -0,0 +1,53 @@ +module Hacspec_concordium.Concordium_types +#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" +open Core + +type t_ContractState = { f_current_contract_state_position:u32 } + +type t_Parameter = { f_current_parameter_position:u32 } + +type t_AttributesCursor = { + f_current_attribute_cursor_position:u32; + f_remaining_items:u16 +} + +type t_Logger = { f__private_logger:Prims.unit } + +type t_LogError = + | LogError_Full : t_LogError + | LogError_Malformed : t_LogError + +type t_NotPayableError = | NotPayableError : t_NotPayableError + +type t_Action = { f__private_action:u32 } + +let impl__tag (self: t_Action) : u32 = self.f__private_action + +let v____: Prims.unit = () + +let v______refinement (error_code: Core.Num.Nonzero.t_NonZeroI32) : bool = true + +type t_Reject = { f_error_code:f_error_code: Core.Num.Nonzero.t_NonZeroI32{true} } + +let impl_1: Core.Default.t_Default t_Reject = { __marker_trait = () } + +let t_ReceiveResult + (#v_A: Type) + (#[FStar.Tactics.Typeclasses.tcresolve ()] ii0: Core.Marker.t_Sized v_A) + = Core.Result.t_Result v_A t_Reject + +let t_InitResult + (#v_S: Type) + (#[FStar.Tactics.Typeclasses.tcresolve ()] ii0: Core.Marker.t_Sized v_S) + = Core.Result.t_Result v_S t_Reject + +type t_ExternContext + (#v_T: Type) {| _: Core.Marker.t_Sized v_T |} + {| _: Hacspec_concordium.Concordium_types.Sealed.t_ContextType v_T |} + = { f_marker:Core.Marker.t_PhantomData v_T } + +type t_ChainMetaExtern = | ChainMetaExtern : t_ChainMetaExtern + +type t_InitContextExtern = | InitContextExtern : t_InitContextExtern + +type t_ReceiveContextExtern = | ReceiveContextExtern : t_ReceiveContextExtern \ No newline at end of file diff --git a/concordium/proofs/fstar/extraction/Hacspec_concordium.Constants.fst b/concordium/proofs/fstar/extraction/Hacspec_concordium.Constants.fst new file mode 100644 index 0000000..94654f3 --- /dev/null +++ b/concordium/proofs/fstar/extraction/Hacspec_concordium.Constants.fst @@ -0,0 +1,9 @@ +module Hacspec_concordium.Constants +#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" +open Core + +let v_MAX_CONTRACT_STATE_SIZE: u32 = 16384ul + +let v_MAX_LOG_SIZE: usize = sz 512 + +let v_MAX_NUM_LOGS: usize = sz 64 \ No newline at end of file diff --git a/concordium/proofs/fstar/extraction/Hacspec_concordium.fst b/concordium/proofs/fstar/extraction/Hacspec_concordium.fst new file mode 100644 index 0000000..9aa4aab --- /dev/null +++ b/concordium/proofs/fstar/extraction/Hacspec_concordium.fst @@ -0,0 +1,5 @@ +module Hacspec_concordium +#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" +open Core + +let trap: Rust_primitives.Hax.t_Never = Core.Intrinsics.abort \ No newline at end of file diff --git a/concordium/proofs/ssprove/extraction/Hacspec_concordium.v b/concordium/proofs/ssprove/extraction/Hacspec_concordium.v index ccddd72..a7d41ef 100644 --- a/concordium/proofs/ssprove/extraction/Hacspec_concordium.v +++ b/concordium/proofs/ssprove/extraction/Hacspec_concordium.v @@ -3,12 +3,12 @@ Set Warnings "-notation-overridden,-ambiguous-paths". From Crypt Require Import choice_type Package Prelude. Import PackageNotation. From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. +From mathcomp Require Import word_ssrZ word. From Jasmin Require Import word. From Coq Require Import ZArith. From Coq Require Import Strings.String. - Import List.ListNotations. +Import List.ListNotations. Open Scope list_scope. Open Scope Z_scope. Open Scope bool_scope. @@ -29,7 +29,8 @@ Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. (*Not implemented yet? todo(item)*) (*Not implemented yet? todo(item)*) - +Definition t_Never : choice_type := 'unit. +Definition abort : both (fset []) (fset []) t_Never := ret_both tt. Equations trap {L : {fset Location}} {I : Interface} : both L I (t_Never) := trap := solve_lift abort : both L I (t_Never). diff --git a/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_impls.v b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_impls.v deleted file mode 100644 index b81bac4..0000000 --- a/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_impls.v +++ /dev/null @@ -1,176 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. - Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Crate. -Export Crate. - -Require Import Crate_Convert. -Export Crate_Convert. - -Require Import convert. -Export convert. - -Require Import NonZeroI32. -Export NonZeroI32. - -Require Import trap. -Export trap. - -Require Import Vec. -Export Vec. - -Require Import Crate. -Export Crate. - -Require Import Concordium_prims. -Export Concordium_prims. - -Require Import Concordium_types. -Export Concordium_types. - -Require Import Concordium_traits. -Export Concordium_traits. - -Equations reject_impl_convert_from_unit {L : {fset Location}} {I : Interface} : both L I (t_Reject) := - reject_impl_convert_from_unit := - solve_lift (Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (1 : int32))))) : both L I (t_Reject). -Fail Next Obligation. - -Equations reject_impl_convert_from_parse_error {L : {fset Location}} {I : Interface} : both L I (t_Reject) := - reject_impl_convert_from_parse_error := - solve_lift (Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (2 : int32))))) : both L I (t_Reject). -Fail Next Obligation. - -#[global] Program Instance t_Reject_t_From : t_From t_Reject 'unit := - let from := fun {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) => solve_lift reject_impl_convert_from_unit : both L1 I1 (t_Reject) in - {| from_loc := (fset [] : {fset Location}); - from := (@from)|}. -Fail Next Obligation. - -#[global] Program Instance t_Reject_t_From : t_From t_Reject t_ParseError := - let from := fun {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 (t_ParseError)) => solve_lift reject_impl_convert_from_parse_error : both L1 I1 (t_Reject) in - {| from_loc := (fset [] : {fset Location}); - from := (@from)|}. -Fail Next Obligation. - -Equations reject_impl_from_log_error {L1 : {fset Location}} {I1 : Interface} (le : both L1 I1 (t_LogError)) : both L1 I1 (t_Reject) := - reject_impl_from_log_error le := - solve_lift matchb le with - | LogError_Full => - Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (3 : int32)))) - | LogError_Malformed => - Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (4 : int32)))) - end : both L1 I1 (t_Reject). -Fail Next Obligation. - -#[global] Program Instance t_Reject_t_From : t_From t_Reject t_LogError := - let from := fun {L1 : {fset Location}} {I1 : Interface} (le : both L1 I1 (t_LogError)) => solve_lift (reject_impl_from_log_error le) : both L1 I1 (t_Reject) in - {| from_loc := (fset [] : {fset Location}); - from := (@from)|}. -Fail Next Obligation. - -Definition t_NewContractNameError : choice_type := - chFin (mkpos 4). -Equations NewContractNameError_NewContractNameErrorMissingInitPrefix {L : {fset Location}} {I : Interface} : both L I t_NewContractNameError := - NewContractNameError_NewContractNameErrorMissingInitPrefix := - solve_lift ret_both (fintype.Ordinal (n:=4) (m:=0) eq_refl : t_NewContractNameError) : both L I t_NewContractNameError. -Fail Next Obligation. -Equations NewContractNameError_NewContractNameErrorTooLong {L : {fset Location}} {I : Interface} : both L I t_NewContractNameError := - NewContractNameError_NewContractNameErrorTooLong := - solve_lift ret_both (fintype.Ordinal (n:=4) (m:=1) eq_refl : t_NewContractNameError) : both L I t_NewContractNameError. -Fail Next Obligation. -Equations NewContractNameError_NewContractNameErrorContainsDot {L : {fset Location}} {I : Interface} : both L I t_NewContractNameError := - NewContractNameError_NewContractNameErrorContainsDot := - solve_lift ret_both (fintype.Ordinal (n:=4) (m:=2) eq_refl : t_NewContractNameError) : both L I t_NewContractNameError. -Fail Next Obligation. -Equations NewContractNameError_NewContractNameErrorInvalidCharacters {L : {fset Location}} {I : Interface} : both L I t_NewContractNameError := - NewContractNameError_NewContractNameErrorInvalidCharacters := - solve_lift ret_both (fintype.Ordinal (n:=4) (m:=3) eq_refl : t_NewContractNameError) : both L I t_NewContractNameError. -Fail Next Obligation. - -Equations reject_impl_from_new_contract_name_error {L1 : {fset Location}} {I1 : Interface} (nre : both L1 I1 (t_NewContractNameError)) : both L1 I1 (t_Reject) := - reject_impl_from_new_contract_name_error nre := - solve_lift matchb nre with - | NewContractNameError_NewContractNameErrorMissingInitPrefix => - Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (5 : int32)))) - | NewContractNameError_NewContractNameErrorTooLong => - Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (6 : int32)))) - | NewContractNameError_NewContractNameErrorContainsDot => - Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (9 : int32)))) - | NewContractNameError_NewContractNameErrorInvalidCharacters => - Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (10 : int32)))) - end : both L1 I1 (t_Reject). -Fail Next Obligation. - -#[global] Program Instance t_Reject_t_From : t_From t_Reject t_NewContractNameError := - let from := fun {L1 : {fset Location}} {I1 : Interface} (nre : both L1 I1 (t_NewContractNameError)) => solve_lift (reject_impl_from_new_contract_name_error nre) : both L1 I1 (t_Reject) in - {| from_loc := (fset [] : {fset Location}); - from := (@from)|}. -Fail Next Obligation. - -Definition t_NewReceiveNameError : choice_type := - chFin (mkpos 3). -Equations NewReceiveNameError_NewReceiveNameErrorMissingDotSeparator {L : {fset Location}} {I : Interface} : both L I t_NewReceiveNameError := - NewReceiveNameError_NewReceiveNameErrorMissingDotSeparator := - solve_lift ret_both (fintype.Ordinal (n:=3) (m:=0) eq_refl : t_NewReceiveNameError) : both L I t_NewReceiveNameError. -Fail Next Obligation. -Equations NewReceiveNameError_NewReceiveNameErrorTooLong {L : {fset Location}} {I : Interface} : both L I t_NewReceiveNameError := - NewReceiveNameError_NewReceiveNameErrorTooLong := - solve_lift ret_both (fintype.Ordinal (n:=3) (m:=1) eq_refl : t_NewReceiveNameError) : both L I t_NewReceiveNameError. -Fail Next Obligation. -Equations NewReceiveNameError_NewReceiveNameErrorInvalidCharacters {L : {fset Location}} {I : Interface} : both L I t_NewReceiveNameError := - NewReceiveNameError_NewReceiveNameErrorInvalidCharacters := - solve_lift ret_both (fintype.Ordinal (n:=3) (m:=2) eq_refl : t_NewReceiveNameError) : both L I t_NewReceiveNameError. -Fail Next Obligation. - -Equations reject_impl_from_new_receive_name_error {L1 : {fset Location}} {I1 : Interface} (nre : both L1 I1 (t_NewReceiveNameError)) : both L1 I1 (t_Reject) := - reject_impl_from_new_receive_name_error nre := - solve_lift matchb nre with - | NewReceiveNameError_NewReceiveNameErrorMissingDotSeparator => - Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (7 : int32)))) - | NewReceiveNameError_NewReceiveNameErrorTooLong => - Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (8 : int32)))) - | NewReceiveNameError_NewReceiveNameErrorInvalidCharacters => - Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (11 : int32)))) - end : both L1 I1 (t_Reject). -Fail Next Obligation. - -#[global] Program Instance t_Reject_t_From : t_From t_Reject t_NewReceiveNameError := - let from := fun {L1 : {fset Location}} {I1 : Interface} (nre : both L1 I1 (t_NewReceiveNameError)) => solve_lift (reject_impl_from_new_receive_name_error nre) : both L1 I1 (t_Reject) in - {| from_loc := (fset [] : {fset Location}); - from := (@from)|}. -Fail Next Obligation. - -Equations reject_impl_from_not_payable_error {L : {fset Location}} {I : Interface} : both L I (t_Reject) := - reject_impl_from_not_payable_error := - solve_lift (Build_Reject (f_error_code := non_zero_i32 (v_MIN_under_impl_2 .+ (ret_both (12 : int32))))) : both L I (t_Reject). -Fail Next Obligation. - -#[global] Program Instance t_Reject_t_From : t_From t_Reject t_NotPayableError := - let from := fun {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 (t_NotPayableError)) => solve_lift reject_impl_from_not_payable_error : both L1 I1 (t_Reject) in - {| from_loc := (fset [] : {fset Location}); - from := (@from)|}. -Fail Next Obligation. diff --git a/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_traits.v b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_traits.v index 12f69a5..b8c3cc3 100644 --- a/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_traits.v +++ b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_traits.v @@ -3,12 +3,12 @@ Set Warnings "-notation-overridden,-ambiguous-paths". From Crypt Require Import choice_type Package Prelude. Import PackageNotation. From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. +From mathcomp Require Import word_ssrZ word. From Jasmin Require Import word. From Coq Require Import ZArith. From Coq Require Import Strings.String. - Import List.ListNotations. +Import List.ListNotations. Open Scope list_scope. Open Scope Z_scope. Open Scope bool_scope. @@ -28,142 +28,177 @@ Require Import Crate. Export Crate. Class t_HasParameter (Self : choice_type) := { - size_loc : {fset Location} ; - size : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: size_loc) I1 (int32) ; + f_size_loc : {fset Location} ; + f_size : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_size_loc) I1 (int32) ; }. +Hint Unfold f_size_loc. Class t_HasChainMetadata (Self : choice_type) := { - slot_time_loc : {fset Location} ; - slot_time : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: slot_time_loc) I1 (t_Timestamp) ; + f_slot_time_loc : {fset Location} ; + f_slot_time : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_slot_time_loc) I1 (t_Timestamp) ; }. +Hint Unfold f_slot_time_loc. Class t_HasPolicy (Self : choice_type) := { - identity_provider_loc : {fset Location} ; - identity_provider : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: identity_provider_loc) I1 (int32) ; - created_at_loc : {fset Location} ; - created_at : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: created_at_loc) I1 (t_Timestamp) ; - valid_to_loc : {fset Location} ; - valid_to : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: valid_to_loc) I1 (t_Timestamp) ; - next_item_loc : {fset Location} ; - next_item : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (nseq int8 31) -> both (L1 :|: L2 :|: next_item_loc) (I1 :|: I2) ((t_Option ((t_AttributeTag × int8)) × nseq int8 31 × Self)) ; + f_identity_provider_loc : {fset Location} ; + f_identity_provider : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_identity_provider_loc) I1 (int32) ; + f_created_at_loc : {fset Location} ; + f_created_at : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_created_at_loc) I1 (t_Timestamp) ; + f_valid_to_loc : {fset Location} ; + f_valid_to : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_valid_to_loc) I1 (t_Timestamp) ; + f_next_item_loc : {fset Location} ; + f_next_item : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (nseq int8 31) -> both (L1 :|: L2 :|: f_next_item_loc) (I1 :|: I2) ((t_Option ((t_AttributeTag × int8)) × nseq int8 31 × v_Self)) ; }. +Hint Unfold f_identity_provider_loc. +Hint Unfold f_created_at_loc. +Hint Unfold f_valid_to_loc. +Hint Unfold f_next_item_loc. Class t_HasCommonData (Self : choice_type) := { - t_PolicyType : choice_type ; - t_PolicyType_t_HasPolicy :> t_HasPolicy (t_PolicyType) ; - t_PolicyType_t_Sized :> t_Sized (t_PolicyType) ; - t_MetadataType : choice_type ; - t_MetadataType_t_HasChainMetadata :> t_HasChainMetadata (t_MetadataType) ; - t_MetadataType_t_Sized :> t_Sized (t_MetadataType) ; - t_ParamType : choice_type ; - t_ParamType_t_Read :> t_Read (t_ParamType) ; - t_ParamType_t_HasParameter :> t_HasParameter (t_ParamType) ; - t_ParamType_t_Sized :> t_Sized (t_ParamType) ; - t_PolicyIteratorType : choice_type ; - t_PolicyIteratorType_t_ExactSizeIterator :> t_ExactSizeIterator (t_PolicyIteratorType) ; - t_PolicyIteratorType_t_Iterator :> t_Iterator (t_PolicyIteratorType) ; - t_PolicyIteratorType_t_Sized :> t_Sized (t_PolicyIteratorType) ; - policies_loc : {fset Location} ; - policies : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: policies_loc) I1 (t_PolicyIteratorType) ; - metadata_loc : {fset Location} ; - metadata : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: metadata_loc) I1 (t_MetadataType) ; - parameter_cursor_loc : {fset Location} ; - parameter_cursor : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: parameter_cursor_loc) I1 (t_ParamType) ; + f_PolicyType : choice_type ; + f_PolicyType_t_HasPolicy :> t_HasPolicy (f_PolicyType) ; + f_PolicyType_t_Sized :> t_Sized (f_PolicyType) ; + f_MetadataType : choice_type ; + f_MetadataType_t_HasChainMetadata :> t_HasChainMetadata (f_MetadataType) ; + f_MetadataType_t_Sized :> t_Sized (f_MetadataType) ; + f_ParamType : choice_type ; + f_ParamType_t_Read :> t_Read (f_ParamType) ; + f_ParamType_t_HasParameter :> t_HasParameter (f_ParamType) ; + f_ParamType_t_Sized :> t_Sized (f_ParamType) ; + f_PolicyIteratorType : choice_type ; + f_PolicyIteratorType_t_ExactSizeIterator :> t_ExactSizeIterator (f_PolicyIteratorType) ; + f_PolicyIteratorType_t_Iterator :> t_Iterator (f_PolicyIteratorType) ; + f_PolicyIteratorType_t_Sized :> t_Sized (f_PolicyIteratorType) ; + f_policies_loc : {fset Location} ; + f_policies : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_policies_loc) I1 (f_PolicyIteratorType) ; + f_metadata_loc : {fset Location} ; + f_metadata : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_metadata_loc) I1 (f_MetadataType) ; + f_parameter_cursor_loc : {fset Location} ; + f_parameter_cursor : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_parameter_cursor_loc) I1 (f_ParamType) ; }. +Hint Unfold f_policies_loc. +Hint Unfold f_metadata_loc. +Hint Unfold f_parameter_cursor_loc. Class t_HasInitContext (Self : choice_type) := { - t_InitData : choice_type ; - t_InitData_t_Sized :> t_Sized (t_InitData) ; - open_loc : {fset Location} ; - open : forall {L1 I1}, both L1 I1 (t_InitData) -> both (L1 :|: open_loc) I1 (Self) ; - init_origin_loc : {fset Location} ; - init_origin : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: init_origin_loc) I1 (t_AccountAddress) ; + f_InitData : choice_type ; + f_InitData_t_Sized :> t_Sized (f_InitData) ; + f_open_loc : {fset Location} ; + f_open : forall {L1 I1}, both L1 I1 (f_InitData) -> both (L1 :|: f_open_loc) I1 (v_Self) ; + f_init_origin_loc : {fset Location} ; + f_init_origin : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_init_origin_loc) I1 (t_AccountAddress) ; }. +Hint Unfold f_open_loc. +Hint Unfold f_init_origin_loc. Class t_HasReceiveContext (Self : choice_type) := { - t_ReceiveData : choice_type ; - t_ReceiveData_t_Sized :> t_Sized (t_ReceiveData) ; - open_loc : {fset Location} ; - open : forall {L1 I1}, both L1 I1 (t_ReceiveData) -> both (L1 :|: open_loc) I1 (Self) ; - invoker_loc : {fset Location} ; - invoker : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: invoker_loc) I1 (t_AccountAddress) ; - self_address_loc : {fset Location} ; - self_address : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: self_address_loc) I1 (t_ContractAddress) ; - self_balance_loc : {fset Location} ; - self_balance : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: self_balance_loc) I1 (t_Amount) ; - sender_loc : {fset Location} ; - sender : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: sender_loc) I1 (t_Address) ; - owner_loc : {fset Location} ; - owner : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: owner_loc) I1 (t_AccountAddress) ; + f_ReceiveData : choice_type ; + f_ReceiveData_t_Sized :> t_Sized (f_ReceiveData) ; + f_open_loc : {fset Location} ; + f_open : forall {L1 I1}, both L1 I1 (f_ReceiveData) -> both (L1 :|: f_open_loc) I1 (v_Self) ; + f_invoker_loc : {fset Location} ; + f_invoker : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_invoker_loc) I1 (t_AccountAddress) ; + f_self_address_loc : {fset Location} ; + f_self_address : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_self_address_loc) I1 (t_ContractAddress) ; + f_self_balance_loc : {fset Location} ; + f_self_balance : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_self_balance_loc) I1 (t_Amount) ; + f_sender_loc : {fset Location} ; + f_sender : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_sender_loc) I1 (t_Address) ; + f_owner_loc : {fset Location} ; + f_owner : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_owner_loc) I1 (t_AccountAddress) ; }. +Hint Unfold f_open_loc. +Hint Unfold f_invoker_loc. +Hint Unfold f_self_address_loc. +Hint Unfold f_self_balance_loc. +Hint Unfold f_sender_loc. +Hint Unfold f_owner_loc. Class t_HasContractState (Self : choice_type) := { - t_ContractStateData : choice_type ; - t_ContractStateData_t_Sized :> t_Sized (t_ContractStateData) ; - open_loc : {fset Location} ; - open : forall {L1 I1}, both L1 I1 (t_ContractStateData) -> both (L1 :|: open_loc) I1 (Self) ; - size_loc : {fset Location} ; - size : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: size_loc) I1 (int32) ; - truncate_loc : {fset Location} ; - truncate : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: truncate_loc) (I1 :|: I2) (Self) ; - reserve_loc : {fset Location} ; - reserve : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: reserve_loc) (I1 :|: I2) (('bool × Self)) ; + f_ContractStateData : choice_type ; + f_ContractStateData_t_Sized :> t_Sized (f_ContractStateData) ; + f_open_loc : {fset Location} ; + f_open : forall {L1 I1}, both L1 I1 (f_ContractStateData) -> both (L1 :|: f_open_loc) I1 (v_Self) ; + f_size_loc : {fset Location} ; + f_size : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_size_loc) I1 (int32) ; + f_truncate_loc : {fset Location} ; + f_truncate : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: f_truncate_loc) (I1 :|: I2) (v_Self) ; + f_reserve_loc : {fset Location} ; + f_reserve : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: f_reserve_loc) (I1 :|: I2) (('bool × v_Self)) ; }. +Hint Unfold f_open_loc. +Hint Unfold f_size_loc. +Hint Unfold f_truncate_loc. +Hint Unfold f_reserve_loc. Class t_HasLogger (Self : choice_type) := { - init_loc : {fset Location} ; - init : forall {L1 I1}, both (L1 :|: init_loc) I1 (Self) ; - log_raw_loc : {fset Location} ; - log_raw : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (seq int8) -> both (L1 :|: L2 :|: log_raw_loc) (I1 :|: I2) ((t_Result ('unit) (t_LogError) × Self)) ; - log_loc : {fset Location} ; - log : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (S) -> both (L1 :|: L2 :|: log_loc) (I1 :|: I2) ((t_Result ('unit) (t_LogError) × Self)) ; + f_init_loc : {fset Location} ; + f_init : forall {L1 I1}, both (L1 :|: f_init_loc) I1 (v_Self) ; + f_log_raw_loc : {fset Location} ; + f_log_raw : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (seq int8) -> both (L1 :|: L2 :|: f_log_raw_loc) (I1 :|: I2) ((t_Result ('unit) (t_LogError) × v_Self)) ; + f_log_loc : {fset Location} ; + f_log : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (v_S) -> both (L1 :|: L2 :|: f_log_loc) (I1 :|: I2) ((t_Result ('unit) (t_LogError) × v_Self)) ; }. +Hint Unfold f_init_loc. +Hint Unfold f_log_raw_loc. +Hint Unfold f_log_loc. Class t_HasActions (Self : choice_type) := { - accept_loc : {fset Location} ; - accept : forall {L1 I1}, both (L1 :|: accept_loc) I1 (Self) ; - simple_transfer_loc : {fset Location} ; - simple_transfer : forall {L1 L2 I1 I2}, both L1 I1 (t_AccountAddress) -> both L2 I2 (t_Amount) -> both (L1 :|: L2 :|: simple_transfer_loc) (I1 :|: I2) (Self) ; - send_raw_loc : {fset Location} ; - send_raw : forall {L1 L2 L3 L4 I1 I2 I3 I4}, both L1 I1 (t_ContractAddress) -> both L2 I2 (t_ReceiveName) -> both L3 I3 (t_Amount) -> both L4 I4 (seq int8) -> both (L1 :|: L2 :|: L3 :|: L4 :|: send_raw_loc) (I1 :|: I2 :|: I3 :|: I4) (Self) ; - and_then_loc : {fset Location} ; - and_then : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (Self) -> both (L1 :|: L2 :|: and_then_loc) (I1 :|: I2) (Self) ; - or_else_loc : {fset Location} ; - or_else : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (Self) -> both (L1 :|: L2 :|: or_else_loc) (I1 :|: I2) (Self) ; + f_accept_loc : {fset Location} ; + f_accept : forall {L1 I1}, both (L1 :|: f_accept_loc) I1 (v_Self) ; + f_simple_transfer_loc : {fset Location} ; + f_simple_transfer : forall {L1 L2 I1 I2}, both L1 I1 (t_AccountAddress) -> both L2 I2 (t_Amount) -> both (L1 :|: L2 :|: f_simple_transfer_loc) (I1 :|: I2) (v_Self) ; + f_send_raw_loc : {fset Location} ; + f_send_raw : forall {L1 L2 L3 L4 I1 I2 I3 I4}, both L1 I1 (t_ContractAddress) -> both L2 I2 (t_ReceiveName) -> both L3 I3 (t_Amount) -> both L4 I4 (seq int8) -> both (L1 :|: L2 :|: L3 :|: L4 :|: f_send_raw_loc) (I1 :|: I2 :|: I3 :|: I4) (v_Self) ; + f_and_then_loc : {fset Location} ; + f_and_then : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (v_Self) -> both (L1 :|: L2 :|: f_and_then_loc) (I1 :|: I2) (v_Self) ; + f_or_else_loc : {fset Location} ; + f_or_else : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (v_Self) -> both (L1 :|: L2 :|: f_or_else_loc) (I1 :|: I2) (v_Self) ; }. +Hint Unfold f_accept_loc. +Hint Unfold f_simple_transfer_loc. +Hint Unfold f_send_raw_loc. +Hint Unfold f_and_then_loc. +Hint Unfold f_or_else_loc. Class t_UnwrapAbort (Self : choice_type) := { - t_Unwrap : choice_type ; - t_Unwrap_t_Sized :> t_Sized (t_Unwrap) ; - unwrap_abort_loc : {fset Location} ; - unwrap_abort : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: unwrap_abort_loc) I1 (t_Unwrap) ; + f_Unwrap : choice_type ; + f_Unwrap_t_Sized :> t_Sized (f_Unwrap) ; + f_unwrap_abort_loc : {fset Location} ; + f_unwrap_abort : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_unwrap_abort_loc) I1 (f_Unwrap) ; }. +Hint Unfold f_unwrap_abort_loc. Class t_ExpectReport (Self : choice_type) := { - t_Unwrap : choice_type ; - t_Unwrap_t_Sized :> t_Sized (t_Unwrap) ; - expect_report_loc : {fset Location} ; - expect_report : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (chString) -> both (L1 :|: L2 :|: expect_report_loc) (I1 :|: I2) (t_Unwrap) ; + f_Unwrap : choice_type ; + f_Unwrap_t_Sized :> t_Sized (f_Unwrap) ; + f_expect_report_loc : {fset Location} ; + f_expect_report : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (chString) -> both (L1 :|: L2 :|: f_expect_report_loc) (I1 :|: I2) (f_Unwrap) ; }. +Hint Unfold f_expect_report_loc. Class t_ExpectErrReport (Self : choice_type) := { - t_Unwrap : choice_type ; - t_Unwrap_t_Sized :> t_Sized (t_Unwrap) ; - expect_err_report_loc : {fset Location} ; - expect_err_report : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (chString) -> both (L1 :|: L2 :|: expect_err_report_loc) (I1 :|: I2) (t_Unwrap) ; + f_Unwrap : choice_type ; + f_Unwrap_t_Sized :> t_Sized (f_Unwrap) ; + f_expect_err_report_loc : {fset Location} ; + f_expect_err_report : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (chString) -> both (L1 :|: L2 :|: f_expect_err_report_loc) (I1 :|: I2) (f_Unwrap) ; }. +Hint Unfold f_expect_err_report_loc. Class t_ExpectNoneReport (Self : choice_type) := { - expect_none_report_loc : {fset Location} ; - expect_none_report : forall {L1 L2 I1 I2}, both L1 I1 (Self) -> both L2 I2 (chString) -> both (L1 :|: L2 :|: expect_none_report_loc) (I1 :|: I2) ('unit) ; + f_expect_none_report_loc : {fset Location} ; + f_expect_none_report : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (chString) -> both (L1 :|: L2 :|: f_expect_none_report_loc) (I1 :|: I2) ('unit) ; }. +Hint Unfold f_expect_none_report_loc. Class t_SerialCtx (Self : choice_type) := { - serial_ctx_loc : {fset Location} ; - serial_ctx : forall {L1 L2 L3 I1 I2 I3}, both L1 I1 (Self) -> both L2 I2 (t_SizeLength) -> both L3 I3 (W) -> both (L1 :|: L2 :|: L3 :|: serial_ctx_loc) (I1 :|: I2 :|: I3) ((t_Result ('unit) (t_Err) × W)) ; + f_serial_ctx_loc : {fset Location} ; + f_serial_ctx : forall {L1 L2 L3 I1 I2 I3}, both L1 I1 (v_Self) -> both L2 I2 (t_SizeLength) -> both L3 I3 (v_W) -> both (L1 :|: L2 :|: L3 :|: f_serial_ctx_loc) (I1 :|: I2 :|: I3) ((t_Result ('unit) (f_Err) × v_W)) ; }. +Hint Unfold f_serial_ctx_loc. Class t_DeserialCtx (Self : choice_type) := { - deserial_ctx_loc : {fset Location} ; - deserial_ctx : forall {L1 L2 L3 I1 I2 I3}, both L1 I1 (t_SizeLength) -> both L2 I2 ('bool) -> both L3 I3 (R) -> both (L1 :|: L2 :|: L3 :|: deserial_ctx_loc) (I1 :|: I2 :|: I3) ((t_Result (Self) (t_ParseError) × R)) ; + f_deserial_ctx_loc : {fset Location} ; + f_deserial_ctx : forall {L1 L2 L3 I1 I2 I3}, both L1 I1 (t_SizeLength) -> both L2 I2 ('bool) -> both L3 I3 (v_R) -> both (L1 :|: L2 :|: L3 :|: f_deserial_ctx_loc) (I1 :|: I2 :|: I3) ((t_Result (v_Self) (t_ParseError) × v_R)) ; }. +Hint Unfold f_deserial_ctx_loc. diff --git a/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types.v b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types.v index a7241e5..40bd0e8 100644 --- a/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types.v +++ b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types.v @@ -3,12 +3,12 @@ Set Warnings "-notation-overridden,-ambiguous-paths". From Crypt Require Import choice_type Package Prelude. Import PackageNotation. From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. +From mathcomp Require Import word_ssrZ word. From Jasmin Require Import word. From Coq Require Import ZArith. From Coq Require Import Strings.String. - Import List.ListNotations. +Import List.ListNotations. Open Scope list_scope. Open Scope Z_scope. Open Scope bool_scope. @@ -24,9 +24,6 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Require Import Crate_Num. -Export Crate_Num. - Definition t_ContractState : choice_type := (int32). Equations f_current_contract_state_position {L : {fset Location}} {I : Interface} (s : both L I (t_ContractState)) : both L I (int32) := @@ -122,18 +119,18 @@ Equations Build_t_Action {L0 : {fset Location}} {I0 : Interface} {f__private_act Fail Next Obligation. Notation "'Build_t_Action' '[' x ']' '(' 'f__private_action' ':=' y ')'" := (Build_t_Action (f__private_action := y)). -Equations tag_under_impl {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Action)) : both L1 I1 (int32) := - tag_under_impl self := +Equations tag {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Action)) : both L1 I1 (int32) := + tag self := solve_lift (f__private_action self) : both L1 I1 (int32). Fail Next Obligation. -Equations v___ {L : {fset Location}} {I : Interface} : both L I ('unit) := - v___ := +Equations v____ {L : {fset Location}} {I : Interface} : both L I ('unit) := + v____ := solve_lift (ret_both (tt : 'unit)) : both L I ('unit). Fail Next Obligation. -Equations refinement_under___ {L1 : {fset Location}} {I1 : Interface} (error_code : both L1 I1 (t_NonZeroI32)) : both L1 I1 ('bool) := - refinement_under___ error_code := +Equations v______refinement {L1 : {fset Location}} {I1 : Interface} (error_code : both L1 I1 (t_NonZeroI32)) : both L1 I1 ('bool) := + v______refinement error_code := solve_lift (ret_both (true : 'bool)) : both L1 I1 ('bool). Fail Next Obligation. @@ -152,9 +149,9 @@ Fail Next Obligation. Notation "'Build_t_Reject' '[' x ']' '(' 'f_error_code' ':=' y ')'" := (Build_t_Reject (f_error_code := y)). #[global] Program Instance t_Reject_t_Default : t_Default t_Reject := - - {| |}. + _. Fail Next Obligation. +Hint Unfold t_Reject_t_Default. (*Not implemented yet? todo(item)*) @@ -172,20 +169,22 @@ Fail Next Obligation. (*Not implemented yet? todo(item)*) -Definition t_ReceiveResult {A : _} : choice_type := - t_Result (A) (t_Reject). +Definition t_ReceiveResult {v_A : _} `{ t_Sized (v_A)} : choice_type := + t_Result (v_A) (t_Reject). + +Definition t_InitResult {v_S : _} `{ t_Sized (v_S)} : choice_type := + t_Result (v_S) (t_Reject). -Definition t_InitResult {S : _} : choice_type := - t_Result (S) (t_Reject). +(*Not implemented yet? todo(item)*) -Definition t_ExternContext {T : _} `{ t_Sized (T)} `{ t_ContextType (T)} : choice_type := - (t_PhantomData (T)). -Equations f_marker {L : {fset Location}} {I : Interface} {T : _} `{ t_Sized (T)} `{ t_ContextType (T)} (s : both L I (t_ExternContext)) : both L I (t_PhantomData (T)) := +Definition t_ExternContext {v_T : _} `{ t_Sized (v_T)} `{ t_ContextType (v_T)} : choice_type := + (t_PhantomData (v_T)). +Equations f_marker {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_ContextType (v_T)} (s : both L I (t_ExternContext)) : both L I (t_PhantomData (v_T)) := f_marker s := bind_both s (fun x => - solve_lift (ret_both (x : t_PhantomData (T)))) : both L I (t_PhantomData (T)). + solve_lift (ret_both (x : t_PhantomData (v_T)))) : both L I (t_PhantomData (v_T)). Fail Next Obligation. -Equations Build_t_ExternContext {L0 : {fset Location}} {I0 : Interface} {T : _} `{ t_Sized (T)} `{ t_ContextType (T)} {f_marker : both L0 I0 (t_PhantomData (T))} : both L0 I0 (t_ExternContext) := +Equations Build_t_ExternContext {L0 : {fset Location}} {I0 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_ContextType (v_T)} {f_marker : both L0 I0 (t_PhantomData (v_T))} : both L0 I0 (t_ExternContext) := Build_t_ExternContext := bind_both f_marker (fun f_marker => solve_lift (ret_both ((f_marker) : (t_ExternContext)))) : both L0 I0 (t_ExternContext). @@ -212,5 +211,3 @@ Equations Build_t_ReceiveContextExtern : both (fset []) (fset []) (t_ReceiveCont Build_t_ReceiveContextExtern := solve_lift (ret_both ((_) : (t_ReceiveContextExtern))) : both (fset []) (fset []) (t_ReceiveContextExtern). Fail Next Obligation. - -(*Not implemented yet? todo(item)*) diff --git a/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types_Sealed.v b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types_Sealed.v index c811594..2db0b3b 100644 --- a/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types_Sealed.v +++ b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types_Sealed.v @@ -3,12 +3,12 @@ Set Warnings "-notation-overridden,-ambiguous-paths". From Crypt Require Import choice_type Package Prelude. Import PackageNotation. From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. +From mathcomp Require Import word_ssrZ word. From Jasmin Require Import word. From Coq Require Import ZArith. From Coq Require Import Strings.String. - Import List.ListNotations. +Import List.ListNotations. Open Scope list_scope. Open Scope Z_scope. Open Scope bool_scope. @@ -31,11 +31,11 @@ Class t_ContextType (Self : choice_type) := { }. #[global] Program Instance t_InitContextExtern_t_ContextType : t_ContextType t_InitContextExtern := - - {| |}. + _. Fail Next Obligation. +Hint Unfold t_InitContextExtern_t_ContextType. #[global] Program Instance t_ReceiveContextExtern_t_ContextType : t_ContextType t_ReceiveContextExtern := - - {| |}. + _. Fail Next Obligation. +Hint Unfold t_ReceiveContextExtern_t_ContextType. diff --git a/concordium/proofs/ssprove/extraction/Hacspec_concordium_Constants.v b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Constants.v index a0cffe6..6fb3f63 100644 --- a/concordium/proofs/ssprove/extraction/Hacspec_concordium_Constants.v +++ b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Constants.v @@ -3,12 +3,12 @@ Set Warnings "-notation-overridden,-ambiguous-paths". From Crypt Require Import choice_type Package Prelude. Import PackageNotation. From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. +From mathcomp Require Import word_ssrZ word. From Jasmin Require Import word. From Coq Require Import ZArith. From Coq Require Import Strings.String. - Import List.ListNotations. +Import List.ListNotations. Open Scope list_scope. Open Scope Z_scope. Open Scope bool_scope. diff --git a/concordium/src/concordium.rs b/concordium/src/concordium.rs index 0d6aea0..731562e 100644 --- a/concordium/src/concordium.rs +++ b/concordium/src/concordium.rs @@ -6,9 +6,9 @@ #![feature(register_tool)] #![register_tool(hax)] -#[hax_lib_macros::skip] +#[hax_lib_macros::exclude] extern crate hax_lib_macros; -#[hax_lib_macros::skip] +#[hax_lib_macros::exclude] use hax_lib_macros::*; #[cfg(not(feature = "hacspec"))] diff --git a/concordium/src/concordium_prims.rs b/concordium/src/concordium_prims.rs index 02028ff..d786193 100644 --- a/concordium/src/concordium_prims.rs +++ b/concordium/src/concordium_prims.rs @@ -1,12 +1,12 @@ #![feature(register_tool)] #![register_tool(hax)] -#[hax_lib_macros::skip] +#[hax_lib_macros::exclude] extern crate hax_lib_macros; -#[hax_lib_macros::skip] +#[hax_lib_macros::exclude] use hax_lib_macros::*; -#[skip] +#[exclude] use crate::*; extern "C" { @@ -20,7 +20,8 @@ extern "C" { extern "C" { // Send a message to a smart contract. - pub(crate) fn send( + pub// (crate) + fn send( addr_index: u64, addr_subindex: u64, receive_name: *const u8, diff --git a/concordium/src/concordium_types.rs b/concordium/src/concordium_types.rs index 8db60b5..8c6a618 100644 --- a/concordium/src/concordium_types.rs +++ b/concordium/src/concordium_types.rs @@ -1,12 +1,12 @@ #![feature(register_tool)] #![register_tool(hax)] -#[hax_lib_macros::skip] +#[hax_lib_macros::exclude] extern crate hax_lib_macros; -#[hax_lib_macros::skip] +#[hax_lib_macros::exclude] use hax_lib_macros::*; -// #[skip] +#[exclude] use crate::num::*; /// A type representing the constract state bytes. @@ -77,16 +77,16 @@ impl Action { /// displayed. The valid range for an error code is from i32::MIN to -1. #[derive(Debug, Eq, PartialEq)] // TODO: Creusot issue re-add "Debug" attribute #[repr(transparent)] -#[hax_lib_macros::hax_attributes] +// #[hax_lib_macros::hax_attributes] pub struct Reject { - #[refine(true)] + // #[refine(true)] pub error_code: NonZeroI32, } /// Default error is i32::MIN. impl Default for Reject { #[inline(always)] - #[skip] // TODO: Unsafe + #[exclude] // TODO: Unsafe fn default() -> Self { Self { error_code: unsafe {NonZeroI32::new_unchecked(i32::MIN)}, @@ -96,7 +96,7 @@ impl Default for Reject { impl Reject { /// This returns `None` for all values >= 0 and `Some` otherwise. - #[skip] + #[exclude] pub fn new(x: i32) -> Option { if x < 0 { let error_code = unsafe { NonZeroI32::new_unchecked(x) }; @@ -314,6 +314,16 @@ pub type ReceiveResult = Result; /// // ``` pub type InitResult = Result; +pub(crate) mod sealed { + use super::*; + /// Marker trait intended to indicate which context type we have. + /// This is deliberately a sealed trait, so that it is only implementable + /// by types in this crate. + pub trait ContextType {} + impl ContextType for InitContextExtern {} + impl ContextType for ReceiveContextExtern {} +} + /// Context backed by host functions. #[derive(Default)] #[doc(hidden)] @@ -330,13 +340,3 @@ pub struct InitContextExtern; #[derive(Default)] #[doc(hidden)] pub struct ReceiveContextExtern; - -pub(crate) mod sealed { - use super::*; - /// Marker trait intended to indicate which context type we have. - /// This is deliberately a sealed trait, so that it is only implementable - /// by types in this crate. - pub trait ContextType {} - impl ContextType for InitContextExtern {} - impl ContextType for ReceiveContextExtern {} -} diff --git a/ovn/proofs/fstar/extraction/Hacspec_ovn.fst b/ovn/proofs/fstar/extraction/Hacspec_ovn.fst new file mode 100644 index 0000000..2e34433 --- /dev/null +++ b/ovn/proofs/fstar/extraction/Hacspec_ovn.fst @@ -0,0 +1,508 @@ +module Hacspec_ovn +#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" +open Core +open FStar.Mul + +class t_Group (v_Self: Type) = { + f_group_type:Type; + f_group_type:Concordium_contracts_common.Traits.t_Serialize v_5183569706910926426.f_group_type; + f_group_type:Concordium_contracts_common.Traits.t_Deserial v_1888537976224086151.f_group_type; + f_group_type:Concordium_contracts_common.Traits.t_Serial v_10320647326333630898.f_group_type; + f_group_type:Core.Marker.t_Copy v_4543221020923779833.f_group_type; + f_group_type:Core.Clone.t_Clone v_17761277238820538890.f_group_type; + f_group_type:Core.Cmp.t_Eq v_6020902491195533656.f_group_type; + f_group_type:Core.Cmp.t_PartialEq v_12217495809561341085.f_group_type + v_10832891087211025400.f_group_type; + f_group_type:Core.Marker.t_Sized v_11006113574502888163.f_group_type; + f_q:u32; + f_g:v_2435825814251343790.f_group_type; + f_g_pow:u32 -> v_12403217412826525306.f_group_type; + f_pow:v_17386186435278539070.f_group_type -> u32 -> v_17745298227217489689.f_group_type; + f_one:v_14625496897574701453.f_group_type; + f_prod:v_15803927440588513364.f_group_type -> v_8822219464673212186.f_group_type + -> v_385434819834542306.f_group_type; + f_inv:v_1421783649257234612.f_group_type -> v_2900833311577513391.f_group_type; + f_div:v_15411338300132236088.f_group_type -> v_5612355442158236557.f_group_type + -> v_1581199640938228835.f_group_type +} + +type t_vals = + | C_vals_MyVal : t_vals + | C_vals_YourVal : u32 -> t_vals + | C_vals_YourSecondVal : u32 -> u32 -> t_vals + | C_vals_StrangeVal { + f_a:u32; + f_b:u32; + f_c:u32 + }: t_vals + +let v_ZKP (g_pow_xi xi: u32) : u32 = 0ul + +let v_ZKP_one_out_of_two (g_pow_vi: u32) (vi: bool) : u32 = 32ul + +let check_commitment (g_pow_xi_yi_vi zkp: u32) : bool = true + +let check_valid (zkp: u32) : bool = true + +let check_valid2 (g_pow_xi_yi_vi zkp: u32) : bool = true + +let commit_to (x: u32) : u32 = 0ul + +let n: usize = sz 20 + +let select_private_voting_key (random: u32) : u32 = random %! f_q + +let test_v: t_vals = C_vals_YourVal 32ul <: t_vals + +let test_vals (x: t_vals) : u32 = + match x with + | C_vals_MyVal -> 0ul + | C_vals_YourVal x -> x + | C_vals_YourSecondVal x y -> y + | C_vals_StrangeVal + { Hacspec_ovn.Vals.f_a = a ; Hacspec_ovn.Vals.f_c = c ; Hacspec_ovn.Vals.f_b = b } -> + c + +type t_CastVoteParam = { + f_cvp_i:u32; + f_cvp_xi:u32; + f_cvp_vote:bool +} + +type t_RegisterParam = { + f_rp_i:u32; + f_rp_xi:u32 +} + +type t_TallyParameter = | TallyParameter : t_TallyParameter + +type t_alt_test = { + f_d:u32; + f_e:u32; + f_f:u32 +} + +type t_z_17_ = | C_z_17_ : t_z_17_ + +unfold +let t_G = t_z_17_ + +let test_alt_vals (x: t_alt_test) : u32 = match x with | { f_d = d ; f_f = f ; f_e = e } -> f + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl_Group_for_z_17: t_Group t_z_17_ = + { + f_group_type = u32; + f_q = 17ul; + f_g = 3ul; + f_g_pow = (fun (x: u32) -> (f_g ^. x <: u32) %! f_q); + f_pow = (fun (g: u32) (x: u32) -> (f_g ^. x <: u32) %! f_q); + f_one = 1ul; + f_prod = (fun (x: u32) (y: u32) -> (x *! y <: u32) %! f_q); + f_inv + = + (fun (x: u32) -> + let res:u32 = 0ul in + let res:u32 = + Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter ({ + Core.Ops.Range.f_start = 1ul; + Core.Ops.Range.f_end = f_q + } + <: + Core.Ops.Range.t_Range u32) + <: + Core.Ops.Range.t_Range u32) + res + (fun res i -> + let res:u32 = res in + let i:u32 = i in + let ii_computation:u32 = i in + if (f_g_pow i <: u32) =. x + then + let res:u32 = ii_computation in + res + else res) + in + res); + f_div = fun (x: u32) (y: u32) -> f_prod x (f_inv y <: u32) + } + +let compute_group_element_for_vote (i xi: u32) (vote: bool) (xis: t_Array u32 (sz 20)) : u32 = + let prod1:u32 = f_one in + let prod1:u32 = + Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter ({ + Core.Ops.Range.f_start = sz 0; + Core.Ops.Range.f_end = cast (i -! 1ul <: u32) <: usize + } + <: + Core.Ops.Range.t_Range usize) + <: + Core.Ops.Range.t_Range usize) + prod1 + (fun prod1 j -> + let prod1:u32 = prod1 in + let j:usize = j in + f_prod prod1 (xis.[ j ] <: u32) <: u32) + in + let prod2:u32 = f_one in + let prod2:u32 = + Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter ({ + Core.Ops.Range.f_start = cast (i +! 1ul <: u32) <: usize; + Core.Ops.Range.f_end = n + } + <: + Core.Ops.Range.t_Range usize) + <: + Core.Ops.Range.t_Range usize) + prod2 + (fun prod2 j -> + let prod2:u32 = prod2 in + let j:usize = j in + f_prod prod2 (xis.[ j ] <: u32) <: u32) + in + let v_Yi:u32 = f_div prod1 prod2 in + f_prod (f_pow v_Yi xi <: u32) (f_g_pow (if vote then 1ul else 0ul) <: u32) + +type t_OvnContractState = { + f_g_pow_xis:t_Array (impl_Group_for_z_17).f_group_type (sz 20); + f_zkp_xis:t_Array u32 (sz 20); + f_commit_vis:t_Array u32 (sz 20); + f_g_pow_xi_yi_vis:t_Array (impl_Group_for_z_17).f_group_type (sz 20); + f_zkp_vis:t_Array u32 (sz 20); + f_tally:u32 +} + +let cast_vote + (#v_A #impl_574521470_: Type) + (#[FStar.Tactics.Typeclasses.tcresolve ()] ii0: Core.Marker.t_Sized v_A) + (#[FStar.Tactics.Typeclasses.tcresolve ()] ii1: Core.Marker.t_Sized impl_574521470_) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + ii2: + Hacspec_concordium.Concordium_traits.t_HasActions v_A) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + ii3: + Hacspec_concordium.Concordium_traits.t_HasReceiveContext impl_574521470_ Prims.unit) + (ctx: impl_574521470_) + (state: t_OvnContractState) + : Core.Result.t_Result (v_A & t_OvnContractState) Concordium_contracts_common.Types.t_ParseError = + Rust_primitives.Hax.Control_flow_monad.Mexception.run (let _, out:(_ & + Core.Result.t_Result t_CastVoteParam Concordium_contracts_common.Types.t_ParseError) = + Concordium_contracts_common.Traits.f_get (Hacspec_concordium.Concordium_traits.f_parameter_cursor + ctx + <: + _) + in + let* (params: t_CastVoteParam):t_CastVoteParam = + match Core.Ops.Try_trait.f_branch out with + | Core.Ops.Control_flow.ControlFlow_Break residual -> + let* hoist1:Rust_primitives.Hax.t_Never = + Core.Ops.Control_flow.ControlFlow.v_Break (Core.Ops.Try_trait.f_from_residual residual + <: + Core.Result.t_Result (v_A & t_OvnContractState) + Concordium_contracts_common.Types.t_ParseError) + in + Core.Ops.Control_flow.ControlFlow_Continue (Rust_primitives.Hax.never_to_any hoist1) + <: + Core.Ops.Control_flow.t_ControlFlow + (Core.Result.t_Result (v_A & t_OvnContractState) + Concordium_contracts_common.Types.t_ParseError) t_CastVoteParam + | Core.Ops.Control_flow.ControlFlow_Continue v_val -> + Core.Ops.Control_flow.ControlFlow_Continue v_val + <: + Core.Ops.Control_flow.t_ControlFlow + (Core.Result.t_Result (v_A & t_OvnContractState) + Concordium_contracts_common.Types.t_ParseError) t_CastVoteParam + in + Core.Ops.Control_flow.ControlFlow_Continue + (let g_pow_xi_yi_vi:u32 = + compute_group_element_for_vote params.f_cvp_i + params.f_cvp_xi + params.f_cvp_vote + state.f_g_pow_xis + in + let zkp_vi:u32 = v_ZKP_one_out_of_two g_pow_xi_yi_vi params.f_cvp_vote in + let cast_vote_state_ret:t_OvnContractState = Core.Clone.f_clone state in + let cast_vote_state_ret:t_OvnContractState = + { + cast_vote_state_ret with + f_g_pow_xi_yi_vis + = + Rust_primitives.Hax.update_at cast_vote_state_ret.f_g_pow_xi_yi_vis + (cast (params.f_cvp_i <: u32) <: usize) + g_pow_xi_yi_vi + } + <: + t_OvnContractState + in + let cast_vote_state_ret:t_OvnContractState = + { + cast_vote_state_ret with + f_zkp_vis + = + Rust_primitives.Hax.update_at cast_vote_state_ret.f_zkp_vis + (cast (params.f_cvp_i <: u32) <: usize) + zkp_vi + } + <: + t_OvnContractState + in + Core.Result.Result_Ok + (Hacspec_concordium.Concordium_traits.f_accept, cast_vote_state_ret + <: + (v_A & t_OvnContractState)) + <: + Core.Result.t_Result (v_A & t_OvnContractState) + Concordium_contracts_common.Types.t_ParseError) + <: + Core.Ops.Control_flow.t_ControlFlow + (Core.Result.t_Result (v_A & t_OvnContractState) + Concordium_contracts_common.Types.t_ParseError) + (Core.Result.t_Result (v_A & t_OvnContractState) + Concordium_contracts_common.Types.t_ParseError)) + +let commit_to_vote + (#v_A #impl_574521470_: Type) + (#[FStar.Tactics.Typeclasses.tcresolve ()] ii0: Core.Marker.t_Sized v_A) + (#[FStar.Tactics.Typeclasses.tcresolve ()] ii1: Core.Marker.t_Sized impl_574521470_) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + ii2: + Hacspec_concordium.Concordium_traits.t_HasActions v_A) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + ii3: + Hacspec_concordium.Concordium_traits.t_HasReceiveContext impl_574521470_ Prims.unit) + (ctx: impl_574521470_) + (state: t_OvnContractState) + : Core.Result.t_Result (v_A & t_OvnContractState) Concordium_contracts_common.Types.t_ParseError = + Rust_primitives.Hax.Control_flow_monad.Mexception.run (let _, out:(_ & + Core.Result.t_Result t_CastVoteParam Concordium_contracts_common.Types.t_ParseError) = + Concordium_contracts_common.Traits.f_get (Hacspec_concordium.Concordium_traits.f_parameter_cursor + ctx + <: + _) + in + let* (params: t_CastVoteParam):t_CastVoteParam = + match Core.Ops.Try_trait.f_branch out with + | Core.Ops.Control_flow.ControlFlow_Break residual -> + let* hoist2:Rust_primitives.Hax.t_Never = + Core.Ops.Control_flow.ControlFlow.v_Break (Core.Ops.Try_trait.f_from_residual residual + <: + Core.Result.t_Result (v_A & t_OvnContractState) + Concordium_contracts_common.Types.t_ParseError) + in + Core.Ops.Control_flow.ControlFlow_Continue (Rust_primitives.Hax.never_to_any hoist2) + <: + Core.Ops.Control_flow.t_ControlFlow + (Core.Result.t_Result (v_A & t_OvnContractState) + Concordium_contracts_common.Types.t_ParseError) t_CastVoteParam + | Core.Ops.Control_flow.ControlFlow_Continue v_val -> + Core.Ops.Control_flow.ControlFlow_Continue v_val + <: + Core.Ops.Control_flow.t_ControlFlow + (Core.Result.t_Result (v_A & t_OvnContractState) + Concordium_contracts_common.Types.t_ParseError) t_CastVoteParam + in + Core.Ops.Control_flow.ControlFlow_Continue + (let _:Prims.unit = + Rust_primitives.Hax.failure "(FunctionalizeLoops) something is not implemented yet.\nLoop without mutation?\n" + "{\n for zkp in (core::iter::traits::collect::f_into_iter::<[int; 20]>(\n proj_hacspec_ovn::f_zkp_xis(state),\n )) {\n {\n let _: bool = { hacspec_ovn::check_valid(zkp) };\n Tuple0()\n }\n }\n }" + + in + let g_pow_xi_yi_vi:u32 = + compute_group_element_for_vote params.f_cvp_i + params.f_cvp_xi + params.f_cvp_vote + state.f_g_pow_xis + in + let commit_vi:u32 = commit_to g_pow_xi_yi_vi in + let commit_to_vote_state_ret:t_OvnContractState = Core.Clone.f_clone state in + let commit_to_vote_state_ret:t_OvnContractState = + { + commit_to_vote_state_ret with + f_commit_vis + = + Rust_primitives.Hax.update_at commit_to_vote_state_ret.f_commit_vis + (cast (params.f_cvp_i <: u32) <: usize) + commit_vi + } + <: + t_OvnContractState + in + Core.Result.Result_Ok + (Hacspec_concordium.Concordium_traits.f_accept, commit_to_vote_state_ret + <: + (v_A & t_OvnContractState)) + <: + Core.Result.t_Result (v_A & t_OvnContractState) + Concordium_contracts_common.Types.t_ParseError) + <: + Core.Ops.Control_flow.t_ControlFlow + (Core.Result.t_Result (v_A & t_OvnContractState) + Concordium_contracts_common.Types.t_ParseError) + (Core.Result.t_Result (v_A & t_OvnContractState) + Concordium_contracts_common.Types.t_ParseError)) + +let init_ovn_contract + (#impl_108907986_: Type) + (#[FStar.Tactics.Typeclasses.tcresolve ()] ii0: Core.Marker.t_Sized impl_108907986_) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + ii1: + Hacspec_concordium.Concordium_traits.t_HasInitContext impl_108907986_ Prims.unit) + (_: impl_108907986_) + : Core.Result.t_Result t_OvnContractState Hacspec_concordium.Concordium_types.t_Reject = + Core.Result.Result_Ok + ({ + f_g_pow_xis = Rust_primitives.Hax.repeat (f_one <: u32) (sz 20); + f_zkp_xis = Rust_primitives.Hax.repeat 0ul (sz 20); + f_commit_vis = Rust_primitives.Hax.repeat 0ul (sz 20); + f_g_pow_xi_yi_vis = Rust_primitives.Hax.repeat (f_one <: u32) (sz 20); + f_zkp_vis = Rust_primitives.Hax.repeat 0ul (sz 20); + f_tally = 0ul + } + <: + t_OvnContractState) + <: + Core.Result.t_Result t_OvnContractState Hacspec_concordium.Concordium_types.t_Reject + +let register_vote + (#v_A #impl_574521470_: Type) + (#[FStar.Tactics.Typeclasses.tcresolve ()] ii0: Core.Marker.t_Sized v_A) + (#[FStar.Tactics.Typeclasses.tcresolve ()] ii1: Core.Marker.t_Sized impl_574521470_) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + ii2: + Hacspec_concordium.Concordium_traits.t_HasActions v_A) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + ii3: + Hacspec_concordium.Concordium_traits.t_HasReceiveContext impl_574521470_ Prims.unit) + (ctx: impl_574521470_) + (state: t_OvnContractState) + : Core.Result.t_Result (v_A & t_OvnContractState) Concordium_contracts_common.Types.t_ParseError = + Rust_primitives.Hax.Control_flow_monad.Mexception.run (let _, out:(_ & + Core.Result.t_Result t_RegisterParam Concordium_contracts_common.Types.t_ParseError) = + Concordium_contracts_common.Traits.f_get (Hacspec_concordium.Concordium_traits.f_parameter_cursor + ctx + <: + _) + in + let* (params: t_RegisterParam):t_RegisterParam = + match Core.Ops.Try_trait.f_branch out with + | Core.Ops.Control_flow.ControlFlow_Break residual -> + let* hoist3:Rust_primitives.Hax.t_Never = + Core.Ops.Control_flow.ControlFlow.v_Break (Core.Ops.Try_trait.f_from_residual residual + <: + Core.Result.t_Result (v_A & t_OvnContractState) + Concordium_contracts_common.Types.t_ParseError) + in + Core.Ops.Control_flow.ControlFlow_Continue (Rust_primitives.Hax.never_to_any hoist3) + <: + Core.Ops.Control_flow.t_ControlFlow + (Core.Result.t_Result (v_A & t_OvnContractState) + Concordium_contracts_common.Types.t_ParseError) t_RegisterParam + | Core.Ops.Control_flow.ControlFlow_Continue v_val -> + Core.Ops.Control_flow.ControlFlow_Continue v_val + <: + Core.Ops.Control_flow.t_ControlFlow + (Core.Result.t_Result (v_A & t_OvnContractState) + Concordium_contracts_common.Types.t_ParseError) t_RegisterParam + in + Core.Ops.Control_flow.ControlFlow_Continue + (let g_pow_xi:u32 = f_g_pow params.f_rp_xi in + let zkp_xi:u32 = v_ZKP g_pow_xi params.f_rp_xi in + let register_vote_state_ret:t_OvnContractState = Core.Clone.f_clone state in + let register_vote_state_ret:t_OvnContractState = + { + register_vote_state_ret with + f_g_pow_xis + = + Rust_primitives.Hax.update_at register_vote_state_ret.f_g_pow_xis + (cast (params.f_rp_i <: u32) <: usize) + g_pow_xi + } + <: + t_OvnContractState + in + let register_vote_state_ret:t_OvnContractState = + { + register_vote_state_ret with + f_zkp_xis + = + Rust_primitives.Hax.update_at register_vote_state_ret.f_zkp_xis + (cast (params.f_rp_i <: u32) <: usize) + zkp_xi + } + <: + t_OvnContractState + in + Core.Result.Result_Ok + (Hacspec_concordium.Concordium_traits.f_accept, register_vote_state_ret + <: + (v_A & t_OvnContractState)) + <: + Core.Result.t_Result (v_A & t_OvnContractState) + Concordium_contracts_common.Types.t_ParseError) + <: + Core.Ops.Control_flow.t_ControlFlow + (Core.Result.t_Result (v_A & t_OvnContractState) + Concordium_contracts_common.Types.t_ParseError) + (Core.Result.t_Result (v_A & t_OvnContractState) + Concordium_contracts_common.Types.t_ParseError)) + +let tally_votes + (#v_A: Type) + (#impl_574521470_: Type) + (#[FStar.Tactics.Typeclasses.tcresolve ()] ii0: Core.Marker.t_Sized v_A) + (#[FStar.Tactics.Typeclasses.tcresolve ()] ii1: Core.Marker.t_Sized impl_574521470_) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + ii2: + Hacspec_concordium.Concordium_traits.t_HasActions v_A) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + ii3: + Hacspec_concordium.Concordium_traits.t_HasReceiveContext impl_574521470_ Prims.unit) + (_: impl_574521470_) + (state: t_OvnContractState) + : Core.Result.t_Result (v_A & t_OvnContractState) Concordium_contracts_common.Types.t_ParseError = + let _:Prims.unit = + Rust_primitives.Hax.failure "(FunctionalizeLoops) something is not implemented yet.\nLoop without mutation?\n" + "{\n for i in (core::iter::traits::collect::f_into_iter::>(\n core::ops::range::Range {\n f_start: 0,\n f_end: hacspec_ovn::n,\n },\n )) {\n {\n let _: bool = {\n hacspec_ovn::check_valid2(\n core::ops::index::Index::index(\n proj_hacspec_ovn::f_g_pow_xi_yi_vis(state),\n i,\n ),\n core::ops::index::Index::index(proj_hacspec_ovn::f_zkp_vis(state), i),\n )\n };\n {\n let _: bool = {\n hacspec_ovn::check_commitment(\n core::ops::index::Index::index(\n proj_hacspec_ovn::f_g_pow_xi_yi_vis(state),\n i,\n ),\n core::ops::index::Index::index(\n proj_hacspec_ovn::f_commit_vis(state),\n i,\n ),\n )\n };\n Tuple0()\n }\n }\n }\n }" + + in + let vote_result:u32 = f_one in + let vote_result:u32 = + Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter state.f_g_pow_xi_yi_vis + <: + Core.Array.Iter.t_IntoIter u32 (sz 20)) + vote_result + (fun vote_result g_pow_vote -> + let vote_result:u32 = vote_result in + let g_pow_vote:u32 = g_pow_vote in + f_prod vote_result g_pow_vote <: u32) + in + let tally:u32 = 0ul in + let tally:u32 = + Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter ({ + Core.Ops.Range.f_start = 0ul; + Core.Ops.Range.f_end = cast (n <: usize) <: u32 + } + <: + Core.Ops.Range.t_Range u32) + <: + Core.Ops.Range.t_Range u32) + tally + (fun tally i -> + let tally:u32 = tally in + let i:u32 = i in + if (f_g_pow i <: u32) =. vote_result <: bool + then + let tally:u32 = i in + tally + else tally) + in + let tally_votes_state_ret:t_OvnContractState = Core.Clone.f_clone state in + let tally_votes_state_ret:t_OvnContractState = + { tally_votes_state_ret with f_tally = tally } <: t_OvnContractState + in + Core.Result.Result_Ok + (Hacspec_concordium.Concordium_traits.f_accept, tally_votes_state_ret + <: + (v_A & t_OvnContractState)) + <: + Core.Result.t_Result (v_A & t_OvnContractState) Concordium_contracts_common.Types.t_ParseError diff --git a/ovn/proofs/semantics/extraction/Hacspec_ovn.semantics b/ovn/proofs/semantics/extraction/Hacspec_ovn.semantics new file mode 100644 index 0000000..a70b561 --- /dev/null +++ b/ovn/proofs/semantics/extraction/Hacspec_ovn.semantics @@ -0,0 +1,117 @@ +(* Automatically Generated Functional Semantics *) +Import core prelude rust_2018 + +(Unimplemented NotImplementedYet) + +(Unimplemented NotImplementedYet) + +(Unimplemented HaxError) + +Type-Definition t_z_17_ := {} + +Section t_Group + Type-Definition group_type := int + Definition q := + 17 + Definition g := + 3 + Definition g_pow := + λ x, + (rem ((bitxor g) x)) q + Definition pow := + λ g x, + (rem ((bitxor g) x)) q + Definition one := + 1 + Definition prod := + λ x y, + (rem ((mul x) y)) q + Definition inv := + λ x, + let res := 0 in + let res := ((fold (into_iter Range[f_start := 1][f_end := q])) res) (λ res i, + (λ true, + let res := i in + res + | false, + res) ((eq (g_pow i)) x)) in + res + Definition div := + λ x y, + (prod x) (inv y) + End t_Group + +Type-Definition t_G := t_z_17__t + +Definition n := + λ (), 20 + +Type-Definition t_OvnContractState := {f_g_pow_xis : _ array<20>; f_zkp_xis : int array<20>; f_commit_vis : int array<20>; f_g_pow_xi_yi_vis : _ array<20>; f_zkp_vis : int array<20>; f_tally : int} + +Definition init_ovn_contract := + λ (ctx : T), + Result_Ok OvnContractState[f_g_pow_xis := (repeat one) 20][f_zkp_xis := (repeat 0) 20][f_commit_vis := (repeat 0) 20][f_g_pow_xi_yi_vis := (repeat one) 20][f_zkp_vis := (repeat 0) 20][f_tally := 0] + +Definition select_private_voting_key := + λ (random : int), + (rem random) q + +Definition v_ZKP := + λ (g_pow_xi : int) (xi : int), + 0 + +Type-Definition t_RegisterParam := {f_rp_i : int; f_rp_xi : int} + +Definition register_vote := + λ (ctx : T) (state : t_OvnContractState_t), + Result_Ok (accept,state)is2 + +Type-Definition t_CastVoteParam := {f_cvp_i : int; f_cvp_xi : int; f_cvp_vote : bool} + +Definition check_valid := + λ (zkp : int), + true + +Definition compute_group_element_for_vote := + λ (i : int) (xi : int) (vote : bool) (xis : int array<20>), + let prod1 := one in + let prod1 := ((fold (into_iter Range[f_start := 0][f_end := cast ((sub i) 1)])) prod1) (λ prod1 j, + (prod prod1) ((index xis) j)) in + let prod2 := one in + let prod2 := ((fold (into_iter Range[f_start := cast ((add i) 1)][f_end := n])) prod2) (λ prod2 j, + (prod prod2) ((index xis) j)) in + let Yi := (div prod1) prod2 in + (prod ((pow Yi) xi)) (g_pow ((λ true, + 1 + | false, + 0) vote)) + +Definition commit_to := + λ (x : int), + 0 + +Definition commit_to_vote := + λ (ctx : impl HasReceiveContext) (state : t_OvnContractState_t), + Result_Ok (accept,state)is2 + +Definition v_ZKP_one_out_of_two := + λ (g_pow_vi : int) (vi : bool), + 32 + +Definition cast_vote := + λ (ctx : impl HasReceiveContext) (state : t_OvnContractState_t), + Result_Ok (accept,state)is2 + +Definition check_valid2 := + λ (g_pow_xi_yi_vi : int) (zkp : int), + true + +Definition check_commitment := + λ (g_pow_xi_yi_vi : int) (zkp : int), + true + +Type-Definition t_TallyParameter := {} + +Definition tally_votes := + λ (_ : impl HasReceiveContext) (state : t_OvnContractState_t), + Result_Ok (accept,state)is2 diff --git a/ovn/proofs/ssprove/extraction/ConCertLib.v b/ovn/proofs/ssprove/extraction/ConCertLib.v index d0a3ad8..e590e13 100644 --- a/ovn/proofs/ssprove/extraction/ConCertLib.v +++ b/ovn/proofs/ssprove/extraction/ConCertLib.v @@ -221,7 +221,7 @@ Proof. rewrite (IHlen (nseq_tl m)). clear. - + apply fmap.eq_fmap. intros x ; simpl in x. destruct m ; induction fmval. @@ -310,7 +310,7 @@ Proof. + destruct p , s. destruct m0 ; [ discriminate | ]. simpl. - + rewrite lower_fval_equation_2. rewrite lift_fval_equation_2. simpl. @@ -334,10 +334,10 @@ Proof. rewrite eq_o. apply (ssrbool.elimF eqtype.eqP) in eq_o. - + destruct (eqtype.eq_op _ _) eqn:eq_o2 ; [ reflexivity | ]. - + simpl. set (@fmap.getm_def _ _). @@ -349,7 +349,7 @@ Proof. apply (path_sorted_tl (path_sorted_tl i)). apply (path_sorted_tl (path_sorted_tl i)). reflexivity. - } + } } Qed. @@ -442,7 +442,7 @@ Proof. (* eapply product_serializable. *) (* Unshelve. *) (* } *) - + (* eapply (@serialize_by_other *) (* (A * pkg_core_definition.code L I A * valid_both) *) (* (both L I A) *) @@ -470,15 +470,15 @@ Proof. (* reflexivity. *) (* apply product_serializable. *) (* Unshelve. *) - + (* - apply y. *) (* - destruct y. *) (* simpl. *) (* destruct prog. *) (* simpl. *) (* eapply both_valid_ret. *) - + (* apply both *) - + Admitted. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 5fd56d4..aa1e7d4 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -24,158 +24,186 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. +Class t_Group (Self : choice_type) := { + f_group_type : choice_type ; + f_group_type_t_Serialize :> t_Serialize (f_group_type) ; + f_group_type_t_Deserial :> t_Deserial (f_group_type) ; + f_group_type_t_Serial :> t_Serial (f_group_type) ; + f_group_type_t_Copy :> t_Copy (f_group_type) ; + f_group_type_t_Clone :> t_Clone (f_group_type) ; + f_group_type_t_Eq :> t_Eq (f_group_type) ; + f_group_type_t_PartialEq :> t_PartialEq (f_group_type) ; + f_group_type_t_Sized :> t_Sized (f_group_type) ; + f_q : forall {L1 I1}, both L1 I1 (int32) ; + f_g : forall {L1 I1}, both L1 I1 (f_group_type) ; + f_g_pow_loc : {fset Location} ; + f_g_pow : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_g_pow_loc) I1 (f_group_type) ; + f_pow_loc : {fset Location} ; + f_pow : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: f_pow_loc) (I1 :|: I2) (f_group_type) ; + f_one_loc : {fset Location} ; + f_one : forall {L1 I1}, both (L1 :|: f_one_loc) I1 (f_group_type) ; + f_prod_loc : {fset Location} ; + f_prod : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_prod_loc) (I1 :|: I2) (f_group_type) ; + f_inv_loc : {fset Location} ; + f_inv : forall {L1 I1}, both L1 I1 (f_group_type) -> both (L1 :|: f_inv_loc) I1 (f_group_type) ; + f_div_loc : {fset Location} ; + f_div : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_div_loc) (I1 :|: I2) (f_group_type) ; +}. +Hint Unfold f_g_pow_loc. +Hint Unfold f_pow_loc. +Hint Unfold f_one_loc. +Hint Unfold f_prod_loc. +Hint Unfold f_inv_loc. +Hint Unfold f_div_loc. + (*Not implemented yet? todo(item)*) (*Not implemented yet? todo(item)*) -Class t_Group (Self : choice_type) := { - t_group_type : choice_type ; - t_group_type_t_Serialize :> t_Serialize (t_group_type) ; - t_group_type_t_Deserial :> t_Deserial (t_group_type) ; - t_group_type_t_Serial :> t_Serial (t_group_type) ; - t_group_type_t_Copy :> t_Copy (t_group_type) ; - t_group_type_t_Clone :> t_Clone (t_group_type) ; - t_group_type_t_Eq :> t_Eq (t_group_type) ; - t_group_type_t_PartialEq :> t_PartialEq (t_group_type) ; - t_group_type_t_Sized :> t_Sized (t_group_type) ; - q : both (fset[]) (fset[]) (int32) ; - g : both (fset[]) (fset[]) (t_group_type) ; - g_pow_loc : {fset Location} ; - g_pow : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: g_pow_loc) I1 (t_group_type) ; - pow_loc : {fset Location} ; - pow : forall {L1 L2 I1 I2}, both L1 I1 (t_group_type) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: pow_loc) (I1 :|: I2) (t_group_type) ; - one_loc : {fset Location} ; - one : forall {L1 I1}, both (L1 :|: one_loc) I1 (t_group_type) ; - prod_loc : {fset Location} ; - prod : forall {L1 L2 I1 I2}, both L1 I1 (t_group_type) -> both L2 I2 (t_group_type) -> both (L1 :|: L2 :|: prod_loc) (I1 :|: I2) (t_group_type) ; - inv_loc : {fset Location} ; - inv : forall {L1 I1}, both L1 I1 (t_group_type) -> both (L1 :|: inv_loc) I1 (t_group_type) ; - div_loc : {fset Location} ; - div : forall {L1 L2 I1 I2}, both L1 I1 (t_group_type) -> both L2 I2 (t_group_type) -> both (L1 :|: L2 :|: div_loc) (I1 :|: I2) (t_group_type) ; -}. -Hint Unfold g_pow_loc. -Hint Unfold pow_loc. -Hint Unfold one_loc. -Hint Unfold prod_loc. -Hint Unfold inv_loc. -Hint Unfold div_loc. +Definition t_vals_StrangeVal : choice_type := + (int32 × int32 × int32). +Equations f_a {L : {fset Location}} {I : Interface} (s : both L I (t_vals_StrangeVal)) : both L I (int32) := + f_a s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_b {L : {fset Location}} {I : Interface} (s : both L I (t_vals_StrangeVal)) : both L I (int32) := + f_b s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_c {L : {fset Location}} {I : Interface} (s : both L I (t_vals_StrangeVal)) : both L I (int32) := + f_c s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_vals_StrangeVal {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_a : both L0 I0 (int32)} {f_b : both L1 I1 (int32)} {f_c : both L2 I2 (int32)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_vals_StrangeVal) := + Build_t_vals_StrangeVal := + bind_both f_c (fun f_c => + bind_both f_b (fun f_b => + bind_both f_a (fun f_a => + solve_lift (ret_both ((f_a,f_b,f_c) : (t_vals_StrangeVal)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_vals_StrangeVal). +Fail Next Obligation. +Notation "'Build_t_vals_StrangeVal' '[' x ']' '(' 'f_a' ':=' y ')'" := (Build_t_vals_StrangeVal (f_a := y) (f_b := f_b x) (f_c := f_c x)). +Notation "'Build_t_vals_StrangeVal' '[' x ']' '(' 'f_b' ':=' y ')'" := (Build_t_vals_StrangeVal (f_a := f_a x) (f_b := y) (f_c := f_c x)). +Notation "'Build_t_vals_StrangeVal' '[' x ']' '(' 'f_c' ':=' y ')'" := (Build_t_vals_StrangeVal (f_a := f_a x) (f_b := f_b x) (f_c := y)). +Definition t_vals : choice_type := + ('unit ∐ int32 ∐ (int32 × int32) ∐ t_vals_StrangeVal). +Notation "'C_vals_MyVal_case'" := (inl (inl (inl tt))) (at level 100). +Equations C_vals_MyVal {L : {fset Location}} {I : Interface} : both L I (t_vals) := + C_vals_MyVal := + solve_lift (ret_both (inl (inl (inl (tt : 'unit))) : t_vals)) : both L I (t_vals). +Fail Next Obligation. +Notation "'C_vals_YourVal_case' x" := (inl (inl (inr x))) (at level 100). +Equations C_vals_YourVal {L : {fset Location}} {I : Interface} (x : both L I (int32)) : both L I (t_vals) := + C_vals_YourVal x := + bind_both x (fun x => + solve_lift (ret_both (inl (inl (inr x)) : t_vals))) : both L I (t_vals). +Fail Next Obligation. +Notation "'C_vals_YourSecondVal_case' x" := (inl (inr x)) (at level 100). +Equations C_vals_YourSecondVal {L : {fset Location}} {I : Interface} (x : both L I ((int32 × int32))) : both L I (t_vals) := + C_vals_YourSecondVal x := + bind_both x (fun x => + solve_lift (ret_both (inl (inr x) : t_vals))) : both L I (t_vals). +Fail Next Obligation. +Notation "'C_vals_StrangeVal_case' x" := (inr x) (at level 100). +Equations C_vals_StrangeVal {L : {fset Location}} {I : Interface} (x : both L I (t_vals_StrangeVal)) : both L I (t_vals) := + C_vals_StrangeVal x := + bind_both x (fun x => + solve_lift (ret_both (inr x : t_vals))) : both L I (t_vals). +Fail Next Obligation. -Definition t_z_17_ : choice_type := - 'unit. -Equations Build_t_z_17_ : both (fset []) (fset []) (t_z_17_) := - Build_t_z_17_ := - solve_lift (ret_both ((_) : (t_z_17_))) : both (fset []) (fset []) (t_z_17_). +Equations v_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi : both L1 I1 (int32)) (xi : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) (int32) := + v_ZKP g_pow_xi xi := + solve_lift (ret_both (0 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). Fail Next Obligation. -Definition res_loc : Location := - (int32 ; 0%nat). -#[global] Program Instance t_z_17__t_Group : t_Group t_z_17_ := - let t_group_type := int32 : choice_type in - let q := ret_both (17 : int32) : both (fset []) (fset []) (int32) in - let g := ret_both (3 : int32) : both (fset []) (fset []) (int32) in - let g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: fset []) I1 (int32) in - let pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in - let one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I (int32) in - let prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in - let inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => letb res loc(res_loc) := ret_both (0 : int32) in - letb res := foldi_both_list (into_iter (Build_t_Range (f_start := ret_both (1 : int32)) (f_end := q))) (fun i => - ssp (fun res => - letb i_computation := i in - solve_lift (ifb (g_pow i) =.? x - then letb res := i_computation in - res - else res) : both (*2*)(L1:|:fset [res_loc;res_loc]) (I1) (int32))) res in - solve_lift res : both (L1 :|: fset [res_loc]) I1 (int32) in - let div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (prod x (inv y)) : both (L1 :|: L2 :|: fset [res_loc]) (I1 :|: I2) (int32) in - {| t_group_type := (@t_group_type); - q := (@q); - g := (@g); - g_pow_loc := (fset [] : {fset Location}); - g_pow := (@g_pow); - pow_loc := (fset [] : {fset Location}); - pow := (@pow); - one_loc := (fset [] : {fset Location}); - one := (@one); - prod_loc := (fset [] : {fset Location}); - prod := (@prod); - inv_loc := (fset [res_loc] : {fset Location}); - inv := (@inv); - div_loc := (fset [res_loc] : {fset Location}); - div := (@div)|}. -Solve All Obligations with exact int_eqdec. +Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (int32)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := + v_ZKP_one_out_of_two g_pow_vi vi := + solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). Fail Next Obligation. -Hint Unfold t_z_17__t_Group. -Notation "'t_G'" := (t_z_17_). +Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + check_commitment g_pow_xi_yi_vi zkp := + solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (int32)) : both L1 I1 ('bool) := + check_valid zkp := + solve_lift (ret_both (true : 'bool)) : both L1 I1 ('bool). +Fail Next Obligation. + +Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + check_valid2 g_pow_xi_yi_vi zkp := + solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) : both L1 I1 (int32) := + commit_to x := + solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). +Fail Next Obligation. Equations n {L : {fset Location}} {I : Interface} : both L I (uint_size) := n := solve_lift (ret_both (20 : uint_size)) : both L I (uint_size). Fail Next Obligation. -Definition t_OvnContractState : choice_type := - (nseq t_group_type 20 × nseq int32 20 × nseq int32 20 × nseq t_group_type 20 × nseq int32 20 × int32). -Equations f_g_pow_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq t_group_type 20) := - f_g_pow_xis s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq t_group_type 20))) : both L I (nseq t_group_type 20). +Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) : both L1 I1 (int32) := + select_private_voting_key random := + solve_lift (random .% f_q) : both L1 I1 (int32). Fail Next Obligation. -Equations f_zkp_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := - f_zkp_xis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq int32 20))) : both L I (nseq int32 20). + +Equations test_v {L : {fset Location}} {I : Interface} : both L I (t_vals) := + test_v := + C_vals_YourVal (solve_lift (ret_both (32 : int32))) : both L I (t_vals). Fail Next Obligation. -Equations f_commit_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := - f_commit_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : nseq int32 20))) : both L I (nseq int32 20). + +Equations test_vals {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_vals)) : both L1 I1 (int32) := + test_vals x := + matchb x with + | C_vals_MyVal_case => + solve_lift (ret_both (0 : int32)) + | C_vals_YourVal_case x => + letb x := ret_both ((x) : (int32)) in + solve_lift x + | C_vals_YourSecondVal_case (x,y) => + letb '(x,y) := ret_both ((x,y) : (int32 × int32)) in + solve_lift y + | some_name => + letb a := f_a some_name in + letb c := f_c some_name in + letb b := f_b some_name in + solve_lift c + end : both L1 I1 (int32). Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq t_group_type 20) := - f_g_pow_xi_yi_vis s := + +Definition t_CastVoteParam : choice_type := + (int32 × int32 × 'bool). +Equations f_cvp_i {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_i s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : nseq t_group_type 20))) : both L I (nseq t_group_type 20). + solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). Fail Next Obligation. -Equations f_zkp_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := - f_zkp_vis s := +Equations f_cvp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_xi s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : nseq int32 20))) : both L I (nseq int32 20). + solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). Fail Next Obligation. -Equations f_tally {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (int32) := - f_tally s := +Equations f_cvp_vote {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I ('bool) := + f_cvp_vote s := bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). -Fail Next Obligation. -Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {f_g_pow_xis : both L0 I0 (nseq t_group_type 20)} {f_zkp_xis : both L1 I1 (nseq int32 20)} {f_commit_vis : both L2 I2 (nseq int32 20)} {f_g_pow_xi_yi_vis : both L3 I3 (nseq t_group_type 20)} {f_zkp_vis : both L4 I4 (nseq int32 20)} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := - Build_t_OvnContractState := - bind_both f_tally (fun f_tally => - bind_both f_zkp_vis (fun f_zkp_vis => - bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => - bind_both f_commit_vis (fun f_commit_vis => - bind_both f_zkp_xis (fun f_zkp_xis => - bind_both f_g_pow_xis (fun f_g_pow_xis => - solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). -Fail Next Obligation. -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). - -Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {T : _} `{ t_Sized (T)} `{ t_HasInitContext (T) ('unit)} (ctx : both L1 I1 (T)) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)) := - init_ovn_contract ctx := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat one (ret_both (20 : uint_size))) (f_zkp_xis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_commit_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_g_pow_xi_yi_vis := repeat one (ret_both (20 : uint_size))) (f_zkp_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)). -Fail Next Obligation. - -Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) : both L1 I1 (int32) := - select_private_voting_key random := - solve_lift (random .% q) : both L1 I1 (int32). + solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). Fail Next Obligation. - -Equations v_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi : both L1 I1 (int32)) (xi : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) (int32) := - v_ZKP g_pow_xi xi := - solve_lift (ret_both (0 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). +Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (int32)} {f_cvp_vote : both L2 I2 ('bool)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := + Build_t_CastVoteParam := + bind_both f_cvp_vote (fun f_cvp_vote => + bind_both f_cvp_xi (fun f_cvp_xi => + bind_both f_cvp_i (fun f_cvp_i => + solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_vote) : (t_CastVoteParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). Fail Next Obligation. +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := y)). Definition t_RegisterParam : choice_type := (int32 × int32). @@ -198,176 +226,271 @@ Fail Next Obligation. Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x)). Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y)). -Definition register_vote_state_ret_loc {A : _} {T : _} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} : Location := - (t_OvnContractState ; 1%nat). -Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {T : _} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} (ctx : both L1 I1 (T)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := - register_vote ctx state := - solve_lift (run (letb '(_,out) := get (parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((A × t_OvnContractState)) (t_ParseError))] (params:t_RegisterParam) := matchb branch out with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code (t_Result ((A × t_OvnContractState)) (t_ParseError))] hoist1 := v_Break (from_residual residual) in - ControlFlow_Continue (never_to_any hoist1) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb g_pow_xi := g_pow (f_rp_xi params) in - letb zkp_xi := v_ZKP g_pow_xi (f_rp_xi params) in - letb register_vote_state_ret loc(register_vote_state_ret_loc) := clone state in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in - Result_Ok (prod_b (accept,register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). +Definition t_TallyParameter : choice_type := + 'unit. +Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := + Build_t_TallyParameter := + solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). Fail Next Obligation. -Definition t_CastVoteParam : choice_type := - (int32 × int32 × 'bool). -Equations f_cvp_i {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_i s := +Definition t_alt_test : choice_type := + (int32 × int32 × int32). +Equations f_d {L : {fset Location}} {I : Interface} (s : both L I (t_alt_test)) : both L I (int32) := + f_d s := bind_both s (fun x => solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). Fail Next Obligation. -Equations f_cvp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_xi s := +Equations f_e {L : {fset Location}} {I : Interface} (s : both L I (t_alt_test)) : both L I (int32) := + f_e s := bind_both s (fun x => solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). Fail Next Obligation. -Equations f_cvp_vote {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I ('bool) := - f_cvp_vote s := +Equations f_f {L : {fset Location}} {I : Interface} (s : both L I (t_alt_test)) : both L I (int32) := + f_f s := bind_both s (fun x => - solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). + solve_lift (ret_both (snd x : int32))) : both L I (int32). Fail Next Obligation. -Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (int32)} {f_cvp_vote : both L2 I2 ('bool)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := - Build_t_CastVoteParam := - bind_both f_cvp_vote (fun f_cvp_vote => - bind_both f_cvp_xi (fun f_cvp_xi => - bind_both f_cvp_i (fun f_cvp_i => - solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_vote) : (t_CastVoteParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). +Equations Build_t_alt_test {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_d : both L0 I0 (int32)} {f_e : both L1 I1 (int32)} {f_f : both L2 I2 (int32)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_alt_test) := + Build_t_alt_test := + bind_both f_f (fun f_f => + bind_both f_e (fun f_e => + bind_both f_d (fun f_d => + solve_lift (ret_both ((f_d,f_e,f_f) : (t_alt_test)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_alt_test). Fail Next Obligation. -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := y)). +Notation "'Build_t_alt_test' '[' x ']' '(' 'f_d' ':=' y ')'" := (Build_t_alt_test (f_d := y) (f_e := f_e x) (f_f := f_f x)). +Notation "'Build_t_alt_test' '[' x ']' '(' 'f_e' ':=' y ')'" := (Build_t_alt_test (f_d := f_d x) (f_e := y) (f_f := f_f x)). +Notation "'Build_t_alt_test' '[' x ']' '(' 'f_f' ':=' y ')'" := (Build_t_alt_test (f_d := f_d x) (f_e := f_e x) (f_f := y)). -Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (int32)) : both L1 I1 ('bool) := - check_valid zkp := - solve_lift (ret_both (true : 'bool)) : both L1 I1 ('bool). +Definition t_z_17_ : choice_type := + 'unit. +Equations Build_t_z_17_ : both (fset []) (fset []) (t_z_17_) := + Build_t_z_17_ := + solve_lift (ret_both (tt (* Empty tuple *) : (t_z_17_))) : both (fset []) (fset []) (t_z_17_). Fail Next Obligation. +Notation "'t_G'" := (t_z_17_). + +Equations test_alt_vals {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_alt_test)) : both L1 I1 (int32) := + test_alt_vals x := + matchb x with + | some_name => + letb d := f_d some_name in + letb f := f_f some_name in + letb e := f_e some_name in + solve_lift f + end : both L1 I1 (int32). +Fail Next Obligation. + +Definition res_loc : Location := + (int32;0%nat). +#[global] Program Instance t_z_17__t_Group : t_Group t_z_17_ := + let f_group_type := int32 : choice_type in + let f_q := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (17 : int32)) : both (L :|: fset []) I (int32) in + let f_g := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (3 : int32)) : both (L :|: fset []) I (int32) in + let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift ((f_g .^ x) .% f_q) : both (L1 :|: fset []) I1 (int32) in + let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((f_g .^ x) .% f_q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + let f_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I (int32) in + let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% f_q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => letb res loc(res_loc) := ret_both (0 : int32) in + letb res := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (1 : int32)) (f_end := f_q))) (fun i => + ssp (fun res => + letb ii_computation := i in + solve_lift (ifb (f_g_pow i) =.? x + then letb res := ii_computation in + res + else res) : both (*2*)(L1:|:fset [res_loc;res_loc]) (I1) (int32))) res in + solve_lift res : both (L1 :|: fset [res_loc]) I1 (int32) in + let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset [res_loc]) (I1 :|: I2) (int32) in + {| f_group_type := (@f_group_type); + f_q_loc := (fset [] : {fset Location}); + f_q := (@f_q); + f_g_loc := (fset [] : {fset Location}); + f_g := (@f_g); + f_g_pow_loc := (fset [] : {fset Location}); + f_g_pow := (@f_g_pow); + f_pow_loc := (fset [] : {fset Location}); + f_pow := (@f_pow); + f_one_loc := (fset [] : {fset Location}); + f_one := (@f_one); + f_prod_loc := (fset [] : {fset Location}); + f_prod := (@f_prod); + f_inv_loc := (fset [res_loc] : {fset Location}); + f_inv := (@f_inv); + f_div_loc := (fset [res_loc] : {fset Location}); + f_div := (@f_div)|}. +Fail Next Obligation. +Hint Unfold t_z_17__t_Group. + Definition prod1_loc : Location := - (int32 ; 2%nat). + (int32;1%nat). Definition prod2_loc : Location := - (int32 ; 3%nat). + (int32;2%nat). Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq int32 20)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod1_loc;prod2_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32) := compute_group_element_for_vote i xi vote xis := - letb prod1 loc(prod1_loc) := one in - letb prod1 := foldi_both_list (into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun j => + letb prod1 loc(prod1_loc) := f_one in + letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun j => ssp (fun prod1 => - solve_lift (prod prod1 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod1_loc;prod1_loc]) (I1:|:I4:|:I1) (t_group_type))) prod1 in - letb prod2 loc(prod2_loc) := one in - letb prod2 := foldi_both_list (into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun j => + solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod1_loc;prod1_loc]) (I1:|:I4:|:I1) (int32))) prod1 in + letb prod2 loc(prod2_loc) := f_one in + letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun j => ssp (fun prod2 => - solve_lift (prod prod2 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod2_loc;prod2_loc]) (I1:|:I4:|:I1) (t_group_type))) prod2 in - letb Yi := div prod1 prod2 in - solve_lift (prod (pow Yi xi) (g_pow (ifb vote + solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod2_loc;prod2_loc]) (I1:|:I4:|:I1) (int32))) prod2 in + letb v_Yi := f_div prod1 prod2 in + solve_lift (f_prod (f_pow v_Yi xi) (f_g_pow (ifb vote then ret_both (1 : int32) else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod1_loc;prod2_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32). Fail Next Obligation. -Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) : both L1 I1 (int32) := - commit_to x := - solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). +Definition t_OvnContractState : choice_type := + (nseq f_group_type 20 × nseq int32 20 × nseq int32 20 × nseq f_group_type 20 × nseq int32 20 × int32). +Equations f_g_pow_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type 20) := + f_g_pow_xis s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type 20))) : both L I (nseq f_group_type 20). Fail Next Obligation. - -Definition commit_to_vote_state_ret_loc {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} : Location := - (t_OvnContractState ; 4%nat). -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} (ctx : both L1 I1 ((* impl *) HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := - commit_to_vote ctx state := - solve_lift (run (letb '(_,out) := get (parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb branch out with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code (t_Result ((A × t_OvnContractState)) (t_ParseError))] hoist2 := v_Break (from_residual residual) in - ControlFlow_Continue (never_to_any hoist2) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb _ := foldi_both_list (into_iter (f_zkp_xis state)) (fun zkp => - ssp (fun _ => - letb _ := check_valid zkp in - solve_lift (ret_both (tt : 'unit)) : both (*0*)(L2:|:fset []) (I2) ('unit))) (ret_both (tt : 'unit)) in - letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in - letb commit_vi := commit_to g_pow_xi_yi_vi in - letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := clone state in - letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (accept,commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). +Equations f_zkp_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := + f_zkp_xis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq int32 20))) : both L I (nseq int32 20). Fail Next Obligation. - -Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (int32)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := - v_ZKP_one_out_of_two g_pow_vi vi := - solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). +Equations f_commit_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := + f_commit_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : nseq int32 20))) : both L I (nseq int32 20). +Fail Next Obligation. +Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type 20) := + f_g_pow_xi_yi_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type 20))) : both L I (nseq f_group_type 20). +Fail Next Obligation. +Equations f_zkp_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := + f_zkp_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : nseq int32 20))) : both L I (nseq int32 20). Fail Next Obligation. +Equations f_tally {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (int32) := + f_tally s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {f_g_pow_xis : both L0 I0 (nseq f_group_type 20)} {f_zkp_xis : both L1 I1 (nseq int32 20)} {f_commit_vis : both L2 I2 (nseq int32 20)} {f_g_pow_xi_yi_vis : both L3 I3 (nseq f_group_type 20)} {f_zkp_vis : both L4 I4 (nseq int32 20)} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := + Build_t_OvnContractState := + bind_both f_tally (fun f_tally => + bind_both f_zkp_vis (fun f_zkp_vis => + bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => + bind_both f_commit_vis (fun f_commit_vis => + bind_both f_zkp_xis (fun f_zkp_xis => + bind_both f_g_pow_xis (fun f_g_pow_xis => + solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). +Fail Next Obligation. +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). -Definition cast_vote_state_ret_loc {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} : Location := - (t_OvnContractState ; 5%nat). -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} (ctx : both L1 I1 ((* impl *) HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := +Definition cast_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState;3%nat). +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := cast_vote ctx state := - solve_lift (run (letb '(_,out) := get (parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb branch out with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code (t_Result ((A × t_OvnContractState)) (t_ParseError))] hoist3 := v_Break (from_residual residual) in - ControlFlow_Continue (never_to_any hoist3) - | ControlFlow_Continue val => - ControlFlow_Continue val + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb f_branch out with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result (t_Infallible) (t_ParseError))) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist1 := v_Break (f_from_residual residual) in + ControlFlow_Continue (solve_lift (never_to_any hoist1)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (t_CastVoteParam)) in + ControlFlow_Continue (solve_lift val) end in ControlFlow_Continue (letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in letb zkp_vi := v_ZKP_one_out_of_two g_pow_xi_yi_vi (f_cvp_vote params) in - letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := clone state in + letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (accept,cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). + Result_Ok (prod_b (f_accept,cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. -Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - check_valid2 g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Definition commit_to_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState;4%nat). +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := + commit_to_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb f_branch out with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result (t_Infallible) (t_ParseError))) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist2 := v_Break (f_from_residual residual) in + ControlFlow_Continue (solve_lift (never_to_any hoist2)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (t_CastVoteParam)) in + ControlFlow_Continue (solve_lift val) + end in + ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (f_zkp_xis state)) (fun zkp => + ssp (fun _ => + letb _ := check_valid zkp in + solve_lift (ret_both (tt : 'unit)) : both (*0*)(L2:|:fset []) (I2) ('unit))) (ret_both (tt : 'unit)) in + letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in + letb commit_vi := commit_to g_pow_xi_yi_vi in + letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in + letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in + Result_Ok (prod_b (f_accept,commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. -Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - check_commitment g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {impl_108907986_ : _} `{ t_Sized (impl_108907986_)} `{ t_HasInitContext (impl_108907986_) ('unit)} (_ : both L1 I1 (impl_108907986_)) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)) := + init_ovn_contract _ := + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_xis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_commit_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_g_pow_xi_yi_vis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)). Fail Next Obligation. -Definition t_TallyParameter : choice_type := - 'unit. -Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := - Build_t_TallyParameter := - solve_lift (ret_both ((_) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). +Definition register_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState;5%nat). +Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := + register_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_RegisterParam) := matchb f_branch out with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result (t_Infallible) (t_ParseError))) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist3 := v_Break (f_from_residual residual) in + ControlFlow_Continue (solve_lift (never_to_any hoist3)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (t_RegisterParam)) in + ControlFlow_Continue (solve_lift val) + end in + ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in + letb zkp_xi := v_ZKP g_pow_xi (f_rp_xi params) in + letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in + Result_Ok (prod_b (f_accept,register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. -Definition tally_loc {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} : Location := - (int32 ; 6%nat). -Definition tally_votes_state_ret_loc {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} : Location := - (t_OvnContractState ; 7%nat). -Definition vote_result_loc {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} : Location := - (t_group_type ; 8%nat). -Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} (_ : both L1 I1 ((* impl *) HasReceiveContext)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)) := +Definition tally_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (int32;6%nat). +Definition tally_votes_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState;7%nat). +Definition vote_result_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (int32;8%nat). +Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := tally_votes _ state := - letb _ := foldi_both_list (into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => letb _ := check_valid2 ((f_g_pow_xi_yi_vis state).a[i]) ((f_zkp_vis state).a[i]) in letb _ := check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i]) in solve_lift (ret_both (tt : 'unit)) : both (*0*)(L2:|:fset []) (I2) ('unit))) (ret_both (tt : 'unit)) in - letb (vote_result) loc(vote_result_loc) := one in - letb vote_result := foldi_both_list (into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => + letb vote_result loc(vote_result_loc) := f_one in + letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => ssp (fun vote_result => - solve_lift (prod vote_result g_pow_vote) : both (*2*)(L2:|:L2:|:fset [vote_result_loc;vote_result_loc]) (I2:|:I2) (t_group_type))) vote_result in + solve_lift (f_prod vote_result g_pow_vote) : both (*2*)(L2:|:L2:|:fset [vote_result_loc;vote_result_loc]) (I2:|:I2) (int32))) vote_result in letb tally loc(tally_loc) := ret_both (0 : int32) in - letb tally := foldi_both_list (into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => + letb tally := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => ssp (fun tally => - solve_lift (ifb (g_pow i) =.? vote_result + solve_lift (ifb (f_g_pow i) =.? vote_result then letb tally := i in - tally - else tally) : both (*3*)(L2 :|: fset [tally_loc;vote_result_loc;tally_loc]) ((I2 :|: fset [])) (int32))) tally in - letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := clone state in + tally + else tally) : both (*3*)(L2:|:fset [tally_loc;vote_result_loc;tally_loc]) (I2) (int32))) tally in + letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in - Result_Ok (solve_lift (prod_b (accept,tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((A × t_OvnContractState)) (t_ParseError)). + Result_Ok (solve_lift (prod_b (f_accept,tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. (** Concert lib part **) @@ -389,44 +512,69 @@ Export ConCertLib. Definition state_OVN : choice_type := t_OvnContractState. -Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : (state_OVN)) : ResultMonad.result ((state_OVN)) (t_ParseError) := - ResultMonad.Ok st. - -(* Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. *) - -#[global] Program Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit := { get x L I := (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) }. -#[global] Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam := { Sized x := x }. -Definition receive_OVN_register {A : _} {T : _} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (A)} `{ t_Sized (T)} `{ t_HasActions (A)} `{ t_HasReceiveContext (T) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_RegisterParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := - register_vote ctx st. +#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := + {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := + fun x => + x. +Fail Next Obligation. +Definition receive_OVN_cast_vote {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + cast_vote ctx st. -#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := { get x L I := (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) }. -#[global] Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := { Sized x := x }. -Definition receive_OVN_commit_to_vote {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := +#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := + {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := + fun x => + x. +Fail Next Obligation. +Definition receive_OVN_commit_to_vote {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := commit_to_vote ctx st. -(* #[global] Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit. Admitted. *) -(* #[global] Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam. Admitted. *) -Definition receive_OVN_cast_vote {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := - cast_vote ctx st. +Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN) (t_ParseError) := + ResultMonad.Ok st. + +#[global] Program Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit := + {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam := + fun x => + x. +Fail Next Obligation. +Definition receive_OVN_register {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_RegisterParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + register_vote ctx st. -#[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := { get x L I := (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) }. -#[global] Instance t_TallyParameter_t_Sized : t_Sized t_TallyParameter := { Sized x := x }. -Definition receive_OVN_tally {A : _} {(* impl *) HasReceiveContext : _} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} `{ t_Sized (A)} `{ t_Sized ((* impl *) HasReceiveContext)} `{ t_HasActions (A)} `{ t_HasReceiveContext ((* impl *) HasReceiveContext) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_TallyParameter)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((A × state_OVN)) (t_ParseError)) := +#[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := + {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_TallyParameter_t_Sized : t_Sized t_TallyParameter := + fun x => + x. +Fail Next Obligation. +Definition receive_OVN_tally {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_TallyParameter)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := tally_votes ctx st. Inductive Msg_OVN: Type := -| msg_OVN_register : t_RegisterParam -> Msg_OVN -| msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN | msg_OVN_cast_vote : t_CastVoteParam -> Msg_OVN +| msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN +| msg_OVN_register : t_RegisterParam -> Msg_OVN | msg_OVN_tally : t_TallyParameter -> Msg_OVN. -#[global] Program Instance state_OVN_t_HasReceiveContext : t_HasReceiveContext state_OVN 'unit := { get x L I := (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) }. -#[global] Instance state_OVN_t_Sized : t_Sized state_OVN := { Sized x := x }. -#[global] Instance state_OVN_t_HasActions : t_HasActions state_OVN. Admitted. -Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : (state_OVN)) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := +#[global] Program Instance state_OVN_t_HasReceiveContext : t_HasReceiveContext state_OVN 'unit := + {| f_get := (fun (Ctx : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance state_OVN_t_Sized : t_Sized state_OVN := + fun x => + x. +Fail Next Obligation. +#[global] Program Instance state_OVN_t_HasActions : t_HasActions state_OVN := + Admitted. +Fail Next Obligation. +Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := receive_OVN chain ctx st msg := match msg with - | Some (msg_OVN_register val) => - match (is_pure (both_prog (receive_OVN_register (ret_both val) (ret_both st)))) with + | Some (msg_OVN_cast_vote val) => + match (is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (ret_both st)))) with | inl x => ResultMonad.Ok ((fst x), []) | inr x => ResultMonad.Err x end @@ -435,8 +583,8 @@ Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : (state_O | inl x => ResultMonad.Ok ((fst x), []) | inr x => ResultMonad.Err x end - | Some (msg_OVN_cast_vote val) => - match (is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (ret_both st)))) with + | Some (msg_OVN_register val) => + match (is_pure (both_prog (receive_OVN_register (ret_both val) (ret_both st)))) with | inl x => ResultMonad.Ok ((fst x), []) | inr x => ResultMonad.Err x end @@ -449,7 +597,11 @@ Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : (state_O ResultMonad.Err tt end : ResultMonad.result (state_OVN * list ActionBody) t_ParseError. Fail Next Obligation. -#[global] Instance state_OVN_Serializable : Serializable state_OVN := _. -#[global] Instance Msg_OVN_Serializable : Serializable Msg_OVN. Admitted. -Definition contract_OVN : Contract ((state_OVN)) (Msg_OVN) ((state_OVN)) (t_ParseError) := +#[global] Program Instance state_OVN_Serializable : Serializable state_OVN := + _. +Fail Next Obligation. +#[global] Program Instance Msg_OVN_Serializable : Serializable Msg_OVN := + Derive Serializable Msg_OVN_rect. +Fail Next Obligation. +Definition contract_OVN : Contract (state_OVN) (Msg_OVN) (state_OVN) (t_ParseError) := build_contract init_OVN receive_OVN. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_fixes.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_fixes.v new file mode 100644 index 0000000..52a02f7 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_fixes.v @@ -0,0 +1,501 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +Class t_Group (Self : choice_type) := { + f_group_type : choice_type ; + f_group_type_t_Serialize :> t_Serialize (f_group_type) ; + f_group_type_t_Deserial :> t_Deserial (f_group_type) ; + f_group_type_t_Serial :> t_Serial (f_group_type) ; + f_group_type_t_Copy :> t_Copy (f_group_type) ; + f_group_type_t_Clone :> t_Clone (f_group_type) ; + f_group_type_t_Eq :> t_Eq (f_group_type) ; + f_group_type_t_PartialEq :> t_PartialEq (f_group_type) ; + f_group_type_t_Sized :> t_Sized (f_group_type) ; + q : both (fset[]) (fset[]) (int32) ; + g : both (fset[]) (fset[]) (f_group_type) ; + f_g_pow_loc : {fset Location} ; + f_g_pow : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_g_pow_loc) I1 (f_group_type) ; + f_pow_loc : {fset Location} ; + f_pow : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: f_pow_loc) (I1 :|: I2) (f_group_type) ; + f_one_loc : {fset Location} ; + f_one : forall {L1 I1}, both (L1 :|: f_one_loc) I1 (f_group_type) ; + f_prod_loc : {fset Location} ; + f_prod : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_prod_loc) (I1 :|: I2) (f_group_type) ; + f_inv_loc : {fset Location} ; + f_inv : forall {L1 I1}, both L1 I1 (f_group_type) -> both (L1 :|: f_inv_loc) I1 (f_group_type) ; + f_div_loc : {fset Location} ; + f_div : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_div_loc) (I1 :|: I2) (f_group_type) ; +}. +Hint Unfold f_g_pow_loc. +Hint Unfold f_pow_loc. +Hint Unfold f_one_loc. +Hint Unfold f_prod_loc. +Hint Unfold f_inv_loc. +Hint Unfold f_div_loc. + +Definition t_z_17_ : choice_type := + 'unit. +Equations Build_t_z_17_ : both (fset []) (fset []) (t_z_17_) := + Build_t_z_17_ := + solve_lift (ret_both ((_) : (t_z_17_))) : both (fset []) (fset []) (t_z_17_). +Fail Next Obligation. + +Definition res_loc : Location := + (int32 ; 0%nat). + +Notation f_into_iter := into_iter. + +#[global] Program Instance t_z_17__t_Group : t_Group t_z_17_ := + let f_group_type := int32 : choice_type in + let q := ret_both (17 : int32) : both (fset []) (fset []) (int32) in + let g := ret_both (3 : int32) : both (fset []) (fset []) (int32) in + let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: fset []) I1 (int32) in + let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + let f_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I (int32) in + let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => letb res loc(res_loc) := ret_both (0 : int32) in + letb res := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (1 : int32)) (f_end := q))) (fun i => + ssp (fun res => + letb ii_computation := i in + solve_lift (ifb (f_g_pow i) =.? x + then letb res := ii_computation in + res + else res) : both (*2*)(L1:|:fset [res_loc;res_loc]) (I1) (int32))) res in + solve_lift res : both (L1 :|: fset [res_loc]) I1 (int32) in + let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset [res_loc]) (I1 :|: I2) (int32) in + {| f_group_type := (@f_group_type); + q := (@q); + g := (@g); + f_g_pow_loc := (fset [] : {fset Location}); + f_g_pow := (@f_g_pow); + f_pow_loc := (fset [] : {fset Location}); + f_pow := (@f_pow); + f_one_loc := (fset [] : {fset Location}); + f_one := (@f_one); + f_prod_loc := (fset [] : {fset Location}); + f_prod := (@f_prod); + f_inv_loc := (fset [res_loc] : {fset Location}); + f_inv := (@f_inv); + f_div_loc := (fset [res_loc] : {fset Location}); + f_div := (@f_div)|}. +Solve All Obligations with exact int_eqdec. +Fail Next Obligation. +Hint Unfold t_z_17__t_Group. + +Notation "'t_G'" := (t_z_17_). + +Equations n {L : {fset Location}} {I : Interface} : both L I (uint_size) := + n := + solve_lift (ret_both (20 : uint_size)) : both L I (uint_size). +Fail Next Obligation. + +Definition t_OvnContractState : choice_type := + (nseq f_group_type 20 × nseq int32 20 × nseq int32 20 × nseq f_group_type 20 × nseq int32 20 × int32). +Equations f_g_pow_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type 20) := + f_g_pow_xis s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type 20))) : both L I (nseq f_group_type 20). +Fail Next Obligation. +Equations f_zkp_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := + f_zkp_xis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq int32 20))) : both L I (nseq int32 20). +Fail Next Obligation. +Equations f_commit_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := + f_commit_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : nseq int32 20))) : both L I (nseq int32 20). +Fail Next Obligation. +Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type 20) := + f_g_pow_xi_yi_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type 20))) : both L I (nseq f_group_type 20). +Fail Next Obligation. +Equations f_zkp_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := + f_zkp_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : nseq int32 20))) : both L I (nseq int32 20). +Fail Next Obligation. +Equations f_tally {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (int32) := + f_tally s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {f_g_pow_xis : both L0 I0 (nseq f_group_type 20)} {f_zkp_xis : both L1 I1 (nseq int32 20)} {f_commit_vis : both L2 I2 (nseq int32 20)} {f_g_pow_xi_yi_vis : both L3 I3 (nseq f_group_type 20)} {f_zkp_vis : both L4 I4 (nseq int32 20)} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := + Build_t_OvnContractState := + bind_both f_tally (fun f_tally => + bind_both f_zkp_vis (fun f_zkp_vis => + bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => + bind_both f_commit_vis (fun f_commit_vis => + bind_both f_zkp_xis (fun f_zkp_xis => + bind_both f_g_pow_xis (fun f_g_pow_xis => + solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). +Fail Next Obligation. +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). + +Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {impl_108907986_ : _} `{ t_Sized (impl_108907986_)} `{ t_HasInitContext (impl_108907986_) ('unit)} (_ : both L1 I1 (impl_108907986_)) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)) := + init_ovn_contract _ := + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_xis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_commit_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_g_pow_xi_yi_vis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)). +Fail Next Obligation. + +Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) : both L1 I1 (int32) := + select_private_voting_key random := + solve_lift (random .% q) : both L1 I1 (int32). +Fail Next Obligation. + +Equations v_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi : both L1 I1 (int32)) (xi : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) (int32) := + v_ZKP g_pow_xi xi := + solve_lift (ret_both (0 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). +Fail Next Obligation. + +Definition t_RegisterParam : choice_type := + (int32 × int32). +Equations f_rp_i {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := + f_rp_i s := + bind_both s (fun x => + solve_lift (ret_both (fst x : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_rp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := + f_rp_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (int32)} : both (L0:|:L1) (I0:|:I1) (t_RegisterParam) := + Build_t_RegisterParam := + bind_both f_rp_xi (fun f_rp_xi => + bind_both f_rp_i (fun f_rp_i => + solve_lift (ret_both ((f_rp_i,f_rp_xi) : (t_RegisterParam))))) : both (L0:|:L1) (I0:|:I1) (t_RegisterParam). +Fail Next Obligation. +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y)). + +Definition register_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState ; 1%nat). + +(* Notation f_branch := branch. *) +Notation f_get := get. +Notation f_parameter_cursor := parameter_cursor. +Notation f_from_residual := from_residual. +Notation f_clone := clone. +Notation f_accept := accept. + +Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := + register_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_RegisterParam) := matchb branch out with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist1 := v_Break (f_from_residual residual) in + ControlFlow_Continue (never_to_any hoist1) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in + letb zkp_xi := v_ZKP g_pow_xi (f_rp_xi params) in + letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in + Result_Ok (prod_b (f_accept,register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. + +Definition t_CastVoteParam : choice_type := + (int32 × int32 × 'bool). +Equations f_cvp_i {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_i s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_cvp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_cvp_vote {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I ('bool) := + f_cvp_vote s := + bind_both s (fun x => + solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). +Fail Next Obligation. +Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (int32)} {f_cvp_vote : both L2 I2 ('bool)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := + Build_t_CastVoteParam := + bind_both f_cvp_vote (fun f_cvp_vote => + bind_both f_cvp_xi (fun f_cvp_xi => + bind_both f_cvp_i (fun f_cvp_i => + solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_vote) : (t_CastVoteParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). +Fail Next Obligation. +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := y)). + +Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (int32)) : both L1 I1 ('bool) := + check_valid zkp := + solve_lift (ret_both (true : 'bool)) : both L1 I1 ('bool). +Fail Next Obligation. + +Definition prod1_loc : Location := + (int32 ; 2%nat). +Definition prod2_loc : Location := + (int32 ; 3%nat). +Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq int32 20)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [res_loc;prod1_loc;prod2_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32) := + compute_group_element_for_vote i xi vote xis := + letb prod1 loc(prod1_loc) := f_one in + letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun j => + ssp (fun prod1 => + solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod1_loc;prod1_loc]) (I1:|:I4:|:I1) (f_group_type))) prod1 in + letb prod2 loc(prod2_loc) := f_one in + letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun j => + ssp (fun prod2 => + solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod2_loc;prod2_loc]) (I1:|:I4:|:I1) (f_group_type))) prod2 in + letb v_Yi := f_div prod1 prod2 in + solve_lift (f_prod (f_pow v_Yi xi) (f_g_pow (ifb vote + then ret_both (1 : int32) + else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [res_loc;prod1_loc;prod2_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32). +Fail Next Obligation. + +Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) : both L1 I1 (int32) := + commit_to x := + solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). +Fail Next Obligation. + +Definition commit_to_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState ; 4%nat). +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [res_loc;commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := + commit_to_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb branch out with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist2 := v_Break (f_from_residual residual) in + ControlFlow_Continue (never_to_any hoist2) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (f_zkp_xis state)) (fun zkp => + ssp (fun _ => + letb _ := check_valid zkp in + solve_lift (ret_both (tt : 'unit)) : both (*0*)(L2:|:fset []) (I2) ('unit))) (ret_both (tt : 'unit)) in + letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in + letb commit_vi := commit_to g_pow_xi_yi_vi in + letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in + letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in + Result_Ok (prod_b (f_accept,commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [res_loc;commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. + +Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (int32)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := + v_ZKP_one_out_of_two g_pow_vi vi := + solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). +Fail Next Obligation. + +Definition cast_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState ; 5%nat). +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [res_loc;cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := + cast_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb branch out with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist3 := v_Break (f_from_residual residual) in + ControlFlow_Continue (never_to_any hoist3) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in + letb zkp_vi := v_ZKP_one_out_of_two g_pow_xi_yi_vi (f_cvp_vote params) in + letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in + Result_Ok (prod_b (f_accept,cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [res_loc;cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. + +Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + check_valid2 g_pow_xi_yi_vi zkp := + solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + check_commitment g_pow_xi_yi_vi zkp := + solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Definition t_TallyParameter : choice_type := + 'unit. +Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := + Build_t_TallyParameter := + solve_lift (ret_both ((_) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). +Fail Next Obligation. + +Definition tally_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (int32 ; 6%nat). +Definition tally_votes_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState ; 7%nat). +Definition vote_result_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (f_group_type ; 8%nat). +Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := + tally_votes _ state := + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + ssp (fun _ => + letb _ := check_valid2 ((f_g_pow_xi_yi_vis state).a[i]) ((f_zkp_vis state).a[i]) in + letb _ := check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i]) in + solve_lift (ret_both (tt : 'unit)) : both (*0*)(L2:|:fset []) (I2) ('unit))) (ret_both (tt : 'unit)) in + letb vote_result loc(vote_result_loc) := f_one in + letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => + ssp (fun vote_result => + solve_lift (f_prod vote_result g_pow_vote) : both (*2*)(L2:|:L2:|:fset [vote_result_loc;vote_result_loc]) (I2:|:I2) (f_group_type))) vote_result in + letb tally loc(tally_loc) := ret_both (0 : int32) in + letb tally := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => + ssp (fun tally => + solve_lift (ifb (f_g_pow i) =.? vote_result + then letb tally := i in + tally + else tally) : both (*3*)(L2 :|: fset [tally_loc;vote_result_loc;tally_loc]) (I2 :|: (fset [])) (int32))) tally in + letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in + letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in + Result_Ok (solve_lift (prod_b (f_accept,tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. + +(** Concert lib part **) +From ConCert.Utils Require Import Extras. +Export Extras. +From ConCert.Utils Require Import Automation. +Export Automation. +From ConCert.Execution Require Import Serializable. +Export Serializable. +From ConCert.Execution Require Import Blockchain. +Export Blockchain. +From ConCert.Execution Require Import ContractCommon. +Export ContractCommon. +From ConCert.Execution Require Import Serializable. +Export Serializable. +Require Import ConCertLib. +Export ConCertLib. + +Definition state_OVN : choice_type := + t_OvnContractState. + +Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN) (t_ParseError) := + ResultMonad.Ok st. + +#[global] Program Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit := + { get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)}. +Fail Next Obligation. +#[global] Program Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam := { Sized := (fun x => x) }. +Fail Next Obligation. +Definition receive_OVN_register {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_RegisterParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + register_vote ctx st. + +#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := + {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := + { Sized := (fun (x : _) => x : _)}. +Fail Next Obligation. +Definition receive_OVN_commit_to_vote {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + commit_to_vote ctx st. + +(* #[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := *) +(* {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. *) +(* Fail Next Obligation. *) +(* #[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := *) +(* { Sized := (fun (x : _) => x : _)}. *) +(* Fail Next Obligation. *) +Definition receive_OVN_cast_vote {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + cast_vote ctx st. + +#[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := + {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_TallyParameter_t_Sized : t_Sized t_TallyParameter := + { Sized := (fun (x : _) => x : _)}. +Fail Next Obligation. +Definition receive_OVN_tally {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_TallyParameter)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + tally_votes ctx st. + +Inductive Msg_OVN: Type := +| msg_OVN_register : t_RegisterParam -> Msg_OVN +| msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN +| msg_OVN_cast_vote : t_CastVoteParam -> Msg_OVN +| msg_OVN_tally : t_TallyParameter -> Msg_OVN. +#[global] Program Instance state_OVN_t_HasReceiveContext : t_HasReceiveContext state_OVN 'unit := + {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance state_OVN_t_Sized : t_Sized state_OVN := + { Sized := (fun (x : _) => x : _)}. +Fail Next Obligation. +#[global] Program Instance state_OVN_t_HasActions : t_HasActions state_OVN := + _. +Next Obligation. + constructor. + intros. + refine (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_xis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_commit_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_g_pow_xi_yi_vis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_tally := ret_both (0 : int32))) : both L I state_OVN). + Unshelve. + 3: apply I. + 3: apply L. + 3: apply I. + 3: apply L. + all: solve_ssprove_obligations. +Defined. + +Fail Next Obligation. +Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := + receive_OVN chain ctx st msg := + match msg with + | Some (msg_OVN_register val) => + match (is_pure (both_prog (receive_OVN_register (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_OVN_commit_to_vote val) => + match (is_pure (both_prog (receive_OVN_commit_to_vote (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_OVN_cast_vote val) => + match (is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_OVN_tally val) => + match (is_pure (both_prog (receive_OVN_tally (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | _ => + ResultMonad.Err tt + end : ResultMonad.result (state_OVN * list ActionBody) t_ParseError. +Fail Next Obligation. +#[global] Program Instance state_OVN_Serializable : Serializable state_OVN := + _. +Fail Next Obligation. +#[global] Program Instance Msg_OVN_Serializable : Serializable Msg_OVN := + Derive Serializable Msg_OVN_rect< msg_OVN_register, msg_OVN_commit_to_vote, msg_OVN_cast_vote, msg_OVN_tally >. +Fail Next Obligation. +Definition contract_OVN : Contract (state_OVN) (Msg_OVN) (state_OVN) (t_ParseError) := + build_contract init_OVN receive_OVN. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_working.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_working.v new file mode 100644 index 0000000..4c46277 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_working.v @@ -0,0 +1,598 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +Definition t_vals_StrangeVal : choice_type := + (int32 × int32 × int32). +Equations f_a {L : {fset Location}} {I : Interface} (s : both L I (t_vals_StrangeVal)) : both L I (int32) := + f_a s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_b {L : {fset Location}} {I : Interface} (s : both L I (t_vals_StrangeVal)) : both L I (int32) := + f_b s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_c {L : {fset Location}} {I : Interface} (s : both L I (t_vals_StrangeVal)) : both L I (int32) := + f_c s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_vals_StrangeVal {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_a : both L0 I0 (int32)} {f_b : both L1 I1 (int32)} {f_c : both L2 I2 (int32)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_vals_StrangeVal) := + Build_t_vals_StrangeVal := + bind_both f_c (fun f_c => + bind_both f_b (fun f_b => + bind_both f_a (fun f_a => + solve_lift (ret_both ((f_a,f_b,f_c) : (t_vals_StrangeVal)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_vals_StrangeVal). +Fail Next Obligation. +Notation "'Build_t_vals_StrangeVal' '[' x ']' '(' 'f_a' ':=' y ')'" := (Build_t_vals_StrangeVal (f_a := y) (f_b := f_b x) (f_c := f_c x)). +Notation "'Build_t_vals_StrangeVal' '[' x ']' '(' 'f_b' ':=' y ')'" := (Build_t_vals_StrangeVal (f_a := f_a x) (f_b := y) (f_c := f_c x)). +Notation "'Build_t_vals_StrangeVal' '[' x ']' '(' 'f_c' ':=' y ')'" := (Build_t_vals_StrangeVal (f_a := f_a x) (f_b := f_b x) (f_c := y)). +Definition t_vals : choice_type := + ('unit ∐ int32 ∐ (int32 × int32) ∐ t_vals_StrangeVal). +Notation "'C_vals_MyVal_case'" := (inl (inl (inl tt))) (at level 100). +Equations C_vals_MyVal {L : {fset Location}} {I : Interface} : both L I (t_vals) := + C_vals_MyVal := + solve_lift (ret_both (inl (inl (inl (tt : 'unit))) : t_vals)) : both L I (t_vals). +Fail Next Obligation. +Notation "'C_vals_YourVal_case' x" := (inl (inl (inr x))) (at level 100). +Equations C_vals_YourVal {L : {fset Location}} {I : Interface} (x : both L I (int32)) : both L I (t_vals) := + C_vals_YourVal x := + bind_both x (fun x => + solve_lift (ret_both (inl (inl (inr x)) : t_vals))) : both L I (t_vals). +Fail Next Obligation. +Notation "'C_vals_YourSecondVal_case' x" := (inl (inr x)) (at level 100). +Equations C_vals_YourSecondVal {L : {fset Location}} {I : Interface} (x : both L I ((int32 × int32))) : both L I (t_vals) := + C_vals_YourSecondVal x := + bind_both x (fun x => + solve_lift (ret_both (inl (inr x) : t_vals))) : both L I (t_vals). +Fail Next Obligation. +Notation "'C_vals_StrangeVal_case' x" := (inr x) (at level 100). +Equations C_vals_StrangeVal {L : {fset Location}} {I : Interface} (x : both L I (t_vals_StrangeVal)) : both L I (t_vals) := + C_vals_StrangeVal x := + bind_both x (fun x => + solve_lift (ret_both (inr x : t_vals))) : both L I (t_vals). +Fail Next Obligation. + +Equations test_v {L : {fset Location}} {I : Interface} : both L I (t_vals) := + test_v := + C_vals_YourVal (solve_lift (ret_both (32 : int32))) : both L I (t_vals). +Fail Next Obligation. + +Equations test_vals {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_vals)) : both L1 I1 (int32) := + test_vals x := + matchb x with + | C_vals_MyVal_case => + solve_lift (ret_both (0 : int32)) + | C_vals_YourVal_case x => + letb x := ret_both ((x) : (int32)) in + solve_lift x + | C_vals_YourSecondVal_case (x,y) => + letb '(x,y) := ret_both ((x,y) : (int32 × int32)) in + solve_lift y + | C_vals_StrangeVal_case some_name => + letb some_name := ret_both ((some_name) : (t_vals_StrangeVal)) in + letb a := f_a some_name in + letb c := f_c some_name in + letb b := f_b some_name in + solve_lift c + end : both L1 I1 (int32). +Fail Next Obligation. + +Definition t_alt_test : choice_type := + (int32 × int32 × int32). +Equations f_d {L : {fset Location}} {I : Interface} (s : both L I (t_alt_test)) : both L I (int32) := + f_d s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_e {L : {fset Location}} {I : Interface} (s : both L I (t_alt_test)) : both L I (int32) := + f_e s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_f {L : {fset Location}} {I : Interface} (s : both L I (t_alt_test)) : both L I (int32) := + f_f s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_alt_test {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_d : both L0 I0 (int32)} {f_e : both L1 I1 (int32)} {f_f : both L2 I2 (int32)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_alt_test) := + Build_t_alt_test := + bind_both f_f (fun f_f => + bind_both f_e (fun f_e => + bind_both f_d (fun f_d => + solve_lift (ret_both ((f_d,f_e,f_f) : (t_alt_test)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_alt_test). +Fail Next Obligation. +Notation "'Build_t_alt_test' '[' x ']' '(' 'f_d' ':=' y ')'" := (Build_t_alt_test (f_d := y) (f_e := f_e x) (f_f := f_f x)). +Notation "'Build_t_alt_test' '[' x ']' '(' 'f_e' ':=' y ')'" := (Build_t_alt_test (f_d := f_d x) (f_e := y) (f_f := f_f x)). +Notation "'Build_t_alt_test' '[' x ']' '(' 'f_f' ':=' y ')'" := (Build_t_alt_test (f_d := f_d x) (f_e := f_e x) (f_f := y)). + +Equations test_alt_vals {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_alt_test)) : both L1 I1 (int32) := + test_alt_vals x := + letb some_name := x in + letb d := f_d some_name in + letb f := f_f some_name in + letb e := f_e some_name in + solve_lift f : both L1 I1 (int32). +Fail Next Obligation. + +Class t_Group (Self : choice_type) := { + f_group_type : choice_type ; + f_group_type_t_Serialize :> t_Serialize (f_group_type) ; + f_group_type_t_Deserial :> t_Deserial (f_group_type) ; + f_group_type_t_Serial :> t_Serial (f_group_type) ; + f_group_type_t_Copy :> t_Copy (f_group_type) ; + f_group_type_t_Clone :> t_Clone (f_group_type) ; + f_group_type_t_Eq :> t_Eq (f_group_type) ; + f_group_type_t_PartialEq :> t_PartialEq (f_group_type) ; + f_group_type_t_Sized :> t_Sized (f_group_type) ; + q : both (fset[]) (fset[]) (int32) ; + g : both (fset[]) (fset[]) (f_group_type) ; + f_g_pow_loc : {fset Location} ; + f_g_pow : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_g_pow_loc) I1 (f_group_type) ; + f_pow_loc : {fset Location} ; + f_pow : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: f_pow_loc) (I1 :|: I2) (f_group_type) ; + f_one_loc : {fset Location} ; + f_one : forall {L1 I1}, both (L1 :|: f_one_loc) I1 (f_group_type) ; + f_prod_loc : {fset Location} ; + f_prod : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_prod_loc) (I1 :|: I2) (f_group_type) ; + f_inv_loc : {fset Location} ; + f_inv : forall {L1 I1}, both L1 I1 (f_group_type) -> both (L1 :|: f_inv_loc) I1 (f_group_type) ; + f_div_loc : {fset Location} ; + f_div : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_div_loc) (I1 :|: I2) (f_group_type) ; +}. +Hint Unfold f_g_pow_loc. +Hint Unfold f_pow_loc. +Hint Unfold f_one_loc. +Hint Unfold f_prod_loc. +Hint Unfold f_inv_loc. +Hint Unfold f_div_loc. + +Definition t_z_17_ : choice_type := + 'unit. +Equations Build_t_z_17_ : both (fset []) (fset []) (t_z_17_) := + Build_t_z_17_ := + solve_lift (ret_both (tt (* Empty tuple *) : (t_z_17_))) : both (fset []) (fset []) (t_z_17_). +Fail Next Obligation. + +Definition res_loc : Location := + (int32;0%nat). +#[global] Program Instance t_z_17__t_Group : t_Group t_z_17_ := + let f_group_type := int32 : choice_type in + let q := ret_both (17 : int32) : both (fset []) (fset []) (int32) in + let g := ret_both (3 : int32) : both (fset []) (fset []) (int32) in + let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: fset []) I1 (int32) in + let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + let f_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I (int32) in + let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => letb res loc(res_loc) := ret_both (0 : int32) in + letb res := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (1 : int32)) (f_end := q))) (fun i => + ssp (fun res => + letb ii_computation := i in + solve_lift (ifb (f_g_pow i) =.? x + then letb res := ii_computation in + res + else res) : both (*2*)(L1:|:fset [res_loc;res_loc]) (I1) (int32))) res in + solve_lift res : both (L1 :|: fset [res_loc]) I1 (int32) in + let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset [res_loc]) (I1 :|: I2) (int32) in + {| f_group_type := (@f_group_type); + q := (@q); + g := (@g); + f_g_pow_loc := (fset [] : {fset Location}); + f_g_pow := (@f_g_pow); + f_pow_loc := (fset [] : {fset Location}); + f_pow := (@f_pow); + f_one_loc := (fset [] : {fset Location}); + f_one := (@f_one); + f_prod_loc := (fset [] : {fset Location}); + f_prod := (@f_prod); + f_inv_loc := (fset [res_loc] : {fset Location}); + f_inv := (@f_inv); + f_div_loc := (fset [res_loc] : {fset Location}); + f_div := (@f_div)|}. +Solve All Obligations with exact int_eqdec. +Fail Next Obligation. +Hint Unfold t_z_17__t_Group. + +Notation "'t_G'" := (t_z_17_). + +Equations n {L : {fset Location}} {I : Interface} : both L I (uint_size) := + n := + solve_lift (ret_both (20 : uint_size)) : both L I (uint_size). +Fail Next Obligation. + +Definition t_OvnContractState : choice_type := + (nseq f_group_type 20 × nseq int32 20 × nseq int32 20 × nseq f_group_type 20 × nseq int32 20 × int32). +Equations f_g_pow_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type 20) := + f_g_pow_xis s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type 20))) : both L I (nseq f_group_type 20). +Fail Next Obligation. +Equations f_zkp_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := + f_zkp_xis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq int32 20))) : both L I (nseq int32 20). +Fail Next Obligation. +Equations f_commit_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := + f_commit_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : nseq int32 20))) : both L I (nseq int32 20). +Fail Next Obligation. +Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type 20) := + f_g_pow_xi_yi_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type 20))) : both L I (nseq f_group_type 20). +Fail Next Obligation. +Equations f_zkp_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := + f_zkp_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : nseq int32 20))) : both L I (nseq int32 20). +Fail Next Obligation. +Equations f_tally {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (int32) := + f_tally s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {f_g_pow_xis : both L0 I0 (nseq f_group_type 20)} {f_zkp_xis : both L1 I1 (nseq int32 20)} {f_commit_vis : both L2 I2 (nseq int32 20)} {f_g_pow_xi_yi_vis : both L3 I3 (nseq f_group_type 20)} {f_zkp_vis : both L4 I4 (nseq int32 20)} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := + Build_t_OvnContractState := + bind_both f_tally (fun f_tally => + bind_both f_zkp_vis (fun f_zkp_vis => + bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => + bind_both f_commit_vis (fun f_commit_vis => + bind_both f_zkp_xis (fun f_zkp_xis => + bind_both f_g_pow_xis (fun f_g_pow_xis => + solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). +Fail Next Obligation. +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). + +Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {impl_108907986_ : _} `{ t_Sized (impl_108907986_)} `{ t_HasInitContext (impl_108907986_) ('unit)} (_ : both L1 I1 (impl_108907986_)) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)) := + init_ovn_contract _ := + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_xis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_commit_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_g_pow_xi_yi_vis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)). +Fail Next Obligation. + +Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) : both L1 I1 (int32) := + select_private_voting_key random := + solve_lift (random .% q) : both L1 I1 (int32). +Fail Next Obligation. + +Equations v_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi : both L1 I1 (int32)) (xi : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) (int32) := + v_ZKP g_pow_xi xi := + solve_lift (ret_both (0 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). +Fail Next Obligation. + +Definition t_RegisterParam : choice_type := + (int32 × int32). +Equations f_rp_i {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := + f_rp_i s := + bind_both s (fun x => + solve_lift (ret_both (fst x : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_rp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := + f_rp_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (int32)} : both (L0:|:L1) (I0:|:I1) (t_RegisterParam) := + Build_t_RegisterParam := + bind_both f_rp_xi (fun f_rp_xi => + bind_both f_rp_i (fun f_rp_i => + solve_lift (ret_both ((f_rp_i,f_rp_xi) : (t_RegisterParam))))) : both (L0:|:L1) (I0:|:I1) (t_RegisterParam). +Fail Next Obligation. +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y)). + +Definition register_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState;1%nat). +Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := + register_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (Ctx := t_RegisterParam) (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_RegisterParam) := matchb f_branch out with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : ( (t_ParseError))) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist1 := v_Break (f_from_residual residual) in + ControlFlow_Continue (solve_lift (never_to_any hoist1)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (t_RegisterParam)) in + ControlFlow_Continue (solve_lift val) + end in + ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in + letb zkp_xi := v_ZKP g_pow_xi (f_rp_xi params) in + letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in + Result_Ok (prod_b (f_accept,register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. + +Definition t_CastVoteParam : choice_type := + (int32 × int32 × 'bool). +Equations f_cvp_i {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_i s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_cvp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_cvp_vote {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I ('bool) := + f_cvp_vote s := + bind_both s (fun x => + solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). +Fail Next Obligation. +Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (int32)} {f_cvp_vote : both L2 I2 ('bool)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := + Build_t_CastVoteParam := + bind_both f_cvp_vote (fun f_cvp_vote => + bind_both f_cvp_xi (fun f_cvp_xi => + bind_both f_cvp_i (fun f_cvp_i => + solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_vote) : (t_CastVoteParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). +Fail Next Obligation. +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := y)). + +Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (int32)) : both L1 I1 ('bool) := + check_valid zkp := + solve_lift (ret_both (true : 'bool)) : both L1 I1 ('bool). +Fail Next Obligation. + +Definition prod1_loc : Location := + (int32;2%nat). +Definition prod2_loc : Location := + (int32;3%nat). +Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq int32 20)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod1_loc;prod2_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32) := + compute_group_element_for_vote i xi vote xis := + letb prod1 loc(prod1_loc) := f_one in + letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun j => + ssp (fun prod1 => + solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod1_loc;prod1_loc]) (I1:|:I4:|:I1) (f_group_type))) prod1 in + letb prod2 loc(prod2_loc) := f_one in + letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun j => + ssp (fun prod2 => + solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod2_loc;prod2_loc]) (I1:|:I4:|:I1) (f_group_type))) prod2 in + letb v_Yi := f_div prod1 prod2 in + solve_lift (f_prod (f_pow v_Yi xi) (f_g_pow (ifb vote + then ret_both (1 : int32) + else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod1_loc;prod2_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32). +Fail Next Obligation. + +Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) : both L1 I1 (int32) := + commit_to x := + solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). +Fail Next Obligation. + +Definition commit_to_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState;4%nat). +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := + commit_to_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (Ctx := t_CastVoteParam) (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb f_branch out with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : ((* t_Result (t_Infallible) *) (t_ParseError))) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist2 := v_Break (f_from_residual residual) in + ControlFlow_Continue (solve_lift (never_to_any hoist2)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (t_CastVoteParam)) in + ControlFlow_Continue (solve_lift val) + end in + ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (f_zkp_xis state)) (fun zkp => + ssp (fun _ => + letb _ := check_valid zkp in + solve_lift (ret_both (tt : 'unit)) : both (*0*)(L2:|:fset []) (I2) ('unit))) (ret_both (tt : 'unit)) in + letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in + letb commit_vi := commit_to g_pow_xi_yi_vi in + letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in + letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in + Result_Ok (prod_b (f_accept,commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. + +Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (int32)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := + v_ZKP_one_out_of_two g_pow_vi vi := + solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). +Fail Next Obligation. + +Definition cast_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState;5%nat). +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := + cast_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (Ctx := t_CastVoteParam) (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb f_branch out with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : ((* t_Result (t_Infallible) *) (t_ParseError))) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist3 := v_Break (f_from_residual residual) in + ControlFlow_Continue (solve_lift (never_to_any hoist3)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (t_CastVoteParam)) in + ControlFlow_Continue (solve_lift val) + end in + ControlFlow_Continue (letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in + letb zkp_vi := v_ZKP_one_out_of_two g_pow_xi_yi_vi (f_cvp_vote params) in + letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in + Result_Ok (prod_b (f_accept,cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. + +Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + check_valid2 g_pow_xi_yi_vi zkp := + solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + check_commitment g_pow_xi_yi_vi zkp := + solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Definition t_TallyParameter : choice_type := + 'unit. +Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := + Build_t_TallyParameter := + solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). +Fail Next Obligation. + +Definition tally_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (int32;6%nat). +Definition tally_votes_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState;7%nat). +Definition vote_result_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (f_group_type;8%nat). +Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := + tally_votes _ state := + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + ssp (fun _ => + letb _ := check_valid2 ((f_g_pow_xi_yi_vis state).a[i]) ((f_zkp_vis state).a[i]) in + letb _ := check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i]) in + solve_lift (ret_both (tt : 'unit)) : both (*0*)(L2:|:fset []) (I2) ('unit))) (ret_both (tt : 'unit)) in + letb vote_result loc(vote_result_loc) := f_one in + letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => + ssp (fun vote_result => + solve_lift (f_prod vote_result g_pow_vote) : both (*2*)(L2:|:L2:|:fset [vote_result_loc;vote_result_loc]) (I2:|:I2) (f_group_type))) vote_result in + letb tally loc(tally_loc) := ret_both (0 : int32) in + letb tally := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => + ssp (fun tally => + solve_lift (ifb (f_g_pow i) =.? vote_result + then letb tally := i in + tally + else tally) : both (*3*)(L2:|:fset [tally_loc;vote_result_loc;tally_loc]) (I2) (int32))) tally in + letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in + letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in + Result_Ok (solve_lift (prod_b (f_accept,tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. + +(** Concert lib part **) +From ConCert.Utils Require Import Extras. +Export Extras. +From ConCert.Utils Require Import Automation. +Export Automation. +From ConCert.Execution Require Import Serializable. +Export Serializable. +From ConCert.Execution Require Import Blockchain. +Export Blockchain. +From ConCert.Execution Require Import ContractCommon. +Export ContractCommon. +From ConCert.Execution Require Import Serializable. +Export Serializable. +Require Import ConCertLib. +Export ConCertLib. + +Definition state_OVN : choice_type := + t_OvnContractState. + +Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN) (t_ParseError) := + ResultMonad.Ok st. + +#[global] Program Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit := + {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam := + fun x => + x. +Fail Next Obligation. +Definition receive_OVN_register {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_RegisterParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + register_vote ctx st. + +#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := + {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := + fun x => + x. +Fail Next Obligation. +Definition receive_OVN_commit_to_vote {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + commit_to_vote ctx st. + +Definition receive_OVN_cast_vote {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + cast_vote ctx st. + +#[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := + {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_TallyParameter_t_Sized : t_Sized t_TallyParameter := + fun x => + x. +Fail Next Obligation. +Definition receive_OVN_tally {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_TallyParameter)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + tally_votes ctx st. + +Inductive Msg_OVN: Type := +| msg_OVN_register : t_RegisterParam -> Msg_OVN +| msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN +| msg_OVN_cast_vote : t_CastVoteParam -> Msg_OVN +| msg_OVN_tally : t_TallyParameter -> Msg_OVN. +#[global] Program Instance state_OVN_t_HasReceiveContext : t_HasReceiveContext state_OVN 'unit := + {| f_get := (fun (Ctx : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance state_OVN_t_Sized : t_Sized state_OVN := + fun x => + x. +Fail Next Obligation. +#[global] (* Program *) Instance state_OVN_t_HasActions : t_HasActions state_OVN. +Admitted. +Fail Next Obligation. +Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := + receive_OVN chain ctx st msg := + match msg with + | Some (msg_OVN_register val) => + match (is_pure (both_prog (receive_OVN_register (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_OVN_commit_to_vote val) => + match (is_pure (both_prog (receive_OVN_commit_to_vote (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_OVN_cast_vote val) => + match (is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_OVN_tally val) => + match (is_pure (both_prog (receive_OVN_tally (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | _ => + ResultMonad.Err tt + end : ResultMonad.result (state_OVN * list ActionBody) t_ParseError. +Fail Next Obligation. +#[global] Program Instance state_OVN_Serializable : Serializable state_OVN := + _. +Fail Next Obligation. +#[global] Program Instance Msg_OVN_Serializable : Serializable Msg_OVN := + Derive Serializable Msg_OVN_rect. +Fail Next Obligation. +Definition contract_OVN : Contract (state_OVN) (Msg_OVN) (state_OVN) (t_ParseError) := + build_contract init_OVN receive_OVN. diff --git a/ovn/src/ovn.rs b/ovn/src/ovn.rs index 9584587..437e52f 100644 --- a/ovn/src/ovn.rs +++ b/ovn/src/ovn.rs @@ -2,22 +2,51 @@ #![feature(register_tool)] #![register_tool(hax)] -#[hax_lib_macros::skip] +#[hax_lib_macros::exclude] extern crate hax_lib_macros; -#[hax_lib_macros::skip] +#[hax_lib_macros::exclude] use hax_lib_macros::*; -#[skip] +#[exclude] use hacspec_concordium::*; -#[skip] +#[exclude] use hacspec_concordium_derive::*; +pub enum vals { + MyVal, + YourVal (u32), + YourSecondVal (u32, u32), + StrangeVal {a : u32, b : u32, c : u32}, +} + +pub fn test_v() -> vals { + vals::YourVal(32) +} + +pub fn test_vals ( x : vals) -> u32 { + match x { + vals::MyVal => 0, + vals::YourVal(x) => x, + vals::YourSecondVal(x, y) => y, + vals::StrangeVal { a, c, b } => c + } +} + +pub struct alt_test {d : u32, e : u32, f : u32} + +pub fn test_alt_vals ( x : alt_test) -> u32 { + match x { + alt_test { d, f, e } => f + } +} + /** Interface for group implementation */ pub trait Group { - type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; + type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize + ; - const q: u32; // Prime order - const g: Self::group_type; // Generator (elemnent of group) + const q : u32; // Prime order + const g : Self::group_type; // Generator (elemnent of group) fn g_pow(x: u32) -> Self::group_type; fn pow(g: Self::group_type, x: u32) -> Self::group_type; diff --git a/wCCD/Cargo.toml b/wCCD/Cargo.toml new file mode 100644 index 0000000..1e00da2 --- /dev/null +++ b/wCCD/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "hacspec-wccd" +version = "0.1.0" +authors = [""] +edition = "2018" + +[lib] +path = "src/wccd.rs" + +[dependencies] +# hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } +hax-lib-macros = { path = "../../hacspec-v2/hax-lib-macros/" } +# hax-lib-macros = { git = "https://github.com/hacspec/hacspec-v2.git" } +# creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "1cca2320e262b2ec9d28b3c84cba759c96829898" } # branch = master +# concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850" , version = "=2.0.0" , default-features = false } # 0cffb859f736ff6726fa38600428a415d800d7b6 + +# concordium-std = { git = "https://github.com/Concordium/concordium-rust-smart-contracts", rev = "4d4b024b547a1f120f6d6951cbc409c94f8f146a" , version = "*" , default-features = false } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a +# concordium-std-derive = { git = "https://github.com/Concordium/concordium-rust-smart-contracts", rev = "4d4b024b547a1f120f6d6951cbc409c94f8f146a" , version = "*" , default-features = false } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a + +concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850", version = "=2.0.0", default-features = false } + +hacspec-concordium = { path = "../concordium" } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a +hacspec-concordium-derive = { path = "../concordium-derive" } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a + +[features] +hax_compilation = [] + +[dev-dependencies] +# hacspec-dev = { path = "../../utils/dev" } +criterion = "0.3" +rand = "0.8" +quickcheck = "1" +quickcheck_macros = "1" diff --git a/wCCD/proofs/ssprove/extraction/Hacspec_wccd.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd.v new file mode 100644 index 0000000..7b02091 --- /dev/null +++ b/wCCD/proofs/ssprove/extraction/Hacspec_wccd.v @@ -0,0 +1,846 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +Require Import Cis1. +Export Cis1. + +Require Import Concordium_contracts_common. +Export Concordium_contracts_common. + +Require Import Map. +Export Map. + +Require Import Set. +Export Set. + +Notation "'t_ContractTokenId'" := (t_TokenIdUnit). + +Equations v_TOKEN_ID_WCCD {L : {fset Location}} {I : Interface} : both L I (t_TokenIdUnit) := + v_TOKEN_ID_WCCD := + TokenIdUnit : both L I (t_TokenIdUnit). +Fail Next Obligation. + +Equations v_TOKEN_METADATA_URL {L : {fset Location}} {I : Interface} : both L I (chString) := + v_TOKEN_METADATA_URL := + solve_lift (ret_both (https://some.example/token/wccd : chString)) : both L I (chString). +Fail Next Obligation. + +Definition t_AddressState : choice_type := + (int64 × t_HashSet (t_Address) (t_BuildHasherDefault (t_FnvHasher)) (t_Global)). +Equations f_balance {L : {fset Location}} {I : Interface} (s : both L I (t_AddressState)) : both L I (int64) := + f_balance s := + bind_both s (fun x => + solve_lift (ret_both (fst x : int64))) : both L I (int64). +Fail Next Obligation. +Equations f_operators {L : {fset Location}} {I : Interface} (s : both L I (t_AddressState)) : both L I (t_HashSet (t_Address) (t_BuildHasherDefault (t_FnvHasher)) (t_Global)) := + f_operators s := + bind_both s (fun x => + solve_lift (ret_both (snd x : t_HashSet (t_Address) (t_BuildHasherDefault (t_FnvHasher)) (t_Global)))) : both L I (t_HashSet (t_Address) (t_BuildHasherDefault (t_FnvHasher)) (t_Global)). +Fail Next Obligation. +Equations Build_t_AddressState {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_balance : both L0 I0 (int64)} {f_operators : both L1 I1 (t_HashSet (t_Address) (t_BuildHasherDefault (t_FnvHasher)) (t_Global))} : both (L0:|:L1) (I0:|:I1) (t_AddressState) := + Build_t_AddressState := + bind_both f_operators (fun f_operators => + bind_both f_balance (fun f_balance => + solve_lift (ret_both ((f_balance,f_operators) : (t_AddressState))))) : both (L0:|:L1) (I0:|:I1) (t_AddressState). +Fail Next Obligation. +Notation "'Build_t_AddressState' '[' x ']' '(' 'f_balance' ':=' y ')'" := (Build_t_AddressState (f_balance := y) (f_operators := f_operators x)). +Notation "'Build_t_AddressState' '[' x ']' '(' 'f_operators' ':=' y ')'" := (Build_t_AddressState (f_balance := f_balance x) (f_operators := y)). + +Definition t_State : choice_type := + (t_HashMap (t_Address) (t_AddressState) (t_BuildHasherDefault (t_FnvHasher)) (t_Global)). +Equations f_token {L : {fset Location}} {I : Interface} (s : both L I (t_State)) : both L I (t_HashMap (t_Address) (t_AddressState) (t_BuildHasherDefault (t_FnvHasher)) (t_Global)) := + f_token s := + bind_both s (fun x => + solve_lift (ret_both (x : t_HashMap (t_Address) (t_AddressState) (t_BuildHasherDefault (t_FnvHasher)) (t_Global)))) : both L I (t_HashMap (t_Address) (t_AddressState) (t_BuildHasherDefault (t_FnvHasher)) (t_Global)). +Fail Next Obligation. +Equations Build_t_State {L0 : {fset Location}} {I0 : Interface} {f_token : both L0 I0 (t_HashMap (t_Address) (t_AddressState) (t_BuildHasherDefault (t_FnvHasher)) (t_Global))} : both L0 I0 (t_State) := + Build_t_State := + bind_both f_token (fun f_token => + solve_lift (ret_both ((f_token) : (t_State)))) : both L0 I0 (t_State). +Fail Next Obligation. +Notation "'Build_t_State' '[' x ']' '(' 'f_token' ':=' y ')'" := (Build_t_State (f_token := y)). + +Definition t_UnwrapParams : choice_type := + (int64 × t_Address × t_Receiver × t_AdditionalData). +Equations f_amount {L : {fset Location}} {I : Interface} (s : both L I (t_UnwrapParams)) : both L I (int64) := + f_amount s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst x)) : int64))) : both L I (int64). +Fail Next Obligation. +Equations f_owner {L : {fset Location}} {I : Interface} (s : both L I (t_UnwrapParams)) : both L I (t_Address) := + f_owner s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : t_Address))) : both L I (t_Address). +Fail Next Obligation. +Equations f_receiver {L : {fset Location}} {I : Interface} (s : both L I (t_UnwrapParams)) : both L I (t_Receiver) := + f_receiver s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : t_Receiver))) : both L I (t_Receiver). +Fail Next Obligation. +Equations f_data {L : {fset Location}} {I : Interface} (s : both L I (t_UnwrapParams)) : both L I (t_AdditionalData) := + f_data s := + bind_both s (fun x => + solve_lift (ret_both (snd x : t_AdditionalData))) : both L I (t_AdditionalData). +Fail Next Obligation. +Equations Build_t_UnwrapParams {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {f_amount : both L0 I0 (int64)} {f_owner : both L1 I1 (t_Address)} {f_receiver : both L2 I2 (t_Receiver)} {f_data : both L3 I3 (t_AdditionalData)} : both (L0:|:L1:|:L2:|:L3) (I0:|:I1:|:I2:|:I3) (t_UnwrapParams) := + Build_t_UnwrapParams := + bind_both f_data (fun f_data => + bind_both f_receiver (fun f_receiver => + bind_both f_owner (fun f_owner => + bind_both f_amount (fun f_amount => + solve_lift (ret_both ((f_amount,f_owner,f_receiver,f_data) : (t_UnwrapParams))))))) : both (L0:|:L1:|:L2:|:L3) (I0:|:I1:|:I2:|:I3) (t_UnwrapParams). +Fail Next Obligation. +Notation "'Build_t_UnwrapParams' '[' x ']' '(' 'f_amount' ':=' y ')'" := (Build_t_UnwrapParams (f_amount := y) (f_owner := f_owner x) (f_receiver := f_receiver x) (f_data := f_data x)). +Notation "'Build_t_UnwrapParams' '[' x ']' '(' 'f_owner' ':=' y ')'" := (Build_t_UnwrapParams (f_amount := f_amount x) (f_owner := y) (f_receiver := f_receiver x) (f_data := f_data x)). +Notation "'Build_t_UnwrapParams' '[' x ']' '(' 'f_receiver' ':=' y ')'" := (Build_t_UnwrapParams (f_amount := f_amount x) (f_owner := f_owner x) (f_receiver := y) (f_data := f_data x)). +Notation "'Build_t_UnwrapParams' '[' x ']' '(' 'f_data' ':=' y ')'" := (Build_t_UnwrapParams (f_amount := f_amount x) (f_owner := f_owner x) (f_receiver := f_receiver x) (f_data := y)). + +Definition t_WrapParams : choice_type := + (t_Receiver × t_AdditionalData). +Equations f_to {L : {fset Location}} {I : Interface} (s : both L I (t_WrapParams)) : both L I (t_Receiver) := + f_to s := + bind_both s (fun x => + solve_lift (ret_both (fst x : t_Receiver))) : both L I (t_Receiver). +Fail Next Obligation. +Equations f_data {L : {fset Location}} {I : Interface} (s : both L I (t_WrapParams)) : both L I (t_AdditionalData) := + f_data s := + bind_both s (fun x => + solve_lift (ret_both (snd x : t_AdditionalData))) : both L I (t_AdditionalData). +Fail Next Obligation. +Equations Build_t_WrapParams {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_to : both L0 I0 (t_Receiver)} {f_data : both L1 I1 (t_AdditionalData)} : both (L0:|:L1) (I0:|:I1) (t_WrapParams) := + Build_t_WrapParams := + bind_both f_data (fun f_data => + bind_both f_to (fun f_to => + solve_lift (ret_both ((f_to,f_data) : (t_WrapParams))))) : both (L0:|:L1) (I0:|:I1) (t_WrapParams). +Fail Next Obligation. +Notation "'Build_t_WrapParams' '[' x ']' '(' 'f_to' ':=' y ')'" := (Build_t_WrapParams (f_to := y) (f_data := f_data x)). +Notation "'Build_t_WrapParams' '[' x ']' '(' 'f_data' ':=' y ')'" := (Build_t_WrapParams (f_to := f_to x) (f_data := y)). + +Definition t_CustomContractError : choice_type := + chFin (mkpos 3). +Equations CustomContractError_ParseParams {L : {fset Location}} {I : Interface} : both L I t_CustomContractError := + CustomContractError_ParseParams := + solve_lift ret_both (fintype.Ordinal (n:=3) (m:=0) eq_refl : t_CustomContractError) : both L I t_CustomContractError. +Fail Next Obligation. +Equations CustomContractError_LogFull {L : {fset Location}} {I : Interface} : both L I t_CustomContractError := + CustomContractError_LogFull := + solve_lift ret_both (fintype.Ordinal (n:=3) (m:=1) eq_refl : t_CustomContractError) : both L I t_CustomContractError. +Fail Next Obligation. +Equations CustomContractError_LogMalformed {L : {fset Location}} {I : Interface} : both L I t_CustomContractError := + CustomContractError_LogMalformed := + solve_lift ret_both (fintype.Ordinal (n:=3) (m:=2) eq_refl : t_CustomContractError) : both L I t_CustomContractError. +Fail Next Obligation. + +#[global] Program Instance t_CustomContractError_t_From : t_From t_CustomContractError t_ParseError := + let f_from := fun {L1 : {fset Location}} {I1 : Interface} (fe : both L1 I1 (t_ParseError)) => CustomContractError_ParseParams : both (L1 :|: fset []) I1 (t_CustomContractError) in + {| f_from_loc := (fset [] : {fset Location}); + f_from := (@f_from)|}. +Fail Next Obligation. +Hint Unfold t_CustomContractError_t_From. + +Notation "'t_ContractError'" := (t_Cis1Error (t_CustomContractError)). + +Definition t_ContractResult {v_A : _} `{ t_Sized (v_A)} : choice_type := + t_Result (v_A) (t_Cis1Error (t_CustomContractError)). + +#[global] Program Instance t_CustomContractError_t_From : t_From t_CustomContractError t_LogError := + let f_from := fun {L1 : {fset Location}} {I1 : Interface} (le : both L1 I1 (t_LogError)) => solve_lift matchb le with + | LogError_Full => + CustomContractError_LogFull + | LogError_Malformed => + CustomContractError_LogMalformed + end : both (L1 :|: fset []) I1 (t_CustomContractError) in + {| f_from_loc := (fset [] : {fset Location}); + f_from := (@f_from)|}. +Fail Next Obligation. +Hint Unfold t_CustomContractError_t_From. + +#[global] Program Instance t_Cis1Error (t_CustomContractError)_t_From : t_From t_Cis1Error (t_CustomContractError) t_CustomContractError := + let f_from := fun {L1 : {fset Location}} {I1 : Interface} (c : both L1 I1 (t_CustomContractError)) => Cis1Error_Custom (solve_lift c) : both (L1 :|: fset []) I1 (t_Cis1Error (t_CustomContractError)) in + {| f_from_loc := (fset [] : {fset Location}); + f_from := (@f_from)|}. +Fail Next Obligation. +Hint Unfold t_Cis1Error (t_CustomContractError)_t_From. + +Equations new {L : {fset Location}} {I : Interface} : both L I (t_State) := + new := + solve_lift (Build_t_State (f_token := f_default)) : both L I (t_State). +Fail Next Obligation. + +Equations balance {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_State)) (token_id : both L2 I2 (t_TokenIdUnit)) (address : both L3 I3 (t_Address)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_Result (int64) (t_Cis1Error (t_CustomContractError))) := + balance self token_id address := + Result_Ok (solve_lift (unwrap_or (map (get (f_token self) address) (fun s => + f_balance s)) (ret_both (0 : int64)))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_Result (int64) (t_Cis1Error (t_CustomContractError))). +Fail Next Obligation. + +Equations is_operator {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_State)) (address : both L2 I2 (t_Address)) (owner : both L3 I3 (t_Address)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) ('bool) := + is_operator self address owner := + solve_lift (unwrap_or (map (get (f_token self) owner) (fun address_state => + contains (f_operators address_state) address)) (ret_both (false : 'bool))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) ('bool). +Fail Next Obligation. + +Equations transfer {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} (self : both L1 I1 (t_State)) (token_id : both L2 I2 (t_TokenIdUnit)) (amount : both L3 I3 (int64)) (from : both L4 I4 (t_Address)) (to : both L5 I5 (t_Address)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5) (I1 :|: I2 :|: I3 :|: I4 :|: I5) (t_Result ('unit) (t_Cis1Error (t_CustomContractError))) := + transfer self token_id amount from to := + solve_lift (run (letm[choice_typeMonad.result_bind_code ((t_State × t_Result ('unit) (t_Cis1Error (t_CustomContractError))))] _ := ifb amount =.? (ret_both (0 : int64)) + then letm[choice_typeMonad.result_bind_code ((t_State × t_Result ('unit) (t_Cis1Error (t_CustomContractError))))] hoist85 := v_Break (prod_b (self,Result_Ok (ret_both (tt : 'unit)))) in + ControlFlow_Continue (never_to_any hoist85) + else ControlFlow_Continue (ret_both (tt : 'unit)) in + ControlFlow_Continue (failure (ret_both ((RefMut) The mutation of this &mut is not allowed here. + : chString)) (ret_both ({ + let from_state: &mut hacspec_wccd::t_AddressState = { + (match core::ops::try_trait::f_branch(core::option::ok_or( + hashbrown::map::get_mut(&mut (proj_hacspec_wccd::f_token(self)), &(deref(from))), + hacspec_wccd::cis1::Cis1Error_InsufficientFunds(), + )) { + core::ops::control_flow::ControlFlow_Break(residual) => { + rust_primitives::hax::never_to_any( + (return Tuple2(self, core::ops::try_trait::f_from_residual(residual))), + ) + } + core::ops::control_flow::ControlFlow_Continue(val) => val, + }) + }; + { + let _: tuple0 = { + { + (if core::ops::bit::Not::not(core::cmp::PartialOrd::ge( + proj_hacspec_wccd::f_balance(deref(from_state)), + amount, + )) { + rust_primitives::hax::never_to_any({ + { + (return Tuple2( + self, + core::result::Result_Err( + hacspec_wccd::cis1::Cis1Error_InsufficientFunds(), + ), + )) + } + }) + }) + } + }; + { + let _: tuple0 = { + (deref(from_state).f_balance = core::ops::arith::Sub::sub( + proj_hacspec_wccd::f_balance(deref(from_state)), + amount, + )) + }; + { + let to_state: &mut hacspec_wccd::t_AddressState = { + hashbrown::map::or_insert_with( + hashbrown::map::entry( + &mut (proj_hacspec_wccd::f_token(self)), + deref(to), + ), + (|| hacspec_wccd::AddressState { + f_balance: 0, + f_operators: core::default::f_default(), + }), + ) + }; + { + let _: tuple0 = { + (deref(to_state).f_balance = core::ops::arith::Add::add( + proj_hacspec_wccd::f_balance(deref(to_state)), + amount, + )) + }; + { + let output: core::result::t_Result< + tuple0, + hacspec_wccd::cis1::t_Cis1Error< + hacspec_wccd::t_CustomContractError, + >, + > = { + { + core::result::Result_Ok(Tuple0()) + } + }; + Tuple2(self, output) + } + } + } + } + } + } : chString))))) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5) (I1 :|: I2 :|: I3 :|: I4 :|: I5) (t_Result ('unit) (t_Cis1Error (t_CustomContractError))). +Fail Next Obligation. + +Equations add_operator {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_State)) (owner : both L2 I2 (t_Address)) (operator : both L3 I3 (t_Address)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) ('unit) := + add_operator self owner operator := + solve_lift (failure (ret_both ((RefMut) The mutation of this &mut is not allowed here. + : chString)) (ret_both ({ + let address_state: &mut hacspec_wccd::t_AddressState = { + hashbrown::map::or_insert_with( + hashbrown::map::entry(&mut (proj_hacspec_wccd::f_token(self)), deref(owner)), + (|| hacspec_wccd::AddressState { + f_balance: 0, + f_operators: core::default::f_default(), + }), + ) + }; + { + let _: bool = { + hashbrown::set::insert( + &mut (proj_hacspec_wccd::f_operators(deref(address_state))), + deref(operator), + ) + }; + self + } + } : chString))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) ('unit). +Fail Next Obligation. + +Equations remove_operator {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_State)) (owner : both L2 I2 (t_Address)) (operator : both L3 I3 (t_Address)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_State) := + remove_operator self owner operator := + letb _ := failure (ret_both ((RefMut) Fatal error: something we considered as impossible occurred! Please report this by submitting an issue on GitHub! +Details: expected an arrow type here + : chString)) (ret_both (core::option::map( + hashbrown::map::get_mut(&mut (proj_hacspec_wccd::f_token(self)), &(deref(owner))), + (|address_state| { + hashbrown::set::remove( + &mut (proj_hacspec_wccd::f_operators(deref(address_state))), + &(deref(operator)), + ) + }), + ) : chString)) in + solve_lift self : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_State). +Fail Next Obligation. + +Equations mint {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (self : both L1 I1 (t_State)) (token_id : both L2 I2 (t_TokenIdUnit)) (amount : both L3 I3 (int64)) (owner : both L4 I4 (t_Address)) : both (L1 :|: L2 :|: L3 :|: L4) (I1 :|: I2 :|: I3 :|: I4) (t_Result ('unit) (t_Cis1Error (t_CustomContractError))) := + mint self token_id amount owner := + solve_lift (failure (ret_both ((RefMut) The mutation of this &mut is not allowed here. + : chString)) (ret_both ({ + let address_state: &mut hacspec_wccd::t_AddressState = { + hashbrown::map::or_insert_with( + hashbrown::map::entry(&mut (proj_hacspec_wccd::f_token(self)), deref(owner)), + (|| hacspec_wccd::AddressState { + f_balance: 0, + f_operators: core::default::f_default(), + }), + ) + }; + { + let _: tuple0 = { + (deref(address_state).f_balance = core::ops::arith::Add::add( + proj_hacspec_wccd::f_balance(deref(address_state)), + amount, + )) + }; + { + let output: core::result::t_Result< + tuple0, + hacspec_wccd::cis1::t_Cis1Error, + > = { + { + core::result::Result_Ok(Tuple0()) + } + }; + Tuple2(self, output) + } + } + } : chString))) : both (L1 :|: L2 :|: L3 :|: L4) (I1 :|: I2 :|: I3 :|: I4) (t_Result ('unit) (t_Cis1Error (t_CustomContractError))). +Fail Next Obligation. + +Equations burn {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (self : both L1 I1 (t_State)) (token_id : both L2 I2 (t_TokenIdUnit)) (amount : both L3 I3 (int64)) (owner : both L4 I4 (t_Address)) : both (L1 :|: L2 :|: L3 :|: L4) (I1 :|: I2 :|: I3 :|: I4) (t_Result ('unit) (t_Cis1Error (t_CustomContractError))) := + burn self token_id amount owner := + solve_lift (run (letm[choice_typeMonad.result_bind_code ((t_State × t_Result ('unit) (t_Cis1Error (t_CustomContractError))))] _ := ifb amount =.? (ret_both (0 : int64)) + then letm[choice_typeMonad.result_bind_code ((t_State × t_Result ('unit) (t_Cis1Error (t_CustomContractError))))] hoist86 := v_Break (prod_b (self,Result_Ok (ret_both (tt : 'unit)))) in + ControlFlow_Continue (never_to_any hoist86) + else ControlFlow_Continue (ret_both (tt : 'unit)) in + ControlFlow_Continue (failure (ret_both ((RefMut) The mutation of this &mut is not allowed here. + : chString)) (ret_both ({ + let from_state: &mut hacspec_wccd::t_AddressState = { + (match core::ops::try_trait::f_branch(core::option::ok_or( + hashbrown::map::get_mut(&mut (proj_hacspec_wccd::f_token(self)), &(deref(owner))), + hacspec_wccd::cis1::Cis1Error_InsufficientFunds(), + )) { + core::ops::control_flow::ControlFlow_Break(residual) => { + rust_primitives::hax::never_to_any( + (return Tuple2(self, core::ops::try_trait::f_from_residual(residual))), + ) + } + core::ops::control_flow::ControlFlow_Continue(val) => val, + }) + }; + { + let _: tuple0 = { + { + (if core::ops::bit::Not::not(core::cmp::PartialOrd::ge( + proj_hacspec_wccd::f_balance(deref(from_state)), + amount, + )) { + rust_primitives::hax::never_to_any({ + { + (return Tuple2( + self, + core::result::Result_Err( + hacspec_wccd::cis1::Cis1Error_InsufficientFunds(), + ), + )) + } + }) + }) + } + }; + { + let _: tuple0 = { + (deref(from_state).f_balance = core::ops::arith::Sub::sub( + proj_hacspec_wccd::f_balance(deref(from_state)), + amount, + )) + }; + { + let output: core::result::t_Result< + tuple0, + hacspec_wccd::cis1::t_Cis1Error, + > = { + { + core::result::Result_Ok(Tuple0()) + } + }; + Tuple2(self, output) + } + } + } + } : chString))))) : both (L1 :|: L2 :|: L3 :|: L4) (I1 :|: I2 :|: I3 :|: I4) (t_Result ('unit) (t_Cis1Error (t_CustomContractError))). +Fail Next Obligation. + +Equations contract_init {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {impl_108907986_ : _} {impl_88511815_ : _} `{ t_Sized (impl_108907986_)} `{ t_Sized (impl_88511815_)} `{ t_HasInitContext (impl_108907986_) ('unit)} `{ t_HasLogger (impl_88511815_)} (ctx : both L1 I1 (impl_108907986_)) (logger : both L2 I2 (impl_88511815_)) : both (L1 :|: L2) (I1 :|: I2) ((impl_88511815_ × t_Result (t_State) (t_Reject))) := + contract_init ctx logger := + letb state := new in + letb invoker := Address_Account (f_init_origin ctx) in + letb output := Result_Ok state in + solve_lift (prod_b (logger,output)) : both (L1 :|: L2) (I1 :|: I2) ((impl_88511815_ × t_Result (t_State) (t_Reject))). +Fail Next Obligation. + +Definition state_ret_loc {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} : Location := + (t_State;0%nat). +Equations contract_wrap {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} (ctx : both L1 I1 (impl_574521470_)) (amount : both L2 I2 (t_Amount)) (logger : both L3 I3 (impl_88511815_)) (state : both L4 I4 (t_State)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [state_ret_loc]) (I1 :|: I2 :|: I3 :|: I4) (t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))) := + contract_wrap ctx amount logger state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))] (params:t_WrapParams) := matchb f_branch out with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))] hoist87 := v_Break (f_from_residual residual) in + ControlFlow_Continue (never_to_any hoist87) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + letb sender := f_sender ctx in + letb receive_address := address (f_to params) in + letb '(tmp0,out) := mint state v_TOKEN_ID_WCCD (f_micro_ccd amount) receive_address in + letb state := tmp0 in + letb hoist89 := out in + letb hoist90 := f_branch hoist89 in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))] _ := matchb hoist90 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))] hoist88 := v_Break (f_from_residual residual) in + ControlFlow_Continue (never_to_any hoist88) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb state_ret loc(state_ret_loc) := f_clone state in + matchb f_to params with + | Receiver_Contract address function => + letb parameter := Build_t_OnReceivingCis1Params (f_token_id := v_TOKEN_ID_WCCD) (f_amount := f_micro_ccd amount) (f_from := sender) (f_contract_name := new_unchecked (f_from (ret_both (init_CIS1-wCCD : chString)))) (f_data := f_data params) in + letb param_bytes := to_bytes parameter in + Result_Ok (prod_b (f_send_raw address (as_ref function) zero (f_deref param_bytes),state_ret)) + | _ => + Result_Ok (prod_b (f_accept,state_ret)) + end))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [state_ret_loc]) (I1 :|: I2 :|: I3 :|: I4) (t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))). +Fail Next Obligation. + +Definition state_ret_loc {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} : Location := + (t_State;1%nat). +Equations contract_unwrap {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} (ctx : both L1 I1 (impl_574521470_)) (logger : both L2 I2 (impl_88511815_)) (state : both L3 I3 (t_State)) : both (L1 :|: L2 :|: L3 :|: fset [state_ret_loc]) (I1 :|: I2 :|: I3) ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))) := + contract_unwrap ctx logger state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] (params:t_UnwrapParams) := matchb f_branch out with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] hoist91 := v_Break (prod_b (logger,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist91) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + letb sender := f_sender ctx in + letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] _ := ifb not (orb (sender =.? (f_owner params)) (is_operator state sender (f_owner params))) + then letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] hoist92 := v_Break (prod_b (logger,Result_Err Cis1Error_Unauthorized)) in + ControlFlow_Continue (never_to_any hoist92) + else ControlFlow_Continue (ret_both (tt : 'unit)) in + letb '(tmp0,out) := burn state v_TOKEN_ID_WCCD (f_amount params) (f_owner params) in + letb state := tmp0 in + letb hoist94 := out in + letb hoist95 := f_branch hoist94 in + letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] _ := matchb hoist95 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] hoist93 := v_Break (prod_b (logger,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist93) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb unwrapped_amount := from_micro_ccd (f_amount params) in + letb action := matchb f_receiver params with + | Receiver_Account address => + f_simple_transfer address unwrapped_amount + | Receiver_Contract address function => + f_send_raw address (as_ref function) unwrapped_amount (f_as_ref (f_data params)) + end in + letb state_ret loc(state_ret_loc) := f_clone state in + letb output := Result_Ok (prod_b (action,state_ret)) in + prod_b (logger,output)))) : both (L1 :|: L2 :|: L3 :|: fset [state_ret_loc]) (I1 :|: I2 :|: I3) ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))). +Fail Next Obligation. + +Notation "'t_TransferParameter'" := (t_TransferParams (t_TokenIdUnit)). + +Definition actions_loc {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} : Location := + (v_A;2%nat). +Definition cursor_loc {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} : Location := + (f_ParamType;3%nat). +Definition state_ret_loc {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} : Location := + (t_State;4%nat). +Equations contract_transfer {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} (ctx : both L1 I1 (impl_574521470_)) (logger : both L2 I2 (impl_88511815_)) (state : both L3 I3 (t_State)) : both (L1 :|: L2 :|: L3 :|: fset [actions_loc;cursor_loc;state_ret_loc]) (I1 :|: I2 :|: I3) ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))) := + contract_transfer ctx logger state := + solve_lift (run (letb cursor loc(cursor_loc) := f_parameter_cursor ctx in + letb '(tmp0,out) := f_get cursor in + letb cursor := tmp0 in + letb hoist97 := out in + letb hoist98 := f_branch hoist97 in + letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] (transfers_length:int8) := matchb hoist98 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] hoist96 := v_Break (prod_b (logger,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist96) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb sender := f_sender ctx in + letb actions loc(actions_loc) := f_accept in + letb '(actions,cursor,state) := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int8)) (f_end := transfers_length))) (fun _ => + ssp (fun '(actions,cursor,state) => + letb '(tmp0,out) := f_get cursor in + letb cursor := tmp0 in + letb hoist100 := out in + letb hoist101 := f_branch hoist100 in + letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] {| + f_token_id := token_id; + f_amount := amount; + f_from := from; + f_to := to; + f_data := data; + |} := matchb hoist101 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] hoist99 := v_Break (prod_b (logger,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist99) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] _ := ifb not (orb (from =.? sender) (is_operator state sender from)) + then letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] hoist102 := v_Break (prod_b (logger,Result_Err Cis1Error_Unauthorized)) in + ControlFlow_Continue (never_to_any hoist102) + else ControlFlow_Continue (ret_both (tt : 'unit)) in + letb to_address := address to in + letb '(tmp0,out) := transfer state token_id amount from to_address in + letb state := tmp0 in + letb hoist104 := out in + letb hoist105 := f_branch hoist104 in + letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] _ := matchb hoist105 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] hoist103 := v_Break (prod_b (logger,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist103) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (solve_lift matchb to with + | Receiver_Contract address function => + letb parameter := Build_t_OnReceivingCis1Params (f_token_id := token_id) (f_amount := amount) (f_from := from) (f_contract_name := new_unchecked (f_from (ret_both (init_CIS1-Multi : chString)))) (f_data := data) in + letb action := f_accept in + letb actions := f_and_then actions action in + prod_b (actions,cursor,state) + | _ => + prod_b (actions,cursor,state) + end) : both (*5*)(L1:|:L2:|:L3:|:L1:|:L2:|:L1:|:L3:|:fset [actions_loc;cursor_loc;cursor_loc;actions_loc;cursor_loc]) (I1:|:I2:|:I3:|:I1:|:I2:|:I1:|:I3) (t_ControlFlow ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))) ((v_A × f_ParamType × t_State))))) (prod_b (actions,cursor,state)) in + letb state_ret loc(state_ret_loc) := f_clone state in + letb output := Result_Ok (prod_b (actions,state_ret)) in + prod_b (logger,output)))) : both (L1 :|: L2 :|: L3 :|: fset [actions_loc;cursor_loc;state_ret_loc]) (I1 :|: I2 :|: I3) ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))). +Fail Next Obligation. + +Definition state_ret_loc {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} : Location := + (t_State;5%nat). +Equations contract_update_operator {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} (ctx : both L1 I1 (impl_574521470_)) (logger : both L2 I2 (impl_88511815_)) (state : both L3 I3 (t_State)) : both (L1 :|: L2 :|: L3 :|: fset [state_ret_loc]) (I1 :|: I2 :|: I3) ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))) := + contract_update_operator ctx logger state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] UpdateOperatorParams params := matchb f_branch out with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] hoist106 := v_Break (prod_b (logger,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist106) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb sender := f_sender ctx in + letb state := foldi_both_list (f_into_iter params) (fun param => + ssp (fun state => + solve_lift matchb f_update param with + | OperatorUpdate_Add => + add_operator state sender (f_operator param) + | OperatorUpdate_Remove => + remove_operator state sender (f_operator param) + end : both (*0*)(L1:|:L2:|:L3:|:L1:|:L2:|:L3:|:fset []) (I1:|:I2:|:I3:|:I1:|:I2:|:I3) (t_State))) state in + letb state_ret loc(state_ret_loc) := f_clone state in + letb output := Result_Ok (prod_b (f_accept,state_ret)) in + prod_b (logger,output)))) : both (L1 :|: L2 :|: L3 :|: fset [state_ret_loc]) (I1 :|: I2 :|: I3) ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))). +Fail Next Obligation. + +Notation "'t_ContractBalanceOfQueryParams'" := (t_BalanceOfQueryParams (t_TokenIdUnit)). + +Equations contract_balance_of {L : {fset Location}} {I : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : both L I (t_Never) := + contract_balance_of := + solve_lift (failure (ret_both ((AST import) Fatal error: something we considered as impossible occurred! Please report this by submitting an issue on GitHub! +Details: [import_thir:literal] got an error literal: this means the Rust compiler or Hax's frontend probably reported errors above. + : chString)) (ret_both ({ Types.attributes = []; + contents = + Types.Literal { + lit = + { Types.node = Types.Err; + span = + { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/wccd.rs")); + hi = { Types.col = "0"; line = "1" }; + lo = { Types.col = "0"; line = "1" } } + }; + neg = false}; + hir_id = None; + span = + { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/wccd.rs")); + hi = { Types.col = "61"; line = "540" }; + lo = { Types.col = "0"; line = "537" } }; + ty = Types.Never } : chString))) : both L I (t_Never). +Fail Next Obligation. + +Equations contract_operator_of {L : {fset Location}} {I : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : both L I (t_Never) := + contract_operator_of := + solve_lift (failure (ret_both ((AST import) Fatal error: something we considered as impossible occurred! Please report this by submitting an issue on GitHub! +Details: [import_thir:literal] got an error literal: this means the Rust compiler or Hax's frontend probably reported errors above. + : chString)) (ret_both ({ Types.attributes = []; + contents = + Types.Literal { + lit = + { Types.node = Types.Err; + span = + { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/wccd.rs")); + hi = { Types.col = "0"; line = "1" }; + lo = { Types.col = "0"; line = "1" } } + }; + neg = false}; + hir_id = None; + span = + { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/wccd.rs")); + hi = { Types.col = "61"; line = "580" }; + lo = { Types.col = "0"; line = "577" } }; + ty = Types.Never } : chString))) : both L I (t_Never). +Fail Next Obligation. + +Notation "'t_ContractTokenMetadataQueryParams'" := (t_TokenMetadataQueryParams (t_TokenIdUnit)). + +Equations contract_token_metadata {L : {fset Location}} {I : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : both L I (t_Never) := + contract_token_metadata := + solve_lift (failure (ret_both ((AST import) Fatal error: something we considered as impossible occurred! Please report this by submitting an issue on GitHub! +Details: [import_thir:literal] got an error literal: this means the Rust compiler or Hax's frontend probably reported errors above. + : chString)) (ret_both ({ Types.attributes = []; + contents = + Types.Literal { + lit = + { Types.node = Types.Err; + span = + { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/wccd.rs")); + hi = { Types.col = "0"; line = "1" }; + lo = { Types.col = "0"; line = "1" } } + }; + neg = false}; + hir_id = None; + span = + { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/wccd.rs")); + hi = { Types.col = "61"; line = "623" }; + lo = { Types.col = "0"; line = "620" } }; + ty = Types.Never } : chString))) : both L I (t_Never). +Fail Next Obligation. + +(** Concert lib part **) +From ConCert.Utils Require Import Extras. +Export Extras. +From ConCert.Utils Require Import Automation. +Export Automation. +From ConCert.Execution Require Import Serializable. +Export Serializable. +From ConCert.Execution Require Import Blockchain. +Export Blockchain. +From ConCert.Execution Require Import ContractCommon. +Export ContractCommon. +From ConCert.Execution Require Import Serializable. +Export Serializable. +Require Import ConCertLib. +Export ConCertLib. + +Definition state_CIS1-wCCD : choice_type := + t_State. + +Definition init_CIS1-wCCD (chain : Chain) (ctx : ContractCallContext) (st : state_CIS1-wCCD) : ResultMonad.result (state_CIS1-wCCD) (t_ParseError) := + ResultMonad.Ok st. + +#[global] Program Instance t_WrapParams_t_HasReceiveContext : t_HasReceiveContext t_WrapParams 'unit := + {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_WrapParams_t_Sized : t_Sized t_WrapParams := + {| Sized := (fun (x : _) => x : _)|}. +Fail Next Obligation. +Definition receive_CIS1-wCCD_wrap {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_WrapParams)) (st : both L1 I1 (state_CIS1-wCCD)) : both _ _ (t_Result ((v_A × state_CIS1-wCCD)) (t_ParseError)) := + contract_wrap ctx st. + +#[global] Program Instance t_UnwrapParams_t_HasReceiveContext : t_HasReceiveContext t_UnwrapParams 'unit := + {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_UnwrapParams_t_Sized : t_Sized t_UnwrapParams := + {| Sized := (fun (x : _) => x : _)|}. +Fail Next Obligation. +Definition receive_CIS1-wCCD_unwrap {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_UnwrapParams)) (st : both L1 I1 (state_CIS1-wCCD)) : both _ _ (t_Result ((v_A × state_CIS1-wCCD)) (t_ParseError)) := + contract_unwrap ctx st. + +#[global] Program Instance t_TransferParameter_t_HasReceiveContext : t_HasReceiveContext t_TransferParameter 'unit := + {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_TransferParameter_t_Sized : t_Sized t_TransferParameter := + {| Sized := (fun (x : _) => x : _)|}. +Fail Next Obligation. +Definition receive_CIS1-wCCD_transfer {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_TransferParameter)) (st : both L1 I1 (state_CIS1-wCCD)) : both _ _ (t_Result ((v_A × state_CIS1-wCCD)) (t_ParseError)) := + contract_transfer ctx st. + +#[global] Program Instance t_UpdateOperatorParams_t_HasReceiveContext : t_HasReceiveContext t_UpdateOperatorParams 'unit := + {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_UpdateOperatorParams_t_Sized : t_Sized t_UpdateOperatorParams := + {| Sized := (fun (x : _) => x : _)|}. +Fail Next Obligation. +Definition receive_CIS1-wCCD_updateOperator {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_UpdateOperatorParams)) (st : both L1 I1 (state_CIS1-wCCD)) : both _ _ (t_Result ((v_A × state_CIS1-wCCD)) (t_ParseError)) := + contract_update_operator ctx st. + +#[global] Program Instance t_ContractBalanceOfQueryParams_t_HasReceiveContext : t_HasReceiveContext t_ContractBalanceOfQueryParams 'unit := + {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_ContractBalanceOfQueryParams_t_Sized : t_Sized t_ContractBalanceOfQueryParams := + {| Sized := (fun (x : _) => x : _)|}. +Fail Next Obligation. +Definition receive_CIS1-wCCD_balanceOf {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_ContractBalanceOfQueryParams)) (st : both L1 I1 (state_CIS1-wCCD)) : both _ _ (t_Result ((v_A × state_CIS1-wCCD)) (t_ParseError)) := + contract_balance_of ctx st. + +#[global] Program Instance t_OperatorOfQueryParams_t_HasReceiveContext : t_HasReceiveContext t_OperatorOfQueryParams 'unit := + {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_OperatorOfQueryParams_t_Sized : t_Sized t_OperatorOfQueryParams := + {| Sized := (fun (x : _) => x : _)|}. +Fail Next Obligation. +Definition receive_CIS1-wCCD_operatorOf {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_OperatorOfQueryParams)) (st : both L1 I1 (state_CIS1-wCCD)) : both _ _ (t_Result ((v_A × state_CIS1-wCCD)) (t_ParseError)) := + contract_operator_of ctx st. + +#[global] Program Instance t_ContractTokenMetadataQueryParams_t_HasReceiveContext : t_HasReceiveContext t_ContractTokenMetadataQueryParams 'unit := + {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_ContractTokenMetadataQueryParams_t_Sized : t_Sized t_ContractTokenMetadataQueryParams := + {| Sized := (fun (x : _) => x : _)|}. +Fail Next Obligation. +Definition receive_CIS1-wCCD_tokenMetadata {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_ContractTokenMetadataQueryParams)) (st : both L1 I1 (state_CIS1-wCCD)) : both _ _ (t_Result ((v_A × state_CIS1-wCCD)) (t_ParseError)) := + contract_token_metadata ctx st. + +Inductive Msg_CIS1-wCCD: Type := +| msg_CIS1-wCCD_wrap : t_WrapParams -> Msg_CIS1-wCCD +| msg_CIS1-wCCD_unwrap : t_UnwrapParams -> Msg_CIS1-wCCD +| msg_CIS1-wCCD_transfer : t_TransferParameter -> Msg_CIS1-wCCD +| msg_CIS1-wCCD_updateOperator : t_UpdateOperatorParams -> Msg_CIS1-wCCD +| msg_CIS1-wCCD_balanceOf : t_ContractBalanceOfQueryParams -> Msg_CIS1-wCCD +| msg_CIS1-wCCD_operatorOf : t_OperatorOfQueryParams -> Msg_CIS1-wCCD +| msg_CIS1-wCCD_tokenMetadata : t_ContractTokenMetadataQueryParams -> Msg_CIS1-wCCD. +#[global] Program Instance state_CIS1-wCCD_t_HasReceiveContext : t_HasReceiveContext state_CIS1-wCCD 'unit := + {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance state_CIS1-wCCD_t_Sized : t_Sized state_CIS1-wCCD := + {| Sized := (fun (x : _) => x : _)|}. +Fail Next Obligation. +#[global] Program Instance state_CIS1-wCCD_t_HasActions : t_HasActions state_CIS1-wCCD := + _. +Fail Next Obligation. +Equations receive_CIS1-wCCD (chain : Chain) (ctx : ContractCallContext) (st : state_CIS1-wCCD) (msg : Datatypes.option Msg_CIS1-wCCD) : ResultMonad.result (state_CIS1-wCCD * list ActionBody) t_ParseError := + receive_CIS1-wCCD chain ctx st msg := + matchb msg with + | Some (msg_CIS1-wCCD_wrap val) => + match (is_pure (both_prog (receive_CIS1-wCCD_wrap (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_CIS1-wCCD_unwrap val) => + match (is_pure (both_prog (receive_CIS1-wCCD_unwrap (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_CIS1-wCCD_transfer val) => + match (is_pure (both_prog (receive_CIS1-wCCD_transfer (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_CIS1-wCCD_updateOperator val) => + match (is_pure (both_prog (receive_CIS1-wCCD_updateOperator (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_CIS1-wCCD_balanceOf val) => + match (is_pure (both_prog (receive_CIS1-wCCD_balanceOf (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_CIS1-wCCD_operatorOf val) => + match (is_pure (both_prog (receive_CIS1-wCCD_operatorOf (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_CIS1-wCCD_tokenMetadata val) => + match (is_pure (both_prog (receive_CIS1-wCCD_tokenMetadata (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | _ => + ResultMonad.Err tt + end : ResultMonad.result (state_CIS1-wCCD * list ActionBody) t_ParseError. +Fail Next Obligation. +#[global] Program Instance state_CIS1-wCCD_Serializable : Serializable state_CIS1-wCCD := + _. +Fail Next Obligation. +#[global] Program Instance Msg_CIS1-wCCD_Serializable : Serializable Msg_CIS1-wCCD := + Derive Serializable Msg_OVN_rect. +Fail Next Obligation. +Definition contract_CIS1-wCCD : Contract (state_CIS1-wCCD) (Msg_CIS1-wCCD) (state_CIS1-wCCD) (t_ParseError) := + build_contract init_CIS1-wCCD receive_CIS1-wCCD. diff --git a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Cis1.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Cis1.v new file mode 100644 index 0000000..6d1d45b --- /dev/null +++ b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Cis1.v @@ -0,0 +1,1881 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_concordium. +Export Hacspec_concordium. + +Require Import Box. +Export Box. + +Require Import TryFrom. +Export TryFrom. + +Require Import NonZeroI32. +Export NonZeroI32. + +Equations v_TRANSFER_EVENT_TAG {L : {fset Location}} {I : Interface} : both L I (int8) := + v_TRANSFER_EVENT_TAG := + solve_lift (ret_both (255 : int8)) : both L I (int8). +Fail Next Obligation. + +Equations v_MINT_EVENT_TAG {L : {fset Location}} {I : Interface} : both L I (int8) := + v_MINT_EVENT_TAG := + solve_lift ((ret_both (255 : int8)) .- (ret_both (1 : int8))) : both L I (int8). +Fail Next Obligation. + +Equations v_BURN_EVENT_TAG {L : {fset Location}} {I : Interface} : both L I (int8) := + v_BURN_EVENT_TAG := + solve_lift ((ret_both (255 : int8)) .- (ret_both (2 : int8))) : both L I (int8). +Fail Next Obligation. + +Equations v_UPDATE_OPERATOR_EVENT_TAG {L : {fset Location}} {I : Interface} : both L I (int8) := + v_UPDATE_OPERATOR_EVENT_TAG := + solve_lift ((ret_both (255 : int8)) .- (ret_both (3 : int8))) : both L I (int8). +Fail Next Obligation. + +Equations v_TOKEN_METADATA_EVENT_TAG {L : {fset Location}} {I : Interface} : both L I (int8) := + v_TOKEN_METADATA_EVENT_TAG := + solve_lift ((ret_both (255 : int8)) .- (ret_both (4 : int8))) : both L I (int8). +Fail Next Obligation. + +Notation "'t_Sha256'" := (nseq int8 32). + +Definition t_MetadataUrl : choice_type := + (t_String × t_Option (nseq int8 32)). +Equations f_url {L : {fset Location}} {I : Interface} (s : both L I (t_MetadataUrl)) : both L I (t_String) := + f_url s := + bind_both s (fun x => + solve_lift (ret_both (fst x : t_String))) : both L I (t_String). +Fail Next Obligation. +Equations f_hash {L : {fset Location}} {I : Interface} (s : both L I (t_MetadataUrl)) : both L I (t_Option (nseq int8 32)) := + f_hash s := + bind_both s (fun x => + solve_lift (ret_both (snd x : t_Option (nseq int8 32)))) : both L I (t_Option (nseq int8 32)). +Fail Next Obligation. +Equations Build_t_MetadataUrl {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_url : both L0 I0 (t_String)} {f_hash : both L1 I1 (t_Option (nseq int8 32))} : both (L0:|:L1) (I0:|:I1) (t_MetadataUrl) := + Build_t_MetadataUrl := + bind_both f_hash (fun f_hash => + bind_both f_url (fun f_url => + solve_lift (ret_both ((f_url,f_hash) : (t_MetadataUrl))))) : both (L0:|:L1) (I0:|:I1) (t_MetadataUrl). +Fail Next Obligation. +Notation "'Build_t_MetadataUrl' '[' x ']' '(' 'f_url' ':=' y ')'" := (Build_t_MetadataUrl (f_url := y) (f_hash := f_hash x)). +Notation "'Build_t_MetadataUrl' '[' x ']' '(' 'f_hash' ':=' y ')'" := (Build_t_MetadataUrl (f_url := f_url x) (f_hash := y)). + +Class t_IsTokenId (Self : choice_type) := { +}. + +Definition t_TokenIdVec : choice_type := + (t_Vec (int8) (t_Global)). +Equations 0 {L : {fset Location}} {I : Interface} (s : both L I (t_TokenIdVec)) : both L I (t_Vec (int8) (t_Global)) := + 0 s := + bind_both s (fun x => + solve_lift (ret_both (x : t_Vec (int8) (t_Global)))) : both L I (t_Vec (int8) (t_Global)). +Fail Next Obligation. +Equations Build_t_TokenIdVec {L0 : {fset Location}} {I0 : Interface} {0 : both L0 I0 (t_Vec (int8) (t_Global))} : both L0 I0 (t_TokenIdVec) := + Build_t_TokenIdVec := + bind_both 0 (fun 0 => + solve_lift (ret_both ((0) : (t_TokenIdVec)))) : both L0 I0 (t_TokenIdVec). +Fail Next Obligation. +Notation "'Build_t_TokenIdVec' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_TokenIdVec (0 := y)). + +#[global] Program Instance t_TokenIdVec_t_IsTokenId : t_IsTokenId t_TokenIdVec := + _. +Fail Next Obligation. +Hint Unfold t_TokenIdVec_t_IsTokenId. + +#[global] Program Instance t_TokenIdVec_t_SchemaType : t_SchemaType t_TokenIdVec := + let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_List SizeLength_U8 Type_U8 : both (L :|: fset []) I (t_Type) in + {| f_get_type_loc := (fset [] : {fset Location}); + f_get_type := (@f_get_type)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdVec_t_SchemaType. + +Definition t_TokenIdFixed {v_N : both (fset []) (fset []) (uint_size)} : choice_type := + (nseq int8 (is_pure (v_N))). +Equations 0 {L : {fset Location}} {I : Interface} {v_N : both (fset []) (fset []) (uint_size)} (s : both L I (t_TokenIdFixed)) : both L I (nseq int8 (is_pure (v_N))) := + 0 s := + bind_both s (fun x => + solve_lift (ret_both (x : nseq int8 (is_pure (v_N))))) : both L I (nseq int8 (is_pure (v_N))). +Fail Next Obligation. +Equations Build_t_TokenIdFixed {L0 : {fset Location}} {I0 : Interface} {v_N : both (fset []) (fset []) (uint_size)} {0 : both L0 I0 (nseq int8 (is_pure (v_N)))} : both L0 I0 (t_TokenIdFixed) := + Build_t_TokenIdFixed := + bind_both 0 (fun 0 => + solve_lift (ret_both ((0) : (t_TokenIdFixed)))) : both L0 I0 (t_TokenIdFixed). +Fail Next Obligation. +Notation "'Build_t_TokenIdFixed' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_TokenIdFixed (0 := y)). + +#[global] Program Instance t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_IsTokenId {v_N : both (fset []) (fset []) (uint_size)} : t_IsTokenId t_TokenIdFixed (both (fset []) (fset []) (uint_size)) := + _. +Fail Next Obligation. +Hint Unfold t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_IsTokenId. + +#[global] Program Instance t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_SchemaType {v_N : both (fset []) (fset []) (uint_size)} : t_SchemaType t_TokenIdFixed (both (fset []) (fset []) (uint_size)) := + let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_List SizeLength_U8 Type_U8 : both (L :|: fset []) I (t_Type) in + {| f_get_type_loc := (fset [] : {fset Location}); + f_get_type := (@f_get_type)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_SchemaType. + +#[global] Program Instance t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_From {v_N : both (fset []) (fset []) (uint_size)} : t_From t_TokenIdFixed (both (fset []) (fset []) (uint_size)) nseq int8 (is_pure (v_N)) := + let f_from := fun {L1 : {fset Location}} {I1 : Interface} (id : both L1 I1 (nseq int8 (is_pure (v_N)))) => TokenIdFixed (solve_lift id) : both (L1 :|: fset []) I1 (t_TokenIdFixed (both (fset []) (fset []) (uint_size))) in + {| f_from_loc := (fset [] : {fset Location}); + f_from := (@f_from)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_From. + +#[global] Program Instance t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_Serial {v_N : both (fset []) (fset []) (uint_size)} : t_Serial t_TokenIdFixed (both (fset []) (fset []) (uint_size)) := + let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_TokenIdFixed (both (fset []) (fset []) (uint_size)))) (out : both L2 I2 (v_W)) => solve_lift (run (letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] len := matchb f_branch (map_err (f_try_from v_N) (fun _ => + f_default)) with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist1 := v_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist1) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + letb '(tmp0,out) := f_write_u8 out len in + letb out := tmp0 in + letb hoist3 := out in + letb hoist4 := f_branch hoist3 in + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist4 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist2 := v_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist2) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb out := foldi_both_list (f_into_iter (0 self)) (fun byte => + ssp (fun out => + letb '(tmp0,out) := f_write_u8 out byte in + letb out := tmp0 in + letb hoist6 := out in + letb hoist7 := f_branch hoist6 in + solve_lift matchb hoist7 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist5 := v_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue out + | ControlFlow_Continue val => + ControlFlow_Continue out + end : both (*0*)(L1:|:L2:|:L1:|:L2:|:fset []) (I1:|:I2:|:I1:|:I2) (t_ControlFlow ((v_W × t_Result ('unit) (f_Err))) (v_W)))) out in + letb output := Result_Ok (ret_both (tt : 'unit)) in + prod_b (out,output)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in + {| f_serial_loc := (fset [] : {fset Location}); + f_serial := (@f_serial)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_Serial. + +#[global] Program Instance t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_Deserial {v_N : both (fset []) (fset []) (uint_size)} : t_Deserial t_TokenIdFixed (both (fset []) (fset []) (uint_size)) := + let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (source : both L1 I1 (v_R)) => solve_lift (run (letb '(tmp0,out) := f_read_u8 source in + letb source := tmp0 in + letb hoist9 := out in + letb hoist10 := f_branch hoist9 in + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdFixed (both (fset []) (fset []) (uint_size))) (t_ParseError)))] byte_length := ControlFlow_Continue matchb hoist10 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdFixed (both (fset []) (fset []) (uint_size))) (t_ParseError)))] hoist8 := v_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist8) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdFixed (both (fset []) (fset []) (uint_size))) (t_ParseError)))] _ := ControlFlow_Continue (ifb (f_from byte_length) <> v_N + then letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdFixed (both (fset []) (fset []) (uint_size))) (t_ParseError)))] hoist11 := v_Break (prod_b (source,Result_Err f_default)) in + ControlFlow_Continue (never_to_any hoist11) + else ControlFlow_Continue (ret_both (tt : 'unit))) in + letb '(tmp0,out) := f_get source in + letb source := tmp0 in + letb hoist13 := out in + letb hoist14 := f_branch hoist13 in + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdFixed (both (fset []) (fset []) (uint_size))) (t_ParseError)))] (bytes:nseq int8 (is_pure (v_N))) := matchb hoist14 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdFixed (both (fset []) (fset []) (uint_size))) (t_ParseError)))] hoist12 := v_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist12) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb output := Result_Ok (TokenIdFixed bytes) in + prod_b (source,output)))) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_TokenIdFixed (both (fset []) (fset []) (uint_size))) (t_ParseError))) in + {| f_deserial_loc := (fset [] : {fset Location}); + f_deserial := (@f_deserial)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_Deserial. + +Definition t_TokenIdU64 : choice_type := + (int64). +Equations 0 {L : {fset Location}} {I : Interface} (s : both L I (t_TokenIdU64)) : both L I (int64) := + 0 s := + bind_both s (fun x => + solve_lift (ret_both (x : int64))) : both L I (int64). +Fail Next Obligation. +Equations Build_t_TokenIdU64 {L0 : {fset Location}} {I0 : Interface} {0 : both L0 I0 (int64)} : both L0 I0 (t_TokenIdU64) := + Build_t_TokenIdU64 := + bind_both 0 (fun 0 => + solve_lift (ret_both ((0) : (t_TokenIdU64)))) : both L0 I0 (t_TokenIdU64). +Fail Next Obligation. +Notation "'Build_t_TokenIdU64' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_TokenIdU64 (0 := y)). + +#[global] Program Instance t_TokenIdU64_t_IsTokenId : t_IsTokenId t_TokenIdU64 := + _. +Fail Next Obligation. +Hint Unfold t_TokenIdU64_t_IsTokenId. + +#[global] Program Instance t_TokenIdU64_t_SchemaType : t_SchemaType t_TokenIdU64 := + let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_List SizeLength_U8 Type_U8 : both (L :|: fset []) I (t_Type) in + {| f_get_type_loc := (fset [] : {fset Location}); + f_get_type := (@f_get_type)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdU64_t_SchemaType. + +#[global] Program Instance t_TokenIdU64_t_From : t_From t_TokenIdU64 int64 := + let f_from := fun {L1 : {fset Location}} {I1 : Interface} (id : both L1 I1 (int64)) => TokenIdU64 (solve_lift id) : both (L1 :|: fset []) I1 (t_TokenIdU64) in + {| f_from_loc := (fset [] : {fset Location}); + f_from := (@f_from)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdU64_t_From. + +#[global] Program Instance t_TokenIdU64_t_Serial : t_Serial t_TokenIdU64 := + let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_TokenIdU64)) (out : both L2 I2 (v_W)) => solve_lift (run (letb '(tmp0,out) := f_write_u8 out (ret_both (8 : int8)) in + letb out := tmp0 in + letb hoist16 := out in + letb hoist17 := f_branch hoist16 in + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist17 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist15 := v_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist15) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb '(tmp0,out) := f_write_u64 out (0 self) in + letb out := tmp0 in + letb output := out in + prod_b (out,output)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in + {| f_serial_loc := (fset [] : {fset Location}); + f_serial := (@f_serial)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdU64_t_Serial. + +#[global] Program Instance t_TokenIdU64_t_Deserial : t_Deserial t_TokenIdU64 := + let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (source : both L1 I1 (v_R)) => solve_lift (run (letb '(tmp0,out) := f_read_u8 source in + letb source := tmp0 in + letb hoist19 := out in + letb hoist20 := f_branch hoist19 in + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU64) (t_ParseError)))] byte_length := matchb hoist20 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU64) (t_ParseError)))] hoist18 := v_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist18) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU64) (t_ParseError)))] '(source,output) := ifb byte_length =.? (ret_both (8 : int8)) + then letb '(tmp0,out) := f_read_u64 source in + letb source := tmp0 in + letb hoist22 := out in + letb hoist23 := f_branch hoist22 in + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU64) (t_ParseError)))] hoist24 := matchb hoist23 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU64) (t_ParseError)))] hoist21 := v_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist21) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb hoist25 := TokenIdU64 hoist24 in + prod_b (source,Result_Ok hoist25)) + else ControlFlow_Continue (prod_b (source,Result_Err f_default)) in + ControlFlow_Continue (prod_b (source,output)))) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_TokenIdU64) (t_ParseError))) in + {| f_deserial_loc := (fset [] : {fset Location}); + f_deserial := (@f_deserial)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdU64_t_Deserial. + +Definition t_TokenIdU32 : choice_type := + (int32). +Equations 0 {L : {fset Location}} {I : Interface} (s : both L I (t_TokenIdU32)) : both L I (int32) := + 0 s := + bind_both s (fun x => + solve_lift (ret_both (x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_TokenIdU32 {L0 : {fset Location}} {I0 : Interface} {0 : both L0 I0 (int32)} : both L0 I0 (t_TokenIdU32) := + Build_t_TokenIdU32 := + bind_both 0 (fun 0 => + solve_lift (ret_both ((0) : (t_TokenIdU32)))) : both L0 I0 (t_TokenIdU32). +Fail Next Obligation. +Notation "'Build_t_TokenIdU32' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_TokenIdU32 (0 := y)). + +#[global] Program Instance t_TokenIdU32_t_IsTokenId : t_IsTokenId t_TokenIdU32 := + _. +Fail Next Obligation. +Hint Unfold t_TokenIdU32_t_IsTokenId. + +#[global] Program Instance t_TokenIdU32_t_SchemaType : t_SchemaType t_TokenIdU32 := + let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_List SizeLength_U8 Type_U8 : both (L :|: fset []) I (t_Type) in + {| f_get_type_loc := (fset [] : {fset Location}); + f_get_type := (@f_get_type)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdU32_t_SchemaType. + +#[global] Program Instance t_TokenIdU32_t_From : t_From t_TokenIdU32 int32 := + let f_from := fun {L1 : {fset Location}} {I1 : Interface} (id : both L1 I1 (int32)) => TokenIdU32 (solve_lift id) : both (L1 :|: fset []) I1 (t_TokenIdU32) in + {| f_from_loc := (fset [] : {fset Location}); + f_from := (@f_from)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdU32_t_From. + +#[global] Program Instance t_TokenIdU32_t_Serial : t_Serial t_TokenIdU32 := + let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_TokenIdU32)) (out : both L2 I2 (v_W)) => solve_lift (run (letb '(tmp0,out) := f_write_u8 out (ret_both (4 : int8)) in + letb out := tmp0 in + letb hoist27 := out in + letb hoist28 := f_branch hoist27 in + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist28 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist26 := v_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist26) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb '(tmp0,out) := f_write_u32 out (0 self) in + letb out := tmp0 in + letb output := out in + prod_b (out,output)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in + {| f_serial_loc := (fset [] : {fset Location}); + f_serial := (@f_serial)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdU32_t_Serial. + +#[global] Program Instance t_TokenIdU32_t_Deserial : t_Deserial t_TokenIdU32 := + let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (source : both L1 I1 (v_R)) => solve_lift (run (letb '(tmp0,out) := f_read_u8 source in + letb source := tmp0 in + letb hoist30 := out in + letb hoist31 := f_branch hoist30 in + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU32) (t_ParseError)))] byte_length := matchb hoist31 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU32) (t_ParseError)))] hoist29 := v_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist29) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU32) (t_ParseError)))] '(source,output) := ifb byte_length =.? (ret_both (4 : int8)) + then letb '(tmp0,out) := f_read_u32 source in + letb source := tmp0 in + letb hoist33 := out in + letb hoist34 := f_branch hoist33 in + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU32) (t_ParseError)))] hoist35 := matchb hoist34 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU32) (t_ParseError)))] hoist32 := v_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist32) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb hoist36 := TokenIdU32 hoist35 in + prod_b (source,Result_Ok hoist36)) + else ControlFlow_Continue (prod_b (source,Result_Err f_default)) in + ControlFlow_Continue (prod_b (source,output)))) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_TokenIdU32) (t_ParseError))) in + {| f_deserial_loc := (fset [] : {fset Location}); + f_deserial := (@f_deserial)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdU32_t_Deserial. + +Definition t_TokenIdU16 : choice_type := + (int16). +Equations 0 {L : {fset Location}} {I : Interface} (s : both L I (t_TokenIdU16)) : both L I (int16) := + 0 s := + bind_both s (fun x => + solve_lift (ret_both (x : int16))) : both L I (int16). +Fail Next Obligation. +Equations Build_t_TokenIdU16 {L0 : {fset Location}} {I0 : Interface} {0 : both L0 I0 (int16)} : both L0 I0 (t_TokenIdU16) := + Build_t_TokenIdU16 := + bind_both 0 (fun 0 => + solve_lift (ret_both ((0) : (t_TokenIdU16)))) : both L0 I0 (t_TokenIdU16). +Fail Next Obligation. +Notation "'Build_t_TokenIdU16' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_TokenIdU16 (0 := y)). + +#[global] Program Instance t_TokenIdU16_t_IsTokenId : t_IsTokenId t_TokenIdU16 := + _. +Fail Next Obligation. +Hint Unfold t_TokenIdU16_t_IsTokenId. + +#[global] Program Instance t_TokenIdU16_t_SchemaType : t_SchemaType t_TokenIdU16 := + let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_List SizeLength_U8 Type_U8 : both (L :|: fset []) I (t_Type) in + {| f_get_type_loc := (fset [] : {fset Location}); + f_get_type := (@f_get_type)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdU16_t_SchemaType. + +#[global] Program Instance t_TokenIdU16_t_From : t_From t_TokenIdU16 int16 := + let f_from := fun {L1 : {fset Location}} {I1 : Interface} (id : both L1 I1 (int16)) => TokenIdU16 (solve_lift id) : both (L1 :|: fset []) I1 (t_TokenIdU16) in + {| f_from_loc := (fset [] : {fset Location}); + f_from := (@f_from)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdU16_t_From. + +#[global] Program Instance t_TokenIdU16_t_Serial : t_Serial t_TokenIdU16 := + let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_TokenIdU16)) (out : both L2 I2 (v_W)) => solve_lift (run (letb '(tmp0,out) := f_write_u8 out (ret_both (2 : int8)) in + letb out := tmp0 in + letb hoist38 := out in + letb hoist39 := f_branch hoist38 in + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist39 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist37 := v_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist37) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb '(tmp0,out) := f_write_u16 out (0 self) in + letb out := tmp0 in + letb output := out in + prod_b (out,output)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in + {| f_serial_loc := (fset [] : {fset Location}); + f_serial := (@f_serial)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdU16_t_Serial. + +#[global] Program Instance t_TokenIdU16_t_Deserial : t_Deserial t_TokenIdU16 := + let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (source : both L1 I1 (v_R)) => solve_lift (run (letb '(tmp0,out) := f_read_u8 source in + letb source := tmp0 in + letb hoist41 := out in + letb hoist42 := f_branch hoist41 in + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU16) (t_ParseError)))] byte_length := matchb hoist42 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU16) (t_ParseError)))] hoist40 := v_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist40) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU16) (t_ParseError)))] '(source,output) := ifb byte_length =.? (ret_both (2 : int8)) + then letb '(tmp0,out) := f_read_u16 source in + letb source := tmp0 in + letb hoist44 := out in + letb hoist45 := f_branch hoist44 in + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU16) (t_ParseError)))] hoist46 := matchb hoist45 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU16) (t_ParseError)))] hoist43 := v_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist43) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb hoist47 := TokenIdU16 hoist46 in + prod_b (source,Result_Ok hoist47)) + else ControlFlow_Continue (prod_b (source,Result_Err f_default)) in + ControlFlow_Continue (prod_b (source,output)))) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_TokenIdU16) (t_ParseError))) in + {| f_deserial_loc := (fset [] : {fset Location}); + f_deserial := (@f_deserial)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdU16_t_Deserial. + +Definition t_TokenIdU8 : choice_type := + (int8). +Equations 0 {L : {fset Location}} {I : Interface} (s : both L I (t_TokenIdU8)) : both L I (int8) := + 0 s := + bind_both s (fun x => + solve_lift (ret_both (x : int8))) : both L I (int8). +Fail Next Obligation. +Equations Build_t_TokenIdU8 {L0 : {fset Location}} {I0 : Interface} {0 : both L0 I0 (int8)} : both L0 I0 (t_TokenIdU8) := + Build_t_TokenIdU8 := + bind_both 0 (fun 0 => + solve_lift (ret_both ((0) : (t_TokenIdU8)))) : both L0 I0 (t_TokenIdU8). +Fail Next Obligation. +Notation "'Build_t_TokenIdU8' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_TokenIdU8 (0 := y)). + +#[global] Program Instance t_TokenIdU8_t_IsTokenId : t_IsTokenId t_TokenIdU8 := + _. +Fail Next Obligation. +Hint Unfold t_TokenIdU8_t_IsTokenId. + +#[global] Program Instance t_TokenIdU8_t_SchemaType : t_SchemaType t_TokenIdU8 := + let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_List SizeLength_U8 Type_U8 : both (L :|: fset []) I (t_Type) in + {| f_get_type_loc := (fset [] : {fset Location}); + f_get_type := (@f_get_type)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdU8_t_SchemaType. + +#[global] Program Instance t_TokenIdU8_t_From : t_From t_TokenIdU8 int8 := + let f_from := fun {L1 : {fset Location}} {I1 : Interface} (id : both L1 I1 (int8)) => TokenIdU8 (solve_lift id) : both (L1 :|: fset []) I1 (t_TokenIdU8) in + {| f_from_loc := (fset [] : {fset Location}); + f_from := (@f_from)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdU8_t_From. + +#[global] Program Instance t_TokenIdU8_t_Serial : t_Serial t_TokenIdU8 := + let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_TokenIdU8)) (out : both L2 I2 (v_W)) => solve_lift (run (letb '(tmp0,out) := f_write_u8 out (ret_both (1 : int8)) in + letb out := tmp0 in + letb hoist49 := out in + letb hoist50 := f_branch hoist49 in + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist50 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist48 := v_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist48) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb '(tmp0,out) := f_write_u8 out (0 self) in + letb out := tmp0 in + letb output := out in + prod_b (out,output)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in + {| f_serial_loc := (fset [] : {fset Location}); + f_serial := (@f_serial)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdU8_t_Serial. + +#[global] Program Instance t_TokenIdU8_t_Deserial : t_Deserial t_TokenIdU8 := + let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (source : both L1 I1 (v_R)) => solve_lift (run (letb '(tmp0,out) := f_read_u8 source in + letb source := tmp0 in + letb hoist52 := out in + letb hoist53 := f_branch hoist52 in + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU8) (t_ParseError)))] byte_length := matchb hoist53 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU8) (t_ParseError)))] hoist51 := v_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist51) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU8) (t_ParseError)))] '(source,output) := ifb byte_length =.? (ret_both (1 : int8)) + then letb '(tmp0,out) := f_read_u8 source in + letb source := tmp0 in + letb hoist55 := out in + letb hoist56 := f_branch hoist55 in + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU8) (t_ParseError)))] hoist57 := matchb hoist56 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU8) (t_ParseError)))] hoist54 := v_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist54) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb hoist58 := TokenIdU8 hoist57 in + prod_b (source,Result_Ok hoist58)) + else ControlFlow_Continue (prod_b (source,Result_Err f_default)) in + ControlFlow_Continue (prod_b (source,output)))) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_TokenIdU8) (t_ParseError))) in + {| f_deserial_loc := (fset [] : {fset Location}); + f_deserial := (@f_deserial)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdU8_t_Deserial. + +Definition t_TokenIdUnit : choice_type := + 'unit. +Equations Build_t_TokenIdUnit : both (fset []) (fset []) (t_TokenIdUnit) := + Build_t_TokenIdUnit := + solve_lift (ret_both ((_) : (t_TokenIdUnit))) : both (fset []) (fset []) (t_TokenIdUnit). +Fail Next Obligation. + +#[global] Program Instance t_TokenIdUnit_t_IsTokenId : t_IsTokenId t_TokenIdUnit := + _. +Fail Next Obligation. +Hint Unfold t_TokenIdUnit_t_IsTokenId. + +#[global] Program Instance t_TokenIdUnit_t_SchemaType : t_SchemaType t_TokenIdUnit := + let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_List SizeLength_U8 Type_U8 : both (L :|: fset []) I (t_Type) in + {| f_get_type_loc := (fset [] : {fset Location}); + f_get_type := (@f_get_type)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdUnit_t_SchemaType. + +#[global] Program Instance t_TokenIdUnit_t_Serial : t_Serial t_TokenIdUnit := + let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_TokenIdUnit)) (out : both L2 I2 (v_W)) => letb '(tmp0,out) := f_write_u8 out (ret_both (0 : int8)) in + letb out := tmp0 in + letb output := out in + solve_lift (prod_b (out,output)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in + {| f_serial_loc := (fset [] : {fset Location}); + f_serial := (@f_serial)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdUnit_t_Serial. + +#[global] Program Instance t_TokenIdUnit_t_Deserial : t_Deserial t_TokenIdUnit := + let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (source : both L1 I1 (v_R)) => solve_lift (run (letb '(tmp0,out) := f_read_u8 source in + letb source := tmp0 in + letb hoist60 := out in + letb hoist61 := f_branch hoist60 in + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdUnit) (t_ParseError)))] byte_length := matchb hoist61 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdUnit) (t_ParseError)))] hoist59 := v_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist59) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb output := ifb byte_length =.? (ret_both (0 : int8)) + then Result_Ok TokenIdUnit + else Result_Err f_default in + prod_b (source,output)))) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_TokenIdUnit) (t_ParseError))) in + {| f_deserial_loc := (fset [] : {fset Location}); + f_deserial := (@f_deserial)|}. +Fail Next Obligation. +Hint Unfold t_TokenIdUnit_t_Deserial. + +Notation "'t_TokenAmount'" := (int64). + +Definition t_TransferEvent {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := + (v_T × int64 × t_Address × t_Address). +Equations f_token_id {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TransferEvent)) : both L I (v_T) := + f_token_id s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst x)) : v_T))) : both L I (v_T). +Fail Next Obligation. +Equations f_amount {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TransferEvent)) : both L I (int64) := + f_amount s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : int64))) : both L I (int64). +Fail Next Obligation. +Equations f_from {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TransferEvent)) : both L I (t_Address) := + f_from s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : t_Address))) : both L I (t_Address). +Fail Next Obligation. +Equations f_to {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TransferEvent)) : both L I (t_Address) := + f_to s := + bind_both s (fun x => + solve_lift (ret_both (snd x : t_Address))) : both L I (t_Address). +Fail Next Obligation. +Equations Build_t_TransferEvent {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {f_token_id : both L0 I0 (v_T)} {f_amount : both L1 I1 (int64)} {f_from : both L2 I2 (t_Address)} {f_to : both L3 I3 (t_Address)} : both (L0:|:L1:|:L2:|:L3) (I0:|:I1:|:I2:|:I3) (t_TransferEvent) := + Build_t_TransferEvent := + bind_both f_to (fun f_to => + bind_both f_from (fun f_from => + bind_both f_amount (fun f_amount => + bind_both f_token_id (fun f_token_id => + solve_lift (ret_both ((f_token_id,f_amount,f_from,f_to) : (t_TransferEvent))))))) : both (L0:|:L1:|:L2:|:L3) (I0:|:I1:|:I2:|:I3) (t_TransferEvent). +Fail Next Obligation. +Notation "'Build_t_TransferEvent' '[' x ']' '(' 'f_token_id' ':=' y ')'" := (Build_t_TransferEvent (f_token_id := y) (f_amount := f_amount x) (f_from := f_from x) (f_to := f_to x)). +Notation "'Build_t_TransferEvent' '[' x ']' '(' 'f_amount' ':=' y ')'" := (Build_t_TransferEvent (f_token_id := f_token_id x) (f_amount := y) (f_from := f_from x) (f_to := f_to x)). +Notation "'Build_t_TransferEvent' '[' x ']' '(' 'f_from' ':=' y ')'" := (Build_t_TransferEvent (f_token_id := f_token_id x) (f_amount := f_amount x) (f_from := y) (f_to := f_to x)). +Notation "'Build_t_TransferEvent' '[' x ']' '(' 'f_to' ':=' y ')'" := (Build_t_TransferEvent (f_token_id := f_token_id x) (f_amount := f_amount x) (f_from := f_from x) (f_to := y)). + +Definition t_MintEvent {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := + (v_T × int64 × t_Address). +Equations f_token_id {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_MintEvent)) : both L I (v_T) := + f_token_id s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : v_T))) : both L I (v_T). +Fail Next Obligation. +Equations f_amount {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_MintEvent)) : both L I (int64) := + f_amount s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : int64))) : both L I (int64). +Fail Next Obligation. +Equations f_owner {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_MintEvent)) : both L I (t_Address) := + f_owner s := + bind_both s (fun x => + solve_lift (ret_both (snd x : t_Address))) : both L I (t_Address). +Fail Next Obligation. +Equations Build_t_MintEvent {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {f_token_id : both L0 I0 (v_T)} {f_amount : both L1 I1 (int64)} {f_owner : both L2 I2 (t_Address)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_MintEvent) := + Build_t_MintEvent := + bind_both f_owner (fun f_owner => + bind_both f_amount (fun f_amount => + bind_both f_token_id (fun f_token_id => + solve_lift (ret_both ((f_token_id,f_amount,f_owner) : (t_MintEvent)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_MintEvent). +Fail Next Obligation. +Notation "'Build_t_MintEvent' '[' x ']' '(' 'f_token_id' ':=' y ')'" := (Build_t_MintEvent (f_token_id := y) (f_amount := f_amount x) (f_owner := f_owner x)). +Notation "'Build_t_MintEvent' '[' x ']' '(' 'f_amount' ':=' y ')'" := (Build_t_MintEvent (f_token_id := f_token_id x) (f_amount := y) (f_owner := f_owner x)). +Notation "'Build_t_MintEvent' '[' x ']' '(' 'f_owner' ':=' y ')'" := (Build_t_MintEvent (f_token_id := f_token_id x) (f_amount := f_amount x) (f_owner := y)). + +Definition t_BurnEvent {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := + (v_T × int64 × t_Address). +Equations f_token_id {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_BurnEvent)) : both L I (v_T) := + f_token_id s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : v_T))) : both L I (v_T). +Fail Next Obligation. +Equations f_amount {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_BurnEvent)) : both L I (int64) := + f_amount s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : int64))) : both L I (int64). +Fail Next Obligation. +Equations f_owner {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_BurnEvent)) : both L I (t_Address) := + f_owner s := + bind_both s (fun x => + solve_lift (ret_both (snd x : t_Address))) : both L I (t_Address). +Fail Next Obligation. +Equations Build_t_BurnEvent {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {f_token_id : both L0 I0 (v_T)} {f_amount : both L1 I1 (int64)} {f_owner : both L2 I2 (t_Address)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_BurnEvent) := + Build_t_BurnEvent := + bind_both f_owner (fun f_owner => + bind_both f_amount (fun f_amount => + bind_both f_token_id (fun f_token_id => + solve_lift (ret_both ((f_token_id,f_amount,f_owner) : (t_BurnEvent)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_BurnEvent). +Fail Next Obligation. +Notation "'Build_t_BurnEvent' '[' x ']' '(' 'f_token_id' ':=' y ')'" := (Build_t_BurnEvent (f_token_id := y) (f_amount := f_amount x) (f_owner := f_owner x)). +Notation "'Build_t_BurnEvent' '[' x ']' '(' 'f_amount' ':=' y ')'" := (Build_t_BurnEvent (f_token_id := f_token_id x) (f_amount := y) (f_owner := f_owner x)). +Notation "'Build_t_BurnEvent' '[' x ']' '(' 'f_owner' ':=' y ')'" := (Build_t_BurnEvent (f_token_id := f_token_id x) (f_amount := f_amount x) (f_owner := y)). + +Definition t_OperatorUpdate : choice_type := + chFin (mkpos 2). +Equations OperatorUpdate_Remove {L : {fset Location}} {I : Interface} : both L I t_OperatorUpdate := + OperatorUpdate_Remove := + solve_lift ret_both (fintype.Ordinal (n:=2) (m:=0) eq_refl : t_OperatorUpdate) : both L I t_OperatorUpdate. +Fail Next Obligation. +Equations OperatorUpdate_Add {L : {fset Location}} {I : Interface} : both L I t_OperatorUpdate := + OperatorUpdate_Add := + solve_lift ret_both (fintype.Ordinal (n:=2) (m:=1) eq_refl : t_OperatorUpdate) : both L I t_OperatorUpdate. +Fail Next Obligation. + +Definition t_UpdateOperatorEvent : choice_type := + (t_OperatorUpdate × t_Address × t_Address). +Equations f_update {L : {fset Location}} {I : Interface} (s : both L I (t_UpdateOperatorEvent)) : both L I (t_OperatorUpdate) := + f_update s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : t_OperatorUpdate))) : both L I (t_OperatorUpdate). +Fail Next Obligation. +Equations f_owner {L : {fset Location}} {I : Interface} (s : both L I (t_UpdateOperatorEvent)) : both L I (t_Address) := + f_owner s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : t_Address))) : both L I (t_Address). +Fail Next Obligation. +Equations f_operator {L : {fset Location}} {I : Interface} (s : both L I (t_UpdateOperatorEvent)) : both L I (t_Address) := + f_operator s := + bind_both s (fun x => + solve_lift (ret_both (snd x : t_Address))) : both L I (t_Address). +Fail Next Obligation. +Equations Build_t_UpdateOperatorEvent {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_update : both L0 I0 (t_OperatorUpdate)} {f_owner : both L1 I1 (t_Address)} {f_operator : both L2 I2 (t_Address)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_UpdateOperatorEvent) := + Build_t_UpdateOperatorEvent := + bind_both f_operator (fun f_operator => + bind_both f_owner (fun f_owner => + bind_both f_update (fun f_update => + solve_lift (ret_both ((f_update,f_owner,f_operator) : (t_UpdateOperatorEvent)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_UpdateOperatorEvent). +Fail Next Obligation. +Notation "'Build_t_UpdateOperatorEvent' '[' x ']' '(' 'f_update' ':=' y ')'" := (Build_t_UpdateOperatorEvent (f_update := y) (f_owner := f_owner x) (f_operator := f_operator x)). +Notation "'Build_t_UpdateOperatorEvent' '[' x ']' '(' 'f_owner' ':=' y ')'" := (Build_t_UpdateOperatorEvent (f_update := f_update x) (f_owner := y) (f_operator := f_operator x)). +Notation "'Build_t_UpdateOperatorEvent' '[' x ']' '(' 'f_operator' ':=' y ')'" := (Build_t_UpdateOperatorEvent (f_update := f_update x) (f_owner := f_owner x) (f_operator := y)). + +Definition t_TokenMetadataEvent {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := + (v_T × t_MetadataUrl). +Equations f_token_id {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TokenMetadataEvent)) : both L I (v_T) := + f_token_id s := + bind_both s (fun x => + solve_lift (ret_both (fst x : v_T))) : both L I (v_T). +Fail Next Obligation. +Equations f_metadata_url {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TokenMetadataEvent)) : both L I (t_MetadataUrl) := + f_metadata_url s := + bind_both s (fun x => + solve_lift (ret_both (snd x : t_MetadataUrl))) : both L I (t_MetadataUrl). +Fail Next Obligation. +Equations Build_t_TokenMetadataEvent {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {f_token_id : both L0 I0 (v_T)} {f_metadata_url : both L1 I1 (t_MetadataUrl)} : both (L0:|:L1) (I0:|:I1) (t_TokenMetadataEvent) := + Build_t_TokenMetadataEvent := + bind_both f_metadata_url (fun f_metadata_url => + bind_both f_token_id (fun f_token_id => + solve_lift (ret_both ((f_token_id,f_metadata_url) : (t_TokenMetadataEvent))))) : both (L0:|:L1) (I0:|:I1) (t_TokenMetadataEvent). +Fail Next Obligation. +Notation "'Build_t_TokenMetadataEvent' '[' x ']' '(' 'f_token_id' ':=' y ')'" := (Build_t_TokenMetadataEvent (f_token_id := y) (f_metadata_url := f_metadata_url x)). +Notation "'Build_t_TokenMetadataEvent' '[' x ']' '(' 'f_metadata_url' ':=' y ')'" := (Build_t_TokenMetadataEvent (f_token_id := f_token_id x) (f_metadata_url := y)). + +Definition t_Cis1Event {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := + chFin (mkpos 5). +Equations Cis1Event_Transfer {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_TransferEvent (v_T) (both L I t_Cis1Event) := + Cis1Event_Transfer := + solve_lift ret_both (fintype.Ordinal (n:=5) (m:=0) eq_refl : t_Cis1Event) : t_TransferEvent (v_T) (both L I t_Cis1Event). +Fail Next Obligation. +Equations Cis1Event_Mint {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_MintEvent (v_T) (both L I t_Cis1Event) := + Cis1Event_Mint := + solve_lift ret_both (fintype.Ordinal (n:=5) (m:=1) eq_refl : t_Cis1Event) : t_MintEvent (v_T) (both L I t_Cis1Event). +Fail Next Obligation. +Equations Cis1Event_Burn {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_BurnEvent (v_T) (both L I t_Cis1Event) := + Cis1Event_Burn := + solve_lift ret_both (fintype.Ordinal (n:=5) (m:=2) eq_refl : t_Cis1Event) : t_BurnEvent (v_T) (both L I t_Cis1Event). +Fail Next Obligation. +Equations Cis1Event_UpdateOperator {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_UpdateOperatorEvent (both L I t_Cis1Event) := + Cis1Event_UpdateOperator := + solve_lift ret_both (fintype.Ordinal (n:=5) (m:=3) eq_refl : t_Cis1Event) : t_UpdateOperatorEvent (both L I t_Cis1Event). +Fail Next Obligation. +Equations Cis1Event_TokenMetadata {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_TokenMetadataEvent (v_T) (both L I t_Cis1Event) := + Cis1Event_TokenMetadata := + solve_lift ret_both (fintype.Ordinal (n:=5) (m:=4) eq_refl : t_Cis1Event) : t_TokenMetadataEvent (v_T) (both L I t_Cis1Event). +Fail Next Obligation. + +#[global] Program Instance t_Cis1Event (v_T)_t_Serial {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_Serial t_Cis1Event (v_T) := + let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Cis1Event (v_T))) (out : both L2 I2 (v_W)) => solve_lift (run (letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] '(out,output) := matchb self with + | Cis1Event_Transfer event => + letb '(tmp0,out) := f_write_u8 out v_TRANSFER_EVENT_TAG in + letb out := tmp0 in + letb hoist63 := out in + letb hoist64 := f_branch hoist63 in + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist64 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist62 := v_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist62) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb '(tmp0,out) := f_serial event out in + letb out := tmp0 in + prod_b (out,out)) + | Cis1Event_Mint event => + letb '(tmp0,out) := f_write_u8 out v_MINT_EVENT_TAG in + letb out := tmp0 in + letb hoist66 := out in + letb hoist67 := f_branch hoist66 in + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist67 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist65 := v_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist65) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb '(tmp0,out) := f_serial event out in + letb out := tmp0 in + prod_b (out,out)) + | Cis1Event_Burn event => + letb '(tmp0,out) := f_write_u8 out v_BURN_EVENT_TAG in + letb out := tmp0 in + letb hoist69 := out in + letb hoist70 := f_branch hoist69 in + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist70 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist68 := v_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist68) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb '(tmp0,out) := f_serial event out in + letb out := tmp0 in + prod_b (out,out)) + | Cis1Event_UpdateOperator event => + letb '(tmp0,out) := f_write_u8 out v_UPDATE_OPERATOR_EVENT_TAG in + letb out := tmp0 in + letb hoist72 := out in + letb hoist73 := f_branch hoist72 in + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist73 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist71 := v_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist71) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb '(tmp0,out) := f_serial event out in + letb out := tmp0 in + prod_b (out,out)) + | Cis1Event_TokenMetadata event => + letb '(tmp0,out) := f_write_u8 out v_TOKEN_METADATA_EVENT_TAG in + letb out := tmp0 in + letb hoist75 := out in + letb hoist76 := f_branch hoist75 in + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist76 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist74 := v_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist74) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb '(tmp0,out) := f_serial event out in + letb out := tmp0 in + prod_b (out,out)) + end in + ControlFlow_Continue (prod_b (out,output)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in + {| f_serial_loc := (fset [] : {fset Location}); + f_serial := (@f_serial)|}. +Fail Next Obligation. +Hint Unfold t_Cis1Event (v_T)_t_Serial. + +#[global] Program Instance t_Cis1Event (v_T)_t_Deserial {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_Deserial t_Cis1Event (v_T) := + let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (source : both L1 I1 (v_R)) => solve_lift (run (letb '(tmp0,out) := f_read_u8 source in + letb source := tmp0 in + letb hoist78 := out in + letb hoist79 := f_branch hoist78 in + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_Cis1Event (v_T)) (t_ParseError)))] tag := matchb hoist79 with + | ControlFlow_Break residual => + letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_Cis1Event (v_T)) (t_ParseError)))] hoist77 := v_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist77) + | ControlFlow_Continue val => + ControlFlow_Continue val + end in + ControlFlow_Continue (letb '(source,output) := matchb tag with + | 255 => + letb '(tmp0,out) := f_deserial source in + letb source := tmp0 in + letb hoist80 := out in + prod_b (source,map hoist80 v_Transfer) + | 254 => + letb '(tmp0,out) := f_deserial source in + letb source := tmp0 in + letb hoist81 := out in + prod_b (source,map hoist81 v_Mint) + | 253 => + letb '(tmp0,out) := f_deserial source in + letb source := tmp0 in + letb hoist82 := out in + prod_b (source,map hoist82 v_Burn) + | 252 => + letb '(tmp0,out) := f_deserial source in + letb source := tmp0 in + letb hoist83 := out in + prod_b (source,map hoist83 v_UpdateOperator) + | 251 => + letb '(tmp0,out) := f_deserial source in + letb source := tmp0 in + letb hoist84 := out in + prod_b (source,map hoist84 v_TokenMetadata) + | _ => + prod_b (source,Result_Err f_default) + end in + prod_b (source,output)))) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_Cis1Event (v_T)) (t_ParseError))) in + {| f_deserial_loc := (fset [] : {fset Location}); + f_deserial := (@f_deserial)|}. +Fail Next Obligation. +Hint Unfold t_Cis1Event (v_T)_t_Deserial. + +Definition t_Cis1Error {v_R : _} `{ t_Sized (v_R)} : choice_type := + chFin (mkpos 4). +Equations Cis1Error_InvalidTokenId {L : {fset Location}} {I : Interface} {v_R : _} `{ t_Sized (v_R)} : both L I t_Cis1Error := + Cis1Error_InvalidTokenId := + solve_lift ret_both (fintype.Ordinal (n:=4) (m:=0) eq_refl : t_Cis1Error) : both L I t_Cis1Error. +Fail Next Obligation. +Equations Cis1Error_InsufficientFunds {L : {fset Location}} {I : Interface} {v_R : _} `{ t_Sized (v_R)} : both L I t_Cis1Error := + Cis1Error_InsufficientFunds := + solve_lift ret_both (fintype.Ordinal (n:=4) (m:=1) eq_refl : t_Cis1Error) : both L I t_Cis1Error. +Fail Next Obligation. +Equations Cis1Error_Unauthorized {L : {fset Location}} {I : Interface} {v_R : _} `{ t_Sized (v_R)} : both L I t_Cis1Error := + Cis1Error_Unauthorized := + solve_lift ret_both (fintype.Ordinal (n:=4) (m:=2) eq_refl : t_Cis1Error) : both L I t_Cis1Error. +Fail Next Obligation. +Equations Cis1Error_Custom {L : {fset Location}} {I : Interface} {v_R : _} `{ t_Sized (v_R)} : v_R (both L I t_Cis1Error) := + Cis1Error_Custom := + solve_lift ret_both (fintype.Ordinal (n:=4) (m:=3) eq_refl : t_Cis1Error) : v_R (both L I t_Cis1Error). +Fail Next Obligation. + +#[global] Program Instance t_Reject_t_From {v_R : _} `{ t_Sized (v_R)} `{ t_Into (v_R) (t_Reject)} : t_From t_Reject t_Cis1Error (v_R) := + let f_from := fun {L1 : {fset Location}} {I1 : Interface} (err : both L1 I1 (t_Cis1Error (v_R))) => letb error_code := matchb err with + | Cis1Error_InvalidTokenId => + failure (ret_both ((AST import) Unsafe blocks are not allowed. + : chString)) (ret_both ({ Types.attributes = []; + contents = + Types.Block { + expr = + (Some { Types.attributes = []; + contents = + Types.Call { + args = + [{ Types.attributes = []; + contents = + Types.Literal { + lit = + { Types.node = (Types.Int ("42000001", Types.Unsuffixed)); + span = + { Types.filename = + (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "85"; line = "655" }; + lo = { Types.col = "77"; line = "655" } } + }; + neg = true}; + hir_id = (Some ("104", "17")); + span = + { Types.filename = + (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "85"; line = "655" }; + lo = { Types.col = "76"; line = "655" } }; + ty = (Types.Int Types.I32) } + ]; + fn_span = + { Types.filename = + (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "86"; line = "655" }; + lo = { Types.col = "50"; line = "655" } }; + from_hir_call = true; + fun' = + { Types.attributes = []; + contents = + Types.GlobalName { + id = + { Types.index = (1, 22145); krate = "core"; + path = + [{ Types.data = (Types.TypeNs "num"); disambiguator = 0 }; + { Types.data = (Types.TypeNs "nonzero"); + disambiguator = 0 }; + { Types.data = Types.Impl; disambiguator = 56 }; + { Types.data = (Types.ValueNs "new_unchecked"); + disambiguator = 0 } + ] + }}; + hir_id = None; + span = + { Types.filename = + (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "75"; line = "655" }; + lo = { Types.col = "50"; line = "655" } }; + ty = + (Types.Arrow + { Types.bound_vars = []; + value = + { Types.abi = Types.Abi {todo = "Rust"}; + c_variadic = false; inputs = [(Types.Int Types.I32)]; + output = + Types.Adt { + def_id = + { Types.index = (1, 22484); krate = "core"; + path = + [{ Types.data = (Types.TypeNs "num"); + disambiguator = 0 }; + { Types.data = (Types.TypeNs "nonzero"); + disambiguator = 0 }; + { Types.data = (Types.TypeNs "NonZeroI32"); + disambiguator = 0 } + ] + }; + generic_args = []}; + unsafety = Types.Unsafe } + }) + }; + impl = None; + ty = + (Types.Arrow + { Types.bound_vars = []; + value = + { Types.abi = Types.Abi {todo = "Rust"}; + c_variadic = false; inputs = [(Types.Int Types.I32)]; + output = + Types.Adt { + def_id = + { Types.index = (1, 22484); krate = "core"; + path = + [{ Types.data = (Types.TypeNs "num"); + disambiguator = 0 }; + { Types.data = (Types.TypeNs "nonzero"); + disambiguator = 0 }; + { Types.data = (Types.TypeNs "NonZeroI32"); + disambiguator = 0 } + ] + }; + generic_args = []}; + unsafety = Types.Unsafe } + })}; + hir_id = (Some ("104", "12")); + span = + { Types.filename = + (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "86"; line = "655" }; + lo = { Types.col = "50"; line = "655" } }; + ty = + Types.Adt { + def_id = + { Types.index = (1, 22484); krate = "core"; + path = + [{ Types.data = (Types.TypeNs "num"); disambiguator = 0 }; + { Types.data = (Types.TypeNs "nonzero"); disambiguator = 0 + }; + { Types.data = (Types.TypeNs "NonZeroI32"); + disambiguator = 0 } + ] + }; + generic_args = []} + }); + opt_destruction_scope = None; + region_scope = { Types.data = Types.Node; id = "19" }; + safety_mode = Types.ExplicitUnsafe; + span = + { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "88"; line = "655" }; + lo = { Types.col = "41"; line = "655" } }; + stmts = []; targeted_by_break = false}; + hir_id = (Some ("104", "11")); + span = + { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "88"; line = "655" }; + lo = { Types.col = "41"; line = "655" } }; + ty = + Types.Adt { + def_id = + { Types.index = (1, 22484); krate = "core"; + path = + [{ Types.data = (Types.TypeNs "num"); disambiguator = 0 }; + { Types.data = (Types.TypeNs "nonzero"); disambiguator = 0 }; + { Types.data = (Types.TypeNs "NonZeroI32"); disambiguator = 0 }] + }; + generic_args = []} + } : chString)) + | Cis1Error_InsufficientFunds => + failure (ret_both ((AST import) Unsafe blocks are not allowed. + : chString)) (ret_both ({ Types.attributes = []; + contents = + Types.Block { + expr = + (Some { Types.attributes = []; + contents = + Types.Call { + args = + [{ Types.attributes = []; + contents = + Types.Literal { + lit = + { Types.node = (Types.Int ("42000002", Types.Unsuffixed)); + span = + { Types.filename = + (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "88"; line = "656" }; + lo = { Types.col = "80"; line = "656" } } + }; + neg = true}; + hir_id = (Some ("104", "30")); + span = + { Types.filename = + (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "88"; line = "656" }; + lo = { Types.col = "79"; line = "656" } }; + ty = (Types.Int Types.I32) } + ]; + fn_span = + { Types.filename = + (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "89"; line = "656" }; + lo = { Types.col = "53"; line = "656" } }; + from_hir_call = true; + fun' = + { Types.attributes = []; + contents = + Types.GlobalName { + id = + { Types.index = (1, 22145); krate = "core"; + path = + [{ Types.data = (Types.TypeNs "num"); disambiguator = 0 }; + { Types.data = (Types.TypeNs "nonzero"); + disambiguator = 0 }; + { Types.data = Types.Impl; disambiguator = 56 }; + { Types.data = (Types.ValueNs "new_unchecked"); + disambiguator = 0 } + ] + }}; + hir_id = None; + span = + { Types.filename = + (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "78"; line = "656" }; + lo = { Types.col = "53"; line = "656" } }; + ty = + (Types.Arrow + { Types.bound_vars = []; + value = + { Types.abi = Types.Abi {todo = "Rust"}; + c_variadic = false; inputs = [(Types.Int Types.I32)]; + output = + Types.Adt { + def_id = + { Types.index = (1, 22484); krate = "core"; + path = + [{ Types.data = (Types.TypeNs "num"); + disambiguator = 0 }; + { Types.data = (Types.TypeNs "nonzero"); + disambiguator = 0 }; + { Types.data = (Types.TypeNs "NonZeroI32"); + disambiguator = 0 } + ] + }; + generic_args = []}; + unsafety = Types.Unsafe } + }) + }; + impl = None; + ty = + (Types.Arrow + { Types.bound_vars = []; + value = + { Types.abi = Types.Abi {todo = "Rust"}; + c_variadic = false; inputs = [(Types.Int Types.I32)]; + output = + Types.Adt { + def_id = + { Types.index = (1, 22484); krate = "core"; + path = + [{ Types.data = (Types.TypeNs "num"); + disambiguator = 0 }; + { Types.data = (Types.TypeNs "nonzero"); + disambiguator = 0 }; + { Types.data = (Types.TypeNs "NonZeroI32"); + disambiguator = 0 } + ] + }; + generic_args = []}; + unsafety = Types.Unsafe } + })}; + hir_id = (Some ("104", "25")); + span = + { Types.filename = + (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "89"; line = "656" }; + lo = { Types.col = "53"; line = "656" } }; + ty = + Types.Adt { + def_id = + { Types.index = (1, 22484); krate = "core"; + path = + [{ Types.data = (Types.TypeNs "num"); disambiguator = 0 }; + { Types.data = (Types.TypeNs "nonzero"); disambiguator = 0 + }; + { Types.data = (Types.TypeNs "NonZeroI32"); + disambiguator = 0 } + ] + }; + generic_args = []} + }); + opt_destruction_scope = None; + region_scope = { Types.data = Types.Node; id = "32" }; + safety_mode = Types.ExplicitUnsafe; + span = + { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "91"; line = "656" }; + lo = { Types.col = "44"; line = "656" } }; + stmts = []; targeted_by_break = false}; + hir_id = (Some ("104", "24")); + span = + { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "91"; line = "656" }; + lo = { Types.col = "44"; line = "656" } }; + ty = + Types.Adt { + def_id = + { Types.index = (1, 22484); krate = "core"; + path = + [{ Types.data = (Types.TypeNs "num"); disambiguator = 0 }; + { Types.data = (Types.TypeNs "nonzero"); disambiguator = 0 }; + { Types.data = (Types.TypeNs "NonZeroI32"); disambiguator = 0 }] + }; + generic_args = []} + } : chString)) + | Cis1Error_Unauthorized => + failure (ret_both ((AST import) Unsafe blocks are not allowed. + : chString)) (ret_both ({ Types.attributes = []; + contents = + Types.Block { + expr = + (Some { Types.attributes = []; + contents = + Types.Call { + args = + [{ Types.attributes = []; + contents = + Types.Literal { + lit = + { Types.node = (Types.Int ("42000003", Types.Unsuffixed)); + span = + { Types.filename = + (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "83"; line = "657" }; + lo = { Types.col = "75"; line = "657" } } + }; + neg = true}; + hir_id = (Some ("104", "43")); + span = + { Types.filename = + (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "83"; line = "657" }; + lo = { Types.col = "74"; line = "657" } }; + ty = (Types.Int Types.I32) } + ]; + fn_span = + { Types.filename = + (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "84"; line = "657" }; + lo = { Types.col = "48"; line = "657" } }; + from_hir_call = true; + fun' = + { Types.attributes = []; + contents = + Types.GlobalName { + id = + { Types.index = (1, 22145); krate = "core"; + path = + [{ Types.data = (Types.TypeNs "num"); disambiguator = 0 }; + { Types.data = (Types.TypeNs "nonzero"); + disambiguator = 0 }; + { Types.data = Types.Impl; disambiguator = 56 }; + { Types.data = (Types.ValueNs "new_unchecked"); + disambiguator = 0 } + ] + }}; + hir_id = None; + span = + { Types.filename = + (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "73"; line = "657" }; + lo = { Types.col = "48"; line = "657" } }; + ty = + (Types.Arrow + { Types.bound_vars = []; + value = + { Types.abi = Types.Abi {todo = "Rust"}; + c_variadic = false; inputs = [(Types.Int Types.I32)]; + output = + Types.Adt { + def_id = + { Types.index = (1, 22484); krate = "core"; + path = + [{ Types.data = (Types.TypeNs "num"); + disambiguator = 0 }; + { Types.data = (Types.TypeNs "nonzero"); + disambiguator = 0 }; + { Types.data = (Types.TypeNs "NonZeroI32"); + disambiguator = 0 } + ] + }; + generic_args = []}; + unsafety = Types.Unsafe } + }) + }; + impl = None; + ty = + (Types.Arrow + { Types.bound_vars = []; + value = + { Types.abi = Types.Abi {todo = "Rust"}; + c_variadic = false; inputs = [(Types.Int Types.I32)]; + output = + Types.Adt { + def_id = + { Types.index = (1, 22484); krate = "core"; + path = + [{ Types.data = (Types.TypeNs "num"); + disambiguator = 0 }; + { Types.data = (Types.TypeNs "nonzero"); + disambiguator = 0 }; + { Types.data = (Types.TypeNs "NonZeroI32"); + disambiguator = 0 } + ] + }; + generic_args = []}; + unsafety = Types.Unsafe } + })}; + hir_id = (Some ("104", "38")); + span = + { Types.filename = + (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "84"; line = "657" }; + lo = { Types.col = "48"; line = "657" } }; + ty = + Types.Adt { + def_id = + { Types.index = (1, 22484); krate = "core"; + path = + [{ Types.data = (Types.TypeNs "num"); disambiguator = 0 }; + { Types.data = (Types.TypeNs "nonzero"); disambiguator = 0 + }; + { Types.data = (Types.TypeNs "NonZeroI32"); + disambiguator = 0 } + ] + }; + generic_args = []} + }); + opt_destruction_scope = None; + region_scope = { Types.data = Types.Node; id = "45" }; + safety_mode = Types.ExplicitUnsafe; + span = + { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "86"; line = "657" }; + lo = { Types.col = "39"; line = "657" } }; + stmts = []; targeted_by_break = false}; + hir_id = (Some ("104", "37")); + span = + { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); + hi = { Types.col = "86"; line = "657" }; + lo = { Types.col = "39"; line = "657" } }; + ty = + Types.Adt { + def_id = + { Types.index = (1, 22484); krate = "core"; + path = + [{ Types.data = (Types.TypeNs "num"); disambiguator = 0 }; + { Types.data = (Types.TypeNs "nonzero"); disambiguator = 0 }; + { Types.data = (Types.TypeNs "NonZeroI32"); disambiguator = 0 }] + }; + generic_args = []} + } : chString)) + | Cis1Error_Custom reject => + f_error_code (f_into reject) + end in + solve_lift (Build_t_Reject (f_error_code := error_code)) : both (L1 :|: fset []) I1 (t_Reject) in + {| f_from_loc := (fset [] : {fset Location}); + f_from := (@f_from)|}. +Fail Next Obligation. +Hint Unfold t_Reject_t_From. + +#[global] Program Instance t_Cis1Error (v_X)_t_From {v_X : _} `{ t_Sized (v_X)} `{ t_From (v_X) (t_LogError)} : t_From t_Cis1Error (v_X) t_LogError := + let f_from := fun {L1 : {fset Location}} {I1 : Interface} (err : both L1 I1 (t_LogError)) => Cis1Error_Custom (solve_lift (f_from err)) : both (L1 :|: fset []) I1 (t_Cis1Error (v_X)) in + {| f_from_loc := (fset [] : {fset Location}); + f_from := (@f_from)|}. +Fail Next Obligation. +Hint Unfold t_Cis1Error (v_X)_t_From. + +#[global] Program Instance t_Cis1Error (v_X)_t_From {v_X : _} `{ t_Sized (v_X)} `{ t_From (v_X) (t_ParseError)} : t_From t_Cis1Error (v_X) t_ParseError := + let f_from := fun {L1 : {fset Location}} {I1 : Interface} (err : both L1 I1 (t_ParseError)) => Cis1Error_Custom (solve_lift (f_from err)) : both (L1 :|: fset []) I1 (t_Cis1Error (v_X)) in + {| f_from_loc := (fset [] : {fset Location}); + f_from := (@f_from)|}. +Fail Next Obligation. +Hint Unfold t_Cis1Error (v_X)_t_From. + +Definition t_Receiver : choice_type := + chFin (mkpos 2). +Equations Receiver_Account {L : {fset Location}} {I : Interface} : t_AccountAddress (both L I t_Receiver) := + Receiver_Account := + solve_lift ret_both (fintype.Ordinal (n:=2) (m:=0) eq_refl : t_Receiver) : t_AccountAddress (both L I t_Receiver). +Fail Next Obligation. +Equations Receiver_Contract {L : {fset Location}} {I : Interface} : (t_ContractAddress × t_OwnedReceiveName) -> both L I t_Receiver := + Receiver_Contract := + solve_lift ret_both (fintype.Ordinal (n:=2) (m:=1) eq_refl : t_Receiver) : (t_ContractAddress × t_OwnedReceiveName) -> both L I t_Receiver. +Fail Next Obligation. + +Equations from_account {L1 : {fset Location}} {I1 : Interface} (address : both L1 I1 (t_AccountAddress)) : both L1 I1 (t_Receiver) := + from_account address := + Receiver_Account (solve_lift address) : both L1 I1 (t_Receiver). +Fail Next Obligation. + +Equations from_contract {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (address : both L1 I1 (t_ContractAddress)) (function : both L2 I2 (t_OwnedReceiveName)) : both (L1 :|: L2) (I1 :|: I2) (t_Receiver) := + from_contract address function := + Receiver_Contract (solve_lift address) (solve_lift function) : both (L1 :|: L2) (I1 :|: I2) (t_Receiver). +Fail Next Obligation. + +Equations address {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Receiver)) : both L1 I1 (t_Address) := + address self := + solve_lift matchb self with + | Receiver_Account address => + Address_Account address + | Receiver_Contract address => + Address_Contract address + end : both L1 I1 (t_Address). +Fail Next Obligation. + +#[global] Program Instance t_Receiver_t_SchemaType : t_SchemaType t_Receiver := + let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_Enum (solve_lift (into_vec (unsize (box_new (array_from_list [prod_b (f_from (ret_both (Account : chString)),Fields_Unnamed (into_vec (unsize (box_new (array_from_list [f_get_type]))))); + prod_b (f_from (ret_both (Contract : chString)),Fields_Unnamed (into_vec (unsize (box_new (array_from_list [f_get_type; + f_get_type])))))]))))) : both (L :|: fset []) I (t_Type) in + {| f_get_type_loc := (fset [] : {fset Location}); + f_get_type := (@f_get_type)|}. +Fail Next Obligation. +Hint Unfold t_Receiver_t_SchemaType. + +#[global] Program Instance t_Receiver_t_From : t_From t_Receiver t_AccountAddress := + let f_from := fun {L1 : {fset Location}} {I1 : Interface} (address : both L1 I1 (t_AccountAddress)) => solve_lift (from_account address) : both (L1 :|: fset []) I1 (t_Receiver) in + {| f_from_loc := (fset [] : {fset Location}); + f_from := (@f_from)|}. +Fail Next Obligation. +Hint Unfold t_Receiver_t_From. + +Definition t_AdditionalData : choice_type := + (t_Vec (int8) (t_Global)). +Equations 0 {L : {fset Location}} {I : Interface} (s : both L I (t_AdditionalData)) : both L I (t_Vec (int8) (t_Global)) := + 0 s := + bind_both s (fun x => + solve_lift (ret_both (x : t_Vec (int8) (t_Global)))) : both L I (t_Vec (int8) (t_Global)). +Fail Next Obligation. +Equations Build_t_AdditionalData {L0 : {fset Location}} {I0 : Interface} {0 : both L0 I0 (t_Vec (int8) (t_Global))} : both L0 I0 (t_AdditionalData) := + Build_t_AdditionalData := + bind_both 0 (fun 0 => + solve_lift (ret_both ((0) : (t_AdditionalData)))) : both L0 I0 (t_AdditionalData). +Fail Next Obligation. +Notation "'Build_t_AdditionalData' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_AdditionalData (0 := y)). + +#[global] Program Instance t_AdditionalData_t_SchemaType : t_SchemaType t_AdditionalData := + let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_List SizeLength_U16 Type_U8 : both (L :|: fset []) I (t_Type) in + {| f_get_type_loc := (fset [] : {fset Location}); + f_get_type := (@f_get_type)|}. +Fail Next Obligation. +Hint Unfold t_AdditionalData_t_SchemaType. + +Equations empty {L : {fset Location}} {I : Interface} : both L I (t_AdditionalData) := + empty := + AdditionalData (solve_lift new) : both L I (t_AdditionalData). +Fail Next Obligation. + +#[global] Program Instance t_AdditionalData_t_From : t_From t_AdditionalData t_Vec (int8) (t_Global) := + let f_from := fun {L1 : {fset Location}} {I1 : Interface} (data : both L1 I1 (t_Vec (int8) (t_Global))) => AdditionalData (solve_lift data) : both (L1 :|: fset []) I1 (t_AdditionalData) in + {| f_from_loc := (fset [] : {fset Location}); + f_from := (@f_from)|}. +Fail Next Obligation. +Hint Unfold t_AdditionalData_t_From. + +#[global] Program Instance t_AdditionalData_t_AsRef : t_AsRef t_AdditionalData seq int8 := + let f_as_ref := fun {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_AdditionalData)) => solve_lift (f_deref (0 self)) : both (L1 :|: fset []) I1 (seq int8) in + {| f_as_ref_loc := (fset [] : {fset Location}); + f_as_ref := (@f_as_ref)|}. +Fail Next Obligation. +Hint Unfold t_AdditionalData_t_AsRef. + +Definition t_Transfer {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := + (v_T × int64 × t_Address × t_Receiver × t_AdditionalData). +Equations f_token_id {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_Transfer)) : both L I (v_T) := + f_token_id s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst x))) : v_T))) : both L I (v_T). +Fail Next Obligation. +Equations f_amount {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_Transfer)) : both L I (int64) := + f_amount s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : int64))) : both L I (int64). +Fail Next Obligation. +Equations f_from {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_Transfer)) : both L I (t_Address) := + f_from s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : t_Address))) : both L I (t_Address). +Fail Next Obligation. +Equations f_to {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_Transfer)) : both L I (t_Receiver) := + f_to s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : t_Receiver))) : both L I (t_Receiver). +Fail Next Obligation. +Equations f_data {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_Transfer)) : both L I (t_AdditionalData) := + f_data s := + bind_both s (fun x => + solve_lift (ret_both (snd x : t_AdditionalData))) : both L I (t_AdditionalData). +Fail Next Obligation. +Equations Build_t_Transfer {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {f_token_id : both L0 I0 (v_T)} {f_amount : both L1 I1 (int64)} {f_from : both L2 I2 (t_Address)} {f_to : both L3 I3 (t_Receiver)} {f_data : both L4 I4 (t_AdditionalData)} : both (L0:|:L1:|:L2:|:L3:|:L4) (I0:|:I1:|:I2:|:I3:|:I4) (t_Transfer) := + Build_t_Transfer := + bind_both f_data (fun f_data => + bind_both f_to (fun f_to => + bind_both f_from (fun f_from => + bind_both f_amount (fun f_amount => + bind_both f_token_id (fun f_token_id => + solve_lift (ret_both ((f_token_id,f_amount,f_from,f_to,f_data) : (t_Transfer)))))))) : both (L0:|:L1:|:L2:|:L3:|:L4) (I0:|:I1:|:I2:|:I3:|:I4) (t_Transfer). +Fail Next Obligation. +Notation "'Build_t_Transfer' '[' x ']' '(' 'f_token_id' ':=' y ')'" := (Build_t_Transfer (f_token_id := y) (f_amount := f_amount x) (f_from := f_from x) (f_to := f_to x) (f_data := f_data x)). +Notation "'Build_t_Transfer' '[' x ']' '(' 'f_amount' ':=' y ')'" := (Build_t_Transfer (f_token_id := f_token_id x) (f_amount := y) (f_from := f_from x) (f_to := f_to x) (f_data := f_data x)). +Notation "'Build_t_Transfer' '[' x ']' '(' 'f_from' ':=' y ')'" := (Build_t_Transfer (f_token_id := f_token_id x) (f_amount := f_amount x) (f_from := y) (f_to := f_to x) (f_data := f_data x)). +Notation "'Build_t_Transfer' '[' x ']' '(' 'f_to' ':=' y ')'" := (Build_t_Transfer (f_token_id := f_token_id x) (f_amount := f_amount x) (f_from := f_from x) (f_to := y) (f_data := f_data x)). +Notation "'Build_t_Transfer' '[' x ']' '(' 'f_data' ':=' y ')'" := (Build_t_Transfer (f_token_id := f_token_id x) (f_amount := f_amount x) (f_from := f_from x) (f_to := f_to x) (f_data := y)). + +#[global] Program Instance t_Transfer (v_T)_t_SchemaType {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_SchemaType t_Transfer (v_T) := + let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_Struct (Fields_Named (solve_lift (into_vec (unsize (box_new (array_from_list [prod_b (f_from (ret_both (token_id : chString)),f_get_type); + prod_b (f_from (ret_both (amount : chString)),f_get_type); + prod_b (f_from (ret_both (from : chString)),f_get_type); + prod_b (f_from (ret_both (to : chString)),f_get_type); + prod_b (f_from (ret_both (data : chString)),f_get_type)])))))) : both (L :|: fset []) I (t_Type) in + {| f_get_type_loc := (fset [] : {fset Location}); + f_get_type := (@f_get_type)|}. +Fail Next Obligation. +Hint Unfold t_Transfer (v_T)_t_SchemaType. + +Definition t_TransferParams {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := + (t_Vec (t_Transfer (v_T)) (t_Global)). +Equations 0 {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TransferParams)) : both L I (t_Vec (t_Transfer (v_T)) (t_Global)) := + 0 s := + bind_both s (fun x => + solve_lift (ret_both (x : t_Vec (t_Transfer (v_T)) (t_Global)))) : both L I (t_Vec (t_Transfer (v_T)) (t_Global)). +Fail Next Obligation. +Equations Build_t_TransferParams {L0 : {fset Location}} {I0 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {0 : both L0 I0 (t_Vec (t_Transfer (v_T)) (t_Global))} : both L0 I0 (t_TransferParams) := + Build_t_TransferParams := + bind_both 0 (fun 0 => + solve_lift (ret_both ((0) : (t_TransferParams)))) : both L0 I0 (t_TransferParams). +Fail Next Obligation. +Notation "'Build_t_TransferParams' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_TransferParams (0 := y)). + +#[global] Program Instance t_TransferParams (v_T)_t_SchemaType {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_SchemaType t_TransferParams (v_T) := + let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_List SizeLength_U16 (solve_lift f_get_type) : both (L :|: fset []) I (t_Type) in + {| f_get_type_loc := (fset [] : {fset Location}); + f_get_type := (@f_get_type)|}. +Fail Next Obligation. +Hint Unfold t_TransferParams (v_T)_t_SchemaType. + +#[global] Program Instance t_TransferParams (v_T)_t_From {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_From t_TransferParams (v_T) t_Vec (t_Transfer (v_T)) (t_Global) := + let f_from := fun {L1 : {fset Location}} {I1 : Interface} (transfers : both L1 I1 (t_Vec (t_Transfer (v_T)) (t_Global))) => TransferParams (solve_lift transfers) : both (L1 :|: fset []) I1 (t_TransferParams (v_T)) in + {| f_from_loc := (fset [] : {fset Location}); + f_from := (@f_from)|}. +Fail Next Obligation. +Hint Unfold t_TransferParams (v_T)_t_From. + +#[global] Program Instance t_TransferParams (v_T)_t_AsRef {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_AsRef t_TransferParams (v_T) seq t_Transfer (v_T) := + let f_as_ref := fun {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_TransferParams (v_T))) => solve_lift (f_deref (0 self)) : both (L1 :|: fset []) I1 (seq t_Transfer (v_T)) in + {| f_as_ref_loc := (fset [] : {fset Location}); + f_as_ref := (@f_as_ref)|}. +Fail Next Obligation. +Hint Unfold t_TransferParams (v_T)_t_AsRef. + +Definition t_UpdateOperator : choice_type := + (t_OperatorUpdate × t_Address). +Equations f_update {L : {fset Location}} {I : Interface} (s : both L I (t_UpdateOperator)) : both L I (t_OperatorUpdate) := + f_update s := + bind_both s (fun x => + solve_lift (ret_both (fst x : t_OperatorUpdate))) : both L I (t_OperatorUpdate). +Fail Next Obligation. +Equations f_operator {L : {fset Location}} {I : Interface} (s : both L I (t_UpdateOperator)) : both L I (t_Address) := + f_operator s := + bind_both s (fun x => + solve_lift (ret_both (snd x : t_Address))) : both L I (t_Address). +Fail Next Obligation. +Equations Build_t_UpdateOperator {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_update : both L0 I0 (t_OperatorUpdate)} {f_operator : both L1 I1 (t_Address)} : both (L0:|:L1) (I0:|:I1) (t_UpdateOperator) := + Build_t_UpdateOperator := + bind_both f_operator (fun f_operator => + bind_both f_update (fun f_update => + solve_lift (ret_both ((f_update,f_operator) : (t_UpdateOperator))))) : both (L0:|:L1) (I0:|:I1) (t_UpdateOperator). +Fail Next Obligation. +Notation "'Build_t_UpdateOperator' '[' x ']' '(' 'f_update' ':=' y ')'" := (Build_t_UpdateOperator (f_update := y) (f_operator := f_operator x)). +Notation "'Build_t_UpdateOperator' '[' x ']' '(' 'f_operator' ':=' y ')'" := (Build_t_UpdateOperator (f_update := f_update x) (f_operator := y)). + +Definition t_UpdateOperatorParams : choice_type := + (t_Vec (t_UpdateOperator) (t_Global)). +Equations 0 {L : {fset Location}} {I : Interface} (s : both L I (t_UpdateOperatorParams)) : both L I (t_Vec (t_UpdateOperator) (t_Global)) := + 0 s := + bind_both s (fun x => + solve_lift (ret_both (x : t_Vec (t_UpdateOperator) (t_Global)))) : both L I (t_Vec (t_UpdateOperator) (t_Global)). +Fail Next Obligation. +Equations Build_t_UpdateOperatorParams {L0 : {fset Location}} {I0 : Interface} {0 : both L0 I0 (t_Vec (t_UpdateOperator) (t_Global))} : both L0 I0 (t_UpdateOperatorParams) := + Build_t_UpdateOperatorParams := + bind_both 0 (fun 0 => + solve_lift (ret_both ((0) : (t_UpdateOperatorParams)))) : both L0 I0 (t_UpdateOperatorParams). +Fail Next Obligation. +Notation "'Build_t_UpdateOperatorParams' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_UpdateOperatorParams (0 := y)). + +Definition t_BalanceOfQuery {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := + (v_T × t_Address). +Equations f_token_id {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_BalanceOfQuery)) : both L I (v_T) := + f_token_id s := + bind_both s (fun x => + solve_lift (ret_both (fst x : v_T))) : both L I (v_T). +Fail Next Obligation. +Equations f_address {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_BalanceOfQuery)) : both L I (t_Address) := + f_address s := + bind_both s (fun x => + solve_lift (ret_both (snd x : t_Address))) : both L I (t_Address). +Fail Next Obligation. +Equations Build_t_BalanceOfQuery {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {f_token_id : both L0 I0 (v_T)} {f_address : both L1 I1 (t_Address)} : both (L0:|:L1) (I0:|:I1) (t_BalanceOfQuery) := + Build_t_BalanceOfQuery := + bind_both f_address (fun f_address => + bind_both f_token_id (fun f_token_id => + solve_lift (ret_both ((f_token_id,f_address) : (t_BalanceOfQuery))))) : both (L0:|:L1) (I0:|:I1) (t_BalanceOfQuery). +Fail Next Obligation. +Notation "'Build_t_BalanceOfQuery' '[' x ']' '(' 'f_token_id' ':=' y ')'" := (Build_t_BalanceOfQuery (f_token_id := y) (f_address := f_address x)). +Notation "'Build_t_BalanceOfQuery' '[' x ']' '(' 'f_address' ':=' y ')'" := (Build_t_BalanceOfQuery (f_token_id := f_token_id x) (f_address := y)). + +Definition t_BalanceOfQueryParams {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := + (t_ContractAddress × t_OwnedReceiveName × t_Vec (t_BalanceOfQuery (v_T)) (t_Global)). +Equations f_result_contract {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_BalanceOfQueryParams)) : both L I (t_ContractAddress) := + f_result_contract s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : t_ContractAddress))) : both L I (t_ContractAddress). +Fail Next Obligation. +Equations f_result_function {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_BalanceOfQueryParams)) : both L I (t_OwnedReceiveName) := + f_result_function s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : t_OwnedReceiveName))) : both L I (t_OwnedReceiveName). +Fail Next Obligation. +Equations f_queries {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_BalanceOfQueryParams)) : both L I (t_Vec (t_BalanceOfQuery (v_T)) (t_Global)) := + f_queries s := + bind_both s (fun x => + solve_lift (ret_both (snd x : t_Vec (t_BalanceOfQuery (v_T)) (t_Global)))) : both L I (t_Vec (t_BalanceOfQuery (v_T)) (t_Global)). +Fail Next Obligation. +Equations Build_t_BalanceOfQueryParams {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {f_result_contract : both L0 I0 (t_ContractAddress)} {f_result_function : both L1 I1 (t_OwnedReceiveName)} {f_queries : both L2 I2 (t_Vec (t_BalanceOfQuery (v_T)) (t_Global))} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_BalanceOfQueryParams) := + Build_t_BalanceOfQueryParams := + bind_both f_queries (fun f_queries => + bind_both f_result_function (fun f_result_function => + bind_both f_result_contract (fun f_result_contract => + solve_lift (ret_both ((f_result_contract,f_result_function,f_queries) : (t_BalanceOfQueryParams)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_BalanceOfQueryParams). +Fail Next Obligation. +Notation "'Build_t_BalanceOfQueryParams' '[' x ']' '(' 'f_result_contract' ':=' y ')'" := (Build_t_BalanceOfQueryParams (f_result_contract := y) (f_result_function := f_result_function x) (f_queries := f_queries x)). +Notation "'Build_t_BalanceOfQueryParams' '[' x ']' '(' 'f_result_function' ':=' y ')'" := (Build_t_BalanceOfQueryParams (f_result_contract := f_result_contract x) (f_result_function := y) (f_queries := f_queries x)). +Notation "'Build_t_BalanceOfQueryParams' '[' x ']' '(' 'f_queries' ':=' y ')'" := (Build_t_BalanceOfQueryParams (f_result_contract := f_result_contract x) (f_result_function := f_result_function x) (f_queries := y)). + +Definition t_BalanceOfQueryResult {v_T : _} `{ t_Sized (v_T)} : choice_type := + (t_BalanceOfQuery (v_T) × int64). + +Definition t_BalanceOfQueryResponse {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := + (t_Vec ((t_BalanceOfQuery (v_T) × int64)) (t_Global)). +Equations 0 {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_BalanceOfQueryResponse)) : both L I (t_Vec ((t_BalanceOfQuery (v_T) × int64)) (t_Global)) := + 0 s := + bind_both s (fun x => + solve_lift (ret_both (x : t_Vec ((t_BalanceOfQuery (v_T) × int64)) (t_Global)))) : both L I (t_Vec ((t_BalanceOfQuery (v_T) × int64)) (t_Global)). +Fail Next Obligation. +Equations Build_t_BalanceOfQueryResponse {L0 : {fset Location}} {I0 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {0 : both L0 I0 (t_Vec ((t_BalanceOfQuery (v_T) × int64)) (t_Global))} : both L0 I0 (t_BalanceOfQueryResponse) := + Build_t_BalanceOfQueryResponse := + bind_both 0 (fun 0 => + solve_lift (ret_both ((0) : (t_BalanceOfQueryResponse)))) : both L0 I0 (t_BalanceOfQueryResponse). +Fail Next Obligation. +Notation "'Build_t_BalanceOfQueryResponse' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_BalanceOfQueryResponse (0 := y)). + +#[global] Program Instance t_BalanceOfQueryResponse (v_T)_t_From {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_From t_BalanceOfQueryResponse (v_T) t_Vec ((t_BalanceOfQuery (v_T) × int64)) (t_Global) := + let f_from := fun {L1 : {fset Location}} {I1 : Interface} (results : both L1 I1 (t_Vec ((t_BalanceOfQuery (v_T) × int64)) (t_Global))) => BalanceOfQueryResponse (solve_lift results) : both (L1 :|: fset []) I1 (t_BalanceOfQueryResponse (v_T)) in + {| f_from_loc := (fset [] : {fset Location}); + f_from := (@f_from)|}. +Fail Next Obligation. +Hint Unfold t_BalanceOfQueryResponse (v_T)_t_From. + +#[global] Program Instance t_BalanceOfQueryResponse (v_T)_t_AsRef {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_AsRef t_BalanceOfQueryResponse (v_T) seq (t_BalanceOfQuery (v_T) × int64) := + let f_as_ref := fun {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_BalanceOfQueryResponse (v_T))) => solve_lift (f_deref (0 self)) : both (L1 :|: fset []) I1 (seq (t_BalanceOfQuery (v_T) × int64)) in + {| f_as_ref_loc := (fset [] : {fset Location}); + f_as_ref := (@f_as_ref)|}. +Fail Next Obligation. +Hint Unfold t_BalanceOfQueryResponse (v_T)_t_AsRef. + +Definition t_OperatorOfQuery : choice_type := + (t_Address × t_Address). +Equations f_owner {L : {fset Location}} {I : Interface} (s : both L I (t_OperatorOfQuery)) : both L I (t_Address) := + f_owner s := + bind_both s (fun x => + solve_lift (ret_both (fst x : t_Address))) : both L I (t_Address). +Fail Next Obligation. +Equations f_address {L : {fset Location}} {I : Interface} (s : both L I (t_OperatorOfQuery)) : both L I (t_Address) := + f_address s := + bind_both s (fun x => + solve_lift (ret_both (snd x : t_Address))) : both L I (t_Address). +Fail Next Obligation. +Equations Build_t_OperatorOfQuery {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_owner : both L0 I0 (t_Address)} {f_address : both L1 I1 (t_Address)} : both (L0:|:L1) (I0:|:I1) (t_OperatorOfQuery) := + Build_t_OperatorOfQuery := + bind_both f_address (fun f_address => + bind_both f_owner (fun f_owner => + solve_lift (ret_both ((f_owner,f_address) : (t_OperatorOfQuery))))) : both (L0:|:L1) (I0:|:I1) (t_OperatorOfQuery). +Fail Next Obligation. +Notation "'Build_t_OperatorOfQuery' '[' x ']' '(' 'f_owner' ':=' y ')'" := (Build_t_OperatorOfQuery (f_owner := y) (f_address := f_address x)). +Notation "'Build_t_OperatorOfQuery' '[' x ']' '(' 'f_address' ':=' y ')'" := (Build_t_OperatorOfQuery (f_owner := f_owner x) (f_address := y)). + +Definition t_OperatorOfQueryParams : choice_type := + (t_ContractAddress × t_OwnedReceiveName × t_Vec (t_OperatorOfQuery) (t_Global)). +Equations f_result_contract {L : {fset Location}} {I : Interface} (s : both L I (t_OperatorOfQueryParams)) : both L I (t_ContractAddress) := + f_result_contract s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : t_ContractAddress))) : both L I (t_ContractAddress). +Fail Next Obligation. +Equations f_result_function {L : {fset Location}} {I : Interface} (s : both L I (t_OperatorOfQueryParams)) : both L I (t_OwnedReceiveName) := + f_result_function s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : t_OwnedReceiveName))) : both L I (t_OwnedReceiveName). +Fail Next Obligation. +Equations f_queries {L : {fset Location}} {I : Interface} (s : both L I (t_OperatorOfQueryParams)) : both L I (t_Vec (t_OperatorOfQuery) (t_Global)) := + f_queries s := + bind_both s (fun x => + solve_lift (ret_both (snd x : t_Vec (t_OperatorOfQuery) (t_Global)))) : both L I (t_Vec (t_OperatorOfQuery) (t_Global)). +Fail Next Obligation. +Equations Build_t_OperatorOfQueryParams {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_result_contract : both L0 I0 (t_ContractAddress)} {f_result_function : both L1 I1 (t_OwnedReceiveName)} {f_queries : both L2 I2 (t_Vec (t_OperatorOfQuery) (t_Global))} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_OperatorOfQueryParams) := + Build_t_OperatorOfQueryParams := + bind_both f_queries (fun f_queries => + bind_both f_result_function (fun f_result_function => + bind_both f_result_contract (fun f_result_contract => + solve_lift (ret_both ((f_result_contract,f_result_function,f_queries) : (t_OperatorOfQueryParams)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_OperatorOfQueryParams). +Fail Next Obligation. +Notation "'Build_t_OperatorOfQueryParams' '[' x ']' '(' 'f_result_contract' ':=' y ')'" := (Build_t_OperatorOfQueryParams (f_result_contract := y) (f_result_function := f_result_function x) (f_queries := f_queries x)). +Notation "'Build_t_OperatorOfQueryParams' '[' x ']' '(' 'f_result_function' ':=' y ')'" := (Build_t_OperatorOfQueryParams (f_result_contract := f_result_contract x) (f_result_function := y) (f_queries := f_queries x)). +Notation "'Build_t_OperatorOfQueryParams' '[' x ']' '(' 'f_queries' ':=' y ')'" := (Build_t_OperatorOfQueryParams (f_result_contract := f_result_contract x) (f_result_function := f_result_function x) (f_queries := y)). + +Notation "'t_OperatorOfQueryResult'" := ((t_OperatorOfQuery × 'bool)). + +Definition t_OperatorOfQueryResponse : choice_type := + (t_Vec ((t_OperatorOfQuery × 'bool)) (t_Global)). +Equations 0 {L : {fset Location}} {I : Interface} (s : both L I (t_OperatorOfQueryResponse)) : both L I (t_Vec ((t_OperatorOfQuery × 'bool)) (t_Global)) := + 0 s := + bind_both s (fun x => + solve_lift (ret_both (x : t_Vec ((t_OperatorOfQuery × 'bool)) (t_Global)))) : both L I (t_Vec ((t_OperatorOfQuery × 'bool)) (t_Global)). +Fail Next Obligation. +Equations Build_t_OperatorOfQueryResponse {L0 : {fset Location}} {I0 : Interface} {0 : both L0 I0 (t_Vec ((t_OperatorOfQuery × 'bool)) (t_Global))} : both L0 I0 (t_OperatorOfQueryResponse) := + Build_t_OperatorOfQueryResponse := + bind_both 0 (fun 0 => + solve_lift (ret_both ((0) : (t_OperatorOfQueryResponse)))) : both L0 I0 (t_OperatorOfQueryResponse). +Fail Next Obligation. +Notation "'Build_t_OperatorOfQueryResponse' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_OperatorOfQueryResponse (0 := y)). + +#[global] Program Instance t_OperatorOfQueryResponse_t_From : t_From t_OperatorOfQueryResponse t_Vec ((t_OperatorOfQuery × 'bool)) (t_Global) := + let f_from := fun {L1 : {fset Location}} {I1 : Interface} (results : both L1 I1 (t_Vec ((t_OperatorOfQuery × 'bool)) (t_Global))) => OperatorOfQueryResponse (solve_lift results) : both (L1 :|: fset []) I1 (t_OperatorOfQueryResponse) in + {| f_from_loc := (fset [] : {fset Location}); + f_from := (@f_from)|}. +Fail Next Obligation. +Hint Unfold t_OperatorOfQueryResponse_t_From. + +#[global] Program Instance t_OperatorOfQueryResponse_t_AsRef : t_AsRef t_OperatorOfQueryResponse seq (t_OperatorOfQuery × 'bool) := + let f_as_ref := fun {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_OperatorOfQueryResponse)) => solve_lift (f_deref (0 self)) : both (L1 :|: fset []) I1 (seq (t_OperatorOfQuery × 'bool)) in + {| f_as_ref_loc := (fset [] : {fset Location}); + f_as_ref := (@f_as_ref)|}. +Fail Next Obligation. +Hint Unfold t_OperatorOfQueryResponse_t_AsRef. + +Definition t_TokenMetadataQueryParams {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := + (t_ContractAddress × t_OwnedReceiveName × t_Vec (v_T) (t_Global)). +Equations f_result_contract {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TokenMetadataQueryParams)) : both L I (t_ContractAddress) := + f_result_contract s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : t_ContractAddress))) : both L I (t_ContractAddress). +Fail Next Obligation. +Equations f_result_function {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TokenMetadataQueryParams)) : both L I (t_OwnedReceiveName) := + f_result_function s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : t_OwnedReceiveName))) : both L I (t_OwnedReceiveName). +Fail Next Obligation. +Equations f_queries {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TokenMetadataQueryParams)) : both L I (t_Vec (v_T) (t_Global)) := + f_queries s := + bind_both s (fun x => + solve_lift (ret_both (snd x : t_Vec (v_T) (t_Global)))) : both L I (t_Vec (v_T) (t_Global)). +Fail Next Obligation. +Equations Build_t_TokenMetadataQueryParams {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {f_result_contract : both L0 I0 (t_ContractAddress)} {f_result_function : both L1 I1 (t_OwnedReceiveName)} {f_queries : both L2 I2 (t_Vec (v_T) (t_Global))} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_TokenMetadataQueryParams) := + Build_t_TokenMetadataQueryParams := + bind_both f_queries (fun f_queries => + bind_both f_result_function (fun f_result_function => + bind_both f_result_contract (fun f_result_contract => + solve_lift (ret_both ((f_result_contract,f_result_function,f_queries) : (t_TokenMetadataQueryParams)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_TokenMetadataQueryParams). +Fail Next Obligation. +Notation "'Build_t_TokenMetadataQueryParams' '[' x ']' '(' 'f_result_contract' ':=' y ')'" := (Build_t_TokenMetadataQueryParams (f_result_contract := y) (f_result_function := f_result_function x) (f_queries := f_queries x)). +Notation "'Build_t_TokenMetadataQueryParams' '[' x ']' '(' 'f_result_function' ':=' y ')'" := (Build_t_TokenMetadataQueryParams (f_result_contract := f_result_contract x) (f_result_function := y) (f_queries := f_queries x)). +Notation "'Build_t_TokenMetadataQueryParams' '[' x ']' '(' 'f_queries' ':=' y ')'" := (Build_t_TokenMetadataQueryParams (f_result_contract := f_result_contract x) (f_result_function := f_result_function x) (f_queries := y)). + +Definition t_TokenMetadataQueryResult {v_T : _} `{ t_Sized (v_T)} : choice_type := + (v_T × t_MetadataUrl). + +Definition t_TokenMetadataQueryResponse {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := + (t_Vec ((v_T × t_MetadataUrl)) (t_Global)). +Equations 0 {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TokenMetadataQueryResponse)) : both L I (t_Vec ((v_T × t_MetadataUrl)) (t_Global)) := + 0 s := + bind_both s (fun x => + solve_lift (ret_both (x : t_Vec ((v_T × t_MetadataUrl)) (t_Global)))) : both L I (t_Vec ((v_T × t_MetadataUrl)) (t_Global)). +Fail Next Obligation. +Equations Build_t_TokenMetadataQueryResponse {L0 : {fset Location}} {I0 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {0 : both L0 I0 (t_Vec ((v_T × t_MetadataUrl)) (t_Global))} : both L0 I0 (t_TokenMetadataQueryResponse) := + Build_t_TokenMetadataQueryResponse := + bind_both 0 (fun 0 => + solve_lift (ret_both ((0) : (t_TokenMetadataQueryResponse)))) : both L0 I0 (t_TokenMetadataQueryResponse). +Fail Next Obligation. +Notation "'Build_t_TokenMetadataQueryResponse' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_TokenMetadataQueryResponse (0 := y)). + +#[global] Program Instance t_TokenMetadataQueryResponse (v_T)_t_From {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_From t_TokenMetadataQueryResponse (v_T) t_Vec ((v_T × t_MetadataUrl)) (t_Global) := + let f_from := fun {L1 : {fset Location}} {I1 : Interface} (results : both L1 I1 (t_Vec ((v_T × t_MetadataUrl)) (t_Global))) => TokenMetadataQueryResponse (solve_lift results) : both (L1 :|: fset []) I1 (t_TokenMetadataQueryResponse (v_T)) in + {| f_from_loc := (fset [] : {fset Location}); + f_from := (@f_from)|}. +Fail Next Obligation. +Hint Unfold t_TokenMetadataQueryResponse (v_T)_t_From. + +#[global] Program Instance t_TokenMetadataQueryResponse (v_T)_t_AsRef {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_AsRef t_TokenMetadataQueryResponse (v_T) seq (v_T × t_MetadataUrl) := + let f_as_ref := fun {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_TokenMetadataQueryResponse (v_T))) => solve_lift (f_deref (0 self)) : both (L1 :|: fset []) I1 (seq (v_T × t_MetadataUrl)) in + {| f_as_ref_loc := (fset [] : {fset Location}); + f_as_ref := (@f_as_ref)|}. +Fail Next Obligation. +Hint Unfold t_TokenMetadataQueryResponse (v_T)_t_AsRef. + +Definition t_OnReceivingCis1Params {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := + (v_T × int64 × t_Address × t_OwnedContractName × t_AdditionalData). +Equations f_token_id {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_OnReceivingCis1Params)) : both L I (v_T) := + f_token_id s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst x))) : v_T))) : both L I (v_T). +Fail Next Obligation. +Equations f_amount {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_OnReceivingCis1Params)) : both L I (int64) := + f_amount s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : int64))) : both L I (int64). +Fail Next Obligation. +Equations f_from {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_OnReceivingCis1Params)) : both L I (t_Address) := + f_from s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : t_Address))) : both L I (t_Address). +Fail Next Obligation. +Equations f_contract_name {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_OnReceivingCis1Params)) : both L I (t_OwnedContractName) := + f_contract_name s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : t_OwnedContractName))) : both L I (t_OwnedContractName). +Fail Next Obligation. +Equations f_data {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_OnReceivingCis1Params)) : both L I (t_AdditionalData) := + f_data s := + bind_both s (fun x => + solve_lift (ret_both (snd x : t_AdditionalData))) : both L I (t_AdditionalData). +Fail Next Obligation. +Equations Build_t_OnReceivingCis1Params {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {f_token_id : both L0 I0 (v_T)} {f_amount : both L1 I1 (int64)} {f_from : both L2 I2 (t_Address)} {f_contract_name : both L3 I3 (t_OwnedContractName)} {f_data : both L4 I4 (t_AdditionalData)} : both (L0:|:L1:|:L2:|:L3:|:L4) (I0:|:I1:|:I2:|:I3:|:I4) (t_OnReceivingCis1Params) := + Build_t_OnReceivingCis1Params := + bind_both f_data (fun f_data => + bind_both f_contract_name (fun f_contract_name => + bind_both f_from (fun f_from => + bind_both f_amount (fun f_amount => + bind_both f_token_id (fun f_token_id => + solve_lift (ret_both ((f_token_id,f_amount,f_from,f_contract_name,f_data) : (t_OnReceivingCis1Params)))))))) : both (L0:|:L1:|:L2:|:L3:|:L4) (I0:|:I1:|:I2:|:I3:|:I4) (t_OnReceivingCis1Params). +Fail Next Obligation. +Notation "'Build_t_OnReceivingCis1Params' '[' x ']' '(' 'f_token_id' ':=' y ')'" := (Build_t_OnReceivingCis1Params (f_token_id := y) (f_amount := f_amount x) (f_from := f_from x) (f_contract_name := f_contract_name x) (f_data := f_data x)). +Notation "'Build_t_OnReceivingCis1Params' '[' x ']' '(' 'f_amount' ':=' y ')'" := (Build_t_OnReceivingCis1Params (f_token_id := f_token_id x) (f_amount := y) (f_from := f_from x) (f_contract_name := f_contract_name x) (f_data := f_data x)). +Notation "'Build_t_OnReceivingCis1Params' '[' x ']' '(' 'f_from' ':=' y ')'" := (Build_t_OnReceivingCis1Params (f_token_id := f_token_id x) (f_amount := f_amount x) (f_from := y) (f_contract_name := f_contract_name x) (f_data := f_data x)). +Notation "'Build_t_OnReceivingCis1Params' '[' x ']' '(' 'f_contract_name' ':=' y ')'" := (Build_t_OnReceivingCis1Params (f_token_id := f_token_id x) (f_amount := f_amount x) (f_from := f_from x) (f_contract_name := y) (f_data := f_data x)). +Notation "'Build_t_OnReceivingCis1Params' '[' x ']' '(' 'f_data' ':=' y ')'" := (Build_t_OnReceivingCis1Params (f_token_id := f_token_id x) (f_amount := f_amount x) (f_from := f_from x) (f_contract_name := f_contract_name x) (f_data := y)). diff --git a/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_prims.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_balance_of.v similarity index 71% rename from concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_prims.v rename to wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_balance_of.v index ea58ff7..4c8ece1 100644 --- a/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_prims.v +++ b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_balance_of.v @@ -3,12 +3,12 @@ Set Warnings "-notation-overridden,-ambiguous-paths". From Crypt Require Import choice_type Package Prelude. Import PackageNotation. From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. +From mathcomp Require Import word_ssrZ word. From Jasmin Require Import word. From Coq Require Import ZArith. From Coq Require Import Strings.String. - Import List.ListNotations. +Import List.ListNotations. Open Scope list_scope. Open Scope Z_scope. Open Scope bool_scope. @@ -24,6 +24,17 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Require Import Crate. -Export Crate. -Inductive Msg: Type :=. +Require Import Hacspec_concordium. +Export Hacspec_concordium. + +Require Import SeekFrom. +Export SeekFrom. + +Require Import ContractState. +Export ContractState. + +Require Import Logger. +Export Logger. + +Require Import trap. +Export trap. diff --git a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_init.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_init.v new file mode 100644 index 0000000..579ca7a --- /dev/null +++ b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_init.v @@ -0,0 +1,40 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_concordium. +Export Hacspec_concordium. + +Require Import trap. +Export trap. + +Require Import ExternContext. +Export ExternContext. + +Require Import InitContextExtern. +Export InitContextExtern. + +Require Import ContractState. +Export ContractState. diff --git a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_operator_of.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_operator_of.v new file mode 100644 index 0000000..4c8ece1 --- /dev/null +++ b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_operator_of.v @@ -0,0 +1,40 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_concordium. +Export Hacspec_concordium. + +Require Import SeekFrom. +Export SeekFrom. + +Require Import ContractState. +Export ContractState. + +Require Import Logger. +Export Logger. + +Require Import trap. +Export trap. diff --git a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_token_metadata.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_token_metadata.v new file mode 100644 index 0000000..4c8ece1 --- /dev/null +++ b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_token_metadata.v @@ -0,0 +1,40 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_concordium. +Export Hacspec_concordium. + +Require Import SeekFrom. +Export SeekFrom. + +Require Import ContractState. +Export ContractState. + +Require Import Logger. +Export Logger. + +Require Import trap. +Export trap. diff --git a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_transfer.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_transfer.v new file mode 100644 index 0000000..4c8ece1 --- /dev/null +++ b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_transfer.v @@ -0,0 +1,40 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_concordium. +Export Hacspec_concordium. + +Require Import SeekFrom. +Export SeekFrom. + +Require Import ContractState. +Export ContractState. + +Require Import Logger. +Export Logger. + +Require Import trap. +Export trap. diff --git a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_unwrap.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_unwrap.v new file mode 100644 index 0000000..4c8ece1 --- /dev/null +++ b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_unwrap.v @@ -0,0 +1,40 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_concordium. +Export Hacspec_concordium. + +Require Import SeekFrom. +Export SeekFrom. + +Require Import ContractState. +Export ContractState. + +Require Import Logger. +Export Logger. + +Require Import trap. +Export trap. diff --git a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_update_operator.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_update_operator.v new file mode 100644 index 0000000..4c8ece1 --- /dev/null +++ b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_update_operator.v @@ -0,0 +1,40 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_concordium. +Export Hacspec_concordium. + +Require Import SeekFrom. +Export SeekFrom. + +Require Import ContractState. +Export ContractState. + +Require Import Logger. +Export Logger. + +Require Import trap. +Export trap. diff --git a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_wrap.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_wrap.v new file mode 100644 index 0000000..4c8ece1 --- /dev/null +++ b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_wrap.v @@ -0,0 +1,40 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_concordium. +Export Hacspec_concordium. + +Require Import SeekFrom. +Export SeekFrom. + +Require Import ContractState. +Export ContractState. + +Require Import Logger. +Export Logger. + +Require Import trap. +Export trap. diff --git a/wCCD/src/cis1.rs b/wCCD/src/cis1.rs new file mode 100644 index 0000000..59fb07e --- /dev/null +++ b/wCCD/src/cis1.rs @@ -0,0 +1,1038 @@ +use hacspec_concordium::*; +use crate::alloc::boxed::Box; + + +use convert::TryFrom; + + +pub use hacspec_concordium::num::NonZeroI32; + +/// Tag for the CIS1 Transfer event. +pub const TRANSFER_EVENT_TAG: u8 = 255u8; // u8::MAX +/// Tag for the CIS1 Mint event. +pub const MINT_EVENT_TAG: u8 = 255u8 - 1u8; // u8::MAX +/// Tag for the CIS1 Burn event. +pub const BURN_EVENT_TAG: u8 = 255u8 - 2u8; // u8::MAX +/// Tag for the CIS1 UpdateOperator event. +pub const UPDATE_OPERATOR_EVENT_TAG: u8 = 255u8 - 3u8; // u8::MAX +/// Tag for the CIS1 TokenMetadata event. +pub const TOKEN_METADATA_EVENT_TAG: u8 = 255u8 - 4u8; // u8::MAX + +/// Sha256 digest +pub type Sha256 = [u8; 32]; + +// pub type Sha256 = ([ +// 0u8;0u8;0u8;0u8;0u8;0u8;0u8;0u8; +// 0u8;0u8;0u8;0u8;0u8;0u8;0u8;0u8; +// 0u8;0u8;0u8;0u8;0u8;0u8;0u8;0u8; +// 0u8;0u8;0u8;0u8;0u8;0u8;0u8;0u8]; + + +/// The location of the metadata and an optional hash of the content. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType, Clone)] +pub struct MetadataUrl { + /// The URL following the specification RFC1738. + // #[concordium(size_length = 2)] + pub url: String, + /// A optional hash of the content. + pub hash: Option, +} + + +/// Trait for marking types as CIS1 token IDs. +/// For a type to be a valid CIS1 token ID it must implement serialization and +/// schema type, such that the first byte indicates how many bytes is used to +/// represent the token ID, followed by this many bytes for the token ID. +/// +/// Note: The reason for introducing such a trait instead of representing every +/// token ID using Vec is to allow smart contracts to use specialized token +/// ID implementations avoiding allocations. +pub trait IsTokenId: Serialize + schema::SchemaType {} + + +/// Token Identifier, which combined with the address of the contract instance, +/// forms the unique identifier of a token type. +/// +/// This token ID type can represent every possible token ID but requires +/// allocating a Vec. Using a fixed size token ID type (such as `TokenIdFixed`) +/// will avoid this. +/// +/// The CIS1 specification allows for up to 255 bytes for the token ID, but +/// unless the bytes have some significant meaning, it is most likely better to +/// use a smaller fixed size token ID such as `TokenIdU8`. +#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Clone, Serialize)] +pub struct TokenIdVec( + // #[concordium(size_length = 1)] + pub Vec, +); + + +impl IsTokenId for TokenIdVec {} + + +impl schema::SchemaType for TokenIdVec { + fn get_type() -> schema::Type { + schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) + } +} + +// #[cfg(not(feature="hacspec"))] +// /// Display the token ID as a uppercase hex string +// impl fmt::Display for TokenIdVec { +// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +// for byte in &self.0 { +// write!(f, "{:02X}", byte)?; +// } +// Ok(()) +// } +// } + + +/// Token Identifier, which combined with the address of the contract instance, +/// forms the unique identifier of a token type. +/// +/// The CIS1 specification allows for up to 255 bytes for the token ID, but for +/// most cases using a smaller token ID is fine and can reduce contract energy +/// costs. +/// +/// This token ID uses an array for representing the token ID bytes which means +/// the token ID space is fixed to `N` number of bytes and some token IDs cannot +/// be represented. For a more general token ID type see `TokenIdVec`. +/// For fixed sized token IDs with integer representations see `TokenIdU8`, +/// `TokenIdU16`, `TokenIdU32` and `TokenIdU64`. +#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] +pub struct TokenIdFixed(pub [u8; N]); + + +impl IsTokenId for TokenIdFixed {} + + +impl schema::SchemaType for TokenIdFixed { + fn get_type() -> schema::Type { + schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) + } +} + + +impl From<[u8; N]> for TokenIdFixed { + fn from(id: [u8; N]) -> Self { + TokenIdFixed(id) + } +} + + +/// The `TokenIdFixed` is serialized as the value of the first byte represents +/// the number of bytes followed for the rest of the token ID. +impl Serial for TokenIdFixed { + fn serial(&self, out: &mut W) -> Result<(), W::Err> { + let len = u8::try_from(N).map_err(|_| W::Err::default())?; + out.write_u8(len)?; + for byte in self.0 { + out.write_u8(byte)?; + } + Ok(()) + } +} + + +/// The `TokenIdFixed` is deserialized by reading the first byte represents the +/// number of bytes and ensuring this value corresponds with the number of bytes +/// to use for the token ID. +impl Deserial for TokenIdFixed { + fn deserial(source: &mut R) -> ParseResult { + let byte_length = source.read_u8()?; + if usize::from(byte_length) != N { + return Err(ParseError::default()); + } + let bytes: [u8; N] = source.get()?; + Ok(TokenIdFixed(bytes)) + } +} + +// #[cfg(not(feature="hacspec"))] +// /// Display the token ID as a uppercase hex string +// impl fmt::Display for TokenIdFixed { +// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +// for byte in &self.0 { +// write!(f, "{:02X}", byte)?; +// } +// Ok(()) +// } +// } + + +/// Token Identifier, which combined with the address of the contract instance, +/// forms the unique identifier of a token type. +/// +/// The CIS1 specification allows for up to 255 bytes for the token ID, but for +/// most cases using a smaller token ID is fine and can reduce contract energy +/// costs. +/// +/// This token ID uses u64 for representing the token ID bytes which means the +/// token ID space is fixed to 8 bytes and some token IDs cannot be represented. +/// For a more general token ID type see `TokenIdVec`. +#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] +pub struct TokenIdU64(pub u64); + + +impl IsTokenId for TokenIdU64 {} + + +impl schema::SchemaType for TokenIdU64 { + fn get_type() -> schema::Type { + schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) + } +} + + +impl From for TokenIdU64 { + fn from(id: u64) -> Self { + TokenIdU64(id) + } +} + + +/// The `TokenIdU64` is serialized with one byte with the value 8 followed by 8 +/// bytes to encode a u64 in little endian. +impl Serial for TokenIdU64 { + fn serial(&self, out: &mut W) -> Result<(), W::Err> { + out.write_u8(8)?; + out.write_u64(self.0) + } +} + + +/// The `TokenIdU64` will deserialize one byte ensuring this contains the value +/// 8 and then deserialize a u64 as little endian. It will result in an error if +/// the first byte is not 8. +impl Deserial for TokenIdU64 { + fn deserial(source: &mut R) -> ParseResult { + let byte_length = source.read_u8()?; + if byte_length == 8 { + Ok(TokenIdU64(source.read_u64()?)) + } else { + Err(ParseError::default()) + } + } +} + +// #[cfg(not(feature="hacspec"))] +// /// Display the token ID as a uppercase hex string +// impl fmt::Display for TokenIdU64 { +// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +// for byte in &self.0.to_le_bytes() { +// write!(f, "{:02X}", byte)?; +// } +// Ok(()) +// } +// } + + +/// Token Identifier, which combined with the address of the contract instance, +/// forms the unique identifier of a token type. +/// +/// The CIS1 specification allows for up to 255 bytes for the token ID, but for +/// most cases using a smaller token ID is fine and can reduce contract energy +/// costs. +/// +/// This token ID uses u32 for representing the token ID bytes which means the +/// token ID space is fixed to 4 bytes and some token IDs cannot be represented. +/// For a more general token ID type see `TokenIdVec`. +#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] +pub struct TokenIdU32(pub u32); + + +impl IsTokenId for TokenIdU32 {} + + +impl schema::SchemaType for TokenIdU32 { + fn get_type() -> schema::Type { + schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) + } +} + + +impl From for TokenIdU32 { + fn from(id: u32) -> Self { + TokenIdU32(id) + } +} + + +/// The `TokenIdU32` is serialized with one byte with the value 4 followed by 4 +/// bytes to encode a u32 in little endian. +impl Serial for TokenIdU32 { + fn serial(&self, out: &mut W) -> Result<(), W::Err> { + out.write_u8(4)?; + out.write_u32(self.0) + } +} + + +/// The `TokenIdU32` will deserialize one byte ensuring this contains the value +/// 4 and then deserialize a u32 as little endian. It will result in an error if +/// the first byte is not 4. +impl Deserial for TokenIdU32 { + fn deserial(source: &mut R) -> ParseResult { + let byte_length = source.read_u8()?; + if byte_length == 4 { + Ok(TokenIdU32(source.read_u32()?)) + } else { + Err(ParseError::default()) + } + } +} + +// /// Display the token ID as a uppercase hex string +// impl fmt::Display for TokenIdU32 { +// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +// for byte in &self.0.to_le_bytes() { +// write!(f, "{:02X}", byte)?; +// } +// Ok(()) +// } +// } + + +/// Token Identifier, which combined with the address of the contract instance, +/// forms the unique identifier of a token type. +/// +/// The CIS1 specification allows for up to 255 bytes for the token ID, but for +/// most cases using a smaller token ID is fine and can reduce contract energy +/// costs. +/// +/// This token ID uses u16 for representing the token ID bytes which means the +/// token ID space is fixed to 2 bytes and some token IDs cannot be represented. +/// For a more general token ID type see `TokenIdVec`. +#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] +pub struct TokenIdU16(pub u16); + + +impl IsTokenId for TokenIdU16 {} + + +impl schema::SchemaType for TokenIdU16 { + fn get_type() -> schema::Type { + schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) + } +} + + +impl From for TokenIdU16 { + fn from(id: u16) -> Self { + TokenIdU16(id) + } +} + + +/// The `TokenIdU16` is serialized with one byte with the value 2 followed by 2 +/// bytes to encode a u16 in little endian. +impl Serial for TokenIdU16 { + fn serial(&self, out: &mut W) -> Result<(), W::Err> { + out.write_u8(2)?; + out.write_u16(self.0) + } +} + + +/// The `TokenIdU16` will deserialize one byte ensuring this contains the value +/// 2 and then deserialize a u16 as little endian. It will result in an error if +/// the first byte is not 2. +impl Deserial for TokenIdU16 { + fn deserial(source: &mut R) -> ParseResult { + let byte_length = source.read_u8()?; + if byte_length == 2 { + Ok(TokenIdU16(source.read_u16()?)) + } else { + Err(ParseError::default()) + } + } +} + +// /// Display the token ID as a uppercase hex string +// impl fmt::Display for TokenIdU16 { +// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +// for byte in &self.0.to_le_bytes() { +// write!(f, "{:02X}", byte)?; +// } +// Ok(()) +// } +// } + + +/// Token Identifier, which combined with the address of the contract instance, +/// forms the unique identifier of a token type. +/// +/// The CIS1 specification allows for up to 255 bytes for the token ID, but for +/// most cases using a smaller token ID is fine and can reduce contract energy +/// costs. +/// +/// This token ID uses u8 for representing the token ID bytes which means the +/// token ID space is fixed to 1 byte and some token IDs cannot be represented. +/// For a more general token ID type see `TokenIdVec`. +#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] +pub struct TokenIdU8(pub u8); + + +impl IsTokenId for TokenIdU8 {} + + +impl schema::SchemaType for TokenIdU8 { + fn get_type() -> schema::Type { + schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) + } +} + + +impl From for TokenIdU8 { + fn from(id: u8) -> Self { + TokenIdU8(id) + } +} + + +/// The `TokenIdU8` is serialized with one byte with the value 1 followed by 1 +/// bytes to encode a u8 in little endian. +impl Serial for TokenIdU8 { + fn serial(&self, out: &mut W) -> Result<(), W::Err> { + out.write_u8(1)?; + out.write_u8(self.0) + } +} + + +/// The `TokenIdU8` will deserialize one byte ensuring this contains the value 1 +/// and then deserialize a u8 as little endian. It will result in an error if +/// the first byte is not 1. +impl Deserial for TokenIdU8 { + fn deserial(source: &mut R) -> ParseResult { + let byte_length = source.read_u8()?; + if byte_length == 1 { + Ok(TokenIdU8(source.read_u8()?)) + } else { + Err(ParseError::default()) + } + } +} + +// /// Display the token ID as a uppercase hex string +// impl fmt::Display for TokenIdU8 { +// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +// for byte in &self.0.to_le_bytes() { +// write!(f, "{:02X}", byte)?; +// } +// Ok(()) +// } +// } + + +/// Token Identifier, which combined with the address of the contract instance, +/// forms the unique identifier of a token type. +/// +/// The CIS1 specification allows for up to 255 bytes for the token ID, but for +/// most cases using a smaller token ID is fine and can reduce contract energy +/// costs. +/// +/// This token ID uses Unit for representing token IDs, which means only one +/// token ID can be represented with this type and other token IDs cannot be +/// represented. For a more general token ID type see `TokenIdVec`. +#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] +pub struct TokenIdUnit(); + + +impl IsTokenId for TokenIdUnit {} + + +impl schema::SchemaType for TokenIdUnit { + fn get_type() -> schema::Type { + schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) + } +} + + +/// The `TokenIdUnit` is serialized with one byte with the value 0. +impl Serial for TokenIdUnit { + fn serial(&self, out: &mut W) -> Result<(), W::Err> { + out.write_u8(0) + } +} + + +/// The `TokenIdUnit` will deserialize one byte ensuring this contains the value +/// 0. It will result in an error if the byte is not 0. +impl Deserial for TokenIdUnit { + fn deserial(source: &mut R) -> ParseResult { + let byte_length = source.read_u8()?; + if byte_length == 0 { + Ok(TokenIdUnit()) + } else { + Err(ParseError::default()) + } + } +} + +// #[cfg(not(feature="hacspec"))] +/// An amount of a specific token type. +pub type TokenAmount = u64; + + +/// An untagged event of a transfer of some amount of tokens from one address to +/// another. For a tagged version, use `Cis1Event`. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct TransferEvent { + /// The ID of the token being transferred. + pub token_id: T, + /// The amount of tokens being transferred. + pub amount: TokenAmount, + /// The address owning these tokens before the transfer. + pub from: Address, + /// The address to receive these tokens after the transfer. + pub to: Address, +} + + +/// An untagged event of tokens being minted, could be a new token type or +/// extending the total supply of existing token. +/// For a tagged version, use `Cis1Event`. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct MintEvent { + /// The ID of the token being minted, (possibly a new token ID). + pub token_id: T, + /// The number of tokens being minted, this is allowed to be 0 as well. + pub amount: TokenAmount, + /// The initial owner of these newly minted amount of tokens. + pub owner: Address, +} + + +/// An untagged event of some amount of a token type being burned. +/// For a tagged version, use `Cis1Event`. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct BurnEvent { + /// The ID of the token where an amount is being burned. + pub token_id: T, + /// The amount of tokens being burned. + pub amount: TokenAmount, + /// The owner of the tokens being burned. + pub owner: Address, +} + + +/// The update to an the operator. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the variants cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub enum OperatorUpdate { + /// Remove the operator. + Remove, + /// Add an address as an operator. + Add, +} + + +/// An untagged event of an update to an operator address for an owner address. +/// For a tagged version, use `Cis1Event`. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct UpdateOperatorEvent { + /// The update to the operator. + pub update: OperatorUpdate, + /// The address for whom, the operator is updated. + pub owner: Address, + /// The address who is the operator being updated. + pub operator: Address, +} + + +/// An untagged event for setting the metadata for a token. +/// For a tagged version, use `Cis1Event`. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct TokenMetadataEvent { + /// The ID of the token. + pub token_id: T, + /// The location of the metadata. + pub metadata_url: MetadataUrl, +} + + +/// Tagged CIS1 event to be serialized for the event log. +#[derive(Debug)] +pub enum Cis1Event { + /// A transfer between two addresses of some amount of tokens. + Transfer(TransferEvent), + /// Creation of new tokens, could be both adding some amounts to an existing + /// token or introduce an entirely new token ID. + Mint(MintEvent), + /// Destruction of tokens removing some amounts of a token. + Burn(BurnEvent), + /// Updates to an operator for a specific address and token id. + UpdateOperator(UpdateOperatorEvent), + /// Setting the metadata for a token. + TokenMetadata(TokenMetadataEvent), +} + + +impl Serial for Cis1Event { + fn serial(&self, out: &mut W) -> Result<(), W::Err> { + match self { + Cis1Event::Transfer(event) => { + out.write_u8(TRANSFER_EVENT_TAG)?; + event.serial(out) + } + Cis1Event::Mint(event) => { + out.write_u8(MINT_EVENT_TAG)?; + event.serial(out) + } + Cis1Event::Burn(event) => { + out.write_u8(BURN_EVENT_TAG)?; + event.serial(out) + } + Cis1Event::UpdateOperator(event) => { + out.write_u8(UPDATE_OPERATOR_EVENT_TAG)?; + event.serial(out) + } + Cis1Event::TokenMetadata(event) => { + out.write_u8(TOKEN_METADATA_EVENT_TAG)?; + event.serial(out) + } + } + } +} + + +impl Deserial for Cis1Event { + fn deserial(source: &mut R) -> ParseResult { + let tag = source.read_u8()?; + match tag { + TRANSFER_EVENT_TAG => TransferEvent::::deserial(source).map(Cis1Event::Transfer), + MINT_EVENT_TAG => MintEvent::::deserial(source).map(Cis1Event::Mint), + BURN_EVENT_TAG => BurnEvent::::deserial(source).map(Cis1Event::Burn), + UPDATE_OPERATOR_EVENT_TAG => { + UpdateOperatorEvent::deserial(source).map(Cis1Event::UpdateOperator) + } + TOKEN_METADATA_EVENT_TAG => { + TokenMetadataEvent::::deserial(source).map(Cis1Event::TokenMetadata) + } + _ => Err(ParseError::default()), + } + } +} + + +/// The different errors the contract can produce. +#[derive(Debug, PartialEq, Eq)] +pub enum Cis1Error { + /// Invalid token id (Error code: -42000001). + InvalidTokenId, + /// The balance of the token owner is insufficient for the transfer (Error + /// code: -42000002). + InsufficientFunds, + /// Sender is unauthorized to call this function (Error code: -42000003). + Unauthorized, + /// Custom error + Custom(R), +} + + +/// Convert Cis1Error into a reject with error code: +/// - InvalidTokenId: -42000001 +/// - InsufficientFunds: -42000002 +/// - Unauthorized: -42000003 +impl> From> for Reject { + fn from(err: Cis1Error) -> Self { + let error_code = match err { + Cis1Error::InvalidTokenId => unsafe { NonZeroI32::new_unchecked(-42000001) }, + Cis1Error::InsufficientFunds => unsafe { NonZeroI32::new_unchecked(-42000002) }, + Cis1Error::Unauthorized => unsafe { NonZeroI32::new_unchecked(-42000003) }, + Cis1Error::Custom(reject) => reject.into().error_code, + }; + Self { error_code } + } +} + + +impl> From for Cis1Error { + #[inline] + fn from(err: LogError) -> Self { + Cis1Error::Custom(X::from(err)) + } +} + + +impl> From for Cis1Error { + #[inline] + fn from(err: ParseError) -> Self { + Cis1Error::Custom(X::from(err)) + } +} + + +/// The receiving address for a transfer, similar to the Address type, but +/// contains extra information when the receiver address is a contract. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the variants and the order of their fields +// cannot be changed. +#[derive(Debug, Serialize)] +pub enum Receiver { + /// The receiver is an account address. + Account( + /// The receiving address. + AccountAddress, + ), + /// The receiver is a contract address. + Contract( + /// The receiving address. + ContractAddress, + /// The function to call on the receiving contract. + OwnedReceiveName, + ), +} + + +impl Receiver { + /// Construct a receiver from an account address. + pub fn from_account(address: AccountAddress) -> Self { + Receiver::Account(address) + } + + /// Construct a receiver from a contract address. + pub fn from_contract(address: ContractAddress, function: OwnedReceiveName) -> Self { + Receiver::Contract(address, function) + } + + /// Get the Address of the receiver. + pub fn address(&self) -> Address { + match self { + Receiver::Account(address) => Address::Account(*address), + Receiver::Contract(address, ..) => Address::Contract(*address), + } + } +} + + +impl schema::SchemaType for Receiver { + fn get_type() -> schema::Type { + schema::Type::Enum(vec![ + ( + String::from("Account"), + schema::Fields::Unnamed(vec![AccountAddress::get_type()]), + ), + ( + String::from("Contract"), + schema::Fields::Unnamed(vec![ + ContractAddress::get_type(), + OwnedReceiveName::get_type(), + ]), + ), + ]) + } +} + + +impl From for Receiver { + fn from(address: AccountAddress) -> Self { + Self::from_account(address) + } +} + + +/// Additional information to include with a transfer. +#[derive(Debug, Serialize)] +pub struct AdditionalData( + // #[concordium(size_length = 2)] + Vec, +); + + +impl schema::SchemaType for AdditionalData { + fn get_type() -> schema::Type { + schema::Type::List(schema::SizeLength::U16, Box::new(schema::Type::U8)) + } +} + + +impl AdditionalData { + /// Construct an AdditionalData containing no data. + pub fn empty() -> Self { + AdditionalData(Vec::new()) + } +} + + +impl From> for AdditionalData { + fn from(data: Vec) -> Self { + AdditionalData(data) + } +} + + +impl AsRef<[u8]> for AdditionalData { + fn as_ref(&self) -> &[u8] { + &self.0 + } +} + + +/// A single transfer of some amount of a token. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize)] +pub struct Transfer { + /// The ID of the token being transferred. + pub token_id: T, + /// The amount of tokens being transferred. + pub amount: TokenAmount, + /// The address owning the tokens being transferred. + pub from: Address, + /// The address receiving the tokens being transferred. + pub to: Receiver, + /// Additional data to include in the transfer. + /// Can be used for additional arguments. + pub data: AdditionalData, +} + + +impl schema::SchemaType for Transfer { + fn get_type() -> schema::Type { + schema::Type::Struct(schema::Fields::Named(vec![ + (String::from("token_id"), T::get_type()), + (String::from("amount"), TokenAmount::get_type()), + (String::from("from"), Address::get_type()), + (String::from("to"), Receiver::get_type()), + (String::from("data"), AdditionalData::get_type()), + ])) + } +} + + +/// The parameter type for the contract function `transfer`. +#[derive(Debug, Serialize)] +pub struct TransferParams( + // #[concordium(size_length = 2)] + pub Vec>, +); + + +impl schema::SchemaType for TransferParams { + fn get_type() -> schema::Type { + schema::Type::List(schema::SizeLength::U16, Box::new(Transfer::::get_type())) + } +} + + +impl From>> for TransferParams { + fn from(transfers: Vec>) -> Self { + TransferParams(transfers) + } +} + + +impl AsRef<[Transfer]> for TransferParams { + fn as_ref(&self) -> &[Transfer] { + &self.0 + } +} + + +/// A single update of an operator. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct UpdateOperator { + /// The update for this operator. + pub update: OperatorUpdate, + /// The address which is either added or removed as an operator. + /// Note: The address for whom this will become an operator is the sender of + /// the contract transaction. + pub operator: Address, +} + + +/// The parameter type for the contract function `updateOperator`. +#[derive(Debug, Serialize, SchemaType)] +pub struct UpdateOperatorParams( + // #[concordium(size_length = 2)] + pub Vec, +); + + +/// A query for the balance of a given address for a given token. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct BalanceOfQuery { + /// The ID of the token for which to query the balance of. + pub token_id: T, + /// The address for which to query the balance of. + pub address: Address, +} + + +/// The parameter type for the contract function `balanceOf`. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct BalanceOfQueryParams { + /// The contract to trigger with the results of the queries. + pub result_contract: ContractAddress, + /// The contract function to trigger with the results of the queries. + pub result_function: OwnedReceiveName, + /// List of balance queries. + // #[concordium(size_length = 2)] + pub queries: Vec>, +} + + +/// BalanceOf query with the result of the query. +pub type BalanceOfQueryResult = (BalanceOfQuery, TokenAmount); + + +/// The response which is sent back when calling the contract function +/// `balanceOf`. +/// It consists of the list of queries paired with their corresponding result. +#[derive(Debug, Serialize, SchemaType)] +pub struct BalanceOfQueryResponse( + // #[concordium(size_length = 2)] + Vec>, +); + + +impl From>> for BalanceOfQueryResponse { + fn from(results: Vec>) -> Self { + BalanceOfQueryResponse(results) + } +} + + +impl AsRef<[BalanceOfQueryResult]> for BalanceOfQueryResponse { + fn as_ref(&self) -> &[BalanceOfQueryResult] { + &self.0 + } +} + + +/// A query for the operator of a given address for a given token. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct OperatorOfQuery { + /// The ID of the token for which to query the balance of. + pub owner: Address, + /// The address for which to check for being an operator of the owner. + pub address: Address, +} + + +/// The parameter type for the contract function `operatorOf`. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct OperatorOfQueryParams { + /// The contract to trigger with the results of the queries. + pub result_contract: ContractAddress, + /// The contract function to trigger with the results of the queries. + pub result_function: OwnedReceiveName, + /// List of operatorOf queries. + // #[concordium(size_length = 2)] + pub queries: Vec, +} + + +/// OperatorOf query with the result of the query. +pub type OperatorOfQueryResult = (OperatorOfQuery, bool); + + +/// The response which is sent back when calling the contract function +/// `operatorOf`. +/// It consists of the list of queries paired with their corresponding result. +#[derive(Debug, Serialize, SchemaType)] +pub struct OperatorOfQueryResponse( + // #[concordium(size_length = 2)] + Vec, +); + + +impl From> for OperatorOfQueryResponse { + fn from(results: Vec) -> Self { + OperatorOfQueryResponse(results) + } +} + + +impl AsRef<[OperatorOfQueryResult]> for OperatorOfQueryResponse { + fn as_ref(&self) -> &[OperatorOfQueryResult] { + &self.0 + } +} + + +/// The parameter type for the contract function `tokenMetadata`. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct TokenMetadataQueryParams { + /// The contract to trigger with the results of the queries. + pub result_contract: ContractAddress, + /// The contract function to trigger with the results of the queries. + pub result_function: OwnedReceiveName, + /// List of balance queries. + // #[concordium(size_length = 2)] + pub queries: Vec, +} + + +/// TokenMetadata query with the result of the query. +pub type TokenMetadataQueryResult = (T, MetadataUrl); + + +/// The response which is sent back when calling the contract function +/// `tokenMetadata`. +/// It consists of the list of queries paired with their corresponding result. +#[derive(Debug, Serialize, SchemaType)] +pub struct TokenMetadataQueryResponse( + // #[concordium(size_length = 2)] + Vec>, +); + + +impl From>> for TokenMetadataQueryResponse { + fn from(results: Vec>) -> Self { + TokenMetadataQueryResponse(results) + } +} + + +impl AsRef<[TokenMetadataQueryResult]> for TokenMetadataQueryResponse { + fn as_ref(&self) -> &[TokenMetadataQueryResult] { + &self.0 + } +} + +/// The parameter type for a contract function which receives CIS1 tokens. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct OnReceivingCis1Params { + /// The ID of the token received. + pub token_id: T, + /// The amount of tokens received. + pub amount: TokenAmount, + /// The previous owner of the tokens. + pub from: Address, + /// The name of the token contract which is tracking the token and + /// implements CIS1. + pub contract_name: OwnedContractName, + /// Some extra information which where sent as part of the transfer. + pub data: AdditionalData, +} diff --git a/wCCD/src/wccd.rs b/wCCD/src/wccd.rs new file mode 100644 index 0000000..c3cebed --- /dev/null +++ b/wCCD/src/wccd.rs @@ -0,0 +1,908 @@ +#![no_std] +#![feature(register_tool)] +#![register_tool(hax)] + +#[hax_lib_macros::skip] +extern crate hax_lib_macros; +#[hax_lib_macros::skip] +use hax_lib_macros::*; + +#[skip] +use hacspec_concordium::*; +#[skip] +use hacspec_concordium_derive::*; + +mod cis1; +pub use cis1::*; + +pub use concordium_contracts_common::{HashMap as Map, HashSet as Set}; + +/// Contract token ID type. +/// Since this contract will only ever contain this one token type, we use the +/// smallest possible token ID. +type ContractTokenId = TokenIdUnit; + +/// The id of the wCCD token in this contract. +const TOKEN_ID_WCCD: ContractTokenId = TokenIdUnit(); + +// #[cfg(not(feature = "hacspec"))] +/// The metadata url for the wCCD token. +const TOKEN_METADATA_URL: &str = "https://some.example/token/wccd"; + +// Types + +// #[cfg(not(feature = "hacspec"))] +/// The state tracked for each address. +#[derive(Serialize, SchemaType, Clone)] +struct AddressState { + /// The number of tokens owned by this address. + balance: TokenAmount, + /// The address which are currently enabled as operators for this token and + /// this address. + // #[concordium(size_length = 1)] + operators: Set
, +} + +// #[contract_state(contract = "CIS1-wCCD")] +// #[derive(Serialize, SchemaType)] +// struct StateHacspec(pub PublicByteSeq); // Map + +// #[cfg(not(feature = "hacspec"))] +/// The contract state, +#[hax::contract_state(contract = "CIS1-wCCD")] +#[derive(Serialize, SchemaType, Clone)] +struct State { + /// The state the one token. + token: Map, +} + +// #[cfg(not(feature = "hacspec"))] +/// The parameter type for the contract function `unwrap`. +/// Takes an amount of tokens and unwrap the CCD and send it to a receiver. +#[derive(Serialize, SchemaType)] +struct UnwrapParams { + /// The amount of tokens to unwrap. + amount: TokenAmount, + /// The owner of the tokens. + owner: Address, + /// The address to receive these unwrapped CCD. + receiver: cis1::Receiver, + /// Some additional bytes to include in the transfer. + data: AdditionalData, +} + +// #[cfg(not(feature = "hacspec"))] +/// The parameter type for the contract function `wrap`. +/// +/// The receiver for the wrapped CCD tokens. +#[derive(Serialize, SchemaType)] +struct WrapParams { + /// The address to receive these tokens. + /// If the receiver is the sender of the message wrapping the tokens, it + /// will not log a transfer. + to: cis1::Receiver, + /// Some additional bytes to include in a transfer. + data: AdditionalData, +} + +// #[cfg(not(feature = "hacspec"))] +/// The different errors the contract can produce. +#[derive(Serialize, Debug, PartialEq, Eq, Reject)] +enum CustomContractError { + /// Failed parsing the parameter. + #[from(ParseError)] + ParseParams, + /// Failed logging: Log is full. + LogFull, + /// Failed logging: Log is malformed. + LogMalformed, +} + +// #[cfg(not(feature = "hacspec"))] +type ContractError = Cis1Error; + +// #[cfg(not(feature = "hacspec"))] +type ContractResult = Result; + +// #[cfg(not(feature = "hacspec"))] +/// Mapping the logging errors to ContractError. +impl From for CustomContractError { + fn from(le: LogError) -> Self { + match le { + LogError::Full => Self::LogFull, + LogError::Malformed => Self::LogMalformed, + } + } +} + +// #[cfg(not(feature = "hacspec"))] +/// Mapping CustomContractError to ContractError +impl From for ContractError { + fn from(c: CustomContractError) -> Self { + Cis1Error::Custom(c) + } +} + +// #[cfg(not(feature = "hacspec"))] +impl State { + /// Creates a new state with no one owning any tokens by default. + fn new() -> Self { + State { + token: Map::default(), + } + } + + /// Get the current balance of a given token id for a given address. + /// Results in an error if the token id does not exist in the state. + fn balance( + &self, + token_id: &ContractTokenId, + address: &Address, + ) -> ContractResult { + // ensure_eq!(token_id, &TOKEN_ID_WCCD, ContractError::InvalidTokenId); + Ok(self.token.get(address).map(|s| s.balance).unwrap_or(0)) + } + + /// Check is an address is an operator of a specific owner address. + /// Results in an error if the token id does not exist in the state. + fn is_operator(&self, address: &Address, owner: &Address) -> bool { + self.token + .get(owner) + .map(|address_state| address_state.operators.contains(address)) + .unwrap_or(false) + } + + /// Update the state with a transfer. + /// Results in an error if the token id does not exist in the state or if + /// the from address have insufficient tokens to do the transfer. + fn transfer( + &mut self, + token_id: &ContractTokenId, + amount: TokenAmount, + from: &Address, + to: &Address, + ) -> ContractResult<()> { + // ensure_eq!(token_id, &TOKEN_ID_WCCD, ContractError::InvalidTokenId); + if amount == 0 { + return Ok(()); + } + let from_state = self + .token + .get_mut(from) + .ok_or(ContractError::InsufficientFunds)?; + ensure!( + from_state.balance >= amount, + ContractError::InsufficientFunds + ); + from_state.balance -= amount; + let to_state = self.token.entry(*to).or_insert_with(|| AddressState { + balance: 0, + operators: Set::default(), + }); + to_state.balance += amount; + Ok(()) + } + + /// Update the state adding a new operator for a given token id and address. + /// Results in an error if the token id does not exist in the state. + /// Succeeds even if the `operator` is already an operator for this + /// `token_id` and `address`. + fn add_operator(&mut self, owner: &Address, operator: &Address) { + let address_state = self.token.entry(*owner).or_insert_with(|| AddressState { + balance: 0, + operators: Set::default(), + }); + address_state.operators.insert(*operator); + } + + /// Update the state removing an operator for a given token id and address. + /// Results in an error if the token id does not exist in the state. + /// Succeeds even if the `operator` is not an operator for this `token_id` + /// and `address`. + fn remove_operator(&mut self, owner: &Address, operator: &Address) { + self.token + .get_mut(owner) + .map(|address_state| address_state.operators.remove(operator)); + } + + fn mint( + &mut self, + token_id: &ContractTokenId, + amount: TokenAmount, + owner: &Address, + ) -> ContractResult<()> { + // ensure_eq!(token_id, &TOKEN_ID_WCCD, ContractError::InvalidTokenId); + let address_state = self.token.entry(*owner).or_insert_with(|| AddressState { + balance: 0, + operators: Set::default(), + }); + address_state.balance += amount; + Ok(()) + } + + fn burn( + &mut self, + token_id: &ContractTokenId, + amount: TokenAmount, + owner: &Address, + ) -> ContractResult<()> { + // ensure_eq!(token_id, &TOKEN_ID_WCCD, ContractError::InvalidTokenId); + if amount == 0 { + return Ok(()); + } + let from_state = self + .token + .get_mut(owner) + .ok_or(ContractError::InsufficientFunds)?; + ensure!( + from_state.balance >= amount, + ContractError::InsufficientFunds + ); + from_state.balance -= amount; + Ok(()) + } +} + +// Contract functions + +// // #[cfg(feature = "hacspec")] +// /// Initialize contract instance with no initial tokens. +// /// Logs a `Mint` event for the single token id with no amounts. +// #[init(contract = "CIS1-wCCD", enable_logger)] +// pub fn contract_init(ctx: Context) -> (Context, StateHacspec) { +// (ctx, StateHacspec(PublicByteSeq::new(0))) +// } + +// #[cfg(not(feature = "hacspec"))] +/// Initialize contract instance with no initial tokens. +/// Logs a `Mint` event for the single token id with no amounts. +#[hax::init(contract = "CIS1-wCCD", enable_logger)] +fn contract_init(ctx: &impl HasInitContext, logger: &mut impl HasLogger) -> InitResult { + // Construct the initial contract state. + let state = State::new(); + // Get the instantiater of this contract instance. + let invoker = Address::Account(ctx.init_origin()); + // Log event for the newly minted token. + // logger.log(&Cis1Event::Mint(MintEvent { + // token_id: TOKEN_ID_WCCD, + // amount: 0, + // owner: invoker, + // }))?; + + // Log event for where to find metadata for the token + // logger.log(&Cis1Event::TokenMetadata(TokenMetadataEvent { + // token_id: TOKEN_ID_WCCD, + // metadata_url: MetadataUrl { + // url: String::from(TOKEN_METADATA_URL), + // hash: None, + // }, + // }))?; + + Ok(state) +} + +// #[cfg(not(feature = "hacspec"))] +/// Wrap an amount of CCD into wCCD tokens and transfer the tokens if the sender +/// is not the receiver. +#[hax::receive( + contract = "CIS1-wCCD", + name = "wrap", + parameter = "WrapParams", + enable_logger, + payable +)] +fn contract_wrap( + ctx: &impl HasReceiveContext, + amount: Amount, + logger: &impl HasLogger, + state: State, +) -> Result<(A, State), cis1::Cis1Error> { + let params: WrapParams = ctx.parameter_cursor().get()?; + // Get the sender who invoked this contract function. + let sender = ctx.sender(); + + let receive_address = params.to.address(); + + // Update the state. + state.mint(&TOKEN_ID_WCCD, amount.micro_ccd, &receive_address)?; + + // Log the newly minted tokens. + // logger.log(&Cis1Event::Mint(MintEvent { + // token_id: TOKEN_ID_WCCD, + // amount: amount.micro_ccd, + // owner: sender, + // }))?; + + // Only log a transfer event if receiver is not the one who payed for this. + // if sender != receive_address { + // logger.log(&Cis1Event::Transfer(TransferEvent { + // token_id: TOKEN_ID_WCCD, + // amount: amount.micro_ccd, + // from: sender, + // to: receive_address, + // }))?; + // } + + let mut state_ret = state.clone(); + + // Send message to the receiver of the tokens. + if let cis1::Receiver::Contract(address, function) = params.to { + let parameter = OnReceivingCis1Params { + token_id: TOKEN_ID_WCCD, + amount: amount.micro_ccd, + from: sender, + contract_name: OwnedContractName::new_unchecked(String::from("init_CIS1-wCCD")), + data: params.data, + }; + let param_bytes = concordium_contracts_common::to_bytes(¶meter); + Ok((A::send_raw(&address, function.as_ref(), Amount::zero(), ¶m_bytes), state_ret)) + } else { + Ok((A::accept(), state_ret)) + } +} + +// #[cfg(not(feature = "hacspec"))] +/// Unwrap an amount of wCCD tokens into CCD +#[hax::receive( + contract = "CIS1-wCCD", + name = "unwrap", + parameter = "UnwrapParams", + enable_logger +)] +fn contract_unwrap( + ctx: &impl HasReceiveContext, + logger: &mut impl HasLogger, + state: State, +) -> Result<(A, State), cis1::Cis1Error> { + let params: UnwrapParams = ctx.parameter_cursor().get()?; + // Get the sender who invoked this contract function. + let sender = ctx.sender(); + ensure!( + sender == params.owner || state.is_operator(&sender, ¶ms.owner), + ContractError::Unauthorized + ); + + // Update the state. + state.burn(&TOKEN_ID_WCCD, params.amount, ¶ms.owner)?; + + // Log the burning of tokens. + // logger.log(&Cis1Event::Burn(BurnEvent { + // token_id: TOKEN_ID_WCCD, + // amount: params.amount, + // owner: params.owner, + // }))?; + + let unwrapped_amount = Amount::from_micro_ccd(params.amount); + + let action = match params.receiver { + cis1::Receiver::Account(address) => A::simple_transfer(&address, unwrapped_amount), + cis1::Receiver::Contract(address, function) => { + A::send_raw(&address, function.as_ref(), unwrapped_amount, params.data.as_ref()) + } + }; + + let mut state_ret = state.clone(); + + Ok((action, state_ret)) +} + +// Contract functions required by CIS1 + +// #[cfg(not(feature = "hacspec"))] +#[allow(dead_code)] +type TransferParameter = TransferParams; + +// #[cfg(not(feature = "hacspec"))] +/// Execute a list of token transfers, in the order of the list. +/// +/// Logs a `Transfer` event for each transfer in the list. +/// Produces an action which sends a message to each contract which was the +/// receiver of a transfer. +/// +/// It rejects if: +/// - It fails to parse the parameter. +/// - Any of the transfers fail to be executed, which could be if: +/// - The `token_id` does not exist. +/// - The sender is not the owner of the token, or an operator for this +/// specific `token_id` and `from` address. +/// - The token is not owned by the `from`. +/// - Fails to log event. +/// - Any of the messages sent to contracts receiving a transfer choose to +/// reject. +#[hax::receive( + contract = "CIS1-wCCD", + name = "transfer", + parameter = "TransferParameter", + enable_logger +)] +fn contract_transfer( + ctx: &impl HasReceiveContext, + logger: &mut impl HasLogger, + state: State, +) -> Result<(A, State), cis1::Cis1Error> { + let mut cursor = ctx.parameter_cursor(); + // Parse the number of transfers. + let transfers_length: u8 = cursor.get()?; + // Get the sender who invoked this contract function. + let sender = ctx.sender(); + + let mut actions = A::accept(); + // Loop over the number of transfers. + for _ in 0..transfers_length { + // Parse one of the transfers. + let Transfer { + token_id, + amount, + from, + to, + data, + } = cursor.get()?; + // Authenticate the sender for this transfer + ensure!( + from == sender || state.is_operator(&sender, &from), + ContractError::Unauthorized + ); + let to_address = to.address(); + // Update the contract state + state.transfer(&token_id, amount, &from, &to_address)?; + + // Log transfer event + // logger.log(&Cis1Event::Transfer(TransferEvent { + // token_id, + // amount, + // from, + // to: to_address, + // }))?; + + // If the receiver is a contract, we add sending it a message to the list of + // actions. + if let cis1::Receiver::Contract(address, function) = to { + let parameter = OnReceivingCis1Params { + token_id, + amount, + from, + contract_name: OwnedContractName::new_unchecked(String::from("init_CIS1-Multi")), + data, + }; + // let action = hacspec_concordium::send(&address, function.as_ref(), Amount::zero(), parameter.data.as_ref()); // Was ¶meter + let action = A::accept(); + actions = actions.and_then(action); + } + } + let mut state_ret = state.clone(); + Ok((actions,state_ret)) +} + + +// #[cfg(not(feature="hacspec"))] +/// Enable or disable addresses as operators of the sender address. +/// Logs an `UpdateOperator` event. +/// +/// It rejects if: +/// - It fails to parse the parameter. +/// - The operator address is the same as the sender address. +/// - Fails to log event. +#[hax::receive( + contract = "CIS1-wCCD", + name = "updateOperator", + parameter = "UpdateOperatorParams", + enable_logger +)] +fn contract_update_operator( + ctx: &impl HasReceiveContext, + logger: &mut impl HasLogger, + state: State, +) -> Result<(A, State), cis1::Cis1Error> { + // Parse the parameter. + let UpdateOperatorParams(params) = ctx.parameter_cursor().get()?; + // Get the sender who invoked this contract function. + let sender = ctx.sender(); + + for param in params { + // Update the operator in the state. + match param.update { + OperatorUpdate::Add => state.add_operator(&sender, ¶m.operator), + OperatorUpdate::Remove => state.remove_operator(&sender, ¶m.operator), + } + + // Log the appropriate event + // logger.log(&Cis1Event::::UpdateOperator(UpdateOperatorEvent { + // owner: sender, + // operator: param.operator, + // update: param.update, + // }))?; + } + + let mut state_ret = state.clone(); + + Ok((A::accept(), state_ret)) +} + +// #[cfg(not(feature="hacspec"))] +/// Parameter type for the CIS-1 function `balanceOf` specialized to the subset +/// of TokenIDs used by this contract. +// This type is pub to silence the dead_code warning, as this type is only used +// for when generating the schema. +pub type ContractBalanceOfQueryParams = BalanceOfQueryParams; + +/// Get the balance of given token IDs and addresses. It takes a contract +/// address plus contract function to invoke with the result. +/// +/// It rejects if: +/// - Sender is not a contract. +/// - It fails to parse the parameter. +/// - Any of the queried `token_id` does not exist. +/// - Message sent back with the result rejects. +#[hax::receive(contract = "CIS1-wCCD", name = "balanceOf", parameter = "ContractBalanceOfQueryParams")] +fn contract_balance_of( + ctx: &impl HasReceiveContext, + state: State, +) -> Result<(A, State), cis1::Cis1Error> { + let mut cursor = ctx.parameter_cursor(); + // Parse the contract address to receive the result. + let result_contract: ContractAddress = cursor.get()?; + // Parse the contract function name to call with the result. + let result_hook: OwnedReceiveName = cursor.get()?; + // Parse the number of queries. + let queries_length: u8 = cursor.get()?; + + // Build the response. + let mut response = Vec::with_capacity(queries_length.into()); + for _ in 0..queries_length { + // Parse one of the queries. + let query: BalanceOfQuery = ctx.parameter_cursor().get()?; + // Query the state for balance. + let amount = state.balance(&query.token_id, &query.address)?; + response.push((query, amount)); + } + let mut state_ret = state.clone(); + // Send back the response. + Ok((A::send_raw( + &result_contract, + result_hook.as_ref(), + Amount::zero(), + &BalanceOfQueryResponse::from(response), + ), state_ret)) +} + +// #[cfg(not(feature="hacspec"))] +/// Takes a list of queries. Each query is an owner address and some address to +/// check as an operator of the owner address. It takes a contract address plus +/// contract function to invoke with the result. +/// +/// It rejects if: +/// - It fails to parse the parameter. +/// - Message sent back with the result rejects. +#[hax::receive(contract = "CIS1-wCCD", name = "operatorOf", parameter = "OperatorOfQueryParams")] +fn contract_operator_of( + ctx: &impl HasReceiveContext, + state: State, +) -> Result<(A, State), cis1::Cis1Error> { + // Parse the parameter. + let params: OperatorOfQueryParams = ctx.parameter_cursor().get()?; + // Build the response. + let mut response = Vec::with_capacity(params.queries.len()); + for query in params.queries { + // Query the state for address being an operator of owner. + let is_operator = state.is_operator(&query.owner, &query.address); + response.push((query, is_operator)); + } + let mut state_ret = state.clone(); + // Send back the response. + Ok((A::send_raw( + ¶ms.result_contract, + params.result_function.as_ref(), + Amount::zero(), + &OperatorOfQueryResponse::from(response), + ), state_ret)) +} + +// #[cfg(not(feature="hacspec"))] +/// Parameter type for the CIS-1 function `tokenMetadata` specialized to the +/// subset of TokenIDs used by this contract. +// This type is pub to silence the dead_code warning, as this type is only used +// for when generating the schema. +pub type ContractTokenMetadataQueryParams = TokenMetadataQueryParams; + +// #[cfg(not(feature="hacspec"))] +/// Get the token metadata URLs and checksums given a list of token IDs. It +/// takes a contract address plus contract function to invoke with the result. +/// +/// It rejects if: +/// - It fails to parse the parameter. +/// - Any of the queried `token_id` does not exist. +/// - Message sent back with the result rejects. +#[hax::receive( + contract = "CIS1-wCCD", + name = "tokenMetadata", + parameter = "ContractTokenMetadataQueryParams" +)] +fn contract_token_metadata( + ctx: &impl HasReceiveContext, + _state: State, +) -> Result<(A, State), cis1::Cis1Error> { + let mut cursor = ctx.parameter_cursor(); + // Parse the contract address to receive the result. + let result_contract: ContractAddress = cursor.get()?; + // Parse the contract function name to call with the result. + let result_hook: OwnedReceiveName = cursor.get()?; + // Parse the number of queries. + let queries_length: u8 = cursor.get()?; + + // Build the response. + let mut response = Vec::with_capacity(queries_length.into()); + for _ in 0..queries_length { + let token_id: ContractTokenId = cursor.get()?; + // Check the token exists. + ensure_eq!(token_id, TOKEN_ID_WCCD, ContractError::InvalidTokenId); + + let metadata_url = MetadataUrl { + url: TOKEN_METADATA_URL.to_string(), + hash: None, + }; + response.push((token_id, metadata_url)); + } + let mut state_ret = _state.clone(); + // Send back the response. + Ok((A::send_raw( + &result_contract, + result_hook.as_ref(), + Amount::zero(), + &TokenMetadataQueryResponse::from(response), + ), state_ret)) +} + +// Tests + +// // #[cfg(not(feature="hacspec"))] +// #[concordium_cfg_test] +// mod tests { +// use super::*; +// use test_infrastructure::*; + +// const ACCOUNT_0: AccountAddress = AccountAddress([0u8; 32]); +// const ADDRESS_0: Address = Address::Account(ACCOUNT_0); +// const ACCOUNT_1: AccountAddress = AccountAddress([1u8; 32]); +// const ADDRESS_1: Address = Address::Account(ACCOUNT_1); + +// /// Test helper function which creates a contract state where ADDRESS_0 owns +// /// 400 tokens. +// fn initial_state() -> State { +// let mut state = State::new(); +// state.mint(&TOKEN_ID_WCCD, 400, &ADDRESS_0).expect_report("Failed to setup state"); +// state +// } + +// /// Test initialization succeeds and the tokens are owned by the contract +// /// instantiater and the appropriate events are logged. +// #[concordium_test] +// fn test_init() { +// // Setup the context +// let mut ctx = InitContextTest::empty(); +// ctx.set_init_origin(ACCOUNT_0); + +// let mut logger = LogRecorder::init(); + +// // Call the contract function. +// let result = contract_init(&ctx, &mut logger); + +// // Check the result +// let state = result.expect_report("Contract initialization failed"); + +// // Check the state +// claim_eq!(state.token.len(), 0, "Only one token is initialized"); +// let balance0 = +// state.balance(&TOKEN_ID_WCCD, &ADDRESS_0).expect_report("Token is expected to exist"); +// claim_eq!(balance0, 0, "No initial tokens are owned by the contract instantiater"); + +// // Check the logs +// claim_eq!(logger.logs.len(), 2, "Exactly one event should be logged"); +// claim!( +// logger.logs.contains(&to_bytes(&Cis1Event::Mint(MintEvent { +// owner: ADDRESS_0, +// token_id: TOKEN_ID_WCCD, +// amount: 0, +// }))), +// "Missing event for minting the token" +// ); +// claim!( +// logger.logs.contains(&to_bytes(&Cis1Event::TokenMetadata(TokenMetadataEvent { +// token_id: TOKEN_ID_WCCD, +// metadata_url: MetadataUrl { +// url: String::from(TOKEN_METADATA_URL), +// hash: None, +// }, +// }))), +// "Missing event with metadata for the token" +// ); +// } + +// /// Test transfer succeeds, when `from` is the sender. +// #[concordium_test] +// fn test_transfer_account() { +// // Setup the context +// let mut ctx = ReceiveContextTest::empty(); +// ctx.set_sender(ADDRESS_0); + +// // and parameter. +// let transfer = Transfer { +// token_id: TOKEN_ID_WCCD, +// amount: 100, +// from: ADDRESS_0, +// to: cis1::Receiver::from_account(ACCOUNT_1), +// data: AdditionalData::empty(), +// }; +// let parameter = TransferParams::from(vec![transfer]); +// let parameter_bytes = to_bytes(¶meter); +// ctx.set_parameter(¶meter_bytes); + +// let mut logger = LogRecorder::init(); +// let mut state = State::new(); +// state.mint(&TOKEN_ID_WCCD, 400, &ADDRESS_0).expect_report("Failed to setup state"); + +// // Call the contract function. +// let result: ContractResult = contract_transfer(&ctx, &mut logger, &mut state); +// // Check the result. +// let actions = result.expect_report("Results in rejection"); +// claim_eq!(actions, ActionsTree::accept(), "No action should be produced."); + +// // Check the state. +// let balance0 = +// state.balance(&TOKEN_ID_WCCD, &ADDRESS_0).expect_report("Token is expected to exist"); +// let balance1 = +// state.balance(&TOKEN_ID_WCCD, &ADDRESS_1).expect_report("Token is expected to exist"); +// claim_eq!( +// balance0, +// 300, +// "Token owner balance should be decreased by the transferred amount" +// ); +// claim_eq!( +// balance1, +// 100, +// "Token receiver balance should be increased by the transferred amount" +// ); + +// // Check the logs. +// claim_eq!(logger.logs.len(), 1, "Only one event should be logged"); +// claim_eq!( +// logger.logs[0], +// to_bytes(&Cis1Event::Transfer(TransferEvent { +// from: ADDRESS_0, +// to: ADDRESS_1, +// token_id: TOKEN_ID_WCCD, +// amount: 100, +// })), +// "Incorrect event emitted" +// ) +// } + +// /// Test transfer token fails, when sender is neither the owner or an +// /// operator of the owner. +// #[concordium_test] +// fn test_transfer_not_authorized() { +// // Setup the context +// let mut ctx = ReceiveContextTest::empty(); +// ctx.set_sender(ADDRESS_1); + +// // and parameter. +// let transfer = Transfer { +// from: ADDRESS_0, +// to: cis1::Receiver::from_account(ACCOUNT_1), +// token_id: TOKEN_ID_WCCD, +// amount: 100, +// data: AdditionalData::empty(), +// }; +// let parameter = TransferParams::from(vec![transfer]); +// let parameter_bytes = to_bytes(¶meter); +// ctx.set_parameter(¶meter_bytes); + +// let mut logger = LogRecorder::init(); +// let mut state = initial_state(); + +// // Call the contract function. +// let result: ContractResult = contract_transfer(&ctx, &mut logger, &mut state); +// // Check the result. +// let err = result.expect_err_report("Expected to fail"); +// claim_eq!(err, ContractError::Unauthorized, "Error is expected to be Unauthorized") +// } + +// /// Test transfer succeeds when sender is not the owner, but is an operator +// /// of the owner. +// #[concordium_test] +// fn test_operator_transfer() { +// // Setup the context +// let mut ctx = ReceiveContextTest::empty(); +// ctx.set_sender(ADDRESS_1); + +// // and parameter. +// let transfer = Transfer { +// from: ADDRESS_0, +// to: cis1::Receiver::from_account(ACCOUNT_1), +// token_id: TOKEN_ID_WCCD, +// amount: 100, +// data: AdditionalData::empty(), +// }; +// let parameter = TransferParams::from(vec![transfer]); +// let parameter_bytes = to_bytes(¶meter); +// ctx.set_parameter(¶meter_bytes); + +// let mut logger = LogRecorder::init(); +// let mut state = initial_state(); +// state.add_operator(&ADDRESS_0, &ADDRESS_1); + +// // Call the contract function. +// let result: ContractResult = contract_transfer(&ctx, &mut logger, &mut state); + +// // Check the result. +// let actions: ActionsTree = result.expect_report("Results in rejection"); +// claim_eq!(actions, ActionsTree::accept(), "No action should be produced."); + +// // Check the state. +// let balance0 = +// state.balance(&TOKEN_ID_WCCD, &ADDRESS_0).expect_report("Token is expected to exist"); +// let balance1 = +// state.balance(&TOKEN_ID_WCCD, &ADDRESS_1).expect_report("Token is expected to exist"); +// claim_eq!(balance0, 300); //, "Token owner balance should be decreased by the transferred amount"); +// claim_eq!( +// balance1, +// 100, +// "Token receiver balance should be increased by the transferred amount" +// ); + +// // Check the logs. +// claim_eq!(logger.logs.len(), 1, "Only one event should be logged"); +// claim_eq!( +// logger.logs[0], +// to_bytes(&Cis1Event::Transfer(TransferEvent { +// from: ADDRESS_0, +// to: ADDRESS_1, +// token_id: TOKEN_ID_WCCD, +// amount: 100, +// })), +// "Incorrect event emitted" +// ) +// } + +// /// Test adding an operator succeeds and the appropriate event is logged. +// #[concordium_test] +// fn test_add_operator() { +// // Setup the context +// let mut ctx = ReceiveContextTest::empty(); +// ctx.set_sender(ADDRESS_0); + +// // and parameter. +// let update = UpdateOperator { +// operator: ADDRESS_1, +// update: OperatorUpdate::Add, +// }; +// let parameter = UpdateOperatorParams(vec![update]); +// let parameter_bytes = to_bytes(¶meter); +// ctx.set_parameter(¶meter_bytes); + +// let mut logger = LogRecorder::init(); +// let mut state = initial_state(); + +// // Call the contract function. +// let result: ContractResult = +// contract_update_operator(&ctx, &mut logger, &mut state); + +// // Check the result. +// let actions: ActionsTree = result.expect_report("Results in rejection"); +// claim_eq!(actions, ActionsTree::accept(), "No action should be produced."); + +// // Check the state. +// claim!(state.is_operator(&ADDRESS_1, &ADDRESS_0), "Account should be an operator"); + +// // Check the logs. +// claim_eq!(logger.logs.len(), 1, "One event should be logged"); +// claim_eq!( +// logger.logs[0], +// to_bytes(&Cis1Event::::UpdateOperator(UpdateOperatorEvent { +// owner: ADDRESS_0, +// operator: ADDRESS_1, +// update: OperatorUpdate::Add, +// })), +// "Incorrect event emitted" +// ) +// } +// } diff --git a/wCCD/wccd.org b/wCCD/wccd.org new file mode 100644 index 0000000..7c197b7 --- /dev/null +++ b/wCCD/wccd.org @@ -0,0 +1,2713 @@ + +#+TITLE: Auction Smartcontract +#+AUTHOR: Lasse Letager Hansen + +# rev: 4d4b024b547a1f120f6d6951cbc409c94f8f146a + +# Use org-tanglesync ! +# lentic + +#+HTML_HEAD: +#+PROPERTY: header-args:coq :session *Coq* + +# C-c C-v t - export this files +# C-c C-v b - create results / run this file +# C-c C-v s - create results / run subtree + +* General information +:PROPERTIES: +:header-args: sh :eval never :results output silent +:END: +** Resulting output +#+begin_src sh +cargo clean +#+end_src + +#+begin_src sh +cargo install --path language +#+end_src + +#+begin_src sh +cargo build +#+end_src + +#+begin_src sh +cargo hacspec -e v --dir coq/src --org-file WCCD.org hacspec-wccd --vc-update --vc-dir coq/ +#+end_src +* Config +#+begin_src toml :tangle ./Cargo.toml :mkdirp yes :eval never +[package] +name = "hacspec-wccd" +version = "0.1.0" +authors = [""] +edition = "2018" + +[lib] +path = "src/wccd.rs" + +[dependencies] +hacspec-lib = { path = "../../lib" } +# pearlite-syn = { path = "../../../../creusot/pearlite-syn" } +creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "7763b3ae77205fba83182b9a6c3e69ad0b12fec7" } +# hacspec = {optional = true} +concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850" , version = "=2.0.0" , default-features = false } # 0cffb859f736ff6726fa38600428a415d800d7b6 +hacspec-concordium = { path = "../concordium" } +hacspec-concordium-derive = { path = "../concordium-derive" } + +[features] +hacspec = [] +# use_attributes = ["hacspec-attributes", "hacspec-attributes/print_attributes"] + +[dev-dependencies] +hacspec-dev = { path = "../../utils/dev" } +criterion = "0.3" +rand = "0.8" +quickcheck = "1" +quickcheck_macros = "1" +#+end_src + +* Cis1 +** Rust code +:PROPERTIES: +:header-args: :tangle ./src/cis1.rs :mkdirp yes +:END: +*** Imports +#+begin_src rust :eval never +#[cfg(not(feature = "hacspec"))] +extern crate hacspec_lib; + +use hacspec_lib::*; + +// #[cfg(not(feature = "hacspec"))] +// extern crate creusot_contracts; +#[cfg(test)] +#[cfg(not(feature = "hacspec"))] +use creusot_contracts::{ensures, requires}; + +use hacspec_concordium::*; + +#[cfg(feature = "hacspec")] +use concert_lib::*; + +#+end_src + +#+begin_src rust :eval never +// #![cfg_attr(not(feature = "std"), no_std)] +// use concordium_std::*; +// #[cfg(not(feature = "std"))] +// use core::fmt; +// #[cfg(feature = "std")] +// use std::fmt; + +#[cfg(not(feature = "hacspec"))] +use convert::TryFrom; + +#[cfg(not(feature = "hacspec"))] +pub use hacspec_concordium::num::NonZeroI32; + +#+end_src +*** Consts +#+begin_src rust :eval never +/// Tag for the CIS1 Transfer event. +pub const TRANSFER_EVENT_TAG: u8 = 255u8; // u8::MAX +/// Tag for the CIS1 Mint event. +pub const MINT_EVENT_TAG: u8 = 255u8 - 1u8; // u8::MAX +/// Tag for the CIS1 Burn event. +pub const BURN_EVENT_TAG: u8 = 255u8 - 2u8; // u8::MAX +/// Tag for the CIS1 UpdateOperator event. +pub const UPDATE_OPERATOR_EVENT_TAG: u8 = 255u8 - 3u8; // u8::MAX +/// Tag for the CIS1 TokenMetadata event. +pub const TOKEN_METADATA_EVENT_TAG: u8 = 255u8 - 4u8; // u8::MAX + +#+end_src +*** Types +#+begin_src rust :eval never +/// Sha256 digest +#[cfg(feature = "hacspec")] +array!(Sha256, 32, u8); + +#[cfg(not(feature = "hacspec"))] +pub type Sha256 = [u8; 32]; + +// pub type Sha256 = ([ +// 0u8;0u8;0u8;0u8;0u8;0u8;0u8;0u8; +// 0u8;0u8;0u8;0u8;0u8;0u8;0u8;0u8; +// 0u8;0u8;0u8;0u8;0u8;0u8;0u8;0u8; +// 0u8;0u8;0u8;0u8;0u8;0u8;0u8;0u8]; + +#[cfg(feature = "hacspec")] +pub struct MetadataUrl(pub String, pub Option); + +#[cfg(not(feature = "hacspec"))] +/// The location of the metadata and an optional hash of the content. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType, Clone)] +pub struct MetadataUrl { + /// The URL following the specification RFC1738. + // #[concordium(size_length = 2)] + pub url: String, + /// A optional hash of the content. + pub hash: Option, +} + +#+end_src + +#+begin_src rust :eval never +#[cfg(not(feature = "hacspec"))] +/// Trait for marking types as CIS1 token IDs. +/// For a type to be a valid CIS1 token ID it must implement serialization and +/// schema type, such that the first byte indicates how many bytes is used to +/// represent the token ID, followed by this many bytes for the token ID. +/// +/// Note: The reason for introducing such a trait instead of representing every +/// token ID using Vec is to allow smart contracts to use specialized token +/// ID implementations avoiding allocations. +pub trait IsTokenId: Serialize + schema::SchemaType {} + +#+end_src +*** TokenIdVec +#+begin_src rust :eval never +#[cfg(feature = "hacspec")] +// #[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Clone, Serialize)] +pub struct TokenIdVec(pub PublicByteSeq); + +#[cfg(not(feature = "hacspec"))] +/// Token Identifier, which combined with the address of the contract instance, +/// forms the unique identifier of a token type. +/// +/// This token ID type can represent every possible token ID but requires +/// allocating a Vec. Using a fixed size token ID type (such as `TokenIdFixed`) +/// will avoid this. +/// +/// The CIS1 specification allows for up to 255 bytes for the token ID, but +/// unless the bytes have some significant meaning, it is most likely better to +/// use a smaller fixed size token ID such as `TokenIdU8`. +#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Clone, Serialize)] +pub struct TokenIdVec( + // #[concordium(size_length = 1)] + pub Vec, +); + +#[cfg(not(feature = "hacspec"))] +impl IsTokenId for TokenIdVec {} + +#[cfg(not(feature = "hacspec"))] +impl schema::SchemaType for TokenIdVec { + fn get_type() -> schema::Type { + schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) + } +} + +// #[cfg(not(feature="hacspec"))] +// /// Display the token ID as a uppercase hex string +// impl fmt::Display for TokenIdVec { +// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +// for byte in &self.0 { +// write!(f, "{:02X}", byte)?; +// } +// Ok(()) +// } +// } + +#+end_src +*** TokenIdFixed +#+begin_src rust :eval never +#[cfg(not(feature = "hacspec"))] +/// Token Identifier, which combined with the address of the contract instance, +/// forms the unique identifier of a token type. +/// +/// The CIS1 specification allows for up to 255 bytes for the token ID, but for +/// most cases using a smaller token ID is fine and can reduce contract energy +/// costs. +/// +/// This token ID uses an array for representing the token ID bytes which means +/// the token ID space is fixed to `N` number of bytes and some token IDs cannot +/// be represented. For a more general token ID type see `TokenIdVec`. +/// For fixed sized token IDs with integer representations see `TokenIdU8`, +/// `TokenIdU16`, `TokenIdU32` and `TokenIdU64`. +#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] +pub struct TokenIdFixed(pub [u8; N]); + +#[cfg(not(feature = "hacspec"))] +impl IsTokenId for TokenIdFixed {} + +#[cfg(not(feature = "hacspec"))] +impl schema::SchemaType for TokenIdFixed { + fn get_type() -> schema::Type { + schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) + } +} + +#[cfg(not(feature = "hacspec"))] +impl From<[u8; N]> for TokenIdFixed { + fn from(id: [u8; N]) -> Self { + TokenIdFixed(id) + } +} + +#[cfg(not(feature = "hacspec"))] +/// The `TokenIdFixed` is serialized as the value of the first byte represents +/// the number of bytes followed for the rest of the token ID. +impl Serial for TokenIdFixed { + fn serial(&self, out: &mut W) -> Result<(), W::Err> { + let len = u8::try_from(N).map_err(|_| W::Err::default())?; + out.write_u8(len)?; + for byte in self.0 { + out.write_u8(byte)?; + } + Ok(()) + } +} + +#[cfg(not(feature = "hacspec"))] +/// The `TokenIdFixed` is deserialized by reading the first byte represents the +/// number of bytes and ensuring this value corresponds with the number of bytes +/// to use for the token ID. +impl Deserial for TokenIdFixed { + fn deserial(source: &mut R) -> ParseResult { + let byte_length = source.read_u8()?; + if usize::from(byte_length) != N { + return Err(ParseError::default()); + } + let bytes: [u8; N] = source.get()?; + Ok(TokenIdFixed(bytes)) + } +} + +// #[cfg(not(feature="hacspec"))] +// /// Display the token ID as a uppercase hex string +// impl fmt::Display for TokenIdFixed { +// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +// for byte in &self.0 { +// write!(f, "{:02X}", byte)?; +// } +// Ok(()) +// } +// } + +#+end_src +*** TokenIdU64 +#+begin_src rust :eval never +#[cfg(not(feature = "hacspec"))] +/// Token Identifier, which combined with the address of the contract instance, +/// forms the unique identifier of a token type. +/// +/// The CIS1 specification allows for up to 255 bytes for the token ID, but for +/// most cases using a smaller token ID is fine and can reduce contract energy +/// costs. +/// +/// This token ID uses u64 for representing the token ID bytes which means the +/// token ID space is fixed to 8 bytes and some token IDs cannot be represented. +/// For a more general token ID type see `TokenIdVec`. +#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] +pub struct TokenIdU64(pub u64); + +#[cfg(not(feature = "hacspec"))] +impl IsTokenId for TokenIdU64 {} + +#[cfg(not(feature = "hacspec"))] +impl schema::SchemaType for TokenIdU64 { + fn get_type() -> schema::Type { + schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) + } +} + +#[cfg(not(feature = "hacspec"))] +impl From for TokenIdU64 { + fn from(id: u64) -> Self { + TokenIdU64(id) + } +} + +#[cfg(not(feature = "hacspec"))] +/// The `TokenIdU64` is serialized with one byte with the value 8 followed by 8 +/// bytes to encode a u64 in little endian. +impl Serial for TokenIdU64 { + fn serial(&self, out: &mut W) -> Result<(), W::Err> { + out.write_u8(8)?; + out.write_u64(self.0) + } +} + +#[cfg(not(feature = "hacspec"))] +/// The `TokenIdU64` will deserialize one byte ensuring this contains the value +/// 8 and then deserialize a u64 as little endian. It will result in an error if +/// the first byte is not 8. +impl Deserial for TokenIdU64 { + fn deserial(source: &mut R) -> ParseResult { + let byte_length = source.read_u8()?; + if byte_length == 8 { + Ok(TokenIdU64(source.read_u64()?)) + } else { + Err(ParseError::default()) + } + } +} + +// #[cfg(not(feature="hacspec"))] +// /// Display the token ID as a uppercase hex string +// impl fmt::Display for TokenIdU64 { +// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +// for byte in &self.0.to_le_bytes() { +// write!(f, "{:02X}", byte)?; +// } +// Ok(()) +// } +// } + +#+end_src +*** TokenIdU32 +#+begin_src rust :eval never +#[cfg(feature = "hacspec")] +// #[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] +pub struct TokenIdU32(pub u32); + +#[cfg(not(feature = "hacspec"))] +/// Token Identifier, which combined with the address of the contract instance, +/// forms the unique identifier of a token type. +/// +/// The CIS1 specification allows for up to 255 bytes for the token ID, but for +/// most cases using a smaller token ID is fine and can reduce contract energy +/// costs. +/// +/// This token ID uses u32 for representing the token ID bytes which means the +/// token ID space is fixed to 4 bytes and some token IDs cannot be represented. +/// For a more general token ID type see `TokenIdVec`. +#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] +pub struct TokenIdU32(pub u32); + +#[cfg(not(feature = "hacspec"))] +impl IsTokenId for TokenIdU32 {} + +#[cfg(not(feature = "hacspec"))] +impl schema::SchemaType for TokenIdU32 { + fn get_type() -> schema::Type { + schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) + } +} + +#[cfg(not(feature = "hacspec"))] +impl From for TokenIdU32 { + fn from(id: u32) -> Self { + TokenIdU32(id) + } +} + +#[cfg(not(feature = "hacspec"))] +/// The `TokenIdU32` is serialized with one byte with the value 4 followed by 4 +/// bytes to encode a u32 in little endian. +impl Serial for TokenIdU32 { + fn serial(&self, out: &mut W) -> Result<(), W::Err> { + out.write_u8(4)?; + out.write_u32(self.0) + } +} + +#[cfg(not(feature = "hacspec"))] +/// The `TokenIdU32` will deserialize one byte ensuring this contains the value +/// 4 and then deserialize a u32 as little endian. It will result in an error if +/// the first byte is not 4. +impl Deserial for TokenIdU32 { + fn deserial(source: &mut R) -> ParseResult { + let byte_length = source.read_u8()?; + if byte_length == 4 { + Ok(TokenIdU32(source.read_u32()?)) + } else { + Err(ParseError::default()) + } + } +} + +// /// Display the token ID as a uppercase hex string +// impl fmt::Display for TokenIdU32 { +// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +// for byte in &self.0.to_le_bytes() { +// write!(f, "{:02X}", byte)?; +// } +// Ok(()) +// } +// } + +#+end_src +*** TokenIdU16 +#+begin_src rust :eval never +#[cfg(feature = "hacspec")] +// #[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] +pub struct TokenIdU16(pub u16); + +#[cfg(not(feature = "hacspec"))] +/// Token Identifier, which combined with the address of the contract instance, +/// forms the unique identifier of a token type. +/// +/// The CIS1 specification allows for up to 255 bytes for the token ID, but for +/// most cases using a smaller token ID is fine and can reduce contract energy +/// costs. +/// +/// This token ID uses u16 for representing the token ID bytes which means the +/// token ID space is fixed to 2 bytes and some token IDs cannot be represented. +/// For a more general token ID type see `TokenIdVec`. +#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] +pub struct TokenIdU16(pub u16); + +#[cfg(not(feature = "hacspec"))] +impl IsTokenId for TokenIdU16 {} + +#[cfg(not(feature = "hacspec"))] +impl schema::SchemaType for TokenIdU16 { + fn get_type() -> schema::Type { + schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) + } +} + +#[cfg(not(feature = "hacspec"))] +impl From for TokenIdU16 { + fn from(id: u16) -> Self { + TokenIdU16(id) + } +} + +#[cfg(not(feature = "hacspec"))] +/// The `TokenIdU16` is serialized with one byte with the value 2 followed by 2 +/// bytes to encode a u16 in little endian. +impl Serial for TokenIdU16 { + fn serial(&self, out: &mut W) -> Result<(), W::Err> { + out.write_u8(2)?; + out.write_u16(self.0) + } +} + +#[cfg(not(feature = "hacspec"))] +/// The `TokenIdU16` will deserialize one byte ensuring this contains the value +/// 2 and then deserialize a u16 as little endian. It will result in an error if +/// the first byte is not 2. +impl Deserial for TokenIdU16 { + fn deserial(source: &mut R) -> ParseResult { + let byte_length = source.read_u8()?; + if byte_length == 2 { + Ok(TokenIdU16(source.read_u16()?)) + } else { + Err(ParseError::default()) + } + } +} + +// /// Display the token ID as a uppercase hex string +// impl fmt::Display for TokenIdU16 { +// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +// for byte in &self.0.to_le_bytes() { +// write!(f, "{:02X}", byte)?; +// } +// Ok(()) +// } +// } + +#+end_src +*** TokenIdU8 +#+begin_src rust :eval never +#[cfg(feature = "hacspec")] +// #[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] +pub struct TokenIdU8(pub u8); + +#[cfg(not(feature = "hacspec"))] +/// Token Identifier, which combined with the address of the contract instance, +/// forms the unique identifier of a token type. +/// +/// The CIS1 specification allows for up to 255 bytes for the token ID, but for +/// most cases using a smaller token ID is fine and can reduce contract energy +/// costs. +/// +/// This token ID uses u8 for representing the token ID bytes which means the +/// token ID space is fixed to 1 byte and some token IDs cannot be represented. +/// For a more general token ID type see `TokenIdVec`. +#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] +pub struct TokenIdU8(pub u8); + +#[cfg(not(feature = "hacspec"))] +impl IsTokenId for TokenIdU8 {} + +#[cfg(not(feature = "hacspec"))] +impl schema::SchemaType for TokenIdU8 { + fn get_type() -> schema::Type { + schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) + } +} + +#[cfg(not(feature = "hacspec"))] +impl From for TokenIdU8 { + fn from(id: u8) -> Self { + TokenIdU8(id) + } +} + +#[cfg(not(feature = "hacspec"))] +/// The `TokenIdU8` is serialized with one byte with the value 1 followed by 1 +/// bytes to encode a u8 in little endian. +impl Serial for TokenIdU8 { + fn serial(&self, out: &mut W) -> Result<(), W::Err> { + out.write_u8(1)?; + out.write_u8(self.0) + } +} + +#[cfg(not(feature = "hacspec"))] +/// The `TokenIdU8` will deserialize one byte ensuring this contains the value 1 +/// and then deserialize a u8 as little endian. It will result in an error if +/// the first byte is not 1. +impl Deserial for TokenIdU8 { + fn deserial(source: &mut R) -> ParseResult { + let byte_length = source.read_u8()?; + if byte_length == 1 { + Ok(TokenIdU8(source.read_u8()?)) + } else { + Err(ParseError::default()) + } + } +} + +// /// Display the token ID as a uppercase hex string +// impl fmt::Display for TokenIdU8 { +// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +// for byte in &self.0.to_le_bytes() { +// write!(f, "{:02X}", byte)?; +// } +// Ok(()) +// } +// } + +#+end_src +*** TokenIdUnit +#+begin_src rust :eval never +#[cfg(feature = "hacspec")] +// #[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] +pub struct TokenIdUnit(); + +#[cfg(not(feature = "hacspec"))] +/// Token Identifier, which combined with the address of the contract instance, +/// forms the unique identifier of a token type. +/// +/// The CIS1 specification allows for up to 255 bytes for the token ID, but for +/// most cases using a smaller token ID is fine and can reduce contract energy +/// costs. +/// +/// This token ID uses Unit for representing token IDs, which means only one +/// token ID can be represented with this type and other token IDs cannot be +/// represented. For a more general token ID type see `TokenIdVec`. +#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] +pub struct TokenIdUnit(); + +#[cfg(not(feature = "hacspec"))] +impl IsTokenId for TokenIdUnit {} + +#[cfg(not(feature = "hacspec"))] +impl schema::SchemaType for TokenIdUnit { + fn get_type() -> schema::Type { + schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) + } +} + +#[cfg(not(feature = "hacspec"))] +/// The `TokenIdUnit` is serialized with one byte with the value 0. +impl Serial for TokenIdUnit { + fn serial(&self, out: &mut W) -> Result<(), W::Err> { + out.write_u8(0) + } +} + +#[cfg(not(feature = "hacspec"))] +/// The `TokenIdUnit` will deserialize one byte ensuring this contains the value +/// 0. It will result in an error if the byte is not 0. +impl Deserial for TokenIdUnit { + fn deserial(source: &mut R) -> ParseResult { + let byte_length = source.read_u8()?; + if byte_length == 0 { + Ok(TokenIdUnit()) + } else { + Err(ParseError::default()) + } + } +} + +#+end_src +*** More data types -- events +#+begin_src rust :eval never +// #[cfg(not(feature="hacspec"))] +/// An amount of a specific token type. +pub type TokenAmount = u64; + +#[cfg(not(feature = "hacspec"))] +/// An untagged event of a transfer of some amount of tokens from one address to +/// another. For a tagged version, use `Cis1Event`. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct TransferEvent { + /// The ID of the token being transferred. + pub token_id: T, + /// The amount of tokens being transferred. + pub amount: TokenAmount, + /// The address owning these tokens before the transfer. + pub from: Address, + /// The address to receive these tokens after the transfer. + pub to: Address, +} + +#[cfg(not(feature = "hacspec"))] +/// An untagged event of tokens being minted, could be a new token type or +/// extending the total supply of existing token. +/// For a tagged version, use `Cis1Event`. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct MintEvent { + /// The ID of the token being minted, (possibly a new token ID). + pub token_id: T, + /// The number of tokens being minted, this is allowed to be 0 as well. + pub amount: TokenAmount, + /// The initial owner of these newly minted amount of tokens. + pub owner: Address, +} + +#[cfg(not(feature = "hacspec"))] +/// An untagged event of some amount of a token type being burned. +/// For a tagged version, use `Cis1Event`. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct BurnEvent { + /// The ID of the token where an amount is being burned. + pub token_id: T, + /// The amount of tokens being burned. + pub amount: TokenAmount, + /// The owner of the tokens being burned. + pub owner: Address, +} + +#[cfg(feature = "hacspec")] +// #[derive(Debug, Serialize, SchemaType)] +pub enum OperatorUpdate { + /// Remove the operator. + Remove, + /// Add an address as an operator. + Add, +} + +#[cfg(not(feature = "hacspec"))] +/// The update to an the operator. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the variants cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub enum OperatorUpdate { + /// Remove the operator. + Remove, + /// Add an address as an operator. + Add, +} + +#[cfg(feature = "hacspec")] +// #[derive(Debug, Serialize, SchemaType)] +pub struct UpdateOperatorEvent(pub OperatorUpdate, pub UserAddress, pub UserAddress); + +#[cfg(not(feature = "hacspec"))] +/// An untagged event of an update to an operator address for an owner address. +/// For a tagged version, use `Cis1Event`. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct UpdateOperatorEvent { + /// The update to the operator. + pub update: OperatorUpdate, + /// The address for whom, the operator is updated. + pub owner: Address, + /// The address who is the operator being updated. + pub operator: Address, +} + +#[cfg(not(feature = "hacspec"))] +/// An untagged event for setting the metadata for a token. +/// For a tagged version, use `Cis1Event`. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct TokenMetadataEvent { + /// The ID of the token. + pub token_id: T, + /// The location of the metadata. + pub metadata_url: MetadataUrl, +} + +#[cfg(not(feature = "hacspec"))] +/// Tagged CIS1 event to be serialized for the event log. +#[derive(Debug)] +pub enum Cis1Event { + /// A transfer between two addresses of some amount of tokens. + Transfer(TransferEvent), + /// Creation of new tokens, could be both adding some amounts to an existing + /// token or introduce an entirely new token ID. + Mint(MintEvent), + /// Destruction of tokens removing some amounts of a token. + Burn(BurnEvent), + /// Updates to an operator for a specific address and token id. + UpdateOperator(UpdateOperatorEvent), + /// Setting the metadata for a token. + TokenMetadata(TokenMetadataEvent), +} + +#[cfg(not(feature = "hacspec"))] +impl Serial for Cis1Event { + fn serial(&self, out: &mut W) -> Result<(), W::Err> { + match self { + Cis1Event::Transfer(event) => { + out.write_u8(TRANSFER_EVENT_TAG)?; + event.serial(out) + } + Cis1Event::Mint(event) => { + out.write_u8(MINT_EVENT_TAG)?; + event.serial(out) + } + Cis1Event::Burn(event) => { + out.write_u8(BURN_EVENT_TAG)?; + event.serial(out) + } + Cis1Event::UpdateOperator(event) => { + out.write_u8(UPDATE_OPERATOR_EVENT_TAG)?; + event.serial(out) + } + Cis1Event::TokenMetadata(event) => { + out.write_u8(TOKEN_METADATA_EVENT_TAG)?; + event.serial(out) + } + } + } +} + +#[cfg(not(feature = "hacspec"))] +impl Deserial for Cis1Event { + fn deserial(source: &mut R) -> ParseResult { + let tag = source.read_u8()?; + match tag { + TRANSFER_EVENT_TAG => TransferEvent::::deserial(source).map(Cis1Event::Transfer), + MINT_EVENT_TAG => MintEvent::::deserial(source).map(Cis1Event::Mint), + BURN_EVENT_TAG => BurnEvent::::deserial(source).map(Cis1Event::Burn), + UPDATE_OPERATOR_EVENT_TAG => { + UpdateOperatorEvent::deserial(source).map(Cis1Event::UpdateOperator) + } + TOKEN_METADATA_EVENT_TAG => { + TokenMetadataEvent::::deserial(source).map(Cis1Event::TokenMetadata) + } + _ => Err(ParseError::default()), + } + } +} + +#[cfg(not(feature = "hacspec"))] +/// The different errors the contract can produce. +#[derive(Debug, PartialEq, Eq)] +pub enum Cis1Error { + /// Invalid token id (Error code: -42000001). + InvalidTokenId, + /// The balance of the token owner is insufficient for the transfer (Error + /// code: -42000002). + InsufficientFunds, + /// Sender is unauthorized to call this function (Error code: -42000003). + Unauthorized, + /// Custom error + Custom(R), +} + +#[cfg(not(feature = "hacspec"))] +/// Convert Cis1Error into a reject with error code: +/// - InvalidTokenId: -42000001 +/// - InsufficientFunds: -42000002 +/// - Unauthorized: -42000003 +impl> From> for Reject { + fn from(err: Cis1Error) -> Self { + let error_code = match err { + Cis1Error::InvalidTokenId => unsafe { NonZeroI32::new_unchecked(-42000001) }, + Cis1Error::InsufficientFunds => unsafe { NonZeroI32::new_unchecked(-42000002) }, + Cis1Error::Unauthorized => unsafe { NonZeroI32::new_unchecked(-42000003) }, + Cis1Error::Custom(reject) => reject.into().error_code, + }; + Self { error_code } + } +} + +#[cfg(not(feature = "hacspec"))] +impl> From for Cis1Error { + #[inline] + fn from(err: LogError) -> Self { + Cis1Error::Custom(X::from(err)) + } +} + +#[cfg(not(feature = "hacspec"))] +impl> From for Cis1Error { + #[inline] + fn from(err: ParseError) -> Self { + Cis1Error::Custom(X::from(err)) + } +} + +#+end_src +*** Receiver +#+begin_src rust :eval never +#[cfg_attr(feature = "hacspec", derive(Debug, Serialize))] +pub enum ReceiverHacspec { + Account( + PublicByteSeq, + ), + Contract( + PublicByteSeq, + String, + ), +} + +#[cfg(not(feature = "hacspec"))] +/// The receiving address for a transfer, similar to the Address type, but +/// contains extra information when the receiver address is a contract. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the variants and the order of their fields +// cannot be changed. +#[derive(Debug, Serialize)] +pub enum Receiver { + /// The receiver is an account address. + Account( + /// The receiving address. + AccountAddress, + ), + /// The receiver is a contract address. + Contract( + /// The receiving address. + ContractAddress, + /// The function to call on the receiving contract. + OwnedReceiveName, + ), +} + +#[cfg(not(feature = "hacspec"))] +impl Receiver { + /// Construct a receiver from an account address. + pub fn from_account(address: AccountAddress) -> Self { + Receiver::Account(address) + } + + /// Construct a receiver from a contract address. + pub fn from_contract(address: ContractAddress, function: OwnedReceiveName) -> Self { + Receiver::Contract(address, function) + } + + /// Get the Address of the receiver. + pub fn address(&self) -> Address { + match self { + Receiver::Account(address) => Address::Account(*address), + Receiver::Contract(address, ..) => Address::Contract(*address), + } + } +} + +#[cfg(not(feature = "hacspec"))] +impl schema::SchemaType for Receiver { + fn get_type() -> schema::Type { + schema::Type::Enum(vec![ + ( + String::from("Account"), + schema::Fields::Unnamed(vec![AccountAddress::get_type()]), + ), + ( + String::from("Contract"), + schema::Fields::Unnamed(vec![ + ContractAddress::get_type(), + OwnedReceiveName::get_type(), + ]), + ), + ]) + } +} + +#[cfg(not(feature = "hacspec"))] +impl From for Receiver { + fn from(address: AccountAddress) -> Self { + Self::from_account(address) + } +} + +#+end_src +*** Additional Data +#+begin_src rust :eval never +#[cfg_attr(feature = "hacspec", derive(Debug, Serialize))] +pub struct AdditionalDataHacspec(Seq); + +#[cfg(not(feature = "hacspec"))] +/// Additional information to include with a transfer. +#[derive(Debug, Serialize)] +pub struct AdditionalData( + // #[concordium(size_length = 2)] + Vec, +); + +#[cfg(not(feature = "hacspec"))] +impl schema::SchemaType for AdditionalData { + fn get_type() -> schema::Type { + schema::Type::List(schema::SizeLength::U16, Box::new(schema::Type::U8)) + } +} + +#[cfg(not(feature = "hacspec"))] +impl AdditionalData { + /// Construct an AdditionalData containing no data. + pub fn empty() -> Self { + AdditionalData(Vec::new()) + } +} + +#[cfg(not(feature = "hacspec"))] +impl From> for AdditionalData { + fn from(data: Vec) -> Self { + AdditionalData(data) + } +} + +#[cfg(not(feature = "hacspec"))] +impl AsRef<[u8]> for AdditionalData { + fn as_ref(&self) -> &[u8] { + &self.0 + } +} + +#+end_src +*** Transfer +#+begin_src rust :eval never +#[cfg(not(feature = "hacspec"))] +/// A single transfer of some amount of a token. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize)] +pub struct Transfer { + /// The ID of the token being transferred. + pub token_id: T, + /// The amount of tokens being transferred. + pub amount: TokenAmount, + /// The address owning the tokens being transferred. + pub from: Address, + /// The address receiving the tokens being transferred. + pub to: Receiver, + /// Additional data to include in the transfer. + /// Can be used for additional arguments. + pub data: AdditionalData, +} + +#[cfg(not(feature = "hacspec"))] +impl schema::SchemaType for Transfer { + fn get_type() -> schema::Type { + schema::Type::Struct(schema::Fields::Named(vec![ + (String::from("token_id"), T::get_type()), + (String::from("amount"), TokenAmount::get_type()), + (String::from("from"), Address::get_type()), + (String::from("to"), Receiver::get_type()), + (String::from("data"), AdditionalData::get_type()), + ])) + } +} + +#[cfg(not(feature = "hacspec"))] +/// The parameter type for the contract function `transfer`. +#[derive(Debug, Serialize)] +pub struct TransferParams( + // #[concordium(size_length = 2)] + pub Vec>, +); + +#[cfg(not(feature = "hacspec"))] +impl schema::SchemaType for TransferParams { + fn get_type() -> schema::Type { + schema::Type::List(schema::SizeLength::U16, Box::new(Transfer::::get_type())) + } +} + +#[cfg(not(feature = "hacspec"))] +impl From>> for TransferParams { + fn from(transfers: Vec>) -> Self { + TransferParams(transfers) + } +} + +#[cfg(not(feature = "hacspec"))] +impl AsRef<[Transfer]> for TransferParams { + fn as_ref(&self) -> &[Transfer] { + &self.0 + } +} + +#+end_src +*** Update Operator +#+begin_src rust :eval never +#[cfg(not(feature = "hacspec"))] +/// A single update of an operator. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct UpdateOperator { + /// The update for this operator. + pub update: OperatorUpdate, + /// The address which is either added or removed as an operator. + /// Note: The address for whom this will become an operator is the sender of + /// the contract transaction. + pub operator: Address, +} + +#[cfg(not(feature = "hacspec"))] +/// The parameter type for the contract function `updateOperator`. +#[derive(Debug, Serialize, SchemaType)] +pub struct UpdateOperatorParams( + // #[concordium(size_length = 2)] + pub Vec, +); + +#+end_src +*** Balance of +#+begin_src rust :eval never +#[cfg(not(feature = "hacspec"))] +/// A query for the balance of a given address for a given token. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct BalanceOfQuery { + /// The ID of the token for which to query the balance of. + pub token_id: T, + /// The address for which to query the balance of. + pub address: Address, +} + +#[cfg(not(feature = "hacspec"))] +/// The parameter type for the contract function `balanceOf`. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct BalanceOfQueryParams { + /// The contract to trigger with the results of the queries. + pub result_contract: ContractAddress, + /// The contract function to trigger with the results of the queries. + pub result_function: OwnedReceiveName, + /// List of balance queries. + // #[concordium(size_length = 2)] + pub queries: Vec>, +} + +#[cfg(not(feature = "hacspec"))] +/// BalanceOf query with the result of the query. +pub type BalanceOfQueryResult = (BalanceOfQuery, TokenAmount); + +#[cfg(not(feature = "hacspec"))] +/// The response which is sent back when calling the contract function +/// `balanceOf`. +/// It consists of the list of queries paired with their corresponding result. +#[derive(Debug, Serialize, SchemaType)] +pub struct BalanceOfQueryResponse( + // #[concordium(size_length = 2)] + Vec>, +); + +#[cfg(not(feature = "hacspec"))] +impl From>> for BalanceOfQueryResponse { + fn from(results: Vec>) -> Self { + BalanceOfQueryResponse(results) + } +} + +#[cfg(not(feature = "hacspec"))] +impl AsRef<[BalanceOfQueryResult]> for BalanceOfQueryResponse { + fn as_ref(&self) -> &[BalanceOfQueryResult] { + &self.0 + } +} + +#+end_src +*** Operator of +#+begin_src rust :eval never +#[cfg(not(feature = "hacspec"))] +/// A query for the operator of a given address for a given token. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct OperatorOfQuery { + /// The ID of the token for which to query the balance of. + pub owner: Address, + /// The address for which to check for being an operator of the owner. + pub address: Address, +} + +#[cfg(not(feature = "hacspec"))] +/// The parameter type for the contract function `operatorOf`. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct OperatorOfQueryParams { + /// The contract to trigger with the results of the queries. + pub result_contract: ContractAddress, + /// The contract function to trigger with the results of the queries. + pub result_function: OwnedReceiveName, + /// List of operatorOf queries. + // #[concordium(size_length = 2)] + pub queries: Vec, +} + +#[cfg(not(feature = "hacspec"))] +/// OperatorOf query with the result of the query. +pub type OperatorOfQueryResult = (OperatorOfQuery, bool); + +#[cfg(not(feature = "hacspec"))] +/// The response which is sent back when calling the contract function +/// `operatorOf`. +/// It consists of the list of queries paired with their corresponding result. +#[derive(Debug, Serialize, SchemaType)] +pub struct OperatorOfQueryResponse( + // #[concordium(size_length = 2)] + Vec, +); + +#[cfg(not(feature = "hacspec"))] +impl From> for OperatorOfQueryResponse { + fn from(results: Vec) -> Self { + OperatorOfQueryResponse(results) + } +} + +#[cfg(not(feature = "hacspec"))] +impl AsRef<[OperatorOfQueryResult]> for OperatorOfQueryResponse { + fn as_ref(&self) -> &[OperatorOfQueryResult] { + &self.0 + } +} + +#+end_src +*** Token metadata +#+begin_src rust :eval never +#[cfg(not(feature = "hacspec"))] +/// The parameter type for the contract function `tokenMetadata`. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct TokenMetadataQueryParams { + /// The contract to trigger with the results of the queries. + pub result_contract: ContractAddress, + /// The contract function to trigger with the results of the queries. + pub result_function: OwnedReceiveName, + /// List of balance queries. + // #[concordium(size_length = 2)] + pub queries: Vec, +} + +#[cfg(not(feature = "hacspec"))] +/// TokenMetadata query with the result of the query. +pub type TokenMetadataQueryResult = (T, MetadataUrl); + +#[cfg(not(feature = "hacspec"))] +/// The response which is sent back when calling the contract function +/// `tokenMetadata`. +/// It consists of the list of queries paired with their corresponding result. +#[derive(Debug, Serialize, SchemaType)] +pub struct TokenMetadataQueryResponse( + // #[concordium(size_length = 2)] + Vec>, +); + +#[cfg(not(feature = "hacspec"))] +impl From>> for TokenMetadataQueryResponse { + fn from(results: Vec>) -> Self { + TokenMetadataQueryResponse(results) + } +} + +#[cfg(not(feature = "hacspec"))] +impl AsRef<[TokenMetadataQueryResult]> for TokenMetadataQueryResponse { + fn as_ref(&self) -> &[TokenMetadataQueryResult] { + &self.0 + } +} + +#+end_src +*** On Receivivingreceiver +#+begin_src rust :eval never +#[cfg(not(feature = "hacspec"))] +/// The parameter type for a contract function which receives CIS1 tokens. +// Note: For the serialization to be derived according to the CIS1 +// specification, the order of the fields cannot be changed. +#[derive(Debug, Serialize, SchemaType)] +pub struct OnReceivingCis1Params { + /// The ID of the token received. + pub token_id: T, + /// The amount of tokens received. + pub amount: TokenAmount, + /// The previous owner of the tokens. + pub from: Address, + /// The name of the token contract which is tracking the token and + /// implements CIS1. + pub contract_name: OwnedContractName, + /// Some extra information which where sent as part of the transfer. + pub data: AdditionalData, +} +#+end_src + +* WCCD smart contract specification +** Rust code +:PROPERTIES: +:header-args: :tangle ./src/wccd.rs :mkdirp yes +:END: +*** Imports +#+begin_src rust :eval never +#[cfg(not(feature = "hacspec"))] +extern crate hacspec_lib; + +use hacspec_lib::*; + +// #[cfg(not(feature = "hacspec"))] +// extern crate creusot_contracts; +#[cfg(test)] +#[cfg(not(feature = "hacspec"))] +use creusot_contracts::{ensures, requires}; + +use hacspec_concordium::*; + +#[cfg(feature = "hacspec")] +use concert_lib::*; + +#+end_src + +#+begin_src rust :eval never +// #![cfg_attr(not(feature = "std"), no_std)] +// use concordium_cis1::*; + +mod cis1; +pub use cis1::*; + +#[cfg(not(feature = "hacspec"))] +pub use concordium_contracts_common::{HashMap as Map, HashSet as Set}; + +// #[cfg(not(feature = "hacspec"))] +// pub use concordium_impls::*; +// #[cfg(not(feature = "hacspec"))] +// pub use concordium_prims::*; + +// #![cfg_attr(not(feature = "std"), no_std)] +// use concordium_std::*; +// #[cfg(not(feature = "std"))] +// use core::fmt; +// #[cfg(feature = "std")] +// use std::fmt; + +#+end_src +*** Consts +#+begin_src rust :eval never +/// Contract token ID type. +/// Since this contract will only ever contain this one token type, we use the +/// smallest possible token ID. +type ContractTokenId = TokenIdUnit; + +/// The id of the wCCD token in this contract. +const TOKEN_ID_WCCD: ContractTokenId = TokenIdUnit(); + +#[cfg(not(feature = "hacspec"))] +/// The metadata url for the wCCD token. +const TOKEN_METADATA_URL: &str = "https://some.example/token/wccd"; + +#+end_src + +*** Types +#+begin_src rust :eval never +// Types + +/// The state tracked for each address. +#[cfg_attr(feature = "hacspec", derive(Serialize, SchemaType))] +struct AddressStateHacspec (TokenAmount, PublicByteSeq); + +#[cfg(not(feature = "hacspec"))] +/// The state tracked for each address. +#[derive(Serialize, SchemaType)] +struct AddressState { + /// The number of tokens owned by this address. + balance: TokenAmount, + /// The address which are currently enabled as operators for this token and + /// this address. + // #[concordium(size_length = 1)] + operators: Set
, +} + +#+end_src + +#+begin_src rust :eval never +#[cfg_attr(feature = "hacspec", contract_state(contract = "CIS1-wCCD"))] +#[cfg_attr(feature = "hacspec", derive(Serialize, SchemaType))] +struct StateHacspec(pub PublicByteSeq); // Map + +#[cfg(not(feature = "hacspec"))] +/// The contract state, +#[contract_state(contract = "CIS1-wCCD")] +#[derive(Serialize, SchemaType)] +struct State { + /// The state the one token. + token: Map, +} + +#+end_src + +#+begin_src rust :eval never +#[cfg_attr(feature = "hacspec", derive(Serialize, SchemaType))] +struct UnwrapParamsHacspec (TokenAmount, PublicByteSeq, ReceiverHacspec, AdditionalDataHacspec); + +#[cfg(not(feature = "hacspec"))] +/// The parameter type for the contract function `unwrap`. +/// Takes an amount of tokens and unwrap the CCD and send it to a receiver. +#[derive(Serialize, SchemaType)] +struct UnwrapParams { + /// The amount of tokens to unwrap. + amount: TokenAmount, + /// The owner of the tokens. + owner: Address, + /// The address to receive these unwrapped CCD. + receiver: cis1::Receiver, + /// Some additional bytes to include in the transfer. + data: AdditionalData, +} + +#+end_src + +#+begin_src rust :eval never +#[cfg_attr(feature = "hacspec", derive(Serialize, SchemaType))] +struct WrapParamsHacspec (ReceiverHacspec, AdditionalDataHacspec); + +#[cfg(not(feature = "hacspec"))] +/// The parameter type for the contract function `wrap`. +/// +/// The receiver for the wrapped CCD tokens. +#[derive(Serialize, SchemaType)] +struct WrapParams { + /// The address to receive these tokens. + /// If the receiver is the sender of the message wrapping the tokens, it + /// will not log a transfer. + to: cis1::Receiver, + /// Some additional bytes to include in a transfer. + data: AdditionalData, +} + +#+end_src + +#+begin_src rust :eval never +#[cfg(not(feature = "hacspec"))] +/// The different errors the contract can produce. +#[derive(Serialize, Debug, PartialEq, Eq, Reject)] +enum CustomContractError { + /// Failed parsing the parameter. + #[from(ParseError)] + ParseParams, + /// Failed logging: Log is full. + LogFull, + /// Failed logging: Log is malformed. + LogMalformed, +} + +#+end_src + +#+begin_src rust :eval never +#[cfg(not(feature = "hacspec"))] +type ContractError = Cis1Error; + +#+end_src + +#+begin_src rust :eval never +#[cfg(not(feature = "hacspec"))] +type ContractResult = Result; + +#+end_src + +*** Implemenetations +#+begin_src rust :eval never +#[cfg(not(feature = "hacspec"))] +/// Mapping the logging errors to ContractError. +impl From for CustomContractError { + fn from(le: LogError) -> Self { + match le { + LogError::Full => Self::LogFull, + LogError::Malformed => Self::LogMalformed, + } + } +} + +#[cfg(not(feature = "hacspec"))] +/// Mapping CustomContractError to ContractError +impl From for ContractError { + fn from(c: CustomContractError) -> Self { + Cis1Error::Custom(c) + } +} + +#[cfg(not(feature = "hacspec"))] +impl State { + /// Creates a new state with no one owning any tokens by default. + fn new() -> Self { + State { + token: Map::default(), + } + } + + /// Get the current balance of a given token id for a given address. + /// Results in an error if the token id does not exist in the state. + fn balance( + &self, + token_id: &ContractTokenId, + address: &Address, + ) -> ContractResult { + // ensure_eq!(token_id, &TOKEN_ID_WCCD, ContractError::InvalidTokenId); + Ok(self.token.get(address).map(|s| s.balance).unwrap_or(0)) + } + + /// Check is an address is an operator of a specific owner address. + /// Results in an error if the token id does not exist in the state. + fn is_operator(&self, address: &Address, owner: &Address) -> bool { + self.token + .get(owner) + .map(|address_state| address_state.operators.contains(address)) + .unwrap_or(false) + } + + /// Update the state with a transfer. + /// Results in an error if the token id does not exist in the state or if + /// the from address have insufficient tokens to do the transfer. + fn transfer( + &mut self, + token_id: &ContractTokenId, + amount: TokenAmount, + from: &Address, + to: &Address, + ) -> ContractResult<()> { + // ensure_eq!(token_id, &TOKEN_ID_WCCD, ContractError::InvalidTokenId); + if amount == 0 { + return Ok(()); + } + let from_state = self + .token + .get_mut(from) + .ok_or(ContractError::InsufficientFunds)?; + ensure!( + from_state.balance >= amount, + ContractError::InsufficientFunds + ); + from_state.balance -= amount; + let to_state = self.token.entry(*to).or_insert_with(|| AddressState { + balance: 0, + operators: Set::default(), + }); + to_state.balance += amount; + Ok(()) + } + + /// Update the state adding a new operator for a given token id and address. + /// Results in an error if the token id does not exist in the state. + /// Succeeds even if the `operator` is already an operator for this + /// `token_id` and `address`. + fn add_operator(&mut self, owner: &Address, operator: &Address) { + let address_state = self.token.entry(*owner).or_insert_with(|| AddressState { + balance: 0, + operators: Set::default(), + }); + address_state.operators.insert(*operator); + } + + /// Update the state removing an operator for a given token id and address. + /// Results in an error if the token id does not exist in the state. + /// Succeeds even if the `operator` is not an operator for this `token_id` + /// and `address`. + fn remove_operator(&mut self, owner: &Address, operator: &Address) { + self.token + .get_mut(owner) + .map(|address_state| address_state.operators.remove(operator)); + } + + fn mint( + &mut self, + token_id: &ContractTokenId, + amount: TokenAmount, + owner: &Address, + ) -> ContractResult<()> { + // ensure_eq!(token_id, &TOKEN_ID_WCCD, ContractError::InvalidTokenId); + let address_state = self.token.entry(*owner).or_insert_with(|| AddressState { + balance: 0, + operators: Set::default(), + }); + address_state.balance += amount; + Ok(()) + } + + fn burn( + &mut self, + token_id: &ContractTokenId, + amount: TokenAmount, + owner: &Address, + ) -> ContractResult<()> { + // ensure_eq!(token_id, &TOKEN_ID_WCCD, ContractError::InvalidTokenId); + if amount == 0 { + return Ok(()); + } + let from_state = self + .token + .get_mut(owner) + .ok_or(ContractError::InsufficientFunds)?; + ensure!( + from_state.balance >= amount, + ContractError::InsufficientFunds + ); + from_state.balance -= amount; + Ok(()) + } +} + +#+end_src + +*** Contract +#+begin_src rust :eval never +// Contract functions + +#[cfg(feature = "hacspec")] +/// Initialize contract instance with no initial tokens. +/// Logs a `Mint` event for the single token id with no amounts. +#[init(contract = "CIS1-wCCD", enable_logger)] +pub fn contract_init(ctx: Context) -> (Context, StateHacspec) { + (ctx, StateHacspec(PublicByteSeq::new(0))) +} + +#[cfg(not(feature = "hacspec"))] +/// Initialize contract instance with no initial tokens. +/// Logs a `Mint` event for the single token id with no amounts. +#[init(contract = "CIS1-wCCD", enable_logger)] +fn contract_init(ctx: &impl HasInitContext, logger: &mut impl HasLogger) -> InitResult { + // Construct the initial contract state. + let state = State::new(); + // Get the instantiater of this contract instance. + let invoker = Address::Account(ctx.init_origin()); + // Log event for the newly minted token. + logger.log(&Cis1Event::Mint(MintEvent { + token_id: TOKEN_ID_WCCD, + amount: 0, + owner: invoker, + }))?; + + // Log event for where to find metadata for the token + logger.log(&Cis1Event::TokenMetadata(TokenMetadataEvent { + token_id: TOKEN_ID_WCCD, + metadata_url: MetadataUrl { + url: String::from(TOKEN_METADATA_URL), + hash: None, + }, + }))?; + + Ok(state) +} + +#+end_src + +#+begin_src rust :eval never +#[cfg(feature = "hacspec")] +/// Receive function in which accounts can bid before the auction end time +#[receive( + contract = "CIS1-wCCD", + name = "wrap", + parameter = "WrapParamsHacspec", + enable_logger, + payable +)] +// pub fn contract_wrap(contract_address_index : u64, contract_address_sub_index : u64, function: String, parameter: PublicByteSeq) { +fn contract_wrap( + ctx: (Context, StateHacspec), + amount: u64, +) -> Option<((Context, StateHacspec), ListAction)> { + let (Context(owner, sender, balance, time), state) = ctx; + + let s = Seq::::new(0); + + // send_wrap_hacspec( + // contract_address_index, + // contract_address_sub_index, + // parameter.clone(), + // 0u64, + // parameter.clone()); + + Option::<((Context, StateHacspec), ListAction)>::Some(( + (Context(owner, sender, balance, time), state), + s, + )) +} + +#[cfg(not(feature = "hacspec"))] +/// Wrap an amount of CCD into wCCD tokens and transfer the tokens if the sender +/// is not the receiver. +#[receive( + contract = "CIS1-wCCD", + name = "wrap", + parameter = "WrapParams", + enable_logger, + payable +)] +fn contract_wrap( + ctx: &impl HasReceiveContext, + amount: Amount, + logger: &mut impl HasLogger, + state: &mut State, +) -> ContractResult { + let params: WrapParams = ctx.parameter_cursor().get()?; + // Get the sender who invoked this contract function. + let sender = ctx.sender(); + + let receive_address = params.to.address(); + + // Update the state. + state.mint(&TOKEN_ID_WCCD, amount.micro_ccd, &receive_address)?; + + // Log the newly minted tokens. + logger.log(&Cis1Event::Mint(MintEvent { + token_id: TOKEN_ID_WCCD, + amount: amount.micro_ccd, + owner: sender, + }))?; + + // Only log a transfer event if receiver is not the one who payed for this. + if sender != receive_address { + logger.log(&Cis1Event::Transfer(TransferEvent { + token_id: TOKEN_ID_WCCD, + amount: amount.micro_ccd, + from: sender, + to: receive_address, + }))?; + } + + // Send message to the receiver of the tokens. + if let cis1::Receiver::Contract(address, function) = params.to { + let parameter = OnReceivingCis1Params { + token_id: TOKEN_ID_WCCD, + amount: amount.micro_ccd, + from: sender, + contract_name: OwnedContractName::new_unchecked(String::from("init_CIS1-wCCD")), + data: params.data, + }; + // let param_bytes = concordium_contracts_common::to_bytes(¶meter); + // Ok(A::send_raw(&address, function.as_ref(), Amount::zero(), ¶m_bytes)) + Ok(send_wrap( + &address, + function.as_ref(), + Amount::zero(), + ¶meter, + )) + } else { + Ok(A::accept()) + } +} + +#+end_src + +#+begin_src rust :eval never +#[cfg(feature = "hacspec")] +/// Receive function in which accounts can bid before the auction end time +#[receive( + contract = "CIS1-wCCD", + name = "unwrap", + parameter = "UnwrapParamsHacspec", + enable_logger +)] +fn contract_unwrap(ctx: (Context, StateHacspec)) -> Option<((Context, StateHacspec), ListAction)> { + let (Context(owner, sender, balance, time), state) = ctx; + + let s = Seq::::new(0); + + Option::<((Context, StateHacspec), ListAction)>::Some(( + (Context(owner, sender, balance, time), state), + s, + )) +} + +#[cfg(not(feature = "hacspec"))] +/// Unwrap an amount of wCCD tokens into CCD +#[receive( + contract = "CIS1-wCCD", + name = "unwrap", + parameter = "UnwrapParams", + enable_logger +)] +fn contract_unwrap( + ctx: &impl HasReceiveContext, + logger: &mut impl HasLogger, + state: &mut State, +) -> ContractResult { + let params: UnwrapParams = ctx.parameter_cursor().get()?; + // Get the sender who invoked this contract function. + let sender = ctx.sender(); + ensure!( + sender == params.owner || state.is_operator(&sender, ¶ms.owner), + ContractError::Unauthorized + ); + + // Update the state. + state.burn(&TOKEN_ID_WCCD, params.amount, ¶ms.owner)?; + + // Log the burning of tokens. + logger.log(&Cis1Event::Burn(BurnEvent { + token_id: TOKEN_ID_WCCD, + amount: params.amount, + owner: params.owner, + }))?; + + let unwrapped_amount = Amount::from_micro_ccd(params.amount); + + let action = match params.receiver { + cis1::Receiver::Account(address) => A::simple_transfer(&address, unwrapped_amount), + cis1::Receiver::Contract(address, function) => { + send_wrap(&address, function.as_ref(), unwrapped_amount, ¶ms.data) + } + }; + + Ok(action) +} + +#+end_src + +#+begin_src rust :eval never +// Contract functions required by CIS1 + +#[allow(dead_code)] +type TransferParameterHacspec = (); // TODO: hacspec repr for TransferParams; + +#[cfg(not(feature = "hacspec"))] +#[allow(dead_code)] +type TransferParameter = TransferParams; + +#[cfg(feature = "hacspec")] +/// Receive function in which accounts can bid before the auction end time +#[receive( + contract = "CIS1-wCCD", + name = "transfer", + parameter = "TransferParameterHacspec", + enable_logger +)] +fn contract_transfer(ctx: (Context, StateHacspec)) -> Option<((Context, StateHacspec), ListAction)> { + let (Context(owner, sender, balance, time), state) = ctx; + + let s = Seq::::new(0); + + Option::<((Context, StateHacspec), ListAction)>::Some(( + (Context(owner, sender, balance, time), state), + s, + )) +} + +#[cfg(not(feature = "hacspec"))] +/// Execute a list of token transfers, in the order of the list. +/// +/// Logs a `Transfer` event for each transfer in the list. +/// Produces an action which sends a message to each contract which was the +/// receiver of a transfer. +/// +/// It rejects if: +/// - It fails to parse the parameter. +/// - Any of the transfers fail to be executed, which could be if: +/// - The `token_id` does not exist. +/// - The sender is not the owner of the token, or an operator for this +/// specific `token_id` and `from` address. +/// - The token is not owned by the `from`. +/// - Fails to log event. +/// - Any of the messages sent to contracts receiving a transfer choose to +/// reject. +#[receive( + contract = "CIS1-wCCD", + name = "transfer", + parameter = "TransferParameter", + enable_logger +)] +fn contract_transfer( + ctx: &impl HasReceiveContext, + logger: &mut impl HasLogger, + state: &mut State, +) -> ContractResult { + let mut cursor = ctx.parameter_cursor(); + // Parse the number of transfers. + let transfers_length: u8 = cursor.get()?; + // Get the sender who invoked this contract function. + let sender = ctx.sender(); + + let mut actions = A::accept(); + // Loop over the number of transfers. + for _ in 0..transfers_length { + // Parse one of the transfers. + let Transfer { + token_id, + amount, + from, + to, + data, + } = cursor.get()?; + // Authenticate the sender for this transfer + ensure!( + from == sender || state.is_operator(&sender, &from), + ContractError::Unauthorized + ); + let to_address = to.address(); + // Update the contract state + state.transfer(&token_id, amount, &from, &to_address)?; + + // Log transfer event + logger.log(&Cis1Event::Transfer(TransferEvent { + token_id, + amount, + from, + to: to_address, + }))?; + + // If the receiver is a contract, we add sending it a message to the list of + // actions. + if let cis1::Receiver::Contract(address, function) = to { + let parameter = OnReceivingCis1Params { + token_id, + amount, + from, + contract_name: OwnedContractName::new_unchecked(String::from("init_CIS1-Multi")), + data, + }; + let action = send_wrap(&address, function.as_ref(), Amount::zero(), ¶meter); + actions = actions.and_then(action); + } + } + Ok(actions) +} + + +#+end_src + +#+begin_src rust :eval never +#[cfg(feature = "hacspec")] +/// Receive function in which accounts can bid before the auction end time +#[receive( + contract = "CIS1-wCCD", + name = "updateOperator", + parameter = "UpdateOperatorParams", + enable_logger +)] +fn contract_update_operator(ctx: (Context, StateHacspec)) -> Option<((Context, StateHacspec), ListAction)> { + let (Context(owner, sender, balance, time), state) = ctx; + + let s = Seq::::new(0); + + Option::<((Context, StateHacspec), ListAction)>::Some(( + (Context(owner, sender, balance, time), state), + s, + )) +} + + +#[cfg(not(feature="hacspec"))] +/// Enable or disable addresses as operators of the sender address. +/// Logs an `UpdateOperator` event. +/// +/// It rejects if: +/// - It fails to parse the parameter. +/// - The operator address is the same as the sender address. +/// - Fails to log event. +#[receive( + contract = "CIS1-wCCD", + name = "updateOperator", + parameter = "UpdateOperatorParams", + enable_logger +)] +fn contract_update_operator( + ctx: &impl HasReceiveContext, + logger: &mut impl HasLogger, + state: &mut State, +) -> ContractResult { + // Parse the parameter. + let UpdateOperatorParams(params) = ctx.parameter_cursor().get()?; + // Get the sender who invoked this contract function. + let sender = ctx.sender(); + + for param in params { + // Update the operator in the state. + match param.update { + OperatorUpdate::Add => state.add_operator(&sender, ¶m.operator), + OperatorUpdate::Remove => state.remove_operator(&sender, ¶m.operator), + } + + // Log the appropriate event + logger.log(&Cis1Event::::UpdateOperator(UpdateOperatorEvent { + owner: sender, + operator: param.operator, + update: param.update, + }))?; + } + + Ok(A::accept()) +} + +#+end_src + +#+begin_src rust :eval never +#[cfg(not(feature="hacspec"))] +/// Parameter type for the CIS-1 function `balanceOf` specialized to the subset +/// of TokenIDs used by this contract. +// This type is pub to silence the dead_code warning, as this type is only used +// for when generating the schema. +pub type ContractBalanceOfQueryParams = BalanceOfQueryParams; + +#[cfg(feature = "hacspec")] +/// Receive function in which accounts can bid before the auction end time +#[receive(contract = "CIS1-wCCD", name = "balanceOf", parameter = "ContractBalanceOfQueryParams")] +fn contract_balance_of(ctx: (Context, StateHacspec)) -> Option<((Context, StateHacspec), ListAction)> { + let (Context(owner, sender, balance, time), state) = ctx; + + let s = Seq::::new(0); + + Option::<((Context, StateHacspec), ListAction)>::Some(( + (Context(owner, sender, balance, time), state), + s, + )) +} + +#[cfg(not(feature="hacspec"))] +/// Get the balance of given token IDs and addresses. It takes a contract +/// address plus contract function to invoke with the result. +/// +/// It rejects if: +/// - Sender is not a contract. +/// - It fails to parse the parameter. +/// - Any of the queried `token_id` does not exist. +/// - Message sent back with the result rejects. +#[receive(contract = "CIS1-wCCD", name = "balanceOf", parameter = "ContractBalanceOfQueryParams")] +fn contract_balance_of( + ctx: &impl HasReceiveContext, + state: &mut State, +) -> ContractResult { + let mut cursor = ctx.parameter_cursor(); + // Parse the contract address to receive the result. + let result_contract: ContractAddress = cursor.get()?; + // Parse the contract function name to call with the result. + let result_hook: OwnedReceiveName = cursor.get()?; + // Parse the number of queries. + let queries_length: u8 = cursor.get()?; + + // Build the response. + let mut response = Vec::with_capacity(queries_length.into()); + for _ in 0..queries_length { + // Parse one of the queries. + let query: BalanceOfQuery = ctx.parameter_cursor().get()?; + // Query the state for balance. + let amount = state.balance(&query.token_id, &query.address)?; + response.push((query, amount)); + } + // Send back the response. + Ok(send_wrap( + &result_contract, + result_hook.as_ref(), + Amount::zero(), + &BalanceOfQueryResponse::from(response), + )) +} + +#+end_src + +#+begin_src rust :eval never +#[cfg(feature = "hacspec")] +/// Receive function in which accounts can bid before the auction end time +#[receive(contract = "CIS1-wCCD", name = "operatorOf", parameter = "OperatorOfQueryParams")] +fn contract_operator_of(ctx: (Context, StateHacspec)) -> Option<((Context, StateHacspec), ListAction)> { + let (Context(owner, sender, balance, time), state) = ctx; + + let s = Seq::::new(0); + + Option::<((Context, StateHacspec), ListAction)>::Some(( + (Context(owner, sender, balance, time), state), + s, + )) +} + +#[cfg(not(feature="hacspec"))] +/// Takes a list of queries. Each query is an owner address and some address to +/// check as an operator of the owner address. It takes a contract address plus +/// contract function to invoke with the result. +/// +/// It rejects if: +/// - It fails to parse the parameter. +/// - Message sent back with the result rejects. +#[receive(contract = "CIS1-wCCD", name = "operatorOf", parameter = "OperatorOfQueryParams")] +fn contract_operator_of( + ctx: &impl HasReceiveContext, + state: &mut State, +) -> ContractResult { + // Parse the parameter. + let params: OperatorOfQueryParams = ctx.parameter_cursor().get()?; + // Build the response. + let mut response = Vec::with_capacity(params.queries.len()); + for query in params.queries { + // Query the state for address being an operator of owner. + let is_operator = state.is_operator(&query.owner, &query.address); + response.push((query, is_operator)); + } + // Send back the response. + Ok(send_wrap( + ¶ms.result_contract, + params.result_function.as_ref(), + Amount::zero(), + &OperatorOfQueryResponse::from(response), + )) +} + +#[cfg(not(feature="hacspec"))] +/// Parameter type for the CIS-1 function `tokenMetadata` specialized to the +/// subset of TokenIDs used by this contract. +// This type is pub to silence the dead_code warning, as this type is only used +// for when generating the schema. +pub type ContractTokenMetadataQueryParams = TokenMetadataQueryParams; + +#[cfg(feature = "hacspec")] +/// Receive function in which accounts can bid before the auction end time +#[receive( + contract = "CIS1-wCCD", + name = "tokenMetadata", + parameter = "ContractTokenMetadataQueryParams" +)] +fn contract_token_metadata(ctx: (Context, StateHacspec)) -> Option<((Context, StateHacspec), ListAction)> { + let (Context(owner, sender, balance, time), state) = ctx; + + let s = Seq::::new(0); + + Option::<((Context, StateHacspec), ListAction)>::Some(( + (Context(owner, sender, balance, time), state), + s, + )) +} + +#[cfg(not(feature="hacspec"))] +/// Get the token metadata URLs and checksums given a list of token IDs. It +/// takes a contract address plus contract function to invoke with the result. +/// +/// It rejects if: +/// - It fails to parse the parameter. +/// - Any of the queried `token_id` does not exist. +/// - Message sent back with the result rejects. +#[receive( + contract = "CIS1-wCCD", + name = "tokenMetadata", + parameter = "ContractTokenMetadataQueryParams" +)] +fn contract_token_metadata( + ctx: &impl HasReceiveContext, + _state: &mut State, +) -> ContractResult { + let mut cursor = ctx.parameter_cursor(); + // Parse the contract address to receive the result. + let result_contract: ContractAddress = cursor.get()?; + // Parse the contract function name to call with the result. + let result_hook: OwnedReceiveName = cursor.get()?; + // Parse the number of queries. + let queries_length: u8 = cursor.get()?; + + // Build the response. + let mut response = Vec::with_capacity(queries_length.into()); + for _ in 0..queries_length { + let token_id: ContractTokenId = cursor.get()?; + // Check the token exists. + ensure_eq!(token_id, TOKEN_ID_WCCD, ContractError::InvalidTokenId); + + let metadata_url = MetadataUrl { + url: TOKEN_METADATA_URL.to_string(), + hash: None, + }; + response.push((token_id, metadata_url)); + } + // Send back the response. + Ok(send_wrap( + &result_contract, + result_hook.as_ref(), + Amount::zero(), + &TokenMetadataQueryResponse::from(response), + )) +} + +#+end_src + +*** Tests +#+begin_src rust :eval never +// Tests + +#[cfg(not(feature="hacspec"))] +#[concordium_cfg_test] +mod tests { + use super::*; + use test_infrastructure::*; + + const ACCOUNT_0: AccountAddress = AccountAddress([0u8; 32]); + const ADDRESS_0: Address = Address::Account(ACCOUNT_0); + const ACCOUNT_1: AccountAddress = AccountAddress([1u8; 32]); + const ADDRESS_1: Address = Address::Account(ACCOUNT_1); + + /// Test helper function which creates a contract state where ADDRESS_0 owns + /// 400 tokens. + fn initial_state() -> State { + let mut state = State::new(); + state.mint(&TOKEN_ID_WCCD, 400, &ADDRESS_0).expect_report("Failed to setup state"); + state + } + + /// Test initialization succeeds and the tokens are owned by the contract + /// instantiater and the appropriate events are logged. + #[concordium_test] + fn test_init() { + // Setup the context + let mut ctx = InitContextTest::empty(); + ctx.set_init_origin(ACCOUNT_0); + + let mut logger = LogRecorder::init(); + + // Call the contract function. + let result = contract_init(&ctx, &mut logger); + + // Check the result + let state = result.expect_report("Contract initialization failed"); + + // Check the state + claim_eq!(state.token.len(), 0, "Only one token is initialized"); + let balance0 = + state.balance(&TOKEN_ID_WCCD, &ADDRESS_0).expect_report("Token is expected to exist"); + claim_eq!(balance0, 0, "No initial tokens are owned by the contract instantiater"); + + // Check the logs + claim_eq!(logger.logs.len(), 2, "Exactly one event should be logged"); + claim!( + logger.logs.contains(&to_bytes(&Cis1Event::Mint(MintEvent { + owner: ADDRESS_0, + token_id: TOKEN_ID_WCCD, + amount: 0, + }))), + "Missing event for minting the token" + ); + claim!( + logger.logs.contains(&to_bytes(&Cis1Event::TokenMetadata(TokenMetadataEvent { + token_id: TOKEN_ID_WCCD, + metadata_url: MetadataUrl { + url: String::from(TOKEN_METADATA_URL), + hash: None, + }, + }))), + "Missing event with metadata for the token" + ); + } + + /// Test transfer succeeds, when `from` is the sender. + #[concordium_test] + fn test_transfer_account() { + // Setup the context + let mut ctx = ReceiveContextTest::empty(); + ctx.set_sender(ADDRESS_0); + + // and parameter. + let transfer = Transfer { + token_id: TOKEN_ID_WCCD, + amount: 100, + from: ADDRESS_0, + to: cis1::Receiver::from_account(ACCOUNT_1), + data: AdditionalData::empty(), + }; + let parameter = TransferParams::from(vec![transfer]); + let parameter_bytes = to_bytes(¶meter); + ctx.set_parameter(¶meter_bytes); + + let mut logger = LogRecorder::init(); + let mut state = State::new(); + state.mint(&TOKEN_ID_WCCD, 400, &ADDRESS_0).expect_report("Failed to setup state"); + + // Call the contract function. + let result: ContractResult = contract_transfer(&ctx, &mut logger, &mut state); + // Check the result. + let actions = result.expect_report("Results in rejection"); + claim_eq!(actions, ActionsTree::accept(), "No action should be produced."); + + // Check the state. + let balance0 = + state.balance(&TOKEN_ID_WCCD, &ADDRESS_0).expect_report("Token is expected to exist"); + let balance1 = + state.balance(&TOKEN_ID_WCCD, &ADDRESS_1).expect_report("Token is expected to exist"); + claim_eq!( + balance0, + 300, + "Token owner balance should be decreased by the transferred amount" + ); + claim_eq!( + balance1, + 100, + "Token receiver balance should be increased by the transferred amount" + ); + + // Check the logs. + claim_eq!(logger.logs.len(), 1, "Only one event should be logged"); + claim_eq!( + logger.logs[0], + to_bytes(&Cis1Event::Transfer(TransferEvent { + from: ADDRESS_0, + to: ADDRESS_1, + token_id: TOKEN_ID_WCCD, + amount: 100, + })), + "Incorrect event emitted" + ) + } + + /// Test transfer token fails, when sender is neither the owner or an + /// operator of the owner. + #[concordium_test] + fn test_transfer_not_authorized() { + // Setup the context + let mut ctx = ReceiveContextTest::empty(); + ctx.set_sender(ADDRESS_1); + + // and parameter. + let transfer = Transfer { + from: ADDRESS_0, + to: cis1::Receiver::from_account(ACCOUNT_1), + token_id: TOKEN_ID_WCCD, + amount: 100, + data: AdditionalData::empty(), + }; + let parameter = TransferParams::from(vec![transfer]); + let parameter_bytes = to_bytes(¶meter); + ctx.set_parameter(¶meter_bytes); + + let mut logger = LogRecorder::init(); + let mut state = initial_state(); + + // Call the contract function. + let result: ContractResult = contract_transfer(&ctx, &mut logger, &mut state); + // Check the result. + let err = result.expect_err_report("Expected to fail"); + claim_eq!(err, ContractError::Unauthorized, "Error is expected to be Unauthorized") + } + + /// Test transfer succeeds when sender is not the owner, but is an operator + /// of the owner. + #[concordium_test] + fn test_operator_transfer() { + // Setup the context + let mut ctx = ReceiveContextTest::empty(); + ctx.set_sender(ADDRESS_1); + + // and parameter. + let transfer = Transfer { + from: ADDRESS_0, + to: cis1::Receiver::from_account(ACCOUNT_1), + token_id: TOKEN_ID_WCCD, + amount: 100, + data: AdditionalData::empty(), + }; + let parameter = TransferParams::from(vec![transfer]); + let parameter_bytes = to_bytes(¶meter); + ctx.set_parameter(¶meter_bytes); + + let mut logger = LogRecorder::init(); + let mut state = initial_state(); + state.add_operator(&ADDRESS_0, &ADDRESS_1); + + // Call the contract function. + let result: ContractResult = contract_transfer(&ctx, &mut logger, &mut state); + + // Check the result. + let actions: ActionsTree = result.expect_report("Results in rejection"); + claim_eq!(actions, ActionsTree::accept(), "No action should be produced."); + + // Check the state. + let balance0 = + state.balance(&TOKEN_ID_WCCD, &ADDRESS_0).expect_report("Token is expected to exist"); + let balance1 = + state.balance(&TOKEN_ID_WCCD, &ADDRESS_1).expect_report("Token is expected to exist"); + claim_eq!(balance0, 300); //, "Token owner balance should be decreased by the transferred amount"); + claim_eq!( + balance1, + 100, + "Token receiver balance should be increased by the transferred amount" + ); + + // Check the logs. + claim_eq!(logger.logs.len(), 1, "Only one event should be logged"); + claim_eq!( + logger.logs[0], + to_bytes(&Cis1Event::Transfer(TransferEvent { + from: ADDRESS_0, + to: ADDRESS_1, + token_id: TOKEN_ID_WCCD, + amount: 100, + })), + "Incorrect event emitted" + ) + } + + /// Test adding an operator succeeds and the appropriate event is logged. + #[concordium_test] + fn test_add_operator() { + // Setup the context + let mut ctx = ReceiveContextTest::empty(); + ctx.set_sender(ADDRESS_0); + + // and parameter. + let update = UpdateOperator { + operator: ADDRESS_1, + update: OperatorUpdate::Add, + }; + let parameter = UpdateOperatorParams(vec![update]); + let parameter_bytes = to_bytes(¶meter); + ctx.set_parameter(¶meter_bytes); + + let mut logger = LogRecorder::init(); + let mut state = initial_state(); + + // Call the contract function. + let result: ContractResult = + contract_update_operator(&ctx, &mut logger, &mut state); + + // Check the result. + let actions: ActionsTree = result.expect_report("Results in rejection"); + claim_eq!(actions, ActionsTree::accept(), "No action should be produced."); + + // Check the state. + claim!(state.is_operator(&ADDRESS_1, &ADDRESS_0), "Account should be an operator"); + + // Check the logs. + claim_eq!(logger.logs.len(), 1, "One event should be logged"); + claim_eq!( + logger.logs[0], + to_bytes(&Cis1Event::::UpdateOperator(UpdateOperatorEvent { + owner: ADDRESS_0, + operator: ADDRESS_1, + update: OperatorUpdate::Add, + })), + "Incorrect event emitted" + ) + } +} +#+end_src + +** Generation of backend output + +#+begin_src elisp :var SOURCE-CODE-FILE="Hacspec_Wccd.v" :results output silent :tangle no +(org-babel-detangle SOURCE-CODE-FILE) +#+end_src + +*** wccd - Coq code +:PROPERTIES: +:header-args: coq :tangle Hacspec_Wccd.v :mkdirp yes :comments link +:header-args: coq :eval never :results output silent +:END: + +#+begin_src coq + +(** This file was automatically generated using Hacspec **) +Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +From Coq Require Import List. +Import ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. +Open Scope hacspec_scope. + +From ConCert.Utils Require Import Extras. +From ConCert.Utils Require Import Automation. +From ConCert.Execution Require Import Serializable. +From ConCert.Execution Require Import Blockchain. +From ConCert.Execution Require Import ContractCommon. +From Coq Require Import Morphisms ZArith Basics. +Open Scope Z. +Set Nonrecursive Elimination Schemes. +#+end_src + +#+begin_src coq +Require Import Hacspec_Lib. +Export Hacspec_Lib. +#+end_src + +#+begin_src coq +Require Import Hacspec_Concordium. +Export Hacspec_Concordium. +#+end_src + +#+begin_src coq +Require Import Concert_Lib. +Export Concert_Lib. +#+end_src + +#+begin_src coq +Definition transfer_event_tag_v : int8 := + @repr WORDSIZE8 255. +#+end_src + +#+begin_src coq +Definition mint_event_tag_v : int8 := + (@repr WORDSIZE8 255) .- (@repr WORDSIZE8 1). +#+end_src + +#+begin_src coq +Definition burn_event_tag_v : int8 := + (@repr WORDSIZE8 255) .- (@repr WORDSIZE8 2). +#+end_src + +#+begin_src coq +Definition update_operator_event_tag_v : int8 := + (@repr WORDSIZE8 255) .- (@repr WORDSIZE8 3). +#+end_src + +#+begin_src coq +Definition token_metadata_event_tag_v : int8 := + (@repr WORDSIZE8 255) .- (@repr WORDSIZE8 4). +#+end_src + +#+begin_src coq +Definition sha256_t := nseq (int8) (usize 32). +#+end_src + +#+begin_src coq +Inductive metadata_url_t := +| MetadataUrl : (string_t ∏ (option sha256_t)) -> metadata_url_t. +Global Instance serializable_metadata_url_t : Serializable metadata_url_t := + Derive Serializable metadata_url_t_rect. +#+end_src + +#+begin_src coq +Inductive token_id_vec_t := +| TokenIdVec : public_byte_seq -> token_id_vec_t. +Global Instance serializable_token_id_vec_t : Serializable token_id_vec_t := + Derive Serializable token_id_vec_t_rect. +#+end_src + +#+begin_src coq +Inductive token_id_uint32_t := +| TokenIdU32 : int32 -> token_id_uint32_t. +Global Instance serializable_token_id_uint32_t : Serializable token_id_uint32_t := + Derive Serializable token_id_uint32_t_rect. +#+end_src + +#+begin_src coq +Inductive token_id_uint16_t := +| TokenIdU16 : int16 -> token_id_uint16_t. +Global Instance serializable_token_id_uint16_t : Serializable token_id_uint16_t := + Derive Serializable token_id_uint16_t_rect. +#+end_src + +#+begin_src coq +Inductive token_id_uint8_t := +| TokenIdU8 : int8 -> token_id_uint8_t. +Global Instance serializable_token_id_uint8_t : Serializable token_id_uint8_t := + Derive Serializable token_id_uint8_t_rect. +#+end_src + +#+begin_src coq +Inductive token_id_unit_t := +| TokenIdUnit : unit -> token_id_unit_t. +Global Instance serializable_token_id_unit_t : Serializable token_id_unit_t := + Derive Serializable token_id_unit_t_rect. +#+end_src + +#+begin_src coq +Notation "'token_amount_t'" := (int64) : hacspec_scope. +#+end_src + +#+begin_src coq +Inductive operator_update_t := +| Remove : operator_update_t +| Add : operator_update_t. +Global Instance serializable_operator_update_t : Serializable operator_update_t := + Derive Serializable operator_update_t_rect. +#+end_src + +#+begin_src coq +Inductive update_operator_event_t := +| UpdateOperatorEvent : (operator_update_t ∏ user_address_t ∏ user_address_t +) -> update_operator_event_t. +Global Instance serializable_update_operator_event_t : Serializable update_operator_event_t := + Derive Serializable update_operator_event_t_rect. +#+end_src + +#+begin_src coq +Notation "'contract_token_id_t'" := (token_id_unit_t) : hacspec_scope. +#+end_src + +#+begin_src coq +Definition token_id_wccd_v : contract_token_id_t := + TokenIdUnit (tt). +#+end_src + +#+begin_src coq +Inductive state_hacspec_t := +| StateHacspec : public_byte_seq -> state_hacspec_t. +Global Instance serializable_state_hacspec_t : Serializable state_hacspec_t := + Derive Serializable state_hacspec_t_rect. +Definition State := context_t ∏ state_hacspec_t. +#+end_src + +#+begin_src coq +Definition contract_init (ctx_0 : context_t): (context_t ∏ state_hacspec_t) := + (ctx_0, StateHacspec (seq_new_ (default) (usize 0))). +Definition Setup := unit. +Definition CIS1_wCCD_State (chain : Chain) (ctx : ContractCallContext) (setup : Setup) : option ( + context_t ∏ + state_hacspec_t +) := + Some (contract_init (Context (ctx.(ctx_from), ctx.(ctx_origin), repr ctx.(ctx_amount), 0 (* TODO *)))). +#+end_src + +#+begin_src coq +Definition contract_wrap + (ctx_1 : (context_t ∏ state_hacspec_t)) + (amount_2 : int64): (option ((context_t ∏ state_hacspec_t) ∏ list_action_t + )) := + let '(Context ((owner_3, sender_4, balance_5, time_6)), state_7) := + ctx_1 in + let s_8 : seq has_action_t := + seq_new_ (default) (usize 0) in + @Some ((context_t ∏ state_hacspec_t) ∏ list_action_t) (( + (Context ((owner_3, sender_4, balance_5, time_6)), state_7), + s_8 + )). + +Definition wrap (amount : int64) (st : State) := + contract_wrap st amount. +#+end_src + +#+begin_src coq +Definition contract_unwrap + (ctx_9 : (context_t ∏ state_hacspec_t)): (option ( + (context_t ∏ state_hacspec_t) ∏ + list_action_t + )) := + let '(Context ((owner_10, sender_11, balance_12, time_13)), state_14) := + ctx_9 in + let s_15 : seq has_action_t := + seq_new_ (default) (usize 0) in + @Some ((context_t ∏ state_hacspec_t) ∏ list_action_t) (( + (Context ((owner_10, sender_11, balance_12, time_13)), state_14), + s_15 + )). + +Definition unwrap (st : State) := + contract_unwrap st. +#+end_src + +#+begin_src coq +Definition contract_transfer + (ctx_16 : (context_t ∏ state_hacspec_t)): (option ( + (context_t ∏ state_hacspec_t) ∏ + list_action_t + )) := + let '(Context ((owner_17, sender_18, balance_19, time_20)), state_21) := + ctx_16 in + let s_22 : seq has_action_t := + seq_new_ (default) (usize 0) in + @Some ((context_t ∏ state_hacspec_t) ∏ list_action_t) (( + (Context ((owner_17, sender_18, balance_19, time_20)), state_21), + s_22 + )). + +Definition transfer (st : State) := + contract_transfer st. +#+end_src + +#+begin_src coq +Definition contract_update_operator + (ctx_23 : (context_t ∏ state_hacspec_t)): (option ( + (context_t ∏ state_hacspec_t) ∏ + list_action_t + )) := + let '(Context ((owner_24, sender_25, balance_26, time_27)), state_28) := + ctx_23 in + let s_29 : seq has_action_t := + seq_new_ (default) (usize 0) in + @Some ((context_t ∏ state_hacspec_t) ∏ list_action_t) (( + (Context ((owner_24, sender_25, balance_26, time_27)), state_28), + s_29 + )). + +Definition updateOperator (st : State) := + contract_update_operator st. +#+end_src + +#+begin_src coq +Definition contract_balance_of + (ctx_30 : (context_t ∏ state_hacspec_t)): (option ( + (context_t ∏ state_hacspec_t) ∏ + list_action_t + )) := + let '(Context ((owner_31, sender_32, balance_33, time_34)), state_35) := + ctx_30 in + let s_36 : seq has_action_t := + seq_new_ (default) (usize 0) in + @Some ((context_t ∏ state_hacspec_t) ∏ list_action_t) (( + (Context ((owner_31, sender_32, balance_33, time_34)), state_35), + s_36 + )). + +Definition balanceOf (st : State) := + contract_balance_of st. +#+end_src + +#+begin_src coq +Definition contract_operator_of + (ctx_37 : (context_t ∏ state_hacspec_t)): (option ( + (context_t ∏ state_hacspec_t) ∏ + list_action_t + )) := + let '(Context ((owner_38, sender_39, balance_40, time_41)), state_42) := + ctx_37 in + let s_43 : seq has_action_t := + seq_new_ (default) (usize 0) in + @Some ((context_t ∏ state_hacspec_t) ∏ list_action_t) (( + (Context ((owner_38, sender_39, balance_40, time_41)), state_42), + s_43 + )). + +Definition operatorOf (st : State) := + contract_operator_of st. +#+end_src + +#+begin_src coq +Definition contract_token_metadata + (ctx_44 : (context_t ∏ state_hacspec_t)): (option ( + (context_t ∏ state_hacspec_t) ∏ + list_action_t + )) := + let '(Context ((owner_45, sender_46, balance_47, time_48)), state_49) := + ctx_44 in + let s_50 : seq has_action_t := + seq_new_ (default) (usize 0) in + @Some ((context_t ∏ state_hacspec_t) ∏ list_action_t) (( + (Context ((owner_45, sender_46, balance_47, time_48)), state_49), + s_50 + )). + +Definition tokenMetadata (st : State) := + contract_token_metadata st. +#+end_src + +#+begin_src coq +Inductive Msg := +| WRAP +| UNWRAP +| TRANSFER +| UPDATEOPERATOR +| BALANCEOF +| OPERATOROF +| TOKENMETADATA. +Global Instance Msg_serializable : Serializable Msg := + Derive Serializable Msg_rect. +Definition CIS1_wCCD_receive (chain : Chain) (ctx : ContractCallContext) (state : State) (msg : option Msg) : option (State * list ActionBody) := + match msg with + | Some WRAP => to_action_body_list ctx (wrap (repr ctx.(ctx_amount)) state) + | Some UNWRAP => to_action_body_list ctx (unwrap state) + | Some TRANSFER => to_action_body_list ctx (transfer state) + | Some UPDATEOPERATOR => to_action_body_list ctx (updateOperator state) + | Some BALANCEOF => to_action_body_list ctx (balanceOf state) + | Some OPERATOROF => to_action_body_list ctx (operatorOf state) + | Some TOKENMETADATA => to_action_body_list ctx (tokenMetadata state) + | None => None + end. + +Definition CIS1_wCCD_contract : Contract Setup Msg State := + build_contract CIS1_wCCD_State CIS1_wCCD_receive. +#+end_src +# 31 code sections From 6f3eacf1f1f7ee129156795eca46fac2a29219e2 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Fri, 24 Nov 2023 13:56:41 +0100 Subject: [PATCH 32/86] A bit of Cleanup --- ovn/proofs/fstar/extraction/Hacspec_ovn.fst | 508 --------------- .../extraction/Hacspec_ovn.semantics | 117 ---- ovn/proofs/ssprove/extraction/ConCertLib.v | 484 -------------- ovn/proofs/ssprove/extraction/Core.v | 39 -- ovn/proofs/ssprove/extraction/Hacspec_lib.v | 578 ----------------- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 481 +++++++------- .../ssprove/extraction/Hacspec_ovn_fixes.v | 501 --------------- .../ssprove/extraction/Hacspec_ovn_working.v | 598 ------------------ ovn/proofs/ssprove/extraction/HashMap.v | 67 -- ovn/proofs/ssprove/extraction/_CoqProject | 9 - ovn/proofs/ssprove/extraction/missing.org | 25 - ovn/proofs/ssprove/extraction/ovn_by_hand.v | 211 ------ ovn/proofs/ssprove/extraction/ovn_helpers.txt | 40 -- 13 files changed, 236 insertions(+), 3422 deletions(-) delete mode 100644 ovn/proofs/fstar/extraction/Hacspec_ovn.fst delete mode 100644 ovn/proofs/semantics/extraction/Hacspec_ovn.semantics delete mode 100644 ovn/proofs/ssprove/extraction/ConCertLib.v delete mode 100644 ovn/proofs/ssprove/extraction/Core.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_lib.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_fixes.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_working.v delete mode 100644 ovn/proofs/ssprove/extraction/HashMap.v delete mode 100644 ovn/proofs/ssprove/extraction/missing.org delete mode 100644 ovn/proofs/ssprove/extraction/ovn_by_hand.v delete mode 100644 ovn/proofs/ssprove/extraction/ovn_helpers.txt diff --git a/ovn/proofs/fstar/extraction/Hacspec_ovn.fst b/ovn/proofs/fstar/extraction/Hacspec_ovn.fst deleted file mode 100644 index 2e34433..0000000 --- a/ovn/proofs/fstar/extraction/Hacspec_ovn.fst +++ /dev/null @@ -1,508 +0,0 @@ -module Hacspec_ovn -#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" -open Core -open FStar.Mul - -class t_Group (v_Self: Type) = { - f_group_type:Type; - f_group_type:Concordium_contracts_common.Traits.t_Serialize v_5183569706910926426.f_group_type; - f_group_type:Concordium_contracts_common.Traits.t_Deserial v_1888537976224086151.f_group_type; - f_group_type:Concordium_contracts_common.Traits.t_Serial v_10320647326333630898.f_group_type; - f_group_type:Core.Marker.t_Copy v_4543221020923779833.f_group_type; - f_group_type:Core.Clone.t_Clone v_17761277238820538890.f_group_type; - f_group_type:Core.Cmp.t_Eq v_6020902491195533656.f_group_type; - f_group_type:Core.Cmp.t_PartialEq v_12217495809561341085.f_group_type - v_10832891087211025400.f_group_type; - f_group_type:Core.Marker.t_Sized v_11006113574502888163.f_group_type; - f_q:u32; - f_g:v_2435825814251343790.f_group_type; - f_g_pow:u32 -> v_12403217412826525306.f_group_type; - f_pow:v_17386186435278539070.f_group_type -> u32 -> v_17745298227217489689.f_group_type; - f_one:v_14625496897574701453.f_group_type; - f_prod:v_15803927440588513364.f_group_type -> v_8822219464673212186.f_group_type - -> v_385434819834542306.f_group_type; - f_inv:v_1421783649257234612.f_group_type -> v_2900833311577513391.f_group_type; - f_div:v_15411338300132236088.f_group_type -> v_5612355442158236557.f_group_type - -> v_1581199640938228835.f_group_type -} - -type t_vals = - | C_vals_MyVal : t_vals - | C_vals_YourVal : u32 -> t_vals - | C_vals_YourSecondVal : u32 -> u32 -> t_vals - | C_vals_StrangeVal { - f_a:u32; - f_b:u32; - f_c:u32 - }: t_vals - -let v_ZKP (g_pow_xi xi: u32) : u32 = 0ul - -let v_ZKP_one_out_of_two (g_pow_vi: u32) (vi: bool) : u32 = 32ul - -let check_commitment (g_pow_xi_yi_vi zkp: u32) : bool = true - -let check_valid (zkp: u32) : bool = true - -let check_valid2 (g_pow_xi_yi_vi zkp: u32) : bool = true - -let commit_to (x: u32) : u32 = 0ul - -let n: usize = sz 20 - -let select_private_voting_key (random: u32) : u32 = random %! f_q - -let test_v: t_vals = C_vals_YourVal 32ul <: t_vals - -let test_vals (x: t_vals) : u32 = - match x with - | C_vals_MyVal -> 0ul - | C_vals_YourVal x -> x - | C_vals_YourSecondVal x y -> y - | C_vals_StrangeVal - { Hacspec_ovn.Vals.f_a = a ; Hacspec_ovn.Vals.f_c = c ; Hacspec_ovn.Vals.f_b = b } -> - c - -type t_CastVoteParam = { - f_cvp_i:u32; - f_cvp_xi:u32; - f_cvp_vote:bool -} - -type t_RegisterParam = { - f_rp_i:u32; - f_rp_xi:u32 -} - -type t_TallyParameter = | TallyParameter : t_TallyParameter - -type t_alt_test = { - f_d:u32; - f_e:u32; - f_f:u32 -} - -type t_z_17_ = | C_z_17_ : t_z_17_ - -unfold -let t_G = t_z_17_ - -let test_alt_vals (x: t_alt_test) : u32 = match x with | { f_d = d ; f_f = f ; f_e = e } -> f - -[@@ FStar.Tactics.Typeclasses.tcinstance] -let impl_Group_for_z_17: t_Group t_z_17_ = - { - f_group_type = u32; - f_q = 17ul; - f_g = 3ul; - f_g_pow = (fun (x: u32) -> (f_g ^. x <: u32) %! f_q); - f_pow = (fun (g: u32) (x: u32) -> (f_g ^. x <: u32) %! f_q); - f_one = 1ul; - f_prod = (fun (x: u32) (y: u32) -> (x *! y <: u32) %! f_q); - f_inv - = - (fun (x: u32) -> - let res:u32 = 0ul in - let res:u32 = - Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter ({ - Core.Ops.Range.f_start = 1ul; - Core.Ops.Range.f_end = f_q - } - <: - Core.Ops.Range.t_Range u32) - <: - Core.Ops.Range.t_Range u32) - res - (fun res i -> - let res:u32 = res in - let i:u32 = i in - let ii_computation:u32 = i in - if (f_g_pow i <: u32) =. x - then - let res:u32 = ii_computation in - res - else res) - in - res); - f_div = fun (x: u32) (y: u32) -> f_prod x (f_inv y <: u32) - } - -let compute_group_element_for_vote (i xi: u32) (vote: bool) (xis: t_Array u32 (sz 20)) : u32 = - let prod1:u32 = f_one in - let prod1:u32 = - Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter ({ - Core.Ops.Range.f_start = sz 0; - Core.Ops.Range.f_end = cast (i -! 1ul <: u32) <: usize - } - <: - Core.Ops.Range.t_Range usize) - <: - Core.Ops.Range.t_Range usize) - prod1 - (fun prod1 j -> - let prod1:u32 = prod1 in - let j:usize = j in - f_prod prod1 (xis.[ j ] <: u32) <: u32) - in - let prod2:u32 = f_one in - let prod2:u32 = - Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter ({ - Core.Ops.Range.f_start = cast (i +! 1ul <: u32) <: usize; - Core.Ops.Range.f_end = n - } - <: - Core.Ops.Range.t_Range usize) - <: - Core.Ops.Range.t_Range usize) - prod2 - (fun prod2 j -> - let prod2:u32 = prod2 in - let j:usize = j in - f_prod prod2 (xis.[ j ] <: u32) <: u32) - in - let v_Yi:u32 = f_div prod1 prod2 in - f_prod (f_pow v_Yi xi <: u32) (f_g_pow (if vote then 1ul else 0ul) <: u32) - -type t_OvnContractState = { - f_g_pow_xis:t_Array (impl_Group_for_z_17).f_group_type (sz 20); - f_zkp_xis:t_Array u32 (sz 20); - f_commit_vis:t_Array u32 (sz 20); - f_g_pow_xi_yi_vis:t_Array (impl_Group_for_z_17).f_group_type (sz 20); - f_zkp_vis:t_Array u32 (sz 20); - f_tally:u32 -} - -let cast_vote - (#v_A #impl_574521470_: Type) - (#[FStar.Tactics.Typeclasses.tcresolve ()] ii0: Core.Marker.t_Sized v_A) - (#[FStar.Tactics.Typeclasses.tcresolve ()] ii1: Core.Marker.t_Sized impl_574521470_) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - ii2: - Hacspec_concordium.Concordium_traits.t_HasActions v_A) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - ii3: - Hacspec_concordium.Concordium_traits.t_HasReceiveContext impl_574521470_ Prims.unit) - (ctx: impl_574521470_) - (state: t_OvnContractState) - : Core.Result.t_Result (v_A & t_OvnContractState) Concordium_contracts_common.Types.t_ParseError = - Rust_primitives.Hax.Control_flow_monad.Mexception.run (let _, out:(_ & - Core.Result.t_Result t_CastVoteParam Concordium_contracts_common.Types.t_ParseError) = - Concordium_contracts_common.Traits.f_get (Hacspec_concordium.Concordium_traits.f_parameter_cursor - ctx - <: - _) - in - let* (params: t_CastVoteParam):t_CastVoteParam = - match Core.Ops.Try_trait.f_branch out with - | Core.Ops.Control_flow.ControlFlow_Break residual -> - let* hoist1:Rust_primitives.Hax.t_Never = - Core.Ops.Control_flow.ControlFlow.v_Break (Core.Ops.Try_trait.f_from_residual residual - <: - Core.Result.t_Result (v_A & t_OvnContractState) - Concordium_contracts_common.Types.t_ParseError) - in - Core.Ops.Control_flow.ControlFlow_Continue (Rust_primitives.Hax.never_to_any hoist1) - <: - Core.Ops.Control_flow.t_ControlFlow - (Core.Result.t_Result (v_A & t_OvnContractState) - Concordium_contracts_common.Types.t_ParseError) t_CastVoteParam - | Core.Ops.Control_flow.ControlFlow_Continue v_val -> - Core.Ops.Control_flow.ControlFlow_Continue v_val - <: - Core.Ops.Control_flow.t_ControlFlow - (Core.Result.t_Result (v_A & t_OvnContractState) - Concordium_contracts_common.Types.t_ParseError) t_CastVoteParam - in - Core.Ops.Control_flow.ControlFlow_Continue - (let g_pow_xi_yi_vi:u32 = - compute_group_element_for_vote params.f_cvp_i - params.f_cvp_xi - params.f_cvp_vote - state.f_g_pow_xis - in - let zkp_vi:u32 = v_ZKP_one_out_of_two g_pow_xi_yi_vi params.f_cvp_vote in - let cast_vote_state_ret:t_OvnContractState = Core.Clone.f_clone state in - let cast_vote_state_ret:t_OvnContractState = - { - cast_vote_state_ret with - f_g_pow_xi_yi_vis - = - Rust_primitives.Hax.update_at cast_vote_state_ret.f_g_pow_xi_yi_vis - (cast (params.f_cvp_i <: u32) <: usize) - g_pow_xi_yi_vi - } - <: - t_OvnContractState - in - let cast_vote_state_ret:t_OvnContractState = - { - cast_vote_state_ret with - f_zkp_vis - = - Rust_primitives.Hax.update_at cast_vote_state_ret.f_zkp_vis - (cast (params.f_cvp_i <: u32) <: usize) - zkp_vi - } - <: - t_OvnContractState - in - Core.Result.Result_Ok - (Hacspec_concordium.Concordium_traits.f_accept, cast_vote_state_ret - <: - (v_A & t_OvnContractState)) - <: - Core.Result.t_Result (v_A & t_OvnContractState) - Concordium_contracts_common.Types.t_ParseError) - <: - Core.Ops.Control_flow.t_ControlFlow - (Core.Result.t_Result (v_A & t_OvnContractState) - Concordium_contracts_common.Types.t_ParseError) - (Core.Result.t_Result (v_A & t_OvnContractState) - Concordium_contracts_common.Types.t_ParseError)) - -let commit_to_vote - (#v_A #impl_574521470_: Type) - (#[FStar.Tactics.Typeclasses.tcresolve ()] ii0: Core.Marker.t_Sized v_A) - (#[FStar.Tactics.Typeclasses.tcresolve ()] ii1: Core.Marker.t_Sized impl_574521470_) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - ii2: - Hacspec_concordium.Concordium_traits.t_HasActions v_A) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - ii3: - Hacspec_concordium.Concordium_traits.t_HasReceiveContext impl_574521470_ Prims.unit) - (ctx: impl_574521470_) - (state: t_OvnContractState) - : Core.Result.t_Result (v_A & t_OvnContractState) Concordium_contracts_common.Types.t_ParseError = - Rust_primitives.Hax.Control_flow_monad.Mexception.run (let _, out:(_ & - Core.Result.t_Result t_CastVoteParam Concordium_contracts_common.Types.t_ParseError) = - Concordium_contracts_common.Traits.f_get (Hacspec_concordium.Concordium_traits.f_parameter_cursor - ctx - <: - _) - in - let* (params: t_CastVoteParam):t_CastVoteParam = - match Core.Ops.Try_trait.f_branch out with - | Core.Ops.Control_flow.ControlFlow_Break residual -> - let* hoist2:Rust_primitives.Hax.t_Never = - Core.Ops.Control_flow.ControlFlow.v_Break (Core.Ops.Try_trait.f_from_residual residual - <: - Core.Result.t_Result (v_A & t_OvnContractState) - Concordium_contracts_common.Types.t_ParseError) - in - Core.Ops.Control_flow.ControlFlow_Continue (Rust_primitives.Hax.never_to_any hoist2) - <: - Core.Ops.Control_flow.t_ControlFlow - (Core.Result.t_Result (v_A & t_OvnContractState) - Concordium_contracts_common.Types.t_ParseError) t_CastVoteParam - | Core.Ops.Control_flow.ControlFlow_Continue v_val -> - Core.Ops.Control_flow.ControlFlow_Continue v_val - <: - Core.Ops.Control_flow.t_ControlFlow - (Core.Result.t_Result (v_A & t_OvnContractState) - Concordium_contracts_common.Types.t_ParseError) t_CastVoteParam - in - Core.Ops.Control_flow.ControlFlow_Continue - (let _:Prims.unit = - Rust_primitives.Hax.failure "(FunctionalizeLoops) something is not implemented yet.\nLoop without mutation?\n" - "{\n for zkp in (core::iter::traits::collect::f_into_iter::<[int; 20]>(\n proj_hacspec_ovn::f_zkp_xis(state),\n )) {\n {\n let _: bool = { hacspec_ovn::check_valid(zkp) };\n Tuple0()\n }\n }\n }" - - in - let g_pow_xi_yi_vi:u32 = - compute_group_element_for_vote params.f_cvp_i - params.f_cvp_xi - params.f_cvp_vote - state.f_g_pow_xis - in - let commit_vi:u32 = commit_to g_pow_xi_yi_vi in - let commit_to_vote_state_ret:t_OvnContractState = Core.Clone.f_clone state in - let commit_to_vote_state_ret:t_OvnContractState = - { - commit_to_vote_state_ret with - f_commit_vis - = - Rust_primitives.Hax.update_at commit_to_vote_state_ret.f_commit_vis - (cast (params.f_cvp_i <: u32) <: usize) - commit_vi - } - <: - t_OvnContractState - in - Core.Result.Result_Ok - (Hacspec_concordium.Concordium_traits.f_accept, commit_to_vote_state_ret - <: - (v_A & t_OvnContractState)) - <: - Core.Result.t_Result (v_A & t_OvnContractState) - Concordium_contracts_common.Types.t_ParseError) - <: - Core.Ops.Control_flow.t_ControlFlow - (Core.Result.t_Result (v_A & t_OvnContractState) - Concordium_contracts_common.Types.t_ParseError) - (Core.Result.t_Result (v_A & t_OvnContractState) - Concordium_contracts_common.Types.t_ParseError)) - -let init_ovn_contract - (#impl_108907986_: Type) - (#[FStar.Tactics.Typeclasses.tcresolve ()] ii0: Core.Marker.t_Sized impl_108907986_) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - ii1: - Hacspec_concordium.Concordium_traits.t_HasInitContext impl_108907986_ Prims.unit) - (_: impl_108907986_) - : Core.Result.t_Result t_OvnContractState Hacspec_concordium.Concordium_types.t_Reject = - Core.Result.Result_Ok - ({ - f_g_pow_xis = Rust_primitives.Hax.repeat (f_one <: u32) (sz 20); - f_zkp_xis = Rust_primitives.Hax.repeat 0ul (sz 20); - f_commit_vis = Rust_primitives.Hax.repeat 0ul (sz 20); - f_g_pow_xi_yi_vis = Rust_primitives.Hax.repeat (f_one <: u32) (sz 20); - f_zkp_vis = Rust_primitives.Hax.repeat 0ul (sz 20); - f_tally = 0ul - } - <: - t_OvnContractState) - <: - Core.Result.t_Result t_OvnContractState Hacspec_concordium.Concordium_types.t_Reject - -let register_vote - (#v_A #impl_574521470_: Type) - (#[FStar.Tactics.Typeclasses.tcresolve ()] ii0: Core.Marker.t_Sized v_A) - (#[FStar.Tactics.Typeclasses.tcresolve ()] ii1: Core.Marker.t_Sized impl_574521470_) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - ii2: - Hacspec_concordium.Concordium_traits.t_HasActions v_A) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - ii3: - Hacspec_concordium.Concordium_traits.t_HasReceiveContext impl_574521470_ Prims.unit) - (ctx: impl_574521470_) - (state: t_OvnContractState) - : Core.Result.t_Result (v_A & t_OvnContractState) Concordium_contracts_common.Types.t_ParseError = - Rust_primitives.Hax.Control_flow_monad.Mexception.run (let _, out:(_ & - Core.Result.t_Result t_RegisterParam Concordium_contracts_common.Types.t_ParseError) = - Concordium_contracts_common.Traits.f_get (Hacspec_concordium.Concordium_traits.f_parameter_cursor - ctx - <: - _) - in - let* (params: t_RegisterParam):t_RegisterParam = - match Core.Ops.Try_trait.f_branch out with - | Core.Ops.Control_flow.ControlFlow_Break residual -> - let* hoist3:Rust_primitives.Hax.t_Never = - Core.Ops.Control_flow.ControlFlow.v_Break (Core.Ops.Try_trait.f_from_residual residual - <: - Core.Result.t_Result (v_A & t_OvnContractState) - Concordium_contracts_common.Types.t_ParseError) - in - Core.Ops.Control_flow.ControlFlow_Continue (Rust_primitives.Hax.never_to_any hoist3) - <: - Core.Ops.Control_flow.t_ControlFlow - (Core.Result.t_Result (v_A & t_OvnContractState) - Concordium_contracts_common.Types.t_ParseError) t_RegisterParam - | Core.Ops.Control_flow.ControlFlow_Continue v_val -> - Core.Ops.Control_flow.ControlFlow_Continue v_val - <: - Core.Ops.Control_flow.t_ControlFlow - (Core.Result.t_Result (v_A & t_OvnContractState) - Concordium_contracts_common.Types.t_ParseError) t_RegisterParam - in - Core.Ops.Control_flow.ControlFlow_Continue - (let g_pow_xi:u32 = f_g_pow params.f_rp_xi in - let zkp_xi:u32 = v_ZKP g_pow_xi params.f_rp_xi in - let register_vote_state_ret:t_OvnContractState = Core.Clone.f_clone state in - let register_vote_state_ret:t_OvnContractState = - { - register_vote_state_ret with - f_g_pow_xis - = - Rust_primitives.Hax.update_at register_vote_state_ret.f_g_pow_xis - (cast (params.f_rp_i <: u32) <: usize) - g_pow_xi - } - <: - t_OvnContractState - in - let register_vote_state_ret:t_OvnContractState = - { - register_vote_state_ret with - f_zkp_xis - = - Rust_primitives.Hax.update_at register_vote_state_ret.f_zkp_xis - (cast (params.f_rp_i <: u32) <: usize) - zkp_xi - } - <: - t_OvnContractState - in - Core.Result.Result_Ok - (Hacspec_concordium.Concordium_traits.f_accept, register_vote_state_ret - <: - (v_A & t_OvnContractState)) - <: - Core.Result.t_Result (v_A & t_OvnContractState) - Concordium_contracts_common.Types.t_ParseError) - <: - Core.Ops.Control_flow.t_ControlFlow - (Core.Result.t_Result (v_A & t_OvnContractState) - Concordium_contracts_common.Types.t_ParseError) - (Core.Result.t_Result (v_A & t_OvnContractState) - Concordium_contracts_common.Types.t_ParseError)) - -let tally_votes - (#v_A: Type) - (#impl_574521470_: Type) - (#[FStar.Tactics.Typeclasses.tcresolve ()] ii0: Core.Marker.t_Sized v_A) - (#[FStar.Tactics.Typeclasses.tcresolve ()] ii1: Core.Marker.t_Sized impl_574521470_) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - ii2: - Hacspec_concordium.Concordium_traits.t_HasActions v_A) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - ii3: - Hacspec_concordium.Concordium_traits.t_HasReceiveContext impl_574521470_ Prims.unit) - (_: impl_574521470_) - (state: t_OvnContractState) - : Core.Result.t_Result (v_A & t_OvnContractState) Concordium_contracts_common.Types.t_ParseError = - let _:Prims.unit = - Rust_primitives.Hax.failure "(FunctionalizeLoops) something is not implemented yet.\nLoop without mutation?\n" - "{\n for i in (core::iter::traits::collect::f_into_iter::>(\n core::ops::range::Range {\n f_start: 0,\n f_end: hacspec_ovn::n,\n },\n )) {\n {\n let _: bool = {\n hacspec_ovn::check_valid2(\n core::ops::index::Index::index(\n proj_hacspec_ovn::f_g_pow_xi_yi_vis(state),\n i,\n ),\n core::ops::index::Index::index(proj_hacspec_ovn::f_zkp_vis(state), i),\n )\n };\n {\n let _: bool = {\n hacspec_ovn::check_commitment(\n core::ops::index::Index::index(\n proj_hacspec_ovn::f_g_pow_xi_yi_vis(state),\n i,\n ),\n core::ops::index::Index::index(\n proj_hacspec_ovn::f_commit_vis(state),\n i,\n ),\n )\n };\n Tuple0()\n }\n }\n }\n }" - - in - let vote_result:u32 = f_one in - let vote_result:u32 = - Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter state.f_g_pow_xi_yi_vis - <: - Core.Array.Iter.t_IntoIter u32 (sz 20)) - vote_result - (fun vote_result g_pow_vote -> - let vote_result:u32 = vote_result in - let g_pow_vote:u32 = g_pow_vote in - f_prod vote_result g_pow_vote <: u32) - in - let tally:u32 = 0ul in - let tally:u32 = - Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter ({ - Core.Ops.Range.f_start = 0ul; - Core.Ops.Range.f_end = cast (n <: usize) <: u32 - } - <: - Core.Ops.Range.t_Range u32) - <: - Core.Ops.Range.t_Range u32) - tally - (fun tally i -> - let tally:u32 = tally in - let i:u32 = i in - if (f_g_pow i <: u32) =. vote_result <: bool - then - let tally:u32 = i in - tally - else tally) - in - let tally_votes_state_ret:t_OvnContractState = Core.Clone.f_clone state in - let tally_votes_state_ret:t_OvnContractState = - { tally_votes_state_ret with f_tally = tally } <: t_OvnContractState - in - Core.Result.Result_Ok - (Hacspec_concordium.Concordium_traits.f_accept, tally_votes_state_ret - <: - (v_A & t_OvnContractState)) - <: - Core.Result.t_Result (v_A & t_OvnContractState) Concordium_contracts_common.Types.t_ParseError diff --git a/ovn/proofs/semantics/extraction/Hacspec_ovn.semantics b/ovn/proofs/semantics/extraction/Hacspec_ovn.semantics deleted file mode 100644 index a70b561..0000000 --- a/ovn/proofs/semantics/extraction/Hacspec_ovn.semantics +++ /dev/null @@ -1,117 +0,0 @@ -(* Automatically Generated Functional Semantics *) -Import core prelude rust_2018 - -(Unimplemented NotImplementedYet) - -(Unimplemented NotImplementedYet) - -(Unimplemented HaxError) - -Type-Definition t_z_17_ := {} - -Section t_Group - Type-Definition group_type := int - Definition q := - 17 - Definition g := - 3 - Definition g_pow := - λ x, - (rem ((bitxor g) x)) q - Definition pow := - λ g x, - (rem ((bitxor g) x)) q - Definition one := - 1 - Definition prod := - λ x y, - (rem ((mul x) y)) q - Definition inv := - λ x, - let res := 0 in - let res := ((fold (into_iter Range[f_start := 1][f_end := q])) res) (λ res i, - (λ true, - let res := i in - res - | false, - res) ((eq (g_pow i)) x)) in - res - Definition div := - λ x y, - (prod x) (inv y) - End t_Group - -Type-Definition t_G := t_z_17__t - -Definition n := - λ (), 20 - -Type-Definition t_OvnContractState := {f_g_pow_xis : _ array<20>; f_zkp_xis : int array<20>; f_commit_vis : int array<20>; f_g_pow_xi_yi_vis : _ array<20>; f_zkp_vis : int array<20>; f_tally : int} - -Definition init_ovn_contract := - λ (ctx : T), - Result_Ok OvnContractState[f_g_pow_xis := (repeat one) 20][f_zkp_xis := (repeat 0) 20][f_commit_vis := (repeat 0) 20][f_g_pow_xi_yi_vis := (repeat one) 20][f_zkp_vis := (repeat 0) 20][f_tally := 0] - -Definition select_private_voting_key := - λ (random : int), - (rem random) q - -Definition v_ZKP := - λ (g_pow_xi : int) (xi : int), - 0 - -Type-Definition t_RegisterParam := {f_rp_i : int; f_rp_xi : int} - -Definition register_vote := - λ (ctx : T) (state : t_OvnContractState_t), - Result_Ok (accept,state)is2 - -Type-Definition t_CastVoteParam := {f_cvp_i : int; f_cvp_xi : int; f_cvp_vote : bool} - -Definition check_valid := - λ (zkp : int), - true - -Definition compute_group_element_for_vote := - λ (i : int) (xi : int) (vote : bool) (xis : int array<20>), - let prod1 := one in - let prod1 := ((fold (into_iter Range[f_start := 0][f_end := cast ((sub i) 1)])) prod1) (λ prod1 j, - (prod prod1) ((index xis) j)) in - let prod2 := one in - let prod2 := ((fold (into_iter Range[f_start := cast ((add i) 1)][f_end := n])) prod2) (λ prod2 j, - (prod prod2) ((index xis) j)) in - let Yi := (div prod1) prod2 in - (prod ((pow Yi) xi)) (g_pow ((λ true, - 1 - | false, - 0) vote)) - -Definition commit_to := - λ (x : int), - 0 - -Definition commit_to_vote := - λ (ctx : impl HasReceiveContext) (state : t_OvnContractState_t), - Result_Ok (accept,state)is2 - -Definition v_ZKP_one_out_of_two := - λ (g_pow_vi : int) (vi : bool), - 32 - -Definition cast_vote := - λ (ctx : impl HasReceiveContext) (state : t_OvnContractState_t), - Result_Ok (accept,state)is2 - -Definition check_valid2 := - λ (g_pow_xi_yi_vi : int) (zkp : int), - true - -Definition check_commitment := - λ (g_pow_xi_yi_vi : int) (zkp : int), - true - -Type-Definition t_TallyParameter := {} - -Definition tally_votes := - λ (_ : impl HasReceiveContext) (state : t_OvnContractState_t), - Result_Ok (accept,state)is2 diff --git a/ovn/proofs/ssprove/extraction/ConCertLib.v b/ovn/proofs/ssprove/extraction/ConCertLib.v deleted file mode 100644 index e590e13..0000000 --- a/ovn/proofs/ssprove/extraction/ConCertLib.v +++ /dev/null @@ -1,484 +0,0 @@ -From Crypt Require Import choice_type . -From Jasmin Require Import word. -From Coq Require Import ZArith. -Open Scope Z_scope. - -From Hacspec Require Import Hacspec_Lib_Pre. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -From ConCert.Execution Require Import Serializable. - -Program Definition serialize_by_other {A B} (f_to : B -> A) (f_from : A -> B) `(forall m, f_from (f_to m) = m) `{Serializable A} : Serializable B := - {| - serialize m := serialize (f_to m); - deserialize m := option_map f_from (deserialize m) ; - |}. -Next Obligation. - intros. hnf. rewrite deserialize_serialize. - unfold option_map. now f_equal. -Defined. - -Program Definition serialize_by_other_option {A B} (f_to : B -> Datatypes.option A) (f_from : Datatypes.option A -> Datatypes.option B) `(forall m, f_from (f_to m) = Some m) `{Serializable A} : Serializable B := - {| - serialize m := serialize (f_to m); - deserialize m := match (deserialize m) with - | Some m => f_from m - | None => None - end; - |}. -Next Obligation. - intros. hnf. simpl. rewrite deserialize_serialize. now f_equal. -Defined. - -#[global] Instance hacspec_int_serializable {ws : wsize} : Serializable (int ws) := serialize_by_other (unsigned) (@repr ws) (@wrepr_unsigned ws). - -Lemma eqtype_ord_ext : - forall n, forall x y : fintype.ordinal n, (@eqtype.eq_op - (ord.Ord.eqType - (@ord.Ord.clone _ - (ord.ordinal_ordType n) - _ - id)) x y) = (@eqtype.eq_op ssrnat.nat_eqType (fintype.nat_of_ord x) (fintype.nat_of_ord y)). -Proof. - intros. - destruct x. - simpl. - destruct y. - simpl. - reflexivity. -Qed. - -Theorem lift_set_commute : - forall {A : choice_type} {len} (a : nseq_ A (S len)) (b : fintype.ordinal (S len)) (c : A), - @lift_nseq A (S _) (fmap.setm a b c) = - fmap.setm (@lift_nseq A (S _) a) (lift_ordinal _ b) c. -Proof. - clear ; intros ; fold chElement in *. - simpl in b. - unfold lift_nseq. - apply fmap.eq_fmap. intros x ; simpl in x. - rewrite fmap.setmE. - unfold fmap.getm. - simpl fmap.FMap.fmval. - destruct a ; induction fmval ; simpl lift_fval. - - now rewrite (lift_fval_equation_2 _ (len) (b, c) nil). - - { - destruct x , b. - rewrite (eqtype_ord_ext (S (S (len)))). - simpl eqtype.eq_op. - destruct eqtype.eq_op eqn:eq_o at 2. - + apply (ssrbool.elimT eqtype.eqP) in eq_o. - subst. - destruct ord.Ord.lt. - * simpl. - rewrite (lift_fval_equation_2 _ (len)). - simpl. - rewrite (eqtype_ord_ext (S (S ( len)))). - simpl. - rewrite eqtype.eq_refl. - reflexivity. - * rewrite (eqtype_ord_ext (S (len))). - simpl. - set (eqtype.eq_op _ _). - destruct b eqn:eq_b_o ; subst b. - -- apply (ssrbool.elimT eqtype.eqP) in eq_b_o. - subst. - rewrite (lift_fval_equation_2 _ (len)). - simpl. - rewrite (eqtype_ord_ext (S (S (len)))). - simpl. - rewrite eqtype.eq_refl. - reflexivity. - -- rewrite (lift_fval_equation_2 _ (len)). - simpl. - rewrite (eqtype_ord_ext (S (S (len)))). - simpl. - destruct (fst _). - simpl in *. - rewrite ssrnat.eqSS. - rewrite eq_b_o. - - rewrite IHfmval. - rewrite (eqtype_ord_ext (S (S (len)))). - simpl. - rewrite eqtype.eq_refl. - reflexivity. - - (* apply (path_sorted_tl _). *) - { - intros. - destruct fmval. reflexivity. - - cbn. - cbn in i. - destruct (seq.unzip1 fmval). - + reflexivity. - + cbn in i. - now rewrite LocationUtility.is_true_split_and in i. - } - + destruct ord.Ord.lt. - * simpl. - rewrite (lift_fval_equation_2 _ (len)). - simpl. - rewrite (eqtype_ord_ext (S (S (len)))). - simpl. - rewrite eq_o. - reflexivity. - * rewrite (eqtype_ord_ext (S (len))). - simpl. - set (eqtype.eq_op _ _). - destruct b eqn:eq_b_o ; subst b. - -- apply (ssrbool.elimT eqtype.eqP) in eq_b_o. - subst. - rewrite (lift_fval_equation_2 _ (len)). - simpl. - rewrite (eqtype_ord_ext (S (S (len)))). - simpl. - rewrite eq_o. - rewrite (lift_fval_equation_2 _ (len)). - simpl. - rewrite (eqtype_ord_ext (S (S (len)))). - simpl. - unfold lift_ordinal. - destruct (fst _). - simpl. - simpl in eq_o. - rewrite eq_o. - reflexivity. - -- rewrite (lift_fval_equation_2 _ (len)). - simpl. - rewrite (eqtype_ord_ext (S (S (len)))). - simpl. - destruct a. - destruct s. - simpl in *. - set (b := eqtype.eq_op _ _) ; destruct b eqn:eq_m_o ; subst b. - ++ apply (ssrbool.elimT eqtype.eqP) in eq_m_o. - subst. - rewrite (lift_fval_equation_2 _ (len)). - simpl. - rewrite (eqtype_ord_ext (S (S (len)))). - simpl. - now rewrite eqtype.eq_refl. - ++ rewrite IHfmval. - rewrite (eqtype_ord_ext (S (S (len)))). - simpl. - rewrite eq_o. - rewrite (lift_fval_equation_2 _ (len)). - simpl. - rewrite (eqtype_ord_ext (S (S (len)))). - simpl. - rewrite eq_m_o. - reflexivity. - (* apply (path_sorted_tl _). *) - { - intros. - destruct fmval. reflexivity. - - cbn. - cbn in i. - destruct (seq.unzip1 fmval). - + reflexivity. - + cbn in i. - now rewrite LocationUtility.is_true_split_and in i. - } - } -Qed. - -Theorem array_from_list_helper_inverse : forall {A} len (m : nseq_ A (S len)), - array_from_option_list_helper - (nseq_hd_option m) - (array_to_option_list (nseq_tl m)) len = m. -Proof. - intros. - induction len. - - unfold nseq_tl. - unfold nseq_hd_option. - rewrite array_to_option_list_equation_1. - destruct m, fmval. - + now apply fmap.eq_fmap. - + apply fmap.eq_fmap. intros x ; simpl in x. - - unfold fmap.getm at 2 ; simpl. - destruct (fst _), m ; [ | discriminate ] ; simpl. - rewrite array_from_option_list_helper_equation_1. - unfold setm_option. - rewrite fmap.setmE. - now destruct x , m ; [ | discriminate ] ; simpl. - - rewrite array_to_option_list_equation_2. - - assert (forall (T : ord.Ord.type) (S : choice_type) - (m : @fmap.FMap.fmap_of T S - (ssreflect.Phant (ord.Ord.sort T -> S))) - (k : ord.Ord.sort T) (v : chOption S) (k' : ord.Ord.sort T), - @fmap.getm T S (setm_option m k v) k' = - match v with - | Some v => @fmap.getm T S (fmap.setm m k v) k' - | None => @fmap.getm T S m k' - end) by now destruct v. - - rewrite array_from_option_list_helper_equation_3. - rewrite (IHlen (nseq_tl m)). - - clear. - - apply fmap.eq_fmap. - intros x ; simpl in x. - destruct m ; induction fmval. - + now unfold fmap.getm ; cbn ; rewrite lift_fval_equation_1. - + { - specialize (IHfmval (path_sorted_tl i)). - unfold nseq_hd_option in *. - simpl. - destruct a. - destruct s. - unfold fmap.getm at 2. - simpl. - destruct m. - { - setoid_rewrite <- IHfmval ; clear. - - setoid_rewrite fmap.setmE. - rewrite !(eqtype_ord_ext (S (S len))). - simpl eqtype.eq_op. - replace (_ - _)%nat with O by (set (temp := nseq_tl _) ; rewrite <- (array_to_length_option_list_is_len A len temp) at 1; now rewrite Nat.sub_diag). - - destruct x , m ; [ reflexivity | ]. - rewrite tl_fmap_equation_2. - unfold setm_option. - destruct fmval ; [reflexivity | ]. - simpl. - destruct p, s. - simpl. - destruct m0 ; [ discriminate | ]. - - rewrite tl_fmap_equation_3. - - unfold fmap.getm. - simpl. - - set (@fmap.getm_def _ _). - set (lift_fval _). - set (lift_fval _). - assert (l = l0) ; [ subst l l0 | now rewrite H ]. - f_equal. - - now apply lower_fval_ext_list. - } - { - setoid_rewrite <- IHfmval ; clear. - unfold setm_option. - unfold fmap.getm. - simpl. - - rewrite tl_fmap_equation_3. - destruct (eqtype.eq_op _ _) eqn:eq_o. - - apply (ssrbool.elimT eqtype.eqP) in eq_o. - rewrite eq_o. - - subst. - simpl. - - rewrite lower_fval_equation_2. - rewrite lift_fval_equation_2. - simpl. - - rewrite !(eqtype_ord_ext (S (S len))). - simpl. - rewrite eqtype.eq_refl. - reflexivity. - - unfold setm_option. - destruct fmval. - + (* discriminate. *) - rewrite tl_fmap_equation_1. - simpl. - - rewrite lower_fval_equation_2. - rewrite lift_fval_equation_2. - simpl. - - rewrite lower_fval_equation_1. - simpl. - - rewrite !(eqtype_ord_ext (S (S len))). - simpl. - rewrite !(eqtype_ord_ext (S (S len))) in eq_o. - simpl in eq_o. - rewrite eq_o. - simpl. - reflexivity. - + destruct p , s. - destruct m0 ; [ discriminate | ]. - simpl. - - rewrite lower_fval_equation_2. - rewrite lift_fval_equation_2. - simpl. - - rewrite lower_fval_equation_2. - rewrite lift_fval_equation_2. - simpl. - - rewrite tl_fmap_equation_3. - simpl. - - rewrite lower_fval_equation_2. - rewrite lift_fval_equation_2. - simpl. - - rewrite !(eqtype_ord_ext (S (S len))). - simpl. - - rewrite (eqtype_ord_ext (S (S len))) in eq_o. - simpl in eq_o. - rewrite eq_o. - - apply (ssrbool.elimF eqtype.eqP) in eq_o. - - destruct (eqtype.eq_op _ _) eqn:eq_o2 ; [ reflexivity | ]. - - - simpl. - - set (@fmap.getm_def _ _). - set (lift_fval _). - set (lift_fval _). - assert (l = l0) ; [ subst l l0 | now rewrite H ]. - f_equal. - apply lower_fval_ext_list. - apply (path_sorted_tl (path_sorted_tl i)). - apply (path_sorted_tl (path_sorted_tl i)). - reflexivity. - } - } -Qed. - -Theorem array_from_list_to_list_unit : forall {A} len (m : nseq_ A len), - array_from_option_list' (array_to_option_list m) len = m. -Proof. - intros. - induction len. - - now destruct m. (* unit element equailty *) - - simpl. - pose (resize_to_length_idemp (array_to_option_list m)). - rewrite (array_to_length_option_list_is_len A (S len) m) in e. - rewrite <- e ; clear e. - rewrite array_to_option_list_equation_2. - specialize (IHlen (nseq_tl m)). - apply array_from_list_helper_inverse. -Qed. - -Definition defaulted_nseq {A len} (m : nseq_ A (S len)) := - forall i, match fmap.getm m i with - | Some x => x <> chCanonical A - | None => True - end. - -#[global] Instance nseq_serializable {A : choice_type} {len} `{Serializable A} : Serializable (nseq_ A len) := - serialize_by_other (array_to_option_list) (fun x => array_from_option_list' x len) (array_from_list_to_list_unit len). - -Ltac serialize_enum := intros ; autounfold ; repeat apply @product_serializable ; fold chElement. - -From ConCert.Execution Require Import Blockchain. - -#[global] Instance BaseTypes : ConCert.Execution.Blockchain.ChainBase := - {| - Address := nat; - address_eqb := Nat.eqb ; - address_eqb_spec := Nat.eqb_spec; - address_is_contract := Nat.even; - |}. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import Hacspec_Lib. - -Theorem both_ext_prog : - forall {L I A} (x y : both L I A), both_prog x = both_prog y <-> x = y. -Proof. - intros L I A [both_x valid_x eq_x] [both_y valid_y eq_y] ; simpl. - split. - - intros ; subst. - f_equal ; easy. - - easy. -Qed. - -Print pkg_core_definition.typed_raw_function. - -Instance serializable_code {L I} {A : choice_type} `{Serializable A} : Serializable (pkg_core_definition.code L I A). -Proof. -Admitted. - -Instance serializable_both {L I} {A : choice_type} `{Serializable A} : Serializable (both L I A). -Proof. - (* refine {| serialize *) - (* '{| both_prog := *) - (* {| *) - (* is_state := is_state; *) - (* is_pure := is_pure *) - (* |} ; *) - (* both_prog_valid := *) - (* {| *) - (* is_valid_code := is_valid_code ; *) - (* is_valid_both := is_valid_both *) - (* |} ; *) - (* p_eq := p_eq |} := *) - (* serialize *) - (* (is_pure, *) - (* {| *) - (* pkg_core_definition.prog := is_state; *) - (* pkg_core_definition.prog_valid := is_valid_code |}, *) - (* is_valid_both, *) - (* p_eq) ; *) - (* deserialize x := *) - (* option_map (fun y => solve_lift ret_both y) (deserialize x) *) - (* |}. *) - (* Unshelve. *) - (* 2:{ *) - (* eapply product_serializable. *) - (* Unshelve. *) - (* eapply product_serializable. *) - (* Unshelve. *) - (* simpl. *) - (* eapply product_serializable. *) - (* Unshelve. *) - (* } *) - - (* eapply (@serialize_by_other *) - (* (A * pkg_core_definition.code L I A * valid_both) *) - (* (both L I A) *) - (* (fun x => (is_pure x, {| pkg_core_definition.prog := is_state x; pkg_core_definition.prog_valid := is_valid_code (both_prog_valid x) |})) *) - (* (fun '(z , {| pkg_core_definition.prog := y ; pkg_core_definition.prog_valid := x |}) => *) - (* _ *) - (* )). *) - (* Unshelve. *) - (* 3:{ *) - (* epose {| is_pure := z ; is_state := y |}. *) - (* assert (y = is_state r) by reflexivity. *) - (* rewrite H0 in *. *) - (* eapply {| *) - (* both_prog := r ; *) - (* both_prog_valid := {| is_valid_code := x |} *) - (* |}. *) - (* } *) - - (* intros. *) - (* destruct m. *) - (* apply both_ext_prog. *) - (* simpl. *) - (* destruct both_prog. *) - (* simpl. *) - (* reflexivity. *) - (* apply product_serializable. *) - (* Unshelve. *) - - (* - apply y. *) - (* - destruct y. *) - (* simpl. *) - (* destruct prog. *) - (* simpl. *) - (* eapply both_valid_ret. *) - - (* apply both *) - -Admitted. -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. diff --git a/ovn/proofs/ssprove/extraction/Core.v b/ovn/proofs/ssprove/extraction/Core.v deleted file mode 100644 index 30f08d3..0000000 --- a/ovn/proofs/ssprove/extraction/Core.v +++ /dev/null @@ -1,39 +0,0 @@ -(* File automatically generated by Hacspec *) -From Hacspec Require Import Hacspec_Lib. - -From Coq Require Import ZArith. -Import List.ListNotations. -Open Scope Z_scope. -Open Scope bool_scope. - -Require Import Lia. -Require Import Coq.Logic.FunctionalExtensionality. -Require Import Sumbool. - -From mathcomp Require Import fintype. - -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset fmap. - -From mathcomp Require Import ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith List. -Import ListNotations. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Declare Scope hacspec_scope. - -Open Scope list_scope. -Open Scope hacspec_scope. -Open Scope nat_scope. - -(* Require Import Hacspec_Lib_Comparable. *) - -Import choice.Choice.Exports. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_lib.v b/ovn/proofs/ssprove/extraction/Hacspec_lib.v deleted file mode 100644 index f1ee22b..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_lib.v +++ /dev/null @@ -1,578 +0,0 @@ -(* File automatically generated by Hacspec *) -From Hacspec Require Import Hacspec_Lib. - -From Coq Require Import ZArith. -Import List.ListNotations. -Open Scope Z_scope. -Open Scope bool_scope. - -Require Import Lia. -Require Import Coq.Logic.FunctionalExtensionality. -Require Import Sumbool. - -From mathcomp Require Import fintype. - -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset fmap. - -From mathcomp Require Import ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith List. -Import ListNotations. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Declare Scope hacspec_scope. - -Open Scope list_scope. -Open Scope hacspec_scope. -Open Scope nat_scope. - -(* Require Import Hacspec_Lib_Comparable. *) - -Import choice.Choice.Exports. -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -(** Should be moved to Hacspec_Lib.v **) -Program Definition int_xI {WS : wsize} (a : (* both (fset []) ([interface]) *)(@int WS)) : (* both (fset []) ([interface]) *) (@int WS) := - Hacspec_Lib_Pre.int_add (Hacspec_Lib_Pre.int_mul a ((* lift_to_both (fset []) ([interface]) *) (@repr WS 2))) ((* lift_to_both (fset []) ([interface]) *) (@one WS)). -(* Next Obligation. intros ; now do 2 rewrite fsetU0. Defined. *) -(* Next Obligation. intros ; rewrite <- fset0E ; now do 2 rewrite fsetU0. Defined. *) - -Program Definition int_xO {WS : wsize} (a : int WS) : int WS := - Hacspec_Lib_Pre.int_mul a (@repr WS 2). -(* Next Obligation. intros ; now rewrite fsetU0. Defined. *) -(* Next Obligation. intros ; rewrite <- fset0E ; now rewrite fsetU0. Defined. *) - -Definition both_int_one {WS : wsize} : both (fset []) ([interface]) (@int WS) := ret_both (one). - -Open Scope hacspec_scope. -Definition int_num {WS : wsize} := int WS. -Number Notation int_num Pos.of_num_int Pos.to_num_int (via positive mapping [[int_xI] => xI, [int_xO] => xO , [one] => xH]) : hacspec_scope. - -Notation "0" := (repr _ 0%Z) : hacspec_scope. - -(* Notation U8_t := int8. *) -(* Notation U8 := id. *) -(* Notation U16_t := int16. *) -(* Notation U16 := id. *) -(* Notation U32_t := int32. *) -(* Notation U32 := id. *) -(* Notation U64_t := int64. *) -(* Notation U64 := id. *) -(* Notation U128_t := int128. *) -(* Notation U128 := id. *) - -Class Addition L1 L2 (* L3 *) I1 I2 (* I3 *) (A : choice_type) (* `(H_loc_fsubset13 : is_true (fsubset L1 L3)) `(H_opsig_fsubset13 : is_true (fsubset I1 I3)) `(H_loc_fsubset23 : is_true (fsubset L2 L3)) `(H_opsig_fsubset23 : is_true (fsubset I2 I3)) *) := - add : both L1 I1 A -> both L2 I2 A -> both (L1 :|: L2) (* L3 *) (I1 :|: I2) (* I3 *) A. -Notation "a .+ b" := (add a b). -(* Instance array_add_inst {ws : wsize} {len: uint_size} {L1 L2 I1 I2} : Addition L1 L2 I1 I2 (nseq (int ws) len) := { add a b := a array_add b }. *) -Instance int_add_inst {ws : wsize} {L1 L2 (* L3 *) I1 I2 (* I3 *)} (* `{H_loc_fsubset13 : is_true (fsubset L1 L3)} `{H_opsig_fsubset13 : is_true (fsubset I1 I3)} `{H_loc_fsubset23 : is_true (fsubset L2 L3)} `{H_opsig_fsubset23 : is_true (fsubset I2 I3)} *) : Addition L1 L2 (* L3 *) I1 I2 (* I3 *) (@int ws) (* H_loc_fsubset13 H_opsig_fsubset13 H_loc_fsubset23 H_opsig_fsubset23 *) := { add a b := int_add (* (H_loc_incl_x := H_loc_fsubset13) (H_opsig_incl_x := H_opsig_fsubset13) (H_loc_incl_y := H_loc_fsubset23) (H_opsig_incl_y := H_opsig_fsubset23) *) a b }. - -Class Subtraction L1 L2 (* L3 *) I1 I2 (* I3 *) (A : choice_type) (* `(H_loc_fsubset13 : is_true (fsubset L1 L3)) `(H_opsig_fsubset13 : is_true (fsubset I1 I3)) `(H_loc_fsubset23 : is_true (fsubset L2 L3)) `(H_opsig_fsubset23 : is_true (fsubset I2 I3)) *) := - sub : both L1 I1 A -> both L2 I2 A -> both (L1 :|: L2) (* L3 *) (I1 :|: I2) (* I3 *) A. -Notation "a .- b" := (sub a b (Subtraction := _)). -(* Instance array_sub_inst {ws : wsize} {len: uint_size} {L1 L2 I1 I2} : Subtraction L1 L2 I1 I2 (nseq (@int ws) len) := { sub a b := a array_minus b }. *) -Instance int_sub_inst {ws : wsize} {L1 L2 (* L3 *) I1 I2 (* I3 *)} (* `{H_loc_fsubset13 : is_true (fsubset L1 L3)} `{H_opsig_fsubset13 : is_true (fsubset I1 I3)} `{H_loc_fsubset23 : is_true (fsubset L2 L3)} `{H_opsig_fsubset23 : is_true (fsubset I2 I3)} *) : Subtraction L1 L2 (* L3 *) I1 I2 (* I3 *) (@int ws) (* H_loc_fsubset13 H_opsig_fsubset13 H_loc_fsubset23 H_opsig_fsubset23 *) := { sub a b := int_sub (* (H_loc_incl_x := H_loc_fsubset13) (H_opsig_incl_x := H_opsig_fsubset13) (H_loc_incl_y := H_loc_fsubset23) (H_opsig_incl_y := H_opsig_fsubset23) *) a b }. - -Class Multiplication (L1 L2 (* L3 *) : {fset Location}) (I1 I2 (* I3 *) : Interface) A (* `(H_loc_incl1 : is_true (fsubset L1 L3)) (H_opsig_incl1 : is_true (fsubset I1 I3)) (H_loc_incl2 : is_true (fsubset L2 L3)) (H_opsig_incl2 : is_true (fsubset I2 I3)) *) := mul : both L1 I1 A -> both L2 I2 A -> both (L1 :|: L2) (* L3 *) (I1 :|: I2) (* I3 *) A. -Notation "a .* b" := (mul a b). -(* Instance array_mul_inst {ws : wsize} {len: uint_size} { L1 L2 I1 I2} : Multiplication L1 L2 I1 I2 (nseq (@int ws) len) := { mul a b := a array_mul b }. *) -Program Instance int_mul_inst {ws : wsize} { L1 L2 (* L3 *) : {fset Location} } { I1 I2 (* I3 *) : Interface} (* `{H_loc_incl1 : is_true (fsubset L1 L3)} `{H_opsig_incl1 : is_true (fsubset I1 I3)} `{H_loc_incl2 : is_true (fsubset L2 L3)} `{H_opsig_incl2 : is_true (fsubset I2 I3)} *) : Multiplication L1 L2 (* L3 *) I1 I2 (* I3 *) (@int ws) (* H_loc_incl1 H_opsig_incl1 H_loc_incl2 H_opsig_incl2 *) := { mul a b := int_mul a b }. -Fail Next Obligation. - -Class Xor (L1 L2 (* L3 *) : {fset Location}) (I1 I2 (* I3 *) : Interface) A (* `(H_loc_incl1 : is_true (fsubset L1 L3)) (H_opsig_incl1 : is_true (fsubset I1 I3)) (H_loc_incl2 : is_true (fsubset L2 L3)) (H_opsig_incl2 : is_true (fsubset I2 I3)) *) := xor : both L1 I1 A -> both L2 I2 A -> both (L1 :|: L2) (* L3 *) (I1 :|: I2) (* I3 *) A. -Notation "a .^ b" := (xor a b). - -(* Instance array_xor_inst {ws : wsize} {len: uint_size} {L1 L2 I1 I2} : Xor L1 L2 I1 I2 (nseq (@int ws) len) := { xor a b := a array_xor b }. *) -Program Instance int_xor_inst {ws : wsize} {L1 L2 (* L3 *) I1 I2 (* I3 *)} (* `{H_loc_incl1 : is_true (fsubset L1 L3)} `{H_opsig_incl1 : is_true (fsubset I1 I3)} `{H_loc_incl2 : is_true (fsubset L2 L3)} `{H_opsig_incl2 : is_true (fsubset I2 I3)} *) : Xor L1 L2 (* L3 *) I1 I2 (* I3 *) (@int ws) (* H_loc_incl1 H_opsig_incl1 H_loc_incl2 H_opsig_incl2 *) := { xor a b := int_xor a b }. -Fail Next Obligation. - -(* Definition new {A : choice_type} {len} : nseq A len := array_new_ default _. *) - -(* (* Axiom conv : A -> B. *) *) -(* (* Coercion conv : A >-> B. *) *) -(* (* Check (fun x : A => x : B). *) *) - -(* Record mixin_of A := *) -(* Mixin { *) -(* as_nseq :> both A ; *) -(* as_seq :> both A ; *) -(* }. *) -(* (* Check choice_type_class_of. *) *) -(* Record class_of (A : choice_type) := { *) -(* base : choice.Choice.sort A ; *) -(* mixin : mixin_of A *) -(* }. *) -(* Structure type := Pack {sort : choice_type ; _ : class_of sort }. *) - -(* Coercion mixin : class_of >-> mixin_of. *) -(* Coercion sort : type >-> choice_type. *) - -Structure array_or_seq A L I (len : nat) := - { as_nseq :> both L I (nseq_ A len) ; - as_seq :> both L I (seq A) ; - as_list :> both L I (chList A) - }. -Print as_seq. -Print as_nseq. - -Print Graph. - -(* Check (fun x : array_or_seq 'nat 25 => x : (* both_seq *) seq 'nat). *) -(* Check (fun x : array_or_seq 'nat 25 => x : (* both_nseq *) (nseq 'nat 25)). *) - -Arguments as_seq {_} {_} {_} {_}. (* array_or_seq. *) -Arguments as_nseq {_} {_} {_} {_}. (* array_or_seq. *) -Arguments as_list {_} {_} {_} {_}. (* array_or_seq. *) -(* Coercion as_seq : array_or_seq >-> both. *) -(* Coercion as_nseq : array_or_seq >-> both. *) - - - -(* Check (fun x : array_or_seq 'nat fset0 (fset []) 25 => x : both (fset []) ([interface]) (nseq 'nat 25)). *) - -(* Definition nseq_array_or_seq {A L I len} (a : both L I (nseq A len)) := *) -(* Build_array_or_seq A L I len (array_to_seq a) a. *) -(* Canonical (* Structure *) nseq_array_or_seq. *) - -Definition array_to_list {L I A n} := lift1_both (L := L) (I := I) (fun x => (@array_to_list A n x) : chList _). - -Definition seq_to_list {L I A} := lift1_both (L := L) (I := I) (fun x => (@seq_to_list A x) : chList _). - -Definition seq_from_list {L I A} := lift1_both (L := L) (I := I) (fun (x : chList _) => seq_from_list A (x : list _)). - -Definition array_from_list' {L I A} {n : nat} := lift1_both (L := L) (I := I) (fun (x : chList A) => @array_from_list' A x n : nseq_ _ _). - -Equations nseq_array_or_seq {A L I len} (val : both L I (nseq_ A len)) : array_or_seq A L I len := - nseq_array_or_seq val := {| as_seq := array_to_seq val ; as_nseq := val ; as_list := array_to_list val |}. -Fail Next Obligation. - -Arguments nseq_array_or_seq {A} {L} {I} {len}. -Check nseq_array_or_seq. -Coercion nseq_array_or_seq : both >-> array_or_seq. -Canonical Structure nseq_array_or_seq. - -(* Check (fun (x : both (fset []) ([interface]) (nseq 'nat 25)) => x : array_or_seq 'nat fset0 (fset []) 25). *) - -(* (* TODO: use of is pure here is an issue!! *) *) -(* Definition seq_array_or_seq {A : choice_type} {L I} (a : both L I (seq A)) : array_or_seq A L I (is_pure (seq_len (* (H_loc_incl_x := fsubsetxx _) (H_opsig_incl_x := fsubsetxx _) *) a : both L I _)) := *) -(* {| as_seq := a ; as_nseq := array_from_seq _ a ; |}. *) - -(* Coercion seq_array_or_seq : both >-> array_or_seq. *) -(* Canonical Structure seq_array_or_seq. *) - -(* Definition seq_array_or_seq {A L I len} (a : both L I (seq A)) := *) -(* Build_array_or_seq A L I len a (array_from_seq (from_uint_size len) a). *) -(* Canonical (* Structure *) seq_array_or_seq. *) -(* Print Canonical Projections . *) - -Program Definition (* Equations *) array_index {A: choice_type} {len : nat} {L1 L2 I1 I2} (s: array_or_seq A L1 I1 len) {WS} (i : both L2 I2 (@int WS)) : both (L1 :|: L2) (I1 :|: I2) A := - (* array_index s i := *)Hacspec_Lib.array_index (as_nseq s) i. -Fail Next Obligation. - -(* Definition array_index {A: choice_type} {len : uint_size} {L I} (s: both L I (nseq A len)) {WS} (i : both L I (@int WS)) := array_index s i. *) - -(* Definition size : forall {L I A len} {B} (H : {B = nseq A len} + {(B = seq A)}) (x : both L I B) `{len : match H with left _ => True | right b => len = eq_rect_r (fun B0 : choice_type => both L I B0 -> uint_size) (fun x' => is_pure (seq_len x')) b x end}, uint_size. *) -(* Proof. *) -(* intros. *) -(* destruct H ; subst. *) -(* refine len. *) -(* refine (is_pure (seq_len x)). *) -(* Show Proof. *) -(* Show Proof. *) -(* Qed. *) - -(* Close Scope hacspec_scope. *) -(* Print Prelude.positive. *) -(* Definition len_of_nseq (H : choice_type) `{contra : match H with *) -(* | chUnit => True *) -(* | chMap (chFin (mkpos (S n) cond_pos) ) (A) => True *) -(* | _ => False *) -(* end} : nat. *) -(* refine *) -(* (match H as K return match K with *) -(* | chUnit => True *) -(* | chMap (chFin (mkpos (S n) cond_pos)) (A) => True *) -(* | _ => False *) -(* end -> nat with *) -(* | chUnit => fun _ => 0%nat *) -(* | chMap (chFin (mkpos pos cond_pos)) A => *) -(* match pos as n return *) -(* match n with *) -(* | O => False *) -(* | _ => True *) -(* end -> nat *) -(* with *) -(* | O => fun m_contra => False_rect nat m_contra *) -(* | S n => fun _ => S n *) -(* end *) -(* | _ => fun m_contra => False_rect nat m_contra *) -(* end contra). *) - -Definition n_seq_array_or_seq {L I A} {B} (x : both L I B) - `(contra : match B with - | chUnit => True - | chMap (chFin (@mkpos (S n) _)) (C) => C = A - | chMap 'nat (C) => C = A - | chList C => C = A - | _ => False - end) : - let len := (match B as K return - match K with - | chUnit => True - | chMap (chFin (@mkpos (S n) _)) (C) => C = A - | chMap 'nat (C) => C = A - | chList C => C = A - | _ => False - end -> nat - with - | chUnit => fun _ => 0%nat - | chMap (chFin (@mkpos p _)) C => - fun m_contra => - match p as p_ return match p_ with - | O => False - | _ => C = A - end -> nat - with - | O => fun m_contra => False_rect nat m_contra - | S n => fun _ => S n - end m_contra - | chMap 'nat C => - fun m_contra => 3%nat - | chList C => fun m_contra => 4%nat - | _ => fun m_contra => False_rect nat m_contra - end contra) in - array_or_seq A L I len. -Proof. - intros. - destruct B ; try contradiction contra. - - change 'unit with (nseq_ A len) in x. - exact {| as_seq := array_to_seq x ; as_nseq := x; as_list := array_to_list x |}. - - destruct B1 ; try contradiction contra ; simpl in *. - + subst. - change (chMap 'nat A) with (seq A) in x. - exact ({| as_seq := x ; as_nseq := array_from_seq _ x ; as_list := seq_to_list x |}). - + destruct n. - destruct pos. - * contradiction. - * subst. - replace (chMap (chFin _) A) with (nseq_ A len) in x. - 2:{ - simpl. - f_equal. - f_equal. - apply (ssrbool.elimT (positive_eqP _ _)). - unfold positive_eq. - apply eqtype.eq_refl. - } - exact {| as_seq := array_to_seq x ; as_nseq := x; as_list := array_to_list x |}. - - subst. - exact {| as_seq := seq_from_list x ; as_nseq := array_from_list' x ; as_list := x |}. -Defined. - -Notation " x '.a[' a ']'" := (array_index (n_seq_array_or_seq x _) a) (at level 40). - -Program Definition (* Equations *) array_upd {A: choice_type} {len : uint_size} {L1 L2 L3 I1 I2 I3} (s: both L1 I1 (nseq A len)) {WS} (i: both L2 I2 (@int WS)) (new_v: both L3 I3 A) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (nseq A len) := - (* array_upd s i new_v := *) Hacspec_Lib.array_upd s i new_v. -Fail Next Obligation. -Notation " x '.a[' i ']<-' a" := (array_upd x i a) (at level 40). - -Notation update_at := array_upd. - -(* Definition update {A : Type} `{Default A} {len slen} (s : nseq A len) {WS} (start : @int WS) (start_a : array_or_seq A slen) : nseq A len := *) -(* array_update (a := A) (len := len) s (unsigned start) (as_seq start_a). *) - -(* Definition to_le_U32s {A l} := array_to_le_uint32s (A := A) (l := l). *) -(* Axiom to_le_bytes : forall {ws : wsize} {len}, nseq (@int ws) len -> seq int8. *) -(* Definition from_seq {A : Type} `{Default A} {len slen} (s : array_or_seq A slen) : nseq A len := array_from_seq _ (as_seq s). *) - -Notation t_Seq := seq. -(* Notation len := (fun s => seq_len s : int32). *) - -(* Definition array_slice {a: Type} `{Default a} {len : nat} (input: nseq a len) {WS} (start: @int WS) (slice_len: @int WS) : seq a := slice (array_to_seq input) (unsigned start) (unsigned (start .+ slice_len)). *) -(* Notation slice := array_slice. *) -(* Definition seq_new {A: Type} `{Default A} {WS} (len: @int WS) : seq A := seq_new (unsigned len). *) -(* Notation new := seq_new. *) -Notation num_exact_chunks := seq_num_exact_chunks. -Notation get_exact_chunk := seq_get_exact_chunk. -(* Definition set_chunk {a: Type} `{Default a} {len} (s: seq a) {WS} (chunk_len: @int WS) (chunk_num: @int WS) (chunk: array_or_seq a len) : seq a := seq_set_chunk s (unsigned chunk_len) (unsigned chunk_num) (as_seq chunk). *) -(* Definition set_exact_chunk {a} `{H : Default a} {len} s {WS} := @set_chunk a H len s WS. *) -Notation get_remainder_chunk := seq_get_remainder_chunk. -Notation "a <> b" := (negb (eqb a b)). - -Notation from_secret_literal := nat_mod_from_secret_literal. -(* Definition pow2 {m} (x : @int wsize32) := nat_mod_pow2 m (unsigned x). *) -(* Instance nat_mod_addition {n} : Addition (nat_mod n) := { add a b := a +% b }. *) -(* Instance nat_mod_subtraction {n} : Subtraction (nat_mod n) := { sub a b := a -% b }. *) -(* Instance nat_mod_multiplication {n} : Multiplication (nat_mod n) := { mul a b := a *% b }. *) -(* Definition from_slice {a: Type} `{Default a} {len slen} (x : array_or_seq a slen) {WS} (start: @int WS) (slice_len: @int WS) := array_from_slice default len (as_seq x) (unsigned start) (unsigned slice_len). *) -Notation zero := nat_mod_zero. -Notation to_byte_seq_le := nat_mod_to_byte_seq_le. -Notation U128_to_le_bytes := u128_to_le_bytes. -Notation U64_to_le_bytes := u64_to_le_bytes. - Notation from_byte_seq_le := nat_mod_from_byte_seq_le. -Definition from_literal {m} := nat_mod_from_literal m. -Notation inv := nat_mod_inv. -Notation update_start := array_update_start. -Notation pow := nat_mod_pow_self. -Notation bit := nat_mod_bit. - -(* Definition int_to_int {ws1 ws2} (i : @int ws1) : @int ws2 := repr (unsigned i). *) -(* Coercion int_to_int : int >-> int. *) -(* Notation push := seq_push. *) -Notation Build_secret := secret. -Notation "a -× b" := -(prod a b) (at level 80, right associativity) : hacspec_scope. -Notation Result_t := result. -Axiom TODO_name : Type. -Notation ONE := nat_mod_one. -Notation exp := nat_mod_exp. -(* Notation nat_mod := GZnZ.znz. *) -(* Instance nat_mod_znz_addition {n} : Addition (GZnZ.znz n) := { add a b := a +% b }. *) -(* Instance nat_mod_znz_subtraction {n} : Subtraction (GZnZ.znz n) := { sub a b := a -% b }. *) -(* Instance nat_mod_znz_multiplication {n} : Multiplication (GZnZ.znz n) := { mul a b := a *% b }. *) -Notation TWO := nat_mod_two. -Notation ne := (fun x y => negb (eqb x y)). -Notation eq := (eqb). -Notation rotate_right := (ror). -Notation to_be_U32s := array_to_be_uint32s. -Notation get_chunk := seq_get_chunk. -Notation num_chunks := seq_num_chunks. -Notation U64_to_be_bytes := uint64_to_be_bytes. -Notation to_be_bytes := array_to_be_bytes. -Notation U8_from_usize := uint8_from_usize. -Notation concat := seq_concat. -Notation declassify := id. -Notation U128_from_be_bytes := uint128_from_be_bytes. -Notation U128_to_be_bytes := uint128_to_be_bytes. -Notation slice_range := array_slice_range. -Notation truncate := seq_truncate. -Axiom array_to_be_uint64s : forall {A l}, nseq A l -> seq uint64. -Notation to_be_U64s := array_to_be_uint64s. -Notation classify := id. -Notation U64_from_U8 := uint64_from_uint8. -(* Definition Build_Range_t (a b : nat) := (a,b). (* match (b - a)%nat with O => [] | S n => match b with | O => [] | S b' => Build_Range_t a b' ++ [b] end end. *) *) -Definition Build_t_Range {WS L1 L2 I1 I2} (a : both L1 I1 (int WS)) (b : both L2 I2 (int WS)) := (a,b). -Notation Build_Range := Build_t_Range. -Notation declassify_eq := eq. -Notation String_t := String.string. - -Notation "'i8(' v ')'" := (ret_both (v : int8) : both (fset []) ([interface]) _). -Notation "'i16(' v ')'" := (ret_both (v : int16) : both (fset []) ([interface]) _). -Notation "'i32(' v ')'" := (ret_both (v : int32) : both (fset []) ([interface]) _). -Notation "'i64(' v ')'" := (ret_both (v : int64) : both (fset []) ([interface]) _). -Notation "'i128(' v ')'" := (ret_both (v : int128) : both (fset []) ([interface]) _). - -Notation into_iter := (fun x => x). - -Definition (* vec_ *)len {L I A ws} := lift1_both (L := L) (I := I) (fun (x : chList A) => repr ws (List.length x)). - -Definition andb {L1 L2 I1 I2} (x : both L1 I1 'bool) (y : both L2 I2 'bool) : both (L1 :|: L2) (I1 :|: I2) 'bool := lift2_both (fun (x y : 'bool) => Datatypes.andb x y : 'bool) x y. -Definition negb {L1 I1} (x : both L1 I1 'bool) : both (L1) (I1) 'bool := lift1_both (fun (x : 'bool) => Datatypes.negb x : 'bool) x. -Notation "a <> b" := (negb (eqb a b)). -Notation "'not'" := (negb). -Notation "x ':of:' y" := (x : both _ _ y) (at level 100). -Notation "x ':of0:' y" := (x : both (fset []) (fset []) y) (at level 100). - -Class t_Serialize (Self : choice_type). -Class t_Deserial (Self : choice_type). -Class t_Serial (Self : choice_type). -Notation "'t_Eq'" := (EqDec). -(** end of: Should be moved to Hacspec_Lib.v **) - -Definition t_Result A B := result B A. - -(** Should be part of core.V **) - -Class t_Sized (A : choice_type) := Sized : A -> A. -Class t_TryFrom (A : choice_type) := TryFrom : A -> A. -Class t_Into (A : choice_type) := Into : A -> A. -Class t_PartialEq (A : choice_type) := PartialEq : A -> A. -Class t_Copy (A : choice_type) := Copy : A -> A. -Class t_Clone (A : choice_type) := Clone : A -> A. -Definition t_Option : choice_type -> choice_type := chOption. -Inductive vec_typ := -| t_Global. -Definition t_Vec : choice_type -> vec_typ -> choice_type := fun A _ => chList A. - -Class t_Default A := { default : A }. - -#[global] Instance bool_copy : t_Copy 'bool := {Copy x := x}. -#[global] Instance bool_clone : t_Clone 'bool := {Clone x := x}. -#[global] Instance bool_sized : t_Sized 'bool := {Sized x := x}. - -Definition ilog2 {WS} {L I} (x : both L I (int WS)) : both L I (int WS) := x. (* TODO *) - -Definition collect {A} {L I} (x : both L I (chList A)) : both L I (t_Vec A t_Global) := x. - - -Equations swap_both_list {A L I} (x : list (both L I A)) : both L I (chList A) := - swap_both_list x := - (List.fold_left (fun (x : both L I (chList A)) y => - bind_both x (fun x' => - bind_both y (fun y' => - solve_lift (ret_both ((y' :: x') : chList A))))) x (solve_lift (ret_both ([] : chList A)))). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Equations match_list {A B : choice_type} {L I} (x : both L I (chList A)) (f : list A -> B) : both L I B := - match_list x f := - bind_both x (fun x' => solve_lift (ret_both (f x'))). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Equations map {A B} {L I} (x : both L I (chList A)) (f : both L I A -> both L I B) : both L I (chList B) := - map x f := - bind_both x (fun x' => swap_both_list (List.map (fun y => f (solve_lift (ret_both y))) x')). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Definition cloned {A} {L I} (x : both L I (chList A)) : both L I (chList A) := x. - -Equations iter {A L I} (x : both L I (seq A)) : both L I (chList A) := - iter x := - bind_both x (fun x' => solve_lift (ret_both (Hacspec_Lib_Pre.seq_to_list _ x' : chList A))). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Definition dedup {A} {L I} (x : both L I (t_Vec A t_Global)) : both L I (t_Vec A t_Global) := x. - -Definition t_String := Coq.Strings.String.string. -Program Definition new {A L I} : both L I (t_Vec A t_Global) := solve_lift (ret_both ([] : chList A)). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Definition enumerate {A} {L I} (x : both L I (t_Vec A t_Global)) : both L I (t_Vec A t_Global) := x. - -Inductive ControlFlow {L I} (A : choice_type) (B : choice_type) := -| ControlFlow_Continue (val : both L I A) -| ControlFlow_Break (val : both L I B). - -Definition run {A B : choice_type} {L I} (x : ControlFlow A B) : both L I (t_Result A B) := - match x with - | ControlFlow_Continue v => Ok v - | ControlFlow_Break v => Err v - end. - -(* Program Definition build_under_impl_1 {A B} : (t_Result A B) := *) -(* run (letb layers := (match branch (build_tree_under_impl_1 partial_layers depth) with *) -(* | ControlFlow_Break residual => letb hoist1 := (v_Break (from_residual residual)) : both _ _ (t_Never) in *) -(* ControlFlow_Continue (never_to_any hoist1) *) -(* | ControlFlow_Continue val => ControlFlow_Continue val *) -(* end) in *) -(* ControlFlow_Continue (Result_Ok (Build_PartialTree layers))). *) -(* Fail Next Obligation. *) - -(** How to handle enums: **) - -(* Inductive t_ErrorKind : Type := *) -(* | ErrorKind_SerializedProofSizeIsIncorrectt_ErrorKind *) -(* | ErrorKind_NotEnoughHelperNodest_ErrorKind *) -(* | ErrorKind_HashConversionErrort_ErrorKind *) -(* | ErrorKind_NotEnoughHashesToCalculateRoott_ErrorKind *) -(* | ErrorKind_LeavesIndicesCountMismatcht_ErrorKind. *) - -Definition t_ErrorKind : choice_type := chFin (mkpos 5). -Program Definition ErrorKind_SerializedProofSizeIsIncorrect {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=0) eq_refl : t_ErrorKind)). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Program Definition ErrorKind_NotEnoughHelperNodes {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=1) eq_refl : t_ErrorKind)). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Program Definition ErrorKind_HashConversionError {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=2) eq_refl : t_ErrorKind)). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Program Definition ErrorKind_NotEnoughHashesToCalculateRoot {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=3) eq_refl : t_ErrorKind)). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Program Definition ErrorKind_LeavesIndicesCountMismatch {L I} : both L I t_ErrorKind := solve_lift (ret_both (fintype.Ordinal (n:=5) (m:=4) eq_refl : t_ErrorKind)). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -(** How to handle records: **) -(* TODO: Remove them as a phase? *) - -(* Record t_Error : Type := { *) -(* f_kind1 : t_ErrorKind *) -(* f_kind2 : t_ErrorKind *) -(* }. *) - -Definition t_Error : choice_type := t_ErrorKind × t_ErrorKind. -(* Uncurry is Build_.. fn *) -Equations Build_Error {L I} {f_kind1 : both L I t_ErrorKind} {f_kind2 : both L I t_ErrorKind} : both L I t_Error := - Build_Error (f_kind1 := x) (f_kind2 := y) := - bind_both x (fun x' => - bind_both y (fun y' => - solve_lift (ret_both ((x', y') : t_Error)))). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. -Definition f_kind1 (v : t_Error) := fst v. -Definition f_kind2 (v : t_Error) := snd v. -(* Make into tuple struct with named projctions! *) - -(*** More functions *) -Definition t_Drain : choice_type -> vec_typ -> choice_type := t_Vec. -Inductive t_Range := RangeFull. -Equations drain : forall {L I A}, both L I (t_Vec A t_Global) -> t_Range -> both L I (t_Drain A t_Global × t_Vec A t_Global) := - drain x _ := - bind_both x (fun x' => solve_lift (ret_both ((x', []) : (t_Drain A t_Global × t_Vec A t_Global)))). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. -Notation t_Rev := id. -Equations rev {L I A} (x : both L I (chList A)) : both L I (chList A) := rev x := bind_both x (fun x => solve_lift (ret_both (List.rev x : chList _))). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Definition pop {L I A} : both L I (chList A) -> both L I (chOption A × t_Vec A (t_Global)) := - lift1_both (fun (x : chList A) => (List.hd_error x , List.tl x) : (chOption A × t_Vec A (t_Global))). - -Definition push {L1 L2 I1 I2 A} : both L1 I1 (t_Vec A t_Global) -> both L2 I2 A -> both (L1 :|: L2) (I1 :|: I2) (t_Vec A (t_Global)) := - lift2_both (fun (x : chList A) y => y :: x : chList A). - -Notation Option_Some := Some. -Definition append {L1 L2 I1 I2} {A : choice_type} (l : both L1 I1 (chList A)) (x : both L2 I2 (chList A)) : both (L2 :|: L1) (I2 :|: I1) (chList A × chList A) := - lift2_both (fun (x : chList A) (y : chList A) => (app y x, []) : chList A × chList A) x l. - -Notation clone := id. -Definition seq_unzip {A B} (s : chList (A × B)) : chList A × chList B := (seq.unzip1 s, seq.unzip2 s). -Definition unzip {L I} {A B} : both L I (chList (A × B)) -> both L I (chList A × chList B) := lift1_both seq_unzip. -Equations deref {L I A} : both L I (t_Vec A t_Global) -> both L I (seq A) := - deref X := bind_both X (fun x : t_Vec A t_Global => solve_lift (ret_both (Hacspec_Lib_Pre.seq_from_list A x))). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. -Definition t_Never := False. -Notation v_Break := id. -Notation Result_Err := Err. -Definition never_to_any := tt. -Notation Result_Ok := Ok. - -Notation "'ret_both' 'tt'" := (ret_both (tt : 'unit)). - -(** Should be part of concordium.v **) -Class HasInitContext (Self : choice_type). -Class t_HasInitContext (Self : choice_type) (something : choice_type). -Class t_HasActions (Self : choice_type) := {accept : forall {L I}, both L I Self}. -Class HasReceiveContext (Self : choice_type). -Definition t_ParamType := 'unit. -Definition t_ParseError := 'unit. -(* (t_RegisterParam) *) -Class t_HasReceiveContext (Self : choice_type) (something : choice_type) := { get : forall {Ctx L I}, both L I (t_ParamType × t_Result Ctx (t_ParseError)) }. -Arguments get {Self} {something} (t_HasReceiveContext) {Ctx} {L} {I}. - -Definition parameter_cursor {T : _} `{ t_Sized (T)} `{ t_HasReceiveContext (T) ('unit)} `{ t_Sized (T)} `{ t_HasReceiveContext (T) ('unit)} {L1 : {fset Location}} {I1 : Interface} (ctx : both L1 I1 (T)) : t_HasReceiveContext (T) ('unit) := _. - - -Definition Continuation B A := (A -> B) -> B. -Definition monad_ret {B A} (x : A) : Continuation B A := fun f => f x. -Definition monad_bind {B A C} (x : Continuation B A) (f : A -> Continuation B C) : Continuation B C := (fun g : C -> B => x (fun y : A => f y g)). diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index aa1e7d4..4c46277 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -24,38 +24,6 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Class t_Group (Self : choice_type) := { - f_group_type : choice_type ; - f_group_type_t_Serialize :> t_Serialize (f_group_type) ; - f_group_type_t_Deserial :> t_Deserial (f_group_type) ; - f_group_type_t_Serial :> t_Serial (f_group_type) ; - f_group_type_t_Copy :> t_Copy (f_group_type) ; - f_group_type_t_Clone :> t_Clone (f_group_type) ; - f_group_type_t_Eq :> t_Eq (f_group_type) ; - f_group_type_t_PartialEq :> t_PartialEq (f_group_type) ; - f_group_type_t_Sized :> t_Sized (f_group_type) ; - f_q : forall {L1 I1}, both L1 I1 (int32) ; - f_g : forall {L1 I1}, both L1 I1 (f_group_type) ; - f_g_pow_loc : {fset Location} ; - f_g_pow : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_g_pow_loc) I1 (f_group_type) ; - f_pow_loc : {fset Location} ; - f_pow : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: f_pow_loc) (I1 :|: I2) (f_group_type) ; - f_one_loc : {fset Location} ; - f_one : forall {L1 I1}, both (L1 :|: f_one_loc) I1 (f_group_type) ; - f_prod_loc : {fset Location} ; - f_prod : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_prod_loc) (I1 :|: I2) (f_group_type) ; - f_inv_loc : {fset Location} ; - f_inv : forall {L1 I1}, both L1 I1 (f_group_type) -> both (L1 :|: f_inv_loc) I1 (f_group_type) ; - f_div_loc : {fset Location} ; - f_div : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_div_loc) (I1 :|: I2) (f_group_type) ; -}. -Hint Unfold f_g_pow_loc. -Hint Unfold f_pow_loc. -Hint Unfold f_one_loc. -Hint Unfold f_prod_loc. -Hint Unfold f_inv_loc. -Hint Unfold f_div_loc. - (*Not implemented yet? todo(item)*) (*Not implemented yet? todo(item)*) @@ -113,46 +81,6 @@ Equations C_vals_StrangeVal {L : {fset Location}} {I : Interface} (x : both L I solve_lift (ret_both (inr x : t_vals))) : both L I (t_vals). Fail Next Obligation. -Equations v_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi : both L1 I1 (int32)) (xi : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) (int32) := - v_ZKP g_pow_xi xi := - solve_lift (ret_both (0 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). -Fail Next Obligation. - -Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (int32)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := - v_ZKP_one_out_of_two g_pow_vi vi := - solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). -Fail Next Obligation. - -Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - check_commitment g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (int32)) : both L1 I1 ('bool) := - check_valid zkp := - solve_lift (ret_both (true : 'bool)) : both L1 I1 ('bool). -Fail Next Obligation. - -Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - check_valid2 g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) : both L1 I1 (int32) := - commit_to x := - solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). -Fail Next Obligation. - -Equations n {L : {fset Location}} {I : Interface} : both L I (uint_size) := - n := - solve_lift (ret_both (20 : uint_size)) : both L I (uint_size). -Fail Next Obligation. - -Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) : both L1 I1 (int32) := - select_private_voting_key random := - solve_lift (random .% f_q) : both L1 I1 (int32). -Fail Next Obligation. - Equations test_v {L : {fset Location}} {I : Interface} : both L I (t_vals) := test_v := C_vals_YourVal (solve_lift (ret_both (32 : int32))) : both L I (t_vals). @@ -165,74 +93,19 @@ Equations test_vals {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_v solve_lift (ret_both (0 : int32)) | C_vals_YourVal_case x => letb x := ret_both ((x) : (int32)) in - solve_lift x + solve_lift x | C_vals_YourSecondVal_case (x,y) => letb '(x,y) := ret_both ((x,y) : (int32 × int32)) in - solve_lift y - | some_name => - letb a := f_a some_name in - letb c := f_c some_name in - letb b := f_b some_name in - solve_lift c + solve_lift y + | C_vals_StrangeVal_case some_name => + letb some_name := ret_both ((some_name) : (t_vals_StrangeVal)) in + letb a := f_a some_name in + letb c := f_c some_name in + letb b := f_b some_name in + solve_lift c end : both L1 I1 (int32). Fail Next Obligation. -Definition t_CastVoteParam : choice_type := - (int32 × int32 × 'bool). -Equations f_cvp_i {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_i s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_cvp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_cvp_vote {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I ('bool) := - f_cvp_vote s := - bind_both s (fun x => - solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). -Fail Next Obligation. -Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (int32)} {f_cvp_vote : both L2 I2 ('bool)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := - Build_t_CastVoteParam := - bind_both f_cvp_vote (fun f_cvp_vote => - bind_both f_cvp_xi (fun f_cvp_xi => - bind_both f_cvp_i (fun f_cvp_i => - solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_vote) : (t_CastVoteParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). -Fail Next Obligation. -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := y)). - -Definition t_RegisterParam : choice_type := - (int32 × int32). -Equations f_rp_i {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := - f_rp_i s := - bind_both s (fun x => - solve_lift (ret_both (fst x : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_rp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := - f_rp_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). -Fail Next Obligation. -Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (int32)} : both (L0:|:L1) (I0:|:I1) (t_RegisterParam) := - Build_t_RegisterParam := - bind_both f_rp_xi (fun f_rp_xi => - bind_both f_rp_i (fun f_rp_i => - solve_lift (ret_both ((f_rp_i,f_rp_xi) : (t_RegisterParam))))) : both (L0:|:L1) (I0:|:I1) (t_RegisterParam). -Fail Next Obligation. -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y)). - -Definition t_TallyParameter : choice_type := - 'unit. -Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := - Build_t_TallyParameter := - solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). -Fail Next Obligation. - Definition t_alt_test : choice_type := (int32 × int32 × int32). Equations f_d {L : {fset Location}} {I : Interface} (s : both L I (t_alt_test)) : both L I (int32) := @@ -261,6 +134,47 @@ Notation "'Build_t_alt_test' '[' x ']' '(' 'f_d' ':=' y ')'" := (Build_t_alt_tes Notation "'Build_t_alt_test' '[' x ']' '(' 'f_e' ':=' y ')'" := (Build_t_alt_test (f_d := f_d x) (f_e := y) (f_f := f_f x)). Notation "'Build_t_alt_test' '[' x ']' '(' 'f_f' ':=' y ')'" := (Build_t_alt_test (f_d := f_d x) (f_e := f_e x) (f_f := y)). +Equations test_alt_vals {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_alt_test)) : both L1 I1 (int32) := + test_alt_vals x := + letb some_name := x in + letb d := f_d some_name in + letb f := f_f some_name in + letb e := f_e some_name in + solve_lift f : both L1 I1 (int32). +Fail Next Obligation. + +Class t_Group (Self : choice_type) := { + f_group_type : choice_type ; + f_group_type_t_Serialize :> t_Serialize (f_group_type) ; + f_group_type_t_Deserial :> t_Deserial (f_group_type) ; + f_group_type_t_Serial :> t_Serial (f_group_type) ; + f_group_type_t_Copy :> t_Copy (f_group_type) ; + f_group_type_t_Clone :> t_Clone (f_group_type) ; + f_group_type_t_Eq :> t_Eq (f_group_type) ; + f_group_type_t_PartialEq :> t_PartialEq (f_group_type) ; + f_group_type_t_Sized :> t_Sized (f_group_type) ; + q : both (fset[]) (fset[]) (int32) ; + g : both (fset[]) (fset[]) (f_group_type) ; + f_g_pow_loc : {fset Location} ; + f_g_pow : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_g_pow_loc) I1 (f_group_type) ; + f_pow_loc : {fset Location} ; + f_pow : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: f_pow_loc) (I1 :|: I2) (f_group_type) ; + f_one_loc : {fset Location} ; + f_one : forall {L1 I1}, both (L1 :|: f_one_loc) I1 (f_group_type) ; + f_prod_loc : {fset Location} ; + f_prod : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_prod_loc) (I1 :|: I2) (f_group_type) ; + f_inv_loc : {fset Location} ; + f_inv : forall {L1 I1}, both L1 I1 (f_group_type) -> both (L1 :|: f_inv_loc) I1 (f_group_type) ; + f_div_loc : {fset Location} ; + f_div : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_div_loc) (I1 :|: I2) (f_group_type) ; +}. +Hint Unfold f_g_pow_loc. +Hint Unfold f_pow_loc. +Hint Unfold f_one_loc. +Hint Unfold f_prod_loc. +Hint Unfold f_inv_loc. +Hint Unfold f_div_loc. + Definition t_z_17_ : choice_type := 'unit. Equations Build_t_z_17_ : both (fset []) (fset []) (t_z_17_) := @@ -268,31 +182,18 @@ Equations Build_t_z_17_ : both (fset []) (fset []) (t_z_17_) := solve_lift (ret_both (tt (* Empty tuple *) : (t_z_17_))) : both (fset []) (fset []) (t_z_17_). Fail Next Obligation. -Notation "'t_G'" := (t_z_17_). - -Equations test_alt_vals {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_alt_test)) : both L1 I1 (int32) := - test_alt_vals x := - matchb x with - | some_name => - letb d := f_d some_name in - letb f := f_f some_name in - letb e := f_e some_name in - solve_lift f - end : both L1 I1 (int32). -Fail Next Obligation. - Definition res_loc : Location := (int32;0%nat). #[global] Program Instance t_z_17__t_Group : t_Group t_z_17_ := let f_group_type := int32 : choice_type in - let f_q := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (17 : int32)) : both (L :|: fset []) I (int32) in - let f_g := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (3 : int32)) : both (L :|: fset []) I (int32) in - let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift ((f_g .^ x) .% f_q) : both (L1 :|: fset []) I1 (int32) in - let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((f_g .^ x) .% f_q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + let q := ret_both (17 : int32) : both (fset []) (fset []) (int32) in + let g := ret_both (3 : int32) : both (fset []) (fset []) (int32) in + let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: fset []) I1 (int32) in + let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in let f_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I (int32) in - let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% f_q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => letb res loc(res_loc) := ret_both (0 : int32) in - letb res := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (1 : int32)) (f_end := f_q))) (fun i => + letb res := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (1 : int32)) (f_end := q))) (fun i => ssp (fun res => letb ii_computation := i in solve_lift (ifb (f_g_pow i) =.? x @@ -302,10 +203,8 @@ Definition res_loc : Location := solve_lift res : both (L1 :|: fset [res_loc]) I1 (int32) in let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset [res_loc]) (I1 :|: I2) (int32) in {| f_group_type := (@f_group_type); - f_q_loc := (fset [] : {fset Location}); - f_q := (@f_q); - f_g_loc := (fset [] : {fset Location}); - f_g := (@f_g); + q := (@q); + g := (@g); f_g_pow_loc := (fset [] : {fset Location}); f_g_pow := (@f_g_pow); f_pow_loc := (fset [] : {fset Location}); @@ -317,28 +216,16 @@ Definition res_loc : Location := f_inv_loc := (fset [res_loc] : {fset Location}); f_inv := (@f_inv); f_div_loc := (fset [res_loc] : {fset Location}); - f_div := (@f_div)|}. + f_div := (@f_div)|}. +Solve All Obligations with exact int_eqdec. Fail Next Obligation. Hint Unfold t_z_17__t_Group. -Definition prod1_loc : Location := - (int32;1%nat). -Definition prod2_loc : Location := - (int32;2%nat). -Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq int32 20)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod1_loc;prod2_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32) := - compute_group_element_for_vote i xi vote xis := - letb prod1 loc(prod1_loc) := f_one in - letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun j => - ssp (fun prod1 => - solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod1_loc;prod1_loc]) (I1:|:I4:|:I1) (int32))) prod1 in - letb prod2 loc(prod2_loc) := f_one in - letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun j => - ssp (fun prod2 => - solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod2_loc;prod2_loc]) (I1:|:I4:|:I1) (int32))) prod2 in - letb v_Yi := f_div prod1 prod2 in - solve_lift (f_prod (f_pow v_Yi xi) (f_g_pow (ifb vote - then ret_both (1 : int32) - else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod1_loc;prod2_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32). +Notation "'t_G'" := (t_z_17_). + +Equations n {L : {fset Location}} {I : Interface} : both L I (uint_size) := + n := + solve_lift (ret_both (20 : uint_size)) : both L I (uint_size). Fail Next Obligation. Definition t_OvnContractState : choice_type := @@ -390,41 +277,135 @@ Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ') Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). -Definition cast_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState;3%nat). -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := - cast_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb f_branch out with +Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {impl_108907986_ : _} `{ t_Sized (impl_108907986_)} `{ t_HasInitContext (impl_108907986_) ('unit)} (_ : both L1 I1 (impl_108907986_)) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)) := + init_ovn_contract _ := + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_xis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_commit_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_g_pow_xi_yi_vis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)). +Fail Next Obligation. + +Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) : both L1 I1 (int32) := + select_private_voting_key random := + solve_lift (random .% q) : both L1 I1 (int32). +Fail Next Obligation. + +Equations v_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi : both L1 I1 (int32)) (xi : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) (int32) := + v_ZKP g_pow_xi xi := + solve_lift (ret_both (0 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). +Fail Next Obligation. + +Definition t_RegisterParam : choice_type := + (int32 × int32). +Equations f_rp_i {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := + f_rp_i s := + bind_both s (fun x => + solve_lift (ret_both (fst x : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_rp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := + f_rp_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (int32)} : both (L0:|:L1) (I0:|:I1) (t_RegisterParam) := + Build_t_RegisterParam := + bind_both f_rp_xi (fun f_rp_xi => + bind_both f_rp_i (fun f_rp_i => + solve_lift (ret_both ((f_rp_i,f_rp_xi) : (t_RegisterParam))))) : both (L0:|:L1) (I0:|:I1) (t_RegisterParam). +Fail Next Obligation. +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y)). + +Definition register_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState;1%nat). +Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := + register_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (Ctx := t_RegisterParam) (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_RegisterParam) := matchb f_branch out with | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result (t_Infallible) (t_ParseError))) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist1 := v_Break (f_from_residual residual) in - ControlFlow_Continue (solve_lift (never_to_any hoist1)) + letb residual := ret_both ((residual) : ( (t_ParseError))) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist1 := v_Break (f_from_residual residual) in + ControlFlow_Continue (solve_lift (never_to_any hoist1)) | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (t_CastVoteParam)) in - ControlFlow_Continue (solve_lift val) + letb val := ret_both ((val) : (t_RegisterParam)) in + ControlFlow_Continue (solve_lift val) end in - ControlFlow_Continue (letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in - letb zkp_vi := v_ZKP_one_out_of_two g_pow_xi_yi_vi (f_cvp_vote params) in - letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (f_accept,cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). + ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in + letb zkp_xi := v_ZKP g_pow_xi (f_rp_xi params) in + letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in + Result_Ok (prod_b (f_accept,register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. + +Definition t_CastVoteParam : choice_type := + (int32 × int32 × 'bool). +Equations f_cvp_i {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_i s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_cvp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_cvp_vote {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I ('bool) := + f_cvp_vote s := + bind_both s (fun x => + solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). +Fail Next Obligation. +Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (int32)} {f_cvp_vote : both L2 I2 ('bool)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := + Build_t_CastVoteParam := + bind_both f_cvp_vote (fun f_cvp_vote => + bind_both f_cvp_xi (fun f_cvp_xi => + bind_both f_cvp_i (fun f_cvp_i => + solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_vote) : (t_CastVoteParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). +Fail Next Obligation. +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := y)). + +Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (int32)) : both L1 I1 ('bool) := + check_valid zkp := + solve_lift (ret_both (true : 'bool)) : both L1 I1 ('bool). +Fail Next Obligation. + +Definition prod1_loc : Location := + (int32;2%nat). +Definition prod2_loc : Location := + (int32;3%nat). +Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq int32 20)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod1_loc;prod2_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32) := + compute_group_element_for_vote i xi vote xis := + letb prod1 loc(prod1_loc) := f_one in + letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun j => + ssp (fun prod1 => + solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod1_loc;prod1_loc]) (I1:|:I4:|:I1) (f_group_type))) prod1 in + letb prod2 loc(prod2_loc) := f_one in + letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun j => + ssp (fun prod2 => + solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod2_loc;prod2_loc]) (I1:|:I4:|:I1) (f_group_type))) prod2 in + letb v_Yi := f_div prod1 prod2 in + solve_lift (f_prod (f_pow v_Yi xi) (f_g_pow (ifb vote + then ret_both (1 : int32) + else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod1_loc;prod2_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32). +Fail Next Obligation. + +Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) : both L1 I1 (int32) := + commit_to x := + solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). Fail Next Obligation. Definition commit_to_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := (t_OvnContractState;4%nat). Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := commit_to_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + solve_lift (run (letb '(_,out) := f_get (Ctx := t_CastVoteParam) (f_parameter_cursor ctx) in letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb f_branch out with | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result (t_Infallible) (t_ParseError))) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist2 := v_Break (f_from_residual residual) in - ControlFlow_Continue (solve_lift (never_to_any hoist2)) + letb residual := ret_both ((residual) : ((* t_Result (t_Infallible) *) (t_ParseError))) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist2 := v_Break (f_from_residual residual) in + ControlFlow_Continue (solve_lift (never_to_any hoist2)) | ControlFlow_Continue_case val => letb val := ret_both ((val) : (t_CastVoteParam)) in - ControlFlow_Continue (solve_lift val) + ControlFlow_Continue (solve_lift val) end in ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (f_zkp_xis state)) (fun zkp => ssp (fun _ => @@ -437,31 +418,48 @@ Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Int Result_Ok (prod_b (f_accept,commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. -Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {impl_108907986_ : _} `{ t_Sized (impl_108907986_)} `{ t_HasInitContext (impl_108907986_) ('unit)} (_ : both L1 I1 (impl_108907986_)) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)) := - init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_xis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_commit_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_g_pow_xi_yi_vis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)). +Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (int32)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := + v_ZKP_one_out_of_two g_pow_vi vi := + solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). Fail Next Obligation. -Definition register_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := +Definition cast_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := (t_OvnContractState;5%nat). -Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := - register_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_RegisterParam) := matchb f_branch out with +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := + cast_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (Ctx := t_CastVoteParam) (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb f_branch out with | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result (t_Infallible) (t_ParseError))) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist3 := v_Break (f_from_residual residual) in - ControlFlow_Continue (solve_lift (never_to_any hoist3)) + letb residual := ret_both ((residual) : ((* t_Result (t_Infallible) *) (t_ParseError))) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist3 := v_Break (f_from_residual residual) in + ControlFlow_Continue (solve_lift (never_to_any hoist3)) | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (t_RegisterParam)) in - ControlFlow_Continue (solve_lift val) + letb val := ret_both ((val) : (t_CastVoteParam)) in + ControlFlow_Continue (solve_lift val) end in - ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in - letb zkp_xi := v_ZKP g_pow_xi (f_rp_xi params) in - letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in - Result_Ok (prod_b (f_accept,register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). + ControlFlow_Continue (letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in + letb zkp_vi := v_ZKP_one_out_of_two g_pow_xi_yi_vi (f_cvp_vote params) in + letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in + Result_Ok (prod_b (f_accept,cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). +Fail Next Obligation. + +Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + check_valid2 g_pow_xi_yi_vi zkp := + solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + check_commitment g_pow_xi_yi_vi zkp := + solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Definition t_TallyParameter : choice_type := + 'unit. +Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := + Build_t_TallyParameter := + solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). Fail Next Obligation. Definition tally_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := @@ -469,7 +467,7 @@ Definition tally_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Size Definition tally_votes_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := (t_OvnContractState;7%nat). Definition vote_result_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (int32;8%nat). + (f_group_type;8%nat). Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := tally_votes _ state := letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => @@ -480,7 +478,7 @@ Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interf letb vote_result loc(vote_result_loc) := f_one in letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => ssp (fun vote_result => - solve_lift (f_prod vote_result g_pow_vote) : both (*2*)(L2:|:L2:|:fset [vote_result_loc;vote_result_loc]) (I2:|:I2) (int32))) vote_result in + solve_lift (f_prod vote_result g_pow_vote) : both (*2*)(L2:|:L2:|:fset [vote_result_loc;vote_result_loc]) (I2:|:I2) (f_group_type))) vote_result in letb tally loc(tally_loc) := ret_both (0 : int32) in letb tally := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => ssp (fun tally => @@ -512,15 +510,18 @@ Export ConCertLib. Definition state_OVN : choice_type := t_OvnContractState. -#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := +Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN) (t_ParseError) := + ResultMonad.Ok st. + +#[global] Program Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit := {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. Fail Next Obligation. -#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := +#[global] Program Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam := fun x => x. Fail Next Obligation. -Definition receive_OVN_cast_vote {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - cast_vote ctx st. +Definition receive_OVN_register {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_RegisterParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + register_vote ctx st. #[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. @@ -532,18 +533,8 @@ Fail Next Obligation. Definition receive_OVN_commit_to_vote {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := commit_to_vote ctx st. -Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN) (t_ParseError) := - ResultMonad.Ok st. - -#[global] Program Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit := - {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam := - fun x => - x. -Fail Next Obligation. -Definition receive_OVN_register {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_RegisterParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - register_vote ctx st. +Definition receive_OVN_cast_vote {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + cast_vote ctx st. #[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. @@ -556,9 +547,9 @@ Definition receive_OVN_tally {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} ` tally_votes ctx st. Inductive Msg_OVN: Type := -| msg_OVN_cast_vote : t_CastVoteParam -> Msg_OVN -| msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN | msg_OVN_register : t_RegisterParam -> Msg_OVN +| msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN +| msg_OVN_cast_vote : t_CastVoteParam -> Msg_OVN | msg_OVN_tally : t_TallyParameter -> Msg_OVN. #[global] Program Instance state_OVN_t_HasReceiveContext : t_HasReceiveContext state_OVN 'unit := {| f_get := (fun (Ctx : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. @@ -567,14 +558,14 @@ Fail Next Obligation. fun x => x. Fail Next Obligation. -#[global] Program Instance state_OVN_t_HasActions : t_HasActions state_OVN := - Admitted. +#[global] (* Program *) Instance state_OVN_t_HasActions : t_HasActions state_OVN. +Admitted. Fail Next Obligation. Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := receive_OVN chain ctx st msg := match msg with - | Some (msg_OVN_cast_vote val) => - match (is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (ret_both st)))) with + | Some (msg_OVN_register val) => + match (is_pure (both_prog (receive_OVN_register (ret_both val) (ret_both st)))) with | inl x => ResultMonad.Ok ((fst x), []) | inr x => ResultMonad.Err x end @@ -583,8 +574,8 @@ Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OV | inl x => ResultMonad.Ok ((fst x), []) | inr x => ResultMonad.Err x end - | Some (msg_OVN_register val) => - match (is_pure (both_prog (receive_OVN_register (ret_both val) (ret_both st)))) with + | Some (msg_OVN_cast_vote val) => + match (is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (ret_both st)))) with | inl x => ResultMonad.Ok ((fst x), []) | inr x => ResultMonad.Err x end @@ -601,7 +592,7 @@ Fail Next Obligation. _. Fail Next Obligation. #[global] Program Instance Msg_OVN_Serializable : Serializable Msg_OVN := - Derive Serializable Msg_OVN_rect. + Derive Serializable Msg_OVN_rect. Fail Next Obligation. Definition contract_OVN : Contract (state_OVN) (Msg_OVN) (state_OVN) (t_ParseError) := build_contract init_OVN receive_OVN. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_fixes.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_fixes.v deleted file mode 100644 index 52a02f7..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_fixes.v +++ /dev/null @@ -1,501 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -Class t_Group (Self : choice_type) := { - f_group_type : choice_type ; - f_group_type_t_Serialize :> t_Serialize (f_group_type) ; - f_group_type_t_Deserial :> t_Deserial (f_group_type) ; - f_group_type_t_Serial :> t_Serial (f_group_type) ; - f_group_type_t_Copy :> t_Copy (f_group_type) ; - f_group_type_t_Clone :> t_Clone (f_group_type) ; - f_group_type_t_Eq :> t_Eq (f_group_type) ; - f_group_type_t_PartialEq :> t_PartialEq (f_group_type) ; - f_group_type_t_Sized :> t_Sized (f_group_type) ; - q : both (fset[]) (fset[]) (int32) ; - g : both (fset[]) (fset[]) (f_group_type) ; - f_g_pow_loc : {fset Location} ; - f_g_pow : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_g_pow_loc) I1 (f_group_type) ; - f_pow_loc : {fset Location} ; - f_pow : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: f_pow_loc) (I1 :|: I2) (f_group_type) ; - f_one_loc : {fset Location} ; - f_one : forall {L1 I1}, both (L1 :|: f_one_loc) I1 (f_group_type) ; - f_prod_loc : {fset Location} ; - f_prod : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_prod_loc) (I1 :|: I2) (f_group_type) ; - f_inv_loc : {fset Location} ; - f_inv : forall {L1 I1}, both L1 I1 (f_group_type) -> both (L1 :|: f_inv_loc) I1 (f_group_type) ; - f_div_loc : {fset Location} ; - f_div : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_div_loc) (I1 :|: I2) (f_group_type) ; -}. -Hint Unfold f_g_pow_loc. -Hint Unfold f_pow_loc. -Hint Unfold f_one_loc. -Hint Unfold f_prod_loc. -Hint Unfold f_inv_loc. -Hint Unfold f_div_loc. - -Definition t_z_17_ : choice_type := - 'unit. -Equations Build_t_z_17_ : both (fset []) (fset []) (t_z_17_) := - Build_t_z_17_ := - solve_lift (ret_both ((_) : (t_z_17_))) : both (fset []) (fset []) (t_z_17_). -Fail Next Obligation. - -Definition res_loc : Location := - (int32 ; 0%nat). - -Notation f_into_iter := into_iter. - -#[global] Program Instance t_z_17__t_Group : t_Group t_z_17_ := - let f_group_type := int32 : choice_type in - let q := ret_both (17 : int32) : both (fset []) (fset []) (int32) in - let g := ret_both (3 : int32) : both (fset []) (fset []) (int32) in - let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: fset []) I1 (int32) in - let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in - let f_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I (int32) in - let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in - let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => letb res loc(res_loc) := ret_both (0 : int32) in - letb res := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (1 : int32)) (f_end := q))) (fun i => - ssp (fun res => - letb ii_computation := i in - solve_lift (ifb (f_g_pow i) =.? x - then letb res := ii_computation in - res - else res) : both (*2*)(L1:|:fset [res_loc;res_loc]) (I1) (int32))) res in - solve_lift res : both (L1 :|: fset [res_loc]) I1 (int32) in - let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset [res_loc]) (I1 :|: I2) (int32) in - {| f_group_type := (@f_group_type); - q := (@q); - g := (@g); - f_g_pow_loc := (fset [] : {fset Location}); - f_g_pow := (@f_g_pow); - f_pow_loc := (fset [] : {fset Location}); - f_pow := (@f_pow); - f_one_loc := (fset [] : {fset Location}); - f_one := (@f_one); - f_prod_loc := (fset [] : {fset Location}); - f_prod := (@f_prod); - f_inv_loc := (fset [res_loc] : {fset Location}); - f_inv := (@f_inv); - f_div_loc := (fset [res_loc] : {fset Location}); - f_div := (@f_div)|}. -Solve All Obligations with exact int_eqdec. -Fail Next Obligation. -Hint Unfold t_z_17__t_Group. - -Notation "'t_G'" := (t_z_17_). - -Equations n {L : {fset Location}} {I : Interface} : both L I (uint_size) := - n := - solve_lift (ret_both (20 : uint_size)) : both L I (uint_size). -Fail Next Obligation. - -Definition t_OvnContractState : choice_type := - (nseq f_group_type 20 × nseq int32 20 × nseq int32 20 × nseq f_group_type 20 × nseq int32 20 × int32). -Equations f_g_pow_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type 20) := - f_g_pow_xis s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type 20))) : both L I (nseq f_group_type 20). -Fail Next Obligation. -Equations f_zkp_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := - f_zkp_xis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq int32 20))) : both L I (nseq int32 20). -Fail Next Obligation. -Equations f_commit_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := - f_commit_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : nseq int32 20))) : both L I (nseq int32 20). -Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type 20) := - f_g_pow_xi_yi_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type 20))) : both L I (nseq f_group_type 20). -Fail Next Obligation. -Equations f_zkp_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := - f_zkp_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : nseq int32 20))) : both L I (nseq int32 20). -Fail Next Obligation. -Equations f_tally {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (int32) := - f_tally s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). -Fail Next Obligation. -Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {f_g_pow_xis : both L0 I0 (nseq f_group_type 20)} {f_zkp_xis : both L1 I1 (nseq int32 20)} {f_commit_vis : both L2 I2 (nseq int32 20)} {f_g_pow_xi_yi_vis : both L3 I3 (nseq f_group_type 20)} {f_zkp_vis : both L4 I4 (nseq int32 20)} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := - Build_t_OvnContractState := - bind_both f_tally (fun f_tally => - bind_both f_zkp_vis (fun f_zkp_vis => - bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => - bind_both f_commit_vis (fun f_commit_vis => - bind_both f_zkp_xis (fun f_zkp_xis => - bind_both f_g_pow_xis (fun f_g_pow_xis => - solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). -Fail Next Obligation. -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). - -Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {impl_108907986_ : _} `{ t_Sized (impl_108907986_)} `{ t_HasInitContext (impl_108907986_) ('unit)} (_ : both L1 I1 (impl_108907986_)) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)) := - init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_xis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_commit_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_g_pow_xi_yi_vis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)). -Fail Next Obligation. - -Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) : both L1 I1 (int32) := - select_private_voting_key random := - solve_lift (random .% q) : both L1 I1 (int32). -Fail Next Obligation. - -Equations v_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi : both L1 I1 (int32)) (xi : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) (int32) := - v_ZKP g_pow_xi xi := - solve_lift (ret_both (0 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). -Fail Next Obligation. - -Definition t_RegisterParam : choice_type := - (int32 × int32). -Equations f_rp_i {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := - f_rp_i s := - bind_both s (fun x => - solve_lift (ret_both (fst x : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_rp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := - f_rp_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). -Fail Next Obligation. -Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (int32)} : both (L0:|:L1) (I0:|:I1) (t_RegisterParam) := - Build_t_RegisterParam := - bind_both f_rp_xi (fun f_rp_xi => - bind_both f_rp_i (fun f_rp_i => - solve_lift (ret_both ((f_rp_i,f_rp_xi) : (t_RegisterParam))))) : both (L0:|:L1) (I0:|:I1) (t_RegisterParam). -Fail Next Obligation. -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y)). - -Definition register_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState ; 1%nat). - -(* Notation f_branch := branch. *) -Notation f_get := get. -Notation f_parameter_cursor := parameter_cursor. -Notation f_from_residual := from_residual. -Notation f_clone := clone. -Notation f_accept := accept. - -Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := - register_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_RegisterParam) := matchb branch out with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist1 := v_Break (f_from_residual residual) in - ControlFlow_Continue (never_to_any hoist1) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in - letb zkp_xi := v_ZKP g_pow_xi (f_rp_xi params) in - letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in - Result_Ok (prod_b (f_accept,register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. - -Definition t_CastVoteParam : choice_type := - (int32 × int32 × 'bool). -Equations f_cvp_i {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_i s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_cvp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_cvp_vote {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I ('bool) := - f_cvp_vote s := - bind_both s (fun x => - solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). -Fail Next Obligation. -Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (int32)} {f_cvp_vote : both L2 I2 ('bool)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := - Build_t_CastVoteParam := - bind_both f_cvp_vote (fun f_cvp_vote => - bind_both f_cvp_xi (fun f_cvp_xi => - bind_both f_cvp_i (fun f_cvp_i => - solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_vote) : (t_CastVoteParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). -Fail Next Obligation. -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := y)). - -Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (int32)) : both L1 I1 ('bool) := - check_valid zkp := - solve_lift (ret_both (true : 'bool)) : both L1 I1 ('bool). -Fail Next Obligation. - -Definition prod1_loc : Location := - (int32 ; 2%nat). -Definition prod2_loc : Location := - (int32 ; 3%nat). -Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq int32 20)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [res_loc;prod1_loc;prod2_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32) := - compute_group_element_for_vote i xi vote xis := - letb prod1 loc(prod1_loc) := f_one in - letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun j => - ssp (fun prod1 => - solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod1_loc;prod1_loc]) (I1:|:I4:|:I1) (f_group_type))) prod1 in - letb prod2 loc(prod2_loc) := f_one in - letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun j => - ssp (fun prod2 => - solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod2_loc;prod2_loc]) (I1:|:I4:|:I1) (f_group_type))) prod2 in - letb v_Yi := f_div prod1 prod2 in - solve_lift (f_prod (f_pow v_Yi xi) (f_g_pow (ifb vote - then ret_both (1 : int32) - else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [res_loc;prod1_loc;prod2_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32). -Fail Next Obligation. - -Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) : both L1 I1 (int32) := - commit_to x := - solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). -Fail Next Obligation. - -Definition commit_to_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState ; 4%nat). -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [res_loc;commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := - commit_to_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb branch out with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist2 := v_Break (f_from_residual residual) in - ControlFlow_Continue (never_to_any hoist2) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (f_zkp_xis state)) (fun zkp => - ssp (fun _ => - letb _ := check_valid zkp in - solve_lift (ret_both (tt : 'unit)) : both (*0*)(L2:|:fset []) (I2) ('unit))) (ret_both (tt : 'unit)) in - letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in - letb commit_vi := commit_to g_pow_xi_yi_vi in - letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in - letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept,commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [res_loc;commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. - -Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (int32)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := - v_ZKP_one_out_of_two g_pow_vi vi := - solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). -Fail Next Obligation. - -Definition cast_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState ; 5%nat). -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [res_loc;cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := - cast_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb branch out with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist3 := v_Break (f_from_residual residual) in - ControlFlow_Continue (never_to_any hoist3) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in - letb zkp_vi := v_ZKP_one_out_of_two g_pow_xi_yi_vi (f_cvp_vote params) in - letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (f_accept,cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [res_loc;cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. - -Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - check_valid2 g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - check_commitment g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Definition t_TallyParameter : choice_type := - 'unit. -Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := - Build_t_TallyParameter := - solve_lift (ret_both ((_) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). -Fail Next Obligation. - -Definition tally_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (int32 ; 6%nat). -Definition tally_votes_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState ; 7%nat). -Definition vote_result_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (f_group_type ; 8%nat). -Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := - tally_votes _ state := - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => - ssp (fun _ => - letb _ := check_valid2 ((f_g_pow_xi_yi_vis state).a[i]) ((f_zkp_vis state).a[i]) in - letb _ := check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i]) in - solve_lift (ret_both (tt : 'unit)) : both (*0*)(L2:|:fset []) (I2) ('unit))) (ret_both (tt : 'unit)) in - letb vote_result loc(vote_result_loc) := f_one in - letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => - ssp (fun vote_result => - solve_lift (f_prod vote_result g_pow_vote) : both (*2*)(L2:|:L2:|:fset [vote_result_loc;vote_result_loc]) (I2:|:I2) (f_group_type))) vote_result in - letb tally loc(tally_loc) := ret_both (0 : int32) in - letb tally := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => - ssp (fun tally => - solve_lift (ifb (f_g_pow i) =.? vote_result - then letb tally := i in - tally - else tally) : both (*3*)(L2 :|: fset [tally_loc;vote_result_loc;tally_loc]) (I2 :|: (fset [])) (int32))) tally in - letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in - letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in - Result_Ok (solve_lift (prod_b (f_accept,tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. - -(** Concert lib part **) -From ConCert.Utils Require Import Extras. -Export Extras. -From ConCert.Utils Require Import Automation. -Export Automation. -From ConCert.Execution Require Import Serializable. -Export Serializable. -From ConCert.Execution Require Import Blockchain. -Export Blockchain. -From ConCert.Execution Require Import ContractCommon. -Export ContractCommon. -From ConCert.Execution Require Import Serializable. -Export Serializable. -Require Import ConCertLib. -Export ConCertLib. - -Definition state_OVN : choice_type := - t_OvnContractState. - -Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN) (t_ParseError) := - ResultMonad.Ok st. - -#[global] Program Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit := - { get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)}. -Fail Next Obligation. -#[global] Program Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam := { Sized := (fun x => x) }. -Fail Next Obligation. -Definition receive_OVN_register {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_RegisterParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - register_vote ctx st. - -#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := - {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := - { Sized := (fun (x : _) => x : _)}. -Fail Next Obligation. -Definition receive_OVN_commit_to_vote {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - commit_to_vote ctx st. - -(* #[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := *) -(* {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. *) -(* Fail Next Obligation. *) -(* #[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := *) -(* { Sized := (fun (x : _) => x : _)}. *) -(* Fail Next Obligation. *) -Definition receive_OVN_cast_vote {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - cast_vote ctx st. - -#[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := - {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_TallyParameter_t_Sized : t_Sized t_TallyParameter := - { Sized := (fun (x : _) => x : _)}. -Fail Next Obligation. -Definition receive_OVN_tally {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_TallyParameter)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - tally_votes ctx st. - -Inductive Msg_OVN: Type := -| msg_OVN_register : t_RegisterParam -> Msg_OVN -| msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN -| msg_OVN_cast_vote : t_CastVoteParam -> Msg_OVN -| msg_OVN_tally : t_TallyParameter -> Msg_OVN. -#[global] Program Instance state_OVN_t_HasReceiveContext : t_HasReceiveContext state_OVN 'unit := - {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance state_OVN_t_Sized : t_Sized state_OVN := - { Sized := (fun (x : _) => x : _)}. -Fail Next Obligation. -#[global] Program Instance state_OVN_t_HasActions : t_HasActions state_OVN := - _. -Next Obligation. - constructor. - intros. - refine (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_xis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_commit_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_g_pow_xi_yi_vis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_tally := ret_both (0 : int32))) : both L I state_OVN). - Unshelve. - 3: apply I. - 3: apply L. - 3: apply I. - 3: apply L. - all: solve_ssprove_obligations. -Defined. - -Fail Next Obligation. -Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := - receive_OVN chain ctx st msg := - match msg with - | Some (msg_OVN_register val) => - match (is_pure (both_prog (receive_OVN_register (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_OVN_commit_to_vote val) => - match (is_pure (both_prog (receive_OVN_commit_to_vote (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_OVN_cast_vote val) => - match (is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_OVN_tally val) => - match (is_pure (both_prog (receive_OVN_tally (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | _ => - ResultMonad.Err tt - end : ResultMonad.result (state_OVN * list ActionBody) t_ParseError. -Fail Next Obligation. -#[global] Program Instance state_OVN_Serializable : Serializable state_OVN := - _. -Fail Next Obligation. -#[global] Program Instance Msg_OVN_Serializable : Serializable Msg_OVN := - Derive Serializable Msg_OVN_rect< msg_OVN_register, msg_OVN_commit_to_vote, msg_OVN_cast_vote, msg_OVN_tally >. -Fail Next Obligation. -Definition contract_OVN : Contract (state_OVN) (Msg_OVN) (state_OVN) (t_ParseError) := - build_contract init_OVN receive_OVN. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_working.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_working.v deleted file mode 100644 index 4c46277..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_working.v +++ /dev/null @@ -1,598 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -Definition t_vals_StrangeVal : choice_type := - (int32 × int32 × int32). -Equations f_a {L : {fset Location}} {I : Interface} (s : both L I (t_vals_StrangeVal)) : both L I (int32) := - f_a s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_b {L : {fset Location}} {I : Interface} (s : both L I (t_vals_StrangeVal)) : both L I (int32) := - f_b s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_c {L : {fset Location}} {I : Interface} (s : both L I (t_vals_StrangeVal)) : both L I (int32) := - f_c s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). -Fail Next Obligation. -Equations Build_t_vals_StrangeVal {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_a : both L0 I0 (int32)} {f_b : both L1 I1 (int32)} {f_c : both L2 I2 (int32)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_vals_StrangeVal) := - Build_t_vals_StrangeVal := - bind_both f_c (fun f_c => - bind_both f_b (fun f_b => - bind_both f_a (fun f_a => - solve_lift (ret_both ((f_a,f_b,f_c) : (t_vals_StrangeVal)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_vals_StrangeVal). -Fail Next Obligation. -Notation "'Build_t_vals_StrangeVal' '[' x ']' '(' 'f_a' ':=' y ')'" := (Build_t_vals_StrangeVal (f_a := y) (f_b := f_b x) (f_c := f_c x)). -Notation "'Build_t_vals_StrangeVal' '[' x ']' '(' 'f_b' ':=' y ')'" := (Build_t_vals_StrangeVal (f_a := f_a x) (f_b := y) (f_c := f_c x)). -Notation "'Build_t_vals_StrangeVal' '[' x ']' '(' 'f_c' ':=' y ')'" := (Build_t_vals_StrangeVal (f_a := f_a x) (f_b := f_b x) (f_c := y)). -Definition t_vals : choice_type := - ('unit ∐ int32 ∐ (int32 × int32) ∐ t_vals_StrangeVal). -Notation "'C_vals_MyVal_case'" := (inl (inl (inl tt))) (at level 100). -Equations C_vals_MyVal {L : {fset Location}} {I : Interface} : both L I (t_vals) := - C_vals_MyVal := - solve_lift (ret_both (inl (inl (inl (tt : 'unit))) : t_vals)) : both L I (t_vals). -Fail Next Obligation. -Notation "'C_vals_YourVal_case' x" := (inl (inl (inr x))) (at level 100). -Equations C_vals_YourVal {L : {fset Location}} {I : Interface} (x : both L I (int32)) : both L I (t_vals) := - C_vals_YourVal x := - bind_both x (fun x => - solve_lift (ret_both (inl (inl (inr x)) : t_vals))) : both L I (t_vals). -Fail Next Obligation. -Notation "'C_vals_YourSecondVal_case' x" := (inl (inr x)) (at level 100). -Equations C_vals_YourSecondVal {L : {fset Location}} {I : Interface} (x : both L I ((int32 × int32))) : both L I (t_vals) := - C_vals_YourSecondVal x := - bind_both x (fun x => - solve_lift (ret_both (inl (inr x) : t_vals))) : both L I (t_vals). -Fail Next Obligation. -Notation "'C_vals_StrangeVal_case' x" := (inr x) (at level 100). -Equations C_vals_StrangeVal {L : {fset Location}} {I : Interface} (x : both L I (t_vals_StrangeVal)) : both L I (t_vals) := - C_vals_StrangeVal x := - bind_both x (fun x => - solve_lift (ret_both (inr x : t_vals))) : both L I (t_vals). -Fail Next Obligation. - -Equations test_v {L : {fset Location}} {I : Interface} : both L I (t_vals) := - test_v := - C_vals_YourVal (solve_lift (ret_both (32 : int32))) : both L I (t_vals). -Fail Next Obligation. - -Equations test_vals {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_vals)) : both L1 I1 (int32) := - test_vals x := - matchb x with - | C_vals_MyVal_case => - solve_lift (ret_both (0 : int32)) - | C_vals_YourVal_case x => - letb x := ret_both ((x) : (int32)) in - solve_lift x - | C_vals_YourSecondVal_case (x,y) => - letb '(x,y) := ret_both ((x,y) : (int32 × int32)) in - solve_lift y - | C_vals_StrangeVal_case some_name => - letb some_name := ret_both ((some_name) : (t_vals_StrangeVal)) in - letb a := f_a some_name in - letb c := f_c some_name in - letb b := f_b some_name in - solve_lift c - end : both L1 I1 (int32). -Fail Next Obligation. - -Definition t_alt_test : choice_type := - (int32 × int32 × int32). -Equations f_d {L : {fset Location}} {I : Interface} (s : both L I (t_alt_test)) : both L I (int32) := - f_d s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_e {L : {fset Location}} {I : Interface} (s : both L I (t_alt_test)) : both L I (int32) := - f_e s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_f {L : {fset Location}} {I : Interface} (s : both L I (t_alt_test)) : both L I (int32) := - f_f s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). -Fail Next Obligation. -Equations Build_t_alt_test {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_d : both L0 I0 (int32)} {f_e : both L1 I1 (int32)} {f_f : both L2 I2 (int32)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_alt_test) := - Build_t_alt_test := - bind_both f_f (fun f_f => - bind_both f_e (fun f_e => - bind_both f_d (fun f_d => - solve_lift (ret_both ((f_d,f_e,f_f) : (t_alt_test)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_alt_test). -Fail Next Obligation. -Notation "'Build_t_alt_test' '[' x ']' '(' 'f_d' ':=' y ')'" := (Build_t_alt_test (f_d := y) (f_e := f_e x) (f_f := f_f x)). -Notation "'Build_t_alt_test' '[' x ']' '(' 'f_e' ':=' y ')'" := (Build_t_alt_test (f_d := f_d x) (f_e := y) (f_f := f_f x)). -Notation "'Build_t_alt_test' '[' x ']' '(' 'f_f' ':=' y ')'" := (Build_t_alt_test (f_d := f_d x) (f_e := f_e x) (f_f := y)). - -Equations test_alt_vals {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_alt_test)) : both L1 I1 (int32) := - test_alt_vals x := - letb some_name := x in - letb d := f_d some_name in - letb f := f_f some_name in - letb e := f_e some_name in - solve_lift f : both L1 I1 (int32). -Fail Next Obligation. - -Class t_Group (Self : choice_type) := { - f_group_type : choice_type ; - f_group_type_t_Serialize :> t_Serialize (f_group_type) ; - f_group_type_t_Deserial :> t_Deserial (f_group_type) ; - f_group_type_t_Serial :> t_Serial (f_group_type) ; - f_group_type_t_Copy :> t_Copy (f_group_type) ; - f_group_type_t_Clone :> t_Clone (f_group_type) ; - f_group_type_t_Eq :> t_Eq (f_group_type) ; - f_group_type_t_PartialEq :> t_PartialEq (f_group_type) ; - f_group_type_t_Sized :> t_Sized (f_group_type) ; - q : both (fset[]) (fset[]) (int32) ; - g : both (fset[]) (fset[]) (f_group_type) ; - f_g_pow_loc : {fset Location} ; - f_g_pow : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_g_pow_loc) I1 (f_group_type) ; - f_pow_loc : {fset Location} ; - f_pow : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: f_pow_loc) (I1 :|: I2) (f_group_type) ; - f_one_loc : {fset Location} ; - f_one : forall {L1 I1}, both (L1 :|: f_one_loc) I1 (f_group_type) ; - f_prod_loc : {fset Location} ; - f_prod : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_prod_loc) (I1 :|: I2) (f_group_type) ; - f_inv_loc : {fset Location} ; - f_inv : forall {L1 I1}, both L1 I1 (f_group_type) -> both (L1 :|: f_inv_loc) I1 (f_group_type) ; - f_div_loc : {fset Location} ; - f_div : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_div_loc) (I1 :|: I2) (f_group_type) ; -}. -Hint Unfold f_g_pow_loc. -Hint Unfold f_pow_loc. -Hint Unfold f_one_loc. -Hint Unfold f_prod_loc. -Hint Unfold f_inv_loc. -Hint Unfold f_div_loc. - -Definition t_z_17_ : choice_type := - 'unit. -Equations Build_t_z_17_ : both (fset []) (fset []) (t_z_17_) := - Build_t_z_17_ := - solve_lift (ret_both (tt (* Empty tuple *) : (t_z_17_))) : both (fset []) (fset []) (t_z_17_). -Fail Next Obligation. - -Definition res_loc : Location := - (int32;0%nat). -#[global] Program Instance t_z_17__t_Group : t_Group t_z_17_ := - let f_group_type := int32 : choice_type in - let q := ret_both (17 : int32) : both (fset []) (fset []) (int32) in - let g := ret_both (3 : int32) : both (fset []) (fset []) (int32) in - let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: fset []) I1 (int32) in - let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in - let f_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I (int32) in - let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in - let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => letb res loc(res_loc) := ret_both (0 : int32) in - letb res := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (1 : int32)) (f_end := q))) (fun i => - ssp (fun res => - letb ii_computation := i in - solve_lift (ifb (f_g_pow i) =.? x - then letb res := ii_computation in - res - else res) : both (*2*)(L1:|:fset [res_loc;res_loc]) (I1) (int32))) res in - solve_lift res : both (L1 :|: fset [res_loc]) I1 (int32) in - let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset [res_loc]) (I1 :|: I2) (int32) in - {| f_group_type := (@f_group_type); - q := (@q); - g := (@g); - f_g_pow_loc := (fset [] : {fset Location}); - f_g_pow := (@f_g_pow); - f_pow_loc := (fset [] : {fset Location}); - f_pow := (@f_pow); - f_one_loc := (fset [] : {fset Location}); - f_one := (@f_one); - f_prod_loc := (fset [] : {fset Location}); - f_prod := (@f_prod); - f_inv_loc := (fset [res_loc] : {fset Location}); - f_inv := (@f_inv); - f_div_loc := (fset [res_loc] : {fset Location}); - f_div := (@f_div)|}. -Solve All Obligations with exact int_eqdec. -Fail Next Obligation. -Hint Unfold t_z_17__t_Group. - -Notation "'t_G'" := (t_z_17_). - -Equations n {L : {fset Location}} {I : Interface} : both L I (uint_size) := - n := - solve_lift (ret_both (20 : uint_size)) : both L I (uint_size). -Fail Next Obligation. - -Definition t_OvnContractState : choice_type := - (nseq f_group_type 20 × nseq int32 20 × nseq int32 20 × nseq f_group_type 20 × nseq int32 20 × int32). -Equations f_g_pow_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type 20) := - f_g_pow_xis s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type 20))) : both L I (nseq f_group_type 20). -Fail Next Obligation. -Equations f_zkp_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := - f_zkp_xis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq int32 20))) : both L I (nseq int32 20). -Fail Next Obligation. -Equations f_commit_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := - f_commit_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : nseq int32 20))) : both L I (nseq int32 20). -Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type 20) := - f_g_pow_xi_yi_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type 20))) : both L I (nseq f_group_type 20). -Fail Next Obligation. -Equations f_zkp_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := - f_zkp_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : nseq int32 20))) : both L I (nseq int32 20). -Fail Next Obligation. -Equations f_tally {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (int32) := - f_tally s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). -Fail Next Obligation. -Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {f_g_pow_xis : both L0 I0 (nseq f_group_type 20)} {f_zkp_xis : both L1 I1 (nseq int32 20)} {f_commit_vis : both L2 I2 (nseq int32 20)} {f_g_pow_xi_yi_vis : both L3 I3 (nseq f_group_type 20)} {f_zkp_vis : both L4 I4 (nseq int32 20)} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := - Build_t_OvnContractState := - bind_both f_tally (fun f_tally => - bind_both f_zkp_vis (fun f_zkp_vis => - bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => - bind_both f_commit_vis (fun f_commit_vis => - bind_both f_zkp_xis (fun f_zkp_xis => - bind_both f_g_pow_xis (fun f_g_pow_xis => - solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). -Fail Next Obligation. -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). - -Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {impl_108907986_ : _} `{ t_Sized (impl_108907986_)} `{ t_HasInitContext (impl_108907986_) ('unit)} (_ : both L1 I1 (impl_108907986_)) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)) := - init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_xis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_commit_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_g_pow_xi_yi_vis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)). -Fail Next Obligation. - -Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) : both L1 I1 (int32) := - select_private_voting_key random := - solve_lift (random .% q) : both L1 I1 (int32). -Fail Next Obligation. - -Equations v_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi : both L1 I1 (int32)) (xi : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) (int32) := - v_ZKP g_pow_xi xi := - solve_lift (ret_both (0 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). -Fail Next Obligation. - -Definition t_RegisterParam : choice_type := - (int32 × int32). -Equations f_rp_i {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := - f_rp_i s := - bind_both s (fun x => - solve_lift (ret_both (fst x : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_rp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := - f_rp_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). -Fail Next Obligation. -Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (int32)} : both (L0:|:L1) (I0:|:I1) (t_RegisterParam) := - Build_t_RegisterParam := - bind_both f_rp_xi (fun f_rp_xi => - bind_both f_rp_i (fun f_rp_i => - solve_lift (ret_both ((f_rp_i,f_rp_xi) : (t_RegisterParam))))) : both (L0:|:L1) (I0:|:I1) (t_RegisterParam). -Fail Next Obligation. -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y)). - -Definition register_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState;1%nat). -Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := - register_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (Ctx := t_RegisterParam) (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_RegisterParam) := matchb f_branch out with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : ( (t_ParseError))) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist1 := v_Break (f_from_residual residual) in - ControlFlow_Continue (solve_lift (never_to_any hoist1)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (t_RegisterParam)) in - ControlFlow_Continue (solve_lift val) - end in - ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in - letb zkp_xi := v_ZKP g_pow_xi (f_rp_xi params) in - letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in - Result_Ok (prod_b (f_accept,register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. - -Definition t_CastVoteParam : choice_type := - (int32 × int32 × 'bool). -Equations f_cvp_i {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_i s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_cvp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_cvp_vote {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I ('bool) := - f_cvp_vote s := - bind_both s (fun x => - solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). -Fail Next Obligation. -Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (int32)} {f_cvp_vote : both L2 I2 ('bool)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := - Build_t_CastVoteParam := - bind_both f_cvp_vote (fun f_cvp_vote => - bind_both f_cvp_xi (fun f_cvp_xi => - bind_both f_cvp_i (fun f_cvp_i => - solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_vote) : (t_CastVoteParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). -Fail Next Obligation. -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := y)). - -Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (int32)) : both L1 I1 ('bool) := - check_valid zkp := - solve_lift (ret_both (true : 'bool)) : both L1 I1 ('bool). -Fail Next Obligation. - -Definition prod1_loc : Location := - (int32;2%nat). -Definition prod2_loc : Location := - (int32;3%nat). -Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq int32 20)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod1_loc;prod2_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32) := - compute_group_element_for_vote i xi vote xis := - letb prod1 loc(prod1_loc) := f_one in - letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun j => - ssp (fun prod1 => - solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod1_loc;prod1_loc]) (I1:|:I4:|:I1) (f_group_type))) prod1 in - letb prod2 loc(prod2_loc) := f_one in - letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun j => - ssp (fun prod2 => - solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod2_loc;prod2_loc]) (I1:|:I4:|:I1) (f_group_type))) prod2 in - letb v_Yi := f_div prod1 prod2 in - solve_lift (f_prod (f_pow v_Yi xi) (f_g_pow (ifb vote - then ret_both (1 : int32) - else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod1_loc;prod2_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32). -Fail Next Obligation. - -Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) : both L1 I1 (int32) := - commit_to x := - solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). -Fail Next Obligation. - -Definition commit_to_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState;4%nat). -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := - commit_to_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (Ctx := t_CastVoteParam) (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb f_branch out with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : ((* t_Result (t_Infallible) *) (t_ParseError))) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist2 := v_Break (f_from_residual residual) in - ControlFlow_Continue (solve_lift (never_to_any hoist2)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (t_CastVoteParam)) in - ControlFlow_Continue (solve_lift val) - end in - ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (f_zkp_xis state)) (fun zkp => - ssp (fun _ => - letb _ := check_valid zkp in - solve_lift (ret_both (tt : 'unit)) : both (*0*)(L2:|:fset []) (I2) ('unit))) (ret_both (tt : 'unit)) in - letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in - letb commit_vi := commit_to g_pow_xi_yi_vi in - letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in - letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept,commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. - -Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (int32)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := - v_ZKP_one_out_of_two g_pow_vi vi := - solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). -Fail Next Obligation. - -Definition cast_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState;5%nat). -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := - cast_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (Ctx := t_CastVoteParam) (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb f_branch out with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : ((* t_Result (t_Infallible) *) (t_ParseError))) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist3 := v_Break (f_from_residual residual) in - ControlFlow_Continue (solve_lift (never_to_any hoist3)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (t_CastVoteParam)) in - ControlFlow_Continue (solve_lift val) - end in - ControlFlow_Continue (letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in - letb zkp_vi := v_ZKP_one_out_of_two g_pow_xi_yi_vi (f_cvp_vote params) in - letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (f_accept,cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. - -Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - check_valid2 g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - check_commitment g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Definition t_TallyParameter : choice_type := - 'unit. -Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := - Build_t_TallyParameter := - solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). -Fail Next Obligation. - -Definition tally_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (int32;6%nat). -Definition tally_votes_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState;7%nat). -Definition vote_result_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (f_group_type;8%nat). -Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := - tally_votes _ state := - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => - ssp (fun _ => - letb _ := check_valid2 ((f_g_pow_xi_yi_vis state).a[i]) ((f_zkp_vis state).a[i]) in - letb _ := check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i]) in - solve_lift (ret_both (tt : 'unit)) : both (*0*)(L2:|:fset []) (I2) ('unit))) (ret_both (tt : 'unit)) in - letb vote_result loc(vote_result_loc) := f_one in - letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => - ssp (fun vote_result => - solve_lift (f_prod vote_result g_pow_vote) : both (*2*)(L2:|:L2:|:fset [vote_result_loc;vote_result_loc]) (I2:|:I2) (f_group_type))) vote_result in - letb tally loc(tally_loc) := ret_both (0 : int32) in - letb tally := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => - ssp (fun tally => - solve_lift (ifb (f_g_pow i) =.? vote_result - then letb tally := i in - tally - else tally) : both (*3*)(L2:|:fset [tally_loc;vote_result_loc;tally_loc]) (I2) (int32))) tally in - letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in - letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in - Result_Ok (solve_lift (prod_b (f_accept,tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. - -(** Concert lib part **) -From ConCert.Utils Require Import Extras. -Export Extras. -From ConCert.Utils Require Import Automation. -Export Automation. -From ConCert.Execution Require Import Serializable. -Export Serializable. -From ConCert.Execution Require Import Blockchain. -Export Blockchain. -From ConCert.Execution Require Import ContractCommon. -Export ContractCommon. -From ConCert.Execution Require Import Serializable. -Export Serializable. -Require Import ConCertLib. -Export ConCertLib. - -Definition state_OVN : choice_type := - t_OvnContractState. - -Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN) (t_ParseError) := - ResultMonad.Ok st. - -#[global] Program Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit := - {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam := - fun x => - x. -Fail Next Obligation. -Definition receive_OVN_register {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_RegisterParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - register_vote ctx st. - -#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := - {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := - fun x => - x. -Fail Next Obligation. -Definition receive_OVN_commit_to_vote {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - commit_to_vote ctx st. - -Definition receive_OVN_cast_vote {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - cast_vote ctx st. - -#[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := - {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_TallyParameter_t_Sized : t_Sized t_TallyParameter := - fun x => - x. -Fail Next Obligation. -Definition receive_OVN_tally {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_TallyParameter)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - tally_votes ctx st. - -Inductive Msg_OVN: Type := -| msg_OVN_register : t_RegisterParam -> Msg_OVN -| msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN -| msg_OVN_cast_vote : t_CastVoteParam -> Msg_OVN -| msg_OVN_tally : t_TallyParameter -> Msg_OVN. -#[global] Program Instance state_OVN_t_HasReceiveContext : t_HasReceiveContext state_OVN 'unit := - {| f_get := (fun (Ctx : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance state_OVN_t_Sized : t_Sized state_OVN := - fun x => - x. -Fail Next Obligation. -#[global] (* Program *) Instance state_OVN_t_HasActions : t_HasActions state_OVN. -Admitted. -Fail Next Obligation. -Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := - receive_OVN chain ctx st msg := - match msg with - | Some (msg_OVN_register val) => - match (is_pure (both_prog (receive_OVN_register (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_OVN_commit_to_vote val) => - match (is_pure (both_prog (receive_OVN_commit_to_vote (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_OVN_cast_vote val) => - match (is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_OVN_tally val) => - match (is_pure (both_prog (receive_OVN_tally (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | _ => - ResultMonad.Err tt - end : ResultMonad.result (state_OVN * list ActionBody) t_ParseError. -Fail Next Obligation. -#[global] Program Instance state_OVN_Serializable : Serializable state_OVN := - _. -Fail Next Obligation. -#[global] Program Instance Msg_OVN_Serializable : Serializable Msg_OVN := - Derive Serializable Msg_OVN_rect. -Fail Next Obligation. -Definition contract_OVN : Contract (state_OVN) (Msg_OVN) (state_OVN) (t_ParseError) := - build_contract init_OVN receive_OVN. diff --git a/ovn/proofs/ssprove/extraction/HashMap.v b/ovn/proofs/ssprove/extraction/HashMap.v deleted file mode 100644 index 58eeb1e..0000000 --- a/ovn/proofs/ssprove/extraction/HashMap.v +++ /dev/null @@ -1,67 +0,0 @@ -(* File automatically generated by Hacspec *) -From Hacspec Require Import Hacspec_Lib. - -From Coq Require Import ZArith. -Import List.ListNotations. -Open Scope Z_scope. -Open Scope bool_scope. - -Require Import Lia. -Require Import Coq.Logic.FunctionalExtensionality. -Require Import Sumbool. - -From mathcomp Require Import fintype. - -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset fmap. - -From mathcomp Require Import ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith List. -Import ListNotations. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Declare Scope hacspec_scope. - -Open Scope list_scope. -Open Scope hacspec_scope. -Open Scope nat_scope. - -(* Require Import Hacspec_Lib_Comparable. *) - -Import choice.Choice.Exports. - -Require Import Core. -Export Core. - -Require Import Hacspec_lib. -Export Hacspec_lib. - -Inductive random_state := - t_RandomState. -Definition t_HashMap A B (_ : random_state) := chMap A B. - -Equations insert : forall {L1 L2 L3 I1 I2 I3} {A B : choice_type}, both L1 I1 (t_HashMap A B t_RandomState) -> both L2 I2 A -> both L3 I3 B -> both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_Option B × t_HashMap A B t_RandomState) := - insert m i v := - bind_both m (fun m' => - bind_both i (fun i' => - bind_both v (fun v' => - solve_lift ret_both ( - (Some v', setm m' (chElement_ordType_ce_to_ce A i') v') - : chOption B × t_HashMap A B _)))). - -Equations get {L1 L2 I1 I2} {A B} (m : both L1 I1 (t_HashMap A B t_RandomState)) (i : both L2 I2 A) : both (L1 :|: L2) (I1 :|: I2) (t_Option B) := - get m i := - bind_both m (fun m' => - bind_both i (fun i' => - solve_lift ret_both (getm m' (chElement_ordType_ce_to_ce A i') : chOption B))). - -Equations new {L I A B} : both L I (t_HashMap A B t_RandomState) := - new := solve_lift ret_both (emptym : t_HashMap A B t_RandomState). (* (fmap (s:=[]) _ : chMap _ _) *) diff --git a/ovn/proofs/ssprove/extraction/_CoqProject b/ovn/proofs/ssprove/extraction/_CoqProject index e92c278..81d2658 100644 --- a/ovn/proofs/ssprove/extraction/_CoqProject +++ b/ovn/proofs/ssprove/extraction/_CoqProject @@ -2,15 +2,6 @@ -arg -w -arg all -# Written by hand -# Hacspec_lib.v -# Core.v -# HashMap.v -ConCertLib.v - -# Translated -# Hacspec_ovn_Schnorr_Random_oracle.v -# Hacspec_ovn_Schnorr.v Hacspec_ovn.v # Taken from Crypt (as branches are not merged!) diff --git a/ovn/proofs/ssprove/extraction/missing.org b/ovn/proofs/ssprove/extraction/missing.org deleted file mode 100644 index 50172cb..0000000 --- a/ovn/proofs/ssprove/extraction/missing.org +++ /dev/null @@ -1,25 +0,0 @@ -better handling of -#+begin_src coq -foldi_both(* _list *) -#+end_src - -Named projections for records/structs: -#+begin_src coq -Definition t_RegisterParam : choice_type := - (int32 × int32). -Equations Build_t_RegisterParam {L : {fset Location}} {I : Interface} (f_i : both L I (int32)) (f_xi : both L I (int32)) : both L I (t_RegisterParam) := - Build_t_RegisterParam f_i f_xi := - bind_both f_xi (fun f_xi => - bind_both f_i (fun f_i => - solve_lift (ret_both ((f_i,f_xi) : (t_RegisterParam))))) : both L I (t_RegisterParam). -Fail Next Obligation. -(* Missing V *) -Equations f_i {L : {fset Location}} {I : Interface} (param : both L I (t_RegisterParam)) : both L I (int32) := - f_i param := - bind_both param (fun x => solve_lift ret_both (fst x : int32)) . -Fail Next Obligation. -Equations f_xi {L : {fset Location}} {I : Interface} (param : both L I (t_RegisterParam)) : both L I (int32) := - f_xi param := - bind_both param (fun x => solve_lift ret_both (snd x : int32)) . -Fail Next Obligation. -#+end_src diff --git a/ovn/proofs/ssprove/extraction/ovn_by_hand.v b/ovn/proofs/ssprove/extraction/ovn_by_hand.v deleted file mode 100644 index caafaea..0000000 --- a/ovn/proofs/ssprove/extraction/ovn_by_hand.v +++ /dev/null @@ -1,211 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -(*Not implemented yet? todo(item)*) - -Require Import Core. (* as TryFrom *) - -Require Import Core. (* as mem *) - -Require Import Hacspec_lib. - -Class t_Hasher (Self : choice_type) := { - t_Hash : choice_type ; - t_Hash_t_TryFrom :> t_TryFrom (t_Hash) ; - t_Hash_t_Into :> t_Into (t_Hash) ; - t_Hash_t_PartialEq :> t_PartialEq (t_Hash) ; - t_Hash_t_Copy :> t_Copy (t_Hash) ; - t_Hash_t_Clone :> t_Clone (t_Hash) ; - t_Hash_t_Sized :> t_Sized (t_Hash) ; - hash : seq int8 -> t_Hash ; - concat_and_hash : t_Hash -> t_Option (t_Hash) -> t_Hash ; - hash_size : uint_size ; -}. - -Definition t_PartialTreeLayer (H : _) : choice_type := - t_Vec ((uint_size × H)) (t_Global). - -Definition t_PartialTree (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} : choice_type := t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global). -Definition Build_PartialTree {L I} {T : _} `{ t_Sized (T)} `{ t_Hasher (T)} {f_layers : both L I (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global))} : both L I (t_PartialTree _) := f_layers. - -Program Definition is_left_index {L1 : {fset Location}} {I1 : Interface} (index : both L1 I1 (uint_size)) : both (L1) (I1) ('bool) := - (index .% i32(2)) =.? i32(0). -Fail Next Obligation. - -Program Definition get_sibling_index {L1 : {fset Location}} {I1 : Interface} (index : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := - ifb is_left_index index - then index .+ i32(1) - else index .- i32(1). -Fail Next Obligation. - -Definition height_loc : Location := - (int32 ; 0%nat). -Program Definition tree_depth {L1 : {fset Location}} {I1 : Interface} (leaves_count : both L1 I1 (uint_size)) : both (L1 :|: fset [height_loc]) (I1) (uint_size) := - letbm height loc(height_loc) := (i32(0)) : both _ _ (int32) in - letbm height loc(height_loc) := (ifb leaves_count =.? i32(1) - then letb height := (i32(1)) : both _ _ (int32) in - height - else letb height := (ilog2 leaves_count) : both _ _ (int32) in - height) : both _ _ (int32) in - (cast_int height). -Fail Next Obligation. - -Program Definition parent_index {L1 : {fset Location}} {I1 : Interface} (index : both L1 I1 (uint_size)) : both (L1) (I1) (uint_size) := - ifb is_left_index index - then index ./ i32(2) - else (get_sibling_index index) ./ i32(2). -Fail Next Obligation. - -Definition parents_loc : Location := - (t_Vec (uint_size) (t_Global) ; 1%nat). -Program Definition parent_indices {L1 : {fset Location}} {I1 : Interface} (indices : both L1 I1 (seq uint_size)) : both (L1 :|: fset [parents_loc]) (I1) (t_Vec (uint_size) (t_Global)) := - letbm parents loc(parents_loc) := (collect (map (cloned (iter indices)) parent_index)) : both _ _ (t_Vec (uint_size) (t_Global)) in - letb parents := (dedup parents) : both _ _ (t_Vec (uint_size) (t_Global)) in - parents. -Fail Next Obligation. - -Definition t_ErrorKind : choice_type := chFin (mkpos 5). -Definition ErrorKind_SerializedProofSizeIsIncorrect {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=0) eq_refl : t_ErrorKind). -Definition ErrorKind_NotEnoughHelperNodes {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=1) eq_refl : t_ErrorKind). -Definition ErrorKind_HashConversionError {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=2) eq_refl : t_ErrorKind). -Definition ErrorKind_NotEnoughHashesToCalculateRoot {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=3) eq_refl : t_ErrorKind). -Definition ErrorKind_LeavesIndicesCountMismatch {L I} : both L I t_ErrorKind := ret_both (fintype.Ordinal (n:=5) (m:=4) eq_refl : t_ErrorKind). - -Definition t_Error : choice_type := t_ErrorKind. -Definition Build_Error {L I} : both L I t_ErrorKind -> both L I t_Error := - fun x => x. - -Program Definition new_under_impl {L1 : {fset Location}} {I1 : Interface} (kind : both L1 I1 (t_ErrorKind)) : both (L1) (I1) (t_Error) := - Build_Error kind. -Fail Next Obligation. - -Program Definition not_enough_helper_nodes_under_impl : both (fset []) ([interface ]) (t_Error) := - new_under_impl ErrorKind_NotEnoughHelperNodes. -Fail Next Obligation. - -Program Definition new_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} : both (fset []) ([interface ]) (t_PartialTree (T)) := - Build_PartialTree new_under_impl. -Fail Next Obligation. - -Program Definition from_leaves_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} {L1 : {fset Location}} {I1 : Interface} (leaves : both L1 I1 (seq t_Hash)) : both (L1 :|: fset [current_layer_loc;nodes_loc;partial_tree_loc;reversed_layers_loc;parents_loc;height_loc]) (I1) (t_Result (t_PartialTree (T)) (t_Error)) := - letb leaf_tuples := (collect (enumerate (cloned (iter_under_impl leaves)))) : both _ _ (t_Vec ((uint_size × t_Hash)) (t_Global)) in - build_under_impl_1 (into_vec_under_impl (unsize box_new)) (tree_depth (len_under_impl leaves)). -Fail Next Obligation. - -Program Definition build_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (partial_layers : both L1 I1 (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global))) (depth : both L2 I2 (uint_size)) : both (L1:|:L2 :|: fset [current_layer_loc;nodes_loc;partial_tree_loc;reversed_layers_loc;parents_loc]) (I1:|:I2) (t_Result (t_PartialTree (T)) (t_Error)) := - run (letb layers := (match branch (build_tree_under_impl_1 partial_layers depth) with - | ControlFlow_Break residual => letb hoist1 := (v_Break (from_residual residual)) : both _ _ (t_Never) in - ControlFlow_Continue (never_to_any hoist1) - | ControlFlow_Continue val => ControlFlow_Continue val - end) : both _ _ (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global)) in - ControlFlow_Continue (Result_Ok (Build_PartialTree layers))). -Fail Next Obligation. - -Definition reversed_layers_loc : Location := - (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global) ; 5%nat). -Definition partial_tree_loc : Location := - (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global) ; 4%nat). -Definition nodes_loc : Location := - (t_Vec ((uint_size × t_Hash)) (t_Global) ; 3%nat). -Definition current_layer_loc : Location := - (t_Vec ((uint_size × t_Hash)) (t_Global) ; 2%nat). -Program Definition build_tree_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (partial_layers : both L1 I1 (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global))) (full_tree_depth : both L2 I2 (uint_size)) : both (L1:|:L2 :|: fset [current_layer_loc;nodes_loc;partial_tree_loc;reversed_layers_loc;parents_loc]) (I1:|:I2) (t_Result (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global)) (t_Error)) := - letbm partial_tree loc(partial_tree_loc) := (new_under_impl) : both _ _ (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global)) in - letbm current_layer loc(current_layer_loc) := (new_under_impl) : both _ _ (t_Vec ((uint_size × t_Hash)) (t_Global)) in - letb '(todo_fresh_var,partial_layers_temp) := (drain_under_impl_1 partial_layers RangeFull) : both _ _ ((t_Drain (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global) × t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global))) in - letb partial_layers := (partial_layers_temp) : both _ _ (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global)) in - letb hoist2 := (todo_fresh_var) : both _ _ (t_Drain (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global)) in - letb hoist3 := (rev hoist2) : both _ _ (t_Rev (t_Drain (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global))) in - letbm reversed_layers loc(reversed_layers_loc) := (collect hoist3) : both _ _ (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global)) in - letb '(current_layer,partial_tree,reversed_layers) := (foldi_both (into_iter (Build_Range i32(0)full_tree_depth)) (fun {L I _ _} =>fun _ => - (ssp (fun '(current_layer,partial_tree,reversed_layers) => - letb '(todo_fresh_var,reversed_layers_temp) := (pop_under_impl_1 reversed_layers) : both _ _ ((t_Option (t_Vec ((uint_size × t_Hash)) (t_Global)) × t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global))) in - letb reversed_layers := (reversed_layers_temp) : both _ _ (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global)) in - letb hoist4 := (todo_fresh_var) : both _ _ (t_Option (t_Vec ((uint_size × t_Hash)) (t_Global))) in - letb current_layer := (match hoist4 with - | Option_Some nodes => letb '(current_layer_temp,nodes_temp) := (append_under_impl_1 current_layer nodes) : both _ _ ((t_Vec ((uint_size × t_Hash)) (t_Global) × t_Vec ((uint_size × t_Hash)) (t_Global))) in - letb current_layer := (current_layer_temp) : both _ _ (t_Vec ((uint_size × t_Hash)) (t_Global)) in - letb nodes := (nodes_temp) : both _ _ (t_Vec ((uint_size × t_Hash)) (t_Global)) in - letb _ := (tt) : both _ _ (unit) in - current_layer - | _ => current_layer - end) : both _ _ (t_Vec ((uint_size × t_Hash)) (t_Global)) in - letb partial_tree := (push_under_impl_1 partial_tree (clone current_layer)) : both _ _ (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global)) in - letb '(todo_fresh_var,current_layer_temp) := (drain_under_impl_1 current_layer RangeFull) : both _ _ ((t_Drain ((uint_size × t_Hash)) (t_Global) × t_Vec ((uint_size × t_Hash)) (t_Global))) in - letb current_layer := (current_layer_temp) : both _ _ (t_Vec ((uint_size × t_Hash)) (t_Global)) in - letb hoist5 := (todo_fresh_var) : both _ _ (t_Drain ((uint_size × t_Hash)) (t_Global)) in - letb '(indices,nodes) := (unzip hoist5) : both _ _ ((t_Vec (uint_size) (t_Global) × t_Vec (t_Hash) (t_Global))) in - letb parent_layer_indices := (parent_indices (deref indices)) : both _ _ (t_Vec (uint_size) (t_Global)) in - letb current_layer := (foldi_both (into_iter (enumerate (iter_under_impl (deref parent_layer_indices)))) (fun {L I _ _} =>fun '(i,parent_node_index) => - (ssp (fun current_layer => - match get_under_impl (deref nodes) (i .* i32(2)) with - | Option_Some left_node => ControlFlow_Continue (push_under_impl_1 current_layer prod_b(parent_node_index,concat_and_hash left_node (get_under_impl (deref nodes) ((i .* i32(2)) .+ i32(1))))) - | Option_None => letb hoist6 := (v_Break (Result_Err not_enough_helper_nodes_under_impl)) : both _ _ (t_Never) in - ControlFlow_Continue (letb 'tt := (never_to_any hoist6) : both _ _ (unit) in - current_layer) - end) )) current_layer) : both _ _ (t_Vec ((uint_size × t_Hash)) (t_Global)) in - prod_b(current_layer,partial_tree,reversed_layers)) )) prod_b(current_layer,partial_tree,reversed_layers)) : both _ _ ((t_Vec ((uint_size × t_Hash)) (t_Global) × t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global) × t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global))) in - letb partial_tree := (push_under_impl_1 partial_tree (clone current_layer)) : both _ _ (t_Vec (t_Vec ((uint_size × t_Hash)) (t_Global)) (t_Global)) in - Result_Ok partial_tree. -Fail Next Obligation. - -Program Definition depth_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_PartialTree (T))) : both (L1) (I1) (uint_size) := - (len_under_impl_1 (f_layers self)) .- i32(1). -Fail Next Obligation. - -Definition temp_loc : Location := - (t_IntoIter ((uint_size × t_Hash)) (t_Global) ; 6%nat). -Program Definition contains_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_PartialTree (T))) (layer_index : both L2 I2 (uint_size)) (node_index : both L3 I3 (uint_size)) : both (L1:|:L2:|:L3 :|: fset [temp_loc]) (I1:|:I2:|:I3) ('bool) := - match get_under_impl (layers_under_impl_1 self) layer_index with - | Option_Some layer => letbm temp loc(temp_loc) := (into_iter (clone layer)) : both _ _ (t_IntoIter) in - letb '(todo_fresh_var,temp_temp) := (any temp (fun '(index,_) => - index =.? node_index)) : both _ _ (('bool × t_IntoIter ((uint_size × t_Hash)) (t_Global))) in - letb temp := (temp_temp) : both _ _ (t_IntoIter ((uint_size × t_Hash)) (t_Global)) in - todo_fresh_var - | Option_None => false - end. -Fail Next Obligation. - -Program Definition upsert_layer_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_PartialTree (T))) (layer_index : both L2 I2 (uint_size)) (new_layer : both L3 I3 (t_Vec ((uint_size × t_Hash)) (t_Global))) : both (L1:|:L2:|:L3) (I1:|:I2:|:I3) (unit) := - match get_under_impl (deref (f_layers self)) layer_index with - | Option_Some layer => tt - | Option_None => tt - end. -Fail Next Obligation. - -Program Definition layer_nodes_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_PartialTree (T))) : both (L1) (I1) (t_Vec (t_Vec (t_Hash) (t_Global)) (t_Global)) := - letb hashes := (collect (map (iter_under_impl (layers_under_impl_1 self)) (fun layer => - collect (map (cloned (iter_under_impl (deref layer))) (fun '(_,hash) => - hash))))) : both _ _ (t_Vec (t_Vec (t_Hash) (t_Global)) (t_Global)) in - hashes. -Fail Next Obligation. - -Program Definition layers_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_PartialTree (T))) : both (L1) (I1) (seq t_Vec ((uint_size × t_Hash)) (t_Global)) := - deref (f_layers self). -Fail Next Obligation. - -Program Definition clear_under_impl_1 (T : _) `{ t_Sized (T)} `{ t_Hasher (T)} {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_PartialTree (T))) : both (L1) (I1) (unit) := - tt. -Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/ovn_helpers.txt b/ovn/proofs/ssprove/extraction/ovn_helpers.txt deleted file mode 100644 index 384d03a..0000000 --- a/ovn/proofs/ssprove/extraction/ovn_helpers.txt +++ /dev/null @@ -1,40 +0,0 @@ -Class t_TryFrom (A : choice_type) := TryFrom : A -> A. -Class t_Into (A : choice_type) := Into : A -> A. -Class t_PartialEq (A : choice_type) := PartialEq : A -> A. -Class t_Copy (A : choice_type) := Copy : A -> A. -Class t_Clone (A : choice_type) := Clone : A -> A. -Class t_Sized (A : choice_type) := Sized : A -> A. -Axiom seq : choice_type -> choice_type. -Axiom int8 : choice_type. -Axiom t_Option : choice_type -> choice_type. -Axiom uint_size : choice_type. -Inductive vec_typ := -| t_Global. -Axiom t_Vec : choice_type -> vec_typ -> choice_type. -Class t_Default A := { default : A }. - - -Class t_Hasher `{t_TryFrom} `{t_Into} `{t_PartialEq} `{t_Copy} `{t_Clone} := { - t_temp_hash : choice_type ; - t_Hash `{t_TryFrom} `{t_Into} `{t_PartialEq} `{t_Copy} `{t_Clone} : choice_type ; - hash : seq int8 -> t_temp_hash ; - concat_and_hash : t_Hash -> t_Option (t_Hash) -> t_Hash ; - hash_size : uint_size ; -}. - -Notation t_PartialTreeLayer := (fun (H : choice_type) => (t_Vec ((uint_size * H)) (t_Global))). - -Record t_PartialTree `{T : t_Hasher} : choice_type :={ - f_layers : t_Vec (t_Vec ((uint_size * t_Hash)) (t_Global)) (t_Global); -}. -Definition new `{T : t_Hasher} : t_Vec (t_Vec ((uint_size * t_Hash)) (t_Global)) (t_Global). Admitted. - -Require Import Coq.Program.Tactics. -Check Build_t_PartialTree. -Program Definition new_under_impl `{T : t_Hasher} : (t_PartialTree) := - {| f_layers := new |}. -Fail Next Obligation. - -#[local] Instance t_PartialTree_t_Default `{T : t_Hasher} : t_Default t_PartialTree := {| - default := new_under_impl; -|}. From 917689b64995660b6d1447568f15e359f98f229b Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Fri, 24 Nov 2023 13:58:36 +0100 Subject: [PATCH 33/86] Cleaup --- Cargo.toml | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9e4633b..f773f0c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,28 +1,28 @@ [workspace] members = [ - # "basic", - # "curve25519", - # "chacha20", - # "poly1305", - # "chacha20poly1305", - # "gimli", - # "sha256", - # "sha3", - # "hmac", - # "hkdf", - # "p256", - # "bls12-381", - # "ecdsa-p256-sha256", - # "aes", - # "aes_jazz", - # "gf128", - # "aes128-gcm", - # "bls12-381-hash", - # "edwards25519", - # "ed25519", - # "pasta", - # "halo2", - # "weierstrass-curves", + "basic", + "curve25519", + "chacha20", + "poly1305", + "chacha20poly1305", + "gimli", + "sha256", + "sha3", + "hmac", + "hkdf", + "p256", + "bls12-381", + "ecdsa-p256-sha256", + "aes", + "aes_jazz", + "gf128", + "aes128-gcm", + "bls12-381-hash", + "edwards25519", + "ed25519", + "pasta", + "halo2", + "weierstrass-curves", "ovn", "concordium", "concordium-derive", From 11b0ac83a96c34cbaf804900446732b8db6fb243 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Fri, 24 Nov 2023 13:59:34 +0100 Subject: [PATCH 34/86] Cleaup --- .../extraction/Hacspec_aes_jazz.semantics | 170 ------------------ .../semantics/extraction/Hacspec_aes_jazz.v | 64 ------- 2 files changed, 234 deletions(-) delete mode 100644 aes_jazz/proofs/semantics/extraction/Hacspec_aes_jazz.semantics delete mode 100644 aes_jazz/proofs/semantics/extraction/Hacspec_aes_jazz.v diff --git a/aes_jazz/proofs/semantics/extraction/Hacspec_aes_jazz.semantics b/aes_jazz/proofs/semantics/extraction/Hacspec_aes_jazz.semantics deleted file mode 100644 index f3ee6ca..0000000 --- a/aes_jazz/proofs/semantics/extraction/Hacspec_aes_jazz.semantics +++ /dev/null @@ -1,170 +0,0 @@ -(* Automatically Generated Functional Semantics *) -Import Usestd prelude rust_2018 - -(Unimplemented NotImplementedYet) - -Import Usehacspec_lib - -Macro public_bytes((SBox, 256)) - -Macro public_bytes((RCon, 15)) - -Macro public_bytes((PBytes256, 256)) - -Definition v_SBOX := - λ (), SBox [99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22] - -Definition v_RCON := - λ (), RCon [141,1,2,4,8,16,32,64,128,27,54,108,216,171,77] - -Definition index_u32 := - λ (s : int) (i : int), - cast ((rem ((shr s) ((mul i) 32))) ((shl 1) 32)) - -Definition index_u8 := - λ (s : int) (i : int), - cast ((rem ((shr s) ((mul i) 8))) ((shl 1) 8)) - -Definition rebuild_u32 := - λ (s0 : int) (s1 : int) (s2 : int) (s3 : int), - (bitor (cast s0)) ((bitor ((shl (cast s1)) 8)) ((bitor ((shl (cast s2)) 16)) ((shl (cast s3)) 24))) - -Definition rebuild_u128 := - λ (s0 : int) (s1 : int) (s2 : int) (s3 : int), - (bitor (cast s0)) ((bitor ((shl (cast s1)) 32)) ((bitor ((shl (cast s2)) 64)) ((shl (cast s3)) 96))) - -Definition subword := - λ (v : int), - (((rebuild_u32 ((index v_SBOX) ((index_u8 v) 0))) ((index v_SBOX) ((index_u8 v) 1))) ((index v_SBOX) ((index_u8 v) 2))) ((index v_SBOX) ((index_u8 v) 3)) - -Definition rotword := - λ (v : int), - (((rebuild_u32 ((index_u8 v) 1)) ((index_u8 v) 2)) ((index_u8 v) 3)) ((index_u8 v) 0) - -Definition vpshufd1 := - λ (s : int) (o : int) (i : int), - (index_u32 ((shr s) ((mul 32) (cast ((rem ((shr o) ((mul 2) i))) 4))))) 0 - -Definition vpshufd := - λ (s : int) (o : int), - let d1 : int := ((vpshufd1 s) o) 0 in - let d2 : int := ((vpshufd1 s) o) 1 in - let d3 : int := ((vpshufd1 s) o) 2 in - let d4 : int := ((vpshufd1 s) o) 3 in - (((rebuild_u128 d1) d2) d3) d4 - -Definition vshufps := - λ (s1 : int) (s2 : int) (o : int), - let d1 : int := ((vpshufd1 s1) o) 0 in - let d2 : int := ((vpshufd1 s1) o) 1 in - let d3 : int := ((vpshufd1 s2) o) 2 in - let d4 : int := ((vpshufd1 s2) o) 3 in - (((rebuild_u128 d1) d2) d3) d4 - -Definition key_combine := - λ (rkey : int) (temp1 : int) (temp2 : int), - let temp1 := (vpshufd temp1) 255 in - let temp2 := ((vshufps temp2) rkey) 16 in - let rkey := (bitxor rkey) temp2 in - let temp2 := ((vshufps temp2) rkey) 140 in - let rkey := (bitxor rkey) temp2 in - let rkey := (bitxor rkey) temp1 in - (rkey,temp2)is2 - -Definition aeskeygenassist := - λ (v1 : int) (v2 : int), - let x1 := (index_u32 v1) 1 in - let x3 := (index_u32 v1) 3 in - let y0 := subword x1 in - let y1 := (bitxor (rotword y0)) (cast v2) in - let y2 := subword x3 in - let y3 := (bitxor (rotword y2)) (cast v2) in - (((rebuild_u128 y0) y1) y2) y3 - -Definition key_expand := - λ (rcon : int) (rkey : int) (temp2 : int), - let temp1 := (aeskeygenassist rkey) rcon in - ((key_combine rkey) temp1) temp2 - -TypeDefinition t_KeyList :=t_Seq_t - -Definition keys_expand := - λ (key : int), - let rkeys : t_Seq_t := new_under_impl_41 0 in - let key := key in - let rkeys := (push_under_impl_41 rkeys) key in - let temp2 : int := 0 in - let (key,rkeys,temp2) := ((fold (into_iter Range[f_start := 1][f_end := 11])) (key,rkeys,temp2)is3) (λ (key,rkeys,temp2) round, - let rcon := (index v_RCON) round in - let (key_temp,temp2_temp) := ((key_expand rcon) key) temp2 in - let key := key_temp in - let temp2 := temp2_temp in - let rkeys := (push_under_impl_41 rkeys) key in - (key,rkeys,temp2)is3) in - rkeys - -Definition subbytes := - λ (s : int), - (((rebuild_u128 (subword ((index_u32 s) 0))) (subword ((index_u32 s) 1))) (subword ((index_u32 s) 2))) (subword ((index_u32 s) 3)) - -Definition matrix_index := - λ (s : int) (i : int) (j : int), - (index_u8 ((index_u32 s) j)) i - -Definition shiftrows := - λ (s : int), - (((rebuild_u128 ((((rebuild_u32 (((matrix_index s) 0) 0)) (((matrix_index s) 1) 1)) (((matrix_index s) 2) 2)) (((matrix_index s) 3) 3))) ((((rebuild_u32 (((matrix_index s) 0) 1)) (((matrix_index s) 1) 2)) (((matrix_index s) 2) 3)) (((matrix_index s) 3) 0))) ((((rebuild_u32 (((matrix_index s) 0) 2)) (((matrix_index s) 1) 3)) (((matrix_index s) 2) 0)) (((matrix_index s) 3) 1))) ((((rebuild_u32 (((matrix_index s) 0) 3)) (((matrix_index s) 1) 0)) (((matrix_index s) 2) 1)) (((matrix_index s) 3) 2)) - -Definition xtime := - λ (x : int), - let x1 := (shl x) 1 in - let x7 := (shr x) 7 in - let x71 := (bitand x7) 1 in - let x711b := (mul x71) 27 in - (bitxor x1) x711b - -Definition mixcolumn := - λ (c : int) (state : int), - let s0 := ((matrix_index state) 0) c in - let s1 := ((matrix_index state) 1) c in - let s2 := ((matrix_index state) 2) c in - let s3 := ((matrix_index state) 3) c in - let tmp := (bitxor ((bitxor ((bitxor s0) s1)) s2)) s3 in - let r0 := (bitxor ((bitxor s0) tmp)) (xtime ((bitxor s0) s1)) in - let r1 := (bitxor ((bitxor s1) tmp)) (xtime ((bitxor s1) s2)) in - let r2 := (bitxor ((bitxor s2) tmp)) (xtime ((bitxor s2) s3)) in - let r3 := (bitxor ((bitxor s3) tmp)) (xtime ((bitxor s3) s0)) in - (((rebuild_u32 r0) r1) r2) r3 - -Definition mixcolumns := - λ (state : int), - let c0 := (mixcolumn 0) state in - let c1 := (mixcolumn 1) state in - let c2 := (mixcolumn 2) state in - let c3 := (mixcolumn 3) state in - (((rebuild_u128 c0) c1) c2) c3 - -Definition aesenc := - λ (state : int) (rkey : int), - let state := shiftrows state in - let state := subbytes state in - let state := mixcolumns state in - (bitxor state) rkey - -Definition aesenclast := - λ (state : int) (rkey : int), - let state := shiftrows state in - let state := subbytes state in - (bitxor state) rkey - -Definition aes_rounds := - λ (rkeys : t_Seq_t) (inp : int), - let state : int := (bitxor inp) ((index rkeys) 0) in - let state := ((fold (into_iter Range[f_start := 1][f_end := 10])) state) (λ state round, - (aesenc state) ((index rkeys) round)) in - (aesenclast state) ((index rkeys) 10) - -Definition aes := - λ (key : int) (inp : int), - let rkeys := keys_expand key in - (aes_rounds rkeys) inp diff --git a/aes_jazz/proofs/semantics/extraction/Hacspec_aes_jazz.v b/aes_jazz/proofs/semantics/extraction/Hacspec_aes_jazz.v deleted file mode 100644 index efc26b0..0000000 --- a/aes_jazz/proofs/semantics/extraction/Hacspec_aes_jazz.v +++ /dev/null @@ -1,64 +0,0 @@ -(* Automatically Generated Functional Semantics *) -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string - -decl x to string From a45e0d3f9ee8609e2a0f4cfe0fa1d14c61850b7e Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Fri, 24 Nov 2023 14:00:51 +0100 Subject: [PATCH 35/86] Cleaup --- .../Hacspec_concordium.Concordium_traits.v | 61 - ...cspec_concordium.Concordium_types.Sealed.v | 17 - .../Hacspec_concordium.Concordium_types.v | 85 - .../extraction/Hacspec_concordium.Constants.v | 15 - .../coq/extraction/Hacspec_concordium.v | 105 - .../Hacspec_concordium.Concordium_traits.fst | 173 -- ...pec_concordium.Concordium_types.Sealed.fst | 13 - .../Hacspec_concordium.Concordium_types.fst | 53 - .../Hacspec_concordium.Constants.fst | 9 - .../fstar/extraction/Hacspec_concordium.fst | 5 - wCCD/Cargo.toml | 33 - wCCD/proofs/ssprove/extraction/Hacspec_wccd.v | 846 ----- .../ssprove/extraction/Hacspec_wccd_Cis1.v | 1881 ------------ .../Hacspec_wccd_Export_contract_balance_of.v | 40 - .../Hacspec_wccd_Export_contract_init.v | 40 - ...Hacspec_wccd_Export_contract_operator_of.v | 40 - ...spec_wccd_Export_contract_token_metadata.v | 40 - .../Hacspec_wccd_Export_contract_transfer.v | 40 - .../Hacspec_wccd_Export_contract_unwrap.v | 40 - ...pec_wccd_Export_contract_update_operator.v | 40 - .../Hacspec_wccd_Export_contract_wrap.v | 40 - wCCD/src/cis1.rs | 1038 ------- wCCD/src/wccd.rs | 908 ------ wCCD/wccd.org | 2713 ----------------- 24 files changed, 8275 deletions(-) delete mode 100644 concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_traits.v delete mode 100644 concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_types.Sealed.v delete mode 100644 concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_types.v delete mode 100644 concordium/proofs/coq/extraction/Hacspec_concordium.Constants.v delete mode 100644 concordium/proofs/coq/extraction/Hacspec_concordium.v delete mode 100644 concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_traits.fst delete mode 100644 concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_types.Sealed.fst delete mode 100644 concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_types.fst delete mode 100644 concordium/proofs/fstar/extraction/Hacspec_concordium.Constants.fst delete mode 100644 concordium/proofs/fstar/extraction/Hacspec_concordium.fst delete mode 100644 wCCD/Cargo.toml delete mode 100644 wCCD/proofs/ssprove/extraction/Hacspec_wccd.v delete mode 100644 wCCD/proofs/ssprove/extraction/Hacspec_wccd_Cis1.v delete mode 100644 wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_balance_of.v delete mode 100644 wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_init.v delete mode 100644 wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_operator_of.v delete mode 100644 wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_token_metadata.v delete mode 100644 wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_transfer.v delete mode 100644 wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_unwrap.v delete mode 100644 wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_update_operator.v delete mode 100644 wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_wrap.v delete mode 100644 wCCD/src/cis1.rs delete mode 100644 wCCD/src/wccd.rs delete mode 100644 wCCD/wccd.org diff --git a/concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_traits.v b/concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_traits.v deleted file mode 100644 index 188602b..0000000 --- a/concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_traits.v +++ /dev/null @@ -1,61 +0,0 @@ -(* File automatically generated by Hacspec *) -From Hacspec Require Import Hacspec_Lib MachineIntegers. -From Coq Require Import ZArith. -Import List.ListNotations. -Open Scope Z_scope. -Open Scope bool_scope. - -Require Import Crate. - -Class t_HasParameter Self := { - f_size:Self -> int32 ; -}. - -Class t_HasChainMetadata Self := { - f_slot_time:Self -> t_Timestamp_t ; -}. - -Class t_HasPolicy Self := { - f_identity_provider:Self -> int32 ; - f_created_at:Self -> t_Timestamp_t ; - f_valid_to:Self -> t_Timestamp_t ; - f_next_item:Self -> nseq int8 TODO: Int.to_string length -> (t_Option_t (t_AttributeTag_t × int8) × nseq int8 TODO: Int.to_string length × Self) ; -}. - -(*item error backend*) - -(*item error backend*) - -(*item error backend*) - -(*item error backend*) - -Class t_HasLogger Self := { - f_init:Self ; - f_log_raw:Self -> seq int8 -> (t_Result_t (unit) (t_LogError_t) × Self) ; - f_log:Self -> S -> (t_Result_t (unit) (t_LogError_t) × Self) ; -}. - -Class t_HasActions Self := { - f_accept:Self ; - f_simple_transfer:t_AccountAddress_t -> t_Amount_t -> Self ; - f_send_raw:t_ContractAddress_t -> t_ReceiveName_t -> t_Amount_t -> seq int8 -> Self ; - f_and_then:Self -> Self -> Self ; - f_or_else:Self -> Self -> Self ; -}. - -(*item error backend*) - -(*item error backend*) - -(*item error backend*) - -(*item error backend*) - -Class t_SerialCtx Self := { - f_serial_ctx:Self -> t_SizeLength_t -> W -> (t_Result_t (unit) (_) × W) ; -}. - -Class t_DeserialCtx Self := { - f_deserial_ctx:t_SizeLength_t -> bool -> R -> (t_Result_t (Self) (t_ParseError_t) × R) ; -}. diff --git a/concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_types.Sealed.v b/concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_types.Sealed.v deleted file mode 100644 index fe15f8c..0000000 --- a/concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_types.Sealed.v +++ /dev/null @@ -1,17 +0,0 @@ -(* File automatically generated by Hacspec *) -From Hacspec Require Import Hacspec_Lib MachineIntegers. -From Coq Require Import ZArith. -Import List.ListNotations. -Open Scope Z_scope. -Open Scope bool_scope. - -Require Import Super. - -Class t_ContextType Self := { -}. - -Instance t_InitContextExtern_t_t_ContextType : t_ContextType t_InitContextExtern_t := { -}. - -Instance t_ReceiveContextExtern_t_t_ContextType : t_ContextType t_ReceiveContextExtern_t := { -}. diff --git a/concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_types.v b/concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_types.v deleted file mode 100644 index aec6be7..0000000 --- a/concordium/proofs/coq/extraction/Hacspec_concordium.Concordium_types.v +++ /dev/null @@ -1,85 +0,0 @@ -(* File automatically generated by Hacspec *) -From Hacspec Require Import Hacspec_Lib MachineIntegers. -From Coq Require Import ZArith. -Import List.ListNotations. -Open Scope Z_scope. -Open Scope bool_scope. - -Record t_ContractState : Type :={ - f_current_contract_state_position : int32; -}. - -Record t_Parameter : Type :={ - f_current_parameter_position : int32; -}. - -Record t_AttributesCursor : Type :={ - f_remaining_items : int16; - f_current_attribute_cursor_position : int32; -}. - -Record t_Logger : Type :={ - f__private_logger : unit; -}. - -Inductive t_LogError : Type := -| LogError_Fullt_LogError -| LogError_Malformedt_LogError. - -Record t_NotPayableError : Type :={ -}. - -Record t_Action : Type :={ - f__private_action : int32; -}. - -Definition impl__tag (self : t_Action_t) : int32 := - f__private_action self. - -Definition v____ : unit := - tt. - -Definition v______refinement (error_code : t_NonZeroI32_t) : bool := - true. - -Record t_Reject : Type :={ - f_error_code : t_NonZeroI32_t; -}. - -Instance t_Reject_t_t_Default : t_Default t_Reject_t := { -}. - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -Notation t_ReceiveResult_t := (t_Result_t (A) (t_Reject_t)). - -Notation t_InitResult_t := (t_Result_t (S) (t_Reject_t)). - -(*Not implemented yet? todo(item)*) - -Record t_ExternContext : Type :={ - f_marker : t_PhantomData_t T; -}. - -Record t_ChainMetaExtern : Type :={ -}. - -Record t_InitContextExtern : Type :={ -}. - -Record t_ReceiveContextExtern : Type :={ -}. diff --git a/concordium/proofs/coq/extraction/Hacspec_concordium.Constants.v b/concordium/proofs/coq/extraction/Hacspec_concordium.Constants.v deleted file mode 100644 index 35685ad..0000000 --- a/concordium/proofs/coq/extraction/Hacspec_concordium.Constants.v +++ /dev/null @@ -1,15 +0,0 @@ -(* File automatically generated by Hacspec *) -From Hacspec Require Import Hacspec_Lib MachineIntegers. -From Coq Require Import ZArith. -Import List.ListNotations. -Open Scope Z_scope. -Open Scope bool_scope. - -Definition v_MAX_CONTRACT_STATE_SIZE : int32 := - (@repr WORDSIZE32 16384). - -Definition v_MAX_LOG_SIZE : uint_size := - (@repr WORDSIZE32 512). - -Definition v_MAX_NUM_LOGS : uint_size := - (@repr WORDSIZE32 64). diff --git a/concordium/proofs/coq/extraction/Hacspec_concordium.v b/concordium/proofs/coq/extraction/Hacspec_concordium.v deleted file mode 100644 index 8899722..0000000 --- a/concordium/proofs/coq/extraction/Hacspec_concordium.v +++ /dev/null @@ -1,105 +0,0 @@ -(* File automatically generated by Hacspec *) -From Hacspec Require Import Hacspec_Lib MachineIntegers. -From Coq Require Import ZArith. -Import List.ListNotations. -Open Scope Z_scope. -Open Scope bool_scope. - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -Definition trap : t_Never_t := - abort. - -Require Import Alloc. - -Require Import Alloc. (* as ToOwned *) - -Require Import Alloc. (* as string *) - -Require Import Alloc. (* as String *) - -Require Import Alloc. (* as ToString *) - -Require Import Alloc. (* as vec *) - -Require Import Alloc. (* as Vec *) - -Require Import Core. - -Require Import Core. (* as convert *) - -Require Import Core. (* as hash *) - -Require Import Core. (* as marker *) - -Require Import Core. (* as mem *) - -Require Import Core. (* as num *) - -Require Import Core. - -Require Import Alloc. (* as collections *) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -Require Import Concordium_prims. - -Require Import Concordium_types. - -Require Import Concordium_traits. - -(*Not implemented yet? todo(item)*) - -Require Import Concordium_contracts_common. - -(*Not implemented yet? todo(item)*) - -Require Import Hacspec_concordium_derive. diff --git a/concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_traits.fst b/concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_traits.fst deleted file mode 100644 index a8633b9..0000000 --- a/concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_traits.fst +++ /dev/null @@ -1,173 +0,0 @@ -module Hacspec_concordium.Concordium_traits -#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" -open Core - -class t_HasParameter (#v_Self: Type) = { - [@@@ FStar.Tactics.Typeclasses.no_method]_super_373553659:Concordium_contracts_common.Traits.t_Read - v_Self; - [@@@ FStar.Tactics.Typeclasses.no_method]_super_806558213:t_HasParameter v_Self; - f_size:v_Self -> u32 -} - -class t_HasChainMetadata (#v_Self: Type) = { - [@@@ FStar.Tactics.Typeclasses.no_method]_super_839676169:t_HasChainMetadata v_Self; - f_slot_time:v_Self -> Concordium_contracts_common.Types.t_Timestamp -} - -class t_HasPolicy (#v_Self: Type) = { - [@@@ FStar.Tactics.Typeclasses.no_method]_super_845917934:t_HasPolicy v_Self; - f_identity_provider:v_Self -> u32; - f_created_at:v_Self -> Concordium_contracts_common.Types.t_Timestamp; - f_valid_to:v_Self -> Concordium_contracts_common.Types.t_Timestamp; - f_next_item:v_Self -> array u8 (sz 31) - -> (Core.Option.t_Option (Concordium_contracts_common.Types.t_AttributeTag & u8) & - array u8 (sz 31) & - v_Self) -} - -class t_HasCommonData (#v_Self: Type) = { - [@@@ FStar.Tactics.Typeclasses.no_method]_super_454473913:t_HasCommonData v_Self; - f_PolicyType:Type; - f_PolicyType:t_HasPolicy i0.f_PolicyType; - f_PolicyType:Core.Marker.t_Sized i0.f_PolicyType; - f_MetadataType:Type; - f_MetadataType:t_HasChainMetadata i0.f_MetadataType; - f_MetadataType:Core.Marker.t_Sized i0.f_MetadataType; - f_ParamType:Type; - f_ParamType:Concordium_contracts_common.Traits.t_Read i0.f_ParamType; - f_ParamType:t_HasParameter i0.f_ParamType; - f_ParamType:Core.Marker.t_Sized i0.f_ParamType; - f_PolicyIteratorType:Type; - f_PolicyIteratorType:Core.Iter.Traits.Exact_size.t_ExactSizeIterator i0.f_PolicyIteratorType; - f_PolicyIteratorType:Core.Iter.Traits.Iterator.t_Iterator i0.f_PolicyIteratorType; - f_PolicyIteratorType:Core.Marker.t_Sized i0.f_PolicyIteratorType; - f_policies:v_Self -> i0.f_PolicyIteratorType; - f_metadata:v_Self -> i0.f_MetadataType; - f_parameter_cursor:v_Self -> i0.f_ParamType -} - -class t_HasInitContext (#v_Self: Type) (#v_Error: Type) = { - [@@@ FStar.Tactics.Typeclasses.no_method]_super_454473913:t_HasCommonData v_Self; - [@@@ FStar.Tactics.Typeclasses.no_method]_super_622119999:Core.Marker.t_Sized v_Error; - [@@@ FStar.Tactics.Typeclasses.no_method]_super_333404876:Core.Default.t_Default v_Error; - [@@@ FStar.Tactics.Typeclasses.no_method]_super_124264501:t_HasInitContext v_Self v_Error; - f_InitData:Type; - f_InitData:Core.Marker.t_Sized i3.f_InitData; - f_open:i3.f_InitData -> v_Self; - f_init_origin:v_Self -> Concordium_contracts_common.Types.t_AccountAddress -} - -class t_HasReceiveContext (#v_Self: Type) (#v_Error: Type) = { - [@@@ FStar.Tactics.Typeclasses.no_method]_super_454473913:t_HasCommonData v_Self; - [@@@ FStar.Tactics.Typeclasses.no_method]_super_622119999:Core.Marker.t_Sized v_Error; - [@@@ FStar.Tactics.Typeclasses.no_method]_super_333404876:Core.Default.t_Default v_Error; - [@@@ FStar.Tactics.Typeclasses.no_method]_super_524859029:t_HasReceiveContext v_Self v_Error; - f_ReceiveData:Type; - f_ReceiveData:Core.Marker.t_Sized i3.f_ReceiveData; - f_open:i3.f_ReceiveData -> v_Self; - f_invoker:v_Self -> Concordium_contracts_common.Types.t_AccountAddress; - f_self_address:v_Self -> Concordium_contracts_common.Types.t_ContractAddress; - f_self_balance:v_Self -> Concordium_contracts_common.Types.t_Amount; - f_sender:v_Self -> Concordium_contracts_common.Types.t_Address; - f_owner:v_Self -> Concordium_contracts_common.Types.t_AccountAddress -} - -class t_HasContractState (#v_Self: Type) (#v_Error: Type) = { - [@@@ FStar.Tactics.Typeclasses.no_method]_super_622119999:Core.Marker.t_Sized v_Error; - [@@@ FStar.Tactics.Typeclasses.no_method]_super_333404876:Core.Default.t_Default v_Error; - [@@@ FStar.Tactics.Typeclasses.no_method]_super_373553659:Concordium_contracts_common.Traits.t_Read - v_Self; - [@@@ FStar.Tactics.Typeclasses.no_method]_super_268178196:Concordium_contracts_common.Traits.t_Write - v_Self; - [@@@ FStar.Tactics.Typeclasses.no_method]_super_99959236:Concordium_contracts_common.Traits.t_Seek - v_Self; - [@@@ FStar.Tactics.Typeclasses.no_method]_super_34555314:t_HasContractState v_Self v_Error; - f_ContractStateData:Type; - f_ContractStateData:Core.Marker.t_Sized i5.f_ContractStateData; - f_open:i5.f_ContractStateData -> v_Self; - f_size:v_Self -> u32; - f_truncate:v_Self -> u32 -> v_Self; - f_reserve:v_Self -> u32 -> (bool & v_Self) -} - -class t_HasLogger (#v_Self: Type) = { - [@@@ FStar.Tactics.Typeclasses.no_method]_super_593170002:t_HasLogger v_Self; - f_init:v_Self; - f_log_raw:v_Self -> slice u8 - -> (Core.Result.t_Result Prims.unit Hacspec_concordium.Concordium_types.t_LogError & v_Self); - f_log: - #v_S: Type -> - {| _: Core.Marker.t_Sized v_S |} -> - {| _: Concordium_contracts_common.Traits.t_Serial v_S |} -> - v_Self -> - v_S - -> (Core.Result.t_Result Prims.unit Hacspec_concordium.Concordium_types.t_LogError & v_Self) -} - -class t_HasActions (#v_Self: Type) = { - [@@@ FStar.Tactics.Typeclasses.no_method]_super_790365329:t_HasActions v_Self; - f_accept:v_Self; - f_simple_transfer: - Concordium_contracts_common.Types.t_AccountAddress -> - Concordium_contracts_common.Types.t_Amount - -> v_Self; - f_send_raw: - Concordium_contracts_common.Types.t_ContractAddress -> - Concordium_contracts_common.Types.t_ReceiveName -> - Concordium_contracts_common.Types.t_Amount -> - slice u8 - -> v_Self; - f_and_then:v_Self -> v_Self -> v_Self; - f_or_else:v_Self -> v_Self -> v_Self -} - -class t_UnwrapAbort (#v_Self: Type) = { - [@@@ FStar.Tactics.Typeclasses.no_method]_super_72353824:t_UnwrapAbort v_Self; - f_Unwrap:Type; - f_Unwrap:Core.Marker.t_Sized i0.f_Unwrap; - f_unwrap_abort:v_Self -> i0.f_Unwrap -} - -class t_ExpectReport (#v_Self: Type) = { - [@@@ FStar.Tactics.Typeclasses.no_method]_super_875898860:t_ExpectReport v_Self; - f_Unwrap:Type; - f_Unwrap:Core.Marker.t_Sized i0.f_Unwrap; - f_expect_report:v_Self -> string -> i0.f_Unwrap -} - -class t_ExpectErrReport (#v_Self: Type) = { - [@@@ FStar.Tactics.Typeclasses.no_method]_super_650373357:t_ExpectErrReport v_Self; - f_Unwrap:Type; - f_Unwrap:Core.Marker.t_Sized i0.f_Unwrap; - f_expect_err_report:v_Self -> string -> i0.f_Unwrap -} - -class t_ExpectNoneReport (#v_Self: Type) = { - [@@@ FStar.Tactics.Typeclasses.no_method]_super_122739808:t_ExpectNoneReport v_Self; - f_expect_none_report:v_Self -> string -> Prims.unit -} - -class t_SerialCtx (#v_Self: Type) = { - [@@@ FStar.Tactics.Typeclasses.no_method]_super_728516819:t_SerialCtx v_Self; - f_serial_ctx: - #v_W: Type -> - {| _: Core.Marker.t_Sized v_W |} -> - {| _: Concordium_contracts_common.Traits.t_Write v_W |} -> - v_Self -> - Concordium_contracts_common.Schema.t_SizeLength -> - v_W - -> (Core.Result.t_Result Prims.unit i2.f_Err & v_W) -} - -class t_DeserialCtx (#v_Self: Type) = { - [@@@ FStar.Tactics.Typeclasses.no_method]_super_529871881:Core.Marker.t_Sized v_Self; - [@@@ FStar.Tactics.Typeclasses.no_method]_super_120498864:t_DeserialCtx v_Self; - f_deserial_ctx: - #v_R: Type -> - {| _: Core.Marker.t_Sized v_R |} -> - {| _: Concordium_contracts_common.Traits.t_Read v_R |} -> - Concordium_contracts_common.Schema.t_SizeLength -> - bool -> - v_R - -> (Core.Result.t_Result v_Self Concordium_contracts_common.Types.t_ParseError & v_R) -} \ No newline at end of file diff --git a/concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_types.Sealed.fst b/concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_types.Sealed.fst deleted file mode 100644 index bfb32d6..0000000 --- a/concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_types.Sealed.fst +++ /dev/null @@ -1,13 +0,0 @@ -module Hacspec_concordium.Concordium_types.Sealed -#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" -open Core - -class t_ContextType (#v_Self: Type) = { - [@@@ FStar.Tactics.Typeclasses.no_method]_super_734339128:t_ContextType v_Self -} - -let impl: t_ContextType Hacspec_concordium.Concordium_types.t_InitContextExtern = - { __marker_trait = () } - -let impl_1: t_ContextType Hacspec_concordium.Concordium_types.t_ReceiveContextExtern = - { __marker_trait = () } \ No newline at end of file diff --git a/concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_types.fst b/concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_types.fst deleted file mode 100644 index 7db36df..0000000 --- a/concordium/proofs/fstar/extraction/Hacspec_concordium.Concordium_types.fst +++ /dev/null @@ -1,53 +0,0 @@ -module Hacspec_concordium.Concordium_types -#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" -open Core - -type t_ContractState = { f_current_contract_state_position:u32 } - -type t_Parameter = { f_current_parameter_position:u32 } - -type t_AttributesCursor = { - f_current_attribute_cursor_position:u32; - f_remaining_items:u16 -} - -type t_Logger = { f__private_logger:Prims.unit } - -type t_LogError = - | LogError_Full : t_LogError - | LogError_Malformed : t_LogError - -type t_NotPayableError = | NotPayableError : t_NotPayableError - -type t_Action = { f__private_action:u32 } - -let impl__tag (self: t_Action) : u32 = self.f__private_action - -let v____: Prims.unit = () - -let v______refinement (error_code: Core.Num.Nonzero.t_NonZeroI32) : bool = true - -type t_Reject = { f_error_code:f_error_code: Core.Num.Nonzero.t_NonZeroI32{true} } - -let impl_1: Core.Default.t_Default t_Reject = { __marker_trait = () } - -let t_ReceiveResult - (#v_A: Type) - (#[FStar.Tactics.Typeclasses.tcresolve ()] ii0: Core.Marker.t_Sized v_A) - = Core.Result.t_Result v_A t_Reject - -let t_InitResult - (#v_S: Type) - (#[FStar.Tactics.Typeclasses.tcresolve ()] ii0: Core.Marker.t_Sized v_S) - = Core.Result.t_Result v_S t_Reject - -type t_ExternContext - (#v_T: Type) {| _: Core.Marker.t_Sized v_T |} - {| _: Hacspec_concordium.Concordium_types.Sealed.t_ContextType v_T |} - = { f_marker:Core.Marker.t_PhantomData v_T } - -type t_ChainMetaExtern = | ChainMetaExtern : t_ChainMetaExtern - -type t_InitContextExtern = | InitContextExtern : t_InitContextExtern - -type t_ReceiveContextExtern = | ReceiveContextExtern : t_ReceiveContextExtern \ No newline at end of file diff --git a/concordium/proofs/fstar/extraction/Hacspec_concordium.Constants.fst b/concordium/proofs/fstar/extraction/Hacspec_concordium.Constants.fst deleted file mode 100644 index 94654f3..0000000 --- a/concordium/proofs/fstar/extraction/Hacspec_concordium.Constants.fst +++ /dev/null @@ -1,9 +0,0 @@ -module Hacspec_concordium.Constants -#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" -open Core - -let v_MAX_CONTRACT_STATE_SIZE: u32 = 16384ul - -let v_MAX_LOG_SIZE: usize = sz 512 - -let v_MAX_NUM_LOGS: usize = sz 64 \ No newline at end of file diff --git a/concordium/proofs/fstar/extraction/Hacspec_concordium.fst b/concordium/proofs/fstar/extraction/Hacspec_concordium.fst deleted file mode 100644 index 9aa4aab..0000000 --- a/concordium/proofs/fstar/extraction/Hacspec_concordium.fst +++ /dev/null @@ -1,5 +0,0 @@ -module Hacspec_concordium -#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" -open Core - -let trap: Rust_primitives.Hax.t_Never = Core.Intrinsics.abort \ No newline at end of file diff --git a/wCCD/Cargo.toml b/wCCD/Cargo.toml deleted file mode 100644 index 1e00da2..0000000 --- a/wCCD/Cargo.toml +++ /dev/null @@ -1,33 +0,0 @@ -[package] -name = "hacspec-wccd" -version = "0.1.0" -authors = [""] -edition = "2018" - -[lib] -path = "src/wccd.rs" - -[dependencies] -# hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } -hax-lib-macros = { path = "../../hacspec-v2/hax-lib-macros/" } -# hax-lib-macros = { git = "https://github.com/hacspec/hacspec-v2.git" } -# creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "1cca2320e262b2ec9d28b3c84cba759c96829898" } # branch = master -# concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850" , version = "=2.0.0" , default-features = false } # 0cffb859f736ff6726fa38600428a415d800d7b6 - -# concordium-std = { git = "https://github.com/Concordium/concordium-rust-smart-contracts", rev = "4d4b024b547a1f120f6d6951cbc409c94f8f146a" , version = "*" , default-features = false } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a -# concordium-std-derive = { git = "https://github.com/Concordium/concordium-rust-smart-contracts", rev = "4d4b024b547a1f120f6d6951cbc409c94f8f146a" , version = "*" , default-features = false } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a - -concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850", version = "=2.0.0", default-features = false } - -hacspec-concordium = { path = "../concordium" } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a -hacspec-concordium-derive = { path = "../concordium-derive" } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a - -[features] -hax_compilation = [] - -[dev-dependencies] -# hacspec-dev = { path = "../../utils/dev" } -criterion = "0.3" -rand = "0.8" -quickcheck = "1" -quickcheck_macros = "1" diff --git a/wCCD/proofs/ssprove/extraction/Hacspec_wccd.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd.v deleted file mode 100644 index 7b02091..0000000 --- a/wCCD/proofs/ssprove/extraction/Hacspec_wccd.v +++ /dev/null @@ -1,846 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -Require Import Cis1. -Export Cis1. - -Require Import Concordium_contracts_common. -Export Concordium_contracts_common. - -Require Import Map. -Export Map. - -Require Import Set. -Export Set. - -Notation "'t_ContractTokenId'" := (t_TokenIdUnit). - -Equations v_TOKEN_ID_WCCD {L : {fset Location}} {I : Interface} : both L I (t_TokenIdUnit) := - v_TOKEN_ID_WCCD := - TokenIdUnit : both L I (t_TokenIdUnit). -Fail Next Obligation. - -Equations v_TOKEN_METADATA_URL {L : {fset Location}} {I : Interface} : both L I (chString) := - v_TOKEN_METADATA_URL := - solve_lift (ret_both (https://some.example/token/wccd : chString)) : both L I (chString). -Fail Next Obligation. - -Definition t_AddressState : choice_type := - (int64 × t_HashSet (t_Address) (t_BuildHasherDefault (t_FnvHasher)) (t_Global)). -Equations f_balance {L : {fset Location}} {I : Interface} (s : both L I (t_AddressState)) : both L I (int64) := - f_balance s := - bind_both s (fun x => - solve_lift (ret_both (fst x : int64))) : both L I (int64). -Fail Next Obligation. -Equations f_operators {L : {fset Location}} {I : Interface} (s : both L I (t_AddressState)) : both L I (t_HashSet (t_Address) (t_BuildHasherDefault (t_FnvHasher)) (t_Global)) := - f_operators s := - bind_both s (fun x => - solve_lift (ret_both (snd x : t_HashSet (t_Address) (t_BuildHasherDefault (t_FnvHasher)) (t_Global)))) : both L I (t_HashSet (t_Address) (t_BuildHasherDefault (t_FnvHasher)) (t_Global)). -Fail Next Obligation. -Equations Build_t_AddressState {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_balance : both L0 I0 (int64)} {f_operators : both L1 I1 (t_HashSet (t_Address) (t_BuildHasherDefault (t_FnvHasher)) (t_Global))} : both (L0:|:L1) (I0:|:I1) (t_AddressState) := - Build_t_AddressState := - bind_both f_operators (fun f_operators => - bind_both f_balance (fun f_balance => - solve_lift (ret_both ((f_balance,f_operators) : (t_AddressState))))) : both (L0:|:L1) (I0:|:I1) (t_AddressState). -Fail Next Obligation. -Notation "'Build_t_AddressState' '[' x ']' '(' 'f_balance' ':=' y ')'" := (Build_t_AddressState (f_balance := y) (f_operators := f_operators x)). -Notation "'Build_t_AddressState' '[' x ']' '(' 'f_operators' ':=' y ')'" := (Build_t_AddressState (f_balance := f_balance x) (f_operators := y)). - -Definition t_State : choice_type := - (t_HashMap (t_Address) (t_AddressState) (t_BuildHasherDefault (t_FnvHasher)) (t_Global)). -Equations f_token {L : {fset Location}} {I : Interface} (s : both L I (t_State)) : both L I (t_HashMap (t_Address) (t_AddressState) (t_BuildHasherDefault (t_FnvHasher)) (t_Global)) := - f_token s := - bind_both s (fun x => - solve_lift (ret_both (x : t_HashMap (t_Address) (t_AddressState) (t_BuildHasherDefault (t_FnvHasher)) (t_Global)))) : both L I (t_HashMap (t_Address) (t_AddressState) (t_BuildHasherDefault (t_FnvHasher)) (t_Global)). -Fail Next Obligation. -Equations Build_t_State {L0 : {fset Location}} {I0 : Interface} {f_token : both L0 I0 (t_HashMap (t_Address) (t_AddressState) (t_BuildHasherDefault (t_FnvHasher)) (t_Global))} : both L0 I0 (t_State) := - Build_t_State := - bind_both f_token (fun f_token => - solve_lift (ret_both ((f_token) : (t_State)))) : both L0 I0 (t_State). -Fail Next Obligation. -Notation "'Build_t_State' '[' x ']' '(' 'f_token' ':=' y ')'" := (Build_t_State (f_token := y)). - -Definition t_UnwrapParams : choice_type := - (int64 × t_Address × t_Receiver × t_AdditionalData). -Equations f_amount {L : {fset Location}} {I : Interface} (s : both L I (t_UnwrapParams)) : both L I (int64) := - f_amount s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst x)) : int64))) : both L I (int64). -Fail Next Obligation. -Equations f_owner {L : {fset Location}} {I : Interface} (s : both L I (t_UnwrapParams)) : both L I (t_Address) := - f_owner s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : t_Address))) : both L I (t_Address). -Fail Next Obligation. -Equations f_receiver {L : {fset Location}} {I : Interface} (s : both L I (t_UnwrapParams)) : both L I (t_Receiver) := - f_receiver s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : t_Receiver))) : both L I (t_Receiver). -Fail Next Obligation. -Equations f_data {L : {fset Location}} {I : Interface} (s : both L I (t_UnwrapParams)) : both L I (t_AdditionalData) := - f_data s := - bind_both s (fun x => - solve_lift (ret_both (snd x : t_AdditionalData))) : both L I (t_AdditionalData). -Fail Next Obligation. -Equations Build_t_UnwrapParams {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {f_amount : both L0 I0 (int64)} {f_owner : both L1 I1 (t_Address)} {f_receiver : both L2 I2 (t_Receiver)} {f_data : both L3 I3 (t_AdditionalData)} : both (L0:|:L1:|:L2:|:L3) (I0:|:I1:|:I2:|:I3) (t_UnwrapParams) := - Build_t_UnwrapParams := - bind_both f_data (fun f_data => - bind_both f_receiver (fun f_receiver => - bind_both f_owner (fun f_owner => - bind_both f_amount (fun f_amount => - solve_lift (ret_both ((f_amount,f_owner,f_receiver,f_data) : (t_UnwrapParams))))))) : both (L0:|:L1:|:L2:|:L3) (I0:|:I1:|:I2:|:I3) (t_UnwrapParams). -Fail Next Obligation. -Notation "'Build_t_UnwrapParams' '[' x ']' '(' 'f_amount' ':=' y ')'" := (Build_t_UnwrapParams (f_amount := y) (f_owner := f_owner x) (f_receiver := f_receiver x) (f_data := f_data x)). -Notation "'Build_t_UnwrapParams' '[' x ']' '(' 'f_owner' ':=' y ')'" := (Build_t_UnwrapParams (f_amount := f_amount x) (f_owner := y) (f_receiver := f_receiver x) (f_data := f_data x)). -Notation "'Build_t_UnwrapParams' '[' x ']' '(' 'f_receiver' ':=' y ')'" := (Build_t_UnwrapParams (f_amount := f_amount x) (f_owner := f_owner x) (f_receiver := y) (f_data := f_data x)). -Notation "'Build_t_UnwrapParams' '[' x ']' '(' 'f_data' ':=' y ')'" := (Build_t_UnwrapParams (f_amount := f_amount x) (f_owner := f_owner x) (f_receiver := f_receiver x) (f_data := y)). - -Definition t_WrapParams : choice_type := - (t_Receiver × t_AdditionalData). -Equations f_to {L : {fset Location}} {I : Interface} (s : both L I (t_WrapParams)) : both L I (t_Receiver) := - f_to s := - bind_both s (fun x => - solve_lift (ret_both (fst x : t_Receiver))) : both L I (t_Receiver). -Fail Next Obligation. -Equations f_data {L : {fset Location}} {I : Interface} (s : both L I (t_WrapParams)) : both L I (t_AdditionalData) := - f_data s := - bind_both s (fun x => - solve_lift (ret_both (snd x : t_AdditionalData))) : both L I (t_AdditionalData). -Fail Next Obligation. -Equations Build_t_WrapParams {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_to : both L0 I0 (t_Receiver)} {f_data : both L1 I1 (t_AdditionalData)} : both (L0:|:L1) (I0:|:I1) (t_WrapParams) := - Build_t_WrapParams := - bind_both f_data (fun f_data => - bind_both f_to (fun f_to => - solve_lift (ret_both ((f_to,f_data) : (t_WrapParams))))) : both (L0:|:L1) (I0:|:I1) (t_WrapParams). -Fail Next Obligation. -Notation "'Build_t_WrapParams' '[' x ']' '(' 'f_to' ':=' y ')'" := (Build_t_WrapParams (f_to := y) (f_data := f_data x)). -Notation "'Build_t_WrapParams' '[' x ']' '(' 'f_data' ':=' y ')'" := (Build_t_WrapParams (f_to := f_to x) (f_data := y)). - -Definition t_CustomContractError : choice_type := - chFin (mkpos 3). -Equations CustomContractError_ParseParams {L : {fset Location}} {I : Interface} : both L I t_CustomContractError := - CustomContractError_ParseParams := - solve_lift ret_both (fintype.Ordinal (n:=3) (m:=0) eq_refl : t_CustomContractError) : both L I t_CustomContractError. -Fail Next Obligation. -Equations CustomContractError_LogFull {L : {fset Location}} {I : Interface} : both L I t_CustomContractError := - CustomContractError_LogFull := - solve_lift ret_both (fintype.Ordinal (n:=3) (m:=1) eq_refl : t_CustomContractError) : both L I t_CustomContractError. -Fail Next Obligation. -Equations CustomContractError_LogMalformed {L : {fset Location}} {I : Interface} : both L I t_CustomContractError := - CustomContractError_LogMalformed := - solve_lift ret_both (fintype.Ordinal (n:=3) (m:=2) eq_refl : t_CustomContractError) : both L I t_CustomContractError. -Fail Next Obligation. - -#[global] Program Instance t_CustomContractError_t_From : t_From t_CustomContractError t_ParseError := - let f_from := fun {L1 : {fset Location}} {I1 : Interface} (fe : both L1 I1 (t_ParseError)) => CustomContractError_ParseParams : both (L1 :|: fset []) I1 (t_CustomContractError) in - {| f_from_loc := (fset [] : {fset Location}); - f_from := (@f_from)|}. -Fail Next Obligation. -Hint Unfold t_CustomContractError_t_From. - -Notation "'t_ContractError'" := (t_Cis1Error (t_CustomContractError)). - -Definition t_ContractResult {v_A : _} `{ t_Sized (v_A)} : choice_type := - t_Result (v_A) (t_Cis1Error (t_CustomContractError)). - -#[global] Program Instance t_CustomContractError_t_From : t_From t_CustomContractError t_LogError := - let f_from := fun {L1 : {fset Location}} {I1 : Interface} (le : both L1 I1 (t_LogError)) => solve_lift matchb le with - | LogError_Full => - CustomContractError_LogFull - | LogError_Malformed => - CustomContractError_LogMalformed - end : both (L1 :|: fset []) I1 (t_CustomContractError) in - {| f_from_loc := (fset [] : {fset Location}); - f_from := (@f_from)|}. -Fail Next Obligation. -Hint Unfold t_CustomContractError_t_From. - -#[global] Program Instance t_Cis1Error (t_CustomContractError)_t_From : t_From t_Cis1Error (t_CustomContractError) t_CustomContractError := - let f_from := fun {L1 : {fset Location}} {I1 : Interface} (c : both L1 I1 (t_CustomContractError)) => Cis1Error_Custom (solve_lift c) : both (L1 :|: fset []) I1 (t_Cis1Error (t_CustomContractError)) in - {| f_from_loc := (fset [] : {fset Location}); - f_from := (@f_from)|}. -Fail Next Obligation. -Hint Unfold t_Cis1Error (t_CustomContractError)_t_From. - -Equations new {L : {fset Location}} {I : Interface} : both L I (t_State) := - new := - solve_lift (Build_t_State (f_token := f_default)) : both L I (t_State). -Fail Next Obligation. - -Equations balance {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_State)) (token_id : both L2 I2 (t_TokenIdUnit)) (address : both L3 I3 (t_Address)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_Result (int64) (t_Cis1Error (t_CustomContractError))) := - balance self token_id address := - Result_Ok (solve_lift (unwrap_or (map (get (f_token self) address) (fun s => - f_balance s)) (ret_both (0 : int64)))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_Result (int64) (t_Cis1Error (t_CustomContractError))). -Fail Next Obligation. - -Equations is_operator {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_State)) (address : both L2 I2 (t_Address)) (owner : both L3 I3 (t_Address)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) ('bool) := - is_operator self address owner := - solve_lift (unwrap_or (map (get (f_token self) owner) (fun address_state => - contains (f_operators address_state) address)) (ret_both (false : 'bool))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) ('bool). -Fail Next Obligation. - -Equations transfer {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} (self : both L1 I1 (t_State)) (token_id : both L2 I2 (t_TokenIdUnit)) (amount : both L3 I3 (int64)) (from : both L4 I4 (t_Address)) (to : both L5 I5 (t_Address)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5) (I1 :|: I2 :|: I3 :|: I4 :|: I5) (t_Result ('unit) (t_Cis1Error (t_CustomContractError))) := - transfer self token_id amount from to := - solve_lift (run (letm[choice_typeMonad.result_bind_code ((t_State × t_Result ('unit) (t_Cis1Error (t_CustomContractError))))] _ := ifb amount =.? (ret_both (0 : int64)) - then letm[choice_typeMonad.result_bind_code ((t_State × t_Result ('unit) (t_Cis1Error (t_CustomContractError))))] hoist85 := v_Break (prod_b (self,Result_Ok (ret_both (tt : 'unit)))) in - ControlFlow_Continue (never_to_any hoist85) - else ControlFlow_Continue (ret_both (tt : 'unit)) in - ControlFlow_Continue (failure (ret_both ((RefMut) The mutation of this &mut is not allowed here. - : chString)) (ret_both ({ - let from_state: &mut hacspec_wccd::t_AddressState = { - (match core::ops::try_trait::f_branch(core::option::ok_or( - hashbrown::map::get_mut(&mut (proj_hacspec_wccd::f_token(self)), &(deref(from))), - hacspec_wccd::cis1::Cis1Error_InsufficientFunds(), - )) { - core::ops::control_flow::ControlFlow_Break(residual) => { - rust_primitives::hax::never_to_any( - (return Tuple2(self, core::ops::try_trait::f_from_residual(residual))), - ) - } - core::ops::control_flow::ControlFlow_Continue(val) => val, - }) - }; - { - let _: tuple0 = { - { - (if core::ops::bit::Not::not(core::cmp::PartialOrd::ge( - proj_hacspec_wccd::f_balance(deref(from_state)), - amount, - )) { - rust_primitives::hax::never_to_any({ - { - (return Tuple2( - self, - core::result::Result_Err( - hacspec_wccd::cis1::Cis1Error_InsufficientFunds(), - ), - )) - } - }) - }) - } - }; - { - let _: tuple0 = { - (deref(from_state).f_balance = core::ops::arith::Sub::sub( - proj_hacspec_wccd::f_balance(deref(from_state)), - amount, - )) - }; - { - let to_state: &mut hacspec_wccd::t_AddressState = { - hashbrown::map::or_insert_with( - hashbrown::map::entry( - &mut (proj_hacspec_wccd::f_token(self)), - deref(to), - ), - (|| hacspec_wccd::AddressState { - f_balance: 0, - f_operators: core::default::f_default(), - }), - ) - }; - { - let _: tuple0 = { - (deref(to_state).f_balance = core::ops::arith::Add::add( - proj_hacspec_wccd::f_balance(deref(to_state)), - amount, - )) - }; - { - let output: core::result::t_Result< - tuple0, - hacspec_wccd::cis1::t_Cis1Error< - hacspec_wccd::t_CustomContractError, - >, - > = { - { - core::result::Result_Ok(Tuple0()) - } - }; - Tuple2(self, output) - } - } - } - } - } - } : chString))))) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5) (I1 :|: I2 :|: I3 :|: I4 :|: I5) (t_Result ('unit) (t_Cis1Error (t_CustomContractError))). -Fail Next Obligation. - -Equations add_operator {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_State)) (owner : both L2 I2 (t_Address)) (operator : both L3 I3 (t_Address)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) ('unit) := - add_operator self owner operator := - solve_lift (failure (ret_both ((RefMut) The mutation of this &mut is not allowed here. - : chString)) (ret_both ({ - let address_state: &mut hacspec_wccd::t_AddressState = { - hashbrown::map::or_insert_with( - hashbrown::map::entry(&mut (proj_hacspec_wccd::f_token(self)), deref(owner)), - (|| hacspec_wccd::AddressState { - f_balance: 0, - f_operators: core::default::f_default(), - }), - ) - }; - { - let _: bool = { - hashbrown::set::insert( - &mut (proj_hacspec_wccd::f_operators(deref(address_state))), - deref(operator), - ) - }; - self - } - } : chString))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) ('unit). -Fail Next Obligation. - -Equations remove_operator {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (self : both L1 I1 (t_State)) (owner : both L2 I2 (t_Address)) (operator : both L3 I3 (t_Address)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_State) := - remove_operator self owner operator := - letb _ := failure (ret_both ((RefMut) Fatal error: something we considered as impossible occurred! Please report this by submitting an issue on GitHub! -Details: expected an arrow type here - : chString)) (ret_both (core::option::map( - hashbrown::map::get_mut(&mut (proj_hacspec_wccd::f_token(self)), &(deref(owner))), - (|address_state| { - hashbrown::set::remove( - &mut (proj_hacspec_wccd::f_operators(deref(address_state))), - &(deref(operator)), - ) - }), - ) : chString)) in - solve_lift self : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_State). -Fail Next Obligation. - -Equations mint {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (self : both L1 I1 (t_State)) (token_id : both L2 I2 (t_TokenIdUnit)) (amount : both L3 I3 (int64)) (owner : both L4 I4 (t_Address)) : both (L1 :|: L2 :|: L3 :|: L4) (I1 :|: I2 :|: I3 :|: I4) (t_Result ('unit) (t_Cis1Error (t_CustomContractError))) := - mint self token_id amount owner := - solve_lift (failure (ret_both ((RefMut) The mutation of this &mut is not allowed here. - : chString)) (ret_both ({ - let address_state: &mut hacspec_wccd::t_AddressState = { - hashbrown::map::or_insert_with( - hashbrown::map::entry(&mut (proj_hacspec_wccd::f_token(self)), deref(owner)), - (|| hacspec_wccd::AddressState { - f_balance: 0, - f_operators: core::default::f_default(), - }), - ) - }; - { - let _: tuple0 = { - (deref(address_state).f_balance = core::ops::arith::Add::add( - proj_hacspec_wccd::f_balance(deref(address_state)), - amount, - )) - }; - { - let output: core::result::t_Result< - tuple0, - hacspec_wccd::cis1::t_Cis1Error, - > = { - { - core::result::Result_Ok(Tuple0()) - } - }; - Tuple2(self, output) - } - } - } : chString))) : both (L1 :|: L2 :|: L3 :|: L4) (I1 :|: I2 :|: I3 :|: I4) (t_Result ('unit) (t_Cis1Error (t_CustomContractError))). -Fail Next Obligation. - -Equations burn {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (self : both L1 I1 (t_State)) (token_id : both L2 I2 (t_TokenIdUnit)) (amount : both L3 I3 (int64)) (owner : both L4 I4 (t_Address)) : both (L1 :|: L2 :|: L3 :|: L4) (I1 :|: I2 :|: I3 :|: I4) (t_Result ('unit) (t_Cis1Error (t_CustomContractError))) := - burn self token_id amount owner := - solve_lift (run (letm[choice_typeMonad.result_bind_code ((t_State × t_Result ('unit) (t_Cis1Error (t_CustomContractError))))] _ := ifb amount =.? (ret_both (0 : int64)) - then letm[choice_typeMonad.result_bind_code ((t_State × t_Result ('unit) (t_Cis1Error (t_CustomContractError))))] hoist86 := v_Break (prod_b (self,Result_Ok (ret_both (tt : 'unit)))) in - ControlFlow_Continue (never_to_any hoist86) - else ControlFlow_Continue (ret_both (tt : 'unit)) in - ControlFlow_Continue (failure (ret_both ((RefMut) The mutation of this &mut is not allowed here. - : chString)) (ret_both ({ - let from_state: &mut hacspec_wccd::t_AddressState = { - (match core::ops::try_trait::f_branch(core::option::ok_or( - hashbrown::map::get_mut(&mut (proj_hacspec_wccd::f_token(self)), &(deref(owner))), - hacspec_wccd::cis1::Cis1Error_InsufficientFunds(), - )) { - core::ops::control_flow::ControlFlow_Break(residual) => { - rust_primitives::hax::never_to_any( - (return Tuple2(self, core::ops::try_trait::f_from_residual(residual))), - ) - } - core::ops::control_flow::ControlFlow_Continue(val) => val, - }) - }; - { - let _: tuple0 = { - { - (if core::ops::bit::Not::not(core::cmp::PartialOrd::ge( - proj_hacspec_wccd::f_balance(deref(from_state)), - amount, - )) { - rust_primitives::hax::never_to_any({ - { - (return Tuple2( - self, - core::result::Result_Err( - hacspec_wccd::cis1::Cis1Error_InsufficientFunds(), - ), - )) - } - }) - }) - } - }; - { - let _: tuple0 = { - (deref(from_state).f_balance = core::ops::arith::Sub::sub( - proj_hacspec_wccd::f_balance(deref(from_state)), - amount, - )) - }; - { - let output: core::result::t_Result< - tuple0, - hacspec_wccd::cis1::t_Cis1Error, - > = { - { - core::result::Result_Ok(Tuple0()) - } - }; - Tuple2(self, output) - } - } - } - } : chString))))) : both (L1 :|: L2 :|: L3 :|: L4) (I1 :|: I2 :|: I3 :|: I4) (t_Result ('unit) (t_Cis1Error (t_CustomContractError))). -Fail Next Obligation. - -Equations contract_init {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {impl_108907986_ : _} {impl_88511815_ : _} `{ t_Sized (impl_108907986_)} `{ t_Sized (impl_88511815_)} `{ t_HasInitContext (impl_108907986_) ('unit)} `{ t_HasLogger (impl_88511815_)} (ctx : both L1 I1 (impl_108907986_)) (logger : both L2 I2 (impl_88511815_)) : both (L1 :|: L2) (I1 :|: I2) ((impl_88511815_ × t_Result (t_State) (t_Reject))) := - contract_init ctx logger := - letb state := new in - letb invoker := Address_Account (f_init_origin ctx) in - letb output := Result_Ok state in - solve_lift (prod_b (logger,output)) : both (L1 :|: L2) (I1 :|: I2) ((impl_88511815_ × t_Result (t_State) (t_Reject))). -Fail Next Obligation. - -Definition state_ret_loc {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} : Location := - (t_State;0%nat). -Equations contract_wrap {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} (ctx : both L1 I1 (impl_574521470_)) (amount : both L2 I2 (t_Amount)) (logger : both L3 I3 (impl_88511815_)) (state : both L4 I4 (t_State)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [state_ret_loc]) (I1 :|: I2 :|: I3 :|: I4) (t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))) := - contract_wrap ctx amount logger state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))] (params:t_WrapParams) := matchb f_branch out with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))] hoist87 := v_Break (f_from_residual residual) in - ControlFlow_Continue (never_to_any hoist87) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - letb sender := f_sender ctx in - letb receive_address := address (f_to params) in - letb '(tmp0,out) := mint state v_TOKEN_ID_WCCD (f_micro_ccd amount) receive_address in - letb state := tmp0 in - letb hoist89 := out in - letb hoist90 := f_branch hoist89 in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))] _ := matchb hoist90 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))] hoist88 := v_Break (f_from_residual residual) in - ControlFlow_Continue (never_to_any hoist88) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb state_ret loc(state_ret_loc) := f_clone state in - matchb f_to params with - | Receiver_Contract address function => - letb parameter := Build_t_OnReceivingCis1Params (f_token_id := v_TOKEN_ID_WCCD) (f_amount := f_micro_ccd amount) (f_from := sender) (f_contract_name := new_unchecked (f_from (ret_both (init_CIS1-wCCD : chString)))) (f_data := f_data params) in - letb param_bytes := to_bytes parameter in - Result_Ok (prod_b (f_send_raw address (as_ref function) zero (f_deref param_bytes),state_ret)) - | _ => - Result_Ok (prod_b (f_accept,state_ret)) - end))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [state_ret_loc]) (I1 :|: I2 :|: I3 :|: I4) (t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))). -Fail Next Obligation. - -Definition state_ret_loc {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} : Location := - (t_State;1%nat). -Equations contract_unwrap {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} (ctx : both L1 I1 (impl_574521470_)) (logger : both L2 I2 (impl_88511815_)) (state : both L3 I3 (t_State)) : both (L1 :|: L2 :|: L3 :|: fset [state_ret_loc]) (I1 :|: I2 :|: I3) ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))) := - contract_unwrap ctx logger state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] (params:t_UnwrapParams) := matchb f_branch out with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] hoist91 := v_Break (prod_b (logger,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist91) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - letb sender := f_sender ctx in - letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] _ := ifb not (orb (sender =.? (f_owner params)) (is_operator state sender (f_owner params))) - then letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] hoist92 := v_Break (prod_b (logger,Result_Err Cis1Error_Unauthorized)) in - ControlFlow_Continue (never_to_any hoist92) - else ControlFlow_Continue (ret_both (tt : 'unit)) in - letb '(tmp0,out) := burn state v_TOKEN_ID_WCCD (f_amount params) (f_owner params) in - letb state := tmp0 in - letb hoist94 := out in - letb hoist95 := f_branch hoist94 in - letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] _ := matchb hoist95 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] hoist93 := v_Break (prod_b (logger,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist93) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb unwrapped_amount := from_micro_ccd (f_amount params) in - letb action := matchb f_receiver params with - | Receiver_Account address => - f_simple_transfer address unwrapped_amount - | Receiver_Contract address function => - f_send_raw address (as_ref function) unwrapped_amount (f_as_ref (f_data params)) - end in - letb state_ret loc(state_ret_loc) := f_clone state in - letb output := Result_Ok (prod_b (action,state_ret)) in - prod_b (logger,output)))) : both (L1 :|: L2 :|: L3 :|: fset [state_ret_loc]) (I1 :|: I2 :|: I3) ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))). -Fail Next Obligation. - -Notation "'t_TransferParameter'" := (t_TransferParams (t_TokenIdUnit)). - -Definition actions_loc {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} : Location := - (v_A;2%nat). -Definition cursor_loc {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} : Location := - (f_ParamType;3%nat). -Definition state_ret_loc {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} : Location := - (t_State;4%nat). -Equations contract_transfer {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} (ctx : both L1 I1 (impl_574521470_)) (logger : both L2 I2 (impl_88511815_)) (state : both L3 I3 (t_State)) : both (L1 :|: L2 :|: L3 :|: fset [actions_loc;cursor_loc;state_ret_loc]) (I1 :|: I2 :|: I3) ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))) := - contract_transfer ctx logger state := - solve_lift (run (letb cursor loc(cursor_loc) := f_parameter_cursor ctx in - letb '(tmp0,out) := f_get cursor in - letb cursor := tmp0 in - letb hoist97 := out in - letb hoist98 := f_branch hoist97 in - letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] (transfers_length:int8) := matchb hoist98 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] hoist96 := v_Break (prod_b (logger,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist96) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb sender := f_sender ctx in - letb actions loc(actions_loc) := f_accept in - letb '(actions,cursor,state) := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int8)) (f_end := transfers_length))) (fun _ => - ssp (fun '(actions,cursor,state) => - letb '(tmp0,out) := f_get cursor in - letb cursor := tmp0 in - letb hoist100 := out in - letb hoist101 := f_branch hoist100 in - letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] {| - f_token_id := token_id; - f_amount := amount; - f_from := from; - f_to := to; - f_data := data; - |} := matchb hoist101 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] hoist99 := v_Break (prod_b (logger,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist99) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] _ := ifb not (orb (from =.? sender) (is_operator state sender from)) - then letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] hoist102 := v_Break (prod_b (logger,Result_Err Cis1Error_Unauthorized)) in - ControlFlow_Continue (never_to_any hoist102) - else ControlFlow_Continue (ret_both (tt : 'unit)) in - letb to_address := address to in - letb '(tmp0,out) := transfer state token_id amount from to_address in - letb state := tmp0 in - letb hoist104 := out in - letb hoist105 := f_branch hoist104 in - letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] _ := matchb hoist105 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] hoist103 := v_Break (prod_b (logger,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist103) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (solve_lift matchb to with - | Receiver_Contract address function => - letb parameter := Build_t_OnReceivingCis1Params (f_token_id := token_id) (f_amount := amount) (f_from := from) (f_contract_name := new_unchecked (f_from (ret_both (init_CIS1-Multi : chString)))) (f_data := data) in - letb action := f_accept in - letb actions := f_and_then actions action in - prod_b (actions,cursor,state) - | _ => - prod_b (actions,cursor,state) - end) : both (*5*)(L1:|:L2:|:L3:|:L1:|:L2:|:L1:|:L3:|:fset [actions_loc;cursor_loc;cursor_loc;actions_loc;cursor_loc]) (I1:|:I2:|:I3:|:I1:|:I2:|:I1:|:I3) (t_ControlFlow ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))) ((v_A × f_ParamType × t_State))))) (prod_b (actions,cursor,state)) in - letb state_ret loc(state_ret_loc) := f_clone state in - letb output := Result_Ok (prod_b (actions,state_ret)) in - prod_b (logger,output)))) : both (L1 :|: L2 :|: L3 :|: fset [actions_loc;cursor_loc;state_ret_loc]) (I1 :|: I2 :|: I3) ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))). -Fail Next Obligation. - -Definition state_ret_loc {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} : Location := - (t_State;5%nat). -Equations contract_update_operator {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} (ctx : both L1 I1 (impl_574521470_)) (logger : both L2 I2 (impl_88511815_)) (state : both L3 I3 (t_State)) : both (L1 :|: L2 :|: L3 :|: fset [state_ret_loc]) (I1 :|: I2 :|: I3) ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))) := - contract_update_operator ctx logger state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] UpdateOperatorParams params := matchb f_branch out with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError))))] hoist106 := v_Break (prod_b (logger,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist106) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb sender := f_sender ctx in - letb state := foldi_both_list (f_into_iter params) (fun param => - ssp (fun state => - solve_lift matchb f_update param with - | OperatorUpdate_Add => - add_operator state sender (f_operator param) - | OperatorUpdate_Remove => - remove_operator state sender (f_operator param) - end : both (*0*)(L1:|:L2:|:L3:|:L1:|:L2:|:L3:|:fset []) (I1:|:I2:|:I3:|:I1:|:I2:|:I3) (t_State))) state in - letb state_ret loc(state_ret_loc) := f_clone state in - letb output := Result_Ok (prod_b (f_accept,state_ret)) in - prod_b (logger,output)))) : both (L1 :|: L2 :|: L3 :|: fset [state_ret_loc]) (I1 :|: I2 :|: I3) ((impl_88511815_ × t_Result ((v_A × t_State)) (t_Cis1Error (t_CustomContractError)))). -Fail Next Obligation. - -Notation "'t_ContractBalanceOfQueryParams'" := (t_BalanceOfQueryParams (t_TokenIdUnit)). - -Equations contract_balance_of {L : {fset Location}} {I : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : both L I (t_Never) := - contract_balance_of := - solve_lift (failure (ret_both ((AST import) Fatal error: something we considered as impossible occurred! Please report this by submitting an issue on GitHub! -Details: [import_thir:literal] got an error literal: this means the Rust compiler or Hax's frontend probably reported errors above. - : chString)) (ret_both ({ Types.attributes = []; - contents = - Types.Literal { - lit = - { Types.node = Types.Err; - span = - { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/wccd.rs")); - hi = { Types.col = "0"; line = "1" }; - lo = { Types.col = "0"; line = "1" } } - }; - neg = false}; - hir_id = None; - span = - { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/wccd.rs")); - hi = { Types.col = "61"; line = "540" }; - lo = { Types.col = "0"; line = "537" } }; - ty = Types.Never } : chString))) : both L I (t_Never). -Fail Next Obligation. - -Equations contract_operator_of {L : {fset Location}} {I : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : both L I (t_Never) := - contract_operator_of := - solve_lift (failure (ret_both ((AST import) Fatal error: something we considered as impossible occurred! Please report this by submitting an issue on GitHub! -Details: [import_thir:literal] got an error literal: this means the Rust compiler or Hax's frontend probably reported errors above. - : chString)) (ret_both ({ Types.attributes = []; - contents = - Types.Literal { - lit = - { Types.node = Types.Err; - span = - { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/wccd.rs")); - hi = { Types.col = "0"; line = "1" }; - lo = { Types.col = "0"; line = "1" } } - }; - neg = false}; - hir_id = None; - span = - { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/wccd.rs")); - hi = { Types.col = "61"; line = "580" }; - lo = { Types.col = "0"; line = "577" } }; - ty = Types.Never } : chString))) : both L I (t_Never). -Fail Next Obligation. - -Notation "'t_ContractTokenMetadataQueryParams'" := (t_TokenMetadataQueryParams (t_TokenIdUnit)). - -Equations contract_token_metadata {L : {fset Location}} {I : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : both L I (t_Never) := - contract_token_metadata := - solve_lift (failure (ret_both ((AST import) Fatal error: something we considered as impossible occurred! Please report this by submitting an issue on GitHub! -Details: [import_thir:literal] got an error literal: this means the Rust compiler or Hax's frontend probably reported errors above. - : chString)) (ret_both ({ Types.attributes = []; - contents = - Types.Literal { - lit = - { Types.node = Types.Err; - span = - { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/wccd.rs")); - hi = { Types.col = "0"; line = "1" }; - lo = { Types.col = "0"; line = "1" } } - }; - neg = false}; - hir_id = None; - span = - { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/wccd.rs")); - hi = { Types.col = "61"; line = "623" }; - lo = { Types.col = "0"; line = "620" } }; - ty = Types.Never } : chString))) : both L I (t_Never). -Fail Next Obligation. - -(** Concert lib part **) -From ConCert.Utils Require Import Extras. -Export Extras. -From ConCert.Utils Require Import Automation. -Export Automation. -From ConCert.Execution Require Import Serializable. -Export Serializable. -From ConCert.Execution Require Import Blockchain. -Export Blockchain. -From ConCert.Execution Require Import ContractCommon. -Export ContractCommon. -From ConCert.Execution Require Import Serializable. -Export Serializable. -Require Import ConCertLib. -Export ConCertLib. - -Definition state_CIS1-wCCD : choice_type := - t_State. - -Definition init_CIS1-wCCD (chain : Chain) (ctx : ContractCallContext) (st : state_CIS1-wCCD) : ResultMonad.result (state_CIS1-wCCD) (t_ParseError) := - ResultMonad.Ok st. - -#[global] Program Instance t_WrapParams_t_HasReceiveContext : t_HasReceiveContext t_WrapParams 'unit := - {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_WrapParams_t_Sized : t_Sized t_WrapParams := - {| Sized := (fun (x : _) => x : _)|}. -Fail Next Obligation. -Definition receive_CIS1-wCCD_wrap {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_WrapParams)) (st : both L1 I1 (state_CIS1-wCCD)) : both _ _ (t_Result ((v_A × state_CIS1-wCCD)) (t_ParseError)) := - contract_wrap ctx st. - -#[global] Program Instance t_UnwrapParams_t_HasReceiveContext : t_HasReceiveContext t_UnwrapParams 'unit := - {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_UnwrapParams_t_Sized : t_Sized t_UnwrapParams := - {| Sized := (fun (x : _) => x : _)|}. -Fail Next Obligation. -Definition receive_CIS1-wCCD_unwrap {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_UnwrapParams)) (st : both L1 I1 (state_CIS1-wCCD)) : both _ _ (t_Result ((v_A × state_CIS1-wCCD)) (t_ParseError)) := - contract_unwrap ctx st. - -#[global] Program Instance t_TransferParameter_t_HasReceiveContext : t_HasReceiveContext t_TransferParameter 'unit := - {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_TransferParameter_t_Sized : t_Sized t_TransferParameter := - {| Sized := (fun (x : _) => x : _)|}. -Fail Next Obligation. -Definition receive_CIS1-wCCD_transfer {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_TransferParameter)) (st : both L1 I1 (state_CIS1-wCCD)) : both _ _ (t_Result ((v_A × state_CIS1-wCCD)) (t_ParseError)) := - contract_transfer ctx st. - -#[global] Program Instance t_UpdateOperatorParams_t_HasReceiveContext : t_HasReceiveContext t_UpdateOperatorParams 'unit := - {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_UpdateOperatorParams_t_Sized : t_Sized t_UpdateOperatorParams := - {| Sized := (fun (x : _) => x : _)|}. -Fail Next Obligation. -Definition receive_CIS1-wCCD_updateOperator {v_A : _} {impl_574521470_ : _} {impl_88511815_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Sized (impl_88511815_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} `{ t_HasLogger (impl_88511815_)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_UpdateOperatorParams)) (st : both L1 I1 (state_CIS1-wCCD)) : both _ _ (t_Result ((v_A × state_CIS1-wCCD)) (t_ParseError)) := - contract_update_operator ctx st. - -#[global] Program Instance t_ContractBalanceOfQueryParams_t_HasReceiveContext : t_HasReceiveContext t_ContractBalanceOfQueryParams 'unit := - {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_ContractBalanceOfQueryParams_t_Sized : t_Sized t_ContractBalanceOfQueryParams := - {| Sized := (fun (x : _) => x : _)|}. -Fail Next Obligation. -Definition receive_CIS1-wCCD_balanceOf {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_ContractBalanceOfQueryParams)) (st : both L1 I1 (state_CIS1-wCCD)) : both _ _ (t_Result ((v_A × state_CIS1-wCCD)) (t_ParseError)) := - contract_balance_of ctx st. - -#[global] Program Instance t_OperatorOfQueryParams_t_HasReceiveContext : t_HasReceiveContext t_OperatorOfQueryParams 'unit := - {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_OperatorOfQueryParams_t_Sized : t_Sized t_OperatorOfQueryParams := - {| Sized := (fun (x : _) => x : _)|}. -Fail Next Obligation. -Definition receive_CIS1-wCCD_operatorOf {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_OperatorOfQueryParams)) (st : both L1 I1 (state_CIS1-wCCD)) : both _ _ (t_Result ((v_A × state_CIS1-wCCD)) (t_ParseError)) := - contract_operator_of ctx st. - -#[global] Program Instance t_ContractTokenMetadataQueryParams_t_HasReceiveContext : t_HasReceiveContext t_ContractTokenMetadataQueryParams 'unit := - {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_ContractTokenMetadataQueryParams_t_Sized : t_Sized t_ContractTokenMetadataQueryParams := - {| Sized := (fun (x : _) => x : _)|}. -Fail Next Obligation. -Definition receive_CIS1-wCCD_tokenMetadata {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_ContractTokenMetadataQueryParams)) (st : both L1 I1 (state_CIS1-wCCD)) : both _ _ (t_Result ((v_A × state_CIS1-wCCD)) (t_ParseError)) := - contract_token_metadata ctx st. - -Inductive Msg_CIS1-wCCD: Type := -| msg_CIS1-wCCD_wrap : t_WrapParams -> Msg_CIS1-wCCD -| msg_CIS1-wCCD_unwrap : t_UnwrapParams -> Msg_CIS1-wCCD -| msg_CIS1-wCCD_transfer : t_TransferParameter -> Msg_CIS1-wCCD -| msg_CIS1-wCCD_updateOperator : t_UpdateOperatorParams -> Msg_CIS1-wCCD -| msg_CIS1-wCCD_balanceOf : t_ContractBalanceOfQueryParams -> Msg_CIS1-wCCD -| msg_CIS1-wCCD_operatorOf : t_OperatorOfQueryParams -> Msg_CIS1-wCCD -| msg_CIS1-wCCD_tokenMetadata : t_ContractTokenMetadataQueryParams -> Msg_CIS1-wCCD. -#[global] Program Instance state_CIS1-wCCD_t_HasReceiveContext : t_HasReceiveContext state_CIS1-wCCD 'unit := - {| get := (fun (x : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result x t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance state_CIS1-wCCD_t_Sized : t_Sized state_CIS1-wCCD := - {| Sized := (fun (x : _) => x : _)|}. -Fail Next Obligation. -#[global] Program Instance state_CIS1-wCCD_t_HasActions : t_HasActions state_CIS1-wCCD := - _. -Fail Next Obligation. -Equations receive_CIS1-wCCD (chain : Chain) (ctx : ContractCallContext) (st : state_CIS1-wCCD) (msg : Datatypes.option Msg_CIS1-wCCD) : ResultMonad.result (state_CIS1-wCCD * list ActionBody) t_ParseError := - receive_CIS1-wCCD chain ctx st msg := - matchb msg with - | Some (msg_CIS1-wCCD_wrap val) => - match (is_pure (both_prog (receive_CIS1-wCCD_wrap (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_CIS1-wCCD_unwrap val) => - match (is_pure (both_prog (receive_CIS1-wCCD_unwrap (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_CIS1-wCCD_transfer val) => - match (is_pure (both_prog (receive_CIS1-wCCD_transfer (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_CIS1-wCCD_updateOperator val) => - match (is_pure (both_prog (receive_CIS1-wCCD_updateOperator (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_CIS1-wCCD_balanceOf val) => - match (is_pure (both_prog (receive_CIS1-wCCD_balanceOf (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_CIS1-wCCD_operatorOf val) => - match (is_pure (both_prog (receive_CIS1-wCCD_operatorOf (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_CIS1-wCCD_tokenMetadata val) => - match (is_pure (both_prog (receive_CIS1-wCCD_tokenMetadata (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | _ => - ResultMonad.Err tt - end : ResultMonad.result (state_CIS1-wCCD * list ActionBody) t_ParseError. -Fail Next Obligation. -#[global] Program Instance state_CIS1-wCCD_Serializable : Serializable state_CIS1-wCCD := - _. -Fail Next Obligation. -#[global] Program Instance Msg_CIS1-wCCD_Serializable : Serializable Msg_CIS1-wCCD := - Derive Serializable Msg_OVN_rect. -Fail Next Obligation. -Definition contract_CIS1-wCCD : Contract (state_CIS1-wCCD) (Msg_CIS1-wCCD) (state_CIS1-wCCD) (t_ParseError) := - build_contract init_CIS1-wCCD receive_CIS1-wCCD. diff --git a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Cis1.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Cis1.v deleted file mode 100644 index 6d1d45b..0000000 --- a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Cis1.v +++ /dev/null @@ -1,1881 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Hacspec_concordium. -Export Hacspec_concordium. - -Require Import Box. -Export Box. - -Require Import TryFrom. -Export TryFrom. - -Require Import NonZeroI32. -Export NonZeroI32. - -Equations v_TRANSFER_EVENT_TAG {L : {fset Location}} {I : Interface} : both L I (int8) := - v_TRANSFER_EVENT_TAG := - solve_lift (ret_both (255 : int8)) : both L I (int8). -Fail Next Obligation. - -Equations v_MINT_EVENT_TAG {L : {fset Location}} {I : Interface} : both L I (int8) := - v_MINT_EVENT_TAG := - solve_lift ((ret_both (255 : int8)) .- (ret_both (1 : int8))) : both L I (int8). -Fail Next Obligation. - -Equations v_BURN_EVENT_TAG {L : {fset Location}} {I : Interface} : both L I (int8) := - v_BURN_EVENT_TAG := - solve_lift ((ret_both (255 : int8)) .- (ret_both (2 : int8))) : both L I (int8). -Fail Next Obligation. - -Equations v_UPDATE_OPERATOR_EVENT_TAG {L : {fset Location}} {I : Interface} : both L I (int8) := - v_UPDATE_OPERATOR_EVENT_TAG := - solve_lift ((ret_both (255 : int8)) .- (ret_both (3 : int8))) : both L I (int8). -Fail Next Obligation. - -Equations v_TOKEN_METADATA_EVENT_TAG {L : {fset Location}} {I : Interface} : both L I (int8) := - v_TOKEN_METADATA_EVENT_TAG := - solve_lift ((ret_both (255 : int8)) .- (ret_both (4 : int8))) : both L I (int8). -Fail Next Obligation. - -Notation "'t_Sha256'" := (nseq int8 32). - -Definition t_MetadataUrl : choice_type := - (t_String × t_Option (nseq int8 32)). -Equations f_url {L : {fset Location}} {I : Interface} (s : both L I (t_MetadataUrl)) : both L I (t_String) := - f_url s := - bind_both s (fun x => - solve_lift (ret_both (fst x : t_String))) : both L I (t_String). -Fail Next Obligation. -Equations f_hash {L : {fset Location}} {I : Interface} (s : both L I (t_MetadataUrl)) : both L I (t_Option (nseq int8 32)) := - f_hash s := - bind_both s (fun x => - solve_lift (ret_both (snd x : t_Option (nseq int8 32)))) : both L I (t_Option (nseq int8 32)). -Fail Next Obligation. -Equations Build_t_MetadataUrl {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_url : both L0 I0 (t_String)} {f_hash : both L1 I1 (t_Option (nseq int8 32))} : both (L0:|:L1) (I0:|:I1) (t_MetadataUrl) := - Build_t_MetadataUrl := - bind_both f_hash (fun f_hash => - bind_both f_url (fun f_url => - solve_lift (ret_both ((f_url,f_hash) : (t_MetadataUrl))))) : both (L0:|:L1) (I0:|:I1) (t_MetadataUrl). -Fail Next Obligation. -Notation "'Build_t_MetadataUrl' '[' x ']' '(' 'f_url' ':=' y ')'" := (Build_t_MetadataUrl (f_url := y) (f_hash := f_hash x)). -Notation "'Build_t_MetadataUrl' '[' x ']' '(' 'f_hash' ':=' y ')'" := (Build_t_MetadataUrl (f_url := f_url x) (f_hash := y)). - -Class t_IsTokenId (Self : choice_type) := { -}. - -Definition t_TokenIdVec : choice_type := - (t_Vec (int8) (t_Global)). -Equations 0 {L : {fset Location}} {I : Interface} (s : both L I (t_TokenIdVec)) : both L I (t_Vec (int8) (t_Global)) := - 0 s := - bind_both s (fun x => - solve_lift (ret_both (x : t_Vec (int8) (t_Global)))) : both L I (t_Vec (int8) (t_Global)). -Fail Next Obligation. -Equations Build_t_TokenIdVec {L0 : {fset Location}} {I0 : Interface} {0 : both L0 I0 (t_Vec (int8) (t_Global))} : both L0 I0 (t_TokenIdVec) := - Build_t_TokenIdVec := - bind_both 0 (fun 0 => - solve_lift (ret_both ((0) : (t_TokenIdVec)))) : both L0 I0 (t_TokenIdVec). -Fail Next Obligation. -Notation "'Build_t_TokenIdVec' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_TokenIdVec (0 := y)). - -#[global] Program Instance t_TokenIdVec_t_IsTokenId : t_IsTokenId t_TokenIdVec := - _. -Fail Next Obligation. -Hint Unfold t_TokenIdVec_t_IsTokenId. - -#[global] Program Instance t_TokenIdVec_t_SchemaType : t_SchemaType t_TokenIdVec := - let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_List SizeLength_U8 Type_U8 : both (L :|: fset []) I (t_Type) in - {| f_get_type_loc := (fset [] : {fset Location}); - f_get_type := (@f_get_type)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdVec_t_SchemaType. - -Definition t_TokenIdFixed {v_N : both (fset []) (fset []) (uint_size)} : choice_type := - (nseq int8 (is_pure (v_N))). -Equations 0 {L : {fset Location}} {I : Interface} {v_N : both (fset []) (fset []) (uint_size)} (s : both L I (t_TokenIdFixed)) : both L I (nseq int8 (is_pure (v_N))) := - 0 s := - bind_both s (fun x => - solve_lift (ret_both (x : nseq int8 (is_pure (v_N))))) : both L I (nseq int8 (is_pure (v_N))). -Fail Next Obligation. -Equations Build_t_TokenIdFixed {L0 : {fset Location}} {I0 : Interface} {v_N : both (fset []) (fset []) (uint_size)} {0 : both L0 I0 (nseq int8 (is_pure (v_N)))} : both L0 I0 (t_TokenIdFixed) := - Build_t_TokenIdFixed := - bind_both 0 (fun 0 => - solve_lift (ret_both ((0) : (t_TokenIdFixed)))) : both L0 I0 (t_TokenIdFixed). -Fail Next Obligation. -Notation "'Build_t_TokenIdFixed' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_TokenIdFixed (0 := y)). - -#[global] Program Instance t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_IsTokenId {v_N : both (fset []) (fset []) (uint_size)} : t_IsTokenId t_TokenIdFixed (both (fset []) (fset []) (uint_size)) := - _. -Fail Next Obligation. -Hint Unfold t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_IsTokenId. - -#[global] Program Instance t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_SchemaType {v_N : both (fset []) (fset []) (uint_size)} : t_SchemaType t_TokenIdFixed (both (fset []) (fset []) (uint_size)) := - let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_List SizeLength_U8 Type_U8 : both (L :|: fset []) I (t_Type) in - {| f_get_type_loc := (fset [] : {fset Location}); - f_get_type := (@f_get_type)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_SchemaType. - -#[global] Program Instance t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_From {v_N : both (fset []) (fset []) (uint_size)} : t_From t_TokenIdFixed (both (fset []) (fset []) (uint_size)) nseq int8 (is_pure (v_N)) := - let f_from := fun {L1 : {fset Location}} {I1 : Interface} (id : both L1 I1 (nseq int8 (is_pure (v_N)))) => TokenIdFixed (solve_lift id) : both (L1 :|: fset []) I1 (t_TokenIdFixed (both (fset []) (fset []) (uint_size))) in - {| f_from_loc := (fset [] : {fset Location}); - f_from := (@f_from)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_From. - -#[global] Program Instance t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_Serial {v_N : both (fset []) (fset []) (uint_size)} : t_Serial t_TokenIdFixed (both (fset []) (fset []) (uint_size)) := - let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_TokenIdFixed (both (fset []) (fset []) (uint_size)))) (out : both L2 I2 (v_W)) => solve_lift (run (letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] len := matchb f_branch (map_err (f_try_from v_N) (fun _ => - f_default)) with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist1 := v_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist1) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - letb '(tmp0,out) := f_write_u8 out len in - letb out := tmp0 in - letb hoist3 := out in - letb hoist4 := f_branch hoist3 in - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist4 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist2 := v_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist2) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb out := foldi_both_list (f_into_iter (0 self)) (fun byte => - ssp (fun out => - letb '(tmp0,out) := f_write_u8 out byte in - letb out := tmp0 in - letb hoist6 := out in - letb hoist7 := f_branch hoist6 in - solve_lift matchb hoist7 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist5 := v_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue out - | ControlFlow_Continue val => - ControlFlow_Continue out - end : both (*0*)(L1:|:L2:|:L1:|:L2:|:fset []) (I1:|:I2:|:I1:|:I2) (t_ControlFlow ((v_W × t_Result ('unit) (f_Err))) (v_W)))) out in - letb output := Result_Ok (ret_both (tt : 'unit)) in - prod_b (out,output)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in - {| f_serial_loc := (fset [] : {fset Location}); - f_serial := (@f_serial)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_Serial. - -#[global] Program Instance t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_Deserial {v_N : both (fset []) (fset []) (uint_size)} : t_Deserial t_TokenIdFixed (both (fset []) (fset []) (uint_size)) := - let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (source : both L1 I1 (v_R)) => solve_lift (run (letb '(tmp0,out) := f_read_u8 source in - letb source := tmp0 in - letb hoist9 := out in - letb hoist10 := f_branch hoist9 in - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdFixed (both (fset []) (fset []) (uint_size))) (t_ParseError)))] byte_length := ControlFlow_Continue matchb hoist10 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdFixed (both (fset []) (fset []) (uint_size))) (t_ParseError)))] hoist8 := v_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist8) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdFixed (both (fset []) (fset []) (uint_size))) (t_ParseError)))] _ := ControlFlow_Continue (ifb (f_from byte_length) <> v_N - then letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdFixed (both (fset []) (fset []) (uint_size))) (t_ParseError)))] hoist11 := v_Break (prod_b (source,Result_Err f_default)) in - ControlFlow_Continue (never_to_any hoist11) - else ControlFlow_Continue (ret_both (tt : 'unit))) in - letb '(tmp0,out) := f_get source in - letb source := tmp0 in - letb hoist13 := out in - letb hoist14 := f_branch hoist13 in - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdFixed (both (fset []) (fset []) (uint_size))) (t_ParseError)))] (bytes:nseq int8 (is_pure (v_N))) := matchb hoist14 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdFixed (both (fset []) (fset []) (uint_size))) (t_ParseError)))] hoist12 := v_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist12) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb output := Result_Ok (TokenIdFixed bytes) in - prod_b (source,output)))) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_TokenIdFixed (both (fset []) (fset []) (uint_size))) (t_ParseError))) in - {| f_deserial_loc := (fset [] : {fset Location}); - f_deserial := (@f_deserial)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdFixed (both (fset []) (fset []) (uint_size))_t_Deserial. - -Definition t_TokenIdU64 : choice_type := - (int64). -Equations 0 {L : {fset Location}} {I : Interface} (s : both L I (t_TokenIdU64)) : both L I (int64) := - 0 s := - bind_both s (fun x => - solve_lift (ret_both (x : int64))) : both L I (int64). -Fail Next Obligation. -Equations Build_t_TokenIdU64 {L0 : {fset Location}} {I0 : Interface} {0 : both L0 I0 (int64)} : both L0 I0 (t_TokenIdU64) := - Build_t_TokenIdU64 := - bind_both 0 (fun 0 => - solve_lift (ret_both ((0) : (t_TokenIdU64)))) : both L0 I0 (t_TokenIdU64). -Fail Next Obligation. -Notation "'Build_t_TokenIdU64' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_TokenIdU64 (0 := y)). - -#[global] Program Instance t_TokenIdU64_t_IsTokenId : t_IsTokenId t_TokenIdU64 := - _. -Fail Next Obligation. -Hint Unfold t_TokenIdU64_t_IsTokenId. - -#[global] Program Instance t_TokenIdU64_t_SchemaType : t_SchemaType t_TokenIdU64 := - let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_List SizeLength_U8 Type_U8 : both (L :|: fset []) I (t_Type) in - {| f_get_type_loc := (fset [] : {fset Location}); - f_get_type := (@f_get_type)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdU64_t_SchemaType. - -#[global] Program Instance t_TokenIdU64_t_From : t_From t_TokenIdU64 int64 := - let f_from := fun {L1 : {fset Location}} {I1 : Interface} (id : both L1 I1 (int64)) => TokenIdU64 (solve_lift id) : both (L1 :|: fset []) I1 (t_TokenIdU64) in - {| f_from_loc := (fset [] : {fset Location}); - f_from := (@f_from)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdU64_t_From. - -#[global] Program Instance t_TokenIdU64_t_Serial : t_Serial t_TokenIdU64 := - let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_TokenIdU64)) (out : both L2 I2 (v_W)) => solve_lift (run (letb '(tmp0,out) := f_write_u8 out (ret_both (8 : int8)) in - letb out := tmp0 in - letb hoist16 := out in - letb hoist17 := f_branch hoist16 in - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist17 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist15 := v_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist15) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb '(tmp0,out) := f_write_u64 out (0 self) in - letb out := tmp0 in - letb output := out in - prod_b (out,output)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in - {| f_serial_loc := (fset [] : {fset Location}); - f_serial := (@f_serial)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdU64_t_Serial. - -#[global] Program Instance t_TokenIdU64_t_Deserial : t_Deserial t_TokenIdU64 := - let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (source : both L1 I1 (v_R)) => solve_lift (run (letb '(tmp0,out) := f_read_u8 source in - letb source := tmp0 in - letb hoist19 := out in - letb hoist20 := f_branch hoist19 in - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU64) (t_ParseError)))] byte_length := matchb hoist20 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU64) (t_ParseError)))] hoist18 := v_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist18) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU64) (t_ParseError)))] '(source,output) := ifb byte_length =.? (ret_both (8 : int8)) - then letb '(tmp0,out) := f_read_u64 source in - letb source := tmp0 in - letb hoist22 := out in - letb hoist23 := f_branch hoist22 in - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU64) (t_ParseError)))] hoist24 := matchb hoist23 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU64) (t_ParseError)))] hoist21 := v_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist21) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb hoist25 := TokenIdU64 hoist24 in - prod_b (source,Result_Ok hoist25)) - else ControlFlow_Continue (prod_b (source,Result_Err f_default)) in - ControlFlow_Continue (prod_b (source,output)))) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_TokenIdU64) (t_ParseError))) in - {| f_deserial_loc := (fset [] : {fset Location}); - f_deserial := (@f_deserial)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdU64_t_Deserial. - -Definition t_TokenIdU32 : choice_type := - (int32). -Equations 0 {L : {fset Location}} {I : Interface} (s : both L I (t_TokenIdU32)) : both L I (int32) := - 0 s := - bind_both s (fun x => - solve_lift (ret_both (x : int32))) : both L I (int32). -Fail Next Obligation. -Equations Build_t_TokenIdU32 {L0 : {fset Location}} {I0 : Interface} {0 : both L0 I0 (int32)} : both L0 I0 (t_TokenIdU32) := - Build_t_TokenIdU32 := - bind_both 0 (fun 0 => - solve_lift (ret_both ((0) : (t_TokenIdU32)))) : both L0 I0 (t_TokenIdU32). -Fail Next Obligation. -Notation "'Build_t_TokenIdU32' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_TokenIdU32 (0 := y)). - -#[global] Program Instance t_TokenIdU32_t_IsTokenId : t_IsTokenId t_TokenIdU32 := - _. -Fail Next Obligation. -Hint Unfold t_TokenIdU32_t_IsTokenId. - -#[global] Program Instance t_TokenIdU32_t_SchemaType : t_SchemaType t_TokenIdU32 := - let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_List SizeLength_U8 Type_U8 : both (L :|: fset []) I (t_Type) in - {| f_get_type_loc := (fset [] : {fset Location}); - f_get_type := (@f_get_type)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdU32_t_SchemaType. - -#[global] Program Instance t_TokenIdU32_t_From : t_From t_TokenIdU32 int32 := - let f_from := fun {L1 : {fset Location}} {I1 : Interface} (id : both L1 I1 (int32)) => TokenIdU32 (solve_lift id) : both (L1 :|: fset []) I1 (t_TokenIdU32) in - {| f_from_loc := (fset [] : {fset Location}); - f_from := (@f_from)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdU32_t_From. - -#[global] Program Instance t_TokenIdU32_t_Serial : t_Serial t_TokenIdU32 := - let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_TokenIdU32)) (out : both L2 I2 (v_W)) => solve_lift (run (letb '(tmp0,out) := f_write_u8 out (ret_both (4 : int8)) in - letb out := tmp0 in - letb hoist27 := out in - letb hoist28 := f_branch hoist27 in - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist28 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist26 := v_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist26) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb '(tmp0,out) := f_write_u32 out (0 self) in - letb out := tmp0 in - letb output := out in - prod_b (out,output)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in - {| f_serial_loc := (fset [] : {fset Location}); - f_serial := (@f_serial)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdU32_t_Serial. - -#[global] Program Instance t_TokenIdU32_t_Deserial : t_Deserial t_TokenIdU32 := - let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (source : both L1 I1 (v_R)) => solve_lift (run (letb '(tmp0,out) := f_read_u8 source in - letb source := tmp0 in - letb hoist30 := out in - letb hoist31 := f_branch hoist30 in - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU32) (t_ParseError)))] byte_length := matchb hoist31 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU32) (t_ParseError)))] hoist29 := v_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist29) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU32) (t_ParseError)))] '(source,output) := ifb byte_length =.? (ret_both (4 : int8)) - then letb '(tmp0,out) := f_read_u32 source in - letb source := tmp0 in - letb hoist33 := out in - letb hoist34 := f_branch hoist33 in - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU32) (t_ParseError)))] hoist35 := matchb hoist34 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU32) (t_ParseError)))] hoist32 := v_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist32) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb hoist36 := TokenIdU32 hoist35 in - prod_b (source,Result_Ok hoist36)) - else ControlFlow_Continue (prod_b (source,Result_Err f_default)) in - ControlFlow_Continue (prod_b (source,output)))) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_TokenIdU32) (t_ParseError))) in - {| f_deserial_loc := (fset [] : {fset Location}); - f_deserial := (@f_deserial)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdU32_t_Deserial. - -Definition t_TokenIdU16 : choice_type := - (int16). -Equations 0 {L : {fset Location}} {I : Interface} (s : both L I (t_TokenIdU16)) : both L I (int16) := - 0 s := - bind_both s (fun x => - solve_lift (ret_both (x : int16))) : both L I (int16). -Fail Next Obligation. -Equations Build_t_TokenIdU16 {L0 : {fset Location}} {I0 : Interface} {0 : both L0 I0 (int16)} : both L0 I0 (t_TokenIdU16) := - Build_t_TokenIdU16 := - bind_both 0 (fun 0 => - solve_lift (ret_both ((0) : (t_TokenIdU16)))) : both L0 I0 (t_TokenIdU16). -Fail Next Obligation. -Notation "'Build_t_TokenIdU16' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_TokenIdU16 (0 := y)). - -#[global] Program Instance t_TokenIdU16_t_IsTokenId : t_IsTokenId t_TokenIdU16 := - _. -Fail Next Obligation. -Hint Unfold t_TokenIdU16_t_IsTokenId. - -#[global] Program Instance t_TokenIdU16_t_SchemaType : t_SchemaType t_TokenIdU16 := - let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_List SizeLength_U8 Type_U8 : both (L :|: fset []) I (t_Type) in - {| f_get_type_loc := (fset [] : {fset Location}); - f_get_type := (@f_get_type)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdU16_t_SchemaType. - -#[global] Program Instance t_TokenIdU16_t_From : t_From t_TokenIdU16 int16 := - let f_from := fun {L1 : {fset Location}} {I1 : Interface} (id : both L1 I1 (int16)) => TokenIdU16 (solve_lift id) : both (L1 :|: fset []) I1 (t_TokenIdU16) in - {| f_from_loc := (fset [] : {fset Location}); - f_from := (@f_from)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdU16_t_From. - -#[global] Program Instance t_TokenIdU16_t_Serial : t_Serial t_TokenIdU16 := - let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_TokenIdU16)) (out : both L2 I2 (v_W)) => solve_lift (run (letb '(tmp0,out) := f_write_u8 out (ret_both (2 : int8)) in - letb out := tmp0 in - letb hoist38 := out in - letb hoist39 := f_branch hoist38 in - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist39 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist37 := v_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist37) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb '(tmp0,out) := f_write_u16 out (0 self) in - letb out := tmp0 in - letb output := out in - prod_b (out,output)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in - {| f_serial_loc := (fset [] : {fset Location}); - f_serial := (@f_serial)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdU16_t_Serial. - -#[global] Program Instance t_TokenIdU16_t_Deserial : t_Deserial t_TokenIdU16 := - let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (source : both L1 I1 (v_R)) => solve_lift (run (letb '(tmp0,out) := f_read_u8 source in - letb source := tmp0 in - letb hoist41 := out in - letb hoist42 := f_branch hoist41 in - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU16) (t_ParseError)))] byte_length := matchb hoist42 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU16) (t_ParseError)))] hoist40 := v_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist40) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU16) (t_ParseError)))] '(source,output) := ifb byte_length =.? (ret_both (2 : int8)) - then letb '(tmp0,out) := f_read_u16 source in - letb source := tmp0 in - letb hoist44 := out in - letb hoist45 := f_branch hoist44 in - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU16) (t_ParseError)))] hoist46 := matchb hoist45 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU16) (t_ParseError)))] hoist43 := v_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist43) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb hoist47 := TokenIdU16 hoist46 in - prod_b (source,Result_Ok hoist47)) - else ControlFlow_Continue (prod_b (source,Result_Err f_default)) in - ControlFlow_Continue (prod_b (source,output)))) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_TokenIdU16) (t_ParseError))) in - {| f_deserial_loc := (fset [] : {fset Location}); - f_deserial := (@f_deserial)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdU16_t_Deserial. - -Definition t_TokenIdU8 : choice_type := - (int8). -Equations 0 {L : {fset Location}} {I : Interface} (s : both L I (t_TokenIdU8)) : both L I (int8) := - 0 s := - bind_both s (fun x => - solve_lift (ret_both (x : int8))) : both L I (int8). -Fail Next Obligation. -Equations Build_t_TokenIdU8 {L0 : {fset Location}} {I0 : Interface} {0 : both L0 I0 (int8)} : both L0 I0 (t_TokenIdU8) := - Build_t_TokenIdU8 := - bind_both 0 (fun 0 => - solve_lift (ret_both ((0) : (t_TokenIdU8)))) : both L0 I0 (t_TokenIdU8). -Fail Next Obligation. -Notation "'Build_t_TokenIdU8' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_TokenIdU8 (0 := y)). - -#[global] Program Instance t_TokenIdU8_t_IsTokenId : t_IsTokenId t_TokenIdU8 := - _. -Fail Next Obligation. -Hint Unfold t_TokenIdU8_t_IsTokenId. - -#[global] Program Instance t_TokenIdU8_t_SchemaType : t_SchemaType t_TokenIdU8 := - let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_List SizeLength_U8 Type_U8 : both (L :|: fset []) I (t_Type) in - {| f_get_type_loc := (fset [] : {fset Location}); - f_get_type := (@f_get_type)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdU8_t_SchemaType. - -#[global] Program Instance t_TokenIdU8_t_From : t_From t_TokenIdU8 int8 := - let f_from := fun {L1 : {fset Location}} {I1 : Interface} (id : both L1 I1 (int8)) => TokenIdU8 (solve_lift id) : both (L1 :|: fset []) I1 (t_TokenIdU8) in - {| f_from_loc := (fset [] : {fset Location}); - f_from := (@f_from)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdU8_t_From. - -#[global] Program Instance t_TokenIdU8_t_Serial : t_Serial t_TokenIdU8 := - let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_TokenIdU8)) (out : both L2 I2 (v_W)) => solve_lift (run (letb '(tmp0,out) := f_write_u8 out (ret_both (1 : int8)) in - letb out := tmp0 in - letb hoist49 := out in - letb hoist50 := f_branch hoist49 in - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist50 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist48 := v_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist48) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb '(tmp0,out) := f_write_u8 out (0 self) in - letb out := tmp0 in - letb output := out in - prod_b (out,output)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in - {| f_serial_loc := (fset [] : {fset Location}); - f_serial := (@f_serial)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdU8_t_Serial. - -#[global] Program Instance t_TokenIdU8_t_Deserial : t_Deserial t_TokenIdU8 := - let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (source : both L1 I1 (v_R)) => solve_lift (run (letb '(tmp0,out) := f_read_u8 source in - letb source := tmp0 in - letb hoist52 := out in - letb hoist53 := f_branch hoist52 in - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU8) (t_ParseError)))] byte_length := matchb hoist53 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU8) (t_ParseError)))] hoist51 := v_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist51) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU8) (t_ParseError)))] '(source,output) := ifb byte_length =.? (ret_both (1 : int8)) - then letb '(tmp0,out) := f_read_u8 source in - letb source := tmp0 in - letb hoist55 := out in - letb hoist56 := f_branch hoist55 in - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU8) (t_ParseError)))] hoist57 := matchb hoist56 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdU8) (t_ParseError)))] hoist54 := v_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist54) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb hoist58 := TokenIdU8 hoist57 in - prod_b (source,Result_Ok hoist58)) - else ControlFlow_Continue (prod_b (source,Result_Err f_default)) in - ControlFlow_Continue (prod_b (source,output)))) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_TokenIdU8) (t_ParseError))) in - {| f_deserial_loc := (fset [] : {fset Location}); - f_deserial := (@f_deserial)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdU8_t_Deserial. - -Definition t_TokenIdUnit : choice_type := - 'unit. -Equations Build_t_TokenIdUnit : both (fset []) (fset []) (t_TokenIdUnit) := - Build_t_TokenIdUnit := - solve_lift (ret_both ((_) : (t_TokenIdUnit))) : both (fset []) (fset []) (t_TokenIdUnit). -Fail Next Obligation. - -#[global] Program Instance t_TokenIdUnit_t_IsTokenId : t_IsTokenId t_TokenIdUnit := - _. -Fail Next Obligation. -Hint Unfold t_TokenIdUnit_t_IsTokenId. - -#[global] Program Instance t_TokenIdUnit_t_SchemaType : t_SchemaType t_TokenIdUnit := - let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_List SizeLength_U8 Type_U8 : both (L :|: fset []) I (t_Type) in - {| f_get_type_loc := (fset [] : {fset Location}); - f_get_type := (@f_get_type)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdUnit_t_SchemaType. - -#[global] Program Instance t_TokenIdUnit_t_Serial : t_Serial t_TokenIdUnit := - let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_TokenIdUnit)) (out : both L2 I2 (v_W)) => letb '(tmp0,out) := f_write_u8 out (ret_both (0 : int8)) in - letb out := tmp0 in - letb output := out in - solve_lift (prod_b (out,output)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in - {| f_serial_loc := (fset [] : {fset Location}); - f_serial := (@f_serial)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdUnit_t_Serial. - -#[global] Program Instance t_TokenIdUnit_t_Deserial : t_Deserial t_TokenIdUnit := - let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (source : both L1 I1 (v_R)) => solve_lift (run (letb '(tmp0,out) := f_read_u8 source in - letb source := tmp0 in - letb hoist60 := out in - letb hoist61 := f_branch hoist60 in - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdUnit) (t_ParseError)))] byte_length := matchb hoist61 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_TokenIdUnit) (t_ParseError)))] hoist59 := v_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist59) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb output := ifb byte_length =.? (ret_both (0 : int8)) - then Result_Ok TokenIdUnit - else Result_Err f_default in - prod_b (source,output)))) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_TokenIdUnit) (t_ParseError))) in - {| f_deserial_loc := (fset [] : {fset Location}); - f_deserial := (@f_deserial)|}. -Fail Next Obligation. -Hint Unfold t_TokenIdUnit_t_Deserial. - -Notation "'t_TokenAmount'" := (int64). - -Definition t_TransferEvent {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := - (v_T × int64 × t_Address × t_Address). -Equations f_token_id {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TransferEvent)) : both L I (v_T) := - f_token_id s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst x)) : v_T))) : both L I (v_T). -Fail Next Obligation. -Equations f_amount {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TransferEvent)) : both L I (int64) := - f_amount s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : int64))) : both L I (int64). -Fail Next Obligation. -Equations f_from {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TransferEvent)) : both L I (t_Address) := - f_from s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : t_Address))) : both L I (t_Address). -Fail Next Obligation. -Equations f_to {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TransferEvent)) : both L I (t_Address) := - f_to s := - bind_both s (fun x => - solve_lift (ret_both (snd x : t_Address))) : both L I (t_Address). -Fail Next Obligation. -Equations Build_t_TransferEvent {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {f_token_id : both L0 I0 (v_T)} {f_amount : both L1 I1 (int64)} {f_from : both L2 I2 (t_Address)} {f_to : both L3 I3 (t_Address)} : both (L0:|:L1:|:L2:|:L3) (I0:|:I1:|:I2:|:I3) (t_TransferEvent) := - Build_t_TransferEvent := - bind_both f_to (fun f_to => - bind_both f_from (fun f_from => - bind_both f_amount (fun f_amount => - bind_both f_token_id (fun f_token_id => - solve_lift (ret_both ((f_token_id,f_amount,f_from,f_to) : (t_TransferEvent))))))) : both (L0:|:L1:|:L2:|:L3) (I0:|:I1:|:I2:|:I3) (t_TransferEvent). -Fail Next Obligation. -Notation "'Build_t_TransferEvent' '[' x ']' '(' 'f_token_id' ':=' y ')'" := (Build_t_TransferEvent (f_token_id := y) (f_amount := f_amount x) (f_from := f_from x) (f_to := f_to x)). -Notation "'Build_t_TransferEvent' '[' x ']' '(' 'f_amount' ':=' y ')'" := (Build_t_TransferEvent (f_token_id := f_token_id x) (f_amount := y) (f_from := f_from x) (f_to := f_to x)). -Notation "'Build_t_TransferEvent' '[' x ']' '(' 'f_from' ':=' y ')'" := (Build_t_TransferEvent (f_token_id := f_token_id x) (f_amount := f_amount x) (f_from := y) (f_to := f_to x)). -Notation "'Build_t_TransferEvent' '[' x ']' '(' 'f_to' ':=' y ')'" := (Build_t_TransferEvent (f_token_id := f_token_id x) (f_amount := f_amount x) (f_from := f_from x) (f_to := y)). - -Definition t_MintEvent {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := - (v_T × int64 × t_Address). -Equations f_token_id {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_MintEvent)) : both L I (v_T) := - f_token_id s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : v_T))) : both L I (v_T). -Fail Next Obligation. -Equations f_amount {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_MintEvent)) : both L I (int64) := - f_amount s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int64))) : both L I (int64). -Fail Next Obligation. -Equations f_owner {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_MintEvent)) : both L I (t_Address) := - f_owner s := - bind_both s (fun x => - solve_lift (ret_both (snd x : t_Address))) : both L I (t_Address). -Fail Next Obligation. -Equations Build_t_MintEvent {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {f_token_id : both L0 I0 (v_T)} {f_amount : both L1 I1 (int64)} {f_owner : both L2 I2 (t_Address)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_MintEvent) := - Build_t_MintEvent := - bind_both f_owner (fun f_owner => - bind_both f_amount (fun f_amount => - bind_both f_token_id (fun f_token_id => - solve_lift (ret_both ((f_token_id,f_amount,f_owner) : (t_MintEvent)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_MintEvent). -Fail Next Obligation. -Notation "'Build_t_MintEvent' '[' x ']' '(' 'f_token_id' ':=' y ')'" := (Build_t_MintEvent (f_token_id := y) (f_amount := f_amount x) (f_owner := f_owner x)). -Notation "'Build_t_MintEvent' '[' x ']' '(' 'f_amount' ':=' y ')'" := (Build_t_MintEvent (f_token_id := f_token_id x) (f_amount := y) (f_owner := f_owner x)). -Notation "'Build_t_MintEvent' '[' x ']' '(' 'f_owner' ':=' y ')'" := (Build_t_MintEvent (f_token_id := f_token_id x) (f_amount := f_amount x) (f_owner := y)). - -Definition t_BurnEvent {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := - (v_T × int64 × t_Address). -Equations f_token_id {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_BurnEvent)) : both L I (v_T) := - f_token_id s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : v_T))) : both L I (v_T). -Fail Next Obligation. -Equations f_amount {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_BurnEvent)) : both L I (int64) := - f_amount s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int64))) : both L I (int64). -Fail Next Obligation. -Equations f_owner {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_BurnEvent)) : both L I (t_Address) := - f_owner s := - bind_both s (fun x => - solve_lift (ret_both (snd x : t_Address))) : both L I (t_Address). -Fail Next Obligation. -Equations Build_t_BurnEvent {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {f_token_id : both L0 I0 (v_T)} {f_amount : both L1 I1 (int64)} {f_owner : both L2 I2 (t_Address)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_BurnEvent) := - Build_t_BurnEvent := - bind_both f_owner (fun f_owner => - bind_both f_amount (fun f_amount => - bind_both f_token_id (fun f_token_id => - solve_lift (ret_both ((f_token_id,f_amount,f_owner) : (t_BurnEvent)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_BurnEvent). -Fail Next Obligation. -Notation "'Build_t_BurnEvent' '[' x ']' '(' 'f_token_id' ':=' y ')'" := (Build_t_BurnEvent (f_token_id := y) (f_amount := f_amount x) (f_owner := f_owner x)). -Notation "'Build_t_BurnEvent' '[' x ']' '(' 'f_amount' ':=' y ')'" := (Build_t_BurnEvent (f_token_id := f_token_id x) (f_amount := y) (f_owner := f_owner x)). -Notation "'Build_t_BurnEvent' '[' x ']' '(' 'f_owner' ':=' y ')'" := (Build_t_BurnEvent (f_token_id := f_token_id x) (f_amount := f_amount x) (f_owner := y)). - -Definition t_OperatorUpdate : choice_type := - chFin (mkpos 2). -Equations OperatorUpdate_Remove {L : {fset Location}} {I : Interface} : both L I t_OperatorUpdate := - OperatorUpdate_Remove := - solve_lift ret_both (fintype.Ordinal (n:=2) (m:=0) eq_refl : t_OperatorUpdate) : both L I t_OperatorUpdate. -Fail Next Obligation. -Equations OperatorUpdate_Add {L : {fset Location}} {I : Interface} : both L I t_OperatorUpdate := - OperatorUpdate_Add := - solve_lift ret_both (fintype.Ordinal (n:=2) (m:=1) eq_refl : t_OperatorUpdate) : both L I t_OperatorUpdate. -Fail Next Obligation. - -Definition t_UpdateOperatorEvent : choice_type := - (t_OperatorUpdate × t_Address × t_Address). -Equations f_update {L : {fset Location}} {I : Interface} (s : both L I (t_UpdateOperatorEvent)) : both L I (t_OperatorUpdate) := - f_update s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : t_OperatorUpdate))) : both L I (t_OperatorUpdate). -Fail Next Obligation. -Equations f_owner {L : {fset Location}} {I : Interface} (s : both L I (t_UpdateOperatorEvent)) : both L I (t_Address) := - f_owner s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : t_Address))) : both L I (t_Address). -Fail Next Obligation. -Equations f_operator {L : {fset Location}} {I : Interface} (s : both L I (t_UpdateOperatorEvent)) : both L I (t_Address) := - f_operator s := - bind_both s (fun x => - solve_lift (ret_both (snd x : t_Address))) : both L I (t_Address). -Fail Next Obligation. -Equations Build_t_UpdateOperatorEvent {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_update : both L0 I0 (t_OperatorUpdate)} {f_owner : both L1 I1 (t_Address)} {f_operator : both L2 I2 (t_Address)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_UpdateOperatorEvent) := - Build_t_UpdateOperatorEvent := - bind_both f_operator (fun f_operator => - bind_both f_owner (fun f_owner => - bind_both f_update (fun f_update => - solve_lift (ret_both ((f_update,f_owner,f_operator) : (t_UpdateOperatorEvent)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_UpdateOperatorEvent). -Fail Next Obligation. -Notation "'Build_t_UpdateOperatorEvent' '[' x ']' '(' 'f_update' ':=' y ')'" := (Build_t_UpdateOperatorEvent (f_update := y) (f_owner := f_owner x) (f_operator := f_operator x)). -Notation "'Build_t_UpdateOperatorEvent' '[' x ']' '(' 'f_owner' ':=' y ')'" := (Build_t_UpdateOperatorEvent (f_update := f_update x) (f_owner := y) (f_operator := f_operator x)). -Notation "'Build_t_UpdateOperatorEvent' '[' x ']' '(' 'f_operator' ':=' y ')'" := (Build_t_UpdateOperatorEvent (f_update := f_update x) (f_owner := f_owner x) (f_operator := y)). - -Definition t_TokenMetadataEvent {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := - (v_T × t_MetadataUrl). -Equations f_token_id {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TokenMetadataEvent)) : both L I (v_T) := - f_token_id s := - bind_both s (fun x => - solve_lift (ret_both (fst x : v_T))) : both L I (v_T). -Fail Next Obligation. -Equations f_metadata_url {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TokenMetadataEvent)) : both L I (t_MetadataUrl) := - f_metadata_url s := - bind_both s (fun x => - solve_lift (ret_both (snd x : t_MetadataUrl))) : both L I (t_MetadataUrl). -Fail Next Obligation. -Equations Build_t_TokenMetadataEvent {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {f_token_id : both L0 I0 (v_T)} {f_metadata_url : both L1 I1 (t_MetadataUrl)} : both (L0:|:L1) (I0:|:I1) (t_TokenMetadataEvent) := - Build_t_TokenMetadataEvent := - bind_both f_metadata_url (fun f_metadata_url => - bind_both f_token_id (fun f_token_id => - solve_lift (ret_both ((f_token_id,f_metadata_url) : (t_TokenMetadataEvent))))) : both (L0:|:L1) (I0:|:I1) (t_TokenMetadataEvent). -Fail Next Obligation. -Notation "'Build_t_TokenMetadataEvent' '[' x ']' '(' 'f_token_id' ':=' y ')'" := (Build_t_TokenMetadataEvent (f_token_id := y) (f_metadata_url := f_metadata_url x)). -Notation "'Build_t_TokenMetadataEvent' '[' x ']' '(' 'f_metadata_url' ':=' y ')'" := (Build_t_TokenMetadataEvent (f_token_id := f_token_id x) (f_metadata_url := y)). - -Definition t_Cis1Event {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := - chFin (mkpos 5). -Equations Cis1Event_Transfer {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_TransferEvent (v_T) (both L I t_Cis1Event) := - Cis1Event_Transfer := - solve_lift ret_both (fintype.Ordinal (n:=5) (m:=0) eq_refl : t_Cis1Event) : t_TransferEvent (v_T) (both L I t_Cis1Event). -Fail Next Obligation. -Equations Cis1Event_Mint {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_MintEvent (v_T) (both L I t_Cis1Event) := - Cis1Event_Mint := - solve_lift ret_both (fintype.Ordinal (n:=5) (m:=1) eq_refl : t_Cis1Event) : t_MintEvent (v_T) (both L I t_Cis1Event). -Fail Next Obligation. -Equations Cis1Event_Burn {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_BurnEvent (v_T) (both L I t_Cis1Event) := - Cis1Event_Burn := - solve_lift ret_both (fintype.Ordinal (n:=5) (m:=2) eq_refl : t_Cis1Event) : t_BurnEvent (v_T) (both L I t_Cis1Event). -Fail Next Obligation. -Equations Cis1Event_UpdateOperator {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_UpdateOperatorEvent (both L I t_Cis1Event) := - Cis1Event_UpdateOperator := - solve_lift ret_both (fintype.Ordinal (n:=5) (m:=3) eq_refl : t_Cis1Event) : t_UpdateOperatorEvent (both L I t_Cis1Event). -Fail Next Obligation. -Equations Cis1Event_TokenMetadata {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_TokenMetadataEvent (v_T) (both L I t_Cis1Event) := - Cis1Event_TokenMetadata := - solve_lift ret_both (fintype.Ordinal (n:=5) (m:=4) eq_refl : t_Cis1Event) : t_TokenMetadataEvent (v_T) (both L I t_Cis1Event). -Fail Next Obligation. - -#[global] Program Instance t_Cis1Event (v_T)_t_Serial {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_Serial t_Cis1Event (v_T) := - let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Cis1Event (v_T))) (out : both L2 I2 (v_W)) => solve_lift (run (letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] '(out,output) := matchb self with - | Cis1Event_Transfer event => - letb '(tmp0,out) := f_write_u8 out v_TRANSFER_EVENT_TAG in - letb out := tmp0 in - letb hoist63 := out in - letb hoist64 := f_branch hoist63 in - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist64 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist62 := v_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist62) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb '(tmp0,out) := f_serial event out in - letb out := tmp0 in - prod_b (out,out)) - | Cis1Event_Mint event => - letb '(tmp0,out) := f_write_u8 out v_MINT_EVENT_TAG in - letb out := tmp0 in - letb hoist66 := out in - letb hoist67 := f_branch hoist66 in - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist67 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist65 := v_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist65) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb '(tmp0,out) := f_serial event out in - letb out := tmp0 in - prod_b (out,out)) - | Cis1Event_Burn event => - letb '(tmp0,out) := f_write_u8 out v_BURN_EVENT_TAG in - letb out := tmp0 in - letb hoist69 := out in - letb hoist70 := f_branch hoist69 in - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist70 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist68 := v_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist68) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb '(tmp0,out) := f_serial event out in - letb out := tmp0 in - prod_b (out,out)) - | Cis1Event_UpdateOperator event => - letb '(tmp0,out) := f_write_u8 out v_UPDATE_OPERATOR_EVENT_TAG in - letb out := tmp0 in - letb hoist72 := out in - letb hoist73 := f_branch hoist72 in - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist73 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist71 := v_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist71) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb '(tmp0,out) := f_serial event out in - letb out := tmp0 in - prod_b (out,out)) - | Cis1Event_TokenMetadata event => - letb '(tmp0,out) := f_write_u8 out v_TOKEN_METADATA_EVENT_TAG in - letb out := tmp0 in - letb hoist75 := out in - letb hoist76 := f_branch hoist75 in - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] _ := matchb hoist76 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_W × t_Result ('unit) (f_Err)))] hoist74 := v_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist74) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb '(tmp0,out) := f_serial event out in - letb out := tmp0 in - prod_b (out,out)) - end in - ControlFlow_Continue (prod_b (out,output)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in - {| f_serial_loc := (fset [] : {fset Location}); - f_serial := (@f_serial)|}. -Fail Next Obligation. -Hint Unfold t_Cis1Event (v_T)_t_Serial. - -#[global] Program Instance t_Cis1Event (v_T)_t_Deserial {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_Deserial t_Cis1Event (v_T) := - let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (source : both L1 I1 (v_R)) => solve_lift (run (letb '(tmp0,out) := f_read_u8 source in - letb source := tmp0 in - letb hoist78 := out in - letb hoist79 := f_branch hoist78 in - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_Cis1Event (v_T)) (t_ParseError)))] tag := matchb hoist79 with - | ControlFlow_Break residual => - letm[choice_typeMonad.result_bind_code ((v_R × t_Result (t_Cis1Event (v_T)) (t_ParseError)))] hoist77 := v_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist77) - | ControlFlow_Continue val => - ControlFlow_Continue val - end in - ControlFlow_Continue (letb '(source,output) := matchb tag with - | 255 => - letb '(tmp0,out) := f_deserial source in - letb source := tmp0 in - letb hoist80 := out in - prod_b (source,map hoist80 v_Transfer) - | 254 => - letb '(tmp0,out) := f_deserial source in - letb source := tmp0 in - letb hoist81 := out in - prod_b (source,map hoist81 v_Mint) - | 253 => - letb '(tmp0,out) := f_deserial source in - letb source := tmp0 in - letb hoist82 := out in - prod_b (source,map hoist82 v_Burn) - | 252 => - letb '(tmp0,out) := f_deserial source in - letb source := tmp0 in - letb hoist83 := out in - prod_b (source,map hoist83 v_UpdateOperator) - | 251 => - letb '(tmp0,out) := f_deserial source in - letb source := tmp0 in - letb hoist84 := out in - prod_b (source,map hoist84 v_TokenMetadata) - | _ => - prod_b (source,Result_Err f_default) - end in - prod_b (source,output)))) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_Cis1Event (v_T)) (t_ParseError))) in - {| f_deserial_loc := (fset [] : {fset Location}); - f_deserial := (@f_deserial)|}. -Fail Next Obligation. -Hint Unfold t_Cis1Event (v_T)_t_Deserial. - -Definition t_Cis1Error {v_R : _} `{ t_Sized (v_R)} : choice_type := - chFin (mkpos 4). -Equations Cis1Error_InvalidTokenId {L : {fset Location}} {I : Interface} {v_R : _} `{ t_Sized (v_R)} : both L I t_Cis1Error := - Cis1Error_InvalidTokenId := - solve_lift ret_both (fintype.Ordinal (n:=4) (m:=0) eq_refl : t_Cis1Error) : both L I t_Cis1Error. -Fail Next Obligation. -Equations Cis1Error_InsufficientFunds {L : {fset Location}} {I : Interface} {v_R : _} `{ t_Sized (v_R)} : both L I t_Cis1Error := - Cis1Error_InsufficientFunds := - solve_lift ret_both (fintype.Ordinal (n:=4) (m:=1) eq_refl : t_Cis1Error) : both L I t_Cis1Error. -Fail Next Obligation. -Equations Cis1Error_Unauthorized {L : {fset Location}} {I : Interface} {v_R : _} `{ t_Sized (v_R)} : both L I t_Cis1Error := - Cis1Error_Unauthorized := - solve_lift ret_both (fintype.Ordinal (n:=4) (m:=2) eq_refl : t_Cis1Error) : both L I t_Cis1Error. -Fail Next Obligation. -Equations Cis1Error_Custom {L : {fset Location}} {I : Interface} {v_R : _} `{ t_Sized (v_R)} : v_R (both L I t_Cis1Error) := - Cis1Error_Custom := - solve_lift ret_both (fintype.Ordinal (n:=4) (m:=3) eq_refl : t_Cis1Error) : v_R (both L I t_Cis1Error). -Fail Next Obligation. - -#[global] Program Instance t_Reject_t_From {v_R : _} `{ t_Sized (v_R)} `{ t_Into (v_R) (t_Reject)} : t_From t_Reject t_Cis1Error (v_R) := - let f_from := fun {L1 : {fset Location}} {I1 : Interface} (err : both L1 I1 (t_Cis1Error (v_R))) => letb error_code := matchb err with - | Cis1Error_InvalidTokenId => - failure (ret_both ((AST import) Unsafe blocks are not allowed. - : chString)) (ret_both ({ Types.attributes = []; - contents = - Types.Block { - expr = - (Some { Types.attributes = []; - contents = - Types.Call { - args = - [{ Types.attributes = []; - contents = - Types.Literal { - lit = - { Types.node = (Types.Int ("42000001", Types.Unsuffixed)); - span = - { Types.filename = - (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "85"; line = "655" }; - lo = { Types.col = "77"; line = "655" } } - }; - neg = true}; - hir_id = (Some ("104", "17")); - span = - { Types.filename = - (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "85"; line = "655" }; - lo = { Types.col = "76"; line = "655" } }; - ty = (Types.Int Types.I32) } - ]; - fn_span = - { Types.filename = - (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "86"; line = "655" }; - lo = { Types.col = "50"; line = "655" } }; - from_hir_call = true; - fun' = - { Types.attributes = []; - contents = - Types.GlobalName { - id = - { Types.index = (1, 22145); krate = "core"; - path = - [{ Types.data = (Types.TypeNs "num"); disambiguator = 0 }; - { Types.data = (Types.TypeNs "nonzero"); - disambiguator = 0 }; - { Types.data = Types.Impl; disambiguator = 56 }; - { Types.data = (Types.ValueNs "new_unchecked"); - disambiguator = 0 } - ] - }}; - hir_id = None; - span = - { Types.filename = - (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "75"; line = "655" }; - lo = { Types.col = "50"; line = "655" } }; - ty = - (Types.Arrow - { Types.bound_vars = []; - value = - { Types.abi = Types.Abi {todo = "Rust"}; - c_variadic = false; inputs = [(Types.Int Types.I32)]; - output = - Types.Adt { - def_id = - { Types.index = (1, 22484); krate = "core"; - path = - [{ Types.data = (Types.TypeNs "num"); - disambiguator = 0 }; - { Types.data = (Types.TypeNs "nonzero"); - disambiguator = 0 }; - { Types.data = (Types.TypeNs "NonZeroI32"); - disambiguator = 0 } - ] - }; - generic_args = []}; - unsafety = Types.Unsafe } - }) - }; - impl = None; - ty = - (Types.Arrow - { Types.bound_vars = []; - value = - { Types.abi = Types.Abi {todo = "Rust"}; - c_variadic = false; inputs = [(Types.Int Types.I32)]; - output = - Types.Adt { - def_id = - { Types.index = (1, 22484); krate = "core"; - path = - [{ Types.data = (Types.TypeNs "num"); - disambiguator = 0 }; - { Types.data = (Types.TypeNs "nonzero"); - disambiguator = 0 }; - { Types.data = (Types.TypeNs "NonZeroI32"); - disambiguator = 0 } - ] - }; - generic_args = []}; - unsafety = Types.Unsafe } - })}; - hir_id = (Some ("104", "12")); - span = - { Types.filename = - (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "86"; line = "655" }; - lo = { Types.col = "50"; line = "655" } }; - ty = - Types.Adt { - def_id = - { Types.index = (1, 22484); krate = "core"; - path = - [{ Types.data = (Types.TypeNs "num"); disambiguator = 0 }; - { Types.data = (Types.TypeNs "nonzero"); disambiguator = 0 - }; - { Types.data = (Types.TypeNs "NonZeroI32"); - disambiguator = 0 } - ] - }; - generic_args = []} - }); - opt_destruction_scope = None; - region_scope = { Types.data = Types.Node; id = "19" }; - safety_mode = Types.ExplicitUnsafe; - span = - { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "88"; line = "655" }; - lo = { Types.col = "41"; line = "655" } }; - stmts = []; targeted_by_break = false}; - hir_id = (Some ("104", "11")); - span = - { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "88"; line = "655" }; - lo = { Types.col = "41"; line = "655" } }; - ty = - Types.Adt { - def_id = - { Types.index = (1, 22484); krate = "core"; - path = - [{ Types.data = (Types.TypeNs "num"); disambiguator = 0 }; - { Types.data = (Types.TypeNs "nonzero"); disambiguator = 0 }; - { Types.data = (Types.TypeNs "NonZeroI32"); disambiguator = 0 }] - }; - generic_args = []} - } : chString)) - | Cis1Error_InsufficientFunds => - failure (ret_both ((AST import) Unsafe blocks are not allowed. - : chString)) (ret_both ({ Types.attributes = []; - contents = - Types.Block { - expr = - (Some { Types.attributes = []; - contents = - Types.Call { - args = - [{ Types.attributes = []; - contents = - Types.Literal { - lit = - { Types.node = (Types.Int ("42000002", Types.Unsuffixed)); - span = - { Types.filename = - (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "88"; line = "656" }; - lo = { Types.col = "80"; line = "656" } } - }; - neg = true}; - hir_id = (Some ("104", "30")); - span = - { Types.filename = - (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "88"; line = "656" }; - lo = { Types.col = "79"; line = "656" } }; - ty = (Types.Int Types.I32) } - ]; - fn_span = - { Types.filename = - (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "89"; line = "656" }; - lo = { Types.col = "53"; line = "656" } }; - from_hir_call = true; - fun' = - { Types.attributes = []; - contents = - Types.GlobalName { - id = - { Types.index = (1, 22145); krate = "core"; - path = - [{ Types.data = (Types.TypeNs "num"); disambiguator = 0 }; - { Types.data = (Types.TypeNs "nonzero"); - disambiguator = 0 }; - { Types.data = Types.Impl; disambiguator = 56 }; - { Types.data = (Types.ValueNs "new_unchecked"); - disambiguator = 0 } - ] - }}; - hir_id = None; - span = - { Types.filename = - (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "78"; line = "656" }; - lo = { Types.col = "53"; line = "656" } }; - ty = - (Types.Arrow - { Types.bound_vars = []; - value = - { Types.abi = Types.Abi {todo = "Rust"}; - c_variadic = false; inputs = [(Types.Int Types.I32)]; - output = - Types.Adt { - def_id = - { Types.index = (1, 22484); krate = "core"; - path = - [{ Types.data = (Types.TypeNs "num"); - disambiguator = 0 }; - { Types.data = (Types.TypeNs "nonzero"); - disambiguator = 0 }; - { Types.data = (Types.TypeNs "NonZeroI32"); - disambiguator = 0 } - ] - }; - generic_args = []}; - unsafety = Types.Unsafe } - }) - }; - impl = None; - ty = - (Types.Arrow - { Types.bound_vars = []; - value = - { Types.abi = Types.Abi {todo = "Rust"}; - c_variadic = false; inputs = [(Types.Int Types.I32)]; - output = - Types.Adt { - def_id = - { Types.index = (1, 22484); krate = "core"; - path = - [{ Types.data = (Types.TypeNs "num"); - disambiguator = 0 }; - { Types.data = (Types.TypeNs "nonzero"); - disambiguator = 0 }; - { Types.data = (Types.TypeNs "NonZeroI32"); - disambiguator = 0 } - ] - }; - generic_args = []}; - unsafety = Types.Unsafe } - })}; - hir_id = (Some ("104", "25")); - span = - { Types.filename = - (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "89"; line = "656" }; - lo = { Types.col = "53"; line = "656" } }; - ty = - Types.Adt { - def_id = - { Types.index = (1, 22484); krate = "core"; - path = - [{ Types.data = (Types.TypeNs "num"); disambiguator = 0 }; - { Types.data = (Types.TypeNs "nonzero"); disambiguator = 0 - }; - { Types.data = (Types.TypeNs "NonZeroI32"); - disambiguator = 0 } - ] - }; - generic_args = []} - }); - opt_destruction_scope = None; - region_scope = { Types.data = Types.Node; id = "32" }; - safety_mode = Types.ExplicitUnsafe; - span = - { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "91"; line = "656" }; - lo = { Types.col = "44"; line = "656" } }; - stmts = []; targeted_by_break = false}; - hir_id = (Some ("104", "24")); - span = - { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "91"; line = "656" }; - lo = { Types.col = "44"; line = "656" } }; - ty = - Types.Adt { - def_id = - { Types.index = (1, 22484); krate = "core"; - path = - [{ Types.data = (Types.TypeNs "num"); disambiguator = 0 }; - { Types.data = (Types.TypeNs "nonzero"); disambiguator = 0 }; - { Types.data = (Types.TypeNs "NonZeroI32"); disambiguator = 0 }] - }; - generic_args = []} - } : chString)) - | Cis1Error_Unauthorized => - failure (ret_both ((AST import) Unsafe blocks are not allowed. - : chString)) (ret_both ({ Types.attributes = []; - contents = - Types.Block { - expr = - (Some { Types.attributes = []; - contents = - Types.Call { - args = - [{ Types.attributes = []; - contents = - Types.Literal { - lit = - { Types.node = (Types.Int ("42000003", Types.Unsuffixed)); - span = - { Types.filename = - (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "83"; line = "657" }; - lo = { Types.col = "75"; line = "657" } } - }; - neg = true}; - hir_id = (Some ("104", "43")); - span = - { Types.filename = - (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "83"; line = "657" }; - lo = { Types.col = "74"; line = "657" } }; - ty = (Types.Int Types.I32) } - ]; - fn_span = - { Types.filename = - (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "84"; line = "657" }; - lo = { Types.col = "48"; line = "657" } }; - from_hir_call = true; - fun' = - { Types.attributes = []; - contents = - Types.GlobalName { - id = - { Types.index = (1, 22145); krate = "core"; - path = - [{ Types.data = (Types.TypeNs "num"); disambiguator = 0 }; - { Types.data = (Types.TypeNs "nonzero"); - disambiguator = 0 }; - { Types.data = Types.Impl; disambiguator = 56 }; - { Types.data = (Types.ValueNs "new_unchecked"); - disambiguator = 0 } - ] - }}; - hir_id = None; - span = - { Types.filename = - (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "73"; line = "657" }; - lo = { Types.col = "48"; line = "657" } }; - ty = - (Types.Arrow - { Types.bound_vars = []; - value = - { Types.abi = Types.Abi {todo = "Rust"}; - c_variadic = false; inputs = [(Types.Int Types.I32)]; - output = - Types.Adt { - def_id = - { Types.index = (1, 22484); krate = "core"; - path = - [{ Types.data = (Types.TypeNs "num"); - disambiguator = 0 }; - { Types.data = (Types.TypeNs "nonzero"); - disambiguator = 0 }; - { Types.data = (Types.TypeNs "NonZeroI32"); - disambiguator = 0 } - ] - }; - generic_args = []}; - unsafety = Types.Unsafe } - }) - }; - impl = None; - ty = - (Types.Arrow - { Types.bound_vars = []; - value = - { Types.abi = Types.Abi {todo = "Rust"}; - c_variadic = false; inputs = [(Types.Int Types.I32)]; - output = - Types.Adt { - def_id = - { Types.index = (1, 22484); krate = "core"; - path = - [{ Types.data = (Types.TypeNs "num"); - disambiguator = 0 }; - { Types.data = (Types.TypeNs "nonzero"); - disambiguator = 0 }; - { Types.data = (Types.TypeNs "NonZeroI32"); - disambiguator = 0 } - ] - }; - generic_args = []}; - unsafety = Types.Unsafe } - })}; - hir_id = (Some ("104", "38")); - span = - { Types.filename = - (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "84"; line = "657" }; - lo = { Types.col = "48"; line = "657" } }; - ty = - Types.Adt { - def_id = - { Types.index = (1, 22484); krate = "core"; - path = - [{ Types.data = (Types.TypeNs "num"); disambiguator = 0 }; - { Types.data = (Types.TypeNs "nonzero"); disambiguator = 0 - }; - { Types.data = (Types.TypeNs "NonZeroI32"); - disambiguator = 0 } - ] - }; - generic_args = []} - }); - opt_destruction_scope = None; - region_scope = { Types.data = Types.Node; id = "45" }; - safety_mode = Types.ExplicitUnsafe; - span = - { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "86"; line = "657" }; - lo = { Types.col = "39"; line = "657" } }; - stmts = []; targeted_by_break = false}; - hir_id = (Some ("104", "37")); - span = - { Types.filename = (Types.Real (Types.LocalPath "wCCD/src/cis1.rs")); - hi = { Types.col = "86"; line = "657" }; - lo = { Types.col = "39"; line = "657" } }; - ty = - Types.Adt { - def_id = - { Types.index = (1, 22484); krate = "core"; - path = - [{ Types.data = (Types.TypeNs "num"); disambiguator = 0 }; - { Types.data = (Types.TypeNs "nonzero"); disambiguator = 0 }; - { Types.data = (Types.TypeNs "NonZeroI32"); disambiguator = 0 }] - }; - generic_args = []} - } : chString)) - | Cis1Error_Custom reject => - f_error_code (f_into reject) - end in - solve_lift (Build_t_Reject (f_error_code := error_code)) : both (L1 :|: fset []) I1 (t_Reject) in - {| f_from_loc := (fset [] : {fset Location}); - f_from := (@f_from)|}. -Fail Next Obligation. -Hint Unfold t_Reject_t_From. - -#[global] Program Instance t_Cis1Error (v_X)_t_From {v_X : _} `{ t_Sized (v_X)} `{ t_From (v_X) (t_LogError)} : t_From t_Cis1Error (v_X) t_LogError := - let f_from := fun {L1 : {fset Location}} {I1 : Interface} (err : both L1 I1 (t_LogError)) => Cis1Error_Custom (solve_lift (f_from err)) : both (L1 :|: fset []) I1 (t_Cis1Error (v_X)) in - {| f_from_loc := (fset [] : {fset Location}); - f_from := (@f_from)|}. -Fail Next Obligation. -Hint Unfold t_Cis1Error (v_X)_t_From. - -#[global] Program Instance t_Cis1Error (v_X)_t_From {v_X : _} `{ t_Sized (v_X)} `{ t_From (v_X) (t_ParseError)} : t_From t_Cis1Error (v_X) t_ParseError := - let f_from := fun {L1 : {fset Location}} {I1 : Interface} (err : both L1 I1 (t_ParseError)) => Cis1Error_Custom (solve_lift (f_from err)) : both (L1 :|: fset []) I1 (t_Cis1Error (v_X)) in - {| f_from_loc := (fset [] : {fset Location}); - f_from := (@f_from)|}. -Fail Next Obligation. -Hint Unfold t_Cis1Error (v_X)_t_From. - -Definition t_Receiver : choice_type := - chFin (mkpos 2). -Equations Receiver_Account {L : {fset Location}} {I : Interface} : t_AccountAddress (both L I t_Receiver) := - Receiver_Account := - solve_lift ret_both (fintype.Ordinal (n:=2) (m:=0) eq_refl : t_Receiver) : t_AccountAddress (both L I t_Receiver). -Fail Next Obligation. -Equations Receiver_Contract {L : {fset Location}} {I : Interface} : (t_ContractAddress × t_OwnedReceiveName) -> both L I t_Receiver := - Receiver_Contract := - solve_lift ret_both (fintype.Ordinal (n:=2) (m:=1) eq_refl : t_Receiver) : (t_ContractAddress × t_OwnedReceiveName) -> both L I t_Receiver. -Fail Next Obligation. - -Equations from_account {L1 : {fset Location}} {I1 : Interface} (address : both L1 I1 (t_AccountAddress)) : both L1 I1 (t_Receiver) := - from_account address := - Receiver_Account (solve_lift address) : both L1 I1 (t_Receiver). -Fail Next Obligation. - -Equations from_contract {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (address : both L1 I1 (t_ContractAddress)) (function : both L2 I2 (t_OwnedReceiveName)) : both (L1 :|: L2) (I1 :|: I2) (t_Receiver) := - from_contract address function := - Receiver_Contract (solve_lift address) (solve_lift function) : both (L1 :|: L2) (I1 :|: I2) (t_Receiver). -Fail Next Obligation. - -Equations address {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Receiver)) : both L1 I1 (t_Address) := - address self := - solve_lift matchb self with - | Receiver_Account address => - Address_Account address - | Receiver_Contract address => - Address_Contract address - end : both L1 I1 (t_Address). -Fail Next Obligation. - -#[global] Program Instance t_Receiver_t_SchemaType : t_SchemaType t_Receiver := - let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_Enum (solve_lift (into_vec (unsize (box_new (array_from_list [prod_b (f_from (ret_both (Account : chString)),Fields_Unnamed (into_vec (unsize (box_new (array_from_list [f_get_type]))))); - prod_b (f_from (ret_both (Contract : chString)),Fields_Unnamed (into_vec (unsize (box_new (array_from_list [f_get_type; - f_get_type])))))]))))) : both (L :|: fset []) I (t_Type) in - {| f_get_type_loc := (fset [] : {fset Location}); - f_get_type := (@f_get_type)|}. -Fail Next Obligation. -Hint Unfold t_Receiver_t_SchemaType. - -#[global] Program Instance t_Receiver_t_From : t_From t_Receiver t_AccountAddress := - let f_from := fun {L1 : {fset Location}} {I1 : Interface} (address : both L1 I1 (t_AccountAddress)) => solve_lift (from_account address) : both (L1 :|: fset []) I1 (t_Receiver) in - {| f_from_loc := (fset [] : {fset Location}); - f_from := (@f_from)|}. -Fail Next Obligation. -Hint Unfold t_Receiver_t_From. - -Definition t_AdditionalData : choice_type := - (t_Vec (int8) (t_Global)). -Equations 0 {L : {fset Location}} {I : Interface} (s : both L I (t_AdditionalData)) : both L I (t_Vec (int8) (t_Global)) := - 0 s := - bind_both s (fun x => - solve_lift (ret_both (x : t_Vec (int8) (t_Global)))) : both L I (t_Vec (int8) (t_Global)). -Fail Next Obligation. -Equations Build_t_AdditionalData {L0 : {fset Location}} {I0 : Interface} {0 : both L0 I0 (t_Vec (int8) (t_Global))} : both L0 I0 (t_AdditionalData) := - Build_t_AdditionalData := - bind_both 0 (fun 0 => - solve_lift (ret_both ((0) : (t_AdditionalData)))) : both L0 I0 (t_AdditionalData). -Fail Next Obligation. -Notation "'Build_t_AdditionalData' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_AdditionalData (0 := y)). - -#[global] Program Instance t_AdditionalData_t_SchemaType : t_SchemaType t_AdditionalData := - let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_List SizeLength_U16 Type_U8 : both (L :|: fset []) I (t_Type) in - {| f_get_type_loc := (fset [] : {fset Location}); - f_get_type := (@f_get_type)|}. -Fail Next Obligation. -Hint Unfold t_AdditionalData_t_SchemaType. - -Equations empty {L : {fset Location}} {I : Interface} : both L I (t_AdditionalData) := - empty := - AdditionalData (solve_lift new) : both L I (t_AdditionalData). -Fail Next Obligation. - -#[global] Program Instance t_AdditionalData_t_From : t_From t_AdditionalData t_Vec (int8) (t_Global) := - let f_from := fun {L1 : {fset Location}} {I1 : Interface} (data : both L1 I1 (t_Vec (int8) (t_Global))) => AdditionalData (solve_lift data) : both (L1 :|: fset []) I1 (t_AdditionalData) in - {| f_from_loc := (fset [] : {fset Location}); - f_from := (@f_from)|}. -Fail Next Obligation. -Hint Unfold t_AdditionalData_t_From. - -#[global] Program Instance t_AdditionalData_t_AsRef : t_AsRef t_AdditionalData seq int8 := - let f_as_ref := fun {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_AdditionalData)) => solve_lift (f_deref (0 self)) : both (L1 :|: fset []) I1 (seq int8) in - {| f_as_ref_loc := (fset [] : {fset Location}); - f_as_ref := (@f_as_ref)|}. -Fail Next Obligation. -Hint Unfold t_AdditionalData_t_AsRef. - -Definition t_Transfer {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := - (v_T × int64 × t_Address × t_Receiver × t_AdditionalData). -Equations f_token_id {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_Transfer)) : both L I (v_T) := - f_token_id s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst x))) : v_T))) : both L I (v_T). -Fail Next Obligation. -Equations f_amount {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_Transfer)) : both L I (int64) := - f_amount s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : int64))) : both L I (int64). -Fail Next Obligation. -Equations f_from {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_Transfer)) : both L I (t_Address) := - f_from s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : t_Address))) : both L I (t_Address). -Fail Next Obligation. -Equations f_to {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_Transfer)) : both L I (t_Receiver) := - f_to s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : t_Receiver))) : both L I (t_Receiver). -Fail Next Obligation. -Equations f_data {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_Transfer)) : both L I (t_AdditionalData) := - f_data s := - bind_both s (fun x => - solve_lift (ret_both (snd x : t_AdditionalData))) : both L I (t_AdditionalData). -Fail Next Obligation. -Equations Build_t_Transfer {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {f_token_id : both L0 I0 (v_T)} {f_amount : both L1 I1 (int64)} {f_from : both L2 I2 (t_Address)} {f_to : both L3 I3 (t_Receiver)} {f_data : both L4 I4 (t_AdditionalData)} : both (L0:|:L1:|:L2:|:L3:|:L4) (I0:|:I1:|:I2:|:I3:|:I4) (t_Transfer) := - Build_t_Transfer := - bind_both f_data (fun f_data => - bind_both f_to (fun f_to => - bind_both f_from (fun f_from => - bind_both f_amount (fun f_amount => - bind_both f_token_id (fun f_token_id => - solve_lift (ret_both ((f_token_id,f_amount,f_from,f_to,f_data) : (t_Transfer)))))))) : both (L0:|:L1:|:L2:|:L3:|:L4) (I0:|:I1:|:I2:|:I3:|:I4) (t_Transfer). -Fail Next Obligation. -Notation "'Build_t_Transfer' '[' x ']' '(' 'f_token_id' ':=' y ')'" := (Build_t_Transfer (f_token_id := y) (f_amount := f_amount x) (f_from := f_from x) (f_to := f_to x) (f_data := f_data x)). -Notation "'Build_t_Transfer' '[' x ']' '(' 'f_amount' ':=' y ')'" := (Build_t_Transfer (f_token_id := f_token_id x) (f_amount := y) (f_from := f_from x) (f_to := f_to x) (f_data := f_data x)). -Notation "'Build_t_Transfer' '[' x ']' '(' 'f_from' ':=' y ')'" := (Build_t_Transfer (f_token_id := f_token_id x) (f_amount := f_amount x) (f_from := y) (f_to := f_to x) (f_data := f_data x)). -Notation "'Build_t_Transfer' '[' x ']' '(' 'f_to' ':=' y ')'" := (Build_t_Transfer (f_token_id := f_token_id x) (f_amount := f_amount x) (f_from := f_from x) (f_to := y) (f_data := f_data x)). -Notation "'Build_t_Transfer' '[' x ']' '(' 'f_data' ':=' y ')'" := (Build_t_Transfer (f_token_id := f_token_id x) (f_amount := f_amount x) (f_from := f_from x) (f_to := f_to x) (f_data := y)). - -#[global] Program Instance t_Transfer (v_T)_t_SchemaType {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_SchemaType t_Transfer (v_T) := - let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_Struct (Fields_Named (solve_lift (into_vec (unsize (box_new (array_from_list [prod_b (f_from (ret_both (token_id : chString)),f_get_type); - prod_b (f_from (ret_both (amount : chString)),f_get_type); - prod_b (f_from (ret_both (from : chString)),f_get_type); - prod_b (f_from (ret_both (to : chString)),f_get_type); - prod_b (f_from (ret_both (data : chString)),f_get_type)])))))) : both (L :|: fset []) I (t_Type) in - {| f_get_type_loc := (fset [] : {fset Location}); - f_get_type := (@f_get_type)|}. -Fail Next Obligation. -Hint Unfold t_Transfer (v_T)_t_SchemaType. - -Definition t_TransferParams {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := - (t_Vec (t_Transfer (v_T)) (t_Global)). -Equations 0 {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TransferParams)) : both L I (t_Vec (t_Transfer (v_T)) (t_Global)) := - 0 s := - bind_both s (fun x => - solve_lift (ret_both (x : t_Vec (t_Transfer (v_T)) (t_Global)))) : both L I (t_Vec (t_Transfer (v_T)) (t_Global)). -Fail Next Obligation. -Equations Build_t_TransferParams {L0 : {fset Location}} {I0 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {0 : both L0 I0 (t_Vec (t_Transfer (v_T)) (t_Global))} : both L0 I0 (t_TransferParams) := - Build_t_TransferParams := - bind_both 0 (fun 0 => - solve_lift (ret_both ((0) : (t_TransferParams)))) : both L0 I0 (t_TransferParams). -Fail Next Obligation. -Notation "'Build_t_TransferParams' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_TransferParams (0 := y)). - -#[global] Program Instance t_TransferParams (v_T)_t_SchemaType {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_SchemaType t_TransferParams (v_T) := - let f_get_type := fun {L : {fset Location}} {I : Interface} => Type_List SizeLength_U16 (solve_lift f_get_type) : both (L :|: fset []) I (t_Type) in - {| f_get_type_loc := (fset [] : {fset Location}); - f_get_type := (@f_get_type)|}. -Fail Next Obligation. -Hint Unfold t_TransferParams (v_T)_t_SchemaType. - -#[global] Program Instance t_TransferParams (v_T)_t_From {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_From t_TransferParams (v_T) t_Vec (t_Transfer (v_T)) (t_Global) := - let f_from := fun {L1 : {fset Location}} {I1 : Interface} (transfers : both L1 I1 (t_Vec (t_Transfer (v_T)) (t_Global))) => TransferParams (solve_lift transfers) : both (L1 :|: fset []) I1 (t_TransferParams (v_T)) in - {| f_from_loc := (fset [] : {fset Location}); - f_from := (@f_from)|}. -Fail Next Obligation. -Hint Unfold t_TransferParams (v_T)_t_From. - -#[global] Program Instance t_TransferParams (v_T)_t_AsRef {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_AsRef t_TransferParams (v_T) seq t_Transfer (v_T) := - let f_as_ref := fun {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_TransferParams (v_T))) => solve_lift (f_deref (0 self)) : both (L1 :|: fset []) I1 (seq t_Transfer (v_T)) in - {| f_as_ref_loc := (fset [] : {fset Location}); - f_as_ref := (@f_as_ref)|}. -Fail Next Obligation. -Hint Unfold t_TransferParams (v_T)_t_AsRef. - -Definition t_UpdateOperator : choice_type := - (t_OperatorUpdate × t_Address). -Equations f_update {L : {fset Location}} {I : Interface} (s : both L I (t_UpdateOperator)) : both L I (t_OperatorUpdate) := - f_update s := - bind_both s (fun x => - solve_lift (ret_both (fst x : t_OperatorUpdate))) : both L I (t_OperatorUpdate). -Fail Next Obligation. -Equations f_operator {L : {fset Location}} {I : Interface} (s : both L I (t_UpdateOperator)) : both L I (t_Address) := - f_operator s := - bind_both s (fun x => - solve_lift (ret_both (snd x : t_Address))) : both L I (t_Address). -Fail Next Obligation. -Equations Build_t_UpdateOperator {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_update : both L0 I0 (t_OperatorUpdate)} {f_operator : both L1 I1 (t_Address)} : both (L0:|:L1) (I0:|:I1) (t_UpdateOperator) := - Build_t_UpdateOperator := - bind_both f_operator (fun f_operator => - bind_both f_update (fun f_update => - solve_lift (ret_both ((f_update,f_operator) : (t_UpdateOperator))))) : both (L0:|:L1) (I0:|:I1) (t_UpdateOperator). -Fail Next Obligation. -Notation "'Build_t_UpdateOperator' '[' x ']' '(' 'f_update' ':=' y ')'" := (Build_t_UpdateOperator (f_update := y) (f_operator := f_operator x)). -Notation "'Build_t_UpdateOperator' '[' x ']' '(' 'f_operator' ':=' y ')'" := (Build_t_UpdateOperator (f_update := f_update x) (f_operator := y)). - -Definition t_UpdateOperatorParams : choice_type := - (t_Vec (t_UpdateOperator) (t_Global)). -Equations 0 {L : {fset Location}} {I : Interface} (s : both L I (t_UpdateOperatorParams)) : both L I (t_Vec (t_UpdateOperator) (t_Global)) := - 0 s := - bind_both s (fun x => - solve_lift (ret_both (x : t_Vec (t_UpdateOperator) (t_Global)))) : both L I (t_Vec (t_UpdateOperator) (t_Global)). -Fail Next Obligation. -Equations Build_t_UpdateOperatorParams {L0 : {fset Location}} {I0 : Interface} {0 : both L0 I0 (t_Vec (t_UpdateOperator) (t_Global))} : both L0 I0 (t_UpdateOperatorParams) := - Build_t_UpdateOperatorParams := - bind_both 0 (fun 0 => - solve_lift (ret_both ((0) : (t_UpdateOperatorParams)))) : both L0 I0 (t_UpdateOperatorParams). -Fail Next Obligation. -Notation "'Build_t_UpdateOperatorParams' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_UpdateOperatorParams (0 := y)). - -Definition t_BalanceOfQuery {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := - (v_T × t_Address). -Equations f_token_id {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_BalanceOfQuery)) : both L I (v_T) := - f_token_id s := - bind_both s (fun x => - solve_lift (ret_both (fst x : v_T))) : both L I (v_T). -Fail Next Obligation. -Equations f_address {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_BalanceOfQuery)) : both L I (t_Address) := - f_address s := - bind_both s (fun x => - solve_lift (ret_both (snd x : t_Address))) : both L I (t_Address). -Fail Next Obligation. -Equations Build_t_BalanceOfQuery {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {f_token_id : both L0 I0 (v_T)} {f_address : both L1 I1 (t_Address)} : both (L0:|:L1) (I0:|:I1) (t_BalanceOfQuery) := - Build_t_BalanceOfQuery := - bind_both f_address (fun f_address => - bind_both f_token_id (fun f_token_id => - solve_lift (ret_both ((f_token_id,f_address) : (t_BalanceOfQuery))))) : both (L0:|:L1) (I0:|:I1) (t_BalanceOfQuery). -Fail Next Obligation. -Notation "'Build_t_BalanceOfQuery' '[' x ']' '(' 'f_token_id' ':=' y ')'" := (Build_t_BalanceOfQuery (f_token_id := y) (f_address := f_address x)). -Notation "'Build_t_BalanceOfQuery' '[' x ']' '(' 'f_address' ':=' y ')'" := (Build_t_BalanceOfQuery (f_token_id := f_token_id x) (f_address := y)). - -Definition t_BalanceOfQueryParams {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := - (t_ContractAddress × t_OwnedReceiveName × t_Vec (t_BalanceOfQuery (v_T)) (t_Global)). -Equations f_result_contract {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_BalanceOfQueryParams)) : both L I (t_ContractAddress) := - f_result_contract s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : t_ContractAddress))) : both L I (t_ContractAddress). -Fail Next Obligation. -Equations f_result_function {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_BalanceOfQueryParams)) : both L I (t_OwnedReceiveName) := - f_result_function s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : t_OwnedReceiveName))) : both L I (t_OwnedReceiveName). -Fail Next Obligation. -Equations f_queries {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_BalanceOfQueryParams)) : both L I (t_Vec (t_BalanceOfQuery (v_T)) (t_Global)) := - f_queries s := - bind_both s (fun x => - solve_lift (ret_both (snd x : t_Vec (t_BalanceOfQuery (v_T)) (t_Global)))) : both L I (t_Vec (t_BalanceOfQuery (v_T)) (t_Global)). -Fail Next Obligation. -Equations Build_t_BalanceOfQueryParams {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {f_result_contract : both L0 I0 (t_ContractAddress)} {f_result_function : both L1 I1 (t_OwnedReceiveName)} {f_queries : both L2 I2 (t_Vec (t_BalanceOfQuery (v_T)) (t_Global))} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_BalanceOfQueryParams) := - Build_t_BalanceOfQueryParams := - bind_both f_queries (fun f_queries => - bind_both f_result_function (fun f_result_function => - bind_both f_result_contract (fun f_result_contract => - solve_lift (ret_both ((f_result_contract,f_result_function,f_queries) : (t_BalanceOfQueryParams)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_BalanceOfQueryParams). -Fail Next Obligation. -Notation "'Build_t_BalanceOfQueryParams' '[' x ']' '(' 'f_result_contract' ':=' y ')'" := (Build_t_BalanceOfQueryParams (f_result_contract := y) (f_result_function := f_result_function x) (f_queries := f_queries x)). -Notation "'Build_t_BalanceOfQueryParams' '[' x ']' '(' 'f_result_function' ':=' y ')'" := (Build_t_BalanceOfQueryParams (f_result_contract := f_result_contract x) (f_result_function := y) (f_queries := f_queries x)). -Notation "'Build_t_BalanceOfQueryParams' '[' x ']' '(' 'f_queries' ':=' y ')'" := (Build_t_BalanceOfQueryParams (f_result_contract := f_result_contract x) (f_result_function := f_result_function x) (f_queries := y)). - -Definition t_BalanceOfQueryResult {v_T : _} `{ t_Sized (v_T)} : choice_type := - (t_BalanceOfQuery (v_T) × int64). - -Definition t_BalanceOfQueryResponse {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := - (t_Vec ((t_BalanceOfQuery (v_T) × int64)) (t_Global)). -Equations 0 {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_BalanceOfQueryResponse)) : both L I (t_Vec ((t_BalanceOfQuery (v_T) × int64)) (t_Global)) := - 0 s := - bind_both s (fun x => - solve_lift (ret_both (x : t_Vec ((t_BalanceOfQuery (v_T) × int64)) (t_Global)))) : both L I (t_Vec ((t_BalanceOfQuery (v_T) × int64)) (t_Global)). -Fail Next Obligation. -Equations Build_t_BalanceOfQueryResponse {L0 : {fset Location}} {I0 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {0 : both L0 I0 (t_Vec ((t_BalanceOfQuery (v_T) × int64)) (t_Global))} : both L0 I0 (t_BalanceOfQueryResponse) := - Build_t_BalanceOfQueryResponse := - bind_both 0 (fun 0 => - solve_lift (ret_both ((0) : (t_BalanceOfQueryResponse)))) : both L0 I0 (t_BalanceOfQueryResponse). -Fail Next Obligation. -Notation "'Build_t_BalanceOfQueryResponse' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_BalanceOfQueryResponse (0 := y)). - -#[global] Program Instance t_BalanceOfQueryResponse (v_T)_t_From {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_From t_BalanceOfQueryResponse (v_T) t_Vec ((t_BalanceOfQuery (v_T) × int64)) (t_Global) := - let f_from := fun {L1 : {fset Location}} {I1 : Interface} (results : both L1 I1 (t_Vec ((t_BalanceOfQuery (v_T) × int64)) (t_Global))) => BalanceOfQueryResponse (solve_lift results) : both (L1 :|: fset []) I1 (t_BalanceOfQueryResponse (v_T)) in - {| f_from_loc := (fset [] : {fset Location}); - f_from := (@f_from)|}. -Fail Next Obligation. -Hint Unfold t_BalanceOfQueryResponse (v_T)_t_From. - -#[global] Program Instance t_BalanceOfQueryResponse (v_T)_t_AsRef {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_AsRef t_BalanceOfQueryResponse (v_T) seq (t_BalanceOfQuery (v_T) × int64) := - let f_as_ref := fun {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_BalanceOfQueryResponse (v_T))) => solve_lift (f_deref (0 self)) : both (L1 :|: fset []) I1 (seq (t_BalanceOfQuery (v_T) × int64)) in - {| f_as_ref_loc := (fset [] : {fset Location}); - f_as_ref := (@f_as_ref)|}. -Fail Next Obligation. -Hint Unfold t_BalanceOfQueryResponse (v_T)_t_AsRef. - -Definition t_OperatorOfQuery : choice_type := - (t_Address × t_Address). -Equations f_owner {L : {fset Location}} {I : Interface} (s : both L I (t_OperatorOfQuery)) : both L I (t_Address) := - f_owner s := - bind_both s (fun x => - solve_lift (ret_both (fst x : t_Address))) : both L I (t_Address). -Fail Next Obligation. -Equations f_address {L : {fset Location}} {I : Interface} (s : both L I (t_OperatorOfQuery)) : both L I (t_Address) := - f_address s := - bind_both s (fun x => - solve_lift (ret_both (snd x : t_Address))) : both L I (t_Address). -Fail Next Obligation. -Equations Build_t_OperatorOfQuery {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_owner : both L0 I0 (t_Address)} {f_address : both L1 I1 (t_Address)} : both (L0:|:L1) (I0:|:I1) (t_OperatorOfQuery) := - Build_t_OperatorOfQuery := - bind_both f_address (fun f_address => - bind_both f_owner (fun f_owner => - solve_lift (ret_both ((f_owner,f_address) : (t_OperatorOfQuery))))) : both (L0:|:L1) (I0:|:I1) (t_OperatorOfQuery). -Fail Next Obligation. -Notation "'Build_t_OperatorOfQuery' '[' x ']' '(' 'f_owner' ':=' y ')'" := (Build_t_OperatorOfQuery (f_owner := y) (f_address := f_address x)). -Notation "'Build_t_OperatorOfQuery' '[' x ']' '(' 'f_address' ':=' y ')'" := (Build_t_OperatorOfQuery (f_owner := f_owner x) (f_address := y)). - -Definition t_OperatorOfQueryParams : choice_type := - (t_ContractAddress × t_OwnedReceiveName × t_Vec (t_OperatorOfQuery) (t_Global)). -Equations f_result_contract {L : {fset Location}} {I : Interface} (s : both L I (t_OperatorOfQueryParams)) : both L I (t_ContractAddress) := - f_result_contract s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : t_ContractAddress))) : both L I (t_ContractAddress). -Fail Next Obligation. -Equations f_result_function {L : {fset Location}} {I : Interface} (s : both L I (t_OperatorOfQueryParams)) : both L I (t_OwnedReceiveName) := - f_result_function s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : t_OwnedReceiveName))) : both L I (t_OwnedReceiveName). -Fail Next Obligation. -Equations f_queries {L : {fset Location}} {I : Interface} (s : both L I (t_OperatorOfQueryParams)) : both L I (t_Vec (t_OperatorOfQuery) (t_Global)) := - f_queries s := - bind_both s (fun x => - solve_lift (ret_both (snd x : t_Vec (t_OperatorOfQuery) (t_Global)))) : both L I (t_Vec (t_OperatorOfQuery) (t_Global)). -Fail Next Obligation. -Equations Build_t_OperatorOfQueryParams {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_result_contract : both L0 I0 (t_ContractAddress)} {f_result_function : both L1 I1 (t_OwnedReceiveName)} {f_queries : both L2 I2 (t_Vec (t_OperatorOfQuery) (t_Global))} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_OperatorOfQueryParams) := - Build_t_OperatorOfQueryParams := - bind_both f_queries (fun f_queries => - bind_both f_result_function (fun f_result_function => - bind_both f_result_contract (fun f_result_contract => - solve_lift (ret_both ((f_result_contract,f_result_function,f_queries) : (t_OperatorOfQueryParams)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_OperatorOfQueryParams). -Fail Next Obligation. -Notation "'Build_t_OperatorOfQueryParams' '[' x ']' '(' 'f_result_contract' ':=' y ')'" := (Build_t_OperatorOfQueryParams (f_result_contract := y) (f_result_function := f_result_function x) (f_queries := f_queries x)). -Notation "'Build_t_OperatorOfQueryParams' '[' x ']' '(' 'f_result_function' ':=' y ')'" := (Build_t_OperatorOfQueryParams (f_result_contract := f_result_contract x) (f_result_function := y) (f_queries := f_queries x)). -Notation "'Build_t_OperatorOfQueryParams' '[' x ']' '(' 'f_queries' ':=' y ')'" := (Build_t_OperatorOfQueryParams (f_result_contract := f_result_contract x) (f_result_function := f_result_function x) (f_queries := y)). - -Notation "'t_OperatorOfQueryResult'" := ((t_OperatorOfQuery × 'bool)). - -Definition t_OperatorOfQueryResponse : choice_type := - (t_Vec ((t_OperatorOfQuery × 'bool)) (t_Global)). -Equations 0 {L : {fset Location}} {I : Interface} (s : both L I (t_OperatorOfQueryResponse)) : both L I (t_Vec ((t_OperatorOfQuery × 'bool)) (t_Global)) := - 0 s := - bind_both s (fun x => - solve_lift (ret_both (x : t_Vec ((t_OperatorOfQuery × 'bool)) (t_Global)))) : both L I (t_Vec ((t_OperatorOfQuery × 'bool)) (t_Global)). -Fail Next Obligation. -Equations Build_t_OperatorOfQueryResponse {L0 : {fset Location}} {I0 : Interface} {0 : both L0 I0 (t_Vec ((t_OperatorOfQuery × 'bool)) (t_Global))} : both L0 I0 (t_OperatorOfQueryResponse) := - Build_t_OperatorOfQueryResponse := - bind_both 0 (fun 0 => - solve_lift (ret_both ((0) : (t_OperatorOfQueryResponse)))) : both L0 I0 (t_OperatorOfQueryResponse). -Fail Next Obligation. -Notation "'Build_t_OperatorOfQueryResponse' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_OperatorOfQueryResponse (0 := y)). - -#[global] Program Instance t_OperatorOfQueryResponse_t_From : t_From t_OperatorOfQueryResponse t_Vec ((t_OperatorOfQuery × 'bool)) (t_Global) := - let f_from := fun {L1 : {fset Location}} {I1 : Interface} (results : both L1 I1 (t_Vec ((t_OperatorOfQuery × 'bool)) (t_Global))) => OperatorOfQueryResponse (solve_lift results) : both (L1 :|: fset []) I1 (t_OperatorOfQueryResponse) in - {| f_from_loc := (fset [] : {fset Location}); - f_from := (@f_from)|}. -Fail Next Obligation. -Hint Unfold t_OperatorOfQueryResponse_t_From. - -#[global] Program Instance t_OperatorOfQueryResponse_t_AsRef : t_AsRef t_OperatorOfQueryResponse seq (t_OperatorOfQuery × 'bool) := - let f_as_ref := fun {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_OperatorOfQueryResponse)) => solve_lift (f_deref (0 self)) : both (L1 :|: fset []) I1 (seq (t_OperatorOfQuery × 'bool)) in - {| f_as_ref_loc := (fset [] : {fset Location}); - f_as_ref := (@f_as_ref)|}. -Fail Next Obligation. -Hint Unfold t_OperatorOfQueryResponse_t_AsRef. - -Definition t_TokenMetadataQueryParams {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := - (t_ContractAddress × t_OwnedReceiveName × t_Vec (v_T) (t_Global)). -Equations f_result_contract {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TokenMetadataQueryParams)) : both L I (t_ContractAddress) := - f_result_contract s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : t_ContractAddress))) : both L I (t_ContractAddress). -Fail Next Obligation. -Equations f_result_function {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TokenMetadataQueryParams)) : both L I (t_OwnedReceiveName) := - f_result_function s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : t_OwnedReceiveName))) : both L I (t_OwnedReceiveName). -Fail Next Obligation. -Equations f_queries {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TokenMetadataQueryParams)) : both L I (t_Vec (v_T) (t_Global)) := - f_queries s := - bind_both s (fun x => - solve_lift (ret_both (snd x : t_Vec (v_T) (t_Global)))) : both L I (t_Vec (v_T) (t_Global)). -Fail Next Obligation. -Equations Build_t_TokenMetadataQueryParams {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {f_result_contract : both L0 I0 (t_ContractAddress)} {f_result_function : both L1 I1 (t_OwnedReceiveName)} {f_queries : both L2 I2 (t_Vec (v_T) (t_Global))} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_TokenMetadataQueryParams) := - Build_t_TokenMetadataQueryParams := - bind_both f_queries (fun f_queries => - bind_both f_result_function (fun f_result_function => - bind_both f_result_contract (fun f_result_contract => - solve_lift (ret_both ((f_result_contract,f_result_function,f_queries) : (t_TokenMetadataQueryParams)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_TokenMetadataQueryParams). -Fail Next Obligation. -Notation "'Build_t_TokenMetadataQueryParams' '[' x ']' '(' 'f_result_contract' ':=' y ')'" := (Build_t_TokenMetadataQueryParams (f_result_contract := y) (f_result_function := f_result_function x) (f_queries := f_queries x)). -Notation "'Build_t_TokenMetadataQueryParams' '[' x ']' '(' 'f_result_function' ':=' y ')'" := (Build_t_TokenMetadataQueryParams (f_result_contract := f_result_contract x) (f_result_function := y) (f_queries := f_queries x)). -Notation "'Build_t_TokenMetadataQueryParams' '[' x ']' '(' 'f_queries' ':=' y ')'" := (Build_t_TokenMetadataQueryParams (f_result_contract := f_result_contract x) (f_result_function := f_result_function x) (f_queries := y)). - -Definition t_TokenMetadataQueryResult {v_T : _} `{ t_Sized (v_T)} : choice_type := - (v_T × t_MetadataUrl). - -Definition t_TokenMetadataQueryResponse {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := - (t_Vec ((v_T × t_MetadataUrl)) (t_Global)). -Equations 0 {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_TokenMetadataQueryResponse)) : both L I (t_Vec ((v_T × t_MetadataUrl)) (t_Global)) := - 0 s := - bind_both s (fun x => - solve_lift (ret_both (x : t_Vec ((v_T × t_MetadataUrl)) (t_Global)))) : both L I (t_Vec ((v_T × t_MetadataUrl)) (t_Global)). -Fail Next Obligation. -Equations Build_t_TokenMetadataQueryResponse {L0 : {fset Location}} {I0 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {0 : both L0 I0 (t_Vec ((v_T × t_MetadataUrl)) (t_Global))} : both L0 I0 (t_TokenMetadataQueryResponse) := - Build_t_TokenMetadataQueryResponse := - bind_both 0 (fun 0 => - solve_lift (ret_both ((0) : (t_TokenMetadataQueryResponse)))) : both L0 I0 (t_TokenMetadataQueryResponse). -Fail Next Obligation. -Notation "'Build_t_TokenMetadataQueryResponse' '[' x ']' '(' '0' ':=' y ')'" := (Build_t_TokenMetadataQueryResponse (0 := y)). - -#[global] Program Instance t_TokenMetadataQueryResponse (v_T)_t_From {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_From t_TokenMetadataQueryResponse (v_T) t_Vec ((v_T × t_MetadataUrl)) (t_Global) := - let f_from := fun {L1 : {fset Location}} {I1 : Interface} (results : both L1 I1 (t_Vec ((v_T × t_MetadataUrl)) (t_Global))) => TokenMetadataQueryResponse (solve_lift results) : both (L1 :|: fset []) I1 (t_TokenMetadataQueryResponse (v_T)) in - {| f_from_loc := (fset [] : {fset Location}); - f_from := (@f_from)|}. -Fail Next Obligation. -Hint Unfold t_TokenMetadataQueryResponse (v_T)_t_From. - -#[global] Program Instance t_TokenMetadataQueryResponse (v_T)_t_AsRef {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : t_AsRef t_TokenMetadataQueryResponse (v_T) seq (v_T × t_MetadataUrl) := - let f_as_ref := fun {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_TokenMetadataQueryResponse (v_T))) => solve_lift (f_deref (0 self)) : both (L1 :|: fset []) I1 (seq (v_T × t_MetadataUrl)) in - {| f_as_ref_loc := (fset [] : {fset Location}); - f_as_ref := (@f_as_ref)|}. -Fail Next Obligation. -Hint Unfold t_TokenMetadataQueryResponse (v_T)_t_AsRef. - -Definition t_OnReceivingCis1Params {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} : choice_type := - (v_T × int64 × t_Address × t_OwnedContractName × t_AdditionalData). -Equations f_token_id {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_OnReceivingCis1Params)) : both L I (v_T) := - f_token_id s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst x))) : v_T))) : both L I (v_T). -Fail Next Obligation. -Equations f_amount {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_OnReceivingCis1Params)) : both L I (int64) := - f_amount s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : int64))) : both L I (int64). -Fail Next Obligation. -Equations f_from {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_OnReceivingCis1Params)) : both L I (t_Address) := - f_from s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : t_Address))) : both L I (t_Address). -Fail Next Obligation. -Equations f_contract_name {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_OnReceivingCis1Params)) : both L I (t_OwnedContractName) := - f_contract_name s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : t_OwnedContractName))) : both L I (t_OwnedContractName). -Fail Next Obligation. -Equations f_data {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} (s : both L I (t_OnReceivingCis1Params)) : both L I (t_AdditionalData) := - f_data s := - bind_both s (fun x => - solve_lift (ret_both (snd x : t_AdditionalData))) : both L I (t_AdditionalData). -Fail Next Obligation. -Equations Build_t_OnReceivingCis1Params {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_IsTokenId (v_T)} {f_token_id : both L0 I0 (v_T)} {f_amount : both L1 I1 (int64)} {f_from : both L2 I2 (t_Address)} {f_contract_name : both L3 I3 (t_OwnedContractName)} {f_data : both L4 I4 (t_AdditionalData)} : both (L0:|:L1:|:L2:|:L3:|:L4) (I0:|:I1:|:I2:|:I3:|:I4) (t_OnReceivingCis1Params) := - Build_t_OnReceivingCis1Params := - bind_both f_data (fun f_data => - bind_both f_contract_name (fun f_contract_name => - bind_both f_from (fun f_from => - bind_both f_amount (fun f_amount => - bind_both f_token_id (fun f_token_id => - solve_lift (ret_both ((f_token_id,f_amount,f_from,f_contract_name,f_data) : (t_OnReceivingCis1Params)))))))) : both (L0:|:L1:|:L2:|:L3:|:L4) (I0:|:I1:|:I2:|:I3:|:I4) (t_OnReceivingCis1Params). -Fail Next Obligation. -Notation "'Build_t_OnReceivingCis1Params' '[' x ']' '(' 'f_token_id' ':=' y ')'" := (Build_t_OnReceivingCis1Params (f_token_id := y) (f_amount := f_amount x) (f_from := f_from x) (f_contract_name := f_contract_name x) (f_data := f_data x)). -Notation "'Build_t_OnReceivingCis1Params' '[' x ']' '(' 'f_amount' ':=' y ')'" := (Build_t_OnReceivingCis1Params (f_token_id := f_token_id x) (f_amount := y) (f_from := f_from x) (f_contract_name := f_contract_name x) (f_data := f_data x)). -Notation "'Build_t_OnReceivingCis1Params' '[' x ']' '(' 'f_from' ':=' y ')'" := (Build_t_OnReceivingCis1Params (f_token_id := f_token_id x) (f_amount := f_amount x) (f_from := y) (f_contract_name := f_contract_name x) (f_data := f_data x)). -Notation "'Build_t_OnReceivingCis1Params' '[' x ']' '(' 'f_contract_name' ':=' y ')'" := (Build_t_OnReceivingCis1Params (f_token_id := f_token_id x) (f_amount := f_amount x) (f_from := f_from x) (f_contract_name := y) (f_data := f_data x)). -Notation "'Build_t_OnReceivingCis1Params' '[' x ']' '(' 'f_data' ':=' y ')'" := (Build_t_OnReceivingCis1Params (f_token_id := f_token_id x) (f_amount := f_amount x) (f_from := f_from x) (f_contract_name := f_contract_name x) (f_data := y)). diff --git a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_balance_of.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_balance_of.v deleted file mode 100644 index 4c8ece1..0000000 --- a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_balance_of.v +++ /dev/null @@ -1,40 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Hacspec_concordium. -Export Hacspec_concordium. - -Require Import SeekFrom. -Export SeekFrom. - -Require Import ContractState. -Export ContractState. - -Require Import Logger. -Export Logger. - -Require Import trap. -Export trap. diff --git a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_init.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_init.v deleted file mode 100644 index 579ca7a..0000000 --- a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_init.v +++ /dev/null @@ -1,40 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Hacspec_concordium. -Export Hacspec_concordium. - -Require Import trap. -Export trap. - -Require Import ExternContext. -Export ExternContext. - -Require Import InitContextExtern. -Export InitContextExtern. - -Require Import ContractState. -Export ContractState. diff --git a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_operator_of.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_operator_of.v deleted file mode 100644 index 4c8ece1..0000000 --- a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_operator_of.v +++ /dev/null @@ -1,40 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Hacspec_concordium. -Export Hacspec_concordium. - -Require Import SeekFrom. -Export SeekFrom. - -Require Import ContractState. -Export ContractState. - -Require Import Logger. -Export Logger. - -Require Import trap. -Export trap. diff --git a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_token_metadata.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_token_metadata.v deleted file mode 100644 index 4c8ece1..0000000 --- a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_token_metadata.v +++ /dev/null @@ -1,40 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Hacspec_concordium. -Export Hacspec_concordium. - -Require Import SeekFrom. -Export SeekFrom. - -Require Import ContractState. -Export ContractState. - -Require Import Logger. -Export Logger. - -Require Import trap. -Export trap. diff --git a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_transfer.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_transfer.v deleted file mode 100644 index 4c8ece1..0000000 --- a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_transfer.v +++ /dev/null @@ -1,40 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Hacspec_concordium. -Export Hacspec_concordium. - -Require Import SeekFrom. -Export SeekFrom. - -Require Import ContractState. -Export ContractState. - -Require Import Logger. -Export Logger. - -Require Import trap. -Export trap. diff --git a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_unwrap.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_unwrap.v deleted file mode 100644 index 4c8ece1..0000000 --- a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_unwrap.v +++ /dev/null @@ -1,40 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Hacspec_concordium. -Export Hacspec_concordium. - -Require Import SeekFrom. -Export SeekFrom. - -Require Import ContractState. -Export ContractState. - -Require Import Logger. -Export Logger. - -Require Import trap. -Export trap. diff --git a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_update_operator.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_update_operator.v deleted file mode 100644 index 4c8ece1..0000000 --- a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_update_operator.v +++ /dev/null @@ -1,40 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Hacspec_concordium. -Export Hacspec_concordium. - -Require Import SeekFrom. -Export SeekFrom. - -Require Import ContractState. -Export ContractState. - -Require Import Logger. -Export Logger. - -Require Import trap. -Export trap. diff --git a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_wrap.v b/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_wrap.v deleted file mode 100644 index 4c8ece1..0000000 --- a/wCCD/proofs/ssprove/extraction/Hacspec_wccd_Export_contract_wrap.v +++ /dev/null @@ -1,40 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Hacspec_concordium. -Export Hacspec_concordium. - -Require Import SeekFrom. -Export SeekFrom. - -Require Import ContractState. -Export ContractState. - -Require Import Logger. -Export Logger. - -Require Import trap. -Export trap. diff --git a/wCCD/src/cis1.rs b/wCCD/src/cis1.rs deleted file mode 100644 index 59fb07e..0000000 --- a/wCCD/src/cis1.rs +++ /dev/null @@ -1,1038 +0,0 @@ -use hacspec_concordium::*; -use crate::alloc::boxed::Box; - - -use convert::TryFrom; - - -pub use hacspec_concordium::num::NonZeroI32; - -/// Tag for the CIS1 Transfer event. -pub const TRANSFER_EVENT_TAG: u8 = 255u8; // u8::MAX -/// Tag for the CIS1 Mint event. -pub const MINT_EVENT_TAG: u8 = 255u8 - 1u8; // u8::MAX -/// Tag for the CIS1 Burn event. -pub const BURN_EVENT_TAG: u8 = 255u8 - 2u8; // u8::MAX -/// Tag for the CIS1 UpdateOperator event. -pub const UPDATE_OPERATOR_EVENT_TAG: u8 = 255u8 - 3u8; // u8::MAX -/// Tag for the CIS1 TokenMetadata event. -pub const TOKEN_METADATA_EVENT_TAG: u8 = 255u8 - 4u8; // u8::MAX - -/// Sha256 digest -pub type Sha256 = [u8; 32]; - -// pub type Sha256 = ([ -// 0u8;0u8;0u8;0u8;0u8;0u8;0u8;0u8; -// 0u8;0u8;0u8;0u8;0u8;0u8;0u8;0u8; -// 0u8;0u8;0u8;0u8;0u8;0u8;0u8;0u8; -// 0u8;0u8;0u8;0u8;0u8;0u8;0u8;0u8]; - - -/// The location of the metadata and an optional hash of the content. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType, Clone)] -pub struct MetadataUrl { - /// The URL following the specification RFC1738. - // #[concordium(size_length = 2)] - pub url: String, - /// A optional hash of the content. - pub hash: Option, -} - - -/// Trait for marking types as CIS1 token IDs. -/// For a type to be a valid CIS1 token ID it must implement serialization and -/// schema type, such that the first byte indicates how many bytes is used to -/// represent the token ID, followed by this many bytes for the token ID. -/// -/// Note: The reason for introducing such a trait instead of representing every -/// token ID using Vec is to allow smart contracts to use specialized token -/// ID implementations avoiding allocations. -pub trait IsTokenId: Serialize + schema::SchemaType {} - - -/// Token Identifier, which combined with the address of the contract instance, -/// forms the unique identifier of a token type. -/// -/// This token ID type can represent every possible token ID but requires -/// allocating a Vec. Using a fixed size token ID type (such as `TokenIdFixed`) -/// will avoid this. -/// -/// The CIS1 specification allows for up to 255 bytes for the token ID, but -/// unless the bytes have some significant meaning, it is most likely better to -/// use a smaller fixed size token ID such as `TokenIdU8`. -#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Clone, Serialize)] -pub struct TokenIdVec( - // #[concordium(size_length = 1)] - pub Vec, -); - - -impl IsTokenId for TokenIdVec {} - - -impl schema::SchemaType for TokenIdVec { - fn get_type() -> schema::Type { - schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) - } -} - -// #[cfg(not(feature="hacspec"))] -// /// Display the token ID as a uppercase hex string -// impl fmt::Display for TokenIdVec { -// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { -// for byte in &self.0 { -// write!(f, "{:02X}", byte)?; -// } -// Ok(()) -// } -// } - - -/// Token Identifier, which combined with the address of the contract instance, -/// forms the unique identifier of a token type. -/// -/// The CIS1 specification allows for up to 255 bytes for the token ID, but for -/// most cases using a smaller token ID is fine and can reduce contract energy -/// costs. -/// -/// This token ID uses an array for representing the token ID bytes which means -/// the token ID space is fixed to `N` number of bytes and some token IDs cannot -/// be represented. For a more general token ID type see `TokenIdVec`. -/// For fixed sized token IDs with integer representations see `TokenIdU8`, -/// `TokenIdU16`, `TokenIdU32` and `TokenIdU64`. -#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] -pub struct TokenIdFixed(pub [u8; N]); - - -impl IsTokenId for TokenIdFixed {} - - -impl schema::SchemaType for TokenIdFixed { - fn get_type() -> schema::Type { - schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) - } -} - - -impl From<[u8; N]> for TokenIdFixed { - fn from(id: [u8; N]) -> Self { - TokenIdFixed(id) - } -} - - -/// The `TokenIdFixed` is serialized as the value of the first byte represents -/// the number of bytes followed for the rest of the token ID. -impl Serial for TokenIdFixed { - fn serial(&self, out: &mut W) -> Result<(), W::Err> { - let len = u8::try_from(N).map_err(|_| W::Err::default())?; - out.write_u8(len)?; - for byte in self.0 { - out.write_u8(byte)?; - } - Ok(()) - } -} - - -/// The `TokenIdFixed` is deserialized by reading the first byte represents the -/// number of bytes and ensuring this value corresponds with the number of bytes -/// to use for the token ID. -impl Deserial for TokenIdFixed { - fn deserial(source: &mut R) -> ParseResult { - let byte_length = source.read_u8()?; - if usize::from(byte_length) != N { - return Err(ParseError::default()); - } - let bytes: [u8; N] = source.get()?; - Ok(TokenIdFixed(bytes)) - } -} - -// #[cfg(not(feature="hacspec"))] -// /// Display the token ID as a uppercase hex string -// impl fmt::Display for TokenIdFixed { -// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { -// for byte in &self.0 { -// write!(f, "{:02X}", byte)?; -// } -// Ok(()) -// } -// } - - -/// Token Identifier, which combined with the address of the contract instance, -/// forms the unique identifier of a token type. -/// -/// The CIS1 specification allows for up to 255 bytes for the token ID, but for -/// most cases using a smaller token ID is fine and can reduce contract energy -/// costs. -/// -/// This token ID uses u64 for representing the token ID bytes which means the -/// token ID space is fixed to 8 bytes and some token IDs cannot be represented. -/// For a more general token ID type see `TokenIdVec`. -#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] -pub struct TokenIdU64(pub u64); - - -impl IsTokenId for TokenIdU64 {} - - -impl schema::SchemaType for TokenIdU64 { - fn get_type() -> schema::Type { - schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) - } -} - - -impl From for TokenIdU64 { - fn from(id: u64) -> Self { - TokenIdU64(id) - } -} - - -/// The `TokenIdU64` is serialized with one byte with the value 8 followed by 8 -/// bytes to encode a u64 in little endian. -impl Serial for TokenIdU64 { - fn serial(&self, out: &mut W) -> Result<(), W::Err> { - out.write_u8(8)?; - out.write_u64(self.0) - } -} - - -/// The `TokenIdU64` will deserialize one byte ensuring this contains the value -/// 8 and then deserialize a u64 as little endian. It will result in an error if -/// the first byte is not 8. -impl Deserial for TokenIdU64 { - fn deserial(source: &mut R) -> ParseResult { - let byte_length = source.read_u8()?; - if byte_length == 8 { - Ok(TokenIdU64(source.read_u64()?)) - } else { - Err(ParseError::default()) - } - } -} - -// #[cfg(not(feature="hacspec"))] -// /// Display the token ID as a uppercase hex string -// impl fmt::Display for TokenIdU64 { -// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { -// for byte in &self.0.to_le_bytes() { -// write!(f, "{:02X}", byte)?; -// } -// Ok(()) -// } -// } - - -/// Token Identifier, which combined with the address of the contract instance, -/// forms the unique identifier of a token type. -/// -/// The CIS1 specification allows for up to 255 bytes for the token ID, but for -/// most cases using a smaller token ID is fine and can reduce contract energy -/// costs. -/// -/// This token ID uses u32 for representing the token ID bytes which means the -/// token ID space is fixed to 4 bytes and some token IDs cannot be represented. -/// For a more general token ID type see `TokenIdVec`. -#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] -pub struct TokenIdU32(pub u32); - - -impl IsTokenId for TokenIdU32 {} - - -impl schema::SchemaType for TokenIdU32 { - fn get_type() -> schema::Type { - schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) - } -} - - -impl From for TokenIdU32 { - fn from(id: u32) -> Self { - TokenIdU32(id) - } -} - - -/// The `TokenIdU32` is serialized with one byte with the value 4 followed by 4 -/// bytes to encode a u32 in little endian. -impl Serial for TokenIdU32 { - fn serial(&self, out: &mut W) -> Result<(), W::Err> { - out.write_u8(4)?; - out.write_u32(self.0) - } -} - - -/// The `TokenIdU32` will deserialize one byte ensuring this contains the value -/// 4 and then deserialize a u32 as little endian. It will result in an error if -/// the first byte is not 4. -impl Deserial for TokenIdU32 { - fn deserial(source: &mut R) -> ParseResult { - let byte_length = source.read_u8()?; - if byte_length == 4 { - Ok(TokenIdU32(source.read_u32()?)) - } else { - Err(ParseError::default()) - } - } -} - -// /// Display the token ID as a uppercase hex string -// impl fmt::Display for TokenIdU32 { -// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { -// for byte in &self.0.to_le_bytes() { -// write!(f, "{:02X}", byte)?; -// } -// Ok(()) -// } -// } - - -/// Token Identifier, which combined with the address of the contract instance, -/// forms the unique identifier of a token type. -/// -/// The CIS1 specification allows for up to 255 bytes for the token ID, but for -/// most cases using a smaller token ID is fine and can reduce contract energy -/// costs. -/// -/// This token ID uses u16 for representing the token ID bytes which means the -/// token ID space is fixed to 2 bytes and some token IDs cannot be represented. -/// For a more general token ID type see `TokenIdVec`. -#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] -pub struct TokenIdU16(pub u16); - - -impl IsTokenId for TokenIdU16 {} - - -impl schema::SchemaType for TokenIdU16 { - fn get_type() -> schema::Type { - schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) - } -} - - -impl From for TokenIdU16 { - fn from(id: u16) -> Self { - TokenIdU16(id) - } -} - - -/// The `TokenIdU16` is serialized with one byte with the value 2 followed by 2 -/// bytes to encode a u16 in little endian. -impl Serial for TokenIdU16 { - fn serial(&self, out: &mut W) -> Result<(), W::Err> { - out.write_u8(2)?; - out.write_u16(self.0) - } -} - - -/// The `TokenIdU16` will deserialize one byte ensuring this contains the value -/// 2 and then deserialize a u16 as little endian. It will result in an error if -/// the first byte is not 2. -impl Deserial for TokenIdU16 { - fn deserial(source: &mut R) -> ParseResult { - let byte_length = source.read_u8()?; - if byte_length == 2 { - Ok(TokenIdU16(source.read_u16()?)) - } else { - Err(ParseError::default()) - } - } -} - -// /// Display the token ID as a uppercase hex string -// impl fmt::Display for TokenIdU16 { -// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { -// for byte in &self.0.to_le_bytes() { -// write!(f, "{:02X}", byte)?; -// } -// Ok(()) -// } -// } - - -/// Token Identifier, which combined with the address of the contract instance, -/// forms the unique identifier of a token type. -/// -/// The CIS1 specification allows for up to 255 bytes for the token ID, but for -/// most cases using a smaller token ID is fine and can reduce contract energy -/// costs. -/// -/// This token ID uses u8 for representing the token ID bytes which means the -/// token ID space is fixed to 1 byte and some token IDs cannot be represented. -/// For a more general token ID type see `TokenIdVec`. -#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] -pub struct TokenIdU8(pub u8); - - -impl IsTokenId for TokenIdU8 {} - - -impl schema::SchemaType for TokenIdU8 { - fn get_type() -> schema::Type { - schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) - } -} - - -impl From for TokenIdU8 { - fn from(id: u8) -> Self { - TokenIdU8(id) - } -} - - -/// The `TokenIdU8` is serialized with one byte with the value 1 followed by 1 -/// bytes to encode a u8 in little endian. -impl Serial for TokenIdU8 { - fn serial(&self, out: &mut W) -> Result<(), W::Err> { - out.write_u8(1)?; - out.write_u8(self.0) - } -} - - -/// The `TokenIdU8` will deserialize one byte ensuring this contains the value 1 -/// and then deserialize a u8 as little endian. It will result in an error if -/// the first byte is not 1. -impl Deserial for TokenIdU8 { - fn deserial(source: &mut R) -> ParseResult { - let byte_length = source.read_u8()?; - if byte_length == 1 { - Ok(TokenIdU8(source.read_u8()?)) - } else { - Err(ParseError::default()) - } - } -} - -// /// Display the token ID as a uppercase hex string -// impl fmt::Display for TokenIdU8 { -// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { -// for byte in &self.0.to_le_bytes() { -// write!(f, "{:02X}", byte)?; -// } -// Ok(()) -// } -// } - - -/// Token Identifier, which combined with the address of the contract instance, -/// forms the unique identifier of a token type. -/// -/// The CIS1 specification allows for up to 255 bytes for the token ID, but for -/// most cases using a smaller token ID is fine and can reduce contract energy -/// costs. -/// -/// This token ID uses Unit for representing token IDs, which means only one -/// token ID can be represented with this type and other token IDs cannot be -/// represented. For a more general token ID type see `TokenIdVec`. -#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] -pub struct TokenIdUnit(); - - -impl IsTokenId for TokenIdUnit {} - - -impl schema::SchemaType for TokenIdUnit { - fn get_type() -> schema::Type { - schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) - } -} - - -/// The `TokenIdUnit` is serialized with one byte with the value 0. -impl Serial for TokenIdUnit { - fn serial(&self, out: &mut W) -> Result<(), W::Err> { - out.write_u8(0) - } -} - - -/// The `TokenIdUnit` will deserialize one byte ensuring this contains the value -/// 0. It will result in an error if the byte is not 0. -impl Deserial for TokenIdUnit { - fn deserial(source: &mut R) -> ParseResult { - let byte_length = source.read_u8()?; - if byte_length == 0 { - Ok(TokenIdUnit()) - } else { - Err(ParseError::default()) - } - } -} - -// #[cfg(not(feature="hacspec"))] -/// An amount of a specific token type. -pub type TokenAmount = u64; - - -/// An untagged event of a transfer of some amount of tokens from one address to -/// another. For a tagged version, use `Cis1Event`. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct TransferEvent { - /// The ID of the token being transferred. - pub token_id: T, - /// The amount of tokens being transferred. - pub amount: TokenAmount, - /// The address owning these tokens before the transfer. - pub from: Address, - /// The address to receive these tokens after the transfer. - pub to: Address, -} - - -/// An untagged event of tokens being minted, could be a new token type or -/// extending the total supply of existing token. -/// For a tagged version, use `Cis1Event`. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct MintEvent { - /// The ID of the token being minted, (possibly a new token ID). - pub token_id: T, - /// The number of tokens being minted, this is allowed to be 0 as well. - pub amount: TokenAmount, - /// The initial owner of these newly minted amount of tokens. - pub owner: Address, -} - - -/// An untagged event of some amount of a token type being burned. -/// For a tagged version, use `Cis1Event`. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct BurnEvent { - /// The ID of the token where an amount is being burned. - pub token_id: T, - /// The amount of tokens being burned. - pub amount: TokenAmount, - /// The owner of the tokens being burned. - pub owner: Address, -} - - -/// The update to an the operator. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the variants cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub enum OperatorUpdate { - /// Remove the operator. - Remove, - /// Add an address as an operator. - Add, -} - - -/// An untagged event of an update to an operator address for an owner address. -/// For a tagged version, use `Cis1Event`. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct UpdateOperatorEvent { - /// The update to the operator. - pub update: OperatorUpdate, - /// The address for whom, the operator is updated. - pub owner: Address, - /// The address who is the operator being updated. - pub operator: Address, -} - - -/// An untagged event for setting the metadata for a token. -/// For a tagged version, use `Cis1Event`. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct TokenMetadataEvent { - /// The ID of the token. - pub token_id: T, - /// The location of the metadata. - pub metadata_url: MetadataUrl, -} - - -/// Tagged CIS1 event to be serialized for the event log. -#[derive(Debug)] -pub enum Cis1Event { - /// A transfer between two addresses of some amount of tokens. - Transfer(TransferEvent), - /// Creation of new tokens, could be both adding some amounts to an existing - /// token or introduce an entirely new token ID. - Mint(MintEvent), - /// Destruction of tokens removing some amounts of a token. - Burn(BurnEvent), - /// Updates to an operator for a specific address and token id. - UpdateOperator(UpdateOperatorEvent), - /// Setting the metadata for a token. - TokenMetadata(TokenMetadataEvent), -} - - -impl Serial for Cis1Event { - fn serial(&self, out: &mut W) -> Result<(), W::Err> { - match self { - Cis1Event::Transfer(event) => { - out.write_u8(TRANSFER_EVENT_TAG)?; - event.serial(out) - } - Cis1Event::Mint(event) => { - out.write_u8(MINT_EVENT_TAG)?; - event.serial(out) - } - Cis1Event::Burn(event) => { - out.write_u8(BURN_EVENT_TAG)?; - event.serial(out) - } - Cis1Event::UpdateOperator(event) => { - out.write_u8(UPDATE_OPERATOR_EVENT_TAG)?; - event.serial(out) - } - Cis1Event::TokenMetadata(event) => { - out.write_u8(TOKEN_METADATA_EVENT_TAG)?; - event.serial(out) - } - } - } -} - - -impl Deserial for Cis1Event { - fn deserial(source: &mut R) -> ParseResult { - let tag = source.read_u8()?; - match tag { - TRANSFER_EVENT_TAG => TransferEvent::::deserial(source).map(Cis1Event::Transfer), - MINT_EVENT_TAG => MintEvent::::deserial(source).map(Cis1Event::Mint), - BURN_EVENT_TAG => BurnEvent::::deserial(source).map(Cis1Event::Burn), - UPDATE_OPERATOR_EVENT_TAG => { - UpdateOperatorEvent::deserial(source).map(Cis1Event::UpdateOperator) - } - TOKEN_METADATA_EVENT_TAG => { - TokenMetadataEvent::::deserial(source).map(Cis1Event::TokenMetadata) - } - _ => Err(ParseError::default()), - } - } -} - - -/// The different errors the contract can produce. -#[derive(Debug, PartialEq, Eq)] -pub enum Cis1Error { - /// Invalid token id (Error code: -42000001). - InvalidTokenId, - /// The balance of the token owner is insufficient for the transfer (Error - /// code: -42000002). - InsufficientFunds, - /// Sender is unauthorized to call this function (Error code: -42000003). - Unauthorized, - /// Custom error - Custom(R), -} - - -/// Convert Cis1Error into a reject with error code: -/// - InvalidTokenId: -42000001 -/// - InsufficientFunds: -42000002 -/// - Unauthorized: -42000003 -impl> From> for Reject { - fn from(err: Cis1Error) -> Self { - let error_code = match err { - Cis1Error::InvalidTokenId => unsafe { NonZeroI32::new_unchecked(-42000001) }, - Cis1Error::InsufficientFunds => unsafe { NonZeroI32::new_unchecked(-42000002) }, - Cis1Error::Unauthorized => unsafe { NonZeroI32::new_unchecked(-42000003) }, - Cis1Error::Custom(reject) => reject.into().error_code, - }; - Self { error_code } - } -} - - -impl> From for Cis1Error { - #[inline] - fn from(err: LogError) -> Self { - Cis1Error::Custom(X::from(err)) - } -} - - -impl> From for Cis1Error { - #[inline] - fn from(err: ParseError) -> Self { - Cis1Error::Custom(X::from(err)) - } -} - - -/// The receiving address for a transfer, similar to the Address type, but -/// contains extra information when the receiver address is a contract. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the variants and the order of their fields -// cannot be changed. -#[derive(Debug, Serialize)] -pub enum Receiver { - /// The receiver is an account address. - Account( - /// The receiving address. - AccountAddress, - ), - /// The receiver is a contract address. - Contract( - /// The receiving address. - ContractAddress, - /// The function to call on the receiving contract. - OwnedReceiveName, - ), -} - - -impl Receiver { - /// Construct a receiver from an account address. - pub fn from_account(address: AccountAddress) -> Self { - Receiver::Account(address) - } - - /// Construct a receiver from a contract address. - pub fn from_contract(address: ContractAddress, function: OwnedReceiveName) -> Self { - Receiver::Contract(address, function) - } - - /// Get the Address of the receiver. - pub fn address(&self) -> Address { - match self { - Receiver::Account(address) => Address::Account(*address), - Receiver::Contract(address, ..) => Address::Contract(*address), - } - } -} - - -impl schema::SchemaType for Receiver { - fn get_type() -> schema::Type { - schema::Type::Enum(vec![ - ( - String::from("Account"), - schema::Fields::Unnamed(vec![AccountAddress::get_type()]), - ), - ( - String::from("Contract"), - schema::Fields::Unnamed(vec![ - ContractAddress::get_type(), - OwnedReceiveName::get_type(), - ]), - ), - ]) - } -} - - -impl From for Receiver { - fn from(address: AccountAddress) -> Self { - Self::from_account(address) - } -} - - -/// Additional information to include with a transfer. -#[derive(Debug, Serialize)] -pub struct AdditionalData( - // #[concordium(size_length = 2)] - Vec, -); - - -impl schema::SchemaType for AdditionalData { - fn get_type() -> schema::Type { - schema::Type::List(schema::SizeLength::U16, Box::new(schema::Type::U8)) - } -} - - -impl AdditionalData { - /// Construct an AdditionalData containing no data. - pub fn empty() -> Self { - AdditionalData(Vec::new()) - } -} - - -impl From> for AdditionalData { - fn from(data: Vec) -> Self { - AdditionalData(data) - } -} - - -impl AsRef<[u8]> for AdditionalData { - fn as_ref(&self) -> &[u8] { - &self.0 - } -} - - -/// A single transfer of some amount of a token. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize)] -pub struct Transfer { - /// The ID of the token being transferred. - pub token_id: T, - /// The amount of tokens being transferred. - pub amount: TokenAmount, - /// The address owning the tokens being transferred. - pub from: Address, - /// The address receiving the tokens being transferred. - pub to: Receiver, - /// Additional data to include in the transfer. - /// Can be used for additional arguments. - pub data: AdditionalData, -} - - -impl schema::SchemaType for Transfer { - fn get_type() -> schema::Type { - schema::Type::Struct(schema::Fields::Named(vec![ - (String::from("token_id"), T::get_type()), - (String::from("amount"), TokenAmount::get_type()), - (String::from("from"), Address::get_type()), - (String::from("to"), Receiver::get_type()), - (String::from("data"), AdditionalData::get_type()), - ])) - } -} - - -/// The parameter type for the contract function `transfer`. -#[derive(Debug, Serialize)] -pub struct TransferParams( - // #[concordium(size_length = 2)] - pub Vec>, -); - - -impl schema::SchemaType for TransferParams { - fn get_type() -> schema::Type { - schema::Type::List(schema::SizeLength::U16, Box::new(Transfer::::get_type())) - } -} - - -impl From>> for TransferParams { - fn from(transfers: Vec>) -> Self { - TransferParams(transfers) - } -} - - -impl AsRef<[Transfer]> for TransferParams { - fn as_ref(&self) -> &[Transfer] { - &self.0 - } -} - - -/// A single update of an operator. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct UpdateOperator { - /// The update for this operator. - pub update: OperatorUpdate, - /// The address which is either added or removed as an operator. - /// Note: The address for whom this will become an operator is the sender of - /// the contract transaction. - pub operator: Address, -} - - -/// The parameter type for the contract function `updateOperator`. -#[derive(Debug, Serialize, SchemaType)] -pub struct UpdateOperatorParams( - // #[concordium(size_length = 2)] - pub Vec, -); - - -/// A query for the balance of a given address for a given token. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct BalanceOfQuery { - /// The ID of the token for which to query the balance of. - pub token_id: T, - /// The address for which to query the balance of. - pub address: Address, -} - - -/// The parameter type for the contract function `balanceOf`. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct BalanceOfQueryParams { - /// The contract to trigger with the results of the queries. - pub result_contract: ContractAddress, - /// The contract function to trigger with the results of the queries. - pub result_function: OwnedReceiveName, - /// List of balance queries. - // #[concordium(size_length = 2)] - pub queries: Vec>, -} - - -/// BalanceOf query with the result of the query. -pub type BalanceOfQueryResult = (BalanceOfQuery, TokenAmount); - - -/// The response which is sent back when calling the contract function -/// `balanceOf`. -/// It consists of the list of queries paired with their corresponding result. -#[derive(Debug, Serialize, SchemaType)] -pub struct BalanceOfQueryResponse( - // #[concordium(size_length = 2)] - Vec>, -); - - -impl From>> for BalanceOfQueryResponse { - fn from(results: Vec>) -> Self { - BalanceOfQueryResponse(results) - } -} - - -impl AsRef<[BalanceOfQueryResult]> for BalanceOfQueryResponse { - fn as_ref(&self) -> &[BalanceOfQueryResult] { - &self.0 - } -} - - -/// A query for the operator of a given address for a given token. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct OperatorOfQuery { - /// The ID of the token for which to query the balance of. - pub owner: Address, - /// The address for which to check for being an operator of the owner. - pub address: Address, -} - - -/// The parameter type for the contract function `operatorOf`. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct OperatorOfQueryParams { - /// The contract to trigger with the results of the queries. - pub result_contract: ContractAddress, - /// The contract function to trigger with the results of the queries. - pub result_function: OwnedReceiveName, - /// List of operatorOf queries. - // #[concordium(size_length = 2)] - pub queries: Vec, -} - - -/// OperatorOf query with the result of the query. -pub type OperatorOfQueryResult = (OperatorOfQuery, bool); - - -/// The response which is sent back when calling the contract function -/// `operatorOf`. -/// It consists of the list of queries paired with their corresponding result. -#[derive(Debug, Serialize, SchemaType)] -pub struct OperatorOfQueryResponse( - // #[concordium(size_length = 2)] - Vec, -); - - -impl From> for OperatorOfQueryResponse { - fn from(results: Vec) -> Self { - OperatorOfQueryResponse(results) - } -} - - -impl AsRef<[OperatorOfQueryResult]> for OperatorOfQueryResponse { - fn as_ref(&self) -> &[OperatorOfQueryResult] { - &self.0 - } -} - - -/// The parameter type for the contract function `tokenMetadata`. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct TokenMetadataQueryParams { - /// The contract to trigger with the results of the queries. - pub result_contract: ContractAddress, - /// The contract function to trigger with the results of the queries. - pub result_function: OwnedReceiveName, - /// List of balance queries. - // #[concordium(size_length = 2)] - pub queries: Vec, -} - - -/// TokenMetadata query with the result of the query. -pub type TokenMetadataQueryResult = (T, MetadataUrl); - - -/// The response which is sent back when calling the contract function -/// `tokenMetadata`. -/// It consists of the list of queries paired with their corresponding result. -#[derive(Debug, Serialize, SchemaType)] -pub struct TokenMetadataQueryResponse( - // #[concordium(size_length = 2)] - Vec>, -); - - -impl From>> for TokenMetadataQueryResponse { - fn from(results: Vec>) -> Self { - TokenMetadataQueryResponse(results) - } -} - - -impl AsRef<[TokenMetadataQueryResult]> for TokenMetadataQueryResponse { - fn as_ref(&self) -> &[TokenMetadataQueryResult] { - &self.0 - } -} - -/// The parameter type for a contract function which receives CIS1 tokens. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct OnReceivingCis1Params { - /// The ID of the token received. - pub token_id: T, - /// The amount of tokens received. - pub amount: TokenAmount, - /// The previous owner of the tokens. - pub from: Address, - /// The name of the token contract which is tracking the token and - /// implements CIS1. - pub contract_name: OwnedContractName, - /// Some extra information which where sent as part of the transfer. - pub data: AdditionalData, -} diff --git a/wCCD/src/wccd.rs b/wCCD/src/wccd.rs deleted file mode 100644 index c3cebed..0000000 --- a/wCCD/src/wccd.rs +++ /dev/null @@ -1,908 +0,0 @@ -#![no_std] -#![feature(register_tool)] -#![register_tool(hax)] - -#[hax_lib_macros::skip] -extern crate hax_lib_macros; -#[hax_lib_macros::skip] -use hax_lib_macros::*; - -#[skip] -use hacspec_concordium::*; -#[skip] -use hacspec_concordium_derive::*; - -mod cis1; -pub use cis1::*; - -pub use concordium_contracts_common::{HashMap as Map, HashSet as Set}; - -/// Contract token ID type. -/// Since this contract will only ever contain this one token type, we use the -/// smallest possible token ID. -type ContractTokenId = TokenIdUnit; - -/// The id of the wCCD token in this contract. -const TOKEN_ID_WCCD: ContractTokenId = TokenIdUnit(); - -// #[cfg(not(feature = "hacspec"))] -/// The metadata url for the wCCD token. -const TOKEN_METADATA_URL: &str = "https://some.example/token/wccd"; - -// Types - -// #[cfg(not(feature = "hacspec"))] -/// The state tracked for each address. -#[derive(Serialize, SchemaType, Clone)] -struct AddressState { - /// The number of tokens owned by this address. - balance: TokenAmount, - /// The address which are currently enabled as operators for this token and - /// this address. - // #[concordium(size_length = 1)] - operators: Set
, -} - -// #[contract_state(contract = "CIS1-wCCD")] -// #[derive(Serialize, SchemaType)] -// struct StateHacspec(pub PublicByteSeq); // Map - -// #[cfg(not(feature = "hacspec"))] -/// The contract state, -#[hax::contract_state(contract = "CIS1-wCCD")] -#[derive(Serialize, SchemaType, Clone)] -struct State { - /// The state the one token. - token: Map, -} - -// #[cfg(not(feature = "hacspec"))] -/// The parameter type for the contract function `unwrap`. -/// Takes an amount of tokens and unwrap the CCD and send it to a receiver. -#[derive(Serialize, SchemaType)] -struct UnwrapParams { - /// The amount of tokens to unwrap. - amount: TokenAmount, - /// The owner of the tokens. - owner: Address, - /// The address to receive these unwrapped CCD. - receiver: cis1::Receiver, - /// Some additional bytes to include in the transfer. - data: AdditionalData, -} - -// #[cfg(not(feature = "hacspec"))] -/// The parameter type for the contract function `wrap`. -/// -/// The receiver for the wrapped CCD tokens. -#[derive(Serialize, SchemaType)] -struct WrapParams { - /// The address to receive these tokens. - /// If the receiver is the sender of the message wrapping the tokens, it - /// will not log a transfer. - to: cis1::Receiver, - /// Some additional bytes to include in a transfer. - data: AdditionalData, -} - -// #[cfg(not(feature = "hacspec"))] -/// The different errors the contract can produce. -#[derive(Serialize, Debug, PartialEq, Eq, Reject)] -enum CustomContractError { - /// Failed parsing the parameter. - #[from(ParseError)] - ParseParams, - /// Failed logging: Log is full. - LogFull, - /// Failed logging: Log is malformed. - LogMalformed, -} - -// #[cfg(not(feature = "hacspec"))] -type ContractError = Cis1Error; - -// #[cfg(not(feature = "hacspec"))] -type ContractResult = Result; - -// #[cfg(not(feature = "hacspec"))] -/// Mapping the logging errors to ContractError. -impl From for CustomContractError { - fn from(le: LogError) -> Self { - match le { - LogError::Full => Self::LogFull, - LogError::Malformed => Self::LogMalformed, - } - } -} - -// #[cfg(not(feature = "hacspec"))] -/// Mapping CustomContractError to ContractError -impl From for ContractError { - fn from(c: CustomContractError) -> Self { - Cis1Error::Custom(c) - } -} - -// #[cfg(not(feature = "hacspec"))] -impl State { - /// Creates a new state with no one owning any tokens by default. - fn new() -> Self { - State { - token: Map::default(), - } - } - - /// Get the current balance of a given token id for a given address. - /// Results in an error if the token id does not exist in the state. - fn balance( - &self, - token_id: &ContractTokenId, - address: &Address, - ) -> ContractResult { - // ensure_eq!(token_id, &TOKEN_ID_WCCD, ContractError::InvalidTokenId); - Ok(self.token.get(address).map(|s| s.balance).unwrap_or(0)) - } - - /// Check is an address is an operator of a specific owner address. - /// Results in an error if the token id does not exist in the state. - fn is_operator(&self, address: &Address, owner: &Address) -> bool { - self.token - .get(owner) - .map(|address_state| address_state.operators.contains(address)) - .unwrap_or(false) - } - - /// Update the state with a transfer. - /// Results in an error if the token id does not exist in the state or if - /// the from address have insufficient tokens to do the transfer. - fn transfer( - &mut self, - token_id: &ContractTokenId, - amount: TokenAmount, - from: &Address, - to: &Address, - ) -> ContractResult<()> { - // ensure_eq!(token_id, &TOKEN_ID_WCCD, ContractError::InvalidTokenId); - if amount == 0 { - return Ok(()); - } - let from_state = self - .token - .get_mut(from) - .ok_or(ContractError::InsufficientFunds)?; - ensure!( - from_state.balance >= amount, - ContractError::InsufficientFunds - ); - from_state.balance -= amount; - let to_state = self.token.entry(*to).or_insert_with(|| AddressState { - balance: 0, - operators: Set::default(), - }); - to_state.balance += amount; - Ok(()) - } - - /// Update the state adding a new operator for a given token id and address. - /// Results in an error if the token id does not exist in the state. - /// Succeeds even if the `operator` is already an operator for this - /// `token_id` and `address`. - fn add_operator(&mut self, owner: &Address, operator: &Address) { - let address_state = self.token.entry(*owner).or_insert_with(|| AddressState { - balance: 0, - operators: Set::default(), - }); - address_state.operators.insert(*operator); - } - - /// Update the state removing an operator for a given token id and address. - /// Results in an error if the token id does not exist in the state. - /// Succeeds even if the `operator` is not an operator for this `token_id` - /// and `address`. - fn remove_operator(&mut self, owner: &Address, operator: &Address) { - self.token - .get_mut(owner) - .map(|address_state| address_state.operators.remove(operator)); - } - - fn mint( - &mut self, - token_id: &ContractTokenId, - amount: TokenAmount, - owner: &Address, - ) -> ContractResult<()> { - // ensure_eq!(token_id, &TOKEN_ID_WCCD, ContractError::InvalidTokenId); - let address_state = self.token.entry(*owner).or_insert_with(|| AddressState { - balance: 0, - operators: Set::default(), - }); - address_state.balance += amount; - Ok(()) - } - - fn burn( - &mut self, - token_id: &ContractTokenId, - amount: TokenAmount, - owner: &Address, - ) -> ContractResult<()> { - // ensure_eq!(token_id, &TOKEN_ID_WCCD, ContractError::InvalidTokenId); - if amount == 0 { - return Ok(()); - } - let from_state = self - .token - .get_mut(owner) - .ok_or(ContractError::InsufficientFunds)?; - ensure!( - from_state.balance >= amount, - ContractError::InsufficientFunds - ); - from_state.balance -= amount; - Ok(()) - } -} - -// Contract functions - -// // #[cfg(feature = "hacspec")] -// /// Initialize contract instance with no initial tokens. -// /// Logs a `Mint` event for the single token id with no amounts. -// #[init(contract = "CIS1-wCCD", enable_logger)] -// pub fn contract_init(ctx: Context) -> (Context, StateHacspec) { -// (ctx, StateHacspec(PublicByteSeq::new(0))) -// } - -// #[cfg(not(feature = "hacspec"))] -/// Initialize contract instance with no initial tokens. -/// Logs a `Mint` event for the single token id with no amounts. -#[hax::init(contract = "CIS1-wCCD", enable_logger)] -fn contract_init(ctx: &impl HasInitContext, logger: &mut impl HasLogger) -> InitResult { - // Construct the initial contract state. - let state = State::new(); - // Get the instantiater of this contract instance. - let invoker = Address::Account(ctx.init_origin()); - // Log event for the newly minted token. - // logger.log(&Cis1Event::Mint(MintEvent { - // token_id: TOKEN_ID_WCCD, - // amount: 0, - // owner: invoker, - // }))?; - - // Log event for where to find metadata for the token - // logger.log(&Cis1Event::TokenMetadata(TokenMetadataEvent { - // token_id: TOKEN_ID_WCCD, - // metadata_url: MetadataUrl { - // url: String::from(TOKEN_METADATA_URL), - // hash: None, - // }, - // }))?; - - Ok(state) -} - -// #[cfg(not(feature = "hacspec"))] -/// Wrap an amount of CCD into wCCD tokens and transfer the tokens if the sender -/// is not the receiver. -#[hax::receive( - contract = "CIS1-wCCD", - name = "wrap", - parameter = "WrapParams", - enable_logger, - payable -)] -fn contract_wrap( - ctx: &impl HasReceiveContext, - amount: Amount, - logger: &impl HasLogger, - state: State, -) -> Result<(A, State), cis1::Cis1Error> { - let params: WrapParams = ctx.parameter_cursor().get()?; - // Get the sender who invoked this contract function. - let sender = ctx.sender(); - - let receive_address = params.to.address(); - - // Update the state. - state.mint(&TOKEN_ID_WCCD, amount.micro_ccd, &receive_address)?; - - // Log the newly minted tokens. - // logger.log(&Cis1Event::Mint(MintEvent { - // token_id: TOKEN_ID_WCCD, - // amount: amount.micro_ccd, - // owner: sender, - // }))?; - - // Only log a transfer event if receiver is not the one who payed for this. - // if sender != receive_address { - // logger.log(&Cis1Event::Transfer(TransferEvent { - // token_id: TOKEN_ID_WCCD, - // amount: amount.micro_ccd, - // from: sender, - // to: receive_address, - // }))?; - // } - - let mut state_ret = state.clone(); - - // Send message to the receiver of the tokens. - if let cis1::Receiver::Contract(address, function) = params.to { - let parameter = OnReceivingCis1Params { - token_id: TOKEN_ID_WCCD, - amount: amount.micro_ccd, - from: sender, - contract_name: OwnedContractName::new_unchecked(String::from("init_CIS1-wCCD")), - data: params.data, - }; - let param_bytes = concordium_contracts_common::to_bytes(¶meter); - Ok((A::send_raw(&address, function.as_ref(), Amount::zero(), ¶m_bytes), state_ret)) - } else { - Ok((A::accept(), state_ret)) - } -} - -// #[cfg(not(feature = "hacspec"))] -/// Unwrap an amount of wCCD tokens into CCD -#[hax::receive( - contract = "CIS1-wCCD", - name = "unwrap", - parameter = "UnwrapParams", - enable_logger -)] -fn contract_unwrap( - ctx: &impl HasReceiveContext, - logger: &mut impl HasLogger, - state: State, -) -> Result<(A, State), cis1::Cis1Error> { - let params: UnwrapParams = ctx.parameter_cursor().get()?; - // Get the sender who invoked this contract function. - let sender = ctx.sender(); - ensure!( - sender == params.owner || state.is_operator(&sender, ¶ms.owner), - ContractError::Unauthorized - ); - - // Update the state. - state.burn(&TOKEN_ID_WCCD, params.amount, ¶ms.owner)?; - - // Log the burning of tokens. - // logger.log(&Cis1Event::Burn(BurnEvent { - // token_id: TOKEN_ID_WCCD, - // amount: params.amount, - // owner: params.owner, - // }))?; - - let unwrapped_amount = Amount::from_micro_ccd(params.amount); - - let action = match params.receiver { - cis1::Receiver::Account(address) => A::simple_transfer(&address, unwrapped_amount), - cis1::Receiver::Contract(address, function) => { - A::send_raw(&address, function.as_ref(), unwrapped_amount, params.data.as_ref()) - } - }; - - let mut state_ret = state.clone(); - - Ok((action, state_ret)) -} - -// Contract functions required by CIS1 - -// #[cfg(not(feature = "hacspec"))] -#[allow(dead_code)] -type TransferParameter = TransferParams; - -// #[cfg(not(feature = "hacspec"))] -/// Execute a list of token transfers, in the order of the list. -/// -/// Logs a `Transfer` event for each transfer in the list. -/// Produces an action which sends a message to each contract which was the -/// receiver of a transfer. -/// -/// It rejects if: -/// - It fails to parse the parameter. -/// - Any of the transfers fail to be executed, which could be if: -/// - The `token_id` does not exist. -/// - The sender is not the owner of the token, or an operator for this -/// specific `token_id` and `from` address. -/// - The token is not owned by the `from`. -/// - Fails to log event. -/// - Any of the messages sent to contracts receiving a transfer choose to -/// reject. -#[hax::receive( - contract = "CIS1-wCCD", - name = "transfer", - parameter = "TransferParameter", - enable_logger -)] -fn contract_transfer( - ctx: &impl HasReceiveContext, - logger: &mut impl HasLogger, - state: State, -) -> Result<(A, State), cis1::Cis1Error> { - let mut cursor = ctx.parameter_cursor(); - // Parse the number of transfers. - let transfers_length: u8 = cursor.get()?; - // Get the sender who invoked this contract function. - let sender = ctx.sender(); - - let mut actions = A::accept(); - // Loop over the number of transfers. - for _ in 0..transfers_length { - // Parse one of the transfers. - let Transfer { - token_id, - amount, - from, - to, - data, - } = cursor.get()?; - // Authenticate the sender for this transfer - ensure!( - from == sender || state.is_operator(&sender, &from), - ContractError::Unauthorized - ); - let to_address = to.address(); - // Update the contract state - state.transfer(&token_id, amount, &from, &to_address)?; - - // Log transfer event - // logger.log(&Cis1Event::Transfer(TransferEvent { - // token_id, - // amount, - // from, - // to: to_address, - // }))?; - - // If the receiver is a contract, we add sending it a message to the list of - // actions. - if let cis1::Receiver::Contract(address, function) = to { - let parameter = OnReceivingCis1Params { - token_id, - amount, - from, - contract_name: OwnedContractName::new_unchecked(String::from("init_CIS1-Multi")), - data, - }; - // let action = hacspec_concordium::send(&address, function.as_ref(), Amount::zero(), parameter.data.as_ref()); // Was ¶meter - let action = A::accept(); - actions = actions.and_then(action); - } - } - let mut state_ret = state.clone(); - Ok((actions,state_ret)) -} - - -// #[cfg(not(feature="hacspec"))] -/// Enable or disable addresses as operators of the sender address. -/// Logs an `UpdateOperator` event. -/// -/// It rejects if: -/// - It fails to parse the parameter. -/// - The operator address is the same as the sender address. -/// - Fails to log event. -#[hax::receive( - contract = "CIS1-wCCD", - name = "updateOperator", - parameter = "UpdateOperatorParams", - enable_logger -)] -fn contract_update_operator( - ctx: &impl HasReceiveContext, - logger: &mut impl HasLogger, - state: State, -) -> Result<(A, State), cis1::Cis1Error> { - // Parse the parameter. - let UpdateOperatorParams(params) = ctx.parameter_cursor().get()?; - // Get the sender who invoked this contract function. - let sender = ctx.sender(); - - for param in params { - // Update the operator in the state. - match param.update { - OperatorUpdate::Add => state.add_operator(&sender, ¶m.operator), - OperatorUpdate::Remove => state.remove_operator(&sender, ¶m.operator), - } - - // Log the appropriate event - // logger.log(&Cis1Event::::UpdateOperator(UpdateOperatorEvent { - // owner: sender, - // operator: param.operator, - // update: param.update, - // }))?; - } - - let mut state_ret = state.clone(); - - Ok((A::accept(), state_ret)) -} - -// #[cfg(not(feature="hacspec"))] -/// Parameter type for the CIS-1 function `balanceOf` specialized to the subset -/// of TokenIDs used by this contract. -// This type is pub to silence the dead_code warning, as this type is only used -// for when generating the schema. -pub type ContractBalanceOfQueryParams = BalanceOfQueryParams; - -/// Get the balance of given token IDs and addresses. It takes a contract -/// address plus contract function to invoke with the result. -/// -/// It rejects if: -/// - Sender is not a contract. -/// - It fails to parse the parameter. -/// - Any of the queried `token_id` does not exist. -/// - Message sent back with the result rejects. -#[hax::receive(contract = "CIS1-wCCD", name = "balanceOf", parameter = "ContractBalanceOfQueryParams")] -fn contract_balance_of( - ctx: &impl HasReceiveContext, - state: State, -) -> Result<(A, State), cis1::Cis1Error> { - let mut cursor = ctx.parameter_cursor(); - // Parse the contract address to receive the result. - let result_contract: ContractAddress = cursor.get()?; - // Parse the contract function name to call with the result. - let result_hook: OwnedReceiveName = cursor.get()?; - // Parse the number of queries. - let queries_length: u8 = cursor.get()?; - - // Build the response. - let mut response = Vec::with_capacity(queries_length.into()); - for _ in 0..queries_length { - // Parse one of the queries. - let query: BalanceOfQuery = ctx.parameter_cursor().get()?; - // Query the state for balance. - let amount = state.balance(&query.token_id, &query.address)?; - response.push((query, amount)); - } - let mut state_ret = state.clone(); - // Send back the response. - Ok((A::send_raw( - &result_contract, - result_hook.as_ref(), - Amount::zero(), - &BalanceOfQueryResponse::from(response), - ), state_ret)) -} - -// #[cfg(not(feature="hacspec"))] -/// Takes a list of queries. Each query is an owner address and some address to -/// check as an operator of the owner address. It takes a contract address plus -/// contract function to invoke with the result. -/// -/// It rejects if: -/// - It fails to parse the parameter. -/// - Message sent back with the result rejects. -#[hax::receive(contract = "CIS1-wCCD", name = "operatorOf", parameter = "OperatorOfQueryParams")] -fn contract_operator_of( - ctx: &impl HasReceiveContext, - state: State, -) -> Result<(A, State), cis1::Cis1Error> { - // Parse the parameter. - let params: OperatorOfQueryParams = ctx.parameter_cursor().get()?; - // Build the response. - let mut response = Vec::with_capacity(params.queries.len()); - for query in params.queries { - // Query the state for address being an operator of owner. - let is_operator = state.is_operator(&query.owner, &query.address); - response.push((query, is_operator)); - } - let mut state_ret = state.clone(); - // Send back the response. - Ok((A::send_raw( - ¶ms.result_contract, - params.result_function.as_ref(), - Amount::zero(), - &OperatorOfQueryResponse::from(response), - ), state_ret)) -} - -// #[cfg(not(feature="hacspec"))] -/// Parameter type for the CIS-1 function `tokenMetadata` specialized to the -/// subset of TokenIDs used by this contract. -// This type is pub to silence the dead_code warning, as this type is only used -// for when generating the schema. -pub type ContractTokenMetadataQueryParams = TokenMetadataQueryParams; - -// #[cfg(not(feature="hacspec"))] -/// Get the token metadata URLs and checksums given a list of token IDs. It -/// takes a contract address plus contract function to invoke with the result. -/// -/// It rejects if: -/// - It fails to parse the parameter. -/// - Any of the queried `token_id` does not exist. -/// - Message sent back with the result rejects. -#[hax::receive( - contract = "CIS1-wCCD", - name = "tokenMetadata", - parameter = "ContractTokenMetadataQueryParams" -)] -fn contract_token_metadata( - ctx: &impl HasReceiveContext, - _state: State, -) -> Result<(A, State), cis1::Cis1Error> { - let mut cursor = ctx.parameter_cursor(); - // Parse the contract address to receive the result. - let result_contract: ContractAddress = cursor.get()?; - // Parse the contract function name to call with the result. - let result_hook: OwnedReceiveName = cursor.get()?; - // Parse the number of queries. - let queries_length: u8 = cursor.get()?; - - // Build the response. - let mut response = Vec::with_capacity(queries_length.into()); - for _ in 0..queries_length { - let token_id: ContractTokenId = cursor.get()?; - // Check the token exists. - ensure_eq!(token_id, TOKEN_ID_WCCD, ContractError::InvalidTokenId); - - let metadata_url = MetadataUrl { - url: TOKEN_METADATA_URL.to_string(), - hash: None, - }; - response.push((token_id, metadata_url)); - } - let mut state_ret = _state.clone(); - // Send back the response. - Ok((A::send_raw( - &result_contract, - result_hook.as_ref(), - Amount::zero(), - &TokenMetadataQueryResponse::from(response), - ), state_ret)) -} - -// Tests - -// // #[cfg(not(feature="hacspec"))] -// #[concordium_cfg_test] -// mod tests { -// use super::*; -// use test_infrastructure::*; - -// const ACCOUNT_0: AccountAddress = AccountAddress([0u8; 32]); -// const ADDRESS_0: Address = Address::Account(ACCOUNT_0); -// const ACCOUNT_1: AccountAddress = AccountAddress([1u8; 32]); -// const ADDRESS_1: Address = Address::Account(ACCOUNT_1); - -// /// Test helper function which creates a contract state where ADDRESS_0 owns -// /// 400 tokens. -// fn initial_state() -> State { -// let mut state = State::new(); -// state.mint(&TOKEN_ID_WCCD, 400, &ADDRESS_0).expect_report("Failed to setup state"); -// state -// } - -// /// Test initialization succeeds and the tokens are owned by the contract -// /// instantiater and the appropriate events are logged. -// #[concordium_test] -// fn test_init() { -// // Setup the context -// let mut ctx = InitContextTest::empty(); -// ctx.set_init_origin(ACCOUNT_0); - -// let mut logger = LogRecorder::init(); - -// // Call the contract function. -// let result = contract_init(&ctx, &mut logger); - -// // Check the result -// let state = result.expect_report("Contract initialization failed"); - -// // Check the state -// claim_eq!(state.token.len(), 0, "Only one token is initialized"); -// let balance0 = -// state.balance(&TOKEN_ID_WCCD, &ADDRESS_0).expect_report("Token is expected to exist"); -// claim_eq!(balance0, 0, "No initial tokens are owned by the contract instantiater"); - -// // Check the logs -// claim_eq!(logger.logs.len(), 2, "Exactly one event should be logged"); -// claim!( -// logger.logs.contains(&to_bytes(&Cis1Event::Mint(MintEvent { -// owner: ADDRESS_0, -// token_id: TOKEN_ID_WCCD, -// amount: 0, -// }))), -// "Missing event for minting the token" -// ); -// claim!( -// logger.logs.contains(&to_bytes(&Cis1Event::TokenMetadata(TokenMetadataEvent { -// token_id: TOKEN_ID_WCCD, -// metadata_url: MetadataUrl { -// url: String::from(TOKEN_METADATA_URL), -// hash: None, -// }, -// }))), -// "Missing event with metadata for the token" -// ); -// } - -// /// Test transfer succeeds, when `from` is the sender. -// #[concordium_test] -// fn test_transfer_account() { -// // Setup the context -// let mut ctx = ReceiveContextTest::empty(); -// ctx.set_sender(ADDRESS_0); - -// // and parameter. -// let transfer = Transfer { -// token_id: TOKEN_ID_WCCD, -// amount: 100, -// from: ADDRESS_0, -// to: cis1::Receiver::from_account(ACCOUNT_1), -// data: AdditionalData::empty(), -// }; -// let parameter = TransferParams::from(vec![transfer]); -// let parameter_bytes = to_bytes(¶meter); -// ctx.set_parameter(¶meter_bytes); - -// let mut logger = LogRecorder::init(); -// let mut state = State::new(); -// state.mint(&TOKEN_ID_WCCD, 400, &ADDRESS_0).expect_report("Failed to setup state"); - -// // Call the contract function. -// let result: ContractResult = contract_transfer(&ctx, &mut logger, &mut state); -// // Check the result. -// let actions = result.expect_report("Results in rejection"); -// claim_eq!(actions, ActionsTree::accept(), "No action should be produced."); - -// // Check the state. -// let balance0 = -// state.balance(&TOKEN_ID_WCCD, &ADDRESS_0).expect_report("Token is expected to exist"); -// let balance1 = -// state.balance(&TOKEN_ID_WCCD, &ADDRESS_1).expect_report("Token is expected to exist"); -// claim_eq!( -// balance0, -// 300, -// "Token owner balance should be decreased by the transferred amount" -// ); -// claim_eq!( -// balance1, -// 100, -// "Token receiver balance should be increased by the transferred amount" -// ); - -// // Check the logs. -// claim_eq!(logger.logs.len(), 1, "Only one event should be logged"); -// claim_eq!( -// logger.logs[0], -// to_bytes(&Cis1Event::Transfer(TransferEvent { -// from: ADDRESS_0, -// to: ADDRESS_1, -// token_id: TOKEN_ID_WCCD, -// amount: 100, -// })), -// "Incorrect event emitted" -// ) -// } - -// /// Test transfer token fails, when sender is neither the owner or an -// /// operator of the owner. -// #[concordium_test] -// fn test_transfer_not_authorized() { -// // Setup the context -// let mut ctx = ReceiveContextTest::empty(); -// ctx.set_sender(ADDRESS_1); - -// // and parameter. -// let transfer = Transfer { -// from: ADDRESS_0, -// to: cis1::Receiver::from_account(ACCOUNT_1), -// token_id: TOKEN_ID_WCCD, -// amount: 100, -// data: AdditionalData::empty(), -// }; -// let parameter = TransferParams::from(vec![transfer]); -// let parameter_bytes = to_bytes(¶meter); -// ctx.set_parameter(¶meter_bytes); - -// let mut logger = LogRecorder::init(); -// let mut state = initial_state(); - -// // Call the contract function. -// let result: ContractResult = contract_transfer(&ctx, &mut logger, &mut state); -// // Check the result. -// let err = result.expect_err_report("Expected to fail"); -// claim_eq!(err, ContractError::Unauthorized, "Error is expected to be Unauthorized") -// } - -// /// Test transfer succeeds when sender is not the owner, but is an operator -// /// of the owner. -// #[concordium_test] -// fn test_operator_transfer() { -// // Setup the context -// let mut ctx = ReceiveContextTest::empty(); -// ctx.set_sender(ADDRESS_1); - -// // and parameter. -// let transfer = Transfer { -// from: ADDRESS_0, -// to: cis1::Receiver::from_account(ACCOUNT_1), -// token_id: TOKEN_ID_WCCD, -// amount: 100, -// data: AdditionalData::empty(), -// }; -// let parameter = TransferParams::from(vec![transfer]); -// let parameter_bytes = to_bytes(¶meter); -// ctx.set_parameter(¶meter_bytes); - -// let mut logger = LogRecorder::init(); -// let mut state = initial_state(); -// state.add_operator(&ADDRESS_0, &ADDRESS_1); - -// // Call the contract function. -// let result: ContractResult = contract_transfer(&ctx, &mut logger, &mut state); - -// // Check the result. -// let actions: ActionsTree = result.expect_report("Results in rejection"); -// claim_eq!(actions, ActionsTree::accept(), "No action should be produced."); - -// // Check the state. -// let balance0 = -// state.balance(&TOKEN_ID_WCCD, &ADDRESS_0).expect_report("Token is expected to exist"); -// let balance1 = -// state.balance(&TOKEN_ID_WCCD, &ADDRESS_1).expect_report("Token is expected to exist"); -// claim_eq!(balance0, 300); //, "Token owner balance should be decreased by the transferred amount"); -// claim_eq!( -// balance1, -// 100, -// "Token receiver balance should be increased by the transferred amount" -// ); - -// // Check the logs. -// claim_eq!(logger.logs.len(), 1, "Only one event should be logged"); -// claim_eq!( -// logger.logs[0], -// to_bytes(&Cis1Event::Transfer(TransferEvent { -// from: ADDRESS_0, -// to: ADDRESS_1, -// token_id: TOKEN_ID_WCCD, -// amount: 100, -// })), -// "Incorrect event emitted" -// ) -// } - -// /// Test adding an operator succeeds and the appropriate event is logged. -// #[concordium_test] -// fn test_add_operator() { -// // Setup the context -// let mut ctx = ReceiveContextTest::empty(); -// ctx.set_sender(ADDRESS_0); - -// // and parameter. -// let update = UpdateOperator { -// operator: ADDRESS_1, -// update: OperatorUpdate::Add, -// }; -// let parameter = UpdateOperatorParams(vec![update]); -// let parameter_bytes = to_bytes(¶meter); -// ctx.set_parameter(¶meter_bytes); - -// let mut logger = LogRecorder::init(); -// let mut state = initial_state(); - -// // Call the contract function. -// let result: ContractResult = -// contract_update_operator(&ctx, &mut logger, &mut state); - -// // Check the result. -// let actions: ActionsTree = result.expect_report("Results in rejection"); -// claim_eq!(actions, ActionsTree::accept(), "No action should be produced."); - -// // Check the state. -// claim!(state.is_operator(&ADDRESS_1, &ADDRESS_0), "Account should be an operator"); - -// // Check the logs. -// claim_eq!(logger.logs.len(), 1, "One event should be logged"); -// claim_eq!( -// logger.logs[0], -// to_bytes(&Cis1Event::::UpdateOperator(UpdateOperatorEvent { -// owner: ADDRESS_0, -// operator: ADDRESS_1, -// update: OperatorUpdate::Add, -// })), -// "Incorrect event emitted" -// ) -// } -// } diff --git a/wCCD/wccd.org b/wCCD/wccd.org deleted file mode 100644 index 7c197b7..0000000 --- a/wCCD/wccd.org +++ /dev/null @@ -1,2713 +0,0 @@ - -#+TITLE: Auction Smartcontract -#+AUTHOR: Lasse Letager Hansen - -# rev: 4d4b024b547a1f120f6d6951cbc409c94f8f146a - -# Use org-tanglesync ! -# lentic - -#+HTML_HEAD: -#+PROPERTY: header-args:coq :session *Coq* - -# C-c C-v t - export this files -# C-c C-v b - create results / run this file -# C-c C-v s - create results / run subtree - -* General information -:PROPERTIES: -:header-args: sh :eval never :results output silent -:END: -** Resulting output -#+begin_src sh -cargo clean -#+end_src - -#+begin_src sh -cargo install --path language -#+end_src - -#+begin_src sh -cargo build -#+end_src - -#+begin_src sh -cargo hacspec -e v --dir coq/src --org-file WCCD.org hacspec-wccd --vc-update --vc-dir coq/ -#+end_src -* Config -#+begin_src toml :tangle ./Cargo.toml :mkdirp yes :eval never -[package] -name = "hacspec-wccd" -version = "0.1.0" -authors = [""] -edition = "2018" - -[lib] -path = "src/wccd.rs" - -[dependencies] -hacspec-lib = { path = "../../lib" } -# pearlite-syn = { path = "../../../../creusot/pearlite-syn" } -creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "7763b3ae77205fba83182b9a6c3e69ad0b12fec7" } -# hacspec = {optional = true} -concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850" , version = "=2.0.0" , default-features = false } # 0cffb859f736ff6726fa38600428a415d800d7b6 -hacspec-concordium = { path = "../concordium" } -hacspec-concordium-derive = { path = "../concordium-derive" } - -[features] -hacspec = [] -# use_attributes = ["hacspec-attributes", "hacspec-attributes/print_attributes"] - -[dev-dependencies] -hacspec-dev = { path = "../../utils/dev" } -criterion = "0.3" -rand = "0.8" -quickcheck = "1" -quickcheck_macros = "1" -#+end_src - -* Cis1 -** Rust code -:PROPERTIES: -:header-args: :tangle ./src/cis1.rs :mkdirp yes -:END: -*** Imports -#+begin_src rust :eval never -#[cfg(not(feature = "hacspec"))] -extern crate hacspec_lib; - -use hacspec_lib::*; - -// #[cfg(not(feature = "hacspec"))] -// extern crate creusot_contracts; -#[cfg(test)] -#[cfg(not(feature = "hacspec"))] -use creusot_contracts::{ensures, requires}; - -use hacspec_concordium::*; - -#[cfg(feature = "hacspec")] -use concert_lib::*; - -#+end_src - -#+begin_src rust :eval never -// #![cfg_attr(not(feature = "std"), no_std)] -// use concordium_std::*; -// #[cfg(not(feature = "std"))] -// use core::fmt; -// #[cfg(feature = "std")] -// use std::fmt; - -#[cfg(not(feature = "hacspec"))] -use convert::TryFrom; - -#[cfg(not(feature = "hacspec"))] -pub use hacspec_concordium::num::NonZeroI32; - -#+end_src -*** Consts -#+begin_src rust :eval never -/// Tag for the CIS1 Transfer event. -pub const TRANSFER_EVENT_TAG: u8 = 255u8; // u8::MAX -/// Tag for the CIS1 Mint event. -pub const MINT_EVENT_TAG: u8 = 255u8 - 1u8; // u8::MAX -/// Tag for the CIS1 Burn event. -pub const BURN_EVENT_TAG: u8 = 255u8 - 2u8; // u8::MAX -/// Tag for the CIS1 UpdateOperator event. -pub const UPDATE_OPERATOR_EVENT_TAG: u8 = 255u8 - 3u8; // u8::MAX -/// Tag for the CIS1 TokenMetadata event. -pub const TOKEN_METADATA_EVENT_TAG: u8 = 255u8 - 4u8; // u8::MAX - -#+end_src -*** Types -#+begin_src rust :eval never -/// Sha256 digest -#[cfg(feature = "hacspec")] -array!(Sha256, 32, u8); - -#[cfg(not(feature = "hacspec"))] -pub type Sha256 = [u8; 32]; - -// pub type Sha256 = ([ -// 0u8;0u8;0u8;0u8;0u8;0u8;0u8;0u8; -// 0u8;0u8;0u8;0u8;0u8;0u8;0u8;0u8; -// 0u8;0u8;0u8;0u8;0u8;0u8;0u8;0u8; -// 0u8;0u8;0u8;0u8;0u8;0u8;0u8;0u8]; - -#[cfg(feature = "hacspec")] -pub struct MetadataUrl(pub String, pub Option); - -#[cfg(not(feature = "hacspec"))] -/// The location of the metadata and an optional hash of the content. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType, Clone)] -pub struct MetadataUrl { - /// The URL following the specification RFC1738. - // #[concordium(size_length = 2)] - pub url: String, - /// A optional hash of the content. - pub hash: Option, -} - -#+end_src - -#+begin_src rust :eval never -#[cfg(not(feature = "hacspec"))] -/// Trait for marking types as CIS1 token IDs. -/// For a type to be a valid CIS1 token ID it must implement serialization and -/// schema type, such that the first byte indicates how many bytes is used to -/// represent the token ID, followed by this many bytes for the token ID. -/// -/// Note: The reason for introducing such a trait instead of representing every -/// token ID using Vec is to allow smart contracts to use specialized token -/// ID implementations avoiding allocations. -pub trait IsTokenId: Serialize + schema::SchemaType {} - -#+end_src -*** TokenIdVec -#+begin_src rust :eval never -#[cfg(feature = "hacspec")] -// #[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Clone, Serialize)] -pub struct TokenIdVec(pub PublicByteSeq); - -#[cfg(not(feature = "hacspec"))] -/// Token Identifier, which combined with the address of the contract instance, -/// forms the unique identifier of a token type. -/// -/// This token ID type can represent every possible token ID but requires -/// allocating a Vec. Using a fixed size token ID type (such as `TokenIdFixed`) -/// will avoid this. -/// -/// The CIS1 specification allows for up to 255 bytes for the token ID, but -/// unless the bytes have some significant meaning, it is most likely better to -/// use a smaller fixed size token ID such as `TokenIdU8`. -#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Clone, Serialize)] -pub struct TokenIdVec( - // #[concordium(size_length = 1)] - pub Vec, -); - -#[cfg(not(feature = "hacspec"))] -impl IsTokenId for TokenIdVec {} - -#[cfg(not(feature = "hacspec"))] -impl schema::SchemaType for TokenIdVec { - fn get_type() -> schema::Type { - schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) - } -} - -// #[cfg(not(feature="hacspec"))] -// /// Display the token ID as a uppercase hex string -// impl fmt::Display for TokenIdVec { -// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { -// for byte in &self.0 { -// write!(f, "{:02X}", byte)?; -// } -// Ok(()) -// } -// } - -#+end_src -*** TokenIdFixed -#+begin_src rust :eval never -#[cfg(not(feature = "hacspec"))] -/// Token Identifier, which combined with the address of the contract instance, -/// forms the unique identifier of a token type. -/// -/// The CIS1 specification allows for up to 255 bytes for the token ID, but for -/// most cases using a smaller token ID is fine and can reduce contract energy -/// costs. -/// -/// This token ID uses an array for representing the token ID bytes which means -/// the token ID space is fixed to `N` number of bytes and some token IDs cannot -/// be represented. For a more general token ID type see `TokenIdVec`. -/// For fixed sized token IDs with integer representations see `TokenIdU8`, -/// `TokenIdU16`, `TokenIdU32` and `TokenIdU64`. -#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] -pub struct TokenIdFixed(pub [u8; N]); - -#[cfg(not(feature = "hacspec"))] -impl IsTokenId for TokenIdFixed {} - -#[cfg(not(feature = "hacspec"))] -impl schema::SchemaType for TokenIdFixed { - fn get_type() -> schema::Type { - schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) - } -} - -#[cfg(not(feature = "hacspec"))] -impl From<[u8; N]> for TokenIdFixed { - fn from(id: [u8; N]) -> Self { - TokenIdFixed(id) - } -} - -#[cfg(not(feature = "hacspec"))] -/// The `TokenIdFixed` is serialized as the value of the first byte represents -/// the number of bytes followed for the rest of the token ID. -impl Serial for TokenIdFixed { - fn serial(&self, out: &mut W) -> Result<(), W::Err> { - let len = u8::try_from(N).map_err(|_| W::Err::default())?; - out.write_u8(len)?; - for byte in self.0 { - out.write_u8(byte)?; - } - Ok(()) - } -} - -#[cfg(not(feature = "hacspec"))] -/// The `TokenIdFixed` is deserialized by reading the first byte represents the -/// number of bytes and ensuring this value corresponds with the number of bytes -/// to use for the token ID. -impl Deserial for TokenIdFixed { - fn deserial(source: &mut R) -> ParseResult { - let byte_length = source.read_u8()?; - if usize::from(byte_length) != N { - return Err(ParseError::default()); - } - let bytes: [u8; N] = source.get()?; - Ok(TokenIdFixed(bytes)) - } -} - -// #[cfg(not(feature="hacspec"))] -// /// Display the token ID as a uppercase hex string -// impl fmt::Display for TokenIdFixed { -// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { -// for byte in &self.0 { -// write!(f, "{:02X}", byte)?; -// } -// Ok(()) -// } -// } - -#+end_src -*** TokenIdU64 -#+begin_src rust :eval never -#[cfg(not(feature = "hacspec"))] -/// Token Identifier, which combined with the address of the contract instance, -/// forms the unique identifier of a token type. -/// -/// The CIS1 specification allows for up to 255 bytes for the token ID, but for -/// most cases using a smaller token ID is fine and can reduce contract energy -/// costs. -/// -/// This token ID uses u64 for representing the token ID bytes which means the -/// token ID space is fixed to 8 bytes and some token IDs cannot be represented. -/// For a more general token ID type see `TokenIdVec`. -#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] -pub struct TokenIdU64(pub u64); - -#[cfg(not(feature = "hacspec"))] -impl IsTokenId for TokenIdU64 {} - -#[cfg(not(feature = "hacspec"))] -impl schema::SchemaType for TokenIdU64 { - fn get_type() -> schema::Type { - schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) - } -} - -#[cfg(not(feature = "hacspec"))] -impl From for TokenIdU64 { - fn from(id: u64) -> Self { - TokenIdU64(id) - } -} - -#[cfg(not(feature = "hacspec"))] -/// The `TokenIdU64` is serialized with one byte with the value 8 followed by 8 -/// bytes to encode a u64 in little endian. -impl Serial for TokenIdU64 { - fn serial(&self, out: &mut W) -> Result<(), W::Err> { - out.write_u8(8)?; - out.write_u64(self.0) - } -} - -#[cfg(not(feature = "hacspec"))] -/// The `TokenIdU64` will deserialize one byte ensuring this contains the value -/// 8 and then deserialize a u64 as little endian. It will result in an error if -/// the first byte is not 8. -impl Deserial for TokenIdU64 { - fn deserial(source: &mut R) -> ParseResult { - let byte_length = source.read_u8()?; - if byte_length == 8 { - Ok(TokenIdU64(source.read_u64()?)) - } else { - Err(ParseError::default()) - } - } -} - -// #[cfg(not(feature="hacspec"))] -// /// Display the token ID as a uppercase hex string -// impl fmt::Display for TokenIdU64 { -// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { -// for byte in &self.0.to_le_bytes() { -// write!(f, "{:02X}", byte)?; -// } -// Ok(()) -// } -// } - -#+end_src -*** TokenIdU32 -#+begin_src rust :eval never -#[cfg(feature = "hacspec")] -// #[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] -pub struct TokenIdU32(pub u32); - -#[cfg(not(feature = "hacspec"))] -/// Token Identifier, which combined with the address of the contract instance, -/// forms the unique identifier of a token type. -/// -/// The CIS1 specification allows for up to 255 bytes for the token ID, but for -/// most cases using a smaller token ID is fine and can reduce contract energy -/// costs. -/// -/// This token ID uses u32 for representing the token ID bytes which means the -/// token ID space is fixed to 4 bytes and some token IDs cannot be represented. -/// For a more general token ID type see `TokenIdVec`. -#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] -pub struct TokenIdU32(pub u32); - -#[cfg(not(feature = "hacspec"))] -impl IsTokenId for TokenIdU32 {} - -#[cfg(not(feature = "hacspec"))] -impl schema::SchemaType for TokenIdU32 { - fn get_type() -> schema::Type { - schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) - } -} - -#[cfg(not(feature = "hacspec"))] -impl From for TokenIdU32 { - fn from(id: u32) -> Self { - TokenIdU32(id) - } -} - -#[cfg(not(feature = "hacspec"))] -/// The `TokenIdU32` is serialized with one byte with the value 4 followed by 4 -/// bytes to encode a u32 in little endian. -impl Serial for TokenIdU32 { - fn serial(&self, out: &mut W) -> Result<(), W::Err> { - out.write_u8(4)?; - out.write_u32(self.0) - } -} - -#[cfg(not(feature = "hacspec"))] -/// The `TokenIdU32` will deserialize one byte ensuring this contains the value -/// 4 and then deserialize a u32 as little endian. It will result in an error if -/// the first byte is not 4. -impl Deserial for TokenIdU32 { - fn deserial(source: &mut R) -> ParseResult { - let byte_length = source.read_u8()?; - if byte_length == 4 { - Ok(TokenIdU32(source.read_u32()?)) - } else { - Err(ParseError::default()) - } - } -} - -// /// Display the token ID as a uppercase hex string -// impl fmt::Display for TokenIdU32 { -// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { -// for byte in &self.0.to_le_bytes() { -// write!(f, "{:02X}", byte)?; -// } -// Ok(()) -// } -// } - -#+end_src -*** TokenIdU16 -#+begin_src rust :eval never -#[cfg(feature = "hacspec")] -// #[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] -pub struct TokenIdU16(pub u16); - -#[cfg(not(feature = "hacspec"))] -/// Token Identifier, which combined with the address of the contract instance, -/// forms the unique identifier of a token type. -/// -/// The CIS1 specification allows for up to 255 bytes for the token ID, but for -/// most cases using a smaller token ID is fine and can reduce contract energy -/// costs. -/// -/// This token ID uses u16 for representing the token ID bytes which means the -/// token ID space is fixed to 2 bytes and some token IDs cannot be represented. -/// For a more general token ID type see `TokenIdVec`. -#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] -pub struct TokenIdU16(pub u16); - -#[cfg(not(feature = "hacspec"))] -impl IsTokenId for TokenIdU16 {} - -#[cfg(not(feature = "hacspec"))] -impl schema::SchemaType for TokenIdU16 { - fn get_type() -> schema::Type { - schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) - } -} - -#[cfg(not(feature = "hacspec"))] -impl From for TokenIdU16 { - fn from(id: u16) -> Self { - TokenIdU16(id) - } -} - -#[cfg(not(feature = "hacspec"))] -/// The `TokenIdU16` is serialized with one byte with the value 2 followed by 2 -/// bytes to encode a u16 in little endian. -impl Serial for TokenIdU16 { - fn serial(&self, out: &mut W) -> Result<(), W::Err> { - out.write_u8(2)?; - out.write_u16(self.0) - } -} - -#[cfg(not(feature = "hacspec"))] -/// The `TokenIdU16` will deserialize one byte ensuring this contains the value -/// 2 and then deserialize a u16 as little endian. It will result in an error if -/// the first byte is not 2. -impl Deserial for TokenIdU16 { - fn deserial(source: &mut R) -> ParseResult { - let byte_length = source.read_u8()?; - if byte_length == 2 { - Ok(TokenIdU16(source.read_u16()?)) - } else { - Err(ParseError::default()) - } - } -} - -// /// Display the token ID as a uppercase hex string -// impl fmt::Display for TokenIdU16 { -// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { -// for byte in &self.0.to_le_bytes() { -// write!(f, "{:02X}", byte)?; -// } -// Ok(()) -// } -// } - -#+end_src -*** TokenIdU8 -#+begin_src rust :eval never -#[cfg(feature = "hacspec")] -// #[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] -pub struct TokenIdU8(pub u8); - -#[cfg(not(feature = "hacspec"))] -/// Token Identifier, which combined with the address of the contract instance, -/// forms the unique identifier of a token type. -/// -/// The CIS1 specification allows for up to 255 bytes for the token ID, but for -/// most cases using a smaller token ID is fine and can reduce contract energy -/// costs. -/// -/// This token ID uses u8 for representing the token ID bytes which means the -/// token ID space is fixed to 1 byte and some token IDs cannot be represented. -/// For a more general token ID type see `TokenIdVec`. -#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] -pub struct TokenIdU8(pub u8); - -#[cfg(not(feature = "hacspec"))] -impl IsTokenId for TokenIdU8 {} - -#[cfg(not(feature = "hacspec"))] -impl schema::SchemaType for TokenIdU8 { - fn get_type() -> schema::Type { - schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) - } -} - -#[cfg(not(feature = "hacspec"))] -impl From for TokenIdU8 { - fn from(id: u8) -> Self { - TokenIdU8(id) - } -} - -#[cfg(not(feature = "hacspec"))] -/// The `TokenIdU8` is serialized with one byte with the value 1 followed by 1 -/// bytes to encode a u8 in little endian. -impl Serial for TokenIdU8 { - fn serial(&self, out: &mut W) -> Result<(), W::Err> { - out.write_u8(1)?; - out.write_u8(self.0) - } -} - -#[cfg(not(feature = "hacspec"))] -/// The `TokenIdU8` will deserialize one byte ensuring this contains the value 1 -/// and then deserialize a u8 as little endian. It will result in an error if -/// the first byte is not 1. -impl Deserial for TokenIdU8 { - fn deserial(source: &mut R) -> ParseResult { - let byte_length = source.read_u8()?; - if byte_length == 1 { - Ok(TokenIdU8(source.read_u8()?)) - } else { - Err(ParseError::default()) - } - } -} - -// /// Display the token ID as a uppercase hex string -// impl fmt::Display for TokenIdU8 { -// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { -// for byte in &self.0.to_le_bytes() { -// write!(f, "{:02X}", byte)?; -// } -// Ok(()) -// } -// } - -#+end_src -*** TokenIdUnit -#+begin_src rust :eval never -#[cfg(feature = "hacspec")] -// #[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] -pub struct TokenIdUnit(); - -#[cfg(not(feature = "hacspec"))] -/// Token Identifier, which combined with the address of the contract instance, -/// forms the unique identifier of a token type. -/// -/// The CIS1 specification allows for up to 255 bytes for the token ID, but for -/// most cases using a smaller token ID is fine and can reduce contract energy -/// costs. -/// -/// This token ID uses Unit for representing token IDs, which means only one -/// token ID can be represented with this type and other token IDs cannot be -/// represented. For a more general token ID type see `TokenIdVec`. -#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash, Copy, Clone)] -pub struct TokenIdUnit(); - -#[cfg(not(feature = "hacspec"))] -impl IsTokenId for TokenIdUnit {} - -#[cfg(not(feature = "hacspec"))] -impl schema::SchemaType for TokenIdUnit { - fn get_type() -> schema::Type { - schema::Type::List(schema::SizeLength::U8, Box::new(schema::Type::U8)) - } -} - -#[cfg(not(feature = "hacspec"))] -/// The `TokenIdUnit` is serialized with one byte with the value 0. -impl Serial for TokenIdUnit { - fn serial(&self, out: &mut W) -> Result<(), W::Err> { - out.write_u8(0) - } -} - -#[cfg(not(feature = "hacspec"))] -/// The `TokenIdUnit` will deserialize one byte ensuring this contains the value -/// 0. It will result in an error if the byte is not 0. -impl Deserial for TokenIdUnit { - fn deserial(source: &mut R) -> ParseResult { - let byte_length = source.read_u8()?; - if byte_length == 0 { - Ok(TokenIdUnit()) - } else { - Err(ParseError::default()) - } - } -} - -#+end_src -*** More data types -- events -#+begin_src rust :eval never -// #[cfg(not(feature="hacspec"))] -/// An amount of a specific token type. -pub type TokenAmount = u64; - -#[cfg(not(feature = "hacspec"))] -/// An untagged event of a transfer of some amount of tokens from one address to -/// another. For a tagged version, use `Cis1Event`. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct TransferEvent { - /// The ID of the token being transferred. - pub token_id: T, - /// The amount of tokens being transferred. - pub amount: TokenAmount, - /// The address owning these tokens before the transfer. - pub from: Address, - /// The address to receive these tokens after the transfer. - pub to: Address, -} - -#[cfg(not(feature = "hacspec"))] -/// An untagged event of tokens being minted, could be a new token type or -/// extending the total supply of existing token. -/// For a tagged version, use `Cis1Event`. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct MintEvent { - /// The ID of the token being minted, (possibly a new token ID). - pub token_id: T, - /// The number of tokens being minted, this is allowed to be 0 as well. - pub amount: TokenAmount, - /// The initial owner of these newly minted amount of tokens. - pub owner: Address, -} - -#[cfg(not(feature = "hacspec"))] -/// An untagged event of some amount of a token type being burned. -/// For a tagged version, use `Cis1Event`. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct BurnEvent { - /// The ID of the token where an amount is being burned. - pub token_id: T, - /// The amount of tokens being burned. - pub amount: TokenAmount, - /// The owner of the tokens being burned. - pub owner: Address, -} - -#[cfg(feature = "hacspec")] -// #[derive(Debug, Serialize, SchemaType)] -pub enum OperatorUpdate { - /// Remove the operator. - Remove, - /// Add an address as an operator. - Add, -} - -#[cfg(not(feature = "hacspec"))] -/// The update to an the operator. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the variants cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub enum OperatorUpdate { - /// Remove the operator. - Remove, - /// Add an address as an operator. - Add, -} - -#[cfg(feature = "hacspec")] -// #[derive(Debug, Serialize, SchemaType)] -pub struct UpdateOperatorEvent(pub OperatorUpdate, pub UserAddress, pub UserAddress); - -#[cfg(not(feature = "hacspec"))] -/// An untagged event of an update to an operator address for an owner address. -/// For a tagged version, use `Cis1Event`. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct UpdateOperatorEvent { - /// The update to the operator. - pub update: OperatorUpdate, - /// The address for whom, the operator is updated. - pub owner: Address, - /// The address who is the operator being updated. - pub operator: Address, -} - -#[cfg(not(feature = "hacspec"))] -/// An untagged event for setting the metadata for a token. -/// For a tagged version, use `Cis1Event`. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct TokenMetadataEvent { - /// The ID of the token. - pub token_id: T, - /// The location of the metadata. - pub metadata_url: MetadataUrl, -} - -#[cfg(not(feature = "hacspec"))] -/// Tagged CIS1 event to be serialized for the event log. -#[derive(Debug)] -pub enum Cis1Event { - /// A transfer between two addresses of some amount of tokens. - Transfer(TransferEvent), - /// Creation of new tokens, could be both adding some amounts to an existing - /// token or introduce an entirely new token ID. - Mint(MintEvent), - /// Destruction of tokens removing some amounts of a token. - Burn(BurnEvent), - /// Updates to an operator for a specific address and token id. - UpdateOperator(UpdateOperatorEvent), - /// Setting the metadata for a token. - TokenMetadata(TokenMetadataEvent), -} - -#[cfg(not(feature = "hacspec"))] -impl Serial for Cis1Event { - fn serial(&self, out: &mut W) -> Result<(), W::Err> { - match self { - Cis1Event::Transfer(event) => { - out.write_u8(TRANSFER_EVENT_TAG)?; - event.serial(out) - } - Cis1Event::Mint(event) => { - out.write_u8(MINT_EVENT_TAG)?; - event.serial(out) - } - Cis1Event::Burn(event) => { - out.write_u8(BURN_EVENT_TAG)?; - event.serial(out) - } - Cis1Event::UpdateOperator(event) => { - out.write_u8(UPDATE_OPERATOR_EVENT_TAG)?; - event.serial(out) - } - Cis1Event::TokenMetadata(event) => { - out.write_u8(TOKEN_METADATA_EVENT_TAG)?; - event.serial(out) - } - } - } -} - -#[cfg(not(feature = "hacspec"))] -impl Deserial for Cis1Event { - fn deserial(source: &mut R) -> ParseResult { - let tag = source.read_u8()?; - match tag { - TRANSFER_EVENT_TAG => TransferEvent::::deserial(source).map(Cis1Event::Transfer), - MINT_EVENT_TAG => MintEvent::::deserial(source).map(Cis1Event::Mint), - BURN_EVENT_TAG => BurnEvent::::deserial(source).map(Cis1Event::Burn), - UPDATE_OPERATOR_EVENT_TAG => { - UpdateOperatorEvent::deserial(source).map(Cis1Event::UpdateOperator) - } - TOKEN_METADATA_EVENT_TAG => { - TokenMetadataEvent::::deserial(source).map(Cis1Event::TokenMetadata) - } - _ => Err(ParseError::default()), - } - } -} - -#[cfg(not(feature = "hacspec"))] -/// The different errors the contract can produce. -#[derive(Debug, PartialEq, Eq)] -pub enum Cis1Error { - /// Invalid token id (Error code: -42000001). - InvalidTokenId, - /// The balance of the token owner is insufficient for the transfer (Error - /// code: -42000002). - InsufficientFunds, - /// Sender is unauthorized to call this function (Error code: -42000003). - Unauthorized, - /// Custom error - Custom(R), -} - -#[cfg(not(feature = "hacspec"))] -/// Convert Cis1Error into a reject with error code: -/// - InvalidTokenId: -42000001 -/// - InsufficientFunds: -42000002 -/// - Unauthorized: -42000003 -impl> From> for Reject { - fn from(err: Cis1Error) -> Self { - let error_code = match err { - Cis1Error::InvalidTokenId => unsafe { NonZeroI32::new_unchecked(-42000001) }, - Cis1Error::InsufficientFunds => unsafe { NonZeroI32::new_unchecked(-42000002) }, - Cis1Error::Unauthorized => unsafe { NonZeroI32::new_unchecked(-42000003) }, - Cis1Error::Custom(reject) => reject.into().error_code, - }; - Self { error_code } - } -} - -#[cfg(not(feature = "hacspec"))] -impl> From for Cis1Error { - #[inline] - fn from(err: LogError) -> Self { - Cis1Error::Custom(X::from(err)) - } -} - -#[cfg(not(feature = "hacspec"))] -impl> From for Cis1Error { - #[inline] - fn from(err: ParseError) -> Self { - Cis1Error::Custom(X::from(err)) - } -} - -#+end_src -*** Receiver -#+begin_src rust :eval never -#[cfg_attr(feature = "hacspec", derive(Debug, Serialize))] -pub enum ReceiverHacspec { - Account( - PublicByteSeq, - ), - Contract( - PublicByteSeq, - String, - ), -} - -#[cfg(not(feature = "hacspec"))] -/// The receiving address for a transfer, similar to the Address type, but -/// contains extra information when the receiver address is a contract. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the variants and the order of their fields -// cannot be changed. -#[derive(Debug, Serialize)] -pub enum Receiver { - /// The receiver is an account address. - Account( - /// The receiving address. - AccountAddress, - ), - /// The receiver is a contract address. - Contract( - /// The receiving address. - ContractAddress, - /// The function to call on the receiving contract. - OwnedReceiveName, - ), -} - -#[cfg(not(feature = "hacspec"))] -impl Receiver { - /// Construct a receiver from an account address. - pub fn from_account(address: AccountAddress) -> Self { - Receiver::Account(address) - } - - /// Construct a receiver from a contract address. - pub fn from_contract(address: ContractAddress, function: OwnedReceiveName) -> Self { - Receiver::Contract(address, function) - } - - /// Get the Address of the receiver. - pub fn address(&self) -> Address { - match self { - Receiver::Account(address) => Address::Account(*address), - Receiver::Contract(address, ..) => Address::Contract(*address), - } - } -} - -#[cfg(not(feature = "hacspec"))] -impl schema::SchemaType for Receiver { - fn get_type() -> schema::Type { - schema::Type::Enum(vec![ - ( - String::from("Account"), - schema::Fields::Unnamed(vec![AccountAddress::get_type()]), - ), - ( - String::from("Contract"), - schema::Fields::Unnamed(vec![ - ContractAddress::get_type(), - OwnedReceiveName::get_type(), - ]), - ), - ]) - } -} - -#[cfg(not(feature = "hacspec"))] -impl From for Receiver { - fn from(address: AccountAddress) -> Self { - Self::from_account(address) - } -} - -#+end_src -*** Additional Data -#+begin_src rust :eval never -#[cfg_attr(feature = "hacspec", derive(Debug, Serialize))] -pub struct AdditionalDataHacspec(Seq); - -#[cfg(not(feature = "hacspec"))] -/// Additional information to include with a transfer. -#[derive(Debug, Serialize)] -pub struct AdditionalData( - // #[concordium(size_length = 2)] - Vec, -); - -#[cfg(not(feature = "hacspec"))] -impl schema::SchemaType for AdditionalData { - fn get_type() -> schema::Type { - schema::Type::List(schema::SizeLength::U16, Box::new(schema::Type::U8)) - } -} - -#[cfg(not(feature = "hacspec"))] -impl AdditionalData { - /// Construct an AdditionalData containing no data. - pub fn empty() -> Self { - AdditionalData(Vec::new()) - } -} - -#[cfg(not(feature = "hacspec"))] -impl From> for AdditionalData { - fn from(data: Vec) -> Self { - AdditionalData(data) - } -} - -#[cfg(not(feature = "hacspec"))] -impl AsRef<[u8]> for AdditionalData { - fn as_ref(&self) -> &[u8] { - &self.0 - } -} - -#+end_src -*** Transfer -#+begin_src rust :eval never -#[cfg(not(feature = "hacspec"))] -/// A single transfer of some amount of a token. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize)] -pub struct Transfer { - /// The ID of the token being transferred. - pub token_id: T, - /// The amount of tokens being transferred. - pub amount: TokenAmount, - /// The address owning the tokens being transferred. - pub from: Address, - /// The address receiving the tokens being transferred. - pub to: Receiver, - /// Additional data to include in the transfer. - /// Can be used for additional arguments. - pub data: AdditionalData, -} - -#[cfg(not(feature = "hacspec"))] -impl schema::SchemaType for Transfer { - fn get_type() -> schema::Type { - schema::Type::Struct(schema::Fields::Named(vec![ - (String::from("token_id"), T::get_type()), - (String::from("amount"), TokenAmount::get_type()), - (String::from("from"), Address::get_type()), - (String::from("to"), Receiver::get_type()), - (String::from("data"), AdditionalData::get_type()), - ])) - } -} - -#[cfg(not(feature = "hacspec"))] -/// The parameter type for the contract function `transfer`. -#[derive(Debug, Serialize)] -pub struct TransferParams( - // #[concordium(size_length = 2)] - pub Vec>, -); - -#[cfg(not(feature = "hacspec"))] -impl schema::SchemaType for TransferParams { - fn get_type() -> schema::Type { - schema::Type::List(schema::SizeLength::U16, Box::new(Transfer::::get_type())) - } -} - -#[cfg(not(feature = "hacspec"))] -impl From>> for TransferParams { - fn from(transfers: Vec>) -> Self { - TransferParams(transfers) - } -} - -#[cfg(not(feature = "hacspec"))] -impl AsRef<[Transfer]> for TransferParams { - fn as_ref(&self) -> &[Transfer] { - &self.0 - } -} - -#+end_src -*** Update Operator -#+begin_src rust :eval never -#[cfg(not(feature = "hacspec"))] -/// A single update of an operator. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct UpdateOperator { - /// The update for this operator. - pub update: OperatorUpdate, - /// The address which is either added or removed as an operator. - /// Note: The address for whom this will become an operator is the sender of - /// the contract transaction. - pub operator: Address, -} - -#[cfg(not(feature = "hacspec"))] -/// The parameter type for the contract function `updateOperator`. -#[derive(Debug, Serialize, SchemaType)] -pub struct UpdateOperatorParams( - // #[concordium(size_length = 2)] - pub Vec, -); - -#+end_src -*** Balance of -#+begin_src rust :eval never -#[cfg(not(feature = "hacspec"))] -/// A query for the balance of a given address for a given token. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct BalanceOfQuery { - /// The ID of the token for which to query the balance of. - pub token_id: T, - /// The address for which to query the balance of. - pub address: Address, -} - -#[cfg(not(feature = "hacspec"))] -/// The parameter type for the contract function `balanceOf`. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct BalanceOfQueryParams { - /// The contract to trigger with the results of the queries. - pub result_contract: ContractAddress, - /// The contract function to trigger with the results of the queries. - pub result_function: OwnedReceiveName, - /// List of balance queries. - // #[concordium(size_length = 2)] - pub queries: Vec>, -} - -#[cfg(not(feature = "hacspec"))] -/// BalanceOf query with the result of the query. -pub type BalanceOfQueryResult = (BalanceOfQuery, TokenAmount); - -#[cfg(not(feature = "hacspec"))] -/// The response which is sent back when calling the contract function -/// `balanceOf`. -/// It consists of the list of queries paired with their corresponding result. -#[derive(Debug, Serialize, SchemaType)] -pub struct BalanceOfQueryResponse( - // #[concordium(size_length = 2)] - Vec>, -); - -#[cfg(not(feature = "hacspec"))] -impl From>> for BalanceOfQueryResponse { - fn from(results: Vec>) -> Self { - BalanceOfQueryResponse(results) - } -} - -#[cfg(not(feature = "hacspec"))] -impl AsRef<[BalanceOfQueryResult]> for BalanceOfQueryResponse { - fn as_ref(&self) -> &[BalanceOfQueryResult] { - &self.0 - } -} - -#+end_src -*** Operator of -#+begin_src rust :eval never -#[cfg(not(feature = "hacspec"))] -/// A query for the operator of a given address for a given token. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct OperatorOfQuery { - /// The ID of the token for which to query the balance of. - pub owner: Address, - /// The address for which to check for being an operator of the owner. - pub address: Address, -} - -#[cfg(not(feature = "hacspec"))] -/// The parameter type for the contract function `operatorOf`. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct OperatorOfQueryParams { - /// The contract to trigger with the results of the queries. - pub result_contract: ContractAddress, - /// The contract function to trigger with the results of the queries. - pub result_function: OwnedReceiveName, - /// List of operatorOf queries. - // #[concordium(size_length = 2)] - pub queries: Vec, -} - -#[cfg(not(feature = "hacspec"))] -/// OperatorOf query with the result of the query. -pub type OperatorOfQueryResult = (OperatorOfQuery, bool); - -#[cfg(not(feature = "hacspec"))] -/// The response which is sent back when calling the contract function -/// `operatorOf`. -/// It consists of the list of queries paired with their corresponding result. -#[derive(Debug, Serialize, SchemaType)] -pub struct OperatorOfQueryResponse( - // #[concordium(size_length = 2)] - Vec, -); - -#[cfg(not(feature = "hacspec"))] -impl From> for OperatorOfQueryResponse { - fn from(results: Vec) -> Self { - OperatorOfQueryResponse(results) - } -} - -#[cfg(not(feature = "hacspec"))] -impl AsRef<[OperatorOfQueryResult]> for OperatorOfQueryResponse { - fn as_ref(&self) -> &[OperatorOfQueryResult] { - &self.0 - } -} - -#+end_src -*** Token metadata -#+begin_src rust :eval never -#[cfg(not(feature = "hacspec"))] -/// The parameter type for the contract function `tokenMetadata`. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct TokenMetadataQueryParams { - /// The contract to trigger with the results of the queries. - pub result_contract: ContractAddress, - /// The contract function to trigger with the results of the queries. - pub result_function: OwnedReceiveName, - /// List of balance queries. - // #[concordium(size_length = 2)] - pub queries: Vec, -} - -#[cfg(not(feature = "hacspec"))] -/// TokenMetadata query with the result of the query. -pub type TokenMetadataQueryResult = (T, MetadataUrl); - -#[cfg(not(feature = "hacspec"))] -/// The response which is sent back when calling the contract function -/// `tokenMetadata`. -/// It consists of the list of queries paired with their corresponding result. -#[derive(Debug, Serialize, SchemaType)] -pub struct TokenMetadataQueryResponse( - // #[concordium(size_length = 2)] - Vec>, -); - -#[cfg(not(feature = "hacspec"))] -impl From>> for TokenMetadataQueryResponse { - fn from(results: Vec>) -> Self { - TokenMetadataQueryResponse(results) - } -} - -#[cfg(not(feature = "hacspec"))] -impl AsRef<[TokenMetadataQueryResult]> for TokenMetadataQueryResponse { - fn as_ref(&self) -> &[TokenMetadataQueryResult] { - &self.0 - } -} - -#+end_src -*** On Receivivingreceiver -#+begin_src rust :eval never -#[cfg(not(feature = "hacspec"))] -/// The parameter type for a contract function which receives CIS1 tokens. -// Note: For the serialization to be derived according to the CIS1 -// specification, the order of the fields cannot be changed. -#[derive(Debug, Serialize, SchemaType)] -pub struct OnReceivingCis1Params { - /// The ID of the token received. - pub token_id: T, - /// The amount of tokens received. - pub amount: TokenAmount, - /// The previous owner of the tokens. - pub from: Address, - /// The name of the token contract which is tracking the token and - /// implements CIS1. - pub contract_name: OwnedContractName, - /// Some extra information which where sent as part of the transfer. - pub data: AdditionalData, -} -#+end_src - -* WCCD smart contract specification -** Rust code -:PROPERTIES: -:header-args: :tangle ./src/wccd.rs :mkdirp yes -:END: -*** Imports -#+begin_src rust :eval never -#[cfg(not(feature = "hacspec"))] -extern crate hacspec_lib; - -use hacspec_lib::*; - -// #[cfg(not(feature = "hacspec"))] -// extern crate creusot_contracts; -#[cfg(test)] -#[cfg(not(feature = "hacspec"))] -use creusot_contracts::{ensures, requires}; - -use hacspec_concordium::*; - -#[cfg(feature = "hacspec")] -use concert_lib::*; - -#+end_src - -#+begin_src rust :eval never -// #![cfg_attr(not(feature = "std"), no_std)] -// use concordium_cis1::*; - -mod cis1; -pub use cis1::*; - -#[cfg(not(feature = "hacspec"))] -pub use concordium_contracts_common::{HashMap as Map, HashSet as Set}; - -// #[cfg(not(feature = "hacspec"))] -// pub use concordium_impls::*; -// #[cfg(not(feature = "hacspec"))] -// pub use concordium_prims::*; - -// #![cfg_attr(not(feature = "std"), no_std)] -// use concordium_std::*; -// #[cfg(not(feature = "std"))] -// use core::fmt; -// #[cfg(feature = "std")] -// use std::fmt; - -#+end_src -*** Consts -#+begin_src rust :eval never -/// Contract token ID type. -/// Since this contract will only ever contain this one token type, we use the -/// smallest possible token ID. -type ContractTokenId = TokenIdUnit; - -/// The id of the wCCD token in this contract. -const TOKEN_ID_WCCD: ContractTokenId = TokenIdUnit(); - -#[cfg(not(feature = "hacspec"))] -/// The metadata url for the wCCD token. -const TOKEN_METADATA_URL: &str = "https://some.example/token/wccd"; - -#+end_src - -*** Types -#+begin_src rust :eval never -// Types - -/// The state tracked for each address. -#[cfg_attr(feature = "hacspec", derive(Serialize, SchemaType))] -struct AddressStateHacspec (TokenAmount, PublicByteSeq); - -#[cfg(not(feature = "hacspec"))] -/// The state tracked for each address. -#[derive(Serialize, SchemaType)] -struct AddressState { - /// The number of tokens owned by this address. - balance: TokenAmount, - /// The address which are currently enabled as operators for this token and - /// this address. - // #[concordium(size_length = 1)] - operators: Set
, -} - -#+end_src - -#+begin_src rust :eval never -#[cfg_attr(feature = "hacspec", contract_state(contract = "CIS1-wCCD"))] -#[cfg_attr(feature = "hacspec", derive(Serialize, SchemaType))] -struct StateHacspec(pub PublicByteSeq); // Map - -#[cfg(not(feature = "hacspec"))] -/// The contract state, -#[contract_state(contract = "CIS1-wCCD")] -#[derive(Serialize, SchemaType)] -struct State { - /// The state the one token. - token: Map, -} - -#+end_src - -#+begin_src rust :eval never -#[cfg_attr(feature = "hacspec", derive(Serialize, SchemaType))] -struct UnwrapParamsHacspec (TokenAmount, PublicByteSeq, ReceiverHacspec, AdditionalDataHacspec); - -#[cfg(not(feature = "hacspec"))] -/// The parameter type for the contract function `unwrap`. -/// Takes an amount of tokens and unwrap the CCD and send it to a receiver. -#[derive(Serialize, SchemaType)] -struct UnwrapParams { - /// The amount of tokens to unwrap. - amount: TokenAmount, - /// The owner of the tokens. - owner: Address, - /// The address to receive these unwrapped CCD. - receiver: cis1::Receiver, - /// Some additional bytes to include in the transfer. - data: AdditionalData, -} - -#+end_src - -#+begin_src rust :eval never -#[cfg_attr(feature = "hacspec", derive(Serialize, SchemaType))] -struct WrapParamsHacspec (ReceiverHacspec, AdditionalDataHacspec); - -#[cfg(not(feature = "hacspec"))] -/// The parameter type for the contract function `wrap`. -/// -/// The receiver for the wrapped CCD tokens. -#[derive(Serialize, SchemaType)] -struct WrapParams { - /// The address to receive these tokens. - /// If the receiver is the sender of the message wrapping the tokens, it - /// will not log a transfer. - to: cis1::Receiver, - /// Some additional bytes to include in a transfer. - data: AdditionalData, -} - -#+end_src - -#+begin_src rust :eval never -#[cfg(not(feature = "hacspec"))] -/// The different errors the contract can produce. -#[derive(Serialize, Debug, PartialEq, Eq, Reject)] -enum CustomContractError { - /// Failed parsing the parameter. - #[from(ParseError)] - ParseParams, - /// Failed logging: Log is full. - LogFull, - /// Failed logging: Log is malformed. - LogMalformed, -} - -#+end_src - -#+begin_src rust :eval never -#[cfg(not(feature = "hacspec"))] -type ContractError = Cis1Error; - -#+end_src - -#+begin_src rust :eval never -#[cfg(not(feature = "hacspec"))] -type ContractResult = Result; - -#+end_src - -*** Implemenetations -#+begin_src rust :eval never -#[cfg(not(feature = "hacspec"))] -/// Mapping the logging errors to ContractError. -impl From for CustomContractError { - fn from(le: LogError) -> Self { - match le { - LogError::Full => Self::LogFull, - LogError::Malformed => Self::LogMalformed, - } - } -} - -#[cfg(not(feature = "hacspec"))] -/// Mapping CustomContractError to ContractError -impl From for ContractError { - fn from(c: CustomContractError) -> Self { - Cis1Error::Custom(c) - } -} - -#[cfg(not(feature = "hacspec"))] -impl State { - /// Creates a new state with no one owning any tokens by default. - fn new() -> Self { - State { - token: Map::default(), - } - } - - /// Get the current balance of a given token id for a given address. - /// Results in an error if the token id does not exist in the state. - fn balance( - &self, - token_id: &ContractTokenId, - address: &Address, - ) -> ContractResult { - // ensure_eq!(token_id, &TOKEN_ID_WCCD, ContractError::InvalidTokenId); - Ok(self.token.get(address).map(|s| s.balance).unwrap_or(0)) - } - - /// Check is an address is an operator of a specific owner address. - /// Results in an error if the token id does not exist in the state. - fn is_operator(&self, address: &Address, owner: &Address) -> bool { - self.token - .get(owner) - .map(|address_state| address_state.operators.contains(address)) - .unwrap_or(false) - } - - /// Update the state with a transfer. - /// Results in an error if the token id does not exist in the state or if - /// the from address have insufficient tokens to do the transfer. - fn transfer( - &mut self, - token_id: &ContractTokenId, - amount: TokenAmount, - from: &Address, - to: &Address, - ) -> ContractResult<()> { - // ensure_eq!(token_id, &TOKEN_ID_WCCD, ContractError::InvalidTokenId); - if amount == 0 { - return Ok(()); - } - let from_state = self - .token - .get_mut(from) - .ok_or(ContractError::InsufficientFunds)?; - ensure!( - from_state.balance >= amount, - ContractError::InsufficientFunds - ); - from_state.balance -= amount; - let to_state = self.token.entry(*to).or_insert_with(|| AddressState { - balance: 0, - operators: Set::default(), - }); - to_state.balance += amount; - Ok(()) - } - - /// Update the state adding a new operator for a given token id and address. - /// Results in an error if the token id does not exist in the state. - /// Succeeds even if the `operator` is already an operator for this - /// `token_id` and `address`. - fn add_operator(&mut self, owner: &Address, operator: &Address) { - let address_state = self.token.entry(*owner).or_insert_with(|| AddressState { - balance: 0, - operators: Set::default(), - }); - address_state.operators.insert(*operator); - } - - /// Update the state removing an operator for a given token id and address. - /// Results in an error if the token id does not exist in the state. - /// Succeeds even if the `operator` is not an operator for this `token_id` - /// and `address`. - fn remove_operator(&mut self, owner: &Address, operator: &Address) { - self.token - .get_mut(owner) - .map(|address_state| address_state.operators.remove(operator)); - } - - fn mint( - &mut self, - token_id: &ContractTokenId, - amount: TokenAmount, - owner: &Address, - ) -> ContractResult<()> { - // ensure_eq!(token_id, &TOKEN_ID_WCCD, ContractError::InvalidTokenId); - let address_state = self.token.entry(*owner).or_insert_with(|| AddressState { - balance: 0, - operators: Set::default(), - }); - address_state.balance += amount; - Ok(()) - } - - fn burn( - &mut self, - token_id: &ContractTokenId, - amount: TokenAmount, - owner: &Address, - ) -> ContractResult<()> { - // ensure_eq!(token_id, &TOKEN_ID_WCCD, ContractError::InvalidTokenId); - if amount == 0 { - return Ok(()); - } - let from_state = self - .token - .get_mut(owner) - .ok_or(ContractError::InsufficientFunds)?; - ensure!( - from_state.balance >= amount, - ContractError::InsufficientFunds - ); - from_state.balance -= amount; - Ok(()) - } -} - -#+end_src - -*** Contract -#+begin_src rust :eval never -// Contract functions - -#[cfg(feature = "hacspec")] -/// Initialize contract instance with no initial tokens. -/// Logs a `Mint` event for the single token id with no amounts. -#[init(contract = "CIS1-wCCD", enable_logger)] -pub fn contract_init(ctx: Context) -> (Context, StateHacspec) { - (ctx, StateHacspec(PublicByteSeq::new(0))) -} - -#[cfg(not(feature = "hacspec"))] -/// Initialize contract instance with no initial tokens. -/// Logs a `Mint` event for the single token id with no amounts. -#[init(contract = "CIS1-wCCD", enable_logger)] -fn contract_init(ctx: &impl HasInitContext, logger: &mut impl HasLogger) -> InitResult { - // Construct the initial contract state. - let state = State::new(); - // Get the instantiater of this contract instance. - let invoker = Address::Account(ctx.init_origin()); - // Log event for the newly minted token. - logger.log(&Cis1Event::Mint(MintEvent { - token_id: TOKEN_ID_WCCD, - amount: 0, - owner: invoker, - }))?; - - // Log event for where to find metadata for the token - logger.log(&Cis1Event::TokenMetadata(TokenMetadataEvent { - token_id: TOKEN_ID_WCCD, - metadata_url: MetadataUrl { - url: String::from(TOKEN_METADATA_URL), - hash: None, - }, - }))?; - - Ok(state) -} - -#+end_src - -#+begin_src rust :eval never -#[cfg(feature = "hacspec")] -/// Receive function in which accounts can bid before the auction end time -#[receive( - contract = "CIS1-wCCD", - name = "wrap", - parameter = "WrapParamsHacspec", - enable_logger, - payable -)] -// pub fn contract_wrap(contract_address_index : u64, contract_address_sub_index : u64, function: String, parameter: PublicByteSeq) { -fn contract_wrap( - ctx: (Context, StateHacspec), - amount: u64, -) -> Option<((Context, StateHacspec), ListAction)> { - let (Context(owner, sender, balance, time), state) = ctx; - - let s = Seq::::new(0); - - // send_wrap_hacspec( - // contract_address_index, - // contract_address_sub_index, - // parameter.clone(), - // 0u64, - // parameter.clone()); - - Option::<((Context, StateHacspec), ListAction)>::Some(( - (Context(owner, sender, balance, time), state), - s, - )) -} - -#[cfg(not(feature = "hacspec"))] -/// Wrap an amount of CCD into wCCD tokens and transfer the tokens if the sender -/// is not the receiver. -#[receive( - contract = "CIS1-wCCD", - name = "wrap", - parameter = "WrapParams", - enable_logger, - payable -)] -fn contract_wrap( - ctx: &impl HasReceiveContext, - amount: Amount, - logger: &mut impl HasLogger, - state: &mut State, -) -> ContractResult { - let params: WrapParams = ctx.parameter_cursor().get()?; - // Get the sender who invoked this contract function. - let sender = ctx.sender(); - - let receive_address = params.to.address(); - - // Update the state. - state.mint(&TOKEN_ID_WCCD, amount.micro_ccd, &receive_address)?; - - // Log the newly minted tokens. - logger.log(&Cis1Event::Mint(MintEvent { - token_id: TOKEN_ID_WCCD, - amount: amount.micro_ccd, - owner: sender, - }))?; - - // Only log a transfer event if receiver is not the one who payed for this. - if sender != receive_address { - logger.log(&Cis1Event::Transfer(TransferEvent { - token_id: TOKEN_ID_WCCD, - amount: amount.micro_ccd, - from: sender, - to: receive_address, - }))?; - } - - // Send message to the receiver of the tokens. - if let cis1::Receiver::Contract(address, function) = params.to { - let parameter = OnReceivingCis1Params { - token_id: TOKEN_ID_WCCD, - amount: amount.micro_ccd, - from: sender, - contract_name: OwnedContractName::new_unchecked(String::from("init_CIS1-wCCD")), - data: params.data, - }; - // let param_bytes = concordium_contracts_common::to_bytes(¶meter); - // Ok(A::send_raw(&address, function.as_ref(), Amount::zero(), ¶m_bytes)) - Ok(send_wrap( - &address, - function.as_ref(), - Amount::zero(), - ¶meter, - )) - } else { - Ok(A::accept()) - } -} - -#+end_src - -#+begin_src rust :eval never -#[cfg(feature = "hacspec")] -/// Receive function in which accounts can bid before the auction end time -#[receive( - contract = "CIS1-wCCD", - name = "unwrap", - parameter = "UnwrapParamsHacspec", - enable_logger -)] -fn contract_unwrap(ctx: (Context, StateHacspec)) -> Option<((Context, StateHacspec), ListAction)> { - let (Context(owner, sender, balance, time), state) = ctx; - - let s = Seq::::new(0); - - Option::<((Context, StateHacspec), ListAction)>::Some(( - (Context(owner, sender, balance, time), state), - s, - )) -} - -#[cfg(not(feature = "hacspec"))] -/// Unwrap an amount of wCCD tokens into CCD -#[receive( - contract = "CIS1-wCCD", - name = "unwrap", - parameter = "UnwrapParams", - enable_logger -)] -fn contract_unwrap( - ctx: &impl HasReceiveContext, - logger: &mut impl HasLogger, - state: &mut State, -) -> ContractResult { - let params: UnwrapParams = ctx.parameter_cursor().get()?; - // Get the sender who invoked this contract function. - let sender = ctx.sender(); - ensure!( - sender == params.owner || state.is_operator(&sender, ¶ms.owner), - ContractError::Unauthorized - ); - - // Update the state. - state.burn(&TOKEN_ID_WCCD, params.amount, ¶ms.owner)?; - - // Log the burning of tokens. - logger.log(&Cis1Event::Burn(BurnEvent { - token_id: TOKEN_ID_WCCD, - amount: params.amount, - owner: params.owner, - }))?; - - let unwrapped_amount = Amount::from_micro_ccd(params.amount); - - let action = match params.receiver { - cis1::Receiver::Account(address) => A::simple_transfer(&address, unwrapped_amount), - cis1::Receiver::Contract(address, function) => { - send_wrap(&address, function.as_ref(), unwrapped_amount, ¶ms.data) - } - }; - - Ok(action) -} - -#+end_src - -#+begin_src rust :eval never -// Contract functions required by CIS1 - -#[allow(dead_code)] -type TransferParameterHacspec = (); // TODO: hacspec repr for TransferParams; - -#[cfg(not(feature = "hacspec"))] -#[allow(dead_code)] -type TransferParameter = TransferParams; - -#[cfg(feature = "hacspec")] -/// Receive function in which accounts can bid before the auction end time -#[receive( - contract = "CIS1-wCCD", - name = "transfer", - parameter = "TransferParameterHacspec", - enable_logger -)] -fn contract_transfer(ctx: (Context, StateHacspec)) -> Option<((Context, StateHacspec), ListAction)> { - let (Context(owner, sender, balance, time), state) = ctx; - - let s = Seq::::new(0); - - Option::<((Context, StateHacspec), ListAction)>::Some(( - (Context(owner, sender, balance, time), state), - s, - )) -} - -#[cfg(not(feature = "hacspec"))] -/// Execute a list of token transfers, in the order of the list. -/// -/// Logs a `Transfer` event for each transfer in the list. -/// Produces an action which sends a message to each contract which was the -/// receiver of a transfer. -/// -/// It rejects if: -/// - It fails to parse the parameter. -/// - Any of the transfers fail to be executed, which could be if: -/// - The `token_id` does not exist. -/// - The sender is not the owner of the token, or an operator for this -/// specific `token_id` and `from` address. -/// - The token is not owned by the `from`. -/// - Fails to log event. -/// - Any of the messages sent to contracts receiving a transfer choose to -/// reject. -#[receive( - contract = "CIS1-wCCD", - name = "transfer", - parameter = "TransferParameter", - enable_logger -)] -fn contract_transfer( - ctx: &impl HasReceiveContext, - logger: &mut impl HasLogger, - state: &mut State, -) -> ContractResult { - let mut cursor = ctx.parameter_cursor(); - // Parse the number of transfers. - let transfers_length: u8 = cursor.get()?; - // Get the sender who invoked this contract function. - let sender = ctx.sender(); - - let mut actions = A::accept(); - // Loop over the number of transfers. - for _ in 0..transfers_length { - // Parse one of the transfers. - let Transfer { - token_id, - amount, - from, - to, - data, - } = cursor.get()?; - // Authenticate the sender for this transfer - ensure!( - from == sender || state.is_operator(&sender, &from), - ContractError::Unauthorized - ); - let to_address = to.address(); - // Update the contract state - state.transfer(&token_id, amount, &from, &to_address)?; - - // Log transfer event - logger.log(&Cis1Event::Transfer(TransferEvent { - token_id, - amount, - from, - to: to_address, - }))?; - - // If the receiver is a contract, we add sending it a message to the list of - // actions. - if let cis1::Receiver::Contract(address, function) = to { - let parameter = OnReceivingCis1Params { - token_id, - amount, - from, - contract_name: OwnedContractName::new_unchecked(String::from("init_CIS1-Multi")), - data, - }; - let action = send_wrap(&address, function.as_ref(), Amount::zero(), ¶meter); - actions = actions.and_then(action); - } - } - Ok(actions) -} - - -#+end_src - -#+begin_src rust :eval never -#[cfg(feature = "hacspec")] -/// Receive function in which accounts can bid before the auction end time -#[receive( - contract = "CIS1-wCCD", - name = "updateOperator", - parameter = "UpdateOperatorParams", - enable_logger -)] -fn contract_update_operator(ctx: (Context, StateHacspec)) -> Option<((Context, StateHacspec), ListAction)> { - let (Context(owner, sender, balance, time), state) = ctx; - - let s = Seq::::new(0); - - Option::<((Context, StateHacspec), ListAction)>::Some(( - (Context(owner, sender, balance, time), state), - s, - )) -} - - -#[cfg(not(feature="hacspec"))] -/// Enable or disable addresses as operators of the sender address. -/// Logs an `UpdateOperator` event. -/// -/// It rejects if: -/// - It fails to parse the parameter. -/// - The operator address is the same as the sender address. -/// - Fails to log event. -#[receive( - contract = "CIS1-wCCD", - name = "updateOperator", - parameter = "UpdateOperatorParams", - enable_logger -)] -fn contract_update_operator( - ctx: &impl HasReceiveContext, - logger: &mut impl HasLogger, - state: &mut State, -) -> ContractResult { - // Parse the parameter. - let UpdateOperatorParams(params) = ctx.parameter_cursor().get()?; - // Get the sender who invoked this contract function. - let sender = ctx.sender(); - - for param in params { - // Update the operator in the state. - match param.update { - OperatorUpdate::Add => state.add_operator(&sender, ¶m.operator), - OperatorUpdate::Remove => state.remove_operator(&sender, ¶m.operator), - } - - // Log the appropriate event - logger.log(&Cis1Event::::UpdateOperator(UpdateOperatorEvent { - owner: sender, - operator: param.operator, - update: param.update, - }))?; - } - - Ok(A::accept()) -} - -#+end_src - -#+begin_src rust :eval never -#[cfg(not(feature="hacspec"))] -/// Parameter type for the CIS-1 function `balanceOf` specialized to the subset -/// of TokenIDs used by this contract. -// This type is pub to silence the dead_code warning, as this type is only used -// for when generating the schema. -pub type ContractBalanceOfQueryParams = BalanceOfQueryParams; - -#[cfg(feature = "hacspec")] -/// Receive function in which accounts can bid before the auction end time -#[receive(contract = "CIS1-wCCD", name = "balanceOf", parameter = "ContractBalanceOfQueryParams")] -fn contract_balance_of(ctx: (Context, StateHacspec)) -> Option<((Context, StateHacspec), ListAction)> { - let (Context(owner, sender, balance, time), state) = ctx; - - let s = Seq::::new(0); - - Option::<((Context, StateHacspec), ListAction)>::Some(( - (Context(owner, sender, balance, time), state), - s, - )) -} - -#[cfg(not(feature="hacspec"))] -/// Get the balance of given token IDs and addresses. It takes a contract -/// address plus contract function to invoke with the result. -/// -/// It rejects if: -/// - Sender is not a contract. -/// - It fails to parse the parameter. -/// - Any of the queried `token_id` does not exist. -/// - Message sent back with the result rejects. -#[receive(contract = "CIS1-wCCD", name = "balanceOf", parameter = "ContractBalanceOfQueryParams")] -fn contract_balance_of( - ctx: &impl HasReceiveContext, - state: &mut State, -) -> ContractResult { - let mut cursor = ctx.parameter_cursor(); - // Parse the contract address to receive the result. - let result_contract: ContractAddress = cursor.get()?; - // Parse the contract function name to call with the result. - let result_hook: OwnedReceiveName = cursor.get()?; - // Parse the number of queries. - let queries_length: u8 = cursor.get()?; - - // Build the response. - let mut response = Vec::with_capacity(queries_length.into()); - for _ in 0..queries_length { - // Parse one of the queries. - let query: BalanceOfQuery = ctx.parameter_cursor().get()?; - // Query the state for balance. - let amount = state.balance(&query.token_id, &query.address)?; - response.push((query, amount)); - } - // Send back the response. - Ok(send_wrap( - &result_contract, - result_hook.as_ref(), - Amount::zero(), - &BalanceOfQueryResponse::from(response), - )) -} - -#+end_src - -#+begin_src rust :eval never -#[cfg(feature = "hacspec")] -/// Receive function in which accounts can bid before the auction end time -#[receive(contract = "CIS1-wCCD", name = "operatorOf", parameter = "OperatorOfQueryParams")] -fn contract_operator_of(ctx: (Context, StateHacspec)) -> Option<((Context, StateHacspec), ListAction)> { - let (Context(owner, sender, balance, time), state) = ctx; - - let s = Seq::::new(0); - - Option::<((Context, StateHacspec), ListAction)>::Some(( - (Context(owner, sender, balance, time), state), - s, - )) -} - -#[cfg(not(feature="hacspec"))] -/// Takes a list of queries. Each query is an owner address and some address to -/// check as an operator of the owner address. It takes a contract address plus -/// contract function to invoke with the result. -/// -/// It rejects if: -/// - It fails to parse the parameter. -/// - Message sent back with the result rejects. -#[receive(contract = "CIS1-wCCD", name = "operatorOf", parameter = "OperatorOfQueryParams")] -fn contract_operator_of( - ctx: &impl HasReceiveContext, - state: &mut State, -) -> ContractResult { - // Parse the parameter. - let params: OperatorOfQueryParams = ctx.parameter_cursor().get()?; - // Build the response. - let mut response = Vec::with_capacity(params.queries.len()); - for query in params.queries { - // Query the state for address being an operator of owner. - let is_operator = state.is_operator(&query.owner, &query.address); - response.push((query, is_operator)); - } - // Send back the response. - Ok(send_wrap( - ¶ms.result_contract, - params.result_function.as_ref(), - Amount::zero(), - &OperatorOfQueryResponse::from(response), - )) -} - -#[cfg(not(feature="hacspec"))] -/// Parameter type for the CIS-1 function `tokenMetadata` specialized to the -/// subset of TokenIDs used by this contract. -// This type is pub to silence the dead_code warning, as this type is only used -// for when generating the schema. -pub type ContractTokenMetadataQueryParams = TokenMetadataQueryParams; - -#[cfg(feature = "hacspec")] -/// Receive function in which accounts can bid before the auction end time -#[receive( - contract = "CIS1-wCCD", - name = "tokenMetadata", - parameter = "ContractTokenMetadataQueryParams" -)] -fn contract_token_metadata(ctx: (Context, StateHacspec)) -> Option<((Context, StateHacspec), ListAction)> { - let (Context(owner, sender, balance, time), state) = ctx; - - let s = Seq::::new(0); - - Option::<((Context, StateHacspec), ListAction)>::Some(( - (Context(owner, sender, balance, time), state), - s, - )) -} - -#[cfg(not(feature="hacspec"))] -/// Get the token metadata URLs and checksums given a list of token IDs. It -/// takes a contract address plus contract function to invoke with the result. -/// -/// It rejects if: -/// - It fails to parse the parameter. -/// - Any of the queried `token_id` does not exist. -/// - Message sent back with the result rejects. -#[receive( - contract = "CIS1-wCCD", - name = "tokenMetadata", - parameter = "ContractTokenMetadataQueryParams" -)] -fn contract_token_metadata( - ctx: &impl HasReceiveContext, - _state: &mut State, -) -> ContractResult { - let mut cursor = ctx.parameter_cursor(); - // Parse the contract address to receive the result. - let result_contract: ContractAddress = cursor.get()?; - // Parse the contract function name to call with the result. - let result_hook: OwnedReceiveName = cursor.get()?; - // Parse the number of queries. - let queries_length: u8 = cursor.get()?; - - // Build the response. - let mut response = Vec::with_capacity(queries_length.into()); - for _ in 0..queries_length { - let token_id: ContractTokenId = cursor.get()?; - // Check the token exists. - ensure_eq!(token_id, TOKEN_ID_WCCD, ContractError::InvalidTokenId); - - let metadata_url = MetadataUrl { - url: TOKEN_METADATA_URL.to_string(), - hash: None, - }; - response.push((token_id, metadata_url)); - } - // Send back the response. - Ok(send_wrap( - &result_contract, - result_hook.as_ref(), - Amount::zero(), - &TokenMetadataQueryResponse::from(response), - )) -} - -#+end_src - -*** Tests -#+begin_src rust :eval never -// Tests - -#[cfg(not(feature="hacspec"))] -#[concordium_cfg_test] -mod tests { - use super::*; - use test_infrastructure::*; - - const ACCOUNT_0: AccountAddress = AccountAddress([0u8; 32]); - const ADDRESS_0: Address = Address::Account(ACCOUNT_0); - const ACCOUNT_1: AccountAddress = AccountAddress([1u8; 32]); - const ADDRESS_1: Address = Address::Account(ACCOUNT_1); - - /// Test helper function which creates a contract state where ADDRESS_0 owns - /// 400 tokens. - fn initial_state() -> State { - let mut state = State::new(); - state.mint(&TOKEN_ID_WCCD, 400, &ADDRESS_0).expect_report("Failed to setup state"); - state - } - - /// Test initialization succeeds and the tokens are owned by the contract - /// instantiater and the appropriate events are logged. - #[concordium_test] - fn test_init() { - // Setup the context - let mut ctx = InitContextTest::empty(); - ctx.set_init_origin(ACCOUNT_0); - - let mut logger = LogRecorder::init(); - - // Call the contract function. - let result = contract_init(&ctx, &mut logger); - - // Check the result - let state = result.expect_report("Contract initialization failed"); - - // Check the state - claim_eq!(state.token.len(), 0, "Only one token is initialized"); - let balance0 = - state.balance(&TOKEN_ID_WCCD, &ADDRESS_0).expect_report("Token is expected to exist"); - claim_eq!(balance0, 0, "No initial tokens are owned by the contract instantiater"); - - // Check the logs - claim_eq!(logger.logs.len(), 2, "Exactly one event should be logged"); - claim!( - logger.logs.contains(&to_bytes(&Cis1Event::Mint(MintEvent { - owner: ADDRESS_0, - token_id: TOKEN_ID_WCCD, - amount: 0, - }))), - "Missing event for minting the token" - ); - claim!( - logger.logs.contains(&to_bytes(&Cis1Event::TokenMetadata(TokenMetadataEvent { - token_id: TOKEN_ID_WCCD, - metadata_url: MetadataUrl { - url: String::from(TOKEN_METADATA_URL), - hash: None, - }, - }))), - "Missing event with metadata for the token" - ); - } - - /// Test transfer succeeds, when `from` is the sender. - #[concordium_test] - fn test_transfer_account() { - // Setup the context - let mut ctx = ReceiveContextTest::empty(); - ctx.set_sender(ADDRESS_0); - - // and parameter. - let transfer = Transfer { - token_id: TOKEN_ID_WCCD, - amount: 100, - from: ADDRESS_0, - to: cis1::Receiver::from_account(ACCOUNT_1), - data: AdditionalData::empty(), - }; - let parameter = TransferParams::from(vec![transfer]); - let parameter_bytes = to_bytes(¶meter); - ctx.set_parameter(¶meter_bytes); - - let mut logger = LogRecorder::init(); - let mut state = State::new(); - state.mint(&TOKEN_ID_WCCD, 400, &ADDRESS_0).expect_report("Failed to setup state"); - - // Call the contract function. - let result: ContractResult = contract_transfer(&ctx, &mut logger, &mut state); - // Check the result. - let actions = result.expect_report("Results in rejection"); - claim_eq!(actions, ActionsTree::accept(), "No action should be produced."); - - // Check the state. - let balance0 = - state.balance(&TOKEN_ID_WCCD, &ADDRESS_0).expect_report("Token is expected to exist"); - let balance1 = - state.balance(&TOKEN_ID_WCCD, &ADDRESS_1).expect_report("Token is expected to exist"); - claim_eq!( - balance0, - 300, - "Token owner balance should be decreased by the transferred amount" - ); - claim_eq!( - balance1, - 100, - "Token receiver balance should be increased by the transferred amount" - ); - - // Check the logs. - claim_eq!(logger.logs.len(), 1, "Only one event should be logged"); - claim_eq!( - logger.logs[0], - to_bytes(&Cis1Event::Transfer(TransferEvent { - from: ADDRESS_0, - to: ADDRESS_1, - token_id: TOKEN_ID_WCCD, - amount: 100, - })), - "Incorrect event emitted" - ) - } - - /// Test transfer token fails, when sender is neither the owner or an - /// operator of the owner. - #[concordium_test] - fn test_transfer_not_authorized() { - // Setup the context - let mut ctx = ReceiveContextTest::empty(); - ctx.set_sender(ADDRESS_1); - - // and parameter. - let transfer = Transfer { - from: ADDRESS_0, - to: cis1::Receiver::from_account(ACCOUNT_1), - token_id: TOKEN_ID_WCCD, - amount: 100, - data: AdditionalData::empty(), - }; - let parameter = TransferParams::from(vec![transfer]); - let parameter_bytes = to_bytes(¶meter); - ctx.set_parameter(¶meter_bytes); - - let mut logger = LogRecorder::init(); - let mut state = initial_state(); - - // Call the contract function. - let result: ContractResult = contract_transfer(&ctx, &mut logger, &mut state); - // Check the result. - let err = result.expect_err_report("Expected to fail"); - claim_eq!(err, ContractError::Unauthorized, "Error is expected to be Unauthorized") - } - - /// Test transfer succeeds when sender is not the owner, but is an operator - /// of the owner. - #[concordium_test] - fn test_operator_transfer() { - // Setup the context - let mut ctx = ReceiveContextTest::empty(); - ctx.set_sender(ADDRESS_1); - - // and parameter. - let transfer = Transfer { - from: ADDRESS_0, - to: cis1::Receiver::from_account(ACCOUNT_1), - token_id: TOKEN_ID_WCCD, - amount: 100, - data: AdditionalData::empty(), - }; - let parameter = TransferParams::from(vec![transfer]); - let parameter_bytes = to_bytes(¶meter); - ctx.set_parameter(¶meter_bytes); - - let mut logger = LogRecorder::init(); - let mut state = initial_state(); - state.add_operator(&ADDRESS_0, &ADDRESS_1); - - // Call the contract function. - let result: ContractResult = contract_transfer(&ctx, &mut logger, &mut state); - - // Check the result. - let actions: ActionsTree = result.expect_report("Results in rejection"); - claim_eq!(actions, ActionsTree::accept(), "No action should be produced."); - - // Check the state. - let balance0 = - state.balance(&TOKEN_ID_WCCD, &ADDRESS_0).expect_report("Token is expected to exist"); - let balance1 = - state.balance(&TOKEN_ID_WCCD, &ADDRESS_1).expect_report("Token is expected to exist"); - claim_eq!(balance0, 300); //, "Token owner balance should be decreased by the transferred amount"); - claim_eq!( - balance1, - 100, - "Token receiver balance should be increased by the transferred amount" - ); - - // Check the logs. - claim_eq!(logger.logs.len(), 1, "Only one event should be logged"); - claim_eq!( - logger.logs[0], - to_bytes(&Cis1Event::Transfer(TransferEvent { - from: ADDRESS_0, - to: ADDRESS_1, - token_id: TOKEN_ID_WCCD, - amount: 100, - })), - "Incorrect event emitted" - ) - } - - /// Test adding an operator succeeds and the appropriate event is logged. - #[concordium_test] - fn test_add_operator() { - // Setup the context - let mut ctx = ReceiveContextTest::empty(); - ctx.set_sender(ADDRESS_0); - - // and parameter. - let update = UpdateOperator { - operator: ADDRESS_1, - update: OperatorUpdate::Add, - }; - let parameter = UpdateOperatorParams(vec![update]); - let parameter_bytes = to_bytes(¶meter); - ctx.set_parameter(¶meter_bytes); - - let mut logger = LogRecorder::init(); - let mut state = initial_state(); - - // Call the contract function. - let result: ContractResult = - contract_update_operator(&ctx, &mut logger, &mut state); - - // Check the result. - let actions: ActionsTree = result.expect_report("Results in rejection"); - claim_eq!(actions, ActionsTree::accept(), "No action should be produced."); - - // Check the state. - claim!(state.is_operator(&ADDRESS_1, &ADDRESS_0), "Account should be an operator"); - - // Check the logs. - claim_eq!(logger.logs.len(), 1, "One event should be logged"); - claim_eq!( - logger.logs[0], - to_bytes(&Cis1Event::::UpdateOperator(UpdateOperatorEvent { - owner: ADDRESS_0, - operator: ADDRESS_1, - update: OperatorUpdate::Add, - })), - "Incorrect event emitted" - ) - } -} -#+end_src - -** Generation of backend output - -#+begin_src elisp :var SOURCE-CODE-FILE="Hacspec_Wccd.v" :results output silent :tangle no -(org-babel-detangle SOURCE-CODE-FILE) -#+end_src - -*** wccd - Coq code -:PROPERTIES: -:header-args: coq :tangle Hacspec_Wccd.v :mkdirp yes :comments link -:header-args: coq :eval never :results output silent -:END: - -#+begin_src coq - -(** This file was automatically generated using Hacspec **) -Require Import Hacspec_Lib MachineIntegers. -From Coq Require Import ZArith. -From Coq Require Import List. -Import ListNotations. -Open Scope Z_scope. -Open Scope bool_scope. -Open Scope hacspec_scope. - -From ConCert.Utils Require Import Extras. -From ConCert.Utils Require Import Automation. -From ConCert.Execution Require Import Serializable. -From ConCert.Execution Require Import Blockchain. -From ConCert.Execution Require Import ContractCommon. -From Coq Require Import Morphisms ZArith Basics. -Open Scope Z. -Set Nonrecursive Elimination Schemes. -#+end_src - -#+begin_src coq -Require Import Hacspec_Lib. -Export Hacspec_Lib. -#+end_src - -#+begin_src coq -Require Import Hacspec_Concordium. -Export Hacspec_Concordium. -#+end_src - -#+begin_src coq -Require Import Concert_Lib. -Export Concert_Lib. -#+end_src - -#+begin_src coq -Definition transfer_event_tag_v : int8 := - @repr WORDSIZE8 255. -#+end_src - -#+begin_src coq -Definition mint_event_tag_v : int8 := - (@repr WORDSIZE8 255) .- (@repr WORDSIZE8 1). -#+end_src - -#+begin_src coq -Definition burn_event_tag_v : int8 := - (@repr WORDSIZE8 255) .- (@repr WORDSIZE8 2). -#+end_src - -#+begin_src coq -Definition update_operator_event_tag_v : int8 := - (@repr WORDSIZE8 255) .- (@repr WORDSIZE8 3). -#+end_src - -#+begin_src coq -Definition token_metadata_event_tag_v : int8 := - (@repr WORDSIZE8 255) .- (@repr WORDSIZE8 4). -#+end_src - -#+begin_src coq -Definition sha256_t := nseq (int8) (usize 32). -#+end_src - -#+begin_src coq -Inductive metadata_url_t := -| MetadataUrl : (string_t ∏ (option sha256_t)) -> metadata_url_t. -Global Instance serializable_metadata_url_t : Serializable metadata_url_t := - Derive Serializable metadata_url_t_rect. -#+end_src - -#+begin_src coq -Inductive token_id_vec_t := -| TokenIdVec : public_byte_seq -> token_id_vec_t. -Global Instance serializable_token_id_vec_t : Serializable token_id_vec_t := - Derive Serializable token_id_vec_t_rect. -#+end_src - -#+begin_src coq -Inductive token_id_uint32_t := -| TokenIdU32 : int32 -> token_id_uint32_t. -Global Instance serializable_token_id_uint32_t : Serializable token_id_uint32_t := - Derive Serializable token_id_uint32_t_rect. -#+end_src - -#+begin_src coq -Inductive token_id_uint16_t := -| TokenIdU16 : int16 -> token_id_uint16_t. -Global Instance serializable_token_id_uint16_t : Serializable token_id_uint16_t := - Derive Serializable token_id_uint16_t_rect. -#+end_src - -#+begin_src coq -Inductive token_id_uint8_t := -| TokenIdU8 : int8 -> token_id_uint8_t. -Global Instance serializable_token_id_uint8_t : Serializable token_id_uint8_t := - Derive Serializable token_id_uint8_t_rect. -#+end_src - -#+begin_src coq -Inductive token_id_unit_t := -| TokenIdUnit : unit -> token_id_unit_t. -Global Instance serializable_token_id_unit_t : Serializable token_id_unit_t := - Derive Serializable token_id_unit_t_rect. -#+end_src - -#+begin_src coq -Notation "'token_amount_t'" := (int64) : hacspec_scope. -#+end_src - -#+begin_src coq -Inductive operator_update_t := -| Remove : operator_update_t -| Add : operator_update_t. -Global Instance serializable_operator_update_t : Serializable operator_update_t := - Derive Serializable operator_update_t_rect. -#+end_src - -#+begin_src coq -Inductive update_operator_event_t := -| UpdateOperatorEvent : (operator_update_t ∏ user_address_t ∏ user_address_t -) -> update_operator_event_t. -Global Instance serializable_update_operator_event_t : Serializable update_operator_event_t := - Derive Serializable update_operator_event_t_rect. -#+end_src - -#+begin_src coq -Notation "'contract_token_id_t'" := (token_id_unit_t) : hacspec_scope. -#+end_src - -#+begin_src coq -Definition token_id_wccd_v : contract_token_id_t := - TokenIdUnit (tt). -#+end_src - -#+begin_src coq -Inductive state_hacspec_t := -| StateHacspec : public_byte_seq -> state_hacspec_t. -Global Instance serializable_state_hacspec_t : Serializable state_hacspec_t := - Derive Serializable state_hacspec_t_rect. -Definition State := context_t ∏ state_hacspec_t. -#+end_src - -#+begin_src coq -Definition contract_init (ctx_0 : context_t): (context_t ∏ state_hacspec_t) := - (ctx_0, StateHacspec (seq_new_ (default) (usize 0))). -Definition Setup := unit. -Definition CIS1_wCCD_State (chain : Chain) (ctx : ContractCallContext) (setup : Setup) : option ( - context_t ∏ - state_hacspec_t -) := - Some (contract_init (Context (ctx.(ctx_from), ctx.(ctx_origin), repr ctx.(ctx_amount), 0 (* TODO *)))). -#+end_src - -#+begin_src coq -Definition contract_wrap - (ctx_1 : (context_t ∏ state_hacspec_t)) - (amount_2 : int64): (option ((context_t ∏ state_hacspec_t) ∏ list_action_t - )) := - let '(Context ((owner_3, sender_4, balance_5, time_6)), state_7) := - ctx_1 in - let s_8 : seq has_action_t := - seq_new_ (default) (usize 0) in - @Some ((context_t ∏ state_hacspec_t) ∏ list_action_t) (( - (Context ((owner_3, sender_4, balance_5, time_6)), state_7), - s_8 - )). - -Definition wrap (amount : int64) (st : State) := - contract_wrap st amount. -#+end_src - -#+begin_src coq -Definition contract_unwrap - (ctx_9 : (context_t ∏ state_hacspec_t)): (option ( - (context_t ∏ state_hacspec_t) ∏ - list_action_t - )) := - let '(Context ((owner_10, sender_11, balance_12, time_13)), state_14) := - ctx_9 in - let s_15 : seq has_action_t := - seq_new_ (default) (usize 0) in - @Some ((context_t ∏ state_hacspec_t) ∏ list_action_t) (( - (Context ((owner_10, sender_11, balance_12, time_13)), state_14), - s_15 - )). - -Definition unwrap (st : State) := - contract_unwrap st. -#+end_src - -#+begin_src coq -Definition contract_transfer - (ctx_16 : (context_t ∏ state_hacspec_t)): (option ( - (context_t ∏ state_hacspec_t) ∏ - list_action_t - )) := - let '(Context ((owner_17, sender_18, balance_19, time_20)), state_21) := - ctx_16 in - let s_22 : seq has_action_t := - seq_new_ (default) (usize 0) in - @Some ((context_t ∏ state_hacspec_t) ∏ list_action_t) (( - (Context ((owner_17, sender_18, balance_19, time_20)), state_21), - s_22 - )). - -Definition transfer (st : State) := - contract_transfer st. -#+end_src - -#+begin_src coq -Definition contract_update_operator - (ctx_23 : (context_t ∏ state_hacspec_t)): (option ( - (context_t ∏ state_hacspec_t) ∏ - list_action_t - )) := - let '(Context ((owner_24, sender_25, balance_26, time_27)), state_28) := - ctx_23 in - let s_29 : seq has_action_t := - seq_new_ (default) (usize 0) in - @Some ((context_t ∏ state_hacspec_t) ∏ list_action_t) (( - (Context ((owner_24, sender_25, balance_26, time_27)), state_28), - s_29 - )). - -Definition updateOperator (st : State) := - contract_update_operator st. -#+end_src - -#+begin_src coq -Definition contract_balance_of - (ctx_30 : (context_t ∏ state_hacspec_t)): (option ( - (context_t ∏ state_hacspec_t) ∏ - list_action_t - )) := - let '(Context ((owner_31, sender_32, balance_33, time_34)), state_35) := - ctx_30 in - let s_36 : seq has_action_t := - seq_new_ (default) (usize 0) in - @Some ((context_t ∏ state_hacspec_t) ∏ list_action_t) (( - (Context ((owner_31, sender_32, balance_33, time_34)), state_35), - s_36 - )). - -Definition balanceOf (st : State) := - contract_balance_of st. -#+end_src - -#+begin_src coq -Definition contract_operator_of - (ctx_37 : (context_t ∏ state_hacspec_t)): (option ( - (context_t ∏ state_hacspec_t) ∏ - list_action_t - )) := - let '(Context ((owner_38, sender_39, balance_40, time_41)), state_42) := - ctx_37 in - let s_43 : seq has_action_t := - seq_new_ (default) (usize 0) in - @Some ((context_t ∏ state_hacspec_t) ∏ list_action_t) (( - (Context ((owner_38, sender_39, balance_40, time_41)), state_42), - s_43 - )). - -Definition operatorOf (st : State) := - contract_operator_of st. -#+end_src - -#+begin_src coq -Definition contract_token_metadata - (ctx_44 : (context_t ∏ state_hacspec_t)): (option ( - (context_t ∏ state_hacspec_t) ∏ - list_action_t - )) := - let '(Context ((owner_45, sender_46, balance_47, time_48)), state_49) := - ctx_44 in - let s_50 : seq has_action_t := - seq_new_ (default) (usize 0) in - @Some ((context_t ∏ state_hacspec_t) ∏ list_action_t) (( - (Context ((owner_45, sender_46, balance_47, time_48)), state_49), - s_50 - )). - -Definition tokenMetadata (st : State) := - contract_token_metadata st. -#+end_src - -#+begin_src coq -Inductive Msg := -| WRAP -| UNWRAP -| TRANSFER -| UPDATEOPERATOR -| BALANCEOF -| OPERATOROF -| TOKENMETADATA. -Global Instance Msg_serializable : Serializable Msg := - Derive Serializable Msg_rect. -Definition CIS1_wCCD_receive (chain : Chain) (ctx : ContractCallContext) (state : State) (msg : option Msg) : option (State * list ActionBody) := - match msg with - | Some WRAP => to_action_body_list ctx (wrap (repr ctx.(ctx_amount)) state) - | Some UNWRAP => to_action_body_list ctx (unwrap state) - | Some TRANSFER => to_action_body_list ctx (transfer state) - | Some UPDATEOPERATOR => to_action_body_list ctx (updateOperator state) - | Some BALANCEOF => to_action_body_list ctx (balanceOf state) - | Some OPERATOROF => to_action_body_list ctx (operatorOf state) - | Some TOKENMETADATA => to_action_body_list ctx (tokenMetadata state) - | None => None - end. - -Definition CIS1_wCCD_contract : Contract Setup Msg State := - build_contract CIS1_wCCD_State CIS1_wCCD_receive. -#+end_src -# 31 code sections From aa6ea89959da4457e08ff84b68b80213fffd69c3 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Mon, 27 Nov 2023 10:54:09 +0100 Subject: [PATCH 36/86] Cleanup Cargo.toml --- Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index f773f0c..3945355 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,5 +26,4 @@ members = [ "ovn", "concordium", "concordium-derive", - "wCCD", ] From 90dc9b72f1aee165a67106b37982bf92fcf8e416 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 10 Jan 2024 14:22:08 +0100 Subject: [PATCH 37/86] Update --- Cargo.toml | 1 + aes/proofs/coq/extraction/Hacspec_aes.v | 547 ++++++++++++++ auction/Cargo.toml | 23 + .../proofs/coq/extraction/Hacspec_auction.v | 63 ++ .../Hacspec_auction_Export_auction_bid.v | 21 + .../Hacspec_auction_Export_auction_finalize.v | 21 + .../Hacspec_auction_Export_auction_init.v | 21 + .../extraction/Hacspec_auction_Export_view.v | 21 + .../Hacspec_auction_Export_view_highest_bid.v | 21 + .../ssprove/extraction/Hacspec_auction.v | 339 +++++++++ .../Hacspec_auction_Export_auction_finalize.v | 40 ++ auction/src/auction.rs | 423 +++++++++++ basic/proofs/coq/extraction/Example.v | 14 + .../proofs/coq/extraction/Hacspec_chacha20.v | 124 ++++ concordium/src/concordium.rs | 3 + concordium/src/concordium_impls.rs | 667 ++++++++++++++++++ .../coq/extraction/Hacspec_edwards25519.v | 490 +++++++++++++ ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 214 ++---- ovn/src/ovn.rs | 28 - pasta/proofs/coq/extraction/Hacspec_pasta.v | 190 +++++ rust-toolchain.toml | 2 +- sha512/proofs/coq/extraction/Hacspec_sha512.v | 250 +++++++ 22 files changed, 3333 insertions(+), 190 deletions(-) create mode 100644 aes/proofs/coq/extraction/Hacspec_aes.v create mode 100644 auction/Cargo.toml create mode 100644 auction/proofs/coq/extraction/Hacspec_auction.v create mode 100644 auction/proofs/coq/extraction/Hacspec_auction_Export_auction_bid.v create mode 100644 auction/proofs/coq/extraction/Hacspec_auction_Export_auction_finalize.v create mode 100644 auction/proofs/coq/extraction/Hacspec_auction_Export_auction_init.v create mode 100644 auction/proofs/coq/extraction/Hacspec_auction_Export_view.v create mode 100644 auction/proofs/coq/extraction/Hacspec_auction_Export_view_highest_bid.v create mode 100644 auction/proofs/ssprove/extraction/Hacspec_auction.v create mode 100644 auction/proofs/ssprove/extraction/Hacspec_auction_Export_auction_finalize.v create mode 100644 auction/src/auction.rs create mode 100644 basic/proofs/coq/extraction/Example.v create mode 100644 chacha20/proofs/coq/extraction/Hacspec_chacha20.v create mode 100644 edwards25519/proofs/coq/extraction/Hacspec_edwards25519.v create mode 100644 pasta/proofs/coq/extraction/Hacspec_pasta.v create mode 100644 sha512/proofs/coq/extraction/Hacspec_sha512.v diff --git a/Cargo.toml b/Cargo.toml index 3945355..d81affa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,7 @@ members = [ "halo2", "weierstrass-curves", "ovn", + "auction", "concordium", "concordium-derive", ] diff --git a/aes/proofs/coq/extraction/Hacspec_aes.v b/aes/proofs/coq/extraction/Hacspec_aes.v new file mode 100644 index 0000000..83c0697 --- /dev/null +++ b/aes/proofs/coq/extraction/Hacspec_aes.v @@ -0,0 +1,547 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +Require Import Hacspec_lib. + +(*Not implemented yet? todo(item)*) + +Definition v_BLOCKSIZE : uint_size := + (@repr WORDSIZE32 16). + +Definition v_INVALID_KEY_EXPANSION_INDEX : int8 := + (@repr WORDSIZE8 1). + +Definition v_ITERATIONS : uint_size := + (@repr WORDSIZE32 40). + +Definition v_IVSIZE : uint_size := + (@repr WORDSIZE32 12). + +Definition v_KEY_LENGTH : uint_size := + (@repr WORDSIZE32 4). + +Definition v_KEY_SCHEDULE_LENGTH : uint_size := + (@repr WORDSIZE32 176). + +Definition v_ROUNDS : uint_size := + (@repr WORDSIZE32 10). + +Notation AesNonce_t := (nseq int8 IVSIZE). +Definition AesNonce : AesNonce_t -> AesNonce_t := + id. + +Notation Block_t := (nseq int8 BLOCKSIZE). +Definition Block : Block_t -> Block_t := + id. + +Notation t_BlockResult_t := (t_Result_t (t_Block_t) (int8)). + +Notation Bytes144_t := (nseq int8 144). +Definition Bytes144 : Bytes144_t -> Bytes144_t := + id. + +Notation Bytes176_t := (nseq int8 KEY_SCHEDULE_LENGTH). +Definition Bytes176 : Bytes176_t -> Bytes176_t := + id. + +Notation Key128_t := (nseq int8 BLOCKSIZE). +Definition Key128 : Key128_t -> Key128_t := + id. + +Notation RCon_t := (nseq int8 15). +Definition RCon : RCon_t -> RCon_t := + id. + +Notation RoundKey_t := (nseq int8 BLOCKSIZE). +Definition RoundKey : RoundKey_t -> RoundKey_t := + id. + +Notation SBox_t := (nseq int8 256). +Definition SBox : SBox_t -> SBox_t := + id. + +Notation Word_t := (nseq int8 KEY_LENGTH). +Definition Word : Word_t -> Word_t := + id. + +Notation t_WordResult_t := (t_Result_t (t_Word_t) (int8)). + +Notation t_ByteSeqResult_t := (t_Result_t (t_Seq_t t_U8_t) (int8)). + +Definition add_round_key (state : t_Block_t) (key : t_RoundKey_t) : t_Block_t := + let out := (state) : t_Block_t in + let out := (f_fold (f_into_iter (Build_Range (@repr WORDSIZE32 0)v_BLOCKSIZE)) out (fun out i => + update_at_usize out i ((out.[i]).^(key.[i])))) : t_Block_t in + out. + +Definition rotate_word (w : t_Word_t) : t_Word_t := + Word (array_from_list [w.[(@repr WORDSIZE32 1)]; + w.[(@repr WORDSIZE32 2)]; + w.[(@repr WORDSIZE32 3)]; + w.[(@repr WORDSIZE32 0)]]). + +Definition shift_row (i : uint_size) (shift : uint_size) (state : t_Block_t) : t_Block_t := + let out := (state) : t_Block_t in + let out := (update_at_usize out i (state.[(i.+((@repr WORDSIZE32 4).*(shift.%(@repr WORDSIZE32 4))))])) : t_Block_t in + let out := (update_at_usize out (i.+(@repr WORDSIZE32 4)) (state.[(i.+((@repr WORDSIZE32 4).*((shift.+(@repr WORDSIZE32 1)).%(@repr WORDSIZE32 4))))])) : t_Block_t in + let out := (update_at_usize out (i.+(@repr WORDSIZE32 8)) (state.[(i.+((@repr WORDSIZE32 4).*((shift.+(@repr WORDSIZE32 2)).%(@repr WORDSIZE32 4))))])) : t_Block_t in + let out := (update_at_usize out (i.+(@repr WORDSIZE32 12)) (state.[(i.+((@repr WORDSIZE32 4).*((shift.+(@repr WORDSIZE32 3)).%(@repr WORDSIZE32 4))))])) : t_Block_t in + out. + +Definition shift_rows (state : t_Block_t) : t_Block_t := + let state := (shift_row (@repr WORDSIZE32 1) (@repr WORDSIZE32 1) state) : t_Block_t in + let state := (shift_row (@repr WORDSIZE32 2) (@repr WORDSIZE32 2) state) : t_Block_t in + shift_row (@repr WORDSIZE32 3) (@repr WORDSIZE32 3) state. + +Definition xor_block (block : t_Block_t) (key_block : t_Block_t) : t_Block_t := + let out := (block) : t_Block_t in + let out := (f_fold (f_into_iter (Build_Range (@repr WORDSIZE32 0)v_BLOCKSIZE)) out (fun out i => + update_at_usize out i ((out.[i]).^(key_block.[i])))) : t_Block_t in + out. + +Definition v_RCON : t_RCon_t := + RCon (array_from_list [U8 (@repr WORDSIZE8 141); + U8 (@repr WORDSIZE8 1); + U8 (@repr WORDSIZE8 2); + U8 (@repr WORDSIZE8 4); + U8 (@repr WORDSIZE8 8); + U8 (@repr WORDSIZE8 16); + U8 (@repr WORDSIZE8 32); + U8 (@repr WORDSIZE8 64); + U8 (@repr WORDSIZE8 128); + U8 (@repr WORDSIZE8 27); + U8 (@repr WORDSIZE8 54); + U8 (@repr WORDSIZE8 108); + U8 (@repr WORDSIZE8 216); + U8 (@repr WORDSIZE8 171); + U8 (@repr WORDSIZE8 77)]). + +Definition v_SBOX : t_SBox_t := + SBox (array_from_list [U8 (@repr WORDSIZE8 99); + U8 (@repr WORDSIZE8 124); + U8 (@repr WORDSIZE8 119); + U8 (@repr WORDSIZE8 123); + U8 (@repr WORDSIZE8 242); + U8 (@repr WORDSIZE8 107); + U8 (@repr WORDSIZE8 111); + U8 (@repr WORDSIZE8 197); + U8 (@repr WORDSIZE8 48); + U8 (@repr WORDSIZE8 1); + U8 (@repr WORDSIZE8 103); + U8 (@repr WORDSIZE8 43); + U8 (@repr WORDSIZE8 254); + U8 (@repr WORDSIZE8 215); + U8 (@repr WORDSIZE8 171); + U8 (@repr WORDSIZE8 118); + U8 (@repr WORDSIZE8 202); + U8 (@repr WORDSIZE8 130); + U8 (@repr WORDSIZE8 201); + U8 (@repr WORDSIZE8 125); + U8 (@repr WORDSIZE8 250); + U8 (@repr WORDSIZE8 89); + U8 (@repr WORDSIZE8 71); + U8 (@repr WORDSIZE8 240); + U8 (@repr WORDSIZE8 173); + U8 (@repr WORDSIZE8 212); + U8 (@repr WORDSIZE8 162); + U8 (@repr WORDSIZE8 175); + U8 (@repr WORDSIZE8 156); + U8 (@repr WORDSIZE8 164); + U8 (@repr WORDSIZE8 114); + U8 (@repr WORDSIZE8 192); + U8 (@repr WORDSIZE8 183); + U8 (@repr WORDSIZE8 253); + U8 (@repr WORDSIZE8 147); + U8 (@repr WORDSIZE8 38); + U8 (@repr WORDSIZE8 54); + U8 (@repr WORDSIZE8 63); + U8 (@repr WORDSIZE8 247); + U8 (@repr WORDSIZE8 204); + U8 (@repr WORDSIZE8 52); + U8 (@repr WORDSIZE8 165); + U8 (@repr WORDSIZE8 229); + U8 (@repr WORDSIZE8 241); + U8 (@repr WORDSIZE8 113); + U8 (@repr WORDSIZE8 216); + U8 (@repr WORDSIZE8 49); + U8 (@repr WORDSIZE8 21); + U8 (@repr WORDSIZE8 4); + U8 (@repr WORDSIZE8 199); + U8 (@repr WORDSIZE8 35); + U8 (@repr WORDSIZE8 195); + U8 (@repr WORDSIZE8 24); + U8 (@repr WORDSIZE8 150); + U8 (@repr WORDSIZE8 5); + U8 (@repr WORDSIZE8 154); + U8 (@repr WORDSIZE8 7); + U8 (@repr WORDSIZE8 18); + U8 (@repr WORDSIZE8 128); + U8 (@repr WORDSIZE8 226); + U8 (@repr WORDSIZE8 235); + U8 (@repr WORDSIZE8 39); + U8 (@repr WORDSIZE8 178); + U8 (@repr WORDSIZE8 117); + U8 (@repr WORDSIZE8 9); + U8 (@repr WORDSIZE8 131); + U8 (@repr WORDSIZE8 44); + U8 (@repr WORDSIZE8 26); + U8 (@repr WORDSIZE8 27); + U8 (@repr WORDSIZE8 110); + U8 (@repr WORDSIZE8 90); + U8 (@repr WORDSIZE8 160); + U8 (@repr WORDSIZE8 82); + U8 (@repr WORDSIZE8 59); + U8 (@repr WORDSIZE8 214); + U8 (@repr WORDSIZE8 179); + U8 (@repr WORDSIZE8 41); + U8 (@repr WORDSIZE8 227); + U8 (@repr WORDSIZE8 47); + U8 (@repr WORDSIZE8 132); + U8 (@repr WORDSIZE8 83); + U8 (@repr WORDSIZE8 209); + U8 (@repr WORDSIZE8 0); + U8 (@repr WORDSIZE8 237); + U8 (@repr WORDSIZE8 32); + U8 (@repr WORDSIZE8 252); + U8 (@repr WORDSIZE8 177); + U8 (@repr WORDSIZE8 91); + U8 (@repr WORDSIZE8 106); + U8 (@repr WORDSIZE8 203); + U8 (@repr WORDSIZE8 190); + U8 (@repr WORDSIZE8 57); + U8 (@repr WORDSIZE8 74); + U8 (@repr WORDSIZE8 76); + U8 (@repr WORDSIZE8 88); + U8 (@repr WORDSIZE8 207); + U8 (@repr WORDSIZE8 208); + U8 (@repr WORDSIZE8 239); + U8 (@repr WORDSIZE8 170); + U8 (@repr WORDSIZE8 251); + U8 (@repr WORDSIZE8 67); + U8 (@repr WORDSIZE8 77); + U8 (@repr WORDSIZE8 51); + U8 (@repr WORDSIZE8 133); + U8 (@repr WORDSIZE8 69); + U8 (@repr WORDSIZE8 249); + U8 (@repr WORDSIZE8 2); + U8 (@repr WORDSIZE8 127); + U8 (@repr WORDSIZE8 80); + U8 (@repr WORDSIZE8 60); + U8 (@repr WORDSIZE8 159); + U8 (@repr WORDSIZE8 168); + U8 (@repr WORDSIZE8 81); + U8 (@repr WORDSIZE8 163); + U8 (@repr WORDSIZE8 64); + U8 (@repr WORDSIZE8 143); + U8 (@repr WORDSIZE8 146); + U8 (@repr WORDSIZE8 157); + U8 (@repr WORDSIZE8 56); + U8 (@repr WORDSIZE8 245); + U8 (@repr WORDSIZE8 188); + U8 (@repr WORDSIZE8 182); + U8 (@repr WORDSIZE8 218); + U8 (@repr WORDSIZE8 33); + U8 (@repr WORDSIZE8 16); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 243); + U8 (@repr WORDSIZE8 210); + U8 (@repr WORDSIZE8 205); + U8 (@repr WORDSIZE8 12); + U8 (@repr WORDSIZE8 19); + U8 (@repr WORDSIZE8 236); + U8 (@repr WORDSIZE8 95); + U8 (@repr WORDSIZE8 151); + U8 (@repr WORDSIZE8 68); + U8 (@repr WORDSIZE8 23); + U8 (@repr WORDSIZE8 196); + U8 (@repr WORDSIZE8 167); + U8 (@repr WORDSIZE8 126); + U8 (@repr WORDSIZE8 61); + U8 (@repr WORDSIZE8 100); + U8 (@repr WORDSIZE8 93); + U8 (@repr WORDSIZE8 25); + U8 (@repr WORDSIZE8 115); + U8 (@repr WORDSIZE8 96); + U8 (@repr WORDSIZE8 129); + U8 (@repr WORDSIZE8 79); + U8 (@repr WORDSIZE8 220); + U8 (@repr WORDSIZE8 34); + U8 (@repr WORDSIZE8 42); + U8 (@repr WORDSIZE8 144); + U8 (@repr WORDSIZE8 136); + U8 (@repr WORDSIZE8 70); + U8 (@repr WORDSIZE8 238); + U8 (@repr WORDSIZE8 184); + U8 (@repr WORDSIZE8 20); + U8 (@repr WORDSIZE8 222); + U8 (@repr WORDSIZE8 94); + U8 (@repr WORDSIZE8 11); + U8 (@repr WORDSIZE8 219); + U8 (@repr WORDSIZE8 224); + U8 (@repr WORDSIZE8 50); + U8 (@repr WORDSIZE8 58); + U8 (@repr WORDSIZE8 10); + U8 (@repr WORDSIZE8 73); + U8 (@repr WORDSIZE8 6); + U8 (@repr WORDSIZE8 36); + U8 (@repr WORDSIZE8 92); + U8 (@repr WORDSIZE8 194); + U8 (@repr WORDSIZE8 211); + U8 (@repr WORDSIZE8 172); + U8 (@repr WORDSIZE8 98); + U8 (@repr WORDSIZE8 145); + U8 (@repr WORDSIZE8 149); + U8 (@repr WORDSIZE8 228); + U8 (@repr WORDSIZE8 121); + U8 (@repr WORDSIZE8 231); + U8 (@repr WORDSIZE8 200); + U8 (@repr WORDSIZE8 55); + U8 (@repr WORDSIZE8 109); + U8 (@repr WORDSIZE8 141); + U8 (@repr WORDSIZE8 213); + U8 (@repr WORDSIZE8 78); + U8 (@repr WORDSIZE8 169); + U8 (@repr WORDSIZE8 108); + U8 (@repr WORDSIZE8 86); + U8 (@repr WORDSIZE8 244); + U8 (@repr WORDSIZE8 234); + U8 (@repr WORDSIZE8 101); + U8 (@repr WORDSIZE8 122); + U8 (@repr WORDSIZE8 174); + U8 (@repr WORDSIZE8 8); + U8 (@repr WORDSIZE8 186); + U8 (@repr WORDSIZE8 120); + U8 (@repr WORDSIZE8 37); + U8 (@repr WORDSIZE8 46); + U8 (@repr WORDSIZE8 28); + U8 (@repr WORDSIZE8 166); + U8 (@repr WORDSIZE8 180); + U8 (@repr WORDSIZE8 198); + U8 (@repr WORDSIZE8 232); + U8 (@repr WORDSIZE8 221); + U8 (@repr WORDSIZE8 116); + U8 (@repr WORDSIZE8 31); + U8 (@repr WORDSIZE8 75); + U8 (@repr WORDSIZE8 189); + U8 (@repr WORDSIZE8 139); + U8 (@repr WORDSIZE8 138); + U8 (@repr WORDSIZE8 112); + U8 (@repr WORDSIZE8 62); + U8 (@repr WORDSIZE8 181); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 72); + U8 (@repr WORDSIZE8 3); + U8 (@repr WORDSIZE8 246); + U8 (@repr WORDSIZE8 14); + U8 (@repr WORDSIZE8 97); + U8 (@repr WORDSIZE8 53); + U8 (@repr WORDSIZE8 87); + U8 (@repr WORDSIZE8 185); + U8 (@repr WORDSIZE8 134); + U8 (@repr WORDSIZE8 193); + U8 (@repr WORDSIZE8 29); + U8 (@repr WORDSIZE8 158); + U8 (@repr WORDSIZE8 225); + U8 (@repr WORDSIZE8 248); + U8 (@repr WORDSIZE8 152); + U8 (@repr WORDSIZE8 17); + U8 (@repr WORDSIZE8 105); + U8 (@repr WORDSIZE8 217); + U8 (@repr WORDSIZE8 142); + U8 (@repr WORDSIZE8 148); + U8 (@repr WORDSIZE8 155); + U8 (@repr WORDSIZE8 30); + U8 (@repr WORDSIZE8 135); + U8 (@repr WORDSIZE8 233); + U8 (@repr WORDSIZE8 206); + U8 (@repr WORDSIZE8 85); + U8 (@repr WORDSIZE8 40); + U8 (@repr WORDSIZE8 223); + U8 (@repr WORDSIZE8 140); + U8 (@repr WORDSIZE8 161); + U8 (@repr WORDSIZE8 137); + U8 (@repr WORDSIZE8 13); + U8 (@repr WORDSIZE8 191); + U8 (@repr WORDSIZE8 230); + U8 (@repr WORDSIZE8 66); + U8 (@repr WORDSIZE8 104); + U8 (@repr WORDSIZE8 65); + U8 (@repr WORDSIZE8 153); + U8 (@repr WORDSIZE8 45); + U8 (@repr WORDSIZE8 15); + U8 (@repr WORDSIZE8 176); + U8 (@repr WORDSIZE8 84); + U8 (@repr WORDSIZE8 187); + U8 (@repr WORDSIZE8 22)]). + +Definition sub_bytes (state : t_Block_t) : t_Block_t := + let st := (state) : t_Block_t in + let st := (f_fold (f_into_iter (Build_Range (@repr WORDSIZE32 0)v_BLOCKSIZE)) st (fun st i => + update_at_usize st i (v_SBOX.[(impl__U8__declassify (state.[i]))]))) : t_Block_t in + st. + +Definition aes_enc_last (state : t_Block_t) (round_key : t_RoundKey_t) : t_Block_t := + let state := (sub_bytes state) : t_Block_t in + let state := (shift_rows state) : t_Block_t in + add_round_key state round_key. + +Definition xtime (x : t_U8_t) : t_U8_t := + let x1 := (x shift_left (@repr WORDSIZE32 1)) : t_U8_t in + let x7 := (x shift_right (@repr WORDSIZE32 7)) : t_U8_t in + let x71 := (x7.&(U8 (@repr WORDSIZE8 1))) : t_U8_t in + let x711b := (x71.*(U8 (@repr WORDSIZE8 27))) : t_U8_t in + x1.^x711b. + +Definition mix_column (c : uint_size) (state : t_Block_t) : t_Block_t := + let i0 := ((@repr WORDSIZE32 4).*c) : uint_size in + let s0 := (state.[i0]) : t_U8_t in + let s1 := (state.[(i0.+(@repr WORDSIZE32 1))]) : t_U8_t in + let s2 := (state.[(i0.+(@repr WORDSIZE32 2))]) : t_U8_t in + let s3 := (state.[(i0.+(@repr WORDSIZE32 3))]) : t_U8_t in + let st := (state) : t_Block_t in + let tmp := (((s0.^s1).^s2).^s3) : t_U8_t in + let st := (update_at_usize st i0 ((s0.^tmp).^(xtime (s0.^s1)))) : t_Block_t in + let st := (update_at_usize st (i0.+(@repr WORDSIZE32 1)) ((s1.^tmp).^(xtime (s1.^s2)))) : t_Block_t in + let st := (update_at_usize st (i0.+(@repr WORDSIZE32 2)) ((s2.^tmp).^(xtime (s2.^s3)))) : t_Block_t in + let st := (update_at_usize st (i0.+(@repr WORDSIZE32 3)) ((s3.^tmp).^(xtime (s3.^s0)))) : t_Block_t in + st. + +Definition mix_columns (state : t_Block_t) : t_Block_t := + let state := (mix_column (@repr WORDSIZE32 0) state) : t_Block_t in + let state := (mix_column (@repr WORDSIZE32 1) state) : t_Block_t in + let state := (mix_column (@repr WORDSIZE32 2) state) : t_Block_t in + mix_column (@repr WORDSIZE32 3) state. + +Definition aes_enc (state : t_Block_t) (round_key : t_RoundKey_t) : t_Block_t := + let state := (sub_bytes state) : t_Block_t in + let state := (shift_rows state) : t_Block_t in + let state := (mix_columns state) : t_Block_t in + add_round_key state round_key. + +Definition rounds_aes (state : t_Block_t) (key : t_Seq_t t_U8_t) : t_Block_t := + let out := (state) : t_Block_t in + let out := (f_fold (f_into_iter (Build_Range (@repr WORDSIZE32 0)(impl_41__num_chunks key v_BLOCKSIZE))) out (fun out i => + let '(_,key_block) := (impl_41__get_chunk key v_BLOCKSIZE i) : (uint_size × t_Seq_t t_U8_t) in + let out := (aes_enc out (impl__RoundKey__from_seq key_block)) : t_Block_t in + out)) : t_Block_t in + out. + +Definition block_cipher_aes (input : t_Block_t) (key : t_Seq_t t_U8_t) (nr : uint_size) : t_Block_t := + let k0 := (impl__RoundKey__from_slice_range key (Build_Range (@repr WORDSIZE32 0)(@repr WORDSIZE32 16))) : t_RoundKey_t in + let k := (impl_41__from_slice_range key (Build_Range (@repr WORDSIZE32 16)(nr.*(@repr WORDSIZE32 16)))) : t_Seq_t t_U8_t in + let kn := (impl__RoundKey__from_slice key (nr.*(@repr WORDSIZE32 16)) (@repr WORDSIZE32 16)) : t_RoundKey_t in + let state := (add_round_key input k0) : t_Block_t in + let state := (rounds_aes state k) : t_Block_t in + aes_enc_last state kn. + +Definition slice_word (w : t_Word_t) : t_Word_t := + Word (array_from_list [v_SBOX.[(declassify_usize_from_U8 (w.[(@repr WORDSIZE32 0)]))]; + v_SBOX.[(declassify_usize_from_U8 (w.[(@repr WORDSIZE32 1)]))]; + v_SBOX.[(declassify_usize_from_U8 (w.[(@repr WORDSIZE32 2)]))]; + v_SBOX.[(declassify_usize_from_U8 (w.[(@repr WORDSIZE32 3)]))]]). + +Definition aes_keygen_assist (w : t_Word_t) (rcon : t_U8_t) : t_Word_t := + let k := (rotate_word w) : t_Word_t in + let k := (slice_word k) : t_Word_t in + let k := (update_at k (@repr WORDSIZE32 0) ((k.[(@repr WORDSIZE32 0)]).^rcon)) : t_Word_t in + k. + +Definition key_expansion_word (w0 : t_Word_t) (w1 : t_Word_t) (i : uint_size) (nk : uint_size) (nr : uint_size) : t_Result_t (t_Word_t) (int8) := + let k := (w1) : t_Word_t in + let result := (v_Err v_INVALID_KEY_EXPANSION_INDEX) : t_Result_t (t_Word_t) (int8) in + let '(k,result) := (if + i<.?((@repr WORDSIZE32 4).*(nr.+(@repr WORDSIZE32 1))) + then + let k := (if + (i.%nk)=.?(@repr WORDSIZE32 0) + then + let k := (aes_keygen_assist k (v_RCON.[(i./nk)])) : t_Word_t in + k + else + if + andb (nk>.?(@repr WORDSIZE32 6)) ((i.%nk)=.?(@repr WORDSIZE32 4)) + then + let k := (slice_word k) : t_Word_t in + k + else + k) : t_Word_t in + let k := (f_fold (f_into_iter (Build_Range (@repr WORDSIZE32 0)(@repr WORDSIZE32 4))) k (fun k i => + update_at k i ((k.[i]).^(w0.[i])))) : t_Word_t in + let result := (v_Ok k) : t_Result_t (t_Word_t) (int8) in + (k,result) + else + (k,result)) : (t_Word_t × t_Result_t (t_Word_t) (int8)) in + result. + +Definition key_expansion_aes (key : t_Seq_t t_U8_t) (nk : uint_size) (nr : uint_size) (key_schedule_length : uint_size) (key_length : uint_size) (iterations : uint_size) : t_Result_t (t_Seq_t t_U8_t) (int8) := + let key_ex := (impl_41__new key_schedule_length) : t_Seq_t t_U8_t in + let key_ex := (f_update_start key_ex key) : t_Seq_t t_U8_t in + let word_size := (key_length) : uint_size in + let key_ex := (f_fold (f_into_iter (Build_Range (@repr WORDSIZE32 0)iterations)) key_ex (fun key_ex j => + let i := (j.+word_size) : uint_size in + let word := (match f_branch (key_expansion_word (impl__Word__from_slice key_ex ((@repr WORDSIZE32 4).*(i.-word_size)) (@repr WORDSIZE32 4)) (impl__Word__from_slice key_ex (((@repr WORDSIZE32 4).*i).-(@repr WORDSIZE32 4)) (@repr WORDSIZE32 4)) i nk nr) with + | ControlFlow_Break residual => let hoist1 := (v_Break (f_from_residual residual)) : t_Never_t in + ControlFlow_Continue (never_to_any hoist1) + | ControlFlow_Continue val => ControlFlow_Continue val + end) : t_Word_t in + ControlFlow_Continue (let key_ex := (f_update key_ex ((@repr WORDSIZE32 4).*i) word) : t_Seq_t t_U8_t in + key_ex))) : t_Seq_t t_U8_t in + v_Ok key_ex. + +Definition aes_encrypt_block (k : t_Seq_t t_U8_t) (input : t_Block_t) (nk : uint_size) (nr : uint_size) (key_schedule_length : uint_size) (key_length : uint_size) (iterations : uint_size) : t_Result_t (t_Block_t) (int8) := + run (let key_ex := (match f_branch (key_expansion_aes k nk nr key_schedule_length key_length iterations) with + | ControlFlow_Break residual => let hoist2 := (v_Break (f_from_residual residual)) : t_Never_t in + ControlFlow_Continue (never_to_any hoist2) + | ControlFlow_Continue val => ControlFlow_Continue val + end) : t_Seq_t t_U8_t in + ControlFlow_Continue (v_Ok (block_cipher_aes input key_ex nr))). + +Definition aes128_encrypt_block (k : t_Key128_t) (input : t_Block_t) : t_Block_t := + impl__unwrap (aes_encrypt_block (impl_52__from_seq k) input v_KEY_LENGTH v_ROUNDS v_KEY_SCHEDULE_LENGTH v_KEY_LENGTH v_ITERATIONS). + +Definition aes_ctr_key_block (k : t_Seq_t t_U8_t) (n : t_AesNonce_t) (c : t_U32_t) (nk : uint_size) (nr : uint_size) (key_schedule_length : uint_size) (key_length : uint_size) (iterations : uint_size) : t_Result_t (t_Block_t) (int8) := + let input := (impl__Block__new) : t_Block_t in + let input := (f_update input (@repr WORDSIZE32 0) n) : t_Block_t in + let input := (f_update input (@repr WORDSIZE32 12) (v_U32_to_be_bytes c)) : t_Block_t in + aes_encrypt_block k input nk nr key_schedule_length key_length iterations. + +Definition aes_counter_mode (key : t_Seq_t t_U8_t) (nonce : t_AesNonce_t) (counter : t_U32_t) (msg : t_Seq_t t_U8_t) (nk : uint_size) (nr : uint_size) (key_schedule_length : uint_size) (key_length : uint_size) (iterations : uint_size) : t_Result_t (t_Seq_t t_U8_t) (int8) := + run (let ctr := (counter) : t_U32_t in + let blocks_out := (impl_41__new (impl_41__len msg)) : t_Seq_t t_U8_t in + let n_blocks := (impl_41__num_exact_chunks msg v_BLOCKSIZE) : uint_size in + let '(blocks_out,ctr) := (f_fold (f_into_iter (Build_Range (@repr WORDSIZE32 0)n_blocks)) (blocks_out,ctr) (fun '(blocks_out,ctr) i => + let msg_block := (impl_41__get_exact_chunk msg v_BLOCKSIZE i) : t_Seq_t t_U8_t in + let key_block := (match f_branch (aes_ctr_key_block key nonce ctr nk nr key_schedule_length key_length iterations) with + | ControlFlow_Break residual => let hoist3 := (v_Break (f_from_residual residual)) : t_Never_t in + ControlFlow_Continue (never_to_any hoist3) + | ControlFlow_Continue val => ControlFlow_Continue val + end) : t_Block_t in + ControlFlow_Continue (let blocks_out := (impl_41__set_chunk blocks_out v_BLOCKSIZE i (xor_block (impl__Block__from_seq msg_block) key_block)) : t_Seq_t t_U8_t in + let ctr := (ctr.+(U32 (@repr WORDSIZE32 1))) : t_U32_t in + (blocks_out,ctr)))) : (t_Seq_t t_U8_t × t_U32_t) in + let last_block := (impl_41__get_remainder_chunk msg v_BLOCKSIZE) : t_Seq_t t_U8_t in + let last_block_len := (impl_41__len last_block) : uint_size in + let blocks_out := (if + last_block_len<>(@repr WORDSIZE32 0) + then + let last_block := (f_update_start impl__Block__new last_block) : t_Block_t in + let key_block := (match f_branch (aes_ctr_key_block key nonce ctr nk nr key_schedule_length key_length iterations) with + | ControlFlow_Break residual => let hoist4 := (v_Break (f_from_residual residual)) : t_Never_t in + ControlFlow_Continue (never_to_any hoist4) + | ControlFlow_Continue val => ControlFlow_Continue val + end) : t_Block_t in + ControlFlow_Continue (let blocks_out := (impl_41__set_chunk blocks_out v_BLOCKSIZE n_blocks (impl__Block__slice_range (xor_block last_block key_block) (Build_Range (@repr WORDSIZE32 0)last_block_len))) : t_Seq_t t_U8_t in + blocks_out) + else + ControlFlow_Continue blocks_out) : t_Seq_t t_U8_t in + ControlFlow_Continue (v_Ok blocks_out)). + +Definition aes128_decrypt (key : t_Key128_t) (nonce : t_AesNonce_t) (counter : t_U32_t) (ctxt : t_Seq_t t_U8_t) : t_Seq_t t_U8_t := + impl__unwrap (aes_counter_mode (impl_52__from_seq key) nonce counter ctxt v_KEY_LENGTH v_ROUNDS v_KEY_SCHEDULE_LENGTH v_KEY_LENGTH v_ITERATIONS). + +Definition aes128_encrypt (key : t_Key128_t) (nonce : t_AesNonce_t) (counter : t_U32_t) (msg : t_Seq_t t_U8_t) : t_Seq_t t_U8_t := + impl__unwrap (aes_counter_mode (impl_52__from_seq key) nonce counter msg v_KEY_LENGTH v_ROUNDS v_KEY_SCHEDULE_LENGTH v_KEY_LENGTH v_ITERATIONS). diff --git a/auction/Cargo.toml b/auction/Cargo.toml new file mode 100644 index 0000000..37100ef --- /dev/null +++ b/auction/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "hacspec-auction" +version = "0.1.0" +authors = ["Lasse Letager Hanse "] +edition = "2018" + +[lib] +path = "src/auction.rs" + +[dependencies] +hax-lib-macros = { path = "../../hacspec-v2/hax-lib-macros/" } +hacspec-concordium = { path = "../concordium" } +hacspec-concordium-derive = { path = "../concordium-derive" } + +quickcheck = "1" +quickcheck_macros = "1" + +[dev-dependencies] +criterion = "0.4" +rand = "0.8" + +[features] +hax_compilation = [] diff --git a/auction/proofs/coq/extraction/Hacspec_auction.v b/auction/proofs/coq/extraction/Hacspec_auction.v new file mode 100644 index 0000000..c4a9ef0 --- /dev/null +++ b/auction/proofs/coq/extraction/Hacspec_auction.v @@ -0,0 +1,63 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +Inductive t_AuctionState: Type := +| AuctionState_NotSoldYet : t_AuctionState +| AuctionState_Sold : t_AccountAddress_t -> t_AuctionState. + +Inductive t_BidError: Type := +| BidError_ContractSender : t_BidError +| BidError_BidTooLow : t_BidError +| BidError_BidsOverWaitingForAuctionFinalization : t_BidError +| BidError_AuctionFinalized : t_BidError. + +Inductive t_FinalizeError: Type := +| FinalizeError_BidMapError : t_FinalizeError +| FinalizeError_AuctionStillActive : t_FinalizeError +| FinalizeError_AuctionFinalized : t_FinalizeError. + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +Definition auction_init (_ : unit) : t_Never_t := + failure (AST import) Fatal error: something we considered as impossible occurred! Please report this by submitting an issue on GitHub! +Details: [import_thir:literal] got an error literal: this means the Rust compiler or Hax's frontend probably reported errors above. + { Types.attributes = []; + contents = + Types.Literal { + lit = + { Types.node = Types.Err; + span = + { Types.filename = + (Types.Real (Types.LocalPath "auction/src/auction.rs")); + hi = { Types.col = "0"; line = "1" }; + lo = { Types.col = "0"; line = "1" } } + }; + neg = false}; + hir_id = None; + span = + { Types.filename = (Types.Real (Types.LocalPath "auction/src/auction.rs")); + hi = { Types.col = "63"; line = "115" }; + lo = { Types.col = "0"; line = "115" } }; + ty = Types.Never }. + +Record t_InitParameter : Type :={ + f_item : t_Vec_t (int8) (t_Global_t); + f_expiry : t_Timestamp_t; +}. + +Record t_State : Type :={ + f_auction_state : t_AuctionState_t; + f_highest_bid : t_Amount_t; + f_item : t_Vec_t (int8) (t_Global_t); + f_expiry : t_Timestamp_t; + f_bids : t_BTreeMap_t (t_AccountAddress_t) (t_Amount_t) (t_Global_t); +}. + +Definition fresh_state (itm : t_Vec_t (int8) (t_Global_t)) (exp : t_Timestamp_t) : t_State_t := + Build_State (f_auction_state := AuctionState_NotSoldYett_AuctionState_t) (f_highest_bid := impl__Amount__zero tt) (f_item := itm) (f_expiry := exp) (f_bids := impl_18__new tt). diff --git a/auction/proofs/coq/extraction/Hacspec_auction_Export_auction_bid.v b/auction/proofs/coq/extraction/Hacspec_auction_Export_auction_bid.v new file mode 100644 index 0000000..ec798ba --- /dev/null +++ b/auction/proofs/coq/extraction/Hacspec_auction_Export_auction_bid.v @@ -0,0 +1,21 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +Require Import Hacspec_concordium. +Export Hacspec_concordium. + +Require Import SeekFrom. +Export SeekFrom. + +Require Import ContractState. +Export ContractState. + +Require Import Logger. +Export Logger. + +Require Import trap. +Export trap. diff --git a/auction/proofs/coq/extraction/Hacspec_auction_Export_auction_finalize.v b/auction/proofs/coq/extraction/Hacspec_auction_Export_auction_finalize.v new file mode 100644 index 0000000..ec798ba --- /dev/null +++ b/auction/proofs/coq/extraction/Hacspec_auction_Export_auction_finalize.v @@ -0,0 +1,21 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +Require Import Hacspec_concordium. +Export Hacspec_concordium. + +Require Import SeekFrom. +Export SeekFrom. + +Require Import ContractState. +Export ContractState. + +Require Import Logger. +Export Logger. + +Require Import trap. +Export trap. diff --git a/auction/proofs/coq/extraction/Hacspec_auction_Export_auction_init.v b/auction/proofs/coq/extraction/Hacspec_auction_Export_auction_init.v new file mode 100644 index 0000000..dcd29d9 --- /dev/null +++ b/auction/proofs/coq/extraction/Hacspec_auction_Export_auction_init.v @@ -0,0 +1,21 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +Require Import Hacspec_concordium. +Export Hacspec_concordium. + +Require Import trap. +Export trap. + +Require Import ExternContext. +Export ExternContext. + +Require Import InitContextExtern. +Export InitContextExtern. + +Require Import ContractState. +Export ContractState. diff --git a/auction/proofs/coq/extraction/Hacspec_auction_Export_view.v b/auction/proofs/coq/extraction/Hacspec_auction_Export_view.v new file mode 100644 index 0000000..ec798ba --- /dev/null +++ b/auction/proofs/coq/extraction/Hacspec_auction_Export_view.v @@ -0,0 +1,21 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +Require Import Hacspec_concordium. +Export Hacspec_concordium. + +Require Import SeekFrom. +Export SeekFrom. + +Require Import ContractState. +Export ContractState. + +Require Import Logger. +Export Logger. + +Require Import trap. +Export trap. diff --git a/auction/proofs/coq/extraction/Hacspec_auction_Export_view_highest_bid.v b/auction/proofs/coq/extraction/Hacspec_auction_Export_view_highest_bid.v new file mode 100644 index 0000000..ec798ba --- /dev/null +++ b/auction/proofs/coq/extraction/Hacspec_auction_Export_view_highest_bid.v @@ -0,0 +1,21 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +Require Import Hacspec_concordium. +Export Hacspec_concordium. + +Require Import SeekFrom. +Export SeekFrom. + +Require Import ContractState. +Export ContractState. + +Require Import Logger. +Export Logger. + +Require Import trap. +Export trap. diff --git a/auction/proofs/ssprove/extraction/Hacspec_auction.v b/auction/proofs/ssprove/extraction/Hacspec_auction.v new file mode 100644 index 0000000..e9f0221 --- /dev/null +++ b/auction/proofs/ssprove/extraction/Hacspec_auction.v @@ -0,0 +1,339 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Definition t_Amount := int64. +Equations f_micro_ccd {L : {fset Location}} {I : Interface} (s : both L I (t_Amount)) : both L I int64 := + f_micro_ccd s := + bind_both s (fun x => + solve_lift (ret_both x)) : both L I int64. +Fail Next Obligation. +Equations Build_t_Amount {L0 : {fset Location}} {I0 : Interface} {f_micro_ccd : both L0 I0 int64} : both (L0) (I0) (t_Amount) := + Build_t_Amount := + bind_both f_micro_ccd (fun f_micro_ccd => + solve_lift (ret_both ((f_micro_ccd) : (t_Amount)))) : both (L0) (I0) (t_Amount). +Fail Next Obligation. + +Definition t_Timestamp := int32. +Definition t_BTreeMap (A B : choice_type) (C : vec_typ) := int32. +Equations impl_20__contains_key {L I A B C} (x : both L I (t_BTreeMap A B C)) (y : both L I A) : both L I 'bool := + impl_20__contains_key x y := solve_lift ret_both (true : 'bool). +Fail Next Obligation. +Equations f_slot_time {L I A} (x : both L I A) : both L I int64 := + f_slot_time x := solve_lift ret_both 3. +Fail Next Obligation. +Definition f_metadata {A} (x : A) := x. +Definition t_Address : choice_type := int64 ∐ int64. +Definition t_AccountAddress : choice_type := int64. +Definition Address_Contract_case (addr : int64) : t_Address := inl addr. +Definition Address_Account_case (addr : t_AccountAddress) : t_Address := inr addr. +Equations f_sender {L I A} (ctx : both L I A) : both L I t_Address := + f_sender ctx := solve_lift ret_both (Address_Account_case 0). +Fail Next Obligation. + + +Definition t_AuctionState : choice_type := + ('unit ∐ t_AccountAddress). +Notation "'AuctionState_NotSoldYet_case'" := (inl tt) (at level 100). +Equations AuctionState_NotSoldYet {L : {fset Location}} {I : Interface} : both L I (t_AuctionState) := + AuctionState_NotSoldYet := + solve_lift (ret_both (inl (tt : 'unit) : t_AuctionState)) : both L I (t_AuctionState). +Fail Next Obligation. +Notation "'AuctionState_Sold_case' x" := (inr x) (at level 100). +Equations AuctionState_Sold {L : {fset Location}} {I : Interface} (x : both L I (t_AccountAddress)) : both L I (t_AuctionState) := + AuctionState_Sold x := + bind_both x (fun x => + solve_lift (ret_both (inr x : t_AuctionState))) : both L I (t_AuctionState). +Fail Next Obligation. + +Definition t_BidError : choice_type := + ('unit ∐ 'unit ∐ 'unit ∐ 'unit). +Notation "'BidError_ContractSender_case'" := (inl (inl (inl tt))) (at level 100). +Equations BidError_ContractSender {L : {fset Location}} {I : Interface} : both L I (t_BidError) := + BidError_ContractSender := + solve_lift (ret_both (inl (inl (inl (tt : 'unit))) : t_BidError)) : both L I (t_BidError). +Fail Next Obligation. +Notation "'BidError_BidTooLow_case'" := (inl (inl (inr tt))) (at level 100). +Equations BidError_BidTooLow {L : {fset Location}} {I : Interface} : both L I (t_BidError) := + BidError_BidTooLow := + solve_lift (ret_both (inl (inl (inr (tt : 'unit))) : t_BidError)) : both L I (t_BidError). +Fail Next Obligation. +Notation "'BidError_BidsOverWaitingForAuctionFinalization_case'" := (inl (inr tt)) (at level 100). +Equations BidError_BidsOverWaitingForAuctionFinalization {L : {fset Location}} {I : Interface} : both L I (t_BidError) := + BidError_BidsOverWaitingForAuctionFinalization := + solve_lift (ret_both (inl (inr (tt : 'unit)) : t_BidError)) : both L I (t_BidError). +Fail Next Obligation. +Notation "'BidError_AuctionFinalized_case'" := (inr tt) (at level 100). +Equations BidError_AuctionFinalized {L : {fset Location}} {I : Interface} : both L I (t_BidError) := + BidError_AuctionFinalized := + solve_lift (ret_both (inr (tt : 'unit) : t_BidError)) : both L I (t_BidError). +Fail Next Obligation. + +Definition t_FinalizeError : choice_type := + ('unit ∐ 'unit ∐ 'unit). +Notation "'FinalizeError_BidMapError_case'" := (inl (inl tt)) (at level 100). +Equations FinalizeError_BidMapError {L : {fset Location}} {I : Interface} : both L I (t_FinalizeError) := + FinalizeError_BidMapError := + solve_lift (ret_both (inl (inl (tt : 'unit)) : t_FinalizeError)) : both L I (t_FinalizeError). +Fail Next Obligation. +Notation "'FinalizeError_AuctionStillActive_case'" := (inl (inr tt)) (at level 100). +Equations FinalizeError_AuctionStillActive {L : {fset Location}} {I : Interface} : both L I (t_FinalizeError) := + FinalizeError_AuctionStillActive := + solve_lift (ret_both (inl (inr (tt : 'unit)) : t_FinalizeError)) : both L I (t_FinalizeError). +Fail Next Obligation. +Notation "'FinalizeError_AuctionFinalized_case'" := (inr tt) (at level 100). +Equations FinalizeError_AuctionFinalized {L : {fset Location}} {I : Interface} : both L I (t_FinalizeError) := + FinalizeError_AuctionFinalized := + solve_lift (ret_both (inr (tt : 'unit) : t_FinalizeError)) : both L I (t_FinalizeError). +Fail Next Obligation. + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +Definition t_InitParameter : choice_type := + (t_Vec (int8) (t_Global) × t_Timestamp). +Equations f_init_parameter_item {L : {fset Location}} {I : Interface} (s : both L I (t_InitParameter)) : both L I (t_Vec (int8) (t_Global)) := + f_init_parameter_item s := + bind_both s (fun x => + solve_lift (ret_both (fst x : t_Vec (int8) (t_Global)))) : both L I (t_Vec (int8) (t_Global)). +Fail Next Obligation. +Equations f_init_parameter_expiry {L : {fset Location}} {I : Interface} (s : both L I (t_InitParameter)) : both L I (t_Timestamp) := + f_init_parameter_expiry s := + bind_both s (fun x => + solve_lift (ret_both (snd x : t_Timestamp))) : both L I (t_Timestamp). +Fail Next Obligation. +Equations Build_t_InitParameter {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_init_parameter_item : both L0 I0 (t_Vec (int8) (t_Global))} {f_init_parameter_expiry : both L1 I1 (t_Timestamp)} : both (L0:|:L1) (I0:|:I1) (t_InitParameter) := + Build_t_InitParameter := + bind_both f_init_parameter_expiry (fun f_init_parameter_expiry => + bind_both f_init_parameter_item (fun f_init_parameter_item => + solve_lift (ret_both ((f_init_parameter_item,f_init_parameter_expiry) : (t_InitParameter))))) : both (L0:|:L1) (I0:|:I1) (t_InitParameter). +Fail Next Obligation. +Notation "'Build_t_InitParameter' '[' x ']' '(' 'f_init_parameter_item' ':=' y ')'" := (Build_t_InitParameter (f_init_parameter_item := y) (f_init_parameter_expiry := f_init_parameter_expiry x)). +Notation "'Build_t_InitParameter' '[' x ']' '(' 'f_init_parameter_expiry' ':=' y ')'" := (Build_t_InitParameter (f_init_parameter_item := f_init_parameter_item x) (f_init_parameter_expiry := y)). + +Definition t_State : choice_type := + (t_AuctionState × t_Amount × t_Vec (int8) (t_Global) × t_Timestamp × t_BTreeMap (t_AccountAddress) (t_Amount) (t_Global)). +Equations f_auction_state {L : {fset Location}} {I : Interface} (s : both L I (t_State)) : both L I (t_AuctionState) := + f_auction_state s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst x))) : t_AuctionState))) : both L I (t_AuctionState). +Fail Next Obligation. +Equations f_highest_bid {L : {fset Location}} {I : Interface} (s : both L I (t_State)) : both L I (t_Amount) := + f_highest_bid s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : t_Amount))) : both L I (t_Amount). +Fail Next Obligation. +Equations f_item {L : {fset Location}} {I : Interface} (s : both L I (t_State)) : both L I (t_Vec (int8) (t_Global)) := + f_item s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : t_Vec (int8) (t_Global)))) : both L I (t_Vec (int8) (t_Global)). +Fail Next Obligation. +Equations f_expiry {L : {fset Location}} {I : Interface} (s : both L I (t_State)) : both L I (t_Timestamp) := + f_expiry s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : t_Timestamp))) : both L I (t_Timestamp). +Fail Next Obligation. +Equations f_bids {L : {fset Location}} {I : Interface} (s : both L I (t_State)) : both L I (t_BTreeMap (t_AccountAddress) (t_Amount) (t_Global)) := + f_bids s := + bind_both s (fun x => + solve_lift (ret_both (snd x : t_BTreeMap (t_AccountAddress) (t_Amount) (t_Global)))) : both L I (t_BTreeMap (t_AccountAddress) (t_Amount) (t_Global)). +Fail Next Obligation. +Equations Build_t_State {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {f_auction_state : both L0 I0 (t_AuctionState)} {f_highest_bid : both L1 I1 (t_Amount)} {f_item : both L2 I2 (t_Vec (int8) (t_Global))} {f_expiry : both L3 I3 (t_Timestamp)} {f_bids : both L4 I4 (t_BTreeMap (t_AccountAddress) (t_Amount) (t_Global))} : both (L0:|:L1:|:L2:|:L3:|:L4) (I0:|:I1:|:I2:|:I3:|:I4) (t_State) := + Build_t_State := + bind_both f_bids (fun f_bids => + bind_both f_expiry (fun f_expiry => + bind_both f_item (fun f_item => + bind_both f_highest_bid (fun f_highest_bid => + bind_both f_auction_state (fun f_auction_state => + solve_lift (ret_both ((f_auction_state,f_highest_bid,f_item,f_expiry,f_bids) : (t_State)))))))) : both (L0:|:L1:|:L2:|:L3:|:L4) (I0:|:I1:|:I2:|:I3:|:I4) (t_State). +Fail Next Obligation. +Notation "'Build_t_State' '[' x ']' '(' 'f_auction_state' ':=' y ')'" := (Build_t_State (f_auction_state := y) (f_highest_bid := f_highest_bid x) (f_item := f_item x) (f_expiry := f_expiry x) (f_bids := f_bids x)). +Notation "'Build_t_State' '[' x ']' '(' 'f_highest_bid' ':=' y ')'" := (Build_t_State (f_auction_state := f_auction_state x) (f_highest_bid := y) (f_item := f_item x) (f_expiry := f_expiry x) (f_bids := f_bids x)). +Notation "'Build_t_State' '[' x ']' '(' 'f_item' ':=' y ')'" := (Build_t_State (f_auction_state := f_auction_state x) (f_highest_bid := f_highest_bid x) (f_item := y) (f_expiry := f_expiry x) (f_bids := f_bids x)). +Notation "'Build_t_State' '[' x ']' '(' 'f_expiry' ':=' y ')'" := (Build_t_State (f_auction_state := f_auction_state x) (f_highest_bid := f_highest_bid x) (f_item := f_item x) (f_expiry := y) (f_bids := f_bids x)). +Notation "'Build_t_State' '[' x ']' '(' 'f_bids' ':=' y ')'" := (Build_t_State (f_auction_state := f_auction_state x) (f_highest_bid := f_highest_bid x) (f_item := f_item x) (f_expiry := f_expiry x) (f_bids := y)). +Fail Next Obligation. + +Equations auction_bid {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (amount : both L2 I2 (t_Amount)) (state : both L3 I3 (t_State)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_Result ((v_A × t_State)) (t_BidError)) := + auction_bid ctx amount state := + solve_lift (run ((* letb slot_time := f_slot_time (f_metadata ctx) in *) + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_State)) (t_BidError))] sender_address := matchb f_sender ctx with + | inl _ => + (* letb _ := ret_both tt in *) + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_State)) (t_BidError))] hoist1 := v_Break (Result_Err BidError_ContractSender) in + ControlFlow_Continue (solve_lift (never_to_any hoist1)) + | inr account_address => + letb account_address := ret_both ((account_address) : (t_AccountAddress)) in + ControlFlow_Continue (solve_lift account_address) + end in + (* letb (bid_to_update:both _ _ int64) := ifb impl_20__contains_key (f_bids state) sender_address *) + (* then f_micro_ccd ((f_bids state).a[sender_address]) *) + (* else ret_both (0 : int64) in *) + (* letb bid_to_update := bid_to_update .+ (f_micro_ccd amount) in *) + (* letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_State)) (t_BidError))] _ := ifb negb (bid_to_update >.? (f_micro_ccd (f_highest_bid state))) *) + (* then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_State)) (t_BidError))] hoist2 := v_Break (Result_Err BidError_BidTooLow) in *) + (* ControlFlow_Continue (never_to_any hoist2) *) + (* else ControlFlow_Continue (ret_both (tt : 'unit)) in *) + ControlFlow_Continue (letb state := Build_t_State[state] (f_highest_bid := Build_t_Amount (f_micro_ccd := ret_both 3 (* bid_to_update *))) in + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),state))))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_Result ((v_A × t_State)) (t_BidError)). +Next Obligation. + +Fail Next Obligation. + +Definition remaining_bid_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_Option ((t_AccountAddress × t_Amount));0%nat). +Definition return_action_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (v_A;1%nat). +Equations auction_finalize {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_State)) : both (L1 :|: L2 :|: fset [remaining_bid_loc;return_action_loc]) (I1 :|: I2) ((t_State × t_Result (v_A) (t_FinalizeError))) := + auction_finalize ctx state := + solve_lift (run (letm[choice_typeMonad.result_bind_code ((t_State × t_Result (v_A) (t_FinalizeError)))] _ := ifb not ((f_auction_state state) =.? AuctionState_NotSoldYet) + then letm[choice_typeMonad.result_bind_code ((t_State × t_Result (v_A) (t_FinalizeError)))] hoist3 := v_Break (prod_b (state,Result_Err FinalizeError_AuctionFinalized)) in + ControlFlow_Continue (never_to_any hoist3) + else ControlFlow_Continue (ret_both (tt : 'unit)) in + letb slot_time := f_slot_time (f_metadata ctx) in + letm[choice_typeMonad.result_bind_code ((t_State × t_Result (v_A) (t_FinalizeError)))] _ := ifb not (slot_time >.? (f_expiry state)) + then letm[choice_typeMonad.result_bind_code ((t_State × t_Result (v_A) (t_FinalizeError)))] hoist4 := v_Break (prod_b (state,Result_Err FinalizeError_AuctionStillActive)) in + ControlFlow_Continue (never_to_any hoist4) + else ControlFlow_Continue (ret_both (tt : 'unit)) in + letb owner := f_owner ctx in + letb balance := f_self_balance ctx in + letm[choice_typeMonad.result_bind_code ((t_State × t_Result (v_A) (t_FinalizeError)))] '(state,hax_temp_output) := ifb balance =.? (impl__Amount__zero (ret_both (tt : 'unit))) + then ControlFlow_Continue (prod_b (state,Result_Ok (f_accept (ret_both (tt : 'unit))))) + else letb return_action loc(return_action_loc) := f_simple_transfer owner (f_highest_bid state) in + letb remaining_bid loc(remaining_bid_loc) := Option_None in + letb '(remaining_bid,return_action,state) := foldi_both_list (f_into_iter (impl_91__iter (f_bids state))) (fun '(addr,amnt) => + ssp (fun '(remaining_bid,return_action,state) => + solve_lift (ifb amnt <.? (f_highest_bid state) + then ControlFlow_Continue (letb return_action := f_and_then return_action (f_simple_transfer addr amnt) in + prod_b (remaining_bid,return_action,state)) + else letm[choice_typeMonad.result_bind_code ((t_State × t_Result (v_A) (t_FinalizeError)))] _ := ifb not (impl__is_none remaining_bid) + then letm[choice_typeMonad.result_bind_code ((t_State × t_Result (v_A) (t_FinalizeError)))] hoist5 := v_Break (prod_b (state,Result_Err FinalizeError_BidMapError)) in + ControlFlow_Continue (never_to_any hoist5) + else ControlFlow_Continue (ret_both (tt : 'unit)) in + ControlFlow_Continue (letb state := Build_t_State[state] (f_auction_state := AuctionState_Sold addr) in + letb remaining_bid := Option_Some (prod_b (addr,amnt)) in + prod_b (remaining_bid,return_action,state))) : both (*4*)(L1:|:L2:|:L2:|:L1:|:L2:|:fset [remaining_bid_loc;return_action_loc;remaining_bid_loc;return_action_loc]) (I1:|:I2:|:I2:|:I1:|:I2) (t_ControlFlow ((t_State × t_Result (v_A) (t_FinalizeError))) ((t_Option ((t_AccountAddress × t_Amount)) × v_A × t_State))))) (prod_b (remaining_bid,return_action,state)) in + matchb remaining_bid with + | Option_Some_case (_,amount) => + letb amount := ret_both (((amount)) : ((t_AccountAddress × t_Amount))) in + letm[choice_typeMonad.result_bind_code ((t_State × t_Result (v_A) (t_FinalizeError)))] _ := ifb not (amount =.? (f_highest_bid state)) + then letm[choice_typeMonad.result_bind_code ((t_State × t_Result (v_A) (t_FinalizeError)))] hoist6 := v_Break (prod_b (state,Result_Err FinalizeError_BidMapError)) in + ControlFlow_Continue (never_to_any hoist6) + else ControlFlow_Continue (ret_both (tt : 'unit)) in + ControlFlow_Continue (solve_lift (prod_b (state,Result_Ok return_action))) + | Option_None_case => + letm[choice_typeMonad.result_bind_code ((t_State × t_Result (v_A) (t_FinalizeError)))] hoist7 := v_Break (prod_b (state,Result_Err FinalizeError_BidMapError)) in + ControlFlow_Continue (solve_lift (prod_b (state,never_to_any hoist7))) + end in + ControlFlow_Continue (prod_b (state,hax_temp_output)))) : both (L1 :|: L2 :|: fset [remaining_bid_loc;return_action_loc]) (I1 :|: I2) ((t_State × t_Result (v_A) (t_FinalizeError))). +Fail Next Obligation. + +Equations fresh_state {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (itm : both L1 I1 (t_Vec (int8) (t_Global))) (exp : both L2 I2 (t_Timestamp)) : both (L1 :|: L2) (I1 :|: I2) (t_State) := + fresh_state itm exp := + solve_lift (Build_t_State (f_auction_state := AuctionState_NotSoldYet) (f_highest_bid := impl__Amount__zero (ret_both (tt : 'unit))) (f_item := itm) (f_expiry := exp) (f_bids := impl_18__new (ret_both (tt : 'unit)))) : both (L1 :|: L2) (I1 :|: I2) (t_State). +Fail Next Obligation. + +Equations auction_init {L1 : {fset Location}} {I1 : Interface} {impl_108907986_ : _} `{ t_Sized (impl_108907986_)} `{ t_HasInitContext (impl_108907986_) ('unit)} (ctx : both L1 I1 (impl_108907986_)) : both L1 I1 (t_Result (t_State) (t_Reject)) := + auction_init ctx := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result (t_State) (t_Reject))] (parameter:t_InitParameter) := matchb f_branch out with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result (t_Infallible) (t_ParseError))) in + letm[choice_typeMonad.result_bind_code (t_Result (t_State) (t_Reject))] hoist8 := v_Break (f_from_residual residual) in + ControlFlow_Continue (solve_lift (never_to_any hoist8)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (t_InitParameter)) in + ControlFlow_Continue (solve_lift val) + end in + ControlFlow_Continue (Result_Ok (fresh_state (f_init_parameter_item parameter) (f_init_parameter_expiry parameter))))) : both L1 I1 (t_Result (t_State) (t_Reject)). +Fail Next Obligation. + +(** Concert lib part **) +From ConCert.Utils Require Import Extras. +Export Extras. +From ConCert.Utils Require Import Automation. +Export Automation. +From ConCert.Execution Require Import Serializable. +Export Serializable. +From ConCert.Execution Require Import Blockchain. +Export Blockchain. +From ConCert.Execution Require Import ContractCommon. +Export ContractCommon. +From ConCert.Execution Require Import Serializable. +Export Serializable. +Require Import ConCertLib. +Export ConCertLib. + +Definition state_auction : choice_type := + t_State. + +Definition receive_auction_bid {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {I0 : Interface} (st : both L0 I0 (state_auction)) : both _ _ (t_Result ((v_A × state_auction)) (t_ParseError)) := + auction_bid st. + +Definition receive_auction_finalize {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {I0 : Interface} (st : both L0 I0 (state_auction)) : both _ _ (t_Result ((v_A × state_auction)) (t_ParseError)) := + auction_finalize st. + +Definition init_auction (chain : Chain) (ctx : ContractCallContext) (st : state_auction) : ResultMonad.result (state_auction) (t_ParseError) := + ResultMonad.Ok st. + +Inductive Msg_auction: Type := +| msg_auction_bid : Msg_auction +| msg_auction_finalize : Msg_auction. +#[global] Program Instance state_auction_t_HasReceiveContext : t_HasReceiveContext state_auction 'unit := + {| f_get := (fun (Ctx : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance state_auction_t_Sized : t_Sized state_auction := + fun x => + x. +Fail Next Obligation. +#[global] Program Instance state_auction_t_HasActions : t_HasActions state_auction := + Admitted. +Fail Next Obligation. +Equations receive_auction (chain : Chain) (ctx : ContractCallContext) (st : state_auction) (msg : Datatypes.option Msg_auction) : ResultMonad.result (state_auction * list ActionBody) t_ParseError := + receive_auction chain ctx st msg := + match msg with + | Some msg_auction_bid => + match (is_pure (both_prog (receive_auction_bid (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | Some msg_auction_finalize => + match (is_pure (both_prog (receive_auction_finalize (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | _ => + ResultMonad.Err tt + end : ResultMonad.result (state_auction * list ActionBody) t_ParseError. +Fail Next Obligation. +#[global] Program Instance state_auction_Serializable : Serializable state_auction := + _. +Fail Next Obligation. +#[global] Program Instance Msg_auction_Serializable : Serializable Msg_auction := + Derive Serializable Msg_OVN_rect. +Fail Next Obligation. +Definition contract_auction : Contract (state_auction) (Msg_auction) (state_auction) (t_ParseError) := + build_contract init_auction receive_auction. diff --git a/auction/proofs/ssprove/extraction/Hacspec_auction_Export_auction_finalize.v b/auction/proofs/ssprove/extraction/Hacspec_auction_Export_auction_finalize.v new file mode 100644 index 0000000..4c8ece1 --- /dev/null +++ b/auction/proofs/ssprove/extraction/Hacspec_auction_Export_auction_finalize.v @@ -0,0 +1,40 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_concordium. +Export Hacspec_concordium. + +Require Import SeekFrom. +Export SeekFrom. + +Require Import ContractState. +Export ContractState. + +Require Import Logger. +Export Logger. + +Require Import trap. +Export trap. diff --git a/auction/src/auction.rs b/auction/src/auction.rs new file mode 100644 index 0000000..706e85a --- /dev/null +++ b/auction/src/auction.rs @@ -0,0 +1,423 @@ +#![no_std] +#![feature(register_tool)] +#![register_tool(hax)] + +#[hax_lib_macros::exclude] +extern crate hax_lib_macros; +#[hax_lib_macros::exclude] +use hax_lib_macros::*; + +// #[exclude] +// use creusot_contracts::{ensures, requires}; + +#[exclude] +use hacspec_concordium::*; +#[exclude] +use hacspec_concordium::{collections::BTreeMap}; + +// #[cfg(feature = "hacspec")] +// use concert_lib::*; + +/// # Implementation of an auction smart contract +/// +/// To bid, participants send GTU using the bid function. +/// The participant with the highest bid wins the auction. +/// Bids are to be placed before the auction end. After that, bids are refused. +/// Only bids that exceed the highest bid are accepted. +/// Bids are placed incrementally, i.e., an account's bid is considered +/// to be the **sum** of all bids. +/// +/// Example: if Alice first bid 1 GTU and then bid 2 GTU, her total +/// bid is 3 GTU. The bidding will only go through if 3 GTU is higher than +/// the currently highest bid. +/// +/// After the auction end, any account can finalize the auction. +/// The auction can be finalized only once. +/// When the auction is finalized, every participant except the +/// winner gets their money back. + +/// The state in which an auction can be. +#[derive(Debug, Serialize, SchemaType, Eq, PartialEq, PartialOrd)] +pub enum AuctionState { + /// The auction is either + /// - still accepting bids or + /// - not accepting bids because it's past the auction end, but nobody has + /// finalized the auction yet. + NotSoldYet, + /// The auction is over and the item has been sold to the indicated address. + Sold(AccountAddress), // winning account's address +} + +/// The state of the smart contract. +/// This is the state that will be shown when the contract is queried using +/// `concordium-client contract show`. +#[hax::contract_state(contract = "auction")] +#[derive(Debug, Serialize, SchemaType, Eq, PartialEq)] +pub struct State { + /// Has the item been sold? + auction_state: AuctionState, + /// The highest bid so far (stored explicitly so that bidders can quickly + /// see it) + highest_bid: Amount, + /// The sold item (to be displayed to the auction participants), encoded in + /// ASCII + item: Vec, + /// Expiration time of the auction at which bids will be closed (to be + /// displayed to the auction participants) + expiry: Timestamp, + /// Keeping track of which account bid how much money + // #[concordium(map_size_length = 2)] + bids: BTreeMap, +} + +/// A helper function to create a state for a new auction. +fn fresh_state(itm: Vec, exp: Timestamp) -> State { + State { + auction_state: AuctionState::NotSoldYet, + highest_bid: Amount::zero(), + item: itm, + expiry: exp, + bids: BTreeMap::new(), + } +} + +/// Type of the parameter to the `init` function. +#[derive(Serialize, SchemaType)] +struct InitParameter { + /// The item to be sold, as a sequence of ASCII codes. + init_parameter_item: Vec, + /// Time of the auction end in the RFC 3339 format (https://tools.ietf.org/html/rfc3339) + init_parameter_expiry: Timestamp, +} + +/// For errors in which the `bid` function can result +#[derive(Debug, PartialEq, Eq, Clone, Reject)] +enum BidError { + ContractSender, // raised if a contract, as opposed to account, tries to bid + BidTooLow, /* { bid: Amount, highest_bid: Amount } */ + // raised if bid is lower than highest amount + BidsOverWaitingForAuctionFinalization, // raised if bid is placed after auction expiry time + AuctionFinalized, /* raised if bid is placed after auction has been + * finalized */ +} + +/// For errors in which the `finalize` function can result +#[derive(Debug, PartialEq, Eq, Clone, Reject)] +enum FinalizeError { + BidMapError, /* raised if there is a mistake in the bid map that keeps track of all + * accounts' bids */ + AuctionStillActive, // raised if there is an attempt to finalize the auction before its expiry + AuctionFinalized, // raised if there is an attempt to finalize an already finalized auction +} + +/// Init function that creates a new auction +#[hax::init(contract = "auction", parameter = "InitParameter")] +fn auction_init(ctx: &impl HasInitContext) -> InitResult { + let parameter: InitParameter = ctx.parameter_cursor().get()?; + Ok(fresh_state(parameter.init_parameter_item, parameter.init_parameter_expiry)) +} + +/// Receive function in which accounts can bid before the auction end time +#[hax::receive(contract = "auction", name = "bid", payable)] +fn auction_bid( + ctx: &impl HasReceiveContext, + amount: Amount, + state: State, +) -> Result<(A, State), BidError> { + // ensure!(state.auction_state == AuctionState::NotSoldYet, BidError::AuctionFinalized); + + let slot_time = ctx.metadata().slot_time(); + // ensure!(slot_time <= state.expiry, BidError::BidsOverWaitingForAuctionFinalization); + + let sender_address = match ctx.sender() { + Address::Contract(_) => bail!(BidError::ContractSender), + Address::Account(account_address) => account_address, + }; + // state.bids.entry(sender_address).or_insert_with(Amount::zero); + let bid_to_update : u64 = + if state.bids.contains_key(&sender_address) { + state.bids[&sender_address].micro_ccd + } else { + 0 + }; + + bid_to_update += amount.micro_ccd; + // Ensure that the new bid exceeds the highest bid so far + ensure!( + bid_to_update > state.highest_bid.micro_ccd, + BidError::BidTooLow /* { bid: amount, highest_bid: state.highest_bid } */ + ); + state.highest_bid = Amount {micro_ccd: bid_to_update }; + + Ok((A::accept(), state)) +} + +/// Receive function used to finalize the auction, returning all bids to their +/// senders, except for the winning bid +#[hax::receive(contract = "auction", name = "finalize")] +fn auction_finalize( + ctx: &impl HasReceiveContext, + state: &mut State, +) -> Result { + ensure!(state.auction_state == AuctionState::NotSoldYet, FinalizeError::AuctionFinalized); + + let slot_time = ctx.metadata().slot_time(); + ensure!(slot_time > state.expiry, FinalizeError::AuctionStillActive); + + let owner = ctx.owner(); + + let balance = ctx.self_balance(); + if balance == Amount::zero() { + Ok(A::accept()) + } else { + let mut return_action = A::simple_transfer(&owner, state.highest_bid); + let mut remaining_bid = None; + // Return bids that are smaller than highest + for (addr, &amnt) in state.bids.iter() { + if amnt < state.highest_bid { + return_action = return_action.and_then(A::simple_transfer(addr, amnt)); + } else { + ensure!(remaining_bid.is_none(), FinalizeError::BidMapError); + state.auction_state = AuctionState::Sold(*addr); + remaining_bid = Some((addr, amnt)); + } + } + // Ensure that the only bidder left in the map is the one with the highest bid + match remaining_bid { + Some((_, amount)) => { + ensure!(amount == state.highest_bid, FinalizeError::BidMapError); + Ok(return_action) + } + None => bail!(FinalizeError::BidMapError), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use std::sync::atomic::{AtomicU8, Ordering}; + use test_infrastructure::*; + + // A counter for generating new account addresses + static ADDRESS_COUNTER: AtomicU8 = AtomicU8::new(0); + const AUCTION_END: u64 = 1; + const ITEM: &str = "Starry night by Van Gogh"; + + fn dummy_fresh_state() -> State { dummy_active_state(Amount::zero(), BTreeMap::new()) } + + fn dummy_active_state(highest: Amount, bids: BTreeMap) -> State { + State { + auction_state: AuctionState::NotSoldYet, + highest_bid: highest, + item: ITEM.as_bytes().to_vec(), + expiry: Timestamp::from_timestamp_millis(AUCTION_END), + bids, + } + } + + fn expect_error(expr: Result, err: E, msg: &str) + where + E: Eq + Debug, + T: Debug, { + let actual = expr.expect_err(msg); + assert_eq!(actual, err); + } + + fn item_expiry_parameter() -> InitParameter { + InitParameter { + item: ITEM.as_bytes().to_vec(), + expiry: Timestamp::from_timestamp_millis(AUCTION_END), + } + } + + fn create_parameter_bytes(parameter: &InitParameter) -> Vec { to_bytes(parameter) } + + fn parametrized_init_ctx<'a>(parameter_bytes: &'a Vec) -> InitContextTest<'a> { + let mut ctx = InitContextTest::empty(); + ctx.set_parameter(parameter_bytes); + ctx + } + + fn new_account() -> AccountAddress { + let account = AccountAddress([ADDRESS_COUNTER.load(Ordering::SeqCst); 32]); + ADDRESS_COUNTER.fetch_add(1, Ordering::SeqCst); + account + } + + fn new_account_ctx<'a>() -> (AccountAddress, ReceiveContextTest<'a>) { + let account = new_account(); + let ctx = new_ctx(account, account, AUCTION_END); + (account, ctx) + } + + fn new_ctx<'a>( + owner: AccountAddress, + sender: AccountAddress, + slot_time: u64, + ) -> ReceiveContextTest<'a> { + let mut ctx = ReceiveContextTest::empty(); + ctx.set_sender(Address::Account(sender)); + ctx.set_owner(owner); + ctx.set_metadata_slot_time(Timestamp::from_timestamp_millis(slot_time)); + ctx + } + + #[test] + /// Test that the smart-contract initialization sets the state correctly + /// (no bids, active state, indicated auction-end time and item name). + fn test_init() { + let parameter_bytes = create_parameter_bytes(&item_expiry_parameter()); + let ctx = parametrized_init_ctx(¶meter_bytes); + + let state_result = auction_init(&ctx); + let state = state_result.expect("Contract initialization results in error"); + assert_eq!(state, dummy_fresh_state(), "Auction state should be new after initialization"); + } + + #[test] + /// Test a sequence of bids and finalizations: + /// 0. Auction is initialized. + /// 1. Alice successfully bids 0.1 GTU. + /// 2. Alice successfully bids another 0.1 GTU, highest bid becomes 0.2 GTU + /// (the sum of her two bids). 3. Bob successfully bids 0.3 GTU, highest + /// bid becomes 0.3 GTU. 4. Someone tries to finalize the auction before + /// its end time. Attempt fails. 5. Dave successfully finalizes the + /// auction after its end time. Alice gets her money back, while + /// Carol (the owner of the contract) collects the highest bid amount. + /// 6. Attempts to subsequently bid or finalize fail. + fn test_auction_bid_and_finalize() { + let parameter_bytes = create_parameter_bytes(&item_expiry_parameter()); + let ctx0 = parametrized_init_ctx(¶meter_bytes); + + let amount = Amount::from_micro_gtu(100); + let winning_amount = Amount::from_micro_gtu(300); + let big_amount = Amount::from_micro_gtu(500); + + let mut bid_map = BTreeMap::new(); + + // initializing auction + let mut state = auction_init(&ctx0).expect("Initialization should pass"); + + // 1st bid: account1 bids amount1 + let (alice, alice_ctx) = new_account_ctx(); + verify_bid(&mut state, alice, &alice_ctx, amount, &mut bid_map, amount); + + // 2nd bid: account1 bids `amount` again + // should work even though it's the same amount because account1 simply + // increases their bid + verify_bid(&mut state, alice, &alice_ctx, amount, &mut bid_map, amount + amount); + + // 3rd bid: second account + let (bob, bob_ctx) = new_account_ctx(); + verify_bid(&mut state, bob, &bob_ctx, winning_amount, &mut bid_map, winning_amount); + + // trying to finalize auction that is still active + // (specifically, the bid is submitted at the last moment, at the AUCTION_END + // time) + let mut ctx4 = ReceiveContextTest::empty(); + ctx4.set_metadata_slot_time(Timestamp::from_timestamp_millis(AUCTION_END)); + let finres: Result = auction_finalize(&ctx4, &mut state); + expect_error( + finres, + FinalizeError::AuctionStillActive, + "Finalizing auction should fail when it's before auction-end time", + ); + + // finalizing auction + let carol = new_account(); + let dave = new_account(); + let mut ctx5 = new_ctx(carol, dave, AUCTION_END + 1); + ctx5.set_self_balance(winning_amount); + let finres2: Result = auction_finalize(&ctx5, &mut state); + let actions = finres2.expect("Finalizing auction should work"); + assert_eq!( + actions, + ActionsTree::simple_transfer(&carol, winning_amount) + .and_then(ActionsTree::simple_transfer(&alice, amount + amount)) + ); + assert_eq!(state, State { + auction_state: AuctionState::Sold(bob), + highest_bid: winning_amount, + item: ITEM.as_bytes().to_vec(), + expiry: Timestamp::from_timestamp_millis(AUCTION_END), + bids: bid_map, + }); + + // attempting to finalize auction again should fail + let finres3: Result = auction_finalize(&ctx5, &mut state); + expect_error( + finres3, + FinalizeError::AuctionFinalized, + "Finalizing auction a second time should fail", + ); + + // attempting to bid again should fail + let res4: Result = auction_bid(&bob_ctx, big_amount, &mut state); + expect_error( + res4, + BidError::AuctionFinalized, + "Bidding should fail because the auction is finalized", + ); + } + + fn verify_bid( + mut state: &mut State, + account: AccountAddress, + ctx: &ContextTest, + amount: Amount, + bid_map: &mut BTreeMap, + highest_bid: Amount, + ) { + let res: Result = auction_bid(ctx, amount, &mut state); + res.expect("Bidding should pass"); + bid_map.insert(account, highest_bid); + assert_eq!(*state, dummy_active_state(highest_bid, bid_map.clone())); + } + + #[test] + /// Bids for amounts lower or equal to the highest bid should be rejected. + fn test_auction_bid_repeated_bid() { + let (account1, ctx1) = new_account_ctx(); + let ctx2 = new_account_ctx().1; + + let parameter_bytes = create_parameter_bytes(&item_expiry_parameter()); + let ctx0 = parametrized_init_ctx(¶meter_bytes); + + let amount = Amount::from_micro_gtu(100); + + let mut bid_map = BTreeMap::new(); + + // initializing auction + let mut state = auction_init(&ctx0).expect("Init results in error"); + + // 1st bid: account1 bids amount1 + verify_bid(&mut state, account1, &ctx1, amount, &mut bid_map, amount); + + // 2nd bid: account2 bids amount1 + // should fail because amount is equal to highest bid + let res2: Result = auction_bid(&ctx2, amount, &mut state); + expect_error( + res2, + BidError::BidTooLow, /* { bid: amount, highest_bid: amount } */ + "Bidding 2 should fail because bid amount must be higher than highest bid", + ); + } + + #[test] + /// Bids for 0 GTU should be rejected. + fn test_auction_bid_zero() { + let ctx1 = new_account_ctx().1; + let parameter_bytes = create_parameter_bytes(&item_expiry_parameter()); + let ctx = parametrized_init_ctx(¶meter_bytes); + + let mut state = auction_init(&ctx).expect("Init results in error"); + + let res: Result = auction_bid(&ctx1, Amount::zero(), &mut state); + expect_error( + res, + BidError::BidTooLow, /* { bid: Amount::zero(), highest_bid: Amount::zero()} */ + "Bidding zero should fail", + ); + } +} diff --git a/basic/proofs/coq/extraction/Example.v b/basic/proofs/coq/extraction/Example.v new file mode 100644 index 0000000..e4fbf27 --- /dev/null +++ b/basic/proofs/coq/extraction/Example.v @@ -0,0 +1,14 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +(*Not implemented yet? todo(item)*) + +Definition test : int8 := + let acc := ((@repr WORDSIZE8 0)) : int8 in + let acc := (f_fold (f_into_iter (Build_Range (@repr WORDSIZE8 1)(@repr WORDSIZE8 10))) acc (fun acc i => + acc.+i)) : int8 in + acc.+(@repr WORDSIZE8 1). diff --git a/chacha20/proofs/coq/extraction/Hacspec_chacha20.v b/chacha20/proofs/coq/extraction/Hacspec_chacha20.v new file mode 100644 index 0000000..3567662 --- /dev/null +++ b/chacha20/proofs/coq/extraction/Hacspec_chacha20.v @@ -0,0 +1,124 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +Require Import Hacspec_lib. + +(*Not implemented yet? todo(item)*) + +Notation Constants_t := (nseq int32 4). +Definition Constants : Constants_t -> Constants_t := + id. + +Notation State_t := (nseq int32 16). +Definition State : State_t -> State_t := + id. + +Notation Block_t := (nseq int8 64). +Definition Block : Block_t -> Block_t := + id. + +Notation ChaChaIV_t := (nseq int8 12). +Definition ChaChaIV : ChaChaIV_t -> ChaChaIV_t := + id. + +Notation ChaChaKey_t := (nseq int8 32). +Definition ChaChaKey : ChaChaKey_t -> ChaChaKey_t := + id. + +Definition chacha20_line (a : uint_size) (b : uint_size) (d : uint_size) (s : uint_size) (m : t_State_t) : t_State_t := + let state := (m) : t_State_t in + let state := (update_at_usize state a ((state.[a]).+(state.[b]))) : t_State_t in + let state := (update_at_usize state d ((state.[d]).^(state.[a]))) : t_State_t in + let state := (update_at_usize state d (impl__U32__rotate_left (state.[d]) s)) : t_State_t in + state. + +Definition chacha20_quarter_round (a : uint_size) (b : uint_size) (c : uint_size) (d : uint_size) (state : t_State_t) : t_State_t := + let state := (chacha20_line a b d (@repr WORDSIZE32 16) state) : t_State_t in + let state := (chacha20_line c d b (@repr WORDSIZE32 12) state) : t_State_t in + let state := (chacha20_line a b d (@repr WORDSIZE32 8) state) : t_State_t in + chacha20_line c d b (@repr WORDSIZE32 7) state. + +Definition chacha20_double_round (state : t_State_t) : t_State_t := + let state := (chacha20_quarter_round (@repr WORDSIZE32 0) (@repr WORDSIZE32 4) (@repr WORDSIZE32 8) (@repr WORDSIZE32 12) state) : t_State_t in + let state := (chacha20_quarter_round (@repr WORDSIZE32 1) (@repr WORDSIZE32 5) (@repr WORDSIZE32 9) (@repr WORDSIZE32 13) state) : t_State_t in + let state := (chacha20_quarter_round (@repr WORDSIZE32 2) (@repr WORDSIZE32 6) (@repr WORDSIZE32 10) (@repr WORDSIZE32 14) state) : t_State_t in + let state := (chacha20_quarter_round (@repr WORDSIZE32 3) (@repr WORDSIZE32 7) (@repr WORDSIZE32 11) (@repr WORDSIZE32 15) state) : t_State_t in + let state := (chacha20_quarter_round (@repr WORDSIZE32 0) (@repr WORDSIZE32 5) (@repr WORDSIZE32 10) (@repr WORDSIZE32 15) state) : t_State_t in + let state := (chacha20_quarter_round (@repr WORDSIZE32 1) (@repr WORDSIZE32 6) (@repr WORDSIZE32 11) (@repr WORDSIZE32 12) state) : t_State_t in + let state := (chacha20_quarter_round (@repr WORDSIZE32 2) (@repr WORDSIZE32 7) (@repr WORDSIZE32 8) (@repr WORDSIZE32 13) state) : t_State_t in + chacha20_quarter_round (@repr WORDSIZE32 3) (@repr WORDSIZE32 4) (@repr WORDSIZE32 9) (@repr WORDSIZE32 14) state. + +Definition chacha20_rounds (state : t_State_t) : t_State_t := + let st := (state) : t_State_t in + let st := (f_fold (f_into_iter (Build_Range (@repr WORDSIZE32 0)(@repr WORDSIZE32 10))) st (fun st _i => + chacha20_double_round st)) : t_State_t in + st. + +Definition chacha20_core (ctr : t_U32_t) (st0 : t_State_t) : t_State_t := + let state := (st0) : t_State_t in + let state := (update_at state (@repr WORDSIZE32 12) ((state.[(@repr WORDSIZE32 12)]).+ctr)) : t_State_t in + let k := (chacha20_rounds state) : t_State_t in + k.+state. + +Definition chacha20_constants_init : t_Constants_t := + let constants := (impl__Constants__new) : t_Constants_t in + let constants := (update_at constants (@repr WORDSIZE32 0) (U32 (@repr WORDSIZE32 1634760805))) : t_Constants_t in + let constants := (update_at constants (@repr WORDSIZE32 1) (U32 (@repr WORDSIZE32 857760878))) : t_Constants_t in + let constants := (update_at constants (@repr WORDSIZE32 2) (U32 (@repr WORDSIZE32 2036477234))) : t_Constants_t in + let constants := (update_at constants (@repr WORDSIZE32 3) (U32 (@repr WORDSIZE32 1797285236))) : t_Constants_t in + constants. + +Definition chacha20_init (key : t_ChaChaKey_t) (iv : t_ChaChaIV_t) (ctr : t_U32_t) : t_State_t := + let st := (impl__State__new) : t_State_t in + let st := (f_update st (@repr WORDSIZE32 0) chacha20_constants_init) : t_State_t in + let st := (f_update st (@repr WORDSIZE32 4) (impl__ChaChaKey__to_le_U32s key)) : t_State_t in + let st := (update_at st (@repr WORDSIZE32 12) ctr) : t_State_t in + let st := (f_update st (@repr WORDSIZE32 13) (impl__ChaChaIV__to_le_U32s iv)) : t_State_t in + st. + +Definition chacha20_encrypt_block (st0 : t_State_t) (ctr : t_U32_t) (plain : t_Block_t) : t_Block_t := + let st := (chacha20_core ctr st0) : t_State_t in + let pl := (impl__State__from_seq (impl__Block__to_le_U32s plain)) : t_State_t in + let st := (pl.^st) : t_State_t in + impl__Block__from_seq (impl__State__to_le_bytes st). + +Definition chacha20_encrypt_last (st0 : t_State_t) (ctr : t_U32_t) (plain : t_Seq_t t_U8_t) : t_Seq_t t_U8_t := + let b := (impl__Block__new) : t_Block_t in + let b := (f_update b (@repr WORDSIZE32 0) plain) : t_Block_t in + let b := (chacha20_encrypt_block st0 ctr b) : t_Block_t in + impl__Block__slice b (@repr WORDSIZE32 0) (impl_41__len plain). + +Definition chacha20_key_block (state : t_State_t) : t_Block_t := + let state := (chacha20_core (U32 (@repr WORDSIZE32 0)) state) : t_State_t in + impl__Block__from_seq (impl__State__to_le_bytes state). + +Definition chacha20_key_block0 (key : t_ChaChaKey_t) (iv : t_ChaChaIV_t) : t_Block_t := + let state := (chacha20_init key iv (U32 (@repr WORDSIZE32 0))) : t_State_t in + chacha20_key_block state. + +Definition chacha20_update (st0 : t_State_t) (m : t_Seq_t t_U8_t) : t_Seq_t t_U8_t := + let blocks_out := (impl_41__new (impl_41__len m)) : t_Seq_t t_U8_t in + let n_blocks := (impl_41__num_exact_chunks m (@repr WORDSIZE32 64)) : uint_size in + let blocks_out := (f_fold (f_into_iter (Build_Range (@repr WORDSIZE32 0)n_blocks)) blocks_out (fun blocks_out i => + let msg_block := (impl_41__get_exact_chunk m (@repr WORDSIZE32 64) i) : t_Seq_t t_U8_t in + let b := (chacha20_encrypt_block st0 (U32 (cast i)) (impl__Block__from_seq msg_block)) : t_Block_t in + let blocks_out := (impl_41__set_exact_chunk blocks_out (@repr WORDSIZE32 64) i b) : t_Seq_t t_U8_t in + blocks_out)) : t_Seq_t t_U8_t in + let last_block := (impl_41__get_remainder_chunk m (@repr WORDSIZE32 64)) : t_Seq_t t_U8_t in + let blocks_out := (if + (impl_41__len last_block)<>(@repr WORDSIZE32 0) + then + let b := (chacha20_encrypt_last st0 (U32 (cast n_blocks)) last_block) : t_Seq_t t_U8_t in + let blocks_out := (impl_41__set_chunk blocks_out (@repr WORDSIZE32 64) n_blocks b) : t_Seq_t t_U8_t in + blocks_out + else + blocks_out) : t_Seq_t t_U8_t in + blocks_out. + +Definition chacha20 (key : t_ChaChaKey_t) (iv : t_ChaChaIV_t) (ctr : int32) (m : t_Seq_t t_U8_t) : t_Seq_t t_U8_t := + let state := (chacha20_init key iv (U32 ctr)) : t_State_t in + chacha20_update state m. diff --git a/concordium/src/concordium.rs b/concordium/src/concordium.rs index 731562e..d7df7a7 100644 --- a/concordium/src/concordium.rs +++ b/concordium/src/concordium.rs @@ -51,6 +51,7 @@ pub use core::{convert, hash, marker, mem, num, result::*}; pub use alloc::collections; pub mod constants; +mod concordium_impls; mod concordium_prims; mod concordium_types; mod concordium_traits; @@ -58,9 +59,11 @@ mod concordium_traits; // pub mod test_infrastructure; use concordium_prims::*; // TODO: Does not re-export anything, nothing is public enough (removed pub) +pub use concordium_impls::*; pub use concordium_types::*; pub use concordium_traits::*; + #[cfg(not(feature = "hacspec"))] extern crate concordium_contracts_common; #[cfg(not(feature = "hacspec"))] diff --git a/concordium/src/concordium_impls.rs b/concordium/src/concordium_impls.rs index e69de29..25fed0d 100644 --- a/concordium/src/concordium_impls.rs +++ b/concordium/src/concordium_impls.rs @@ -0,0 +1,667 @@ +use crate::{convert, mem, num, // prims, + concordium_prims::*, concordium_traits::*, concordium_types::*}; +use concordium_contracts_common::*; + +impl convert::From<()> for Reject { + #[inline(always)] + fn from(_: ()) -> Self { + Reject { + error_code: unsafe { num::NonZeroI32::new_unchecked(i32::MIN + 1) }, + } + } +} + +impl convert::From for Reject { + #[inline(always)] + fn from(_: ParseError) -> Self { + Reject { + error_code: unsafe { num::NonZeroI32::new_unchecked(i32::MIN + 2) }, + } + } +} + +// /// Full is mapped to i32::MIN+3, Malformed is mapped to i32::MIN+4. +// impl From for Reject { +// #[inline(always)] +// fn from(le: LogError) -> Self { +// let error_code = match le { +// LogError::Full => unsafe { crate::num::NonZeroI32::new_unchecked(i32::MIN + 3) }, +// LogError::Malformed => unsafe { crate::num::NonZeroI32::new_unchecked(i32::MIN + 4) }, +// }; +// Self { +// error_code, +// } +// } +// } + +// /// MissingInitPrefix is mapped to i32::MIN + 5, and TooLong is mapped to +// /// i32::MIN + 6. +// impl From for Reject { +// fn from(nre: NewContractNameError) -> Self { +// let error_code = match nre { +// NewContractNameError::MissingInitPrefix => unsafe { +// crate::num::NonZeroI32::new_unchecked(i32::MIN + 5) +// }, +// NewContractNameError::TooLong => unsafe { +// crate::num::NonZeroI32::new_unchecked(i32::MIN + 6) +// }, +// }; +// Self { +// error_code, +// } +// } +// } + +// /// MissingDotSeparator is mapped to i32::MIN + 7, and TooLong is mapped to +// /// i32::MIN + 8. +// impl From for Reject { +// fn from(nre: NewReceiveNameError) -> Self { +// let error_code = match nre { +// NewReceiveNameError::MissingDotSeparator => unsafe { +// crate::num::NonZeroI32::new_unchecked(i32::MIN + 7) +// }, +// NewReceiveNameError::TooLong => unsafe { +// crate::num::NonZeroI32::new_unchecked(i32::MIN + 8) +// }, +// }; +// Self { +// error_code, +// } +// } +// } + +// /// # Contract state trait implementations. +// impl Seek for ContractState { +// type Err = (); + +// fn seek(&mut self, pos: SeekFrom) -> Result { +// use core::convert::TryFrom; +// use SeekFrom::*; +// match pos { +// Start(offset) => match u32::try_from(offset) { +// Ok(offset_u32) => { +// self.current_position = offset_u32; +// Ok(offset) +// } +// _ => Err(()), +// }, +// End(delta) => { +// let end = self.size(); +// if delta >= 0 { +// match u32::try_from(delta) +// .ok() +// .and_then(|x| self.current_position.checked_add(x)) +// { +// Some(offset_u32) => { +// self.current_position = offset_u32; +// Ok(u64::from(offset_u32)) +// } +// _ => Err(()), +// } +// } else { +// match delta.checked_abs().and_then(|x| u32::try_from(x).ok()) { +// Some(before) if before <= end => { +// let new_pos = end - before; +// self.current_position = new_pos; +// Ok(u64::from(new_pos)) +// } +// _ => Err(()), +// } +// } +// } +// Current(delta) => { +// let new_offset = if delta >= 0 { +// u32::try_from(delta).ok().and_then(|x| self.current_position.checked_add(x)) +// } else { +// delta +// .checked_abs() +// .and_then(|x| u32::try_from(x).ok()) +// .and_then(|x| self.current_position.checked_sub(x)) +// }; +// match new_offset { +// Some(offset) => { +// self.current_position = offset; +// Ok(u64::from(offset)) +// } +// _ => Err(()), +// } +// } +// } +// } +// } + +// impl Read for ContractState { +// fn read(&mut self, buf: &mut [u8]) -> ParseResult { +// use core::convert::TryInto; +// let len: u32 = { +// match buf.len().try_into() { +// Ok(v) => v, +// _ => return Err(ParseError::default()), +// } +// }; +// let num_read = unsafe { load_state(buf.as_mut_ptr(), len, self.current_position) }; +// self.current_position += num_read; +// Ok(num_read as usize) +// } + +// /// Read a `u32` in little-endian format. This is optimized to not +// /// initialize a dummy value before calling an external function. +// fn read_u64(&mut self) -> ParseResult { +// let mut bytes: MaybeUninit<[u8; 8]> = MaybeUninit::uninit(); +// let num_read = +// unsafe { load_state(bytes.as_mut_ptr() as *mut u8, 8, self.current_position) }; +// self.current_position += num_read; +// if num_read == 8 { +// unsafe { Ok(u64::from_le_bytes(bytes.assume_init())) } +// } else { +// Err(ParseError::default()) +// } +// } + +// /// Read a `u32` in little-endian format. This is optimized to not +// /// initialize a dummy value before calling an external function. +// fn read_u32(&mut self) -> ParseResult { +// let mut bytes: MaybeUninit<[u8; 4]> = MaybeUninit::uninit(); +// let num_read = +// unsafe { load_state(bytes.as_mut_ptr() as *mut u8, 4, self.current_position) }; +// self.current_position += num_read; +// if num_read == 4 { +// unsafe { Ok(u32::from_le_bytes(bytes.assume_init())) } +// } else { +// Err(ParseError::default()) +// } +// } + +// /// Read a `u8` in little-endian format. This is optimized to not +// /// initialize a dummy value before calling an external function. +// fn read_u8(&mut self) -> ParseResult { +// let mut bytes: MaybeUninit<[u8; 1]> = MaybeUninit::uninit(); +// let num_read = +// unsafe { load_state(bytes.as_mut_ptr() as *mut u8, 1, self.current_position) }; +// self.current_position += num_read; +// if num_read == 1 { +// unsafe { Ok(bytes.assume_init()[0]) } +// } else { +// Err(ParseError::default()) +// } +// } +// } + +// impl Write for ContractState { +// type Err = (); + +// fn write(&mut self, buf: &[u8]) -> Result { +// use core::convert::TryInto; +// let len: u32 = { +// match buf.len().try_into() { +// Ok(v) => v, +// _ => return Err(()), +// } +// }; +// if self.current_position.checked_add(len).is_none() { +// return Err(()); +// } +// let num_bytes = unsafe { write_state(buf.as_ptr(), len, self.current_position) }; +// self.current_position += num_bytes; // safe because of check above that len + pos is small enough +// Ok(num_bytes as usize) +// } +// } + +// impl HasContractState<()> for ContractState { +// type ContractStateData = (); + +// #[inline(always)] +// fn open(_: Self::ContractStateData) -> Self { +// ContractState { +// current_position: 0, +// } +// } + +// fn reserve(&mut self, len: u32) -> bool { +// let cur_size = unsafe { state_size() }; +// if cur_size < len { +// let res = unsafe { resize_state(len) }; +// res == 1 +// } else { +// true +// } +// } + +// #[inline(always)] +// fn size(&self) -> u32 { unsafe { state_size() } } + +// fn truncate(&mut self, new_size: u32) { +// let cur_size = self.size(); +// if cur_size > new_size { +// unsafe { resize_state(new_size) }; +// } +// if new_size < self.current_position { +// self.current_position = new_size +// } +// } +// } + +// /// # Trait implementations for Parameter +// impl Read for Parameter { +// fn read(&mut self, buf: &mut [u8]) -> ParseResult { +// use core::convert::TryInto; +// let len: u32 = { +// match buf.len().try_into() { +// Ok(v) => v, +// _ => return Err(ParseError::default()), +// } +// }; +// let num_read = +// unsafe { get_parameter_section(buf.as_mut_ptr(), len, self.current_position) }; +// self.current_position += num_read; +// Ok(num_read as usize) +// } +// } + +// impl HasParameter for Parameter { +// #[inline(always)] +// fn size(&self) -> u32 { unsafe { get_parameter_size() } } +// } + +// /// # Trait implementations for the chain metadata. +// impl HasChainMetadata for ChainMetaExtern { +// #[inline(always)] +// fn slot_time(&self) -> SlotTime { Timestamp::from_timestamp_millis(unsafe { get_slot_time() }) } +// } + +// impl HasPolicy for Policy { +// fn identity_provider(&self) -> IdentityProvider { self.identity_provider } + +// fn created_at(&self) -> Timestamp { self.created_at } + +// fn valid_to(&self) -> Timestamp { self.valid_to } + +// fn next_item(&mut self, buf: &mut [u8; 31]) -> Option<(AttributeTag, u8)> { +// if self.items.remaining_items == 0 { +// return None; +// } + +// let (tag_value_len, num_read) = unsafe { +// let mut tag_value_len = MaybeUninit::<[u8; 2]>::uninit(); +// // Should succeed, otherwise host violated precondition. +// let num_read = get_policy_section( +// tag_value_len.as_mut_ptr() as *mut u8, +// 2, +// self.items.current_position, +// ); +// (tag_value_len.assume_init(), num_read) +// }; +// self.items.current_position += num_read; +// if tag_value_len[1] > 31 { +// // Should not happen because all attributes fit into 31 bytes. +// return None; +// } +// let num_read = unsafe { +// get_policy_section( +// buf.as_mut_ptr(), +// u32::from(tag_value_len[1]), +// self.items.current_position, +// ) +// }; +// self.items.current_position += num_read; +// self.items.remaining_items -= 1; +// Some((AttributeTag(tag_value_len[0]), tag_value_len[1])) +// } +// } + +// /// An iterator over policies using host functions to supply the data. +// /// The main interface to using this type is via the methods of the [Iterator](https://doc.rust-lang.org/std/iter/trait.Iterator.html) +// /// and [ExactSizeIterator](https://doc.rust-lang.org/std/iter/trait.ExactSizeIterator.html) traits. +// pub struct PoliciesIterator { +// /// Position in the policies binary serialization. +// pos: u32, +// /// Number of remaining items in the stream. +// remaining_items: u16, +// } + +// impl Iterator for PoliciesIterator { +// type Item = Policy; + +// fn next(&mut self) -> Option { +// if self.remaining_items == 0 { +// return None; +// } +// // 2 for total size of this section, 4 for identity_provider, +// // 8 bytes for created_at, 8 for valid_to, and 2 for +// // the length +// let mut buf: MaybeUninit<[u8; 2 + 4 + 8 + 8 + 2]> = MaybeUninit::uninit(); +// let buf = unsafe { +// get_policy_section(buf.as_mut_ptr() as *mut u8, 2 + 4 + 8 + 8 + 2, self.pos); +// buf.assume_init() +// }; +// use convert::TryInto; +// let skip_part: [u8; 2] = buf[0..2].try_into().unwrap_abort(); +// let ip_part: [u8; 4] = buf[2..2 + 4].try_into().unwrap_abort(); +// let created_at_part: [u8; 8] = buf[2 + 4..2 + 4 + 8].try_into().unwrap_abort(); +// let valid_to_part: [u8; 8] = buf[2 + 4 + 8..2 + 4 + 8 + 8].try_into().unwrap_abort(); +// let len_part: [u8; 2] = buf[2 + 4 + 8 + 8..2 + 4 + 8 + 8 + 2].try_into().unwrap_abort(); +// let identity_provider = IdentityProvider::from_le_bytes(ip_part); +// let created_at = Timestamp::from_timestamp_millis(u64::from_le_bytes(created_at_part)); +// let valid_to = Timestamp::from_timestamp_millis(u64::from_le_bytes(valid_to_part)); +// let remaining_items = u16::from_le_bytes(len_part); +// let attributes_start = self.pos + 2 + 4 + 8 + 8 + 2; +// self.pos += u32::from(u16::from_le_bytes(skip_part)) + 2; +// self.remaining_items -= 1; +// Some(Policy { +// identity_provider, +// created_at, +// valid_to, +// items: AttributesCursor { +// current_position: attributes_start, +// remaining_items, +// }, +// }) +// } + +// fn size_hint(&self) -> (usize, Option) { +// let rem = self.remaining_items as usize; +// (rem, Some(rem)) +// } +// } + +// impl ExactSizeIterator for PoliciesIterator { +// #[inline(always)] +// fn len(&self) -> usize { self.remaining_items as usize } +// } + +// impl HasCommonData for ExternContext { +// type MetadataType = ChainMetaExtern; +// type ParamType = Parameter; +// type PolicyIteratorType = PoliciesIterator; +// type PolicyType = Policy; + +// #[inline(always)] +// fn metadata(&self) -> &Self::MetadataType { &ChainMetaExtern {} } + +// fn policies(&self) -> PoliciesIterator { +// let mut buf: MaybeUninit<[u8; 2]> = MaybeUninit::uninit(); +// let buf = unsafe { +// get_policy_section(buf.as_mut_ptr() as *mut u8, 2, 0); +// buf.assume_init() +// }; +// PoliciesIterator { +// pos: 2, // 2 because we already read 2 bytes. +// remaining_items: u16::from_le_bytes(buf), +// } +// } + +// #[inline(always)] +// fn parameter_cursor(&self) -> Self::ParamType { +// Parameter { +// current_position: 0, +// } +// } +// } + +// /// # Trait implementations for the init context +// impl HasInitContext for ExternContext { +// type InitData = (); + +// /// Create a new init context by using an external call. +// fn open(_: Self::InitData) -> Self { ExternContext::default() } + +// #[inline(always)] +// fn init_origin(&self) -> AccountAddress { +// let mut bytes: MaybeUninit<[u8; ACCOUNT_ADDRESS_SIZE]> = MaybeUninit::uninit(); +// let ptr = bytes.as_mut_ptr(); +// let address = unsafe { +// get_init_origin(ptr as *mut u8); +// bytes.assume_init() +// }; +// AccountAddress(address) +// } +// } + +// /// # Trait implementations for the receive context +// impl HasReceiveContext for ExternContext { +// type ReceiveData = (); + +// /// Create a new receive context +// fn open(_: Self::ReceiveData) -> Self { ExternContext::default() } + +// #[inline(always)] +// fn invoker(&self) -> AccountAddress { +// let mut bytes: MaybeUninit<[u8; ACCOUNT_ADDRESS_SIZE]> = MaybeUninit::uninit(); +// let ptr = bytes.as_mut_ptr(); +// let address = unsafe { +// get_receive_invoker(ptr as *mut u8); +// bytes.assume_init() +// }; +// AccountAddress(address) +// } + +// #[inline(always)] +// fn self_address(&self) -> ContractAddress { +// let mut bytes: MaybeUninit<[u8; 16]> = MaybeUninit::uninit(); +// let ptr = bytes.as_mut_ptr(); +// let address = unsafe { +// get_receive_self_address(ptr as *mut u8); +// bytes.assume_init() +// }; +// match from_bytes(&address) { +// Ok(v) => v, +// Err(_) => crate::trap(), +// } +// } + +// #[inline(always)] +// fn self_balance(&self) -> Amount { +// Amount::from_micro_gtu(unsafe { get_receive_self_balance() }) +// } + +// #[inline(always)] +// fn sender(&self) -> Address { +// let mut bytes: MaybeUninit<[u8; 33]> = MaybeUninit::uninit(); +// let ptr = bytes.as_mut_ptr() as *mut u8; +// unsafe { +// get_receive_sender(ptr); +// let tag = *ptr; +// match tag { +// 0u8 => { +// match from_bytes(core::slice::from_raw_parts(ptr.add(1), ACCOUNT_ADDRESS_SIZE)) +// { +// Ok(v) => Address::Account(v), +// Err(_) => crate::trap(), +// } +// } +// 1u8 => match from_bytes(core::slice::from_raw_parts(ptr.add(1), 16)) { +// Ok(v) => Address::Contract(v), +// Err(_) => crate::trap(), +// }, +// _ => crate::trap(), // unreachable!("Host violated precondition."), +// } +// } +// } + +// #[inline(always)] +// fn owner(&self) -> AccountAddress { +// let mut bytes: MaybeUninit<[u8; ACCOUNT_ADDRESS_SIZE]> = MaybeUninit::uninit(); +// let ptr = bytes.as_mut_ptr(); +// let address = unsafe { +// get_receive_owner(ptr as *mut u8); +// bytes.assume_init() +// }; +// AccountAddress(address) +// } +// } + +// /// #Implementations of the logger. + +// impl HasLogger for Logger { +// #[inline(always)] +// fn init() -> Self { +// Self { +// _private: (), +// } +// } + +// fn log_raw(&mut self, event: &[u8]) -> Result<(), LogError> { +// let res = unsafe { log_event(event.as_ptr(), event.len() as u32) }; +// match res { +// 1 => Ok(()), +// 0 => Err(LogError::Full), +// _ => Err(LogError::Malformed), +// } +// } +// } + +// /// #Implementation of actions. +// /// These actions are implemented by direct calls to host functions. +// impl HasActions for Action { +// #[inline(always)] +// fn accept() -> Self { +// Action { +// _private: unsafe { accept() }, +// } +// } + +// #[inline(always)] +// fn simple_transfer(acc: &AccountAddress, amount: Amount) -> Self { +// let res = unsafe { simple_transfer(acc.0.as_ptr(), amount.micro_gtu) }; +// Action { +// _private: res, +// } +// } + +// #[inline(always)] +// fn send_raw( +// ca: &ContractAddress, +// receive_name: ReceiveName, +// amount: Amount, +// parameter: &[u8], +// ) -> Self { +// let receive_bytes = receive_name.get_chain_name().as_bytes(); +// let res = unsafe { +// prims::send( +// ca.index, +// ca.subindex, +// receive_bytes.as_ptr(), +// receive_bytes.len() as u32, +// amount.micro_gtu, +// parameter.as_ptr(), +// parameter.len() as u32, +// ) +// }; +// Action { +// _private: res, +// } +// } + +// #[inline(always)] +// fn and_then(self, then: Self) -> Self { +// let res = unsafe { combine_and(self._private, then._private) }; +// Action { +// _private: res, +// } +// } + +// #[inline(always)] +// fn or_else(self, el: Self) -> Self { +// let res = unsafe { combine_or(self._private, el._private) }; +// Action { +// _private: res, +// } +// } +// } + +// /// Allocates a Vec of bytes prepended with its length as a `u32` into memory, +// /// and prevents them from being dropped. Returns the pointer. +// /// Used to pass bytes from a Wasm module to its host. +// #[doc(hidden)] +// pub fn put_in_memory(input: &[u8]) -> *mut u8 { +// let bytes_length = input.len() as u32; +// let mut bytes = to_bytes(&bytes_length); +// bytes.extend_from_slice(input); +// let ptr = bytes.as_mut_ptr(); +// #[cfg(feature = "std")] +// ::std::mem::forget(bytes); +// #[cfg(not(feature = "std"))] +// core::mem::forget(bytes); +// ptr +// } + +// /// Wrapper for +// /// [HasActions::send_raw](./trait.HasActions.html#tymethod.send_raw), which +// /// automatically serializes the parameter. Note that if the parameter is +// /// already a byte array or convertible to a byte array without allocations it +// /// is preferrable to use [send_raw](./trait.HasActions.html#tymethod.send_raw). +// /// It is more efficient and avoids memory allocations. +// pub fn send( +// ca: &ContractAddress, +// receive_name: ReceiveName, +// amount: Amount, +// parameter: &P, +// ) -> A { +// let param_bytes = to_bytes(parameter); +// A::send_raw(ca, receive_name, amount, ¶m_bytes) +// } + +// impl UnwrapAbort for Result { +// type Unwrap = A; + +// #[inline] +// fn unwrap_abort(self) -> Self::Unwrap { +// match self { +// Ok(x) => x, +// Err(_) => crate::trap(), +// } +// } +// } + +// #[cfg(not(feature = "std"))] +// use core::fmt; +// #[cfg(feature = "std")] +// use std::fmt; + +// impl ExpectReport for Result { +// type Unwrap = A; + +// fn expect_report(self, msg: &str) -> Self::Unwrap { +// match self { +// Ok(x) => x, +// Err(e) => crate::fail!("{}: {:?}", msg, e), +// } +// } +// } + +// impl ExpectErrReport for Result { +// type Unwrap = E; + +// fn expect_err_report(self, msg: &str) -> Self::Unwrap { +// match self { +// Ok(a) => crate::fail!("{}: {:?}", msg, a), +// Err(e) => e, +// } +// } +// } + +// impl UnwrapAbort for Option { +// type Unwrap = A; + +// #[inline(always)] +// fn unwrap_abort(self) -> Self::Unwrap { self.unwrap_or_else(|| crate::trap()) } +// } + +// impl ExpectReport for Option { +// type Unwrap = A; + +// fn expect_report(self, msg: &str) -> Self::Unwrap { +// match self { +// Some(v) => v, +// None => crate::fail!("{}", msg), +// } +// } +// } + +// impl ExpectNoneReport for Option { +// fn expect_none_report(self, msg: &str) { +// if let Some(x) = self { +// crate::fail!("{}: {:?}", msg, x) +// } +// } +// } diff --git a/edwards25519/proofs/coq/extraction/Hacspec_edwards25519.v b/edwards25519/proofs/coq/extraction/Hacspec_edwards25519.v new file mode 100644 index 0000000..aaef9e7 --- /dev/null +++ b/edwards25519/proofs/coq/extraction/Hacspec_edwards25519.v @@ -0,0 +1,490 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +Require Import Hacspec_lib. + +Notation t_EdPoint_t := ((t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t)). + +Inductive t_Error : Type := +| Error_InvalidPublickeyt_Error +| Error_InvalidSignaturet_Error +| Error_InvalidSt_Error +| Error_InvalidRt_Error +| Error_SmallOrderPointt_Error +| Error_NotEnoughRandomnesst_Error. + +Notation t_VerifyResult_t := (t_Result_t (unit) (t_Error_t)). + +(*Not implemented yet? todo(item)*) + +Definition point_eq (p : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t)) (q : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t)) : bool := + let '(x1,y1,z1,_) := (p) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) in + let '(x2,y2,z2,_) := (q) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) in + andb ((x1.*z2)=.?(x2.*z1)) ((y1.*z2)=.?(y2.*z1)). + +Notation CompressedEdPoint_t := (nseq int8 32). +Definition CompressedEdPoint : CompressedEdPoint_t -> CompressedEdPoint_t := + id. + +Notation t_PublicKey_t := (t_CompressedEdPoint_t). + +Notation SerializedScalar_t := (nseq int8 32). +Definition SerializedScalar : SerializedScalar_t -> SerializedScalar_t := + id. + +Notation t_SecretKey_t := (t_SerializedScalar_t). + +Notation Signature_t := (nseq int8 64). +Definition Signature : Signature_t -> Signature_t := + id. + +Notation BigIntegerCanvas := (nseq int8 256). +Notation BigInteger_t := (nat_mod 0x8000000000000000000000000000000080000000000000000000000000000000). +Definition BigInteger : BigInteger_t -> BigInteger_t := + id. + +Notation BigScalarCanvas := (nseq int8 512). +Notation BigScalar_t := (nat_mod 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed). +Definition BigScalar : BigScalar_t -> BigScalar_t := + id. + +Notation FieldCanvas := (nseq int8 256). +Notation Ed25519FieldElement_t := (nat_mod 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed). +Definition Ed25519FieldElement : Ed25519FieldElement_t -> Ed25519FieldElement_t := + id. + +Notation ScalarCanvas := (nseq int8 256). +Notation Scalar_t := (nat_mod 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed). +Definition Scalar : Scalar_t -> Scalar_t := + id. + +Definition point_normalize (q : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t)) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) := + let '(qx,qy,qz,_) := (q) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) in + let px := (qx.*(impl__Ed25519FieldElement__inv qz)) : t_Ed25519FieldElement_t in + let py := (qy.*(impl__Ed25519FieldElement__inv qz)) : t_Ed25519FieldElement_t in + let pz := (f_ONE) : t_Ed25519FieldElement_t in + let pt := (px.*py) : t_Ed25519FieldElement_t in + (px,py,pz,pt). + +Definition point_identity : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) := + (f_ZERO,f_ONE,f_ONE,f_ZERO). + +Definition point_neg (p : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t)) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) := + let '(x,y,z,t) := (p) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) in + (f_ZERO.-x,y,z,f_ZERO.-t). + +Definition secret_expand : t_Never_t := + failure (AST import) Fatal error: something we considered as impossible occurred! Please report this by submitting an issue on GitHub! +Details: [import_thir:literal] got an error literal: this means the Rust compiler or Hax's frontend probably reported errors above. + { Types.attributes = []; + contents = + Types.Literal { + lit = + { Types.node = Types.Err; + span = + { Types.filename = + (Types.Real (Types.LocalPath "edwards25519/src/edwards25519.rs")); + hi = { Types.col = "0"; line = "1" }; + lo = { Types.col = "0"; line = "1" } } + }; + neg = false}; + hir_id = None; + span = + { Types.filename = + (Types.Real (Types.LocalPath "edwards25519/src/edwards25519.rs")); + hi = { Types.col = "75"; line = "297" }; + lo = { Types.col = "0"; line = "297" } }; + ty = Types.Never }. + +Definition v_BASE : t_CompressedEdPoint_t := + CompressedEdPoint (array_from_list [U8 (@repr WORDSIZE8 88); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102); + U8 (@repr WORDSIZE8 102)]). + +Definition v_CONSTANT_D : t_SerializedScalar_t := + SerializedScalar (array_from_list [U8 (@repr WORDSIZE8 163); + U8 (@repr WORDSIZE8 120); + U8 (@repr WORDSIZE8 89); + U8 (@repr WORDSIZE8 19); + U8 (@repr WORDSIZE8 202); + U8 (@repr WORDSIZE8 77); + U8 (@repr WORDSIZE8 235); + U8 (@repr WORDSIZE8 117); + U8 (@repr WORDSIZE8 171); + U8 (@repr WORDSIZE8 216); + U8 (@repr WORDSIZE8 65); + U8 (@repr WORDSIZE8 65); + U8 (@repr WORDSIZE8 77); + U8 (@repr WORDSIZE8 10); + U8 (@repr WORDSIZE8 112); + U8 (@repr WORDSIZE8 0); + U8 (@repr WORDSIZE8 152); + U8 (@repr WORDSIZE8 232); + U8 (@repr WORDSIZE8 121); + U8 (@repr WORDSIZE8 119); + U8 (@repr WORDSIZE8 121); + U8 (@repr WORDSIZE8 64); + U8 (@repr WORDSIZE8 199); + U8 (@repr WORDSIZE8 140); + U8 (@repr WORDSIZE8 115); + U8 (@repr WORDSIZE8 254); + U8 (@repr WORDSIZE8 111); + U8 (@repr WORDSIZE8 43); + U8 (@repr WORDSIZE8 238); + U8 (@repr WORDSIZE8 108); + U8 (@repr WORDSIZE8 3); + U8 (@repr WORDSIZE8 82)]). + +Definition v_CONSTANT_L : t_SerializedScalar_t := + SerializedScalar (array_from_list [U8 (@repr WORDSIZE8 237); + U8 (@repr WORDSIZE8 211); + U8 (@repr WORDSIZE8 245); + U8 (@repr WORDSIZE8 92); + U8 (@repr WORDSIZE8 26); + U8 (@repr WORDSIZE8 99); + U8 (@repr WORDSIZE8 18); + U8 (@repr WORDSIZE8 88); + U8 (@repr WORDSIZE8 214); + U8 (@repr WORDSIZE8 156); + U8 (@repr WORDSIZE8 247); + U8 (@repr WORDSIZE8 162); + U8 (@repr WORDSIZE8 222); + U8 (@repr WORDSIZE8 249); + U8 (@repr WORDSIZE8 222); + U8 (@repr WORDSIZE8 20); + U8 (@repr WORDSIZE8 0); + U8 (@repr WORDSIZE8 0); + U8 (@repr WORDSIZE8 0); + U8 (@repr WORDSIZE8 0); + U8 (@repr WORDSIZE8 0); + U8 (@repr WORDSIZE8 0); + U8 (@repr WORDSIZE8 0); + U8 (@repr WORDSIZE8 0); + U8 (@repr WORDSIZE8 0); + U8 (@repr WORDSIZE8 0); + U8 (@repr WORDSIZE8 0); + U8 (@repr WORDSIZE8 0); + U8 (@repr WORDSIZE8 0); + U8 (@repr WORDSIZE8 0); + U8 (@repr WORDSIZE8 0); + U8 (@repr WORDSIZE8 16)]). + +Definition v_CONSTANT_P : t_SerializedScalar_t := + SerializedScalar (array_from_list [U8 (@repr WORDSIZE8 237); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 127)]). + +Definition v_CONSTANT_P1_4_ : t_SerializedScalar_t := + SerializedScalar (array_from_list [U8 (@repr WORDSIZE8 251); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 31)]). + +Definition v_CONSTANT_P3_8_ : t_SerializedScalar_t := + SerializedScalar (array_from_list [U8 (@repr WORDSIZE8 254); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 255); + U8 (@repr WORDSIZE8 15)]). + +Definition check_canonical_point (x : t_CompressedEdPoint_t) : bool := + let x := (update_at x (@repr WORDSIZE32 31) ((x.[(@repr WORDSIZE32 31)]).&(U8 (@repr WORDSIZE8 127)))) : t_CompressedEdPoint_t in + let x := (impl__BigInteger__from_byte_seq_le x) : t_BigInteger_t in + x<.?(impl__BigInteger__from_byte_seq_le v_CONSTANT_P). + +Definition check_canonical_scalar (s : t_SerializedScalar_t) : bool := + if + (impl__U8__declassify ((s.[(@repr WORDSIZE32 31)]).&(U8 (@repr WORDSIZE8 224))))<>(@repr WORDSIZE8 0) + then + false + else + (impl__BigInteger__from_byte_seq_le s)<.?(impl__BigInteger__from_byte_seq_le v_CONSTANT_L). + +Definition is_negative (x : t_Ed25519FieldElement_t) : t_U8_t := + if + impl__Ed25519FieldElement__bit x (@repr WORDSIZE32 0) + then + U8 (@repr WORDSIZE8 1) + else + U8 (@repr WORDSIZE8 0). + +Definition compress (p : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t)) : t_CompressedEdPoint_t := + let '(x,y,z,_) := (p) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) in + let z_inv := (impl__Ed25519FieldElement__inv z) : t_Ed25519FieldElement_t in + let x := (x.*z_inv) : t_Ed25519FieldElement_t in + let y := (y.*z_inv) : t_Ed25519FieldElement_t in + let s := (impl__Ed25519FieldElement__to_byte_seq_le y) : t_Seq_t t_U8_t in + let s := (update_at s (@repr WORDSIZE32 31) ((s.[(@repr WORDSIZE32 31)]).^((is_negative x) shift_left (@repr WORDSIZE32 7)))) : t_Seq_t t_U8_t in + impl__CompressedEdPoint__from_slice s (@repr WORDSIZE32 0) (@repr WORDSIZE32 32). + +Definition encode (p : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t)) : t_Seq_t t_U8_t := + let '(x,y,z,_) := (p) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) in + let z_inv := (impl__Ed25519FieldElement__inv z) : t_Ed25519FieldElement_t in + let x := (x.*z_inv) : t_Ed25519FieldElement_t in + let y := (y.*z_inv) : t_Ed25519FieldElement_t in + let s := (impl__Ed25519FieldElement__to_byte_seq_le y) : t_Seq_t t_U8_t in + let s := (update_at s (@repr WORDSIZE32 31) ((s.[(@repr WORDSIZE32 31)]).^((is_negative x) shift_left (@repr WORDSIZE32 7)))) : t_Seq_t t_U8_t in + s. + +Definition point_add (p : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t)) (q : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t)) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) := + let d_c := (impl__Ed25519FieldElement__from_byte_seq_le v_CONSTANT_D) : t_Ed25519FieldElement_t in + let two := (f_TWO) : t_Ed25519FieldElement_t in + let '(x1,y1,z1,t1) := (p) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) in + let '(x2,y2,z2,t2) := (q) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) in + let a := ((y1.-x1).*(y2.-x2)) : t_Ed25519FieldElement_t in + let b := ((y1.+x1).*(y2.+x2)) : t_Ed25519FieldElement_t in + let c := (((t1.*two).*d_c).*t2) : t_Ed25519FieldElement_t in + let d := ((z1.*two).*z2) : t_Ed25519FieldElement_t in + let e := (b.-a) : t_Ed25519FieldElement_t in + let f := (d.-c) : t_Ed25519FieldElement_t in + let g := (d.+c) : t_Ed25519FieldElement_t in + let h := (b.+a) : t_Ed25519FieldElement_t in + let x3 := (e.*f) : t_Ed25519FieldElement_t in + let y3 := (g.*h) : t_Ed25519FieldElement_t in + let t3 := (e.*h) : t_Ed25519FieldElement_t in + let z3 := (f.*g) : t_Ed25519FieldElement_t in + (x3,y3,z3,t3). + +Definition point_mul (s : t_Scalar_t) (p : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t)) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) := + let p := (p) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) in + let q := (point_identity) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) in + let '(p,q) := (f_fold (f_into_iter (Build_Range (@repr WORDSIZE32 0)(@repr WORDSIZE32 256))) (p,q) (fun '(p,q) i => + let q := (if + impl__Scalar__bit s i + then + let q := (point_add q p) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) in + q + else + q) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) in + let p := (point_add p p) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) in + (p,q))) : ((t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) × (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t)) in + q. + +Definition point_mul_by_cofactor (p : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t)) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) := + let p2 := (point_add p p) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) in + let p4 := (point_add p2 p2) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) in + point_add p4 p4. + +Definition sqrt (a : t_Ed25519FieldElement_t) : t_Option_t t_Ed25519FieldElement_t := + let p3_8 := (impl__Ed25519FieldElement__from_byte_seq_le v_CONSTANT_P3_8_) : t_Ed25519FieldElement_t in + let p1_4 := (impl__Ed25519FieldElement__from_byte_seq_le v_CONSTANT_P1_4_) : t_Ed25519FieldElement_t in + let x_c := (f_pow_self a p3_8) : t_Ed25519FieldElement_t in + let result := (Option_Nonet_Option_t t_Ed25519FieldElement_t) : t_Option_t t_Ed25519FieldElement_t in + let result := (if + (x_c.*x_c)=.?a + then + let result := (Option_Some x_c) : t_Option_t t_Ed25519FieldElement_t in + result + else + result) : t_Option_t t_Ed25519FieldElement_t in + let result := (if + (x_c.*x_c)=.?(f_ZERO.-a) + then + let x := ((f_pow_self f_TWO p1_4).*x_c) : t_Ed25519FieldElement_t in + let result := (Option_Some x) : t_Option_t t_Ed25519FieldElement_t in + result + else + result) : t_Option_t t_Ed25519FieldElement_t in + result. + +Definition decompress (q : t_CompressedEdPoint_t) : t_Option_t (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) := + run (let d := (impl__Ed25519FieldElement__from_byte_seq_le v_CONSTANT_D) : t_Ed25519FieldElement_t in + let x_s := (((q.[(@repr WORDSIZE32 31)]).&(U8 (@repr WORDSIZE8 128))) shift_right (@repr WORDSIZE32 7)) : t_U8_t in + let y_s := (q) : t_CompressedEdPoint_t in + let y_s := (update_at y_s (@repr WORDSIZE32 31) ((y_s.[(@repr WORDSIZE32 31)]).&(U8 (@repr WORDSIZE8 127)))) : t_CompressedEdPoint_t in + let _ := (if + not (check_canonical_point y_s) + then + let _ := (match f_branch Option_Nonet_Option_t (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) with + | ControlFlow_Break residual => let hoist1 := (v_Break (f_from_residual residual)) : t_Never_t in + ControlFlow_Continue (never_to_any hoist1) + | ControlFlow_Continue val => ControlFlow_Continue val + end) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) in + ControlFlow_Continue tt + else + ControlFlow_Continue tt) : unit in + let y := (impl__Ed25519FieldElement__from_byte_seq_le y_s) : t_Ed25519FieldElement_t in + let z := (f_ONE) : t_Ed25519FieldElement_t in + let yy := (y.*y) : t_Ed25519FieldElement_t in + let u := (yy.-z) : t_Ed25519FieldElement_t in + let v := ((d.*yy).+z) : t_Ed25519FieldElement_t in + let xx := (u.*(impl__Ed25519FieldElement__inv v)) : t_Ed25519FieldElement_t in + let x := (match f_branch (sqrt xx) with + | ControlFlow_Break residual => let hoist2 := (v_Break (f_from_residual residual)) : t_Never_t in + ControlFlow_Continue (never_to_any hoist2) + | ControlFlow_Continue val => ControlFlow_Continue val + end) : t_Ed25519FieldElement_t in + let x_r := (is_negative x) : t_U8_t in + let _ := (if + andb (x=.?f_ZERO) ((impl__U8__declassify x_s)=.?(@repr WORDSIZE8 1)) + then + let _ := (match f_branch Option_Nonet_Option_t (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) with + | ControlFlow_Break residual => let hoist3 := (v_Break (f_from_residual residual)) : t_Never_t in + ControlFlow_Continue (never_to_any hoist3) + | ControlFlow_Continue val => ControlFlow_Continue val + end) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) in + ControlFlow_Continue tt + else + ControlFlow_Continue tt) : unit in + ControlFlow_Continue (let x := (if + (impl__U8__declassify x_r)<>(impl__U8__declassify x_s) + then + let x := (f_ZERO.-x) : t_Ed25519FieldElement_t in + x + else + x) : t_Ed25519FieldElement_t in + Option_Some (x,y,z,x.*y))). + +Definition decode (q_s : t_Seq_t t_U8_t) : t_Option_t (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) := + let q := (impl__CompressedEdPoint__from_slice q_s (@repr WORDSIZE32 0) (@repr WORDSIZE32 32)) : t_CompressedEdPoint_t in + decompress q. + +Definition decompress_non_canonical (p : t_CompressedEdPoint_t) : t_Option_t (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) := + run (let d := (impl__Ed25519FieldElement__from_byte_seq_le v_CONSTANT_D) : t_Ed25519FieldElement_t in + let x_s := (((p.[(@repr WORDSIZE32 31)]).&(U8 (@repr WORDSIZE8 128))) shift_right (@repr WORDSIZE32 7)) : t_U8_t in + let y_s := (p) : t_CompressedEdPoint_t in + let y_s := (update_at y_s (@repr WORDSIZE32 31) ((y_s.[(@repr WORDSIZE32 31)]).&(U8 (@repr WORDSIZE8 127)))) : t_CompressedEdPoint_t in + let y := (impl__Ed25519FieldElement__from_byte_seq_le y_s) : t_Ed25519FieldElement_t in + let z := (f_ONE) : t_Ed25519FieldElement_t in + let yy := (y.*y) : t_Ed25519FieldElement_t in + let u := (yy.-z) : t_Ed25519FieldElement_t in + let v := ((d.*yy).+z) : t_Ed25519FieldElement_t in + let xx := (u.*(impl__Ed25519FieldElement__inv v)) : t_Ed25519FieldElement_t in + let x := (match f_branch (sqrt xx) with + | ControlFlow_Break residual => let hoist4 := (v_Break (f_from_residual residual)) : t_Never_t in + ControlFlow_Continue (never_to_any hoist4) + | ControlFlow_Continue val => ControlFlow_Continue val + end) : t_Ed25519FieldElement_t in + ControlFlow_Continue (let x_r := (is_negative x) : t_U8_t in + let x := (if + (impl__U8__declassify x_r)<>(impl__U8__declassify x_s) + then + let x := (f_ZERO.-x) : t_Ed25519FieldElement_t in + x + else + x) : t_Ed25519FieldElement_t in + Option_Some (x,y,z,x.*y))). + +Definition secret_to_public (sk : t_SerializedScalar_t) : t_CompressedEdPoint_t := + let '(s,_) := (secret_expand sk) : (t_SerializedScalar_t × t_SerializedScalar_t) in + let base := (impl__unwrap (decompress v_BASE)) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) in + let ss := (impl__Scalar__from_byte_seq_le s) : t_Scalar_t in + let a := (point_mul ss base) : (t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t × t_Ed25519FieldElement_t) in + compress a. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 4c46277..1089392 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -28,121 +28,6 @@ Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. (*Not implemented yet? todo(item)*) -Definition t_vals_StrangeVal : choice_type := - (int32 × int32 × int32). -Equations f_a {L : {fset Location}} {I : Interface} (s : both L I (t_vals_StrangeVal)) : both L I (int32) := - f_a s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_b {L : {fset Location}} {I : Interface} (s : both L I (t_vals_StrangeVal)) : both L I (int32) := - f_b s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_c {L : {fset Location}} {I : Interface} (s : both L I (t_vals_StrangeVal)) : both L I (int32) := - f_c s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). -Fail Next Obligation. -Equations Build_t_vals_StrangeVal {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_a : both L0 I0 (int32)} {f_b : both L1 I1 (int32)} {f_c : both L2 I2 (int32)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_vals_StrangeVal) := - Build_t_vals_StrangeVal := - bind_both f_c (fun f_c => - bind_both f_b (fun f_b => - bind_both f_a (fun f_a => - solve_lift (ret_both ((f_a,f_b,f_c) : (t_vals_StrangeVal)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_vals_StrangeVal). -Fail Next Obligation. -Notation "'Build_t_vals_StrangeVal' '[' x ']' '(' 'f_a' ':=' y ')'" := (Build_t_vals_StrangeVal (f_a := y) (f_b := f_b x) (f_c := f_c x)). -Notation "'Build_t_vals_StrangeVal' '[' x ']' '(' 'f_b' ':=' y ')'" := (Build_t_vals_StrangeVal (f_a := f_a x) (f_b := y) (f_c := f_c x)). -Notation "'Build_t_vals_StrangeVal' '[' x ']' '(' 'f_c' ':=' y ')'" := (Build_t_vals_StrangeVal (f_a := f_a x) (f_b := f_b x) (f_c := y)). -Definition t_vals : choice_type := - ('unit ∐ int32 ∐ (int32 × int32) ∐ t_vals_StrangeVal). -Notation "'C_vals_MyVal_case'" := (inl (inl (inl tt))) (at level 100). -Equations C_vals_MyVal {L : {fset Location}} {I : Interface} : both L I (t_vals) := - C_vals_MyVal := - solve_lift (ret_both (inl (inl (inl (tt : 'unit))) : t_vals)) : both L I (t_vals). -Fail Next Obligation. -Notation "'C_vals_YourVal_case' x" := (inl (inl (inr x))) (at level 100). -Equations C_vals_YourVal {L : {fset Location}} {I : Interface} (x : both L I (int32)) : both L I (t_vals) := - C_vals_YourVal x := - bind_both x (fun x => - solve_lift (ret_both (inl (inl (inr x)) : t_vals))) : both L I (t_vals). -Fail Next Obligation. -Notation "'C_vals_YourSecondVal_case' x" := (inl (inr x)) (at level 100). -Equations C_vals_YourSecondVal {L : {fset Location}} {I : Interface} (x : both L I ((int32 × int32))) : both L I (t_vals) := - C_vals_YourSecondVal x := - bind_both x (fun x => - solve_lift (ret_both (inl (inr x) : t_vals))) : both L I (t_vals). -Fail Next Obligation. -Notation "'C_vals_StrangeVal_case' x" := (inr x) (at level 100). -Equations C_vals_StrangeVal {L : {fset Location}} {I : Interface} (x : both L I (t_vals_StrangeVal)) : both L I (t_vals) := - C_vals_StrangeVal x := - bind_both x (fun x => - solve_lift (ret_both (inr x : t_vals))) : both L I (t_vals). -Fail Next Obligation. - -Equations test_v {L : {fset Location}} {I : Interface} : both L I (t_vals) := - test_v := - C_vals_YourVal (solve_lift (ret_both (32 : int32))) : both L I (t_vals). -Fail Next Obligation. - -Equations test_vals {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_vals)) : both L1 I1 (int32) := - test_vals x := - matchb x with - | C_vals_MyVal_case => - solve_lift (ret_both (0 : int32)) - | C_vals_YourVal_case x => - letb x := ret_both ((x) : (int32)) in - solve_lift x - | C_vals_YourSecondVal_case (x,y) => - letb '(x,y) := ret_both ((x,y) : (int32 × int32)) in - solve_lift y - | C_vals_StrangeVal_case some_name => - letb some_name := ret_both ((some_name) : (t_vals_StrangeVal)) in - letb a := f_a some_name in - letb c := f_c some_name in - letb b := f_b some_name in - solve_lift c - end : both L1 I1 (int32). -Fail Next Obligation. - -Definition t_alt_test : choice_type := - (int32 × int32 × int32). -Equations f_d {L : {fset Location}} {I : Interface} (s : both L I (t_alt_test)) : both L I (int32) := - f_d s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_e {L : {fset Location}} {I : Interface} (s : both L I (t_alt_test)) : both L I (int32) := - f_e s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_f {L : {fset Location}} {I : Interface} (s : both L I (t_alt_test)) : both L I (int32) := - f_f s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). -Fail Next Obligation. -Equations Build_t_alt_test {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_d : both L0 I0 (int32)} {f_e : both L1 I1 (int32)} {f_f : both L2 I2 (int32)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_alt_test) := - Build_t_alt_test := - bind_both f_f (fun f_f => - bind_both f_e (fun f_e => - bind_both f_d (fun f_d => - solve_lift (ret_both ((f_d,f_e,f_f) : (t_alt_test)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_alt_test). -Fail Next Obligation. -Notation "'Build_t_alt_test' '[' x ']' '(' 'f_d' ':=' y ')'" := (Build_t_alt_test (f_d := y) (f_e := f_e x) (f_f := f_f x)). -Notation "'Build_t_alt_test' '[' x ']' '(' 'f_e' ':=' y ')'" := (Build_t_alt_test (f_d := f_d x) (f_e := y) (f_f := f_f x)). -Notation "'Build_t_alt_test' '[' x ']' '(' 'f_f' ':=' y ')'" := (Build_t_alt_test (f_d := f_d x) (f_e := f_e x) (f_f := y)). - -Equations test_alt_vals {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_alt_test)) : both L1 I1 (int32) := - test_alt_vals x := - letb some_name := x in - letb d := f_d some_name in - letb f := f_f some_name in - letb e := f_e some_name in - solve_lift f : both L1 I1 (int32). -Fail Next Obligation. - Class t_Group (Self : choice_type) := { f_group_type : choice_type ; f_group_type_t_Serialize :> t_Serialize (f_group_type) ; @@ -153,8 +38,8 @@ Class t_Group (Self : choice_type) := { f_group_type_t_Eq :> t_Eq (f_group_type) ; f_group_type_t_PartialEq :> t_PartialEq (f_group_type) ; f_group_type_t_Sized :> t_Sized (f_group_type) ; - q : both (fset[]) (fset[]) (int32) ; - g : both (fset[]) (fset[]) (f_group_type) ; + f_q : forall {L1 I1}, both L1 I1 (int32) ; + f_g : forall {L1 I1}, both L1 I1 (f_group_type) ; f_g_pow_loc : {fset Location} ; f_g_pow : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_g_pow_loc) I1 (f_group_type) ; f_pow_loc : {fset Location} ; @@ -186,14 +71,14 @@ Definition res_loc : Location := (int32;0%nat). #[global] Program Instance t_z_17__t_Group : t_Group t_z_17_ := let f_group_type := int32 : choice_type in - let q := ret_both (17 : int32) : both (fset []) (fset []) (int32) in - let g := ret_both (3 : int32) : both (fset []) (fset []) (int32) in - let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: fset []) I1 (int32) in - let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((g .^ x) .% q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + let f_q := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (17 : int32)) : both (L :|: fset []) I (int32) in + let f_g := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (3 : int32)) : both (L :|: fset []) I (int32) in + let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift ((f_g .^ x) .% f_q) : both (L1 :|: fset []) I1 (int32) in + let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((f_g .^ x) .% f_q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in let f_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I (int32) in - let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% f_q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => letb res loc(res_loc) := ret_both (0 : int32) in - letb res := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (1 : int32)) (f_end := q))) (fun i => + letb res := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (1 : int32)) (f_end := f_q))) (fun i => ssp (fun res => letb ii_computation := i in solve_lift (ifb (f_g_pow i) =.? x @@ -203,8 +88,8 @@ Definition res_loc : Location := solve_lift res : both (L1 :|: fset [res_loc]) I1 (int32) in let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset [res_loc]) (I1 :|: I2) (int32) in {| f_group_type := (@f_group_type); - q := (@q); - g := (@g); + f_q := (@f_q); + f_g := (@f_g); f_g_pow_loc := (fset [] : {fset Location}); f_g_pow := (@f_g_pow); f_pow_loc := (fset [] : {fset Location}); @@ -216,7 +101,7 @@ Definition res_loc : Location := f_inv_loc := (fset [res_loc] : {fset Location}); f_inv := (@f_inv); f_div_loc := (fset [res_loc] : {fset Location}); - f_div := (@f_div)|}. + f_div := (@f_div)|}. Solve All Obligations with exact int_eqdec. Fail Next Obligation. Hint Unfold t_z_17__t_Group. @@ -279,12 +164,12 @@ Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Bui Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {impl_108907986_ : _} `{ t_Sized (impl_108907986_)} `{ t_HasInitContext (impl_108907986_) ('unit)} (_ : both L1 I1 (impl_108907986_)) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)) := init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_xis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_commit_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_g_pow_xi_yi_vis := repeat f_one (ret_both (20 : uint_size))) (f_zkp_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)). + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_one) (ret_both (20 : uint_size))) (f_zkp_xis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_commit_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_g_pow_xi_yi_vis := repeat (f_one) (ret_both (20 : uint_size))) (f_zkp_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)). Fail Next Obligation. Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) : both L1 I1 (int32) := select_private_voting_key random := - solve_lift (random .% q) : both L1 I1 (int32). + solve_lift (random .% f_q) : both L1 I1 (int32). Fail Next Obligation. Equations v_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi : both L1 I1 (int32)) (xi : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) (int32) := @@ -317,22 +202,22 @@ Definition register_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Size (t_OvnContractState;1%nat). Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := register_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (Ctx := t_RegisterParam) (f_parameter_cursor ctx) in + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_RegisterParam) := matchb f_branch out with | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : ( (t_ParseError))) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist1 := v_Break (f_from_residual residual) in - ControlFlow_Continue (solve_lift (never_to_any hoist1)) + letb residual := ret_both ((residual) : (t_Result (t_Infallible) (t_ParseError))) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist1 := v_Break (f_from_residual residual) in + ControlFlow_Continue (solve_lift (never_to_any hoist1)) | ControlFlow_Continue_case val => letb val := ret_both ((val) : (t_RegisterParam)) in - ControlFlow_Continue (solve_lift val) + ControlFlow_Continue (solve_lift val) end in ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in letb zkp_xi := v_ZKP g_pow_xi (f_rp_xi params) in letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in - Result_Ok (prod_b (f_accept,register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. Definition t_CastVoteParam : choice_type := @@ -374,14 +259,14 @@ Definition prod2_loc : Location := (int32;3%nat). Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq int32 20)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod1_loc;prod2_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32) := compute_group_element_for_vote i xi vote xis := - letb prod1 loc(prod1_loc) := f_one in + letb prod1 loc(prod1_loc) := f_one (ret_both (tt : 'unit)) in letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun j => ssp (fun prod1 => - solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod1_loc;prod1_loc]) (I1:|:I4:|:I1) (f_group_type))) prod1 in - letb prod2 loc(prod2_loc) := f_one in + solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod1_loc;prod1_loc]) (I1:|:I4:|:I1) (int32))) prod1 in + letb prod2 loc(prod2_loc) := f_one (ret_both (tt : 'unit)) in letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun j => ssp (fun prod2 => - solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod2_loc;prod2_loc]) (I1:|:I4:|:I1) (f_group_type))) prod2 in + solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod2_loc;prod2_loc]) (I1:|:I4:|:I1) (int32))) prod2 in letb v_Yi := f_div prod1 prod2 in solve_lift (f_prod (f_pow v_Yi xi) (f_g_pow (ifb vote then ret_both (1 : int32) @@ -397,15 +282,15 @@ Definition commit_to_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Siz (t_OvnContractState;4%nat). Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := commit_to_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (Ctx := t_CastVoteParam) (f_parameter_cursor ctx) in + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb f_branch out with | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : ((* t_Result (t_Infallible) *) (t_ParseError))) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist2 := v_Break (f_from_residual residual) in - ControlFlow_Continue (solve_lift (never_to_any hoist2)) + letb residual := ret_both ((residual) : (t_Result (t_Infallible) (t_ParseError))) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist2 := v_Break (f_from_residual residual) in + ControlFlow_Continue (solve_lift (never_to_any hoist2)) | ControlFlow_Continue_case val => letb val := ret_both ((val) : (t_CastVoteParam)) in - ControlFlow_Continue (solve_lift val) + ControlFlow_Continue (solve_lift val) end in ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (f_zkp_xis state)) (fun zkp => ssp (fun _ => @@ -414,8 +299,8 @@ Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Int letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in letb commit_vi := commit_to g_pow_xi_yi_vi in letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in - letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept,commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). + letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (int32)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := @@ -427,22 +312,22 @@ Definition cast_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v (t_OvnContractState;5%nat). Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := cast_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (Ctx := t_CastVoteParam) (f_parameter_cursor ctx) in + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb f_branch out with | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : ((* t_Result (t_Infallible) *) (t_ParseError))) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist3 := v_Break (f_from_residual residual) in - ControlFlow_Continue (solve_lift (never_to_any hoist3)) + letb residual := ret_both ((residual) : (t_Result (t_Infallible) (t_ParseError))) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist3 := v_Break (f_from_residual residual) in + ControlFlow_Continue (solve_lift (never_to_any hoist3)) | ControlFlow_Continue_case val => letb val := ret_both ((val) : (t_CastVoteParam)) in - ControlFlow_Continue (solve_lift val) + ControlFlow_Continue (solve_lift val) end in ControlFlow_Continue (letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in letb zkp_vi := v_ZKP_one_out_of_two g_pow_xi_yi_vi (f_cvp_vote params) in letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (f_accept,cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := @@ -467,7 +352,7 @@ Definition tally_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Size Definition tally_votes_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := (t_OvnContractState;7%nat). Definition vote_result_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (f_group_type;8%nat). + (int32;8%nat). Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := tally_votes _ state := letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => @@ -475,10 +360,10 @@ Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interf letb _ := check_valid2 ((f_g_pow_xi_yi_vis state).a[i]) ((f_zkp_vis state).a[i]) in letb _ := check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i]) in solve_lift (ret_both (tt : 'unit)) : both (*0*)(L2:|:fset []) (I2) ('unit))) (ret_both (tt : 'unit)) in - letb vote_result loc(vote_result_loc) := f_one in + letb vote_result loc(vote_result_loc) := f_one (ret_both (tt : 'unit)) in letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => ssp (fun vote_result => - solve_lift (f_prod vote_result g_pow_vote) : both (*2*)(L2:|:L2:|:fset [vote_result_loc;vote_result_loc]) (I2:|:I2) (f_group_type))) vote_result in + solve_lift (f_prod vote_result g_pow_vote) : both (*2*)(L2:|:L2:|:fset [vote_result_loc;vote_result_loc]) (I2:|:I2) (int32))) vote_result in letb tally loc(tally_loc) := ret_both (0 : int32) in letb tally := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => ssp (fun tally => @@ -488,7 +373,7 @@ Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interf else tally) : both (*3*)(L2:|:fset [tally_loc;vote_result_loc;tally_loc]) (I2) (int32))) tally in letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in - Result_Ok (solve_lift (prod_b (f_accept,tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). + Result_Ok (solve_lift (prod_b (f_accept (ret_both (tt : 'unit)),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. (** Concert lib part **) @@ -533,6 +418,13 @@ Fail Next Obligation. Definition receive_OVN_commit_to_vote {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := commit_to_vote ctx st. +#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := + {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := + fun x => + x. +Fail Next Obligation. Definition receive_OVN_cast_vote {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := cast_vote ctx st. @@ -558,8 +450,8 @@ Fail Next Obligation. fun x => x. Fail Next Obligation. -#[global] (* Program *) Instance state_OVN_t_HasActions : t_HasActions state_OVN. -Admitted. +#[global] Program Instance state_OVN_t_HasActions : t_HasActions state_OVN := + Admitted. Fail Next Obligation. Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := receive_OVN chain ctx st msg := diff --git a/ovn/src/ovn.rs b/ovn/src/ovn.rs index 437e52f..868bbc1 100644 --- a/ovn/src/ovn.rs +++ b/ovn/src/ovn.rs @@ -12,34 +12,6 @@ use hacspec_concordium::*; #[exclude] use hacspec_concordium_derive::*; -pub enum vals { - MyVal, - YourVal (u32), - YourSecondVal (u32, u32), - StrangeVal {a : u32, b : u32, c : u32}, -} - -pub fn test_v() -> vals { - vals::YourVal(32) -} - -pub fn test_vals ( x : vals) -> u32 { - match x { - vals::MyVal => 0, - vals::YourVal(x) => x, - vals::YourSecondVal(x, y) => y, - vals::StrangeVal { a, c, b } => c - } -} - -pub struct alt_test {d : u32, e : u32, f : u32} - -pub fn test_alt_vals ( x : alt_test) -> u32 { - match x { - alt_test { d, f, e } => f - } -} - /** Interface for group implementation */ pub trait Group { type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize diff --git a/pasta/proofs/coq/extraction/Hacspec_pasta.v b/pasta/proofs/coq/extraction/Hacspec_pasta.v new file mode 100644 index 0000000..a7e08e2 --- /dev/null +++ b/pasta/proofs/coq/extraction/Hacspec_pasta.v @@ -0,0 +1,190 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +Require Import Hacspec_lib. + +Notation t_G1_pallas_t := ((t_FpPallas_t × t_FpPallas_t × bool)). + +Notation t_G1_vesta_t := ((t_FpVesta_t × t_FpVesta_t × bool)). + +Notation PallasCanvas := (nseq int8 255). +Notation FpPallas_t := (nat_mod 0x40000000000000000000000000000000224698FC094CF91B992D30ED00000001). +Definition FpPallas : FpPallas_t -> FpPallas_t := + id. + +Notation VestaCanvas := (nseq int8 255). +Notation FpVesta_t := (nat_mod 0x40000000000000000000000000000000224698FC0994A8DD8C46EB2100000001). +Definition FpVesta : FpVesta_t -> FpVesta_t := + id. + +(*Not implemented yet? todo(item)*) + +Definition g1_default_pallas : (t_FpPallas_t × t_FpPallas_t × bool) := + (f_ZERO,f_ZERO,true). + +Definition g1_default_vesta : (t_FpVesta_t × t_FpVesta_t × bool) := + (f_ZERO,f_ZERO,true). + +Definition g1_is_identity_pallas (p : (t_FpPallas_t × t_FpPallas_t × bool)) : bool := + let '(_,_,inf) := (p) : (t_FpPallas_t × t_FpPallas_t × bool) in + inf. + +Definition g1_is_identity_vesta (p : (t_FpVesta_t × t_FpVesta_t × bool)) : bool := + let '(_,_,inf) := (p) : (t_FpVesta_t × t_FpVesta_t × bool) in + inf. + +Definition g1_on_curve_pallas (p : (t_FpPallas_t × t_FpPallas_t × bool)) : bool := + let '(x,y,inf) := (p) : (t_FpPallas_t × t_FpPallas_t × bool) in + let y_squared := (y.*y) : t_FpPallas_t in + let x_cubed := ((x.*x).*x) : t_FpPallas_t in + let fp5 := ((f_TWO.+f_TWO).+f_ONE) : t_FpPallas_t in + orb (y_squared=.?(x_cubed.+fp5)) inf. + +Definition g1_on_curve_vesta (p : (t_FpVesta_t × t_FpVesta_t × bool)) : bool := + let '(x,y,inf) := (p) : (t_FpVesta_t × t_FpVesta_t × bool) in + let y_squared := (y.*y) : t_FpVesta_t in + let x_cubed := ((x.*x).*x) : t_FpVesta_t in + let fp5 := ((f_TWO.+f_TWO).+f_ONE) : t_FpVesta_t in + orb (y_squared=.?(x_cubed.+fp5)) inf. + +Definition g1add_a_pallas (p : (t_FpPallas_t × t_FpPallas_t × bool)) (q : (t_FpPallas_t × t_FpPallas_t × bool)) : (t_FpPallas_t × t_FpPallas_t × bool) := + let '(x1,y1,_) := (p) : (t_FpPallas_t × t_FpPallas_t × bool) in + let '(x2,y2,_) := (q) : (t_FpPallas_t × t_FpPallas_t × bool) in + let x_diff := (x2.-x1) : t_FpPallas_t in + let y_diff := (y2.-y1) : t_FpPallas_t in + let xovery := (y_diff.*(impl__FpPallas__inv x_diff)) : t_FpPallas_t in + let x3 := (((f_exp xovery (@repr WORDSIZE32 2)).-x1).-x2) : t_FpPallas_t in + let y3 := ((xovery.*(x1.-x3)).-y1) : t_FpPallas_t in + (x3,y3,false). + +Definition g1add_a_vesta (p : (t_FpVesta_t × t_FpVesta_t × bool)) (q : (t_FpVesta_t × t_FpVesta_t × bool)) : (t_FpVesta_t × t_FpVesta_t × bool) := + let '(x1,y1,_) := (p) : (t_FpVesta_t × t_FpVesta_t × bool) in + let '(x2,y2,_) := (q) : (t_FpVesta_t × t_FpVesta_t × bool) in + let x_diff := (x2.-x1) : t_FpVesta_t in + let y_diff := (y2.-y1) : t_FpVesta_t in + let xovery := (y_diff.*(impl__FpVesta__inv x_diff)) : t_FpVesta_t in + let x3 := (((f_exp xovery (@repr WORDSIZE32 2)).-x1).-x2) : t_FpVesta_t in + let y3 := ((xovery.*(x1.-x3)).-y1) : t_FpVesta_t in + (x3,y3,false). + +Definition g1double_a_pallas (p : (t_FpPallas_t × t_FpPallas_t × bool)) : (t_FpPallas_t × t_FpPallas_t × bool) := + let '(x1,y1,_) := (p) : (t_FpPallas_t × t_FpPallas_t × bool) in + let x12 := (f_exp x1 (@repr WORDSIZE32 2)) : t_FpPallas_t in + let xovery := (((impl__FpPallas__from_literal (@repr WORDSIZE128 3)).*x12).*(impl__FpPallas__inv (f_TWO.*y1))) : t_FpPallas_t in + let x3 := ((f_exp xovery (@repr WORDSIZE32 2)).-(f_TWO.*x1)) : t_FpPallas_t in + let y3 := ((xovery.*(x1.-x3)).-y1) : t_FpPallas_t in + (x3,y3,false). + +Definition g1double_a_vesta (p : (t_FpVesta_t × t_FpVesta_t × bool)) : (t_FpVesta_t × t_FpVesta_t × bool) := + let '(x1,y1,_) := (p) : (t_FpVesta_t × t_FpVesta_t × bool) in + let x12 := (f_exp x1 (@repr WORDSIZE32 2)) : t_FpVesta_t in + let xovery := (((impl__FpVesta__from_literal (@repr WORDSIZE128 3)).*x12).*(impl__FpVesta__inv (f_TWO.*y1))) : t_FpVesta_t in + let x3 := ((f_exp xovery (@repr WORDSIZE32 2)).-(f_TWO.*x1)) : t_FpVesta_t in + let y3 := ((xovery.*(x1.-x3)).-y1) : t_FpVesta_t in + (x3,y3,false). + +Definition g1double_pallas (p : (t_FpPallas_t × t_FpPallas_t × bool)) : (t_FpPallas_t × t_FpPallas_t × bool) := + let '(_x1,y1,inf1) := (p) : (t_FpPallas_t × t_FpPallas_t × bool) in + if + andb (y1<>f_ZERO) (not inf1) + then + g1double_a_pallas p + else + (f_ZERO,f_ZERO,true). + +Definition g1add_pallas (p : (t_FpPallas_t × t_FpPallas_t × bool)) (q : (t_FpPallas_t × t_FpPallas_t × bool)) : (t_FpPallas_t × t_FpPallas_t × bool) := + let '(x1,y1,inf1) := (p) : (t_FpPallas_t × t_FpPallas_t × bool) in + let '(x2,y2,inf2) := (q) : (t_FpPallas_t × t_FpPallas_t × bool) in + if + inf1 + then + q + else + if + inf2 + then + p + else + if + p=.?q + then + g1double_pallas p + else + if + not (andb (x1=.?x2) (y1=.?(f_ZERO.-y2))) + then + g1add_a_pallas p q + else + (f_ZERO,f_ZERO,true). + +Definition g1double_vesta (p : (t_FpVesta_t × t_FpVesta_t × bool)) : (t_FpVesta_t × t_FpVesta_t × bool) := + let '(_x1,y1,inf1) := (p) : (t_FpVesta_t × t_FpVesta_t × bool) in + if + andb (y1<>f_ZERO) (not inf1) + then + g1double_a_vesta p + else + (f_ZERO,f_ZERO,true). + +Definition g1add_vesta (p : (t_FpVesta_t × t_FpVesta_t × bool)) (q : (t_FpVesta_t × t_FpVesta_t × bool)) : (t_FpVesta_t × t_FpVesta_t × bool) := + let '(x1,y1,inf1) := (p) : (t_FpVesta_t × t_FpVesta_t × bool) in + let '(x2,y2,inf2) := (q) : (t_FpVesta_t × t_FpVesta_t × bool) in + if + inf1 + then + q + else + if + inf2 + then + p + else + if + p=.?q + then + g1double_vesta p + else + if + not (andb (x1=.?x2) (y1=.?(f_ZERO.-y2))) + then + g1add_a_vesta p q + else + (f_ZERO,f_ZERO,true). + +Definition g1neg_pallas (p : (t_FpPallas_t × t_FpPallas_t × bool)) : (t_FpPallas_t × t_FpPallas_t × bool) := + let '(x,y,inf) := (p) : (t_FpPallas_t × t_FpPallas_t × bool) in + (x,f_ZERO.-y,inf). + +Definition g1neg_vesta (p : (t_FpVesta_t × t_FpVesta_t × bool)) : (t_FpVesta_t × t_FpVesta_t × bool) := + let '(x,y,inf) := (p) : (t_FpVesta_t × t_FpVesta_t × bool) in + (x,f_ZERO.-y,inf). + +Definition g1mul_pallas (m : t_FpVesta_t) (p : (t_FpPallas_t × t_FpPallas_t × bool)) : (t_FpPallas_t × t_FpPallas_t × bool) := + let t := ((f_ZERO,f_ZERO,true)) : (t_FpPallas_t × t_FpPallas_t × bool) in + let t := (f_fold (f_into_iter (Build_Range (@repr WORDSIZE32 0)(@repr WORDSIZE32 255))) t (fun t i => + let t := (g1double_pallas t) : (t_FpPallas_t × t_FpPallas_t × bool) in + if + impl__FpVesta__bit m ((@repr WORDSIZE32 254).-i) + then + let t := (g1add_pallas t p) : (t_FpPallas_t × t_FpPallas_t × bool) in + t + else + t)) : (t_FpPallas_t × t_FpPallas_t × bool) in + t. + +Definition g1mul_vesta (m : t_FpPallas_t) (p : (t_FpVesta_t × t_FpVesta_t × bool)) : (t_FpVesta_t × t_FpVesta_t × bool) := + let t := ((f_ZERO,f_ZERO,true)) : (t_FpVesta_t × t_FpVesta_t × bool) in + let t := (f_fold (f_into_iter (Build_Range (@repr WORDSIZE32 0)(@repr WORDSIZE32 255))) t (fun t i => + let t := (g1double_vesta t) : (t_FpVesta_t × t_FpVesta_t × bool) in + if + impl__FpPallas__bit m ((@repr WORDSIZE32 254).-i) + then + let t := (g1add_vesta t p) : (t_FpVesta_t × t_FpVesta_t × bool) in + t + else + t)) : (t_FpVesta_t × t_FpVesta_t × bool) in + t. diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 94ea93e..d358713 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2023-01-07" +channel = "nightly-2023-06-02" components = [ "rustc-dev", "llvm-tools-preview" , "rust-analysis" , "rust-src" , "rustfmt" ] diff --git a/sha512/proofs/coq/extraction/Hacspec_sha512.v b/sha512/proofs/coq/extraction/Hacspec_sha512.v new file mode 100644 index 0000000..5d0f9cf --- /dev/null +++ b/sha512/proofs/coq/extraction/Hacspec_sha512.v @@ -0,0 +1,250 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib MachineIntegers. +From Coq Require Import ZArith. +Import List.ListNotations. +Open Scope Z_scope. +Open Scope bool_scope. + +Require Import Hacspec_lib. + +Notation Block_t := (nseq int8 BLOCK_SIZE). +Definition Block : Block_t -> Block_t := + id. + +Notation Hash_t := (nseq int64 8). +Definition Hash : Hash_t -> Hash_t := + id. + +Notation OpTableType_t := (nseq int32 12). +Definition OpTableType : OpTableType_t -> OpTableType_t := + id. + +Notation RoundConstantsTable_t := (nseq int64 K_SIZE). +Definition RoundConstantsTable : RoundConstantsTable_t -> RoundConstantsTable_t := + id. + +Notation Sha512Digest_t := (nseq int8 HASH_SIZE). +Definition Sha512Digest : Sha512Digest_t -> Sha512Digest_t := + id. + +(*Not implemented yet? todo(item)*) + +Definition v_BLOCK_SIZE : uint_size := + (@repr WORDSIZE32 128). + +Definition v_HASH_SIZE : uint_size := + (@repr WORDSIZE32 512)./(@repr WORDSIZE32 8). + +Definition v_K_SIZE : uint_size := + (@repr WORDSIZE32 80). + +Definition v_LEN_SIZE : uint_size := + (@repr WORDSIZE32 16). + +Definition v_OP_TABLE : t_OpTableType_t := + OpTableType (array_from_list [(@repr WORDSIZE32 28); + (@repr WORDSIZE32 34); + (@repr WORDSIZE32 39); + (@repr WORDSIZE32 14); + (@repr WORDSIZE32 18); + (@repr WORDSIZE32 41); + (@repr WORDSIZE32 1); + (@repr WORDSIZE32 8); + (@repr WORDSIZE32 7); + (@repr WORDSIZE32 19); + (@repr WORDSIZE32 61); + (@repr WORDSIZE32 6)]). + +Definition ch (x : t_U64_t) (y : t_U64_t) (z : t_U64_t) : t_U64_t := + (x.&y).^((f_not x).&z). + +Definition maj (x : t_U64_t) (y : t_U64_t) (z : t_U64_t) : t_U64_t := + (x.&y).^((x.&z).^(y.&z)). + +Definition sigma (x : t_U64_t) (i : uint_size) (op : uint_size) : t_U64_t := + let tmp := (impl__U64__rotate_right x (v_OP_TABLE.[(((@repr WORDSIZE32 3).*i).+(@repr WORDSIZE32 2))])) : t_U64_t in + let tmp := (if + op=.?(@repr WORDSIZE32 0) + then + x shift_right (v_OP_TABLE.[(((@repr WORDSIZE32 3).*i).+(@repr WORDSIZE32 2))]) + else + tmp) : t_U64_t in + ((impl__U64__rotate_right x (v_OP_TABLE.[((@repr WORDSIZE32 3).*i)])).^(impl__U64__rotate_right x (v_OP_TABLE.[(((@repr WORDSIZE32 3).*i).+(@repr WORDSIZE32 1))]))).^tmp. + +Definition schedule (block : t_Block_t) : t_RoundConstantsTable_t := + let b := (impl__Block__to_be_U64s block) : t_Seq_t t_U64_t in + let s := (impl__RoundConstantsTable__new) : t_RoundConstantsTable_t in + let s := (f_fold (f_into_iter (Build_Range (@repr WORDSIZE32 0)v_K_SIZE)) s (fun s i => + if + i<.?(@repr WORDSIZE32 16) + then + let s := (update_at_usize s i (b.[i])) : t_RoundConstantsTable_t in + s + else + let t16 := (s.[(i.-(@repr WORDSIZE32 16))]) : t_U64_t in + let t15 := (s.[(i.-(@repr WORDSIZE32 15))]) : t_U64_t in + let t7 := (s.[(i.-(@repr WORDSIZE32 7))]) : t_U64_t in + let t2 := (s.[(i.-(@repr WORDSIZE32 2))]) : t_U64_t in + let s1 := (sigma t2 (@repr WORDSIZE32 3) (@repr WORDSIZE32 0)) : t_U64_t in + let s0 := (sigma t15 (@repr WORDSIZE32 2) (@repr WORDSIZE32 0)) : t_U64_t in + let s := (update_at_usize s i (((s1.+t7).+s0).+t16)) : t_RoundConstantsTable_t in + s)) : t_RoundConstantsTable_t in + s. + +Definition v_HASH_INIT : t_Hash_t := + Hash (array_from_list [U64 (@repr WORDSIZE64 7640891576956012808); + U64 (@repr WORDSIZE64 13503953896175478587); + U64 (@repr WORDSIZE64 4354685564936845355); + U64 (@repr WORDSIZE64 11912009170470909681); + U64 (@repr WORDSIZE64 5840696475078001361); + U64 (@repr WORDSIZE64 11170449401992604703); + U64 (@repr WORDSIZE64 2270897969802886507); + U64 (@repr WORDSIZE64 6620516959819538809)]). + +Definition v_K_TABLE : t_RoundConstantsTable_t := + RoundConstantsTable (array_from_list [U64 (@repr WORDSIZE64 4794697086780616226); + U64 (@repr WORDSIZE64 8158064640168781261); + U64 (@repr WORDSIZE64 13096744586834688815); + U64 (@repr WORDSIZE64 16840607885511220156); + U64 (@repr WORDSIZE64 4131703408338449720); + U64 (@repr WORDSIZE64 6480981068601479193); + U64 (@repr WORDSIZE64 10538285296894168987); + U64 (@repr WORDSIZE64 12329834152419229976); + U64 (@repr WORDSIZE64 15566598209576043074); + U64 (@repr WORDSIZE64 1334009975649890238); + U64 (@repr WORDSIZE64 2608012711638119052); + U64 (@repr WORDSIZE64 6128411473006802146); + U64 (@repr WORDSIZE64 8268148722764581231); + U64 (@repr WORDSIZE64 9286055187155687089); + U64 (@repr WORDSIZE64 11230858885718282805); + U64 (@repr WORDSIZE64 13951009754708518548); + U64 (@repr WORDSIZE64 16472876342353939154); + U64 (@repr WORDSIZE64 17275323862435702243); + U64 (@repr WORDSIZE64 1135362057144423861); + U64 (@repr WORDSIZE64 2597628984639134821); + U64 (@repr WORDSIZE64 3308224258029322869); + U64 (@repr WORDSIZE64 5365058923640841347); + U64 (@repr WORDSIZE64 6679025012923562964); + U64 (@repr WORDSIZE64 8573033837759648693); + U64 (@repr WORDSIZE64 10970295158949994411); + U64 (@repr WORDSIZE64 12119686244451234320); + U64 (@repr WORDSIZE64 12683024718118986047); + U64 (@repr WORDSIZE64 13788192230050041572); + U64 (@repr WORDSIZE64 14330467153632333762); + U64 (@repr WORDSIZE64 15395433587784984357); + U64 (@repr WORDSIZE64 489312712824947311); + U64 (@repr WORDSIZE64 1452737877330783856); + U64 (@repr WORDSIZE64 2861767655752347644); + U64 (@repr WORDSIZE64 3322285676063803686); + U64 (@repr WORDSIZE64 5560940570517711597); + U64 (@repr WORDSIZE64 5996557281743188959); + U64 (@repr WORDSIZE64 7280758554555802590); + U64 (@repr WORDSIZE64 8532644243296465576); + U64 (@repr WORDSIZE64 9350256976987008742); + U64 (@repr WORDSIZE64 10552545826968843579); + U64 (@repr WORDSIZE64 11727347734174303076); + U64 (@repr WORDSIZE64 12113106623233404929); + U64 (@repr WORDSIZE64 14000437183269869457); + U64 (@repr WORDSIZE64 14369950271660146224); + U64 (@repr WORDSIZE64 15101387698204529176); + U64 (@repr WORDSIZE64 15463397548674623760); + U64 (@repr WORDSIZE64 17586052441742319658); + U64 (@repr WORDSIZE64 1182934255886127544); + U64 (@repr WORDSIZE64 1847814050463011016); + U64 (@repr WORDSIZE64 2177327727835720531); + U64 (@repr WORDSIZE64 2830643537854262169); + U64 (@repr WORDSIZE64 3796741975233480872); + U64 (@repr WORDSIZE64 4115178125766777443); + U64 (@repr WORDSIZE64 5681478168544905931); + U64 (@repr WORDSIZE64 6601373596472566643); + U64 (@repr WORDSIZE64 7507060721942968483); + U64 (@repr WORDSIZE64 8399075790359081724); + U64 (@repr WORDSIZE64 8693463985226723168); + U64 (@repr WORDSIZE64 9568029438360202098); + U64 (@repr WORDSIZE64 10144078919501101548); + U64 (@repr WORDSIZE64 10430055236837252648); + U64 (@repr WORDSIZE64 11840083180663258601); + U64 (@repr WORDSIZE64 13761210420658862357); + U64 (@repr WORDSIZE64 14299343276471374635); + U64 (@repr WORDSIZE64 14566680578165727644); + U64 (@repr WORDSIZE64 15097957966210449927); + U64 (@repr WORDSIZE64 16922976911328602910); + U64 (@repr WORDSIZE64 17689382322260857208); + U64 (@repr WORDSIZE64 500013540394364858); + U64 (@repr WORDSIZE64 748580250866718886); + U64 (@repr WORDSIZE64 1242879168328830382); + U64 (@repr WORDSIZE64 1977374033974150939); + U64 (@repr WORDSIZE64 2944078676154940804); + U64 (@repr WORDSIZE64 3659926193048069267); + U64 (@repr WORDSIZE64 4368137639120453308); + U64 (@repr WORDSIZE64 4836135668995329356); + U64 (@repr WORDSIZE64 5532061633213252278); + U64 (@repr WORDSIZE64 6448918945643986474); + U64 (@repr WORDSIZE64 6902733635092675308); + U64 (@repr WORDSIZE64 7801388544844847127)]). + +Definition shuffle (ws : t_RoundConstantsTable_t) (hashi : t_Hash_t) : t_Hash_t := + let h := (hashi) : t_Hash_t in + let h := (f_fold (f_into_iter (Build_Range (@repr WORDSIZE32 0)v_K_SIZE)) h (fun h i => + let a0 := (h.[(@repr WORDSIZE32 0)]) : t_U64_t in + let b0 := (h.[(@repr WORDSIZE32 1)]) : t_U64_t in + let c0 := (h.[(@repr WORDSIZE32 2)]) : t_U64_t in + let d0 := (h.[(@repr WORDSIZE32 3)]) : t_U64_t in + let e0 := (h.[(@repr WORDSIZE32 4)]) : t_U64_t in + let f0 := (h.[(@repr WORDSIZE32 5)]) : t_U64_t in + let g0 := (h.[(@repr WORDSIZE32 6)]) : t_U64_t in + let h0 := (h.[(@repr WORDSIZE32 7)]) : t_U64_t in + let t1 := ((((h0.+(sigma e0 (@repr WORDSIZE32 1) (@repr WORDSIZE32 1))).+(ch e0 f0 g0)).+(v_K_TABLE.[i])).+(ws.[i])) : t_U64_t in + let t2 := ((sigma a0 (@repr WORDSIZE32 0) (@repr WORDSIZE32 1)).+(maj a0 b0 c0)) : t_U64_t in + let h := (update_at h (@repr WORDSIZE32 0) (t1.+t2)) : t_Hash_t in + let h := (update_at h (@repr WORDSIZE32 1) a0) : t_Hash_t in + let h := (update_at h (@repr WORDSIZE32 2) b0) : t_Hash_t in + let h := (update_at h (@repr WORDSIZE32 3) c0) : t_Hash_t in + let h := (update_at h (@repr WORDSIZE32 4) (d0.+t1)) : t_Hash_t in + let h := (update_at h (@repr WORDSIZE32 5) e0) : t_Hash_t in + let h := (update_at h (@repr WORDSIZE32 6) f0) : t_Hash_t in + let h := (update_at h (@repr WORDSIZE32 7) g0) : t_Hash_t in + h)) : t_Hash_t in + h. + +Definition compress (block : t_Block_t) (h_in : t_Hash_t) : t_Hash_t := + let s := (schedule block) : t_RoundConstantsTable_t in + let h := (shuffle s h_in) : t_Hash_t in + let h := (f_fold (f_into_iter (Build_Range (@repr WORDSIZE32 0)(@repr WORDSIZE32 8))) h (fun h i => + update_at h i ((h.[i]).+(h_in.[i])))) : t_Hash_t in + h. + +Definition hash (msg : t_Seq_t t_U8_t) : t_Sha512Digest_t := + let h := (v_HASH_INIT) : t_Hash_t in + let last_block := (impl__Block__new) : t_Block_t in + let last_block_len := ((@repr WORDSIZE32 0)) : uint_size in + let '(h,last_block,last_block_len) := (f_fold (f_into_iter (Build_Range (@repr WORDSIZE32 0)(impl_41__num_chunks msg v_BLOCK_SIZE))) (h,last_block,last_block_len) (fun '(h,last_block,last_block_len) i => + let '(block_len,block) := (impl_41__get_chunk msg v_BLOCK_SIZE i) : (uint_size × t_Seq_t t_U8_t) in + if + block_len<.?v_BLOCK_SIZE + then + let last_block := (f_update_start impl__Block__new block) : t_Block_t in + let last_block_len := (block_len) : uint_size in + (h,last_block,last_block_len) + else + let compress_input := (impl__Block__from_seq block) : t_Block_t in + let h := (compress compress_input h) : t_Hash_t in + (h,last_block,last_block_len))) : (t_Hash_t × t_Block_t × uint_size) in + let last_block := (update_at_usize last_block last_block_len (U8 (@repr WORDSIZE8 128))) : t_Block_t in + let len_bist := (U128 (cast ((impl_41__len msg).*(@repr WORDSIZE32 8)))) : t_U128_t in + let '(h,last_block) := (if + last_block_len<.?(v_BLOCK_SIZE.-v_LEN_SIZE) + then + let last_block := (f_update last_block (v_BLOCK_SIZE.-v_LEN_SIZE) (v_U128_to_be_bytes len_bist)) : t_Block_t in + let h := (compress last_block h) : t_Hash_t in + (h,last_block) + else + let pad_block := (impl__Block__new) : t_Block_t in + let pad_block := (f_update pad_block (v_BLOCK_SIZE.-v_LEN_SIZE) (v_U128_to_be_bytes len_bist)) : t_Block_t in + let h := (compress last_block h) : t_Hash_t in + let h := (compress pad_block h) : t_Hash_t in + (h,last_block)) : (t_Hash_t × t_Block_t) in + impl__Sha512Digest__from_seq (impl__Hash__to_be_bytes h). + +Definition sha512 (msg : t_Seq_t t_U8_t) : t_Sha512Digest_t := + hash msg. From 5637f11602c1b4325d847aac432a91e191de1903 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Mon, 22 Jan 2024 17:26:03 +0100 Subject: [PATCH 38/86] WIP, full OVN artifact --- ovn/Cargo.toml | 2 +- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 560 +++++++++++--------- ovn/src/ovn.rs | 147 +++-- ovn/src/ovn_group.rs | 350 ++++++++++++ 4 files changed, 735 insertions(+), 324 deletions(-) create mode 100644 ovn/src/ovn_group.rs diff --git a/ovn/Cargo.toml b/ovn/Cargo.toml index a0c5191..d3e8fcb 100644 --- a/ovn/Cargo.toml +++ b/ovn/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Lasse Letager Hanse "] edition = "2018" [lib] -path = "src/ovn.rs" +path = "src/ovn_group.rs" [dependencies] # hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 1089392..97d3f3b 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -24,11 +24,35 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) +Class t_Z_Field (Self : choice_type) := { + f_field_type : choice_type ; + f_field_type_t_Serialize :> t_Serialize (f_field_type) ; + f_field_type_t_Deserial :> t_Deserial (f_field_type) ; + f_field_type_t_Serial :> t_Serial (f_field_type) ; + f_field_type_t_Copy :> t_Copy (f_field_type) ; + f_field_type_t_Clone :> t_Clone (f_field_type) ; + f_field_type_t_Eq :> t_Eq (f_field_type) ; + f_field_type_t_PartialEq :> t_PartialEq (f_field_type) ; + f_field_type_t_Sized :> t_Sized (f_field_type) ; + f_q : forall {L1 I1}, both L1 I1 (uint_size) ; + f_random_field_elem_loc : {fset Location} ; + f_random_field_elem : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_random_field_elem_loc) I1 (f_field_type) ; + f_field_zero_loc : {fset Location} ; + f_field_zero : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_field_zero_loc) I1 (f_field_type) ; + f_field_one_loc : {fset Location} ; + f_field_one : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_field_one_loc) I1 (f_field_type) ; + f_add_loc : {fset Location} ; + f_add : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_add_loc) (I1 :|: I2) (f_field_type) ; + f_mul_loc : {fset Location} ; + f_mul : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_mul_loc) (I1 :|: I2) (f_field_type) ; +}. +Hint Unfold f_random_field_elem_loc. +Hint Unfold f_field_zero_loc. +Hint Unfold f_field_one_loc. +Hint Unfold f_add_loc. +Hint Unfold f_mul_loc. -Class t_Group (Self : choice_type) := { +Class t_Group (Self : choice_type) `{t_Z_Field} := { f_group_type : choice_type ; f_group_type_t_Serialize :> t_Serialize (f_group_type) ; f_group_type_t_Deserial :> t_Deserial (f_group_type) ; @@ -38,14 +62,15 @@ Class t_Group (Self : choice_type) := { f_group_type_t_Eq :> t_Eq (f_group_type) ; f_group_type_t_PartialEq :> t_PartialEq (f_group_type) ; f_group_type_t_Sized :> t_Sized (f_group_type) ; - f_q : forall {L1 I1}, both L1 I1 (int32) ; f_g : forall {L1 I1}, both L1 I1 (f_group_type) ; + f_random_group_elem_loc : {fset Location} ; + f_random_group_elem : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_random_group_elem_loc) I1 (f_group_type) ; f_g_pow_loc : {fset Location} ; - f_g_pow : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_g_pow_loc) I1 (f_group_type) ; + f_g_pow : forall {L1 I1}, both L1 I1 (f_field_type) -> both (L1 :|: f_g_pow_loc) I1 (f_group_type) ; f_pow_loc : {fset Location} ; - f_pow : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: f_pow_loc) (I1 :|: I2) (f_group_type) ; - f_one_loc : {fset Location} ; - f_one : forall {L1 I1}, both (L1 :|: f_one_loc) I1 (f_group_type) ; + f_pow : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_pow_loc) (I1 :|: I2) (f_group_type) ; + f_group_one_loc : {fset Location} ; + f_group_one : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_group_one_loc) I1 (f_group_type) ; f_prod_loc : {fset Location} ; f_prod : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_prod_loc) (I1 :|: I2) (f_group_type) ; f_inv_loc : {fset Location} ; @@ -53,143 +78,110 @@ Class t_Group (Self : choice_type) := { f_div_loc : {fset Location} ; f_div : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_div_loc) (I1 :|: I2) (f_group_type) ; }. +Hint Unfold f_random_group_elem_loc. Hint Unfold f_g_pow_loc. Hint Unfold f_pow_loc. -Hint Unfold f_one_loc. +Hint Unfold f_group_one_loc. Hint Unfold f_prod_loc. Hint Unfold f_inv_loc. Hint Unfold f_div_loc. -Definition t_z_17_ : choice_type := - 'unit. -Equations Build_t_z_17_ : both (fset []) (fset []) (t_z_17_) := - Build_t_z_17_ := - solve_lift (ret_both (tt (* Empty tuple *) : (t_z_17_))) : both (fset []) (fset []) (t_z_17_). -Fail Next Obligation. - -Definition res_loc : Location := - (int32;0%nat). -#[global] Program Instance t_z_17__t_Group : t_Group t_z_17_ := - let f_group_type := int32 : choice_type in - let f_q := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (17 : int32)) : both (L :|: fset []) I (int32) in - let f_g := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (3 : int32)) : both (L :|: fset []) I (int32) in - let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift ((f_g .^ x) .% f_q) : both (L1 :|: fset []) I1 (int32) in - let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => solve_lift ((f_g .^ x) .% f_q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in - let f_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I (int32) in - let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% f_q) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in - let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => letb res loc(res_loc) := ret_both (0 : int32) in - letb res := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (1 : int32)) (f_end := f_q))) (fun i => - ssp (fun res => - letb ii_computation := i in - solve_lift (ifb (f_g_pow i) =.? x - then letb res := ii_computation in - res - else res) : both (*2*)(L1:|:fset [res_loc;res_loc]) (I1) (int32))) res in - solve_lift res : both (L1 :|: fset [res_loc]) I1 (int32) in - let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset [res_loc]) (I1 :|: I2) (int32) in - {| f_group_type := (@f_group_type); - f_q := (@f_q); - f_g := (@f_g); - f_g_pow_loc := (fset [] : {fset Location}); - f_g_pow := (@f_g_pow); - f_pow_loc := (fset [] : {fset Location}); - f_pow := (@f_pow); - f_one_loc := (fset [] : {fset Location}); - f_one := (@f_one); - f_prod_loc := (fset [] : {fset Location}); - f_prod := (@f_prod); - f_inv_loc := (fset [res_loc] : {fset Location}); - f_inv := (@f_inv); - f_div_loc := (fset [res_loc] : {fset Location}); - f_div := (@f_div)|}. -Solve All Obligations with exact int_eqdec. -Fail Next Obligation. -Hint Unfold t_z_17__t_Group. - -Notation "'t_G'" := (t_z_17_). - -Equations n {L : {fset Location}} {I : Interface} : both L I (uint_size) := - n := - solve_lift (ret_both (20 : uint_size)) : both L I (uint_size). -Fail Next Obligation. - -Definition t_OvnContractState : choice_type := - (nseq f_group_type 20 × nseq int32 20 × nseq int32 20 × nseq f_group_type 20 × nseq int32 20 × int32). -Equations f_g_pow_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type 20) := - f_g_pow_xis s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type 20))) : both L I (nseq f_group_type 20). -Fail Next Obligation. -Equations f_zkp_xis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := - f_zkp_xis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq int32 20))) : both L I (nseq int32 20). -Fail Next Obligation. -Equations f_commit_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := - f_commit_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : nseq int32 20))) : both L I (nseq int32 20). -Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type 20) := - f_g_pow_xi_yi_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type 20))) : both L I (nseq f_group_type 20). +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +Equations v_Hash {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (v : both L1 I1 ((f_group_type × f_group_type × f_group_type))) : both ((f_field_one_loc :|: L1) : {fset Location}) I1 (f_field_type) := + v_Hash v := + solve_lift (f_field_one (ret_both (tt : 'unit))) : both (f_field_one_loc :|: L1) I1 (f_field_type). Fail Next Obligation. -Equations f_zkp_vis {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (nseq int32 20) := - f_zkp_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : nseq int32 20))) : both L I (nseq int32 20). + +Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_vi : both L1 I1 (f_group_type)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := + v_ZKP_one_out_of_two g_pow_vi vi := + solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). Fail Next Obligation. -Equations f_tally {L : {fset Location}} {I : Interface} (s : both L I (t_OvnContractState)) : both L I (int32) := - f_tally s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). + +Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + check_commitment g_pow_xi_yi_vi zkp := + solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). Fail Next Obligation. -Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {f_g_pow_xis : both L0 I0 (nseq f_group_type 20)} {f_zkp_xis : both L1 I1 (nseq int32 20)} {f_commit_vis : both L2 I2 (nseq int32 20)} {f_g_pow_xi_yi_vis : both L3 I3 (nseq f_group_type 20)} {f_zkp_vis : both L4 I4 (nseq int32 20)} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := - Build_t_OvnContractState := - bind_both f_tally (fun f_tally => - bind_both f_zkp_vis (fun f_zkp_vis => - bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => - bind_both f_commit_vis (fun f_commit_vis => - bind_both f_zkp_xis (fun f_zkp_xis => - bind_both f_g_pow_xis (fun f_g_pow_xis => - solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). + +Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + check_valid2 g_pow_xi_yi_vi zkp := + solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). Fail Next Obligation. -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). -Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {impl_108907986_ : _} `{ t_Sized (impl_108907986_)} `{ t_HasInitContext (impl_108907986_) ('unit)} (_ : both L1 I1 (impl_108907986_)) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)) := - init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_one) (ret_both (20 : uint_size))) (f_zkp_xis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_commit_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_g_pow_xi_yi_vis := repeat (f_one) (ret_both (20 : uint_size))) (f_zkp_vis := repeat (ret_both (0 : int32)) (ret_both (20 : uint_size))) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState) (t_Reject)). +Equations commit_to {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (x : both L1 I1 (f_group_type)) : both L1 I1 (int32) := + commit_to x := + solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). Fail Next Obligation. -Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) : both L1 I1 (int32) := +Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) : both (f_random_group_elem_loc :|: L1) I1 (f_group_type) := select_private_voting_key random := - solve_lift (random .% f_q) : both L1 I1 (int32). + solve_lift (f_random_group_elem random) : both (f_random_group_elem_loc :|: L1) I1 (f_group_type). Fail Next Obligation. -Equations v_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi : both L1 I1 (int32)) (xi : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) (int32) := - v_ZKP g_pow_xi xi := - solve_lift (ret_both (0 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). +Definition prod1_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := + (f_group_type;0%nat). +Definition prod2_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := + (f_group_type;1%nat). +Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both L1 I1 (int32)) (xi : both L2 I2 (f_field_type)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq f_group_type (is_pure (n)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc (n:=n);prod2_loc (n:=n)]) (I1 :|: I2 :|: I3 :|: I4) (f_group_type) := + compute_group_element_for_vote i xi vote xis := + letb prod1 loc(prod1_loc) := f_group_one (ret_both (tt : 'unit)) in + letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun j => + ssp (fun prod1 => + solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc:|:fset [prod1_loc;prod1_loc]) (I1:|:I4:|:I1) (f_group_type))) prod1 in + letb prod2 loc(prod2_loc) := f_group_one (ret_both (tt : 'unit)) in + letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun j => + ssp (fun prod2 => + solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc:|:fset [prod2_loc;prod2_loc]) (I1:|:I4:|:I1) (f_group_type))) prod2 in + letb v_Yi := f_div prod1 prod2 in + solve_lift (f_prod (f_pow v_Yi xi) (f_g_pow (ifb vote + then f_field_one (ret_both (tt : 'unit)) + else f_field_zero (ret_both (tt : 'unit))))) : both (L1 :|: L2 :|: L3 :|: L4 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2 :|: I3 :|: I4) (f_group_type). +Solve All Obligations with ( (solve_ssprove_obligations ; now (rewrite !fset0E ; apply (ret_both 0))) || (destruct from_uint_size ; easy)). +Fail Next Obligation. + +Definition t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := + (int32 × f_field_type × 'bool). +Equations f_cvp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_i s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_cvp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (f_field_type) := + f_cvp_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_cvp_vote {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I ('bool) := + f_cvp_vote s := + bind_both s (fun x => + solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). +Fail Next Obligation. +Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (f_field_type)} {f_cvp_vote : both L2 I2 ('bool)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := + Build_t_CastVoteParam := + bind_both f_cvp_vote (fun f_cvp_vote => + bind_both f_cvp_xi (fun f_cvp_xi => + bind_both f_cvp_i (fun f_cvp_i => + solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_vote) : (t_CastVoteParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). Fail Next Obligation. +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := y)). -Definition t_RegisterParam : choice_type := - (int32 × int32). -Equations f_rp_i {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := +Definition t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := + (int32 × f_field_type). +Equations f_rp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (int32) := f_rp_i s := bind_both s (fun x => solve_lift (ret_both (fst x : int32))) : both L I (int32). Fail Next Obligation. -Equations f_rp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_RegisterParam)) : both L I (int32) := +Equations f_rp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (f_field_type) := f_rp_xi s := bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). + solve_lift (ret_both (snd x : f_field_type))) : both L I (f_field_type). Fail Next Obligation. -Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (int32)} : both (L0:|:L1) (I0:|:I1) (t_RegisterParam) := +Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (f_field_type)} : both (L0:|:L1) (I0:|:I1) (t_RegisterParam) := Build_t_RegisterParam := bind_both f_rp_xi (fun f_rp_xi => bind_both f_rp_i (fun f_rp_i => @@ -198,182 +190,220 @@ Fail Next Obligation. Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x)). Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y)). -Definition register_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState;1%nat). -Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := - register_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_RegisterParam) := matchb f_branch out with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result (t_Infallible) (t_ParseError))) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist1 := v_Break (f_from_residual residual) in - ControlFlow_Continue (solve_lift (never_to_any hoist1)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (t_RegisterParam)) in - ControlFlow_Continue (solve_lift val) - end in - ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in - letb zkp_xi := v_ZKP g_pow_xi (f_rp_xi params) in - letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. - -Definition t_CastVoteParam : choice_type := - (int32 × int32 × 'bool). -Equations f_cvp_i {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_i s := +Definition t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := + (f_group_type × f_field_type × f_field_type). +Equations f_u {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_group_type) := + f_u s := bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). + solve_lift (ret_both (fst (fst x) : f_group_type))) : both L I (f_group_type). Fail Next Obligation. -Equations f_cvp_xi {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_xi s := +Equations f_c {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := + f_c s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). + solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). Fail Next Obligation. -Equations f_cvp_vote {L : {fset Location}} {I : Interface} (s : both L I (t_CastVoteParam)) : both L I ('bool) := - f_cvp_vote s := +Equations f_z {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := + f_z s := bind_both s (fun x => - solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). + solve_lift (ret_both (snd x : f_field_type))) : both L I (f_field_type). Fail Next Obligation. -Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (int32)} {f_cvp_vote : both L2 I2 ('bool)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := - Build_t_CastVoteParam := - bind_both f_cvp_vote (fun f_cvp_vote => - bind_both f_cvp_xi (fun f_cvp_xi => - bind_both f_cvp_i (fun f_cvp_i => - solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_vote) : (t_CastVoteParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). +Equations Build_t_SchnorrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_u : both L0 I0 (f_group_type)} {f_c : both L1 I1 (f_field_type)} {f_z : both L2 I2 (f_field_type)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit) := + Build_t_SchnorrZKPCommit := + bind_both f_z (fun f_z => + bind_both f_c (fun f_c => + bind_both f_u (fun f_u => + solve_lift (ret_both ((f_u,f_c,f_z) : (t_SchnorrZKPCommit)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit). Fail Next Obligation. -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := y)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_u := y) (f_c := f_c x) (f_z := f_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_u := f_u x) (f_c := y) (f_z := f_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_u := f_u x) (f_c := f_c x) (f_z := y)). -Equations check_valid {L1 : {fset Location}} {I1 : Interface} (zkp : both L1 I1 (int32)) : both L1 I1 ('bool) := - check_valid zkp := - solve_lift (ret_both (true : 'bool)) : both L1 I1 ('bool). +Definition t_TallyParameter : choice_type := + 'unit. +Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := + Build_t_TallyParameter := + solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). Fail Next Obligation. -Definition prod1_loc : Location := - (int32;2%nat). -Definition prod2_loc : Location := - (int32;3%nat). -Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} (i : both L1 I1 (int32)) (xi : both L2 I2 (int32)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq int32 20)) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod1_loc;prod2_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32) := - compute_group_element_for_vote i xi vote xis := - letb prod1 loc(prod1_loc) := f_one (ret_both (tt : 'unit)) in - letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun j => - ssp (fun prod1 => - solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod1_loc;prod1_loc]) (I1:|:I4:|:I1) (int32))) prod1 in - letb prod2 loc(prod2_loc) := f_one (ret_both (tt : 'unit)) in - letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun j => - ssp (fun prod2 => - solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:fset [prod2_loc;prod2_loc]) (I1:|:I4:|:I1) (int32))) prod2 in - letb v_Yi := f_div prod1 prod2 in - solve_lift (f_prod (f_pow v_Yi xi) (f_g_pow (ifb vote - then ret_both (1 : int32) - else ret_both (0 : int32)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: fset [prod1_loc;prod2_loc;res_loc]) (I1 :|: I2 :|: I3 :|: I4) (int32). +Equations schnorr_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (g_pow_x : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z) (v_G)) := + schnorr_ZKP random g_pow_x x := + solve_lift (run (letb r := f_random_field_elem random in + letb u := f_g_pow r in + letb c := v_Hash (prod_b (f_g,g_pow_x,u)) in + letb z := f_add r (f_mul c x) in + letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z) (v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_u := u) (f_c := c) (f_z := z)) in + ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z) (v_G)). Fail Next Obligation. -Equations commit_to {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) : both L1 I1 (int32) := - commit_to x := - solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). +Equations schnorr_ZKP_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_x : both L1 I1 (f_group_type)) (pi : both L2 I2 (t_SchnorrZKPCommit (v_Z) (v_G))) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + schnorr_ZKP_validate g_pow_x pi := + solve_lift (andb ((f_c pi) =.? (v_Hash (prod_b (f_g,g_pow_x,f_u pi)))) ((f_g_pow (f_z pi)) =.? (f_prod (f_u pi) (f_pow g_pow_x (f_c pi))))) : both (L1 :|: L2) (I1 :|: I2) ('bool). Fail Next Obligation. -Definition commit_to_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState;4%nat). -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := - commit_to_vote ctx state := +Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := + (int32 × nseq f_group_type (is_pure (n)) × nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n)) × nseq int32 (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq int32 (is_pure (n)) × int32). +Equations f_zkp_random {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (int32) := + f_zkp_random s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst (fst x))))) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type (is_pure (n))) := + f_g_pow_xis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). +Fail Next Obligation. +Equations f_zkp_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n))) := + f_zkp_xis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n))))) : both L I (nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n))). +Fail Next Obligation. +Equations f_commit_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq int32 (is_pure (n))) := + f_commit_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : nseq int32 (is_pure (n))))) : both L I (nseq int32 (is_pure (n))). +Fail Next Obligation. +Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type (is_pure (n))) := + f_g_pow_xi_yi_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). +Fail Next Obligation. +Equations f_zkp_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq int32 (is_pure (n))) := + f_zkp_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : nseq int32 (is_pure (n))))) : both L I (nseq int32 (is_pure (n))). +Fail Next Obligation. +Equations f_tally {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (int32) := + f_tally s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_zkp_random : both L0 I0 (int32)} {f_g_pow_xis : both L1 I1 (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both L2 I2 (nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n)))} {f_commit_vis : both L3 I3 (nseq int32 (is_pure (n)))} {f_g_pow_xi_yi_vis : both L4 I4 (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both L5 I5 (nseq int32 (is_pure (n)))} {f_tally : both L6 I6 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6) (t_OvnContractState) := + Build_t_OvnContractState := + bind_both f_tally (fun f_tally => + bind_both f_zkp_vis (fun f_zkp_vis => + bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => + bind_both f_commit_vis (fun f_commit_vis => + bind_both f_zkp_xis (fun f_zkp_xis => + bind_both f_g_pow_xis (fun f_g_pow_xis => + bind_both f_zkp_random (fun f_zkp_random => + solve_lift (ret_both ((f_zkp_random,f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState)))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6) (t_OvnContractState). +Fail Next Obligation. +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_random' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := y) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). + +Definition cast_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));2%nat). +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := + cast_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb f_branch out with + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] (params:t_CastVoteParam (v_Z)) := matchb f_branch out with | ControlFlow_Break_case residual => letb residual := ret_both ((residual) : (t_Result (t_Infallible) (t_ParseError))) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist2 := v_Break (f_from_residual residual) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist2 := v_Break (f_from_residual residual) in ControlFlow_Continue (solve_lift (never_to_any hoist2)) | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (t_CastVoteParam)) in + letb val := ret_both ((val) : (t_CastVoteParam (v_Z))) in ControlFlow_Continue (solve_lift val) end in - ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (f_zkp_xis state)) (fun zkp => + ControlFlow_Continue (letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in + letb zkp_vi := v_ZKP_one_out_of_two g_pow_xi_yi_vi (f_cvp_vote params) in + letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). +Fail Next Obligation. + +Definition commit_to_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));3%nat). +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := + commit_to_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] (params:t_CastVoteParam (v_Z)) := matchb f_branch out with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result (t_Infallible) (t_ParseError))) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist3 := v_Break (f_from_residual residual) in + ControlFlow_Continue (solve_lift (never_to_any hoist3)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (t_CastVoteParam (v_Z))) in + ControlFlow_Continue (solve_lift val) + end in + ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => - letb _ := check_valid zkp in - solve_lift (ret_both (tt : 'unit)) : both (*0*)(L2:|:fset []) (I2) ('unit))) (ret_both (tt : 'unit)) in + solve_lift (ifb not (schnorr_ZKP_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist4 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist4) + else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*0*)(L2:|:fset []) (I2) (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in letb commit_vi := commit_to g_pow_xi_yi_vi in letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). Fail Next Obligation. -Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_vi : both L1 I1 (int32)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := - v_ZKP_one_out_of_two g_pow_vi vi := - solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). +Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {impl_108907986_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (impl_108907986_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasInitContext (impl_108907986_) ('unit)} (_ : both L1 I1 (impl_108907986_)) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)) := + init_ovn_contract _ := + Result_Ok (solve_lift (Build_t_OvnContractState (f_zkp_random := ret_both (0 : int32)) (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_u := f_group_one (ret_both (tt : 'unit))) (f_z := f_field_zero (ret_both (tt : 'unit))) (f_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (ret_both (0 : int32)) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (ret_both (0 : int32)) n) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)). Fail Next Obligation. -Definition cast_vote_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState;5%nat). -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := - cast_vote ctx state := +Definition register_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));4%nat). +Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := + register_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params:t_CastVoteParam) := matchb f_branch out with + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] (params:t_RegisterParam (v_Z)) := matchb f_branch out with | ControlFlow_Break_case residual => letb residual := ret_both ((residual) : (t_Result (t_Infallible) (t_ParseError))) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist3 := v_Break (f_from_residual residual) in - ControlFlow_Continue (solve_lift (never_to_any hoist3)) + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist5 := v_Break (f_from_residual residual) in + ControlFlow_Continue (solve_lift (never_to_any hoist5)) | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (t_CastVoteParam)) in + letb val := ret_both ((val) : (t_RegisterParam (v_Z))) in ControlFlow_Continue (solve_lift val) end in - ControlFlow_Continue (letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in - letb zkp_vi := v_ZKP_one_out_of_two g_pow_xi_yi_vi (f_cvp_vote params) in - letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc;res_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. - -Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - check_valid2 g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 (int32)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - check_commitment g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Definition t_TallyParameter : choice_type := - 'unit. -Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := - Build_t_TallyParameter := - solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). + ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in + letb zkp_xi := schnorr_ZKP (f_zkp_random state) g_pow_xi (f_rp_xi params) in + letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). Fail Next Obligation. -Definition tally_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := +Definition curr_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (f_field_type;5%nat). +Definition tally_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := (int32;6%nat). -Definition tally_votes_state_ret_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState;7%nat). -Definition vote_result_loc {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (int32;8%nat). -Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState)) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := +Definition tally_votes_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));7%nat). +Definition vote_result_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (f_group_type;8%nat). +Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := tally_votes _ state := letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => letb _ := check_valid2 ((f_g_pow_xi_yi_vis state).a[i]) ((f_zkp_vis state).a[i]) in letb _ := check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i]) in solve_lift (ret_both (tt : 'unit)) : both (*0*)(L2:|:fset []) (I2) ('unit))) (ret_both (tt : 'unit)) in - letb vote_result loc(vote_result_loc) := f_one (ret_both (tt : 'unit)) in + letb vote_result loc(vote_result_loc) := f_group_one (ret_both (tt : 'unit)) in letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => ssp (fun vote_result => - solve_lift (f_prod vote_result g_pow_vote) : both (*2*)(L2:|:L2:|:fset [vote_result_loc;vote_result_loc]) (I2:|:I2) (int32))) vote_result in + solve_lift (f_prod vote_result g_pow_vote) : both (*2*)(L2:|:L2:|:fset [vote_result_loc;vote_result_loc]) (I2:|:I2) (f_group_type))) vote_result in letb tally loc(tally_loc) := ret_both (0 : int32) in - letb tally := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => - ssp (fun tally => - solve_lift (ifb (f_g_pow i) =.? vote_result + letb curr loc(curr_loc) := f_field_zero (ret_both (tt : 'unit)) in + letb '(curr,tally) := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => + ssp (fun '(curr,tally) => + letb tally := ifb (f_g_pow curr) =.? vote_result then letb tally := i in tally - else tally) : both (*3*)(L2:|:fset [tally_loc;vote_result_loc;tally_loc]) (I2) (int32))) tally in + else tally in + letb curr := f_add curr (f_field_one (ret_both (tt : 'unit))) in + solve_lift (prod_b (curr,tally)) : both (*5*)(L2:|:fset [curr_loc;tally_loc;vote_result_loc;curr_loc;tally_loc]) (I2) ((f_field_type × int32)))) (prod_b (curr,tally)) in letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in - Result_Ok (solve_lift (prod_b (f_accept (ret_both (tt : 'unit)),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). + Result_Ok (solve_lift (prod_b (f_accept (ret_both (tt : 'unit)),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). Fail Next Obligation. (** Concert lib part **) @@ -395,18 +425,15 @@ Export ConCertLib. Definition state_OVN : choice_type := t_OvnContractState. -Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN) (t_ParseError) := - ResultMonad.Ok st. - -#[global] Program Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit := +#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. Fail Next Obligation. -#[global] Program Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam := +#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := fun x => x. Fail Next Obligation. -Definition receive_OVN_register {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_RegisterParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - register_vote ctx st. +Definition receive_OVN_cast_vote {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + cast_vote ctx st. #[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. @@ -415,18 +442,21 @@ Fail Next Obligation. fun x => x. Fail Next Obligation. -Definition receive_OVN_commit_to_vote {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := +Definition receive_OVN_commit_to_vote {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := commit_to_vote ctx st. -#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := +Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN) (t_ParseError) := + ResultMonad.Ok st. + +#[global] Program Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit := {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. Fail Next Obligation. -#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := +#[global] Program Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam := fun x => x. Fail Next Obligation. -Definition receive_OVN_cast_vote {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - cast_vote ctx st. +Definition receive_OVN_register {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_RegisterParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + register_vote ctx st. #[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. @@ -435,13 +465,13 @@ Fail Next Obligation. fun x => x. Fail Next Obligation. -Definition receive_OVN_tally {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_TallyParameter)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := +Definition receive_OVN_tally {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_TallyParameter)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := tally_votes ctx st. Inductive Msg_OVN: Type := -| msg_OVN_register : t_RegisterParam -> Msg_OVN -| msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN | msg_OVN_cast_vote : t_CastVoteParam -> Msg_OVN +| msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN +| msg_OVN_register : t_RegisterParam -> Msg_OVN | msg_OVN_tally : t_TallyParameter -> Msg_OVN. #[global] Program Instance state_OVN_t_HasReceiveContext : t_HasReceiveContext state_OVN 'unit := {| f_get := (fun (Ctx : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. @@ -456,8 +486,8 @@ Fail Next Obligation. Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := receive_OVN chain ctx st msg := match msg with - | Some (msg_OVN_register val) => - match (is_pure (both_prog (receive_OVN_register (ret_both val) (ret_both st)))) with + | Some (msg_OVN_cast_vote val) => + match (is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (ret_both st)))) with | inl x => ResultMonad.Ok ((fst x), []) | inr x => ResultMonad.Err x end @@ -466,8 +496,8 @@ Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OV | inl x => ResultMonad.Ok ((fst x), []) | inr x => ResultMonad.Err x end - | Some (msg_OVN_cast_vote val) => - match (is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (ret_both st)))) with + | Some (msg_OVN_register val) => + match (is_pure (both_prog (receive_OVN_register (ret_both val) (ret_both st)))) with | inl x => ResultMonad.Ok ((fst x), []) | inr x => ResultMonad.Err x end @@ -484,7 +514,7 @@ Fail Next Obligation. _. Fail Next Obligation. #[global] Program Instance Msg_OVN_Serializable : Serializable Msg_OVN := - Derive Serializable Msg_OVN_rect. + Derive Serializable Msg_OVN_rect. Fail Next Obligation. Definition contract_OVN : Contract (state_OVN) (Msg_OVN) (state_OVN) (t_ParseError) := build_contract init_OVN receive_OVN. diff --git a/ovn/src/ovn.rs b/ovn/src/ovn.rs index 868bbc1..c5501b9 100644 --- a/ovn/src/ovn.rs +++ b/ovn/src/ovn.rs @@ -86,13 +86,48 @@ const n: usize = 20; // use concordium_contracts_common::*; // extern crate concordium_std; +// use hacspec_sha256::*; + +/** TODO: Hash function */ +pub fn Hash((u,c,z) : (u32,u32,u32)) -> u32 { + 0 +} + +#[derive(Serialize, SchemaType, Clone, Copy)] +struct SchnorrZKPCommit { + u: /*G*/::group_type, + c: /*G*/::group_type, + z: /*G*/::group_type, +} + +/** Non-interactive Schnorr proof using Fiat-Shamir heuristics */ +// https://crypto.stanford.edu/cs355/19sp/lec5.pdf +pub fn schnorr_ZKP( + random : u32, + g_pow_x: /*G*/::group_type, + x: u32, +) -> SchnorrZKPCommit { + let r = random % G::q; // x_i \in_R Z_q;; + let u = G::g_pow(r); + let c = Hash((G::g,g_pow_x,u)); + let z = r + c * x; + + return SchnorrZKPCommit {u, c, z}; +} + +// https://crypto.stanford.edu/cs355/19sp/lec5.pdf +pub fn schnorr_ZKP_validate(g_pow_x: /*G*/::group_type, pi: SchnorrZKPCommit) -> bool { + pi.c == Hash((G::g, g_pow_x, pi.u)) && G::g_pow(pi.z) == pi.u * G::pow(g_pow_x, pi.c) +} #[hax::contract_state(contract = "OVN")] // #[cfg_attr(not(feature = "hax_compilation"), contract_state(contract = "OVN"))] #[derive(Serialize, SchemaType, Clone, Copy)] pub struct OvnContractState/* */ { + zkp_random : u32, + g_pow_xis: [/*G*/::group_type; n], - zkp_xis: [u32; n], + zkp_xis: [SchnorrZKPCommit; n], commit_vis: [u32; n], @@ -106,8 +141,10 @@ pub struct OvnContractState/* */ { // #[cfg_attr(not(feature = "hax_compilation"), init(contract = "OVN"))] pub fn init_ovn_contract(_: &impl HasInitContext) -> InitResult { Ok(OvnContractState { + zkp_random: 0, // TODO + g_pow_xis: [G::one(); n], - zkp_xis: [0; n], + zkp_xis: [SchnorrZKPCommit { u: 0, z: 0, c: 0 }; n], commit_vis: [0; n], @@ -123,11 +160,6 @@ pub fn select_private_voting_key/* */(random: u32) -> u32 { random % G::q // x_i \in_R Z_q; } -/** TODO: Non-interactive Schnorr proof using Fiat-Shamir heuristics */ -pub fn ZKP/* */(g_pow_xi: /*G*/::group_type, xi: u32) -> u32 { - 0 -} - #[derive(Serialize, SchemaType)] pub struct RegisterParam { rp_i: u32, @@ -143,7 +175,8 @@ pub fn register_vote( ) -> Result<(A, OvnContractState/* */), ParseError> { let params : RegisterParam = ctx.parameter_cursor().get()?; let g_pow_xi = G::g_pow(params.rp_xi); - let zkp_xi = ZKP/* :: */(g_pow_xi, params.rp_xi); + + let zkp_xi = schnorr_ZKP/* :: */(state.zkp_random, g_pow_xi, params.rp_xi); let mut register_vote_state_ret = state.clone(); register_vote_state_ret.g_pow_xis[params.rp_i as usize] = g_pow_xi; @@ -159,10 +192,6 @@ pub struct CastVoteParam { cvp_vote: bool, } -pub fn check_valid(zkp: u32) -> bool { - true -} - pub fn compute_group_element_for_vote/* */( i: u32, xi: u32, @@ -194,9 +223,11 @@ pub fn commit_to_vote( state: OvnContractState/* */, ) -> Result<(A, OvnContractState/* */), ParseError> { let params: CastVoteParam = ctx.parameter_cursor().get()?; - for zkp in state.zkp_xis { - check_valid(zkp); - () + + for i in 0..n { + if !schnorr_ZKP_validate(state.g_pow_xis[i], state.zkp_xis[i]) { + return Err(ParseError { }); + } } let g_pow_xi_yi_vi = @@ -274,59 +305,59 @@ pub fn tally_votes( Ok((A::accept(), tally_votes_state_ret)) } -// #[cfg(test)] -// #[concordium_test] -// pub fn test_correctness() { -// let randomness : Vec = Vec::new(); -// let votes : Vec = Vec::new(); +#[cfg(test)] +#[concordium_test] +pub fn test_correctness() { + let randomness : Vec = Vec::new(); + let votes : Vec = Vec::new(); -// // Setup the context -// let mut ctx = InitContextTest::empty(); -// // ctx.set_sender(ADDRESS_0); + // Setup the context + let mut ctx = InitContextTest::empty(); + // ctx.set_sender(ADDRESS_0); -// let mut state = init_ovn_contract(); + let mut state = init_ovn_contract(); -// let xis = Vec::new(); -// for i in 0..n { -// xis.push(select_private_voting_key::(randomness[i])); -// } + let xis = Vec::new(); + for i in 0..n { + xis.push(select_private_voting_key::(randomness[i])); + } -// for i in 0..n { -// let parameter = RegisterParam { i, xi: xis[i] }; -// let parameter_bytes = to_bytes(¶meter); -// ctx.set_parameter(¶meter_bytes); + for i in 0..n { + let parameter = RegisterParam { rp_i: i, rp_xi: xis[i] }; + let parameter_bytes = to_bytes(¶meter); + ctx.set_parameter(¶meter_bytes); -// register_vote(ctx, state); -// } + register_vote(ctx, state); + } -// for i in 0..n { -// let parameter = CastVoteParam { i, xi: xis[i], vote: votes[i] }; -// let parameter_bytes = to_bytes(¶meter); -// ctx.set_parameter(¶meter_bytes); + for i in 0..n { + let parameter = CastVoteParam { cvp_i: i, cvp_xi: xis[i], cvp_vote: votes[i] }; + let parameter_bytes = to_bytes(¶meter); + ctx.set_parameter(¶meter_bytes); -// commit_to_vote(ctx, state); -// } + commit_to_vote(ctx, state); + } -// for i in 0..n { -// let parameter = CastVoteParam { i, xi: xis[i], vote: votes[i] }; -// let parameter_bytes = to_bytes(¶meter); -// ctx.set_parameter(¶meter_bytes); + for i in 0..n { + let parameter = CastVoteParam { cvp_i: i, cvp_xi: xis[i], cvp_vote: votes[i] }; + let parameter_bytes = to_bytes(¶meter); + ctx.set_parameter(¶meter_bytes); -// cast_vote(ctx, state); -// } + cast_vote(ctx, state); + } -// let parameter = TallyParameter {}; -// let parameter_bytes = to_bytes(¶meter); -// ctx.set_parameter(¶meter_bytes); + let parameter = TallyParameter {}; + let parameter_bytes = to_bytes(¶meter); + ctx.set_parameter(¶meter_bytes); -// tally_votes(ctx, state); + tally_votes(ctx, state); -// let mut count = 0; -// for v in votes { -// if v { -// count = count + 1; // += 1 does not work correctly -// } -// } + let mut count = 0; + for v in votes { + if v { + count = count + 1; // += 1 does not work correctly + } + } -// claim_eq!(state.tally, count, "The tally should equal the number of positive votes"); -// } + claim_eq!(state.tally, count, "The tally should equal the number of positive votes"); +} diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs new file mode 100644 index 0000000..f455306 --- /dev/null +++ b/ovn/src/ovn_group.rs @@ -0,0 +1,350 @@ +#![no_std] +#![feature(register_tool)] +#![register_tool(hax)] + +#[hax_lib_macros::exclude] +extern crate hax_lib_macros; +#[hax_lib_macros::exclude] +use hax_lib_macros::*; + +#[exclude] +use hacspec_concordium::*; +#[exclude] +use hacspec_concordium_derive::*; + +use hacspec_bls12_381::*; + +pub trait Z_Field : core::marker::Copy { + type field_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; + + const q : usize; + + fn random_field_elem(random : u32) -> Self::field_type; + + fn field_zero() -> Self::field_type; + fn field_one() -> Self::field_type; + + fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type; + fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type; +} + +/** Interface for group implementation */ +pub trait Group : core::marker::Copy { + type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; + + const g: Self::group_type; // Generator (elemnent of group) + + fn random_group_elem(random : u32) -> Self::group_type; + + fn g_pow(x: Z::field_type) -> Self::group_type; + fn pow(g: Self::group_type, x: Z::field_type) -> Self::group_type; // TODO: Link with q + fn group_one() -> Self::group_type; + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type; + fn inv(x: Self::group_type) -> Self::group_type; + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; +} + +// struct eligible_votes { +// v_id : u32, +// } + +// /** number of parties */ +// const n : u32 = 3u32; +// const P : [eligible_votes; 3] = // n = 3 +// [eligible_votes {v_id: 0}, +// eligible_votes {v_id: 1}, +// eligible_votes {v_id: 2}]; + +// use concordium_contracts_common::*; +// extern crate concordium_std; + +// use hacspec_sha256::*; + +/** TODO: Hash function */ +pub fn Hash>(v : (G::group_type, G::group_type, G::group_type)) -> Z::field_type { + let (a, b, c) = v; + Z::field_one() +} + +#[derive(Serialize, SchemaType, Clone, Copy)] +struct SchnorrZKPCommit> { + u: G::group_type, + c: Z::field_type, + z: Z::field_type, +} + +/** Non-interactive Schnorr proof using Fiat-Shamir heuristics */ +// https://crypto.stanford.edu/cs355/19sp/lec5.pdf +pub fn schnorr_ZKP>(random: u32, g_pow_x: G::group_type, x: Z::field_type) -> SchnorrZKPCommit { + let r = Z::random_field_elem(random); + let u = G::g_pow(r); + let c = Hash::((G::g, g_pow_x, u)); + let z = Z::add(r , Z::mul(c , x) ); + + return SchnorrZKPCommit { u, c, z }; +} + +// https://crypto.stanford.edu/cs355/19sp/lec5.pdf +pub fn schnorr_ZKP_validate>(g_pow_x: G::group_type, pi: SchnorrZKPCommit) -> bool { + pi.c == Hash::((G::g, g_pow_x, pi.u)) && G::g_pow(pi.z) == G::prod(pi.u , G::pow(g_pow_x, pi.c)) +} + +#[hax::contract_state(contract = "OVN")] +// #[cfg_attr(not(feature = "hax_compilation"), contract_state(contract = "OVN"))] +#[derive(Serialize, SchemaType, Clone, Copy)] +pub struct OvnContractState, const n: usize> { + zkp_random: u32, + + g_pow_xis: [G::group_type; n], + zkp_xis: [SchnorrZKPCommit; n], + + commit_vis: [u32; n], + + g_pow_xi_yi_vis: [G::group_type; n], + zkp_vis: [u32; n], + + tally: u32, +} + +#[hax::init(contract = "OVN")] +// #[cfg_attr(not(feature = "hax_compilation"), init(contract = "OVN"))] +pub fn init_ovn_contract, const n: usize>( + _: &impl HasInitContext, +) -> InitResult> { + Ok(OvnContractState:: { + zkp_random: 0, // TODO + + g_pow_xis: [G::group_one(); n], + zkp_xis: [SchnorrZKPCommit:: { u: G::group_one(), z: Z::field_zero(), c: Z::field_zero() }; n], + + commit_vis: [0; n], + + g_pow_xi_yi_vis: [G::group_one(); n], + zkp_vis: [0; n], + + tally: 0, + }) +} + +/** Currently randomness needs to be injected */ +pub fn select_private_voting_key>(random: u32) -> G::group_type { + G::random_group_elem(random) // x_i \in_R Z_q; +} + +#[derive(Serialize, SchemaType)] +pub struct RegisterParam { + rp_i: u32, + rp_xi: Z::field_type, +} + +/** Primary function in round 1 */ +#[hax::receive(contract = "OVN", name = "register", parameter = "RegisterParam")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "register", parameter = "RegisterParam"))] +pub fn register_vote, const n : usize, A: HasActions>( + ctx: &impl HasReceiveContext, + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { + let params: RegisterParam = ctx.parameter_cursor().get()?; + let g_pow_xi = G::g_pow(params.rp_xi); + + let zkp_xi = schnorr_ZKP::(state.zkp_random, g_pow_xi, params.rp_xi); + + let mut register_vote_state_ret = state.clone(); + register_vote_state_ret.g_pow_xis[params.rp_i as usize] = g_pow_xi; + register_vote_state_ret.zkp_xis[params.rp_i as usize] = zkp_xi; + + Ok((A::accept(), register_vote_state_ret)) +} + +#[derive(Serialize, SchemaType)] +pub struct CastVoteParam { + cvp_i: u32, + cvp_xi: Z::field_type, + cvp_vote: bool, +} + +pub fn compute_group_element_for_vote, const n: usize>( + i: u32, + xi: Z::field_type, + vote: bool, + xis: [G::group_type; n], +) -> G::group_type { + let mut prod1 = G::group_one(); + for j in 0..(i - 1) as usize { + prod1 = G::prod(prod1, xis[j]); + } + let mut prod2 = G::group_one(); + for j in (i + 1) as usize..n { + prod2 = G::prod(prod2, xis[j]); + } + let Yi = G::div(prod1, prod2); + // implicityly: Y_i = g^y_i + G::prod(G::pow(Yi, xi), G::g_pow(if vote { Z::field_one() } else { Z::field_zero() })) +} + +pub fn commit_to>(x: G::group_type) -> u32 { + 0 +} + +/** Commitment before round 2 */ +#[hax::receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam"))] +pub fn commit_to_vote, const n : usize, A: HasActions>( + ctx: &impl HasReceiveContext, + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { + let params: CastVoteParam = ctx.parameter_cursor().get()?; + + for i in 0..n { + if !schnorr_ZKP_validate(state.g_pow_xis[i], state.zkp_xis[i]) { + return Err(ParseError {}); + } + } + + let g_pow_xi_yi_vi = compute_group_element_for_vote::(params.cvp_i, params.cvp_xi, params.cvp_vote, state.g_pow_xis); + let commit_vi = commit_to::(g_pow_xi_yi_vi); + + let mut commit_to_vote_state_ret = state.clone(); + commit_to_vote_state_ret.commit_vis[params.cvp_i as usize] = commit_vi; + Ok((A::accept(), commit_to_vote_state_ret)) +} + +/** Cramer, Damgård and Schoenmakers (CDS) technique */ +pub fn ZKP_one_out_of_two>(g_pow_vi: G::group_type, vi: bool) -> u32 { + 32 // TODO +} + +/** Primary function in round 2, also opens commitment */ +#[hax::receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam"))] +pub fn cast_vote, const n : usize, A: HasActions>( + ctx: &impl HasReceiveContext, + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { + let params: CastVoteParam = ctx.parameter_cursor().get()?; + + let g_pow_xi_yi_vi = compute_group_element_for_vote::(params.cvp_i, params.cvp_xi, params.cvp_vote, state.g_pow_xis); + let zkp_vi = ZKP_one_out_of_two::(g_pow_xi_yi_vi, params.cvp_vote); + + let mut cast_vote_state_ret = state.clone(); + cast_vote_state_ret.g_pow_xi_yi_vis[params.cvp_i as usize] = g_pow_xi_yi_vi; + cast_vote_state_ret.zkp_vis[params.cvp_i as usize] = zkp_vi; + + Ok((A::accept(), cast_vote_state_ret)) +} + +pub fn check_valid2>(g_pow_xi_yi_vi: G::group_type, zkp: u32) -> bool { + true +} + +pub fn check_commitment>(g_pow_xi_yi_vi: G::group_type, zkp: u32) -> bool { + true +} + +pub struct TallyParameter {} +#[hax::receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "tally", parameter = "TallyParameter"))] +/** Anyone can tally the votes */ +pub fn tally_votes, const n : usize, A: HasActions>( + _: &impl HasReceiveContext, + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { + for i in 0..n { + check_valid2::(state.g_pow_xi_yi_vis[i], state.zkp_vis[i]); + check_commitment::(state.g_pow_xi_yi_vis[i], state.commit_vis[i]); + () + } + + let mut vote_result = G::group_one(); + for g_pow_vote in state.g_pow_xi_yi_vis { + vote_result = G::prod(vote_result, g_pow_vote); + } + + let mut tally = 0; + let mut curr = Z::field_zero(); + for i in 0..n as u32 { + // Should be while, but is bounded by n anyways! + if G::g_pow(curr) == vote_result { + tally = i; + } + + curr = Z::add(curr, Z::field_one()); + } + + let mut tally_votes_state_ret = state.clone(); + tally_votes_state_ret.tally = tally; + + Ok((A::accept(), tally_votes_state_ret)) +} + +#[cfg(test)] +#[concordium_test] +pub fn test_correctness>() { + let randomness: Vec = Vec::new(); + let votes: Vec = Vec::new(); + + // Setup the context + let mut ctx = InitContextTest::empty(); + // ctx.set_sender(ADDRESS_0); + + let mut state = init_ovn_contract(); + + let xis = Vec::new(); + for i in 0..n { + xis.push(select_private_voting_key::(randomness[i])); + } + + for i in 0..n { + let parameter = RegisterParam { + rp_i: i, + rp_xi: xis[i], + }; + let parameter_bytes = to_bytes(¶meter); + ctx.set_parameter(¶meter_bytes); + + register_vote(ctx, state); + } + + for i in 0..n { + let parameter = CastVoteParam:: { + cvp_i: i, + cvp_xi: xis[i], + cvp_vote: votes[i], + }; + let parameter_bytes = to_bytes(¶meter); + ctx.set_parameter(¶meter_bytes); + + commit_to_vote(ctx, state); + } + + for i in 0..n { + let parameter = CastVoteParam:: { + cvp_i: i, + cvp_xi: xis[i], + cvp_vote: votes[i], + }; + let parameter_bytes = to_bytes(¶meter); + ctx.set_parameter(¶meter_bytes); + + cast_vote(ctx, state); + } + + let parameter = TallyParameter {}; + let parameter_bytes = to_bytes(¶meter); + ctx.set_parameter(¶meter_bytes); + + tally_votes(ctx, state); + + let mut count = 0; + for v in votes { + if v { + count = count + 1; // += 1 does not work correctly + } + } + + claim_eq!( + state.tally, + count, + "The tally should equal the number of positive votes" + ); +} From ec0b459125707ee33977e8051a03e56898909881 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Mon, 22 Jan 2024 17:31:37 +0100 Subject: [PATCH 39/86] WIP, full OVN artifact --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 97d3f3b..8073b07 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -138,7 +138,7 @@ Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Loca solve_lift (f_prod (f_pow v_Yi xi) (f_g_pow (ifb vote then f_field_one (ret_both (tt : 'unit)) else f_field_zero (ret_both (tt : 'unit))))) : both (L1 :|: L2 :|: L3 :|: L4 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2 :|: I3 :|: I4) (f_group_type). -Solve All Obligations with ( (solve_ssprove_obligations ; now (rewrite !fset0E ; apply (ret_both 0))) || (destruct from_uint_size ; easy)). +Solve All Obligations with ( solve_ssprove_obligations ; ((now (rewrite !fset0E ; apply (ret_both 0))) || (now destruct from_uint_size))). Fail Next Obligation. Definition t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := From b3a569affb638eff151869e9eef487cad204fa3e Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Mon, 22 Jan 2024 17:34:43 +0100 Subject: [PATCH 40/86] WIP, full OVN artifact --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 8073b07..eb8d4c8 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -225,14 +225,14 @@ Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) : solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). Fail Next Obligation. -Equations schnorr_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (g_pow_x : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z) (v_G)) := +Equations schnorr_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (g_pow_x : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := schnorr_ZKP random g_pow_x x := solve_lift (run (letb r := f_random_field_elem random in letb u := f_g_pow r in letb c := v_Hash (prod_b (f_g,g_pow_x,u)) in letb z := f_add r (f_mul c x) in - letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z) (v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_u := u) (f_c := c) (f_z := z)) in - ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z) (v_G)). + letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_u := u) (f_c := c) (f_z := z)) in + ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). Fail Next Obligation. Equations schnorr_ZKP_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_x : both L1 I1 (f_group_type)) (pi : both L2 I2 (t_SchnorrZKPCommit (v_Z) (v_G))) : both (L1 :|: L2) (I1 :|: I2) ('bool) := From c58b1df8705b19782912a6d10796c2ebd20d178c Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 24 Jan 2024 17:17:13 +0100 Subject: [PATCH 41/86] ZKPs --- ovn/Cargo.toml | 2 + ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 157 +++-- .../ssprove/extraction/Hacspec_ovn_by_hand.v | 594 ++++++++++++++++++ ovn/src/ovn_group.rs | 157 +++-- ovn/src/ovn_group_instantiated.rs | 66 ++ 5 files changed, 889 insertions(+), 87 deletions(-) create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v create mode 100644 ovn/src/ovn_group_instantiated.rs diff --git a/ovn/Cargo.toml b/ovn/Cargo.toml index d3e8fcb..efc45a1 100644 --- a/ovn/Cargo.toml +++ b/ovn/Cargo.toml @@ -10,6 +10,8 @@ path = "src/ovn_group.rs" [dependencies] # hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } hax-lib-macros = { path = "../../hacspec-v2/hax-lib-macros/" } +hacspec-bls12-381 = { path = "../bls12-381/" } +hacspec-bls12-381-hash = { path = "../bls12-381-hash/" } # hax-lib-macros = { git = "https://github.com/hacspec/hacspec-v2.git" } # creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "1cca2320e262b2ec9d28b3c84cba759c96829898" } # branch = master # concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850" , version = "=2.0.0" , default-features = false } # 0cffb859f736ff6726fa38600428a415d800d7b6 diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index eb8d4c8..25ed8da 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -225,59 +225,59 @@ Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) : solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). Fail Next Obligation. -Equations schnorr_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (g_pow_x : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := +Equations schnorr_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (g_pow_x : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_field_one_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := schnorr_ZKP random g_pow_x x := solve_lift (run (letb r := f_random_field_elem random in letb u := f_g_pow r in letb c := v_Hash (prod_b (f_g,g_pow_x,u)) in letb z := f_add r (f_mul c x) in letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_u := u) (f_c := c) (f_z := z)) in - ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). + ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_field_one_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). Fail Next Obligation. -Equations schnorr_ZKP_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_x : both L1 I1 (f_group_type)) (pi : both L2 I2 (t_SchnorrZKPCommit (v_Z) (v_G))) : both (L1 :|: L2) (I1 :|: I2) ('bool) := +Equations schnorr_ZKP_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_x : both L1 I1 (f_group_type)) (pi : both L2 I2 (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 :|: f_g_pow_loc :|: f_pow_loc :|: f_prod_loc :|: f_field_one_loc) (I1 :|: I2) ('bool) := schnorr_ZKP_validate g_pow_x pi := - solve_lift (andb ((f_c pi) =.? (v_Hash (prod_b (f_g,g_pow_x,f_u pi)))) ((f_g_pow (f_z pi)) =.? (f_prod (f_u pi) (f_pow g_pow_x (f_c pi))))) : both (L1 :|: L2) (I1 :|: I2) ('bool). + solve_lift (andb ((f_c pi) =.? (v_Hash (prod_b (f_g,g_pow_x,f_u pi)))) ((f_g_pow (f_z pi)) =.? (f_prod (f_u pi) (f_pow g_pow_x (f_c pi))))) : both (L1 :|: L2 :|: f_g_pow_loc :|: f_pow_loc :|: f_prod_loc :|: f_field_one_loc) (I1 :|: I2) ('bool). Fail Next Obligation. Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := - (int32 × nseq f_group_type (is_pure (n)) × nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n)) × nseq int32 (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq int32 (is_pure (n)) × int32). -Equations f_zkp_random {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (int32) := + (int32 × nseq f_group_type (is_pure (n)) × nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × nseq int32 (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq int32 (is_pure (n)) × int32). +Equations f_zkp_random {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (int32) := f_zkp_random s := bind_both s (fun x => solve_lift (ret_both (fst (fst (fst (fst (fst (fst x))))) : int32))) : both L I (int32). Fail Next Obligation. -Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type (is_pure (n))) := +Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq f_group_type (is_pure (n))) := f_g_pow_xis s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). Fail Next Obligation. -Equations f_zkp_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n))) := +Equations f_zkp_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := f_zkp_xis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n))))) : both L I (nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n))). + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both L I (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). Fail Next Obligation. -Equations f_commit_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq int32 (is_pure (n))) := +Equations f_commit_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq int32 (is_pure (n))) := f_commit_vis s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst x))) : nseq int32 (is_pure (n))))) : both L I (nseq int32 (is_pure (n))). Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type (is_pure (n))) := +Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq f_group_type (is_pure (n))) := f_g_pow_xi_yi_vis s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). Fail Next Obligation. -Equations f_zkp_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq int32 (is_pure (n))) := +Equations f_zkp_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq int32 (is_pure (n))) := f_zkp_vis s := bind_both s (fun x => solve_lift (ret_both (snd (fst x) : nseq int32 (is_pure (n))))) : both L I (nseq int32 (is_pure (n))). Fail Next Obligation. -Equations f_tally {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (int32) := +Equations f_tally {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (int32) := f_tally s := bind_both s (fun x => solve_lift (ret_both (snd x : int32))) : both L I (int32). Fail Next Obligation. -Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_zkp_random : both L0 I0 (int32)} {f_g_pow_xis : both L1 I1 (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both L2 I2 (nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n)))} {f_commit_vis : both L3 I3 (nseq int32 (is_pure (n)))} {f_g_pow_xi_yi_vis : both L4 I4 (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both L5 I5 (nseq int32 (is_pure (n)))} {f_tally : both L6 I6 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6) (t_OvnContractState) := +Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_zkp_random : both L0 I0 (int32)} {f_g_pow_xis : both L1 I1 (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both L2 I2 (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_commit_vis : both L3 I3 (nseq int32 (is_pure (n)))} {f_g_pow_xi_yi_vis : both L4 I4 (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both L5 I5 (nseq int32 (is_pure (n)))} {f_tally : both L6 I6 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6) (t_OvnContractState (n := n)) := Build_t_OvnContractState := bind_both f_tally (fun f_tally => bind_both f_zkp_vis (fun f_zkp_vis => @@ -297,17 +297,19 @@ Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (B Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). Definition cast_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));2%nat). -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := + (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *);2%nat). + +Obligation Tactic := Tactics.program_simpl ; intros. (* (Tactics.program_simpl; fail). *) +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := cast_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] (params:t_CastVoteParam (v_Z)) := matchb f_branch out with + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params:t_CastVoteParam (v_Z)) := matchb f_branch out with | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result (t_Infallible) (t_ParseError))) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist2 := v_Break (f_from_residual residual) in + letb residual := ret_both ((residual) : t_ParseError (* (t_Result (t_Infallible) (t_ParseError)) *)) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist2 := v_Break (f_from_residual residual) in ControlFlow_Continue (solve_lift (never_to_any hoist2)) | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (t_CastVoteParam (v_Z))) in + letb val := ret_both ((val) (* : (t_CastVoteParam (v_Z := v_Z)) *)) in ControlFlow_Continue (solve_lift val) end in ControlFlow_Continue (letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in @@ -315,41 +317,124 @@ Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interfac letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). +Next Obligation. + solve_ssprove_obligations. +Qed. +Next Obligation. + solve_ssprove_obligations. +Qed. +Next Obligation. + solve_ssprove_obligations. +Qed. +Next Obligation. + unfold cast_vote_obligations_obligation_3. + unfold cast_vote_obligations_obligation_4. + normalize_fset. + split_fsubset_lhs. + now solve_single_fset_fsubset. + normalize_fset. + now solve_single_fset_fsubset. + now solve_single_fset_fsubset. + now solve_single_fset_fsubset. + now solve_single_fset_fsubset. + now solve_single_fset_fsubset. + now solve_single_fset_fsubset. + now solve_single_fset_fsubset. + now solve_single_fset_fsubset. + now solve_single_fset_fsubset. + now solve_single_fset_fsubset. + now solve_single_fset_fsubset. + now solve_single_fset_fsubset. + now solve_single_fset_fsubset. + now solve_single_fset_fsubset. + solve_ssprove_obligations. +Qed. Fail Next Obligation. +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. Definition commit_to_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));3%nat). -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := + (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *);3%nat). + +Obligation Tactic := (Tactics.program_simpl; fail). +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := commit_to_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] (params:t_CastVoteParam (v_Z)) := matchb f_branch out with + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params:t_CastVoteParam (v_Z)) := matchb f_branch out with | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result (t_Infallible) (t_ParseError))) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist3 := v_Break (f_from_residual residual) in + letb residual := ret_both ((residual) : t_ParseError (* (t_Result (t_Infallible) (t_ParseError)) *)) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist3 := v_Break (f_from_residual residual) in ControlFlow_Continue (solve_lift (never_to_any hoist3)) | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (t_CastVoteParam (v_Z))) in + letb val := ret_both ((val) (* : (t_CastVoteParam (v_Z)) *)) in ControlFlow_Continue (solve_lift val) end in ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => - solve_lift (ifb not (schnorr_ZKP_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist4 := v_Break (Result_Err ParseError) in + solve_lift (ifb negb (schnorr_ZKP_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist4 := v_Break (Result_Err (solve_lift ret_both (tt : 'unit))) (* (Result_Err ParseError) *) in ControlFlow_Continue (never_to_any hoist4) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*0*)(L2:|:fset []) (I2) (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in + else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*0*)(L2:|:fset []) (I2) ((* t_ControlFlow *) _ (* (t_Result (* ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) *) _ (t_ParseError)) *) ('unit)))) (Result_Ok (ret_both (tt : 'unit))) in letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in letb commit_vi := commit_to g_pow_xi_yi_vi in letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). Fail Next Obligation. - -Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {impl_108907986_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (impl_108907986_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasInitContext (impl_108907986_) ('unit)} (_ : both L1 I1 (impl_108907986_)) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)) := +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Obligation Tactic := intros. +Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {impl_108907986_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (impl_108907986_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasInitContext (impl_108907986_) ('unit)} (_ : both L1 I1 (impl_108907986_)) : both (L1 :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *)) (t_Reject)) := init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_zkp_random := ret_both (0 : int32)) (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_u := f_group_one (ret_both (tt : 'unit))) (f_z := f_field_zero (ret_both (tt : 'unit))) (f_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (ret_both (0 : int32)) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (ret_both (0 : int32)) n) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)). -Fail Next Obligation. - + Result_Ok (solve_lift (Build_t_OvnContractState (f_zkp_random := ret_both (0 : int32)) (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_u := f_group_one (ret_both (tt : 'unit))) (f_z := f_field_zero (ret_both (tt : 'unit))) (f_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (ret_both (0 : int32)) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (ret_both (0 : int32)) n) (f_tally := ret_both (0 : int32)))) : both (L1 :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *)) (t_Reject)). +Next Obligation. + solve_ssprove_obligations. +Qed. +Next Obligation. + solve_ssprove_obligations. +Qed. +Next Obligation. + solve_ssprove_obligations. +Qed. +Next Obligation. + simpl. + unfold cast_vote_obligations_obligation_3. + normalize_fset. + simpl. + destruct H5. + destruct H4. + split_fsubset_lhs. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + now solve_single_fset_fsubset. + solve_single_fset_fsubset. + now solve_single_fset_fsubset. + now solve_single_fset_fsubset. + + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + unfold cast_vote_obligations_obligation_3. + solve_single_fset_fsubset. + + + solve_ssprove_obligations. +Qed. +Fail Next Obligation. +lia Definition register_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));4%nat). Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v new file mode 100644 index 0000000..05bb53a --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v @@ -0,0 +1,594 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Class t_Z_Field (Self : choice_type) := { + f_field_type : choice_type ; + f_field_type_t_Serialize :> t_Serialize (f_field_type) ; + f_field_type_t_Deserial :> t_Deserial (f_field_type) ; + f_field_type_t_Serial :> t_Serial (f_field_type) ; + f_field_type_t_Copy :> t_Copy (f_field_type) ; + f_field_type_t_Clone :> t_Clone (f_field_type) ; + f_field_type_t_Eq :> t_Eq (f_field_type) ; + f_field_type_t_PartialEq :> t_PartialEq (f_field_type) ; + f_field_type_t_Sized :> t_Sized (f_field_type) ; + f_q : forall {L1 I1}, both L1 I1 (uint_size) ; + f_random_field_elem_loc : {fset Location} ; + f_random_field_elem : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_random_field_elem_loc) I1 (f_field_type) ; + f_field_zero_loc : {fset Location} ; + f_field_zero : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_field_zero_loc) I1 (f_field_type) ; + f_field_one_loc : {fset Location} ; + f_field_one : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_field_one_loc) I1 (f_field_type) ; + f_add_loc : {fset Location} ; + f_add : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_add_loc) (I1 :|: I2) (f_field_type) ; + f_mul_loc : {fset Location} ; + f_mul : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_mul_loc) (I1 :|: I2) (f_field_type) ; +}. +Hint Unfold f_random_field_elem_loc. +Hint Unfold f_field_zero_loc. +Hint Unfold f_field_one_loc. +Hint Unfold f_add_loc. +Hint Unfold f_mul_loc. + +Class t_Group (Self : choice_type) `{t_Z_Field} := { + f_group_type : choice_type ; + f_group_type_t_Serialize :> t_Serialize (f_group_type) ; + f_group_type_t_Deserial :> t_Deserial (f_group_type) ; + f_group_type_t_Serial :> t_Serial (f_group_type) ; + f_group_type_t_Copy :> t_Copy (f_group_type) ; + f_group_type_t_Clone :> t_Clone (f_group_type) ; + f_group_type_t_Eq :> t_Eq (f_group_type) ; + f_group_type_t_PartialEq :> t_PartialEq (f_group_type) ; + f_group_type_t_Sized :> t_Sized (f_group_type) ; + f_g : forall {L1 I1}, both L1 I1 (f_group_type) ; + f_random_group_elem_loc : {fset Location} ; + f_random_group_elem : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_random_group_elem_loc) I1 (f_group_type) ; + f_g_pow_loc : {fset Location} ; + f_g_pow : forall {L1 I1}, both L1 I1 (f_field_type) -> both (L1 :|: f_g_pow_loc) I1 (f_group_type) ; + f_pow_loc : {fset Location} ; + f_pow : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_pow_loc) (I1 :|: I2) (f_group_type) ; + f_group_one_loc : {fset Location} ; + f_group_one : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_group_one_loc) I1 (f_group_type) ; + f_prod_loc : {fset Location} ; + f_prod : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_prod_loc) (I1 :|: I2) (f_group_type) ; + f_inv_loc : {fset Location} ; + f_inv : forall {L1 I1}, both L1 I1 (f_group_type) -> both (L1 :|: f_inv_loc) I1 (f_group_type) ; + f_div_loc : {fset Location} ; + f_div : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_div_loc) (I1 :|: I2) (f_group_type) ; +}. +Hint Unfold f_random_group_elem_loc. +Hint Unfold f_g_pow_loc. +Hint Unfold f_pow_loc. +Hint Unfold f_group_one_loc. +Hint Unfold f_prod_loc. +Hint Unfold f_inv_loc. +Hint Unfold f_div_loc. + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +Equations v_Hash {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (v : both L1 I1 ((f_group_type × f_group_type × f_group_type))) : both ((f_field_one_loc :|: L1) : {fset Location}) I1 (f_field_type) := + v_Hash v := + solve_lift (f_field_one (ret_both (tt : 'unit))) : both (f_field_one_loc :|: L1) I1 (f_field_type). +Fail Next Obligation. + +Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_vi : both L1 I1 (f_group_type)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := + v_ZKP_one_out_of_two g_pow_vi vi := + solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). +Fail Next Obligation. + +Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + check_commitment g_pow_xi_yi_vi zkp := + solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + check_valid2 g_pow_xi_yi_vi zkp := + solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Equations commit_to {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (x : both L1 I1 (f_group_type)) : both L1 I1 (int32) := + commit_to x := + solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). +Fail Next Obligation. + +Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) : both (f_random_group_elem_loc :|: L1) I1 (f_group_type) := + select_private_voting_key random := + solve_lift (f_random_group_elem random) : both (f_random_group_elem_loc :|: L1) I1 (f_group_type). +Fail Next Obligation. + +Definition prod1_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := + (f_group_type;0%nat). +Definition prod2_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := + (f_group_type;1%nat). +Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both L1 I1 (int32)) (xi : both L2 I2 (f_field_type)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq f_group_type (is_pure (n)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc (n:=n);prod2_loc (n:=n)]) (I1 :|: I2 :|: I3 :|: I4) (f_group_type) := + compute_group_element_for_vote i xi vote xis := + letb prod1 loc(prod1_loc) := f_group_one (ret_both (tt : 'unit)) in + letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun j => + ssp (fun prod1 => + solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc:|:fset [prod1_loc;prod1_loc]) (I1:|:I4:|:I1) (f_group_type))) prod1 in + letb prod2 loc(prod2_loc) := f_group_one (ret_both (tt : 'unit)) in + letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun j => + ssp (fun prod2 => + solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc:|:fset [prod2_loc;prod2_loc]) (I1:|:I4:|:I1) (f_group_type))) prod2 in + letb v_Yi := f_div prod1 prod2 in + solve_lift (f_prod (f_pow v_Yi xi) (f_g_pow (ifb vote + then f_field_one (ret_both (tt : 'unit)) + else f_field_zero (ret_both (tt : 'unit))))) : both (L1 :|: L2 :|: L3 :|: L4 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2 :|: I3 :|: I4) (f_group_type). +Solve All Obligations with ( solve_ssprove_obligations ; ((now (rewrite !fset0E ; apply (ret_both 0))) || (now destruct from_uint_size))). +Fail Next Obligation. + +Definition t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := + (int32 × f_field_type × 'bool). +Equations f_cvp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_i s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_cvp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (f_field_type) := + f_cvp_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_cvp_vote {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I ('bool) := + f_cvp_vote s := + bind_both s (fun x => + solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). +Fail Next Obligation. +Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (f_field_type)} {f_cvp_vote : both L2 I2 ('bool)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := + Build_t_CastVoteParam := + bind_both f_cvp_vote (fun f_cvp_vote => + bind_both f_cvp_xi (fun f_cvp_xi => + bind_both f_cvp_i (fun f_cvp_i => + solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_vote) : (t_CastVoteParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). +Fail Next Obligation. +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := y)). + +Definition t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := + (int32 × f_field_type). +Equations f_rp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (int32) := + f_rp_i s := + bind_both s (fun x => + solve_lift (ret_both (fst x : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_rp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (f_field_type) := + f_rp_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd x : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (f_field_type)} : both (L0:|:L1) (I0:|:I1) (t_RegisterParam) := + Build_t_RegisterParam := + bind_both f_rp_xi (fun f_rp_xi => + bind_both f_rp_i (fun f_rp_i => + solve_lift (ret_both ((f_rp_i,f_rp_xi) : (t_RegisterParam))))) : both (L0:|:L1) (I0:|:I1) (t_RegisterParam). +Fail Next Obligation. +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y)). + +Definition t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := + (f_group_type × f_field_type × f_field_type). +Equations f_u {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_group_type) := + f_u s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : f_group_type))) : both L I (f_group_type). +Fail Next Obligation. +Equations f_c {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := + f_c s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_z {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := + f_z s := + bind_both s (fun x => + solve_lift (ret_both (snd x : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations Build_t_SchnorrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_u : both L0 I0 (f_group_type)} {f_c : both L1 I1 (f_field_type)} {f_z : both L2 I2 (f_field_type)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit) := + Build_t_SchnorrZKPCommit := + bind_both f_z (fun f_z => + bind_both f_c (fun f_c => + bind_both f_u (fun f_u => + solve_lift (ret_both ((f_u,f_c,f_z) : (t_SchnorrZKPCommit)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit). +Fail Next Obligation. +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_u := y) (f_c := f_c x) (f_z := f_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_u := f_u x) (f_c := y) (f_z := f_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_u := f_u x) (f_c := f_c x) (f_z := y)). + +Definition t_TallyParameter : choice_type := + 'unit. +Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := + Build_t_TallyParameter := + solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). +Fail Next Obligation. + +Equations schnorr_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (g_pow_x : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_field_one_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := + schnorr_ZKP random g_pow_x x := + solve_lift (run (letb r := f_random_field_elem random in + letb u := f_g_pow r in + letb c := v_Hash (prod_b (f_g,g_pow_x,u)) in + letb z := f_add r (f_mul c x) in + letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_u := u) (f_c := c) (f_z := z)) in + ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_field_one_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). +Fail Next Obligation. + +Equations schnorr_ZKP_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_x : both L1 I1 (f_group_type)) (pi : both L2 I2 (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 :|: f_g_pow_loc :|: f_pow_loc :|: f_prod_loc :|: f_field_one_loc) (I1 :|: I2) ('bool) := + schnorr_ZKP_validate g_pow_x pi := + solve_lift (andb ((f_c pi) =.? (v_Hash (prod_b (f_g,g_pow_x,f_u pi)))) ((f_g_pow (f_z pi)) =.? (f_prod (f_u pi) (f_pow g_pow_x (f_c pi))))) : both (L1 :|: L2 :|: f_g_pow_loc :|: f_pow_loc :|: f_prod_loc :|: f_field_one_loc) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := + (int32 × nseq f_group_type (is_pure (n)) × nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × nseq int32 (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq int32 (is_pure (n)) × int32). +Equations f_zkp_random {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (int32) := + f_zkp_random s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst (fst x))))) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq f_group_type (is_pure (n))) := + f_g_pow_xis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). +Fail Next Obligation. +Equations f_zkp_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := + f_zkp_xis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both L I (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). +Fail Next Obligation. +Equations f_commit_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq int32 (is_pure (n))) := + f_commit_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : nseq int32 (is_pure (n))))) : both L I (nseq int32 (is_pure (n))). +Fail Next Obligation. +Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq f_group_type (is_pure (n))) := + f_g_pow_xi_yi_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). +Fail Next Obligation. +Equations f_zkp_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq int32 (is_pure (n))) := + f_zkp_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : nseq int32 (is_pure (n))))) : both L I (nseq int32 (is_pure (n))). +Fail Next Obligation. +Equations f_tally {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (int32) := + f_tally s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_zkp_random : both L0 I0 (int32)} {f_g_pow_xis : both L1 I1 (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both L2 I2 (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_commit_vis : both L3 I3 (nseq int32 (is_pure (n)))} {f_g_pow_xi_yi_vis : both L4 I4 (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both L5 I5 (nseq int32 (is_pure (n)))} {f_tally : both L6 I6 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6) (t_OvnContractState (n := n)) := + Build_t_OvnContractState := + bind_both f_tally (fun f_tally => + bind_both f_zkp_vis (fun f_zkp_vis => + bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => + bind_both f_commit_vis (fun f_commit_vis => + bind_both f_zkp_xis (fun f_zkp_xis => + bind_both f_g_pow_xis (fun f_g_pow_xis => + bind_both f_zkp_random (fun f_zkp_random => + solve_lift (ret_both ((f_zkp_random,f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState)))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6) (t_OvnContractState). +Fail Next Obligation. +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_random' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := y) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). + +Definition cast_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *);2%nat). + +Obligation Tactic := try timeout 8 solve_ssprove_obligations. +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] :|: f_group_one_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := + cast_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params:t_CastVoteParam (v_Z)) := matchb f_branch out with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : t_ParseError (* (t_Result (t_Infallible) (t_ParseError)) *)) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist2 := v_Break (f_from_residual residual) in + ControlFlow_Continue (solve_lift (never_to_any hoist2)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) (* : (t_CastVoteParam (v_Z := v_Z)) *)) in + ControlFlow_Continue (solve_lift val) + end in + ControlFlow_Continue (letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in + letb zkp_vi := v_ZKP_one_out_of_two g_pow_xi_yi_vi (f_cvp_vote params) in + letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in +Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc] :|: f_group_one_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). +Next Obligation. + (intros ; simpl ; autounfold with * ; destruct H4 , H5). + normalize_fset ; split_fsubset_lhs. + now solve_single_fset_fsubset. +Defined. +Next Obligation. + (intros ; simpl ; autounfold with * ; destruct H4 , H5). + solve_is_true. +Defined. +Next Obligation. + (intros ; simpl ; autounfold with * ; destruct H4 , H5). + solve_is_true. + normalize_fset ; split_fsubset_lhs. + + all: now solve_single_fset_fsubset. +Defined. +Next Obligation. + (intros ; simpl ; autounfold with * ; destruct H4 , H5). + normalize_fset ; split_fsubset_lhs. + all: now solve_single_fset_fsubset. +Defined. +Fail Next Obligation. +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Definition commit_to_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *);3%nat). + +Obligation Tactic := (Tactics.program_simpl; fail). +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := + commit_to_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params:t_CastVoteParam (v_Z)) := matchb f_branch out with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : t_ParseError (* (t_Result (t_Infallible) (t_ParseError)) *)) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist3 := v_Break (f_from_residual residual) in + ControlFlow_Continue (solve_lift (never_to_any hoist3)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) (* : (t_CastVoteParam (v_Z)) *)) in + ControlFlow_Continue (solve_lift val) + end in + ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + ssp (fun _ => + solve_lift (ifb negb (schnorr_ZKP_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist4 := v_Break (Result_Err (solve_lift ret_both (tt : 'unit))) (* (Result_Err ParseError) *) in + ControlFlow_Continue (never_to_any hoist4) + else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*0*)(L2:|:fset []) (I2) ((* t_ControlFlow *) _ (* (t_Result (* ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) *) _ (t_ParseError)) *) ('unit)))) (Result_Ok (ret_both (tt : 'unit))) in + letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in + letb commit_vi := commit_to g_pow_xi_yi_vi in + letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in + letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). +Fail Next Obligation. +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Obligation Tactic := intros. +Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {impl_108907986_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (impl_108907986_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasInitContext (impl_108907986_) ('unit)} (_ : both L1 I1 (impl_108907986_)) : both (L1 :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *)) (t_Reject)) := + init_ovn_contract _ := + Result_Ok (solve_lift (Build_t_OvnContractState (f_zkp_random := ret_both (0 : int32)) (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_u := f_group_one (ret_both (tt : 'unit))) (f_z := f_field_zero (ret_both (tt : 'unit))) (f_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (ret_both (0 : int32)) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (ret_both (0 : int32)) n) (f_tally := ret_both (0 : int32)))) : both (L1 :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *)) (t_Reject)). +Next Obligation. + solve_ssprove_obligations. +Qed. +Next Obligation. + solve_ssprove_obligations. +Qed. +Next Obligation. + solve_ssprove_obligations. +Qed. +Next Obligation. + simpl. + unfold cast_vote_obligations_obligation_3. + normalize_fset. + simpl. + destruct H5. + destruct H4. + split_fsubset_lhs. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + now solve_single_fset_fsubset. + solve_single_fset_fsubset. + now solve_single_fset_fsubset. + now solve_single_fset_fsubset. + + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + unfold cast_vote_obligations_obligation_3. + solve_single_fset_fsubset. + + + solve_ssprove_obligations. +Qed. +Fail Next Obligation. +lia +Definition register_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));4%nat). +Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := + register_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] (params:t_RegisterParam (v_Z)) := matchb f_branch out with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result (t_Infallible) (t_ParseError))) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist5 := v_Break (f_from_residual residual) in + ControlFlow_Continue (solve_lift (never_to_any hoist5)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (t_RegisterParam (v_Z))) in + ControlFlow_Continue (solve_lift val) + end in + ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in + letb zkp_xi := schnorr_ZKP (f_zkp_random state) g_pow_xi (f_rp_xi params) in + letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). +Fail Next Obligation. + +Definition curr_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (f_field_type;5%nat). +Definition tally_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (int32;6%nat). +Definition tally_votes_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));7%nat). +Definition vote_result_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (f_group_type;8%nat). +Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := + tally_votes _ state := + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + ssp (fun _ => + letb _ := check_valid2 ((f_g_pow_xi_yi_vis state).a[i]) ((f_zkp_vis state).a[i]) in + letb _ := check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i]) in + solve_lift (ret_both (tt : 'unit)) : both (*0*)(L2:|:fset []) (I2) ('unit))) (ret_both (tt : 'unit)) in + letb vote_result loc(vote_result_loc) := f_group_one (ret_both (tt : 'unit)) in + letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => + ssp (fun vote_result => + solve_lift (f_prod vote_result g_pow_vote) : both (*2*)(L2:|:L2:|:fset [vote_result_loc;vote_result_loc]) (I2:|:I2) (f_group_type))) vote_result in + letb tally loc(tally_loc) := ret_both (0 : int32) in + letb curr loc(curr_loc) := f_field_zero (ret_both (tt : 'unit)) in + letb '(curr,tally) := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => + ssp (fun '(curr,tally) => + letb tally := ifb (f_g_pow curr) =.? vote_result + then letb tally := i in + tally + else tally in + letb curr := f_add curr (f_field_one (ret_both (tt : 'unit))) in + solve_lift (prod_b (curr,tally)) : both (*5*)(L2:|:fset [curr_loc;tally_loc;vote_result_loc;curr_loc;tally_loc]) (I2) ((f_field_type × int32)))) (prod_b (curr,tally)) in + letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in + letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in + Result_Ok (solve_lift (prod_b (f_accept (ret_both (tt : 'unit)),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). +Fail Next Obligation. + +(** Concert lib part **) +From ConCert.Utils Require Import Extras. +Export Extras. +From ConCert.Utils Require Import Automation. +Export Automation. +From ConCert.Execution Require Import Serializable. +Export Serializable. +From ConCert.Execution Require Import Blockchain. +Export Blockchain. +From ConCert.Execution Require Import ContractCommon. +Export ContractCommon. +From ConCert.Execution Require Import Serializable. +Export Serializable. +Require Import ConCertLib. +Export ConCertLib. + +Definition state_OVN : choice_type := + t_OvnContractState. + +#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := + {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := + fun x => + x. +Fail Next Obligation. +Definition receive_OVN_cast_vote {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + cast_vote ctx st. + +#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := + {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := + fun x => + x. +Fail Next Obligation. +Definition receive_OVN_commit_to_vote {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + commit_to_vote ctx st. + +Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN) (t_ParseError) := + ResultMonad.Ok st. + +#[global] Program Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit := + {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam := + fun x => + x. +Fail Next Obligation. +Definition receive_OVN_register {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_RegisterParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + register_vote ctx st. + +#[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := + {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_TallyParameter_t_Sized : t_Sized t_TallyParameter := + fun x => + x. +Fail Next Obligation. +Definition receive_OVN_tally {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_TallyParameter)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + tally_votes ctx st. + +Inductive Msg_OVN: Type := +| msg_OVN_cast_vote : t_CastVoteParam -> Msg_OVN +| msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN +| msg_OVN_register : t_RegisterParam -> Msg_OVN +| msg_OVN_tally : t_TallyParameter -> Msg_OVN. +#[global] Program Instance state_OVN_t_HasReceiveContext : t_HasReceiveContext state_OVN 'unit := + {| f_get := (fun (Ctx : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance state_OVN_t_Sized : t_Sized state_OVN := + fun x => + x. +Fail Next Obligation. +#[global] Program Instance state_OVN_t_HasActions : t_HasActions state_OVN := + Admitted. +Fail Next Obligation. +Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := + receive_OVN chain ctx st msg := + match msg with + | Some (msg_OVN_cast_vote val) => + match (is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_OVN_commit_to_vote val) => + match (is_pure (both_prog (receive_OVN_commit_to_vote (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_OVN_register val) => + match (is_pure (both_prog (receive_OVN_register (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_OVN_tally val) => + match (is_pure (both_prog (receive_OVN_tally (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | _ => + ResultMonad.Err tt + end : ResultMonad.result (state_OVN * list ActionBody) t_ParseError. +Fail Next Obligation. +#[global] Program Instance state_OVN_Serializable : Serializable state_OVN := + _. +Fail Next Obligation. +#[global] Program Instance Msg_OVN_Serializable : Serializable Msg_OVN := + Derive Serializable Msg_OVN_rect. +Fail Next Obligation. +Definition contract_OVN : Contract (state_OVN) (Msg_OVN) (state_OVN) (t_ParseError) := + build_contract init_OVN receive_OVN. diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs index f455306..25db5b5 100644 --- a/ovn/src/ovn_group.rs +++ b/ovn/src/ovn_group.rs @@ -14,12 +14,12 @@ use hacspec_concordium_derive::*; use hacspec_bls12_381::*; -pub trait Z_Field : core::marker::Copy { +pub trait Z_Field: core::marker::Copy { type field_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; - const q : usize; + const q: usize; - fn random_field_elem(random : u32) -> Self::field_type; + fn random_field_elem(random: u32) -> Self::field_type; fn field_zero() -> Self::field_type; fn field_one() -> Self::field_type; @@ -29,12 +29,12 @@ pub trait Z_Field : core::marker::Copy { } /** Interface for group implementation */ -pub trait Group : core::marker::Copy { +pub trait Group: core::marker::Copy { type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; const g: Self::group_type; // Generator (elemnent of group) - fn random_group_elem(random : u32) -> Self::group_type; + fn random_group_elem(random: u32) -> Self::group_type; fn g_pow(x: Z::field_type) -> Self::group_type; fn pow(g: Self::group_type, x: Z::field_type) -> Self::group_type; // TODO: Link with q @@ -42,6 +42,8 @@ pub trait Group : core::marker::Copy { fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type; fn inv(x: Self::group_type) -> Self::group_type; fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; + + fn hash(x: Self::group_type, y: Self::group_type, z: Self::group_type) -> Z::field_type; } // struct eligible_votes { @@ -60,14 +62,8 @@ pub trait Group : core::marker::Copy { // use hacspec_sha256::*; -/** TODO: Hash function */ -pub fn Hash>(v : (G::group_type, G::group_type, G::group_type)) -> Z::field_type { - let (a, b, c) = v; - Z::field_one() -} - #[derive(Serialize, SchemaType, Clone, Copy)] -struct SchnorrZKPCommit> { +pub struct SchnorrZKPCommit> { u: G::group_type, c: Z::field_type, z: Z::field_type, @@ -75,24 +71,64 @@ struct SchnorrZKPCommit> { /** Non-interactive Schnorr proof using Fiat-Shamir heuristics */ // https://crypto.stanford.edu/cs355/19sp/lec5.pdf -pub fn schnorr_ZKP>(random: u32, g_pow_x: G::group_type, x: Z::field_type) -> SchnorrZKPCommit { +pub fn schnorr_zkp>( + random: u32, + g_pow_x: G::group_type, + x: Z::field_type, +) -> SchnorrZKPCommit { let r = Z::random_field_elem(random); let u = G::g_pow(r); - let c = Hash::((G::g, g_pow_x, u)); - let z = Z::add(r , Z::mul(c , x) ); + let c = G::hash(G::g, g_pow_x, u); + let z = Z::add(r, Z::mul(c, x)); return SchnorrZKPCommit { u, c, z }; } // https://crypto.stanford.edu/cs355/19sp/lec5.pdf -pub fn schnorr_ZKP_validate>(g_pow_x: G::group_type, pi: SchnorrZKPCommit) -> bool { - pi.c == Hash::((G::g, g_pow_x, pi.u)) && G::g_pow(pi.z) == G::prod(pi.u , G::pow(g_pow_x, pi.c)) +pub fn schnorr_zkp_validate>( + g_pow_x: G::group_type, + pi: SchnorrZKPCommit, +) -> bool { + pi.c == G::hash(G::g, g_pow_x, pi.u) && G::g_pow(pi.z) == G::prod(pi.u, G::pow(g_pow_x, pi.c)) +} + +#[derive(Serialize, SchemaType, Clone, Copy)] +pub struct OrZKPCommit> { + a: G::group_type, + r: Z::field_type, +} + +/** Cramer, Damgård and Schoenmakers (CDS) technique */ +pub fn zkp_one_out_of_two>( + random: u32, + g_pow_xi_yi_vi: G::group_type, + vi: bool, +) -> OrZKPCommit { + let w = if vi { Z::field_one() } else { Z::field_zero() }; + let x = g_pow_xi_yi_vi; + + let z = Z::random_field_elem(random); + let a = G::g_pow(z); + let c = G::hash(G::g, x, a); + let r = Z::add(z, Z::mul(c, w)); + + OrZKPCommit { a, r } +} + +pub fn zkp_one_out_of_two_validate>( + g_pow_xi_yi_vi: G::group_type, + zkp: OrZKPCommit, +) -> bool { + let x = g_pow_xi_yi_vi; + + let c = G::hash(G::g, x, zkp.a); + G::g_pow(zkp.r) == G::prod(zkp.a, G::pow(x, c)) } #[hax::contract_state(contract = "OVN")] // #[cfg_attr(not(feature = "hax_compilation"), contract_state(contract = "OVN"))] #[derive(Serialize, SchemaType, Clone, Copy)] -pub struct OvnContractState, const n: usize> { +pub struct OvnContractState, const n: usize> { zkp_random: u32, g_pow_xis: [G::group_type; n], @@ -101,38 +137,45 @@ pub struct OvnContractState, const n: usize> { commit_vis: [u32; n], g_pow_xi_yi_vis: [G::group_type; n], - zkp_vis: [u32; n], + zkp_vis: [OrZKPCommit; n], tally: u32, } #[hax::init(contract = "OVN")] // #[cfg_attr(not(feature = "hax_compilation"), init(contract = "OVN"))] -pub fn init_ovn_contract, const n: usize>( +pub fn init_ovn_contract, const n: usize>( _: &impl HasInitContext, -) -> InitResult> { - Ok(OvnContractState:: { +) -> InitResult> { + Ok(OvnContractState:: { zkp_random: 0, // TODO g_pow_xis: [G::group_one(); n], - zkp_xis: [SchnorrZKPCommit:: { u: G::group_one(), z: Z::field_zero(), c: Z::field_zero() }; n], + zkp_xis: [SchnorrZKPCommit:: { + u: G::group_one(), + z: Z::field_zero(), + c: Z::field_zero(), + }; n], commit_vis: [0; n], g_pow_xi_yi_vis: [G::group_one(); n], - zkp_vis: [0; n], + zkp_vis: [OrZKPCommit:: { + a: G::group_one(), + r: Z::field_zero(), + }; n], tally: 0, }) } /** Currently randomness needs to be injected */ -pub fn select_private_voting_key>(random: u32) -> G::group_type { +pub fn select_private_voting_key>(random: u32) -> G::group_type { G::random_group_elem(random) // x_i \in_R Z_q; } #[derive(Serialize, SchemaType)] -pub struct RegisterParam { +pub struct RegisterParam { rp_i: u32, rp_xi: Z::field_type, } @@ -140,14 +183,14 @@ pub struct RegisterParam { /** Primary function in round 1 */ #[hax::receive(contract = "OVN", name = "register", parameter = "RegisterParam")] // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "register", parameter = "RegisterParam"))] -pub fn register_vote, const n : usize, A: HasActions>( +pub fn register_vote, const n: usize, A: HasActions>( ctx: &impl HasReceiveContext, state: OvnContractState, ) -> Result<(A, OvnContractState), ParseError> { let params: RegisterParam = ctx.parameter_cursor().get()?; let g_pow_xi = G::g_pow(params.rp_xi); - let zkp_xi = schnorr_ZKP::(state.zkp_random, g_pow_xi, params.rp_xi); + let zkp_xi = schnorr_zkp::(state.zkp_random, g_pow_xi, params.rp_xi); let mut register_vote_state_ret = state.clone(); register_vote_state_ret.g_pow_xis[params.rp_i as usize] = g_pow_xi; @@ -157,13 +200,13 @@ pub fn register_vote, const n : usize, A: HasActions>( } #[derive(Serialize, SchemaType)] -pub struct CastVoteParam { +pub struct CastVoteParam { cvp_i: u32, cvp_xi: Z::field_type, cvp_vote: bool, } -pub fn compute_group_element_for_vote, const n: usize>( +pub fn compute_group_element_for_vote, const n: usize>( i: u32, xi: Z::field_type, vote: bool, @@ -179,29 +222,41 @@ pub fn compute_group_element_for_vote, const n: usize>( } let Yi = G::div(prod1, prod2); // implicityly: Y_i = g^y_i - G::prod(G::pow(Yi, xi), G::g_pow(if vote { Z::field_one() } else { Z::field_zero() })) + G::prod( + G::pow(Yi, xi), + G::g_pow(if vote { + Z::field_one() + } else { + Z::field_zero() + }), + ) } -pub fn commit_to>(x: G::group_type) -> u32 { +pub fn commit_to>(x: G::group_type) -> u32 { 0 } /** Commitment before round 2 */ #[hax::receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam"))] -pub fn commit_to_vote, const n : usize, A: HasActions>( +pub fn commit_to_vote, const n: usize, A: HasActions>( ctx: &impl HasReceiveContext, state: OvnContractState, ) -> Result<(A, OvnContractState), ParseError> { let params: CastVoteParam = ctx.parameter_cursor().get()?; for i in 0..n { - if !schnorr_ZKP_validate(state.g_pow_xis[i], state.zkp_xis[i]) { + if !schnorr_zkp_validate(state.g_pow_xis[i], state.zkp_xis[i]) { return Err(ParseError {}); } } - let g_pow_xi_yi_vi = compute_group_element_for_vote::(params.cvp_i, params.cvp_xi, params.cvp_vote, state.g_pow_xis); + let g_pow_xi_yi_vi = compute_group_element_for_vote::( + params.cvp_i, + params.cvp_xi, + params.cvp_vote, + state.g_pow_xis, + ); let commit_vi = commit_to::(g_pow_xi_yi_vi); let mut commit_to_vote_state_ret = state.clone(); @@ -209,22 +264,26 @@ pub fn commit_to_vote, const n : usize, A: HasActions> Ok((A::accept(), commit_to_vote_state_ret)) } -/** Cramer, Damgård and Schoenmakers (CDS) technique */ -pub fn ZKP_one_out_of_two>(g_pow_vi: G::group_type, vi: bool) -> u32 { - 32 // TODO -} - /** Primary function in round 2, also opens commitment */ #[hax::receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam"))] -pub fn cast_vote, const n : usize, A: HasActions>( +pub fn cast_vote, const n: usize, A: HasActions>( ctx: &impl HasReceiveContext, state: OvnContractState, ) -> Result<(A, OvnContractState), ParseError> { let params: CastVoteParam = ctx.parameter_cursor().get()?; - let g_pow_xi_yi_vi = compute_group_element_for_vote::(params.cvp_i, params.cvp_xi, params.cvp_vote, state.g_pow_xis); - let zkp_vi = ZKP_one_out_of_two::(g_pow_xi_yi_vi, params.cvp_vote); + let g_pow_xi_yi_vi = compute_group_element_for_vote::( + params.cvp_i, + params.cvp_xi, + params.cvp_vote, + state.g_pow_xis, + ); + let zkp_vi = zkp_one_out_of_two::( + 0u32, /* TODO: Randomness */ + g_pow_xi_yi_vi, + params.cvp_vote, + ); let mut cast_vote_state_ret = state.clone(); cast_vote_state_ret.g_pow_xi_yi_vis[params.cvp_i as usize] = g_pow_xi_yi_vi; @@ -233,11 +292,7 @@ pub fn cast_vote, const n : usize, A: HasActions>( Ok((A::accept(), cast_vote_state_ret)) } -pub fn check_valid2>(g_pow_xi_yi_vi: G::group_type, zkp: u32) -> bool { - true -} - -pub fn check_commitment>(g_pow_xi_yi_vi: G::group_type, zkp: u32) -> bool { +pub fn check_commitment>(g_pow_xi_yi_vi: G::group_type, zkp: u32) -> bool { true } @@ -245,12 +300,12 @@ pub struct TallyParameter {} #[hax::receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "tally", parameter = "TallyParameter"))] /** Anyone can tally the votes */ -pub fn tally_votes, const n : usize, A: HasActions>( +pub fn tally_votes, const n: usize, A: HasActions>( _: &impl HasReceiveContext, state: OvnContractState, ) -> Result<(A, OvnContractState), ParseError> { for i in 0..n { - check_valid2::(state.g_pow_xi_yi_vis[i], state.zkp_vis[i]); + zkp_one_out_of_two_validate::(state.g_pow_xi_yi_vis[i], state.zkp_vis[i]); check_commitment::(state.g_pow_xi_yi_vis[i], state.commit_vis[i]); () } @@ -279,7 +334,7 @@ pub fn tally_votes, const n : usize, A: HasActions>( #[cfg(test)] #[concordium_test] -pub fn test_correctness>() { +pub fn test_correctness>() { let randomness: Vec = Vec::new(); let votes: Vec = Vec::new(); diff --git a/ovn/src/ovn_group_instantiated.rs b/ovn/src/ovn_group_instantiated.rs new file mode 100644 index 0000000..13da544 --- /dev/null +++ b/ovn/src/ovn_group_instantiated.rs @@ -0,0 +1,66 @@ +// #![no_std] +// #![feature(register_tool)] +// #![register_tool(hax)] + +// // pub trait Z_Field: core::marker::Copy { +// // type field_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; + +// // const q: usize; + +// // fn random_field_elem(random: u32) -> Self::field_type; + +// // fn field_zero() -> Self::field_type; +// // fn field_one() -> Self::field_type; + +// // fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type; +// // fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type; +// // } + +// // /** Interface for group implementation */ +// // pub trait Group: core::marker::Copy { +// // type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; + +// // const g: Self::group_type; // Generator (elemnent of group) + +// // fn random_group_elem(random: u32) -> Self::group_type; + +// // fn g_pow(x: Z::field_type) -> Self::group_type; +// // fn pow(g: Self::group_type, x: Z::field_type) -> Self::group_type; // TODO: Link with q +// // fn group_one() -> Self::group_type; +// // fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type; +// // fn inv(x: Self::group_type) -> Self::group_type; +// // fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; + +// // fn hash(x: G::group_type, y: G::group_type, z: G::group_type) -> Z::field_type; +// // } + +// use hacspec_bls12_381::*; + +// // pub trait Z_Field: core::marker::Copy { +// // type field_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; + +// // const q: usize; + +// // fn random_field_elem(random: u32) -> Self::field_type; + +// // fn field_zero() -> Self::field_type; +// // fn field_one() -> Self::field_type; + +// // fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type; +// // fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type; +// // } + +// impl Z_Field for Scalar { +// type Field_type = Scalar; + +// // const q = Scalar::modulo; + +// fn random_field_elem(random: u32) { +// return Scalar::from_literal(random); +// } +// } + +// impl Group for Fp12 { +// group_type = Fp12; +// } + From 59fd73fa76db6e486cc04764eb032ec733599843 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 24 Jan 2024 17:39:50 +0100 Subject: [PATCH 42/86] WIP: BLS12-381 instantiation --- ovn/src/ovn_group.rs | 61 +++++++++++++++++++++++++++- ovn/src/ovn_group_instantiated.rs | 66 ------------------------------- 2 files changed, 59 insertions(+), 68 deletions(-) delete mode 100644 ovn/src/ovn_group_instantiated.rs diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs index 25db5b5..a6b7739 100644 --- a/ovn/src/ovn_group.rs +++ b/ovn/src/ovn_group.rs @@ -12,8 +12,6 @@ use hacspec_concordium::*; #[exclude] use hacspec_concordium_derive::*; -use hacspec_bls12_381::*; - pub trait Z_Field: core::marker::Copy { type field_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; @@ -403,3 +401,62 @@ pub fn test_correctness>() { "The tally should equal the number of positive votes" ); } + +use hacspec_bls12_381::*; +use hacspec_bls12_381_hash::*; + +#[derive(core::marker::Copy, Clone, PartialEq, Eq)] +struct Z_curve { + val : Scalar +} + +impl hacspec_concordium::Deserial for Z_curve { + // TODO: + fn deserial(_source: &mut R) -> ParseResult { + Err(ParseError { }) + } +} + +impl hacspec_concordium::Serial for Z_curve { + // TODO: + fn serial(&self, _out: &mut W) -> Result<(), W::Err> { + Ok(()) + } +} + +// impl hacspec_concordium::Serialize for Z_curve { + +// } + +impl Z_Field for Z_curve { + type field_type = Z_curve; + + const q: usize = 11; // TODO: Scalar::modulo_value; + + fn random_field_elem(random: u32) -> Self::field_type { + Z_curve { val: Scalar::from_literal(random as u128) } + } + + fn field_zero() -> Self::field_type { + Z_curve { val: Scalar::from_literal(0u128) } // Scalar::ZERO() + } + + fn field_one() -> Self::field_type { + Z_curve { val: Scalar::from_literal(1u128) } // Scalar::ONE() + } + + fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { + Z_curve { val: x.val + y.val } + } + + fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { + Z_curve { val: x.val * y.val } + } +} + + +type Group_curve = Fp12; + +// impl Group for Fp12 { +// group_type = Fp12; +// } diff --git a/ovn/src/ovn_group_instantiated.rs b/ovn/src/ovn_group_instantiated.rs deleted file mode 100644 index 13da544..0000000 --- a/ovn/src/ovn_group_instantiated.rs +++ /dev/null @@ -1,66 +0,0 @@ -// #![no_std] -// #![feature(register_tool)] -// #![register_tool(hax)] - -// // pub trait Z_Field: core::marker::Copy { -// // type field_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; - -// // const q: usize; - -// // fn random_field_elem(random: u32) -> Self::field_type; - -// // fn field_zero() -> Self::field_type; -// // fn field_one() -> Self::field_type; - -// // fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type; -// // fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type; -// // } - -// // /** Interface for group implementation */ -// // pub trait Group: core::marker::Copy { -// // type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; - -// // const g: Self::group_type; // Generator (elemnent of group) - -// // fn random_group_elem(random: u32) -> Self::group_type; - -// // fn g_pow(x: Z::field_type) -> Self::group_type; -// // fn pow(g: Self::group_type, x: Z::field_type) -> Self::group_type; // TODO: Link with q -// // fn group_one() -> Self::group_type; -// // fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type; -// // fn inv(x: Self::group_type) -> Self::group_type; -// // fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; - -// // fn hash(x: G::group_type, y: G::group_type, z: G::group_type) -> Z::field_type; -// // } - -// use hacspec_bls12_381::*; - -// // pub trait Z_Field: core::marker::Copy { -// // type field_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; - -// // const q: usize; - -// // fn random_field_elem(random: u32) -> Self::field_type; - -// // fn field_zero() -> Self::field_type; -// // fn field_one() -> Self::field_type; - -// // fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type; -// // fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type; -// // } - -// impl Z_Field for Scalar { -// type Field_type = Scalar; - -// // const q = Scalar::modulo; - -// fn random_field_elem(random: u32) { -// return Scalar::from_literal(random); -// } -// } - -// impl Group for Fp12 { -// group_type = Fp12; -// } - From 28441503aef9d99bf995844c4f90030b64083e5b Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 24 Jan 2024 21:25:20 +0100 Subject: [PATCH 43/86] Valid test failing --- bls12-381/src/bls12-381.rs | 4 +- concordium/src/concordium.rs | 2 +- concordium/src/concordium_traits.rs | 16 +- concordium/src/test_infrastructure.rs | 59 ++-- .../ssprove/extraction/Hacspec_ovn_by_hand.v | 30 +- ovn/src/ovn_group.rs | 297 +++++++++++++----- 6 files changed, 274 insertions(+), 134 deletions(-) diff --git a/bls12-381/src/bls12-381.rs b/bls12-381/src/bls12-381.rs index 90092dd..8dec41f 100644 --- a/bls12-381/src/bls12-381.rs +++ b/bls12-381/src/bls12-381.rs @@ -76,11 +76,11 @@ pub fn fp2conjugate(n: Fp2) -> Fp2 { /* Arithmetic for Fp6 elements */ //Algorithms from: https://eprint.iacr.org/2010/354.pdf -fn fp6fromfp2(n: Fp2) -> Fp6 { +pub fn fp6fromfp2(n: Fp2) -> Fp6 { (n, fp2zero(), fp2zero()) } -fn fp6zero() -> Fp6 { +pub fn fp6zero() -> Fp6 { fp6fromfp2(fp2zero()) } diff --git a/concordium/src/concordium.rs b/concordium/src/concordium.rs index d7df7a7..c7a71e2 100644 --- a/concordium/src/concordium.rs +++ b/concordium/src/concordium.rs @@ -56,7 +56,7 @@ mod concordium_prims; mod concordium_types; mod concordium_traits; -// pub mod test_infrastructure; +pub mod test_infrastructure; use concordium_prims::*; // TODO: Does not re-export anything, nothing is public enough (removed pub) pub use concordium_impls::*; diff --git a/concordium/src/concordium_traits.rs b/concordium/src/concordium_traits.rs index ff629de..e76ff3f 100644 --- a/concordium/src/concordium_traits.rs +++ b/concordium/src/concordium_traits.rs @@ -121,12 +121,12 @@ where /// Truncate the state to the given size. If the given size is more than the /// current state size this operation does nothing. The new position is at /// most at the end of the stream. - fn truncate(&self, new_size: u32) -> Self; + fn truncate(self, new_size: u32) -> Self; /// Make sure that the memory size is at least that many bytes in size. /// Returns true iff this was successful. The new bytes are initialized as /// 0. - fn reserve(&self, len: u32) -> (bool, Self); + fn reserve(self, len: u32) -> (bool, Self); } @@ -142,16 +142,16 @@ pub trait HasLogger { /// Log the given slice as-is. If logging is not successful an error will be /// returned. - fn log_raw(&self, event: &[u8]) -> (Result<(), LogError>, Self); + fn log_raw(self, event: &[u8]) -> (Result<(), LogError>, Self); // #[inline(always)] - /// Log a serializable event by serializing it with a supplied serializer. - fn log(&self, event: &S) -> (Result<(), LogError>, Self); + // /// Log a serializable event by serializing it with a supplied serializer. + // fn log(self, event: &S) -> (Result<(), LogError>, Self); // { // let mut out = Vec::new(); - // if event.serial(&mut out).is_err() { - // trap(); // should not happen - // } + // // if event.serial(&mut out).is_err() { + // // trap(); // should not happen + // // } // self.log_raw(&out) // } } diff --git a/concordium/src/test_infrastructure.rs b/concordium/src/test_infrastructure.rs index 9126af6..f4b43e6 100644 --- a/concordium/src/test_infrastructure.rs +++ b/concordium/src/test_infrastructure.rs @@ -261,7 +261,7 @@ pub struct InitOnlyDataTest { pub type ReceiveContextTest<'a> = ContextTest<'a, ReceiveOnlyDataTest>; #[cfg(not(feature = "hacspec"))] -#[derive(Default)] +#[derive(Default, Clone)] #[doc(hidden)] pub struct ReceiveOnlyDataTest { pub(crate) invoker: Option, @@ -308,9 +308,8 @@ impl<'a, C> ContextTest<'a, C> { self } - pub fn set_parameter(&mut self, value: &'a [u8]) -> &mut Self { - self.common.parameter = Some(value); - self + pub fn set_parameter(self, value: &'a [u8]) -> Self { + Self { common: CommonDataTest { parameter: Some(value), ..self.common }, ..self } } /// Get a mutable reference to the chain meta data placeholder @@ -395,14 +394,14 @@ impl HasPolicy for TestPolicy { fn valid_to(&self) -> Timestamp { self.policy.valid_to } - fn next_item(&mut self, buf: &mut [u8; 31]) -> Option<(AttributeTag, u8)> { + fn next_item(self, buf: [u8; 31]) -> (Option<(AttributeTag, u8)>, [u8; 31], Self) { if let Some(item) = self.policy.items.get(self.position) { let len = item.1.len(); - buf[0..len].copy_from_slice(&item.1); - self.position += 1; - Some((item.0, len as u8)) + let mut temp_buf : [u8; 31] = [0; 31]; + temp_buf[0..len].copy_from_slice(&item.1); + (Some((item.0, len as u8)), temp_buf, Self { position: self.position + 1, policy: self.policy }) } else { - None + (None, buf, self) } } } @@ -475,15 +474,16 @@ impl HasLogger for LogRecorder { } } - fn log_raw(&mut self, event: &[u8]) -> Result<(), LogError> { + fn log_raw(self, event: &[u8]) -> (Result<(), LogError>, Self) { if event.len() > constants::MAX_LOG_SIZE { - return Err(LogError::Malformed); + return (Err(LogError::Malformed), self); } if self.logs.len() >= constants::MAX_NUM_LOGS { - return Err(LogError::Full); + return (Err(LogError::Full), self); } - self.logs.push(event.to_vec()); - Ok(()) + let mut temp_logs = self.logs; + temp_logs.push(event.to_vec()); + (Ok(()), Self {logs: temp_logs}) } } @@ -647,26 +647,33 @@ impl> + AsMut<[u8]> + AsRef<[u8]>> HasContractState u32 { self.cursor.data.as_ref().len() as u32 } - fn truncate(&mut self, new_size: u32) { + fn truncate(self, new_size: u32) -> Self { if self.size() > new_size { let new_size = new_size as usize; - let data: &mut Vec = self.cursor.data.as_mut(); - data.truncate(new_size); - if self.cursor.offset > new_size { - self.cursor.offset = new_size + // TODO: + let data: Self::ContractStateData = self.cursor.data; + // data.truncate(new_size); // TODO + let mut offset = self.cursor.offset; + if offset > new_size { + offset = new_size } + Self { cursor: Cursor { offset: offset, data: data } } + } + else { + self // TODO } } - fn reserve(&mut self, len: u32) -> bool { + fn reserve(self, len: u32) -> (bool, Self) { if len <= constants::MAX_CONTRACT_STATE_SIZE { - if self.size() < len { - let data: &mut Vec = self.cursor.data.as_mut(); - data.resize(len as usize, 0u8); - } - true + // TODO: + // if self.size() < len { + // let data: T = self.cursor.data; + // data.resize(len as usize, 0u8); + // } + (true, self) // TODO } else { - false + (false, self) // TODO } } } diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v index 05bb53a..056df88 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v @@ -299,7 +299,7 @@ Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Bui Definition cast_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *);2%nat). -Obligation Tactic := try timeout 8 solve_ssprove_obligations. +Obligation Tactic := try timeout 5 solve_ssprove_obligations. Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] :|: f_group_one_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := cast_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in @@ -318,29 +318,13 @@ Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interfac letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc] :|: f_group_one_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). -Next Obligation. - (intros ; simpl ; autounfold with * ; destruct H4 , H5). - normalize_fset ; split_fsubset_lhs. - now solve_single_fset_fsubset. -Defined. -Next Obligation. - (intros ; simpl ; autounfold with * ; destruct H4 , H5). - solve_is_true. -Defined. -Next Obligation. - (intros ; simpl ; autounfold with * ; destruct H4 , H5). - solve_is_true. - normalize_fset ; split_fsubset_lhs. - - all: now solve_single_fset_fsubset. -Defined. -Next Obligation. - (intros ; simpl ; autounfold with * ; destruct H4 , H5). - normalize_fset ; split_fsubset_lhs. - all: now solve_single_fset_fsubset. -Defined. +Next Obligation. intros ; now solve_in_fset. Defined. +Next Obligation. intros ; now solve_in_fset. Defined. +Next Obligation. solve_ssprove_obligations. Defined. +Next Obligation. solve_ssprove_obligations. Defined. +Next Obligation. solve_ssprove_obligations. Defined. +Next Obligation. solve_ssprove_obligations. Defined. Fail Next Obligation. -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. Definition commit_to_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *);3%nat). diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs index a6b7739..df973b8 100644 --- a/ovn/src/ovn_group.rs +++ b/ovn/src/ovn_group.rs @@ -127,8 +127,6 @@ pub fn zkp_one_out_of_two_validate>( // #[cfg_attr(not(feature = "hax_compilation"), contract_state(contract = "OVN"))] #[derive(Serialize, SchemaType, Clone, Copy)] pub struct OvnContractState, const n: usize> { - zkp_random: u32, - g_pow_xis: [G::group_type; n], zkp_xis: [SchnorrZKPCommit; n], @@ -143,11 +141,9 @@ pub struct OvnContractState, const n: usize> { #[hax::init(contract = "OVN")] // #[cfg_attr(not(feature = "hax_compilation"), init(contract = "OVN"))] pub fn init_ovn_contract, const n: usize>( - _: &impl HasInitContext, + // _: &impl HasInitContext, ) -> InitResult> { Ok(OvnContractState:: { - zkp_random: 0, // TODO - g_pow_xis: [G::group_one(); n], zkp_xis: [SchnorrZKPCommit:: { u: G::group_one(), @@ -168,27 +164,28 @@ pub fn init_ovn_contract, const n: usize>( } /** Currently randomness needs to be injected */ -pub fn select_private_voting_key>(random: u32) -> G::group_type { - G::random_group_elem(random) // x_i \in_R Z_q; +pub fn select_private_voting_key(random: u32) -> Z::field_type { + Z::random_field_elem(random) // x_i \in_R Z_q; } #[derive(Serialize, SchemaType)] pub struct RegisterParam { rp_i: u32, rp_xi: Z::field_type, + rp_zkp_random: u32, } /** Primary function in round 1 */ #[hax::receive(contract = "OVN", name = "register", parameter = "RegisterParam")] // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "register", parameter = "RegisterParam"))] pub fn register_vote, const n: usize, A: HasActions>( - ctx: &impl HasReceiveContext, + ctx: impl HasReceiveContext, state: OvnContractState, ) -> Result<(A, OvnContractState), ParseError> { let params: RegisterParam = ctx.parameter_cursor().get()?; let g_pow_xi = G::g_pow(params.rp_xi); - let zkp_xi = schnorr_zkp::(state.zkp_random, g_pow_xi, params.rp_xi); + let zkp_xi = schnorr_zkp::(params.rp_zkp_random, g_pow_xi, params.rp_xi); let mut register_vote_state_ret = state.clone(); register_vote_state_ret.g_pow_xis[params.rp_i as usize] = g_pow_xi; @@ -201,6 +198,7 @@ pub fn register_vote, const n: usize, A: HasActions>( pub struct CastVoteParam { cvp_i: u32, cvp_xi: Z::field_type, + cvp_zkp_random: u32, cvp_vote: bool, } @@ -238,7 +236,7 @@ pub fn commit_to>(x: G::group_type) -> u32 { #[hax::receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam"))] pub fn commit_to_vote, const n: usize, A: HasActions>( - ctx: &impl HasReceiveContext, + ctx: impl HasReceiveContext, state: OvnContractState, ) -> Result<(A, OvnContractState), ParseError> { let params: CastVoteParam = ctx.parameter_cursor().get()?; @@ -266,7 +264,7 @@ pub fn commit_to_vote, const n: usize, A: HasActions>( #[hax::receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam"))] pub fn cast_vote, const n: usize, A: HasActions>( - ctx: &impl HasReceiveContext, + ctx: impl HasReceiveContext, state: OvnContractState, ) -> Result<(A, OvnContractState), ParseError> { let params: CastVoteParam = ctx.parameter_cursor().get()?; @@ -277,11 +275,7 @@ pub fn cast_vote, const n: usize, A: HasActions>( params.cvp_vote, state.g_pow_xis, ); - let zkp_vi = zkp_one_out_of_two::( - 0u32, /* TODO: Randomness */ - g_pow_xi_yi_vi, - params.cvp_vote, - ); + let zkp_vi = zkp_one_out_of_two::(params.cvp_zkp_random, g_pow_xi_yi_vi, params.cvp_vote); let mut cast_vote_state_ret = state.clone(); cast_vote_state_ret.g_pow_xi_yi_vis[params.cvp_i as usize] = g_pow_xi_yi_vi; @@ -294,12 +288,14 @@ pub fn check_commitment>(g_pow_xi_yi_vi: G::group_type, true } +#[derive(Serialize, SchemaType)] pub struct TallyParameter {} + #[hax::receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "tally", parameter = "TallyParameter"))] /** Anyone can tally the votes */ pub fn tally_votes, const n: usize, A: HasActions>( - _: &impl HasReceiveContext, + _: impl HasReceiveContext, state: OvnContractState, ) -> Result<(A, OvnContractState), ParseError> { for i in 0..n { @@ -330,65 +326,65 @@ pub fn tally_votes, const n: usize, A: HasActions>( Ok((A::accept(), tally_votes_state_ret)) } +// use crate::test_infrastructure::*; + #[cfg(test)] -#[concordium_test] -pub fn test_correctness>() { - let randomness: Vec = Vec::new(); +pub fn test_correctness, const n : usize, A: HasActions>() -> () { + use rand::random; + // rand::SeedableRng::seed_from_u64(32u64); // TODO + let votes: Vec = Vec::new(); // Setup the context - let mut ctx = InitContextTest::empty(); + let mut ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); // ctx.set_sender(ADDRESS_0); - let mut state = init_ovn_contract(); + let mut state : OvnContractState = init_ovn_contract().unwrap(); - let xis = Vec::new(); + let mut xis = Vec::new(); for i in 0..n { - xis.push(select_private_voting_key::(randomness[i])); + xis.push(select_private_voting_key::(random())); } for i in 0..n { - let parameter = RegisterParam { - rp_i: i, + let parameter = RegisterParam:: { + rp_i: i as u32, rp_xi: xis[i], + rp_zkp_random: random(), // TODO }; let parameter_bytes = to_bytes(¶meter); - ctx.set_parameter(¶meter_bytes); - - register_vote(ctx, state); + (_, state) = register_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); } for i in 0..n { let parameter = CastVoteParam:: { - cvp_i: i, + cvp_i: i as u32, cvp_xi: xis[i], + cvp_zkp_random: random(), // TODO cvp_vote: votes[i], }; let parameter_bytes = to_bytes(¶meter); - ctx.set_parameter(¶meter_bytes); - - commit_to_vote(ctx, state); + (_, state) = commit_to_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); } for i in 0..n { let parameter = CastVoteParam:: { - cvp_i: i, + cvp_i: i as u32, cvp_xi: xis[i], + cvp_zkp_random: random(), // TODO cvp_vote: votes[i], }; let parameter_bytes = to_bytes(¶meter); - ctx.set_parameter(¶meter_bytes); - - cast_vote(ctx, state); + (_, state) = cast_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); } let parameter = TallyParameter {}; let parameter_bytes = to_bytes(¶meter); - ctx.set_parameter(¶meter_bytes); + ctx = ctx.set_parameter(¶meter_bytes); - tally_votes(ctx, state); + (_, state) = tally_votes::(ctx.clone(), state).unwrap(); - let mut count = 0; + let mut count = 0u32; for v in votes { if v { count = count + 1; // += 1 does not work correctly @@ -399,64 +395,217 @@ pub fn test_correctness>() { state.tally, count, "The tally should equal the number of positive votes" - ); + ) } -use hacspec_bls12_381::*; -use hacspec_bls12_381_hash::*; +#[derive(Clone, Copy)] +pub struct z_17 {} +impl Z_Field for z_17 { + type field_type = u32; + const q: usize = 17; // Prime order + fn random_field_elem(random: u32) -> Self::field_type { + random % (Self::q as u32) + } -#[derive(core::marker::Copy, Clone, PartialEq, Eq)] -struct Z_curve { - val : Scalar -} + fn field_zero() -> Self::field_type { + 0 + } -impl hacspec_concordium::Deserial for Z_curve { - // TODO: - fn deserial(_source: &mut R) -> ParseResult { - Err(ParseError { }) + fn field_one() -> Self::field_type { + 1 + } + + fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { + (x + y) % (Self::q as u32) } -} -impl hacspec_concordium::Serial for Z_curve { - // TODO: - fn serial(&self, _out: &mut W) -> Result<(), W::Err> { - Ok(()) + fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { + (x * y) % (Self::q as u32) } } -// impl hacspec_concordium::Serialize for Z_curve { +#[derive(Clone, Copy)] +pub struct g_z_17 {} +impl Group for g_z_17 { + type group_type = u32; -// } + const g: Self::group_type = 3; // Generator (elemnent of group) -impl Z_Field for Z_curve { - type field_type = Z_curve; + fn random_group_elem(random: u32) -> Self::group_type { + random % (z_17::q as u32) + } - const q: usize = 11; // TODO: Scalar::modulo_value; + fn hash(x: Self::group_type, y: Self::group_type, z: Self::group_type) -> ::field_type { + (x * y * z) % (z_17::q as u32) // TODO + } + + fn g_pow(x: u32) -> Self::group_type { + (Self::g ^ x) % (z_17::q as u32) + } - fn random_field_elem(random: u32) -> Self::field_type { - Z_curve { val: Scalar::from_literal(random as u128) } + fn pow(g: Self::group_type, x: u32) -> Self::group_type { + (Self::g ^ x) % (z_17::q as u32) } - fn field_zero() -> Self::field_type { - Z_curve { val: Scalar::from_literal(0u128) } // Scalar::ZERO() + fn group_one() -> Self::group_type { + 1 } - fn field_one() -> Self::field_type { - Z_curve { val: Scalar::from_literal(1u128) } // Scalar::ONE() + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { + (x * y) % (z_17::q as u32) } - fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { - Z_curve { val: x.val + y.val } + fn inv(x: Self::group_type) -> Self::group_type { + let mut res = 0; + for i in 1.. (z_17::q as u32) { + let i_computation = i; + if Self::g_pow(i) == x { + res = i_computation; + } + } + res + // [0, 1, 9, 6, 13, 7, 3, 5, 15, 2, 12, 14, 10, 4, 11, 8, 16][x as usize] } - fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { - Z_curve { val: x.val * y.val } + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { + Self::prod(x, Self::inv(y)) } } +#[concordium_test] +fn test() { + type Z = z_17; + type G = g_z_17; + const n: usize = 20; + + test_correctness::() +} + +// use hacspec_bls12_381::*; +// use hacspec_bls12_381_hash::*; + +// #[derive(core::marker::Copy, Clone, PartialEq, Eq)] +// struct Z_curve { +// val: Scalar, +// } + +// impl hacspec_concordium::Deserial for Z_curve { +// // TODO: +// fn deserial(_source: &mut R) -> ParseResult { +// Err(ParseError {}) +// } +// } + +// impl hacspec_concordium::Serial for Z_curve { +// // TODO: +// fn serial(&self, _out: &mut W) -> Result<(), W::Err> { +// Ok(()) +// } +// } + +// impl Z_Field for Z_curve { +// type field_type = Z_curve; + +// const q: usize = 11; // TODO: Scalar::modulo_value; + +// fn random_field_elem(random: u32) -> Self::field_type { +// Z_curve { +// val: Scalar::from_literal(random as u128), +// } +// } + +// fn field_zero() -> Self::field_type { +// Z_curve { +// val: Scalar::from_literal(0u128), +// } // Scalar::ZERO() +// } + +// fn field_one() -> Self::field_type { +// Z_curve { +// val: Scalar::from_literal(1u128), +// } // Scalar::ONE() +// } + +// fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { +// Z_curve { val: x.val + y.val } +// } -type Group_curve = Fp12; +// fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { +// Z_curve { val: x.val * y.val } +// } +// } + +// #[derive(core::marker::Copy, Clone, PartialEq, Eq)] +// struct Group_curve { +// val: Fp12, +// } + +// impl hacspec_concordium::Deserial for Group_curve { +// // TODO: +// fn deserial(_source: &mut R) -> ParseResult { +// Err(ParseError {}) +// } +// } + +// impl hacspec_concordium::Serial for Group_curve { +// // TODO: +// fn serial(&self, _out: &mut W) -> Result<(), W::Err> { +// Ok(()) +// } +// } -// impl Group for Fp12 { -// group_type = Fp12; +// impl Group for Group_curve { +// type group_type = Group_curve; + +// const g: Self::group_type = Group_curve { +// val: pairing(g1(), g2()), +// }; // TODO + +// // TODO +// fn random_group_elem(random: u32) -> Self::group_type { +// Group_curve { +// val: fp12fromfp6(fp6fromfp2(fp2fromfp(Fp::from_literal(random as u128)))), +// } +// } + +// fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { +// Group_curve { +// val: fp12exp(g.val, x.val), +// } +// } + +// fn g_pow(x: ::field_type) -> Self::group_type { +// Self::pow(Self::g, x) +// } + +// fn group_one() -> Self::group_type { +// Group_curve { +// val: fp12fromfp6(fp6fromfp2(fp2fromfp(Fp::from_literal(1u128)))), +// } // ONE +// } + +// fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { +// Group_curve { +// val: fp12mul(x.val, y.val), +// } +// } + +// fn inv(x: Self::group_type) -> Self::group_type { +// Group_curve { +// val: fp12inv(x.val), +// } +// } + +// fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { +// Self::prod(x, Self::inv(y)) +// } + +// fn hash( +// x: Self::group_type, +// y: Self::group_type, +// z: Self::group_type, +// ) -> ::field_type { +// // fp_hash_to_field +// Z_curve::field_one() // TODO: bls12-381 hash to curve? +// } // } From 6fe2cd09c4155cd9d2644d95292f0b910542defc Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 24 Jan 2024 22:42:04 +0100 Subject: [PATCH 44/86] Not working :( --- ovn/src/ovn_group.rs | 248 ++++++++++++++++++++++++------------------- 1 file changed, 138 insertions(+), 110 deletions(-) diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs index df973b8..00cd0f3 100644 --- a/ovn/src/ovn_group.rs +++ b/ovn/src/ovn_group.rs @@ -4,6 +4,7 @@ #[hax_lib_macros::exclude] extern crate hax_lib_macros; + #[hax_lib_macros::exclude] use hax_lib_macros::*; @@ -13,7 +14,7 @@ use hacspec_concordium::*; use hacspec_concordium_derive::*; pub trait Z_Field: core::marker::Copy { - type field_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; + type field_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize + core::fmt::Debug; const q: usize; @@ -28,12 +29,10 @@ pub trait Z_Field: core::marker::Copy { /** Interface for group implementation */ pub trait Group: core::marker::Copy { - type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; + type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize + core::fmt::Debug; const g: Self::group_type; // Generator (elemnent of group) - fn random_group_elem(random: u32) -> Self::group_type; - fn g_pow(x: Z::field_type) -> Self::group_type; fn pow(g: Self::group_type, x: Z::field_type) -> Self::group_type; // TODO: Link with q fn group_one() -> Self::group_type; @@ -44,21 +43,76 @@ pub trait Group: core::marker::Copy { fn hash(x: Self::group_type, y: Self::group_type, z: Self::group_type) -> Z::field_type; } -// struct eligible_votes { -// v_id : u32, -// } -// /** number of parties */ -// const n : u32 = 3u32; -// const P : [eligible_votes; 3] = // n = 3 -// [eligible_votes {v_id: 0}, -// eligible_votes {v_id: 1}, -// eligible_votes {v_id: 2}]; +#[derive(Clone, Copy)] +pub struct z_17 {} +impl Z_Field for z_17 { + type field_type = u32; + const q: usize = 17; // Prime order + fn random_field_elem(random: u32) -> Self::field_type { + random % (Self::q as u32) + } + + fn field_zero() -> Self::field_type { + 0 + } + + fn field_one() -> Self::field_type { + 1 + } + + fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { + (x + y) % (Self::q as u32) + } + + fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { + (x * y) % (Self::q as u32) + } +} + +#[derive(Clone, Copy)] +pub struct g_z_17 {} +impl Group for g_z_17 { + type group_type = u32; + + const g: Self::group_type = 3; // Generator (elemnent of group) + + fn hash(x: Self::group_type, y: Self::group_type, z: Self::group_type) -> ::field_type { + 5 // TODO + } + + fn g_pow(x: u32) -> Self::group_type { + (Self::g.pow(x)) % (z_17::q as u32) + } + + fn pow(g: Self::group_type, x: u32) -> Self::group_type { + (g.pow(x)) % (z_17::q as u32) + } -// use concordium_contracts_common::*; -// extern crate concordium_std; + fn group_one() -> Self::group_type { + 1 + } -// use hacspec_sha256::*; + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { + (x * y) % (z_17::q as u32) + } + + fn inv(x: Self::group_type) -> Self::group_type { + let mut res = 0; + for i in 1.. (z_17::q as u32) { + let i_computation = i; + if Self::g_pow(i) == x { + res = i_computation; + } + } + res + // [0, 1, 9, 6, 13, 7, 3, 5, 15, 2, 12, 14, 10, 4, 11, 8, 16][x as usize] + } + + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { + Self::prod(x, Self::inv(y)) + } +} #[derive(Serialize, SchemaType, Clone, Copy)] pub struct SchnorrZKPCommit> { @@ -71,25 +125,68 @@ pub struct SchnorrZKPCommit> { // https://crypto.stanford.edu/cs355/19sp/lec5.pdf pub fn schnorr_zkp>( random: u32, - g_pow_x: G::group_type, + h: G::group_type, x: Z::field_type, ) -> SchnorrZKPCommit { let r = Z::random_field_elem(random); let u = G::g_pow(r); - let c = G::hash(G::g, g_pow_x, u); - let z = Z::add(r, Z::mul(c, x)); + let c = G::hash(G::g, h, u); + let z = Z::add(r, Z::mul(c, x)); // g^(r + c * x) =?= u * (g^x)^c return SchnorrZKPCommit { u, c, z }; } // https://crypto.stanford.edu/cs355/19sp/lec5.pdf pub fn schnorr_zkp_validate>( - g_pow_x: G::group_type, + h: G::group_type, pi: SchnorrZKPCommit, ) -> bool { - pi.c == G::hash(G::g, g_pow_x, pi.u) && G::g_pow(pi.z) == G::prod(pi.u, G::pow(g_pow_x, pi.c)) + pi.c == G::hash(G::g, h, pi.u) && G::g_pow(pi.z) == G::prod(pi.u, G::pow(h, pi.c)) +} +#[cfg(test)] +extern crate quickcheck; +#[cfg(test)] +#[macro_use(quickcheck)] +extern crate quickcheck_macros; + +#[cfg(test)] +use quickcheck::*; + +#[cfg(test)] +use rand::random; + +#[test] +pub fn schorr_zkp_correctness() { + fn test(random_x : u32, random_r : u32) -> bool { + type Z = z_17; + type G = g_z_17; + + let x : u32 = Z::random_field_elem(random_x); // 2 works + let pow_x = G::g_pow(x); + + let pi : SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); + + let valid = schnorr_zkp_validate::(pow_x, pi); + valid + } + + QuickCheck::new() + .tests(10000) + .quickcheck(test as fn(u32, u32) -> bool) } +// WORKS: +// #[test] +// pub fn schorr_zkp_correctness() { +// use rand::random; + +// type Z = z_17; +// type G = g_z_17; + +// let x : u32 = random::() % 17u32; +// assert!( schnorr_zkp_validate::(G::g_pow(x), schnorr_zkp(3, G::g_pow(x), x)) ); +// } + #[derive(Serialize, SchemaType, Clone, Copy)] pub struct OrZKPCommit> { a: G::group_type, @@ -333,7 +430,10 @@ pub fn test_correctness, const n : usize, A: HasActions> use rand::random; // rand::SeedableRng::seed_from_u64(32u64); // TODO - let votes: Vec = Vec::new(); + let mut votes: Vec = Vec::new(); + for i in 0..n { + votes.push(random()); + } // Setup the context let mut ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); @@ -398,88 +498,14 @@ pub fn test_correctness, const n : usize, A: HasActions> ) } -#[derive(Clone, Copy)] -pub struct z_17 {} -impl Z_Field for z_17 { - type field_type = u32; - const q: usize = 17; // Prime order - fn random_field_elem(random: u32) -> Self::field_type { - random % (Self::q as u32) - } - - fn field_zero() -> Self::field_type { - 0 - } - - fn field_one() -> Self::field_type { - 1 - } - - fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { - (x + y) % (Self::q as u32) - } - - fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { - (x * y) % (Self::q as u32) - } -} - -#[derive(Clone, Copy)] -pub struct g_z_17 {} -impl Group for g_z_17 { - type group_type = u32; - - const g: Self::group_type = 3; // Generator (elemnent of group) - - fn random_group_elem(random: u32) -> Self::group_type { - random % (z_17::q as u32) - } - - fn hash(x: Self::group_type, y: Self::group_type, z: Self::group_type) -> ::field_type { - (x * y * z) % (z_17::q as u32) // TODO - } - - fn g_pow(x: u32) -> Self::group_type { - (Self::g ^ x) % (z_17::q as u32) - } - - fn pow(g: Self::group_type, x: u32) -> Self::group_type { - (Self::g ^ x) % (z_17::q as u32) - } - - fn group_one() -> Self::group_type { - 1 - } - - fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { - (x * y) % (z_17::q as u32) - } - - fn inv(x: Self::group_type) -> Self::group_type { - let mut res = 0; - for i in 1.. (z_17::q as u32) { - let i_computation = i; - if Self::g_pow(i) == x { - res = i_computation; - } - } - res - // [0, 1, 9, 6, 13, 7, 3, 5, 15, 2, 12, 14, 10, 4, 11, 8, 16][x as usize] - } - - fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { - Self::prod(x, Self::inv(y)) - } -} - -#[concordium_test] -fn test() { - type Z = z_17; - type G = g_z_17; - const n: usize = 20; +// #[concordium_test] +// fn test() { +// type Z = z_17; +// type G = g_z_17; +// const n: usize = 20; - test_correctness::() -} +// test_correctness::() +// } // use hacspec_bls12_381::*; // use hacspec_bls12_381_hash::*; @@ -561,13 +587,6 @@ fn test() { // val: pairing(g1(), g2()), // }; // TODO -// // TODO -// fn random_group_elem(random: u32) -> Self::group_type { -// Group_curve { -// val: fp12fromfp6(fp6fromfp2(fp2fromfp(Fp::from_literal(random as u128)))), -// } -// } - // fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { // Group_curve { // val: fp12exp(g.val, x.val), @@ -609,3 +628,12 @@ fn test() { // Z_curve::field_one() // TODO: bls12-381 hash to curve? // } // } + +// #[concordium_test] +// fn test() { +// type Z = Z_curve; +// type G = Group_curve; +// const n: usize = 20; + +// test_correctness::() +// } From f5896b9d02018b01e27deafb6cbbd88501619338 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Thu, 25 Jan 2024 17:58:15 +0100 Subject: [PATCH 45/86] Semi workin one-out-of-two --- .../ssprove/extraction/Hacspec_ovn_by_hand.v | 4 + ovn/src/ovn_group.rs | 572 +++++++++++------- 2 files changed, 358 insertions(+), 218 deletions(-) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v index 056df88..faaae50 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v @@ -324,6 +324,10 @@ Next Obligation. solve_ssprove_obligations. Defined. Next Obligation. solve_ssprove_obligations. Defined. Next Obligation. solve_ssprove_obligations. Defined. Next Obligation. solve_ssprove_obligations. Defined. +Next Obligation. solve_ssprove_obligations. Defined. +Next Obligation. solve_ssprove_obligations. Defined. +Next Obligation. solve_ssprove_obligations. Defined. +Next Obligation. solve_ssprove_obligations. Defined. Fail Next Obligation. Definition commit_to_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs index 00cd0f3..bb57325 100644 --- a/ovn/src/ovn_group.rs +++ b/ovn/src/ovn_group.rs @@ -13,10 +13,22 @@ use hacspec_concordium::*; #[exclude] use hacspec_concordium_derive::*; +#[cfg(test)] +extern crate quickcheck; +#[cfg(test)] +#[macro_use(quickcheck)] +extern crate quickcheck_macros; + +#[cfg(test)] +use quickcheck::*; + +#[cfg(test)] +use rand::random; + pub trait Z_Field: core::marker::Copy { - type field_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize + core::fmt::Debug; + type field_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; // + core::fmt::Debug - const q: usize; + fn q() -> Self::field_type; fn random_field_elem(random: u32) -> Self::field_type; @@ -29,9 +41,9 @@ pub trait Z_Field: core::marker::Copy { /** Interface for group implementation */ pub trait Group: core::marker::Copy { - type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize + core::fmt::Debug; + type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; // + core::fmt::Debug - const g: Self::group_type; // Generator (elemnent of group) + fn g() -> Self::group_type; // Generator (elemnent of group) fn g_pow(x: Z::field_type) -> Self::group_type; fn pow(g: Self::group_type, x: Z::field_type) -> Self::group_type; // TODO: Link with q @@ -43,30 +55,31 @@ pub trait Group: core::marker::Copy { fn hash(x: Self::group_type, y: Self::group_type, z: Self::group_type) -> Z::field_type; } - #[derive(Clone, Copy)] pub struct z_17 {} impl Z_Field for z_17 { type field_type = u32; - const q: usize = 17; // Prime order + fn q() -> Self::field_type { + 17u32 + } // Prime order fn random_field_elem(random: u32) -> Self::field_type { - random % (Self::q as u32) + random % (Self::q() - 1) } fn field_zero() -> Self::field_type { - 0 + 0u32 } fn field_one() -> Self::field_type { - 1 + 1u32 } fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { - (x + y) % (Self::q as u32) + (x + y) % (Self::q() - 1) } fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { - (x * y) % (Self::q as u32) + (x * y) % (Self::q() - 1) } } @@ -75,18 +88,29 @@ pub struct g_z_17 {} impl Group for g_z_17 { type group_type = u32; - const g: Self::group_type = 3; // Generator (elemnent of group) + fn g() -> Self::group_type { + 3u32 + } // Generator (elemnent of group) - fn hash(x: Self::group_type, y: Self::group_type, z: Self::group_type) -> ::field_type { + fn hash( + x: Self::group_type, + y: Self::group_type, + z: Self::group_type, + ) -> ::field_type { 5 // TODO } - fn g_pow(x: u32) -> Self::group_type { - (Self::g.pow(x)) % (z_17::q as u32) + fn g_pow(x: ::field_type) -> Self::group_type { + Self::pow(Self::g(), x) } - fn pow(g: Self::group_type, x: u32) -> Self::group_type { - (g.pow(x)) % (z_17::q as u32) + // TODO: use repeated squaring instead! + fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { + let mut result = Self::group_one(); + for i in 0..(x % (z_17::q() - 1)) { + result = Self::prod(result, g); + } + result } fn group_one() -> Self::group_type { @@ -94,12 +118,12 @@ impl Group for g_z_17 { } fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { - (x * y) % (z_17::q as u32) + ((x % z_17::q()) * (y % z_17::q())) % z_17::q() } fn inv(x: Self::group_type) -> Self::group_type { let mut res = 0; - for i in 1.. (z_17::q as u32) { + for i in 1..z_17::q() { let i_computation = i; if Self::g_pow(i) == x { res = i_computation; @@ -110,10 +134,167 @@ impl Group for g_z_17 { } fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { + assert!(Self::inv(y) < 17); + assert!(x < 17); Self::prod(x, Self::inv(y)) } } +#[test] +pub fn z_17_correctness() { + type Z = z_17; + type G = g_z_17; + + assert!( + G::g_pow(0) == 1 + && G::g_pow(1) == 3 + && G::g_pow(2) == 9 + && G::g_pow(3) == 10 + && G::g_pow(4) == 13 + && G::g_pow(5) == 5 + && G::g_pow(6) == 15 + && G::g_pow(7) == 11 + && G::g_pow(8) == 16 + && G::g_pow(9) == 14 + && G::g_pow(10) == 8 + && G::g_pow(11) == 7 + && G::g_pow(12) == 4 + && G::g_pow(13) == 12 + && G::g_pow(14) == 2 + && G::g_pow(15) == 6 + && G::g_pow(16) == 1 + ) +} + +use hacspec_bls12_381::*; +use hacspec_bls12_381_hash::*; + +#[derive(core::marker::Copy, Clone, PartialEq, Eq)] +struct Z_curve { + val: Scalar, +} + +impl hacspec_concordium::Deserial for Z_curve { + // TODO: + fn deserial(_source: &mut R) -> ParseResult { + Err(ParseError {}) + } +} + +impl hacspec_concordium::Serial for Z_curve { + // TODO: + fn serial(&self, _out: &mut W) -> Result<(), W::Err> { + Ok(()) + } +} + +impl Z_Field for Z_curve { + type field_type = Z_curve; + + fn q() -> Self::field_type { + Z_curve { + val: Scalar::from_hex("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab"), + } // TODO: Scalar::modulo_value; + } + + fn random_field_elem(random: u32) -> Self::field_type { + Z_curve { + val: Scalar::from_literal(random as u128), + } + } + + fn field_zero() -> Self::field_type { + Z_curve { + val: Scalar::from_literal(0u128), + } // Scalar::ZERO() + } + + fn field_one() -> Self::field_type { + Z_curve { + val: Scalar::from_literal(1u128), + } // Scalar::ONE() + } + + fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { + Z_curve { val: x.val + y.val } + } + + fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { + Z_curve { val: x.val * y.val } + } +} + +#[derive(core::marker::Copy, Clone, PartialEq, Eq)] +struct Group_curve { + val: Fp12, +} + +impl hacspec_concordium::Deserial for Group_curve { + // TODO: + fn deserial(_source: &mut R) -> ParseResult { + Err(ParseError {}) + } +} + +impl hacspec_concordium::Serial for Group_curve { + // TODO: + fn serial(&self, _out: &mut W) -> Result<(), W::Err> { + Ok(()) + } +} + +impl Group for Group_curve { + type group_type = Group_curve; + + // https://eips.ethereum.org/EIPS/eip-2333 + fn g() -> Self::group_type { + Group_curve { + val: pairing(g1(), g2()), + } + } // TODO + + fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { + Group_curve { + val: fp12exp(g.val, x.val), + } + } + + fn g_pow(x: ::field_type) -> Self::group_type { + Self::pow(Self::g(), x) + } + + fn group_one() -> Self::group_type { + Group_curve { + val: fp12fromfp6(fp6fromfp2(fp2fromfp(Fp::from_literal(1u128)))), + } // ONE + } + + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { + Group_curve { + val: fp12mul(x.val, y.val), + } + } + + fn inv(x: Self::group_type) -> Self::group_type { + Group_curve { + val: fp12inv(x.val), + } + } + + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { + Self::prod(x, Self::inv(y)) + } + + fn hash( + x: Self::group_type, + y: Self::group_type, + z: Self::group_type, + ) -> ::field_type { + // fp_hash_to_field + Z_curve::field_one() // TODO: bls12-381 hash to curve? + } +} + #[derive(Serialize, SchemaType, Clone, Copy)] pub struct SchnorrZKPCommit> { u: G::group_type, @@ -130,7 +311,7 @@ pub fn schnorr_zkp>( ) -> SchnorrZKPCommit { let r = Z::random_field_elem(random); let u = G::g_pow(r); - let c = G::hash(G::g, h, u); + let c = G::hash(G::g(), h, u); let z = Z::add(r, Z::mul(c, x)); // g^(r + c * x) =?= u * (g^x)^c return SchnorrZKPCommit { u, c, z }; @@ -141,32 +322,21 @@ pub fn schnorr_zkp_validate>( h: G::group_type, pi: SchnorrZKPCommit, ) -> bool { - pi.c == G::hash(G::g, h, pi.u) && G::g_pow(pi.z) == G::prod(pi.u, G::pow(h, pi.c)) + pi.c == G::hash(G::g(), h, pi.u) && G::g_pow(pi.z) == G::prod(pi.u, G::pow(h, pi.c)) } -#[cfg(test)] -extern crate quickcheck; -#[cfg(test)] -#[macro_use(quickcheck)] -extern crate quickcheck_macros; - -#[cfg(test)] -use quickcheck::*; - -#[cfg(test)] -use rand::random; #[test] pub fn schorr_zkp_correctness() { - fn test(random_x : u32, random_r : u32) -> bool { + fn test(random_x: u32, random_r: u32) -> bool { type Z = z_17; type G = g_z_17; - let x : u32 = Z::random_field_elem(random_x); // 2 works + let x: u32 = Z::random_field_elem(random_x); let pow_x = G::g_pow(x); - let pi : SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); + let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); - let valid = schnorr_zkp_validate::(pow_x, pi); + let valid = schnorr_zkp_validate::(pow_x, pi); valid } @@ -175,16 +345,25 @@ pub fn schorr_zkp_correctness() { .quickcheck(test as fn(u32, u32) -> bool) } -// WORKS: // #[test] -// pub fn schorr_zkp_correctness() { -// use rand::random; +// pub fn schorr_zkp_correctness_bls() { +// fn test(random_x: u32, random_r: u32) -> bool { +// type Z = Z_curve; +// type G = Group_curve; + +// let x = Z::random_field_elem(random_x); // 2 works +// // let _ = G::g(); +// let pow_x = G::g_pow(x); + +// let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); -// type Z = z_17; -// type G = g_z_17; +// let valid = schnorr_zkp_validate::(pow_x, pi); +// valid +// } -// let x : u32 = random::() % 17u32; -// assert!( schnorr_zkp_validate::(G::g_pow(x), schnorr_zkp(3, G::g_pow(x), x)) ); +// QuickCheck::new() +// .tests(10) +// .quickcheck(test as fn(u32, u32) -> bool) // } #[derive(Serialize, SchemaType, Clone, Copy)] @@ -196,30 +375,53 @@ pub struct OrZKPCommit> { /** Cramer, Damgård and Schoenmakers (CDS) technique */ pub fn zkp_one_out_of_two>( random: u32, - g_pow_xi_yi_vi: G::group_type, - vi: bool, + g_pow_vi: G::group_type, + vi: Z::field_type, ) -> OrZKPCommit { - let w = if vi { Z::field_one() } else { Z::field_zero() }; - let x = g_pow_xi_yi_vi; + let w = vi; // TODO: not secure? + let x = g_pow_vi; let z = Z::random_field_elem(random); let a = G::g_pow(z); - let c = G::hash(G::g, x, a); + let c = G::hash(G::g(), x, a); let r = Z::add(z, Z::mul(c, w)); OrZKPCommit { a, r } } pub fn zkp_one_out_of_two_validate>( - g_pow_xi_yi_vi: G::group_type, + g_pow_vi: G::group_type, zkp: OrZKPCommit, ) -> bool { - let x = g_pow_xi_yi_vi; + let x = g_pow_vi; - let c = G::hash(G::g, x, zkp.a); + let c = G::hash(G::g(), x, zkp.a); G::g_pow(zkp.r) == G::prod(zkp.a, G::pow(x, c)) } +#[test] +pub fn or_zkp_correctness() { + fn test(random_x: u32, random_r: u32, v: bool) -> bool { + type Z = z_17; + type G = g_z_17; + + let xv = Z::add( + Z::random_field_elem(random_x), + if v { Z::field_one() } else { Z::field_zero() }, + ); + let pow_xv = G::g_pow(xv); + + let pi: OrZKPCommit = zkp_one_out_of_two(random_r, pow_xv, xv); + + let valid = zkp_one_out_of_two_validate::(pow_xv, pi); + valid + } + + QuickCheck::new() + .tests(10000) + .quickcheck(test as fn(u32, u32, bool) -> bool) +} + #[hax::contract_state(contract = "OVN")] // #[cfg_attr(not(feature = "hax_compilation"), contract_state(contract = "OVN"))] #[derive(Serialize, SchemaType, Clone, Copy)] @@ -237,8 +439,7 @@ pub struct OvnContractState, const n: usize> { #[hax::init(contract = "OVN")] // #[cfg_attr(not(feature = "hax_compilation"), init(contract = "OVN"))] -pub fn init_ovn_contract, const n: usize>( - // _: &impl HasInitContext, +pub fn init_ovn_contract, const n: usize>(// _: &impl HasInitContext, ) -> InitResult> { Ok(OvnContractState:: { g_pow_xis: [G::group_one(); n], @@ -300,23 +501,30 @@ pub struct CastVoteParam { } pub fn compute_group_element_for_vote, const n: usize>( - i: u32, + i: usize, xi: Z::field_type, vote: bool, xis: [G::group_type; n], ) -> G::group_type { + assert!(G::g_pow(xi) == xis[i]); + let mut prod1 = G::group_one(); - for j in 0..(i - 1) as usize { - prod1 = G::prod(prod1, xis[j]); + if i > 0 { + for j in 0..(i - 1) { + prod1 = G::prod(prod1, xis[j]); + } } + let mut prod2 = G::group_one(); - for j in (i + 1) as usize..n { + for j in (i + 1)..n { prod2 = G::prod(prod2, xis[j]); } - let Yi = G::div(prod1, prod2); - // implicityly: Y_i = g^y_i + + // implicitly: Y_i = g^y_i + let g_yi = G::div(prod1, prod2); + G::prod( - G::pow(Yi, xi), + G::pow(g_yi, xi), G::g_pow(if vote { Z::field_one() } else { @@ -345,7 +553,7 @@ pub fn commit_to_vote, const n: usize, A: HasActions>( } let g_pow_xi_yi_vi = compute_group_element_for_vote::( - params.cvp_i, + params.cvp_i as usize, params.cvp_xi, params.cvp_vote, state.g_pow_xis, @@ -367,12 +575,18 @@ pub fn cast_vote, const n: usize, A: HasActions>( let params: CastVoteParam = ctx.parameter_cursor().get()?; let g_pow_xi_yi_vi = compute_group_element_for_vote::( - params.cvp_i, + params.cvp_i as usize, params.cvp_xi, params.cvp_vote, state.g_pow_xis, ); - let zkp_vi = zkp_one_out_of_two::(params.cvp_zkp_random, g_pow_xi_yi_vi, params.cvp_vote); + // let zkp_vi = zkp_one_out_of_two::(params.cvp_zkp_random, g_pow_xi_yi_vi, params.cvp_xi, params.cvp_vote); + let w = Z::mul(params.cvp_xi, if params.cvp_vote { + Z::field_one() + } else { + Z::field_zero() + }); + let zkp_vi = zkp_one_out_of_two::(params.cvp_zkp_random, G::g_pow(w), w); let mut cast_vote_state_ret = state.clone(); cast_vote_state_ret.g_pow_xi_yi_vis[params.cvp_i as usize] = g_pow_xi_yi_vi; @@ -396,9 +610,12 @@ pub fn tally_votes, const n: usize, A: HasActions>( state: OvnContractState, ) -> Result<(A, OvnContractState), ParseError> { for i in 0..n { - zkp_one_out_of_two_validate::(state.g_pow_xi_yi_vis[i], state.zkp_vis[i]); - check_commitment::(state.g_pow_xi_yi_vis[i], state.commit_vis[i]); - () + if !zkp_one_out_of_two_validate::(state.g_pow_xi_yi_vis[i], state.zkp_vis[i]) { + return Err(ParseError {}); + } + if !check_commitment::(state.g_pow_xi_yi_vis[i], state.commit_vis[i]) { + return Err(ParseError {}); + } } let mut vote_result = G::group_one(); @@ -426,56 +643,54 @@ pub fn tally_votes, const n: usize, A: HasActions>( // use crate::test_infrastructure::*; #[cfg(test)] -pub fn test_correctness, const n : usize, A: HasActions>() -> () { - use rand::random; - // rand::SeedableRng::seed_from_u64(32u64); // TODO - - let mut votes: Vec = Vec::new(); - for i in 0..n { - votes.push(random()); - } - +pub fn test_correctness, const n: usize, A: HasActions>( + votes: [bool; n], + xis: [Z::field_type; n], + rp_zkp_randoms: [u32; n], + cvp_zkp_randoms1: [u32; n], + cvp_zkp_randoms2: [u32; n], +) -> bool { // Setup the context let mut ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); // ctx.set_sender(ADDRESS_0); - let mut state : OvnContractState = init_ovn_contract().unwrap(); - - let mut xis = Vec::new(); - for i in 0..n { - xis.push(select_private_voting_key::(random())); - } + let mut state: OvnContractState = init_ovn_contract().unwrap(); for i in 0..n { let parameter = RegisterParam:: { rp_i: i as u32, rp_xi: xis[i], - rp_zkp_random: random(), // TODO + rp_zkp_random: rp_zkp_randoms[i], // TODO }; let parameter_bytes = to_bytes(¶meter); - (_, state) = register_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); + (_, state) = + register_vote::(ctx.clone().set_parameter(¶meter_bytes), state) + .unwrap(); } for i in 0..n { let parameter = CastVoteParam:: { cvp_i: i as u32, cvp_xi: xis[i], - cvp_zkp_random: random(), // TODO + cvp_zkp_random: cvp_zkp_randoms1[i], cvp_vote: votes[i], }; let parameter_bytes = to_bytes(¶meter); - (_, state) = commit_to_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); + (_, state) = + commit_to_vote::(ctx.clone().set_parameter(¶meter_bytes), state) + .unwrap(); } for i in 0..n { let parameter = CastVoteParam:: { cvp_i: i as u32, cvp_xi: xis[i], - cvp_zkp_random: random(), // TODO + cvp_zkp_random: cvp_zkp_randoms2[i], cvp_vote: votes[i], }; let parameter_bytes = to_bytes(¶meter); - (_, state) = cast_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); + (_, state) = + cast_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); } let parameter = TallyParameter {}; @@ -491,149 +706,70 @@ pub fn test_correctness, const n : usize, A: HasActions> } } - claim_eq!( - state.tally, - count, - "The tally should equal the number of positive votes" - ) + // claim_eq!( + // state.tally, + // count, + // "The tally should equal the number of positive votes" + // ); + + assert_eq!(state.tally, count); + state.tally == count + // true } // #[concordium_test] -// fn test() { -// type Z = z_17; -// type G = g_z_17; -// const n: usize = 20; - -// test_correctness::() -// } - -// use hacspec_bls12_381::*; -// use hacspec_bls12_381_hash::*; - -// #[derive(core::marker::Copy, Clone, PartialEq, Eq)] -// struct Z_curve { -// val: Scalar, -// } - -// impl hacspec_concordium::Deserial for Z_curve { -// // TODO: -// fn deserial(_source: &mut R) -> ParseResult { -// Err(ParseError {}) -// } -// } - -// impl hacspec_concordium::Serial for Z_curve { -// // TODO: -// fn serial(&self, _out: &mut W) -> Result<(), W::Err> { -// Ok(()) -// } -// } - -// impl Z_Field for Z_curve { -// type field_type = Z_curve; - -// const q: usize = 11; // TODO: Scalar::modulo_value; - -// fn random_field_elem(random: u32) -> Self::field_type { -// Z_curve { -// val: Scalar::from_literal(random as u128), -// } -// } - -// fn field_zero() -> Self::field_type { -// Z_curve { -// val: Scalar::from_literal(0u128), -// } // Scalar::ZERO() -// } - -// fn field_one() -> Self::field_type { -// Z_curve { -// val: Scalar::from_literal(1u128), -// } // Scalar::ONE() -// } - -// fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { -// Z_curve { val: x.val + y.val } -// } - -// fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { -// Z_curve { val: x.val * y.val } -// } -// } - -// #[derive(core::marker::Copy, Clone, PartialEq, Eq)] -// struct Group_curve { -// val: Fp12, -// } - -// impl hacspec_concordium::Deserial for Group_curve { -// // TODO: -// fn deserial(_source: &mut R) -> ParseResult { -// Err(ParseError {}) -// } -// } - -// impl hacspec_concordium::Serial for Group_curve { -// // TODO: -// fn serial(&self, _out: &mut W) -> Result<(), W::Err> { -// Ok(()) -// } -// } - -// impl Group for Group_curve { -// type group_type = Group_curve; - -// const g: Self::group_type = Group_curve { -// val: pairing(g1(), g2()), -// }; // TODO - -// fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { -// Group_curve { -// val: fp12exp(g.val, x.val), -// } -// } - -// fn g_pow(x: ::field_type) -> Self::group_type { -// Self::pow(Self::g, x) -// } - -// fn group_one() -> Self::group_type { -// Group_curve { -// val: fp12fromfp6(fp6fromfp2(fp2fromfp(Fp::from_literal(1u128)))), -// } // ONE -// } +#[test] +fn test_full_z17() { + type Z = z_17; + type G = g_z_17; + const n: usize = 20; -// fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { -// Group_curve { -// val: fp12mul(x.val, y.val), -// } -// } + use rand::random; -// fn inv(x: Self::group_type) -> Self::group_type { -// Group_curve { -// val: fp12inv(x.val), -// } -// } + // fn test() -> bool { + // rand::SeedableRng::seed_from_u64(32u64); // TODO + let mut votes: [bool; n] = [false; n]; + let mut xis: [::field_type; n] = [0; n]; + let mut rp_zkp_randoms: [u32; n] = [0; n]; + let mut cvp_zkp_randoms1: [u32; n] = [0; n]; + let mut cvp_zkp_randoms2: [u32; n] = [0; n]; -// fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { -// Self::prod(x, Self::inv(y)) -// } + for i in 0..n { + votes[i] = false // random() + ; + xis[i] = Z::random_field_elem(random()); + rp_zkp_randoms[i] = random(); + cvp_zkp_randoms1[i] = random(); + cvp_zkp_randoms2[i] = random(); + } -// fn hash( -// x: Self::group_type, -// y: Self::group_type, -// z: Self::group_type, -// ) -> ::field_type { -// // fp_hash_to_field -// Z_curve::field_one() // TODO: bls12-381 hash to curve? -// } -// } + assert!(test_correctness::< + Z, + G, + n, + hacspec_concordium::test_infrastructure::ActionsTree, + >( + votes, + xis, + rp_zkp_randoms, + cvp_zkp_randoms1, + cvp_zkp_randoms2 + )) + // }; + + // QuickCheck::new() + // .tests(1) + // .quickcheck(test as fn() -> bool) +} // #[concordium_test] -// fn test() { +// fn test_bls12_381() { // type Z = Z_curve; // type G = Group_curve; // const n: usize = 20; +// use rand::random; +// // rand::SeedableRng::seed_from_u64(32u64); // TODO + // test_correctness::() // } From ee56091de73b9ab6ebf7ae8d64eebe996fe01d5f Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Fri, 26 Jan 2024 01:36:32 +0100 Subject: [PATCH 46/86] Working OVN? --- bls12-381/src/bls12-381.rs | 9 +- ovn/src/ovn_group.rs | 616 +++++++++++++++++++++++-------------- 2 files changed, 394 insertions(+), 231 deletions(-) diff --git a/bls12-381/src/bls12-381.rs b/bls12-381/src/bls12-381.rs index 8dec41f..28409fd 100644 --- a/bls12-381/src/bls12-381.rs +++ b/bls12-381/src/bls12-381.rs @@ -509,6 +509,7 @@ fn final_exponentiation(f: Fp12) -> Fp12 { let t1 = fp12mul(t1, t2); //t1t2 t1 } + //ate-pairing used for BLS pub fn pairing(p: G1, q: G2) -> Fp12 { let t = Scalar::from_literal(0xd201000000010000u128); @@ -810,15 +811,15 @@ fn test_g2_add_double_special_case() { //https://tools.ietf.org/id/draft-yonezawa-pairing-friendly-curves-02.html#rfc.section.4.2.2 //THIS IS A CORRECT G1 GENERATOR :) -#[cfg(test)] -fn g1() -> G1 { +// #[cfg(test)] +pub fn g1() -> G1 { (Fp::from_hex("17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb"), Fp::from_hex("08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1"), false) } //THIS IS A CORRECT G2 GENERATOR :) -#[cfg(test)] -fn g2() -> G2 { +// #[cfg(test)] +pub fn g2() -> G2 { ((Fp::from_hex("24aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8"), Fp::from_hex("13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e")), (Fp::from_hex("0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801"), diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs index bb57325..df9b981 100644 --- a/ovn/src/ovn_group.rs +++ b/ovn/src/ovn_group.rs @@ -26,7 +26,12 @@ use quickcheck::*; use rand::random; pub trait Z_Field: core::marker::Copy { - type field_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; // + core::fmt::Debug + type field_type: PartialEq + + Eq + + Clone + + Copy + + hacspec_concordium::Serialize + + core::fmt::Debug; fn q() -> Self::field_type; @@ -36,12 +41,18 @@ pub trait Z_Field: core::marker::Copy { fn field_one() -> Self::field_type; fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type; + fn sub(x: Self::field_type, y: Self::field_type) -> Self::field_type; fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type; } /** Interface for group implementation */ pub trait Group: core::marker::Copy { - type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; // + core::fmt::Debug + type group_type: PartialEq + + Eq + + Clone + + Copy + + hacspec_concordium::Serialize + + core::fmt::Debug; fn g() -> Self::group_type; // Generator (elemnent of group) @@ -52,7 +63,7 @@ pub trait Group: core::marker::Copy { fn inv(x: Self::group_type) -> Self::group_type; fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; - fn hash(x: Self::group_type, y: Self::group_type, z: Self::group_type) -> Z::field_type; + fn hash(x: Vec) -> Z::field_type; } #[derive(Clone, Copy)] @@ -78,6 +89,10 @@ impl Z_Field for z_17 { (x + y) % (Self::q() - 1) } + fn sub(x: Self::field_type, y: Self::field_type) -> Self::field_type { + (x + (Self::q() - 1) - y) % (Self::q() - 1) + } + fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { (x * y) % (Self::q() - 1) } @@ -92,11 +107,7 @@ impl Group for g_z_17 { 3u32 } // Generator (elemnent of group) - fn hash( - x: Self::group_type, - y: Self::group_type, - z: Self::group_type, - ) -> ::field_type { + fn hash(x: Vec) -> ::field_type { 5 // TODO } @@ -122,20 +133,17 @@ impl Group for g_z_17 { } fn inv(x: Self::group_type) -> Self::group_type { - let mut res = 0; - for i in 1..z_17::q() { - let i_computation = i; - if Self::g_pow(i) == x { - res = i_computation; - } - } - res - // [0, 1, 9, 6, 13, 7, 3, 5, 15, 2, 12, 14, 10, 4, 11, 8, 16][x as usize] + // let mut res = 0; + // for i in 1..z_17::q() { + // if Self::prod(Self::g_pow(i), x) == Self::group_one() { + // res = i; + // } + // } + // res + [0, 1, 9, 6, 13, 7, 3, 5, 15, 2, 12, 14, 10, 4, 11, 8, 16][x as usize] } fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { - assert!(Self::inv(y) < 17); - assert!(x < 17); Self::prod(x, Self::inv(y)) } } @@ -166,134 +174,159 @@ pub fn z_17_correctness() { ) } -use hacspec_bls12_381::*; -use hacspec_bls12_381_hash::*; +#[test] +pub fn z_17_inv_correctness() { + type Z = z_17; + type G = g_z_17; -#[derive(core::marker::Copy, Clone, PartialEq, Eq)] -struct Z_curve { - val: Scalar, -} + // [0, 1, 9, 6, 13, 7, 3, 5, 15, 2, 12, 14, 10, 4, 11, 8, 16] + assert_eq!(G::inv(0), 0); + assert_eq!(G::inv(1), 1); + assert_eq!(G::inv(2), 9); + assert_eq!(G::inv(3), 6); + assert_eq!(G::inv(4), 13); + assert_eq!(G::inv(5), 7); + assert_eq!(G::inv(6), 3); + assert_eq!(G::inv(7), 5); + assert_eq!(G::inv(8), 15); + assert_eq!(G::inv(9), 2); + assert_eq!(G::inv(10), 12); + assert_eq!(G::inv(11), 14); + assert_eq!(G::inv(12), 10); + assert_eq!(G::inv(13), 4); + assert_eq!(G::inv(14), 11); + assert_eq!(G::inv(15), 8); + assert_eq!(G::inv(16), 16); +} + +// use hacspec_bls12_381::*; +// use hacspec_bls12_381_hash::*; + +// #[derive(core::marker::Copy, Clone, PartialEq, Eq)] +// struct Z_curve { +// val: Scalar, +// } -impl hacspec_concordium::Deserial for Z_curve { - // TODO: - fn deserial(_source: &mut R) -> ParseResult { - Err(ParseError {}) - } -} +// impl hacspec_concordium::Deserial for Z_curve { +// // TODO: +// fn deserial(_source: &mut R) -> ParseResult { +// Err(ParseError {}) +// } +// } -impl hacspec_concordium::Serial for Z_curve { - // TODO: - fn serial(&self, _out: &mut W) -> Result<(), W::Err> { - Ok(()) - } -} +// impl hacspec_concordium::Serial for Z_curve { +// // TODO: +// fn serial(&self, _out: &mut W) -> Result<(), W::Err> { +// Ok(()) +// } +// } -impl Z_Field for Z_curve { - type field_type = Z_curve; +// impl Z_Field for Z_curve { +// type field_type = Z_curve; - fn q() -> Self::field_type { - Z_curve { - val: Scalar::from_hex("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab"), - } // TODO: Scalar::modulo_value; - } +// fn q() -> Self::field_type { +// Z_curve { +// val: Scalar::from_hex("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab"), +// } // TODO: Scalar::modulo_value; +// } - fn random_field_elem(random: u32) -> Self::field_type { - Z_curve { - val: Scalar::from_literal(random as u128), - } - } +// fn random_field_elem(random: u32) -> Self::field_type { +// Z_curve { +// val: Scalar::from_literal(random as u128), +// } +// } - fn field_zero() -> Self::field_type { - Z_curve { - val: Scalar::from_literal(0u128), - } // Scalar::ZERO() - } +// fn field_zero() -> Self::field_type { +// Z_curve { +// val: Scalar::from_literal(0u128), +// } // Scalar::ZERO() +// } - fn field_one() -> Self::field_type { - Z_curve { - val: Scalar::from_literal(1u128), - } // Scalar::ONE() - } +// fn field_one() -> Self::field_type { +// Z_curve { +// val: Scalar::from_literal(1u128), +// } // Scalar::ONE() +// } - fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { - Z_curve { val: x.val + y.val } - } +// fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { +// Z_curve { val: x.val + y.val } +// } - fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { - Z_curve { val: x.val * y.val } - } -} +// fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { +// Z_curve { val: x.val * y.val } +// } +// } -#[derive(core::marker::Copy, Clone, PartialEq, Eq)] -struct Group_curve { - val: Fp12, -} +// #[derive(core::marker::Copy, Clone, PartialEq, Eq)] +// struct Group_curve { +// val: Fp12, +// } -impl hacspec_concordium::Deserial for Group_curve { - // TODO: - fn deserial(_source: &mut R) -> ParseResult { - Err(ParseError {}) - } -} +// impl hacspec_concordium::Deserial for Group_curve { +// // TODO: +// fn deserial(_source: &mut R) -> ParseResult { +// Err(ParseError {}) +// } +// } -impl hacspec_concordium::Serial for Group_curve { - // TODO: - fn serial(&self, _out: &mut W) -> Result<(), W::Err> { - Ok(()) - } -} +// impl hacspec_concordium::Serial for Group_curve { +// // TODO: +// fn serial(&self, _out: &mut W) -> Result<(), W::Err> { +// Ok(()) +// } +// } -impl Group for Group_curve { - type group_type = Group_curve; +// impl Group for Group_curve { +// type group_type = Group_curve; - // https://eips.ethereum.org/EIPS/eip-2333 - fn g() -> Self::group_type { - Group_curve { - val: pairing(g1(), g2()), - } - } // TODO +// // https://eips.ethereum.org/EIPS/eip-2333 +// fn g() -> Self::group_type { +// Group_curve { +// val: pairing(g1(), g2()), +// } +// } // TODO - fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { - Group_curve { - val: fp12exp(g.val, x.val), - } - } +// fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { +// Group_curve { +// val: fp12exp(g.val, x.val), +// } +// } - fn g_pow(x: ::field_type) -> Self::group_type { - Self::pow(Self::g(), x) - } +// fn g_pow(x: ::field_type) -> Self::group_type { +// Self::pow(Self::g(), x) +// } - fn group_one() -> Self::group_type { - Group_curve { - val: fp12fromfp6(fp6fromfp2(fp2fromfp(Fp::from_literal(1u128)))), - } // ONE - } +// fn group_one() -> Self::group_type { +// Group_curve { +// val: fp12fromfp6(fp6fromfp2(fp2fromfp(Fp::from_literal(1u128)))), +// } // ONE +// } - fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { - Group_curve { - val: fp12mul(x.val, y.val), - } - } +// fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { +// Group_curve { +// val: fp12mul(x.val, y.val), +// } +// } - fn inv(x: Self::group_type) -> Self::group_type { - Group_curve { - val: fp12inv(x.val), - } - } +// fn inv(x: Self::group_type) -> Self::group_type { +// Group_curve { +// val: fp12inv(x.val), +// } +// } - fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { - Self::prod(x, Self::inv(y)) - } +// fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { +// Self::prod(x, Self::inv(y)) +// } - fn hash( - x: Self::group_type, - y: Self::group_type, - z: Self::group_type, - ) -> ::field_type { - // fp_hash_to_field - Z_curve::field_one() // TODO: bls12-381 hash to curve? - } -} +// fn hash( +// x: Self::group_type, +// y: Self::group_type, +// z: Self::group_type, +// ) -> ::field_type { +// // fp_hash_to_field +// Z_curve::field_one() // TODO: bls12-381 hash to curve? +// } +// } #[derive(Serialize, SchemaType, Clone, Copy)] pub struct SchnorrZKPCommit> { @@ -311,7 +344,7 @@ pub fn schnorr_zkp>( ) -> SchnorrZKPCommit { let r = Z::random_field_elem(random); let u = G::g_pow(r); - let c = G::hash(G::g(), h, u); + let c = G::hash(vec![G::g(), h, u]); let z = Z::add(r, Z::mul(c, x)); // g^(r + c * x) =?= u * (g^x)^c return SchnorrZKPCommit { u, c, z }; @@ -322,7 +355,7 @@ pub fn schnorr_zkp_validate>( h: G::group_type, pi: SchnorrZKPCommit, ) -> bool { - pi.c == G::hash(G::g(), h, pi.u) && G::g_pow(pi.z) == G::prod(pi.u, G::pow(h, pi.c)) + pi.c == G::hash(vec![G::g(), h, pi.u]) && G::g_pow(pi.z) == G::prod(pi.u, G::pow(h, pi.c)) } #[test] @@ -368,58 +401,135 @@ pub fn schorr_zkp_correctness() { #[derive(Serialize, SchemaType, Clone, Copy)] pub struct OrZKPCommit> { - a: G::group_type, - r: Z::field_type, + x: G::group_type, + y: G::group_type, + a1: G::group_type, + b1: G::group_type, + a2: G::group_type, + b2: G::group_type, + + c: Z::field_type, + + d1: Z::field_type, + d2: Z::field_type, + + r1: Z::field_type, + r2: Z::field_type, } /** Cramer, Damgård and Schoenmakers (CDS) technique */ pub fn zkp_one_out_of_two>( - random: u32, - g_pow_vi: G::group_type, - vi: Z::field_type, + random_w: u32, + random_r: u32, + random_d: u32, + h: G::group_type, + xi: Z::field_type, + vi: bool, ) -> OrZKPCommit { - let w = vi; // TODO: not secure? - let x = g_pow_vi; - - let z = Z::random_field_elem(random); - let a = G::g_pow(z); - let c = G::hash(G::g(), x, a); - let r = Z::add(z, Z::mul(c, w)); - - OrZKPCommit { a, r } + let w = Z::random_field_elem(random_w); + + if vi { + let r1 = Z::random_field_elem(random_r); + let d1 = Z::random_field_elem(random_d); + + let x = G::g_pow(xi); + let y = G::prod(G::pow(h, xi), G::g()); + + let a1 = G::prod(G::g_pow(r1), G::pow(x, d1)); + let b1 = G::prod(G::pow(h, r1), G::pow(y, d1)); + + let a2 = G::g_pow(w); + let b2 = G::pow(h, w); + + let c = G::hash(vec![x, y, a1, b1, a2, b2]); + + let d2 = Z::sub(c, d1); + let r2 = Z::sub(w, Z::mul(xi, d2)); + + OrZKPCommit { + x, + y, + a1, + b1, + a2, + b2, + c, + d1, + d2, + r1, + r2, + } + } else { + let r2 = Z::random_field_elem(random_r); + let d2 = Z::random_field_elem(random_d); + + let x = G::g_pow(xi); + let y = G::pow(h, xi); + + let a1 = G::g_pow(w); + let b1 = G::pow(h, w); + + let a2 = G::prod(G::g_pow(r2), G::pow(x, d2)); + let b2 = G::prod(G::pow(h, r2), G::pow(G::div(y, G::g()), d2)); + + let c = G::hash(vec![x, y, a1, b1, a2, b2]); + + let d1 = Z::sub(c, d2); + let r1 = Z::sub(w, Z::mul(xi, d1)); + + OrZKPCommit { + x, + y, + a1, + b1, + a2, + b2, + c, + d1, + d2, + r1, + r2, + } + } } +// Anonymous voting by two-round public discussion pub fn zkp_one_out_of_two_validate>( - g_pow_vi: G::group_type, + h: G::group_type, zkp: OrZKPCommit, ) -> bool { - let x = g_pow_vi; + let c = G::hash(vec![zkp.x, zkp.y, zkp.a1, zkp.b1, zkp.a2, zkp.b2]); // TODO: add i - let c = G::hash(G::g(), x, zkp.a); - G::g_pow(zkp.r) == G::prod(zkp.a, G::pow(x, c)) + (c == Z::add(zkp.d1, zkp.d2) + && zkp.a1 == G::prod(G::g_pow(zkp.r1), G::pow(zkp.x, zkp.d1)) + && zkp.b1 == G::prod(G::pow(h, zkp.r1), G::pow(zkp.y, zkp.d1)) + && zkp.a2 == G::prod(G::g_pow(zkp.r2), G::pow(zkp.x, zkp.d2)) + && zkp.b2 == G::prod(G::pow(h, zkp.r2), G::pow(G::div(zkp.y, G::g()), zkp.d2))) } #[test] pub fn or_zkp_correctness() { - fn test(random_x: u32, random_r: u32, v: bool) -> bool { + fn test( + random_w: u32, + random_r: u32, + random_d: u32, + random_h: u32, + random_x: u32, + v: bool, + ) -> bool { type Z = z_17; type G = g_z_17; - let xv = Z::add( - Z::random_field_elem(random_x), - if v { Z::field_one() } else { Z::field_zero() }, - ); - let pow_xv = G::g_pow(xv); - - let pi: OrZKPCommit = zkp_one_out_of_two(random_r, pow_xv, xv); - - let valid = zkp_one_out_of_two_validate::(pow_xv, pi); + let mut h = G::g_pow(Z::random_field_elem(random_h)); + let x = Z::random_field_elem(random_x); + let pi: OrZKPCommit = zkp_one_out_of_two(random_w, random_r, random_d, h, x, v); + let valid = zkp_one_out_of_two_validate::(h, pi); valid } QuickCheck::new() .tests(10000) - .quickcheck(test as fn(u32, u32, bool) -> bool) + .quickcheck(test as fn(u32, u32, u32, u32, u32, bool) -> bool) } #[hax::contract_state(contract = "OVN")] @@ -453,8 +563,20 @@ pub fn init_ovn_contract, const n: usize>(// _: &impl Ha g_pow_xi_yi_vis: [G::group_one(); n], zkp_vis: [OrZKPCommit:: { - a: G::group_one(), - r: Z::field_zero(), + x: G::group_one(), + y: G::group_one(), + a1: G::group_one(), + b1: G::group_one(), + a2: G::group_one(), + b2: G::group_one(), + + c: Z::field_zero(), + + d1: Z::field_zero(), + d2: Z::field_zero(), + + r1: Z::field_zero(), + r2: Z::field_zero(), }; n], tally: 0, @@ -496,23 +618,19 @@ pub fn register_vote, const n: usize, A: HasActions>( pub struct CastVoteParam { cvp_i: u32, cvp_xi: Z::field_type, - cvp_zkp_random: u32, + cvp_zkp_random_w: u32, + cvp_zkp_random_r: u32, + cvp_zkp_random_d: u32, cvp_vote: bool, } -pub fn compute_group_element_for_vote, const n: usize>( +pub fn compute_g_pow_yi, const n: usize>( i: usize, - xi: Z::field_type, - vote: bool, xis: [G::group_type; n], ) -> G::group_type { - assert!(G::g_pow(xi) == xis[i]); - let mut prod1 = G::group_one(); - if i > 0 { - for j in 0..(i - 1) { - prod1 = G::prod(prod1, xis[j]); - } + for j in 0..i { + prod1 = G::prod(prod1, xis[j]); } let mut prod2 = G::group_one(); @@ -521,10 +639,38 @@ pub fn compute_group_element_for_vote, const n: usize>( } // implicitly: Y_i = g^y_i - let g_yi = G::div(prod1, prod2); + let g_pow_yi = G::div(prod1, prod2); + g_pow_yi +} + +#[test] +pub fn sum_to_zero() { + type Z = z_17; + type G = g_z_17; + const n: usize = 15; + let mut xis: [::field_type; n] = [0; n]; + let mut g_pow_xis: [>::group_type; n] = [0; n]; + use rand::random; + for i in 0..n { + xis[i] = Z::random_field_elem(random()); + g_pow_xis[i] = G::g_pow(xis[i]); + } + + let mut res = G::group_one(); + for i in 0..n { + let g_pow_yi = compute_g_pow_yi::(i, g_pow_xis); + res = G::prod(res, G::pow(g_pow_yi, xis[i])); + } + assert_eq!(res, G::group_one()); +} +pub fn compute_group_element_for_vote>( + xi: Z::field_type, + vote: bool, + g_pow_yi: G::group_type, +) -> G::group_type { G::prod( - G::pow(g_yi, xi), + G::pow(g_pow_yi, xi), G::g_pow(if vote { Z::field_one() } else { @@ -552,12 +698,9 @@ pub fn commit_to_vote, const n: usize, A: HasActions>( } } - let g_pow_xi_yi_vi = compute_group_element_for_vote::( - params.cvp_i as usize, - params.cvp_xi, - params.cvp_vote, - state.g_pow_xis, - ); + let g_pow_yi = compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); + let g_pow_xi_yi_vi = + compute_group_element_for_vote::(params.cvp_xi, params.cvp_vote, g_pow_yi); let commit_vi = commit_to::(g_pow_xi_yi_vi); let mut commit_to_vote_state_ret = state.clone(); @@ -574,20 +717,18 @@ pub fn cast_vote, const n: usize, A: HasActions>( ) -> Result<(A, OvnContractState), ParseError> { let params: CastVoteParam = ctx.parameter_cursor().get()?; - let g_pow_xi_yi_vi = compute_group_element_for_vote::( - params.cvp_i as usize, + let g_pow_yi = compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); + let g_pow_xi_yi_vi = + compute_group_element_for_vote::(params.cvp_xi, params.cvp_vote, g_pow_yi); + + let zkp_vi = zkp_one_out_of_two::( + params.cvp_zkp_random_w, + params.cvp_zkp_random_r, + params.cvp_zkp_random_d, + g_pow_yi, params.cvp_xi, params.cvp_vote, - state.g_pow_xis, ); - // let zkp_vi = zkp_one_out_of_two::(params.cvp_zkp_random, g_pow_xi_yi_vi, params.cvp_xi, params.cvp_vote); - let w = Z::mul(params.cvp_xi, if params.cvp_vote { - Z::field_one() - } else { - Z::field_zero() - }); - let zkp_vi = zkp_one_out_of_two::(params.cvp_zkp_random, G::g_pow(w), w); - let mut cast_vote_state_ret = state.clone(); cast_vote_state_ret.g_pow_xi_yi_vis[params.cvp_i as usize] = g_pow_xi_yi_vi; cast_vote_state_ret.zkp_vis[params.cvp_i as usize] = zkp_vi; @@ -610,7 +751,8 @@ pub fn tally_votes, const n: usize, A: HasActions>( state: OvnContractState, ) -> Result<(A, OvnContractState), ParseError> { for i in 0..n { - if !zkp_one_out_of_two_validate::(state.g_pow_xi_yi_vis[i], state.zkp_vis[i]) { + let g_pow_yi = compute_g_pow_yi::(i as usize, state.g_pow_xis); + if !zkp_one_out_of_two_validate::(g_pow_yi, state.zkp_vis[i]) { return Err(ParseError {}); } if !check_commitment::(state.g_pow_xi_yi_vis[i], state.commit_vis[i]) { @@ -647,8 +789,12 @@ pub fn test_correctness, const n: usize, A: HasActions>( votes: [bool; n], xis: [Z::field_type; n], rp_zkp_randoms: [u32; n], - cvp_zkp_randoms1: [u32; n], - cvp_zkp_randoms2: [u32; n], + cvp_zkp_random_ws1: [u32; n], + cvp_zkp_random_rs1: [u32; n], + cvp_zkp_random_ds1: [u32; n], + cvp_zkp_random_ws2: [u32; n], + cvp_zkp_random_rs2: [u32; n], + cvp_zkp_random_ds2: [u32; n], ) -> bool { // Setup the context let mut ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); @@ -672,7 +818,9 @@ pub fn test_correctness, const n: usize, A: HasActions>( let parameter = CastVoteParam:: { cvp_i: i as u32, cvp_xi: xis[i], - cvp_zkp_random: cvp_zkp_randoms1[i], + cvp_zkp_random_w: cvp_zkp_random_ws1[i], + cvp_zkp_random_r: cvp_zkp_random_rs1[i], + cvp_zkp_random_d: cvp_zkp_random_ds1[i], cvp_vote: votes[i], }; let parameter_bytes = to_bytes(¶meter); @@ -685,7 +833,9 @@ pub fn test_correctness, const n: usize, A: HasActions>( let parameter = CastVoteParam:: { cvp_i: i as u32, cvp_xi: xis[i], - cvp_zkp_random: cvp_zkp_randoms2[i], + cvp_zkp_random_w: cvp_zkp_random_ws2[i], + cvp_zkp_random_r: cvp_zkp_random_rs2[i], + cvp_zkp_random_d: cvp_zkp_random_ds2[i], cvp_vote: votes[i], }; let parameter_bytes = to_bytes(¶meter); @@ -722,51 +872,63 @@ pub fn test_correctness, const n: usize, A: HasActions>( fn test_full_z17() { type Z = z_17; type G = g_z_17; - const n: usize = 20; + const n: usize = 15; use rand::random; - - // fn test() -> bool { // rand::SeedableRng::seed_from_u64(32u64); // TODO - let mut votes: [bool; n] = [false; n]; - let mut xis: [::field_type; n] = [0; n]; - let mut rp_zkp_randoms: [u32; n] = [0; n]; - let mut cvp_zkp_randoms1: [u32; n] = [0; n]; - let mut cvp_zkp_randoms2: [u32; n] = [0; n]; - - for i in 0..n { - votes[i] = false // random() - ; - xis[i] = Z::random_field_elem(random()); - rp_zkp_randoms[i] = random(); - cvp_zkp_randoms1[i] = random(); - cvp_zkp_randoms2[i] = random(); - } - assert!(test_correctness::< - Z, - G, - n, - hacspec_concordium::test_infrastructure::ActionsTree, - >( - votes, - xis, - rp_zkp_randoms, - cvp_zkp_randoms1, - cvp_zkp_randoms2 - )) - // }; - - // QuickCheck::new() - // .tests(1) - // .quickcheck(test as fn() -> bool) + fn test() -> bool { + let mut votes: [bool; n] = [false; n]; + let mut xis: [::field_type; n] = [0; n]; + let mut rp_zkp_randoms: [u32; n] = [0; n]; + let mut cvp_zkp_random_ws1: [u32; n] = [0; n]; + let mut cvp_zkp_random_rs1: [u32; n] = [0; n]; + let mut cvp_zkp_random_ds1: [u32; n] = [0; n]; + + let mut cvp_zkp_random_ws2: [u32; n] = [0; n]; + let mut cvp_zkp_random_rs2: [u32; n] = [0; n]; + let mut cvp_zkp_random_ds2: [u32; n] = [0; n]; + + for i in 0..n { + votes[i] = false; // random(); + xis[i] = Z::random_field_elem(random()); + rp_zkp_randoms[i] = random(); + cvp_zkp_random_ws1[i] = random(); + cvp_zkp_random_rs1[i] = random(); + cvp_zkp_random_ds1[i] = random(); + cvp_zkp_random_ws2[i] = random(); + cvp_zkp_random_rs2[i] = random(); + cvp_zkp_random_ds2[i] = random(); + } + + test_correctness::< + Z, + G, + n, + hacspec_concordium::test_infrastructure::ActionsTree, + >( + votes, + xis, + rp_zkp_randoms, + cvp_zkp_random_ws1, + cvp_zkp_random_rs1, + cvp_zkp_random_ds1, + cvp_zkp_random_ws2, + cvp_zkp_random_rs2, + cvp_zkp_random_ds2, + ) + }; + + QuickCheck::new() + .tests(10000) + .quickcheck(test as fn() -> bool) } // #[concordium_test] // fn test_bls12_381() { // type Z = Z_curve; // type G = Group_curve; -// const n: usize = 20; +// const n: usize = 15; // use rand::random; // // rand::SeedableRng::seed_from_u64(32u64); // TODO From aeb4420479981e06d71478da670839593111fe06 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Fri, 26 Jan 2024 01:52:47 +0100 Subject: [PATCH 47/86] Add commitment and use z_89 instead of z_17 --- ovn/src/ovn_group.rs | 157 ++++++++++++------------------------------- 1 file changed, 43 insertions(+), 114 deletions(-) diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs index df9b981..bf734b9 100644 --- a/ovn/src/ovn_group.rs +++ b/ovn/src/ovn_group.rs @@ -67,11 +67,11 @@ pub trait Group: core::marker::Copy { } #[derive(Clone, Copy)] -pub struct z_17 {} -impl Z_Field for z_17 { +pub struct z_89 {} +impl Z_Field for z_89 { type field_type = u32; fn q() -> Self::field_type { - 17u32 + 89u32 } // Prime order fn random_field_elem(random: u32) -> Self::field_type { random % (Self::q() - 1) @@ -99,26 +99,26 @@ impl Z_Field for z_17 { } #[derive(Clone, Copy)] -pub struct g_z_17 {} -impl Group for g_z_17 { +pub struct g_z_89 {} +impl Group for g_z_89 { type group_type = u32; fn g() -> Self::group_type { 3u32 } // Generator (elemnent of group) - fn hash(x: Vec) -> ::field_type { + fn hash(x: Vec) -> ::field_type { 5 // TODO } - fn g_pow(x: ::field_type) -> Self::group_type { + fn g_pow(x: ::field_type) -> Self::group_type { Self::pow(Self::g(), x) } // TODO: use repeated squaring instead! - fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { + fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { let mut result = Self::group_one(); - for i in 0..(x % (z_17::q() - 1)) { + for i in 0..(x % (z_89::q() - 1)) { result = Self::prod(result, g); } result @@ -129,18 +129,17 @@ impl Group for g_z_17 { } fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { - ((x % z_17::q()) * (y % z_17::q())) % z_17::q() + ((x % z_89::q()) * (y % z_89::q())) % z_89::q() } fn inv(x: Self::group_type) -> Self::group_type { - // let mut res = 0; - // for i in 1..z_17::q() { - // if Self::prod(Self::g_pow(i), x) == Self::group_one() { - // res = i; - // } - // } - // res - [0, 1, 9, 6, 13, 7, 3, 5, 15, 2, 12, 14, 10, 4, 11, 8, 16][x as usize] + for j in 0..89 { + if Self::prod(x, j) == Self::group_one() { + return j + } + } + assert!(false); + return x; } fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { @@ -148,57 +147,6 @@ impl Group for g_z_17 { } } -#[test] -pub fn z_17_correctness() { - type Z = z_17; - type G = g_z_17; - - assert!( - G::g_pow(0) == 1 - && G::g_pow(1) == 3 - && G::g_pow(2) == 9 - && G::g_pow(3) == 10 - && G::g_pow(4) == 13 - && G::g_pow(5) == 5 - && G::g_pow(6) == 15 - && G::g_pow(7) == 11 - && G::g_pow(8) == 16 - && G::g_pow(9) == 14 - && G::g_pow(10) == 8 - && G::g_pow(11) == 7 - && G::g_pow(12) == 4 - && G::g_pow(13) == 12 - && G::g_pow(14) == 2 - && G::g_pow(15) == 6 - && G::g_pow(16) == 1 - ) -} - -#[test] -pub fn z_17_inv_correctness() { - type Z = z_17; - type G = g_z_17; - - // [0, 1, 9, 6, 13, 7, 3, 5, 15, 2, 12, 14, 10, 4, 11, 8, 16] - assert_eq!(G::inv(0), 0); - assert_eq!(G::inv(1), 1); - assert_eq!(G::inv(2), 9); - assert_eq!(G::inv(3), 6); - assert_eq!(G::inv(4), 13); - assert_eq!(G::inv(5), 7); - assert_eq!(G::inv(6), 3); - assert_eq!(G::inv(7), 5); - assert_eq!(G::inv(8), 15); - assert_eq!(G::inv(9), 2); - assert_eq!(G::inv(10), 12); - assert_eq!(G::inv(11), 14); - assert_eq!(G::inv(12), 10); - assert_eq!(G::inv(13), 4); - assert_eq!(G::inv(14), 11); - assert_eq!(G::inv(15), 8); - assert_eq!(G::inv(16), 16); -} - // use hacspec_bls12_381::*; // use hacspec_bls12_381_hash::*; @@ -361,8 +309,8 @@ pub fn schnorr_zkp_validate>( #[test] pub fn schorr_zkp_correctness() { fn test(random_x: u32, random_r: u32) -> bool { - type Z = z_17; - type G = g_z_17; + type Z = z_89; + type G = g_z_89; let x: u32 = Z::random_field_elem(random_x); let pow_x = G::g_pow(x); @@ -517,8 +465,8 @@ pub fn or_zkp_correctness() { random_x: u32, v: bool, ) -> bool { - type Z = z_17; - type G = g_z_17; + type Z = z_89; + type G = g_z_89; let mut h = G::g_pow(Z::random_field_elem(random_h)); let x = Z::random_field_elem(random_x); @@ -532,6 +480,14 @@ pub fn or_zkp_correctness() { .quickcheck(test as fn(u32, u32, u32, u32, u32, bool) -> bool) } +pub fn commit_to>(g_pow_xi_yi_vi: G::group_type) -> Z::field_type { + G::hash(vec![g_pow_xi_yi_vi]) +} + +pub fn check_commitment>(g_pow_xi_yi_vi: G::group_type, commitment: Z::field_type) -> bool { + G::hash(vec![g_pow_xi_yi_vi]) == commitment +} + #[hax::contract_state(contract = "OVN")] // #[cfg_attr(not(feature = "hax_compilation"), contract_state(contract = "OVN"))] #[derive(Serialize, SchemaType, Clone, Copy)] @@ -539,7 +495,7 @@ pub struct OvnContractState, const n: usize> { g_pow_xis: [G::group_type; n], zkp_xis: [SchnorrZKPCommit; n], - commit_vis: [u32; n], + commit_vis: [Z::field_type; n], g_pow_xi_yi_vis: [G::group_type; n], zkp_vis: [OrZKPCommit; n], @@ -559,7 +515,7 @@ pub fn init_ovn_contract, const n: usize>(// _: &impl Ha c: Z::field_zero(), }; n], - commit_vis: [0; n], + commit_vis: [Z::field_zero(); n], g_pow_xi_yi_vis: [G::group_one(); n], zkp_vis: [OrZKPCommit:: { @@ -645,11 +601,11 @@ pub fn compute_g_pow_yi, const n: usize>( #[test] pub fn sum_to_zero() { - type Z = z_17; - type G = g_z_17; - const n: usize = 15; - let mut xis: [::field_type; n] = [0; n]; - let mut g_pow_xis: [>::group_type; n] = [0; n]; + type Z = z_89; + type G = g_z_89; + const n: usize = 55; + let mut xis: [::field_type; n] = [0; n]; + let mut g_pow_xis: [>::group_type; n] = [0; n]; use rand::random; for i in 0..n { xis[i] = Z::random_field_elem(random()); @@ -679,10 +635,6 @@ pub fn compute_group_element_for_vote>( ) } -pub fn commit_to>(x: G::group_type) -> u32 { - 0 -} - /** Commitment before round 2 */ #[hax::receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam"))] @@ -736,10 +688,6 @@ pub fn cast_vote, const n: usize, A: HasActions>( Ok((A::accept(), cast_vote_state_ret)) } -pub fn check_commitment>(g_pow_xi_yi_vi: G::group_type, zkp: u32) -> bool { - true -} - #[derive(Serialize, SchemaType)] pub struct TallyParameter {} @@ -856,30 +804,23 @@ pub fn test_correctness, const n: usize, A: HasActions>( } } - // claim_eq!( - // state.tally, - // count, - // "The tally should equal the number of positive votes" - // ); - assert_eq!(state.tally, count); state.tally == count - // true } // #[concordium_test] #[test] -fn test_full_z17() { - type Z = z_17; - type G = g_z_17; - const n: usize = 15; +fn test_full_z89() { + type Z = z_89; + type G = g_z_89; + const n: usize = 55; use rand::random; // rand::SeedableRng::seed_from_u64(32u64); // TODO fn test() -> bool { let mut votes: [bool; n] = [false; n]; - let mut xis: [::field_type; n] = [0; n]; + let mut xis: [::field_type; n] = [0; n]; let mut rp_zkp_randoms: [u32; n] = [0; n]; let mut cvp_zkp_random_ws1: [u32; n] = [0; n]; let mut cvp_zkp_random_rs1: [u32; n] = [0; n]; @@ -900,7 +841,7 @@ fn test_full_z17() { cvp_zkp_random_rs2[i] = random(); cvp_zkp_random_ds2[i] = random(); } - + test_correctness::< Z, G, @@ -918,20 +859,8 @@ fn test_full_z17() { cvp_zkp_random_ds2, ) }; - + QuickCheck::new() .tests(10000) .quickcheck(test as fn() -> bool) } - -// #[concordium_test] -// fn test_bls12_381() { -// type Z = Z_curve; -// type G = Group_curve; -// const n: usize = 15; - -// use rand::random; -// // rand::SeedableRng::seed_from_u64(32u64); // TODO - -// test_correctness::() -// } From 38a6c036221ad853d984d5da87ebe4412b481358 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Fri, 26 Jan 2024 14:52:51 +0100 Subject: [PATCH 48/86] WIP: Cleanup --- .../ssprove/extraction/CoqMakefile.conf | 63 ++ ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 621 +++++++++++------- .../ssprove/extraction/Hacspec_ovn_by_hand.v | 4 +- ovn/src/ovn_group.rs | 17 +- 4 files changed, 461 insertions(+), 244 deletions(-) create mode 100644 ovn/proofs/ssprove/extraction/CoqMakefile.conf diff --git a/ovn/proofs/ssprove/extraction/CoqMakefile.conf b/ovn/proofs/ssprove/extraction/CoqMakefile.conf new file mode 100644 index 0000000..81f2d00 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/CoqMakefile.conf @@ -0,0 +1,63 @@ +# This configuration file was generated by running: +# coq_makefile + + +############################################################################### +# # +# Project files. # +# # +############################################################################### + +COQMF_VFILES = +COQMF_MLIFILES = +COQMF_MLFILES = +COQMF_MLGFILES = +COQMF_MLPACKFILES = +COQMF_MLLIBFILES = +COQMF_CMDLINE_VFILES = + +############################################################################### +# # +# Path directives (-I, -R, -Q). # +# # +############################################################################### + +COQMF_OCAMLLIBS = +COQMF_SRC_SUBDIRS = +COQMF_COQLIBS = +COQMF_COQLIBS_NOML = +COQMF_CMDLINE_COQLIBS = + +############################################################################### +# # +# Coq configuration. # +# # +############################################################################### + +COQMF_COQLIB=/home/au538501/.opam/hacspec_ssprove/lib/coq/ +COQMF_COQCORELIB=/home/au538501/.opam/hacspec_ssprove/lib/coq/../coq-core/ +COQMF_DOCDIR=/home/au538501/.opam/hacspec_ssprove/doc/coq/ +COQMF_OCAMLFIND=/home/au538501/.opam/hacspec_ssprove/bin/ocamlfind +COQMF_CAMLFLAGS=-thread -rectypes -w -a+1..3-4+5..8-9+10..26-27+28..40-41-42+43-44-45+46..47-48+49..57-58+59..66-67-68+69-70 -safe-string -strict-sequence +COQMF_WARN=-warn-error +a-3 +COQMF_HASNATDYNLINK=true +COQMF_COQ_SRC_SUBDIRS=boot config lib clib kernel library engine pretyping interp gramlib parsing proofs tactics toplevel printing ide stm vernac plugins/btauto plugins/cc plugins/derive plugins/extraction plugins/firstorder plugins/funind plugins/ltac plugins/ltac2 plugins/micromega plugins/nsatz plugins/ring plugins/rtauto plugins/ssr plugins/ssrmatching plugins/syntax +COQMF_COQ_NATIVE_COMPILER_DEFAULT=no +COQMF_WINDRIVE= + +############################################################################### +# # +# Native compiler. # +# # +############################################################################### + +COQMF_COQPROJECTNATIVEFLAG = + +############################################################################### +# # +# Extra variables. # +# # +############################################################################### + +COQMF_OTHERFLAGS = +COQMF_INSTALLCOQDOCROOT = orphan_ diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 25ed8da..a4bc941 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -34,7 +34,8 @@ Class t_Z_Field (Self : choice_type) := { f_field_type_t_Eq :> t_Eq (f_field_type) ; f_field_type_t_PartialEq :> t_PartialEq (f_field_type) ; f_field_type_t_Sized :> t_Sized (f_field_type) ; - f_q : forall {L1 I1}, both L1 I1 (uint_size) ; + f_q_loc : {fset Location} ; + f_q : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_q_loc) I1 (f_field_type) ; f_random_field_elem_loc : {fset Location} ; f_random_field_elem : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_random_field_elem_loc) I1 (f_field_type) ; f_field_zero_loc : {fset Location} ; @@ -43,16 +44,20 @@ Class t_Z_Field (Self : choice_type) := { f_field_one : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_field_one_loc) I1 (f_field_type) ; f_add_loc : {fset Location} ; f_add : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_add_loc) (I1 :|: I2) (f_field_type) ; + f_sub_loc : {fset Location} ; + f_sub : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_sub_loc) (I1 :|: I2) (f_field_type) ; f_mul_loc : {fset Location} ; f_mul : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_mul_loc) (I1 :|: I2) (f_field_type) ; }. +Hint Unfold f_q_loc. Hint Unfold f_random_field_elem_loc. Hint Unfold f_field_zero_loc. Hint Unfold f_field_one_loc. Hint Unfold f_add_loc. +Hint Unfold f_sub_loc. Hint Unfold f_mul_loc. -Class t_Group (Self : choice_type) `{t_Z_Field} := { +Class t_Group (Self : choice_type) := { f_group_type : choice_type ; f_group_type_t_Serialize :> t_Serialize (f_group_type) ; f_group_type_t_Deserial :> t_Deserial (f_group_type) ; @@ -62,9 +67,8 @@ Class t_Group (Self : choice_type) `{t_Z_Field} := { f_group_type_t_Eq :> t_Eq (f_group_type) ; f_group_type_t_PartialEq :> t_PartialEq (f_group_type) ; f_group_type_t_Sized :> t_Sized (f_group_type) ; - f_g : forall {L1 I1}, both L1 I1 (f_group_type) ; - f_random_group_elem_loc : {fset Location} ; - f_random_group_elem : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_random_group_elem_loc) I1 (f_group_type) ; + f_g_loc : {fset Location} ; + f_g : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_g_loc) I1 (f_group_type) ; f_g_pow_loc : {fset Location} ; f_g_pow : forall {L1 I1}, both L1 I1 (f_field_type) -> both (L1 :|: f_g_pow_loc) I1 (f_group_type) ; f_pow_loc : {fset Location} ; @@ -77,118 +81,221 @@ Class t_Group (Self : choice_type) `{t_Z_Field} := { f_inv : forall {L1 I1}, both L1 I1 (f_group_type) -> both (L1 :|: f_inv_loc) I1 (f_group_type) ; f_div_loc : {fset Location} ; f_div : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_div_loc) (I1 :|: I2) (f_group_type) ; + f_hash_loc : {fset Location} ; + f_hash : forall {L1 I1}, both L1 I1 (t_Vec (f_group_type) (t_Global)) -> both (L1 :|: f_hash_loc) I1 (f_field_type) ; }. -Hint Unfold f_random_group_elem_loc. +Hint Unfold f_g_loc. Hint Unfold f_g_pow_loc. Hint Unfold f_pow_loc. Hint Unfold f_group_one_loc. Hint Unfold f_prod_loc. Hint Unfold f_inv_loc. Hint Unfold f_div_loc. +Hint Unfold f_hash_loc. (*Not implemented yet? todo(item)*) (*Not implemented yet? todo(item)*) -Equations v_Hash {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (v : both L1 I1 ((f_group_type × f_group_type × f_group_type))) : both ((f_field_one_loc :|: L1) : {fset Location}) I1 (f_field_type) := - v_Hash v := - solve_lift (f_field_one (ret_both (tt : 'unit))) : both (f_field_one_loc :|: L1) I1 (f_field_type). -Fail Next Obligation. - -Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_vi : both L1 I1 (f_group_type)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := - v_ZKP_one_out_of_two g_pow_vi vi := - solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). -Fail Next Obligation. - -Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - check_commitment g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - check_valid2 g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Equations commit_to {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (x : both L1 I1 (f_group_type)) : both L1 I1 (int32) := - commit_to x := - solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). +Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (xi : both L1 I1 (f_field_type)) (vote : both L2 I2 ('bool)) (g_pow_yi : both L3 I3 (f_group_type)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (f_group_type) := + compute_group_element_for_vote xi vote g_pow_yi := + solve_lift (f_prod (f_pow g_pow_yi xi) (f_g_pow (ifb vote + then f_field_one (ret_both (tt : 'unit)) + else f_field_zero (ret_both (tt : 'unit))))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (f_group_type). Fail Next Obligation. -Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) : both (f_random_group_elem_loc :|: L1) I1 (f_group_type) := +Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (random : both L1 I1 (int32)) : both L1 I1 (f_field_type) := select_private_voting_key random := - solve_lift (f_random_group_elem random) : both (f_random_group_elem_loc :|: L1) I1 (f_group_type). + solve_lift (f_random_field_elem random) : both L1 I1 (f_field_type). Fail Next Obligation. Definition prod1_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := (f_group_type;0%nat). Definition prod2_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := (f_group_type;1%nat). -Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both L1 I1 (int32)) (xi : both L2 I2 (f_field_type)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq f_group_type (is_pure (n)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc (n:=n);prod2_loc (n:=n)]) (I1 :|: I2 :|: I3 :|: I4) (f_group_type) := - compute_group_element_for_vote i xi vote xis := +Equations compute_g_pow_yi {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both L1 I1 (uint_size)) (xis : both L2 I2 (nseq f_group_type (is_pure (n)))) : both (L1 :|: L2 :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2) (f_group_type) := + compute_g_pow_yi i xis := letb prod1 loc(prod1_loc) := f_group_one (ret_both (tt : 'unit)) in - letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun j => + letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => ssp (fun prod1 => - solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc:|:fset [prod1_loc;prod1_loc]) (I1:|:I4:|:I1) (f_group_type))) prod1 in + solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L2:|:L1:|:fset [prod1_loc;prod1_loc]) (I1:|:I2:|:I1) (f_group_type))) prod1 in letb prod2 loc(prod2_loc) := f_group_one (ret_both (tt : 'unit)) in - letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun j => + letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => ssp (fun prod2 => - solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc:|:fset [prod2_loc;prod2_loc]) (I1:|:I4:|:I1) (f_group_type))) prod2 in - letb v_Yi := f_div prod1 prod2 in - solve_lift (f_prod (f_pow v_Yi xi) (f_g_pow (ifb vote - then f_field_one (ret_both (tt : 'unit)) - else f_field_zero (ret_both (tt : 'unit))))) : both (L1 :|: L2 :|: L3 :|: L4 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2 :|: I3 :|: I4) (f_group_type). -Solve All Obligations with ( solve_ssprove_obligations ; ((now (rewrite !fset0E ; apply (ret_both 0))) || (now destruct from_uint_size))). + solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L2:|:L1:|:fset [prod2_loc;prod2_loc]) (I1:|:I2:|:I1) (f_group_type))) prod2 in + solve_lift (f_div prod1 prod2) : both (L1 :|: L2 :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2) (f_group_type). +Fail Next Obligation. + +Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (commitment : both L2 I2 (f_field_type)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + check_commitment g_pow_xi_yi_vi commitment := + solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Equations commit_to {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) : both L1 I1 (f_field_type) := + commit_to g_pow_xi_yi_vi := + solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both L1 I1 (f_field_type). Fail Next Obligation. Definition t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := - (int32 × f_field_type × 'bool). + (int32 × f_field_type × int32 × int32 × int32 × 'bool). Equations f_cvp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := f_cvp_i s := bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : int32))) : both L I (int32). Fail Next Obligation. Equations f_cvp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (f_field_type) := f_cvp_xi s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_cvp_zkp_random_w {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_zkp_random_w s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_cvp_zkp_random_r {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_zkp_random_r s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_cvp_zkp_random_d {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_zkp_random_d s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). Fail Next Obligation. Equations f_cvp_vote {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I ('bool) := f_cvp_vote s := bind_both s (fun x => solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). Fail Next Obligation. -Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (f_field_type)} {f_cvp_vote : both L2 I2 ('bool)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := +Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (f_field_type)} {f_cvp_zkp_random_w : both L2 I2 (int32)} {f_cvp_zkp_random_r : both L3 I3 (int32)} {f_cvp_zkp_random_d : both L4 I4 (int32)} {f_cvp_vote : both L5 I5 ('bool)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_CastVoteParam) := Build_t_CastVoteParam := bind_both f_cvp_vote (fun f_cvp_vote => - bind_both f_cvp_xi (fun f_cvp_xi => - bind_both f_cvp_i (fun f_cvp_i => - solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_vote) : (t_CastVoteParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). + bind_both f_cvp_zkp_random_d (fun f_cvp_zkp_random_d => + bind_both f_cvp_zkp_random_r (fun f_cvp_zkp_random_r => + bind_both f_cvp_zkp_random_w (fun f_cvp_zkp_random_w => + bind_both f_cvp_xi (fun f_cvp_xi => + bind_both f_cvp_i (fun f_cvp_i => + solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_CastVoteParam). +Fail Next Obligation. +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_w' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := y) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_r' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := y) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_d' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := y) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := y)). + +Definition t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := + (f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_field_type × f_field_type × f_field_type × f_field_type × f_field_type). +Equations f_x {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_x s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both L I (f_group_type). +Fail Next Obligation. +Equations f_y {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_y s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both L I (f_group_type). +Fail Next Obligation. +Equations f_a1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_a1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : f_group_type))) : both L I (f_group_type). +Fail Next Obligation. +Equations f_b1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_b1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : f_group_type))) : both L I (f_group_type). +Fail Next Obligation. +Equations f_a2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_a2 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : f_group_type))) : both L I (f_group_type). +Fail Next Obligation. +Equations f_b2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_b2 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : f_group_type))) : both L I (f_group_type). Fail Next Obligation. -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := y)). +Equations f_c {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_c s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_d1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_d1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_d2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_d2 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_r1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_r1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_r2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_r2 s := + bind_both s (fun x => + solve_lift (ret_both (snd x : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations Build_t_OrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {L7 : {fset Location}} {L8 : {fset Location}} {L9 : {fset Location}} {L10 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {I7 : Interface} {I8 : Interface} {I9 : Interface} {I10 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_x : both L0 I0 (f_group_type)} {f_y : both L1 I1 (f_group_type)} {f_a1 : both L2 I2 (f_group_type)} {f_b1 : both L3 I3 (f_group_type)} {f_a2 : both L4 I4 (f_group_type)} {f_b2 : both L5 I5 (f_group_type)} {f_c : both L6 I6 (f_field_type)} {f_d1 : both L7 I7 (f_field_type)} {f_d2 : both L8 I8 (f_field_type)} {f_r1 : both L9 I9 (f_field_type)} {f_r2 : both L10 I10 (f_field_type)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit) := + Build_t_OrZKPCommit := + bind_both f_r2 (fun f_r2 => + bind_both f_r1 (fun f_r1 => + bind_both f_d2 (fun f_d2 => + bind_both f_d1 (fun f_d1 => + bind_both f_c (fun f_c => + bind_both f_b2 (fun f_b2 => + bind_both f_a2 (fun f_a2 => + bind_both f_b1 (fun f_b1 => + bind_both f_a1 (fun f_a1 => + bind_both f_y (fun f_y => + bind_both f_x (fun f_x => + solve_lift (ret_both ((f_x,f_y,f_a1,f_b1,f_a2,f_b2,f_c,f_d1,f_d2,f_r1,f_r2) : (t_OrZKPCommit)))))))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit). +Fail Next Obligation. +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := y) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := y) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_a1' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := y) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_b1' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := y) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_a2' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := y) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_b2' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := y) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_c' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := y) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_d1' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := y) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_d2' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := y) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_r1' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := y) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_r2' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := y)). Definition t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := - (int32 × f_field_type). + (int32 × f_field_type × int32). Equations f_rp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (int32) := f_rp_i s := bind_both s (fun x => - solve_lift (ret_both (fst x : int32))) : both L I (int32). + solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). Fail Next Obligation. Equations f_rp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (f_field_type) := f_rp_xi s := bind_both s (fun x => - solve_lift (ret_both (snd x : f_field_type))) : both L I (f_field_type). + solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). Fail Next Obligation. -Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (f_field_type)} : both (L0:|:L1) (I0:|:I1) (t_RegisterParam) := +Equations f_rp_zkp_random {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (int32) := + f_rp_zkp_random s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (f_field_type)} {f_rp_zkp_random : both L2 I2 (int32)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_RegisterParam) := Build_t_RegisterParam := - bind_both f_rp_xi (fun f_rp_xi => - bind_both f_rp_i (fun f_rp_i => - solve_lift (ret_both ((f_rp_i,f_rp_xi) : (t_RegisterParam))))) : both (L0:|:L1) (I0:|:I1) (t_RegisterParam). + bind_both f_rp_zkp_random (fun f_rp_zkp_random => + bind_both f_rp_xi (fun f_rp_xi => + bind_both f_rp_i (fun f_rp_i => + solve_lift (ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_RegisterParam). Fail Next Obligation. -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y) (f_rp_zkp_random := f_rp_zkp_random x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := y)). Definition t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := (f_group_type × f_field_type × f_field_type). @@ -225,59 +332,150 @@ Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) : solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). Fail Next Obligation. -Equations schnorr_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (g_pow_x : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_field_one_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := - schnorr_ZKP random g_pow_x x := - solve_lift (run (letb r := f_random_field_elem random in - letb u := f_g_pow r in - letb c := v_Hash (prod_b (f_g,g_pow_x,u)) in - letb z := f_add r (f_mul c x) in - letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_u := u) (f_c := c) (f_z := z)) in - ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_field_one_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). +Definition t_g_z_89_ : choice_type := + 'unit. +Equations Build_t_g_z_89_ : both (fset []) (fset []) (t_g_z_89_) := + Build_t_g_z_89_ := + solve_lift (ret_both (tt (* Empty tuple *) : (t_g_z_89_))) : both (fset []) (fset []) (t_g_z_89_). Fail Next Obligation. -Equations schnorr_ZKP_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_x : both L1 I1 (f_group_type)) (pi : both L2 I2 (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 :|: f_g_pow_loc :|: f_pow_loc :|: f_prod_loc :|: f_field_one_loc) (I1 :|: I2) ('bool) := - schnorr_ZKP_validate g_pow_x pi := - solve_lift (andb ((f_c pi) =.? (v_Hash (prod_b (f_g,g_pow_x,f_u pi)))) ((f_g_pow (f_z pi)) =.? (f_prod (f_u pi) (f_pow g_pow_x (f_c pi))))) : both (L1 :|: L2 :|: f_g_pow_loc :|: f_pow_loc :|: f_prod_loc :|: f_field_one_loc) (I1 :|: I2) ('bool). +Definition t_z_89_ : choice_type := + 'unit. +Equations Build_t_z_89_ : both (fset []) (fset []) (t_z_89_) := + Build_t_z_89_ := + solve_lift (ret_both (tt (* Empty tuple *) : (t_z_89_))) : both (fset []) (fset []) (t_z_89_). Fail Next Obligation. +Equations schnorr_zkp {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (h : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z) (v_G)) := + schnorr_zkp random h x := + solve_lift (run (letb r := f_random_field_elem random in + letb u := f_g_pow r in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); + h; + u])))) in + letb z := f_add r (f_mul c x) in + letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z) (v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_u := u) (f_c := c) (f_z := z)) in + ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z) (v_G)). +Fail Next Obligation. + +Equations schnorr_zkp_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (pi : both L2 I2 (t_SchnorrZKPCommit (v_Z) (v_G))) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + schnorr_zkp_validate h pi := + solve_lift (andb ((f_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); + h; + f_u pi])))))) ((f_g_pow (f_z pi)) =.? (f_prod (f_u pi) (f_pow h (f_c pi))))) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both L1 I1 (int32)) (random_r : both L2 I2 (int32)) (random_d : both L3 I3 (int32)) (h : both L4 I4 (f_group_type)) (xi : both L5 I5 (f_field_type)) (vi : both L6 I6 ('bool)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z) (v_G)) := + zkp_one_out_of_two random_w random_r random_d h xi vi := + letb w := f_random_field_elem random_w in + solve_lift (ifb vi + then letb r1 := f_random_field_elem random_r in + letb d1 := f_random_field_elem random_d in + letb x := f_g_pow xi in + letb y := f_prod (f_pow h xi) (f_g (ret_both (tt : 'unit))) in + letb a1 := f_prod (f_g_pow r1) (f_pow x d1) in + letb b1 := f_prod (f_pow h r1) (f_pow y d1) in + letb a2 := f_g_pow w in + letb b2 := f_pow h w in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; + y; + a1; + b1; + a2; + b2])))) in + letb d2 := f_sub c d1 in + letb r2 := f_sub w (f_mul xi d2) in + Build_t_OrZKPCommit (f_x := x) (f_y := y) (f_a1 := a1) (f_b1 := b1) (f_a2 := a2) (f_b2 := b2) (f_c := c) (f_d1 := d1) (f_d2 := d2) (f_r1 := r1) (f_r2 := r2) + else letb r2 := f_random_field_elem random_r in + letb d2 := f_random_field_elem random_d in + letb x := f_g_pow xi in + letb y := f_pow h xi in + letb a1 := f_g_pow w in + letb b1 := f_pow h w in + letb a2 := f_prod (f_g_pow r2) (f_pow x d2) in + letb b2 := f_prod (f_pow h r2) (f_pow (f_div y (f_g (ret_both (tt : 'unit)))) d2) in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; + y; + a1; + b1; + a2; + b2])))) in + letb d1 := f_sub c d2 in + letb r1 := f_sub w (f_mul xi d1) in + Build_t_OrZKPCommit (f_x := x) (f_y := y) (f_a1 := a1) (f_b1 := b1) (f_a2 := a2) (f_b2 := b2) (f_c := c) (f_d1 := d1) (f_d2 := d2) (f_r1 := r1) (f_r2 := r2)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z) (v_G)). +Fail Next Obligation. + +Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (zkp : both L2 I2 (t_OrZKPCommit (v_Z) (v_G))) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + zkp_one_out_of_two_validate h zkp := + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_x zkp; + f_y zkp; + f_a1 zkp; + f_b1 zkp; + f_a2 zkp; + f_b2 zkp])))) in + solve_lift (andb (andb (andb (andb (c =.? (f_add (f_d1 zkp) (f_d2 zkp))) ((f_a1 zkp) =.? (f_prod (f_g_pow (f_r1 zkp)) (f_pow (f_x zkp) (f_d1 zkp))))) ((f_b1 zkp) =.? (f_prod (f_pow h (f_r1 zkp)) (f_pow (f_y zkp) (f_d1 zkp))))) ((f_a2 zkp) =.? (f_prod (f_g_pow (f_r2 zkp)) (f_pow (f_x zkp) (f_d2 zkp))))) ((f_b2 zkp) =.? (f_prod (f_pow h (f_r2 zkp)) (f_pow (f_div (f_y zkp) (f_g (ret_both (tt : 'unit)))) (f_d2 zkp))))) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +#[global] Program Instance t_z_89__t_Z_Field : t_Z_Field t_z_89_ := + let f_field_type := int32 : choice_type in + let f_q := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (89 : int32)) : both (L :|: fset []) I (int32) in + let f_random_field_elem := fun {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) => solve_lift (random .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) : both (L1 :|: fset []) I1 (int32) in + let f_field_zero := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (0 : int32)) : both (L :|: fset []) I (int32) in + let f_field_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I (int32) in + let f_add := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .+ y) .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + let f_sub := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (((x .+ ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) .- y) .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + let f_mul := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + {| f_field_type := (@f_field_type); + f_q_loc := (fset [] : {fset Location}); + f_q := (@f_q); + f_random_field_elem_loc := (fset [] : {fset Location}); + f_random_field_elem := (@f_random_field_elem); + f_field_zero_loc := (fset [] : {fset Location}); + f_field_zero := (@f_field_zero); + f_field_one_loc := (fset [] : {fset Location}); + f_field_one := (@f_field_one); + f_add_loc := (fset [] : {fset Location}); + f_add := (@f_add); + f_sub_loc := (fset [] : {fset Location}); + f_sub := (@f_sub); + f_mul_loc := (fset [] : {fset Location}); + f_mul := (@f_mul)|}. +Fail Next Obligation. +Hint Unfold t_z_89__t_Z_Field. + Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := - (int32 × nseq f_group_type (is_pure (n)) × nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × nseq int32 (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq int32 (is_pure (n)) × int32). -Equations f_zkp_random {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (int32) := - f_zkp_random s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst (fst x))))) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq f_group_type (is_pure (n))) := + (nseq f_group_type (is_pure (n)) × nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n)) × nseq f_field_type (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n)) × int32). +Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type (is_pure (n))) := f_g_pow_xis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). Fail Next Obligation. -Equations f_zkp_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := +Equations f_zkp_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n))) := f_zkp_xis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both L I (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n))))) : both L I (nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n))). Fail Next Obligation. -Equations f_commit_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq int32 (is_pure (n))) := +Equations f_commit_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq f_field_type (is_pure (n))) := f_commit_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : nseq int32 (is_pure (n))))) : both L I (nseq int32 (is_pure (n))). + solve_lift (ret_both (snd (fst (fst (fst x))) : nseq f_field_type (is_pure (n))))) : both L I (nseq f_field_type (is_pure (n))). Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq f_group_type (is_pure (n))) := +Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type (is_pure (n))) := f_g_pow_xi_yi_vis s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). Fail Next Obligation. -Equations f_zkp_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq int32 (is_pure (n))) := +Equations f_zkp_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n))) := f_zkp_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : nseq int32 (is_pure (n))))) : both L I (nseq int32 (is_pure (n))). + solve_lift (ret_both (snd (fst x) : nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n))))) : both L I (nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n))). Fail Next Obligation. -Equations f_tally {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (int32) := +Equations f_tally {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (int32) := f_tally s := bind_both s (fun x => solve_lift (ret_both (snd x : int32))) : both L I (int32). Fail Next Obligation. -Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_zkp_random : both L0 I0 (int32)} {f_g_pow_xis : both L1 I1 (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both L2 I2 (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_commit_vis : both L3 I3 (nseq int32 (is_pure (n)))} {f_g_pow_xi_yi_vis : both L4 I4 (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both L5 I5 (nseq int32 (is_pure (n)))} {f_tally : both L6 I6 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6) (t_OvnContractState (n := n)) := +Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_g_pow_xis : both L0 I0 (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both L1 I1 (nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n)))} {f_commit_vis : both L2 I2 (nseq f_field_type (is_pure (n)))} {f_g_pow_xi_yi_vis : both L3 I3 (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both L4 I4 (nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n)))} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := Build_t_OvnContractState := bind_both f_tally (fun f_tally => bind_both f_zkp_vis (fun f_zkp_vis => @@ -285,172 +483,63 @@ Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} bind_both f_commit_vis (fun f_commit_vis => bind_both f_zkp_xis (fun f_zkp_xis => bind_both f_g_pow_xis (fun f_g_pow_xis => - bind_both f_zkp_random (fun f_zkp_random => - solve_lift (ret_both ((f_zkp_random,f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState)))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6) (t_OvnContractState). + solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). Fail Next Obligation. -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_random' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := y) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). Definition cast_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *);2%nat). - -Obligation Tactic := Tactics.program_simpl ; intros. (* (Tactics.program_simpl; fail). *) -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := + (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));2%nat). +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := cast_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params:t_CastVoteParam (v_Z)) := matchb f_branch out with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : t_ParseError (* (t_Result (t_Infallible) (t_ParseError)) *)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist2 := v_Break (f_from_residual residual) in - ControlFlow_Continue (solve_lift (never_to_any hoist2)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) (* : (t_CastVoteParam (v_Z := v_Z)) *)) in - ControlFlow_Continue (solve_lift val) - end in - ControlFlow_Continue (letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in - letb zkp_vi := v_ZKP_one_out_of_two g_pow_xi_yi_vi (f_cvp_vote params) in + letm[choice_typeMonad.result_bind_code (t_ParseError)] (params:t_CastVoteParam (v_Z)) := impl__map_err out f_from in + Result_Ok (letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in + letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in + letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). -Next Obligation. - solve_ssprove_obligations. -Qed. -Next Obligation. - solve_ssprove_obligations. -Qed. -Next Obligation. - solve_ssprove_obligations. -Qed. -Next Obligation. - unfold cast_vote_obligations_obligation_3. - unfold cast_vote_obligations_obligation_4. - normalize_fset. - split_fsubset_lhs. - now solve_single_fset_fsubset. - normalize_fset. - now solve_single_fset_fsubset. - now solve_single_fset_fsubset. - now solve_single_fset_fsubset. - now solve_single_fset_fsubset. - now solve_single_fset_fsubset. - now solve_single_fset_fsubset. - now solve_single_fset_fsubset. - now solve_single_fset_fsubset. - now solve_single_fset_fsubset. - now solve_single_fset_fsubset. - now solve_single_fset_fsubset. - now solve_single_fset_fsubset. - now solve_single_fset_fsubset. - now solve_single_fset_fsubset. - solve_ssprove_obligations. -Qed. + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). Fail Next Obligation. -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. Definition commit_to_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *);3%nat). - -Obligation Tactic := (Tactics.program_simpl; fail). -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := + (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));3%nat). +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := commit_to_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params:t_CastVoteParam (v_Z)) := matchb f_branch out with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : t_ParseError (* (t_Result (t_Infallible) (t_ParseError)) *)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist3 := v_Break (f_from_residual residual) in - ControlFlow_Continue (solve_lift (never_to_any hoist3)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) (* : (t_CastVoteParam (v_Z)) *)) in - ControlFlow_Continue (solve_lift val) - end in - ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + letm[choice_typeMonad.result_bind_code (t_ParseError)] (params:t_CastVoteParam (v_Z)) := impl__map_err out f_from in + Result_Ok (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => - solve_lift (ifb negb (schnorr_ZKP_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist4 := v_Break (Result_Err (solve_lift ret_both (tt : 'unit))) (* (Result_Err ParseError) *) in - ControlFlow_Continue (never_to_any hoist4) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*0*)(L2:|:fset []) (I2) ((* t_ControlFlow *) _ (* (t_Result (* ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) *) _ (t_ParseError)) *) ('unit)))) (Result_Ok (ret_both (tt : 'unit))) in - letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in + solve_lift (ifb not (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist2 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist2) + else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*0*)(L2:|:fset []) (I2) (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in + letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in + letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in letb commit_vi := commit_to g_pow_xi_yi_vi in letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). Fail Next Obligation. -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Obligation Tactic := intros. -Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {impl_108907986_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (impl_108907986_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasInitContext (impl_108907986_) ('unit)} (_ : both L1 I1 (impl_108907986_)) : both (L1 :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *)) (t_Reject)) := + +Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both L1 I1 ('unit)) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)) := init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_zkp_random := ret_both (0 : int32)) (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_u := f_group_one (ret_both (tt : 'unit))) (f_z := f_field_zero (ret_both (tt : 'unit))) (f_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (ret_both (0 : int32)) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (ret_both (0 : int32)) n) (f_tally := ret_both (0 : int32)))) : both (L1 :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *)) (t_Reject)). -Next Obligation. - solve_ssprove_obligations. -Qed. -Next Obligation. - solve_ssprove_obligations. -Qed. -Next Obligation. - solve_ssprove_obligations. -Qed. -Next Obligation. - simpl. - unfold cast_vote_obligations_obligation_3. - normalize_fset. - simpl. - destruct H5. - destruct H4. - split_fsubset_lhs. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - now solve_single_fset_fsubset. - solve_single_fset_fsubset. - now solve_single_fset_fsubset. - now solve_single_fset_fsubset. - - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - unfold cast_vote_obligations_obligation_3. - solve_single_fset_fsubset. - - - solve_ssprove_obligations. -Qed. -Fail Next Obligation. -lia + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_u := f_group_one (ret_both (tt : 'unit))) (f_z := f_field_zero (ret_both (tt : 'unit))) (f_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_x := f_group_one (ret_both (tt : 'unit))) (f_y := f_group_one (ret_both (tt : 'unit))) (f_a1 := f_group_one (ret_both (tt : 'unit))) (f_b1 := f_group_one (ret_both (tt : 'unit))) (f_a2 := f_group_one (ret_both (tt : 'unit))) (f_b2 := f_group_one (ret_both (tt : 'unit))) (f_c := f_field_zero (ret_both (tt : 'unit))) (f_d1 := f_field_zero (ret_both (tt : 'unit))) (f_d2 := f_field_zero (ret_both (tt : 'unit))) (f_r1 := f_field_zero (ret_both (tt : 'unit))) (f_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)). +Fail Next Obligation. + Definition register_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));4%nat). Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := register_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] (params:t_RegisterParam (v_Z)) := matchb f_branch out with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result (t_Infallible) (t_ParseError))) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist5 := v_Break (f_from_residual residual) in - ControlFlow_Continue (solve_lift (never_to_any hoist5)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (t_RegisterParam (v_Z))) in - ControlFlow_Continue (solve_lift val) - end in - ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in - letb zkp_xi := schnorr_ZKP (f_zkp_random state) g_pow_xi (f_rp_xi params) in + letm[choice_typeMonad.result_bind_code (t_ParseError)] (params:t_RegisterParam (v_Z)) := impl__map_err out f_from in + Result_Ok (letb g_pow_xi := f_g_pow (f_rp_xi params) in + letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in @@ -465,13 +554,19 @@ Definition tally_votes_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fs (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));7%nat). Definition vote_result_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := (f_group_type;8%nat). -Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := +Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := tally_votes _ state := letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => - letb _ := check_valid2 ((f_g_pow_xi_yi_vis state).a[i]) ((f_zkp_vis state).a[i]) in - letb _ := check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i]) in - solve_lift (ret_both (tt : 'unit)) : both (*0*)(L2:|:fset []) (I2) ('unit))) (ret_both (tt : 'unit)) in + letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] _ := ControlFlow_Continue (ifb not (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist3 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist3) + else ControlFlow_Continue (ret_both (tt : 'unit))) in + solve_lift (ifb not (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist4 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist4) + else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*2*)(L2:|:fset [prod1_loc;prod2_loc]) (I2) (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in letb vote_result loc(vote_result_loc) := f_group_one (ret_both (tt : 'unit)) in letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => ssp (fun vote_result => @@ -488,8 +583,60 @@ Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interf solve_lift (prod_b (curr,tally)) : both (*5*)(L2:|:fset [curr_loc;tally_loc;vote_result_loc;curr_loc;tally_loc]) (I2) ((f_field_type × int32)))) (prod_b (curr,tally)) in letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in - Result_Ok (solve_lift (prod_b (f_accept (ret_both (tt : 'unit)),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). -Fail Next Obligation. + Result_Ok (solve_lift (prod_b (f_accept (ret_both (tt : 'unit)),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). +Fail Next Obligation. + +Definition res_loc : Location := + (int32;9%nat). +Definition result_loc : Location := + (int32;10%nat). +#[global] Program Instance t_g_z_89__t_Group : t_Group t_g_z_89_ t_z_89_ := + let f_group_type := int32 : choice_type in + let f_g := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (3 : int32)) : both (L :|: fset []) I (int32) in + let f_hash := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Vec (int32) (t_Global))) => letb res loc(res_loc) := f_field_one (ret_both (tt : 'unit)) in + letb res := foldi_both_list (f_into_iter x) (fun y => + ssp (fun res => + solve_lift (f_mul y res) : both (*2*)(L1:|:L1:|:fset [res_loc;res_loc]) (I1:|:I1) (int32))) res in + solve_lift res : both (L1 :|: fset [res_loc]) I1 (int32) in + let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift (f_pow (f_g (ret_both (tt : 'unit))) x) : both (L1 :|: fset []) I1 (int32) in + let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => letb result loc(result_loc) := f_group_one (ret_both (tt : 'unit)) in + letb result := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := x .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))))) (fun i => + ssp (fun result => + solve_lift (f_prod result g) : both (*2*)(L1:|:L2:|:L2:|:fset [result_loc;result_loc]) (I1:|:I2:|:I2) (int32))) result in + solve_lift result : both (L1 :|: L2 :|: fset [result_loc]) (I1 :|: I2) (int32) in + let f_group_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I (int32) in + let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (((x .% (f_q (ret_both (tt : 'unit)))) .* (y .% (f_q (ret_both (tt : 'unit))))) .% (f_q (ret_both (tt : 'unit)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift (run (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := ret_both (89 : int32)))) (fun j => + ssp (fun _ => + solve_lift (ifb (f_prod x j) =.? (f_group_one (ret_both (tt : 'unit))) + then letm[choice_typeMonad.result_bind_code (int32)] hoist5 := v_Break j in + ControlFlow_Continue (never_to_any hoist5) + else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*0*)(L1:|:fset []) (I1) (t_ControlFlow (int32) ('unit)))) (ret_both (tt : 'unit)) in + letb _ := ifb not (ret_both (false : 'bool)) + then never_to_any (panic (ret_both (assertion failed: false : chString))) + else ret_both (tt : 'unit) in + letm[choice_typeMonad.result_bind_code (int32)] hoist6 := v_Break x in + ControlFlow_Continue (never_to_any hoist6))) : both (L1 :|: fset []) I1 (int32) in + let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + {| f_group_type := (@f_group_type); + f_g_loc := (fset [] : {fset Location}); + f_g := (@f_g); + f_hash_loc := (fset [res_loc] : {fset Location}); + f_hash := (@f_hash); + f_g_pow_loc := (fset [] : {fset Location}); + f_g_pow := (@f_g_pow); + f_pow_loc := (fset [result_loc] : {fset Location}); + f_pow := (@f_pow); + f_group_one_loc := (fset [] : {fset Location}); + f_group_one := (@f_group_one); + f_prod_loc := (fset [] : {fset Location}); + f_prod := (@f_prod); + f_inv_loc := (fset [] : {fset Location}); + f_inv := (@f_inv); + f_div_loc := (fset [] : {fset Location}); + f_div := (@f_div)|}. +Fail Next Obligation. +Hint Unfold t_g_z_89__t_Group. (** Concert lib part **) From ConCert.Utils Require Import Extras. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v index faaae50..04935a9 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v @@ -321,7 +321,9 @@ Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))) Next Obligation. intros ; now solve_in_fset. Defined. Next Obligation. intros ; now solve_in_fset. Defined. Next Obligation. solve_ssprove_obligations. Defined. -Next Obligation. solve_ssprove_obligations. Defined. +Next Obligation. + + solve_ssprove_obligations. Defined. Next Obligation. solve_ssprove_obligations. Defined. Next Obligation. solve_ssprove_obligations. Defined. Next Obligation. solve_ssprove_obligations. Defined. diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs index bf734b9..4a2351e 100644 --- a/ovn/src/ovn_group.rs +++ b/ovn/src/ovn_group.rs @@ -30,8 +30,7 @@ pub trait Z_Field: core::marker::Copy { + Eq + Clone + Copy - + hacspec_concordium::Serialize - + core::fmt::Debug; + + hacspec_concordium::Serialize; fn q() -> Self::field_type; @@ -51,8 +50,7 @@ pub trait Group: core::marker::Copy { + Eq + Clone + Copy - + hacspec_concordium::Serialize - + core::fmt::Debug; + + hacspec_concordium::Serialize; fn g() -> Self::group_type; // Generator (elemnent of group) @@ -108,7 +106,11 @@ impl Group for g_z_89 { } // Generator (elemnent of group) fn hash(x: Vec) -> ::field_type { - 5 // TODO + let mut res = z_89::field_one(); + for y in x { + res = z_89::mul(y, res); + } + res // TODO } fn g_pow(x: ::field_type) -> Self::group_type { @@ -283,7 +285,8 @@ pub struct SchnorrZKPCommit> { z: Z::field_type, } -/** Non-interactive Schnorr proof using Fiat-Shamir heuristics */ +/** Non-interactive Schnorr proof using Fiat-Shamir heuristics (RFC 8235) */ +// https://www.rfc-editor.org/rfc/rfc8235 // https://crypto.stanford.edu/cs355/19sp/lec5.pdf pub fn schnorr_zkp>( random: u32, @@ -864,3 +867,5 @@ fn test_full_z89() { .tests(10000) .quickcheck(test as fn() -> bool) } + +// https://github.com/stonecoldpat/anonymousvoting From 00ae0812d625241468f12f6a45210ed90c5b9f12 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Fri, 26 Jan 2024 16:11:25 +0100 Subject: [PATCH 49/86] Cleaned testing, and added secp256k1 (missing inv operation) for testing --- bip-340/src/bip-340.rs | 2 +- ovn/Cargo.toml | 10 +- ovn/src/ovn_group.rs | 505 ++++++++++++++++++++++------------------- 3 files changed, 273 insertions(+), 244 deletions(-) diff --git a/bip-340/src/bip-340.rs b/bip-340/src/bip-340.rs index 27997e1..38d2bb3 100644 --- a/bip-340/src/bip-340.rs +++ b/bip-340/src/bip-340.rs @@ -33,7 +33,7 @@ pub type AffinePoint = (FieldElement, FieldElement); public_bytes!(PBytes32, 32); -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum Point { Affine(AffinePoint), AtInfinity, diff --git a/ovn/Cargo.toml b/ovn/Cargo.toml index efc45a1..79a4e76 100644 --- a/ovn/Cargo.toml +++ b/ovn/Cargo.toml @@ -8,16 +8,8 @@ edition = "2018" path = "src/ovn_group.rs" [dependencies] -# hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } hax-lib-macros = { path = "../../hacspec-v2/hax-lib-macros/" } -hacspec-bls12-381 = { path = "../bls12-381/" } -hacspec-bls12-381-hash = { path = "../bls12-381-hash/" } -# hax-lib-macros = { git = "https://github.com/hacspec/hacspec-v2.git" } -# creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "1cca2320e262b2ec9d28b3c84cba759c96829898" } # branch = master -# concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850" , version = "=2.0.0" , default-features = false } # 0cffb859f736ff6726fa38600428a415d800d7b6 - -# concordium-std = { git = "https://github.com/Concordium/concordium-rust-smart-contracts", rev = "4d4b024b547a1f120f6d6951cbc409c94f8f146a" , version = "*" , default-features = false } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a -# concordium-std-derive = { git = "https://github.com/Concordium/concordium-rust-smart-contracts", rev = "4d4b024b547a1f120f6d6951cbc409c94f8f146a" , version = "*" , default-features = false } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a +hacspec-bip-340 = { path = "../bip-340/" } hacspec-concordium = { path = "../concordium" } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a hacspec-concordium-derive = { path = "../concordium-derive" } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs index 4a2351e..5d62b59 100644 --- a/ovn/src/ovn_group.rs +++ b/ovn/src/ovn_group.rs @@ -25,12 +25,12 @@ use quickcheck::*; #[cfg(test)] use rand::random; +//////////// +// Traits // +//////////// + pub trait Z_Field: core::marker::Copy { - type field_type: PartialEq - + Eq - + Clone - + Copy - + hacspec_concordium::Serialize; + type field_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; fn q() -> Self::field_type; @@ -46,11 +46,7 @@ pub trait Z_Field: core::marker::Copy { /** Interface for group implementation */ pub trait Group: core::marker::Copy { - type group_type: PartialEq - + Eq - + Clone - + Copy - + hacspec_concordium::Serialize; + type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; fn g() -> Self::group_type; // Generator (elemnent of group) @@ -64,6 +60,10 @@ pub trait Group: core::marker::Copy { fn hash(x: Vec) -> Z::field_type; } +//////////////////// +// Impl for Z/89Z // +//////////////////// + #[derive(Clone, Copy)] pub struct z_89 {} impl Z_Field for z_89 { @@ -137,7 +137,7 @@ impl Group for g_z_89 { fn inv(x: Self::group_type) -> Self::group_type { for j in 0..89 { if Self::prod(x, j) == Self::group_one() { - return j + return j; } } assert!(false); @@ -149,134 +149,160 @@ impl Group for g_z_89 { } } -// use hacspec_bls12_381::*; -// use hacspec_bls12_381_hash::*; - -// #[derive(core::marker::Copy, Clone, PartialEq, Eq)] -// struct Z_curve { -// val: Scalar, -// } - -// impl hacspec_concordium::Deserial for Z_curve { -// // TODO: -// fn deserial(_source: &mut R) -> ParseResult { -// Err(ParseError {}) -// } -// } - -// impl hacspec_concordium::Serial for Z_curve { -// // TODO: -// fn serial(&self, _out: &mut W) -> Result<(), W::Err> { -// Ok(()) -// } -// } - -// impl Z_Field for Z_curve { -// type field_type = Z_curve; - -// fn q() -> Self::field_type { -// Z_curve { -// val: Scalar::from_hex("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab"), -// } // TODO: Scalar::modulo_value; -// } - -// fn random_field_elem(random: u32) -> Self::field_type { -// Z_curve { -// val: Scalar::from_literal(random as u128), -// } -// } - -// fn field_zero() -> Self::field_type { -// Z_curve { -// val: Scalar::from_literal(0u128), -// } // Scalar::ZERO() -// } - -// fn field_one() -> Self::field_type { -// Z_curve { -// val: Scalar::from_literal(1u128), -// } // Scalar::ONE() -// } - -// fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { -// Z_curve { val: x.val + y.val } -// } - -// fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { -// Z_curve { val: x.val * y.val } -// } -// } - -// #[derive(core::marker::Copy, Clone, PartialEq, Eq)] -// struct Group_curve { -// val: Fp12, -// } - -// impl hacspec_concordium::Deserial for Group_curve { -// // TODO: -// fn deserial(_source: &mut R) -> ParseResult { -// Err(ParseError {}) -// } -// } - -// impl hacspec_concordium::Serial for Group_curve { -// // TODO: -// fn serial(&self, _out: &mut W) -> Result<(), W::Err> { -// Ok(()) -// } -// } - -// impl Group for Group_curve { -// type group_type = Group_curve; - -// // https://eips.ethereum.org/EIPS/eip-2333 -// fn g() -> Self::group_type { -// Group_curve { -// val: pairing(g1(), g2()), -// } -// } // TODO - -// fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { -// Group_curve { -// val: fp12exp(g.val, x.val), -// } -// } - -// fn g_pow(x: ::field_type) -> Self::group_type { -// Self::pow(Self::g(), x) -// } - -// fn group_one() -> Self::group_type { -// Group_curve { -// val: fp12fromfp6(fp6fromfp2(fp2fromfp(Fp::from_literal(1u128)))), -// } // ONE -// } - -// fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { -// Group_curve { -// val: fp12mul(x.val, y.val), -// } -// } - -// fn inv(x: Self::group_type) -> Self::group_type { -// Group_curve { -// val: fp12inv(x.val), -// } -// } - -// fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { -// Self::prod(x, Self::inv(y)) -// } - -// fn hash( -// x: Self::group_type, -// y: Self::group_type, -// z: Self::group_type, -// ) -> ::field_type { -// // fp_hash_to_field -// Z_curve::field_one() // TODO: bls12-381 hash to curve? -// } -// } +//////////////////////// +// Impl for Secp256k1 // +//////////////////////// + +use hacspec_bip_340::*; + +#[derive(core::marker::Copy, Clone, PartialEq, Eq)] +struct Z_curve { + val: Scalar, +} + +impl hacspec_concordium::Deserial for Z_curve { + // TODO: + fn deserial(_source: &mut R) -> ParseResult { + Err(ParseError {}) + } +} + +impl hacspec_concordium::Serial for Z_curve { + // TODO: + fn serial(&self, _out: &mut W) -> Result<(), W::Err> { + Ok(()) + } +} + +impl Z_Field for Z_curve { + type field_type = Z_curve; + + fn q() -> Self::field_type { + Z_curve { + val: Scalar::from_hex( + "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", + ), + } // TODO: Scalar::modulo_value; + } + + fn random_field_elem(random: u32) -> Self::field_type { + Z_curve { + val: Scalar::from_literal(random as u128), + } + } + + fn field_zero() -> Self::field_type { + Z_curve { + val: Scalar::from_literal(0u128), + } // Scalar::ZERO() + } + + fn field_one() -> Self::field_type { + Z_curve { + val: Scalar::from_literal(1u128), + } // Scalar::ONE() + } + + fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { + Z_curve { val: x.val + y.val } + } + + fn sub(x: Self::field_type, y: Self::field_type) -> Self::field_type { + Z_curve { val: x.val - y.val } + } + + fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { + Z_curve { val: x.val * y.val } + } +} + +#[derive(core::marker::Copy, Clone, PartialEq, Eq)] +struct Group_curve { + val: Point, +} + +impl hacspec_concordium::Deserial for Group_curve { + // TODO: + fn deserial(_source: &mut R) -> ParseResult { + Err(ParseError {}) + } +} + +impl hacspec_concordium::Serial for Group_curve { + // TODO: + fn serial(&self, _out: &mut W) -> Result<(), W::Err> { + Ok(()) + } +} + +impl Group for Group_curve { + type group_type = Group_curve; + + // https://eips.ethereum.org/EIPS/eip-2333 + fn g() -> Self::group_type { + #[rustfmt::skip] + let gx = PBytes32([ + 0x79u8, 0xBEu8, 0x66u8, 0x7Eu8, 0xF9u8, 0xDCu8, 0xBBu8, 0xACu8, + 0x55u8, 0xA0u8, 0x62u8, 0x95u8, 0xCEu8, 0x87u8, 0x0Bu8, 0x07u8, + 0x02u8, 0x9Bu8, 0xFCu8, 0xDBu8, 0x2Du8, 0xCEu8, 0x28u8, 0xD9u8, + 0x59u8, 0xF2u8, 0x81u8, 0x5Bu8, 0x16u8, 0xF8u8, 0x17u8, 0x98u8 + ]); + #[rustfmt::skip] + let gy = PBytes32([ + 0x48u8, 0x3Au8, 0xDAu8, 0x77u8, 0x26u8, 0xA3u8, 0xC4u8, 0x65u8, + 0x5Du8, 0xA4u8, 0xFBu8, 0xFCu8, 0x0Eu8, 0x11u8, 0x08u8, 0xA8u8, + 0xFDu8, 0x17u8, 0xB4u8, 0x48u8, 0xA6u8, 0x85u8, 0x54u8, 0x19u8, + 0x9Cu8, 0x47u8, 0xD0u8, 0x8Fu8, 0xFBu8, 0x10u8, 0xD4u8, 0xB8u8 + ]); + Group_curve { + val: Point::Affine(( + FieldElement::from_public_byte_seq_be(gx), + FieldElement::from_public_byte_seq_be(gy), + )), + } + } // TODO + + fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { + Group_curve { + val: point_mul(x.val, g.val), + } + } + + fn g_pow(x: ::field_type) -> Self::group_type { + Group_curve { + val: point_mul_base(x.val), + } + // Self::pow(Self::g(), x) + } + + fn group_one() -> Self::group_type { + Self::g_pow(::field_zero()) + } + + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { + Group_curve { + val: point_add(x.val, y.val), + } + } + + fn inv(x: Self::group_type) -> Self::group_type { + // TODO: + x + } + + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { + Self::prod(x, Self::inv(y)) + } + + fn hash(x: Vec) -> ::field_type { + // fp_hash_to_field + Z_curve::field_one() // TODO: bls12-381 hash to curve? + } +} + +//////////////////// +// Implementation // +//////////////////// #[derive(Serialize, SchemaType, Clone, Copy)] pub struct SchnorrZKPCommit> { @@ -296,7 +322,7 @@ pub fn schnorr_zkp>( let r = Z::random_field_elem(random); let u = G::g_pow(r); let c = G::hash(vec![G::g(), h, u]); - let z = Z::add(r, Z::mul(c, x)); // g^(r + c * x) =?= u * (g^x)^c + let z = Z::add(r, Z::mul(c, x)); return SchnorrZKPCommit { u, c, z }; } @@ -329,26 +355,25 @@ pub fn schorr_zkp_correctness() { .quickcheck(test as fn(u32, u32) -> bool) } -// #[test] -// pub fn schorr_zkp_correctness_bls() { -// fn test(random_x: u32, random_r: u32) -> bool { -// type Z = Z_curve; -// type G = Group_curve; +#[test] +pub fn schorr_zkp_secp256k1_correctness() { + fn test(random_x: u32, random_r: u32) -> bool { + type Z = Z_curve; + type G = Group_curve; -// let x = Z::random_field_elem(random_x); // 2 works -// // let _ = G::g(); -// let pow_x = G::g_pow(x); + let x: Z_curve = Z::random_field_elem(random_x); + let pow_x = G::g_pow(x); -// let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); + let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); -// let valid = schnorr_zkp_validate::(pow_x, pi); -// valid -// } + let valid = schnorr_zkp_validate::(pow_x, pi); + valid + } -// QuickCheck::new() -// .tests(10) -// .quickcheck(test as fn(u32, u32) -> bool) -// } + QuickCheck::new() + .tests(10) + .quickcheck(test as fn(u32, u32) -> bool) +} #[derive(Serialize, SchemaType, Clone, Copy)] pub struct OrZKPCommit> { @@ -458,36 +483,45 @@ pub fn zkp_one_out_of_two_validate>( && zkp.b2 == G::prod(G::pow(h, zkp.r2), G::pow(G::div(zkp.y, G::g()), zkp.d2))) } -#[test] -pub fn or_zkp_correctness() { - fn test( +#[cfg(test)] +pub fn or_zkp_correctness>( random_w: u32, random_r: u32, random_d: u32, random_h: u32, random_x: u32, v: bool, - ) -> bool { - type Z = z_89; - type G = g_z_89; - - let mut h = G::g_pow(Z::random_field_elem(random_h)); - let x = Z::random_field_elem(random_x); - let pi: OrZKPCommit = zkp_one_out_of_two(random_w, random_r, random_d, h, x, v); - let valid = zkp_one_out_of_two_validate::(h, pi); - valid - } +) -> bool { + let mut h = G::g_pow(Z::random_field_elem(random_h)); + let x = Z::random_field_elem(random_x); + let pi: OrZKPCommit = zkp_one_out_of_two(random_w, random_r, random_d, h, x, v); + let valid = zkp_one_out_of_two_validate::(h, pi); + valid +} +#[test] +pub fn or_zkp_correctness_z89(){ QuickCheck::new() .tests(10000) - .quickcheck(test as fn(u32, u32, u32, u32, u32, bool) -> bool) + .quickcheck(or_zkp_correctness:: as fn(u32, u32, u32, u32, u32, bool) -> bool) +} + +#[test] +// TODO: Fix inverse opeation, should make this test parse +pub fn or_zkp_secp256k1_correctness() { + QuickCheck::new() + .tests(10) + .quickcheck(or_zkp_correctness:: as fn(u32, u32, u32, u32, u32, bool) -> bool) } pub fn commit_to>(g_pow_xi_yi_vi: G::group_type) -> Z::field_type { G::hash(vec![g_pow_xi_yi_vi]) } -pub fn check_commitment>(g_pow_xi_yi_vi: G::group_type, commitment: Z::field_type) -> bool { +pub fn check_commitment>( + g_pow_xi_yi_vi: G::group_type, + commitment: Z::field_type, +) -> bool { G::hash(vec![g_pow_xi_yi_vi]) == commitment } @@ -544,7 +578,7 @@ pub fn init_ovn_contract, const n: usize>(// _: &impl Ha /** Currently randomness needs to be injected */ pub fn select_private_voting_key(random: u32) -> Z::field_type { - Z::random_field_elem(random) // x_i \in_R Z_q; + Z::random_field_elem(random) } #[derive(Serialize, SchemaType)] @@ -602,13 +636,10 @@ pub fn compute_g_pow_yi, const n: usize>( g_pow_yi } -#[test] -pub fn sum_to_zero() { - type Z = z_89; - type G = g_z_89; - const n: usize = 55; - let mut xis: [::field_type; n] = [0; n]; - let mut g_pow_xis: [>::group_type; n] = [0; n]; +#[cfg(test)] +pub fn sum_to_zero, const n: usize>() { + let mut xis: [Z::field_type; n] = [Z::field_zero(); n]; + let mut g_pow_xis: [G::group_type; n] = [G::group_one(); n]; use rand::random; for i in 0..n { xis[i] = Z::random_field_elem(random()); @@ -620,7 +651,18 @@ pub fn sum_to_zero() { let g_pow_yi = compute_g_pow_yi::(i, g_pow_xis); res = G::prod(res, G::pow(g_pow_yi, xis[i])); } - assert_eq!(res, G::group_one()); + + assert!(res == G::group_one()); +} + +#[test] +pub fn sum_to_zero_z89() { + sum_to_zero::() +} + +#[test] +pub fn sum_to_zero_secp256k1() { + sum_to_zero::() } pub fn compute_group_element_for_vote>( @@ -733,8 +775,6 @@ pub fn tally_votes, const n: usize, A: HasActions>( Ok((A::accept(), tally_votes_state_ret)) } -// use crate::test_infrastructure::*; - #[cfg(test)] pub fn test_correctness, const n: usize, A: HasActions>( votes: [bool; n], @@ -749,7 +789,6 @@ pub fn test_correctness, const n: usize, A: HasActions>( ) -> bool { // Setup the context let mut ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); - // ctx.set_sender(ADDRESS_0); let mut state: OvnContractState = init_ovn_contract().unwrap(); @@ -757,7 +796,7 @@ pub fn test_correctness, const n: usize, A: HasActions>( let parameter = RegisterParam:: { rp_i: i as u32, rp_xi: xis[i], - rp_zkp_random: rp_zkp_randoms[i], // TODO + rp_zkp_random: rp_zkp_randoms[i], }; let parameter_bytes = to_bytes(¶meter); (_, state) = @@ -811,61 +850,59 @@ pub fn test_correctness, const n: usize, A: HasActions>( state.tally == count } +#[cfg(test)] +fn randomized_full_test, const n: usize> () -> bool { + use rand::random; + let mut votes: [bool; n] = [false; n]; + let mut xis: [Z::field_type; n] = [Z::field_zero(); n]; + let mut rp_zkp_randoms: [u32; n] = [0; n]; + let mut cvp_zkp_random_ws1: [u32; n] = [0; n]; + let mut cvp_zkp_random_rs1: [u32; n] = [0; n]; + let mut cvp_zkp_random_ds1: [u32; n] = [0; n]; + + let mut cvp_zkp_random_ws2: [u32; n] = [0; n]; + let mut cvp_zkp_random_rs2: [u32; n] = [0; n]; + let mut cvp_zkp_random_ds2: [u32; n] = [0; n]; + + for i in 0..n { + votes[i] = random(); + xis[i] = Z::random_field_elem(random()); + rp_zkp_randoms[i] = random(); + cvp_zkp_random_ws1[i] = random(); + cvp_zkp_random_rs1[i] = random(); + cvp_zkp_random_ds1[i] = random(); + cvp_zkp_random_ws2[i] = random(); + cvp_zkp_random_rs2[i] = random(); + cvp_zkp_random_ds2[i] = random(); + } + + test_correctness::( + votes, + xis, + rp_zkp_randoms, + cvp_zkp_random_ws1, + cvp_zkp_random_rs1, + cvp_zkp_random_ds1, + cvp_zkp_random_ws2, + cvp_zkp_random_rs2, + cvp_zkp_random_ds2, + ) +} + // #[concordium_test] #[test] fn test_full_z89() { - type Z = z_89; - type G = g_z_89; - const n: usize = 55; - - use rand::random; - // rand::SeedableRng::seed_from_u64(32u64); // TODO - - fn test() -> bool { - let mut votes: [bool; n] = [false; n]; - let mut xis: [::field_type; n] = [0; n]; - let mut rp_zkp_randoms: [u32; n] = [0; n]; - let mut cvp_zkp_random_ws1: [u32; n] = [0; n]; - let mut cvp_zkp_random_rs1: [u32; n] = [0; n]; - let mut cvp_zkp_random_ds1: [u32; n] = [0; n]; - - let mut cvp_zkp_random_ws2: [u32; n] = [0; n]; - let mut cvp_zkp_random_rs2: [u32; n] = [0; n]; - let mut cvp_zkp_random_ds2: [u32; n] = [0; n]; - - for i in 0..n { - votes[i] = false; // random(); - xis[i] = Z::random_field_elem(random()); - rp_zkp_randoms[i] = random(); - cvp_zkp_random_ws1[i] = random(); - cvp_zkp_random_rs1[i] = random(); - cvp_zkp_random_ds1[i] = random(); - cvp_zkp_random_ws2[i] = random(); - cvp_zkp_random_rs2[i] = random(); - cvp_zkp_random_ds2[i] = random(); - } - - test_correctness::< - Z, - G, - n, - hacspec_concordium::test_infrastructure::ActionsTree, - >( - votes, - xis, - rp_zkp_randoms, - cvp_zkp_random_ws1, - cvp_zkp_random_rs1, - cvp_zkp_random_ds1, - cvp_zkp_random_ws2, - cvp_zkp_random_rs2, - cvp_zkp_random_ds2, - ) - }; + QuickCheck::new() + .tests(100) + .quickcheck(randomized_full_test:: as fn() -> bool) +} +// #[concordium_test] +#[test] +fn test_full_secp256k1() { QuickCheck::new() - .tests(10000) - .quickcheck(test as fn() -> bool) + .tests(100) + .quickcheck(randomized_full_test:: as fn() -> bool) } // https://github.com/stonecoldpat/anonymousvoting From 29e9aded12979b53065d2ec2e10cabecd07ab3c7 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Fri, 26 Jan 2024 16:12:41 +0100 Subject: [PATCH 50/86] Full group ovn extraction to Hacspec_ovn --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 188 ++++++++++++++++++++ 1 file changed, 188 insertions(+) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index a4bc941..d2a619b 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -24,6 +24,9 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. +Require Import Hacspec_bip_340. +Export Hacspec_bip_340. + Class t_Z_Field (Self : choice_type) := { f_field_type : choice_type ; f_field_type_t_Serialize :> t_Serialize (f_field_type) ; @@ -185,6 +188,36 @@ Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_r' ':=' y ')'" Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_d' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := y) (f_cvp_vote := f_cvp_vote x)). Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := y)). +Definition t_Group_curve : choice_type := + (t_Point). +Equations f_val {L : {fset Location}} {I : Interface} (s : both L I (t_Group_curve)) : both L I (t_Point) := + f_val s := + bind_both s (fun x => + solve_lift (ret_both (x : t_Point))) : both L I (t_Point). +Fail Next Obligation. +Equations Build_t_Group_curve {L0 : {fset Location}} {I0 : Interface} {f_val : both L0 I0 (t_Point)} : both L0 I0 (t_Group_curve) := + Build_t_Group_curve := + bind_both f_val (fun f_val => + solve_lift (ret_both ((f_val) : (t_Group_curve)))) : both L0 I0 (t_Group_curve). +Fail Next Obligation. +Notation "'Build_t_Group_curve' '[' x ']' '(' 'f_val' ':=' y ')'" := (Build_t_Group_curve (f_val := y)). + +#[global] Program Instance t_Group_curve_t_Deserial : t_Deserial t_Group_curve := + let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (v__source : both L1 I1 (v_R)) => letb hax_temp_output := Result_Err ParseError in + solve_lift (prod_b (v__source,hax_temp_output)) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_Group_curve) (t_ParseError))) in + {| f_deserial_loc := (fset [] : {fset Location}); + f_deserial := (@f_deserial)|}. +Fail Next Obligation. +Hint Unfold t_Group_curve_t_Deserial. + +#[global] Program Instance t_Group_curve_t_Serial : t_Serial t_Group_curve := + let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Group_curve)) (v__out : both L2 I2 (v_W)) => letb hax_temp_output := Result_Ok (ret_both (tt : 'unit)) in + solve_lift (prod_b (v__out,hax_temp_output)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in + {| f_serial_loc := (fset [] : {fset Location}); + f_serial := (@f_serial)|}. +Fail Next Obligation. +Hint Unfold t_Group_curve_t_Serial. + Definition t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := (f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_field_type × f_field_type × f_field_type × f_field_type × f_field_type). Equations f_x {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := @@ -332,6 +365,63 @@ Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) : solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). Fail Next Obligation. +Definition t_Z_curve : choice_type := + (t_Scalar). +Equations f_val {L : {fset Location}} {I : Interface} (s : both L I (t_Z_curve)) : both L I (t_Scalar) := + f_val s := + bind_both s (fun x => + solve_lift (ret_both (x : t_Scalar))) : both L I (t_Scalar). +Fail Next Obligation. +Equations Build_t_Z_curve {L0 : {fset Location}} {I0 : Interface} {f_val : both L0 I0 (t_Scalar)} : both L0 I0 (t_Z_curve) := + Build_t_Z_curve := + bind_both f_val (fun f_val => + solve_lift (ret_both ((f_val) : (t_Z_curve)))) : both L0 I0 (t_Z_curve). +Fail Next Obligation. +Notation "'Build_t_Z_curve' '[' x ']' '(' 'f_val' ':=' y ')'" := (Build_t_Z_curve (f_val := y)). + +#[global] Program Instance t_Z_curve_t_Deserial : t_Deserial t_Z_curve := + let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (v__source : both L1 I1 (v_R)) => letb hax_temp_output := Result_Err ParseError in + solve_lift (prod_b (v__source,hax_temp_output)) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_Z_curve) (t_ParseError))) in + {| f_deserial_loc := (fset [] : {fset Location}); + f_deserial := (@f_deserial)|}. +Fail Next Obligation. +Hint Unfold t_Z_curve_t_Deserial. + +#[global] Program Instance t_Z_curve_t_Serial : t_Serial t_Z_curve := + let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Z_curve)) (v__out : both L2 I2 (v_W)) => letb hax_temp_output := Result_Ok (ret_both (tt : 'unit)) in + solve_lift (prod_b (v__out,hax_temp_output)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in + {| f_serial_loc := (fset [] : {fset Location}); + f_serial := (@f_serial)|}. +Fail Next Obligation. +Hint Unfold t_Z_curve_t_Serial. + +#[global] Program Instance t_Z_curve_t_Z_Field : t_Z_Field t_Z_curve := + let f_field_type := t_Z_curve : choice_type in + let f_q := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_hex (ret_both (0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 : chString)))) : both (L :|: fset []) I (t_Z_curve) in + let f_random_field_elem := fun {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_literal (cast_int (WS2 := _) random))) : both (L1 :|: fset []) I1 (t_Z_curve) in + let f_field_zero := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_literal (ret_both (0 : int128)))) : both (L :|: fset []) I (t_Z_curve) in + let f_field_one := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_literal (ret_both (1 : int128)))) : both (L :|: fset []) I (t_Z_curve) in + let f_add := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Z_curve)) (y : both L2 I2 (t_Z_curve)) => solve_lift (Build_t_Z_curve (f_val := (f_val x) .+ (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Z_curve) in + let f_sub := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Z_curve)) (y : both L2 I2 (t_Z_curve)) => solve_lift (Build_t_Z_curve (f_val := (f_val x) .- (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Z_curve) in + let f_mul := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Z_curve)) (y : both L2 I2 (t_Z_curve)) => solve_lift (Build_t_Z_curve (f_val := (f_val x) .* (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Z_curve) in + {| f_field_type := (@f_field_type); + f_q_loc := (fset [] : {fset Location}); + f_q := (@f_q); + f_random_field_elem_loc := (fset [] : {fset Location}); + f_random_field_elem := (@f_random_field_elem); + f_field_zero_loc := (fset [] : {fset Location}); + f_field_zero := (@f_field_zero); + f_field_one_loc := (fset [] : {fset Location}); + f_field_one := (@f_field_one); + f_add_loc := (fset [] : {fset Location}); + f_add := (@f_add); + f_sub_loc := (fset [] : {fset Location}); + f_sub := (@f_sub); + f_mul_loc := (fset [] : {fset Location}); + f_mul := (@f_mul)|}. +Fail Next Obligation. +Hint Unfold t_Z_curve_t_Z_Field. + Definition t_g_z_89_ : choice_type := 'unit. Equations Build_t_g_z_89_ : both (fset []) (fset []) (t_g_z_89_) := @@ -443,6 +533,104 @@ Fail Next Obligation. Fail Next Obligation. Hint Unfold t_z_89__t_Z_Field. +Definition result_loc : Location := + (int32;10%nat). +Definition res_loc : Location := + (int32;9%nat). +#[global] Program Instance t_Group_curve_t_Group : t_Group t_Group_curve t_Z_curve := + let f_group_type := t_Group_curve : choice_type in + let f_g := fun {L : {fset Location}} {I : Interface} => letb gx := PBytes32 (array_from_list [ret_both (121 : int8); + ret_both (190 : int8); + ret_both (102 : int8); + ret_both (126 : int8); + ret_both (249 : int8); + ret_both (220 : int8); + ret_both (187 : int8); + ret_both (172 : int8); + ret_both (85 : int8); + ret_both (160 : int8); + ret_both (98 : int8); + ret_both (149 : int8); + ret_both (206 : int8); + ret_both (135 : int8); + ret_both (11 : int8); + ret_both (7 : int8); + ret_both (2 : int8); + ret_both (155 : int8); + ret_both (252 : int8); + ret_both (219 : int8); + ret_both (45 : int8); + ret_both (206 : int8); + ret_both (40 : int8); + ret_both (217 : int8); + ret_both (89 : int8); + ret_both (242 : int8); + ret_both (129 : int8); + ret_both (91 : int8); + ret_both (22 : int8); + ret_both (248 : int8); + ret_both (23 : int8); + ret_both (152 : int8)]) in + letb gy := PBytes32 (array_from_list [ret_both (72 : int8); + ret_both (58 : int8); + ret_both (218 : int8); + ret_both (119 : int8); + ret_both (38 : int8); + ret_both (163 : int8); + ret_both (196 : int8); + ret_both (101 : int8); + ret_both (93 : int8); + ret_both (164 : int8); + ret_both (251 : int8); + ret_both (252 : int8); + ret_both (14 : int8); + ret_both (17 : int8); + ret_both (8 : int8); + ret_both (168 : int8); + ret_both (253 : int8); + ret_both (23 : int8); + ret_both (180 : int8); + ret_both (72 : int8); + ret_both (166 : int8); + ret_both (133 : int8); + ret_both (84 : int8); + ret_both (25 : int8); + ret_both (156 : int8); + ret_both (71 : int8); + ret_both (208 : int8); + ret_both (143 : int8); + ret_both (251 : int8); + ret_both (16 : int8); + ret_both (212 : int8); + ret_both (184 : int8)]) in + solve_lift (Build_t_Group_curve (f_val := Point_Affine (prod_b (impl__FieldElement__from_public_byte_seq_be gx,impl__FieldElement__from_public_byte_seq_be gy)))) : both (L :|: fset []) I (t_Group_curve) in + let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (t_Group_curve)) (x : both L2 I2 (t_Z_curve)) => solve_lift (Build_t_Group_curve (f_val := point_mul (f_val x) (f_val g))) : both (L1 :|: L2 :|: fset [result_loc]) (I1 :|: I2) (t_Group_curve) in + let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Z_curve)) => solve_lift (Build_t_Group_curve (f_val := point_mul_base (f_val x))) : both (L1 :|: fset []) I1 (t_Group_curve) in + let f_group_one := fun {L : {fset Location}} {I : Interface} => solve_lift (f_g_pow (f_field_zero (ret_both (tt : 'unit)))) : both (L :|: fset []) I (t_Group_curve) in + let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Group_curve)) (y : both L2 I2 (t_Group_curve)) => solve_lift (Build_t_Group_curve (f_val := point_add (f_val x) (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Group_curve) in + let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Group_curve)) => solve_lift x : both (L1 :|: fset []) I1 (t_Group_curve) in + let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Group_curve)) (y : both L2 I2 (t_Group_curve)) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Group_curve) in + let f_hash := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Vec (t_Group_curve) (t_Global))) => solve_lift (f_field_one (ret_both (tt : 'unit))) : both (L1 :|: fset [res_loc]) I1 (t_Z_curve) in + {| f_group_type := (@f_group_type); + f_g_loc := (fset [] : {fset Location}); + f_g := (@f_g); + f_pow_loc := (fset [result_loc] : {fset Location}); + f_pow := (@f_pow); + f_g_pow_loc := (fset [] : {fset Location}); + f_g_pow := (@f_g_pow); + f_group_one_loc := (fset [] : {fset Location}); + f_group_one := (@f_group_one); + f_prod_loc := (fset [] : {fset Location}); + f_prod := (@f_prod); + f_inv_loc := (fset [] : {fset Location}); + f_inv := (@f_inv); + f_div_loc := (fset [] : {fset Location}); + f_div := (@f_div); + f_hash_loc := (fset [res_loc] : {fset Location}); + f_hash := (@f_hash)|}. +Fail Next Obligation. +Hint Unfold t_Group_curve_t_Group. + Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := (nseq f_group_type (is_pure (n)) × nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n)) × nseq f_field_type (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n)) × int32). Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type (is_pure (n))) := From 87461b6d44a1dcfd24947540916e454d4a6b431e Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Fri, 26 Jan 2024 16:26:38 +0100 Subject: [PATCH 51/86] Fix generation by hand for now --- .../extraction/Hacspec_ovn_group_by_hand.v | 941 ++++++++++++++++++ 1 file changed, 941 insertions(+) create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_group_by_hand.v diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_by_hand.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_by_hand.v new file mode 100644 index 0000000..8da08f8 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_by_hand.v @@ -0,0 +1,941 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +(* Require Import Hacspec_bip_340. *) +(* Export Hacspec_bip_340. *) + +Class t_Z_Field (Self : choice_type) := { + f_field_type : choice_type ; + f_field_type_t_Serialize :> t_Serialize (f_field_type) ; + f_field_type_t_Deserial :> t_Deserial (f_field_type) ; + f_field_type_t_Serial :> t_Serial (f_field_type) ; + f_field_type_t_Copy :> t_Copy (f_field_type) ; + f_field_type_t_Clone :> t_Clone (f_field_type) ; + f_field_type_t_Eq :> t_Eq (f_field_type) ; + f_field_type_t_PartialEq :> t_PartialEq (f_field_type) ; + f_field_type_t_Sized :> t_Sized (f_field_type) ; + f_q_loc : {fset Location} ; + f_q : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_q_loc) I1 (f_field_type) ; + f_random_field_elem_loc : {fset Location} ; + f_random_field_elem : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_random_field_elem_loc) I1 (f_field_type) ; + f_field_zero_loc : {fset Location} ; + f_field_zero : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_field_zero_loc) I1 (f_field_type) ; + f_field_one_loc : {fset Location} ; + f_field_one : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_field_one_loc) I1 (f_field_type) ; + f_add_loc : {fset Location} ; + f_add : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_add_loc) (I1 :|: I2) (f_field_type) ; + f_sub_loc : {fset Location} ; + f_sub : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_sub_loc) (I1 :|: I2) (f_field_type) ; + f_mul_loc : {fset Location} ; + f_mul : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_mul_loc) (I1 :|: I2) (f_field_type) ; +}. +Hint Unfold f_q_loc. +Hint Unfold f_random_field_elem_loc. +Hint Unfold f_field_zero_loc. +Hint Unfold f_field_one_loc. +Hint Unfold f_add_loc. +Hint Unfold f_sub_loc. +Hint Unfold f_mul_loc. + +Class t_Group (Self : choice_type) `{t_Z_Field} := { + f_group_type : choice_type ; + f_group_type_t_Serialize :> t_Serialize (f_group_type) ; + f_group_type_t_Deserial :> t_Deserial (f_group_type) ; + f_group_type_t_Serial :> t_Serial (f_group_type) ; + f_group_type_t_Copy :> t_Copy (f_group_type) ; + f_group_type_t_Clone :> t_Clone (f_group_type) ; + f_group_type_t_Eq :> t_Eq (f_group_type) ; + f_group_type_t_PartialEq :> t_PartialEq (f_group_type) ; + f_group_type_t_Sized :> t_Sized (f_group_type) ; + f_g_loc : {fset Location} ; + f_g : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_g_loc) I1 (f_group_type) ; + f_g_pow_loc : {fset Location} ; + f_g_pow : forall {L1 I1}, both L1 I1 (f_field_type) -> both (L1 :|: f_g_pow_loc) I1 (f_group_type) ; + f_pow_loc : {fset Location} ; + f_pow : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_pow_loc) (I1 :|: I2) (f_group_type) ; + f_group_one_loc : {fset Location} ; + f_group_one : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_group_one_loc) I1 (f_group_type) ; + f_prod_loc : {fset Location} ; + f_prod : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_prod_loc) (I1 :|: I2) (f_group_type) ; + f_inv_loc : {fset Location} ; + f_inv : forall {L1 I1}, both L1 I1 (f_group_type) -> both (L1 :|: f_inv_loc) I1 (f_group_type) ; + f_div_loc : {fset Location} ; + f_div : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_div_loc) (I1 :|: I2) (f_group_type) ; + f_hash_loc : {fset Location} ; + f_hash : forall {L1 I1}, both L1 I1 (t_Vec (f_group_type) (t_Global)) -> both (L1 :|: f_hash_loc) I1 (f_field_type) ; +}. +Hint Unfold f_g_loc. +Hint Unfold f_g_pow_loc. +Hint Unfold f_pow_loc. +Hint Unfold f_group_one_loc. +Hint Unfold f_prod_loc. +Hint Unfold f_inv_loc. +Hint Unfold f_div_loc. +Hint Unfold f_hash_loc. + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (xi : both L1 I1 (f_field_type)) (vote : both L2 I2 ('bool)) (g_pow_yi : both L3 I3 (f_group_type)) : both (L1 :|: L2 :|: L3 :|: (f_pow_loc :|: f_field_zero_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3) (f_group_type) := + compute_group_element_for_vote xi vote g_pow_yi := + solve_lift (f_prod (f_pow g_pow_yi xi) (f_g_pow (ifb vote + then f_field_one (ret_both (tt : 'unit)) + else f_field_zero (ret_both (tt : 'unit))))) : both (L1 :|: L2 :|: L3 :|: (f_pow_loc :|: f_field_zero_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3) (f_group_type). +Fail Next Obligation. + +Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (random : both L1 I1 (int32)) : both (L1 :|: f_random_field_elem_loc) I1 (f_field_type) := + select_private_voting_key random := + solve_lift (f_random_field_elem random) : both (L1 :|: f_random_field_elem_loc) I1 (f_field_type). +Fail Next Obligation. + +Definition prod1_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := + (f_group_type;0%nat). +Definition prod2_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := + (f_group_type;1%nat). +Equations compute_g_pow_yi {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both L1 I1 (uint_size)) (xis : both L2 I2 (nseq f_group_type (is_pure (n)))) : both (L1 :|: L2 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (f_group_type) := + compute_g_pow_yi i xis := + letb prod1 loc(prod1_loc) := f_group_one (ret_both (tt : 'unit)) in + letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => + ssp (fun prod1 => + solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L2:|:f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|:L1:|:fset [prod1_loc;prod1_loc]) (I1:|:I2:|:I1) (f_group_type))) prod1 in + letb prod2 loc(prod2_loc) := f_group_one (ret_both (tt : 'unit)) in + letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => + ssp (fun prod2 => + solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L2:|:f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|:L1:|:fset [prod2_loc;prod2_loc]) (I1:|:I2:|:I1) (f_group_type))) prod2 in + solve_lift (f_div prod1 prod2) : both (L1 :|: L2 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2) (f_group_type). +Solve All Obligations with ( solve_ssprove_obligations ; ((now (rewrite !fset0E ; apply (ret_both 0))) || (now destruct from_uint_size))). +Fail Next Obligation. + +Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (commitment : both L2 I2 (f_field_type)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + check_commitment g_pow_xi_yi_vi commitment := + solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Equations commit_to {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) : both L1 I1 (f_field_type) := + commit_to g_pow_xi_yi_vi := + solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both L1 I1 (f_field_type). +Fail Next Obligation. + +Definition t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := + (int32 × f_field_type × int32 × int32 × int32 × 'bool). +Equations f_cvp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_i s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_cvp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (f_field_type) := + f_cvp_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_cvp_zkp_random_w {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_zkp_random_w s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_cvp_zkp_random_r {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_zkp_random_r s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_cvp_zkp_random_d {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_zkp_random_d s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_cvp_vote {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I ('bool) := + f_cvp_vote s := + bind_both s (fun x => + solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). +Fail Next Obligation. +Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (f_field_type)} {f_cvp_zkp_random_w : both L2 I2 (int32)} {f_cvp_zkp_random_r : both L3 I3 (int32)} {f_cvp_zkp_random_d : both L4 I4 (int32)} {f_cvp_vote : both L5 I5 ('bool)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_CastVoteParam) := + Build_t_CastVoteParam := + bind_both f_cvp_vote (fun f_cvp_vote => + bind_both f_cvp_zkp_random_d (fun f_cvp_zkp_random_d => + bind_both f_cvp_zkp_random_r (fun f_cvp_zkp_random_r => + bind_both f_cvp_zkp_random_w (fun f_cvp_zkp_random_w => + bind_both f_cvp_xi (fun f_cvp_xi => + bind_both f_cvp_i (fun f_cvp_i => + solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_CastVoteParam). +Fail Next Obligation. +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_w' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := y) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_r' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := y) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_d' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := y) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := y)). + +Definition t_Group_curve : choice_type := + (t_Point). +Equations f_val {L : {fset Location}} {I : Interface} (s : both L I (t_Group_curve)) : both L I (t_Point) := + f_val s := + bind_both s (fun x => + solve_lift (ret_both (x : t_Point))) : both L I (t_Point). +Fail Next Obligation. +Equations Build_t_Group_curve {L0 : {fset Location}} {I0 : Interface} {f_val : both L0 I0 (t_Point)} : both L0 I0 (t_Group_curve) := + Build_t_Group_curve := + bind_both f_val (fun f_val => + solve_lift (ret_both ((f_val) : (t_Group_curve)))) : both L0 I0 (t_Group_curve). +Fail Next Obligation. +Notation "'Build_t_Group_curve' '[' x ']' '(' 'f_val' ':=' y ')'" := (Build_t_Group_curve (f_val := y)). + +#[global] Program Instance t_Group_curve_t_Deserial : t_Deserial t_Group_curve := + let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (v__source : both L1 I1 (v_R)) => letb hax_temp_output := Result_Err ParseError in + solve_lift (prod_b (v__source,hax_temp_output)) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_Group_curve) (t_ParseError))) in + {| f_deserial_loc := (fset [] : {fset Location}); + f_deserial := (@f_deserial)|}. +Fail Next Obligation. +Hint Unfold t_Group_curve_t_Deserial. + +#[global] Program Instance t_Group_curve_t_Serial : t_Serial t_Group_curve := + let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Group_curve)) (v__out : both L2 I2 (v_W)) => letb hax_temp_output := Result_Ok (ret_both (tt : 'unit)) in + solve_lift (prod_b (v__out,hax_temp_output)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in + {| f_serial_loc := (fset [] : {fset Location}); + f_serial := (@f_serial)|}. +Fail Next Obligation. +Hint Unfold t_Group_curve_t_Serial. + +Definition t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := + (f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_field_type × f_field_type × f_field_type × f_field_type × f_field_type). +Equations f_x {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_x s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both L I (f_group_type). +Fail Next Obligation. +Equations f_y {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_y s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both L I (f_group_type). +Fail Next Obligation. +Equations f_a1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_a1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : f_group_type))) : both L I (f_group_type). +Fail Next Obligation. +Equations f_b1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_b1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : f_group_type))) : both L I (f_group_type). +Fail Next Obligation. +Equations f_a2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_a2 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : f_group_type))) : both L I (f_group_type). +Fail Next Obligation. +Equations f_b2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_b2 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : f_group_type))) : both L I (f_group_type). +Fail Next Obligation. +Equations f_c {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_c s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_d1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_d1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_d2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_d2 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_r1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_r1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_r2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_r2 s := + bind_both s (fun x => + solve_lift (ret_both (snd x : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations Build_t_OrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {L7 : {fset Location}} {L8 : {fset Location}} {L9 : {fset Location}} {L10 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {I7 : Interface} {I8 : Interface} {I9 : Interface} {I10 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_x : both L0 I0 (f_group_type)} {f_y : both L1 I1 (f_group_type)} {f_a1 : both L2 I2 (f_group_type)} {f_b1 : both L3 I3 (f_group_type)} {f_a2 : both L4 I4 (f_group_type)} {f_b2 : both L5 I5 (f_group_type)} {f_c : both L6 I6 (f_field_type)} {f_d1 : both L7 I7 (f_field_type)} {f_d2 : both L8 I8 (f_field_type)} {f_r1 : both L9 I9 (f_field_type)} {f_r2 : both L10 I10 (f_field_type)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit) := + Build_t_OrZKPCommit := + bind_both f_r2 (fun f_r2 => + bind_both f_r1 (fun f_r1 => + bind_both f_d2 (fun f_d2 => + bind_both f_d1 (fun f_d1 => + bind_both f_c (fun f_c => + bind_both f_b2 (fun f_b2 => + bind_both f_a2 (fun f_a2 => + bind_both f_b1 (fun f_b1 => + bind_both f_a1 (fun f_a1 => + bind_both f_y (fun f_y => + bind_both f_x (fun f_x => + solve_lift (ret_both ((f_x,f_y,f_a1,f_b1,f_a2,f_b2,f_c,f_d1,f_d2,f_r1,f_r2) : (t_OrZKPCommit)))))))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit). +Fail Next Obligation. +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := y) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := y) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_a1' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := y) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_b1' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := y) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_a2' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := y) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_b2' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := y) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_c' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := y) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_d1' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := y) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_d2' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := y) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_r1' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := y) (f_r2 := f_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_r2' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := y)). + +Definition t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := + (int32 × f_field_type × int32). +Equations f_rp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (int32) := + f_rp_i s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_rp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (f_field_type) := + f_rp_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_rp_zkp_random {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (int32) := + f_rp_zkp_random s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (f_field_type)} {f_rp_zkp_random : both L2 I2 (int32)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_RegisterParam) := + Build_t_RegisterParam := + bind_both f_rp_zkp_random (fun f_rp_zkp_random => + bind_both f_rp_xi (fun f_rp_xi => + bind_both f_rp_i (fun f_rp_i => + solve_lift (ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_RegisterParam). +Fail Next Obligation. +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y) (f_rp_zkp_random := f_rp_zkp_random x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := y)). + +Definition t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := + (f_group_type × f_field_type × f_field_type). +Equations f_u {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_group_type) := + f_u s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : f_group_type))) : both L I (f_group_type). +Fail Next Obligation. +Equations f_c {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := + f_c s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_z {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := + f_z s := + bind_both s (fun x => + solve_lift (ret_both (snd x : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations Build_t_SchnorrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_u : both L0 I0 (f_group_type)} {f_c : both L1 I1 (f_field_type)} {f_z : both L2 I2 (f_field_type)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit) := + Build_t_SchnorrZKPCommit := + bind_both f_z (fun f_z => + bind_both f_c (fun f_c => + bind_both f_u (fun f_u => + solve_lift (ret_both ((f_u,f_c,f_z) : (t_SchnorrZKPCommit)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit). +Fail Next Obligation. +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_u := y) (f_c := f_c x) (f_z := f_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_u := f_u x) (f_c := y) (f_z := f_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_u := f_u x) (f_c := f_c x) (f_z := y)). + +Definition t_TallyParameter : choice_type := + 'unit. +Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := + Build_t_TallyParameter := + solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). +Fail Next Obligation. + +Definition t_Z_curve : choice_type := + (t_Scalar). +Equations f_val {L : {fset Location}} {I : Interface} (s : both L I (t_Z_curve)) : both L I (t_Scalar) := + f_val s := + bind_both s (fun x => + solve_lift (ret_both (x : t_Scalar))) : both L I (t_Scalar). +Fail Next Obligation. +Equations Build_t_Z_curve {L0 : {fset Location}} {I0 : Interface} {f_val : both L0 I0 (t_Scalar)} : both L0 I0 (t_Z_curve) := + Build_t_Z_curve := + bind_both f_val (fun f_val => + solve_lift (ret_both ((f_val) : (t_Z_curve)))) : both L0 I0 (t_Z_curve). +Fail Next Obligation. +Notation "'Build_t_Z_curve' '[' x ']' '(' 'f_val' ':=' y ')'" := (Build_t_Z_curve (f_val := y)). + +#[global] Program Instance t_Z_curve_t_Deserial : t_Deserial t_Z_curve := + let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (v__source : both L1 I1 (v_R)) => letb hax_temp_output := Result_Err ParseError in + solve_lift (prod_b (v__source,hax_temp_output)) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_Z_curve) (t_ParseError))) in + {| f_deserial_loc := (fset [] : {fset Location}); + f_deserial := (@f_deserial)|}. +Fail Next Obligation. +Hint Unfold t_Z_curve_t_Deserial. + +#[global] Program Instance t_Z_curve_t_Serial : t_Serial t_Z_curve := + let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Z_curve)) (v__out : both L2 I2 (v_W)) => letb hax_temp_output := Result_Ok (ret_both (tt : 'unit)) in + solve_lift (prod_b (v__out,hax_temp_output)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in + {| f_serial_loc := (fset [] : {fset Location}); + f_serial := (@f_serial)|}. +Fail Next Obligation. +Hint Unfold t_Z_curve_t_Serial. + +#[global] Program Instance t_Z_curve_t_Z_Field : t_Z_Field t_Z_curve := + let f_field_type := t_Z_curve : choice_type in + let f_q := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_hex (ret_both (0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 : chString)))) : both (L :|: fset []) I (t_Z_curve) in + let f_random_field_elem := fun {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_literal (cast_int (WS2 := _) random))) : both (L1 :|: fset []) I1 (t_Z_curve) in + let f_field_zero := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_literal (ret_both (0 : int128)))) : both (L :|: fset []) I (t_Z_curve) in + let f_field_one := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_literal (ret_both (1 : int128)))) : both (L :|: fset []) I (t_Z_curve) in + let f_add := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Z_curve)) (y : both L2 I2 (t_Z_curve)) => solve_lift (Build_t_Z_curve (f_val := (f_val x) .+ (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Z_curve) in + let f_sub := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Z_curve)) (y : both L2 I2 (t_Z_curve)) => solve_lift (Build_t_Z_curve (f_val := (f_val x) .- (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Z_curve) in + let f_mul := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Z_curve)) (y : both L2 I2 (t_Z_curve)) => solve_lift (Build_t_Z_curve (f_val := (f_val x) .* (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Z_curve) in + {| f_field_type := (@f_field_type); + f_q_loc := (fset [] : {fset Location}); + f_q := (@f_q); + f_random_field_elem_loc := (fset [] : {fset Location}); + f_random_field_elem := (@f_random_field_elem); + f_field_zero_loc := (fset [] : {fset Location}); + f_field_zero := (@f_field_zero); + f_field_one_loc := (fset [] : {fset Location}); + f_field_one := (@f_field_one); + f_add_loc := (fset [] : {fset Location}); + f_add := (@f_add); + f_sub_loc := (fset [] : {fset Location}); + f_sub := (@f_sub); + f_mul_loc := (fset [] : {fset Location}); + f_mul := (@f_mul)|}. +Fail Next Obligation. +Hint Unfold t_Z_curve_t_Z_Field. + +Definition t_g_z_89_ : choice_type := + 'unit. +Equations Build_t_g_z_89_ : both (fset []) (fset []) (t_g_z_89_) := + Build_t_g_z_89_ := + solve_lift (ret_both (tt (* Empty tuple *) : (t_g_z_89_))) : both (fset []) (fset []) (t_g_z_89_). +Fail Next Obligation. + +Definition t_z_89_ : choice_type := + 'unit. +Equations Build_t_z_89_ : both (fset []) (fset []) (t_z_89_) := + Build_t_z_89_ := + solve_lift (ret_both (tt (* Empty tuple *) : (t_z_89_))) : both (fset []) (fset []) (t_z_89_). +Fail Next Obligation. + +Equations schnorr_zkp {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (h : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z) (v_G)) := + schnorr_zkp random h x := + solve_lift (run (letb r := f_random_field_elem random in + letb u := f_g_pow r in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); + h; + u])))) in + letb z := f_add r (f_mul c x) in + letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z) (v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_u := u) (f_c := c) (f_z := z)) in + ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z) (v_G)). +Fail Next Obligation. + +Equations schnorr_zkp_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (pi : both L2 I2 (t_SchnorrZKPCommit (v_Z) (v_G))) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + schnorr_zkp_validate h pi := + solve_lift (andb ((f_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); + h; + f_u pi])))))) ((f_g_pow (f_z pi)) =.? (f_prod (f_u pi) (f_pow h (f_c pi))))) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both L1 I1 (int32)) (random_r : both L2 I2 (int32)) (random_d : both L3 I3 (int32)) (h : both L4 I4 (f_group_type)) (xi : both L5 I5 (f_field_type)) (vi : both L6 I6 ('bool)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z) (v_G)) := + zkp_one_out_of_two random_w random_r random_d h xi vi := + letb w := f_random_field_elem random_w in + solve_lift (ifb vi + then letb r1 := f_random_field_elem random_r in + letb d1 := f_random_field_elem random_d in + letb x := f_g_pow xi in + letb y := f_prod (f_pow h xi) (f_g (ret_both (tt : 'unit))) in + letb a1 := f_prod (f_g_pow r1) (f_pow x d1) in + letb b1 := f_prod (f_pow h r1) (f_pow y d1) in + letb a2 := f_g_pow w in + letb b2 := f_pow h w in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; + y; + a1; + b1; + a2; + b2])))) in + letb d2 := f_sub c d1 in + letb r2 := f_sub w (f_mul xi d2) in + Build_t_OrZKPCommit (f_x := x) (f_y := y) (f_a1 := a1) (f_b1 := b1) (f_a2 := a2) (f_b2 := b2) (f_c := c) (f_d1 := d1) (f_d2 := d2) (f_r1 := r1) (f_r2 := r2) + else letb r2 := f_random_field_elem random_r in + letb d2 := f_random_field_elem random_d in + letb x := f_g_pow xi in + letb y := f_pow h xi in + letb a1 := f_g_pow w in + letb b1 := f_pow h w in + letb a2 := f_prod (f_g_pow r2) (f_pow x d2) in + letb b2 := f_prod (f_pow h r2) (f_pow (f_div y (f_g (ret_both (tt : 'unit)))) d2) in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; + y; + a1; + b1; + a2; + b2])))) in + letb d1 := f_sub c d2 in + letb r1 := f_sub w (f_mul xi d1) in + Build_t_OrZKPCommit (f_x := x) (f_y := y) (f_a1 := a1) (f_b1 := b1) (f_a2 := a2) (f_b2 := b2) (f_c := c) (f_d1 := d1) (f_d2 := d2) (f_r1 := r1) (f_r2 := r2)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z) (v_G)). +Fail Next Obligation. + +Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (zkp : both L2 I2 (t_OrZKPCommit (v_Z) (v_G))) : both (L1 :|: L2) (I1 :|: I2) ('bool) := + zkp_one_out_of_two_validate h zkp := + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_x zkp; + f_y zkp; + f_a1 zkp; + f_b1 zkp; + f_a2 zkp; + f_b2 zkp])))) in + solve_lift (andb (andb (andb (andb (c =.? (f_add (f_d1 zkp) (f_d2 zkp))) ((f_a1 zkp) =.? (f_prod (f_g_pow (f_r1 zkp)) (f_pow (f_x zkp) (f_d1 zkp))))) ((f_b1 zkp) =.? (f_prod (f_pow h (f_r1 zkp)) (f_pow (f_y zkp) (f_d1 zkp))))) ((f_a2 zkp) =.? (f_prod (f_g_pow (f_r2 zkp)) (f_pow (f_x zkp) (f_d2 zkp))))) ((f_b2 zkp) =.? (f_prod (f_pow h (f_r2 zkp)) (f_pow (f_div (f_y zkp) (f_g (ret_both (tt : 'unit)))) (f_d2 zkp))))) : both (L1 :|: L2) (I1 :|: I2) ('bool). +Fail Next Obligation. + +#[global] Program Instance t_z_89__t_Z_Field : t_Z_Field t_z_89_ := + let f_field_type := int32 : choice_type in + let f_q := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (89 : int32)) : both (L :|: fset []) I (int32) in + let f_random_field_elem := fun {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) => solve_lift (random .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) : both (L1 :|: fset []) I1 (int32) in + let f_field_zero := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (0 : int32)) : both (L :|: fset []) I (int32) in + let f_field_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I (int32) in + let f_add := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .+ y) .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + let f_sub := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (((x .+ ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) .- y) .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + let f_mul := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + {| f_field_type := (@f_field_type); + f_q_loc := (fset [] : {fset Location}); + f_q := (@f_q); + f_random_field_elem_loc := (fset [] : {fset Location}); + f_random_field_elem := (@f_random_field_elem); + f_field_zero_loc := (fset [] : {fset Location}); + f_field_zero := (@f_field_zero); + f_field_one_loc := (fset [] : {fset Location}); + f_field_one := (@f_field_one); + f_add_loc := (fset [] : {fset Location}); + f_add := (@f_add); + f_sub_loc := (fset [] : {fset Location}); + f_sub := (@f_sub); + f_mul_loc := (fset [] : {fset Location}); + f_mul := (@f_mul)|}. +Fail Next Obligation. +Hint Unfold t_z_89__t_Z_Field. + +Definition result_loc : Location := + (int32;10%nat). +Definition res_loc : Location := + (int32;9%nat). +#[global] Program Instance t_Group_curve_t_Group : t_Group t_Group_curve t_Z_curve := + let f_group_type := t_Group_curve : choice_type in + let f_g := fun {L : {fset Location}} {I : Interface} => letb gx := PBytes32 (array_from_list [ret_both (121 : int8); + ret_both (190 : int8); + ret_both (102 : int8); + ret_both (126 : int8); + ret_both (249 : int8); + ret_both (220 : int8); + ret_both (187 : int8); + ret_both (172 : int8); + ret_both (85 : int8); + ret_both (160 : int8); + ret_both (98 : int8); + ret_both (149 : int8); + ret_both (206 : int8); + ret_both (135 : int8); + ret_both (11 : int8); + ret_both (7 : int8); + ret_both (2 : int8); + ret_both (155 : int8); + ret_both (252 : int8); + ret_both (219 : int8); + ret_both (45 : int8); + ret_both (206 : int8); + ret_both (40 : int8); + ret_both (217 : int8); + ret_both (89 : int8); + ret_both (242 : int8); + ret_both (129 : int8); + ret_both (91 : int8); + ret_both (22 : int8); + ret_both (248 : int8); + ret_both (23 : int8); + ret_both (152 : int8)]) in + letb gy := PBytes32 (array_from_list [ret_both (72 : int8); + ret_both (58 : int8); + ret_both (218 : int8); + ret_both (119 : int8); + ret_both (38 : int8); + ret_both (163 : int8); + ret_both (196 : int8); + ret_both (101 : int8); + ret_both (93 : int8); + ret_both (164 : int8); + ret_both (251 : int8); + ret_both (252 : int8); + ret_both (14 : int8); + ret_both (17 : int8); + ret_both (8 : int8); + ret_both (168 : int8); + ret_both (253 : int8); + ret_both (23 : int8); + ret_both (180 : int8); + ret_both (72 : int8); + ret_both (166 : int8); + ret_both (133 : int8); + ret_both (84 : int8); + ret_both (25 : int8); + ret_both (156 : int8); + ret_both (71 : int8); + ret_both (208 : int8); + ret_both (143 : int8); + ret_both (251 : int8); + ret_both (16 : int8); + ret_both (212 : int8); + ret_both (184 : int8)]) in + solve_lift (Build_t_Group_curve (f_val := Point_Affine (prod_b (impl__FieldElement__from_public_byte_seq_be gx,impl__FieldElement__from_public_byte_seq_be gy)))) : both (L :|: fset []) I (t_Group_curve) in + let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (t_Group_curve)) (x : both L2 I2 (t_Z_curve)) => solve_lift (Build_t_Group_curve (f_val := point_mul (f_val x) (f_val g))) : both (L1 :|: L2 :|: fset [result_loc]) (I1 :|: I2) (t_Group_curve) in + let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Z_curve)) => solve_lift (Build_t_Group_curve (f_val := point_mul_base (f_val x))) : both (L1 :|: fset []) I1 (t_Group_curve) in + let f_group_one := fun {L : {fset Location}} {I : Interface} => solve_lift (f_g_pow (f_field_zero (ret_both (tt : 'unit)))) : both (L :|: fset []) I (t_Group_curve) in + let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Group_curve)) (y : both L2 I2 (t_Group_curve)) => solve_lift (Build_t_Group_curve (f_val := point_add (f_val x) (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Group_curve) in + let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Group_curve)) => solve_lift x : both (L1 :|: fset []) I1 (t_Group_curve) in + let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Group_curve)) (y : both L2 I2 (t_Group_curve)) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Group_curve) in + let f_hash := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Vec (t_Group_curve) (t_Global))) => solve_lift (f_field_one (ret_both (tt : 'unit))) : both (L1 :|: fset [res_loc]) I1 (t_Z_curve) in + {| f_group_type := (@f_group_type); + f_g_loc := (fset [] : {fset Location}); + f_g := (@f_g); + f_pow_loc := (fset [result_loc] : {fset Location}); + f_pow := (@f_pow); + f_g_pow_loc := (fset [] : {fset Location}); + f_g_pow := (@f_g_pow); + f_group_one_loc := (fset [] : {fset Location}); + f_group_one := (@f_group_one); + f_prod_loc := (fset [] : {fset Location}); + f_prod := (@f_prod); + f_inv_loc := (fset [] : {fset Location}); + f_inv := (@f_inv); + f_div_loc := (fset [] : {fset Location}); + f_div := (@f_div); + f_hash_loc := (fset [res_loc] : {fset Location}); + f_hash := (@f_hash)|}. +Fail Next Obligation. +Hint Unfold t_Group_curve_t_Group. + +Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := + (nseq f_group_type (is_pure (n)) × nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n)) × nseq f_field_type (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n)) × int32). +Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type (is_pure (n))) := + f_g_pow_xis s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). +Fail Next Obligation. +Equations f_zkp_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n))) := + f_zkp_xis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n))))) : both L I (nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n))). +Fail Next Obligation. +Equations f_commit_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq f_field_type (is_pure (n))) := + f_commit_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : nseq f_field_type (is_pure (n))))) : both L I (nseq f_field_type (is_pure (n))). +Fail Next Obligation. +Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type (is_pure (n))) := + f_g_pow_xi_yi_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). +Fail Next Obligation. +Equations f_zkp_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n))) := + f_zkp_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n))))) : both L I (nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n))). +Fail Next Obligation. +Equations f_tally {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (int32) := + f_tally s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_g_pow_xis : both L0 I0 (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both L1 I1 (nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n)))} {f_commit_vis : both L2 I2 (nseq f_field_type (is_pure (n)))} {f_g_pow_xi_yi_vis : both L3 I3 (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both L4 I4 (nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n)))} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := + Build_t_OvnContractState := + bind_both f_tally (fun f_tally => + bind_both f_zkp_vis (fun f_zkp_vis => + bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => + bind_both f_commit_vis (fun f_commit_vis => + bind_both f_zkp_xis (fun f_zkp_xis => + bind_both f_g_pow_xis (fun f_g_pow_xis => + solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). +Fail Next Obligation. +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). + +Definition cast_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));2%nat). +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := + cast_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_ParseError)] (params:t_CastVoteParam (v_Z)) := impl__map_err out f_from in + Result_Ok (letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in + letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in + letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in + letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). +Fail Next Obligation. + +Definition commit_to_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));3%nat). +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := + commit_to_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_ParseError)] (params:t_CastVoteParam (v_Z)) := impl__map_err out f_from in + Result_Ok (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + ssp (fun _ => + solve_lift (ifb not (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist2 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist2) + else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*0*)(L2:|:fset []) (I2) (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in + letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in + letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in + letb commit_vi := commit_to g_pow_xi_yi_vi in + letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in + letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). +Fail Next Obligation. + +Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both L1 I1 ('unit)) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)) := + init_ovn_contract _ := + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_u := f_group_one (ret_both (tt : 'unit))) (f_z := f_field_zero (ret_both (tt : 'unit))) (f_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_x := f_group_one (ret_both (tt : 'unit))) (f_y := f_group_one (ret_both (tt : 'unit))) (f_a1 := f_group_one (ret_both (tt : 'unit))) (f_b1 := f_group_one (ret_both (tt : 'unit))) (f_a2 := f_group_one (ret_both (tt : 'unit))) (f_b2 := f_group_one (ret_both (tt : 'unit))) (f_c := f_field_zero (ret_both (tt : 'unit))) (f_d1 := f_field_zero (ret_both (tt : 'unit))) (f_d2 := f_field_zero (ret_both (tt : 'unit))) (f_r1 := f_field_zero (ret_both (tt : 'unit))) (f_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)). +Fail Next Obligation. + +Definition register_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));4%nat). +Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := + register_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_ParseError)] (params:t_RegisterParam (v_Z)) := impl__map_err out f_from in + Result_Ok (letb g_pow_xi := f_g_pow (f_rp_xi params) in + letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in + letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). +Fail Next Obligation. + +Definition curr_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (f_field_type;5%nat). +Definition tally_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (int32;6%nat). +Definition tally_votes_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));7%nat). +Definition vote_result_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (f_group_type;8%nat). +Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := + tally_votes _ state := + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + ssp (fun _ => + letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] _ := ControlFlow_Continue (ifb not (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist3 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist3) + else ControlFlow_Continue (ret_both (tt : 'unit))) in + solve_lift (ifb not (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist4 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist4) + else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*2*)(L2:|:fset [prod1_loc;prod2_loc]) (I2) (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in + letb vote_result loc(vote_result_loc) := f_group_one (ret_both (tt : 'unit)) in + letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => + ssp (fun vote_result => + solve_lift (f_prod vote_result g_pow_vote) : both (*2*)(L2:|:L2:|:fset [vote_result_loc;vote_result_loc]) (I2:|:I2) (f_group_type))) vote_result in + letb tally loc(tally_loc) := ret_both (0 : int32) in + letb curr loc(curr_loc) := f_field_zero (ret_both (tt : 'unit)) in + letb '(curr,tally) := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => + ssp (fun '(curr,tally) => + letb tally := ifb (f_g_pow curr) =.? vote_result + then letb tally := i in + tally + else tally in + letb curr := f_add curr (f_field_one (ret_both (tt : 'unit))) in + solve_lift (prod_b (curr,tally)) : both (*5*)(L2:|:fset [curr_loc;tally_loc;vote_result_loc;curr_loc;tally_loc]) (I2) ((f_field_type × int32)))) (prod_b (curr,tally)) in + letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in + letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in + Result_Ok (solve_lift (prod_b (f_accept (ret_both (tt : 'unit)),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). +Fail Next Obligation. + +Definition res_loc : Location := + (int32;9%nat). +Definition result_loc : Location := + (int32;10%nat). +#[global] Program Instance t_g_z_89__t_Group : t_Group t_g_z_89_ t_z_89_ := + let f_group_type := int32 : choice_type in + let f_g := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (3 : int32)) : both (L :|: fset []) I (int32) in + let f_hash := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Vec (int32) (t_Global))) => letb res loc(res_loc) := f_field_one (ret_both (tt : 'unit)) in + letb res := foldi_both_list (f_into_iter x) (fun y => + ssp (fun res => + solve_lift (f_mul y res) : both (*2*)(L1:|:L1:|:fset [res_loc;res_loc]) (I1:|:I1) (int32))) res in + solve_lift res : both (L1 :|: fset [res_loc]) I1 (int32) in + let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift (f_pow (f_g (ret_both (tt : 'unit))) x) : both (L1 :|: fset []) I1 (int32) in + let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => letb result loc(result_loc) := f_group_one (ret_both (tt : 'unit)) in + letb result := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := x .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))))) (fun i => + ssp (fun result => + solve_lift (f_prod result g) : both (*2*)(L1:|:L2:|:L2:|:fset [result_loc;result_loc]) (I1:|:I2:|:I2) (int32))) result in + solve_lift result : both (L1 :|: L2 :|: fset [result_loc]) (I1 :|: I2) (int32) in + let f_group_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I (int32) in + let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (((x .% (f_q (ret_both (tt : 'unit)))) .* (y .% (f_q (ret_both (tt : 'unit))))) .% (f_q (ret_both (tt : 'unit)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift (run (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := ret_both (89 : int32)))) (fun j => + ssp (fun _ => + solve_lift (ifb (f_prod x j) =.? (f_group_one (ret_both (tt : 'unit))) + then letm[choice_typeMonad.result_bind_code (int32)] hoist5 := v_Break j in + ControlFlow_Continue (never_to_any hoist5) + else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*0*)(L1:|:fset []) (I1) (t_ControlFlow (int32) ('unit)))) (ret_both (tt : 'unit)) in + letb _ := ifb not (ret_both (false : 'bool)) + then never_to_any (panic (ret_both (assertion failed: false : chString))) + else ret_both (tt : 'unit) in + letm[choice_typeMonad.result_bind_code (int32)] hoist6 := v_Break x in + ControlFlow_Continue (never_to_any hoist6))) : both (L1 :|: fset []) I1 (int32) in + let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in + {| f_group_type := (@f_group_type); + f_g_loc := (fset [] : {fset Location}); + f_g := (@f_g); + f_hash_loc := (fset [res_loc] : {fset Location}); + f_hash := (@f_hash); + f_g_pow_loc := (fset [] : {fset Location}); + f_g_pow := (@f_g_pow); + f_pow_loc := (fset [result_loc] : {fset Location}); + f_pow := (@f_pow); + f_group_one_loc := (fset [] : {fset Location}); + f_group_one := (@f_group_one); + f_prod_loc := (fset [] : {fset Location}); + f_prod := (@f_prod); + f_inv_loc := (fset [] : {fset Location}); + f_inv := (@f_inv); + f_div_loc := (fset [] : {fset Location}); + f_div := (@f_div)|}. +Fail Next Obligation. +Hint Unfold t_g_z_89__t_Group. + +(** Concert lib part **) +From ConCert.Utils Require Import Extras. +Export Extras. +From ConCert.Utils Require Import Automation. +Export Automation. +From ConCert.Execution Require Import Serializable. +Export Serializable. +From ConCert.Execution Require Import Blockchain. +Export Blockchain. +From ConCert.Execution Require Import ContractCommon. +Export ContractCommon. +From ConCert.Execution Require Import Serializable. +Export Serializable. +Require Import ConCertLib. +Export ConCertLib. + +Definition state_OVN : choice_type := + t_OvnContractState. + +#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := + {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := + fun x => + x. +Fail Next Obligation. +Definition receive_OVN_cast_vote {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + cast_vote ctx st. + +#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := + {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := + fun x => + x. +Fail Next Obligation. +Definition receive_OVN_commit_to_vote {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + commit_to_vote ctx st. + +Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN) (t_ParseError) := + ResultMonad.Ok st. + +#[global] Program Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit := + {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam := + fun x => + x. +Fail Next Obligation. +Definition receive_OVN_register {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_RegisterParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + register_vote ctx st. + +#[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := + {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_TallyParameter_t_Sized : t_Sized t_TallyParameter := + fun x => + x. +Fail Next Obligation. +Definition receive_OVN_tally {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_TallyParameter)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := + tally_votes ctx st. + +Inductive Msg_OVN: Type := +| msg_OVN_cast_vote : t_CastVoteParam -> Msg_OVN +| msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN +| msg_OVN_register : t_RegisterParam -> Msg_OVN +| msg_OVN_tally : t_TallyParameter -> Msg_OVN. +#[global] Program Instance state_OVN_t_HasReceiveContext : t_HasReceiveContext state_OVN 'unit := + {| f_get := (fun (Ctx : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance state_OVN_t_Sized : t_Sized state_OVN := + fun x => + x. +Fail Next Obligation. +#[global] Program Instance state_OVN_t_HasActions : t_HasActions state_OVN := + Admitted. +Fail Next Obligation. +Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := + receive_OVN chain ctx st msg := + match msg with + | Some (msg_OVN_cast_vote val) => + match (is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_OVN_commit_to_vote val) => + match (is_pure (both_prog (receive_OVN_commit_to_vote (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_OVN_register val) => + match (is_pure (both_prog (receive_OVN_register (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_OVN_tally val) => + match (is_pure (both_prog (receive_OVN_tally (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((fst x), []) + | inr x => ResultMonad.Err x + end + | _ => + ResultMonad.Err tt + end : ResultMonad.result (state_OVN * list ActionBody) t_ParseError. +Fail Next Obligation. +#[global] Program Instance state_OVN_Serializable : Serializable state_OVN := + _. +Fail Next Obligation. +#[global] Program Instance Msg_OVN_Serializable : Serializable Msg_OVN := + Derive Serializable Msg_OVN_rect. +Fail Next Obligation. +Definition contract_OVN : Contract (state_OVN) (Msg_OVN) (state_OVN) (t_ParseError) := + build_contract init_OVN receive_OVN. From fe1e21730871b8acf197edc354dd1d662f745a8f Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Fri, 26 Jan 2024 16:35:27 +0100 Subject: [PATCH 52/86] WIP --- ovn/proofs/ssprove/extraction/Hacspec_ovn_group_by_hand.v | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_by_hand.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_by_hand.v index 8da08f8..3645e95 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_by_hand.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_by_hand.v @@ -130,6 +130,14 @@ Equations compute_g_pow_yi {L1 : {fset Location}} {L2 : {fset Location}} {I1 : I Solve All Obligations with ( solve_ssprove_obligations ; ((now (rewrite !fset0E ; apply (ret_both 0))) || (now destruct from_uint_size))). Fail Next Obligation. +Equations impl__into_vec {L I A n} : both L I (nseq A n) -> both L I (t_Vec A t_Global) := + impl__into_vec X := bind_both X (fun x : nseq A n => solve_lift (ret_both (Hacspec_Lib_Pre.array_to_list x : chList _))). +Fail Next Obligation. + +Definition unsize {A} := @id A. +Definition box_new {A} := @id A. + + Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (commitment : both L2 I2 (f_field_type)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := check_commitment g_pow_xi_yi_vi commitment := solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both (L1 :|: L2) (I1 :|: I2) ('bool). From 6a624f43ba6d025662a685e92a00d59e72ee2024 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Mon, 29 Jan 2024 17:04:24 +0100 Subject: [PATCH 53/86] WIP fixing coq generation --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 639 +++++------------- .../extraction/Hacspec_ovn_Ovn_traits.v | 94 +++ .../extraction/Hacspec_ovn_group_by_hand.v | 70 +- ovn/proofs/ssprove/extraction/_CoqProject | 2 + 4 files changed, 293 insertions(+), 512 deletions(-) create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index d2a619b..ee20c3a 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -24,119 +24,60 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Require Import Hacspec_bip_340. -Export Hacspec_bip_340. - -Class t_Z_Field (Self : choice_type) := { - f_field_type : choice_type ; - f_field_type_t_Serialize :> t_Serialize (f_field_type) ; - f_field_type_t_Deserial :> t_Deserial (f_field_type) ; - f_field_type_t_Serial :> t_Serial (f_field_type) ; - f_field_type_t_Copy :> t_Copy (f_field_type) ; - f_field_type_t_Clone :> t_Clone (f_field_type) ; - f_field_type_t_Eq :> t_Eq (f_field_type) ; - f_field_type_t_PartialEq :> t_PartialEq (f_field_type) ; - f_field_type_t_Sized :> t_Sized (f_field_type) ; - f_q_loc : {fset Location} ; - f_q : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_q_loc) I1 (f_field_type) ; - f_random_field_elem_loc : {fset Location} ; - f_random_field_elem : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_random_field_elem_loc) I1 (f_field_type) ; - f_field_zero_loc : {fset Location} ; - f_field_zero : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_field_zero_loc) I1 (f_field_type) ; - f_field_one_loc : {fset Location} ; - f_field_one : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_field_one_loc) I1 (f_field_type) ; - f_add_loc : {fset Location} ; - f_add : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_add_loc) (I1 :|: I2) (f_field_type) ; - f_sub_loc : {fset Location} ; - f_sub : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_sub_loc) (I1 :|: I2) (f_field_type) ; - f_mul_loc : {fset Location} ; - f_mul : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_mul_loc) (I1 :|: I2) (f_field_type) ; -}. -Hint Unfold f_q_loc. -Hint Unfold f_random_field_elem_loc. -Hint Unfold f_field_zero_loc. -Hint Unfold f_field_one_loc. -Hint Unfold f_add_loc. -Hint Unfold f_sub_loc. -Hint Unfold f_mul_loc. - -Class t_Group (Self : choice_type) := { - f_group_type : choice_type ; - f_group_type_t_Serialize :> t_Serialize (f_group_type) ; - f_group_type_t_Deserial :> t_Deserial (f_group_type) ; - f_group_type_t_Serial :> t_Serial (f_group_type) ; - f_group_type_t_Copy :> t_Copy (f_group_type) ; - f_group_type_t_Clone :> t_Clone (f_group_type) ; - f_group_type_t_Eq :> t_Eq (f_group_type) ; - f_group_type_t_PartialEq :> t_PartialEq (f_group_type) ; - f_group_type_t_Sized :> t_Sized (f_group_type) ; - f_g_loc : {fset Location} ; - f_g : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_g_loc) I1 (f_group_type) ; - f_g_pow_loc : {fset Location} ; - f_g_pow : forall {L1 I1}, both L1 I1 (f_field_type) -> both (L1 :|: f_g_pow_loc) I1 (f_group_type) ; - f_pow_loc : {fset Location} ; - f_pow : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_pow_loc) (I1 :|: I2) (f_group_type) ; - f_group_one_loc : {fset Location} ; - f_group_one : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_group_one_loc) I1 (f_group_type) ; - f_prod_loc : {fset Location} ; - f_prod : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_prod_loc) (I1 :|: I2) (f_group_type) ; - f_inv_loc : {fset Location} ; - f_inv : forall {L1 I1}, both L1 I1 (f_group_type) -> both (L1 :|: f_inv_loc) I1 (f_group_type) ; - f_div_loc : {fset Location} ; - f_div : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_div_loc) (I1 :|: I2) (f_group_type) ; - f_hash_loc : {fset Location} ; - f_hash : forall {L1 I1}, both L1 I1 (t_Vec (f_group_type) (t_Global)) -> both (L1 :|: f_hash_loc) I1 (f_field_type) ; -}. -Hint Unfold f_g_loc. -Hint Unfold f_g_pow_loc. -Hint Unfold f_pow_loc. -Hint Unfold f_group_one_loc. -Hint Unfold f_prod_loc. -Hint Unfold f_inv_loc. -Hint Unfold f_div_loc. -Hint Unfold f_hash_loc. +Require Import Hacspec_ovn_Ovn_traits. +Export Hacspec_ovn_Ovn_traits. (*Not implemented yet? todo(item)*) (*Not implemented yet? todo(item)*) -Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (xi : both L1 I1 (f_field_type)) (vote : both L2 I2 ('bool)) (g_pow_yi : both L3 I3 (f_group_type)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (f_group_type) := +(*Not implemented yet? todo(item)*) + +Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (xi : both L1 I1 (f_field_type)) (vote : both L2 I2 ('bool)) (g_pow_yi : both L3 I3 (f_group_type)) : both (L1 :|: L2 :|: L3 :|: (f_pow_loc :|: f_field_zero_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3) (f_group_type) := compute_group_element_for_vote xi vote g_pow_yi := solve_lift (f_prod (f_pow g_pow_yi xi) (f_g_pow (ifb vote then f_field_one (ret_both (tt : 'unit)) - else f_field_zero (ret_both (tt : 'unit))))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (f_group_type). + else f_field_zero (ret_both (tt : 'unit))))) : both (L1 :|: L2 :|: L3 :|: (f_pow_loc :|: f_field_zero_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3) (f_group_type). Fail Next Obligation. -Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (random : both L1 I1 (int32)) : both L1 I1 (f_field_type) := +Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (random : both L1 I1 (int32)) : both (L1 :|: f_random_field_elem_loc) I1 (f_field_type) := select_private_voting_key random := - solve_lift (f_random_field_elem random) : both L1 I1 (f_field_type). + solve_lift (f_random_field_elem random) : both (L1 :|: f_random_field_elem_loc) I1 (f_field_type). Fail Next Obligation. Definition prod1_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := (f_group_type;0%nat). Definition prod2_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := (f_group_type;1%nat). -Equations compute_g_pow_yi {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both L1 I1 (uint_size)) (xis : both L2 I2 (nseq f_group_type (is_pure (n)))) : both (L1 :|: L2 :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2) (f_group_type) := +Equations compute_g_pow_yi {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both L1 I1 (uint_size)) (xis : both L2 I2 (nseq f_group_type (is_pure (n)))) : both (L1 :|: L2 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (f_group_type) := compute_g_pow_yi i xis := letb prod1 loc(prod1_loc) := f_group_one (ret_both (tt : 'unit)) in letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => ssp (fun prod1 => - solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L2:|:L1:|:fset [prod1_loc;prod1_loc]) (I1:|:I2:|:I1) (f_group_type))) prod1 in + solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L2:|:L1 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc:|:fset [prod1_loc;prod1_loc]) (I1:|:I2:|:I1) (f_group_type))) prod1 in letb prod2 loc(prod2_loc) := f_group_one (ret_both (tt : 'unit)) in letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => ssp (fun prod2 => - solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L2:|:L1:|:fset [prod2_loc;prod2_loc]) (I1:|:I2:|:I1) (f_group_type))) prod2 in - solve_lift (f_div prod1 prod2) : both (L1 :|: L2 :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2) (f_group_type). + solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L2:|:L1:|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod2_loc;prod2_loc]) (I1:|:I2:|:I1) (f_group_type))) prod2 in + solve_lift (f_div prod1 prod2) : both (L1 :|: L2 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2) (f_group_type). +Solve All Obligations with ( solve_ssprove_obligations ; ((now (rewrite !fset0E ; apply (ret_both 0))) || (now destruct from_uint_size))). +Fail Next Obligation. + +Equations impl__into_vec {L I A n} : both L I (nseq_ A n) -> both L I (t_Vec A t_Global) := + impl__into_vec X := bind_both X (fun x : nseq_ A n => solve_lift (ret_both (Hacspec_Lib_Pre.array_to_list x : chList _))). Fail Next Obligation. -Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (commitment : both L2 I2 (f_field_type)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := +Definition unsize {A} := @id A. +Definition box_new {A} := @id A. + +Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (commitment : both L2 I2 (f_field_type)) : both (L1 :|: L2 :|: f_hash_loc) (I1 :|: I2) ('bool) := check_commitment g_pow_xi_yi_vi commitment := - solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both (L1 :|: L2) (I1 :|: I2) ('bool). + solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both (L1 :|: L2 :|: f_hash_loc) (I1 :|: I2) ('bool). Fail Next Obligation. -Equations commit_to {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) : both L1 I1 (f_field_type) := +Equations commit_to {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) : both (L1 :|: f_hash_loc) I1 (f_field_type) := commit_to g_pow_xi_yi_vi := - solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both L1 I1 (f_field_type). + solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both (L1 :|: f_hash_loc) I1 (f_field_type). Fail Next Obligation. Definition t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := @@ -188,119 +129,89 @@ Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_r' ':=' y ')'" Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_d' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := y) (f_cvp_vote := f_cvp_vote x)). Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := y)). -Definition t_Group_curve : choice_type := - (t_Point). -Equations f_val {L : {fset Location}} {I : Interface} (s : both L I (t_Group_curve)) : both L I (t_Point) := - f_val s := - bind_both s (fun x => - solve_lift (ret_both (x : t_Point))) : both L I (t_Point). -Fail Next Obligation. -Equations Build_t_Group_curve {L0 : {fset Location}} {I0 : Interface} {f_val : both L0 I0 (t_Point)} : both L0 I0 (t_Group_curve) := - Build_t_Group_curve := - bind_both f_val (fun f_val => - solve_lift (ret_both ((f_val) : (t_Group_curve)))) : both L0 I0 (t_Group_curve). -Fail Next Obligation. -Notation "'Build_t_Group_curve' '[' x ']' '(' 'f_val' ':=' y ')'" := (Build_t_Group_curve (f_val := y)). - -#[global] Program Instance t_Group_curve_t_Deserial : t_Deserial t_Group_curve := - let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (v__source : both L1 I1 (v_R)) => letb hax_temp_output := Result_Err ParseError in - solve_lift (prod_b (v__source,hax_temp_output)) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_Group_curve) (t_ParseError))) in - {| f_deserial_loc := (fset [] : {fset Location}); - f_deserial := (@f_deserial)|}. -Fail Next Obligation. -Hint Unfold t_Group_curve_t_Deserial. - -#[global] Program Instance t_Group_curve_t_Serial : t_Serial t_Group_curve := - let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Group_curve)) (v__out : both L2 I2 (v_W)) => letb hax_temp_output := Result_Ok (ret_both (tt : 'unit)) in - solve_lift (prod_b (v__out,hax_temp_output)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in - {| f_serial_loc := (fset [] : {fset Location}); - f_serial := (@f_serial)|}. -Fail Next Obligation. -Hint Unfold t_Group_curve_t_Serial. - Definition t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := (f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_field_type × f_field_type × f_field_type × f_field_type × f_field_type). -Equations f_x {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := - f_x s := +Equations f_or_zkp_x {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_or_zkp_x s := bind_both s (fun x => solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both L I (f_group_type). Fail Next Obligation. -Equations f_y {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := - f_y s := +Equations f_or_zkp_y {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_or_zkp_y s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both L I (f_group_type). Fail Next Obligation. -Equations f_a1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := - f_a1 s := +Equations f_or_zkp_a1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_or_zkp_a1 s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : f_group_type))) : both L I (f_group_type). Fail Next Obligation. -Equations f_b1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := - f_b1 s := +Equations f_or_zkp_b1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_or_zkp_b1 s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : f_group_type))) : both L I (f_group_type). Fail Next Obligation. -Equations f_a2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := - f_a2 s := +Equations f_or_zkp_a2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_or_zkp_a2 s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : f_group_type))) : both L I (f_group_type). Fail Next Obligation. -Equations f_b2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := - f_b2 s := +Equations f_or_zkp_b2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_or_zkp_b2 s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : f_group_type))) : both L I (f_group_type). Fail Next Obligation. -Equations f_c {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := - f_c s := +Equations f_or_zkp_c {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_or_zkp_c s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both L I (f_field_type). Fail Next Obligation. -Equations f_d1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := - f_d1 s := +Equations f_or_zkp_d1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_or_zkp_d1 s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst x))) : f_field_type))) : both L I (f_field_type). Fail Next Obligation. -Equations f_d2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := - f_d2 s := +Equations f_or_zkp_d2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_or_zkp_d2 s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst x)) : f_field_type))) : both L I (f_field_type). Fail Next Obligation. -Equations f_r1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := - f_r1 s := +Equations f_or_zkp_r1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_or_zkp_r1 s := bind_both s (fun x => solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). Fail Next Obligation. -Equations f_r2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := - f_r2 s := +Equations f_or_zkp_r2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_or_zkp_r2 s := bind_both s (fun x => solve_lift (ret_both (snd x : f_field_type))) : both L I (f_field_type). Fail Next Obligation. -Equations Build_t_OrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {L7 : {fset Location}} {L8 : {fset Location}} {L9 : {fset Location}} {L10 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {I7 : Interface} {I8 : Interface} {I9 : Interface} {I10 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_x : both L0 I0 (f_group_type)} {f_y : both L1 I1 (f_group_type)} {f_a1 : both L2 I2 (f_group_type)} {f_b1 : both L3 I3 (f_group_type)} {f_a2 : both L4 I4 (f_group_type)} {f_b2 : both L5 I5 (f_group_type)} {f_c : both L6 I6 (f_field_type)} {f_d1 : both L7 I7 (f_field_type)} {f_d2 : both L8 I8 (f_field_type)} {f_r1 : both L9 I9 (f_field_type)} {f_r2 : both L10 I10 (f_field_type)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit) := +Equations Build_t_OrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {L7 : {fset Location}} {L8 : {fset Location}} {L9 : {fset Location}} {L10 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {I7 : Interface} {I8 : Interface} {I9 : Interface} {I10 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_or_zkp_x : both L0 I0 (f_group_type)} {f_or_zkp_y : both L1 I1 (f_group_type)} {f_or_zkp_a1 : both L2 I2 (f_group_type)} {f_or_zkp_b1 : both L3 I3 (f_group_type)} {f_or_zkp_a2 : both L4 I4 (f_group_type)} {f_or_zkp_b2 : both L5 I5 (f_group_type)} {f_or_zkp_c : both L6 I6 (f_field_type)} {f_or_zkp_d1 : both L7 I7 (f_field_type)} {f_or_zkp_d2 : both L8 I8 (f_field_type)} {f_or_zkp_r1 : both L9 I9 (f_field_type)} {f_or_zkp_r2 : both L10 I10 (f_field_type)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit) := Build_t_OrZKPCommit := - bind_both f_r2 (fun f_r2 => - bind_both f_r1 (fun f_r1 => - bind_both f_d2 (fun f_d2 => - bind_both f_d1 (fun f_d1 => - bind_both f_c (fun f_c => - bind_both f_b2 (fun f_b2 => - bind_both f_a2 (fun f_a2 => - bind_both f_b1 (fun f_b1 => - bind_both f_a1 (fun f_a1 => - bind_both f_y (fun f_y => - bind_both f_x (fun f_x => - solve_lift (ret_both ((f_x,f_y,f_a1,f_b1,f_a2,f_b2,f_c,f_d1,f_d2,f_r1,f_r2) : (t_OrZKPCommit)))))))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit). -Fail Next Obligation. -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := y) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := y) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_a1' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := y) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_b1' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := y) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_a2' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := y) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_b2' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := y) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_c' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := y) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_d1' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := y) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_d2' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := y) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_r1' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := y) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_r2' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := y)). + bind_both f_or_zkp_r2 (fun f_or_zkp_r2 => + bind_both f_or_zkp_r1 (fun f_or_zkp_r1 => + bind_both f_or_zkp_d2 (fun f_or_zkp_d2 => + bind_both f_or_zkp_d1 (fun f_or_zkp_d1 => + bind_both f_or_zkp_c (fun f_or_zkp_c => + bind_both f_or_zkp_b2 (fun f_or_zkp_b2 => + bind_both f_or_zkp_a2 (fun f_or_zkp_a2 => + bind_both f_or_zkp_b1 (fun f_or_zkp_b1 => + bind_both f_or_zkp_a1 (fun f_or_zkp_a1 => + bind_both f_or_zkp_y (fun f_or_zkp_y => + bind_both f_or_zkp_x (fun f_or_zkp_x => + solve_lift (ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit)))))))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit). +Fail Next Obligation. +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := y) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := y) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := y) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := y) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := y) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := y) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_c' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := y) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := y) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := y) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := y) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := y)). Definition t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := (int32 × f_field_type × int32). @@ -332,31 +243,31 @@ Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := Definition t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := (f_group_type × f_field_type × f_field_type). -Equations f_u {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_group_type) := - f_u s := +Equations f_schnorr_zkp_u {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_group_type) := + f_schnorr_zkp_u s := bind_both s (fun x => solve_lift (ret_both (fst (fst x) : f_group_type))) : both L I (f_group_type). Fail Next Obligation. -Equations f_c {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := - f_c s := +Equations f_schnorr_zkp_c {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := + f_schnorr_zkp_c s := bind_both s (fun x => solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). Fail Next Obligation. -Equations f_z {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := - f_z s := +Equations f_schnorr_zkp_z {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := + f_schnorr_zkp_z s := bind_both s (fun x => solve_lift (ret_both (snd x : f_field_type))) : both L I (f_field_type). Fail Next Obligation. -Equations Build_t_SchnorrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_u : both L0 I0 (f_group_type)} {f_c : both L1 I1 (f_field_type)} {f_z : both L2 I2 (f_field_type)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit) := +Equations Build_t_SchnorrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_schnorr_zkp_u : both L0 I0 (f_group_type)} {f_schnorr_zkp_c : both L1 I1 (f_field_type)} {f_schnorr_zkp_z : both L2 I2 (f_field_type)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit) := Build_t_SchnorrZKPCommit := - bind_both f_z (fun f_z => - bind_both f_c (fun f_c => - bind_both f_u (fun f_u => - solve_lift (ret_both ((f_u,f_c,f_z) : (t_SchnorrZKPCommit)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit). + bind_both f_schnorr_zkp_z (fun f_schnorr_zkp_z => + bind_both f_schnorr_zkp_c (fun f_schnorr_zkp_c => + bind_both f_schnorr_zkp_u (fun f_schnorr_zkp_u => + solve_lift (ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit). Fail Next Obligation. -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_u := y) (f_c := f_c x) (f_z := f_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_u := f_u x) (f_c := y) (f_z := f_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_u := f_u x) (f_c := f_c x) (f_z := y)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := y) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := y) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := y)). Definition t_TallyParameter : choice_type := 'unit. @@ -365,97 +276,26 @@ Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) : solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). Fail Next Obligation. -Definition t_Z_curve : choice_type := - (t_Scalar). -Equations f_val {L : {fset Location}} {I : Interface} (s : both L I (t_Z_curve)) : both L I (t_Scalar) := - f_val s := - bind_both s (fun x => - solve_lift (ret_both (x : t_Scalar))) : both L I (t_Scalar). -Fail Next Obligation. -Equations Build_t_Z_curve {L0 : {fset Location}} {I0 : Interface} {f_val : both L0 I0 (t_Scalar)} : both L0 I0 (t_Z_curve) := - Build_t_Z_curve := - bind_both f_val (fun f_val => - solve_lift (ret_both ((f_val) : (t_Z_curve)))) : both L0 I0 (t_Z_curve). -Fail Next Obligation. -Notation "'Build_t_Z_curve' '[' x ']' '(' 'f_val' ':=' y ')'" := (Build_t_Z_curve (f_val := y)). - -#[global] Program Instance t_Z_curve_t_Deserial : t_Deserial t_Z_curve := - let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (v__source : both L1 I1 (v_R)) => letb hax_temp_output := Result_Err ParseError in - solve_lift (prod_b (v__source,hax_temp_output)) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_Z_curve) (t_ParseError))) in - {| f_deserial_loc := (fset [] : {fset Location}); - f_deserial := (@f_deserial)|}. -Fail Next Obligation. -Hint Unfold t_Z_curve_t_Deserial. - -#[global] Program Instance t_Z_curve_t_Serial : t_Serial t_Z_curve := - let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Z_curve)) (v__out : both L2 I2 (v_W)) => letb hax_temp_output := Result_Ok (ret_both (tt : 'unit)) in - solve_lift (prod_b (v__out,hax_temp_output)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in - {| f_serial_loc := (fset [] : {fset Location}); - f_serial := (@f_serial)|}. -Fail Next Obligation. -Hint Unfold t_Z_curve_t_Serial. - -#[global] Program Instance t_Z_curve_t_Z_Field : t_Z_Field t_Z_curve := - let f_field_type := t_Z_curve : choice_type in - let f_q := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_hex (ret_both (0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 : chString)))) : both (L :|: fset []) I (t_Z_curve) in - let f_random_field_elem := fun {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_literal (cast_int (WS2 := _) random))) : both (L1 :|: fset []) I1 (t_Z_curve) in - let f_field_zero := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_literal (ret_both (0 : int128)))) : both (L :|: fset []) I (t_Z_curve) in - let f_field_one := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_literal (ret_both (1 : int128)))) : both (L :|: fset []) I (t_Z_curve) in - let f_add := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Z_curve)) (y : both L2 I2 (t_Z_curve)) => solve_lift (Build_t_Z_curve (f_val := (f_val x) .+ (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Z_curve) in - let f_sub := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Z_curve)) (y : both L2 I2 (t_Z_curve)) => solve_lift (Build_t_Z_curve (f_val := (f_val x) .- (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Z_curve) in - let f_mul := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Z_curve)) (y : both L2 I2 (t_Z_curve)) => solve_lift (Build_t_Z_curve (f_val := (f_val x) .* (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Z_curve) in - {| f_field_type := (@f_field_type); - f_q_loc := (fset [] : {fset Location}); - f_q := (@f_q); - f_random_field_elem_loc := (fset [] : {fset Location}); - f_random_field_elem := (@f_random_field_elem); - f_field_zero_loc := (fset [] : {fset Location}); - f_field_zero := (@f_field_zero); - f_field_one_loc := (fset [] : {fset Location}); - f_field_one := (@f_field_one); - f_add_loc := (fset [] : {fset Location}); - f_add := (@f_add); - f_sub_loc := (fset [] : {fset Location}); - f_sub := (@f_sub); - f_mul_loc := (fset [] : {fset Location}); - f_mul := (@f_mul)|}. -Fail Next Obligation. -Hint Unfold t_Z_curve_t_Z_Field. - -Definition t_g_z_89_ : choice_type := - 'unit. -Equations Build_t_g_z_89_ : both (fset []) (fset []) (t_g_z_89_) := - Build_t_g_z_89_ := - solve_lift (ret_both (tt (* Empty tuple *) : (t_g_z_89_))) : both (fset []) (fset []) (t_g_z_89_). -Fail Next Obligation. - -Definition t_z_89_ : choice_type := - 'unit. -Equations Build_t_z_89_ : both (fset []) (fset []) (t_z_89_) := - Build_t_z_89_ := - solve_lift (ret_both (tt (* Empty tuple *) : (t_z_89_))) : both (fset []) (fset []) (t_z_89_). -Fail Next Obligation. - -Equations schnorr_zkp {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (h : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z) (v_G)) := +Equations schnorr_zkp {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (h : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3 :|: f_random_field_elem_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_field_one_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := schnorr_zkp random h x := solve_lift (run (letb r := f_random_field_elem random in letb u := f_g_pow r in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); - h; - u])))) in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [solve_lift f_g (ret_both (tt : 'unit)) : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _; + solve_lift h : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _; + solve_lift u : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _])))) in letb z := f_add r (f_mul c x) in - letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z) (v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_u := u) (f_c := c) (f_z := z)) in - ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z) (v_G)). + letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in + ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3 :|: f_random_field_elem_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_field_one_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). Fail Next Obligation. -Equations schnorr_zkp_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (pi : both L2 I2 (t_SchnorrZKPCommit (v_Z) (v_G))) : both (L1 :|: L2) (I1 :|: I2) ('bool) := +Equations schnorr_zkp_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (pi : both L2 I2 (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_field_one_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2) ('bool) := schnorr_zkp_validate h pi := - solve_lift (andb ((f_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); - h; - f_u pi])))))) ((f_g_pow (f_z pi)) =.? (f_prod (f_u pi) (f_pow h (f_c pi))))) : both (L1 :|: L2) (I1 :|: I2) ('bool). + solve_lift (andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [solve_lift f_g (ret_both (tt : 'unit)) : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _; + solve_lift h : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _; + solve_lift f_schnorr_zkp_u pi : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_field_one_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2) ('bool). Fail Next Obligation. -Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both L1 I1 (int32)) (random_r : both L2 I2 (int32)) (random_d : both L3 I3 (int32)) (h : both L4 I4 (f_group_type)) (xi : both L5 I5 (f_field_type)) (vi : both L6 I6 ('bool)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z) (v_G)) := +Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both L1 I1 (int32)) (random_r : both L2 I2 (int32)) (random_d : both L3 I3 (int32)) (h : both L4 I4 (f_group_type)) (xi : both L5 I5 (f_field_type)) (vi : both L6 I6 ('bool)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: f_prod_loc :|: f_div_loc :|: f_pow_loc :|: f_g_loc :|: f_g_pow_loc :|: f_random_field_elem_loc :|: f_hash_loc :|: f_sub_loc :|: f_mul_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) := zkp_one_out_of_two random_w random_r random_d h xi vi := letb w := f_random_field_elem random_w in solve_lift (ifb vi @@ -467,15 +307,16 @@ Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : letb b1 := f_prod (f_pow h r1) (f_pow y d1) in letb a2 := f_g_pow w in letb b2 := f_pow h w in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; - y; - a1; - b1; - a2; - b2])))) in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [ + solve_lift x : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; + solve_lift y : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; + solve_lift a1 : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; + solve_lift b1 : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; + solve_lift a2 : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; + solve_lift b2 : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _])))) in letb d2 := f_sub c d1 in letb r2 := f_sub w (f_mul xi d2) in - Build_t_OrZKPCommit (f_x := x) (f_y := y) (f_a1 := a1) (f_b1 := b1) (f_a2 := a2) (f_b2 := b2) (f_c := c) (f_d1 := d1) (f_d2 := d2) (f_r1 := r1) (f_r2 := r2) + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2) else letb r2 := f_random_field_elem random_r in letb d2 := f_random_field_elem random_d in letb x := f_g_pow xi in @@ -484,186 +325,62 @@ Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : letb b1 := f_pow h w in letb a2 := f_prod (f_g_pow r2) (f_pow x d2) in letb b2 := f_prod (f_pow h r2) (f_pow (f_div y (f_g (ret_both (tt : 'unit)))) d2) in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; - y; - a1; - b1; - a2; - b2])))) in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [ + solve_lift x : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); + solve_lift y : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); + solve_lift a1 : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); + solve_lift b1 : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); + solve_lift a2 : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); + solve_lift b2 : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _)])))) in letb d1 := f_sub c d2 in letb r1 := f_sub w (f_mul xi d1) in - Build_t_OrZKPCommit (f_x := x) (f_y := y) (f_a1 := a1) (f_b1 := b1) (f_a2 := a2) (f_b2 := b2) (f_c := c) (f_d1 := d1) (f_d2 := d2) (f_r1 := r1) (f_r2 := r2)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z) (v_G)). + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: f_prod_loc :|: f_div_loc :|: f_pow_loc :|: f_g_loc :|: f_g_pow_loc :|: f_random_field_elem_loc :|: f_hash_loc :|: f_sub_loc :|: f_mul_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)). Fail Next Obligation. -Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (zkp : both L2 I2 (t_OrZKPCommit (v_Z) (v_G))) : both (L1 :|: L2) (I1 :|: I2) ('bool) := +Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (zkp : both L2 I2 (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 :|: f_hash_loc :|: f_add_loc :|: f_prod_loc :|: f_g_pow_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc) (I1 :|: I2) ('bool) := zkp_one_out_of_two_validate h zkp := - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_x zkp; - f_y zkp; - f_a1 zkp; - f_b1 zkp; - f_a2 zkp; - f_b2 zkp])))) in - solve_lift (andb (andb (andb (andb (c =.? (f_add (f_d1 zkp) (f_d2 zkp))) ((f_a1 zkp) =.? (f_prod (f_g_pow (f_r1 zkp)) (f_pow (f_x zkp) (f_d1 zkp))))) ((f_b1 zkp) =.? (f_prod (f_pow h (f_r1 zkp)) (f_pow (f_y zkp) (f_d1 zkp))))) ((f_a2 zkp) =.? (f_prod (f_g_pow (f_r2 zkp)) (f_pow (f_x zkp) (f_d2 zkp))))) ((f_b2 zkp) =.? (f_prod (f_pow h (f_r2 zkp)) (f_pow (f_div (f_y zkp) (f_g (ret_both (tt : 'unit)))) (f_d2 zkp))))) : both (L1 :|: L2) (I1 :|: I2) ('bool). -Fail Next Obligation. - -#[global] Program Instance t_z_89__t_Z_Field : t_Z_Field t_z_89_ := - let f_field_type := int32 : choice_type in - let f_q := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (89 : int32)) : both (L :|: fset []) I (int32) in - let f_random_field_elem := fun {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) => solve_lift (random .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) : both (L1 :|: fset []) I1 (int32) in - let f_field_zero := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (0 : int32)) : both (L :|: fset []) I (int32) in - let f_field_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I (int32) in - let f_add := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .+ y) .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in - let f_sub := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (((x .+ ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) .- y) .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in - let f_mul := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in - {| f_field_type := (@f_field_type); - f_q_loc := (fset [] : {fset Location}); - f_q := (@f_q); - f_random_field_elem_loc := (fset [] : {fset Location}); - f_random_field_elem := (@f_random_field_elem); - f_field_zero_loc := (fset [] : {fset Location}); - f_field_zero := (@f_field_zero); - f_field_one_loc := (fset [] : {fset Location}); - f_field_one := (@f_field_one); - f_add_loc := (fset [] : {fset Location}); - f_add := (@f_add); - f_sub_loc := (fset [] : {fset Location}); - f_sub := (@f_sub); - f_mul_loc := (fset [] : {fset Location}); - f_mul := (@f_mul)|}. -Fail Next Obligation. -Hint Unfold t_z_89__t_Z_Field. - -Definition result_loc : Location := - (int32;10%nat). -Definition res_loc : Location := - (int32;9%nat). -#[global] Program Instance t_Group_curve_t_Group : t_Group t_Group_curve t_Z_curve := - let f_group_type := t_Group_curve : choice_type in - let f_g := fun {L : {fset Location}} {I : Interface} => letb gx := PBytes32 (array_from_list [ret_both (121 : int8); - ret_both (190 : int8); - ret_both (102 : int8); - ret_both (126 : int8); - ret_both (249 : int8); - ret_both (220 : int8); - ret_both (187 : int8); - ret_both (172 : int8); - ret_both (85 : int8); - ret_both (160 : int8); - ret_both (98 : int8); - ret_both (149 : int8); - ret_both (206 : int8); - ret_both (135 : int8); - ret_both (11 : int8); - ret_both (7 : int8); - ret_both (2 : int8); - ret_both (155 : int8); - ret_both (252 : int8); - ret_both (219 : int8); - ret_both (45 : int8); - ret_both (206 : int8); - ret_both (40 : int8); - ret_both (217 : int8); - ret_both (89 : int8); - ret_both (242 : int8); - ret_both (129 : int8); - ret_both (91 : int8); - ret_both (22 : int8); - ret_both (248 : int8); - ret_both (23 : int8); - ret_both (152 : int8)]) in - letb gy := PBytes32 (array_from_list [ret_both (72 : int8); - ret_both (58 : int8); - ret_both (218 : int8); - ret_both (119 : int8); - ret_both (38 : int8); - ret_both (163 : int8); - ret_both (196 : int8); - ret_both (101 : int8); - ret_both (93 : int8); - ret_both (164 : int8); - ret_both (251 : int8); - ret_both (252 : int8); - ret_both (14 : int8); - ret_both (17 : int8); - ret_both (8 : int8); - ret_both (168 : int8); - ret_both (253 : int8); - ret_both (23 : int8); - ret_both (180 : int8); - ret_both (72 : int8); - ret_both (166 : int8); - ret_both (133 : int8); - ret_both (84 : int8); - ret_both (25 : int8); - ret_both (156 : int8); - ret_both (71 : int8); - ret_both (208 : int8); - ret_both (143 : int8); - ret_both (251 : int8); - ret_both (16 : int8); - ret_both (212 : int8); - ret_both (184 : int8)]) in - solve_lift (Build_t_Group_curve (f_val := Point_Affine (prod_b (impl__FieldElement__from_public_byte_seq_be gx,impl__FieldElement__from_public_byte_seq_be gy)))) : both (L :|: fset []) I (t_Group_curve) in - let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (t_Group_curve)) (x : both L2 I2 (t_Z_curve)) => solve_lift (Build_t_Group_curve (f_val := point_mul (f_val x) (f_val g))) : both (L1 :|: L2 :|: fset [result_loc]) (I1 :|: I2) (t_Group_curve) in - let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Z_curve)) => solve_lift (Build_t_Group_curve (f_val := point_mul_base (f_val x))) : both (L1 :|: fset []) I1 (t_Group_curve) in - let f_group_one := fun {L : {fset Location}} {I : Interface} => solve_lift (f_g_pow (f_field_zero (ret_both (tt : 'unit)))) : both (L :|: fset []) I (t_Group_curve) in - let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Group_curve)) (y : both L2 I2 (t_Group_curve)) => solve_lift (Build_t_Group_curve (f_val := point_add (f_val x) (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Group_curve) in - let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Group_curve)) => solve_lift x : both (L1 :|: fset []) I1 (t_Group_curve) in - let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Group_curve)) (y : both L2 I2 (t_Group_curve)) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Group_curve) in - let f_hash := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Vec (t_Group_curve) (t_Global))) => solve_lift (f_field_one (ret_both (tt : 'unit))) : both (L1 :|: fset [res_loc]) I1 (t_Z_curve) in - {| f_group_type := (@f_group_type); - f_g_loc := (fset [] : {fset Location}); - f_g := (@f_g); - f_pow_loc := (fset [result_loc] : {fset Location}); - f_pow := (@f_pow); - f_g_pow_loc := (fset [] : {fset Location}); - f_g_pow := (@f_g_pow); - f_group_one_loc := (fset [] : {fset Location}); - f_group_one := (@f_group_one); - f_prod_loc := (fset [] : {fset Location}); - f_prod := (@f_prod); - f_inv_loc := (fset [] : {fset Location}); - f_inv := (@f_inv); - f_div_loc := (fset [] : {fset Location}); - f_div := (@f_div); - f_hash_loc := (fset [res_loc] : {fset Location}); - f_hash := (@f_hash)|}. -Fail Next Obligation. -Hint Unfold t_Group_curve_t_Group. + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; + f_or_zkp_y zkp; + f_or_zkp_a1 zkp; + f_or_zkp_b1 zkp; + f_or_zkp_a2 zkp; + f_or_zkp_b2 zkp])))) in + solve_lift (andb (andb (andb (andb (c =.? (f_add (f_or_zkp_d1 zkp) (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? (f_prod (f_pow h (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r2 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? (f_prod (f_pow h (f_or_zkp_r2 zkp)) (f_pow (f_div (f_or_zkp_y zkp) (f_g (ret_both (tt : 'unit)))) (f_or_zkp_d2 zkp))))) : both (L1 :|: L2 :|: f_hash_loc :|: f_add_loc :|: f_prod_loc :|: f_g_pow_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc) (I1 :|: I2) ('bool). +Fail Next Obligation. Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := - (nseq f_group_type (is_pure (n)) × nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n)) × nseq f_field_type (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n)) × int32). -Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type (is_pure (n))) := + (nseq f_group_type (is_pure (n)) × nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × nseq f_field_type (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × int32). +Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq f_group_type (is_pure (n))) := f_g_pow_xis s := bind_both s (fun x => solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). Fail Next Obligation. -Equations f_zkp_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n))) := +Equations f_zkp_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := f_zkp_xis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n))))) : both L I (nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n))). + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both L I (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). Fail Next Obligation. -Equations f_commit_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq f_field_type (is_pure (n))) := +Equations f_commit_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq f_field_type (is_pure (n))) := f_commit_vis s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst x))) : nseq f_field_type (is_pure (n))))) : both L I (nseq f_field_type (is_pure (n))). Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type (is_pure (n))) := +Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq f_group_type (is_pure (n))) := f_g_pow_xi_yi_vis s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). Fail Next Obligation. -Equations f_zkp_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n))) := +Equations f_zkp_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := f_zkp_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n))))) : both L I (nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n))). + solve_lift (ret_both (snd (fst x) : nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both L I (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). Fail Next Obligation. -Equations f_tally {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (int32) := +Equations f_tally {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (int32) := f_tally s := bind_both s (fun x => solve_lift (ret_both (snd x : int32))) : both L I (int32). Fail Next Obligation. -Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_g_pow_xis : both L0 I0 (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both L1 I1 (nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n)))} {f_commit_vis : both L2 I2 (nseq f_field_type (is_pure (n)))} {f_g_pow_xi_yi_vis : both L3 I3 (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both L4 I4 (nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n)))} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := +Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_g_pow_xis : both L0 I0 (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both L1 I1 (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_commit_vis : both L2 I2 (nseq f_field_type (is_pure (n)))} {f_g_pow_xi_yi_vis : both L3 I3 (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both L4 I4 (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState (n := n)) := Build_t_OvnContractState := bind_both f_tally (fun f_tally => bind_both f_zkp_vis (fun f_zkp_vis => @@ -680,19 +397,39 @@ Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ') Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). +Equations f_from {L I} : both L I 'nat := + f_from := solve_lift (ret_both (0%nat : 'nat)). +Fail Next Obligation. +Equations impl__map_err {L1 I1} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (out : both L1 I1 (t_Result t_CastVoteParam t_ParseError)) (f_from : both L1 I1 'nat) : + both L1 I1 (@choice_typeMonad.M (@choice_typeMonad.mnd + (choice_typeMonad.result_bind_code (Result_t (@t_CastVoteParam _ _ _) t_ParseError))) t_CastVoteParam) := + impl__map_err out f_from := + matchb out with + | inl s => solve_lift ret_both _ + | inr s => solve_lift ret_both _ +end. +Fail Next Obligation. + +(* Equations run {L I A} (x : both L I (choice_typeMonad.M (CEMonad := (@choice_typeMonad.mnd (choice_typeMonad.result_bind_code A))) A)) : both L I (t_Result A 'unit) := *) +(* run x := *) +(* bind_both x (fun y => match y with *) +(* | inl r | inr r => solve_lift ret_both (inl r : t_Result A 'unit) *) +(* end). *) +(* Fail Next Obligation. *) + Definition cast_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));2%nat). -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := + (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *);2%nat). +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := cast_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_ParseError)] (params:t_CastVoteParam (v_Z)) := impl__map_err out f_from in - Result_Ok (letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in - letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in - letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in + solve_lift (run (letb '(_,out) := f_get (Ctx := t_CastVoteParam) (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (Result_t t_CastVoteParam t_ParseError)] (params:t_CastVoteParam (v_Z := v_Z)) := impl__map_err out f_from in + Result_Ok ((* letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in *) + (* letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in *) + (* letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in *) letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). + (* letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in *) + (* letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in *) + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). Fail Next Obligation. Definition commit_to_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := @@ -717,7 +454,7 @@ Fail Next Obligation. Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both L1 I1 ('unit)) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)) := init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_u := f_group_one (ret_both (tt : 'unit))) (f_z := f_field_zero (ret_both (tt : 'unit))) (f_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_x := f_group_one (ret_both (tt : 'unit))) (f_y := f_group_one (ret_both (tt : 'unit))) (f_a1 := f_group_one (ret_both (tt : 'unit))) (f_b1 := f_group_one (ret_both (tt : 'unit))) (f_a2 := f_group_one (ret_both (tt : 'unit))) (f_b2 := f_group_one (ret_both (tt : 'unit))) (f_c := f_field_zero (ret_both (tt : 'unit))) (f_d1 := f_field_zero (ret_both (tt : 'unit))) (f_d2 := f_field_zero (ret_both (tt : 'unit))) (f_r1 := f_field_zero (ret_both (tt : 'unit))) (f_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)). + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_field_zero (ret_both (tt : 'unit))) (f_schnorr_zkp_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_y := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_c := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d2 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)). Fail Next Obligation. Definition register_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := @@ -774,58 +511,6 @@ Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interf Result_Ok (solve_lift (prod_b (f_accept (ret_both (tt : 'unit)),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). Fail Next Obligation. -Definition res_loc : Location := - (int32;9%nat). -Definition result_loc : Location := - (int32;10%nat). -#[global] Program Instance t_g_z_89__t_Group : t_Group t_g_z_89_ t_z_89_ := - let f_group_type := int32 : choice_type in - let f_g := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (3 : int32)) : both (L :|: fset []) I (int32) in - let f_hash := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Vec (int32) (t_Global))) => letb res loc(res_loc) := f_field_one (ret_both (tt : 'unit)) in - letb res := foldi_both_list (f_into_iter x) (fun y => - ssp (fun res => - solve_lift (f_mul y res) : both (*2*)(L1:|:L1:|:fset [res_loc;res_loc]) (I1:|:I1) (int32))) res in - solve_lift res : both (L1 :|: fset [res_loc]) I1 (int32) in - let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift (f_pow (f_g (ret_both (tt : 'unit))) x) : both (L1 :|: fset []) I1 (int32) in - let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => letb result loc(result_loc) := f_group_one (ret_both (tt : 'unit)) in - letb result := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := x .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))))) (fun i => - ssp (fun result => - solve_lift (f_prod result g) : both (*2*)(L1:|:L2:|:L2:|:fset [result_loc;result_loc]) (I1:|:I2:|:I2) (int32))) result in - solve_lift result : both (L1 :|: L2 :|: fset [result_loc]) (I1 :|: I2) (int32) in - let f_group_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I (int32) in - let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (((x .% (f_q (ret_both (tt : 'unit)))) .* (y .% (f_q (ret_both (tt : 'unit))))) .% (f_q (ret_both (tt : 'unit)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in - let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift (run (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := ret_both (89 : int32)))) (fun j => - ssp (fun _ => - solve_lift (ifb (f_prod x j) =.? (f_group_one (ret_both (tt : 'unit))) - then letm[choice_typeMonad.result_bind_code (int32)] hoist5 := v_Break j in - ControlFlow_Continue (never_to_any hoist5) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*0*)(L1:|:fset []) (I1) (t_ControlFlow (int32) ('unit)))) (ret_both (tt : 'unit)) in - letb _ := ifb not (ret_both (false : 'bool)) - then never_to_any (panic (ret_both (assertion failed: false : chString))) - else ret_both (tt : 'unit) in - letm[choice_typeMonad.result_bind_code (int32)] hoist6 := v_Break x in - ControlFlow_Continue (never_to_any hoist6))) : both (L1 :|: fset []) I1 (int32) in - let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in - {| f_group_type := (@f_group_type); - f_g_loc := (fset [] : {fset Location}); - f_g := (@f_g); - f_hash_loc := (fset [res_loc] : {fset Location}); - f_hash := (@f_hash); - f_g_pow_loc := (fset [] : {fset Location}); - f_g_pow := (@f_g_pow); - f_pow_loc := (fset [result_loc] : {fset Location}); - f_pow := (@f_pow); - f_group_one_loc := (fset [] : {fset Location}); - f_group_one := (@f_group_one); - f_prod_loc := (fset [] : {fset Location}); - f_prod := (@f_prod); - f_inv_loc := (fset [] : {fset Location}); - f_inv := (@f_inv); - f_div_loc := (fset [] : {fset Location}); - f_div := (@f_div)|}. -Fail Next Obligation. -Hint Unfold t_g_z_89__t_Group. - (** Concert lib part **) From ConCert.Utils Require Import Extras. Export Extras. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v new file mode 100644 index 0000000..2dff7b3 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v @@ -0,0 +1,94 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Class t_Z_Field (Self : choice_type) := { + f_field_type : choice_type ; + f_field_type_t_Serialize :> t_Serialize (f_field_type) ; + f_field_type_t_Deserial :> t_Deserial (f_field_type) ; + f_field_type_t_Serial :> t_Serial (f_field_type) ; + f_field_type_t_Copy :> t_Copy (f_field_type) ; + f_field_type_t_Clone :> t_Clone (f_field_type) ; + f_field_type_t_Eq :> t_Eq (f_field_type) ; + f_field_type_t_PartialEq :> t_PartialEq (f_field_type) ; + f_field_type_t_Sized :> t_Sized (f_field_type) ; + f_q_loc : {fset Location} ; + f_q : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_q_loc) I1 (f_field_type) ; + f_random_field_elem_loc : {fset Location} ; + f_random_field_elem : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_random_field_elem_loc) I1 (f_field_type) ; + f_field_zero_loc : {fset Location} ; + f_field_zero : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_field_zero_loc) I1 (f_field_type) ; + f_field_one_loc : {fset Location} ; + f_field_one : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_field_one_loc) I1 (f_field_type) ; + f_add_loc : {fset Location} ; + f_add : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_add_loc) (I1 :|: I2) (f_field_type) ; + f_sub_loc : {fset Location} ; + f_sub : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_sub_loc) (I1 :|: I2) (f_field_type) ; + f_mul_loc : {fset Location} ; + f_mul : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_mul_loc) (I1 :|: I2) (f_field_type) ; +}. +Hint Unfold f_q_loc. +Hint Unfold f_random_field_elem_loc. +Hint Unfold f_field_zero_loc. +Hint Unfold f_field_one_loc. +Hint Unfold f_add_loc. +Hint Unfold f_sub_loc. +Hint Unfold f_mul_loc. + +Class t_Group (Self : choice_type) `{_ : t_Z_Field} := { + f_group_type : choice_type ; + f_group_type_t_Serialize :> t_Serialize (f_group_type) ; + f_group_type_t_Deserial :> t_Deserial (f_group_type) ; + f_group_type_t_Serial :> t_Serial (f_group_type) ; + f_group_type_t_Copy :> t_Copy (f_group_type) ; + f_group_type_t_Clone :> t_Clone (f_group_type) ; + f_group_type_t_Eq :> t_Eq (f_group_type) ; + f_group_type_t_PartialEq :> t_PartialEq (f_group_type) ; + f_group_type_t_Sized :> t_Sized (f_group_type) ; + f_g_loc : {fset Location} ; + f_g : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_g_loc) I1 (f_group_type) ; + f_g_pow_loc : {fset Location} ; + f_g_pow : forall {L1 I1}, both L1 I1 (f_field_type) -> both (L1 :|: f_g_pow_loc) I1 (f_group_type) ; + f_pow_loc : {fset Location} ; + f_pow : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_pow_loc) (I1 :|: I2) (f_group_type) ; + f_group_one_loc : {fset Location} ; + f_group_one : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_group_one_loc) I1 (f_group_type) ; + f_prod_loc : {fset Location} ; + f_prod : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_prod_loc) (I1 :|: I2) (f_group_type) ; + f_inv_loc : {fset Location} ; + f_inv : forall {L1 I1}, both L1 I1 (f_group_type) -> both (L1 :|: f_inv_loc) I1 (f_group_type) ; + f_div_loc : {fset Location} ; + f_div : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_div_loc) (I1 :|: I2) (f_group_type) ; + f_hash_loc : {fset Location} ; + f_hash : forall {L1 I1}, both L1 I1 (t_Vec (f_group_type) (t_Global)) -> both (L1 :|: f_hash_loc) I1 (f_field_type) ; +}. +Hint Unfold f_g_loc. +Hint Unfold f_g_pow_loc. +Hint Unfold f_pow_loc. +Hint Unfold f_group_one_loc. +Hint Unfold f_prod_loc. +Hint Unfold f_inv_loc. +Hint Unfold f_div_loc. +Hint Unfold f_hash_loc. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_by_hand.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_by_hand.v index 3645e95..16d575d 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_by_hand.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_by_hand.v @@ -130,22 +130,22 @@ Equations compute_g_pow_yi {L1 : {fset Location}} {L2 : {fset Location}} {I1 : I Solve All Obligations with ( solve_ssprove_obligations ; ((now (rewrite !fset0E ; apply (ret_both 0))) || (now destruct from_uint_size))). Fail Next Obligation. -Equations impl__into_vec {L I A n} : both L I (nseq A n) -> both L I (t_Vec A t_Global) := - impl__into_vec X := bind_both X (fun x : nseq A n => solve_lift (ret_both (Hacspec_Lib_Pre.array_to_list x : chList _))). +Equations impl__into_vec {L I A n} : both L I (nseq_ A n) -> both L I (t_Vec A t_Global) := + impl__into_vec X := bind_both X (fun x : nseq_ A n => solve_lift (ret_both (Hacspec_Lib_Pre.array_to_list x : chList _))). Fail Next Obligation. Definition unsize {A} := @id A. Definition box_new {A} := @id A. -Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (commitment : both L2 I2 (f_field_type)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := +Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (commitment : both L2 I2 (f_field_type)) : both (L1 :|: L2 :|: f_hash_loc) (I1 :|: I2) ('bool) := check_commitment g_pow_xi_yi_vi commitment := - solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both (L1 :|: L2) (I1 :|: I2) ('bool). + solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both (L1 :|: L2 :|: f_hash_loc) (I1 :|: I2) ('bool). Fail Next Obligation. -Equations commit_to {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) : both L1 I1 (f_field_type) := +Equations commit_to {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) : both (L1 :|: f_hash_loc) I1 (f_field_type) := commit_to g_pow_xi_yi_vi := - solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both L1 I1 (f_field_type). + solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both (L1 :|: f_hash_loc) I1 (f_field_type). Fail Next Obligation. Definition t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := @@ -197,35 +197,35 @@ Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_r' ':=' y ')'" Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_d' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := y) (f_cvp_vote := f_cvp_vote x)). Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := y)). -Definition t_Group_curve : choice_type := - (t_Point). -Equations f_val {L : {fset Location}} {I : Interface} (s : both L I (t_Group_curve)) : both L I (t_Point) := - f_val s := - bind_both s (fun x => - solve_lift (ret_both (x : t_Point))) : both L I (t_Point). -Fail Next Obligation. -Equations Build_t_Group_curve {L0 : {fset Location}} {I0 : Interface} {f_val : both L0 I0 (t_Point)} : both L0 I0 (t_Group_curve) := - Build_t_Group_curve := - bind_both f_val (fun f_val => - solve_lift (ret_both ((f_val) : (t_Group_curve)))) : both L0 I0 (t_Group_curve). -Fail Next Obligation. -Notation "'Build_t_Group_curve' '[' x ']' '(' 'f_val' ':=' y ')'" := (Build_t_Group_curve (f_val := y)). - -#[global] Program Instance t_Group_curve_t_Deserial : t_Deserial t_Group_curve := - let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (v__source : both L1 I1 (v_R)) => letb hax_temp_output := Result_Err ParseError in - solve_lift (prod_b (v__source,hax_temp_output)) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_Group_curve) (t_ParseError))) in - {| f_deserial_loc := (fset [] : {fset Location}); - f_deserial := (@f_deserial)|}. -Fail Next Obligation. -Hint Unfold t_Group_curve_t_Deserial. - -#[global] Program Instance t_Group_curve_t_Serial : t_Serial t_Group_curve := - let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Group_curve)) (v__out : both L2 I2 (v_W)) => letb hax_temp_output := Result_Ok (ret_both (tt : 'unit)) in - solve_lift (prod_b (v__out,hax_temp_output)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in - {| f_serial_loc := (fset [] : {fset Location}); - f_serial := (@f_serial)|}. -Fail Next Obligation. -Hint Unfold t_Group_curve_t_Serial. +(* Definition t_Group_curve : choice_type := *) +(* (t_Point). *) +(* Equations f_val {L : {fset Location}} {I : Interface} (s : both L I (t_Group_curve)) : both L I (t_Point) := *) +(* f_val s := *) +(* bind_both s (fun x => *) +(* solve_lift (ret_both (x : t_Point))) : both L I (t_Point). *) +(* Fail Next Obligation. *) +(* Equations Build_t_Group_curve {L0 : {fset Location}} {I0 : Interface} {f_val : both L0 I0 (t_Point)} : both L0 I0 (t_Group_curve) := *) +(* Build_t_Group_curve := *) +(* bind_both f_val (fun f_val => *) +(* solve_lift (ret_both ((f_val) : (t_Group_curve)))) : both L0 I0 (t_Group_curve). *) +(* Fail Next Obligation. *) +(* Notation "'Build_t_Group_curve' '[' x ']' '(' 'f_val' ':=' y ')'" := (Build_t_Group_curve (f_val := y)). *) + +(* #[global] Program Instance t_Group_curve_t_Deserial : t_Deserial t_Group_curve := *) +(* let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (v__source : both L1 I1 (v_R)) => letb hax_temp_output := Result_Err ParseError in *) +(* solve_lift (prod_b (v__source,hax_temp_output)) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_Group_curve) (t_ParseError))) in *) +(* {| f_deserial_loc := (fset [] : {fset Location}); *) +(* f_deserial := (@f_deserial)|}. *) +(* Fail Next Obligation. *) +(* Hint Unfold t_Group_curve_t_Deserial. *) + +(* #[global] Program Instance t_Group_curve_t_Serial : t_Serial t_Group_curve := *) +(* let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Group_curve)) (v__out : both L2 I2 (v_W)) => letb hax_temp_output := Result_Ok (ret_both (tt : 'unit)) in *) +(* solve_lift (prod_b (v__out,hax_temp_output)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in *) +(* {| f_serial_loc := (fset [] : {fset Location}); *) +(* f_serial := (@f_serial)|}. *) +(* Fail Next Obligation. *) +(* Hint Unfold t_Group_curve_t_Serial. *) Definition t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := (f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_field_type × f_field_type × f_field_type × f_field_type × f_field_type). diff --git a/ovn/proofs/ssprove/extraction/_CoqProject b/ovn/proofs/ssprove/extraction/_CoqProject index 81d2658..6f4f8b9 100644 --- a/ovn/proofs/ssprove/extraction/_CoqProject +++ b/ovn/proofs/ssprove/extraction/_CoqProject @@ -2,8 +2,10 @@ -arg -w -arg all +Hacspec_ovn_Ovn_traits.v Hacspec_ovn.v + # Taken from Crypt (as branches are not merged!) pkg_advantage.v SigmaProtocol.v From fdbcfbb841de6da4ba8bed54779b7ebe6909bf4f Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Mon, 29 Jan 2024 17:05:03 +0100 Subject: [PATCH 54/86] WIP fixing coq generation and cleanup --- ovn/Cargo.toml | 1 + ovn/src/ovn_group.rs | 664 +++++---------------------------------- ovn/src/ovn_traits.rs | 49 +++ ovn/tests/ovn_example.rs | 534 +++++++++++++++++++++++++++++++ 4 files changed, 659 insertions(+), 589 deletions(-) create mode 100644 ovn/src/ovn_traits.rs create mode 100644 ovn/tests/ovn_example.rs diff --git a/ovn/Cargo.toml b/ovn/Cargo.toml index 79a4e76..75bcc08 100644 --- a/ovn/Cargo.toml +++ b/ovn/Cargo.toml @@ -8,6 +8,7 @@ edition = "2018" path = "src/ovn_group.rs" [dependencies] +hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } hax-lib-macros = { path = "../../hacspec-v2/hax-lib-macros/" } hacspec-bip-340 = { path = "../bip-340/" } diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs index 5d62b59..0e9da1b 100644 --- a/ovn/src/ovn_group.rs +++ b/ovn/src/ovn_group.rs @@ -13,292 +13,8 @@ use hacspec_concordium::*; #[exclude] use hacspec_concordium_derive::*; -#[cfg(test)] -extern crate quickcheck; -#[cfg(test)] -#[macro_use(quickcheck)] -extern crate quickcheck_macros; - -#[cfg(test)] -use quickcheck::*; - -#[cfg(test)] -use rand::random; - -//////////// -// Traits // -//////////// - -pub trait Z_Field: core::marker::Copy { - type field_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; - - fn q() -> Self::field_type; - - fn random_field_elem(random: u32) -> Self::field_type; - - fn field_zero() -> Self::field_type; - fn field_one() -> Self::field_type; - - fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type; - fn sub(x: Self::field_type, y: Self::field_type) -> Self::field_type; - fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type; -} - -/** Interface for group implementation */ -pub trait Group: core::marker::Copy { - type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; - - fn g() -> Self::group_type; // Generator (elemnent of group) - - fn g_pow(x: Z::field_type) -> Self::group_type; - fn pow(g: Self::group_type, x: Z::field_type) -> Self::group_type; // TODO: Link with q - fn group_one() -> Self::group_type; - fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type; - fn inv(x: Self::group_type) -> Self::group_type; - fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; - - fn hash(x: Vec) -> Z::field_type; -} - -//////////////////// -// Impl for Z/89Z // -//////////////////// - -#[derive(Clone, Copy)] -pub struct z_89 {} -impl Z_Field for z_89 { - type field_type = u32; - fn q() -> Self::field_type { - 89u32 - } // Prime order - fn random_field_elem(random: u32) -> Self::field_type { - random % (Self::q() - 1) - } - - fn field_zero() -> Self::field_type { - 0u32 - } - - fn field_one() -> Self::field_type { - 1u32 - } - - fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { - (x + y) % (Self::q() - 1) - } - - fn sub(x: Self::field_type, y: Self::field_type) -> Self::field_type { - (x + (Self::q() - 1) - y) % (Self::q() - 1) - } - - fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { - (x * y) % (Self::q() - 1) - } -} - -#[derive(Clone, Copy)] -pub struct g_z_89 {} -impl Group for g_z_89 { - type group_type = u32; - - fn g() -> Self::group_type { - 3u32 - } // Generator (elemnent of group) - - fn hash(x: Vec) -> ::field_type { - let mut res = z_89::field_one(); - for y in x { - res = z_89::mul(y, res); - } - res // TODO - } - - fn g_pow(x: ::field_type) -> Self::group_type { - Self::pow(Self::g(), x) - } - - // TODO: use repeated squaring instead! - fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { - let mut result = Self::group_one(); - for i in 0..(x % (z_89::q() - 1)) { - result = Self::prod(result, g); - } - result - } - - fn group_one() -> Self::group_type { - 1 - } - - fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { - ((x % z_89::q()) * (y % z_89::q())) % z_89::q() - } - - fn inv(x: Self::group_type) -> Self::group_type { - for j in 0..89 { - if Self::prod(x, j) == Self::group_one() { - return j; - } - } - assert!(false); - return x; - } - - fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { - Self::prod(x, Self::inv(y)) - } -} - -//////////////////////// -// Impl for Secp256k1 // -//////////////////////// - -use hacspec_bip_340::*; - -#[derive(core::marker::Copy, Clone, PartialEq, Eq)] -struct Z_curve { - val: Scalar, -} - -impl hacspec_concordium::Deserial for Z_curve { - // TODO: - fn deserial(_source: &mut R) -> ParseResult { - Err(ParseError {}) - } -} - -impl hacspec_concordium::Serial for Z_curve { - // TODO: - fn serial(&self, _out: &mut W) -> Result<(), W::Err> { - Ok(()) - } -} - -impl Z_Field for Z_curve { - type field_type = Z_curve; - - fn q() -> Self::field_type { - Z_curve { - val: Scalar::from_hex( - "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", - ), - } // TODO: Scalar::modulo_value; - } - - fn random_field_elem(random: u32) -> Self::field_type { - Z_curve { - val: Scalar::from_literal(random as u128), - } - } - - fn field_zero() -> Self::field_type { - Z_curve { - val: Scalar::from_literal(0u128), - } // Scalar::ZERO() - } - - fn field_one() -> Self::field_type { - Z_curve { - val: Scalar::from_literal(1u128), - } // Scalar::ONE() - } - - fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { - Z_curve { val: x.val + y.val } - } - - fn sub(x: Self::field_type, y: Self::field_type) -> Self::field_type { - Z_curve { val: x.val - y.val } - } - - fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { - Z_curve { val: x.val * y.val } - } -} - -#[derive(core::marker::Copy, Clone, PartialEq, Eq)] -struct Group_curve { - val: Point, -} - -impl hacspec_concordium::Deserial for Group_curve { - // TODO: - fn deserial(_source: &mut R) -> ParseResult { - Err(ParseError {}) - } -} - -impl hacspec_concordium::Serial for Group_curve { - // TODO: - fn serial(&self, _out: &mut W) -> Result<(), W::Err> { - Ok(()) - } -} - -impl Group for Group_curve { - type group_type = Group_curve; - - // https://eips.ethereum.org/EIPS/eip-2333 - fn g() -> Self::group_type { - #[rustfmt::skip] - let gx = PBytes32([ - 0x79u8, 0xBEu8, 0x66u8, 0x7Eu8, 0xF9u8, 0xDCu8, 0xBBu8, 0xACu8, - 0x55u8, 0xA0u8, 0x62u8, 0x95u8, 0xCEu8, 0x87u8, 0x0Bu8, 0x07u8, - 0x02u8, 0x9Bu8, 0xFCu8, 0xDBu8, 0x2Du8, 0xCEu8, 0x28u8, 0xD9u8, - 0x59u8, 0xF2u8, 0x81u8, 0x5Bu8, 0x16u8, 0xF8u8, 0x17u8, 0x98u8 - ]); - #[rustfmt::skip] - let gy = PBytes32([ - 0x48u8, 0x3Au8, 0xDAu8, 0x77u8, 0x26u8, 0xA3u8, 0xC4u8, 0x65u8, - 0x5Du8, 0xA4u8, 0xFBu8, 0xFCu8, 0x0Eu8, 0x11u8, 0x08u8, 0xA8u8, - 0xFDu8, 0x17u8, 0xB4u8, 0x48u8, 0xA6u8, 0x85u8, 0x54u8, 0x19u8, - 0x9Cu8, 0x47u8, 0xD0u8, 0x8Fu8, 0xFBu8, 0x10u8, 0xD4u8, 0xB8u8 - ]); - Group_curve { - val: Point::Affine(( - FieldElement::from_public_byte_seq_be(gx), - FieldElement::from_public_byte_seq_be(gy), - )), - } - } // TODO - - fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { - Group_curve { - val: point_mul(x.val, g.val), - } - } - - fn g_pow(x: ::field_type) -> Self::group_type { - Group_curve { - val: point_mul_base(x.val), - } - // Self::pow(Self::g(), x) - } - - fn group_one() -> Self::group_type { - Self::g_pow(::field_zero()) - } - - fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { - Group_curve { - val: point_add(x.val, y.val), - } - } - - fn inv(x: Self::group_type) -> Self::group_type { - // TODO: - x - } - - fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { - Self::prod(x, Self::inv(y)) - } - - fn hash(x: Vec) -> ::field_type { - // fp_hash_to_field - Z_curve::field_one() // TODO: bls12-381 hash to curve? - } -} +mod ovn_traits; +pub use ovn_traits::*; //////////////////// // Implementation // @@ -306,9 +22,9 @@ impl Group for Group_curve { #[derive(Serialize, SchemaType, Clone, Copy)] pub struct SchnorrZKPCommit> { - u: G::group_type, - c: Z::field_type, - z: Z::field_type, + pub schnorr_zkp_u: G::group_type, + pub schnorr_zkp_c: Z::field_type, + pub schnorr_zkp_z: Z::field_type, } /** Non-interactive Schnorr proof using Fiat-Shamir heuristics (RFC 8235) */ @@ -324,7 +40,7 @@ pub fn schnorr_zkp>( let c = G::hash(vec![G::g(), h, u]); let z = Z::add(r, Z::mul(c, x)); - return SchnorrZKPCommit { u, c, z }; + return SchnorrZKPCommit { schnorr_zkp_u: u, schnorr_zkp_c: c, schnorr_zkp_z: z }; } // https://crypto.stanford.edu/cs355/19sp/lec5.pdf @@ -332,65 +48,25 @@ pub fn schnorr_zkp_validate>( h: G::group_type, pi: SchnorrZKPCommit, ) -> bool { - pi.c == G::hash(vec![G::g(), h, pi.u]) && G::g_pow(pi.z) == G::prod(pi.u, G::pow(h, pi.c)) -} - -#[test] -pub fn schorr_zkp_correctness() { - fn test(random_x: u32, random_r: u32) -> bool { - type Z = z_89; - type G = g_z_89; - - let x: u32 = Z::random_field_elem(random_x); - let pow_x = G::g_pow(x); - - let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); - - let valid = schnorr_zkp_validate::(pow_x, pi); - valid - } - - QuickCheck::new() - .tests(10000) - .quickcheck(test as fn(u32, u32) -> bool) -} - -#[test] -pub fn schorr_zkp_secp256k1_correctness() { - fn test(random_x: u32, random_r: u32) -> bool { - type Z = Z_curve; - type G = Group_curve; - - let x: Z_curve = Z::random_field_elem(random_x); - let pow_x = G::g_pow(x); - - let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); - - let valid = schnorr_zkp_validate::(pow_x, pi); - valid - } - - QuickCheck::new() - .tests(10) - .quickcheck(test as fn(u32, u32) -> bool) + pi.schnorr_zkp_c == G::hash(vec![G::g(), h, pi.schnorr_zkp_u]) && G::g_pow(pi.schnorr_zkp_z) == G::prod(pi.schnorr_zkp_u, G::pow(h, pi.schnorr_zkp_c)) } #[derive(Serialize, SchemaType, Clone, Copy)] pub struct OrZKPCommit> { - x: G::group_type, - y: G::group_type, - a1: G::group_type, - b1: G::group_type, - a2: G::group_type, - b2: G::group_type, + pub or_zkp_x: G::group_type, + pub or_zkp_y: G::group_type, + pub or_zkp_a1: G::group_type, + pub or_zkp_b1: G::group_type, + pub or_zkp_a2: G::group_type, + pub or_zkp_b2: G::group_type, - c: Z::field_type, + pub or_zkp_c: Z::field_type, - d1: Z::field_type, - d2: Z::field_type, + pub or_zkp_d1: Z::field_type, + pub or_zkp_d2: Z::field_type, - r1: Z::field_type, - r2: Z::field_type, + pub or_zkp_r1: Z::field_type, + pub or_zkp_r2: Z::field_type, } /** Cramer, Damgård and Schoenmakers (CDS) technique */ @@ -423,17 +99,17 @@ pub fn zkp_one_out_of_two>( let r2 = Z::sub(w, Z::mul(xi, d2)); OrZKPCommit { - x, - y, - a1, - b1, - a2, - b2, - c, - d1, - d2, - r1, - r2, + or_zkp_x: x, + or_zkp_y: y, + or_zkp_a1: a1, + or_zkp_b1: b1, + or_zkp_a2: a2, + or_zkp_b2: b2, + or_zkp_c: c, + or_zkp_d1: d1, + or_zkp_d2: d2, + or_zkp_r1: r1, + or_zkp_r2: r2, } } else { let r2 = Z::random_field_elem(random_r); @@ -454,17 +130,17 @@ pub fn zkp_one_out_of_two>( let r1 = Z::sub(w, Z::mul(xi, d1)); OrZKPCommit { - x, - y, - a1, - b1, - a2, - b2, - c, - d1, - d2, - r1, - r2, + or_zkp_x: x, + or_zkp_y: y, + or_zkp_a1: a1, + or_zkp_b1: b1, + or_zkp_a2: a2, + or_zkp_b2: b2, + or_zkp_c: c, + or_zkp_d1: d1, + or_zkp_d2: d2, + or_zkp_r1: r1, + or_zkp_r2: r2, } } } @@ -474,44 +150,13 @@ pub fn zkp_one_out_of_two_validate>( h: G::group_type, zkp: OrZKPCommit, ) -> bool { - let c = G::hash(vec![zkp.x, zkp.y, zkp.a1, zkp.b1, zkp.a2, zkp.b2]); // TODO: add i - - (c == Z::add(zkp.d1, zkp.d2) - && zkp.a1 == G::prod(G::g_pow(zkp.r1), G::pow(zkp.x, zkp.d1)) - && zkp.b1 == G::prod(G::pow(h, zkp.r1), G::pow(zkp.y, zkp.d1)) - && zkp.a2 == G::prod(G::g_pow(zkp.r2), G::pow(zkp.x, zkp.d2)) - && zkp.b2 == G::prod(G::pow(h, zkp.r2), G::pow(G::div(zkp.y, G::g()), zkp.d2))) -} - -#[cfg(test)] -pub fn or_zkp_correctness>( - random_w: u32, - random_r: u32, - random_d: u32, - random_h: u32, - random_x: u32, - v: bool, -) -> bool { - let mut h = G::g_pow(Z::random_field_elem(random_h)); - let x = Z::random_field_elem(random_x); - let pi: OrZKPCommit = zkp_one_out_of_two(random_w, random_r, random_d, h, x, v); - let valid = zkp_one_out_of_two_validate::(h, pi); - valid -} + let c = G::hash(vec![zkp.or_zkp_x, zkp.or_zkp_y, zkp.or_zkp_a1, zkp.or_zkp_b1, zkp.or_zkp_a2, zkp.or_zkp_b2]); // TODO: add i -#[test] -pub fn or_zkp_correctness_z89(){ - QuickCheck::new() - .tests(10000) - .quickcheck(or_zkp_correctness:: as fn(u32, u32, u32, u32, u32, bool) -> bool) -} - -#[test] -// TODO: Fix inverse opeation, should make this test parse -pub fn or_zkp_secp256k1_correctness() { - QuickCheck::new() - .tests(10) - .quickcheck(or_zkp_correctness:: as fn(u32, u32, u32, u32, u32, bool) -> bool) + (c == Z::add(zkp.or_zkp_d1, zkp.or_zkp_d2) + && zkp.or_zkp_a1 == G::prod(G::g_pow(zkp.or_zkp_r1), G::pow(zkp.or_zkp_x, zkp.or_zkp_d1)) + && zkp.or_zkp_b1 == G::prod(G::pow(h, zkp.or_zkp_r1), G::pow(zkp.or_zkp_y, zkp.or_zkp_d1)) + && zkp.or_zkp_a2 == G::prod(G::g_pow(zkp.or_zkp_r2), G::pow(zkp.or_zkp_x, zkp.or_zkp_d2)) + && zkp.or_zkp_b2 == G::prod(G::pow(h, zkp.or_zkp_r2), G::pow(G::div(zkp.or_zkp_y, G::g()), zkp.or_zkp_d2))) } pub fn commit_to>(g_pow_xi_yi_vi: G::group_type) -> Z::field_type { @@ -529,15 +174,15 @@ pub fn check_commitment>( // #[cfg_attr(not(feature = "hax_compilation"), contract_state(contract = "OVN"))] #[derive(Serialize, SchemaType, Clone, Copy)] pub struct OvnContractState, const n: usize> { - g_pow_xis: [G::group_type; n], - zkp_xis: [SchnorrZKPCommit; n], + pub g_pow_xis: [G::group_type; n], + pub zkp_xis: [SchnorrZKPCommit; n], - commit_vis: [Z::field_type; n], + pub commit_vis: [Z::field_type; n], - g_pow_xi_yi_vis: [G::group_type; n], - zkp_vis: [OrZKPCommit; n], + pub g_pow_xi_yi_vis: [G::group_type; n], + pub zkp_vis: [OrZKPCommit; n], - tally: u32, + pub tally: u32, } #[hax::init(contract = "OVN")] @@ -547,29 +192,29 @@ pub fn init_ovn_contract, const n: usize>(// _: &impl Ha Ok(OvnContractState:: { g_pow_xis: [G::group_one(); n], zkp_xis: [SchnorrZKPCommit:: { - u: G::group_one(), - z: Z::field_zero(), - c: Z::field_zero(), + schnorr_zkp_u: G::group_one(), + schnorr_zkp_z: Z::field_zero(), + schnorr_zkp_c: Z::field_zero(), }; n], commit_vis: [Z::field_zero(); n], g_pow_xi_yi_vis: [G::group_one(); n], zkp_vis: [OrZKPCommit:: { - x: G::group_one(), - y: G::group_one(), - a1: G::group_one(), - b1: G::group_one(), - a2: G::group_one(), - b2: G::group_one(), + or_zkp_x: G::group_one(), + or_zkp_y: G::group_one(), + or_zkp_a1: G::group_one(), + or_zkp_b1: G::group_one(), + or_zkp_a2: G::group_one(), + or_zkp_b2: G::group_one(), - c: Z::field_zero(), + or_zkp_c: Z::field_zero(), - d1: Z::field_zero(), - d2: Z::field_zero(), + or_zkp_d1: Z::field_zero(), + or_zkp_d2: Z::field_zero(), - r1: Z::field_zero(), - r2: Z::field_zero(), + or_zkp_r1: Z::field_zero(), + or_zkp_r2: Z::field_zero(), }; n], tally: 0, @@ -583,9 +228,9 @@ pub fn select_private_voting_key(random: u32) -> Z::field_type { #[derive(Serialize, SchemaType)] pub struct RegisterParam { - rp_i: u32, - rp_xi: Z::field_type, - rp_zkp_random: u32, + pub rp_i: u32, + pub rp_xi: Z::field_type, + pub rp_zkp_random: u32, } /** Primary function in round 1 */ @@ -609,12 +254,12 @@ pub fn register_vote, const n: usize, A: HasActions>( #[derive(Serialize, SchemaType)] pub struct CastVoteParam { - cvp_i: u32, - cvp_xi: Z::field_type, - cvp_zkp_random_w: u32, - cvp_zkp_random_r: u32, - cvp_zkp_random_d: u32, - cvp_vote: bool, + pub cvp_i: u32, + pub cvp_xi: Z::field_type, + pub cvp_zkp_random_w: u32, + pub cvp_zkp_random_r: u32, + pub cvp_zkp_random_d: u32, + pub cvp_vote: bool, } pub fn compute_g_pow_yi, const n: usize>( @@ -636,35 +281,6 @@ pub fn compute_g_pow_yi, const n: usize>( g_pow_yi } -#[cfg(test)] -pub fn sum_to_zero, const n: usize>() { - let mut xis: [Z::field_type; n] = [Z::field_zero(); n]; - let mut g_pow_xis: [G::group_type; n] = [G::group_one(); n]; - use rand::random; - for i in 0..n { - xis[i] = Z::random_field_elem(random()); - g_pow_xis[i] = G::g_pow(xis[i]); - } - - let mut res = G::group_one(); - for i in 0..n { - let g_pow_yi = compute_g_pow_yi::(i, g_pow_xis); - res = G::prod(res, G::pow(g_pow_yi, xis[i])); - } - - assert!(res == G::group_one()); -} - -#[test] -pub fn sum_to_zero_z89() { - sum_to_zero::() -} - -#[test] -pub fn sum_to_zero_secp256k1() { - sum_to_zero::() -} - pub fn compute_group_element_for_vote>( xi: Z::field_type, vote: bool, @@ -775,134 +391,4 @@ pub fn tally_votes, const n: usize, A: HasActions>( Ok((A::accept(), tally_votes_state_ret)) } -#[cfg(test)] -pub fn test_correctness, const n: usize, A: HasActions>( - votes: [bool; n], - xis: [Z::field_type; n], - rp_zkp_randoms: [u32; n], - cvp_zkp_random_ws1: [u32; n], - cvp_zkp_random_rs1: [u32; n], - cvp_zkp_random_ds1: [u32; n], - cvp_zkp_random_ws2: [u32; n], - cvp_zkp_random_rs2: [u32; n], - cvp_zkp_random_ds2: [u32; n], -) -> bool { - // Setup the context - let mut ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); - - let mut state: OvnContractState = init_ovn_contract().unwrap(); - - for i in 0..n { - let parameter = RegisterParam:: { - rp_i: i as u32, - rp_xi: xis[i], - rp_zkp_random: rp_zkp_randoms[i], - }; - let parameter_bytes = to_bytes(¶meter); - (_, state) = - register_vote::(ctx.clone().set_parameter(¶meter_bytes), state) - .unwrap(); - } - - for i in 0..n { - let parameter = CastVoteParam:: { - cvp_i: i as u32, - cvp_xi: xis[i], - cvp_zkp_random_w: cvp_zkp_random_ws1[i], - cvp_zkp_random_r: cvp_zkp_random_rs1[i], - cvp_zkp_random_d: cvp_zkp_random_ds1[i], - cvp_vote: votes[i], - }; - let parameter_bytes = to_bytes(¶meter); - (_, state) = - commit_to_vote::(ctx.clone().set_parameter(¶meter_bytes), state) - .unwrap(); - } - - for i in 0..n { - let parameter = CastVoteParam:: { - cvp_i: i as u32, - cvp_xi: xis[i], - cvp_zkp_random_w: cvp_zkp_random_ws2[i], - cvp_zkp_random_r: cvp_zkp_random_rs2[i], - cvp_zkp_random_d: cvp_zkp_random_ds2[i], - cvp_vote: votes[i], - }; - let parameter_bytes = to_bytes(¶meter); - (_, state) = - cast_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); - } - - let parameter = TallyParameter {}; - let parameter_bytes = to_bytes(¶meter); - ctx = ctx.set_parameter(¶meter_bytes); - - (_, state) = tally_votes::(ctx.clone(), state).unwrap(); - - let mut count = 0u32; - for v in votes { - if v { - count = count + 1; // += 1 does not work correctly - } - } - - assert_eq!(state.tally, count); - state.tally == count -} - -#[cfg(test)] -fn randomized_full_test, const n: usize> () -> bool { - use rand::random; - let mut votes: [bool; n] = [false; n]; - let mut xis: [Z::field_type; n] = [Z::field_zero(); n]; - let mut rp_zkp_randoms: [u32; n] = [0; n]; - let mut cvp_zkp_random_ws1: [u32; n] = [0; n]; - let mut cvp_zkp_random_rs1: [u32; n] = [0; n]; - let mut cvp_zkp_random_ds1: [u32; n] = [0; n]; - - let mut cvp_zkp_random_ws2: [u32; n] = [0; n]; - let mut cvp_zkp_random_rs2: [u32; n] = [0; n]; - let mut cvp_zkp_random_ds2: [u32; n] = [0; n]; - - for i in 0..n { - votes[i] = random(); - xis[i] = Z::random_field_elem(random()); - rp_zkp_randoms[i] = random(); - cvp_zkp_random_ws1[i] = random(); - cvp_zkp_random_rs1[i] = random(); - cvp_zkp_random_ds1[i] = random(); - cvp_zkp_random_ws2[i] = random(); - cvp_zkp_random_rs2[i] = random(); - cvp_zkp_random_ds2[i] = random(); - } - - test_correctness::( - votes, - xis, - rp_zkp_randoms, - cvp_zkp_random_ws1, - cvp_zkp_random_rs1, - cvp_zkp_random_ds1, - cvp_zkp_random_ws2, - cvp_zkp_random_rs2, - cvp_zkp_random_ds2, - ) -} - -// #[concordium_test] -#[test] -fn test_full_z89() { - QuickCheck::new() - .tests(100) - .quickcheck(randomized_full_test:: as fn() -> bool) -} - -// #[concordium_test] -#[test] -fn test_full_secp256k1() { - QuickCheck::new() - .tests(100) - .quickcheck(randomized_full_test:: as fn() -> bool) -} - // https://github.com/stonecoldpat/anonymousvoting diff --git a/ovn/src/ovn_traits.rs b/ovn/src/ovn_traits.rs new file mode 100644 index 0000000..cee0a93 --- /dev/null +++ b/ovn/src/ovn_traits.rs @@ -0,0 +1,49 @@ +#![no_std] +#![feature(register_tool)] +#![register_tool(hax)] + +#[hax_lib_macros::exclude] +extern crate hax_lib_macros; + +#[hax_lib_macros::exclude] +use hax_lib_macros::*; + +#[exclude] +use hacspec_concordium::*; +#[exclude] +use hacspec_concordium_derive::*; + +//////////// +// Traits // +//////////// + +pub trait Z_Field: core::marker::Copy { + type field_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; + + fn q() -> Self::field_type; + + fn random_field_elem(random: u32) -> Self::field_type; + + fn field_zero() -> Self::field_type; + fn field_one() -> Self::field_type; + + fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type; + fn sub(x: Self::field_type, y: Self::field_type) -> Self::field_type; + fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type; +} + +/** Interface for group implementation */ +pub trait Group: core::marker::Copy { + type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; + + fn g() -> Self::group_type; // Generator (elemnent of group) + + fn g_pow(x: Z::field_type) -> Self::group_type; + fn pow(g: Self::group_type, x: Z::field_type) -> Self::group_type; // TODO: Link with q + fn group_one() -> Self::group_type; + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type; + fn inv(x: Self::group_type) -> Self::group_type; + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; + + fn hash(x: Vec) -> Z::field_type; +} diff --git a/ovn/tests/ovn_example.rs b/ovn/tests/ovn_example.rs new file mode 100644 index 0000000..c12fb64 --- /dev/null +++ b/ovn/tests/ovn_example.rs @@ -0,0 +1,534 @@ +#![no_std] +#![feature(register_tool)] +#![register_tool(hax)] + +#[hax_lib_macros::exclude] +extern crate hax_lib_macros; + +#[hax_lib_macros::exclude] +use hax_lib_macros::*; + +#[exclude] +use hacspec_concordium::*; +#[exclude] +use hacspec_concordium_derive::*; + +#[cfg(test)] +extern crate quickcheck; +#[cfg(test)] +#[macro_use(quickcheck)] +extern crate quickcheck_macros; + +#[cfg(test)] +use quickcheck::*; + +#[cfg(test)] +use rand::random; + +extern crate hacspec_lib; +use hacspec_lib::*; + +//////////////////// +// Impl for Z/89Z // +//////////////////// + +pub use hacspec_ovn::*; +// pub use ovn_group::*; +// pub use ovn_trait::*; + +#[derive(Clone, Copy)] +pub struct z_89 {} +impl Z_Field for z_89 { + type field_type = u32; + fn q() -> Self::field_type { + 89u32 + } // Prime order + fn random_field_elem(random: u32) -> Self::field_type { + random % (Self::q() - 1) + } + + fn field_zero() -> Self::field_type { + 0u32 + } + + fn field_one() -> Self::field_type { + 1u32 + } + + fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { + (x + y) % (Self::q() - 1) + } + + fn sub(x: Self::field_type, y: Self::field_type) -> Self::field_type { + (x + (Self::q() - 1) - y) % (Self::q() - 1) + } + + fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { + (x * y) % (Self::q() - 1) + } +} + +#[derive(Clone, Copy)] +pub struct g_z_89 {} +impl Group for g_z_89 { + type group_type = u32; + + fn g() -> Self::group_type { + 3u32 + } // Generator (elemnent of group) + + fn hash(x: Vec) -> ::field_type { + let mut res = z_89::field_one(); + for y in x { + res = z_89::mul(y, res); + } + res // TODO + } + + fn g_pow(x: ::field_type) -> Self::group_type { + Self::pow(Self::g(), x) + } + + // TODO: use repeated squaring instead! + fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { + let mut result = Self::group_one(); + for i in 0..(x % (z_89::q() - 1)) { + result = Self::prod(result, g); + } + result + } + + fn group_one() -> Self::group_type { + 1 + } + + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { + ((x % z_89::q()) * (y % z_89::q())) % z_89::q() + } + + fn inv(x: Self::group_type) -> Self::group_type { + for j in 0..89 { + if Self::prod(x, j) == Self::group_one() { + return j; + } + } + assert!(false); + return x; + } + + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { + Self::prod(x, Self::inv(y)) + } +} + +//////////////////////// +// Impl for Secp256k1 // +//////////////////////// + +use hacspec_bip_340::*; + +#[derive(core::marker::Copy, Clone, PartialEq, Eq)] +struct Z_curve { + val: Scalar, +} + +impl hacspec_concordium::Deserial for Z_curve { + // TODO: + fn deserial(_source: &mut R) -> ParseResult { + let buffer : &mut [u8] = &mut []; + let _ = _source.read(buffer)?; + + Ok(Z_curve { + val: Scalar::from_public_byte_seq_be(Seq::::from_native_slice(buffer)), + }) + } +} + +impl hacspec_concordium::Serial for Z_curve { + // TODO: + fn serial(&self, _out: &mut W) -> Result<(), W::Err> { + _out.write(self.val.to_public_byte_seq_be().native_slice()); + Ok(()) + } +} + +impl Z_Field for Z_curve { + type field_type = Z_curve; + + fn q() -> Self::field_type { + Z_curve { + val: Scalar::from_hex( + "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", + ), + } // TODO: Scalar::modulo_value; + } + + fn random_field_elem(random: u32) -> Self::field_type { + Z_curve { + val: Scalar::from_literal(random as u128), + } + } + + fn field_zero() -> Self::field_type { + Z_curve { + val: Scalar::from_literal(0u128), + } // Scalar::ZERO() + } + + fn field_one() -> Self::field_type { + Z_curve { + val: Scalar::from_literal(1u128), + } // Scalar::ONE() + } + + fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { + Z_curve { val: x.val + y.val } + } + + fn sub(x: Self::field_type, y: Self::field_type) -> Self::field_type { + Z_curve { val: x.val - y.val } + } + + fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { + Z_curve { val: x.val * y.val } + } +} + +#[derive(core::marker::Copy, Clone, PartialEq, Eq)] +struct Group_curve { + val: Point, +} + +impl hacspec_concordium::Deserial for Group_curve { + // TODO: + fn deserial(_source: &mut R) -> ParseResult { + let buffer : &mut [u8] = &mut []; + let _ = _source.read(buffer)?; + if let [0] = buffer { + return Ok(Group_curve { val: Point::AtInfinity }) + } + + let buffer_y : &mut [u8] = &mut []; + let _ = _source.read(buffer_y)?; + + Ok(Group_curve { + val: Point::Affine((FieldElement::from_public_byte_seq_be(Seq::::from_native_slice(buffer)), + FieldElement::from_public_byte_seq_be(Seq::::from_native_slice(buffer_y)))), + }) + } +} + +impl hacspec_concordium::Serial for Group_curve { + // TODO: + fn serial(&self, _out: &mut W) -> Result<(), W::Err> { + match self.val { + Point::Affine(p) => + { + _out.write(x(p).to_public_byte_seq_be().native_slice()); + _out.write(y(p).to_public_byte_seq_be().native_slice()) + }, + Point::AtInfinity => _out.write(&[0]), + }; + Ok(()) + } +} + +impl Group for Group_curve { + type group_type = Group_curve; + + // https://eips.ethereum.org/EIPS/eip-2333 + fn g() -> Self::group_type { + #[rustfmt::skip] + let gx = PBytes32([ + 0x79u8, 0xBEu8, 0x66u8, 0x7Eu8, 0xF9u8, 0xDCu8, 0xBBu8, 0xACu8, + 0x55u8, 0xA0u8, 0x62u8, 0x95u8, 0xCEu8, 0x87u8, 0x0Bu8, 0x07u8, + 0x02u8, 0x9Bu8, 0xFCu8, 0xDBu8, 0x2Du8, 0xCEu8, 0x28u8, 0xD9u8, + 0x59u8, 0xF2u8, 0x81u8, 0x5Bu8, 0x16u8, 0xF8u8, 0x17u8, 0x98u8 + ]); + #[rustfmt::skip] + let gy = PBytes32([ + 0x48u8, 0x3Au8, 0xDAu8, 0x77u8, 0x26u8, 0xA3u8, 0xC4u8, 0x65u8, + 0x5Du8, 0xA4u8, 0xFBu8, 0xFCu8, 0x0Eu8, 0x11u8, 0x08u8, 0xA8u8, + 0xFDu8, 0x17u8, 0xB4u8, 0x48u8, 0xA6u8, 0x85u8, 0x54u8, 0x19u8, + 0x9Cu8, 0x47u8, 0xD0u8, 0x8Fu8, 0xFBu8, 0x10u8, 0xD4u8, 0xB8u8 + ]); + Group_curve { + val: Point::Affine(( + FieldElement::from_public_byte_seq_be(gx), + FieldElement::from_public_byte_seq_be(gy), + )), + } + } // TODO + + fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { + Group_curve { + val: point_mul(x.val, g.val), + } + } + + fn g_pow(x: ::field_type) -> Self::group_type { + Group_curve { + val: point_mul_base(x.val), + } + // Self::pow(Self::g(), x) + } + + fn group_one() -> Self::group_type { + Self::g_pow(::field_zero()) + } + + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { + Group_curve { + val: point_add(x.val, y.val), + } + } + + fn inv(x: Self::group_type) -> Self::group_type { + Group_curve { + val: match x.val { + Point::Affine((a,b)) => Point::Affine((a, FieldElement::from_literal(0u128)-b)), + Point::AtInfinity => Point::AtInfinity, // TODO? + } + } + } + + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { + Self::prod(x, Self::inv(y)) + } + + fn hash(x: Vec) -> ::field_type { + // fp_hash_to_field + Z_curve::field_one() // TODO: bls12-381 hash to curve? + } +} + + +#[test] +pub fn schorr_zkp_correctness() { + fn test(random_x: u32, random_r: u32) -> bool { + type Z = z_89; + type G = g_z_89; + + let x: u32 = Z::random_field_elem(random_x); + let pow_x = G::g_pow(x); + + let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); + + let valid = schnorr_zkp_validate::(pow_x, pi); + valid + } + + QuickCheck::new() + .tests(10000) + .quickcheck(test as fn(u32, u32) -> bool) +} + +#[test] +pub fn schorr_zkp_secp256k1_correctness() { + fn test(random_x: u32, random_r: u32) -> bool { + type Z = Z_curve; + type G = Group_curve; + + let x: Z_curve = Z::random_field_elem(random_x); + let pow_x = G::g_pow(x); + + let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); + + let valid = schnorr_zkp_validate::(pow_x, pi); + valid + } + + QuickCheck::new() + .tests(10) + .quickcheck(test as fn(u32, u32) -> bool) +} + +#[cfg(test)] +pub fn or_zkp_correctness>( + random_w: u32, + random_r: u32, + random_d: u32, + random_h: u32, + random_x: u32, + v: bool, +) -> bool { + let mut h = G::g_pow(Z::random_field_elem(random_h)); + let x = Z::random_field_elem(random_x); + let pi: OrZKPCommit = zkp_one_out_of_two(random_w, random_r, random_d, h, x, v); + let valid = zkp_one_out_of_two_validate::(h, pi); + valid +} + +#[test] +pub fn or_zkp_correctness_z89(){ + QuickCheck::new() + .tests(10000) + .quickcheck(or_zkp_correctness:: as fn(u32, u32, u32, u32, u32, bool) -> bool) +} + +#[test] +// TODO: Fix inverse opeation, should make this test parse +pub fn or_zkp_secp256k1_correctness() { + QuickCheck::new() + .tests(10) + .quickcheck(or_zkp_correctness:: as fn(u32, u32, u32, u32, u32, bool) -> bool) +} + +#[cfg(test)] +pub fn sum_to_zero, const n: usize>() { + let mut xis: [Z::field_type; n] = [Z::field_zero(); n]; + let mut g_pow_xis: [G::group_type; n] = [G::group_one(); n]; + use rand::random; + for i in 0..n { + xis[i] = Z::random_field_elem(random()); + g_pow_xis[i] = G::g_pow(xis[i]); + } + + let mut res = G::group_one(); + for i in 0..n { + let g_pow_yi = compute_g_pow_yi::(i, g_pow_xis); + res = G::prod(res, G::pow(g_pow_yi, xis[i])); + } + + assert!(res == G::group_one()); +} + +#[test] +pub fn sum_to_zero_z89() { + sum_to_zero::() +} + +#[test] +pub fn sum_to_zero_secp256k1() { + sum_to_zero::() +} + +#[cfg(test)] +pub fn test_correctness, const n: usize, A: HasActions>( + votes: [bool; n], + xis: [Z::field_type; n], + rp_zkp_randoms: [u32; n], + cvp_zkp_random_ws1: [u32; n], + cvp_zkp_random_rs1: [u32; n], + cvp_zkp_random_ds1: [u32; n], + cvp_zkp_random_ws2: [u32; n], + cvp_zkp_random_rs2: [u32; n], + cvp_zkp_random_ds2: [u32; n], +) -> bool { + // Setup the context + let mut ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); + + let mut state: OvnContractState = init_ovn_contract().unwrap(); + + for i in 0..n { + let parameter = RegisterParam:: { + rp_i: i as u32, + rp_xi: xis[i], + rp_zkp_random: rp_zkp_randoms[i], + }; + let parameter_bytes = to_bytes(¶meter); + (_, state) = + register_vote::(ctx.clone().set_parameter(¶meter_bytes), state) + .unwrap(); + } + + for i in 0..n { + let parameter = CastVoteParam:: { + cvp_i: i as u32, + cvp_xi: xis[i], + cvp_zkp_random_w: cvp_zkp_random_ws1[i], + cvp_zkp_random_r: cvp_zkp_random_rs1[i], + cvp_zkp_random_d: cvp_zkp_random_ds1[i], + cvp_vote: votes[i], + }; + let parameter_bytes = to_bytes(¶meter); + (_, state) = + commit_to_vote::(ctx.clone().set_parameter(¶meter_bytes), state) + .unwrap(); + } + + for i in 0..n { + let parameter = CastVoteParam:: { + cvp_i: i as u32, + cvp_xi: xis[i], + cvp_zkp_random_w: cvp_zkp_random_ws2[i], + cvp_zkp_random_r: cvp_zkp_random_rs2[i], + cvp_zkp_random_d: cvp_zkp_random_ds2[i], + cvp_vote: votes[i], + }; + let parameter_bytes = to_bytes(¶meter); + (_, state) = + cast_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); + } + + let parameter = TallyParameter {}; + let parameter_bytes = to_bytes(¶meter); + ctx = ctx.set_parameter(¶meter_bytes); + + (_, state) = tally_votes::(ctx.clone(), state).unwrap(); + + let mut count = 0u32; + for v in votes { + if v { + count = count + 1; // += 1 does not work correctly + } + } + + assert_eq!(state.tally, count); + state.tally == count +} + +#[cfg(test)] +fn randomized_full_test, const n: usize> () -> bool { + use rand::random; + let mut votes: [bool; n] = [false; n]; + let mut xis: [Z::field_type; n] = [Z::field_zero(); n]; + let mut rp_zkp_randoms: [u32; n] = [0; n]; + let mut cvp_zkp_random_ws1: [u32; n] = [0; n]; + let mut cvp_zkp_random_rs1: [u32; n] = [0; n]; + let mut cvp_zkp_random_ds1: [u32; n] = [0; n]; + + let mut cvp_zkp_random_ws2: [u32; n] = [0; n]; + let mut cvp_zkp_random_rs2: [u32; n] = [0; n]; + let mut cvp_zkp_random_ds2: [u32; n] = [0; n]; + + for i in 0..n { + votes[i] = random(); + xis[i] = Z::random_field_elem(random()); + rp_zkp_randoms[i] = random(); + cvp_zkp_random_ws1[i] = random(); + cvp_zkp_random_rs1[i] = random(); + cvp_zkp_random_ds1[i] = random(); + cvp_zkp_random_ws2[i] = random(); + cvp_zkp_random_rs2[i] = random(); + cvp_zkp_random_ds2[i] = random(); + } + + test_correctness::( + votes, + xis, + rp_zkp_randoms, + cvp_zkp_random_ws1, + cvp_zkp_random_rs1, + cvp_zkp_random_ds1, + cvp_zkp_random_ws2, + cvp_zkp_random_rs2, + cvp_zkp_random_ds2, + ) +} + +// #[concordium_test] +#[test] +fn test_full_z89() { + QuickCheck::new() + .tests(100) + .quickcheck(randomized_full_test:: as fn() -> bool) +} + +// #[concordium_test] +#[test] +fn test_full_secp256k1() { + QuickCheck::new() + .tests(1) + .quickcheck(randomized_full_test:: as fn() -> bool) +} From 72a06f4d380c927732a003bb275f750218d4b019 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 31 Jan 2024 19:00:11 +0100 Subject: [PATCH 55/86] WIP by hand --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 99 +-- .../extraction/Hacspec_ovn_Ovn_traits.v | 2 +- .../ssprove/extraction/Hacspec_ovn_by_hand.v | 599 ++++++++++-------- ovn/src/ovn_group.rs | 18 +- 4 files changed, 391 insertions(+), 327 deletions(-) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index ee20c3a..b1876ff 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -397,59 +397,62 @@ Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ') Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). -Equations f_from {L I} : both L I 'nat := - f_from := solve_lift (ret_both (0%nat : 'nat)). -Fail Next Obligation. -Equations impl__map_err {L1 I1} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (out : both L1 I1 (t_Result t_CastVoteParam t_ParseError)) (f_from : both L1 I1 'nat) : - both L1 I1 (@choice_typeMonad.M (@choice_typeMonad.mnd - (choice_typeMonad.result_bind_code (Result_t (@t_CastVoteParam _ _ _) t_ParseError))) t_CastVoteParam) := - impl__map_err out f_from := - matchb out with - | inl s => solve_lift ret_both _ - | inr s => solve_lift ret_both _ -end. -Fail Next Obligation. - -(* Equations run {L I A} (x : both L I (choice_typeMonad.M (CEMonad := (@choice_typeMonad.mnd (choice_typeMonad.result_bind_code A))) A)) : both L I (t_Result A 'unit) := *) -(* run x := *) -(* bind_both x (fun y => match y with *) -(* | inl r | inr r => solve_lift ret_both (inl r : t_Result A 'unit) *) -(* end). *) -(* Fail Next Obligation. *) - Definition cast_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *);2%nat). -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := +Notation Result_Ok_case := inl. +Notation Result_Err_case := inr. +Obligation Tactic := try timeout 2 solve_ssprove_obligations. +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: f_g_loc :|: f_random_field_elem_loc :|: f_hash_loc :|: f_sub_loc :|: f_mul_loc :|: f_group_one_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := cast_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (Ctx := t_CastVoteParam) (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (Result_t t_CastVoteParam t_ParseError)] (params:t_CastVoteParam (v_Z := v_Z)) := impl__map_err out f_from in - Result_Ok ((* letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in *) - (* letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in *) - (* letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in *) + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params:t_CastVoteParam (v_Z)) := matchb out with + | Result_Ok_case x => + letb x := ret_both ((x) (* : (t_CastVoteParam (v_Z := v_Z)) *)) in + ControlFlow_Continue (solve_lift x) + | Result_Err_case x => + letb x := ret_both ((x) : (t_ParseError)) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist2 := v_Break _ (* (Result_Err t_ParseError) *) in + ControlFlow_Continue (solve_lift (never_to_any hoist2)) + end in + ControlFlow_Continue (letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in + letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in + letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in - (* letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in *) - (* letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in *) - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (L1 :|: L2 :|: f_g_loc :|: f_random_field_elem_loc :|: f_hash_loc :|: f_sub_loc :|: f_mul_loc :|: f_group_one_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). +Solve All Obligations with try timeout 4 solve_ssprove_obligations. +Admit Obligations. Fail Next Obligation. Definition commit_to_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));3%nat). -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := + (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *);3%nat). +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := commit_to_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_ParseError)] (params:t_CastVoteParam (v_Z)) := impl__map_err out f_from in - Result_Ok (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params:t_CastVoteParam (v_Z)) := matchb out with + | Result_Ok_case x => + letb x := ret_both ((x) (* : (t_CastVoteParam (v_Z := v_Z)) *)) in + ControlFlow_Continue (solve_lift x) + | Result_Err_case x => + letb x := ret_both ((x) : (t_ParseError)) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist3 := v_Break _ (* (Result_Err t_ParseError) *) in + ControlFlow_Continue (solve_lift (never_to_any hoist3)) + end in + ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => - solve_lift (ifb not (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist2 := v_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist2) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*0*)(L2:|:fset []) (I2) (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in + solve_lift (ifb negb (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) + then + (* letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist4 := v_Break _ (* (Result_Err ParseError) *) in *) + ControlFlow_Continue (never_to_any v_Break _(* hoist4 *)) + else ControlFlow_Continue (never_to_any v_Break _(* hoist4 *)) + (* ControlFlow_Continue (ret_both (tt : 'unit)) *)) : both (*0*)(L2:|:fset []) (I2) (t_Result (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in letb commit_vi := commit_to g_pow_xi_yi_vi in letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). Fail Next Obligation. Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both L1 I1 ('unit)) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)) := @@ -462,8 +465,16 @@ Definition register_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) ( Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := register_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_ParseError)] (params:t_RegisterParam (v_Z)) := impl__map_err out f_from in - Result_Ok (letb g_pow_xi := f_g_pow (f_rp_xi params) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] (params:t_RegisterParam (v_Z)) := matchb out with + | Result_Ok_case x => + letb x := ret_both ((x) : (t_RegisterParam (v_Z))) in + ControlFlow_Continue (solve_lift x) + | Result_Err_case x => + letb x := ret_both ((x) : (t_ParseError)) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist5 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (solve_lift (never_to_any hoist5)) + end in + ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in @@ -485,12 +496,12 @@ Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interf ssp (fun _ => letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] _ := ControlFlow_Continue (ifb not (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist3 := v_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist3) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist6 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist6) else ControlFlow_Continue (ret_both (tt : 'unit))) in solve_lift (ifb not (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist4 := v_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist4) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist7 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist7) else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*2*)(L2:|:fset [prod1_loc;prod2_loc]) (I2) (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in letb vote_result loc(vote_result_loc) := f_group_one (ret_both (tt : 'unit)) in letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v index 2dff7b3..c96962f 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v @@ -57,7 +57,7 @@ Hint Unfold f_add_loc. Hint Unfold f_sub_loc. Hint Unfold f_mul_loc. -Class t_Group (Self : choice_type) `{_ : t_Z_Field} := { +Class t_Group (Self : choice_type) := { f_group_type : choice_type ; f_group_type_t_Serialize :> t_Serialize (f_group_type) ; f_group_type_t_Deserial :> t_Deserial (f_group_type) ; diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v index 04935a9..ee20c3a 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v @@ -24,199 +24,250 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Class t_Z_Field (Self : choice_type) := { - f_field_type : choice_type ; - f_field_type_t_Serialize :> t_Serialize (f_field_type) ; - f_field_type_t_Deserial :> t_Deserial (f_field_type) ; - f_field_type_t_Serial :> t_Serial (f_field_type) ; - f_field_type_t_Copy :> t_Copy (f_field_type) ; - f_field_type_t_Clone :> t_Clone (f_field_type) ; - f_field_type_t_Eq :> t_Eq (f_field_type) ; - f_field_type_t_PartialEq :> t_PartialEq (f_field_type) ; - f_field_type_t_Sized :> t_Sized (f_field_type) ; - f_q : forall {L1 I1}, both L1 I1 (uint_size) ; - f_random_field_elem_loc : {fset Location} ; - f_random_field_elem : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_random_field_elem_loc) I1 (f_field_type) ; - f_field_zero_loc : {fset Location} ; - f_field_zero : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_field_zero_loc) I1 (f_field_type) ; - f_field_one_loc : {fset Location} ; - f_field_one : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_field_one_loc) I1 (f_field_type) ; - f_add_loc : {fset Location} ; - f_add : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_add_loc) (I1 :|: I2) (f_field_type) ; - f_mul_loc : {fset Location} ; - f_mul : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_mul_loc) (I1 :|: I2) (f_field_type) ; -}. -Hint Unfold f_random_field_elem_loc. -Hint Unfold f_field_zero_loc. -Hint Unfold f_field_one_loc. -Hint Unfold f_add_loc. -Hint Unfold f_mul_loc. - -Class t_Group (Self : choice_type) `{t_Z_Field} := { - f_group_type : choice_type ; - f_group_type_t_Serialize :> t_Serialize (f_group_type) ; - f_group_type_t_Deserial :> t_Deserial (f_group_type) ; - f_group_type_t_Serial :> t_Serial (f_group_type) ; - f_group_type_t_Copy :> t_Copy (f_group_type) ; - f_group_type_t_Clone :> t_Clone (f_group_type) ; - f_group_type_t_Eq :> t_Eq (f_group_type) ; - f_group_type_t_PartialEq :> t_PartialEq (f_group_type) ; - f_group_type_t_Sized :> t_Sized (f_group_type) ; - f_g : forall {L1 I1}, both L1 I1 (f_group_type) ; - f_random_group_elem_loc : {fset Location} ; - f_random_group_elem : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_random_group_elem_loc) I1 (f_group_type) ; - f_g_pow_loc : {fset Location} ; - f_g_pow : forall {L1 I1}, both L1 I1 (f_field_type) -> both (L1 :|: f_g_pow_loc) I1 (f_group_type) ; - f_pow_loc : {fset Location} ; - f_pow : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_pow_loc) (I1 :|: I2) (f_group_type) ; - f_group_one_loc : {fset Location} ; - f_group_one : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_group_one_loc) I1 (f_group_type) ; - f_prod_loc : {fset Location} ; - f_prod : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_prod_loc) (I1 :|: I2) (f_group_type) ; - f_inv_loc : {fset Location} ; - f_inv : forall {L1 I1}, both L1 I1 (f_group_type) -> both (L1 :|: f_inv_loc) I1 (f_group_type) ; - f_div_loc : {fset Location} ; - f_div : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_div_loc) (I1 :|: I2) (f_group_type) ; -}. -Hint Unfold f_random_group_elem_loc. -Hint Unfold f_g_pow_loc. -Hint Unfold f_pow_loc. -Hint Unfold f_group_one_loc. -Hint Unfold f_prod_loc. -Hint Unfold f_inv_loc. -Hint Unfold f_div_loc. +Require Import Hacspec_ovn_Ovn_traits. +Export Hacspec_ovn_Ovn_traits. (*Not implemented yet? todo(item)*) (*Not implemented yet? todo(item)*) -Equations v_Hash {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (v : both L1 I1 ((f_group_type × f_group_type × f_group_type))) : both ((f_field_one_loc :|: L1) : {fset Location}) I1 (f_field_type) := - v_Hash v := - solve_lift (f_field_one (ret_both (tt : 'unit))) : both (f_field_one_loc :|: L1) I1 (f_field_type). -Fail Next Obligation. - -Equations v_ZKP_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_vi : both L1 I1 (f_group_type)) (vi : both L2 I2 ('bool)) : both (L1 :|: L2) (I1 :|: I2) (int32) := - v_ZKP_one_out_of_two g_pow_vi vi := - solve_lift (ret_both (32 : int32)) : both (L1 :|: L2) (I1 :|: I2) (int32). -Fail Next Obligation. - -Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - check_commitment g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Equations check_valid2 {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (zkp : both L2 I2 (int32)) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - check_valid2 g_pow_xi_yi_vi zkp := - solve_lift (ret_both (true : 'bool)) : both (L1 :|: L2) (I1 :|: I2) ('bool). -Fail Next Obligation. +(*Not implemented yet? todo(item)*) -Equations commit_to {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (x : both L1 I1 (f_group_type)) : both L1 I1 (int32) := - commit_to x := - solve_lift (ret_both (0 : int32)) : both L1 I1 (int32). +Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (xi : both L1 I1 (f_field_type)) (vote : both L2 I2 ('bool)) (g_pow_yi : both L3 I3 (f_group_type)) : both (L1 :|: L2 :|: L3 :|: (f_pow_loc :|: f_field_zero_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3) (f_group_type) := + compute_group_element_for_vote xi vote g_pow_yi := + solve_lift (f_prod (f_pow g_pow_yi xi) (f_g_pow (ifb vote + then f_field_one (ret_both (tt : 'unit)) + else f_field_zero (ret_both (tt : 'unit))))) : both (L1 :|: L2 :|: L3 :|: (f_pow_loc :|: f_field_zero_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3) (f_group_type). Fail Next Obligation. -Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) : both (f_random_group_elem_loc :|: L1) I1 (f_group_type) := +Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (random : both L1 I1 (int32)) : both (L1 :|: f_random_field_elem_loc) I1 (f_field_type) := select_private_voting_key random := - solve_lift (f_random_group_elem random) : both (f_random_group_elem_loc :|: L1) I1 (f_group_type). + solve_lift (f_random_field_elem random) : both (L1 :|: f_random_field_elem_loc) I1 (f_field_type). Fail Next Obligation. Definition prod1_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := (f_group_type;0%nat). Definition prod2_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := (f_group_type;1%nat). -Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both L1 I1 (int32)) (xi : both L2 I2 (f_field_type)) (vote : both L3 I3 ('bool)) (xis : both L4 I4 (nseq f_group_type (is_pure (n)))) : both (L1 :|: L2 :|: L3 :|: L4 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc (n:=n);prod2_loc (n:=n)]) (I1 :|: I2 :|: I3 :|: I4) (f_group_type) := - compute_group_element_for_vote i xi vote xis := +Equations compute_g_pow_yi {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both L1 I1 (uint_size)) (xis : both L2 I2 (nseq f_group_type (is_pure (n)))) : both (L1 :|: L2 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (f_group_type) := + compute_g_pow_yi i xis := letb prod1 loc(prod1_loc) := f_group_one (ret_both (tt : 'unit)) in - letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := cast_int (WS2 := _) (i .- (ret_both (1 : int32)))))) (fun j => + letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => ssp (fun prod1 => - solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc:|:fset [prod1_loc;prod1_loc]) (I1:|:I4:|:I1) (f_group_type))) prod1 in + solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L2:|:L1 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc:|:fset [prod1_loc;prod1_loc]) (I1:|:I2:|:I1) (f_group_type))) prod1 in letb prod2 loc(prod2_loc) := f_group_one (ret_both (tt : 'unit)) in - letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := cast_int (WS2 := _) (i .+ (ret_both (1 : int32)))) (f_end := n))) (fun j => + letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => ssp (fun prod2 => - solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L4:|:L1:|:f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc:|:fset [prod2_loc;prod2_loc]) (I1:|:I4:|:I1) (f_group_type))) prod2 in - letb v_Yi := f_div prod1 prod2 in - solve_lift (f_prod (f_pow v_Yi xi) (f_g_pow (ifb vote - then f_field_one (ret_both (tt : 'unit)) - else f_field_zero (ret_both (tt : 'unit))))) : both (L1 :|: L2 :|: L3 :|: L4 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2 :|: I3 :|: I4) (f_group_type). + solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L2:|:L1:|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod2_loc;prod2_loc]) (I1:|:I2:|:I1) (f_group_type))) prod2 in + solve_lift (f_div prod1 prod2) : both (L1 :|: L2 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2) (f_group_type). Solve All Obligations with ( solve_ssprove_obligations ; ((now (rewrite !fset0E ; apply (ret_both 0))) || (now destruct from_uint_size))). Fail Next Obligation. +Equations impl__into_vec {L I A n} : both L I (nseq_ A n) -> both L I (t_Vec A t_Global) := + impl__into_vec X := bind_both X (fun x : nseq_ A n => solve_lift (ret_both (Hacspec_Lib_Pre.array_to_list x : chList _))). +Fail Next Obligation. + +Definition unsize {A} := @id A. +Definition box_new {A} := @id A. + +Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (commitment : both L2 I2 (f_field_type)) : both (L1 :|: L2 :|: f_hash_loc) (I1 :|: I2) ('bool) := + check_commitment g_pow_xi_yi_vi commitment := + solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both (L1 :|: L2 :|: f_hash_loc) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Equations commit_to {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) : both (L1 :|: f_hash_loc) I1 (f_field_type) := + commit_to g_pow_xi_yi_vi := + solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both (L1 :|: f_hash_loc) I1 (f_field_type). +Fail Next Obligation. + Definition t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := - (int32 × f_field_type × 'bool). + (int32 × f_field_type × int32 × int32 × int32 × 'bool). Equations f_cvp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := f_cvp_i s := bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : int32))) : both L I (int32). Fail Next Obligation. Equations f_cvp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (f_field_type) := f_cvp_xi s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_cvp_zkp_random_w {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_zkp_random_w s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_cvp_zkp_random_r {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_zkp_random_r s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : int32))) : both L I (int32). +Fail Next Obligation. +Equations f_cvp_zkp_random_d {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := + f_cvp_zkp_random_d s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). Fail Next Obligation. Equations f_cvp_vote {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I ('bool) := f_cvp_vote s := bind_both s (fun x => solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). Fail Next Obligation. -Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (f_field_type)} {f_cvp_vote : both L2 I2 ('bool)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam) := +Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (f_field_type)} {f_cvp_zkp_random_w : both L2 I2 (int32)} {f_cvp_zkp_random_r : both L3 I3 (int32)} {f_cvp_zkp_random_d : both L4 I4 (int32)} {f_cvp_vote : both L5 I5 ('bool)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_CastVoteParam) := Build_t_CastVoteParam := bind_both f_cvp_vote (fun f_cvp_vote => - bind_both f_cvp_xi (fun f_cvp_xi => - bind_both f_cvp_i (fun f_cvp_i => - solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_vote) : (t_CastVoteParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_CastVoteParam). + bind_both f_cvp_zkp_random_d (fun f_cvp_zkp_random_d => + bind_both f_cvp_zkp_random_r (fun f_cvp_zkp_random_r => + bind_both f_cvp_zkp_random_w (fun f_cvp_zkp_random_w => + bind_both f_cvp_xi (fun f_cvp_xi => + bind_both f_cvp_i (fun f_cvp_i => + solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_CastVoteParam). +Fail Next Obligation. +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_w' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := y) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_r' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := y) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_d' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := y) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := y)). + +Definition t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := + (f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_field_type × f_field_type × f_field_type × f_field_type × f_field_type). +Equations f_or_zkp_x {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_or_zkp_x s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both L I (f_group_type). +Fail Next Obligation. +Equations f_or_zkp_y {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_or_zkp_y s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both L I (f_group_type). +Fail Next Obligation. +Equations f_or_zkp_a1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_or_zkp_a1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : f_group_type))) : both L I (f_group_type). +Fail Next Obligation. +Equations f_or_zkp_b1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_or_zkp_b1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : f_group_type))) : both L I (f_group_type). +Fail Next Obligation. +Equations f_or_zkp_a2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_or_zkp_a2 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : f_group_type))) : both L I (f_group_type). Fail Next Obligation. -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_vote := y)). +Equations f_or_zkp_b2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := + f_or_zkp_b2 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : f_group_type))) : both L I (f_group_type). +Fail Next Obligation. +Equations f_or_zkp_c {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_or_zkp_c s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_or_zkp_d1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_or_zkp_d1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_or_zkp_d2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_or_zkp_d2 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_or_zkp_r1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_or_zkp_r1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations f_or_zkp_r2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := + f_or_zkp_r2 s := + bind_both s (fun x => + solve_lift (ret_both (snd x : f_field_type))) : both L I (f_field_type). +Fail Next Obligation. +Equations Build_t_OrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {L7 : {fset Location}} {L8 : {fset Location}} {L9 : {fset Location}} {L10 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {I7 : Interface} {I8 : Interface} {I9 : Interface} {I10 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_or_zkp_x : both L0 I0 (f_group_type)} {f_or_zkp_y : both L1 I1 (f_group_type)} {f_or_zkp_a1 : both L2 I2 (f_group_type)} {f_or_zkp_b1 : both L3 I3 (f_group_type)} {f_or_zkp_a2 : both L4 I4 (f_group_type)} {f_or_zkp_b2 : both L5 I5 (f_group_type)} {f_or_zkp_c : both L6 I6 (f_field_type)} {f_or_zkp_d1 : both L7 I7 (f_field_type)} {f_or_zkp_d2 : both L8 I8 (f_field_type)} {f_or_zkp_r1 : both L9 I9 (f_field_type)} {f_or_zkp_r2 : both L10 I10 (f_field_type)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit) := + Build_t_OrZKPCommit := + bind_both f_or_zkp_r2 (fun f_or_zkp_r2 => + bind_both f_or_zkp_r1 (fun f_or_zkp_r1 => + bind_both f_or_zkp_d2 (fun f_or_zkp_d2 => + bind_both f_or_zkp_d1 (fun f_or_zkp_d1 => + bind_both f_or_zkp_c (fun f_or_zkp_c => + bind_both f_or_zkp_b2 (fun f_or_zkp_b2 => + bind_both f_or_zkp_a2 (fun f_or_zkp_a2 => + bind_both f_or_zkp_b1 (fun f_or_zkp_b1 => + bind_both f_or_zkp_a1 (fun f_or_zkp_a1 => + bind_both f_or_zkp_y (fun f_or_zkp_y => + bind_both f_or_zkp_x (fun f_or_zkp_x => + solve_lift (ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit)))))))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit). +Fail Next Obligation. +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := y) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := y) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := y) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := y) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := y) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := y) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_c' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := y) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := y) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := y) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := y) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := y)). Definition t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := - (int32 × f_field_type). + (int32 × f_field_type × int32). Equations f_rp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (int32) := f_rp_i s := bind_both s (fun x => - solve_lift (ret_both (fst x : int32))) : both L I (int32). + solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). Fail Next Obligation. Equations f_rp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (f_field_type) := f_rp_xi s := bind_both s (fun x => - solve_lift (ret_both (snd x : f_field_type))) : both L I (f_field_type). + solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). Fail Next Obligation. -Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (f_field_type)} : both (L0:|:L1) (I0:|:I1) (t_RegisterParam) := +Equations f_rp_zkp_random {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (int32) := + f_rp_zkp_random s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (f_field_type)} {f_rp_zkp_random : both L2 I2 (int32)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_RegisterParam) := Build_t_RegisterParam := - bind_both f_rp_xi (fun f_rp_xi => - bind_both f_rp_i (fun f_rp_i => - solve_lift (ret_both ((f_rp_i,f_rp_xi) : (t_RegisterParam))))) : both (L0:|:L1) (I0:|:I1) (t_RegisterParam). + bind_both f_rp_zkp_random (fun f_rp_zkp_random => + bind_both f_rp_xi (fun f_rp_xi => + bind_both f_rp_i (fun f_rp_i => + solve_lift (ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_RegisterParam). Fail Next Obligation. -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y) (f_rp_zkp_random := f_rp_zkp_random x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := y)). Definition t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := (f_group_type × f_field_type × f_field_type). -Equations f_u {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_group_type) := - f_u s := +Equations f_schnorr_zkp_u {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_group_type) := + f_schnorr_zkp_u s := bind_both s (fun x => solve_lift (ret_both (fst (fst x) : f_group_type))) : both L I (f_group_type). Fail Next Obligation. -Equations f_c {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := - f_c s := +Equations f_schnorr_zkp_c {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := + f_schnorr_zkp_c s := bind_both s (fun x => solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). Fail Next Obligation. -Equations f_z {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := - f_z s := +Equations f_schnorr_zkp_z {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := + f_schnorr_zkp_z s := bind_both s (fun x => solve_lift (ret_both (snd x : f_field_type))) : both L I (f_field_type). Fail Next Obligation. -Equations Build_t_SchnorrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_u : both L0 I0 (f_group_type)} {f_c : both L1 I1 (f_field_type)} {f_z : both L2 I2 (f_field_type)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit) := +Equations Build_t_SchnorrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_schnorr_zkp_u : both L0 I0 (f_group_type)} {f_schnorr_zkp_c : both L1 I1 (f_field_type)} {f_schnorr_zkp_z : both L2 I2 (f_field_type)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit) := Build_t_SchnorrZKPCommit := - bind_both f_z (fun f_z => - bind_both f_c (fun f_c => - bind_both f_u (fun f_u => - solve_lift (ret_both ((f_u,f_c,f_z) : (t_SchnorrZKPCommit)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit). + bind_both f_schnorr_zkp_z (fun f_schnorr_zkp_z => + bind_both f_schnorr_zkp_c (fun f_schnorr_zkp_c => + bind_both f_schnorr_zkp_u (fun f_schnorr_zkp_u => + solve_lift (ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit). Fail Next Obligation. -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_u := y) (f_c := f_c x) (f_z := f_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_u := f_u x) (f_c := y) (f_z := f_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_u := f_u x) (f_c := f_c x) (f_z := y)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := y) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := y) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := y)). Definition t_TallyParameter : choice_type := 'unit. @@ -225,59 +276,111 @@ Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) : solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). Fail Next Obligation. -Equations schnorr_ZKP {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (g_pow_x : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_field_one_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := - schnorr_ZKP random g_pow_x x := +Equations schnorr_zkp {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (h : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3 :|: f_random_field_elem_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_field_one_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := + schnorr_zkp random h x := solve_lift (run (letb r := f_random_field_elem random in letb u := f_g_pow r in - letb c := v_Hash (prod_b (f_g,g_pow_x,u)) in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [solve_lift f_g (ret_both (tt : 'unit)) : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _; + solve_lift h : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _; + solve_lift u : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _])))) in letb z := f_add r (f_mul c x) in - letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_u := u) (f_c := c) (f_z := z)) in - ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_field_one_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). -Fail Next Obligation. - -Equations schnorr_ZKP_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_x : both L1 I1 (f_group_type)) (pi : both L2 I2 (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 :|: f_g_pow_loc :|: f_pow_loc :|: f_prod_loc :|: f_field_one_loc) (I1 :|: I2) ('bool) := - schnorr_ZKP_validate g_pow_x pi := - solve_lift (andb ((f_c pi) =.? (v_Hash (prod_b (f_g,g_pow_x,f_u pi)))) ((f_g_pow (f_z pi)) =.? (f_prod (f_u pi) (f_pow g_pow_x (f_c pi))))) : both (L1 :|: L2 :|: f_g_pow_loc :|: f_pow_loc :|: f_prod_loc :|: f_field_one_loc) (I1 :|: I2) ('bool). + letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in + ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3 :|: f_random_field_elem_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_field_one_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). +Fail Next Obligation. + +Equations schnorr_zkp_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (pi : both L2 I2 (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_field_one_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2) ('bool) := + schnorr_zkp_validate h pi := + solve_lift (andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [solve_lift f_g (ret_both (tt : 'unit)) : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _; + solve_lift h : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _; + solve_lift f_schnorr_zkp_u pi : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_field_one_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both L1 I1 (int32)) (random_r : both L2 I2 (int32)) (random_d : both L3 I3 (int32)) (h : both L4 I4 (f_group_type)) (xi : both L5 I5 (f_field_type)) (vi : both L6 I6 ('bool)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: f_prod_loc :|: f_div_loc :|: f_pow_loc :|: f_g_loc :|: f_g_pow_loc :|: f_random_field_elem_loc :|: f_hash_loc :|: f_sub_loc :|: f_mul_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) := + zkp_one_out_of_two random_w random_r random_d h xi vi := + letb w := f_random_field_elem random_w in + solve_lift (ifb vi + then letb r1 := f_random_field_elem random_r in + letb d1 := f_random_field_elem random_d in + letb x := f_g_pow xi in + letb y := f_prod (f_pow h xi) (f_g (ret_both (tt : 'unit))) in + letb a1 := f_prod (f_g_pow r1) (f_pow x d1) in + letb b1 := f_prod (f_pow h r1) (f_pow y d1) in + letb a2 := f_g_pow w in + letb b2 := f_pow h w in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [ + solve_lift x : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; + solve_lift y : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; + solve_lift a1 : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; + solve_lift b1 : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; + solve_lift a2 : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; + solve_lift b2 : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _])))) in + letb d2 := f_sub c d1 in + letb r2 := f_sub w (f_mul xi d2) in + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2) + else letb r2 := f_random_field_elem random_r in + letb d2 := f_random_field_elem random_d in + letb x := f_g_pow xi in + letb y := f_pow h xi in + letb a1 := f_g_pow w in + letb b1 := f_pow h w in + letb a2 := f_prod (f_g_pow r2) (f_pow x d2) in + letb b2 := f_prod (f_pow h r2) (f_pow (f_div y (f_g (ret_both (tt : 'unit)))) d2) in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [ + solve_lift x : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); + solve_lift y : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); + solve_lift a1 : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); + solve_lift b1 : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); + solve_lift a2 : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); + solve_lift b2 : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _)])))) in + letb d1 := f_sub c d2 in + letb r1 := f_sub w (f_mul xi d1) in + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: f_prod_loc :|: f_div_loc :|: f_pow_loc :|: f_g_loc :|: f_g_pow_loc :|: f_random_field_elem_loc :|: f_hash_loc :|: f_sub_loc :|: f_mul_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)). +Fail Next Obligation. + +Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (zkp : both L2 I2 (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 :|: f_hash_loc :|: f_add_loc :|: f_prod_loc :|: f_g_pow_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc) (I1 :|: I2) ('bool) := + zkp_one_out_of_two_validate h zkp := + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; + f_or_zkp_y zkp; + f_or_zkp_a1 zkp; + f_or_zkp_b1 zkp; + f_or_zkp_a2 zkp; + f_or_zkp_b2 zkp])))) in + solve_lift (andb (andb (andb (andb (c =.? (f_add (f_or_zkp_d1 zkp) (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? (f_prod (f_pow h (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r2 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? (f_prod (f_pow h (f_or_zkp_r2 zkp)) (f_pow (f_div (f_or_zkp_y zkp) (f_g (ret_both (tt : 'unit)))) (f_or_zkp_d2 zkp))))) : both (L1 :|: L2 :|: f_hash_loc :|: f_add_loc :|: f_prod_loc :|: f_g_pow_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc) (I1 :|: I2) ('bool). Fail Next Obligation. Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := - (int32 × nseq f_group_type (is_pure (n)) × nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × nseq int32 (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq int32 (is_pure (n)) × int32). -Equations f_zkp_random {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (int32) := - f_zkp_random s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst (fst x))))) : int32))) : both L I (int32). -Fail Next Obligation. + (nseq f_group_type (is_pure (n)) × nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × nseq f_field_type (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × int32). Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq f_group_type (is_pure (n))) := f_g_pow_xis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). Fail Next Obligation. Equations f_zkp_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := f_zkp_xis s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both L I (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). Fail Next Obligation. -Equations f_commit_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq int32 (is_pure (n))) := +Equations f_commit_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq f_field_type (is_pure (n))) := f_commit_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : nseq int32 (is_pure (n))))) : both L I (nseq int32 (is_pure (n))). + solve_lift (ret_both (snd (fst (fst (fst x))) : nseq f_field_type (is_pure (n))))) : both L I (nseq f_field_type (is_pure (n))). Fail Next Obligation. Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq f_group_type (is_pure (n))) := f_g_pow_xi_yi_vis s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). Fail Next Obligation. -Equations f_zkp_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq int32 (is_pure (n))) := +Equations f_zkp_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := f_zkp_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : nseq int32 (is_pure (n))))) : both L I (nseq int32 (is_pure (n))). + solve_lift (ret_both (snd (fst x) : nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both L I (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). Fail Next Obligation. Equations f_tally {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (int32) := f_tally s := bind_both s (fun x => solve_lift (ret_both (snd x : int32))) : both L I (int32). Fail Next Obligation. -Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_zkp_random : both L0 I0 (int32)} {f_g_pow_xis : both L1 I1 (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both L2 I2 (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_commit_vis : both L3 I3 (nseq int32 (is_pure (n)))} {f_g_pow_xi_yi_vis : both L4 I4 (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both L5 I5 (nseq int32 (is_pure (n)))} {f_tally : both L6 I6 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6) (t_OvnContractState (n := n)) := +Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_g_pow_xis : both L0 I0 (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both L1 I1 (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_commit_vis : both L2 I2 (nseq f_field_type (is_pure (n)))} {f_g_pow_xi_yi_vis : both L3 I3 (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both L4 I4 (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState (n := n)) := Build_t_OvnContractState := bind_both f_tally (fun f_tally => bind_both f_zkp_vis (fun f_zkp_vis => @@ -285,151 +388,83 @@ Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} bind_both f_commit_vis (fun f_commit_vis => bind_both f_zkp_xis (fun f_zkp_xis => bind_both f_g_pow_xis (fun f_g_pow_xis => - bind_both f_zkp_random (fun f_zkp_random => - solve_lift (ret_both ((f_zkp_random,f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState)))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6) (t_OvnContractState). -Fail Next Obligation. -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_random' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := y) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_zkp_random := f_zkp_random x) (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). + solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). +Fail Next Obligation. +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). + +Equations f_from {L I} : both L I 'nat := + f_from := solve_lift (ret_both (0%nat : 'nat)). +Fail Next Obligation. +Equations impl__map_err {L1 I1} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (out : both L1 I1 (t_Result t_CastVoteParam t_ParseError)) (f_from : both L1 I1 'nat) : + both L1 I1 (@choice_typeMonad.M (@choice_typeMonad.mnd + (choice_typeMonad.result_bind_code (Result_t (@t_CastVoteParam _ _ _) t_ParseError))) t_CastVoteParam) := + impl__map_err out f_from := + matchb out with + | inl s => solve_lift ret_both _ + | inr s => solve_lift ret_both _ +end. +Fail Next Obligation. + +(* Equations run {L I A} (x : both L I (choice_typeMonad.M (CEMonad := (@choice_typeMonad.mnd (choice_typeMonad.result_bind_code A))) A)) : both L I (t_Result A 'unit) := *) +(* run x := *) +(* bind_both x (fun y => match y with *) +(* | inl r | inr r => solve_lift ret_both (inl r : t_Result A 'unit) *) +(* end). *) +(* Fail Next Obligation. *) Definition cast_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *);2%nat). - -Obligation Tactic := try timeout 5 solve_ssprove_obligations. -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] :|: f_group_one_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := cast_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params:t_CastVoteParam (v_Z)) := matchb f_branch out with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : t_ParseError (* (t_Result (t_Infallible) (t_ParseError)) *)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist2 := v_Break (f_from_residual residual) in - ControlFlow_Continue (solve_lift (never_to_any hoist2)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) (* : (t_CastVoteParam (v_Z := v_Z)) *)) in - ControlFlow_Continue (solve_lift val) - end in - ControlFlow_Continue (letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in - letb zkp_vi := v_ZKP_one_out_of_two g_pow_xi_yi_vi (f_cvp_vote params) in + solve_lift (run (letb '(_,out) := f_get (Ctx := t_CastVoteParam) (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (Result_t t_CastVoteParam t_ParseError)] (params:t_CastVoteParam (v_Z := v_Z)) := impl__map_err out f_from in + Result_Ok ((* letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in *) + (* letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in *) + (* letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in *) letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in -Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc] :|: f_group_one_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). -Next Obligation. intros ; now solve_in_fset. Defined. -Next Obligation. intros ; now solve_in_fset. Defined. -Next Obligation. solve_ssprove_obligations. Defined. -Next Obligation. - - solve_ssprove_obligations. Defined. -Next Obligation. solve_ssprove_obligations. Defined. -Next Obligation. solve_ssprove_obligations. Defined. -Next Obligation. solve_ssprove_obligations. Defined. -Next Obligation. solve_ssprove_obligations. Defined. -Next Obligation. solve_ssprove_obligations. Defined. -Next Obligation. solve_ssprove_obligations. Defined. + (* letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in *) + (* letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in *) + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). Fail Next Obligation. Definition commit_to_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *);3%nat). - -Obligation Tactic := (Tactics.program_simpl; fail). -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := + (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));3%nat). +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := commit_to_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params:t_CastVoteParam (v_Z)) := matchb f_branch out with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : t_ParseError (* (t_Result (t_Infallible) (t_ParseError)) *)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist3 := v_Break (f_from_residual residual) in - ControlFlow_Continue (solve_lift (never_to_any hoist3)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) (* : (t_CastVoteParam (v_Z)) *)) in - ControlFlow_Continue (solve_lift val) - end in - ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + letm[choice_typeMonad.result_bind_code (t_ParseError)] (params:t_CastVoteParam (v_Z)) := impl__map_err out f_from in + Result_Ok (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => - solve_lift (ifb negb (schnorr_ZKP_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist4 := v_Break (Result_Err (solve_lift ret_both (tt : 'unit))) (* (Result_Err ParseError) *) in - ControlFlow_Continue (never_to_any hoist4) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*0*)(L2:|:fset []) (I2) ((* t_ControlFlow *) _ (* (t_Result (* ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) *) _ (t_ParseError)) *) ('unit)))) (Result_Ok (ret_both (tt : 'unit))) in - letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_i params) (f_cvp_xi params) (f_cvp_vote params) (f_g_pow_xis state) in + solve_lift (ifb not (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist2 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist2) + else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*0*)(L2:|:fset []) (I2) (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in + letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in + letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in letb commit_vi := commit_to g_pow_xi_yi_vi in letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). Fail Next Obligation. -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Obligation Tactic := intros. -Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {impl_108907986_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (impl_108907986_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasInitContext (impl_108907986_) ('unit)} (_ : both L1 I1 (impl_108907986_)) : both (L1 :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *)) (t_Reject)) := + +Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both L1 I1 ('unit)) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)) := init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_zkp_random := ret_both (0 : int32)) (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_u := f_group_one (ret_both (tt : 'unit))) (f_z := f_field_zero (ret_both (tt : 'unit))) (f_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (ret_both (0 : int32)) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (ret_both (0 : int32)) n) (f_tally := ret_both (0 : int32)))) : both (L1 :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *)) (t_Reject)). -Next Obligation. - solve_ssprove_obligations. -Qed. -Next Obligation. - solve_ssprove_obligations. -Qed. -Next Obligation. - solve_ssprove_obligations. -Qed. -Next Obligation. - simpl. - unfold cast_vote_obligations_obligation_3. - normalize_fset. - simpl. - destruct H5. - destruct H4. - split_fsubset_lhs. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - now solve_single_fset_fsubset. - solve_single_fset_fsubset. - now solve_single_fset_fsubset. - now solve_single_fset_fsubset. - - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - unfold cast_vote_obligations_obligation_3. - solve_single_fset_fsubset. - - - solve_ssprove_obligations. -Qed. -Fail Next Obligation. -lia + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_field_zero (ret_both (tt : 'unit))) (f_schnorr_zkp_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_y := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_c := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d2 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)). +Fail Next Obligation. + Definition register_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));4%nat). Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := register_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] (params:t_RegisterParam (v_Z)) := matchb f_branch out with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result (t_Infallible) (t_ParseError))) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist5 := v_Break (f_from_residual residual) in - ControlFlow_Continue (solve_lift (never_to_any hoist5)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (t_RegisterParam (v_Z))) in - ControlFlow_Continue (solve_lift val) - end in - ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in - letb zkp_xi := schnorr_ZKP (f_zkp_random state) g_pow_xi (f_rp_xi params) in + letm[choice_typeMonad.result_bind_code (t_ParseError)] (params:t_RegisterParam (v_Z)) := impl__map_err out f_from in + Result_Ok (letb g_pow_xi := f_g_pow (f_rp_xi params) in + letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in @@ -444,13 +479,19 @@ Definition tally_votes_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fs (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));7%nat). Definition vote_result_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := (f_group_type;8%nat). -Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := +Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := tally_votes _ state := letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => - letb _ := check_valid2 ((f_g_pow_xi_yi_vis state).a[i]) ((f_zkp_vis state).a[i]) in - letb _ := check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i]) in - solve_lift (ret_both (tt : 'unit)) : both (*0*)(L2:|:fset []) (I2) ('unit))) (ret_both (tt : 'unit)) in + letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] _ := ControlFlow_Continue (ifb not (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist3 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist3) + else ControlFlow_Continue (ret_both (tt : 'unit))) in + solve_lift (ifb not (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist4 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist4) + else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*2*)(L2:|:fset [prod1_loc;prod2_loc]) (I2) (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in letb vote_result loc(vote_result_loc) := f_group_one (ret_both (tt : 'unit)) in letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => ssp (fun vote_result => @@ -467,7 +508,7 @@ Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interf solve_lift (prod_b (curr,tally)) : both (*5*)(L2:|:fset [curr_loc;tally_loc;vote_result_loc;curr_loc;tally_loc]) (I2) ((f_field_type × int32)))) (prod_b (curr,tally)) in letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in - Result_Ok (solve_lift (prod_b (f_accept (ret_both (tt : 'unit)),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). + Result_Ok (solve_lift (prod_b (f_accept (ret_both (tt : 'unit)),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). Fail Next Obligation. (** Concert lib part **) diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs index 0e9da1b..b6671e7 100644 --- a/ovn/src/ovn_group.rs +++ b/ovn/src/ovn_group.rs @@ -240,7 +240,11 @@ pub fn register_vote, const n: usize, A: HasActions>( ctx: impl HasReceiveContext, state: OvnContractState, ) -> Result<(A, OvnContractState), ParseError> { - let params: RegisterParam = ctx.parameter_cursor().get()?; + let params: RegisterParam = + match ctx.parameter_cursor().get() { + Ok (x) => x, + Err (x) => return Err (ParseError{}), + }; let g_pow_xi = G::g_pow(params.rp_xi); let zkp_xi = schnorr_zkp::(params.rp_zkp_random, g_pow_xi, params.rp_xi); @@ -303,7 +307,11 @@ pub fn commit_to_vote, const n: usize, A: HasActions>( ctx: impl HasReceiveContext, state: OvnContractState, ) -> Result<(A, OvnContractState), ParseError> { - let params: CastVoteParam = ctx.parameter_cursor().get()?; + let params: CastVoteParam = + match ctx.parameter_cursor().get() { + Ok (x) => x, + Err (x) => return Err (ParseError{}), + }; for i in 0..n { if !schnorr_zkp_validate(state.g_pow_xis[i], state.zkp_xis[i]) { @@ -328,7 +336,11 @@ pub fn cast_vote, const n: usize, A: HasActions>( ctx: impl HasReceiveContext, state: OvnContractState, ) -> Result<(A, OvnContractState), ParseError> { - let params: CastVoteParam = ctx.parameter_cursor().get()?; + let params: CastVoteParam = + match ctx.parameter_cursor().get() { + Ok (x) => x, + Err (x) => return Err (ParseError{}), + }; let g_pow_yi = compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); let g_pow_xi_yi_vi = From 1167a1b76a7b3a9923deb60c4de9c253ac806ae7 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Sun, 4 Feb 2024 18:39:12 +0100 Subject: [PATCH 56/86] Better extraction? --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 224 +++++++++++--------- 1 file changed, 118 insertions(+), 106 deletions(-) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index b1876ff..758f48f 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -33,11 +33,11 @@ Export Hacspec_ovn_Ovn_traits. (*Not implemented yet? todo(item)*) -Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (xi : both L1 I1 (f_field_type)) (vote : both L2 I2 ('bool)) (g_pow_yi : both L3 I3 (f_group_type)) : both (L1 :|: L2 :|: L3 :|: (f_pow_loc :|: f_field_zero_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3) (f_group_type) := +Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (xi : both L1 I1 (f_field_type)) (vote : both L2 I2 ('bool)) (g_pow_yi : both L3 I3 (f_group_type)) : both (L1 :|: L2 :|: L3 :|: f_g_pow_loc :|: f_pow_loc :|: f_prod_loc :|: f_field_one_loc :|: f_field_zero_loc) (I1 :|: I2 :|: I3) (f_group_type) := compute_group_element_for_vote xi vote g_pow_yi := solve_lift (f_prod (f_pow g_pow_yi xi) (f_g_pow (ifb vote then f_field_one (ret_both (tt : 'unit)) - else f_field_zero (ret_both (tt : 'unit))))) : both (L1 :|: L2 :|: L3 :|: (f_pow_loc :|: f_field_zero_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3) (f_group_type). + else f_field_zero (ret_both (tt : 'unit))))) : both (L1 :|: L2 :|: L3 :|: f_g_pow_loc :|: f_pow_loc :|: f_prod_loc :|: f_field_one_loc :|: f_field_zero_loc) (I1 :|: I2 :|: I3) (f_group_type). Fail Next Obligation. Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (random : both L1 I1 (int32)) : both (L1 :|: f_random_field_elem_loc) I1 (f_field_type) := @@ -49,17 +49,20 @@ Definition prod1_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_siz (f_group_type;0%nat). Definition prod2_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := (f_group_type;1%nat). -Equations compute_g_pow_yi {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both L1 I1 (uint_size)) (xis : both L2 I2 (nseq f_group_type (is_pure (n)))) : both (L1 :|: L2 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (f_group_type) := +Equations compute_g_pow_yi {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both L1 I1 (uint_size)) (xis : both L2 I2 (nseq f_group_type (is_pure (n)))) : both (L1 :|: L2 :|: fset [prod1_loc (n:=n);prod2_loc (n:=n)] :|: (* f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: *)f_div_loc :|: f_group_one_loc :|: f_prod_loc) (I1 :|: I2) (f_group_type) := compute_g_pow_yi i xis := letb prod1 loc(prod1_loc) := f_group_one (ret_both (tt : 'unit)) in - letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => - ssp (fun prod1 => - solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L2:|:L1 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc:|:fset [prod1_loc;prod1_loc]) (I1:|:I2:|:I1) (f_group_type))) prod1 in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => + ssp (fun _ => + letb prod1 loc(prod1_loc) := f_prod prod1 (xis.a[j]) in + (* assign body todo(term) *) (solve_lift ret_both tt) : both (*1*)(L2:|:L1:|:fset [prod1_loc] :|: f_group_one_loc :|: f_prod_loc) (I2:|:I1) ('unit))) (ret_both (tt : 'unit)) in letb prod2 loc(prod2_loc) := f_group_one (ret_both (tt : 'unit)) in - letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => - ssp (fun prod2 => - solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L2:|:L1:|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod2_loc;prod2_loc]) (I1:|:I2:|:I1) (f_group_type))) prod2 in - solve_lift (f_div prod1 prod2) : both (L1 :|: L2 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2) (f_group_type). + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => + ssp (fun _ => + letb prod2 loc(prod2_loc) := f_prod prod2 (xis.a[j]) in + (* assign body todo(term) *) + (solve_lift ret_both tt) : both (*1*)(L2:|:L1:|:fset [prod2_loc] :|: f_group_one_loc :|: f_prod_loc) (I2:|:I1) ('unit))) (ret_both (tt : 'unit)) in + solve_lift (f_div prod1 prod2) : both (L1 :|: L2 :|: fset [prod1_loc;prod2_loc] :|: (* f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: *)f_div_loc :|: f_group_one_loc :|: f_prod_loc) (I1 :|: I2) (f_group_type). Solve All Obligations with ( solve_ssprove_obligations ; ((now (rewrite !fset0E ; apply (ret_both 0))) || (now destruct from_uint_size))). Fail Next Obligation. @@ -70,9 +73,9 @@ Fail Next Obligation. Definition unsize {A} := @id A. Definition box_new {A} := @id A. -Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (commitment : both L2 I2 (f_field_type)) : both (L1 :|: L2 :|: f_hash_loc) (I1 :|: I2) ('bool) := +Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (commitment : both L2 I2 (f_field_type)) : both (L1 :|: L2 :|: (* f_eq_loc :|: *)f_hash_loc) (I1 :|: I2) ('bool) := check_commitment g_pow_xi_yi_vi commitment := - solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both (L1 :|: L2 :|: f_hash_loc) (I1 :|: I2) ('bool). + solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both (L1 :|: L2 :|: (* f_eq_loc :|: *)f_hash_loc) (I1 :|: I2) ('bool). Fail Next Obligation. Equations commit_to {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) : both (L1 :|: f_hash_loc) I1 (f_field_type) := @@ -276,26 +279,27 @@ Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) : solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). Fail Next Obligation. -Equations schnorr_zkp {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (h : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3 :|: f_random_field_elem_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_field_one_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := +Equations schnorr_zkp {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (h : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3 :|: (* f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc :|: *)f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_add_loc :|: f_mul_loc :|: f_random_field_elem_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := schnorr_zkp random h x := solve_lift (run (letb r := f_random_field_elem random in letb u := f_g_pow r in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [solve_lift f_g (ret_both (tt : 'unit)) : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _; - solve_lift h : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _; - solve_lift u : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _])))) in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list (L := (L1 :|: L2 :|: L3 :|: (* f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc :|: *)f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_add_loc :|: f_mul_loc :|: f_random_field_elem_loc)) (I := (I1 :|: I2 :|: I3)) [solve_lift f_g (ret_both (tt : 'unit)); + solve_lift h; + solve_lift u])))) in letb z := f_add r (f_mul c x) in letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in - ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3 :|: f_random_field_elem_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_field_one_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). + ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3 :|: (* f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc :|: *)f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_add_loc :|: f_mul_loc :|: f_random_field_elem_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). Fail Next Obligation. -Equations schnorr_zkp_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (pi : both L2 I2 (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_field_one_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2) ('bool) := +Equations schnorr_zkp_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (pi : both L2 I2 (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 :|: (* f_eq_loc :|: *)f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc) (I1 :|: I2) ('bool) := schnorr_zkp_validate h pi := - solve_lift (andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [solve_lift f_g (ret_both (tt : 'unit)) : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _; - solve_lift h : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _; - solve_lift f_schnorr_zkp_u pi : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_field_one_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2) ('bool). + solve_lift (andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list (L := (L1 :|: L2 :|: (* f_eq_loc :|: *)f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc)) (I := (I1 :|: I2)) [solve_lift f_g (ret_both (tt : 'unit)); + solve_lift h; + solve_lift f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both (L1 :|: L2 :|: (* f_eq_loc :|: *)f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc) (I1 :|: I2) ('bool). Fail Next Obligation. -Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both L1 I1 (int32)) (random_r : both L2 I2 (int32)) (random_d : both L3 I3 (int32)) (h : both L4 I4 (f_group_type)) (xi : both L5 I5 (f_field_type)) (vi : both L6 I6 ('bool)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: f_prod_loc :|: f_div_loc :|: f_pow_loc :|: f_g_loc :|: f_g_pow_loc :|: f_random_field_elem_loc :|: f_hash_loc :|: f_sub_loc :|: f_mul_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) := +Obligation Tactic := try timeout 2 solve_ssprove_obligations. +Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both L1 I1 (int32)) (random_r : both L2 I2 (int32)) (random_d : both L3 I3 (int32)) (h : both L4 I4 (f_group_type)) (xi : both L5 I5 (f_field_type)) (vi : both L6 I6 ('bool)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: (* f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: *)f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) := zkp_one_out_of_two random_w random_r random_d h xi vi := letb w := f_random_field_elem random_w in solve_lift (ifb vi @@ -307,13 +311,12 @@ Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : letb b1 := f_prod (f_pow h r1) (f_pow y d1) in letb a2 := f_g_pow w in letb b2 := f_pow h w in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [ - solve_lift x : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; - solve_lift y : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; - solve_lift a1 : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; - solve_lift b1 : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; - solve_lift a2 : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; - solve_lift b2 : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _])))) in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list (L := (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: (* f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: *) f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc)) (I := (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6)) [solve_lift x; + solve_lift y; + solve_lift a1; + solve_lift b1; + solve_lift a2; + solve_lift b2])))) in letb d2 := f_sub c d1 in letb r2 := f_sub w (f_mul xi d2) in Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2) @@ -325,19 +328,20 @@ Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : letb b1 := f_pow h w in letb a2 := f_prod (f_g_pow r2) (f_pow x d2) in letb b2 := f_prod (f_pow h r2) (f_pow (f_div y (f_g (ret_both (tt : 'unit)))) d2) in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [ - solve_lift x : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); - solve_lift y : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); - solve_lift a1 : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); - solve_lift b1 : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); - solve_lift a2 : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); - solve_lift b2 : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _)])))) in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list (L := (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: (* f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: *) f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc)) (I := (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6)) [solve_lift x; + solve_lift y; + solve_lift a1; + solve_lift b1; + solve_lift a2; + solve_lift b2])))) in letb d1 := f_sub c d2 in letb r1 := f_sub w (f_mul xi d1) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: f_prod_loc :|: f_div_loc :|: f_pow_loc :|: f_g_loc :|: f_g_pow_loc :|: f_random_field_elem_loc :|: f_hash_loc :|: f_sub_loc :|: f_mul_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)). + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: (* f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: *) f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)). +Admit Obligations. (* Slow *) Fail Next Obligation. +Obligation Tactic := (* try timeout 2 *) solve_ssprove_obligations. -Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (zkp : both L2 I2 (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 :|: f_hash_loc :|: f_add_loc :|: f_prod_loc :|: f_g_pow_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc) (I1 :|: I2) ('bool) := +Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (zkp : both L2 I2 (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 (* :|: f_eq_loc *) :|: f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_add_loc) (I1 :|: I2) ('bool) := zkp_one_out_of_two_validate h zkp := letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; f_or_zkp_y zkp; @@ -345,7 +349,7 @@ Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Locatio f_or_zkp_b1 zkp; f_or_zkp_a2 zkp; f_or_zkp_b2 zkp])))) in - solve_lift (andb (andb (andb (andb (c =.? (f_add (f_or_zkp_d1 zkp) (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? (f_prod (f_pow h (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r2 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? (f_prod (f_pow h (f_or_zkp_r2 zkp)) (f_pow (f_div (f_or_zkp_y zkp) (f_g (ret_both (tt : 'unit)))) (f_or_zkp_d2 zkp))))) : both (L1 :|: L2 :|: f_hash_loc :|: f_add_loc :|: f_prod_loc :|: f_g_pow_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc) (I1 :|: I2) ('bool). + solve_lift (andb (andb (andb (andb (c =.? (f_add (f_or_zkp_d1 zkp) (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? (f_prod (f_pow h (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r2 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? (f_prod (f_pow h (f_or_zkp_r2 zkp)) (f_pow (f_div (f_or_zkp_y zkp) (f_g (ret_both (tt : 'unit)))) (f_or_zkp_d2 zkp))))) : both (L1 :|: L2 (* :|: f_eq_loc *) :|: f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_add_loc) (I1 :|: I2) ('bool). Fail Next Obligation. Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := @@ -401,85 +405,88 @@ Definition cast_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *);2%nat). Notation Result_Ok_case := inl. Notation Result_Err_case := inr. -Obligation Tactic := try timeout 2 solve_ssprove_obligations. -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: f_g_loc :|: f_random_field_elem_loc :|: f_hash_loc :|: f_sub_loc :|: f_mul_loc :|: f_group_one_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := cast_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params:t_CastVoteParam (v_Z)) := matchb out with + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with | Result_Ok_case x => letb x := ret_both ((x) (* : (t_CastVoteParam (v_Z := v_Z)) *)) in ControlFlow_Continue (solve_lift x) | Result_Err_case x => letb x := ret_both ((x) : (t_ParseError)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist2 := v_Break _ (* (Result_Err t_ParseError) *) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist2 := v_Break (Result_Err _ (* ParseError *)) in ControlFlow_Continue (solve_lift (never_to_any hoist2)) end in - ControlFlow_Continue (letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in + ControlFlow_Continue (letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := U32) (f_cvp_i params)) (f_g_pow_xis state) in letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (L1 :|: L2 :|: f_g_loc :|: f_random_field_elem_loc :|: f_hash_loc :|: f_sub_loc :|: f_mul_loc :|: f_group_one_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). -Solve All Obligations with try timeout 4 solve_ssprove_obligations. -Admit Obligations. + letb _ := letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := U32) (f_cvp_i params)) g_pow_xi_yi_vi) in + solve_lift ret_both tt (* assign body todo(term) *) in + letb _ := letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := U32) (f_cvp_i params)) zkp_vi) in + solve_lift ret_both tt (* assign body todo(term) *) in + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). +Admit Obligations. (* TODO: fix *) Fail Next Obligation. Definition commit_to_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *);3%nat). -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := + (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *);3%nat). +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := commit_to_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params:t_CastVoteParam (v_Z)) := matchb out with + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with | Result_Ok_case x => - letb x := ret_both ((x) (* : (t_CastVoteParam (v_Z := v_Z)) *)) in + letb x := ret_both ((x) (* : (t_CastVoteParam (v_Z)) *)) in ControlFlow_Continue (solve_lift x) | Result_Err_case x => letb x := ret_both ((x) : (t_ParseError)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist3 := v_Break _ (* (Result_Err t_ParseError) *) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist3 := v_Break (Result_Err _ (* ParseError *)) in ControlFlow_Continue (solve_lift (never_to_any hoist3)) end in ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => - solve_lift (ifb negb (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) - then - (* letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist4 := v_Break _ (* (Result_Err ParseError) *) in *) - ControlFlow_Continue (never_to_any v_Break _(* hoist4 *)) - else ControlFlow_Continue (never_to_any v_Break _(* hoist4 *)) - (* ControlFlow_Continue (ret_both (tt : 'unit)) *)) : both (*0*)(L2:|:fset []) (I2) (t_Result (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in - letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in + solve_lift (ifb (* not *) negb (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist4 := v_Break (Result_Err _ (* ParseError *)) in + ControlFlow_Continue (never_to_any hoist4) + else Result_Ok (solve_lift ret_both tt)) : both (*0*)(L2:|:fset []) (I2) (* ((* t_ControlFlow *) t_Result (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) ('unit)) *) _)) (Result_Ok (solve_lift ret_both (tt : 'unit))) in + letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := U32) (f_cvp_i params)) (f_g_pow_xis state) in letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in letb commit_vi := commit_to g_pow_xi_yi_vi in letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in - letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). + letb _ := letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := U32) (f_cvp_i params)) commit_vi) in + solve_lift ret_both tt (* assign body todo(term) *) in + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc] (* :|: f_get_loc :|: f_clone_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). +Admit Obligations. Fail Next Obligation. -Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both L1 I1 ('unit)) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)) := +Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both L1 I1 ('unit)) : both (L1 (* :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_commit_vis_loc :|: f_g_pow_xi_yi_vis_loc :|: f_g_pow_xis_loc :|: f_tally_loc :|: f_zkp_vis_loc :|: f_zkp_xis_loc :|: f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc *) :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *)) (t_Reject)) := init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_field_zero (ret_both (tt : 'unit))) (f_schnorr_zkp_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_y := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_c := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d2 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)). + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_field_zero (ret_both (tt : 'unit))) (f_schnorr_zkp_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_y := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_c := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d2 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both (L1 (* :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_commit_vis_loc :|: f_g_pow_xi_yi_vis_loc :|: f_g_pow_xis_loc :|: f_tally_loc :|: f_zkp_vis_loc :|: f_zkp_xis_loc :|: f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc *) :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *)) (t_Reject)). Fail Next Obligation. Definition register_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));4%nat). -Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := + (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *);4%nat). +Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *) :|: f_g_pow_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := register_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] (params:t_RegisterParam (v_Z)) := matchb out with + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params : t_RegisterParam (v_Z)) := matchb out with | Result_Ok_case x => - letb x := ret_both ((x) : (t_RegisterParam (v_Z))) in + letb x := ret_both ((x) (* : (t_RegisterParam (v_Z)) *)) in ControlFlow_Continue (solve_lift x) | Result_Err_case x => letb x := ret_both ((x) : (t_ParseError)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist5 := v_Break (Result_Err ParseError) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist5 := v_Break (Result_Err (* ParseError *) _) in ControlFlow_Continue (solve_lift (never_to_any hoist5)) end in ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). + letb _ := letb register_vote_state_ret loc(register_vote_state_ret_loc) := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := U32) (f_rp_i params)) g_pow_xi) in + solve_lift ret_both tt (* assign body todo(term) *) in + letb _ := letb register_vote_state_ret loc(register_vote_state_ret_loc) := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := U32) (f_rp_i params)) zkp_xi) in + solve_lift ret_both tt (* assign body todo(term) *) in + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *) :|: f_g_pow_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). +Admit Obligations. Fail Next Obligation. Definition curr_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := @@ -487,40 +494,45 @@ Definition curr_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size Definition tally_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := (int32;6%nat). Definition tally_votes_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));7%nat). + (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *);7%nat). Definition vote_result_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := (f_group_type;8%nat). -Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := - tally_votes _ state := - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => - ssp (fun _ => - letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] _ := ControlFlow_Continue (ifb not (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist6 := v_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist6) - else ControlFlow_Continue (ret_both (tt : 'unit))) in - solve_lift (ifb not (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist7 := v_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist7) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*2*)(L2:|:fset [prod1_loc;prod2_loc]) (I2) (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in - letb vote_result loc(vote_result_loc) := f_group_one (ret_both (tt : 'unit)) in - letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => - ssp (fun vote_result => - solve_lift (f_prod vote_result g_pow_vote) : both (*2*)(L2:|:L2:|:fset [vote_result_loc;vote_result_loc]) (I2:|:I2) (f_group_type))) vote_result in - letb tally loc(tally_loc) := ret_both (0 : int32) in - letb curr loc(curr_loc) := f_field_zero (ret_both (tt : 'unit)) in - letb '(curr,tally) := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => - ssp (fun '(curr,tally) => - letb tally := ifb (f_g_pow curr) =.? vote_result - then letb tally := i in - tally - else tally in - letb curr := f_add curr (f_field_one (ret_both (tt : 'unit))) in - solve_lift (prod_b (curr,tally)) : both (*5*)(L2:|:fset [curr_loc;tally_loc;vote_result_loc;curr_loc;tally_loc]) (I2) ((f_field_type × int32)))) (prod_b (curr,tally)) in - letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in - letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in - Result_Ok (solve_lift (prod_b (f_accept (ret_both (tt : 'unit)),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). -Fail Next Obligation. +(* Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [curr_loc (n := n);tally_loc (n := n);tally_votes_state_ret_loc (n := n);vote_result_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] (* :|: f_clone_loc :|: f_eq_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc *) :|: f_g_pow_loc :|: f_group_one_loc :|: f_prod_loc :|: f_add_loc :|: f_field_one_loc :|: f_field_zero_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := *) +(* tally_votes _ state := *) +(* letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => *) +(* ssp (fun _ => *) +(* letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in *) +(* letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] _ := ControlFlow_Continue (ifb (* not *)negb (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) *) +(* then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist6 := v_Break (Result_Err _ (* ParseError *)) in *) +(* ControlFlow_Continue (never_to_any hoist6) *) +(* else Result_Ok (solve_lift ret_both tt)) in *) +(* solve_lift (ifb (* not *)negb (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) *) +(* then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist7 := v_Break (Result_Err (* ParseError *) _) in *) +(* ControlFlow_Continue (never_to_any hoist7) *) +(* else Result_Ok (solve_lift ret_both tt)) : both (*0*)(L2:|:fset []) (I2) _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) ('unit)) *))) (Result_Ok (ret_both (tt : 'unit))) in *) +(* letb vote_result loc(vote_result_loc) := f_group_one (ret_both (tt : 'unit)) in *) +(* letb _ := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => *) +(* ssp (fun _ => *) +(* letb vote_result loc(vote_result_loc) := f_prod vote_result g_pow_vote in *) +(* solve_lift ret_both tt (* assign body todo(term) *) : both (*1*)(L2:|:fset [vote_result_loc]) (I2) ('unit))) (ret_both (tt : 'unit)) in *) +(* letb tally loc(tally_loc) := ret_both (0 : int32) in *) +(* letb curr loc(curr_loc) := f_field_zero (ret_both (tt : 'unit)) in *) +(* letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := U32) n))) (fun i => *) +(* ssp (fun _ => *) +(* letb _ := ifb (f_g_pow curr) =.? vote_result *) +(* then letb _ := letb tally loc(tally_loc) := i in *) +(* solve_lift ret_both tt (* assign body todo(term) *) in *) +(* ret_both (tt : 'unit) *) +(* else solve_lift (ret_both tt) in *) +(* letb _ := letb curr loc(curr_loc) := f_add curr (f_field_one (ret_both (tt : 'unit))) in *) +(* solve_lift ret_both tt (* assign body todo(term) *) in *) +(* solve_lift (ret_both (tt : 'unit)) : both (*2*)(fset [curr_loc;vote_result_loc]) ((fset [])) ('unit))) (ret_both (tt : 'unit)) in *) +(* letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in *) +(* letb _ := letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in *) +(* solve_lift ret_both tt (* assign body todo(term) *) in *) +(* Result_Ok (solve_lift (prod_b (f_accept (* (ret_both (tt : 'unit)) *),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc] (* :|: f_clone_loc :|: f_eq_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc *) :|: f_g_pow_loc :|: f_group_one_loc :|: f_prod_loc :|: f_add_loc :|: f_field_one_loc :|: f_field_zero_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). *) +(* Fail Next Obligation. *) +(* TODO *) (** Concert lib part **) From ConCert.Utils Require Import Extras. @@ -584,7 +596,7 @@ Fail Next Obligation. Definition receive_OVN_tally {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_TallyParameter)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := tally_votes ctx st. -Inductive Msg_OVN: Type := +Inductive Msg_OVN : Type := | msg_OVN_cast_vote : t_CastVoteParam -> Msg_OVN | msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN | msg_OVN_register : t_RegisterParam -> Msg_OVN From c219c1502dd9e4867cc855244d885d149e91c008 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Sat, 10 Feb 2024 22:12:07 +0100 Subject: [PATCH 57/86] Update to Coq.8.18.0 --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 55 +++++ .../extraction/Hacspec_ovn_Ovn_traits.v | 2 +- ovn/proofs/ssprove/extraction/Makefile | 207 ++++++++++++------ 3 files changed, 192 insertions(+), 72 deletions(-) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 758f48f..e66b965 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -1,3 +1,56 @@ +Require Import Lia. +Lemma add_assoc : forall a b c, (a + (b + c)) = (a + b + c). +Proof. + intros ; induction a ; [ | simpl ; rewrite IHa ] ; easy. +Qed. +Lemma add_commut : forall a b, a + b = b + a. +Proof. + lia. +Qed. +Lemma add_0_l : forall a, (0 + a) = a. +Proof. + easy. +Qed. +Lemma add_0_r : forall a, (a + 0) = a. +Proof. + easy. +Qed. +Lemma add_trans : forall a b c, a <= b -> b <= c -> a <= c. +Proof. + lia. +Qed. + +Ltac normalize_goal := + repeat match goal with + | |- context [?a + ?b + ?c] => + replace (a + b + c) with (a + (b + c)) by apply add_assoc + end. +Ltac solve_split_goal := + easy || + (normalize_goal ; + match goal with + | |- context [_ <= ?x + ?y] => + match goal with + | |- context [?lhs <= ?rhs] => + let H_rhs := fresh in + let H_f := fresh in + let H_ass_l := fresh in + let H_ass_r := fresh in + set (H_rhs := rhs) ; pattern x in H_rhs ; + set (H_f := fun _ => _) in H_rhs ; + assert (H_ass_l : lhs <= H_f 0 + x) by (subst H_rhs H_f ; hnf ; try rewrite ! add_0_l ; try rewrite ! add_0_r ; normalize_goal ; solve_split_goal) ; + assert (H_ass_r : x + H_f 0 <= rhs) by (subst H_rhs H_f ; hnf ; try rewrite ! add_0_l ; try rewrite ! add_0_r ; normalize_goal ; lia) ; (* Should always be true (safe under approximation) *) + replace (H_f 0 + x) with (x + H_f 0) in H_ass_l by apply add_commut ; + transitivity (x + H_f 0) ; assumption + end + end). + + +Goal forall x y, Nat.add x y <= Nat.add x (y + y + x + x). + intros. + solve_split_goal. +Qed. + (* File automatically generated by Hacspec *) Set Warnings "-notation-overridden,-ambiguous-paths". From Crypt Require Import choice_type Package Prelude. @@ -27,6 +80,8 @@ Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. Require Import Hacspec_ovn_Ovn_traits. Export Hacspec_ovn_Ovn_traits. + + (*Not implemented yet? todo(item)*) (*Not implemented yet? todo(item)*) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v index c96962f..126fc0c 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v @@ -57,7 +57,7 @@ Hint Unfold f_add_loc. Hint Unfold f_sub_loc. Hint Unfold f_mul_loc. -Class t_Group (Self : choice_type) := { +Class t_Group (Self : choice_type) `{t_Z_Field} := { f_group_type : choice_type ; f_group_type_t_Serialize :> t_Serialize (f_group_type) ; f_group_type_t_Deserial :> t_Deserial (f_group_type) ; diff --git a/ovn/proofs/ssprove/extraction/Makefile b/ovn/proofs/ssprove/extraction/Makefile index ac7ef75..42626b6 100644 --- a/ovn/proofs/ssprove/extraction/Makefile +++ b/ovn/proofs/ssprove/extraction/Makefile @@ -7,7 +7,7 @@ ## # GNU Lesser General Public License Version 2.1 ## ## # (see LICENSE file for the text of the license) ## ########################################################################## -## GNUMakefile for Coq 8.15.2 +## GNUMakefile for Coq 8.18.0 # For debugging purposes (must stay here, don't move below) INITIAL_VARS := $(.VARIABLES) @@ -26,6 +26,7 @@ MLFILES := $(COQMF_MLFILES) MLGFILES := $(COQMF_MLGFILES) MLPACKFILES := $(COQMF_MLPACKFILES) MLLIBFILES := $(COQMF_MLLIBFILES) +METAFILE := $(COQMF_METAFILE) CMDLINE_VFILES := $(COQMF_CMDLINE_VFILES) INSTALLCOQDOCROOT := $(COQMF_INSTALLCOQDOCROOT) OTHERFLAGS := $(COQMF_OTHERFLAGS) @@ -59,12 +60,12 @@ Makefile.conf: _CoqProject # practice is discouraged since _CoqProject better not contain make specific # code (be nice to user interfaces). -# set KEEP_ERROR to prevent make from deleting files produced by failing rules. -# For instance if coqc creates a .vo but then fails to native compile, -# the .vo will be deleted unless KEEP_ERROR is nonempty. +# Set KEEP_ERROR to have make keep files produced by failing rules. +# By default, KEEP_ERROR is empty. So for instance if coqc creates a .vo but +# then fails to native compile, the .vo will be deleted. # May confuse make so use only for debugging. KEEP_ERROR?= -ifneq (,$(KEEP_ERROR)) +ifeq (,$(KEEP_ERROR)) .DELETE_ON_ERROR: endif @@ -75,7 +76,7 @@ VERBOSE ?= TIMED?= TIMECMD?= # Use command time on linux, gtime on Mac OS -TIMEFMT?="$@ (real: %e, user: %U, sys: %S, mem: %M ko)" +TIMEFMT?="$(if $(findstring undefined, $(flavor 1)),$@,$(1)) (real: %e, user: %U, sys: %S, mem: %M ko)" ifneq (,$(TIMED)) ifeq (0,$(shell command time -f "" true >/dev/null 2>/dev/null; echo $$?)) STDTIME?=command time -f $(TIMEFMT) @@ -114,14 +115,11 @@ COQMAKE_BOTH_SINGLE_TIMING_FILES ?= "$(COQCORELIB)/tools/make-both-single-timing BEFORE ?= AFTER ?= -# FIXME this should be generated by Coq (modules already linked by Coq) -CAMLDONTLINK=str,unix,dynlink,threads,zarith - # OCaml binaries CAMLC ?= "$(OCAMLFIND)" ocamlc -c CAMLOPTC ?= "$(OCAMLFIND)" opt -c -CAMLLINK ?= "$(OCAMLFIND)" ocamlc -linkpkg -dontlink $(CAMLDONTLINK) -CAMLOPTLINK ?= "$(OCAMLFIND)" opt -linkpkg -dontlink $(CAMLDONTLINK) +CAMLLINK ?= "$(OCAMLFIND)" ocamlc -linkall +CAMLOPTLINK ?= "$(OCAMLFIND)" opt -linkall CAMLDOC ?= "$(OCAMLFIND)" ocamldoc CAMLDEP ?= "$(OCAMLFIND)" ocamldep -slash -ml-synonym .mlpack @@ -134,6 +132,7 @@ COQDEBUG ?= # Extra packages to be linked in (as in findlib -package) CAMLPKGS ?= +FINDLIBPKGS = -package coq-core.plugins.ltac $(CAMLPKGS) # Option for making timing files TIMING?= @@ -170,8 +169,30 @@ destination_path = $(if $(DESTDIR),$(DESTDIR)/$(call windrive_path,$(1)),$(1)) # Installation paths of libraries and documentation. COQLIBINSTALL ?= $(call destination_path,$(COQLIB)/user-contrib) COQDOCINSTALL ?= $(call destination_path,$(DOCDIR)/coq/user-contrib) +COQPLUGININSTALL ?= $(call destination_path,$(COQCORELIB)/..) COQTOPINSTALL ?= $(call destination_path,$(COQLIB)/toploop) # FIXME: Unused variable? +# findlib files installation +FINDLIBPREINST= mkdir -p "$(COQPLUGININSTALL)/" +FINDLIBDESTDIR= -destdir "$(COQPLUGININSTALL)/" + +# we need to move out of sight $(METAFILE) otherwise findlib thinks the +# package is already installed +findlib_install = \ + $(HIDE)if [ "$(METAFILE)" ]; then \ + $(FINDLIBPREINST) && \ + mv "$(METAFILE)" "$(METAFILE).skip" ; \ + "$(OCAMLFIND)" install $(2) $(FINDLIBDESTDIR) $(FINDLIBPACKAGE) $(1); \ + rc=$$?; \ + mv "$(METAFILE).skip" "$(METAFILE)"; \ + exit $$rc; \ + fi +findlib_remove = \ + $(HIDE)if [ ! -z "$(METAFILE)" ]; then\ + "$(OCAMLFIND)" remove $(FINDLIBDESTDIR) $(FINDLIBPACKAGE); \ + fi + + ########## End of parameters ################################################## # What follows may be relevant to you only if you need to # extend this Makefile. If so, look for 'Extension point' here and @@ -257,14 +278,14 @@ COQDOCLIBS?=$(COQLIBS_NOML) # The version of Coq being run and the version of coq_makefile that # generated this makefile COQ_VERSION:=$(shell $(COQC) --print-version | cut -d " " -f 1) -COQMAKEFILE_VERSION:=8.15.2 +COQMAKEFILE_VERSION:=8.18.0 # COQ_SRC_SUBDIRS is for user-overriding, usually to add # `user-contrib/Foo` to the includes, we keep COQCORE_SRC_SUBDIRS for # Coq's own core libraries, which should be replaced by ocamlfind # options at some point. COQ_SRC_SUBDIRS?= -COQSRCLIBS?= $(foreach d,$(COQCORE_SRC_SUBDIRS), -I "$(COQCORELIB)/$(d)") $(foreach d,$(COQ_SRC_SUBDIRS), -I "$(COQLIB)/$(d)") +COQSRCLIBS?= $(foreach d,$(COQ_SRC_SUBDIRS), -I "$(COQLIB)/$(d)") CAMLFLAGS+=$(OCAMLLIBS) $(COQSRCLIBS) # ocamldoc fails with unknown argument otherwise @@ -272,18 +293,18 @@ CAMLDOCFLAGS:=$(filter-out -annot, $(filter-out -bin-annot, $(CAMLFLAGS))) CAMLFLAGS+=$(OCAMLWARN) ifneq (,$(TIMING)) -TIMING_ARG=-time -ifeq (after,$(TIMING)) -TIMING_EXT=after-timing -else -ifeq (before,$(TIMING)) -TIMING_EXT=before-timing -else -TIMING_EXT=timing -endif -endif + ifeq (after,$(TIMING)) + TIMING_EXT=after-timing + else + ifeq (before,$(TIMING)) + TIMING_EXT=before-timing + else + TIMING_EXT=timing + endif + endif + TIMING_ARG=-time-file $<.$(TIMING_EXT) else -TIMING_ARG= + TIMING_ARG= endif # Files ####################################################################### @@ -358,6 +379,8 @@ ALLNATIVEFILES = \ $(OBJFILES:.o=.cmi) \ $(OBJFILES:.o=.cmx) \ $(OBJFILES:.o=.cmxs) +FINDLIBPACKAGE=$(patsubst .%,%,$(suffix $(METAFILE))) + # trick: wildcard filters out non-existing files, so that `install` doesn't show # warnings and `clean` doesn't pass to rm a list of files that is too long for # the shell. @@ -367,13 +390,12 @@ FILESTOINSTALL = \ $(VFILES) \ $(GLOBFILES) \ $(NATIVEFILES) \ + $(CMXSFILES) # to be removed when we remove legacy loading +FINDLIBFILESTOINSTALL = \ $(CMIFILESTOINSTALL) -BYTEFILESTOINSTALL = \ - $(CMOFILESTOINSTALL) \ - $(CMAFILES) ifeq '$(HASNATDYNLINK)' 'true' DO_NATDYNLINK = yes -FILESTOINSTALL += $(CMXSFILES) $(CMXAFILES) $(CMOFILESTOINSTALL:.cmo=.cmx) +FINDLIBFILESTOINSTALL += $(CMXSFILES) $(CMXAFILES) $(CMOFILESTOINSTALL:.cmo=.cmx) else DO_NATDYNLINK = endif @@ -529,12 +551,12 @@ mlihtml: $(MLIFILES:.mli=.cmi) $(SHOW)'CAMLDOC -d $@' $(HIDE)mkdir $@ || rm -rf $@/* $(HIDE)$(CAMLDOC) -html \ - -d $@ -m A $(CAMLDEBUG) $(CAMLDOCFLAGS) $(MLIFILES) + -d $@ -m A $(CAMLDEBUG) $(CAMLDOCFLAGS) $(MLIFILES) $(FINDLIBPKGS) all-mli.tex: $(MLIFILES:.mli=.cmi) $(SHOW)'CAMLDOC -latex $@' $(HIDE)$(CAMLDOC) -latex \ - -o $@ -m A $(CAMLDEBUG) $(CAMLDOCFLAGS) $(MLIFILES) + -o $@ -m A $(CAMLDEBUG) $(CAMLDOCFLAGS) $(MLIFILES) $(FINDLIBPKGS) all.ps: $(VFILES) $(SHOW)'COQDOC -ps $(GAL)' @@ -570,11 +592,24 @@ beautify: $(BEAUTYFILES) # There rules can be extended in Makefile.local # Extensions can't assume when they run. -install: - $(HIDE)code=0; for f in $(FILESTOINSTALL); do\ +# We use $(file) to avoid generating a very long command string to pass to the shell +# (cf https://coq.zulipchat.com/#narrow/stream/250632-Coq-Platform-devs-.26-users/topic/Strange.20command.20length.20limit.20on.20Linux) +# However Apple ships old make which doesn't have $(file) so we need a fallback +$(file >.hasfile,1) +HASFILE:=$(shell if [ -e .hasfile ]; then echo 1; rm .hasfile; fi) + +MKFILESTOINSTALL= $(if $(HASFILE),$(file >.filestoinstall,$(FILESTOINSTALL)),\ + $(shell rm -f .filestoinstall) \ + $(foreach x,$(FILESTOINSTALL),$(shell printf '%s\n' "$x" >> .filestoinstall))) + +# findlib needs the package to not be installed, so we remove it before +# installing it (see the call to findlib_remove) +install: META + @$(MKFILESTOINSTALL) + $(HIDE)code=0; for f in $$(cat .filestoinstall); do\ if ! [ -f "$$f" ]; then >&2 echo $$f does not exist; code=1; fi \ done; exit $$code - $(HIDE)for f in $(FILESTOINSTALL); do\ + $(HIDE)for f in $$(cat .filestoinstall); do\ df="`$(COQMKFILE) -destination-of "$$f" $(COQLIBS)`";\ if [ "$$?" != "0" -o -z "$$df" ]; then\ echo SKIP "$$f" since it has no logical path;\ @@ -584,22 +619,21 @@ install: echo INSTALL "$$f" "$(COQLIBINSTALL)/$$df";\ fi;\ done + $(call findlib_remove) + $(call findlib_install, META $(FINDLIBFILESTOINSTALL)) $(HIDE)$(MAKE) install-extra -f "$(SELF)" + @rm -f .filestoinstall install-extra:: @# Extension point .PHONY: install install-extra +META: $(METAFILE) + $(HIDE)if [ "$(METAFILE)" ]; then \ + cat "$(METAFILE)" | grep -v 'directory.*=.*' > META; \ + fi + install-byte: - $(HIDE)for f in $(BYTEFILESTOINSTALL); do\ - df="`$(COQMKFILE) -destination-of "$$f" $(COQLIBS)`";\ - if [ "$$?" != "0" -o -z "$$df" ]; then\ - echo SKIP "$$f" since it has no logical path;\ - else\ - install -d "$(COQLIBINSTALL)/$$df" &&\ - install -m 0644 "$$f" "$(COQLIBINSTALL)/$$df" &&\ - echo INSTALL "$$f" "$(COQLIBINSTALL)/$$df";\ - fi;\ - done + $(call findlib_install, $(CMAFILES) $(CMOFILESTOINSTALL), -add) install-doc:: html mlihtml @# Extension point @@ -620,13 +654,21 @@ install-doc:: html mlihtml uninstall:: @# Extension point - $(HIDE)for f in $(FILESTOINSTALL); do \ + @$(MKFILESTOINSTALL) + $(call findlib_remove) + $(HIDE)for f in $$(cat .filestoinstall); do \ df="`$(COQMKFILE) -destination-of "$$f" $(COQLIBS)`" &&\ instf="$(COQLIBINSTALL)/$$df/`basename $$f`" &&\ rm -f "$$instf" &&\ - echo RM "$$instf" &&\ + echo RM "$$instf" ;\ + done + $(HIDE)for f in $$(cat .filestoinstall); do \ + df="`$(COQMKFILE) -destination-of "$$f" $(COQLIBS)`" &&\ + echo RMDIR "$(COQLIBINSTALL)/$$df/" &&\ (rmdir "$(COQLIBINSTALL)/$$df/" 2>/dev/null || true); \ done + @rm -f .filestoinstall + .PHONY: uninstall uninstall-doc:: @@ -649,12 +691,14 @@ clean:: $(HIDE)rm -f $(CMOFILES) $(HIDE)rm -f $(CMIFILES) $(HIDE)rm -f $(CMAFILES) - $(HIDE)rm -f $(CMOFILES:.cmo=.cmx) + $(HIDE)rm -f $(CMXFILES) $(HIDE)rm -f $(CMXAFILES) $(HIDE)rm -f $(CMXSFILES) - $(HIDE)rm -f $(CMOFILES:.cmo=.o) + $(HIDE)rm -f $(OFILES) $(HIDE)rm -f $(CMXAFILES:.cmxa=.a) $(HIDE)rm -f $(MLGFILES:.mlg=.ml) + $(HIDE)rm -f $(CMXFILES:.cmx=.cmt) + $(HIDE)rm -f $(MLIFILES:.mli=.cmti) $(HIDE)rm -f $(ALLDFILES) $(HIDE)rm -f $(NATIVEFILES) $(HIDE)find . -name .coq-native -type d -empty -delete @@ -668,6 +712,7 @@ clean:: $(HIDE)rm -f $(VFILES:.v=.tex) $(HIDE)rm -f $(VFILES:.v=.g.tex) $(HIDE)rm -f pretty-timed-success.ok + $(HIDE)rm -f META $(HIDE)rm -rf html mlihtml .PHONY: clean @@ -695,7 +740,7 @@ archclean:: $(MLIFILES:.mli=.cmi): %.cmi: %.mli $(SHOW)'CAMLC -c $<' - $(HIDE)$(TIMER) $(CAMLC) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) $< + $(HIDE)$(TIMER) $(CAMLC) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) $< $(MLGFILES:.mlg=.ml): %.ml: %.mlg $(SHOW)'COQPP $<' @@ -704,72 +749,92 @@ $(MLGFILES:.mlg=.ml): %.ml: %.mlg # Stupid hack around a deficient syntax: we cannot concatenate two expansions $(filter %.cmo, $(MLFILES:.ml=.cmo) $(MLGFILES:.mlg=.cmo)): %.cmo: %.ml $(SHOW)'CAMLC -c $<' - $(HIDE)$(TIMER) $(CAMLC) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) $< + $(HIDE)$(TIMER) $(CAMLC) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) $< # Same hack $(filter %.cmx, $(MLFILES:.ml=.cmx) $(MLGFILES:.mlg=.cmx)): %.cmx: %.ml $(SHOW)'CAMLOPT -c $(FOR_PACK) $<' - $(HIDE)$(TIMER) $(CAMLOPTC) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) $(FOR_PACK) $< + $(HIDE)$(TIMER) $(CAMLOPTC) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) $(FOR_PACK) $< $(MLLIBFILES:.mllib=.cmxs): %.cmxs: %.cmxa $(SHOW)'CAMLOPT -shared -o $@' - $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) \ - -linkall -shared -o $@ $< + $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) \ + -shared -o $@ $< $(MLLIBFILES:.mllib=.cma): %.cma: | %.mllib $(SHOW)'CAMLC -a -o $@' - $(HIDE)$(TIMER) $(CAMLLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) -a -o $@ $^ + $(HIDE)$(TIMER) $(CAMLLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) -a -o $@ $^ $(MLLIBFILES:.mllib=.cmxa): %.cmxa: | %.mllib $(SHOW)'CAMLOPT -a -o $@' - $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) -a -o $@ $^ + $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) -a -o $@ $^ $(MLPACKFILES:.mlpack=.cmxs): %.cmxs: %.cmxa $(SHOW)'CAMLOPT -shared -o $@' - $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) \ - -shared -linkall -o $@ $< + $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) \ + -shared -o $@ $< -$(MLPACKFILES:.mlpack=.cmxa): %.cmxa: %.cmx +$(MLPACKFILES:.mlpack=.cmxa): %.cmxa: %.cmx | %.mlpack $(SHOW)'CAMLOPT -a -o $@' - $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) -a -o $@ $< + $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) -a -o $@ $< $(MLPACKFILES:.mlpack=.cma): %.cma: %.cmo | %.mlpack $(SHOW)'CAMLC -a -o $@' - $(HIDE)$(TIMER) $(CAMLLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) -a -o $@ $^ + $(HIDE)$(TIMER) $(CAMLLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) -a -o $@ $^ $(MLPACKFILES:.mlpack=.cmo): %.cmo: | %.mlpack $(SHOW)'CAMLC -pack -o $@' - $(HIDE)$(TIMER) $(CAMLLINK) $(CAMLDEBUG) $(CAMLFLAGS) -pack -o $@ $^ + $(HIDE)$(TIMER) $(CAMLLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) -pack -o $@ $^ $(MLPACKFILES:.mlpack=.cmx): %.cmx: | %.mlpack $(SHOW)'CAMLOPT -pack -o $@' - $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) -pack -o $@ $^ + $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) -pack -o $@ $^ # This rule is for _CoqProject with no .mllib nor .mlpack $(filter-out $(MLLIBFILES:.mllib=.cmxs) $(MLPACKFILES:.mlpack=.cmxs) $(addsuffix .cmxs,$(PACKEDFILES)) $(addsuffix .cmxs,$(LIBEDFILES)),$(MLFILES:.ml=.cmxs) $(MLGFILES:.mlg=.cmxs)): %.cmxs: %.cmx $(SHOW)'[deprecated,use-mllib-or-mlpack] CAMLOPT -shared -o $@' - $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) \ + $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) \ -shared -o $@ $< -ifneq (,$(TIMING)) -TIMING_EXTRA = > $<.$(TIMING_EXT) -else -TIMING_EXTRA = +# can't make +# https://www.gnu.org/software/make/manual/make.html#Static-Pattern +# work with multiple target rules +# so use eval in a loop instead +# with grouped targets https://www.gnu.org/software/make/manual/make.html#Multiple-Targets +# if available (GNU Make >= 4.3) +ifneq (,$(filter grouped-target,$(.FEATURES))) +define globvorule= + +# take care to $$ variables using $< etc + $(1).vo $(1).glob &: $(1).v | $(VDFILE) + $(SHOW)COQC $(1).v + $(HIDE)$$(TIMER) $(COQC) $(COQDEBUG) $$(TIMING_ARG) $(COQFLAGS) $(COQLIBS) $(1).v +ifeq ($(COQDONATIVE), "yes") + $(SHOW)COQNATIVE $(1).vo + $(HIDE)$(call TIMER,$(1).vo.native) $(COQNATIVE) $(COQLIBS) $(1).vo endif +endef +else + $(VOFILES): %.vo: %.v | $(VDFILE) $(SHOW)COQC $< - $(HIDE)$(TIMER) $(COQC) $(COQDEBUG) $(TIMING_ARG) $(COQFLAGS) $(COQLIBS) $< $(TIMING_EXTRA) + $(HIDE)$(TIMER) $(COQC) $(COQDEBUG) $(TIMING_ARG) $(COQFLAGS) $(COQLIBS) $< ifeq ($(COQDONATIVE), "yes") $(SHOW)COQNATIVE $@ - $(HIDE)$(COQNATIVE) $(COQLIBS) $@ + $(HIDE)$(call TIMER,$@.native) $(COQNATIVE) $(COQLIBS) $@ endif -# FIXME ?merge with .vo / .vio ? +# this is broken :( todo fix if we ever find a solution that doesn't need grouped targets $(GLOBFILES): %.glob: %.v - $(TIMER) $(COQC) $(COQDEBUG) $(COQFLAGS) $(COQLIBS) $< + $(SHOW)'COQC $< (for .glob)' + $(HIDE)$(TIMER) $(COQC) $(COQDEBUG) $(COQFLAGS) $(COQLIBS) $< + +endif + +$(foreach vfile,$(VFILES:.v=),$(eval $(call globvorule,$(vfile)))) $(VFILES:.v=.vio): %.vio: %.v $(SHOW)COQC -vio $< @@ -851,7 +916,7 @@ VDFILE_FLAGS:=$(if _CoqProject,-f _CoqProject,) $(CMDLINE_COQLIBS) $(CMDLINE_VFI $(VDFILE): _CoqProject $(VFILES) $(SHOW)'COQDEP VFILES' - $(HIDE)$(COQDEP) -vos -dyndep var $(VDFILE_FLAGS) $(redir_if_ok) + $(HIDE)$(COQDEP) $(if $(strip $(METAFILE)),-m "$(METAFILE)") -vos -dyndep var $(VDFILE_FLAGS) $(redir_if_ok) # Misc ######################################################################## From 9e421eb7cf6cca013466cb9d56b6b205e40dc275 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 14 Feb 2024 21:08:57 +0100 Subject: [PATCH 58/86] WIP ovn --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 128 ++++++++++++++++++-- 1 file changed, 120 insertions(+), 8 deletions(-) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index e66b965..b2e3981 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -353,7 +353,7 @@ Equations schnorr_zkp_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 solve_lift f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both (L1 :|: L2 :|: (* f_eq_loc :|: *)f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc) (I1 :|: I2) ('bool). Fail Next Obligation. -Obligation Tactic := try timeout 2 solve_ssprove_obligations. +Obligation Tactic := try timeout 1 solve_ssprove_obligations. Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both L1 I1 (int32)) (random_r : both L2 I2 (int32)) (random_d : both L3 I3 (int32)) (h : both L4 I4 (f_group_type)) (xi : both L5 I5 (f_field_type)) (vi : both L6 I6 ('bool)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: (* f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: *)f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) := zkp_one_out_of_two random_w random_r random_d h xi vi := letb w := f_random_field_elem random_w in @@ -391,10 +391,9 @@ Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : solve_lift b2])))) in letb d1 := f_sub c d2 in letb r1 := f_sub w (f_mul xi d1) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: (* f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: *) f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)). -Admit Obligations. (* Slow *) + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: (* f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: *) f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)). +Admit Obligations. (* slow *) (* Solve All Obligations with solve_ssprove_obligations. *) Fail Next Obligation. -Obligation Tactic := (* try timeout 2 *) solve_ssprove_obligations. Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (zkp : both L2 I2 (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 (* :|: f_eq_loc *) :|: f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_add_loc) (I1 :|: I2) ('bool) := zkp_one_out_of_two_validate h zkp := @@ -460,7 +459,15 @@ Definition cast_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *);2%nat). Notation Result_Ok_case := inl. Notation Result_Err_case := inr. -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := +(* Obligation Tactic := try timeout 2 solve_ssprove_obligations. *) +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] :|: + Hacspec_ovn_Ovn_traits.f_div_loc :|: + Hacspec_ovn_Ovn_traits.f_group_one_loc :|: + Hacspec_ovn_Ovn_traits.f_prod_loc :|: + Hacspec_ovn_Ovn_traits.f_g_pow_loc :|: + Hacspec_ovn_Ovn_traits.f_pow_loc :|: + Hacspec_ovn_Ovn_traits.f_field_one_loc :|: + Hacspec_ovn_Ovn_traits.f_field_zero_loc (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := cast_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with @@ -477,12 +484,117 @@ Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interfac letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in letb _ := letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := U32) (f_cvp_i params)) g_pow_xi_yi_vi) in - solve_lift ret_both tt (* assign body todo(term) *) in + solve_lift ret_both tt (* assign body todo(term) *) : both (L1 :|: L2 :|: + fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc] :|: Hacspec_ovn_Ovn_traits.f_div_loc :|: + Hacspec_ovn_Ovn_traits.f_group_one_loc :|: + Hacspec_ovn_Ovn_traits.f_prod_loc :|: + Hacspec_ovn_Ovn_traits.f_g_pow_loc :|: + Hacspec_ovn_Ovn_traits.f_pow_loc :|: + Hacspec_ovn_Ovn_traits.f_field_one_loc :|: + Hacspec_ovn_Ovn_traits.f_field_zero_loc (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) _ _ in letb _ := letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := U32) (f_cvp_i params)) zkp_vi) in - solve_lift ret_both tt (* assign body todo(term) *) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). + solve_lift ret_both tt (* assign body todo(term) *) : both (L1 :|: L2 :|: + fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc] :|: Hacspec_ovn_Ovn_traits.f_div_loc :|: + Hacspec_ovn_Ovn_traits.f_group_one_loc :|: + Hacspec_ovn_Ovn_traits.f_prod_loc :|: + Hacspec_ovn_Ovn_traits.f_g_pow_loc :|: + Hacspec_ovn_Ovn_traits.f_pow_loc :|: + Hacspec_ovn_Ovn_traits.f_field_one_loc :|: + Hacspec_ovn_Ovn_traits.f_field_zero_loc (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) _ _ in + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (L1 :|: L2 :|: + fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc] :|: Hacspec_ovn_Ovn_traits.f_div_loc :|: + Hacspec_ovn_Ovn_traits.f_group_one_loc :|: + Hacspec_ovn_Ovn_traits.f_prod_loc :|: + Hacspec_ovn_Ovn_traits.f_g_pow_loc :|: + Hacspec_ovn_Ovn_traits.f_pow_loc :|: + Hacspec_ovn_Ovn_traits.f_field_one_loc :|: + Hacspec_ovn_Ovn_traits.f_field_zero_loc (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). +Next Obligation. + intros. + autounfold. + solve_ssprove_obligations. +Qed. +Next Obligation. + solve_ssprove_obligations. +Qed. +Next Obligation. + solve_ssprove_obligations. +Qed. +Next Obligation. + solve_ssprove_obligations. +Qed. +Next Obligation. + solve_ssprove_obligations. +Qed. +Next Obligation. + solve_ssprove_obligations. +Qed. +Next Obligation. + solve_ssprove_obligations. +Qed. +Next Obligation. + solve_ssprove_obligations. +Qed. +Next Obligation. + refine (solve_lift ret_both 0). + solve_ssprove_obligations. + rewrite fset0E. + solve_ssprove_obligations. +Qed. +Next Obligation. + refine (solve_lift ret_both 0). + solve_ssprove_obligations. + rewrite fset0E. + solve_ssprove_obligations. +Qed. +Next Obligation. + refine (solve_lift ret_both 0). + solve_ssprove_obligations. + rewrite fset0E. + solve_ssprove_obligations. +Qed. +Next Obligation. + simpl. + intros. + unfold cast_vote_obligations_obligation_5. + destruct H5. + destruct H4. + split_fsubset_lhs. + now solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. + solve_single_fset_fsubset. +Qed. + +Solve All Obligations with solve_ssprove_obligations. Admit Obligations. (* TODO: fix *) Fail Next Obligation. +Obligation Tactic := (* try timeout 2 *) solve_ssprove_obligations. Definition commit_to_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *);3%nat). From f7fa611a3910a906124162702f33143fee8e7be2 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Thu, 15 Feb 2024 14:13:15 +0100 Subject: [PATCH 59/86] WIP --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 512 +++++++++++++------- 1 file changed, 338 insertions(+), 174 deletions(-) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index b2e3981..21500ef 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -395,6 +395,7 @@ Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : Admit Obligations. (* slow *) (* Solve All Obligations with solve_ssprove_obligations. *) Fail Next Obligation. +Obligation Tactic := try timeout 4 solve_ssprove_obligations. Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (zkp : both L2 I2 (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 (* :|: f_eq_loc *) :|: f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_add_loc) (I1 :|: I2) ('bool) := zkp_one_out_of_two_validate h zkp := letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; @@ -460,14 +461,15 @@ Definition cast_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset Notation Result_Ok_case := inl. Notation Result_Err_case := inr. (* Obligation Tactic := try timeout 2 solve_ssprove_obligations. *) -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] :|: - Hacspec_ovn_Ovn_traits.f_div_loc :|: - Hacspec_ovn_Ovn_traits.f_group_one_loc :|: - Hacspec_ovn_Ovn_traits.f_prod_loc :|: - Hacspec_ovn_Ovn_traits.f_g_pow_loc :|: - Hacspec_ovn_Ovn_traits.f_pow_loc :|: - Hacspec_ovn_Ovn_traits.f_field_one_loc :|: - Hacspec_ovn_Ovn_traits.f_field_zero_loc (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: + f_div_loc :|: + f_group_one_loc :|: + f_prod_loc :|: + f_g_pow_loc :|: + f_g_loc :|: f_hash_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc :|: + f_pow_loc :|: + f_field_one_loc :|: + f_field_zero_loc :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := cast_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with @@ -482,63 +484,120 @@ Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interfac ControlFlow_Continue (letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := U32) (f_cvp_i params)) (f_g_pow_xis state) in letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in - letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in - letb _ := letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := U32) (f_cvp_i params)) g_pow_xi_yi_vi) in + letb cast_vote_state_ret loc(cast_vote_state_ret_loc (n := n)) := f_clone state in + letb _ := letb cast_vote_state_ret loc(cast_vote_state_ret_loc (n := n)) := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := U32) (f_cvp_i params)) g_pow_xi_yi_vi)(* : both (L1 :|: L2 :|: *) + (* f_div_loc :|: *) + (* f_group_one_loc :|: *) + (* f_prod_loc :|: *) + (* f_g_pow_loc :|: *) + (* f_g_loc :|: f_hash_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc :|: *) + (* f_pow_loc :|: *) + (* f_field_one_loc :|: *) + (* f_field_zero_loc :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) ((t_OvnContractState (n := n))) *) in solve_lift ret_both tt (* assign body todo(term) *) : both (L1 :|: L2 :|: - fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc] :|: Hacspec_ovn_Ovn_traits.f_div_loc :|: - Hacspec_ovn_Ovn_traits.f_group_one_loc :|: - Hacspec_ovn_Ovn_traits.f_prod_loc :|: - Hacspec_ovn_Ovn_traits.f_g_pow_loc :|: - Hacspec_ovn_Ovn_traits.f_pow_loc :|: - Hacspec_ovn_Ovn_traits.f_field_one_loc :|: - Hacspec_ovn_Ovn_traits.f_field_zero_loc (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) _ _ in - letb _ := letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := U32) (f_cvp_i params)) zkp_vi) in + f_div_loc :|: + f_group_one_loc :|: + f_prod_loc :|: + f_g_pow_loc :|: + f_g_loc :|: f_hash_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc :|: + f_pow_loc :|: + f_field_one_loc :|: + f_field_zero_loc :|: + fset [cast_vote_state_ret_loc (n := n);prod1_loc;prod2_loc] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) _ _ in + letb _ := letb cast_vote_state_ret loc(cast_vote_state_ret_loc (n := n)) := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := U32) (f_cvp_i params)) zkp_vi)(* : both (L1 :|: L2 :|: *) + (* f_div_loc :|: *) + (* f_group_one_loc :|: *) + (* f_prod_loc :|: *) + (* f_g_pow_loc :|: *) + (* f_g_loc :|: f_hash_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc :|: *) + (* f_pow_loc :|: *) + (* f_field_one_loc :|: *) + (* f_field_zero_loc :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_OvnContractState (n := n)) *) in solve_lift ret_both tt (* assign body todo(term) *) : both (L1 :|: L2 :|: - fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc] :|: Hacspec_ovn_Ovn_traits.f_div_loc :|: - Hacspec_ovn_Ovn_traits.f_group_one_loc :|: - Hacspec_ovn_Ovn_traits.f_prod_loc :|: - Hacspec_ovn_Ovn_traits.f_g_pow_loc :|: - Hacspec_ovn_Ovn_traits.f_pow_loc :|: - Hacspec_ovn_Ovn_traits.f_field_one_loc :|: - Hacspec_ovn_Ovn_traits.f_field_zero_loc (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) _ _ in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (L1 :|: L2 :|: - fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc] :|: Hacspec_ovn_Ovn_traits.f_div_loc :|: - Hacspec_ovn_Ovn_traits.f_group_one_loc :|: - Hacspec_ovn_Ovn_traits.f_prod_loc :|: - Hacspec_ovn_Ovn_traits.f_g_pow_loc :|: - Hacspec_ovn_Ovn_traits.f_pow_loc :|: - Hacspec_ovn_Ovn_traits.f_field_one_loc :|: - Hacspec_ovn_Ovn_traits.f_field_zero_loc (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). + f_div_loc :|: + f_group_one_loc :|: + f_prod_loc :|: + f_g_pow_loc :|: + f_g_loc :|: f_hash_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc :|: + f_pow_loc :|: + f_field_one_loc :|: + f_field_zero_loc :|: + fset [cast_vote_state_ret_loc (n := n);prod1_loc;prod2_loc] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) _ _ in + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (L1 :|: L2 :|: f_div_loc :|: + f_group_one_loc :|: + f_prod_loc :|: + f_g_pow_loc :|: + f_g_loc :|: f_hash_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc :|: + f_pow_loc :|: + f_field_one_loc :|: + f_field_zero_loc :|: + fset [cast_vote_state_ret_loc (n := n);prod1_loc;prod2_loc] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). Next Obligation. intros. - autounfold. + simpl. + unfold cast_vote_obligations_obligation_1. + unfold cast_vote_obligations_obligation_7. solve_ssprove_obligations. Qed. Next Obligation. + intros. + simpl. + unfold cast_vote_obligations_obligation_2. + unfold cast_vote_obligations_obligation_9. solve_ssprove_obligations. Qed. Next Obligation. - solve_ssprove_obligations. + intros. + simpl. + unfold cast_vote_obligations_obligation_7. +solve_ssprove_obligations. Qed. Next Obligation. + intros. + simpl. + unfold cast_vote_obligations_obligation_9. solve_ssprove_obligations. Qed. Next Obligation. + intros. + simpl. + unfold cast_vote_obligations_obligation_3. + unfold cast_vote_obligations_obligation_5. solve_ssprove_obligations. Qed. Next Obligation. + intros. + simpl. + unfold cast_vote_obligations_obligation_4. + unfold cast_vote_obligations_obligation_6. solve_ssprove_obligations. Qed. Next Obligation. + intros. + simpl. + unfold cast_vote_obligations_obligation_3. + unfold cast_vote_obligations_obligation_5. solve_ssprove_obligations. Qed. Next Obligation. + intros. + simpl. + unfold cast_vote_obligations_obligation_4. + unfold cast_vote_obligations_obligation_6. solve_ssprove_obligations. Qed. Next Obligation. - refine (solve_lift ret_both 0). + intros. + simpl. + unfold cast_vote_obligations_obligation_1. + unfold cast_vote_obligations_obligation_5. solve_ssprove_obligations. - rewrite fset0E. +Qed. +Next Obligation. + intros. + simpl. + unfold cast_vote_obligations_obligation_2. + unfold cast_vote_obligations_obligation_6. solve_ssprove_obligations. Qed. Next Obligation. @@ -559,147 +618,252 @@ Next Obligation. unfold cast_vote_obligations_obligation_5. destruct H5. destruct H4. - split_fsubset_lhs. - now solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. - solve_single_fset_fsubset. -Qed. - -Solve All Obligations with solve_ssprove_obligations. -Admit Obligations. (* TODO: fix *) -Fail Next Obligation. -Obligation Tactic := (* try timeout 2 *) solve_ssprove_obligations. - -Definition commit_to_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *);3%nat). -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := - commit_to_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with - | Result_Ok_case x => - letb x := ret_both ((x) (* : (t_CastVoteParam (v_Z)) *)) in - ControlFlow_Continue (solve_lift x) - | Result_Err_case x => - letb x := ret_both ((x) : (t_ParseError)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist3 := v_Break (Result_Err _ (* ParseError *)) in - ControlFlow_Continue (solve_lift (never_to_any hoist3)) - end in - ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => - ssp (fun _ => - solve_lift (ifb (* not *) negb (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist4 := v_Break (Result_Err _ (* ParseError *)) in - ControlFlow_Continue (never_to_any hoist4) - else Result_Ok (solve_lift ret_both tt)) : both (*0*)(L2:|:fset []) (I2) (* ((* t_ControlFlow *) t_Result (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) ('unit)) *) _)) (Result_Ok (solve_lift ret_both (tt : 'unit))) in - letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := U32) (f_cvp_i params)) (f_g_pow_xis state) in - letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in - letb commit_vi := commit_to g_pow_xi_yi_vi in - letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in - letb _ := letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := U32) (f_cvp_i params)) commit_vi) in - solve_lift ret_both tt (* assign body todo(term) *) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc] (* :|: f_get_loc :|: f_clone_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). -Admit Obligations. -Fail Next Obligation. - -Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both L1 I1 ('unit)) : both (L1 (* :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_commit_vis_loc :|: f_g_pow_xi_yi_vis_loc :|: f_g_pow_xis_loc :|: f_tally_loc :|: f_zkp_vis_loc :|: f_zkp_xis_loc :|: f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc *) :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *)) (t_Reject)) := - init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_field_zero (ret_both (tt : 'unit))) (f_schnorr_zkp_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_y := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_c := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d2 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both (L1 (* :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_commit_vis_loc :|: f_g_pow_xi_yi_vis_loc :|: f_g_pow_xis_loc :|: f_tally_loc :|: f_zkp_vis_loc :|: f_zkp_xis_loc :|: f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc *) :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *)) (t_Reject)). + solve_ssprove_obligations. +Qed. +Next Obligation. + simpl. + intros. + unfold cast_vote_obligations_obligation_6. + unfold cast_vote_obligations_obligation_27. + solve_ssprove_obligations. +Qed. +Solve All Obligations with timeout 2 ( solve_ssprove_obligations ; ((now (rewrite !fset0E ; apply (ret_both 0))) || (now destruct from_uint_size))). +Next Obligation. + simpl. + intros. + unfold cast_vote_obligations_obligation_5. + unfold cast_vote_obligations_obligation_27. + normalize_fset. + destruct H5. + destruct H4. + solve_ssprove_obligations. +Qed. +Next Obligation. + simpl. + intros. + unfold cast_vote_obligations_obligation_6. + unfold cast_vote_obligations_obligation_33. + destruct H5. + destruct H4. + solve_ssprove_obligations. +Qed. +Next Obligation. + simpl. + intros. + unfold cast_vote_obligations_obligation_7. + destruct H5. + destruct H4. + normalize_fset. + split_fsubset_lhs ; admit. (* Somethings wrong *) +Admitted. +Next Obligation. + simpl. + intros. + unfold cast_vote_obligations_obligation_33. + unfold cast_vote_obligations_obligation_9. + solve_ssprove_obligations. +Qed. +Next Obligation. + simpl. + intros. + unfold cast_vote_obligations_obligation_7. + admit. (* Somethings wrong *) +Admitted. +Next Obligation. + simpl. + intros. + unfold cast_vote_obligations_obligation_27. + unfold cast_vote_obligations_obligation_9. + solve_ssprove_obligations. +Qed. +Next Obligation. + simpl. + intros. + unfold cast_vote_obligations_obligation_5. + unfold cast_vote_obligations_obligation_7. + admit. (* Somethings wrong *) +Admitted. +Next Obligation. + simpl. + intros. + unfold cast_vote_obligations_obligation_27. + unfold cast_vote_obligations_obligation_9. + unfold cast_vote_obligations_obligation_6. + solve_ssprove_obligations. +Qed. +Next Obligation. + simpl. + intros. + unfold cast_vote_obligations_obligation_5. + unfold cast_vote_obligations_obligation_7. + admit. (* Somethings wrong *) +Admitted. +Next Obligation. + simpl. + intros. + unfold cast_vote_obligations_obligation_27. + unfold cast_vote_obligations_obligation_9. + unfold cast_vote_obligations_obligation_6. + solve_ssprove_obligations. +Qed. +Next Obligation. + simpl. + intros. + unfold cast_vote_obligations_obligation_5. + unfold cast_vote_obligations_obligation_7. + admit. (* Somethings wrong *) +Admitted. +Next Obligation. + simpl. + intros. + unfold cast_vote_obligations_obligation_27. + unfold cast_vote_obligations_obligation_9. + unfold cast_vote_obligations_obligation_6. + solve_ssprove_obligations. +Qed. +Next Obligation. + simpl. + intros. + unfold cast_vote_obligations_obligation_5. + unfold cast_vote_obligations_obligation_7. + solve_ssprove_obligations. +Qed. +Next Obligation. + simpl. + intros. + unfold cast_vote_obligations_obligation_27. + unfold cast_vote_obligations_obligation_9. + unfold cast_vote_obligations_obligation_6. + solve_ssprove_obligations. +Qed. +Next Obligation. + simpl. + intros. + unfold cast_vote_obligations_obligation_5. + unfold cast_vote_obligations_obligation_7. + solve_ssprove_obligations. +Qed. +Next Obligation. + simpl. + intros. + solve_ssprove_obligations. +Qed. +Next Obligation. + simpl. + intros. + solve_ssprove_obligations. +Qed. +Next Obligation. + simpl. + intros. + solve_ssprove_obligations. +Qed. Fail Next Obligation. -Definition register_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *);4%nat). -Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *) :|: f_g_pow_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := - register_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params : t_RegisterParam (v_Z)) := matchb out with - | Result_Ok_case x => - letb x := ret_both ((x) (* : (t_RegisterParam (v_Z)) *)) in - ControlFlow_Continue (solve_lift x) - | Result_Err_case x => - letb x := ret_both ((x) : (t_ParseError)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist5 := v_Break (Result_Err (* ParseError *) _) in - ControlFlow_Continue (solve_lift (never_to_any hoist5)) - end in - ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in - letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in - letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in - letb _ := letb register_vote_state_ret loc(register_vote_state_ret_loc) := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := U32) (f_rp_i params)) g_pow_xi) in - solve_lift ret_both tt (* assign body todo(term) *) in - letb _ := letb register_vote_state_ret loc(register_vote_state_ret_loc) := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := U32) (f_rp_i params)) zkp_xi) in - solve_lift ret_both tt (* assign body todo(term) *) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *) :|: f_g_pow_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). -Admit Obligations. -Fail Next Obligation. - -Definition curr_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (f_field_type;5%nat). -Definition tally_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (int32;6%nat). -Definition tally_votes_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *);7%nat). -Definition vote_result_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (f_group_type;8%nat). -(* Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [curr_loc (n := n);tally_loc (n := n);tally_votes_state_ret_loc (n := n);vote_result_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] (* :|: f_clone_loc :|: f_eq_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc *) :|: f_g_pow_loc :|: f_group_one_loc :|: f_prod_loc :|: f_add_loc :|: f_field_one_loc :|: f_field_zero_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := *) -(* tally_votes _ state := *) -(* letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => *) -(* ssp (fun _ => *) -(* letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in *) -(* letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] _ := ControlFlow_Continue (ifb (* not *)negb (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) *) -(* then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist6 := v_Break (Result_Err _ (* ParseError *)) in *) -(* ControlFlow_Continue (never_to_any hoist6) *) -(* else Result_Ok (solve_lift ret_both tt)) in *) -(* solve_lift (ifb (* not *)negb (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) *) -(* then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist7 := v_Break (Result_Err (* ParseError *) _) in *) -(* ControlFlow_Continue (never_to_any hoist7) *) -(* else Result_Ok (solve_lift ret_both tt)) : both (*0*)(L2:|:fset []) (I2) _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) ('unit)) *))) (Result_Ok (ret_both (tt : 'unit))) in *) -(* letb vote_result loc(vote_result_loc) := f_group_one (ret_both (tt : 'unit)) in *) -(* letb _ := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => *) +(* Definition commit_to_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := *) +(* (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *);3%nat). *) +(* Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := *) +(* commit_to_vote ctx state := *) +(* solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in *) +(* letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with *) +(* | Result_Ok_case x => *) +(* letb x := ret_both ((x) (* : (t_CastVoteParam (v_Z)) *)) in *) +(* ControlFlow_Continue (solve_lift x) *) +(* | Result_Err_case x => *) +(* letb x := ret_both ((x) : (t_ParseError)) in *) +(* letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist3 := v_Break (Result_Err _ (* ParseError *)) in *) +(* ControlFlow_Continue (solve_lift (never_to_any hoist3)) *) +(* end in *) +(* ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => *) (* ssp (fun _ => *) -(* letb vote_result loc(vote_result_loc) := f_prod vote_result g_pow_vote in *) -(* solve_lift ret_both tt (* assign body todo(term) *) : both (*1*)(L2:|:fset [vote_result_loc]) (I2) ('unit))) (ret_both (tt : 'unit)) in *) -(* letb tally loc(tally_loc) := ret_both (0 : int32) in *) -(* letb curr loc(curr_loc) := f_field_zero (ret_both (tt : 'unit)) in *) -(* letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := U32) n))) (fun i => *) -(* ssp (fun _ => *) -(* letb _ := ifb (f_g_pow curr) =.? vote_result *) -(* then letb _ := letb tally loc(tally_loc) := i in *) -(* solve_lift ret_both tt (* assign body todo(term) *) in *) -(* ret_both (tt : 'unit) *) -(* else solve_lift (ret_both tt) in *) -(* letb _ := letb curr loc(curr_loc) := f_add curr (f_field_one (ret_both (tt : 'unit))) in *) -(* solve_lift ret_both tt (* assign body todo(term) *) in *) -(* solve_lift (ret_both (tt : 'unit)) : both (*2*)(fset [curr_loc;vote_result_loc]) ((fset [])) ('unit))) (ret_both (tt : 'unit)) in *) -(* letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in *) -(* letb _ := letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in *) -(* solve_lift ret_both tt (* assign body todo(term) *) in *) -(* Result_Ok (solve_lift (prod_b (f_accept (* (ret_both (tt : 'unit)) *),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc] (* :|: f_clone_loc :|: f_eq_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc *) :|: f_g_pow_loc :|: f_group_one_loc :|: f_prod_loc :|: f_add_loc :|: f_field_one_loc :|: f_field_zero_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). *) +(* solve_lift (ifb (* not *) negb (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) *) +(* then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist4 := v_Break (Result_Err _ (* ParseError *)) in *) +(* ControlFlow_Continue (never_to_any hoist4) *) +(* else Result_Ok (solve_lift ret_both tt)) : both (*0*)(L2:|:fset []) (I2) (* ((* t_ControlFlow *) t_Result (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) ('unit)) *) _)) (Result_Ok (solve_lift ret_both (tt : 'unit))) in *) +(* letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := U32) (f_cvp_i params)) (f_g_pow_xis state) in *) +(* letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in *) +(* letb commit_vi := commit_to g_pow_xi_yi_vi in *) +(* letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in *) +(* letb _ := letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := U32) (f_cvp_i params)) commit_vi) in *) +(* solve_lift ret_both tt (* assign body todo(term) *) in *) +(* Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc] (* :|: f_get_loc :|: f_clone_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). *) +(* Admit Obligations. *) (* Fail Next Obligation. *) -(* TODO *) + +(* Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both L1 I1 ('unit)) : both (L1 (* :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_commit_vis_loc :|: f_g_pow_xi_yi_vis_loc :|: f_g_pow_xis_loc :|: f_tally_loc :|: f_zkp_vis_loc :|: f_zkp_xis_loc :|: f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc *) :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *)) (t_Reject)) := *) +(* init_ovn_contract _ := *) +(* Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_field_zero (ret_both (tt : 'unit))) (f_schnorr_zkp_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_y := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_c := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d2 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both (L1 (* :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_commit_vis_loc :|: f_g_pow_xi_yi_vis_loc :|: f_g_pow_xis_loc :|: f_tally_loc :|: f_zkp_vis_loc :|: f_zkp_xis_loc :|: f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc *) :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *)) (t_Reject)). *) +(* Fail Next Obligation. *) + +(* Definition register_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := *) +(* (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *);4%nat). *) +(* Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *) :|: f_g_pow_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := *) +(* register_vote ctx state := *) +(* solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in *) +(* letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params : t_RegisterParam (v_Z)) := matchb out with *) +(* | Result_Ok_case x => *) +(* letb x := ret_both ((x) (* : (t_RegisterParam (v_Z)) *)) in *) +(* ControlFlow_Continue (solve_lift x) *) +(* | Result_Err_case x => *) +(* letb x := ret_both ((x) : (t_ParseError)) in *) +(* letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist5 := v_Break (Result_Err (* ParseError *) _) in *) +(* ControlFlow_Continue (solve_lift (never_to_any hoist5)) *) +(* end in *) +(* ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in *) +(* letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in *) +(* letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in *) +(* letb _ := letb register_vote_state_ret loc(register_vote_state_ret_loc) := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := U32) (f_rp_i params)) g_pow_xi) in *) +(* solve_lift ret_both tt (* assign body todo(term) *) in *) +(* letb _ := letb register_vote_state_ret loc(register_vote_state_ret_loc) := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := U32) (f_rp_i params)) zkp_xi) in *) +(* solve_lift ret_both tt (* assign body todo(term) *) in *) +(* Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *) :|: f_g_pow_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). *) +(* Admit Obligations. *) +(* Fail Next Obligation. *) + +(* Definition curr_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := *) +(* (f_field_type;5%nat). *) +(* Definition tally_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := *) +(* (int32;6%nat). *) +(* Definition tally_votes_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := *) +(* (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *);7%nat). *) +(* Definition vote_result_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := *) +(* (f_group_type;8%nat). *) +(* (* Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [curr_loc (n := n);tally_loc (n := n);tally_votes_state_ret_loc (n := n);vote_result_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] (* :|: f_clone_loc :|: f_eq_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc *) :|: f_g_pow_loc :|: f_group_one_loc :|: f_prod_loc :|: f_add_loc :|: f_field_one_loc :|: f_field_zero_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := *) *) +(* (* tally_votes _ state := *) *) +(* (* letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => *) *) +(* (* ssp (fun _ => *) *) +(* (* letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in *) *) +(* (* letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] _ := ControlFlow_Continue (ifb (* not *)negb (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) *) *) +(* (* then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist6 := v_Break (Result_Err _ (* ParseError *)) in *) *) +(* (* ControlFlow_Continue (never_to_any hoist6) *) *) +(* (* else Result_Ok (solve_lift ret_both tt)) in *) *) +(* (* solve_lift (ifb (* not *)negb (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) *) *) +(* (* then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist7 := v_Break (Result_Err (* ParseError *) _) in *) *) +(* (* ControlFlow_Continue (never_to_any hoist7) *) *) +(* (* else Result_Ok (solve_lift ret_both tt)) : both (*0*)(L2:|:fset []) (I2) _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) ('unit)) *))) (Result_Ok (ret_both (tt : 'unit))) in *) *) +(* (* letb vote_result loc(vote_result_loc) := f_group_one (ret_both (tt : 'unit)) in *) *) +(* (* letb _ := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => *) *) +(* (* ssp (fun _ => *) *) +(* (* letb vote_result loc(vote_result_loc) := f_prod vote_result g_pow_vote in *) *) +(* (* solve_lift ret_both tt (* assign body todo(term) *) : both (*1*)(L2:|:fset [vote_result_loc]) (I2) ('unit))) (ret_both (tt : 'unit)) in *) *) +(* (* letb tally loc(tally_loc) := ret_both (0 : int32) in *) *) +(* (* letb curr loc(curr_loc) := f_field_zero (ret_both (tt : 'unit)) in *) *) +(* (* letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := U32) n))) (fun i => *) *) +(* (* ssp (fun _ => *) *) +(* (* letb _ := ifb (f_g_pow curr) =.? vote_result *) *) +(* (* then letb _ := letb tally loc(tally_loc) := i in *) *) +(* (* solve_lift ret_both tt (* assign body todo(term) *) in *) *) +(* (* ret_both (tt : 'unit) *) *) +(* (* else solve_lift (ret_both tt) in *) *) +(* (* letb _ := letb curr loc(curr_loc) := f_add curr (f_field_one (ret_both (tt : 'unit))) in *) *) +(* (* solve_lift ret_both tt (* assign body todo(term) *) in *) *) +(* (* solve_lift (ret_both (tt : 'unit)) : both (*2*)(fset [curr_loc;vote_result_loc]) ((fset [])) ('unit))) (ret_both (tt : 'unit)) in *) *) +(* (* letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in *) *) +(* (* letb _ := letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in *) *) +(* (* solve_lift ret_both tt (* assign body todo(term) *) in *) *) +(* (* Result_Ok (solve_lift (prod_b (f_accept (* (ret_both (tt : 'unit)) *),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc] (* :|: f_clone_loc :|: f_eq_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc *) :|: f_g_pow_loc :|: f_group_one_loc :|: f_prod_loc :|: f_add_loc :|: f_field_one_loc :|: f_field_zero_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). *) *) +(* (* Fail Next Obligation. *) *) +(* (* TODO *) *) (** Concert lib part **) From ConCert.Utils Require Import Extras. From 2ba94ee4953c8f4035512b8c8ecda4cf485c68bd Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Thu, 15 Feb 2024 17:42:26 +0100 Subject: [PATCH 60/86] WIP --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 648 +++++--------------- 1 file changed, 165 insertions(+), 483 deletions(-) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 21500ef..e19054e 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -1,56 +1,3 @@ -Require Import Lia. -Lemma add_assoc : forall a b c, (a + (b + c)) = (a + b + c). -Proof. - intros ; induction a ; [ | simpl ; rewrite IHa ] ; easy. -Qed. -Lemma add_commut : forall a b, a + b = b + a. -Proof. - lia. -Qed. -Lemma add_0_l : forall a, (0 + a) = a. -Proof. - easy. -Qed. -Lemma add_0_r : forall a, (a + 0) = a. -Proof. - easy. -Qed. -Lemma add_trans : forall a b c, a <= b -> b <= c -> a <= c. -Proof. - lia. -Qed. - -Ltac normalize_goal := - repeat match goal with - | |- context [?a + ?b + ?c] => - replace (a + b + c) with (a + (b + c)) by apply add_assoc - end. -Ltac solve_split_goal := - easy || - (normalize_goal ; - match goal with - | |- context [_ <= ?x + ?y] => - match goal with - | |- context [?lhs <= ?rhs] => - let H_rhs := fresh in - let H_f := fresh in - let H_ass_l := fresh in - let H_ass_r := fresh in - set (H_rhs := rhs) ; pattern x in H_rhs ; - set (H_f := fun _ => _) in H_rhs ; - assert (H_ass_l : lhs <= H_f 0 + x) by (subst H_rhs H_f ; hnf ; try rewrite ! add_0_l ; try rewrite ! add_0_r ; normalize_goal ; solve_split_goal) ; - assert (H_ass_r : x + H_f 0 <= rhs) by (subst H_rhs H_f ; hnf ; try rewrite ! add_0_l ; try rewrite ! add_0_r ; normalize_goal ; lia) ; (* Should always be true (safe under approximation) *) - replace (H_f 0 + x) with (x + H_f 0) in H_ass_l by apply add_commut ; - transitivity (x + H_f 0) ; assumption - end - end). - - -Goal forall x y, Nat.add x y <= Nat.add x (y + y + x + x). - intros. - solve_split_goal. -Qed. - (* File automatically generated by Hacspec *) Set Warnings "-notation-overridden,-ambiguous-paths". From Crypt Require Import choice_type Package Prelude. @@ -80,8 +27,6 @@ Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. Require Import Hacspec_ovn_Ovn_traits. Export Hacspec_ovn_Ovn_traits. - - (*Not implemented yet? todo(item)*) (*Not implemented yet? todo(item)*) @@ -100,27 +45,33 @@ Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} {v_Z solve_lift (f_random_field_elem random) : both (L1 :|: f_random_field_elem_loc) I1 (f_field_type). Fail Next Obligation. +(* assignb prod1 loc(prod1_loc) := f_prod prod1 (xis.a[j]) *) + +Notation f_into_iter_loc := fset0. +Notation f_end_loc := fset0. +Notation f_start_loc := fset0. + +Check assign_mut_both. + Definition prod1_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := (f_group_type;0%nat). Definition prod2_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := (f_group_type;1%nat). -Equations compute_g_pow_yi {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both L1 I1 (uint_size)) (xis : both L2 I2 (nseq f_group_type (is_pure (n)))) : both (L1 :|: L2 :|: fset [prod1_loc (n:=n);prod2_loc (n:=n)] :|: (* f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: *)f_div_loc :|: f_group_one_loc :|: f_prod_loc) (I1 :|: I2) (f_group_type) := +Equations compute_g_pow_yi {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both L1 I1 (uint_size)) (xis : both L2 I2 (nseq (f_group_type) (is_pure (n)))) : both (L1 :|: L2 :|: fset [prod1_loc (n := n);prod2_loc (n := n)] :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_div_loc :|: f_group_one_loc :|: f_prod_loc) (I1 :|: I2) (f_group_type) := compute_g_pow_yi i xis := letb prod1 loc(prod1_loc) := f_group_one (ret_both (tt : 'unit)) in letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => ssp (fun _ => - letb prod1 loc(prod1_loc) := f_prod prod1 (xis.a[j]) in - (* assign body todo(term) *) (solve_lift ret_both tt) : both (*1*)(L2:|:L1:|:fset [prod1_loc] :|: f_group_one_loc :|: f_prod_loc) (I2:|:I1) ('unit))) (ret_both (tt : 'unit)) in + solve_lift assign_mut_both prod1_loc (f_prod prod1 (xis.a[j])) : both (*1*)(L1 :|: L2 :|: fset [prod1_loc;prod2_loc] :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_div_loc :|: f_group_one_loc :|: f_prod_loc) (I2:|:I1) ('unit))) (ret_both (tt : 'unit)) in letb prod2 loc(prod2_loc) := f_group_one (ret_both (tt : 'unit)) in letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => ssp (fun _ => - letb prod2 loc(prod2_loc) := f_prod prod2 (xis.a[j]) in - (* assign body todo(term) *) - (solve_lift ret_both tt) : both (*1*)(L2:|:L1:|:fset [prod2_loc] :|: f_group_one_loc :|: f_prod_loc) (I2:|:I1) ('unit))) (ret_both (tt : 'unit)) in - solve_lift (f_div prod1 prod2) : both (L1 :|: L2 :|: fset [prod1_loc;prod2_loc] :|: (* f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: *)f_div_loc :|: f_group_one_loc :|: f_prod_loc) (I1 :|: I2) (f_group_type). + solve_lift assign_mut_both prod2_loc (f_prod prod2 (xis.a[j])) : both (*1*)(L1 :|: L2 :|: fset [prod1_loc;prod2_loc] :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_div_loc :|: f_group_one_loc :|: f_prod_loc) (I2:|:I1) ('unit))) (ret_both (tt : 'unit)) in + solve_lift (f_div prod1 prod2) : both (L1 :|: L2 :|: fset [prod1_loc;prod2_loc] :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_div_loc :|: f_group_one_loc :|: f_prod_loc) (I1 :|: I2) (f_group_type). Solve All Obligations with ( solve_ssprove_obligations ; ((now (rewrite !fset0E ; apply (ret_both 0))) || (now destruct from_uint_size))). Fail Next Obligation. +Notation f_eq_loc := fset0. Equations impl__into_vec {L I A n} : both L I (nseq_ A n) -> both L I (t_Vec A t_Global) := impl__into_vec X := bind_both X (fun x : nseq_ A n => solve_lift (ret_both (Hacspec_Lib_Pre.array_to_list x : chList _))). Fail Next Obligation. @@ -128,9 +79,9 @@ Fail Next Obligation. Definition unsize {A} := @id A. Definition box_new {A} := @id A. -Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (commitment : both L2 I2 (f_field_type)) : both (L1 :|: L2 :|: (* f_eq_loc :|: *)f_hash_loc) (I1 :|: I2) ('bool) := +Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (commitment : both L2 I2 (f_field_type)) : both (L1 :|: L2 :|: f_eq_loc :|: f_hash_loc) (I1 :|: I2) ('bool) := check_commitment g_pow_xi_yi_vi commitment := - solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both (L1 :|: L2 :|: (* f_eq_loc :|: *)f_hash_loc) (I1 :|: I2) ('bool). + solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both (L1 :|: L2 :|: f_eq_loc :|: f_hash_loc) (I1 :|: I2) ('bool). Fail Next Obligation. Equations commit_to {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) : both (L1 :|: f_hash_loc) I1 (f_field_type) := @@ -334,27 +285,42 @@ Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) : solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). Fail Next Obligation. -Equations schnorr_zkp {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (h : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3 :|: (* f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc :|: *)f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_add_loc :|: f_mul_loc :|: f_random_field_elem_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := +Notation f_schnorr_zkp_c_loc := fset0. +Notation f_schnorr_zkp_u_loc := fset0. +Notation f_schnorr_zkp_z_loc := fset0. + +Equations schnorr_zkp {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (h : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3 :|: f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_add_loc :|: f_mul_loc :|: f_random_field_elem_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := schnorr_zkp random h x := solve_lift (run (letb r := f_random_field_elem random in letb u := f_g_pow r in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list (L := (L1 :|: L2 :|: L3 :|: (* f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc :|: *)f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_add_loc :|: f_mul_loc :|: f_random_field_elem_loc)) (I := (I1 :|: I2 :|: I3)) [solve_lift f_g (ret_both (tt : 'unit)); + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [solve_lift f_g (ret_both (tt : 'unit)) : both (L1 :|: L2 :|: L3 :|: f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_add_loc :|: f_mul_loc :|: f_random_field_elem_loc) (I1 :|: I2 :|: I3) _; solve_lift h; solve_lift u])))) in letb z := f_add r (f_mul c x) in letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in - ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3 :|: (* f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc :|: *)f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_add_loc :|: f_mul_loc :|: f_random_field_elem_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). + ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3 :|: f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_add_loc :|: f_mul_loc :|: f_random_field_elem_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). Fail Next Obligation. -Equations schnorr_zkp_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (pi : both L2 I2 (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 :|: (* f_eq_loc :|: *)f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc) (I1 :|: I2) ('bool) := +Equations schnorr_zkp_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (pi : both L2 I2 (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 :|: f_eq_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc) (I1 :|: I2) ('bool) := schnorr_zkp_validate h pi := - solve_lift (andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list (L := (L1 :|: L2 :|: (* f_eq_loc :|: *)f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc)) (I := (I1 :|: I2)) [solve_lift f_g (ret_both (tt : 'unit)); + solve_lift (andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [solve_lift f_g (ret_both (tt : 'unit)) : both (L1 :|: L2 :|: f_eq_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc) (I1 :|: I2) _; solve_lift h; - solve_lift f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both (L1 :|: L2 :|: (* f_eq_loc :|: *)f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Obligation Tactic := try timeout 1 solve_ssprove_obligations. -Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both L1 I1 (int32)) (random_r : both L2 I2 (int32)) (random_d : both L3 I3 (int32)) (h : both L4 I4 (f_group_type)) (xi : both L5 I5 (f_field_type)) (vi : both L6 I6 ('bool)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: (* f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: *)f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) := + solve_lift f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both (L1 :|: L2 :|: f_eq_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc) (I1 :|: I2) ('bool). +Fail Next Obligation. + +Notation f_or_zkp_a1_loc := fset0. +Notation f_or_zkp_a2_loc := fset0. +Notation f_or_zkp_b1_loc := fset0. +Notation f_or_zkp_b2_loc := fset0. +Notation f_or_zkp_c_loc := fset0. +Notation f_or_zkp_d1_loc := fset0. +Notation f_or_zkp_d2_loc := fset0. +Notation f_or_zkp_r1_loc := fset0. +Notation f_or_zkp_r2_loc := fset0. +Notation f_or_zkp_x_loc := fset0. +Notation f_or_zkp_y_loc := fset0. + +Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both L1 I1 (int32)) (random_r : both L2 I2 (int32)) (random_d : both L3 I3 (int32)) (h : both L4 I4 (f_group_type)) (xi : both L5 I5 (f_field_type)) (vi : both L6 I6 ('bool)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) := zkp_one_out_of_two random_w random_r random_d h xi vi := letb w := f_random_field_elem random_w in solve_lift (ifb vi @@ -366,7 +332,7 @@ Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : letb b1 := f_prod (f_pow h r1) (f_pow y d1) in letb a2 := f_g_pow w in letb b2 := f_pow h w in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list (L := (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: (* f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: *) f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc)) (I := (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6)) [solve_lift x; + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [solve_lift x : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) _; solve_lift y; solve_lift a1; solve_lift b1; @@ -383,7 +349,7 @@ Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : letb b1 := f_pow h w in letb a2 := f_prod (f_g_pow r2) (f_pow x d2) in letb b2 := f_prod (f_pow h r2) (f_pow (f_div y (f_g (ret_both (tt : 'unit)))) d2) in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list (L := (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: (* f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: *) f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc)) (I := (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6)) [solve_lift x; + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [solve_lift x : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) _; solve_lift y; solve_lift a1; solve_lift b1; @@ -391,12 +357,10 @@ Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : solve_lift b2])))) in letb d1 := f_sub c d2 in letb r1 := f_sub w (f_mul xi d1) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: (* f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: *) f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)). -Admit Obligations. (* slow *) (* Solve All Obligations with solve_ssprove_obligations. *) + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)). Fail Next Obligation. -Obligation Tactic := try timeout 4 solve_ssprove_obligations. -Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (zkp : both L2 I2 (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 (* :|: f_eq_loc *) :|: f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_add_loc) (I1 :|: I2) ('bool) := +Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (zkp : both L2 I2 (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 :|: f_eq_loc :|: f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_add_loc) (I1 :|: I2) ('bool) := zkp_one_out_of_two_validate h zkp := letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; f_or_zkp_y zkp; @@ -404,30 +368,30 @@ Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Locatio f_or_zkp_b1 zkp; f_or_zkp_a2 zkp; f_or_zkp_b2 zkp])))) in - solve_lift (andb (andb (andb (andb (c =.? (f_add (f_or_zkp_d1 zkp) (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? (f_prod (f_pow h (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r2 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? (f_prod (f_pow h (f_or_zkp_r2 zkp)) (f_pow (f_div (f_or_zkp_y zkp) (f_g (ret_both (tt : 'unit)))) (f_or_zkp_d2 zkp))))) : both (L1 :|: L2 (* :|: f_eq_loc *) :|: f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_add_loc) (I1 :|: I2) ('bool). + solve_lift (andb (andb (andb (andb (c =.? (f_add (f_or_zkp_d1 zkp) (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? (f_prod (f_pow h (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r2 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? (f_prod (f_pow h (f_or_zkp_r2 zkp)) (f_pow (f_div (f_or_zkp_y zkp) (f_g (ret_both (tt : 'unit)))) (f_or_zkp_d2 zkp))))) : both (L1 :|: L2 :|: f_eq_loc :|: f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_add_loc) (I1 :|: I2) ('bool). Fail Next Obligation. Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := - (nseq f_group_type (is_pure (n)) × nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × nseq f_field_type (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × int32). -Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq f_group_type (is_pure (n))) := + (nseq (f_group_type) (is_pure (n)) × nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × nseq (f_field_type) (is_pure (n)) × nseq (f_group_type) (is_pure (n)) × nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × int32). +Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq (f_group_type) (is_pure (n))) := f_g_pow_xis s := bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq (f_group_type) (is_pure (n))))) : both L I (nseq (f_group_type) (is_pure (n))). Fail Next Obligation. Equations f_zkp_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := f_zkp_xis s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both L I (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). Fail Next Obligation. -Equations f_commit_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq f_field_type (is_pure (n))) := +Equations f_commit_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq (f_field_type) (is_pure (n))) := f_commit_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : nseq f_field_type (is_pure (n))))) : both L I (nseq f_field_type (is_pure (n))). + solve_lift (ret_both (snd (fst (fst (fst x))) : nseq (f_field_type) (is_pure (n))))) : both L I (nseq (f_field_type) (is_pure (n))). Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq f_group_type (is_pure (n))) := +Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq (f_group_type) (is_pure (n))) := f_g_pow_xi_yi_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). + solve_lift (ret_both (snd (fst (fst x)) : nseq (f_group_type) (is_pure (n))))) : both L I (nseq (f_group_type) (is_pure (n))). Fail Next Obligation. Equations f_zkp_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := f_zkp_vis s := @@ -439,7 +403,7 @@ Equations f_tally {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : bind_both s (fun x => solve_lift (ret_both (snd x : int32))) : both L I (int32). Fail Next Obligation. -Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_g_pow_xis : both L0 I0 (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both L1 I1 (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_commit_vis : both L2 I2 (nseq f_field_type (is_pure (n)))} {f_g_pow_xi_yi_vis : both L3 I3 (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both L4 I4 (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState (n := n)) := +Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_g_pow_xis : both L0 I0 (nseq (f_group_type) (is_pure (n)))} {f_zkp_xis : both L1 I1 (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_commit_vis : both L2 I2 (nseq (f_field_type) (is_pure (n)))} {f_g_pow_xi_yi_vis : both L3 I3 (nseq (f_group_type) (is_pure (n)))} {f_zkp_vis : both L4 I4 (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState (n := n)) := Build_t_OvnContractState := bind_both f_tally (fun f_tally => bind_both f_zkp_vis (fun f_zkp_vis => @@ -458,412 +422,130 @@ Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Bui Definition cast_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *);2%nat). + +Notation f_get_loc := fset0. +Notation f_clone_loc := fset0. +Notation f_accept_loc := fset0. +Notation f_parameter_cursor_loc := fset0. + Notation Result_Ok_case := inl. Notation Result_Err_case := inr. -(* Obligation Tactic := try timeout 2 solve_ssprove_obligations. *) -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: - f_div_loc :|: - f_group_one_loc :|: - f_prod_loc :|: - f_g_pow_loc :|: - f_g_loc :|: f_hash_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc :|: - f_pow_loc :|: - f_field_one_loc :|: - f_field_zero_loc :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := + +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := cast_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with | Result_Ok_case x => - letb x := ret_both ((x) (* : (t_CastVoteParam (v_Z := v_Z)) *)) in + letb x := ret_both ((x) : _ (* (t_CastVoteParam (v_Z)) *)) in ControlFlow_Continue (solve_lift x) | Result_Err_case x => letb x := ret_both ((x) : (t_ParseError)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist2 := v_Break (Result_Err _ (* ParseError *)) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist2 := v_Break (Result_Err _) in ControlFlow_Continue (solve_lift (never_to_any hoist2)) end in - ControlFlow_Continue (letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := U32) (f_cvp_i params)) (f_g_pow_xis state) in + ControlFlow_Continue (letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in - letb cast_vote_state_ret loc(cast_vote_state_ret_loc (n := n)) := f_clone state in - letb _ := letb cast_vote_state_ret loc(cast_vote_state_ret_loc (n := n)) := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := U32) (f_cvp_i params)) g_pow_xi_yi_vi)(* : both (L1 :|: L2 :|: *) - (* f_div_loc :|: *) - (* f_group_one_loc :|: *) - (* f_prod_loc :|: *) - (* f_g_pow_loc :|: *) - (* f_g_loc :|: f_hash_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc :|: *) - (* f_pow_loc :|: *) - (* f_field_one_loc :|: *) - (* f_field_zero_loc :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) ((t_OvnContractState (n := n))) *) in - solve_lift ret_both tt (* assign body todo(term) *) : both (L1 :|: L2 :|: - f_div_loc :|: - f_group_one_loc :|: - f_prod_loc :|: - f_g_pow_loc :|: - f_g_loc :|: f_hash_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc :|: - f_pow_loc :|: - f_field_one_loc :|: - f_field_zero_loc :|: - fset [cast_vote_state_ret_loc (n := n);prod1_loc;prod2_loc] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) _ _ in - letb _ := letb cast_vote_state_ret loc(cast_vote_state_ret_loc (n := n)) := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := U32) (f_cvp_i params)) zkp_vi)(* : both (L1 :|: L2 :|: *) - (* f_div_loc :|: *) - (* f_group_one_loc :|: *) - (* f_prod_loc :|: *) - (* f_g_pow_loc :|: *) - (* f_g_loc :|: f_hash_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc :|: *) - (* f_pow_loc :|: *) - (* f_field_one_loc :|: *) - (* f_field_zero_loc :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_OvnContractState (n := n)) *) in - solve_lift ret_both tt (* assign body todo(term) *) : both (L1 :|: L2 :|: - f_div_loc :|: - f_group_one_loc :|: - f_prod_loc :|: - f_g_pow_loc :|: - f_g_loc :|: f_hash_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc :|: - f_pow_loc :|: - f_field_one_loc :|: - f_field_zero_loc :|: - fset [cast_vote_state_ret_loc (n := n);prod1_loc;prod2_loc] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) _ _ in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (L1 :|: L2 :|: f_div_loc :|: - f_group_one_loc :|: - f_prod_loc :|: - f_g_pow_loc :|: - f_g_loc :|: f_hash_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc :|: - f_pow_loc :|: - f_field_one_loc :|: - f_field_zero_loc :|: - fset [cast_vote_state_ret_loc (n := n);prod1_loc;prod2_loc] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). -Next Obligation. - intros. - simpl. - unfold cast_vote_obligations_obligation_1. - unfold cast_vote_obligations_obligation_7. - solve_ssprove_obligations. -Qed. -Next Obligation. - intros. - simpl. - unfold cast_vote_obligations_obligation_2. - unfold cast_vote_obligations_obligation_9. - solve_ssprove_obligations. -Qed. -Next Obligation. - intros. - simpl. - unfold cast_vote_obligations_obligation_7. -solve_ssprove_obligations. -Qed. -Next Obligation. - intros. - simpl. - unfold cast_vote_obligations_obligation_9. - solve_ssprove_obligations. -Qed. -Next Obligation. - intros. - simpl. - unfold cast_vote_obligations_obligation_3. - unfold cast_vote_obligations_obligation_5. - solve_ssprove_obligations. -Qed. -Next Obligation. - intros. - simpl. - unfold cast_vote_obligations_obligation_4. - unfold cast_vote_obligations_obligation_6. - solve_ssprove_obligations. -Qed. -Next Obligation. - intros. - simpl. - unfold cast_vote_obligations_obligation_3. - unfold cast_vote_obligations_obligation_5. - solve_ssprove_obligations. -Qed. -Next Obligation. - intros. - simpl. - unfold cast_vote_obligations_obligation_4. - unfold cast_vote_obligations_obligation_6. - solve_ssprove_obligations. -Qed. -Next Obligation. - intros. - simpl. - unfold cast_vote_obligations_obligation_1. - unfold cast_vote_obligations_obligation_5. - solve_ssprove_obligations. -Qed. -Next Obligation. - intros. - simpl. - unfold cast_vote_obligations_obligation_2. - unfold cast_vote_obligations_obligation_6. - solve_ssprove_obligations. -Qed. -Next Obligation. - refine (solve_lift ret_both 0). - solve_ssprove_obligations. - rewrite fset0E. - solve_ssprove_obligations. -Qed. -Next Obligation. - refine (solve_lift ret_both 0). - solve_ssprove_obligations. - rewrite fset0E. - solve_ssprove_obligations. -Qed. -Next Obligation. - simpl. - intros. - unfold cast_vote_obligations_obligation_5. - destruct H5. - destruct H4. - solve_ssprove_obligations. -Qed. -Next Obligation. - simpl. - intros. - unfold cast_vote_obligations_obligation_6. - unfold cast_vote_obligations_obligation_27. - solve_ssprove_obligations. -Qed. -Solve All Obligations with timeout 2 ( solve_ssprove_obligations ; ((now (rewrite !fset0E ; apply (ret_both 0))) || (now destruct from_uint_size))). -Next Obligation. - simpl. - intros. - unfold cast_vote_obligations_obligation_5. - unfold cast_vote_obligations_obligation_27. - normalize_fset. - destruct H5. - destruct H4. - solve_ssprove_obligations. -Qed. -Next Obligation. - simpl. - intros. - unfold cast_vote_obligations_obligation_6. - unfold cast_vote_obligations_obligation_33. - destruct H5. - destruct H4. - solve_ssprove_obligations. -Qed. -Next Obligation. - simpl. - intros. - unfold cast_vote_obligations_obligation_7. - destruct H5. - destruct H4. - normalize_fset. - split_fsubset_lhs ; admit. (* Somethings wrong *) -Admitted. -Next Obligation. - simpl. - intros. - unfold cast_vote_obligations_obligation_33. - unfold cast_vote_obligations_obligation_9. - solve_ssprove_obligations. -Qed. -Next Obligation. - simpl. - intros. - unfold cast_vote_obligations_obligation_7. - admit. (* Somethings wrong *) -Admitted. -Next Obligation. - simpl. - intros. - unfold cast_vote_obligations_obligation_27. - unfold cast_vote_obligations_obligation_9. - solve_ssprove_obligations. -Qed. -Next Obligation. - simpl. - intros. - unfold cast_vote_obligations_obligation_5. - unfold cast_vote_obligations_obligation_7. - admit. (* Somethings wrong *) -Admitted. -Next Obligation. - simpl. - intros. - unfold cast_vote_obligations_obligation_27. - unfold cast_vote_obligations_obligation_9. - unfold cast_vote_obligations_obligation_6. - solve_ssprove_obligations. -Qed. -Next Obligation. - simpl. - intros. - unfold cast_vote_obligations_obligation_5. - unfold cast_vote_obligations_obligation_7. - admit. (* Somethings wrong *) -Admitted. -Next Obligation. - simpl. - intros. - unfold cast_vote_obligations_obligation_27. - unfold cast_vote_obligations_obligation_9. - unfold cast_vote_obligations_obligation_6. - solve_ssprove_obligations. -Qed. -Next Obligation. - simpl. - intros. - unfold cast_vote_obligations_obligation_5. - unfold cast_vote_obligations_obligation_7. - admit. (* Somethings wrong *) -Admitted. -Next Obligation. - simpl. - intros. - unfold cast_vote_obligations_obligation_27. - unfold cast_vote_obligations_obligation_9. - unfold cast_vote_obligations_obligation_6. - solve_ssprove_obligations. -Qed. -Next Obligation. - simpl. - intros. - unfold cast_vote_obligations_obligation_5. - unfold cast_vote_obligations_obligation_7. - solve_ssprove_obligations. -Qed. -Next Obligation. - simpl. - intros. - unfold cast_vote_obligations_obligation_27. - unfold cast_vote_obligations_obligation_9. - unfold cast_vote_obligations_obligation_6. - solve_ssprove_obligations. -Qed. -Next Obligation. - simpl. - intros. - unfold cast_vote_obligations_obligation_5. - unfold cast_vote_obligations_obligation_7. - solve_ssprove_obligations. -Qed. -Next Obligation. - simpl. - intros. - solve_ssprove_obligations. -Qed. -Next Obligation. - simpl. - intros. - solve_ssprove_obligations. -Qed. -Next Obligation. - simpl. - intros. - solve_ssprove_obligations. -Qed. -Fail Next Obligation. - -(* Definition commit_to_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := *) -(* (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *);3%nat). *) -(* Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := *) -(* commit_to_vote ctx state := *) -(* solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in *) -(* letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with *) -(* | Result_Ok_case x => *) -(* letb x := ret_both ((x) (* : (t_CastVoteParam (v_Z)) *)) in *) -(* ControlFlow_Continue (solve_lift x) *) -(* | Result_Err_case x => *) -(* letb x := ret_both ((x) : (t_ParseError)) in *) -(* letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist3 := v_Break (Result_Err _ (* ParseError *)) in *) -(* ControlFlow_Continue (solve_lift (never_to_any hoist3)) *) -(* end in *) -(* ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => *) -(* ssp (fun _ => *) -(* solve_lift (ifb (* not *) negb (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) *) -(* then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist4 := v_Break (Result_Err _ (* ParseError *)) in *) -(* ControlFlow_Continue (never_to_any hoist4) *) -(* else Result_Ok (solve_lift ret_both tt)) : both (*0*)(L2:|:fset []) (I2) (* ((* t_ControlFlow *) t_Result (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) ('unit)) *) _)) (Result_Ok (solve_lift ret_both (tt : 'unit))) in *) -(* letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := U32) (f_cvp_i params)) (f_g_pow_xis state) in *) -(* letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in *) -(* letb commit_vi := commit_to g_pow_xi_yi_vi in *) -(* letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in *) -(* letb _ := letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := U32) (f_cvp_i params)) commit_vi) in *) -(* solve_lift ret_both tt (* assign body todo(term) *) in *) -(* Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc] (* :|: f_get_loc :|: f_clone_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc :|: f_parameter_cursor_loc *)) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). *) -(* Admit Obligations. *) -(* Fail Next Obligation. *) - -(* Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both L1 I1 ('unit)) : both (L1 (* :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_commit_vis_loc :|: f_g_pow_xi_yi_vis_loc :|: f_g_pow_xis_loc :|: f_tally_loc :|: f_zkp_vis_loc :|: f_zkp_xis_loc :|: f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc *) :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *)) (t_Reject)) := *) -(* init_ovn_contract _ := *) -(* Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_field_zero (ret_both (tt : 'unit))) (f_schnorr_zkp_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_y := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_c := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d2 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both (L1 (* :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_commit_vis_loc :|: f_g_pow_xi_yi_vis_loc :|: f_g_pow_xis_loc :|: f_tally_loc :|: f_zkp_vis_loc :|: f_zkp_xis_loc :|: f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc *) :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *)) (t_Reject)). *) -(* Fail Next Obligation. *) - -(* Definition register_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := *) -(* (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *);4%nat). *) -(* Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *) :|: f_g_pow_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := *) -(* register_vote ctx state := *) -(* solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in *) -(* letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] (params : t_RegisterParam (v_Z)) := matchb out with *) -(* | Result_Ok_case x => *) -(* letb x := ret_both ((x) (* : (t_RegisterParam (v_Z)) *)) in *) -(* ControlFlow_Continue (solve_lift x) *) -(* | Result_Err_case x => *) -(* letb x := ret_both ((x) : (t_ParseError)) in *) -(* letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist5 := v_Break (Result_Err (* ParseError *) _) in *) -(* ControlFlow_Continue (solve_lift (never_to_any hoist5)) *) -(* end in *) -(* ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in *) -(* letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in *) -(* letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in *) -(* letb _ := letb register_vote_state_ret loc(register_vote_state_ret_loc) := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := U32) (f_rp_i params)) g_pow_xi) in *) -(* solve_lift ret_both tt (* assign body todo(term) *) in *) -(* letb _ := letb register_vote_state_ret loc(register_vote_state_ret_loc) := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := U32) (f_rp_i params)) zkp_xi) in *) -(* solve_lift ret_both tt (* assign body todo(term) *) in *) -(* Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc (n := n)] (* :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc *) :|: f_g_pow_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). *) -(* Admit Obligations. *) -(* Fail Next Obligation. *) - -(* Definition curr_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := *) -(* (f_field_type;5%nat). *) -(* Definition tally_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := *) -(* (int32;6%nat). *) -(* Definition tally_votes_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := *) -(* (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *);7%nat). *) -(* Definition vote_result_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := *) -(* (f_group_type;8%nat). *) -(* (* Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [curr_loc (n := n);tally_loc (n := n);tally_votes_state_ret_loc (n := n);vote_result_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] (* :|: f_clone_loc :|: f_eq_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc *) :|: f_g_pow_loc :|: f_group_one_loc :|: f_prod_loc :|: f_add_loc :|: f_field_one_loc :|: f_field_zero_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := *) *) -(* (* tally_votes _ state := *) *) -(* (* letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => *) *) -(* (* ssp (fun _ => *) *) -(* (* letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in *) *) -(* (* letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] _ := ControlFlow_Continue (ifb (* not *)negb (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) *) *) -(* (* then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist6 := v_Break (Result_Err _ (* ParseError *)) in *) *) -(* (* ControlFlow_Continue (never_to_any hoist6) *) *) -(* (* else Result_Ok (solve_lift ret_both tt)) in *) *) -(* (* solve_lift (ifb (* not *)negb (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) *) *) -(* (* then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError))] hoist7 := v_Break (Result_Err (* ParseError *) _) in *) *) -(* (* ControlFlow_Continue (never_to_any hoist7) *) *) -(* (* else Result_Ok (solve_lift ret_both tt)) : both (*0*)(L2:|:fset []) (I2) _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) ('unit)) *))) (Result_Ok (ret_both (tt : 'unit))) in *) *) -(* (* letb vote_result loc(vote_result_loc) := f_group_one (ret_both (tt : 'unit)) in *) *) -(* (* letb _ := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => *) *) -(* (* ssp (fun _ => *) *) -(* (* letb vote_result loc(vote_result_loc) := f_prod vote_result g_pow_vote in *) *) -(* (* solve_lift ret_both tt (* assign body todo(term) *) : both (*1*)(L2:|:fset [vote_result_loc]) (I2) ('unit))) (ret_both (tt : 'unit)) in *) *) -(* (* letb tally loc(tally_loc) := ret_both (0 : int32) in *) *) -(* (* letb curr loc(curr_loc) := f_field_zero (ret_both (tt : 'unit)) in *) *) -(* (* letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := U32) n))) (fun i => *) *) -(* (* ssp (fun _ => *) *) -(* (* letb _ := ifb (f_g_pow curr) =.? vote_result *) *) -(* (* then letb _ := letb tally loc(tally_loc) := i in *) *) -(* (* solve_lift ret_both tt (* assign body todo(term) *) in *) *) -(* (* ret_both (tt : 'unit) *) *) -(* (* else solve_lift (ret_both tt) in *) *) -(* (* letb _ := letb curr loc(curr_loc) := f_add curr (f_field_one (ret_both (tt : 'unit))) in *) *) -(* (* solve_lift ret_both tt (* assign body todo(term) *) in *) *) -(* (* solve_lift (ret_both (tt : 'unit)) : both (*2*)(fset [curr_loc;vote_result_loc]) ((fset [])) ('unit))) (ret_both (tt : 'unit)) in *) *) -(* (* letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in *) *) -(* (* letb _ := letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in *) *) -(* (* solve_lift ret_both tt (* assign body todo(term) *) in *) *) -(* (* Result_Ok (solve_lift (prod_b (f_accept (* (ret_both (tt : 'unit)) *),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc] (* :|: f_clone_loc :|: f_eq_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc *) :|: f_g_pow_loc :|: f_group_one_loc :|: f_prod_loc :|: f_add_loc :|: f_field_one_loc :|: f_field_zero_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)(* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). *) *) -(* (* Fail Next Obligation. *) *) -(* (* TODO *) *) + letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in + letb _ := assignb cast_vote_state_ret loc(cast_vote_state_ret_loc) := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in + letb _ := assignb cast_vote_state_ret loc(cast_vote_state_ret_loc) := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc] :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). +Fail Next Obligation. + +Definition commit_to_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n);3%nat). +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc] :|: f_get_loc :|: f_clone_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc :|: f_parameter_cursor_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := + commit_to_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with + | Result_Ok_case x => + letb x := ret_both ((x) : (t_CastVoteParam (v_Z))) in + ControlFlow_Continue (solve_lift x) + | Result_Err_case x => + letb x := ret_both ((x) : (t_ParseError)) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist3 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (solve_lift (never_to_any hoist3)) + end in + ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + ssp (fun _ => + solve_lift (ifb not (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist4 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist4) + else ()) : both (*0*)(L2:|:fset []) (I2) (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in + letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in + letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in + letb commit_vi := commit_to g_pow_xi_yi_vi in + letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in + letb _ := assignb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc] :|: f_get_loc :|: f_clone_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc :|: f_parameter_cursor_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). +Fail Next Obligation. + +Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both L1 I1 ('unit)) : both (L1 :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_commit_vis_loc :|: f_g_pow_xi_yi_vis_loc :|: f_g_pow_xis_loc :|: f_tally_loc :|: f_zkp_vis_loc :|: f_zkp_xis_loc :|: f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)) := + init_ovn_contract _ := + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_field_zero (ret_both (tt : 'unit))) (f_schnorr_zkp_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_y := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_c := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d2 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both (L1 :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_commit_vis_loc :|: f_g_pow_xi_yi_vis_loc :|: f_g_pow_xis_loc :|: f_tally_loc :|: f_zkp_vis_loc :|: f_zkp_xis_loc :|: f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)). +Fail Next Obligation. + +Definition register_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n);4%nat). +Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc] :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc :|: f_g_pow_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := + register_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_RegisterParam (v_Z)) := matchb out with + | Result_Ok_case x => + letb x := ret_both ((x) : (t_RegisterParam (v_Z))) in + ControlFlow_Continue (solve_lift x) + | Result_Err_case x => + letb x := ret_both ((x) : (t_ParseError)) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist5 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (solve_lift (never_to_any hoist5)) + end in + ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in + letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in + letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in + letb _ := assignb register_vote_state_ret loc(register_vote_state_ret_loc) := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in + letb _ := assignb register_vote_state_ret loc(register_vote_state_ret_loc) := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc] :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc :|: f_g_pow_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). +Fail Next Obligation. + +Definition curr_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (f_field_type;5%nat). +Definition tally_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (int32;6%nat). +Definition tally_votes_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n);7%nat). +Definition vote_result_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := + (f_group_type;8%nat). +Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc] :|: f_clone_loc :|: f_eq_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc :|: f_g_pow_loc :|: f_group_one_loc :|: f_prod_loc :|: f_add_loc :|: f_field_one_loc :|: f_field_zero_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := + tally_votes _ state := + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + ssp (fun _ => + letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] _ := ControlFlow_Continue (ifb not (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist6 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist6) + else ()) in + solve_lift (ifb not (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist7 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist7) + else ()) : both (*0*)(L2:|:fset []) (I2) (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in + letb vote_result loc(vote_result_loc) := f_group_one (ret_both (tt : 'unit)) in + letb _ := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => + ssp (fun _ => + assignb vote_result loc(vote_result_loc) := f_prod vote_result g_pow_vote : both (*1*)(L2:|:fset [vote_result_loc]) (I2) ('unit))) (ret_both (tt : 'unit)) in + letb tally loc(tally_loc) := ret_both (0 : int32) in + letb curr loc(curr_loc) := f_field_zero (ret_both (tt : 'unit)) in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => + ssp (fun _ => + letb _ := ifb (f_g_pow curr) =.? vote_result + then letb _ := assignb tally loc(tally_loc) := i in + ret_both (tt : 'unit) + else () in + letb _ := assignb curr loc(curr_loc) := f_add curr (f_field_one (ret_both (tt : 'unit))) in + solve_lift (ret_both (tt : 'unit)) : both (*3*)(fset [curr_loc;tally_loc;vote_result_loc]) ((fset [])) ('unit))) (ret_both (tt : 'unit)) in + letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in + letb _ := assignb tally_votes_state_ret loc(tally_votes_state_ret_loc) := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in + Result_Ok (solve_lift (prod_b (f_accept (ret_both (tt : 'unit)),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc] :|: f_clone_loc :|: f_eq_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc :|: f_g_pow_loc :|: f_group_one_loc :|: f_prod_loc :|: f_add_loc :|: f_field_one_loc :|: f_field_zero_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). +Fail Next Obligation. (** Concert lib part **) From ConCert.Utils Require Import Extras. From ea59ddb2b47c9364c971b8c4e3293469173c01cb Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Mon, 19 Feb 2024 18:50:14 +0100 Subject: [PATCH 61/86] No location OVN --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 477 ++++++++---------- .../extraction/Hacspec_ovn_Ovn_traits.v | 60 +-- 2 files changed, 225 insertions(+), 312 deletions(-) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index e19054e..3cb2a3b 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -33,95 +33,75 @@ Export Hacspec_ovn_Ovn_traits. (*Not implemented yet? todo(item)*) -Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (xi : both L1 I1 (f_field_type)) (vote : both L2 I2 ('bool)) (g_pow_yi : both L3 I3 (f_group_type)) : both (L1 :|: L2 :|: L3 :|: f_g_pow_loc :|: f_pow_loc :|: f_prod_loc :|: f_field_one_loc :|: f_field_zero_loc) (I1 :|: I2 :|: I3) (f_group_type) := +Equations compute_group_element_for_vote {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (xi : both (f_field_type)) (vote : both ('bool)) (g_pow_yi : both (f_group_type)) : both (f_group_type) := compute_group_element_for_vote xi vote g_pow_yi := solve_lift (f_prod (f_pow g_pow_yi xi) (f_g_pow (ifb vote then f_field_one (ret_both (tt : 'unit)) - else f_field_zero (ret_both (tt : 'unit))))) : both (L1 :|: L2 :|: L3 :|: f_g_pow_loc :|: f_pow_loc :|: f_prod_loc :|: f_field_one_loc :|: f_field_zero_loc) (I1 :|: I2 :|: I3) (f_group_type). + else f_field_zero (ret_both (tt : 'unit))))) : both (f_group_type). Fail Next Obligation. -Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (random : both L1 I1 (int32)) : both (L1 :|: f_random_field_elem_loc) I1 (f_field_type) := +Equations select_private_voting_key {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (random : both (int32)) : both (f_field_type) := select_private_voting_key random := - solve_lift (f_random_field_elem random) : both (L1 :|: f_random_field_elem_loc) I1 (f_field_type). + solve_lift (f_random_field_elem random) : both (f_field_type). Fail Next Obligation. -(* assignb prod1 loc(prod1_loc) := f_prod prod1 (xis.a[j]) *) - -Notation f_into_iter_loc := fset0. -Notation f_end_loc := fset0. -Notation f_start_loc := fset0. - -Check assign_mut_both. - -Definition prod1_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := - (f_group_type;0%nat). -Definition prod2_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := - (f_group_type;1%nat). -Equations compute_g_pow_yi {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both L1 I1 (uint_size)) (xis : both L2 I2 (nseq (f_group_type) (is_pure (n)))) : both (L1 :|: L2 :|: fset [prod1_loc (n := n);prod2_loc (n := n)] :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_div_loc :|: f_group_one_loc :|: f_prod_loc) (I1 :|: I2) (f_group_type) := +Equations compute_g_pow_yi {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both (uint_size)) (xis : both (nseq f_group_type (is_pure (n)))) : both (f_group_type) := compute_g_pow_yi i xis := - letb prod1 loc(prod1_loc) := f_group_one (ret_both (tt : 'unit)) in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => - ssp (fun _ => - solve_lift assign_mut_both prod1_loc (f_prod prod1 (xis.a[j])) : both (*1*)(L1 :|: L2 :|: fset [prod1_loc;prod2_loc] :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_div_loc :|: f_group_one_loc :|: f_prod_loc) (I2:|:I1) ('unit))) (ret_both (tt : 'unit)) in - letb prod2 loc(prod2_loc) := f_group_one (ret_both (tt : 'unit)) in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => - ssp (fun _ => - solve_lift assign_mut_both prod2_loc (f_prod prod2 (xis.a[j])) : both (*1*)(L1 :|: L2 :|: fset [prod1_loc;prod2_loc] :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_div_loc :|: f_group_one_loc :|: f_prod_loc) (I2:|:I1) ('unit))) (ret_both (tt : 'unit)) in - solve_lift (f_div prod1 prod2) : both (L1 :|: L2 :|: fset [prod1_loc;prod2_loc] :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_div_loc :|: f_group_one_loc :|: f_prod_loc) (I1 :|: I2) (f_group_type). -Solve All Obligations with ( solve_ssprove_obligations ; ((now (rewrite !fset0E ; apply (ret_both 0))) || (now destruct from_uint_size))). -Fail Next Obligation. - -Notation f_eq_loc := fset0. -Equations impl__into_vec {L I A n} : both L I (nseq_ A n) -> both L I (t_Vec A t_Global) := - impl__into_vec X := bind_both X (fun x : nseq_ A n => solve_lift (ret_both (Hacspec_Lib_Pre.array_to_list x : chList _))). -Fail Next Obligation. - -Definition unsize {A} := @id A. -Definition box_new {A} := @id A. - -Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (commitment : both L2 I2 (f_field_type)) : both (L1 :|: L2 :|: f_eq_loc :|: f_hash_loc) (I1 :|: I2) ('bool) := + letb prod1 := f_group_one (ret_both (tt : 'unit)) in + letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => + ssp (fun prod1 => + solve_lift (f_prod prod1 (xis.a[j])) : both (f_group_type))) prod1 in + letb prod2 := f_group_one (ret_both (tt : 'unit)) in + letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => + ssp (fun prod2 => + solve_lift (f_prod prod2 (xis.a[j])) : both (f_group_type))) prod2 in + solve_lift (f_div prod1 prod2) : both (f_group_type). +Solve All Obligations with now intros ; destruct from_uint_size. +Fail Next Obligation. + +Equations check_commitment {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both (f_group_type)) (commitment : both (f_field_type)) : both ('bool) := check_commitment g_pow_xi_yi_vi commitment := - solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both (L1 :|: L2 :|: f_eq_loc :|: f_hash_loc) (I1 :|: I2) ('bool). + solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both ('bool). Fail Next Obligation. -Equations commit_to {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) : both (L1 :|: f_hash_loc) I1 (f_field_type) := +Equations commit_to {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both (f_group_type)) : both (f_field_type) := commit_to g_pow_xi_yi_vi := - solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both (L1 :|: f_hash_loc) I1 (f_field_type). + solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both (f_field_type). Fail Next Obligation. Definition t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := (int32 × f_field_type × int32 × int32 × int32 × 'bool). -Equations f_cvp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := +Equations f_cvp_i {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := f_cvp_i s := bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : int32))) : both L I (int32). + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : int32))) : both (int32). Fail Next Obligation. -Equations f_cvp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (f_field_type) := +Equations f_cvp_xi {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (f_field_type) := f_cvp_xi s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both L I (f_field_type). + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_cvp_zkp_random_w {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := +Equations f_cvp_zkp_random_w {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := f_cvp_zkp_random_w s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : int32))) : both L I (int32). + solve_lift (ret_both (snd (fst (fst (fst x))) : int32))) : both (int32). Fail Next Obligation. -Equations f_cvp_zkp_random_r {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := +Equations f_cvp_zkp_random_r {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := f_cvp_zkp_random_r s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : int32))) : both L I (int32). + solve_lift (ret_both (snd (fst (fst x)) : int32))) : both (int32). Fail Next Obligation. -Equations f_cvp_zkp_random_d {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := +Equations f_cvp_zkp_random_d {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := f_cvp_zkp_random_d s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). + solve_lift (ret_both (snd (fst x) : int32))) : both (int32). Fail Next Obligation. -Equations f_cvp_vote {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I ('bool) := +Equations f_cvp_vote {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both ('bool) := f_cvp_vote s := bind_both s (fun x => - solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). + solve_lift (ret_both (snd x : 'bool))) : both ('bool). Fail Next Obligation. -Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (f_field_type)} {f_cvp_zkp_random_w : both L2 I2 (int32)} {f_cvp_zkp_random_r : both L3 I3 (int32)} {f_cvp_zkp_random_d : both L4 I4 (int32)} {f_cvp_vote : both L5 I5 ('bool)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_CastVoteParam) := +Equations Build_t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_cvp_i : both (int32)} {f_cvp_xi : both (f_field_type)} {f_cvp_zkp_random_w : both (int32)} {f_cvp_zkp_random_r : both (int32)} {f_cvp_zkp_random_d : both (int32)} {f_cvp_vote : both ('bool)} : both (t_CastVoteParam) := Build_t_CastVoteParam := bind_both f_cvp_vote (fun f_cvp_vote => bind_both f_cvp_zkp_random_d (fun f_cvp_zkp_random_d => @@ -129,7 +109,7 @@ Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L bind_both f_cvp_zkp_random_w (fun f_cvp_zkp_random_w => bind_both f_cvp_xi (fun f_cvp_xi => bind_both f_cvp_i (fun f_cvp_i => - solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_CastVoteParam). + solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam))))))))) : both (t_CastVoteParam). Fail Next Obligation. Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). @@ -140,62 +120,62 @@ Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Bui Definition t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := (f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_field_type × f_field_type × f_field_type × f_field_type × f_field_type). -Equations f_or_zkp_x {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := +Equations f_or_zkp_x {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := f_or_zkp_x s := bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both L I (f_group_type). + solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_or_zkp_y {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := +Equations f_or_zkp_y {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := f_or_zkp_y s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both L I (f_group_type). + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_or_zkp_a1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := +Equations f_or_zkp_a1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := f_or_zkp_a1 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : f_group_type))) : both L I (f_group_type). + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_or_zkp_b1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := +Equations f_or_zkp_b1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := f_or_zkp_b1 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : f_group_type))) : both L I (f_group_type). + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_or_zkp_a2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := +Equations f_or_zkp_a2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := f_or_zkp_a2 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : f_group_type))) : both L I (f_group_type). + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_or_zkp_b2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := +Equations f_or_zkp_b2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := f_or_zkp_b2 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : f_group_type))) : both L I (f_group_type). + solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_or_zkp_c {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := +Equations f_or_zkp_c {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := f_or_zkp_c s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both L I (f_field_type). + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_or_zkp_d1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := +Equations f_or_zkp_d1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := f_or_zkp_d1 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : f_field_type))) : both L I (f_field_type). + solve_lift (ret_both (snd (fst (fst (fst x))) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_or_zkp_d2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := +Equations f_or_zkp_d2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := f_or_zkp_d2 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : f_field_type))) : both L I (f_field_type). + solve_lift (ret_both (snd (fst (fst x)) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_or_zkp_r1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := +Equations f_or_zkp_r1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := f_or_zkp_r1 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). + solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_or_zkp_r2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := +Equations f_or_zkp_r2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := f_or_zkp_r2 s := bind_both s (fun x => - solve_lift (ret_both (snd x : f_field_type))) : both L I (f_field_type). + solve_lift (ret_both (snd x : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations Build_t_OrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {L7 : {fset Location}} {L8 : {fset Location}} {L9 : {fset Location}} {L10 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {I7 : Interface} {I8 : Interface} {I9 : Interface} {I10 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_or_zkp_x : both L0 I0 (f_group_type)} {f_or_zkp_y : both L1 I1 (f_group_type)} {f_or_zkp_a1 : both L2 I2 (f_group_type)} {f_or_zkp_b1 : both L3 I3 (f_group_type)} {f_or_zkp_a2 : both L4 I4 (f_group_type)} {f_or_zkp_b2 : both L5 I5 (f_group_type)} {f_or_zkp_c : both L6 I6 (f_field_type)} {f_or_zkp_d1 : both L7 I7 (f_field_type)} {f_or_zkp_d2 : both L8 I8 (f_field_type)} {f_or_zkp_r1 : both L9 I9 (f_field_type)} {f_or_zkp_r2 : both L10 I10 (f_field_type)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit) := +Equations Build_t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_or_zkp_x : both (f_group_type)} {f_or_zkp_y : both (f_group_type)} {f_or_zkp_a1 : both (f_group_type)} {f_or_zkp_b1 : both (f_group_type)} {f_or_zkp_a2 : both (f_group_type)} {f_or_zkp_b2 : both (f_group_type)} {f_or_zkp_c : both (f_field_type)} {f_or_zkp_d1 : both (f_field_type)} {f_or_zkp_d2 : both (f_field_type)} {f_or_zkp_r1 : both (f_field_type)} {f_or_zkp_r2 : both (f_field_type)} : both (t_OrZKPCommit) := Build_t_OrZKPCommit := bind_both f_or_zkp_r2 (fun f_or_zkp_r2 => bind_both f_or_zkp_r1 (fun f_or_zkp_r1 => @@ -208,7 +188,7 @@ Equations Build_t_OrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 bind_both f_or_zkp_a1 (fun f_or_zkp_a1 => bind_both f_or_zkp_y (fun f_or_zkp_y => bind_both f_or_zkp_x (fun f_or_zkp_x => - solve_lift (ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit)))))))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit). + solve_lift (ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit)))))))))))))) : both (t_OrZKPCommit). Fail Next Obligation. Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := y) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := y) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). @@ -224,27 +204,27 @@ Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r2' ':=' y ')'" := (Buil Definition t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := (int32 × f_field_type × int32). -Equations f_rp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (int32) := +Equations f_rp_i {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_RegisterParam)) : both (int32) := f_rp_i s := bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). + solve_lift (ret_both (fst (fst x) : int32))) : both (int32). Fail Next Obligation. -Equations f_rp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (f_field_type) := +Equations f_rp_xi {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_RegisterParam)) : both (f_field_type) := f_rp_xi s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). + solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_rp_zkp_random {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (int32) := +Equations f_rp_zkp_random {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_RegisterParam)) : both (int32) := f_rp_zkp_random s := bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). + solve_lift (ret_both (snd x : int32))) : both (int32). Fail Next Obligation. -Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (f_field_type)} {f_rp_zkp_random : both L2 I2 (int32)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_RegisterParam) := +Equations Build_t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_rp_i : both (int32)} {f_rp_xi : both (f_field_type)} {f_rp_zkp_random : both (int32)} : both (t_RegisterParam) := Build_t_RegisterParam := bind_both f_rp_zkp_random (fun f_rp_zkp_random => bind_both f_rp_xi (fun f_rp_xi => bind_both f_rp_i (fun f_rp_i => - solve_lift (ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_RegisterParam). + solve_lift (ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam)))))) : both (t_RegisterParam). Fail Next Obligation. Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x)). Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y) (f_rp_zkp_random := f_rp_zkp_random x)). @@ -252,27 +232,27 @@ Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := Definition t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := (f_group_type × f_field_type × f_field_type). -Equations f_schnorr_zkp_u {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_group_type) := +Equations f_schnorr_zkp_u {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_SchnorrZKPCommit)) : both (f_group_type) := f_schnorr_zkp_u s := bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : f_group_type))) : both L I (f_group_type). + solve_lift (ret_both (fst (fst x) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_schnorr_zkp_c {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := +Equations f_schnorr_zkp_c {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_SchnorrZKPCommit)) : both (f_field_type) := f_schnorr_zkp_c s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). + solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_schnorr_zkp_z {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := +Equations f_schnorr_zkp_z {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_SchnorrZKPCommit)) : both (f_field_type) := f_schnorr_zkp_z s := bind_both s (fun x => - solve_lift (ret_both (snd x : f_field_type))) : both L I (f_field_type). + solve_lift (ret_both (snd x : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations Build_t_SchnorrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_schnorr_zkp_u : both L0 I0 (f_group_type)} {f_schnorr_zkp_c : both L1 I1 (f_field_type)} {f_schnorr_zkp_z : both L2 I2 (f_field_type)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit) := +Equations Build_t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_schnorr_zkp_u : both (f_group_type)} {f_schnorr_zkp_c : both (f_field_type)} {f_schnorr_zkp_z : both (f_field_type)} : both (t_SchnorrZKPCommit) := Build_t_SchnorrZKPCommit := bind_both f_schnorr_zkp_z (fun f_schnorr_zkp_z => bind_both f_schnorr_zkp_c (fun f_schnorr_zkp_c => bind_both f_schnorr_zkp_u (fun f_schnorr_zkp_u => - solve_lift (ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit). + solve_lift (ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit)))))) : both (t_SchnorrZKPCommit). Fail Next Obligation. Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := y) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := y) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). @@ -280,47 +260,31 @@ Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_z' ':=' y ')'" Definition t_TallyParameter : choice_type := 'unit. -Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := +Equations Build_t_TallyParameter : both (t_TallyParameter) := Build_t_TallyParameter := - solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). + solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (t_TallyParameter). Fail Next Obligation. -Notation f_schnorr_zkp_c_loc := fset0. -Notation f_schnorr_zkp_u_loc := fset0. -Notation f_schnorr_zkp_z_loc := fset0. - -Equations schnorr_zkp {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (h : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3 :|: f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_add_loc :|: f_mul_loc :|: f_random_field_elem_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := +Equations schnorr_zkp {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both (int32)) (h : both (f_group_type)) (x : both (f_field_type)) : both (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := schnorr_zkp random h x := solve_lift (run (letb r := f_random_field_elem random in letb u := f_g_pow r in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [solve_lift f_g (ret_both (tt : 'unit)) : both (L1 :|: L2 :|: L3 :|: f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_add_loc :|: f_mul_loc :|: f_random_field_elem_loc) (I1 :|: I2 :|: I3) _; - solve_lift h; - solve_lift u])))) in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); + h; + u])))) in letb z := f_add r (f_mul c x) in letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in - ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3 :|: f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_add_loc :|: f_mul_loc :|: f_random_field_elem_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). + ControlFlow_Continue (never_to_any hoist1))) : both (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). Fail Next Obligation. -Equations schnorr_zkp_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (pi : both L2 I2 (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 :|: f_eq_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc) (I1 :|: I2) ('bool) := +Equations schnorr_zkp_validate {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both (f_group_type)) (pi : both (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both ('bool) := schnorr_zkp_validate h pi := - solve_lift (andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [solve_lift f_g (ret_both (tt : 'unit)) : both (L1 :|: L2 :|: f_eq_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc) (I1 :|: I2) _; - solve_lift h; - solve_lift f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both (L1 :|: L2 :|: f_eq_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Notation f_or_zkp_a1_loc := fset0. -Notation f_or_zkp_a2_loc := fset0. -Notation f_or_zkp_b1_loc := fset0. -Notation f_or_zkp_b2_loc := fset0. -Notation f_or_zkp_c_loc := fset0. -Notation f_or_zkp_d1_loc := fset0. -Notation f_or_zkp_d2_loc := fset0. -Notation f_or_zkp_r1_loc := fset0. -Notation f_or_zkp_r2_loc := fset0. -Notation f_or_zkp_x_loc := fset0. -Notation f_or_zkp_y_loc := fset0. - -Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both L1 I1 (int32)) (random_r : both L2 I2 (int32)) (random_d : both L3 I3 (int32)) (h : both L4 I4 (f_group_type)) (xi : both L5 I5 (f_field_type)) (vi : both L6 I6 ('bool)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) := + solve_lift (andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); + h; + f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both ('bool). +Fail Next Obligation. + +Equations zkp_one_out_of_two {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both (int32)) (random_r : both (int32)) (random_d : both (int32)) (h : both (f_group_type)) (xi : both (f_field_type)) (vi : both ('bool)) : both (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) := zkp_one_out_of_two random_w random_r random_d h xi vi := letb w := f_random_field_elem random_w in solve_lift (ifb vi @@ -332,12 +296,12 @@ Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : letb b1 := f_prod (f_pow h r1) (f_pow y d1) in letb a2 := f_g_pow w in letb b2 := f_pow h w in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [solve_lift x : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) _; - solve_lift y; - solve_lift a1; - solve_lift b1; - solve_lift a2; - solve_lift b2])))) in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; + y; + a1; + b1; + a2; + b2])))) in letb d2 := f_sub c d1 in letb r2 := f_sub w (f_mul xi d2) in Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2) @@ -349,18 +313,18 @@ Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : letb b1 := f_pow h w in letb a2 := f_prod (f_g_pow r2) (f_pow x d2) in letb b2 := f_prod (f_pow h r2) (f_pow (f_div y (f_g (ret_both (tt : 'unit)))) d2) in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [solve_lift x : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) _; - solve_lift y; - solve_lift a1; - solve_lift b1; - solve_lift a2; - solve_lift b2])))) in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; + y; + a1; + b1; + a2; + b2])))) in letb d1 := f_sub c d2 in letb r1 := f_sub w (f_mul xi d1) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_random_field_elem_loc :|: f_sub_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)). + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)). Fail Next Obligation. -Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (zkp : both L2 I2 (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 :|: f_eq_loc :|: f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_add_loc) (I1 :|: I2) ('bool) := +Equations zkp_one_out_of_two_validate {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both (f_group_type)) (zkp : both (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both ('bool) := zkp_one_out_of_two_validate h zkp := letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; f_or_zkp_y zkp; @@ -368,42 +332,42 @@ Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Locatio f_or_zkp_b1 zkp; f_or_zkp_a2 zkp; f_or_zkp_b2 zkp])))) in - solve_lift (andb (andb (andb (andb (c =.? (f_add (f_or_zkp_d1 zkp) (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? (f_prod (f_pow h (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r2 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? (f_prod (f_pow h (f_or_zkp_r2 zkp)) (f_pow (f_div (f_or_zkp_y zkp) (f_g (ret_both (tt : 'unit)))) (f_or_zkp_d2 zkp))))) : both (L1 :|: L2 :|: f_eq_loc :|: f_div_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_pow_loc :|: f_prod_loc :|: f_add_loc) (I1 :|: I2) ('bool). + solve_lift (andb (andb (andb (andb (c =.? (f_add (f_or_zkp_d1 zkp) (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? (f_prod (f_pow h (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r2 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? (f_prod (f_pow h (f_or_zkp_r2 zkp)) (f_pow (f_div (f_or_zkp_y zkp) (f_g (ret_both (tt : 'unit)))) (f_or_zkp_d2 zkp))))) : both ('bool). Fail Next Obligation. -Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := - (nseq (f_group_type) (is_pure (n)) × nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × nseq (f_field_type) (is_pure (n)) × nseq (f_group_type) (is_pure (n)) × nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × int32). -Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq (f_group_type) (is_pure (n))) := +Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := + (nseq f_group_type (is_pure (n)) × nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × nseq f_field_type (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × int32). +Equations f_g_pow_xis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq f_group_type (is_pure (n))) := f_g_pow_xis s := bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq (f_group_type) (is_pure (n))))) : both L I (nseq (f_group_type) (is_pure (n))). + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type (is_pure (n))))) : both (nseq f_group_type (is_pure (n))). Fail Next Obligation. -Equations f_zkp_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := +Equations f_zkp_xis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := f_zkp_xis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both L I (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). Fail Next Obligation. -Equations f_commit_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq (f_field_type) (is_pure (n))) := +Equations f_commit_vis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq f_field_type (is_pure (n))) := f_commit_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : nseq (f_field_type) (is_pure (n))))) : both L I (nseq (f_field_type) (is_pure (n))). + solve_lift (ret_both (snd (fst (fst (fst x))) : nseq f_field_type (is_pure (n))))) : both (nseq f_field_type (is_pure (n))). Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq (f_group_type) (is_pure (n))) := +Equations f_g_pow_xi_yi_vis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq f_group_type (is_pure (n))) := f_g_pow_xi_yi_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : nseq (f_group_type) (is_pure (n))))) : both L I (nseq (f_group_type) (is_pure (n))). + solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type (is_pure (n))))) : both (nseq f_group_type (is_pure (n))). Fail Next Obligation. -Equations f_zkp_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := +Equations f_zkp_vis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := f_zkp_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both L I (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). + solve_lift (ret_both (snd (fst x) : nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). Fail Next Obligation. -Equations f_tally {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (int32) := +Equations f_tally {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (int32) := f_tally s := bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). + solve_lift (ret_both (snd x : int32))) : both (int32). Fail Next Obligation. -Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_g_pow_xis : both L0 I0 (nseq (f_group_type) (is_pure (n)))} {f_zkp_xis : both L1 I1 (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_commit_vis : both L2 I2 (nseq (f_field_type) (is_pure (n)))} {f_g_pow_xi_yi_vis : both L3 I3 (nseq (f_group_type) (is_pure (n)))} {f_zkp_vis : both L4 I4 (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState (n := n)) := +Equations Build_t_OvnContractState {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_g_pow_xis : both (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_commit_vis : both (nseq f_field_type (is_pure (n)))} {f_g_pow_xi_yi_vis : both (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_tally : both (int32)} : both (t_OvnContractState (n := n)) := Build_t_OvnContractState := bind_both f_tally (fun f_tally => bind_both f_zkp_vis (fun f_zkp_vis => @@ -411,7 +375,7 @@ Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} bind_both f_commit_vis (fun f_commit_vis => bind_both f_zkp_xis (fun f_zkp_xis => bind_both f_g_pow_xis (fun f_g_pow_xis => - solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). + solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (t_OvnContractState). Fail Next Obligation. Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). @@ -420,18 +384,7 @@ Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ') Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). -Definition cast_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *);2%nat). - -Notation f_get_loc := fset0. -Notation f_clone_loc := fset0. -Notation f_accept_loc := fset0. -Notation f_parameter_cursor_loc := fset0. - -Notation Result_Ok_case := inl. -Notation Result_Err_case := inr. - -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)] :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := +Equations cast_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := cast_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with @@ -440,111 +393,101 @@ Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interfac ControlFlow_Continue (solve_lift x) | Result_Err_case x => letb x := ret_both ((x) : (t_ParseError)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist2 := v_Break (Result_Err _) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist2 := v_Break (Result_Err (ret_both tt)) in ControlFlow_Continue (solve_lift (never_to_any hoist2)) end in ControlFlow_Continue (letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in - letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in - letb _ := assignb cast_vote_state_ret loc(cast_vote_state_ret_loc) := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in - letb _ := assignb cast_vote_state_ret loc(cast_vote_state_ret_loc) := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc] :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). + letb cast_vote_state_ret := f_clone state in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). Fail Next Obligation. -Definition commit_to_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n);3%nat). -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc] :|: f_get_loc :|: f_clone_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc :|: f_parameter_cursor_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := +Equations commit_to_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := commit_to_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with | Result_Ok_case x => - letb x := ret_both ((x) : (t_CastVoteParam (v_Z))) in + letb x := ret_both ((x) : _ (* (t_CastVoteParam (v_Z)) *)) in ControlFlow_Continue (solve_lift x) | Result_Err_case x => letb x := ret_both ((x) : (t_ParseError)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist3 := v_Break (Result_Err ParseError) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist3 := v_Break (Result_Err (ret_both tt)) in ControlFlow_Continue (solve_lift (never_to_any hoist3)) end in ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => - solve_lift (ifb not (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist4 := v_Break (Result_Err ParseError) in + solve_lift (ifb negb (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist4 := v_Break (Result_Err (ret_both tt)) in ControlFlow_Continue (never_to_any hoist4) - else ()) : both (*0*)(L2:|:fset []) (I2) (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in + else ControlFlow_Continue (ret_both (tt : 'unit))) : both _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in letb commit_vi := commit_to g_pow_xi_yi_vi in - letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in - letb _ := assignb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc] :|: f_get_loc :|: f_clone_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc :|: f_parameter_cursor_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). + letb commit_to_vote_state_ret := f_clone state in + letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),commit_to_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). +Solve All Obligations with now intros ; destruct from_uint_size. Fail Next Obligation. -Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both L1 I1 ('unit)) : both (L1 :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_commit_vis_loc :|: f_g_pow_xi_yi_vis_loc :|: f_g_pow_xis_loc :|: f_tally_loc :|: f_zkp_vis_loc :|: f_zkp_xis_loc :|: f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)) := +Equations init_ovn_contract {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both ('unit)) : both (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)) := init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_field_zero (ret_both (tt : 'unit))) (f_schnorr_zkp_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_y := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_c := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d2 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both (L1 :|: f_or_zkp_a1_loc :|: f_or_zkp_a2_loc :|: f_or_zkp_b1_loc :|: f_or_zkp_b2_loc :|: f_or_zkp_c_loc :|: f_or_zkp_d1_loc :|: f_or_zkp_d2_loc :|: f_or_zkp_r1_loc :|: f_or_zkp_r2_loc :|: f_or_zkp_x_loc :|: f_or_zkp_y_loc :|: f_commit_vis_loc :|: f_g_pow_xi_yi_vis_loc :|: f_g_pow_xis_loc :|: f_tally_loc :|: f_zkp_vis_loc :|: f_zkp_xis_loc :|: f_schnorr_zkp_c_loc :|: f_schnorr_zkp_u_loc :|: f_schnorr_zkp_z_loc :|: f_group_one_loc :|: f_field_zero_loc) I1 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)). + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_field_zero (ret_both (tt : 'unit))) (f_schnorr_zkp_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_y := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_c := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d2 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)). Fail Next Obligation. -Definition register_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n);4%nat). -Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc] :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc :|: f_g_pow_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := +Equations register_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := register_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_RegisterParam (v_Z)) := matchb out with | Result_Ok_case x => - letb x := ret_both ((x) : (t_RegisterParam (v_Z))) in + letb x := ret_both ((x) : _ (* (t_RegisterParam (v_Z)) *)) in ControlFlow_Continue (solve_lift x) | Result_Err_case x => letb x := ret_both ((x) : (t_ParseError)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist5 := v_Break (Result_Err ParseError) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist5 := v_Break (Result_Err (ret_both tt)) in ControlFlow_Continue (solve_lift (never_to_any hoist5)) end in ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in - letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in - letb _ := assignb register_vote_state_ret loc(register_vote_state_ret_loc) := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in - letb _ := assignb register_vote_state_ret loc(register_vote_state_ret_loc) := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc] :|: f_get_loc :|: f_clone_loc :|: f_accept_loc :|: f_parameter_cursor_loc :|: f_g_pow_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). -Fail Next Obligation. - -Definition curr_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (f_field_type;5%nat). -Definition tally_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (int32;6%nat). -Definition tally_votes_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n);7%nat). -Definition vote_result_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (f_group_type;8%nat). -Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc] :|: f_clone_loc :|: f_eq_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc :|: f_g_pow_loc :|: f_group_one_loc :|: f_prod_loc :|: f_add_loc :|: f_field_one_loc :|: f_field_zero_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := + letb register_vote_state_ret := f_clone state in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),register_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). +Fail Next Obligation. + +Equations tally_votes {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := tally_votes _ state := letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] _ := ControlFlow_Continue (ifb not (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist6 := v_Break (Result_Err ParseError) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] _ := ControlFlow_Continue (ifb negb (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist6 := v_Break (Result_Err (ret_both tt)) in ControlFlow_Continue (never_to_any hoist6) - else ()) in - solve_lift (ifb not (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist7 := v_Break (Result_Err ParseError) in + else ControlFlow_Continue (ret_both (tt : 'unit))) in + solve_lift (ifb negb (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist7 := v_Break (Result_Err (ret_both tt)) in ControlFlow_Continue (never_to_any hoist7) - else ()) : both (*0*)(L2:|:fset []) (I2) (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in - letb vote_result loc(vote_result_loc) := f_group_one (ret_both (tt : 'unit)) in - letb _ := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => - ssp (fun _ => - assignb vote_result loc(vote_result_loc) := f_prod vote_result g_pow_vote : both (*1*)(L2:|:fset [vote_result_loc]) (I2) ('unit))) (ret_both (tt : 'unit)) in - letb tally loc(tally_loc) := ret_both (0 : int32) in - letb curr loc(curr_loc) := f_field_zero (ret_both (tt : 'unit)) in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => - ssp (fun _ => - letb _ := ifb (f_g_pow curr) =.? vote_result - then letb _ := assignb tally loc(tally_loc) := i in - ret_both (tt : 'unit) - else () in - letb _ := assignb curr loc(curr_loc) := f_add curr (f_field_one (ret_both (tt : 'unit))) in - solve_lift (ret_both (tt : 'unit)) : both (*3*)(fset [curr_loc;tally_loc;vote_result_loc]) ((fset [])) ('unit))) (ret_both (tt : 'unit)) in - letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in - letb _ := assignb tally_votes_state_ret loc(tally_votes_state_ret_loc) := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in - Result_Ok (solve_lift (prod_b (f_accept (ret_both (tt : 'unit)),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc] :|: f_clone_loc :|: f_eq_loc :|: f_into_iter_loc :|: f_end_loc :|: f_start_loc :|: f_accept_loc :|: f_g_pow_loc :|: f_group_one_loc :|: f_prod_loc :|: f_add_loc :|: f_field_one_loc :|: f_field_zero_loc) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). + else ControlFlow_Continue (ret_both (tt : 'unit))) : both _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in + letb vote_result := f_group_one (ret_both (tt : 'unit)) in + letb vote_result := foldi_both_list ((* f_into_iter *) (array_to_list (f_g_pow_xi_yi_vis state))) (fun g_pow_vote => + ssp (fun vote_result => + solve_lift (f_prod vote_result g_pow_vote) : both (f_group_type))) vote_result in + letb tally := ret_both (0 : int32) in + letb curr := f_field_zero (ret_both (tt : 'unit)) in + letb '(curr,tally) := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => + ssp (fun '(curr,tally) => + letb tally := ifb (f_g_pow curr) =.? vote_result + then letb tally := i in + tally + else tally in + letb curr := f_add curr (f_field_one (ret_both (tt : 'unit))) in + solve_lift (prod_b (curr,tally)) : both ((f_field_type × int32)))) (prod_b (curr,tally)) in + letb tally_votes_state_ret := f_clone state in + letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in + Result_Ok (solve_lift (prod_b (f_accept (* (ret_both (tt : 'unit)) *),tally_votes_state_ret))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). +Solve All Obligations with now intros ; destruct from_uint_size. Fail Next Obligation. (** Concert lib part **) @@ -560,90 +503,90 @@ From ConCert.Execution Require Import ContractCommon. Export ContractCommon. From ConCert.Execution Require Import Serializable. Export Serializable. -Require Import ConCertLib. +From Hacspec Require Import ConCertLib. Export ConCertLib. -Definition state_OVN : choice_type := - t_OvnContractState. - -#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := - {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := - fun x => - x. -Fail Next Obligation. -Definition receive_OVN_cast_vote {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - cast_vote ctx st. +Definition state_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := + t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n). -#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := - {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +#[global] Program Instance t_CastVoteParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_HasReceiveContext t_CastVoteParam 'unit := + {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. Fail Next Obligation. -#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := +#[global] Program Instance t_CastVoteParam_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_Sized t_CastVoteParam := fun x => x. Fail Next Obligation. -Definition receive_OVN_commit_to_vote {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := +Definition receive_OVN_cast_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ temp : t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Sized (t_CastVoteParam (v_Z := v_Z) (H := temp))} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (t_CastVoteParam (v_Z := v_Z)) ('unit)} (ctx : both (t_CastVoteParam (v_Z := v_Z))) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := + cast_vote (v_Z := v_Z) (v_G := v_G) (n := n) (v_A := v_A) (impl_574521470_ := t_CastVoteParam) (H2 := t_CastVoteParam_t_Sized (v_Z := v_Z) (v_G := v_G) (n := n)) ctx st. + +(* #[global] Program Instance t_CastVoteParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_HasReceiveContext t_CastVoteParam 'unit := *) +(* {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. *) +(* Fail Next Obligation. *) +(* #[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := *) +(* fun x => *) +(* x. *) +(* Fail Next Obligation. *) +Definition receive_OVN_commit_to_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_Sized (t_CastVoteParam)} `{ t_HasReceiveContext (t_CastVoteParam) ('unit)} (ctx : both (t_CastVoteParam)) (st : both (state_OVN (n := n))) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := commit_to_vote ctx st. -Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN) (t_ParseError) := +Definition init_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN (n := n)) (t_ParseError) := ResultMonad.Ok st. -#[global] Program Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit := - {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +#[global] Program Instance t_RegisterParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_HasReceiveContext t_RegisterParam 'unit := + {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. Fail Next Obligation. -#[global] Program Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam := +#[global] Program Instance t_RegisterParam_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_Sized t_RegisterParam := fun x => x. Fail Next Obligation. -Definition receive_OVN_register {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_RegisterParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := +Definition receive_OVN_register {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_Sized (t_RegisterParam)} `{ t_HasReceiveContext (t_RegisterParam) ('unit)} (ctx : both (t_RegisterParam)) (st : both (state_OVN (n := n))) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := register_vote ctx st. #[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := - {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. + {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. Fail Next Obligation. #[global] Program Instance t_TallyParameter_t_Sized : t_Sized t_TallyParameter := fun x => x. Fail Next Obligation. -Definition receive_OVN_tally {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_TallyParameter)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := +Definition receive_OVN_tally {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (t_TallyParameter)) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN (n := n))) (t_ParseError)) := tally_votes ctx st. -Inductive Msg_OVN : Type := -| msg_OVN_cast_vote : t_CastVoteParam -> Msg_OVN -| msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN -| msg_OVN_register : t_RegisterParam -> Msg_OVN +Inductive Msg_OVN {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : Type := +| msg_OVN_cast_vote : t_CastVoteParam (v_Z := v_Z) -> Msg_OVN +| msg_OVN_commit_to_vote : t_CastVoteParam (v_Z := v_Z) -> Msg_OVN +| msg_OVN_register : t_RegisterParam (v_Z := v_Z) -> Msg_OVN | msg_OVN_tally : t_TallyParameter -> Msg_OVN. -#[global] Program Instance state_OVN_t_HasReceiveContext : t_HasReceiveContext state_OVN 'unit := - {| f_get := (fun (Ctx : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +#[global] Program Instance state_OVN_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_HasReceiveContext (state_OVN (n := n)) 'unit := + {| f_get := (fun (Ctx : _) => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. Fail Next Obligation. -#[global] Program Instance state_OVN_t_Sized : t_Sized state_OVN := +#[global] Program Instance state_OVN_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_Sized (state_OVN (n := n)) := fun x => x. Fail Next Obligation. -#[global] Program Instance state_OVN_t_HasActions : t_HasActions state_OVN := - Admitted. +#[global] Program Instance state_OVN_t_HasActions {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_HasActions (state_OVN (v_Z := v_Z) (n := n)). +Admit Obligations. Fail Next Obligation. -Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := +Equations receive_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (chain : Chain) (ctx : ContractCallContext) (st : state_OVN (v_Z := v_Z) (v_G := v_G) (n := n)) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := receive_OVN chain ctx st msg := match msg with | Some (msg_OVN_cast_vote val) => - match (is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (ret_both st)))) with + match (is_pure (both_prog (receive_OVN_cast_vote (v_Z := v_Z) (v_G := v_G) (n := n) (ret_both val) (ret_both st)))) with | inl x => ResultMonad.Ok ((fst x), []) | inr x => ResultMonad.Err x end | Some (msg_OVN_commit_to_vote val) => - match (is_pure (both_prog (receive_OVN_commit_to_vote (ret_both val) (ret_both st)))) with + match (is_pure (both_prog (receive_OVN_commit_to_vote (v_Z := v_Z) (v_G := v_G) (n := n) (ret_both val) (ret_both st)))) with | inl x => ResultMonad.Ok ((fst x), []) | inr x => ResultMonad.Err x end | Some (msg_OVN_register val) => - match (is_pure (both_prog (receive_OVN_register (ret_both val) (ret_both st)))) with + match (is_pure (both_prog (receive_OVN_register (v_Z := v_Z) (v_G := v_G) (n := n) (ret_both val) (ret_both st)))) with | inl x => ResultMonad.Ok ((fst x), []) | inr x => ResultMonad.Err x end | Some (msg_OVN_tally val) => - match (is_pure (both_prog (receive_OVN_tally (ret_both val) (ret_both st)))) with + match (is_pure (both_prog (receive_OVN_tally (v_Z := v_Z) (v_G := v_G) (n := n) (ret_both val) (ret_both st)))) with | inl x => ResultMonad.Ok ((fst x), []) | inr x => ResultMonad.Err x end diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v index 126fc0c..bfb1778 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v @@ -34,28 +34,14 @@ Class t_Z_Field (Self : choice_type) := { f_field_type_t_Eq :> t_Eq (f_field_type) ; f_field_type_t_PartialEq :> t_PartialEq (f_field_type) ; f_field_type_t_Sized :> t_Sized (f_field_type) ; - f_q_loc : {fset Location} ; - f_q : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_q_loc) I1 (f_field_type) ; - f_random_field_elem_loc : {fset Location} ; - f_random_field_elem : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_random_field_elem_loc) I1 (f_field_type) ; - f_field_zero_loc : {fset Location} ; - f_field_zero : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_field_zero_loc) I1 (f_field_type) ; - f_field_one_loc : {fset Location} ; - f_field_one : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_field_one_loc) I1 (f_field_type) ; - f_add_loc : {fset Location} ; - f_add : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_add_loc) (I1 :|: I2) (f_field_type) ; - f_sub_loc : {fset Location} ; - f_sub : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_sub_loc) (I1 :|: I2) (f_field_type) ; - f_mul_loc : {fset Location} ; - f_mul : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_mul_loc) (I1 :|: I2) (f_field_type) ; + f_q : both ('unit) -> both (f_field_type) ; + f_random_field_elem : both (int32) -> both (f_field_type) ; + f_field_zero : both ('unit) -> both (f_field_type) ; + f_field_one : both ('unit) -> both (f_field_type) ; + f_add : both (f_field_type) -> both (f_field_type) -> both (f_field_type) ; + f_sub : both (f_field_type) -> both (f_field_type) -> both (f_field_type) ; + f_mul : both (f_field_type) -> both (f_field_type) -> both (f_field_type) ; }. -Hint Unfold f_q_loc. -Hint Unfold f_random_field_elem_loc. -Hint Unfold f_field_zero_loc. -Hint Unfold f_field_one_loc. -Hint Unfold f_add_loc. -Hint Unfold f_sub_loc. -Hint Unfold f_mul_loc. Class t_Group (Self : choice_type) `{t_Z_Field} := { f_group_type : choice_type ; @@ -67,28 +53,12 @@ Class t_Group (Self : choice_type) `{t_Z_Field} := { f_group_type_t_Eq :> t_Eq (f_group_type) ; f_group_type_t_PartialEq :> t_PartialEq (f_group_type) ; f_group_type_t_Sized :> t_Sized (f_group_type) ; - f_g_loc : {fset Location} ; - f_g : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_g_loc) I1 (f_group_type) ; - f_g_pow_loc : {fset Location} ; - f_g_pow : forall {L1 I1}, both L1 I1 (f_field_type) -> both (L1 :|: f_g_pow_loc) I1 (f_group_type) ; - f_pow_loc : {fset Location} ; - f_pow : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_pow_loc) (I1 :|: I2) (f_group_type) ; - f_group_one_loc : {fset Location} ; - f_group_one : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_group_one_loc) I1 (f_group_type) ; - f_prod_loc : {fset Location} ; - f_prod : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_prod_loc) (I1 :|: I2) (f_group_type) ; - f_inv_loc : {fset Location} ; - f_inv : forall {L1 I1}, both L1 I1 (f_group_type) -> both (L1 :|: f_inv_loc) I1 (f_group_type) ; - f_div_loc : {fset Location} ; - f_div : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_div_loc) (I1 :|: I2) (f_group_type) ; - f_hash_loc : {fset Location} ; - f_hash : forall {L1 I1}, both L1 I1 (t_Vec (f_group_type) (t_Global)) -> both (L1 :|: f_hash_loc) I1 (f_field_type) ; + f_g : both ('unit) -> both (f_group_type) ; + f_g_pow : both (f_field_type) -> both (f_group_type) ; + f_pow : both (f_group_type) -> both (f_field_type) -> both (f_group_type) ; + f_group_one : both ('unit) -> both (f_group_type) ; + f_prod : both (f_group_type) -> both (f_group_type) -> both (f_group_type) ; + f_inv : both (f_group_type) -> both (f_group_type) ; + f_div : both (f_group_type) -> both (f_group_type) -> both (f_group_type) ; + f_hash : both (t_Vec (f_group_type) (t_Global)) -> both (f_field_type) ; }. -Hint Unfold f_g_loc. -Hint Unfold f_g_pow_loc. -Hint Unfold f_pow_loc. -Hint Unfold f_group_one_loc. -Hint Unfold f_prod_loc. -Hint Unfold f_inv_loc. -Hint Unfold f_div_loc. -Hint Unfold f_hash_loc. From b6551b06c6441133c805e6dafe1559f058748ea4 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Mon, 19 Feb 2024 20:00:45 +0100 Subject: [PATCH 62/86] Close to done --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 58 +++++++++++---------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 3cb2a3b..085f993 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -516,8 +516,8 @@ Fail Next Obligation. fun x => x. Fail Next Obligation. -Definition receive_OVN_cast_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ temp : t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Sized (t_CastVoteParam (v_Z := v_Z) (H := temp))} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (t_CastVoteParam (v_Z := v_Z)) ('unit)} (ctx : both (t_CastVoteParam (v_Z := v_Z))) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := - cast_vote (v_Z := v_Z) (v_G := v_G) (n := n) (v_A := v_A) (impl_574521470_ := t_CastVoteParam) (H2 := t_CastVoteParam_t_Sized (v_Z := v_Z) (v_G := v_G) (n := n)) ctx st. +Definition receive_OVN_cast_vote {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {v_A : _} `{ t_Sized (v_A)} `{ t_HasActions (v_A)} (ctx : both (t_CastVoteParam (v_Z := v_Z))) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := + cast_vote (v_Z := v_Z) (v_G := v_G) (n := n) (v_A := v_A) (H2 := t_CastVoteParam_t_Sized (v_Z := v_Z) (v_G := v_G) (n := n)) (H7 := t_CastVoteParam_t_HasReceiveContext (v_Z := v_Z) (v_G := v_G) (n := n)) ctx st. (* #[global] Program Instance t_CastVoteParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_HasReceiveContext t_CastVoteParam 'unit := *) (* {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. *) @@ -526,8 +526,8 @@ Definition receive_OVN_cast_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A (* fun x => *) (* x. *) (* Fail Next Obligation. *) -Definition receive_OVN_commit_to_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_Sized (t_CastVoteParam)} `{ t_HasReceiveContext (t_CastVoteParam) ('unit)} (ctx : both (t_CastVoteParam)) (st : both (state_OVN (n := n))) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := - commit_to_vote ctx st. +Definition receive_OVN_commit_to_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both (t_CastVoteParam)) (st : both (state_OVN (n := n))) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := + commit_to_vote (H2 := t_CastVoteParam_t_Sized (n := n)) (H7 := t_CastVoteParam_t_HasReceiveContext (n := n)) ctx st. Definition init_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN (n := n)) (t_ParseError) := ResultMonad.Ok st. @@ -539,8 +539,8 @@ Fail Next Obligation. fun x => x. Fail Next Obligation. -Definition receive_OVN_register {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_Sized (t_RegisterParam)} `{ t_HasReceiveContext (t_RegisterParam) ('unit)} (ctx : both (t_RegisterParam)) (st : both (state_OVN (n := n))) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := - register_vote ctx st. +Definition receive_OVN_register {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both (t_RegisterParam)) (st : both (state_OVN (n := n))) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := + register_vote (H2 := t_RegisterParam_t_Sized (n := n)) (H7 := t_RegisterParam_t_HasReceiveContext (n := n)) ctx st. #[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. @@ -549,56 +549,60 @@ Fail Next Obligation. fun x => x. Fail Next Obligation. -Definition receive_OVN_tally {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (t_TallyParameter)) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN (n := n))) (t_ParseError)) := +Definition receive_OVN_tally {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both (t_TallyParameter)) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN (n := n))) (t_ParseError)) := tally_votes ctx st. -Inductive Msg_OVN {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : Type := -| msg_OVN_cast_vote : t_CastVoteParam (v_Z := v_Z) -> Msg_OVN -| msg_OVN_commit_to_vote : t_CastVoteParam (v_Z := v_Z) -> Msg_OVN +Inductive Msg_OVN {v_Z : _} `{ t_Sized (v_Z)} `{ temp : t_Z_Field (v_Z)} : Type := +| msg_OVN_cast_vote : t_CastVoteParam (v_Z := v_Z) (H0 := temp) -> Msg_OVN +| msg_OVN_commit_to_vote : t_CastVoteParam (v_Z := v_Z) (H0 := temp) -> Msg_OVN | msg_OVN_register : t_RegisterParam (v_Z := v_Z) -> Msg_OVN | msg_OVN_tally : t_TallyParameter -> Msg_OVN. #[global] Program Instance state_OVN_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_HasReceiveContext (state_OVN (n := n)) 'unit := {| f_get := (fun (Ctx : _) => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. Fail Next Obligation. -#[global] Program Instance state_OVN_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_Sized (state_OVN (n := n)) := +#[global] Program Instance state_OVN_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : t_Sized (state_OVN (n := n)) := fun x => x. Fail Next Obligation. -#[global] Program Instance state_OVN_t_HasActions {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_HasActions (state_OVN (v_Z := v_Z) (n := n)). +#[global] Program Instance state_OVN_t_HasActions {v_Z : _} {v_G : _} {n : both (uint_size)}`{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : t_HasActions (state_OVN (v_Z := v_Z) (n := n)). Admit Obligations. Fail Next Obligation. -Equations receive_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (chain : Chain) (ctx : ContractCallContext) (st : state_OVN (v_Z := v_Z) (v_G := v_G) (n := n)) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := +Obligation Tactic := intros. + +(* *) +Equations receive_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ temp1 : t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (chain : Chain) (ctx : ContractCallContext) (st : state_OVN (v_Z := v_Z) (n := n)) (msg : Datatypes.option (Msg_OVN (v_Z := v_Z))) : ResultMonad.result (state_OVN (v_Z := v_Z) (n := n) * list ActionBody) t_ParseError := receive_OVN chain ctx st msg := match msg with | Some (msg_OVN_cast_vote val) => - match (is_pure (both_prog (receive_OVN_cast_vote (v_Z := v_Z) (v_G := v_G) (n := n) (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) + match is_pure (both_prog (@receive_OVN_cast_vote v_Z v_G n _ _ _ _ _ v_A _ _ (ret_both val) (ret_both st))) with + | inl x => ResultMonad.Ok ((snd x), []) | inr x => ResultMonad.Err x end | Some (msg_OVN_commit_to_vote val) => - match (is_pure (both_prog (receive_OVN_commit_to_vote (v_Z := v_Z) (v_G := v_G) (n := n) (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) + match is_pure (both_prog (@receive_OVN_commit_to_vote v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st))) with + | inl x => ResultMonad.Ok ((snd x), []) | inr x => ResultMonad.Err x end | Some (msg_OVN_register val) => - match (is_pure (both_prog (receive_OVN_register (v_Z := v_Z) (v_G := v_G) (n := n) (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) + match is_pure (both_prog (@receive_OVN_register v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st))) with + | inl x => ResultMonad.Ok ((snd x), []) | inr x => ResultMonad.Err x end | Some (msg_OVN_tally val) => - match (is_pure (both_prog (receive_OVN_tally (v_Z := v_Z) (v_G := v_G) (n := n) (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) + match (is_pure (both_prog (@receive_OVN_tally v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((snd x), []) | inr x => ResultMonad.Err x end | _ => ResultMonad.Err tt - end : ResultMonad.result (state_OVN * list ActionBody) t_ParseError. + end : ResultMonad.result (state_OVN (v_Z := v_Z) (n := n) * list ActionBody) t_ParseError. Fail Next Obligation. -#[global] Program Instance state_OVN_Serializable : Serializable state_OVN := +#[global] Program Instance state_OVN_Serializable {v_Z : _} {v_G : _} {n : both (uint_size)} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : Serializable (state_OVN (v_Z := v_Z) (n := n)) := _. +Admit Obligations. Fail Next Obligation. -#[global] Program Instance Msg_OVN_Serializable : Serializable Msg_OVN := - Derive Serializable Msg_OVN_rect. -Fail Next Obligation. -Definition contract_OVN : Contract (state_OVN) (Msg_OVN) (state_OVN) (t_ParseError) := +(* #[global] Program Instance Msg_OVN_Serializable {v_Z : _} `{ t_Sized (v_Z)} `{ temp : t_Z_Field (v_Z)} : Serializable (Msg_OVN (v_Z := v_Z)) := *) +(* Derive Serializable Msg_OVN_rect. *) +(* Fail Next Obligation. *) +Definition contract_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} : Contract (state_OVN (v_Z := v_Z) (n := n)) (Msg_OVN (v_Z := v_Z)) (state_OVN (v_Z := v_Z) (n := n)) (t_ParseError). build_contract init_OVN receive_OVN. From 29698abc4ce7c25f3877e23fa97d488cd4403c0b Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Mon, 19 Feb 2024 20:16:28 +0100 Subject: [PATCH 63/86] Working contract for ovn --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 085f993..023ce1b 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -601,8 +601,8 @@ Fail Next Obligation. _. Admit Obligations. Fail Next Obligation. -(* #[global] Program Instance Msg_OVN_Serializable {v_Z : _} `{ t_Sized (v_Z)} `{ temp : t_Z_Field (v_Z)} : Serializable (Msg_OVN (v_Z := v_Z)) := *) -(* Derive Serializable Msg_OVN_rect. *) -(* Fail Next Obligation. *) -Definition contract_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} : Contract (state_OVN (v_Z := v_Z) (n := n)) (Msg_OVN (v_Z := v_Z)) (state_OVN (v_Z := v_Z) (n := n)) (t_ParseError). - build_contract init_OVN receive_OVN. +#[global] Program Instance Msg_OVN_Serializable {v_Z : _} `{ temp0 : t_Sized (v_Z)} `{ temp1 : t_Z_Field (v_Z)} : Serializable (@Msg_OVN v_Z temp0 temp1). +Admit Obligations. +(* Derive Serializable Msg_OVN_rect. *) +Fail Next Obligation. +Definition contract_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ temp1 : t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ temp2 : t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : @Contract _ (@state_OVN v_Z v_G n temp1 _ _ _ _) (@Msg_OVN v_Z temp1 H1 ) (state_OVN (v_Z := v_Z) (n := n)) (t_ParseError) state_OVN_Serializable Msg_OVN_Serializable state_OVN_Serializable _ := build_contract init_OVN receive_OVN. From 21798d0208afde84839bc25d933a905eff4b71bc Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 5 Mar 2024 11:29:43 +0100 Subject: [PATCH 64/86] No group --- ovn/src/ovn_no_group.rs | 399 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 399 insertions(+) create mode 100644 ovn/src/ovn_no_group.rs diff --git a/ovn/src/ovn_no_group.rs b/ovn/src/ovn_no_group.rs new file mode 100644 index 0000000..fa8a1c0 --- /dev/null +++ b/ovn/src/ovn_no_group.rs @@ -0,0 +1,399 @@ +#![no_std] +#![feature(register_tool)] +#![register_tool(hax)] + +#[hax_lib_macros::exclude] +extern crate hax_lib_macros; + +#[hax_lib_macros::exclude] +use hax_lib_macros::*; + +#[exclude] +use hacspec_concordium::*; +#[exclude] +use hacspec_concordium_derive::*; + +mod ovn_traits; +pub use ovn_traits::*; + +mod ovn_z_89; +pub use ovn_z_89::*; + +type Z : = z_89; +type G = g_z_89; // g_z_89 +const n: usize = 20; + +#[derive(Serialize, SchemaType, Clone, Copy)] +pub struct SchnorrZKPCommit { + pub schnorr_zkp_u: >::group_type, + pub schnorr_zkp_c: ::field_type, + pub schnorr_zkp_z: ::field_type, +} + +/** Non-interactive Schnorr proof using Fiat-Shamir heuristics (RFC 8235) */ +// https://www.rfc-editor.org/rfc/rfc8235 +// https://crypto.stanford.edu/cs355/19sp/lec5.pdf +pub fn schnorr_zkp(random: u32, h: >::group_type, x: ::field_type) -> SchnorrZKPCommit { + let r = ::random_field_elem(random); + let u = >::g_pow(r); + let c = >::hash(vec![>::g(), h, u]); + let z = ::add(r, ::mul(c, x)); + + return SchnorrZKPCommit { + schnorr_zkp_u: u, + schnorr_zkp_c: c, + schnorr_zkp_z: z, + }; +} + +// https://crypto.stanford.edu/cs355/19sp/lec5.pdf +pub fn schnorr_zkp_validate(h: >::group_type, pi: SchnorrZKPCommit) -> bool { + pi.schnorr_zkp_c == >::hash(vec![>::g(), h, pi.schnorr_zkp_u]) + && >::g_pow(pi.schnorr_zkp_z) == >::prod(pi.schnorr_zkp_u, >::pow(h, pi.schnorr_zkp_c)) +} + +#[derive(Serialize, SchemaType, Clone, Copy)] +pub struct OrZKPCommit { + pub or_zkp_x: >::group_type, + pub or_zkp_y: >::group_type, + pub or_zkp_a1: >::group_type, + pub or_zkp_b1: >::group_type, + pub or_zkp_a2: >::group_type, + pub or_zkp_b2: >::group_type, + + pub or_zkp_c: ::field_type, + + pub or_zkp_d1: ::field_type, + pub or_zkp_d2: ::field_type, + + pub or_zkp_r1: ::field_type, + pub or_zkp_r2: ::field_type, +} + +/** Cramer, Damgård and Schoenmakers (CDS) technique */ +pub fn zkp_one_out_of_two( + random_w: u32, + random_r: u32, + random_d: u32, + h: >::group_type, + xi: ::field_type, + vi: bool, +) -> OrZKPCommit { + let w = ::random_field_elem(random_w); + + if vi { + let r1 = ::random_field_elem(random_r); + let d1 = ::random_field_elem(random_d); + + let x = >::g_pow(xi); + let y = >::prod(>::pow(h, xi), >::g()); + + let a1 = >::prod(>::g_pow(r1), >::pow(x, d1)); + let b1 = >::prod(>::pow(h, r1), >::pow(y, d1)); + + let a2 = >::g_pow(w); + let b2 = >::pow(h, w); + + let c = >::hash(vec![x, y, a1, b1, a2, b2]); + + let d2 = ::sub(c, d1); + let r2 = ::sub(w, ::mul(xi, d2)); + + OrZKPCommit { + or_zkp_x: x, + or_zkp_y: y, + or_zkp_a1: a1, + or_zkp_b1: b1, + or_zkp_a2: a2, + or_zkp_b2: b2, + or_zkp_c: c, + or_zkp_d1: d1, + or_zkp_d2: d2, + or_zkp_r1: r1, + or_zkp_r2: r2, + } + } else { + let r2 = ::random_field_elem(random_r); + let d2 = ::random_field_elem(random_d); + + let x = >::g_pow(xi); + let y = >::pow(h, xi); + + let a1 = >::g_pow(w); + let b1 = >::pow(h, w); + + let a2 = >::prod(>::g_pow(r2), >::pow(x, d2)); + let b2 = >::prod(>::pow(h, r2), >::pow(>::div(y, >::g()), d2)); + + let c = >::hash(vec![x, y, a1, b1, a2, b2]); + + let d1 = ::sub(c, d2); + let r1 = ::sub(w, ::mul(xi, d1)); + + OrZKPCommit { + or_zkp_x: x, + or_zkp_y: y, + or_zkp_a1: a1, + or_zkp_b1: b1, + or_zkp_a2: a2, + or_zkp_b2: b2, + or_zkp_c: c, + or_zkp_d1: d1, + or_zkp_d2: d2, + or_zkp_r1: r1, + or_zkp_r2: r2, + } + } +} + +// Anonymous voting by two-round public discussion +pub fn zkp_one_out_of_two_validate(h: >::group_type, zkp: OrZKPCommit) -> bool { + let c = >::hash(vec![ + zkp.or_zkp_x, + zkp.or_zkp_y, + zkp.or_zkp_a1, + zkp.or_zkp_b1, + zkp.or_zkp_a2, + zkp.or_zkp_b2, + ]); // TODO: add i + + (c == ::add(zkp.or_zkp_d1, zkp.or_zkp_d2) + && zkp.or_zkp_a1 == >::prod(>::g_pow(zkp.or_zkp_r1), >::pow(zkp.or_zkp_x, zkp.or_zkp_d1)) + && zkp.or_zkp_b1 + == >::prod( + >::pow(h, zkp.or_zkp_r1), + >::pow(zkp.or_zkp_y, zkp.or_zkp_d1), + ) + && zkp.or_zkp_a2 == >::prod(>::g_pow(zkp.or_zkp_r2), >::pow(zkp.or_zkp_x, zkp.or_zkp_d2)) + && zkp.or_zkp_b2 + == >::prod( + >::pow(h, zkp.or_zkp_r2), + >::pow(>::div(zkp.or_zkp_y, >::g()), zkp.or_zkp_d2), + )) +} + +pub fn commit_to(g_pow_xi_yi_vi: >::group_type) -> ::field_type { + >::hash(vec![g_pow_xi_yi_vi]) +} + +pub fn check_commitment(g_pow_xi_yi_vi: >::group_type, commitment: ::field_type) -> bool { + >::hash(vec![g_pow_xi_yi_vi]) == commitment +} + +#[hax::contract_state(contract = "OVN")] +// #[cfg_attr(not(feature = "hax_compilation"), contract_state(contract = "OVN"))] +#[derive(Serialize, SchemaType, Clone, Copy)] +pub struct OvnContractState { + pub g_pow_xis: [>::group_type; n], + pub zkp_xis: [SchnorrZKPCommit; n], + + pub commit_vis: [::field_type; n], + + pub g_pow_xi_yi_vis: [>::group_type; n], + pub zkp_vis: [OrZKPCommit; n], + + pub tally: u32, +} + +#[hax::init(contract = "OVN")] +// #[cfg_attr(not(feature = "hax_compilation"), init(contract = "OVN"))] +pub fn init_ovn_contract(// _: &impl HasInitContext, +) -> InitResult { + Ok(OvnContractState { + g_pow_xis: [>::group_one(); n], + zkp_xis: [SchnorrZKPCommit { + schnorr_zkp_u: >::group_one(), + schnorr_zkp_z: ::field_zero(), + schnorr_zkp_c: ::field_zero(), + }; n], + + commit_vis: [::field_zero(); n], + + g_pow_xi_yi_vis: [>::group_one(); n], + zkp_vis: [OrZKPCommit { + or_zkp_x: >::group_one(), + or_zkp_y: >::group_one(), + or_zkp_a1: >::group_one(), + or_zkp_b1: >::group_one(), + or_zkp_a2: >::group_one(), + or_zkp_b2: >::group_one(), + + or_zkp_c: ::field_zero(), + + or_zkp_d1: ::field_zero(), + or_zkp_d2: ::field_zero(), + + or_zkp_r1: ::field_zero(), + or_zkp_r2: ::field_zero(), + }; n], + + tally: 0, + }) +} + +/** Currently randomness needs to be injected */ +pub fn select_private_voting_key(random: u32) -> ::field_type { + ::random_field_elem(random) +} + +#[derive(Serialize, SchemaType)] +pub struct RegisterParam { + pub rp_i: u32, + pub rp_xi: ::field_type, + pub rp_zkp_random: u32, +} + +/** Primary function in round 1 */ +#[hax::receive(contract = "OVN", name = "register", parameter = "RegisterParam")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "register", parameter = "RegisterParam"))] +pub fn register_vote( + ctx: impl HasReceiveContext, + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { + let params: RegisterParam = ctx.parameter_cursor().get()?; + let g_pow_xi = >::g_pow(params.rp_xi); + + let zkp_xi = schnorr_zkp(params.rp_zkp_random, g_pow_xi, params.rp_xi); + + let mut register_vote_state_ret = state.clone(); + register_vote_state_ret.g_pow_xis[params.rp_i as usize] = g_pow_xi; + register_vote_state_ret.zkp_xis[params.rp_i as usize] = zkp_xi; + + Ok((A::accept(), register_vote_state_ret)) +} + +#[derive(Serialize, SchemaType)] +pub struct CastVoteParam { + pub cvp_i: u32, + pub cvp_xi: ::field_type, + pub cvp_zkp_random_w: u32, + pub cvp_zkp_random_r: u32, + pub cvp_zkp_random_d: u32, + pub cvp_vote: bool, +} + +pub fn compute_g_pow_yi(i: usize, xis: [>::group_type; n]) -> >::group_type { + let mut prod1 = >::group_one(); + for j in 0..i { + prod1 = >::prod(prod1, xis[j]); + } + + let mut prod2 = >::group_one(); + for j in (i + 1)..n { + prod2 = >::prod(prod2, xis[j]); + } + + // implicitly: Y_i = g^y_i + let g_pow_yi = >::div(prod1, prod2); + g_pow_yi +} + +pub fn compute_group_element_for_vote( + xi: ::field_type, + vote: bool, + g_pow_yi: >::group_type, +) -> >::group_type { + >::prod( + >::pow(g_pow_yi, xi), + >::g_pow(if vote { + ::field_one() + } else { + ::field_zero() + }), + ) +} + +/** Commitment before round 2 */ +#[hax::receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam"))] +pub fn commit_to_vote( + ctx: impl HasReceiveContext, + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { + let params: CastVoteParam = ctx.parameter_cursor().get()?; + + for i in 0..n { + if !schnorr_zkp_validate(state.g_pow_xis[i], state.zkp_xis[i]) { + return Err(ParseError {}); + } + } + + let g_pow_yi = compute_g_pow_yi(params.cvp_i as usize, state.g_pow_xis); + let g_pow_xi_yi_vi = compute_group_element_for_vote(params.cvp_xi, params.cvp_vote, g_pow_yi); + let commit_vi = commit_to(g_pow_xi_yi_vi); + + let mut commit_to_vote_state_ret = state.clone(); + commit_to_vote_state_ret.commit_vis[params.cvp_i as usize] = commit_vi; + Ok((A::accept(), commit_to_vote_state_ret)) +} + +/** Primary function in round 2, also opens commitment */ +#[hax::receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam"))] +pub fn cast_vote( + ctx: impl HasReceiveContext, + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { + let params: CastVoteParam = ctx.parameter_cursor().get()?; + + let g_pow_yi = compute_g_pow_yi(params.cvp_i as usize, state.g_pow_xis); + let g_pow_xi_yi_vi = compute_group_element_for_vote(params.cvp_xi, params.cvp_vote, g_pow_yi); + + let zkp_vi = zkp_one_out_of_two( + params.cvp_zkp_random_w, + params.cvp_zkp_random_r, + params.cvp_zkp_random_d, + g_pow_yi, + params.cvp_xi, + params.cvp_vote, + ); + let mut cast_vote_state_ret = state.clone(); + cast_vote_state_ret.g_pow_xi_yi_vis[params.cvp_i as usize] = g_pow_xi_yi_vi; + cast_vote_state_ret.zkp_vis[params.cvp_i as usize] = zkp_vi; + + Ok((A::accept(), cast_vote_state_ret)) +} + +#[derive(Serialize, SchemaType)] +pub struct TallyParameter {} + +#[hax::receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "tally", parameter = "TallyParameter"))] +/** Anyone can tally the votes */ +pub fn tally_votes( + _: impl HasReceiveContext, + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { + for i in 0..n { + let g_pow_yi = compute_g_pow_yi(i as usize, state.g_pow_xis); + if !zkp_one_out_of_two_validate(g_pow_yi, state.zkp_vis[i]) { + return Err(ParseError {}); + } + if !check_commitment(state.g_pow_xi_yi_vis[i], state.commit_vis[i]) { + return Err(ParseError {}); + } + } + + let mut vote_result = >::group_one(); + for g_pow_vote in state.g_pow_xi_yi_vis { + vote_result = >::prod(vote_result, g_pow_vote); + } + + let mut tally = 0; + let mut curr = ::field_zero(); + for i in 0..n as u32 { + // Should be while, but is bounded by n anyways! + if >::g_pow(curr) == vote_result { + tally = i; + } + + curr = ::add(curr, ::field_one()); + } + + let mut tally_votes_state_ret = state.clone(); + tally_votes_state_ret.tally = tally; + + Ok((A::accept(), tally_votes_state_ret)) +} + +// https://github.com/stonecoldpat/anonymousvoting From 8d500d1cdf4f08cc61110794b53118a32f94ecb3 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 5 Mar 2024 12:59:32 +0100 Subject: [PATCH 65/86] WIP --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 325 ++++++++++-------- .../extraction/Hacspec_ovn_Ovn_traits.v | 64 ++-- 2 files changed, 219 insertions(+), 170 deletions(-) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 023ce1b..913533e 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -27,81 +27,128 @@ Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. Require Import Hacspec_ovn_Ovn_traits. Export Hacspec_ovn_Ovn_traits. +(*** Remove locations *) + +Notation both0 := (both (fset []) (fset [])). + (*Not implemented yet? todo(item)*) (*Not implemented yet? todo(item)*) (*Not implemented yet? todo(item)*) -Equations compute_group_element_for_vote {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (xi : both (f_field_type)) (vote : both ('bool)) (g_pow_yi : both (f_group_type)) : both (f_group_type) := +Program Definition if_both0 {A} (c : both0 'bool) (e_then : both0 A) (e_else : both0 A) : both0 A := + bind_both (fsubset_loc := _) (fsubset_opsig := _) c (fun b => if b then lift_both (fsubset_loc := _) (fsubset_opsig := _) e_then else lift_both (fsubset_loc := _) (fsubset_opsig := _) e_else). +Solve All Obligations with solve_ssprove_obligations. +Fail Next Obligation. + +Notation "'ifb0' b 'then' et 'else' ee" := (if_both0 b et ee). +(* Notation "f_prod". *) + +Equations foldi_both_list0 + {acc B: choice_type} + (l : both0 (chList B)) + (f: both0 B -> + both0 acc -> + both0 acc) + (init: both0 acc) + : both0 (acc) := + foldi_both_list0 l f init := + bind_both l (fun l' => List.fold_left (fun x y => solve_lift @f (solve_lift ret_both y) (x) : both0 _) l' (solve_lift init)). +Solve All Obligations with intros ; solve_fsubset_trans. +Solve All Obligations with intros ; solve_ssprove_obligations. +Fail Next Obligation. + +Equations prod_both0 {ceA ceB : choice_type} (a : both0 ceA) (b : both0 ceB) : both0 (ceA × ceB) := + prod_both0 a b := + bind_both a (fun a' => + bind_both b (fun b' => + (ret_both ((a', b') : _ × _)))). +Solve All Obligations with intros ; solve_in_fset. +Fail Next Obligation. + +Definition Build_t_Range {WS} {f_start : both0 (int WS)} {f_end : both0 (int WS)} : both0 (chProd (int WS) (int WS)) := @prod_both0 (int WS) (int WS) f_start f_end. +(* Class iterable (A B : choice_type) := {f_into_iter : both0 A -> both0 (chList B)}. *) + +(* Equations array_index *) +(* {A: choice_type} {len : nat} (x : both0 (nseq_ A len)) {WS} (y : both0 (int WS)) : both0 A := *) +(* array_index x (WS := WS) y := solve_lift lift2_both (fun x y => Hacspec_Lib_Pre.array_index x y) x y. *) +(* Fail Next Obligation. *) + +Notation " x '.a[' a ']'" := (solve_lift array_index (n_seq_array_or_seq x _) a : both0 _) (at level 40). + + +(** End *) + +Equations compute_group_element_for_vote {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (xi : both0 (f_field_type)) (vote : both0 ('bool)) (g_pow_yi : both0 (f_group_type)) : both0 (f_group_type) := compute_group_element_for_vote xi vote g_pow_yi := - solve_lift (f_prod (f_pow g_pow_yi xi) (f_g_pow (ifb vote - then f_field_one (ret_both (tt : 'unit)) - else f_field_zero (ret_both (tt : 'unit))))) : both (f_group_type). + solve_lift (f_prod (f_pow g_pow_yi xi) (f_g_pow (ifb0 vote + then f_field_one + else f_field_zero))) : both0 (f_group_type). Fail Next Obligation. -Equations select_private_voting_key {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (random : both (int32)) : both (f_field_type) := +Equations select_private_voting_key {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (random : both0 (int32)) : both0 (f_field_type) := select_private_voting_key random := - solve_lift (f_random_field_elem random) : both (f_field_type). + solve_lift (f_random_field_elem random) : both0 (f_field_type). Fail Next Obligation. - -Equations compute_g_pow_yi {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both (uint_size)) (xis : both (nseq f_group_type (is_pure (n)))) : both (f_group_type) := + +Equations compute_g_pow_yi {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both0 (uint_size)) (xis : both0 (nseq f_group_type (is_pure (n)))) : both0 (f_group_type) := compute_g_pow_yi i xis := - letb prod1 := f_group_one (ret_both (tt : 'unit)) in - letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => + letb prod1 := f_group_one in + letb prod1 := foldi_both_list0 (f_into_iter (Build_t_Range (f_start := solve_lift ret_both (0 : uint_size)) (f_end := i))) (fun j => ssp (fun prod1 => - solve_lift (f_prod prod1 (xis.a[j])) : both (f_group_type))) prod1 in - letb prod2 := f_group_one (ret_both (tt : 'unit)) in - letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => + (* solve_lift (f_prod prod1 (xis.a[j])) : both0 (f_group_type) *) _)) prod1 in + letb prod2 := f_group_one in + letb prod2 := foldi_both0_list (f_into_iter (Build_t_Range (f_start := (* i .+ (ret_both (1 : uint_size)) *)_ ) (f_end := n))) (fun j => ssp (fun prod2 => - solve_lift (f_prod prod2 (xis.a[j])) : both (f_group_type))) prod2 in - solve_lift (f_div prod1 prod2) : both (f_group_type). + solve_lift (f_prod prod2 (xis.a[j])) : both0 (f_group_type))) prod2 in + solve_lift (f_div prod1 prod2) : both0 (f_group_type). Solve All Obligations with now intros ; destruct from_uint_size. Fail Next Obligation. -Equations check_commitment {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both (f_group_type)) (commitment : both (f_field_type)) : both ('bool) := +Equations check_commitment {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both0 (f_group_type)) (commitment : both0 (f_field_type)) : both0 ('bool) := check_commitment g_pow_xi_yi_vi commitment := - solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both ('bool). + solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both0 ('bool). Fail Next Obligation. -Equations commit_to {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both (f_group_type)) : both (f_field_type) := +Equations commit_to {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both0 (f_group_type)) : both0 (f_field_type) := commit_to g_pow_xi_yi_vi := - solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both (f_field_type). + solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both0 (f_field_type). Fail Next Obligation. Definition t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := (int32 × f_field_type × int32 × int32 × int32 × 'bool). -Equations f_cvp_i {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := +Equations f_cvp_i {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both0 (t_CastVoteParam)) : both0 (int32) := f_cvp_i s := bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : int32))) : both (int32). + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : int32))) : both0 (int32). Fail Next Obligation. -Equations f_cvp_xi {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (f_field_type) := +Equations f_cvp_xi {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both0 (t_CastVoteParam)) : both0 (f_field_type) := f_cvp_xi s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both (f_field_type). + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both0 (f_field_type). Fail Next Obligation. -Equations f_cvp_zkp_random_w {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := +Equations f_cvp_zkp_random_w {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both0 (t_CastVoteParam)) : both0 (int32) := f_cvp_zkp_random_w s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : int32))) : both (int32). + solve_lift (ret_both (snd (fst (fst (fst x))) : int32))) : both0 (int32). Fail Next Obligation. -Equations f_cvp_zkp_random_r {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := +Equations f_cvp_zkp_random_r {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both0 (t_CastVoteParam)) : both0 (int32) := f_cvp_zkp_random_r s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : int32))) : both (int32). + solve_lift (ret_both (snd (fst (fst x)) : int32))) : both0 (int32). Fail Next Obligation. -Equations f_cvp_zkp_random_d {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := +Equations f_cvp_zkp_random_d {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both0 (t_CastVoteParam)) : both0 (int32) := f_cvp_zkp_random_d s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int32))) : both (int32). + solve_lift (ret_both (snd (fst x) : int32))) : both0 (int32). Fail Next Obligation. -Equations f_cvp_vote {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both ('bool) := +Equations f_cvp_vote {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both0 (t_CastVoteParam)) : both0 ('bool) := f_cvp_vote s := bind_both s (fun x => - solve_lift (ret_both (snd x : 'bool))) : both ('bool). + solve_lift (ret_both (snd x : 'bool))) : both0 ('bool). Fail Next Obligation. -Equations Build_t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_cvp_i : both (int32)} {f_cvp_xi : both (f_field_type)} {f_cvp_zkp_random_w : both (int32)} {f_cvp_zkp_random_r : both (int32)} {f_cvp_zkp_random_d : both (int32)} {f_cvp_vote : both ('bool)} : both (t_CastVoteParam) := +Equations Build_t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_cvp_i : both0 (int32)} {f_cvp_xi : both0 (f_field_type)} {f_cvp_zkp_random_w : both0 (int32)} {f_cvp_zkp_random_r : both0 (int32)} {f_cvp_zkp_random_d : both0 (int32)} {f_cvp_vote : both0 ('bool)} : both0 (t_CastVoteParam) := Build_t_CastVoteParam := bind_both f_cvp_vote (fun f_cvp_vote => bind_both f_cvp_zkp_random_d (fun f_cvp_zkp_random_d => @@ -109,7 +156,7 @@ Equations Build_t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} bind_both f_cvp_zkp_random_w (fun f_cvp_zkp_random_w => bind_both f_cvp_xi (fun f_cvp_xi => bind_both f_cvp_i (fun f_cvp_i => - solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam))))))))) : both (t_CastVoteParam). + solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam))))))))) : both0 (t_CastVoteParam). Fail Next Obligation. Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). @@ -120,62 +167,62 @@ Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Bui Definition t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := (f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_field_type × f_field_type × f_field_type × f_field_type × f_field_type). -Equations f_or_zkp_x {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := +Equations f_or_zkp_x {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_group_type) := f_or_zkp_x s := bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both (f_group_type). + solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both0 (f_group_type). Fail Next Obligation. -Equations f_or_zkp_y {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := +Equations f_or_zkp_y {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_group_type) := f_or_zkp_y s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both (f_group_type). + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both0 (f_group_type). Fail Next Obligation. -Equations f_or_zkp_a1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := +Equations f_or_zkp_a1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_group_type) := f_or_zkp_a1 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : f_group_type))) : both (f_group_type). + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : f_group_type))) : both0 (f_group_type). Fail Next Obligation. -Equations f_or_zkp_b1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := +Equations f_or_zkp_b1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_group_type) := f_or_zkp_b1 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : f_group_type))) : both (f_group_type). + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : f_group_type))) : both0 (f_group_type). Fail Next Obligation. -Equations f_or_zkp_a2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := +Equations f_or_zkp_a2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_group_type) := f_or_zkp_a2 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : f_group_type))) : both (f_group_type). + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : f_group_type))) : both0 (f_group_type). Fail Next Obligation. -Equations f_or_zkp_b2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := +Equations f_or_zkp_b2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_group_type) := f_or_zkp_b2 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : f_group_type))) : both (f_group_type). + solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : f_group_type))) : both0 (f_group_type). Fail Next Obligation. -Equations f_or_zkp_c {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := +Equations f_or_zkp_c {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_field_type) := f_or_zkp_c s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both (f_field_type). + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both0 (f_field_type). Fail Next Obligation. -Equations f_or_zkp_d1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := +Equations f_or_zkp_d1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_field_type) := f_or_zkp_d1 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : f_field_type))) : both (f_field_type). + solve_lift (ret_both (snd (fst (fst (fst x))) : f_field_type))) : both0 (f_field_type). Fail Next Obligation. -Equations f_or_zkp_d2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := +Equations f_or_zkp_d2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_field_type) := f_or_zkp_d2 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : f_field_type))) : both (f_field_type). + solve_lift (ret_both (snd (fst (fst x)) : f_field_type))) : both0 (f_field_type). Fail Next Obligation. -Equations f_or_zkp_r1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := +Equations f_or_zkp_r1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_field_type) := f_or_zkp_r1 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). + solve_lift (ret_both (snd (fst x) : f_field_type))) : both0 (f_field_type). Fail Next Obligation. -Equations f_or_zkp_r2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := +Equations f_or_zkp_r2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_field_type) := f_or_zkp_r2 s := bind_both s (fun x => - solve_lift (ret_both (snd x : f_field_type))) : both (f_field_type). + solve_lift (ret_both (snd x : f_field_type))) : both0 (f_field_type). Fail Next Obligation. -Equations Build_t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_or_zkp_x : both (f_group_type)} {f_or_zkp_y : both (f_group_type)} {f_or_zkp_a1 : both (f_group_type)} {f_or_zkp_b1 : both (f_group_type)} {f_or_zkp_a2 : both (f_group_type)} {f_or_zkp_b2 : both (f_group_type)} {f_or_zkp_c : both (f_field_type)} {f_or_zkp_d1 : both (f_field_type)} {f_or_zkp_d2 : both (f_field_type)} {f_or_zkp_r1 : both (f_field_type)} {f_or_zkp_r2 : both (f_field_type)} : both (t_OrZKPCommit) := +Equations Build_t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_or_zkp_x : both0 (f_group_type)} {f_or_zkp_y : both0 (f_group_type)} {f_or_zkp_a1 : both0 (f_group_type)} {f_or_zkp_b1 : both0 (f_group_type)} {f_or_zkp_a2 : both0 (f_group_type)} {f_or_zkp_b2 : both0 (f_group_type)} {f_or_zkp_c : both0 (f_field_type)} {f_or_zkp_d1 : both0 (f_field_type)} {f_or_zkp_d2 : both0 (f_field_type)} {f_or_zkp_r1 : both0 (f_field_type)} {f_or_zkp_r2 : both0 (f_field_type)} : both0 (t_OrZKPCommit) := Build_t_OrZKPCommit := bind_both f_or_zkp_r2 (fun f_or_zkp_r2 => bind_both f_or_zkp_r1 (fun f_or_zkp_r1 => @@ -188,7 +235,7 @@ Equations Build_t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized ( bind_both f_or_zkp_a1 (fun f_or_zkp_a1 => bind_both f_or_zkp_y (fun f_or_zkp_y => bind_both f_or_zkp_x (fun f_or_zkp_x => - solve_lift (ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit)))))))))))))) : both (t_OrZKPCommit). + solve_lift (ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit)))))))))))))) : both0 (t_OrZKPCommit). Fail Next Obligation. Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := y) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := y) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). @@ -204,27 +251,27 @@ Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r2' ':=' y ')'" := (Buil Definition t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := (int32 × f_field_type × int32). -Equations f_rp_i {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_RegisterParam)) : both (int32) := +Equations f_rp_i {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both0 (t_RegisterParam)) : both0 (int32) := f_rp_i s := bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both (int32). + solve_lift (ret_both (fst (fst x) : int32))) : both0 (int32). Fail Next Obligation. -Equations f_rp_xi {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_RegisterParam)) : both (f_field_type) := +Equations f_rp_xi {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both0 (t_RegisterParam)) : both0 (f_field_type) := f_rp_xi s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). + solve_lift (ret_both (snd (fst x) : f_field_type))) : both0 (f_field_type). Fail Next Obligation. -Equations f_rp_zkp_random {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_RegisterParam)) : both (int32) := +Equations f_rp_zkp_random {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both0 (t_RegisterParam)) : both0 (int32) := f_rp_zkp_random s := bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both (int32). + solve_lift (ret_both (snd x : int32))) : both0 (int32). Fail Next Obligation. -Equations Build_t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_rp_i : both (int32)} {f_rp_xi : both (f_field_type)} {f_rp_zkp_random : both (int32)} : both (t_RegisterParam) := +Equations Build_t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_rp_i : both0 (int32)} {f_rp_xi : both0 (f_field_type)} {f_rp_zkp_random : both0 (int32)} : both0 (t_RegisterParam) := Build_t_RegisterParam := bind_both f_rp_zkp_random (fun f_rp_zkp_random => bind_both f_rp_xi (fun f_rp_xi => bind_both f_rp_i (fun f_rp_i => - solve_lift (ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam)))))) : both (t_RegisterParam). + solve_lift (ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam)))))) : both0 (t_RegisterParam). Fail Next Obligation. Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x)). Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y) (f_rp_zkp_random := f_rp_zkp_random x)). @@ -232,27 +279,27 @@ Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := Definition t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := (f_group_type × f_field_type × f_field_type). -Equations f_schnorr_zkp_u {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_SchnorrZKPCommit)) : both (f_group_type) := +Equations f_schnorr_zkp_u {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_SchnorrZKPCommit)) : both0 (f_group_type) := f_schnorr_zkp_u s := bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : f_group_type))) : both (f_group_type). + solve_lift (ret_both (fst (fst x) : f_group_type))) : both0 (f_group_type). Fail Next Obligation. -Equations f_schnorr_zkp_c {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_SchnorrZKPCommit)) : both (f_field_type) := +Equations f_schnorr_zkp_c {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_SchnorrZKPCommit)) : both0 (f_field_type) := f_schnorr_zkp_c s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). + solve_lift (ret_both (snd (fst x) : f_field_type))) : both0 (f_field_type). Fail Next Obligation. -Equations f_schnorr_zkp_z {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_SchnorrZKPCommit)) : both (f_field_type) := +Equations f_schnorr_zkp_z {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_SchnorrZKPCommit)) : both0 (f_field_type) := f_schnorr_zkp_z s := bind_both s (fun x => - solve_lift (ret_both (snd x : f_field_type))) : both (f_field_type). + solve_lift (ret_both (snd x : f_field_type))) : both0 (f_field_type). Fail Next Obligation. -Equations Build_t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_schnorr_zkp_u : both (f_group_type)} {f_schnorr_zkp_c : both (f_field_type)} {f_schnorr_zkp_z : both (f_field_type)} : both (t_SchnorrZKPCommit) := +Equations Build_t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_schnorr_zkp_u : both0 (f_group_type)} {f_schnorr_zkp_c : both0 (f_field_type)} {f_schnorr_zkp_z : both0 (f_field_type)} : both0 (t_SchnorrZKPCommit) := Build_t_SchnorrZKPCommit := bind_both f_schnorr_zkp_z (fun f_schnorr_zkp_z => bind_both f_schnorr_zkp_c (fun f_schnorr_zkp_c => bind_both f_schnorr_zkp_u (fun f_schnorr_zkp_u => - solve_lift (ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit)))))) : both (t_SchnorrZKPCommit). + solve_lift (ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit)))))) : both0 (t_SchnorrZKPCommit). Fail Next Obligation. Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := y) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := y) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). @@ -260,31 +307,31 @@ Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_z' ':=' y ')'" Definition t_TallyParameter : choice_type := 'unit. -Equations Build_t_TallyParameter : both (t_TallyParameter) := +Equations Build_t_TallyParameter : both0 (t_TallyParameter) := Build_t_TallyParameter := - solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (t_TallyParameter). + solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both0 (t_TallyParameter). Fail Next Obligation. -Equations schnorr_zkp {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both (int32)) (h : both (f_group_type)) (x : both (f_field_type)) : both (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := +Equations schnorr_zkp {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both0 (int32)) (h : both0 (f_group_type)) (x : both0 (f_field_type)) : both0 (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := schnorr_zkp random h x := solve_lift (run (letb r := f_random_field_elem random in letb u := f_g_pow r in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g; h; u])))) in letb z := f_add r (f_mul c x) in - letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in - ControlFlow_Continue (never_to_any hoist1))) : both (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). + letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))] hoist1 := _ (* v_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) *) in + ControlFlow_Continue _ (* (never_to_any hoist1) *))) : both0 (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). Fail Next Obligation. -Equations schnorr_zkp_validate {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both (f_group_type)) (pi : both (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both ('bool) := +Equations schnorr_zkp_validate {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both0 (f_group_type)) (pi : both0 (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both0 ('bool) := schnorr_zkp_validate h pi := solve_lift (andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); h; - f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both ('bool). + f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both0 ('bool). Fail Next Obligation. -Equations zkp_one_out_of_two {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both (int32)) (random_r : both (int32)) (random_d : both (int32)) (h : both (f_group_type)) (xi : both (f_field_type)) (vi : both ('bool)) : both (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) := +Equations zkp_one_out_of_two {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both0 (int32)) (random_r : both0 (int32)) (random_d : both0 (int32)) (h : both0 (f_group_type)) (xi : both0 (f_field_type)) (vi : both0 ('bool)) : both0 (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) := zkp_one_out_of_two random_w random_r random_d h xi vi := letb w := f_random_field_elem random_w in solve_lift (ifb vi @@ -321,10 +368,10 @@ Equations zkp_one_out_of_two {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v b2])))) in letb d1 := f_sub c d2 in letb r1 := f_sub w (f_mul xi d1) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)). + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both0 (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)). Fail Next Obligation. -Equations zkp_one_out_of_two_validate {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both (f_group_type)) (zkp : both (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both ('bool) := +Equations zkp_one_out_of_two_validate {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both0 (f_group_type)) (zkp : both0 (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both0 ('bool) := zkp_one_out_of_two_validate h zkp := letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; f_or_zkp_y zkp; @@ -332,42 +379,42 @@ Equations zkp_one_out_of_two_validate {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t f_or_zkp_b1 zkp; f_or_zkp_a2 zkp; f_or_zkp_b2 zkp])))) in - solve_lift (andb (andb (andb (andb (c =.? (f_add (f_or_zkp_d1 zkp) (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? (f_prod (f_pow h (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r2 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? (f_prod (f_pow h (f_or_zkp_r2 zkp)) (f_pow (f_div (f_or_zkp_y zkp) (f_g (ret_both (tt : 'unit)))) (f_or_zkp_d2 zkp))))) : both ('bool). + solve_lift (andb (andb (andb (andb (c =.? (f_add (f_or_zkp_d1 zkp) (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? (f_prod (f_pow h (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r2 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? (f_prod (f_pow h (f_or_zkp_r2 zkp)) (f_pow (f_div (f_or_zkp_y zkp) (f_g (ret_both (tt : 'unit)))) (f_or_zkp_d2 zkp))))) : both0 ('bool). Fail Next Obligation. -Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := +Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := (nseq f_group_type (is_pure (n)) × nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × nseq f_field_type (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × int32). -Equations f_g_pow_xis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq f_group_type (is_pure (n))) := +Equations f_g_pow_xis {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OvnContractState (n := n))) : both0 (nseq f_group_type (is_pure (n))) := f_g_pow_xis s := bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type (is_pure (n))))) : both (nseq f_group_type (is_pure (n))). + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type (is_pure (n))))) : both0 (nseq f_group_type (is_pure (n))). Fail Next Obligation. -Equations f_zkp_xis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := +Equations f_zkp_xis {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OvnContractState (n := n))) : both0 (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := f_zkp_xis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both0 (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). Fail Next Obligation. -Equations f_commit_vis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq f_field_type (is_pure (n))) := +Equations f_commit_vis {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OvnContractState (n := n))) : both0 (nseq f_field_type (is_pure (n))) := f_commit_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : nseq f_field_type (is_pure (n))))) : both (nseq f_field_type (is_pure (n))). + solve_lift (ret_both (snd (fst (fst (fst x))) : nseq f_field_type (is_pure (n))))) : both0 (nseq f_field_type (is_pure (n))). Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq f_group_type (is_pure (n))) := +Equations f_g_pow_xi_yi_vis {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OvnContractState (n := n))) : both0 (nseq f_group_type (is_pure (n))) := f_g_pow_xi_yi_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type (is_pure (n))))) : both (nseq f_group_type (is_pure (n))). + solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type (is_pure (n))))) : both0 (nseq f_group_type (is_pure (n))). Fail Next Obligation. -Equations f_zkp_vis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := +Equations f_zkp_vis {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OvnContractState (n := n))) : both0 (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := f_zkp_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). + solve_lift (ret_both (snd (fst x) : nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both0 (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). Fail Next Obligation. -Equations f_tally {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (int32) := +Equations f_tally {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OvnContractState (n := n))) : both0 (int32) := f_tally s := bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both (int32). + solve_lift (ret_both (snd x : int32))) : both0 (int32). Fail Next Obligation. -Equations Build_t_OvnContractState {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_g_pow_xis : both (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_commit_vis : both (nseq f_field_type (is_pure (n)))} {f_g_pow_xi_yi_vis : both (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_tally : both (int32)} : both (t_OvnContractState (n := n)) := +Equations Build_t_OvnContractState {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_g_pow_xis : both0 (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both0 (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_commit_vis : both0 (nseq f_field_type (is_pure (n)))} {f_g_pow_xi_yi_vis : both0 (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both0 (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_tally : both0 (int32)} : both0 (t_OvnContractState (n := n)) := Build_t_OvnContractState := bind_both f_tally (fun f_tally => bind_both f_zkp_vis (fun f_zkp_vis => @@ -375,7 +422,7 @@ Equations Build_t_OvnContractState {v_Z : _} {v_G : _} {n : both (uint_size)} `{ bind_both f_commit_vis (fun f_commit_vis => bind_both f_zkp_xis (fun f_zkp_xis => bind_both f_g_pow_xis (fun f_g_pow_xis => - solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (t_OvnContractState). + solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both0 (t_OvnContractState). Fail Next Obligation. Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). @@ -384,7 +431,7 @@ Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ') Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). -Equations cast_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := +Equations cast_vote {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both0 (impl_574521470_)) (state : both0 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both0 (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := cast_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with @@ -402,10 +449,10 @@ Equations cast_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_5 letb cast_vote_state_ret := f_clone state in letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both0 (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). Fail Next Obligation. -Equations commit_to_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := +Equations commit_to_vote {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both0 (impl_574521470_)) (state : both0 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both0 (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := commit_to_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with @@ -417,27 +464,27 @@ Equations commit_to_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {i letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist3 := v_Break (Result_Err (ret_both tt)) in ControlFlow_Continue (solve_lift (never_to_any hoist3)) end in - ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + ControlFlow_Continue (letb _ := foldi_both0_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => solve_lift (ifb negb (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist4 := v_Break (Result_Err (ret_both tt)) in ControlFlow_Continue (never_to_any hoist4) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in + else ControlFlow_Continue (ret_both (tt : 'unit))) : both0 _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in letb commit_vi := commit_to g_pow_xi_yi_vi in letb commit_to_vote_state_ret := f_clone state in letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),commit_to_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),commit_to_vote_state_ret))))) : both0 (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). Solve All Obligations with now intros ; destruct from_uint_size. Fail Next Obligation. -Equations init_ovn_contract {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both ('unit)) : both (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)) := +Equations init_ovn_contract {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both0 ('unit)) : both0 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)) := init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_field_zero (ret_both (tt : 'unit))) (f_schnorr_zkp_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_y := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_c := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d2 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)). + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_field_zero (ret_both (tt : 'unit))) (f_schnorr_zkp_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_y := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_c := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d2 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both0 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)). Fail Next Obligation. -Equations register_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := +Equations register_vote {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both0 (impl_574521470_)) (state : both0 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both0 (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := register_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_RegisterParam (v_Z)) := matchb out with @@ -454,12 +501,12 @@ Equations register_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {im letb register_vote_state_ret := f_clone state in letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),register_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),register_vote_state_ret))))) : both0 (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). Fail Next Obligation. -Equations tally_votes {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := +Equations tally_votes {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both0 (impl_574521470_)) (state : both0 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both0 (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := tally_votes _ state := - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + letb _ := foldi_both0_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] _ := ControlFlow_Continue (ifb negb (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) @@ -469,24 +516,24 @@ Equations tally_votes {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl solve_lift (ifb negb (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist7 := v_Break (Result_Err (ret_both tt)) in ControlFlow_Continue (never_to_any hoist7) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in + else ControlFlow_Continue (ret_both (tt : 'unit))) : both0 _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in letb vote_result := f_group_one (ret_both (tt : 'unit)) in - letb vote_result := foldi_both_list ((* f_into_iter *) (array_to_list (f_g_pow_xi_yi_vis state))) (fun g_pow_vote => + letb vote_result := foldi_both0_list ((* f_into_iter *) (array_to_list (f_g_pow_xi_yi_vis state))) (fun g_pow_vote => ssp (fun vote_result => - solve_lift (f_prod vote_result g_pow_vote) : both (f_group_type))) vote_result in + solve_lift (f_prod vote_result g_pow_vote) : both0 (f_group_type))) vote_result in letb tally := ret_both (0 : int32) in letb curr := f_field_zero (ret_both (tt : 'unit)) in - letb '(curr,tally) := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => + letb '(curr,tally) := foldi_both0_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => ssp (fun '(curr,tally) => letb tally := ifb (f_g_pow curr) =.? vote_result then letb tally := i in tally else tally in letb curr := f_add curr (f_field_one (ret_both (tt : 'unit))) in - solve_lift (prod_b (curr,tally)) : both ((f_field_type × int32)))) (prod_b (curr,tally)) in + solve_lift (prod_b (curr,tally)) : both0 ((f_field_type × int32)))) (prod_b (curr,tally)) in letb tally_votes_state_ret := f_clone state in letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in - Result_Ok (solve_lift (prod_b (f_accept (* (ret_both (tt : 'unit)) *),tally_votes_state_ret))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). + Result_Ok (solve_lift (prod_b (f_accept (* (ret_both (tt : 'unit)) *),tally_votes_state_ret))) : both0 (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). Solve All Obligations with now intros ; destruct from_uint_size. Fail Next Obligation. @@ -506,40 +553,40 @@ Export Serializable. From Hacspec Require Import ConCertLib. Export ConCertLib. -Definition state_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := +Definition state_OVN {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n). -#[global] Program Instance t_CastVoteParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_HasReceiveContext t_CastVoteParam 'unit := +#[global] Program Instance t_CastVoteParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_HasReceiveContext t_CastVoteParam 'unit := {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. Fail Next Obligation. -#[global] Program Instance t_CastVoteParam_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_Sized t_CastVoteParam := +#[global] Program Instance t_CastVoteParam_t_Sized {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_Sized t_CastVoteParam := fun x => x. Fail Next Obligation. -Definition receive_OVN_cast_vote {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {v_A : _} `{ t_Sized (v_A)} `{ t_HasActions (v_A)} (ctx : both (t_CastVoteParam (v_Z := v_Z))) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := +Definition receive_OVN_cast_vote {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {v_A : _} `{ t_Sized (v_A)} `{ t_HasActions (v_A)} (ctx : both0 (t_CastVoteParam (v_Z := v_Z))) (st : both0 (state_OVN)) : both0 (t_Result ((v_A × state_OVN)) (t_ParseError)) := cast_vote (v_Z := v_Z) (v_G := v_G) (n := n) (v_A := v_A) (H2 := t_CastVoteParam_t_Sized (v_Z := v_Z) (v_G := v_G) (n := n)) (H7 := t_CastVoteParam_t_HasReceiveContext (v_Z := v_Z) (v_G := v_G) (n := n)) ctx st. -(* #[global] Program Instance t_CastVoteParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_HasReceiveContext t_CastVoteParam 'unit := *) +(* #[global] Program Instance t_CastVoteParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_HasReceiveContext t_CastVoteParam 'unit := *) (* {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. *) (* Fail Next Obligation. *) (* #[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := *) (* fun x => *) (* x. *) (* Fail Next Obligation. *) -Definition receive_OVN_commit_to_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both (t_CastVoteParam)) (st : both (state_OVN (n := n))) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := +Definition receive_OVN_commit_to_vote {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both0 (t_CastVoteParam)) (st : both0 (state_OVN (n := n))) : both0 (t_Result ((v_A × state_OVN)) (t_ParseError)) := commit_to_vote (H2 := t_CastVoteParam_t_Sized (n := n)) (H7 := t_CastVoteParam_t_HasReceiveContext (n := n)) ctx st. -Definition init_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN (n := n)) (t_ParseError) := +Definition init_OVN {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN (n := n)) (t_ParseError) := ResultMonad.Ok st. -#[global] Program Instance t_RegisterParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_HasReceiveContext t_RegisterParam 'unit := +#[global] Program Instance t_RegisterParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_HasReceiveContext t_RegisterParam 'unit := {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. Fail Next Obligation. -#[global] Program Instance t_RegisterParam_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_Sized t_RegisterParam := +#[global] Program Instance t_RegisterParam_t_Sized {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_Sized t_RegisterParam := fun x => x. Fail Next Obligation. -Definition receive_OVN_register {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both (t_RegisterParam)) (st : both (state_OVN (n := n))) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := +Definition receive_OVN_register {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both0 (t_RegisterParam)) (st : both0 (state_OVN (n := n))) : both0 (t_Result ((v_A × state_OVN)) (t_ParseError)) := register_vote (H2 := t_RegisterParam_t_Sized (n := n)) (H7 := t_RegisterParam_t_HasReceiveContext (n := n)) ctx st. #[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := @@ -549,7 +596,7 @@ Fail Next Obligation. fun x => x. Fail Next Obligation. -Definition receive_OVN_tally {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both (t_TallyParameter)) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN (n := n))) (t_ParseError)) := +Definition receive_OVN_tally {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both0 (t_TallyParameter)) (st : both0 (state_OVN)) : both0 (t_Result ((v_A × state_OVN (n := n))) (t_ParseError)) := tally_votes ctx st. Inductive Msg_OVN {v_Z : _} `{ t_Sized (v_Z)} `{ temp : t_Z_Field (v_Z)} : Type := @@ -557,39 +604,39 @@ Inductive Msg_OVN {v_Z : _} `{ t_Sized (v_Z)} `{ temp : t_Z_Field (v_Z)} : Type | msg_OVN_commit_to_vote : t_CastVoteParam (v_Z := v_Z) (H0 := temp) -> Msg_OVN | msg_OVN_register : t_RegisterParam (v_Z := v_Z) -> Msg_OVN | msg_OVN_tally : t_TallyParameter -> Msg_OVN. -#[global] Program Instance state_OVN_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_HasReceiveContext (state_OVN (n := n)) 'unit := +#[global] Program Instance state_OVN_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_HasReceiveContext (state_OVN (n := n)) 'unit := {| f_get := (fun (Ctx : _) => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. Fail Next Obligation. -#[global] Program Instance state_OVN_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : t_Sized (state_OVN (n := n)) := +#[global] Program Instance state_OVN_t_Sized {v_Z : _} {v_G : _} {n : both0 (uint_size)} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : t_Sized (state_OVN (n := n)) := fun x => x. Fail Next Obligation. -#[global] Program Instance state_OVN_t_HasActions {v_Z : _} {v_G : _} {n : both (uint_size)}`{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : t_HasActions (state_OVN (v_Z := v_Z) (n := n)). +#[global] Program Instance state_OVN_t_HasActions {v_Z : _} {v_G : _} {n : both0 (uint_size)}`{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : t_HasActions (state_OVN (v_Z := v_Z) (n := n)). Admit Obligations. Fail Next Obligation. Obligation Tactic := intros. (* *) -Equations receive_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ temp1 : t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (chain : Chain) (ctx : ContractCallContext) (st : state_OVN (v_Z := v_Z) (n := n)) (msg : Datatypes.option (Msg_OVN (v_Z := v_Z))) : ResultMonad.result (state_OVN (v_Z := v_Z) (n := n) * list ActionBody) t_ParseError := +Equations receive_OVN {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ temp1 : t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (chain : Chain) (ctx : ContractCallContext) (st : state_OVN (v_Z := v_Z) (n := n)) (msg : Datatypes.option (Msg_OVN (v_Z := v_Z))) : ResultMonad.result (state_OVN (v_Z := v_Z) (n := n) * list ActionBody) t_ParseError := receive_OVN chain ctx st msg := match msg with | Some (msg_OVN_cast_vote val) => - match is_pure (both_prog (@receive_OVN_cast_vote v_Z v_G n _ _ _ _ _ v_A _ _ (ret_both val) (ret_both st))) with + match is_pure (both0_prog (@receive_OVN_cast_vote v_Z v_G n _ _ _ _ _ v_A _ _ (ret_both val) (ret_both st))) with | inl x => ResultMonad.Ok ((snd x), []) | inr x => ResultMonad.Err x end | Some (msg_OVN_commit_to_vote val) => - match is_pure (both_prog (@receive_OVN_commit_to_vote v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st))) with + match is_pure (both0_prog (@receive_OVN_commit_to_vote v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st))) with | inl x => ResultMonad.Ok ((snd x), []) | inr x => ResultMonad.Err x end | Some (msg_OVN_register val) => - match is_pure (both_prog (@receive_OVN_register v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st))) with + match is_pure (both0_prog (@receive_OVN_register v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st))) with | inl x => ResultMonad.Ok ((snd x), []) | inr x => ResultMonad.Err x end | Some (msg_OVN_tally val) => - match (is_pure (both_prog (@receive_OVN_tally v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st)))) with + match (is_pure (both0_prog (@receive_OVN_tally v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st)))) with | inl x => ResultMonad.Ok ((snd x), []) | inr x => ResultMonad.Err x end @@ -597,7 +644,7 @@ Equations receive_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t ResultMonad.Err tt end : ResultMonad.result (state_OVN (v_Z := v_Z) (n := n) * list ActionBody) t_ParseError. Fail Next Obligation. -#[global] Program Instance state_OVN_Serializable {v_Z : _} {v_G : _} {n : both (uint_size)} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : Serializable (state_OVN (v_Z := v_Z) (n := n)) := +#[global] Program Instance state_OVN_Serializable {v_Z : _} {v_G : _} {n : both0 (uint_size)} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : Serializable (state_OVN (v_Z := v_Z) (n := n)) := _. Admit Obligations. Fail Next Obligation. @@ -605,4 +652,4 @@ Fail Next Obligation. Admit Obligations. (* Derive Serializable Msg_OVN_rect. *) Fail Next Obligation. -Definition contract_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ temp1 : t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ temp2 : t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : @Contract _ (@state_OVN v_Z v_G n temp1 _ _ _ _) (@Msg_OVN v_Z temp1 H1 ) (state_OVN (v_Z := v_Z) (n := n)) (t_ParseError) state_OVN_Serializable Msg_OVN_Serializable state_OVN_Serializable _ := build_contract init_OVN receive_OVN. +Definition contract_OVN {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} `{ temp1 : t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ temp2 : t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : @Contract _ (@state_OVN v_Z v_G n temp1 _ _ _ _) (@Msg_OVN v_Z temp1 H1 ) (state_OVN (v_Z := v_Z) (n := n)) (t_ParseError) state_OVN_Serializable Msg_OVN_Serializable state_OVN_Serializable _ := build_contract init_OVN receive_OVN. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v index bfb1778..511c9f1 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v @@ -24,41 +24,43 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. +Notation both0 := (both (fset []) (fset [])). + Class t_Z_Field (Self : choice_type) := { f_field_type : choice_type ; - f_field_type_t_Serialize :> t_Serialize (f_field_type) ; - f_field_type_t_Deserial :> t_Deserial (f_field_type) ; - f_field_type_t_Serial :> t_Serial (f_field_type) ; - f_field_type_t_Copy :> t_Copy (f_field_type) ; - f_field_type_t_Clone :> t_Clone (f_field_type) ; - f_field_type_t_Eq :> t_Eq (f_field_type) ; - f_field_type_t_PartialEq :> t_PartialEq (f_field_type) ; - f_field_type_t_Sized :> t_Sized (f_field_type) ; - f_q : both ('unit) -> both (f_field_type) ; - f_random_field_elem : both (int32) -> both (f_field_type) ; - f_field_zero : both ('unit) -> both (f_field_type) ; - f_field_one : both ('unit) -> both (f_field_type) ; - f_add : both (f_field_type) -> both (f_field_type) -> both (f_field_type) ; - f_sub : both (f_field_type) -> both (f_field_type) -> both (f_field_type) ; - f_mul : both (f_field_type) -> both (f_field_type) -> both (f_field_type) ; + f_field_type_t_Serialize :> (t_Serialize f_field_type) ; + f_field_type_t_Deserial :> (t_Deserial f_field_type) ; + f_field_type_t_Serial :> (t_Serial f_field_type) ; + f_field_type_t_Copy :> (t_Copy f_field_type) ; + f_field_type_t_Clone :> (t_Clone f_field_type) ; + f_field_type_t_Eq :> (t_Eq f_field_type) ; + f_field_type_t_PartialEq :> (t_PartialEq f_field_type) ; + f_field_type_t_Sized :> (t_Sized f_field_type) ; + f_q : (both0 f_field_type) ; + f_random_field_elem : (both0 int32 -> both0 f_field_type) ; + f_field_zero : (both0 f_field_type) ; + f_field_one : (both0 f_field_type) ; + f_add : (both0 f_field_type -> both0 f_field_type -> both0 f_field_type) ; + f_sub : (both0 f_field_type -> both0 f_field_type -> both0 f_field_type) ; + f_mul : (both0 f_field_type -> both0 f_field_type -> both0 f_field_type) ; }. Class t_Group (Self : choice_type) `{t_Z_Field} := { f_group_type : choice_type ; - f_group_type_t_Serialize :> t_Serialize (f_group_type) ; - f_group_type_t_Deserial :> t_Deserial (f_group_type) ; - f_group_type_t_Serial :> t_Serial (f_group_type) ; - f_group_type_t_Copy :> t_Copy (f_group_type) ; - f_group_type_t_Clone :> t_Clone (f_group_type) ; - f_group_type_t_Eq :> t_Eq (f_group_type) ; - f_group_type_t_PartialEq :> t_PartialEq (f_group_type) ; - f_group_type_t_Sized :> t_Sized (f_group_type) ; - f_g : both ('unit) -> both (f_group_type) ; - f_g_pow : both (f_field_type) -> both (f_group_type) ; - f_pow : both (f_group_type) -> both (f_field_type) -> both (f_group_type) ; - f_group_one : both ('unit) -> both (f_group_type) ; - f_prod : both (f_group_type) -> both (f_group_type) -> both (f_group_type) ; - f_inv : both (f_group_type) -> both (f_group_type) ; - f_div : both (f_group_type) -> both (f_group_type) -> both (f_group_type) ; - f_hash : both (t_Vec (f_group_type) (t_Global)) -> both (f_field_type) ; + f_group_type_t_Serialize :> (t_Serialize f_group_type) ; + f_group_type_t_Deserial :> (t_Deserial f_group_type) ; + f_group_type_t_Serial :> (t_Serial f_group_type) ; + f_group_type_t_Copy :> (t_Copy f_group_type) ; + f_group_type_t_Clone :> (t_Clone f_group_type) ; + f_group_type_t_Eq :> (t_Eq f_group_type) ; + f_group_type_t_PartialEq :> (t_PartialEq f_group_type) ; + f_group_type_t_Sized :> (t_Sized f_group_type) ; + f_g : (both0 f_group_type) ; + f_g_pow : (both0 f_field_type -> both0 f_group_type) ; + f_pow : (both0 f_group_type -> both0 f_field_type -> both0 f_group_type) ; + f_group_one : (both0 f_group_type) ; + f_prod : (both0 f_group_type -> both0 f_group_type -> both0 f_group_type) ; + f_inv : (both0 f_group_type -> both0 f_group_type) ; + f_div : (both0 f_group_type -> both0 f_group_type -> both0 f_group_type) ; + f_hash : (both0 (t_Vec f_group_type t_Global) -> both0 f_field_type) ; }. From ff8870115fbb6316fbcfba83248164948c57d6fc Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 5 Mar 2024 13:06:39 +0100 Subject: [PATCH 66/86] Working with Hax/ssprove_backend_lib --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 329 ++++++++---------- .../extraction/Hacspec_ovn_Ovn_traits.v | 32 +- 2 files changed, 156 insertions(+), 205 deletions(-) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 913533e..49a43fa 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -27,128 +27,81 @@ Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. Require Import Hacspec_ovn_Ovn_traits. Export Hacspec_ovn_Ovn_traits. -(*** Remove locations *) - -Notation both0 := (both (fset []) (fset [])). - (*Not implemented yet? todo(item)*) (*Not implemented yet? todo(item)*) (*Not implemented yet? todo(item)*) -Program Definition if_both0 {A} (c : both0 'bool) (e_then : both0 A) (e_else : both0 A) : both0 A := - bind_both (fsubset_loc := _) (fsubset_opsig := _) c (fun b => if b then lift_both (fsubset_loc := _) (fsubset_opsig := _) e_then else lift_both (fsubset_loc := _) (fsubset_opsig := _) e_else). -Solve All Obligations with solve_ssprove_obligations. -Fail Next Obligation. - -Notation "'ifb0' b 'then' et 'else' ee" := (if_both0 b et ee). -(* Notation "f_prod". *) - -Equations foldi_both_list0 - {acc B: choice_type} - (l : both0 (chList B)) - (f: both0 B -> - both0 acc -> - both0 acc) - (init: both0 acc) - : both0 (acc) := - foldi_both_list0 l f init := - bind_both l (fun l' => List.fold_left (fun x y => solve_lift @f (solve_lift ret_both y) (x) : both0 _) l' (solve_lift init)). -Solve All Obligations with intros ; solve_fsubset_trans. -Solve All Obligations with intros ; solve_ssprove_obligations. -Fail Next Obligation. - -Equations prod_both0 {ceA ceB : choice_type} (a : both0 ceA) (b : both0 ceB) : both0 (ceA × ceB) := - prod_both0 a b := - bind_both a (fun a' => - bind_both b (fun b' => - (ret_both ((a', b') : _ × _)))). -Solve All Obligations with intros ; solve_in_fset. -Fail Next Obligation. - -Definition Build_t_Range {WS} {f_start : both0 (int WS)} {f_end : both0 (int WS)} : both0 (chProd (int WS) (int WS)) := @prod_both0 (int WS) (int WS) f_start f_end. -(* Class iterable (A B : choice_type) := {f_into_iter : both0 A -> both0 (chList B)}. *) - -(* Equations array_index *) -(* {A: choice_type} {len : nat} (x : both0 (nseq_ A len)) {WS} (y : both0 (int WS)) : both0 A := *) -(* array_index x (WS := WS) y := solve_lift lift2_both (fun x y => Hacspec_Lib_Pre.array_index x y) x y. *) -(* Fail Next Obligation. *) - -Notation " x '.a[' a ']'" := (solve_lift array_index (n_seq_array_or_seq x _) a : both0 _) (at level 40). - - -(** End *) - -Equations compute_group_element_for_vote {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (xi : both0 (f_field_type)) (vote : both0 ('bool)) (g_pow_yi : both0 (f_group_type)) : both0 (f_group_type) := +Equations compute_group_element_for_vote {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (xi : both (f_field_type)) (vote : both ('bool)) (g_pow_yi : both (f_group_type)) : both (f_group_type) := compute_group_element_for_vote xi vote g_pow_yi := - solve_lift (f_prod (f_pow g_pow_yi xi) (f_g_pow (ifb0 vote + solve_lift (f_prod (f_pow g_pow_yi xi) (f_g_pow (ifb vote then f_field_one - else f_field_zero))) : both0 (f_group_type). + else f_field_zero))) : both (f_group_type). Fail Next Obligation. -Equations select_private_voting_key {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (random : both0 (int32)) : both0 (f_field_type) := +Equations select_private_voting_key {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (random : both (int32)) : both (f_field_type) := select_private_voting_key random := - solve_lift (f_random_field_elem random) : both0 (f_field_type). + solve_lift (f_random_field_elem random) : both (f_field_type). Fail Next Obligation. - -Equations compute_g_pow_yi {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both0 (uint_size)) (xis : both0 (nseq f_group_type (is_pure (n)))) : both0 (f_group_type) := + +Equations compute_g_pow_yi {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both (uint_size)) (xis : both (nseq f_group_type (is_pure (n)))) : both (f_group_type) := compute_g_pow_yi i xis := letb prod1 := f_group_one in - letb prod1 := foldi_both_list0 (f_into_iter (Build_t_Range (f_start := solve_lift ret_both (0 : uint_size)) (f_end := i))) (fun j => + letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => ssp (fun prod1 => - (* solve_lift (f_prod prod1 (xis.a[j])) : both0 (f_group_type) *) _)) prod1 in + solve_lift (f_prod prod1 (xis.a[j])) : both (f_group_type))) prod1 in letb prod2 := f_group_one in - letb prod2 := foldi_both0_list (f_into_iter (Build_t_Range (f_start := (* i .+ (ret_both (1 : uint_size)) *)_ ) (f_end := n))) (fun j => + letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => ssp (fun prod2 => - solve_lift (f_prod prod2 (xis.a[j])) : both0 (f_group_type))) prod2 in - solve_lift (f_div prod1 prod2) : both0 (f_group_type). + solve_lift (f_prod prod2 (xis.a[j])) : both (f_group_type))) prod2 in + solve_lift (f_div prod1 prod2) : both (f_group_type). Solve All Obligations with now intros ; destruct from_uint_size. Fail Next Obligation. -Equations check_commitment {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both0 (f_group_type)) (commitment : both0 (f_field_type)) : both0 ('bool) := +Equations check_commitment {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both (f_group_type)) (commitment : both (f_field_type)) : both ('bool) := check_commitment g_pow_xi_yi_vi commitment := - solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both0 ('bool). + solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both ('bool). Fail Next Obligation. -Equations commit_to {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both0 (f_group_type)) : both0 (f_field_type) := +Equations commit_to {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both (f_group_type)) : both (f_field_type) := commit_to g_pow_xi_yi_vi := - solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both0 (f_field_type). + solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both (f_field_type). Fail Next Obligation. Definition t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := (int32 × f_field_type × int32 × int32 × int32 × 'bool). -Equations f_cvp_i {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both0 (t_CastVoteParam)) : both0 (int32) := +Equations f_cvp_i {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := f_cvp_i s := bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : int32))) : both0 (int32). + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : int32))) : both (int32). Fail Next Obligation. -Equations f_cvp_xi {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both0 (t_CastVoteParam)) : both0 (f_field_type) := +Equations f_cvp_xi {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (f_field_type) := f_cvp_xi s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both0 (f_field_type). + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_cvp_zkp_random_w {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both0 (t_CastVoteParam)) : both0 (int32) := +Equations f_cvp_zkp_random_w {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := f_cvp_zkp_random_w s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : int32))) : both0 (int32). + solve_lift (ret_both (snd (fst (fst (fst x))) : int32))) : both (int32). Fail Next Obligation. -Equations f_cvp_zkp_random_r {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both0 (t_CastVoteParam)) : both0 (int32) := +Equations f_cvp_zkp_random_r {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := f_cvp_zkp_random_r s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : int32))) : both0 (int32). + solve_lift (ret_both (snd (fst (fst x)) : int32))) : both (int32). Fail Next Obligation. -Equations f_cvp_zkp_random_d {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both0 (t_CastVoteParam)) : both0 (int32) := +Equations f_cvp_zkp_random_d {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := f_cvp_zkp_random_d s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int32))) : both0 (int32). + solve_lift (ret_both (snd (fst x) : int32))) : both (int32). Fail Next Obligation. -Equations f_cvp_vote {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both0 (t_CastVoteParam)) : both0 ('bool) := +Equations f_cvp_vote {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both ('bool) := f_cvp_vote s := bind_both s (fun x => - solve_lift (ret_both (snd x : 'bool))) : both0 ('bool). + solve_lift (ret_both (snd x : 'bool))) : both ('bool). Fail Next Obligation. -Equations Build_t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_cvp_i : both0 (int32)} {f_cvp_xi : both0 (f_field_type)} {f_cvp_zkp_random_w : both0 (int32)} {f_cvp_zkp_random_r : both0 (int32)} {f_cvp_zkp_random_d : both0 (int32)} {f_cvp_vote : both0 ('bool)} : both0 (t_CastVoteParam) := +Equations Build_t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_cvp_i : both (int32)} {f_cvp_xi : both (f_field_type)} {f_cvp_zkp_random_w : both (int32)} {f_cvp_zkp_random_r : both (int32)} {f_cvp_zkp_random_d : both (int32)} {f_cvp_vote : both ('bool)} : both (t_CastVoteParam) := Build_t_CastVoteParam := bind_both f_cvp_vote (fun f_cvp_vote => bind_both f_cvp_zkp_random_d (fun f_cvp_zkp_random_d => @@ -156,7 +109,7 @@ Equations Build_t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} bind_both f_cvp_zkp_random_w (fun f_cvp_zkp_random_w => bind_both f_cvp_xi (fun f_cvp_xi => bind_both f_cvp_i (fun f_cvp_i => - solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam))))))))) : both0 (t_CastVoteParam). + solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam))))))))) : both (t_CastVoteParam). Fail Next Obligation. Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). @@ -167,62 +120,62 @@ Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Bui Definition t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := (f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_field_type × f_field_type × f_field_type × f_field_type × f_field_type). -Equations f_or_zkp_x {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_group_type) := +Equations f_or_zkp_x {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := f_or_zkp_x s := bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both0 (f_group_type). + solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_or_zkp_y {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_group_type) := +Equations f_or_zkp_y {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := f_or_zkp_y s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both0 (f_group_type). + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_or_zkp_a1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_group_type) := +Equations f_or_zkp_a1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := f_or_zkp_a1 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : f_group_type))) : both0 (f_group_type). + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_or_zkp_b1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_group_type) := +Equations f_or_zkp_b1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := f_or_zkp_b1 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : f_group_type))) : both0 (f_group_type). + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_or_zkp_a2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_group_type) := +Equations f_or_zkp_a2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := f_or_zkp_a2 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : f_group_type))) : both0 (f_group_type). + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_or_zkp_b2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_group_type) := +Equations f_or_zkp_b2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := f_or_zkp_b2 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : f_group_type))) : both0 (f_group_type). + solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_or_zkp_c {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_field_type) := +Equations f_or_zkp_c {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := f_or_zkp_c s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both0 (f_field_type). + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_or_zkp_d1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_field_type) := +Equations f_or_zkp_d1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := f_or_zkp_d1 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : f_field_type))) : both0 (f_field_type). + solve_lift (ret_both (snd (fst (fst (fst x))) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_or_zkp_d2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_field_type) := +Equations f_or_zkp_d2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := f_or_zkp_d2 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : f_field_type))) : both0 (f_field_type). + solve_lift (ret_both (snd (fst (fst x)) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_or_zkp_r1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_field_type) := +Equations f_or_zkp_r1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := f_or_zkp_r1 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both0 (f_field_type). + solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_or_zkp_r2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OrZKPCommit)) : both0 (f_field_type) := +Equations f_or_zkp_r2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := f_or_zkp_r2 s := bind_both s (fun x => - solve_lift (ret_both (snd x : f_field_type))) : both0 (f_field_type). + solve_lift (ret_both (snd x : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations Build_t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_or_zkp_x : both0 (f_group_type)} {f_or_zkp_y : both0 (f_group_type)} {f_or_zkp_a1 : both0 (f_group_type)} {f_or_zkp_b1 : both0 (f_group_type)} {f_or_zkp_a2 : both0 (f_group_type)} {f_or_zkp_b2 : both0 (f_group_type)} {f_or_zkp_c : both0 (f_field_type)} {f_or_zkp_d1 : both0 (f_field_type)} {f_or_zkp_d2 : both0 (f_field_type)} {f_or_zkp_r1 : both0 (f_field_type)} {f_or_zkp_r2 : both0 (f_field_type)} : both0 (t_OrZKPCommit) := +Equations Build_t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_or_zkp_x : both (f_group_type)} {f_or_zkp_y : both (f_group_type)} {f_or_zkp_a1 : both (f_group_type)} {f_or_zkp_b1 : both (f_group_type)} {f_or_zkp_a2 : both (f_group_type)} {f_or_zkp_b2 : both (f_group_type)} {f_or_zkp_c : both (f_field_type)} {f_or_zkp_d1 : both (f_field_type)} {f_or_zkp_d2 : both (f_field_type)} {f_or_zkp_r1 : both (f_field_type)} {f_or_zkp_r2 : both (f_field_type)} : both (t_OrZKPCommit) := Build_t_OrZKPCommit := bind_both f_or_zkp_r2 (fun f_or_zkp_r2 => bind_both f_or_zkp_r1 (fun f_or_zkp_r1 => @@ -235,7 +188,7 @@ Equations Build_t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized ( bind_both f_or_zkp_a1 (fun f_or_zkp_a1 => bind_both f_or_zkp_y (fun f_or_zkp_y => bind_both f_or_zkp_x (fun f_or_zkp_x => - solve_lift (ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit)))))))))))))) : both0 (t_OrZKPCommit). + solve_lift (ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit)))))))))))))) : both (t_OrZKPCommit). Fail Next Obligation. Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := y) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := y) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). @@ -251,27 +204,27 @@ Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r2' ':=' y ')'" := (Buil Definition t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := (int32 × f_field_type × int32). -Equations f_rp_i {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both0 (t_RegisterParam)) : both0 (int32) := +Equations f_rp_i {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_RegisterParam)) : both (int32) := f_rp_i s := bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both0 (int32). + solve_lift (ret_both (fst (fst x) : int32))) : both (int32). Fail Next Obligation. -Equations f_rp_xi {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both0 (t_RegisterParam)) : both0 (f_field_type) := +Equations f_rp_xi {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_RegisterParam)) : both (f_field_type) := f_rp_xi s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both0 (f_field_type). + solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_rp_zkp_random {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both0 (t_RegisterParam)) : both0 (int32) := +Equations f_rp_zkp_random {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_RegisterParam)) : both (int32) := f_rp_zkp_random s := bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both0 (int32). + solve_lift (ret_both (snd x : int32))) : both (int32). Fail Next Obligation. -Equations Build_t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_rp_i : both0 (int32)} {f_rp_xi : both0 (f_field_type)} {f_rp_zkp_random : both0 (int32)} : both0 (t_RegisterParam) := +Equations Build_t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_rp_i : both (int32)} {f_rp_xi : both (f_field_type)} {f_rp_zkp_random : both (int32)} : both (t_RegisterParam) := Build_t_RegisterParam := bind_both f_rp_zkp_random (fun f_rp_zkp_random => bind_both f_rp_xi (fun f_rp_xi => bind_both f_rp_i (fun f_rp_i => - solve_lift (ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam)))))) : both0 (t_RegisterParam). + solve_lift (ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam)))))) : both (t_RegisterParam). Fail Next Obligation. Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x)). Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y) (f_rp_zkp_random := f_rp_zkp_random x)). @@ -279,27 +232,27 @@ Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := Definition t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := (f_group_type × f_field_type × f_field_type). -Equations f_schnorr_zkp_u {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_SchnorrZKPCommit)) : both0 (f_group_type) := +Equations f_schnorr_zkp_u {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_SchnorrZKPCommit)) : both (f_group_type) := f_schnorr_zkp_u s := bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : f_group_type))) : both0 (f_group_type). + solve_lift (ret_both (fst (fst x) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_schnorr_zkp_c {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_SchnorrZKPCommit)) : both0 (f_field_type) := +Equations f_schnorr_zkp_c {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_SchnorrZKPCommit)) : both (f_field_type) := f_schnorr_zkp_c s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both0 (f_field_type). + solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_schnorr_zkp_z {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_SchnorrZKPCommit)) : both0 (f_field_type) := +Equations f_schnorr_zkp_z {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_SchnorrZKPCommit)) : both (f_field_type) := f_schnorr_zkp_z s := bind_both s (fun x => - solve_lift (ret_both (snd x : f_field_type))) : both0 (f_field_type). + solve_lift (ret_both (snd x : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations Build_t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_schnorr_zkp_u : both0 (f_group_type)} {f_schnorr_zkp_c : both0 (f_field_type)} {f_schnorr_zkp_z : both0 (f_field_type)} : both0 (t_SchnorrZKPCommit) := +Equations Build_t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_schnorr_zkp_u : both (f_group_type)} {f_schnorr_zkp_c : both (f_field_type)} {f_schnorr_zkp_z : both (f_field_type)} : both (t_SchnorrZKPCommit) := Build_t_SchnorrZKPCommit := bind_both f_schnorr_zkp_z (fun f_schnorr_zkp_z => bind_both f_schnorr_zkp_c (fun f_schnorr_zkp_c => bind_both f_schnorr_zkp_u (fun f_schnorr_zkp_u => - solve_lift (ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit)))))) : both0 (t_SchnorrZKPCommit). + solve_lift (ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit)))))) : both (t_SchnorrZKPCommit). Fail Next Obligation. Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := y) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := y) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). @@ -307,12 +260,12 @@ Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_z' ':=' y ')'" Definition t_TallyParameter : choice_type := 'unit. -Equations Build_t_TallyParameter : both0 (t_TallyParameter) := +Equations Build_t_TallyParameter : both (t_TallyParameter) := Build_t_TallyParameter := - solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both0 (t_TallyParameter). + solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (t_TallyParameter). Fail Next Obligation. -Equations schnorr_zkp {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both0 (int32)) (h : both0 (f_group_type)) (x : both0 (f_field_type)) : both0 (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := +Equations schnorr_zkp {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both (int32)) (h : both (f_group_type)) (x : both (f_field_type)) : both (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := schnorr_zkp random h x := solve_lift (run (letb r := f_random_field_elem random in letb u := f_g_pow r in @@ -320,25 +273,25 @@ Equations schnorr_zkp {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ h; u])))) in letb z := f_add r (f_mul c x) in - letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))] hoist1 := _ (* v_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) *) in - ControlFlow_Continue _ (* (never_to_any hoist1) *))) : both0 (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). + letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in + ControlFlow_Continue (never_to_any hoist1))) : both (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). Fail Next Obligation. -Equations schnorr_zkp_validate {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both0 (f_group_type)) (pi : both0 (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both0 ('bool) := +Equations schnorr_zkp_validate {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both (f_group_type)) (pi : both (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both ('bool) := schnorr_zkp_validate h pi := - solve_lift (andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); + solve_lift (andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g; h; - f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both0 ('bool). + f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both ('bool). Fail Next Obligation. -Equations zkp_one_out_of_two {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both0 (int32)) (random_r : both0 (int32)) (random_d : both0 (int32)) (h : both0 (f_group_type)) (xi : both0 (f_field_type)) (vi : both0 ('bool)) : both0 (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) := +Equations zkp_one_out_of_two {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both (int32)) (random_r : both (int32)) (random_d : both (int32)) (h : both (f_group_type)) (xi : both (f_field_type)) (vi : both ('bool)) : both (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) := zkp_one_out_of_two random_w random_r random_d h xi vi := letb w := f_random_field_elem random_w in solve_lift (ifb vi then letb r1 := f_random_field_elem random_r in letb d1 := f_random_field_elem random_d in letb x := f_g_pow xi in - letb y := f_prod (f_pow h xi) (f_g (ret_both (tt : 'unit))) in + letb y := f_prod (f_pow h xi) (f_g) in letb a1 := f_prod (f_g_pow r1) (f_pow x d1) in letb b1 := f_prod (f_pow h r1) (f_pow y d1) in letb a2 := f_g_pow w in @@ -359,7 +312,7 @@ Equations zkp_one_out_of_two {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v letb a1 := f_g_pow w in letb b1 := f_pow h w in letb a2 := f_prod (f_g_pow r2) (f_pow x d2) in - letb b2 := f_prod (f_pow h r2) (f_pow (f_div y (f_g (ret_both (tt : 'unit)))) d2) in + letb b2 := f_prod (f_pow h r2) (f_pow (f_div y (f_g)) d2) in letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; y; a1; @@ -368,10 +321,10 @@ Equations zkp_one_out_of_two {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v b2])))) in letb d1 := f_sub c d2 in letb r1 := f_sub w (f_mul xi d1) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both0 (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)). + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)). Fail Next Obligation. -Equations zkp_one_out_of_two_validate {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both0 (f_group_type)) (zkp : both0 (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both0 ('bool) := +Equations zkp_one_out_of_two_validate {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both (f_group_type)) (zkp : both (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both ('bool) := zkp_one_out_of_two_validate h zkp := letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; f_or_zkp_y zkp; @@ -379,42 +332,42 @@ Equations zkp_one_out_of_two_validate {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t f_or_zkp_b1 zkp; f_or_zkp_a2 zkp; f_or_zkp_b2 zkp])))) in - solve_lift (andb (andb (andb (andb (c =.? (f_add (f_or_zkp_d1 zkp) (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? (f_prod (f_pow h (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r2 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? (f_prod (f_pow h (f_or_zkp_r2 zkp)) (f_pow (f_div (f_or_zkp_y zkp) (f_g (ret_both (tt : 'unit)))) (f_or_zkp_d2 zkp))))) : both0 ('bool). + solve_lift (andb (andb (andb (andb (c =.? (f_add (f_or_zkp_d1 zkp) (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? (f_prod (f_pow h (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r2 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? (f_prod (f_pow h (f_or_zkp_r2 zkp)) (f_pow (f_div (f_or_zkp_y zkp) (f_g)) (f_or_zkp_d2 zkp))))) : both ('bool). Fail Next Obligation. -Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := +Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := (nseq f_group_type (is_pure (n)) × nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × nseq f_field_type (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × int32). -Equations f_g_pow_xis {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OvnContractState (n := n))) : both0 (nseq f_group_type (is_pure (n))) := +Equations f_g_pow_xis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq f_group_type (is_pure (n))) := f_g_pow_xis s := bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type (is_pure (n))))) : both0 (nseq f_group_type (is_pure (n))). + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type (is_pure (n))))) : both (nseq f_group_type (is_pure (n))). Fail Next Obligation. -Equations f_zkp_xis {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OvnContractState (n := n))) : both0 (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := +Equations f_zkp_xis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := f_zkp_xis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both0 (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). Fail Next Obligation. -Equations f_commit_vis {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OvnContractState (n := n))) : both0 (nseq f_field_type (is_pure (n))) := +Equations f_commit_vis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq f_field_type (is_pure (n))) := f_commit_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : nseq f_field_type (is_pure (n))))) : both0 (nseq f_field_type (is_pure (n))). + solve_lift (ret_both (snd (fst (fst (fst x))) : nseq f_field_type (is_pure (n))))) : both (nseq f_field_type (is_pure (n))). Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OvnContractState (n := n))) : both0 (nseq f_group_type (is_pure (n))) := +Equations f_g_pow_xi_yi_vis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq f_group_type (is_pure (n))) := f_g_pow_xi_yi_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type (is_pure (n))))) : both0 (nseq f_group_type (is_pure (n))). + solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type (is_pure (n))))) : both (nseq f_group_type (is_pure (n))). Fail Next Obligation. -Equations f_zkp_vis {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OvnContractState (n := n))) : both0 (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := +Equations f_zkp_vis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := f_zkp_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both0 (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). + solve_lift (ret_both (snd (fst x) : nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). Fail Next Obligation. -Equations f_tally {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both0 (t_OvnContractState (n := n))) : both0 (int32) := +Equations f_tally {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (int32) := f_tally s := bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both0 (int32). + solve_lift (ret_both (snd x : int32))) : both (int32). Fail Next Obligation. -Equations Build_t_OvnContractState {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_g_pow_xis : both0 (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both0 (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_commit_vis : both0 (nseq f_field_type (is_pure (n)))} {f_g_pow_xi_yi_vis : both0 (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both0 (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_tally : both0 (int32)} : both0 (t_OvnContractState (n := n)) := +Equations Build_t_OvnContractState {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_g_pow_xis : both (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_commit_vis : both (nseq f_field_type (is_pure (n)))} {f_g_pow_xi_yi_vis : both (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_tally : both (int32)} : both (t_OvnContractState (n := n)) := Build_t_OvnContractState := bind_both f_tally (fun f_tally => bind_both f_zkp_vis (fun f_zkp_vis => @@ -422,7 +375,7 @@ Equations Build_t_OvnContractState {v_Z : _} {v_G : _} {n : both0 (uint_size)} ` bind_both f_commit_vis (fun f_commit_vis => bind_both f_zkp_xis (fun f_zkp_xis => bind_both f_g_pow_xis (fun f_g_pow_xis => - solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both0 (t_OvnContractState). + solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (t_OvnContractState). Fail Next Obligation. Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). @@ -431,7 +384,7 @@ Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ') Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). -Equations cast_vote {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both0 (impl_574521470_)) (state : both0 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both0 (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := +Equations cast_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := cast_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with @@ -449,10 +402,10 @@ Equations cast_vote {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} {impl_ letb cast_vote_state_ret := f_clone state in letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both0 (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). Fail Next Obligation. -Equations commit_to_vote {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both0 (impl_574521470_)) (state : both0 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both0 (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := +Equations commit_to_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := commit_to_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with @@ -464,27 +417,27 @@ Equations commit_to_vote {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} { letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist3 := v_Break (Result_Err (ret_both tt)) in ControlFlow_Continue (solve_lift (never_to_any hoist3)) end in - ControlFlow_Continue (letb _ := foldi_both0_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => solve_lift (ifb negb (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist4 := v_Break (Result_Err (ret_both tt)) in ControlFlow_Continue (never_to_any hoist4) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both0 _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in + else ControlFlow_Continue (ret_both (tt : 'unit))) : both _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in letb commit_vi := commit_to g_pow_xi_yi_vi in letb commit_to_vote_state_ret := f_clone state in letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),commit_to_vote_state_ret))))) : both0 (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),commit_to_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). Solve All Obligations with now intros ; destruct from_uint_size. Fail Next Obligation. -Equations init_ovn_contract {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both0 ('unit)) : both0 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)) := +Equations init_ovn_contract {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both ('unit)) : both (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)) := init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_field_zero (ret_both (tt : 'unit))) (f_schnorr_zkp_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_y := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_c := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d2 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both0 (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)). + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one) (f_schnorr_zkp_z := f_field_zero) (f_schnorr_zkp_c := f_field_zero)) n) (f_commit_vis := repeat (f_field_zero) n) (f_g_pow_xi_yi_vis := repeat (f_group_one) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one) (f_or_zkp_y := f_group_one) (f_or_zkp_a1 := f_group_one) (f_or_zkp_b1 := f_group_one ) (f_or_zkp_a2 := f_group_one ) (f_or_zkp_b2 := f_group_one ) (f_or_zkp_c := f_field_zero ) (f_or_zkp_d1 := f_field_zero ) (f_or_zkp_d2 := f_field_zero ) (f_or_zkp_r1 := f_field_zero ) (f_or_zkp_r2 := f_field_zero )) n) (f_tally := ret_both (0 : int32)))) : both (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)). Fail Next Obligation. -Equations register_vote {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both0 (impl_574521470_)) (state : both0 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both0 (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := +Equations register_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := register_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_RegisterParam (v_Z)) := matchb out with @@ -501,12 +454,12 @@ Equations register_vote {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} {i letb register_vote_state_ret := f_clone state in letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),register_vote_state_ret))))) : both0 (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),register_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). Fail Next Obligation. -Equations tally_votes {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both0 (impl_574521470_)) (state : both0 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both0 (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := +Equations tally_votes {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := tally_votes _ state := - letb _ := foldi_both0_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] _ := ControlFlow_Continue (ifb negb (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) @@ -516,24 +469,24 @@ Equations tally_votes {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} {imp solve_lift (ifb negb (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist7 := v_Break (Result_Err (ret_both tt)) in ControlFlow_Continue (never_to_any hoist7) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both0 _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in - letb vote_result := f_group_one (ret_both (tt : 'unit)) in - letb vote_result := foldi_both0_list ((* f_into_iter *) (array_to_list (f_g_pow_xi_yi_vis state))) (fun g_pow_vote => + else ControlFlow_Continue (ret_both (tt : 'unit))) : both _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in + letb vote_result := f_group_one in + letb vote_result := foldi_both_list ((* f_into_iter *) (array_to_list (f_g_pow_xi_yi_vis state))) (fun g_pow_vote => ssp (fun vote_result => - solve_lift (f_prod vote_result g_pow_vote) : both0 (f_group_type))) vote_result in + solve_lift (f_prod vote_result g_pow_vote) : both (f_group_type))) vote_result in letb tally := ret_both (0 : int32) in - letb curr := f_field_zero (ret_both (tt : 'unit)) in - letb '(curr,tally) := foldi_both0_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => + letb curr := f_field_zero in + letb '(curr,tally) := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => ssp (fun '(curr,tally) => letb tally := ifb (f_g_pow curr) =.? vote_result then letb tally := i in tally else tally in - letb curr := f_add curr (f_field_one (ret_both (tt : 'unit))) in - solve_lift (prod_b (curr,tally)) : both0 ((f_field_type × int32)))) (prod_b (curr,tally)) in + letb curr := f_add curr (f_field_one) in + solve_lift (prod_b (curr,tally)) : both ((f_field_type × int32)))) (prod_b (curr,tally)) in letb tally_votes_state_ret := f_clone state in letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in - Result_Ok (solve_lift (prod_b (f_accept (* (ret_both (tt : 'unit)) *),tally_votes_state_ret))) : both0 (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). + Result_Ok (solve_lift (prod_b (f_accept (* (ret_both (tt : 'unit)) *),tally_votes_state_ret))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). Solve All Obligations with now intros ; destruct from_uint_size. Fail Next Obligation. @@ -553,40 +506,40 @@ Export Serializable. From Hacspec Require Import ConCertLib. Export ConCertLib. -Definition state_OVN {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := +Definition state_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n). -#[global] Program Instance t_CastVoteParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_HasReceiveContext t_CastVoteParam 'unit := +#[global] Program Instance t_CastVoteParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_HasReceiveContext t_CastVoteParam 'unit := {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. Fail Next Obligation. -#[global] Program Instance t_CastVoteParam_t_Sized {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_Sized t_CastVoteParam := +#[global] Program Instance t_CastVoteParam_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_Sized t_CastVoteParam := fun x => x. Fail Next Obligation. -Definition receive_OVN_cast_vote {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {v_A : _} `{ t_Sized (v_A)} `{ t_HasActions (v_A)} (ctx : both0 (t_CastVoteParam (v_Z := v_Z))) (st : both0 (state_OVN)) : both0 (t_Result ((v_A × state_OVN)) (t_ParseError)) := +Definition receive_OVN_cast_vote {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {v_A : _} `{ t_Sized (v_A)} `{ t_HasActions (v_A)} (ctx : both (t_CastVoteParam (v_Z := v_Z))) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := cast_vote (v_Z := v_Z) (v_G := v_G) (n := n) (v_A := v_A) (H2 := t_CastVoteParam_t_Sized (v_Z := v_Z) (v_G := v_G) (n := n)) (H7 := t_CastVoteParam_t_HasReceiveContext (v_Z := v_Z) (v_G := v_G) (n := n)) ctx st. -(* #[global] Program Instance t_CastVoteParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both0 (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_HasReceiveContext t_CastVoteParam 'unit := *) +(* #[global] Program Instance t_CastVoteParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_HasReceiveContext t_CastVoteParam 'unit := *) (* {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. *) (* Fail Next Obligation. *) (* #[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := *) (* fun x => *) (* x. *) (* Fail Next Obligation. *) -Definition receive_OVN_commit_to_vote {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both0 (t_CastVoteParam)) (st : both0 (state_OVN (n := n))) : both0 (t_Result ((v_A × state_OVN)) (t_ParseError)) := +Definition receive_OVN_commit_to_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both (t_CastVoteParam)) (st : both (state_OVN (n := n))) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := commit_to_vote (H2 := t_CastVoteParam_t_Sized (n := n)) (H7 := t_CastVoteParam_t_HasReceiveContext (n := n)) ctx st. -Definition init_OVN {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN (n := n)) (t_ParseError) := +Definition init_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN (n := n)) (t_ParseError) := ResultMonad.Ok st. -#[global] Program Instance t_RegisterParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_HasReceiveContext t_RegisterParam 'unit := +#[global] Program Instance t_RegisterParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_HasReceiveContext t_RegisterParam 'unit := {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. Fail Next Obligation. -#[global] Program Instance t_RegisterParam_t_Sized {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_Sized t_RegisterParam := +#[global] Program Instance t_RegisterParam_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_Sized t_RegisterParam := fun x => x. Fail Next Obligation. -Definition receive_OVN_register {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both0 (t_RegisterParam)) (st : both0 (state_OVN (n := n))) : both0 (t_Result ((v_A × state_OVN)) (t_ParseError)) := +Definition receive_OVN_register {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both (t_RegisterParam)) (st : both (state_OVN (n := n))) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := register_vote (H2 := t_RegisterParam_t_Sized (n := n)) (H7 := t_RegisterParam_t_HasReceiveContext (n := n)) ctx st. #[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := @@ -596,7 +549,7 @@ Fail Next Obligation. fun x => x. Fail Next Obligation. -Definition receive_OVN_tally {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both0 (t_TallyParameter)) (st : both0 (state_OVN)) : both0 (t_Result ((v_A × state_OVN (n := n))) (t_ParseError)) := +Definition receive_OVN_tally {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both (t_TallyParameter)) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN (n := n))) (t_ParseError)) := tally_votes ctx st. Inductive Msg_OVN {v_Z : _} `{ t_Sized (v_Z)} `{ temp : t_Z_Field (v_Z)} : Type := @@ -604,39 +557,39 @@ Inductive Msg_OVN {v_Z : _} `{ t_Sized (v_Z)} `{ temp : t_Z_Field (v_Z)} : Type | msg_OVN_commit_to_vote : t_CastVoteParam (v_Z := v_Z) (H0 := temp) -> Msg_OVN | msg_OVN_register : t_RegisterParam (v_Z := v_Z) -> Msg_OVN | msg_OVN_tally : t_TallyParameter -> Msg_OVN. -#[global] Program Instance state_OVN_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_HasReceiveContext (state_OVN (n := n)) 'unit := +#[global] Program Instance state_OVN_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_HasReceiveContext (state_OVN (n := n)) 'unit := {| f_get := (fun (Ctx : _) => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. Fail Next Obligation. -#[global] Program Instance state_OVN_t_Sized {v_Z : _} {v_G : _} {n : both0 (uint_size)} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : t_Sized (state_OVN (n := n)) := +#[global] Program Instance state_OVN_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : t_Sized (state_OVN (n := n)) := fun x => x. Fail Next Obligation. -#[global] Program Instance state_OVN_t_HasActions {v_Z : _} {v_G : _} {n : both0 (uint_size)}`{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : t_HasActions (state_OVN (v_Z := v_Z) (n := n)). +#[global] Program Instance state_OVN_t_HasActions {v_Z : _} {v_G : _} {n : both (uint_size)}`{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : t_HasActions (state_OVN (v_Z := v_Z) (n := n)). Admit Obligations. Fail Next Obligation. Obligation Tactic := intros. (* *) -Equations receive_OVN {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ temp1 : t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (chain : Chain) (ctx : ContractCallContext) (st : state_OVN (v_Z := v_Z) (n := n)) (msg : Datatypes.option (Msg_OVN (v_Z := v_Z))) : ResultMonad.result (state_OVN (v_Z := v_Z) (n := n) * list ActionBody) t_ParseError := +Equations receive_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ temp1 : t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (chain : Chain) (ctx : ContractCallContext) (st : state_OVN (v_Z := v_Z) (n := n)) (msg : Datatypes.option (Msg_OVN (v_Z := v_Z))) : ResultMonad.result (state_OVN (v_Z := v_Z) (n := n) * list ActionBody) t_ParseError := receive_OVN chain ctx st msg := match msg with | Some (msg_OVN_cast_vote val) => - match is_pure (both0_prog (@receive_OVN_cast_vote v_Z v_G n _ _ _ _ _ v_A _ _ (ret_both val) (ret_both st))) with + match is_pure (both_prog (@receive_OVN_cast_vote v_Z v_G n _ _ _ _ _ v_A _ _ (ret_both val) (ret_both st))) with | inl x => ResultMonad.Ok ((snd x), []) | inr x => ResultMonad.Err x end | Some (msg_OVN_commit_to_vote val) => - match is_pure (both0_prog (@receive_OVN_commit_to_vote v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st))) with + match is_pure (both_prog (@receive_OVN_commit_to_vote v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st))) with | inl x => ResultMonad.Ok ((snd x), []) | inr x => ResultMonad.Err x end | Some (msg_OVN_register val) => - match is_pure (both0_prog (@receive_OVN_register v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st))) with + match is_pure (both_prog (@receive_OVN_register v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st))) with | inl x => ResultMonad.Ok ((snd x), []) | inr x => ResultMonad.Err x end | Some (msg_OVN_tally val) => - match (is_pure (both0_prog (@receive_OVN_tally v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st)))) with + match (is_pure (both_prog (@receive_OVN_tally v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st)))) with | inl x => ResultMonad.Ok ((snd x), []) | inr x => ResultMonad.Err x end @@ -644,7 +597,7 @@ Equations receive_OVN {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} `{ ResultMonad.Err tt end : ResultMonad.result (state_OVN (v_Z := v_Z) (n := n) * list ActionBody) t_ParseError. Fail Next Obligation. -#[global] Program Instance state_OVN_Serializable {v_Z : _} {v_G : _} {n : both0 (uint_size)} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : Serializable (state_OVN (v_Z := v_Z) (n := n)) := +#[global] Program Instance state_OVN_Serializable {v_Z : _} {v_G : _} {n : both (uint_size)} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : Serializable (state_OVN (v_Z := v_Z) (n := n)) := _. Admit Obligations. Fail Next Obligation. @@ -652,4 +605,4 @@ Fail Next Obligation. Admit Obligations. (* Derive Serializable Msg_OVN_rect. *) Fail Next Obligation. -Definition contract_OVN {v_Z : _} {v_G : _} {n : both0 (uint_size)} {v_A : _} `{ temp1 : t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ temp2 : t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : @Contract _ (@state_OVN v_Z v_G n temp1 _ _ _ _) (@Msg_OVN v_Z temp1 H1 ) (state_OVN (v_Z := v_Z) (n := n)) (t_ParseError) state_OVN_Serializable Msg_OVN_Serializable state_OVN_Serializable _ := build_contract init_OVN receive_OVN. +Definition contract_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ temp1 : t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ temp2 : t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : @Contract _ (@state_OVN v_Z v_G n temp1 _ _ _ _) (@Msg_OVN v_Z temp1 H1 ) (state_OVN (v_Z := v_Z) (n := n)) (t_ParseError) state_OVN_Serializable Msg_OVN_Serializable state_OVN_Serializable _ := build_contract init_OVN receive_OVN. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v index 511c9f1..590ce18 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v @@ -24,8 +24,6 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Notation both0 := (both (fset []) (fset [])). - Class t_Z_Field (Self : choice_type) := { f_field_type : choice_type ; f_field_type_t_Serialize :> (t_Serialize f_field_type) ; @@ -36,13 +34,13 @@ Class t_Z_Field (Self : choice_type) := { f_field_type_t_Eq :> (t_Eq f_field_type) ; f_field_type_t_PartialEq :> (t_PartialEq f_field_type) ; f_field_type_t_Sized :> (t_Sized f_field_type) ; - f_q : (both0 f_field_type) ; - f_random_field_elem : (both0 int32 -> both0 f_field_type) ; - f_field_zero : (both0 f_field_type) ; - f_field_one : (both0 f_field_type) ; - f_add : (both0 f_field_type -> both0 f_field_type -> both0 f_field_type) ; - f_sub : (both0 f_field_type -> both0 f_field_type -> both0 f_field_type) ; - f_mul : (both0 f_field_type -> both0 f_field_type -> both0 f_field_type) ; + f_q : (both f_field_type) ; + f_random_field_elem : (both int32 -> both f_field_type) ; + f_field_zero : (both f_field_type) ; + f_field_one : (both f_field_type) ; + f_add : (both f_field_type -> both f_field_type -> both f_field_type) ; + f_sub : (both f_field_type -> both f_field_type -> both f_field_type) ; + f_mul : (both f_field_type -> both f_field_type -> both f_field_type) ; }. Class t_Group (Self : choice_type) `{t_Z_Field} := { @@ -55,12 +53,12 @@ Class t_Group (Self : choice_type) `{t_Z_Field} := { f_group_type_t_Eq :> (t_Eq f_group_type) ; f_group_type_t_PartialEq :> (t_PartialEq f_group_type) ; f_group_type_t_Sized :> (t_Sized f_group_type) ; - f_g : (both0 f_group_type) ; - f_g_pow : (both0 f_field_type -> both0 f_group_type) ; - f_pow : (both0 f_group_type -> both0 f_field_type -> both0 f_group_type) ; - f_group_one : (both0 f_group_type) ; - f_prod : (both0 f_group_type -> both0 f_group_type -> both0 f_group_type) ; - f_inv : (both0 f_group_type -> both0 f_group_type) ; - f_div : (both0 f_group_type -> both0 f_group_type -> both0 f_group_type) ; - f_hash : (both0 (t_Vec f_group_type t_Global) -> both0 f_field_type) ; + f_g : (both f_group_type) ; + f_g_pow : (both f_field_type -> both f_group_type) ; + f_pow : (both f_group_type -> both f_field_type -> both f_group_type) ; + f_group_one : (both f_group_type) ; + f_prod : (both f_group_type -> both f_group_type -> both f_group_type) ; + f_inv : (both f_group_type -> both f_group_type) ; + f_div : (both f_group_type -> both f_group_type -> both f_group_type) ; + f_hash : (both (t_Vec f_group_type t_Global) -> both f_field_type) ; }. From 303228a137297dac2ecdf8a71326b62181e25283 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 5 Mar 2024 13:53:24 +0100 Subject: [PATCH 67/86] Working with Hax/ssprove_backend_lib: fix serializable --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 18 +++++++++++++++--- .../extraction/Hacspec_ovn_Ovn_traits.v | 5 +++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 49a43fa..2c74e8b 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -565,7 +565,11 @@ Fail Next Obligation. x. Fail Next Obligation. #[global] Program Instance state_OVN_t_HasActions {v_Z : _} {v_G : _} {n : both (uint_size)}`{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : t_HasActions (state_OVN (v_Z := v_Z) (n := n)). -Admit Obligations. +Next Obligation. + pose (init_ovn_contract_equation_1 v_Z v_G n H H0 H1 _ H2 (ret_both tt)). + set (solve_lift _) in e. + apply b. +Defined. Fail Next Obligation. Obligation Tactic := intros. @@ -599,10 +603,18 @@ Equations receive_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t Fail Next Obligation. #[global] Program Instance state_OVN_Serializable {v_Z : _} {v_G : _} {n : both (uint_size)} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : Serializable (state_OVN (v_Z := v_Z) (n := n)) := _. -Admit Obligations. +Next Obligation. + serialize_enum. + 1-4: refine nseq_serializable ; serialize_enum. + 7: refine nseq_serializable ; serialize_enum. + all: try refine f_group_type_Serializable. + all: try refine f_field_type_Serializable. + exact hacspec_int_serializable. +Qed. Fail Next Obligation. #[global] Program Instance Msg_OVN_Serializable {v_Z : _} `{ temp0 : t_Sized (v_Z)} `{ temp1 : t_Z_Field (v_Z)} : Serializable (@Msg_OVN v_Z temp0 temp1). + (* Derive Serializable (@Msg_OVN_rect v_Z temp0 temp1) < (msg_OVN_cast_vote (v_Z := v_Z) (H := temp0) (temp := temp1)) , (msg_OVN_commit_to_vote (v_Z := v_Z) (H := temp0) (temp := temp1)), (msg_OVN_register (v_Z := v_Z) (H := temp0) (temp := temp1)),(msg_OVN_tally (v_Z := v_Z) (H := temp0) (temp := temp1)) >. *) Admit Obligations. -(* Derive Serializable Msg_OVN_rect. *) Fail Next Obligation. + Definition contract_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ temp1 : t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ temp2 : t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : @Contract _ (@state_OVN v_Z v_G n temp1 _ _ _ _) (@Msg_OVN v_Z temp1 H1 ) (state_OVN (v_Z := v_Z) (n := n)) (t_ParseError) state_OVN_Serializable Msg_OVN_Serializable state_OVN_Serializable _ := build_contract init_OVN receive_OVN. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v index 590ce18..7fe905e 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v @@ -24,8 +24,12 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. +From ConCert.Execution Require Import Serializable. +From Hacspec Require Import ConCertLib. + Class t_Z_Field (Self : choice_type) := { f_field_type : choice_type ; + f_field_type_Serializable : Serializable f_field_type; f_field_type_t_Serialize :> (t_Serialize f_field_type) ; f_field_type_t_Deserial :> (t_Deserial f_field_type) ; f_field_type_t_Serial :> (t_Serial f_field_type) ; @@ -45,6 +49,7 @@ Class t_Z_Field (Self : choice_type) := { Class t_Group (Self : choice_type) `{t_Z_Field} := { f_group_type : choice_type ; + f_group_type_Serializable : Serializable f_group_type; f_group_type_t_Serialize :> (t_Serialize f_group_type) ; f_group_type_t_Deserial :> (t_Deserial f_group_type) ; f_group_type_t_Serial :> (t_Serial f_group_type) ; From 4a1c48d53bb3a34d67b6cf315a0760123f4030f4 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 5 Mar 2024 14:16:01 +0100 Subject: [PATCH 68/86] Cleanup by adding Context --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 239 ++++++++++---------- 1 file changed, 120 insertions(+), 119 deletions(-) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 2c74e8b..9c3782e 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -33,19 +33,24 @@ Export Hacspec_ovn_Ovn_traits. (*Not implemented yet? todo(item)*) -Equations compute_group_element_for_vote {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (xi : both (f_field_type)) (vote : both ('bool)) (g_pow_yi : both (f_group_type)) : both (f_group_type) := +Context (v_Z : choice_type) (v_G : choice_type) (v_A : choice_type). +Context {n : both (uint_size)}. +Context (v_Z_t_Sized : t_Sized (v_Z)) (v_G_t_Sized : t_Sized (v_G)) `{ t_Sized (v_A)}. +Context (v_Z_t_Z_Field : t_Z_Field (v_Z)) (v_G_v_Z_t_Group : @t_Group (v_G) (v_Z) v_Z_t_Z_Field) (v_A_t_HasActions : t_HasActions (v_A)) . + +Equations compute_group_element_for_vote (xi : both (f_field_type)) (vote : both ('bool)) (g_pow_yi : both (f_group_type)) : both (f_group_type) := compute_group_element_for_vote xi vote g_pow_yi := solve_lift (f_prod (f_pow g_pow_yi xi) (f_g_pow (ifb vote then f_field_one else f_field_zero))) : both (f_group_type). Fail Next Obligation. -Equations select_private_voting_key {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (random : both (int32)) : both (f_field_type) := +Equations select_private_voting_key (random : both (int32)) : both (f_field_type) := select_private_voting_key random := solve_lift (f_random_field_elem random) : both (f_field_type). Fail Next Obligation. -Equations compute_g_pow_yi {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both (uint_size)) (xis : both (nseq f_group_type (is_pure (n)))) : both (f_group_type) := +Equations compute_g_pow_yi (i : both (uint_size)) (xis : both (nseq f_group_type (is_pure (n)))) : both (f_group_type) := compute_g_pow_yi i xis := letb prod1 := f_group_one in letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => @@ -59,49 +64,49 @@ Equations compute_g_pow_yi {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized Solve All Obligations with now intros ; destruct from_uint_size. Fail Next Obligation. -Equations check_commitment {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both (f_group_type)) (commitment : both (f_field_type)) : both ('bool) := +Equations check_commitment (g_pow_xi_yi_vi : both (f_group_type)) (commitment : both (f_field_type)) : both ('bool) := check_commitment g_pow_xi_yi_vi commitment := solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both ('bool). Fail Next Obligation. -Equations commit_to {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both (f_group_type)) : both (f_field_type) := +Equations commit_to (g_pow_xi_yi_vi : both (f_group_type)) : both (f_field_type) := commit_to g_pow_xi_yi_vi := solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both (f_field_type). Fail Next Obligation. -Definition t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := +Definition t_CastVoteParam : choice_type := (int32 × f_field_type × int32 × int32 × int32 × 'bool). -Equations f_cvp_i {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := +Equations f_cvp_i (s : both (t_CastVoteParam)) : both (int32) := f_cvp_i s := bind_both s (fun x => solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : int32))) : both (int32). Fail Next Obligation. -Equations f_cvp_xi {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (f_field_type) := +Equations f_cvp_xi (s : both (t_CastVoteParam)) : both (f_field_type) := f_cvp_xi s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_cvp_zkp_random_w {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := +Equations f_cvp_zkp_random_w (s : both (t_CastVoteParam)) : both (int32) := f_cvp_zkp_random_w s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst x))) : int32))) : both (int32). Fail Next Obligation. -Equations f_cvp_zkp_random_r {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := +Equations f_cvp_zkp_random_r (s : both (t_CastVoteParam)) : both (int32) := f_cvp_zkp_random_r s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst x)) : int32))) : both (int32). Fail Next Obligation. -Equations f_cvp_zkp_random_d {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := +Equations f_cvp_zkp_random_d (s : both (t_CastVoteParam)) : both (int32) := f_cvp_zkp_random_d s := bind_both s (fun x => solve_lift (ret_both (snd (fst x) : int32))) : both (int32). Fail Next Obligation. -Equations f_cvp_vote {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both ('bool) := +Equations f_cvp_vote (s : both (t_CastVoteParam)) : both ('bool) := f_cvp_vote s := bind_both s (fun x => solve_lift (ret_both (snd x : 'bool))) : both ('bool). Fail Next Obligation. -Equations Build_t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_cvp_i : both (int32)} {f_cvp_xi : both (f_field_type)} {f_cvp_zkp_random_w : both (int32)} {f_cvp_zkp_random_r : both (int32)} {f_cvp_zkp_random_d : both (int32)} {f_cvp_vote : both ('bool)} : both (t_CastVoteParam) := +Equations Build_t_CastVoteParam {f_cvp_i : both (int32)} {f_cvp_xi : both (f_field_type)} {f_cvp_zkp_random_w : both (int32)} {f_cvp_zkp_random_r : both (int32)} {f_cvp_zkp_random_d : both (int32)} {f_cvp_vote : both ('bool)} : both (t_CastVoteParam) := Build_t_CastVoteParam := bind_both f_cvp_vote (fun f_cvp_vote => bind_both f_cvp_zkp_random_d (fun f_cvp_zkp_random_d => @@ -118,64 +123,64 @@ Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_r' ':=' y ')'" Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_d' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := y) (f_cvp_vote := f_cvp_vote x)). Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := y)). -Definition t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := +Definition t_OrZKPCommit : choice_type := (f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_field_type × f_field_type × f_field_type × f_field_type × f_field_type). -Equations f_or_zkp_x {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := +Equations f_or_zkp_x (s : both (t_OrZKPCommit)) : both (f_group_type) := f_or_zkp_x s := bind_both s (fun x => solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_or_zkp_y {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := +Equations f_or_zkp_y (s : both (t_OrZKPCommit)) : both (f_group_type) := f_or_zkp_y s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_or_zkp_a1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := +Equations f_or_zkp_a1 (s : both (t_OrZKPCommit)) : both (f_group_type) := f_or_zkp_a1 s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_or_zkp_b1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := +Equations f_or_zkp_b1 (s : both (t_OrZKPCommit)) : both (f_group_type) := f_or_zkp_b1 s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_or_zkp_a2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := +Equations f_or_zkp_a2 (s : both (t_OrZKPCommit)) : both (f_group_type) := f_or_zkp_a2 s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_or_zkp_b2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := +Equations f_or_zkp_b2 (s : both (t_OrZKPCommit)) : both (f_group_type) := f_or_zkp_b2 s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_or_zkp_c {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := +Equations f_or_zkp_c (s : both (t_OrZKPCommit)) : both (f_field_type) := f_or_zkp_c s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_or_zkp_d1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := +Equations f_or_zkp_d1 (s : both (t_OrZKPCommit)) : both (f_field_type) := f_or_zkp_d1 s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst x))) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_or_zkp_d2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := +Equations f_or_zkp_d2 (s : both (t_OrZKPCommit)) : both (f_field_type) := f_or_zkp_d2 s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst x)) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_or_zkp_r1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := +Equations f_or_zkp_r1 (s : both (t_OrZKPCommit)) : both (f_field_type) := f_or_zkp_r1 s := bind_both s (fun x => solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_or_zkp_r2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := +Equations f_or_zkp_r2 (s : both (t_OrZKPCommit)) : both (f_field_type) := f_or_zkp_r2 s := bind_both s (fun x => solve_lift (ret_both (snd x : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations Build_t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_or_zkp_x : both (f_group_type)} {f_or_zkp_y : both (f_group_type)} {f_or_zkp_a1 : both (f_group_type)} {f_or_zkp_b1 : both (f_group_type)} {f_or_zkp_a2 : both (f_group_type)} {f_or_zkp_b2 : both (f_group_type)} {f_or_zkp_c : both (f_field_type)} {f_or_zkp_d1 : both (f_field_type)} {f_or_zkp_d2 : both (f_field_type)} {f_or_zkp_r1 : both (f_field_type)} {f_or_zkp_r2 : both (f_field_type)} : both (t_OrZKPCommit) := +Equations Build_t_OrZKPCommit {f_or_zkp_x : both (f_group_type)} {f_or_zkp_y : both (f_group_type)} {f_or_zkp_a1 : both (f_group_type)} {f_or_zkp_b1 : both (f_group_type)} {f_or_zkp_a2 : both (f_group_type)} {f_or_zkp_b2 : both (f_group_type)} {f_or_zkp_c : both (f_field_type)} {f_or_zkp_d1 : both (f_field_type)} {f_or_zkp_d2 : both (f_field_type)} {f_or_zkp_r1 : both (f_field_type)} {f_or_zkp_r2 : both (f_field_type)} : both (t_OrZKPCommit) := Build_t_OrZKPCommit := bind_both f_or_zkp_r2 (fun f_or_zkp_r2 => bind_both f_or_zkp_r1 (fun f_or_zkp_r1 => @@ -202,24 +207,24 @@ Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d2' ':=' y ')'" := (Buil Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := y) (f_or_zkp_r2 := f_or_zkp_r2 x)). Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := y)). -Definition t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := +Definition t_RegisterParam : choice_type := (int32 × f_field_type × int32). -Equations f_rp_i {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_RegisterParam)) : both (int32) := +Equations f_rp_i (s : both (t_RegisterParam)) : both (int32) := f_rp_i s := bind_both s (fun x => solve_lift (ret_both (fst (fst x) : int32))) : both (int32). Fail Next Obligation. -Equations f_rp_xi {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_RegisterParam)) : both (f_field_type) := +Equations f_rp_xi (s : both (t_RegisterParam)) : both (f_field_type) := f_rp_xi s := bind_both s (fun x => solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_rp_zkp_random {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_RegisterParam)) : both (int32) := +Equations f_rp_zkp_random (s : both (t_RegisterParam)) : both (int32) := f_rp_zkp_random s := bind_both s (fun x => solve_lift (ret_both (snd x : int32))) : both (int32). Fail Next Obligation. -Equations Build_t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_rp_i : both (int32)} {f_rp_xi : both (f_field_type)} {f_rp_zkp_random : both (int32)} : both (t_RegisterParam) := +Equations Build_t_RegisterParam {f_rp_i : both (int32)} {f_rp_xi : both (f_field_type)} {f_rp_zkp_random : both (int32)} : both (t_RegisterParam) := Build_t_RegisterParam := bind_both f_rp_zkp_random (fun f_rp_zkp_random => bind_both f_rp_xi (fun f_rp_xi => @@ -230,24 +235,24 @@ Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y) (f_rp_zkp_random := f_rp_zkp_random x)). Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := y)). -Definition t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := +Definition t_SchnorrZKPCommit : choice_type := (f_group_type × f_field_type × f_field_type). -Equations f_schnorr_zkp_u {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_SchnorrZKPCommit)) : both (f_group_type) := +Equations f_schnorr_zkp_u (s : both (t_SchnorrZKPCommit)) : both (f_group_type) := f_schnorr_zkp_u s := bind_both s (fun x => solve_lift (ret_both (fst (fst x) : f_group_type))) : both (f_group_type). Fail Next Obligation. -Equations f_schnorr_zkp_c {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_SchnorrZKPCommit)) : both (f_field_type) := +Equations f_schnorr_zkp_c (s : both (t_SchnorrZKPCommit)) : both (f_field_type) := f_schnorr_zkp_c s := bind_both s (fun x => solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations f_schnorr_zkp_z {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_SchnorrZKPCommit)) : both (f_field_type) := +Equations f_schnorr_zkp_z (s : both (t_SchnorrZKPCommit)) : both (f_field_type) := f_schnorr_zkp_z s := bind_both s (fun x => solve_lift (ret_both (snd x : f_field_type))) : both (f_field_type). Fail Next Obligation. -Equations Build_t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_schnorr_zkp_u : both (f_group_type)} {f_schnorr_zkp_c : both (f_field_type)} {f_schnorr_zkp_z : both (f_field_type)} : both (t_SchnorrZKPCommit) := +Equations Build_t_SchnorrZKPCommit {f_schnorr_zkp_u : both (f_group_type)} {f_schnorr_zkp_c : both (f_field_type)} {f_schnorr_zkp_z : both (f_field_type)} : both (t_SchnorrZKPCommit) := Build_t_SchnorrZKPCommit := bind_both f_schnorr_zkp_z (fun f_schnorr_zkp_z => bind_both f_schnorr_zkp_c (fun f_schnorr_zkp_c => @@ -265,7 +270,7 @@ Equations Build_t_TallyParameter : both (t_TallyParameter) := solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (t_TallyParameter). Fail Next Obligation. -Equations schnorr_zkp {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both (int32)) (h : both (f_group_type)) (x : both (f_field_type)) : both (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := +Equations schnorr_zkp (random : both (int32)) (h : both (f_group_type)) (x : both (f_field_type)) : both (t_SchnorrZKPCommit) := schnorr_zkp random h x := solve_lift (run (letb r := f_random_field_elem random in letb u := f_g_pow r in @@ -273,18 +278,18 @@ Equations schnorr_zkp {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ h; u])))) in letb z := f_add r (f_mul c x) in - letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in - ControlFlow_Continue (never_to_any hoist1))) : both (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). + letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit)] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in + ControlFlow_Continue (never_to_any hoist1))) : both (t_SchnorrZKPCommit). Fail Next Obligation. -Equations schnorr_zkp_validate {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both (f_group_type)) (pi : both (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both ('bool) := +Equations schnorr_zkp_validate (h : both (f_group_type)) (pi : both (t_SchnorrZKPCommit)) : both ('bool) := schnorr_zkp_validate h pi := solve_lift (andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g; h; f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both ('bool). Fail Next Obligation. -Equations zkp_one_out_of_two {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both (int32)) (random_r : both (int32)) (random_d : both (int32)) (h : both (f_group_type)) (xi : both (f_field_type)) (vi : both ('bool)) : both (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) := +Equations zkp_one_out_of_two (random_w : both (int32)) (random_r : both (int32)) (random_d : both (int32)) (h : both (f_group_type)) (xi : both (f_field_type)) (vi : both ('bool)) : both (t_OrZKPCommit) := zkp_one_out_of_two random_w random_r random_d h xi vi := letb w := f_random_field_elem random_w in solve_lift (ifb vi @@ -321,10 +326,10 @@ Equations zkp_one_out_of_two {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v b2])))) in letb d1 := f_sub c d2 in letb r1 := f_sub w (f_mul xi d1) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)). + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (t_OrZKPCommit). Fail Next Obligation. -Equations zkp_one_out_of_two_validate {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both (f_group_type)) (zkp : both (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both ('bool) := +Equations zkp_one_out_of_two_validate (h : both (f_group_type)) (zkp : both (t_OrZKPCommit)) : both ('bool) := zkp_one_out_of_two_validate h zkp := letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; f_or_zkp_y zkp; @@ -335,39 +340,39 @@ Equations zkp_one_out_of_two_validate {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t solve_lift (andb (andb (andb (andb (c =.? (f_add (f_or_zkp_d1 zkp) (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? (f_prod (f_pow h (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r2 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? (f_prod (f_pow h (f_or_zkp_r2 zkp)) (f_pow (f_div (f_or_zkp_y zkp) (f_g)) (f_or_zkp_d2 zkp))))) : both ('bool). Fail Next Obligation. -Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := - (nseq f_group_type (is_pure (n)) × nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × nseq f_field_type (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × int32). -Equations f_g_pow_xis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq f_group_type (is_pure (n))) := +Definition t_OvnContractState : choice_type := + (nseq f_group_type (is_pure (n)) × nseq (t_SchnorrZKPCommit) (is_pure (n)) × nseq f_field_type (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq (t_OrZKPCommit) (is_pure (n)) × int32). +Equations f_g_pow_xis (s : both (t_OvnContractState)) : both (nseq f_group_type (is_pure (n))) := f_g_pow_xis s := bind_both s (fun x => solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type (is_pure (n))))) : both (nseq f_group_type (is_pure (n))). Fail Next Obligation. -Equations f_zkp_xis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := +Equations f_zkp_xis (s : both (t_OvnContractState)) : both (nseq (t_SchnorrZKPCommit) (is_pure (n))) := f_zkp_xis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq (t_SchnorrZKPCommit) (is_pure (n))))) : both (nseq (t_SchnorrZKPCommit) (is_pure (n))). Fail Next Obligation. -Equations f_commit_vis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq f_field_type (is_pure (n))) := +Equations f_commit_vis (s : both (t_OvnContractState)) : both (nseq f_field_type (is_pure (n))) := f_commit_vis s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst (fst x))) : nseq f_field_type (is_pure (n))))) : both (nseq f_field_type (is_pure (n))). Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq f_group_type (is_pure (n))) := +Equations f_g_pow_xi_yi_vis (s : both (t_OvnContractState)) : both (nseq f_group_type (is_pure (n))) := f_g_pow_xi_yi_vis s := bind_both s (fun x => solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type (is_pure (n))))) : both (nseq f_group_type (is_pure (n))). Fail Next Obligation. -Equations f_zkp_vis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := +Equations f_zkp_vis (s : both (t_OvnContractState)) : both (nseq (t_OrZKPCommit) (is_pure (n))) := f_zkp_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). + solve_lift (ret_both (snd (fst x) : nseq (t_OrZKPCommit) (is_pure (n))))) : both (nseq (t_OrZKPCommit) (is_pure (n))). Fail Next Obligation. -Equations f_tally {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (int32) := +Equations f_tally (s : both (t_OvnContractState)) : both (int32) := f_tally s := bind_both s (fun x => solve_lift (ret_both (snd x : int32))) : both (int32). Fail Next Obligation. -Equations Build_t_OvnContractState {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_g_pow_xis : both (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_commit_vis : both (nseq f_field_type (is_pure (n)))} {f_g_pow_xi_yi_vis : both (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_tally : both (int32)} : both (t_OvnContractState (n := n)) := +Equations Build_t_OvnContractState {f_g_pow_xis : both (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both (nseq (t_SchnorrZKPCommit) (is_pure (n)))} {f_commit_vis : both (nseq f_field_type (is_pure (n)))} {f_g_pow_xi_yi_vis : both (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both (nseq (t_OrZKPCommit) (is_pure (n)))} {f_tally : both (int32)} : both (t_OvnContractState) := Build_t_OvnContractState := bind_both f_tally (fun f_tally => bind_both f_zkp_vis (fun f_zkp_vis => @@ -384,16 +389,16 @@ Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ') Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). -Equations cast_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := +Equations cast_vote {impl_574521470_ : _} `{ t_Sized (impl_574521470_)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState)) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := cast_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with | Result_Ok_case x => letb x := ret_both ((x) : _ (* (t_CastVoteParam (v_Z)) *)) in ControlFlow_Continue (solve_lift x) | Result_Err_case x => letb x := ret_both ((x) : (t_ParseError)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist2 := v_Break (Result_Err (ret_both tt)) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist2 := v_Break (Result_Err (ret_both tt)) in ControlFlow_Continue (solve_lift (never_to_any hoist2)) end in ControlFlow_Continue (letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in @@ -402,51 +407,51 @@ Equations cast_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_5 letb cast_vote_state_ret := f_clone state in letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. -Equations commit_to_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := +Equations commit_to_vote {impl_574521470_ : _} `{ t_Sized (impl_574521470_)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState)) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := commit_to_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with | Result_Ok_case x => letb x := ret_both ((x) : _ (* (t_CastVoteParam (v_Z)) *)) in ControlFlow_Continue (solve_lift x) | Result_Err_case x => letb x := ret_both ((x) : (t_ParseError)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist3 := v_Break (Result_Err (ret_both tt)) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist3 := v_Break (Result_Err (ret_both tt)) in ControlFlow_Continue (solve_lift (never_to_any hoist3)) end in ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => solve_lift (ifb negb (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist4 := v_Break (Result_Err (ret_both tt)) in + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist4 := v_Break (Result_Err (ret_both tt)) in ControlFlow_Continue (never_to_any hoist4) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in + else ControlFlow_Continue (ret_both (tt : 'unit))) : both _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in letb commit_vi := commit_to g_pow_xi_yi_vi in letb commit_to_vote_state_ret := f_clone state in letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),commit_to_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),commit_to_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). Solve All Obligations with now intros ; destruct from_uint_size. Fail Next Obligation. -Equations init_ovn_contract {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both ('unit)) : both (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)) := +Equations init_ovn_contract (_ : both ('unit)) : both (t_Result (t_OvnContractState) (t_Reject)) := init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one) (f_schnorr_zkp_z := f_field_zero) (f_schnorr_zkp_c := f_field_zero)) n) (f_commit_vis := repeat (f_field_zero) n) (f_g_pow_xi_yi_vis := repeat (f_group_one) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one) (f_or_zkp_y := f_group_one) (f_or_zkp_a1 := f_group_one) (f_or_zkp_b1 := f_group_one ) (f_or_zkp_a2 := f_group_one ) (f_or_zkp_b2 := f_group_one ) (f_or_zkp_c := f_field_zero ) (f_or_zkp_d1 := f_field_zero ) (f_or_zkp_d2 := f_field_zero ) (f_or_zkp_r1 := f_field_zero ) (f_or_zkp_r2 := f_field_zero )) n) (f_tally := ret_both (0 : int32)))) : both (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)). + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one) (f_schnorr_zkp_z := f_field_zero) (f_schnorr_zkp_c := f_field_zero)) n) (f_commit_vis := repeat (f_field_zero) n) (f_g_pow_xi_yi_vis := repeat (f_group_one) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one) (f_or_zkp_y := f_group_one) (f_or_zkp_a1 := f_group_one) (f_or_zkp_b1 := f_group_one ) (f_or_zkp_a2 := f_group_one ) (f_or_zkp_b2 := f_group_one ) (f_or_zkp_c := f_field_zero ) (f_or_zkp_d1 := f_field_zero ) (f_or_zkp_d2 := f_field_zero ) (f_or_zkp_r1 := f_field_zero ) (f_or_zkp_r2 := f_field_zero )) n) (f_tally := ret_both (0 : int32)))) : both (t_Result (t_OvnContractState) (t_Reject)). Fail Next Obligation. -Equations register_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := +Equations register_vote {impl_574521470_ : _} `{ t_Sized (impl_574521470_)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState)) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := register_vote ctx state := solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_RegisterParam (v_Z)) := matchb out with + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params : t_RegisterParam (v_Z)) := matchb out with | Result_Ok_case x => letb x := ret_both ((x) : _ (* (t_RegisterParam (v_Z)) *)) in ControlFlow_Continue (solve_lift x) | Result_Err_case x => letb x := ret_both ((x) : (t_ParseError)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist5 := v_Break (Result_Err (ret_both tt)) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist5 := v_Break (Result_Err (ret_both tt)) in ControlFlow_Continue (solve_lift (never_to_any hoist5)) end in ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in @@ -454,22 +459,22 @@ Equations register_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {im letb register_vote_state_ret := f_clone state in letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),register_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),register_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. -Equations tally_votes {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := +Equations tally_votes {impl_574521470_ : _} `{ t_Sized (impl_574521470_)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both (impl_574521470_)) (state : both (t_OvnContractState)) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := tally_votes _ state := letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] _ := ControlFlow_Continue (ifb negb (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist6 := v_Break (Result_Err (ret_both tt)) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] _ := ControlFlow_Continue (ifb negb (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist6 := v_Break (Result_Err (ret_both tt)) in ControlFlow_Continue (never_to_any hoist6) else ControlFlow_Continue (ret_both (tt : 'unit))) in solve_lift (ifb negb (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist7 := v_Break (Result_Err (ret_both tt)) in + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist7 := v_Break (Result_Err (ret_both tt)) in ControlFlow_Continue (never_to_any hoist7) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in + else ControlFlow_Continue (ret_both (tt : 'unit))) : both _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in letb vote_result := f_group_one in letb vote_result := foldi_both_list ((* f_into_iter *) (array_to_list (f_g_pow_xi_yi_vis state))) (fun g_pow_vote => ssp (fun vote_result => @@ -486,7 +491,7 @@ Equations tally_votes {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl solve_lift (prod_b (curr,tally)) : both ((f_field_type × int32)))) (prod_b (curr,tally)) in letb tally_votes_state_ret := f_clone state in letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in - Result_Ok (solve_lift (prod_b (f_accept (* (ret_both (tt : 'unit)) *),tally_votes_state_ret))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). + Result_Ok (solve_lift (prod_b (f_accept (* (ret_both (tt : 'unit)) *),tally_votes_state_ret))) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). Solve All Obligations with now intros ; destruct from_uint_size. Fail Next Obligation. @@ -506,41 +511,41 @@ Export Serializable. From Hacspec Require Import ConCertLib. Export ConCertLib. -Definition state_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := - t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n). +Definition state_OVN : choice_type := + t_OvnContractState. -#[global] Program Instance t_CastVoteParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_HasReceiveContext t_CastVoteParam 'unit := +#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. Fail Next Obligation. -#[global] Program Instance t_CastVoteParam_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_Sized t_CastVoteParam := +#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := fun x => x. Fail Next Obligation. -Definition receive_OVN_cast_vote {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {v_A : _} `{ t_Sized (v_A)} `{ t_HasActions (v_A)} (ctx : both (t_CastVoteParam (v_Z := v_Z))) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := - cast_vote (v_Z := v_Z) (v_G := v_G) (n := n) (v_A := v_A) (H2 := t_CastVoteParam_t_Sized (v_Z := v_Z) (v_G := v_G) (n := n)) (H7 := t_CastVoteParam_t_HasReceiveContext (v_Z := v_Z) (v_G := v_G) (n := n)) ctx st. +Definition receive_OVN_cast_vote (ctx : both (t_CastVoteParam)) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := + cast_vote ctx st. -(* #[global] Program Instance t_CastVoteParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_HasReceiveContext t_CastVoteParam 'unit := *) +(* #[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := *) (* {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. *) (* Fail Next Obligation. *) (* #[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := *) (* fun x => *) (* x. *) (* Fail Next Obligation. *) -Definition receive_OVN_commit_to_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both (t_CastVoteParam)) (st : both (state_OVN (n := n))) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := - commit_to_vote (H2 := t_CastVoteParam_t_Sized (n := n)) (H7 := t_CastVoteParam_t_HasReceiveContext (n := n)) ctx st. +Definition receive_OVN_commit_to_vote (ctx : both (t_CastVoteParam)) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := + commit_to_vote ctx st. -Definition init_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN (n := n)) (t_ParseError) := +Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN) (t_ParseError) := ResultMonad.Ok st. -#[global] Program Instance t_RegisterParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_HasReceiveContext t_RegisterParam 'unit := +#[global] Program Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit := {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. Fail Next Obligation. -#[global] Program Instance t_RegisterParam_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_Sized t_RegisterParam := +#[global] Program Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam := fun x => x. Fail Next Obligation. -Definition receive_OVN_register {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both (t_RegisterParam)) (st : both (state_OVN (n := n))) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := - register_vote (H2 := t_RegisterParam_t_Sized (n := n)) (H7 := t_RegisterParam_t_HasReceiveContext (n := n)) ctx st. +Definition receive_OVN_register (ctx : both (t_RegisterParam)) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := + register_vote ctx st. #[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. @@ -549,24 +554,24 @@ Fail Next Obligation. fun x => x. Fail Next Obligation. -Definition receive_OVN_tally {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both (t_TallyParameter)) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN (n := n))) (t_ParseError)) := +Definition receive_OVN_tally (ctx : both (t_TallyParameter)) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := tally_votes ctx st. -Inductive Msg_OVN {v_Z : _} `{ t_Sized (v_Z)} `{ temp : t_Z_Field (v_Z)} : Type := -| msg_OVN_cast_vote : t_CastVoteParam (v_Z := v_Z) (H0 := temp) -> Msg_OVN -| msg_OVN_commit_to_vote : t_CastVoteParam (v_Z := v_Z) (H0 := temp) -> Msg_OVN -| msg_OVN_register : t_RegisterParam (v_Z := v_Z) -> Msg_OVN +Inductive Msg_OVN : Type := +| msg_OVN_cast_vote : t_CastVoteParam -> Msg_OVN +| msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN +| msg_OVN_register : t_RegisterParam -> Msg_OVN | msg_OVN_tally : t_TallyParameter -> Msg_OVN. -#[global] Program Instance state_OVN_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_HasReceiveContext (state_OVN (n := n)) 'unit := +#[global] Program Instance state_OVN_t_HasReceiveContext : t_HasReceiveContext (state_OVN) 'unit := {| f_get := (fun (Ctx : _) => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. Fail Next Obligation. -#[global] Program Instance state_OVN_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : t_Sized (state_OVN (n := n)) := +#[global] Program Instance state_OVN_t_Sized : t_Sized (state_OVN) := fun x => x. Fail Next Obligation. -#[global] Program Instance state_OVN_t_HasActions {v_Z : _} {v_G : _} {n : both (uint_size)}`{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : t_HasActions (state_OVN (v_Z := v_Z) (n := n)). +#[global] Program Instance state_OVN_t_HasActions : t_HasActions (state_OVN). Next Obligation. - pose (init_ovn_contract_equation_1 v_Z v_G n H H0 H1 _ H2 (ret_both tt)). + pose (init_ovn_contract_equation_1 (ret_both tt)). set (solve_lift _) in e. apply b. Defined. @@ -574,47 +579,43 @@ Fail Next Obligation. Obligation Tactic := intros. (* *) -Equations receive_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ temp1 : t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (chain : Chain) (ctx : ContractCallContext) (st : state_OVN (v_Z := v_Z) (n := n)) (msg : Datatypes.option (Msg_OVN (v_Z := v_Z))) : ResultMonad.result (state_OVN (v_Z := v_Z) (n := n) * list ActionBody) t_ParseError := +Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) (msg : Datatypes.option (Msg_OVN)) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := receive_OVN chain ctx st msg := match msg with | Some (msg_OVN_cast_vote val) => - match is_pure (both_prog (@receive_OVN_cast_vote v_Z v_G n _ _ _ _ _ v_A _ _ (ret_both val) (ret_both st))) with + match is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (ret_both st))) with | inl x => ResultMonad.Ok ((snd x), []) | inr x => ResultMonad.Err x end | Some (msg_OVN_commit_to_vote val) => - match is_pure (both_prog (@receive_OVN_commit_to_vote v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st))) with + match is_pure (both_prog (receive_OVN_commit_to_vote (ret_both val) (ret_both st))) with | inl x => ResultMonad.Ok ((snd x), []) | inr x => ResultMonad.Err x end | Some (msg_OVN_register val) => - match is_pure (both_prog (@receive_OVN_register v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st))) with + match is_pure (both_prog (receive_OVN_register (ret_both val) (ret_both st))) with | inl x => ResultMonad.Ok ((snd x), []) | inr x => ResultMonad.Err x end | Some (msg_OVN_tally val) => - match (is_pure (both_prog (@receive_OVN_tally v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st)))) with + match (is_pure (both_prog (receive_OVN_tally (ret_both val) (ret_both st)))) with | inl x => ResultMonad.Ok ((snd x), []) | inr x => ResultMonad.Err x end | _ => ResultMonad.Err tt - end : ResultMonad.result (state_OVN (v_Z := v_Z) (n := n) * list ActionBody) t_ParseError. + end : ResultMonad.result (state_OVN * list ActionBody) t_ParseError. Fail Next Obligation. -#[global] Program Instance state_OVN_Serializable {v_Z : _} {v_G : _} {n : both (uint_size)} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : Serializable (state_OVN (v_Z := v_Z) (n := n)) := - _. -Next Obligation. - serialize_enum. - 1-4: refine nseq_serializable ; serialize_enum. - 7: refine nseq_serializable ; serialize_enum. - all: try refine f_group_type_Serializable. - all: try refine f_field_type_Serializable. - exact hacspec_int_serializable. -Qed. -Fail Next Obligation. -#[global] Program Instance Msg_OVN_Serializable {v_Z : _} `{ temp0 : t_Sized (v_Z)} `{ temp1 : t_Z_Field (v_Z)} : Serializable (@Msg_OVN v_Z temp0 temp1). - (* Derive Serializable (@Msg_OVN_rect v_Z temp0 temp1) < (msg_OVN_cast_vote (v_Z := v_Z) (H := temp0) (temp := temp1)) , (msg_OVN_commit_to_vote (v_Z := v_Z) (H := temp0) (temp := temp1)), (msg_OVN_register (v_Z := v_Z) (H := temp0) (temp := temp1)),(msg_OVN_tally (v_Z := v_Z) (H := temp0) (temp := temp1)) >. *) +#[global] Program Instance state_OVN_Serializable : Serializable (state_OVN) := + ltac:(serialize_enum ; repeat (refine nseq_serializable ; serialize_enum) + ; try refine f_group_type_Serializable + ; try refine f_field_type_Serializable + ; exact hacspec_int_serializable). +Fail Next Obligation. +#[global] Program Instance Msg_OVN_Serializable : Serializable Msg_OVN := _. + (* Derive Serializable Msg_OVN_rect < msg_OVN_cast_vote , msg_OVN_commit_to_vote, msg_OVN_register,msg_OVN_tally >. *) Admit Obligations. Fail Next Obligation. -Definition contract_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ temp1 : t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ temp2 : t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : @Contract _ (@state_OVN v_Z v_G n temp1 _ _ _ _) (@Msg_OVN v_Z temp1 H1 ) (state_OVN (v_Z := v_Z) (n := n)) (t_ParseError) state_OVN_Serializable Msg_OVN_Serializable state_OVN_Serializable _ := build_contract init_OVN receive_OVN. +Definition contract_OVN : @Contract _ (state_OVN) (Msg_OVN) (state_OVN) (t_ParseError) state_OVN_Serializable Msg_OVN_Serializable state_OVN_Serializable _ := + build_contract init_OVN receive_OVN. From 4feb726a0b25d90f12af31010225cea5afe3f7e8 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 5 Mar 2024 14:26:10 +0100 Subject: [PATCH 69/86] No more admits --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 30 +++++++++++++++------ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 9c3782e..afa842c 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -606,15 +606,29 @@ Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OV ResultMonad.Err tt end : ResultMonad.result (state_OVN * list ActionBody) t_ParseError. Fail Next Obligation. + +Ltac make_hacspec_serializable := + (serialize_enum ; repeat (refine nseq_serializable ; serialize_enum) + ; try ( exact f_group_type_Serializable + || exact f_field_type_Serializable + || exact hacspec_int_serializable + || exact bool_serializable + || exact unit_serializable)). + #[global] Program Instance state_OVN_Serializable : Serializable (state_OVN) := - ltac:(serialize_enum ; repeat (refine nseq_serializable ; serialize_enum) - ; try refine f_group_type_Serializable - ; try refine f_field_type_Serializable - ; exact hacspec_int_serializable). -Fail Next Obligation. -#[global] Program Instance Msg_OVN_Serializable : Serializable Msg_OVN := _. - (* Derive Serializable Msg_OVN_rect < msg_OVN_cast_vote , msg_OVN_commit_to_vote, msg_OVN_register,msg_OVN_tally >. *) -Admit Obligations. + ltac:(make_hacspec_serializable). +Fail Next Obligation. + +#[global] Program Instance t_RegisterParam_Serializable : Serializable t_RegisterParam := + ltac:(make_hacspec_serializable). +Fail Next Obligation. + +#[global] Program Instance t_CastVoteParam_Serializable : Serializable t_TallyParameter := + ltac:(make_hacspec_serializable). +Fail Next Obligation. + +#[global] Program Instance Msg_OVN_Serializable : Serializable Msg_OVN := + Derive Serializable Msg_OVN_rect < msg_OVN_cast_vote , msg_OVN_commit_to_vote, msg_OVN_register,msg_OVN_tally >. Fail Next Obligation. Definition contract_OVN : @Contract _ (state_OVN) (Msg_OVN) (state_OVN) (t_ParseError) state_OVN_Serializable Msg_OVN_Serializable state_OVN_Serializable _ := From 96673f8ac537ed6611133e7a8b6555d9d57836a0 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 12 Mar 2024 12:21:31 +0100 Subject: [PATCH 70/86] Update ovn --- ovn/Cargo.toml | 2 +- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 12 +- .../extraction/Hacspec_ovn_Ovn_z_89_.v | 140 ++++ .../extraction/Hacspec_ovn_group_no_mem.v | 608 ++++++++++++++++++ ovn/src/ovn_group.rs | 18 +- ovn/src/ovn_z_89.rs | 110 ++++ ovn/tests/ovn_example.rs | 168 ++--- 7 files changed, 951 insertions(+), 107 deletions(-) create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_z_89_.v create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_group_no_mem.v create mode 100644 ovn/src/ovn_z_89.rs diff --git a/ovn/Cargo.toml b/ovn/Cargo.toml index 75bcc08..d2fa741 100644 --- a/ovn/Cargo.toml +++ b/ovn/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Lasse Letager Hanse "] edition = "2018" [lib] -path = "src/ovn_group.rs" +path = "src/ovn_no_group.rs" [dependencies] hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index afa842c..8fe102e 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -407,7 +407,7 @@ Equations cast_vote {impl_574521470_ : _} `{ t_Sized (impl_574521470_)} `{ t_Ha letb cast_vote_state_ret := f_clone state in letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). + Result_Ok (prod_b (f_accept,cast_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. Equations commit_to_vote {impl_574521470_ : _} `{ t_Sized (impl_574521470_)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState)) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := @@ -433,7 +433,7 @@ Equations commit_to_vote {impl_574521470_ : _} `{ t_Sized (impl_574521470_)} `{ letb commit_vi := commit_to g_pow_xi_yi_vi in letb commit_to_vote_state_ret := f_clone state in letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),commit_to_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). + Result_Ok (prod_b (f_accept,commit_to_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). Solve All Obligations with now intros ; destruct from_uint_size. Fail Next Obligation. @@ -459,7 +459,7 @@ Equations register_vote {impl_574521470_ : _} `{ t_Sized (impl_574521470_)} `{ t letb register_vote_state_ret := f_clone state in letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),register_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). + Result_Ok (prod_b (f_accept,register_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). Fail Next Obligation. Equations tally_votes {impl_574521470_ : _} `{ t_Sized (impl_574521470_)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both (impl_574521470_)) (state : both (t_OvnContractState)) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := @@ -491,7 +491,7 @@ Equations tally_votes {impl_574521470_ : _} `{ t_Sized (impl_574521470_)} `{ t_H solve_lift (prod_b (curr,tally)) : both ((f_field_type × int32)))) (prod_b (curr,tally)) in letb tally_votes_state_ret := f_clone state in letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in - Result_Ok (solve_lift (prod_b (f_accept (* (ret_both (tt : 'unit)) *),tally_votes_state_ret))) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). + Result_Ok (solve_lift (prod_b (f_accept,tally_votes_state_ret))) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). Solve All Obligations with now intros ; destruct from_uint_size. Fail Next Obligation. @@ -576,9 +576,7 @@ Next Obligation. apply b. Defined. Fail Next Obligation. -Obligation Tactic := intros. -(* *) Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) (msg : Datatypes.option (Msg_OVN)) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := receive_OVN chain ctx st msg := match msg with @@ -609,7 +607,7 @@ Fail Next Obligation. Ltac make_hacspec_serializable := (serialize_enum ; repeat (refine nseq_serializable ; serialize_enum) - ; try ( exact f_group_type_Serializable + ; try ( exact f_group_type_Serializable || exact f_field_type_Serializable || exact hacspec_int_serializable || exact bool_serializable diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_z_89_.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_z_89_.v new file mode 100644 index 0000000..fdb6d8d --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_z_89_.v @@ -0,0 +1,140 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_ovn_Ovn_traits. +Export Hacspec_ovn_Ovn_traits. + +Definition t_g_z_89_ : choice_type := + 'unit. +Equations Build_t_g_z_89_ : both (fset []) (fset []) (t_g_z_89_) := + Build_t_g_z_89_ := + solve_lift (ret_both (tt (* Empty tuple *) : (t_g_z_89_))) : both (fset []) (fset []) (t_g_z_89_). +Fail Next Obligation. + +Definition t_z_89_ : choice_type := + 'unit. +Equations Build_t_z_89_ : both (fset []) (fset []) (t_z_89_) := + Build_t_z_89_ := + solve_lift (ret_both (tt (* Empty tuple *) : (t_z_89_))) : both (fset []) (fset []) (t_z_89_). +Fail Next Obligation. + +#[global] Program Instance t_z_89__t_Z_Field : t_Z_Field t_z_89_ := _. +Next Obligation. + refine ( + let f_field_type := int32 : choice_type in + let f_q := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (89 : int32)) : both (L :|: fset []) I int32 in + let f_random_field_elem := fun {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 int32) => solve_lift (random .% ((f_q ) .- (ret_both (1 : int32)))) : both (L1 :|: fset []) I1 int32 in + let f_field_zero := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (0 : int32)) : both (L :|: fset []) I int32 in + let f_field_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I int32 in + let f_add := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 int32) (y : both L2 I2 int32) => solve_lift ((x .+ y) .% ((f_q ) .- (ret_both (1 : int32)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) int32 in + let f_sub := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 int32) (y : both L2 I2 int32) => solve_lift (((x .+ ((f_q ) .- (ret_both (1 : int32)))) .- y) .% ((f_q ) .- (ret_both (1 : int32)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) int32 in + let f_mul := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 int32) (y : both L2 I2 int32) => solve_lift ((x .* y) .% ((f_q ) .- (ret_both (1 : int32)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) int32 in + {| f_field_type := (@f_field_type); + f_q_loc := (fset [] : {fset Location}); + f_q := (@f_q); + f_random_field_elem_loc := (fset [] : {fset Location}); + f_random_field_elem := (@f_random_field_elem); + f_field_zero_loc := (fset [] : {fset Location}); + f_field_zero := (@f_field_zero); + f_field_one_loc := (fset [] : {fset Location}); + f_field_one := (@f_field_one); + f_add_loc := (fset [] : {fset Location}); + f_add := (@f_add); + f_sub_loc := (fset [] : {fset Location}); + f_sub := (@f_sub); + f_mul_loc := (fset [] : {fset Location}); + f_mul := (@f_mul)|} + ). + easy. + easy. + easy. + easy. + easy. + exact int_eqdec. + easy. + easy. + Unshelve. + all: try normalize_fset. + all: try solve_single_fset_fsubset. + + unfold f_parameter_cursor_loc. + +Next Obligation. + unfold t_z_89__t_Z_Field_obligation_4. +Fail Next Obligation. +Hint Unfold t_z_89__t_Z_Field. + +Definition res_loc : Location := + (int32;0%nat). +Definition result_loc : Location := + (int32;1%nat). +#[global] Program Instance t_g_z_89__t_Group : t_Group t_g_z_89_ t_z_89_ := + let f_group_type := int32 : choice_type in + let f_g := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (3 : int32)) : both (L :|: fset []) I int32 in + let f_hash := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Vec int32 t_Global)) => letb res loc(res_loc) := f_field_one (ret_both (tt : 'unit)) in + letb _ := foldi_both_list (f_into_iter x) (fun y => + ssp (fun _ => + assign todo(term) : (both (*1*)(L1:|:fset [res_loc]) (I1) 'unit))) (ret_both (tt : 'unit)) in + solve_lift res : both (L1 :|: fset [res_loc]) I1 int32 in + let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 int32) => solve_lift (f_pow (f_g (ret_both (tt : 'unit))) x) : both (L1 :|: fset []) I1 int32 in + let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 int32) (x : both L2 I2 int32) => letb result loc(result_loc) := f_group_one (ret_both (tt : 'unit)) in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := x .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))))) (fun i => + ssp (fun _ => + assign todo(term) : (both (*1*)(L1:|:L2:|:fset [result_loc]) (I1:|:I2) 'unit))) (ret_both (tt : 'unit)) in + solve_lift result : both (L1 :|: L2 :|: fset [result_loc]) (I1 :|: I2) int32 in + let f_group_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I int32 in + let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 int32) (y : both L2 I2 int32) => solve_lift (((x .% (f_q (ret_both (tt : 'unit)))) .* (y .% (f_q (ret_both (tt : 'unit))))) .% (f_q (ret_both (tt : 'unit)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) int32 in + let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 int32) => solve_lift (run (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := ret_both (89 : int32)))) (fun j => + ssp (fun _ => + solve_lift (ifb (f_prod x j) =.? (f_group_one (ret_both (tt : 'unit))) + then letm[choice_typeMonad.result_bind_code int32] hoist1 := v_Break j in + ControlFlow_Continue (never_to_any hoist1) + else ()) : (both (*0*)(L1:|:fset []) (I1) (t_ControlFlow int32 'unit)))) (ret_both (tt : 'unit)) in + letb _ := ifb not (ret_both (false : 'bool)) + then never_to_any (panic (ret_both (assertion failed: false : chString))) + else () in + letm[choice_typeMonad.result_bind_code int32] hoist2 := v_Break x in + ControlFlow_Continue (never_to_any hoist2))) : both (L1 :|: fset []) I1 int32 in + let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 int32) (y : both L2 I2 int32) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) int32 in + {| f_group_type := (@f_group_type); + f_g_loc := (fset [] : {fset Location}); + f_g := (@f_g); + f_hash_loc := (fset [res_loc] : {fset Location}); + f_hash := (@f_hash); + f_g_pow_loc := (fset [] : {fset Location}); + f_g_pow := (@f_g_pow); + f_pow_loc := (fset [result_loc] : {fset Location}); + f_pow := (@f_pow); + f_group_one_loc := (fset [] : {fset Location}); + f_group_one := (@f_group_one); + f_prod_loc := (fset [] : {fset Location}); + f_prod := (@f_prod); + f_inv_loc := (fset [] : {fset Location}); + f_inv := (@f_inv); + f_div_loc := (fset [] : {fset Location}); + f_div := (@f_div)|}. +Fail Next Obligation. +Hint Unfold t_g_z_89__t_Group. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_no_mem.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_no_mem.v new file mode 100644 index 0000000..023ce1b --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_no_mem.v @@ -0,0 +1,608 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_ovn_Ovn_traits. +Export Hacspec_ovn_Ovn_traits. + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +Equations compute_group_element_for_vote {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (xi : both (f_field_type)) (vote : both ('bool)) (g_pow_yi : both (f_group_type)) : both (f_group_type) := + compute_group_element_for_vote xi vote g_pow_yi := + solve_lift (f_prod (f_pow g_pow_yi xi) (f_g_pow (ifb vote + then f_field_one (ret_both (tt : 'unit)) + else f_field_zero (ret_both (tt : 'unit))))) : both (f_group_type). +Fail Next Obligation. + +Equations select_private_voting_key {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (random : both (int32)) : both (f_field_type) := + select_private_voting_key random := + solve_lift (f_random_field_elem random) : both (f_field_type). +Fail Next Obligation. + +Equations compute_g_pow_yi {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both (uint_size)) (xis : both (nseq f_group_type (is_pure (n)))) : both (f_group_type) := + compute_g_pow_yi i xis := + letb prod1 := f_group_one (ret_both (tt : 'unit)) in + letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => + ssp (fun prod1 => + solve_lift (f_prod prod1 (xis.a[j])) : both (f_group_type))) prod1 in + letb prod2 := f_group_one (ret_both (tt : 'unit)) in + letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => + ssp (fun prod2 => + solve_lift (f_prod prod2 (xis.a[j])) : both (f_group_type))) prod2 in + solve_lift (f_div prod1 prod2) : both (f_group_type). +Solve All Obligations with now intros ; destruct from_uint_size. +Fail Next Obligation. + +Equations check_commitment {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both (f_group_type)) (commitment : both (f_field_type)) : both ('bool) := + check_commitment g_pow_xi_yi_vi commitment := + solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both ('bool). +Fail Next Obligation. + +Equations commit_to {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both (f_group_type)) : both (f_field_type) := + commit_to g_pow_xi_yi_vi := + solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both (f_field_type). +Fail Next Obligation. + +Definition t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := + (int32 × f_field_type × int32 × int32 × int32 × 'bool). +Equations f_cvp_i {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := + f_cvp_i s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : int32))) : both (int32). +Fail Next Obligation. +Equations f_cvp_xi {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (f_field_type) := + f_cvp_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both (f_field_type). +Fail Next Obligation. +Equations f_cvp_zkp_random_w {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := + f_cvp_zkp_random_w s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : int32))) : both (int32). +Fail Next Obligation. +Equations f_cvp_zkp_random_r {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := + f_cvp_zkp_random_r s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : int32))) : both (int32). +Fail Next Obligation. +Equations f_cvp_zkp_random_d {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := + f_cvp_zkp_random_d s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : int32))) : both (int32). +Fail Next Obligation. +Equations f_cvp_vote {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both ('bool) := + f_cvp_vote s := + bind_both s (fun x => + solve_lift (ret_both (snd x : 'bool))) : both ('bool). +Fail Next Obligation. +Equations Build_t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_cvp_i : both (int32)} {f_cvp_xi : both (f_field_type)} {f_cvp_zkp_random_w : both (int32)} {f_cvp_zkp_random_r : both (int32)} {f_cvp_zkp_random_d : both (int32)} {f_cvp_vote : both ('bool)} : both (t_CastVoteParam) := + Build_t_CastVoteParam := + bind_both f_cvp_vote (fun f_cvp_vote => + bind_both f_cvp_zkp_random_d (fun f_cvp_zkp_random_d => + bind_both f_cvp_zkp_random_r (fun f_cvp_zkp_random_r => + bind_both f_cvp_zkp_random_w (fun f_cvp_zkp_random_w => + bind_both f_cvp_xi (fun f_cvp_xi => + bind_both f_cvp_i (fun f_cvp_i => + solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam))))))))) : both (t_CastVoteParam). +Fail Next Obligation. +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_w' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := y) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_r' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := y) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_d' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := y) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := y)). + +Definition t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := + (f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_field_type × f_field_type × f_field_type × f_field_type × f_field_type). +Equations f_or_zkp_x {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := + f_or_zkp_x s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both (f_group_type). +Fail Next Obligation. +Equations f_or_zkp_y {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := + f_or_zkp_y s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both (f_group_type). +Fail Next Obligation. +Equations f_or_zkp_a1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := + f_or_zkp_a1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : f_group_type))) : both (f_group_type). +Fail Next Obligation. +Equations f_or_zkp_b1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := + f_or_zkp_b1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : f_group_type))) : both (f_group_type). +Fail Next Obligation. +Equations f_or_zkp_a2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := + f_or_zkp_a2 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : f_group_type))) : both (f_group_type). +Fail Next Obligation. +Equations f_or_zkp_b2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := + f_or_zkp_b2 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : f_group_type))) : both (f_group_type). +Fail Next Obligation. +Equations f_or_zkp_c {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := + f_or_zkp_c s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both (f_field_type). +Fail Next Obligation. +Equations f_or_zkp_d1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := + f_or_zkp_d1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : f_field_type))) : both (f_field_type). +Fail Next Obligation. +Equations f_or_zkp_d2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := + f_or_zkp_d2 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : f_field_type))) : both (f_field_type). +Fail Next Obligation. +Equations f_or_zkp_r1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := + f_or_zkp_r1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). +Fail Next Obligation. +Equations f_or_zkp_r2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := + f_or_zkp_r2 s := + bind_both s (fun x => + solve_lift (ret_both (snd x : f_field_type))) : both (f_field_type). +Fail Next Obligation. +Equations Build_t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_or_zkp_x : both (f_group_type)} {f_or_zkp_y : both (f_group_type)} {f_or_zkp_a1 : both (f_group_type)} {f_or_zkp_b1 : both (f_group_type)} {f_or_zkp_a2 : both (f_group_type)} {f_or_zkp_b2 : both (f_group_type)} {f_or_zkp_c : both (f_field_type)} {f_or_zkp_d1 : both (f_field_type)} {f_or_zkp_d2 : both (f_field_type)} {f_or_zkp_r1 : both (f_field_type)} {f_or_zkp_r2 : both (f_field_type)} : both (t_OrZKPCommit) := + Build_t_OrZKPCommit := + bind_both f_or_zkp_r2 (fun f_or_zkp_r2 => + bind_both f_or_zkp_r1 (fun f_or_zkp_r1 => + bind_both f_or_zkp_d2 (fun f_or_zkp_d2 => + bind_both f_or_zkp_d1 (fun f_or_zkp_d1 => + bind_both f_or_zkp_c (fun f_or_zkp_c => + bind_both f_or_zkp_b2 (fun f_or_zkp_b2 => + bind_both f_or_zkp_a2 (fun f_or_zkp_a2 => + bind_both f_or_zkp_b1 (fun f_or_zkp_b1 => + bind_both f_or_zkp_a1 (fun f_or_zkp_a1 => + bind_both f_or_zkp_y (fun f_or_zkp_y => + bind_both f_or_zkp_x (fun f_or_zkp_x => + solve_lift (ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit)))))))))))))) : both (t_OrZKPCommit). +Fail Next Obligation. +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := y) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := y) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := y) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := y) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := y) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := y) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_c' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := y) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := y) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := y) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := y) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := y)). + +Definition t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := + (int32 × f_field_type × int32). +Equations f_rp_i {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_RegisterParam)) : both (int32) := + f_rp_i s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : int32))) : both (int32). +Fail Next Obligation. +Equations f_rp_xi {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_RegisterParam)) : both (f_field_type) := + f_rp_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). +Fail Next Obligation. +Equations f_rp_zkp_random {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_RegisterParam)) : both (int32) := + f_rp_zkp_random s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both (int32). +Fail Next Obligation. +Equations Build_t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_rp_i : both (int32)} {f_rp_xi : both (f_field_type)} {f_rp_zkp_random : both (int32)} : both (t_RegisterParam) := + Build_t_RegisterParam := + bind_both f_rp_zkp_random (fun f_rp_zkp_random => + bind_both f_rp_xi (fun f_rp_xi => + bind_both f_rp_i (fun f_rp_i => + solve_lift (ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam)))))) : both (t_RegisterParam). +Fail Next Obligation. +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y) (f_rp_zkp_random := f_rp_zkp_random x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := y)). + +Definition t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := + (f_group_type × f_field_type × f_field_type). +Equations f_schnorr_zkp_u {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_SchnorrZKPCommit)) : both (f_group_type) := + f_schnorr_zkp_u s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : f_group_type))) : both (f_group_type). +Fail Next Obligation. +Equations f_schnorr_zkp_c {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_SchnorrZKPCommit)) : both (f_field_type) := + f_schnorr_zkp_c s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). +Fail Next Obligation. +Equations f_schnorr_zkp_z {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_SchnorrZKPCommit)) : both (f_field_type) := + f_schnorr_zkp_z s := + bind_both s (fun x => + solve_lift (ret_both (snd x : f_field_type))) : both (f_field_type). +Fail Next Obligation. +Equations Build_t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_schnorr_zkp_u : both (f_group_type)} {f_schnorr_zkp_c : both (f_field_type)} {f_schnorr_zkp_z : both (f_field_type)} : both (t_SchnorrZKPCommit) := + Build_t_SchnorrZKPCommit := + bind_both f_schnorr_zkp_z (fun f_schnorr_zkp_z => + bind_both f_schnorr_zkp_c (fun f_schnorr_zkp_c => + bind_both f_schnorr_zkp_u (fun f_schnorr_zkp_u => + solve_lift (ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit)))))) : both (t_SchnorrZKPCommit). +Fail Next Obligation. +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := y) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := y) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := y)). + +Definition t_TallyParameter : choice_type := + 'unit. +Equations Build_t_TallyParameter : both (t_TallyParameter) := + Build_t_TallyParameter := + solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (t_TallyParameter). +Fail Next Obligation. + +Equations schnorr_zkp {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both (int32)) (h : both (f_group_type)) (x : both (f_field_type)) : both (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := + schnorr_zkp random h x := + solve_lift (run (letb r := f_random_field_elem random in + letb u := f_g_pow r in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); + h; + u])))) in + letb z := f_add r (f_mul c x) in + letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in + ControlFlow_Continue (never_to_any hoist1))) : both (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). +Fail Next Obligation. + +Equations schnorr_zkp_validate {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both (f_group_type)) (pi : both (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both ('bool) := + schnorr_zkp_validate h pi := + solve_lift (andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); + h; + f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both ('bool). +Fail Next Obligation. + +Equations zkp_one_out_of_two {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both (int32)) (random_r : both (int32)) (random_d : both (int32)) (h : both (f_group_type)) (xi : both (f_field_type)) (vi : both ('bool)) : both (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) := + zkp_one_out_of_two random_w random_r random_d h xi vi := + letb w := f_random_field_elem random_w in + solve_lift (ifb vi + then letb r1 := f_random_field_elem random_r in + letb d1 := f_random_field_elem random_d in + letb x := f_g_pow xi in + letb y := f_prod (f_pow h xi) (f_g (ret_both (tt : 'unit))) in + letb a1 := f_prod (f_g_pow r1) (f_pow x d1) in + letb b1 := f_prod (f_pow h r1) (f_pow y d1) in + letb a2 := f_g_pow w in + letb b2 := f_pow h w in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; + y; + a1; + b1; + a2; + b2])))) in + letb d2 := f_sub c d1 in + letb r2 := f_sub w (f_mul xi d2) in + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2) + else letb r2 := f_random_field_elem random_r in + letb d2 := f_random_field_elem random_d in + letb x := f_g_pow xi in + letb y := f_pow h xi in + letb a1 := f_g_pow w in + letb b1 := f_pow h w in + letb a2 := f_prod (f_g_pow r2) (f_pow x d2) in + letb b2 := f_prod (f_pow h r2) (f_pow (f_div y (f_g (ret_both (tt : 'unit)))) d2) in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; + y; + a1; + b1; + a2; + b2])))) in + letb d1 := f_sub c d2 in + letb r1 := f_sub w (f_mul xi d1) in + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)). +Fail Next Obligation. + +Equations zkp_one_out_of_two_validate {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both (f_group_type)) (zkp : both (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both ('bool) := + zkp_one_out_of_two_validate h zkp := + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; + f_or_zkp_y zkp; + f_or_zkp_a1 zkp; + f_or_zkp_b1 zkp; + f_or_zkp_a2 zkp; + f_or_zkp_b2 zkp])))) in + solve_lift (andb (andb (andb (andb (c =.? (f_add (f_or_zkp_d1 zkp) (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? (f_prod (f_pow h (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r2 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? (f_prod (f_pow h (f_or_zkp_r2 zkp)) (f_pow (f_div (f_or_zkp_y zkp) (f_g (ret_both (tt : 'unit)))) (f_or_zkp_d2 zkp))))) : both ('bool). +Fail Next Obligation. + +Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := + (nseq f_group_type (is_pure (n)) × nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × nseq f_field_type (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × int32). +Equations f_g_pow_xis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq f_group_type (is_pure (n))) := + f_g_pow_xis s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type (is_pure (n))))) : both (nseq f_group_type (is_pure (n))). +Fail Next Obligation. +Equations f_zkp_xis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := + f_zkp_xis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). +Fail Next Obligation. +Equations f_commit_vis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq f_field_type (is_pure (n))) := + f_commit_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : nseq f_field_type (is_pure (n))))) : both (nseq f_field_type (is_pure (n))). +Fail Next Obligation. +Equations f_g_pow_xi_yi_vis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq f_group_type (is_pure (n))) := + f_g_pow_xi_yi_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type (is_pure (n))))) : both (nseq f_group_type (is_pure (n))). +Fail Next Obligation. +Equations f_zkp_vis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := + f_zkp_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). +Fail Next Obligation. +Equations f_tally {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (int32) := + f_tally s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both (int32). +Fail Next Obligation. +Equations Build_t_OvnContractState {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_g_pow_xis : both (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_commit_vis : both (nseq f_field_type (is_pure (n)))} {f_g_pow_xi_yi_vis : both (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_tally : both (int32)} : both (t_OvnContractState (n := n)) := + Build_t_OvnContractState := + bind_both f_tally (fun f_tally => + bind_both f_zkp_vis (fun f_zkp_vis => + bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => + bind_both f_commit_vis (fun f_commit_vis => + bind_both f_zkp_xis (fun f_zkp_xis => + bind_both f_g_pow_xis (fun f_g_pow_xis => + solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (t_OvnContractState). +Fail Next Obligation. +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). + +Equations cast_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := + cast_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with + | Result_Ok_case x => + letb x := ret_both ((x) : _ (* (t_CastVoteParam (v_Z)) *)) in + ControlFlow_Continue (solve_lift x) + | Result_Err_case x => + letb x := ret_both ((x) : (t_ParseError)) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist2 := v_Break (Result_Err (ret_both tt)) in + ControlFlow_Continue (solve_lift (never_to_any hoist2)) + end in + ControlFlow_Continue (letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in + letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in + letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in + letb cast_vote_state_ret := f_clone state in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). +Fail Next Obligation. + +Equations commit_to_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := + commit_to_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with + | Result_Ok_case x => + letb x := ret_both ((x) : _ (* (t_CastVoteParam (v_Z)) *)) in + ControlFlow_Continue (solve_lift x) + | Result_Err_case x => + letb x := ret_both ((x) : (t_ParseError)) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist3 := v_Break (Result_Err (ret_both tt)) in + ControlFlow_Continue (solve_lift (never_to_any hoist3)) + end in + ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + ssp (fun _ => + solve_lift (ifb negb (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist4 := v_Break (Result_Err (ret_both tt)) in + ControlFlow_Continue (never_to_any hoist4) + else ControlFlow_Continue (ret_both (tt : 'unit))) : both _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in + letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in + letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in + letb commit_vi := commit_to g_pow_xi_yi_vi in + letb commit_to_vote_state_ret := f_clone state in + letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),commit_to_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). +Solve All Obligations with now intros ; destruct from_uint_size. +Fail Next Obligation. + +Equations init_ovn_contract {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both ('unit)) : both (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)) := + init_ovn_contract _ := + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_field_zero (ret_both (tt : 'unit))) (f_schnorr_zkp_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_y := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_c := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d2 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)). +Fail Next Obligation. + +Equations register_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := + register_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_RegisterParam (v_Z)) := matchb out with + | Result_Ok_case x => + letb x := ret_both ((x) : _ (* (t_RegisterParam (v_Z)) *)) in + ControlFlow_Continue (solve_lift x) + | Result_Err_case x => + letb x := ret_both ((x) : (t_ParseError)) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist5 := v_Break (Result_Err (ret_both tt)) in + ControlFlow_Continue (solve_lift (never_to_any hoist5)) + end in + ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in + letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in + letb register_vote_state_ret := f_clone state in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in + Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),register_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). +Fail Next Obligation. + +Equations tally_votes {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := + tally_votes _ state := + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + ssp (fun _ => + letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in + letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] _ := ControlFlow_Continue (ifb negb (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist6 := v_Break (Result_Err (ret_both tt)) in + ControlFlow_Continue (never_to_any hoist6) + else ControlFlow_Continue (ret_both (tt : 'unit))) in + solve_lift (ifb negb (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist7 := v_Break (Result_Err (ret_both tt)) in + ControlFlow_Continue (never_to_any hoist7) + else ControlFlow_Continue (ret_both (tt : 'unit))) : both _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in + letb vote_result := f_group_one (ret_both (tt : 'unit)) in + letb vote_result := foldi_both_list ((* f_into_iter *) (array_to_list (f_g_pow_xi_yi_vis state))) (fun g_pow_vote => + ssp (fun vote_result => + solve_lift (f_prod vote_result g_pow_vote) : both (f_group_type))) vote_result in + letb tally := ret_both (0 : int32) in + letb curr := f_field_zero (ret_both (tt : 'unit)) in + letb '(curr,tally) := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => + ssp (fun '(curr,tally) => + letb tally := ifb (f_g_pow curr) =.? vote_result + then letb tally := i in + tally + else tally in + letb curr := f_add curr (f_field_one (ret_both (tt : 'unit))) in + solve_lift (prod_b (curr,tally)) : both ((f_field_type × int32)))) (prod_b (curr,tally)) in + letb tally_votes_state_ret := f_clone state in + letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in + Result_Ok (solve_lift (prod_b (f_accept (* (ret_both (tt : 'unit)) *),tally_votes_state_ret))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). +Solve All Obligations with now intros ; destruct from_uint_size. +Fail Next Obligation. + +(** Concert lib part **) +From ConCert.Utils Require Import Extras. +Export Extras. +From ConCert.Utils Require Import Automation. +Export Automation. +From ConCert.Execution Require Import Serializable. +Export Serializable. +From ConCert.Execution Require Import Blockchain. +Export Blockchain. +From ConCert.Execution Require Import ContractCommon. +Export ContractCommon. +From ConCert.Execution Require Import Serializable. +Export Serializable. +From Hacspec Require Import ConCertLib. +Export ConCertLib. + +Definition state_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := + t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n). + +#[global] Program Instance t_CastVoteParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_HasReceiveContext t_CastVoteParam 'unit := + {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_CastVoteParam_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_Sized t_CastVoteParam := + fun x => + x. +Fail Next Obligation. +Definition receive_OVN_cast_vote {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {v_A : _} `{ t_Sized (v_A)} `{ t_HasActions (v_A)} (ctx : both (t_CastVoteParam (v_Z := v_Z))) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := + cast_vote (v_Z := v_Z) (v_G := v_G) (n := n) (v_A := v_A) (H2 := t_CastVoteParam_t_Sized (v_Z := v_Z) (v_G := v_G) (n := n)) (H7 := t_CastVoteParam_t_HasReceiveContext (v_Z := v_Z) (v_G := v_G) (n := n)) ctx st. + +(* #[global] Program Instance t_CastVoteParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_HasReceiveContext t_CastVoteParam 'unit := *) +(* {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. *) +(* Fail Next Obligation. *) +(* #[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := *) +(* fun x => *) +(* x. *) +(* Fail Next Obligation. *) +Definition receive_OVN_commit_to_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both (t_CastVoteParam)) (st : both (state_OVN (n := n))) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := + commit_to_vote (H2 := t_CastVoteParam_t_Sized (n := n)) (H7 := t_CastVoteParam_t_HasReceiveContext (n := n)) ctx st. + +Definition init_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN (n := n)) (t_ParseError) := + ResultMonad.Ok st. + +#[global] Program Instance t_RegisterParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_HasReceiveContext t_RegisterParam 'unit := + {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_RegisterParam_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_Sized t_RegisterParam := + fun x => + x. +Fail Next Obligation. +Definition receive_OVN_register {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both (t_RegisterParam)) (st : both (state_OVN (n := n))) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := + register_vote (H2 := t_RegisterParam_t_Sized (n := n)) (H7 := t_RegisterParam_t_HasReceiveContext (n := n)) ctx st. + +#[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := + {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance t_TallyParameter_t_Sized : t_Sized t_TallyParameter := + fun x => + x. +Fail Next Obligation. +Definition receive_OVN_tally {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both (t_TallyParameter)) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN (n := n))) (t_ParseError)) := + tally_votes ctx st. + +Inductive Msg_OVN {v_Z : _} `{ t_Sized (v_Z)} `{ temp : t_Z_Field (v_Z)} : Type := +| msg_OVN_cast_vote : t_CastVoteParam (v_Z := v_Z) (H0 := temp) -> Msg_OVN +| msg_OVN_commit_to_vote : t_CastVoteParam (v_Z := v_Z) (H0 := temp) -> Msg_OVN +| msg_OVN_register : t_RegisterParam (v_Z := v_Z) -> Msg_OVN +| msg_OVN_tally : t_TallyParameter -> Msg_OVN. +#[global] Program Instance state_OVN_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_HasReceiveContext (state_OVN (n := n)) 'unit := + {| f_get := (fun (Ctx : _) => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. +Fail Next Obligation. +#[global] Program Instance state_OVN_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : t_Sized (state_OVN (n := n)) := + fun x => + x. +Fail Next Obligation. +#[global] Program Instance state_OVN_t_HasActions {v_Z : _} {v_G : _} {n : both (uint_size)}`{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : t_HasActions (state_OVN (v_Z := v_Z) (n := n)). +Admit Obligations. +Fail Next Obligation. +Obligation Tactic := intros. + +(* *) +Equations receive_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ temp1 : t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (chain : Chain) (ctx : ContractCallContext) (st : state_OVN (v_Z := v_Z) (n := n)) (msg : Datatypes.option (Msg_OVN (v_Z := v_Z))) : ResultMonad.result (state_OVN (v_Z := v_Z) (n := n) * list ActionBody) t_ParseError := + receive_OVN chain ctx st msg := + match msg with + | Some (msg_OVN_cast_vote val) => + match is_pure (both_prog (@receive_OVN_cast_vote v_Z v_G n _ _ _ _ _ v_A _ _ (ret_both val) (ret_both st))) with + | inl x => ResultMonad.Ok ((snd x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_OVN_commit_to_vote val) => + match is_pure (both_prog (@receive_OVN_commit_to_vote v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st))) with + | inl x => ResultMonad.Ok ((snd x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_OVN_register val) => + match is_pure (both_prog (@receive_OVN_register v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st))) with + | inl x => ResultMonad.Ok ((snd x), []) + | inr x => ResultMonad.Err x + end + | Some (msg_OVN_tally val) => + match (is_pure (both_prog (@receive_OVN_tally v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st)))) with + | inl x => ResultMonad.Ok ((snd x), []) + | inr x => ResultMonad.Err x + end + | _ => + ResultMonad.Err tt + end : ResultMonad.result (state_OVN (v_Z := v_Z) (n := n) * list ActionBody) t_ParseError. +Fail Next Obligation. +#[global] Program Instance state_OVN_Serializable {v_Z : _} {v_G : _} {n : both (uint_size)} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : Serializable (state_OVN (v_Z := v_Z) (n := n)) := + _. +Admit Obligations. +Fail Next Obligation. +#[global] Program Instance Msg_OVN_Serializable {v_Z : _} `{ temp0 : t_Sized (v_Z)} `{ temp1 : t_Z_Field (v_Z)} : Serializable (@Msg_OVN v_Z temp0 temp1). +Admit Obligations. +(* Derive Serializable Msg_OVN_rect. *) +Fail Next Obligation. +Definition contract_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ temp1 : t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ temp2 : t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : @Contract _ (@state_OVN v_Z v_G n temp1 _ _ _ _) (@Msg_OVN v_Z temp1 H1 ) (state_OVN (v_Z := v_Z) (n := n)) (t_ParseError) state_OVN_Serializable Msg_OVN_Serializable state_OVN_Serializable _ := build_contract init_OVN receive_OVN. diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs index b6671e7..0e9da1b 100644 --- a/ovn/src/ovn_group.rs +++ b/ovn/src/ovn_group.rs @@ -240,11 +240,7 @@ pub fn register_vote, const n: usize, A: HasActions>( ctx: impl HasReceiveContext, state: OvnContractState, ) -> Result<(A, OvnContractState), ParseError> { - let params: RegisterParam = - match ctx.parameter_cursor().get() { - Ok (x) => x, - Err (x) => return Err (ParseError{}), - }; + let params: RegisterParam = ctx.parameter_cursor().get()?; let g_pow_xi = G::g_pow(params.rp_xi); let zkp_xi = schnorr_zkp::(params.rp_zkp_random, g_pow_xi, params.rp_xi); @@ -307,11 +303,7 @@ pub fn commit_to_vote, const n: usize, A: HasActions>( ctx: impl HasReceiveContext, state: OvnContractState, ) -> Result<(A, OvnContractState), ParseError> { - let params: CastVoteParam = - match ctx.parameter_cursor().get() { - Ok (x) => x, - Err (x) => return Err (ParseError{}), - }; + let params: CastVoteParam = ctx.parameter_cursor().get()?; for i in 0..n { if !schnorr_zkp_validate(state.g_pow_xis[i], state.zkp_xis[i]) { @@ -336,11 +328,7 @@ pub fn cast_vote, const n: usize, A: HasActions>( ctx: impl HasReceiveContext, state: OvnContractState, ) -> Result<(A, OvnContractState), ParseError> { - let params: CastVoteParam = - match ctx.parameter_cursor().get() { - Ok (x) => x, - Err (x) => return Err (ParseError{}), - }; + let params: CastVoteParam = ctx.parameter_cursor().get()?; let g_pow_yi = compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); let g_pow_xi_yi_vi = diff --git a/ovn/src/ovn_z_89.rs b/ovn/src/ovn_z_89.rs new file mode 100644 index 0000000..cb22b6d --- /dev/null +++ b/ovn/src/ovn_z_89.rs @@ -0,0 +1,110 @@ +#![no_std] +#![feature(register_tool)] +#![register_tool(hax)] + +#[hax_lib_macros::exclude] +extern crate hax_lib_macros; + +#[hax_lib_macros::exclude] +use hax_lib_macros::*; + +#[exclude] +use hacspec_concordium::*; +#[exclude] +use hacspec_concordium_derive::*; + +pub use crate::ovn_traits::*; + +// // pub use create::ovn_traits::*; +// use create::Z_Field; +// use create::Group; +// use create::Z_Field; + +//////////////////// +// Impl for Z/89Z // +//////////////////// + +#[derive(Clone, Copy)] +pub struct z_89 {} +impl Z_Field for z_89 { + type field_type = u32; + fn q() -> Self::field_type { + 89u32 + } // Prime order + fn random_field_elem(random: u32) -> Self::field_type { + random % (Self::q() - 1) + } + + fn field_zero() -> Self::field_type { + 0u32 + } + + fn field_one() -> Self::field_type { + 1u32 + } + + fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { + (x + y) % (Self::q() - 1) + } + + fn sub(x: Self::field_type, y: Self::field_type) -> Self::field_type { + (x + (Self::q() - 1) - y) % (Self::q() - 1) + } + + fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { + (x * y) % (Self::q() - 1) + } +} + +#[derive(Clone, Copy)] +pub struct g_z_89 {} +impl Group for g_z_89 { + type group_type = u32; + + fn g() -> Self::group_type { + 3u32 + } // Generator (elemnent of group) + + fn hash(x: Vec) -> ::field_type { + let mut res = z_89::field_one(); + for y in x { + res = z_89::mul(y, res); + } + res // TODO + } + + fn g_pow(x: ::field_type) -> Self::group_type { + Self::pow(Self::g(), x) + } + + // TODO: use repeated squaring instead! + fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { + let mut result = Self::group_one(); + for i in 0..(x % (z_89::q() - 1)) { + result = Self::prod(result, g); + } + result + } + + fn group_one() -> Self::group_type { + 1 + } + + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { + ((x % z_89::q()) * (y % z_89::q())) % z_89::q() + } + + fn inv(x: Self::group_type) -> Self::group_type { + for j in 0..89 { + if Self::prod(x, j) == Self::group_one() { + return j; + } + } + assert!(false); + return x; + } + + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { + Self::prod(x, Self::inv(y)) + } +} diff --git a/ovn/tests/ovn_example.rs b/ovn/tests/ovn_example.rs index c12fb64..8cad312 100644 --- a/ovn/tests/ovn_example.rs +++ b/ovn/tests/ovn_example.rs @@ -36,90 +36,90 @@ pub use hacspec_ovn::*; // pub use ovn_group::*; // pub use ovn_trait::*; -#[derive(Clone, Copy)] -pub struct z_89 {} -impl Z_Field for z_89 { - type field_type = u32; - fn q() -> Self::field_type { - 89u32 - } // Prime order - fn random_field_elem(random: u32) -> Self::field_type { - random % (Self::q() - 1) - } - - fn field_zero() -> Self::field_type { - 0u32 - } - - fn field_one() -> Self::field_type { - 1u32 - } - - fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { - (x + y) % (Self::q() - 1) - } - - fn sub(x: Self::field_type, y: Self::field_type) -> Self::field_type { - (x + (Self::q() - 1) - y) % (Self::q() - 1) - } - - fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { - (x * y) % (Self::q() - 1) - } -} - -#[derive(Clone, Copy)] -pub struct g_z_89 {} -impl Group for g_z_89 { - type group_type = u32; - - fn g() -> Self::group_type { - 3u32 - } // Generator (elemnent of group) - - fn hash(x: Vec) -> ::field_type { - let mut res = z_89::field_one(); - for y in x { - res = z_89::mul(y, res); - } - res // TODO - } - - fn g_pow(x: ::field_type) -> Self::group_type { - Self::pow(Self::g(), x) - } - - // TODO: use repeated squaring instead! - fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { - let mut result = Self::group_one(); - for i in 0..(x % (z_89::q() - 1)) { - result = Self::prod(result, g); - } - result - } - - fn group_one() -> Self::group_type { - 1 - } - - fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { - ((x % z_89::q()) * (y % z_89::q())) % z_89::q() - } - - fn inv(x: Self::group_type) -> Self::group_type { - for j in 0..89 { - if Self::prod(x, j) == Self::group_one() { - return j; - } - } - assert!(false); - return x; - } - - fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { - Self::prod(x, Self::inv(y)) - } -} +// #[derive(Clone, Copy)] +// pub struct z_89 {} +// impl Z_Field for z_89 { +// type field_type = u32; +// fn q() -> Self::field_type { +// 89u32 +// } // Prime order +// fn random_field_elem(random: u32) -> Self::field_type { +// random % (Self::q() - 1) +// } + +// fn field_zero() -> Self::field_type { +// 0u32 +// } + +// fn field_one() -> Self::field_type { +// 1u32 +// } + +// fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { +// (x + y) % (Self::q() - 1) +// } + +// fn sub(x: Self::field_type, y: Self::field_type) -> Self::field_type { +// (x + (Self::q() - 1) - y) % (Self::q() - 1) +// } + +// fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { +// (x * y) % (Self::q() - 1) +// } +// } + +// #[derive(Clone, Copy)] +// pub struct g_z_89 {} +// impl Group for g_z_89 { +// type group_type = u32; + +// fn g() -> Self::group_type { +// 3u32 +// } // Generator (elemnent of group) + +// fn hash(x: Vec) -> ::field_type { +// let mut res = z_89::field_one(); +// for y in x { +// res = z_89::mul(y, res); +// } +// res // TODO +// } + +// fn g_pow(x: ::field_type) -> Self::group_type { +// Self::pow(Self::g(), x) +// } + +// // TODO: use repeated squaring instead! +// fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { +// let mut result = Self::group_one(); +// for i in 0..(x % (z_89::q() - 1)) { +// result = Self::prod(result, g); +// } +// result +// } + +// fn group_one() -> Self::group_type { +// 1 +// } + +// fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { +// ((x % z_89::q()) * (y % z_89::q())) % z_89::q() +// } + +// fn inv(x: Self::group_type) -> Self::group_type { +// for j in 0..89 { +// if Self::prod(x, j) == Self::group_one() { +// return j; +// } +// } +// assert!(false); +// return x; +// } + +// fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { +// Self::prod(x, Self::inv(y)) +// } +// } //////////////////////// // Impl for Secp256k1 // From 80d2a357347b1b8f7b3ea803d291260cd2e5835e Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 12 Mar 2024 12:21:51 +0100 Subject: [PATCH 71/86] Chnages --- .../ssprove/extraction/Hacspec_bls12_381.v | 537 ++++++++++ .../extraction/.Hacspec_concordium.aux | 2 + .../.Hacspec_concordium_Concordium_traits.aux | 1 + .../proofs/ssprove/extraction/.Makefile.d | 15 + .../extraction/Hacspec_concordium.glob | 45 + .../ssprove/extraction/Hacspec_concordium.v | 48 +- .../ssprove/extraction/Hacspec_concordium.vo | Bin 0 -> 87020 bytes .../ssprove/extraction/Hacspec_concordium.vok | 0 .../ssprove/extraction/Hacspec_concordium.vos | 0 .../Hacspec_concordium_Concordium_traits.v | 174 +-- .../Hacspec_concordium_Concordium_types.v | 211 ++-- concordium/proofs/ssprove/extraction/Makefile | 989 ++++++++++++++++++ .../proofs/ssprove/extraction/Makefile.conf | 71 ++ .../proofs/ssprove/extraction/_CoqProject | 9 + concordium/src/concordium.rs | 4 +- concordium/src/concordium_impls.rs | 42 +- concordium/src/concordium_types.rs | 44 +- .../ssprove/extraction/Hacspec_sha256.v | 292 ++++++ .../ssprove/extraction/Hacspec_sha512.v | 308 ++++++ 19 files changed, 2444 insertions(+), 348 deletions(-) create mode 100644 bls12-381/proofs/ssprove/extraction/Hacspec_bls12_381.v create mode 100644 concordium/proofs/ssprove/extraction/.Hacspec_concordium.aux create mode 100644 concordium/proofs/ssprove/extraction/.Hacspec_concordium_Concordium_traits.aux create mode 100644 concordium/proofs/ssprove/extraction/.Makefile.d create mode 100644 concordium/proofs/ssprove/extraction/Hacspec_concordium.glob create mode 100644 concordium/proofs/ssprove/extraction/Hacspec_concordium.vo create mode 100644 concordium/proofs/ssprove/extraction/Hacspec_concordium.vok create mode 100644 concordium/proofs/ssprove/extraction/Hacspec_concordium.vos create mode 100644 concordium/proofs/ssprove/extraction/Makefile create mode 100644 concordium/proofs/ssprove/extraction/Makefile.conf create mode 100644 concordium/proofs/ssprove/extraction/_CoqProject create mode 100644 sha256/proofs/ssprove/extraction/Hacspec_sha256.v create mode 100644 sha512/proofs/ssprove/extraction/Hacspec_sha512.v diff --git a/bls12-381/proofs/ssprove/extraction/Hacspec_bls12_381.v b/bls12-381/proofs/ssprove/extraction/Hacspec_bls12_381.v new file mode 100644 index 0000000..6ef3cba --- /dev/null +++ b/bls12-381/proofs/ssprove/extraction/Hacspec_bls12_381.v @@ -0,0 +1,537 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_lib. +Export Hacspec_lib. + +Notation "'t_Fp12'" := ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). + +Notation "'t_Fp2'" := ((t_Fp × t_Fp)). + +Notation "'t_Fp6'" := (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))). + +Notation "'t_G1'" := ((t_Fp × t_Fp × 'bool)). + +Notation "'t_G2'" := (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)). + +(*Not implemented yet? todo(item)*) + +Equations fp2add {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 ((t_Fp × t_Fp))) (m : both L2 I2 ((t_Fp × t_Fp))) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp)) := + fp2add n m := + letb '(n1,n2) := n in + letb '(m1,m2) := m in + solve_lift (prod_b (n1 .+ m1,n2 .+ m2)) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp)). +Fail Next Obligation. + +Equations fp2mul {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 ((t_Fp × t_Fp))) (m : both L2 I2 ((t_Fp × t_Fp))) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp)) := + fp2mul n m := + letb '(n1,n2) := n in + letb '(m1,m2) := m in + letb x1 := (n1 .* m1) .- (n2 .* m2) in + letb x2 := (n1 .* m2) .+ (n2 .* m1) in + solve_lift (prod_b (x1,x2)) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp)). +Fail Next Obligation. + +Equations fp6add {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) (m : both L2 I2 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))) := + fp6add n m := + letb '(n1,n2,n3) := n in + letb '(m1,m2,m3) := m in + solve_lift (prod_b (fp2add n1 m1,fp2add n2 m2,fp2add n3 m3)) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))). +Fail Next Obligation. + +Equations fp12add {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) (m : both L2 I2 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) : both (L1 :|: L2) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := + fp12add n m := + letb '(n1,n2) := n in + letb '(m1,m2) := m in + solve_lift (prod_b (fp6add n1 m1,fp6add n2 m2)) : both (L1 :|: L2) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). +Fail Next Obligation. + +Equations g1 {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both L1 I1 ((t_Fp × t_Fp × 'bool)) := + g1 _ := + solve_lift (prod_b (impl__Fp__from_hex (ret_both (17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb : chString)),impl__Fp__from_hex (ret_both (08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1 : chString)),ret_both (false : 'bool))) : both L1 I1 ((t_Fp × t_Fp × 'bool)). +Fail Next Obligation. + +Equations g2 {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)) := + g2 _ := + solve_lift (prod_b (prod_b (impl__Fp__from_hex (ret_both (24aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8 : chString)),impl__Fp__from_hex (ret_both (13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e : chString))),prod_b (impl__Fp__from_hex (ret_both (0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801 : chString)),impl__Fp__from_hex (ret_both (0606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be : chString))),ret_both (false : 'bool))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)). +Fail Next Obligation. + +Notation "'t_ArrayFp'" := (nseq int64 6). +Definition ArrayFp {L : {fset Location}} {I : Interface} : both L I (t_ArrayFp) -> both L I (t_ArrayFp) := + id. + +Notation "'t_SerializedFp'" := (nseq int8 48). +Definition SerializedFp {L : {fset Location}} {I : Interface} : both L I (t_SerializedFp) -> both L I (t_SerializedFp) := + id. + +Notation "'t_Fp'" := (nat_mod 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab). +Definition Fp {L : {fset Location}} {I : Interface} : both L I (t_Fp) -> both L I (t_Fp) := + id. + +Notation "'t_Scalar'" := (nat_mod 0x8000000000000000000000000000000000000000000000000000000000000000). +Definition Scalar {L : {fset Location}} {I : Interface} : both L I (t_Scalar) -> both L I (t_Scalar) := + id. + +Equations fp2conjugate {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 ((t_Fp × t_Fp))) : both L1 I1 ((t_Fp × t_Fp)) := + fp2conjugate n := + letb '(n1,n2) := n in + solve_lift (prod_b (n1,(f_ZERO (ret_both (tt : 'unit))) .- n2)) : both L1 I1 ((t_Fp × t_Fp)). +Fail Next Obligation. + +Equations fp2fromfp {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 (t_Fp)) : both L1 I1 ((t_Fp × t_Fp)) := + fp2fromfp n := + solve_lift (prod_b (n,f_ZERO (ret_both (tt : 'unit)))) : both L1 I1 ((t_Fp × t_Fp)). +Fail Next Obligation. + +Equations fp2inv {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 ((t_Fp × t_Fp))) : both L1 I1 ((t_Fp × t_Fp)) := + fp2inv n := + letb '(n1,n2) := n in + letb t0 := (n1 .* n1) .+ (n2 .* n2) in + letb t1 := impl__Fp__inv t0 in + letb x1 := n1 .* t1 in + letb x2 := (f_ZERO (ret_both (tt : 'unit))) .- (n2 .* t1) in + solve_lift (prod_b (x1,x2)) : both L1 I1 ((t_Fp × t_Fp)). +Fail Next Obligation. + +Equations fp2neg {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 ((t_Fp × t_Fp))) : both L1 I1 ((t_Fp × t_Fp)) := + fp2neg n := + letb '(n1,n2) := n in + solve_lift (prod_b ((f_ZERO (ret_both (tt : 'unit))) .- n1,(f_ZERO (ret_both (tt : 'unit))) .- n2)) : both L1 I1 ((t_Fp × t_Fp)). +Fail Next Obligation. + +Equations fp2sub {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 ((t_Fp × t_Fp))) (m : both L2 I2 ((t_Fp × t_Fp))) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp)) := + fp2sub n m := + solve_lift (fp2add n (fp2neg m)) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp)). +Fail Next Obligation. + +Equations fp2zero {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both L1 I1 ((t_Fp × t_Fp)) := + fp2zero _ := + solve_lift (fp2fromfp (f_ZERO (ret_both (tt : 'unit)))) : both L1 I1 ((t_Fp × t_Fp)). +Fail Next Obligation. + +Equations fp6fromfp2 {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 ((t_Fp × t_Fp))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))) := + fp6fromfp2 n := + solve_lift (prod_b (n,fp2zero (ret_both (tt : 'unit)),fp2zero (ret_both (tt : 'unit)))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))). +Fail Next Obligation. + +Equations fp6inv {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))) := + fp6inv n := + letb '(n1,n2,n3) := n in + letb eps := prod_b (f_ONE (ret_both (tt : 'unit)),f_ONE (ret_both (tt : 'unit))) in + letb t1 := fp2mul n1 n1 in + letb t2 := fp2mul n2 n2 in + letb t3 := fp2mul n3 n3 in + letb t4 := fp2mul n1 n2 in + letb t5 := fp2mul n1 n3 in + letb t6 := fp2mul n2 n3 in + letb x0 := fp2sub t1 (fp2mul eps t6) in + letb y0 := fp2sub (fp2mul eps t3) t4 in + letb z0 := fp2sub t2 t5 in + letb t0 := fp2mul n1 x0 in + letb t0 := fp2add t0 (fp2mul eps (fp2mul n3 y0)) in + letb t0 := fp2add t0 (fp2mul eps (fp2mul n2 z0)) in + letb t0 := fp2inv t0 in + letb x := fp2mul x0 t0 in + letb y := fp2mul y0 t0 in + letb z := fp2mul z0 t0 in + solve_lift (prod_b (x,y,z)) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))). +Fail Next Obligation. + +Equations fp6mul {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) (m : both L2 I2 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))) := + fp6mul n m := + letb '(n1,n2,n3) := n in + letb '(m1,m2,m3) := m in + letb eps := prod_b (f_ONE (ret_both (tt : 'unit)),f_ONE (ret_both (tt : 'unit))) in + letb t1 := fp2mul n1 m1 in + letb t2 := fp2mul n2 m2 in + letb t3 := fp2mul n3 m3 in + letb t4 := fp2mul (fp2add n2 n3) (fp2add m2 m3) in + letb t5 := fp2sub (fp2sub t4 t2) t3 in + letb x := fp2add (fp2mul t5 eps) t1 in + letb t4 := fp2mul (fp2add n1 n2) (fp2add m1 m2) in + letb t5 := fp2sub (fp2sub t4 t1) t2 in + letb y := fp2add t5 (fp2mul eps t3) in + letb t4 := fp2mul (fp2add n1 n3) (fp2add m1 m3) in + letb t5 := fp2sub (fp2sub t4 t1) t3 in + letb z := fp2add t5 t2 in + solve_lift (prod_b (x,y,z)) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))). +Fail Next Obligation. + +Equations fp6neg {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))) := + fp6neg n := + letb '(n1,n2,n3) := n in + solve_lift (prod_b (fp2sub (fp2zero (ret_both (tt : 'unit))) n1,fp2sub (fp2zero (ret_both (tt : 'unit))) n2,fp2sub (fp2zero (ret_both (tt : 'unit))) n3)) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))). +Fail Next Obligation. + +Equations fp12conjugate {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := + fp12conjugate n := + letb '(n1,n2) := n in + solve_lift (prod_b (n1,fp6neg n2)) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). +Fail Next Obligation. + +Equations fp6sub {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) (m : both L2 I2 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))) := + fp6sub n m := + solve_lift (fp6add n (fp6neg m)) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))). +Fail Next Obligation. + +Equations fp12inv {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := + fp12inv n := + letb '(n1,n2) := n in + letb gamma := prod_b (fp2zero (ret_both (tt : 'unit)),fp2fromfp (f_ONE (ret_both (tt : 'unit))),fp2zero (ret_both (tt : 'unit))) in + letb t1 := fp6mul n1 n1 in + letb t2 := fp6mul n2 n2 in + letb t1 := fp6sub t1 (fp6mul gamma t2) in + letb t2 := fp6inv t1 in + letb x := fp6mul n1 t2 in + letb y := fp6neg (fp6mul n2 t2) in + solve_lift (prod_b (x,y)) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). +Fail Next Obligation. + +Equations fp12mul {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) (m : both L2 I2 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) : both (L1 :|: L2) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := + fp12mul n m := + letb '(n1,n2) := n in + letb '(m1,m2) := m in + letb gamma := prod_b (fp2zero (ret_both (tt : 'unit)),fp2fromfp (f_ONE (ret_both (tt : 'unit))),fp2zero (ret_both (tt : 'unit))) in + letb t1 := fp6mul n1 m1 in + letb t2 := fp6mul n2 m2 in + letb x := fp6add t1 (fp6mul t2 gamma) in + letb y := fp6mul (fp6add n1 n2) (fp6add m1 m2) in + letb y := fp6sub (fp6sub y t1) t2 in + solve_lift (prod_b (x,y)) : both (L1 :|: L2) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). +Fail Next Obligation. + +Equations fp6zero {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))) := + fp6zero _ := + solve_lift (fp6fromfp2 (fp2zero (ret_both (tt : 'unit)))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))). +Fail Next Obligation. + +Equations fp12fromfp6 {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := + fp12fromfp6 n := + solve_lift (prod_b (n,fp6zero (ret_both (tt : 'unit)))) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). +Fail Next Obligation. + +Equations fp12neg {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := + fp12neg n := + letb '(n1,n2) := n in + solve_lift (prod_b (fp6sub (fp6zero (ret_both (tt : 'unit))) n1,fp6sub (fp6zero (ret_both (tt : 'unit))) n2)) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). +Fail Next Obligation. + +Equations fp12sub {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) (m : both L2 I2 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) : both (L1 :|: L2) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := + fp12sub n m := + solve_lift (fp12add n (fp12neg m)) : both (L1 :|: L2) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). +Fail Next Obligation. + +Equations fp12zero {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := + fp12zero _ := + solve_lift (fp12fromfp6 (fp6zero (ret_both (tt : 'unit)))) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). +Fail Next Obligation. + +Equations g1neg {L1 : {fset Location}} {I1 : Interface} (p : both L1 I1 ((t_Fp × t_Fp × 'bool))) : both L1 I1 ((t_Fp × t_Fp × 'bool)) := + g1neg p := + letb '(x,y,inf) := p in + solve_lift (prod_b (x,(f_ZERO (ret_both (tt : 'unit))) .- y,inf)) : both L1 I1 ((t_Fp × t_Fp × 'bool)). +Fail Next Obligation. + +Equations g2add_a {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (p : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) (q : both L2 I2 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)) := + g2add_a p q := + letb '(x1,y1,_) := p in + letb '(x2,y2,_) := q in + letb x_diff := fp2sub x2 x1 in + letb y_diff := fp2sub y2 y1 in + letb xovery := fp2mul y_diff (fp2inv x_diff) in + letb t1 := fp2mul xovery xovery in + letb t2 := fp2sub t1 x1 in + letb x3 := fp2sub t2 x2 in + letb t1 := fp2sub x1 x3 in + letb t2 := fp2mul xovery t1 in + letb y3 := fp2sub t2 y1 in + solve_lift (prod_b (x3,y3,ret_both (false : 'bool))) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)). +Fail Next Obligation. + +Equations g2double_a {L1 : {fset Location}} {I1 : Interface} (p : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)) := + g2double_a p := + letb '(x1,y1,_) := p in + letb x12 := fp2mul x1 x1 in + letb t1 := fp2mul (fp2fromfp (impl__Fp__from_literal (ret_both (3 : int128)))) x12 in + letb t2 := fp2inv (fp2mul (fp2fromfp (f_TWO (ret_both (tt : 'unit)))) y1) in + letb xovery := fp2mul t1 t2 in + letb t1 := fp2mul xovery xovery in + letb t2 := fp2mul (fp2fromfp (f_TWO (ret_both (tt : 'unit)))) x1 in + letb x3 := fp2sub t1 t2 in + letb t1 := fp2sub x1 x3 in + letb t2 := fp2mul xovery t1 in + letb y3 := fp2sub t2 y1 in + solve_lift (prod_b (x3,y3,ret_both (false : 'bool))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)). +Fail Next Obligation. + +Equations g2double {L1 : {fset Location}} {I1 : Interface} (p : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)) := + g2double p := + letb '(v__x1,y1,inf1) := p in + solve_lift (ifb andb (y1 <> (fp2zero (ret_both (tt : 'unit)))) (not inf1) + then g2double_a p + else prod_b (fp2zero (ret_both (tt : 'unit)),fp2zero (ret_both (tt : 'unit)),ret_both (true : 'bool))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)). +Fail Next Obligation. + +Equations g2add {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (p : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) (q : both L2 I2 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)) := + g2add p q := + letb '(x1,y1,inf1) := p in + letb '(x2,y2,inf2) := q in + solve_lift (ifb inf1 + then q + else ifb inf2 + then p + else ifb p =.? q + then g2double p + else ifb not (andb (x1 =.? x2) (y1 =.? (fp2neg y2))) + then g2add_a p q + else prod_b (fp2zero (ret_both (tt : 'unit)),fp2zero (ret_both (tt : 'unit)),ret_both (true : 'bool))) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)). +Fail Next Obligation. + +Equations g2neg {L1 : {fset Location}} {I1 : Interface} (p : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)) := + g2neg p := + letb '(x,y,inf) := p in + solve_lift (prod_b (x,fp2neg y,inf)) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)). +Fail Next Obligation. + +Equations twist {L1 : {fset Location}} {I1 : Interface} (p : both L1 I1 ((t_Fp × t_Fp × 'bool))) : both L1 I1 (((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))) × (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) := + twist p := + letb '(p0,p1,_) := p in + letb x := prod_b (prod_b (fp2zero (ret_both (tt : 'unit)),fp2fromfp p0,fp2zero (ret_both (tt : 'unit))),fp6zero (ret_both (tt : 'unit))) in + letb y := prod_b (fp6zero (ret_both (tt : 'unit)),prod_b (fp2zero (ret_both (tt : 'unit)),fp2fromfp p1,fp2zero (ret_both (tt : 'unit)))) in + solve_lift (prod_b (x,y)) : both L1 I1 (((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))) × (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))). +Fail Next Obligation. + +Equations line_add_p {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (r : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) (q : both L2 I2 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) (p : both L3 I3 ((t_Fp × t_Fp × 'bool))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := + line_add_p r q p := + letb '(r0,r1,_) := r in + letb '(q0,q1,_) := q in + letb a := fp2mul (fp2sub q1 r1) (fp2inv (fp2sub q0 r0)) in + letb b := fp2sub r1 (fp2mul a r0) in + letb a := fp12fromfp6 (fp6fromfp2 a) in + letb b := fp12fromfp6 (fp6fromfp2 b) in + letb '(x,y) := twist p in + solve_lift (fp12neg (fp12sub (fp12sub y (fp12mul a x)) b)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). +Fail Next Obligation. + +Equations line_double_p {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (r : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) (p : both L2 I2 ((t_Fp × t_Fp × 'bool))) : both (L1 :|: L2) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := + line_double_p r p := + letb '(r0,r1,_) := r in + letb a := fp2mul (fp2fromfp (impl__Fp__from_literal (ret_both (3 : int128)))) (fp2mul r0 r0) in + letb a := fp2mul a (fp2inv (fp2mul (fp2fromfp (f_TWO (ret_both (tt : 'unit)))) r1)) in + letb b := fp2sub r1 (fp2mul a r0) in + letb a := fp12fromfp6 (fp6fromfp2 a) in + letb b := fp12fromfp6 (fp6fromfp2 b) in + letb '(x,y) := twist p in + solve_lift (fp12neg (fp12sub (fp12sub y (fp12mul a x)) b)) : both (L1 :|: L2) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). +Fail Next Obligation. + +Equations g1add_a {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (p : both L1 I1 ((t_Fp × t_Fp × 'bool))) (q : both L2 I2 ((t_Fp × t_Fp × 'bool))) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp × 'bool)) := + g1add_a p q := + letb '(x1,y1,_) := p in + letb '(x2,y2,_) := q in + letb x_diff := x2 .- x1 in + letb y_diff := y2 .- y1 in + letb xovery := y_diff .* (impl__Fp__inv x_diff) in + letb x3 := ((f_exp xovery (ret_both (2 : int32))) .- x1) .- x2 in + letb y3 := (xovery .* (x1 .- x3)) .- y1 in + solve_lift (prod_b (x3,y3,ret_both (false : 'bool))) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp × 'bool)). +Fail Next Obligation. + +Equations g1double_a {L1 : {fset Location}} {I1 : Interface} (p : both L1 I1 ((t_Fp × t_Fp × 'bool))) : both L1 I1 ((t_Fp × t_Fp × 'bool)) := + g1double_a p := + letb '(x1,y1,_) := p in + letb x12 := f_exp x1 (ret_both (2 : int32)) in + letb xovery := ((impl__Fp__from_literal (ret_both (3 : int128))) .* x12) .* (impl__Fp__inv ((f_TWO (ret_both (tt : 'unit))) .* y1)) in + letb x3 := (f_exp xovery (ret_both (2 : int32))) .- ((f_TWO (ret_both (tt : 'unit))) .* x1) in + letb y3 := (xovery .* (x1 .- x3)) .- y1 in + solve_lift (prod_b (x3,y3,ret_both (false : 'bool))) : both L1 I1 ((t_Fp × t_Fp × 'bool)). +Fail Next Obligation. + +Equations g1double {L1 : {fset Location}} {I1 : Interface} (p : both L1 I1 ((t_Fp × t_Fp × 'bool))) : both L1 I1 ((t_Fp × t_Fp × 'bool)) := + g1double p := + letb '(v__x1,y1,inf1) := p in + solve_lift (ifb andb (y1 <> (f_ZERO (ret_both (tt : 'unit)))) (not inf1) + then g1double_a p + else prod_b (f_ZERO (ret_both (tt : 'unit)),f_ZERO (ret_both (tt : 'unit)),ret_both (true : 'bool))) : both L1 I1 ((t_Fp × t_Fp × 'bool)). +Fail Next Obligation. + +Equations g1add {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (p : both L1 I1 ((t_Fp × t_Fp × 'bool))) (q : both L2 I2 ((t_Fp × t_Fp × 'bool))) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp × 'bool)) := + g1add p q := + letb '(x1,y1,inf1) := p in + letb '(x2,y2,inf2) := q in + solve_lift (ifb inf1 + then q + else ifb inf2 + then p + else ifb p =.? q + then g1double p + else ifb not (andb (x1 =.? x2) (y1 =.? ((f_ZERO (ret_both (tt : 'unit))) .- y2))) + then g1add_a p q + else prod_b (f_ZERO (ret_both (tt : 'unit)),f_ZERO (ret_both (tt : 'unit)),ret_both (true : 'bool))) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp × 'bool)). +Fail Next Obligation. + +Definition c_loc : Location := + ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)));0%nat). +Equations fp12exp {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) (k : both L2 I2 (t_Scalar)) : both (L1 :|: L2 :|: fset [c_loc]) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := + fp12exp n k := + letb c loc(c_loc) := fp12fromfp6 (fp6fromfp2 (fp2fromfp (f_ONE (ret_both (tt : 'unit))))) in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := ret_both (256 : uint_size)))) (fun i => + ssp (fun _ => + letb _ := assign todo(term) in + solve_lift (ifb impl__Scalar__bit k ((ret_both (255 : uint_size)) .- i) + then letb _ := assign todo(term) in + ret_both (tt : 'unit) + else ()) : both (*1*)(L1:|:L2:|:fset [c_loc]) (I1:|:I2) ('unit))) (ret_both (tt : 'unit)) in + solve_lift c : both (L1 :|: L2 :|: fset [c_loc]) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). +Fail Next Obligation. + +Definition t_loc : Location := + ((t_Fp × t_Fp × 'bool);1%nat). +Equations g1mul {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (m : both L1 I1 (t_Scalar)) (p : both L2 I2 ((t_Fp × t_Fp × 'bool))) : both (L1 :|: L2 :|: fset [t_loc]) (I1 :|: I2) ((t_Fp × t_Fp × 'bool)) := + g1mul m p := + letb t loc(t_loc) := prod_b (f_ZERO (ret_both (tt : 'unit)),f_ZERO (ret_both (tt : 'unit)),ret_both (true : 'bool)) in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := ret_both (256 : uint_size)))) (fun i => + ssp (fun _ => + letb _ := assign todo(term) in + solve_lift (ifb impl__Scalar__bit m ((ret_both (255 : uint_size)) .- i) + then letb _ := assign todo(term) in + ret_both (tt : 'unit) + else ()) : both (*1*)(L1:|:L2:|:fset [t_loc]) (I1:|:I2) ('unit))) (ret_both (tt : 'unit)) in + solve_lift t : both (L1 :|: L2 :|: fset [t_loc]) (I1 :|: I2) ((t_Fp × t_Fp × 'bool)). +Fail Next Obligation. + +Definition t_loc : Location := + (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool);2%nat). +Equations g2mul {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (m : both L1 I1 (t_Scalar)) (p : both L2 I2 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) : both (L1 :|: L2 :|: fset [t_loc]) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)) := + g2mul m p := + letb t loc(t_loc) := prod_b (fp2zero (ret_both (tt : 'unit)),fp2zero (ret_both (tt : 'unit)),ret_both (true : 'bool)) in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := ret_both (256 : uint_size)))) (fun i => + ssp (fun _ => + letb _ := assign todo(term) in + solve_lift (ifb impl__Scalar__bit m ((ret_both (255 : uint_size)) .- i) + then letb _ := assign todo(term) in + ret_both (tt : 'unit) + else ()) : both (*1*)(L1:|:L2:|:fset [t_loc]) (I1:|:I2) ('unit))) (ret_both (tt : 'unit)) in + solve_lift t : both (L1 :|: L2 :|: fset [t_loc]) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)). +Fail Next Obligation. + +Equations frobenius {L1 : {fset Location}} {I1 : Interface} (f : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := + frobenius f := + letb '((g0,g1,g2),(h0,h1,h2)) := f in + letb t1 := fp2conjugate g0 in + letb t2 := fp2conjugate h0 in + letb t3 := fp2conjugate g1 in + letb t4 := fp2conjugate h1 in + letb t5 := fp2conjugate g2 in + letb t6 := fp2conjugate h2 in + letb c1 := ArrayFp (array_from_list [U64 (ret_both (10162220747404304312 : int64)); + U64 (ret_both (17761815663483519293 : int64)); + U64 (ret_both (8873291758750579140 : int64)); + U64 (ret_both (1141103941765652303 : int64)); + U64 (ret_both (13993175198059990303 : int64)); + U64 (ret_both (1802798568193066599 : int64))]) in + letb c1 := impl__ArrayFp__to_le_bytes c1 in + letb c1 := impl__Fp__from_byte_seq_le c1 in + letb c2 := ArrayFp (array_from_list [U64 (ret_both (3240210268673559283 : int64)); + U64 (ret_both (2895069921743240898 : int64)); + U64 (ret_both (17009126888523054175 : int64)); + U64 (ret_both (6098234018649060207 : int64)); + U64 (ret_both (9865672654120263608 : int64)); + U64 (ret_both (71000049454473266 : int64))]) in + letb c2 := impl__ArrayFp__to_le_bytes c2 in + letb c2 := impl__Fp__from_byte_seq_le c2 in + letb gamma11 := prod_b (c1,c2) in + letb gamma12 := fp2mul gamma11 gamma11 in + letb gamma13 := fp2mul gamma12 gamma11 in + letb gamma14 := fp2mul gamma13 gamma11 in + letb gamma15 := fp2mul gamma14 gamma11 in + letb t2 := fp2mul t2 gamma11 in + letb t3 := fp2mul t3 gamma12 in + letb t4 := fp2mul t4 gamma13 in + letb t5 := fp2mul t5 gamma14 in + letb t6 := fp2mul t6 gamma15 in + solve_lift (prod_b (prod_b (t1,t3,t5),prod_b (t2,t4,t6))) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). +Fail Next Obligation. + +Equations final_exponentiation {L1 : {fset Location}} {I1 : Interface} (f : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) : both (L1 :|: fset [c_loc]) I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := + final_exponentiation f := + letb fp6 := fp12conjugate f in + letb finv := fp12inv f in + letb fp6_1_ := fp12mul fp6 finv in + letb fp8 := frobenius (frobenius fp6_1_) in + letb f := fp12mul fp8 fp6_1_ in + letb u := impl__Scalar__from_literal (ret_both (15132376222941642752 : int128)) in + letb u_half := impl__Scalar__from_literal (ret_both (7566188111470821376 : int128)) in + letb t0 := fp12mul f f in + letb t1 := fp12exp t0 u in + letb t1 := fp12conjugate t1 in + letb t2 := fp12exp t1 u_half in + letb t2 := fp12conjugate t2 in + letb t3 := fp12conjugate f in + letb t1 := fp12mul t3 t1 in + letb t1 := fp12conjugate t1 in + letb t1 := fp12mul t1 t2 in + letb t2 := fp12exp t1 u in + letb t2 := fp12conjugate t2 in + letb t3 := fp12exp t2 u in + letb t3 := fp12conjugate t3 in + letb t1 := fp12conjugate t1 in + letb t3 := fp12mul t1 t3 in + letb t1 := fp12conjugate t1 in + letb t1 := frobenius (frobenius (frobenius t1)) in + letb t2 := frobenius (frobenius t2) in + letb t1 := fp12mul t1 t2 in + letb t2 := fp12exp t3 u in + letb t2 := fp12conjugate t2 in + letb t2 := fp12mul t2 t0 in + letb t2 := fp12mul t2 f in + letb t1 := fp12mul t1 t2 in + letb t2 := frobenius t3 in + solve_lift (fp12mul t1 t2) : both (L1 :|: fset [c_loc]) I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). +Fail Next Obligation. + +Definition f_loc : Location := + ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)));3%nat). +Definition r_loc : Location := + (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool);4%nat). +Equations pairing {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (p : both L1 I1 ((t_Fp × t_Fp × 'bool))) (q : both L2 I2 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) : both (L1 :|: L2 :|: fset [f_loc;r_loc;c_loc]) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := + pairing p q := + letb t := impl__Scalar__from_literal (ret_both (15132376222941642752 : int128)) in + letb r loc(r_loc) := q in + letb f loc(f_loc) := fp12fromfp6 (fp6fromfp2 (fp2fromfp (f_ONE (ret_both (tt : 'unit))))) in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (1 : uint_size)) (f_end := ret_both (64 : uint_size)))) (fun i => + ssp (fun _ => + letb lrr := line_double_p r p in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + solve_lift (ifb impl__Scalar__bit t (((ret_both (64 : uint_size)) .- i) .- (ret_both (1 : uint_size))) + then letb lrq := line_add_p r q p in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + ret_both (tt : 'unit) + else ()) : both (*2*)(L1:|:L2:|:fset [f_loc;r_loc]) (I1:|:I2) ('unit))) (ret_both (tt : 'unit)) in + solve_lift (final_exponentiation (fp12conjugate f)) : both (L1 :|: L2 :|: fset [f_loc;r_loc;c_loc]) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). +Fail Next Obligation. diff --git a/concordium/proofs/ssprove/extraction/.Hacspec_concordium.aux b/concordium/proofs/ssprove/extraction/.Hacspec_concordium.aux new file mode 100644 index 0000000..b86194a --- /dev/null +++ b/concordium/proofs/ssprove/extraction/.Hacspec_concordium.aux @@ -0,0 +1,2 @@ +COQAUX1 1fd1617ec37cda10bbc5e53eee59a9a9 /home/au538501/Documents/LocalHacspec/specs/concordium/proofs/ssprove/extraction/Hacspec_concordium.v +0 0 vo_compile_time "4.101" diff --git a/concordium/proofs/ssprove/extraction/.Hacspec_concordium_Concordium_traits.aux b/concordium/proofs/ssprove/extraction/.Hacspec_concordium_Concordium_traits.aux new file mode 100644 index 0000000..2f9b48d --- /dev/null +++ b/concordium/proofs/ssprove/extraction/.Hacspec_concordium_Concordium_traits.aux @@ -0,0 +1 @@ +COQAUX1 a86cb56e39100c5212166bcaa90fb20d /home/au538501/Documents/LocalHacspec/specs/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_traits.v diff --git a/concordium/proofs/ssprove/extraction/.Makefile.d b/concordium/proofs/ssprove/extraction/.Makefile.d new file mode 100644 index 0000000..a1b20b8 --- /dev/null +++ b/concordium/proofs/ssprove/extraction/.Makefile.d @@ -0,0 +1,15 @@ +Hacspec_concordium.vo Hacspec_concordium.glob Hacspec_concordium.v.beautified Hacspec_concordium.required_vo: Hacspec_concordium.v +Hacspec_concordium.vio: Hacspec_concordium.v +Hacspec_concordium.vos Hacspec_concordium.vok Hacspec_concordium.required_vos: Hacspec_concordium.v +Hacspec_concordium_Concordium_traits.vo Hacspec_concordium_Concordium_traits.glob Hacspec_concordium_Concordium_traits.v.beautified Hacspec_concordium_Concordium_traits.required_vo: Hacspec_concordium_Concordium_traits.v +Hacspec_concordium_Concordium_traits.vio: Hacspec_concordium_Concordium_traits.v +Hacspec_concordium_Concordium_traits.vos Hacspec_concordium_Concordium_traits.vok Hacspec_concordium_Concordium_traits.required_vos: Hacspec_concordium_Concordium_traits.v +Hacspec_concordium_Concordium_types.vo Hacspec_concordium_Concordium_types.glob Hacspec_concordium_Concordium_types.v.beautified Hacspec_concordium_Concordium_types.required_vo: Hacspec_concordium_Concordium_types.v +Hacspec_concordium_Concordium_types.vio: Hacspec_concordium_Concordium_types.v +Hacspec_concordium_Concordium_types.vos Hacspec_concordium_Concordium_types.vok Hacspec_concordium_Concordium_types.required_vos: Hacspec_concordium_Concordium_types.v +Hacspec_concordium_Concordium_types_Sealed.vo Hacspec_concordium_Concordium_types_Sealed.glob Hacspec_concordium_Concordium_types_Sealed.v.beautified Hacspec_concordium_Concordium_types_Sealed.required_vo: Hacspec_concordium_Concordium_types_Sealed.v +Hacspec_concordium_Concordium_types_Sealed.vio: Hacspec_concordium_Concordium_types_Sealed.v +Hacspec_concordium_Concordium_types_Sealed.vos Hacspec_concordium_Concordium_types_Sealed.vok Hacspec_concordium_Concordium_types_Sealed.required_vos: Hacspec_concordium_Concordium_types_Sealed.v +Hacspec_concordium_Constants.vo Hacspec_concordium_Constants.glob Hacspec_concordium_Constants.v.beautified Hacspec_concordium_Constants.required_vo: Hacspec_concordium_Constants.v +Hacspec_concordium_Constants.vio: Hacspec_concordium_Constants.v +Hacspec_concordium_Constants.vos Hacspec_concordium_Constants.vok Hacspec_concordium_Constants.required_vos: Hacspec_concordium_Constants.v diff --git a/concordium/proofs/ssprove/extraction/Hacspec_concordium.glob b/concordium/proofs/ssprove/extraction/Hacspec_concordium.glob new file mode 100644 index 0000000..f8f21c2 --- /dev/null +++ b/concordium/proofs/ssprove/extraction/Hacspec_concordium.glob @@ -0,0 +1,45 @@ +DIGEST 1fd1617ec37cda10bbc5e53eee59a9a9 +FExamples.Hacspec_concordium +R126:136 Crypt.choice_type <> <> lib +R138:144 Crypt.Package <> <> lib +R146:152 Crypt.Prelude <> <> lib +R162:176 Crypt.package.pkg_notation PackageNotation <> mod +R211:213 extructures.ord <> <> lib +R215:218 extructures.fset <> <> lib +R250:258 mathcomp.word.word_ssrZ <> <> lib +R260:263 mathcomp.word.word <> <> lib +R293:296 Jasmin.word <> <> lib +R324:329 Coq.ZArith.ZArith <> <> lib +R356:369 Coq.Strings.String <> <> lib +R379:396 Coq.Lists.List ListNotations <> mod +R494:507 Hacspec.ChoiceEquality <> <> lib +R538:552 Hacspec.LocationUtility <> <> lib +R583:604 Hacspec.Hacspec_Lib_Comparable <> <> lib +R635:649 Hacspec.Hacspec_Lib_Pre <> <> lib +R680:690 Hacspec.Hacspec_Lib <> <> lib +R727:747 mathcomp.ssreflect.choice Choice.Exports <> mod +def 941:947 <> t_Never +R951:961 Crypt.choice_type <> choice_type ind +R966:970 Crypt.package.pkg_notation PackageNotation ::package_scope:'''unit' not +def 984:988 <> abort +R992:995 Hacspec.ChoiceEquality <> both rec +R1017:1023 Examples.Hacspec_concordium <> t_Never def +R1008:1011 extructures.fset <> fset def +R1013:1014 Coq.Lists.List ListNotations ::list_scope:'['_']' not +R998:1001 extructures.fset <> fset def +R1003:1004 Coq.Lists.List ListNotations ::list_scope:'['_']' not +R1028:1038 Hacspec.Hacspec_Lib <> :::'ret_both'_'tt' not +def 1051:1054 <> trap +R1061:1066 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R1075:1075 extructures.fset FSet.Exports ::type_scope:'{'_'fset'_x_'}' not +R1067:1074 Crypt.package.pkg_core_definition <> Location def +binder 1057:1057 <> L:1 +R1083:1091 Crypt.package.pkg_core_definition <> Interface def +binder 1079:1079 <> I:2 +R1096:1099 Hacspec.ChoiceEquality <> both rec +R1106:1112 Examples.Hacspec_concordium <> t_Never def +R1120:1123 Examples.Hacspec_concordium <> trap:4 def +R1152:1155 Hacspec.ChoiceEquality <> both rec +R1162:1168 Examples.Hacspec_concordium <> t_Never def +R1133:1143 Hacspec.ChoiceEquality <> :::'solve_lift'_x not +R1144:1148 Examples.Hacspec_concordium <> abort def diff --git a/concordium/proofs/ssprove/extraction/Hacspec_concordium.v b/concordium/proofs/ssprove/extraction/Hacspec_concordium.v index a7d41ef..e56a0b3 100644 --- a/concordium/proofs/ssprove/extraction/Hacspec_concordium.v +++ b/concordium/proofs/ssprove/extraction/Hacspec_concordium.v @@ -24,18 +24,6 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) -Definition t_Never : choice_type := 'unit. -Definition abort : both (fset []) (fset []) t_Never := ret_both tt. -Equations trap {L : {fset Location}} {I : Interface} : both L I (t_Never) := - trap := - solve_lift abort : both L I (t_Never). -Fail Next Obligation. - Require Import Alloc. Export Alloc. @@ -81,6 +69,24 @@ Export Core_Result. Require Import collections. Export collections. +Require Import Concordium_prims. +Export Concordium_prims. + +Require Import Concordium_impls. +Export Concordium_impls. + +Require Import Concordium_types. +Export Concordium_types. + +Require Import Concordium_traits. +Export Concordium_traits. + +Require Import Concordium_contracts_common. +Export Concordium_contracts_common. + +Require Import Hacspec_concordium_derive. +Export Hacspec_concordium_derive. + (*Not implemented yet? todo(item)*) (*Not implemented yet? todo(item)*) @@ -127,21 +133,19 @@ Export collections. (*Not implemented yet? todo(item)*) -Require Import Concordium_prims. -Export Concordium_prims. +(*Not implemented yet? todo(item)*) -Require Import Concordium_types. -Export Concordium_types. +(*Not implemented yet? todo(item)*) -Require Import Concordium_traits. -Export Concordium_traits. +(*Not implemented yet? todo(item)*) (*Not implemented yet? todo(item)*) -Require Import Concordium_contracts_common. -Export Concordium_contracts_common. +(*Not implemented yet? todo(item)*) (*Not implemented yet? todo(item)*) -Require Import Hacspec_concordium_derive. -Export Hacspec_concordium_derive. +Equations trap {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both L1 I1 (t_Never) := + trap _ := + solve_lift (abort (ret_both (tt : 'unit))) : both L1 I1 (t_Never). +Fail Next Obligation. diff --git a/concordium/proofs/ssprove/extraction/Hacspec_concordium.vo b/concordium/proofs/ssprove/extraction/Hacspec_concordium.vo new file mode 100644 index 0000000000000000000000000000000000000000..6f254c05dbb3d754d23fafbefa4036a6e87a88aa GIT binary patch literal 87020 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 z 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 Y<|#4F=Jkf>ZPJ both (L1 :|: f_size_loc) I1 (int32) ; -}. -Hint Unfold f_size_loc. +Require Import Hacspec_concordium. +Export Hacspec_concordium. Class t_HasChainMetadata (Self : choice_type) := { f_slot_time_loc : {fset Location} ; - f_slot_time : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_slot_time_loc) I1 (t_Timestamp) ; + f_slot_time : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: f_slot_time_loc) I1 (t_Timestamp) ; }. Hint Unfold f_slot_time_loc. -Class t_HasPolicy (Self : choice_type) := { - f_identity_provider_loc : {fset Location} ; - f_identity_provider : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_identity_provider_loc) I1 (int32) ; - f_created_at_loc : {fset Location} ; - f_created_at : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_created_at_loc) I1 (t_Timestamp) ; - f_valid_to_loc : {fset Location} ; - f_valid_to : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_valid_to_loc) I1 (t_Timestamp) ; - f_next_item_loc : {fset Location} ; - f_next_item : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (nseq int8 31) -> both (L1 :|: L2 :|: f_next_item_loc) (I1 :|: I2) ((t_Option ((t_AttributeTag × int8)) × nseq int8 31 × v_Self)) ; -}. -Hint Unfold f_identity_provider_loc. -Hint Unfold f_created_at_loc. -Hint Unfold f_valid_to_loc. -Hint Unfold f_next_item_loc. - -Class t_HasCommonData (Self : choice_type) := { - f_PolicyType : choice_type ; - f_PolicyType_t_HasPolicy :> t_HasPolicy (f_PolicyType) ; - f_PolicyType_t_Sized :> t_Sized (f_PolicyType) ; - f_MetadataType : choice_type ; - f_MetadataType_t_HasChainMetadata :> t_HasChainMetadata (f_MetadataType) ; - f_MetadataType_t_Sized :> t_Sized (f_MetadataType) ; - f_ParamType : choice_type ; - f_ParamType_t_Read :> t_Read (f_ParamType) ; - f_ParamType_t_HasParameter :> t_HasParameter (f_ParamType) ; - f_ParamType_t_Sized :> t_Sized (f_ParamType) ; - f_PolicyIteratorType : choice_type ; - f_PolicyIteratorType_t_ExactSizeIterator :> t_ExactSizeIterator (f_PolicyIteratorType) ; - f_PolicyIteratorType_t_Iterator :> t_Iterator (f_PolicyIteratorType) ; - f_PolicyIteratorType_t_Sized :> t_Sized (f_PolicyIteratorType) ; - f_policies_loc : {fset Location} ; - f_policies : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_policies_loc) I1 (f_PolicyIteratorType) ; - f_metadata_loc : {fset Location} ; - f_metadata : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_metadata_loc) I1 (f_MetadataType) ; - f_parameter_cursor_loc : {fset Location} ; - f_parameter_cursor : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_parameter_cursor_loc) I1 (f_ParamType) ; -}. -Hint Unfold f_policies_loc. -Hint Unfold f_metadata_loc. -Hint Unfold f_parameter_cursor_loc. - -Class t_HasInitContext (Self : choice_type) := { - f_InitData : choice_type ; - f_InitData_t_Sized :> t_Sized (f_InitData) ; - f_open_loc : {fset Location} ; - f_open : forall {L1 I1}, both L1 I1 (f_InitData) -> both (L1 :|: f_open_loc) I1 (v_Self) ; - f_init_origin_loc : {fset Location} ; - f_init_origin : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_init_origin_loc) I1 (t_AccountAddress) ; -}. -Hint Unfold f_open_loc. -Hint Unfold f_init_origin_loc. - -Class t_HasReceiveContext (Self : choice_type) := { - f_ReceiveData : choice_type ; - f_ReceiveData_t_Sized :> t_Sized (f_ReceiveData) ; - f_open_loc : {fset Location} ; - f_open : forall {L1 I1}, both L1 I1 (f_ReceiveData) -> both (L1 :|: f_open_loc) I1 (v_Self) ; - f_invoker_loc : {fset Location} ; - f_invoker : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_invoker_loc) I1 (t_AccountAddress) ; - f_self_address_loc : {fset Location} ; - f_self_address : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_self_address_loc) I1 (t_ContractAddress) ; - f_self_balance_loc : {fset Location} ; - f_self_balance : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_self_balance_loc) I1 (t_Amount) ; - f_sender_loc : {fset Location} ; - f_sender : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_sender_loc) I1 (t_Address) ; - f_owner_loc : {fset Location} ; - f_owner : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_owner_loc) I1 (t_AccountAddress) ; -}. -Hint Unfold f_open_loc. -Hint Unfold f_invoker_loc. -Hint Unfold f_self_address_loc. -Hint Unfold f_self_balance_loc. -Hint Unfold f_sender_loc. -Hint Unfold f_owner_loc. - -Class t_HasContractState (Self : choice_type) := { - f_ContractStateData : choice_type ; - f_ContractStateData_t_Sized :> t_Sized (f_ContractStateData) ; - f_open_loc : {fset Location} ; - f_open : forall {L1 I1}, both L1 I1 (f_ContractStateData) -> both (L1 :|: f_open_loc) I1 (v_Self) ; +Class t_HasParameter (Self : choice_type) := { f_size_loc : {fset Location} ; - f_size : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_size_loc) I1 (int32) ; - f_truncate_loc : {fset Location} ; - f_truncate : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: f_truncate_loc) (I1 :|: I2) (v_Self) ; - f_reserve_loc : {fset Location} ; - f_reserve : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (int32) -> both (L1 :|: L2 :|: f_reserve_loc) (I1 :|: I2) (('bool × v_Self)) ; + f_size : forall {L1 I1}, both L1 I1 (Self) -> both (L1 :|: f_size_loc) I1 (int32) ; }. -Hint Unfold f_open_loc. Hint Unfold f_size_loc. -Hint Unfold f_truncate_loc. -Hint Unfold f_reserve_loc. - -Class t_HasLogger (Self : choice_type) := { - f_init_loc : {fset Location} ; - f_init : forall {L1 I1}, both (L1 :|: f_init_loc) I1 (v_Self) ; - f_log_raw_loc : {fset Location} ; - f_log_raw : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (seq int8) -> both (L1 :|: L2 :|: f_log_raw_loc) (I1 :|: I2) ((t_Result ('unit) (t_LogError) × v_Self)) ; - f_log_loc : {fset Location} ; - f_log : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (v_S) -> both (L1 :|: L2 :|: f_log_loc) (I1 :|: I2) ((t_Result ('unit) (t_LogError) × v_Self)) ; -}. -Hint Unfold f_init_loc. -Hint Unfold f_log_raw_loc. -Hint Unfold f_log_loc. - -Class t_HasActions (Self : choice_type) := { - f_accept_loc : {fset Location} ; - f_accept : forall {L1 I1}, both (L1 :|: f_accept_loc) I1 (v_Self) ; - f_simple_transfer_loc : {fset Location} ; - f_simple_transfer : forall {L1 L2 I1 I2}, both L1 I1 (t_AccountAddress) -> both L2 I2 (t_Amount) -> both (L1 :|: L2 :|: f_simple_transfer_loc) (I1 :|: I2) (v_Self) ; - f_send_raw_loc : {fset Location} ; - f_send_raw : forall {L1 L2 L3 L4 I1 I2 I3 I4}, both L1 I1 (t_ContractAddress) -> both L2 I2 (t_ReceiveName) -> both L3 I3 (t_Amount) -> both L4 I4 (seq int8) -> both (L1 :|: L2 :|: L3 :|: L4 :|: f_send_raw_loc) (I1 :|: I2 :|: I3 :|: I4) (v_Self) ; - f_and_then_loc : {fset Location} ; - f_and_then : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (v_Self) -> both (L1 :|: L2 :|: f_and_then_loc) (I1 :|: I2) (v_Self) ; - f_or_else_loc : {fset Location} ; - f_or_else : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (v_Self) -> both (L1 :|: L2 :|: f_or_else_loc) (I1 :|: I2) (v_Self) ; -}. -Hint Unfold f_accept_loc. -Hint Unfold f_simple_transfer_loc. -Hint Unfold f_send_raw_loc. -Hint Unfold f_and_then_loc. -Hint Unfold f_or_else_loc. - -Class t_UnwrapAbort (Self : choice_type) := { - f_Unwrap : choice_type ; - f_Unwrap_t_Sized :> t_Sized (f_Unwrap) ; - f_unwrap_abort_loc : {fset Location} ; - f_unwrap_abort : forall {L1 I1}, both L1 I1 (v_Self) -> both (L1 :|: f_unwrap_abort_loc) I1 (f_Unwrap) ; -}. -Hint Unfold f_unwrap_abort_loc. - -Class t_ExpectReport (Self : choice_type) := { - f_Unwrap : choice_type ; - f_Unwrap_t_Sized :> t_Sized (f_Unwrap) ; - f_expect_report_loc : {fset Location} ; - f_expect_report : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (chString) -> both (L1 :|: L2 :|: f_expect_report_loc) (I1 :|: I2) (f_Unwrap) ; -}. -Hint Unfold f_expect_report_loc. - -Class t_ExpectErrReport (Self : choice_type) := { - f_Unwrap : choice_type ; - f_Unwrap_t_Sized :> t_Sized (f_Unwrap) ; - f_expect_err_report_loc : {fset Location} ; - f_expect_err_report : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (chString) -> both (L1 :|: L2 :|: f_expect_err_report_loc) (I1 :|: I2) (f_Unwrap) ; -}. -Hint Unfold f_expect_err_report_loc. - -Class t_ExpectNoneReport (Self : choice_type) := { - f_expect_none_report_loc : {fset Location} ; - f_expect_none_report : forall {L1 L2 I1 I2}, both L1 I1 (v_Self) -> both L2 I2 (chString) -> both (L1 :|: L2 :|: f_expect_none_report_loc) (I1 :|: I2) ('unit) ; -}. -Hint Unfold f_expect_none_report_loc. - -Class t_SerialCtx (Self : choice_type) := { - f_serial_ctx_loc : {fset Location} ; - f_serial_ctx : forall {L1 L2 L3 I1 I2 I3}, both L1 I1 (v_Self) -> both L2 I2 (t_SizeLength) -> both L3 I3 (v_W) -> both (L1 :|: L2 :|: L3 :|: f_serial_ctx_loc) (I1 :|: I2 :|: I3) ((t_Result ('unit) (f_Err) × v_W)) ; -}. -Hint Unfold f_serial_ctx_loc. - -Class t_DeserialCtx (Self : choice_type) := { - f_deserial_ctx_loc : {fset Location} ; - f_deserial_ctx : forall {L1 L2 L3 I1 I2 I3}, both L1 I1 (t_SizeLength) -> both L2 I2 ('bool) -> both L3 I3 (v_R) -> both (L1 :|: L2 :|: L3 :|: f_deserial_ctx_loc) (I1 :|: I2 :|: I3) ((t_Result (v_Self) (t_ParseError) × v_R)) ; -}. -Hint Unfold f_deserial_ctx_loc. diff --git a/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types.v b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types.v index 40bd0e8..ca4ab12 100644 --- a/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types.v +++ b/concordium/proofs/ssprove/extraction/Hacspec_concordium_Concordium_types.v @@ -24,33 +24,55 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Definition t_ContractState : choice_type := - (int32). -Equations f_current_contract_state_position {L : {fset Location}} {I : Interface} (s : both L I (t_ContractState)) : both L I (int32) := - f_current_contract_state_position s := - bind_both s (fun x => - solve_lift (ret_both (x : int32))) : both L I (int32). +Definition t_LogError : choice_type := + ('unit ∐ 'unit). +Notation "'LogError_Full_case'" := (inl tt) (at level 100). +Equations LogError_Full {L : {fset Location}} {I : Interface} : both L I (t_LogError) := + LogError_Full := + solve_lift (ret_both (inl (tt : 'unit) : t_LogError)) : both L I (t_LogError). Fail Next Obligation. -Equations Build_t_ContractState {L0 : {fset Location}} {I0 : Interface} {f_current_contract_state_position : both L0 I0 (int32)} : both L0 I0 (t_ContractState) := - Build_t_ContractState := - bind_both f_current_contract_state_position (fun f_current_contract_state_position => - solve_lift (ret_both ((f_current_contract_state_position) : (t_ContractState)))) : both L0 I0 (t_ContractState). +Notation "'LogError_Malformed_case'" := (inr tt) (at level 100). +Equations LogError_Malformed {L : {fset Location}} {I : Interface} : both L I (t_LogError) := + LogError_Malformed := + solve_lift (ret_both (inr (tt : 'unit) : t_LogError)) : both L I (t_LogError). Fail Next Obligation. -Notation "'Build_t_ContractState' '[' x ']' '(' 'f_current_contract_state_position' ':=' y ')'" := (Build_t_ContractState (f_current_contract_state_position := y)). -Definition t_Parameter : choice_type := +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) + +Definition t_Action : choice_type := (int32). -Equations f_current_parameter_position {L : {fset Location}} {I : Interface} (s : both L I (t_Parameter)) : both L I (int32) := - f_current_parameter_position s := +Equations f__private_action {L : {fset Location}} {I : Interface} (s : both L I (t_Action)) : both L I (int32) := + f__private_action s := bind_both s (fun x => solve_lift (ret_both (x : int32))) : both L I (int32). Fail Next Obligation. -Equations Build_t_Parameter {L0 : {fset Location}} {I0 : Interface} {f_current_parameter_position : both L0 I0 (int32)} : both L0 I0 (t_Parameter) := - Build_t_Parameter := - bind_both f_current_parameter_position (fun f_current_parameter_position => - solve_lift (ret_both ((f_current_parameter_position) : (t_Parameter)))) : both L0 I0 (t_Parameter). +Equations Build_t_Action {L0 : {fset Location}} {I0 : Interface} {f__private_action : both L0 I0 (int32)} : both L0 I0 (t_Action) := + Build_t_Action := + bind_both f__private_action (fun f__private_action => + solve_lift (ret_both ((f__private_action) : (t_Action)))) : both L0 I0 (t_Action). +Fail Next Obligation. +Notation "'Build_t_Action' '[' x ']' '(' 'f__private_action' ':=' y ')'" := (Build_t_Action (f__private_action := y)). + +Equations impl__Action__tag {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Action)) : both L1 I1 (int32) := + impl__Action__tag self := + solve_lift (f__private_action self) : both L1 I1 (int32). Fail Next Obligation. -Notation "'Build_t_Parameter' '[' x ']' '(' 'f_current_parameter_position' ':=' y ')'" := (Build_t_Parameter (f_current_parameter_position := y)). Definition t_AttributesCursor : choice_type := (int32 × int16). @@ -73,6 +95,48 @@ Fail Next Obligation. Notation "'Build_t_AttributesCursor' '[' x ']' '(' 'f_current_attribute_cursor_position' ':=' y ')'" := (Build_t_AttributesCursor (f_current_attribute_cursor_position := y) (f_remaining_items := f_remaining_items x)). Notation "'Build_t_AttributesCursor' '[' x ']' '(' 'f_remaining_items' ':=' y ')'" := (Build_t_AttributesCursor (f_current_attribute_cursor_position := f_current_attribute_cursor_position x) (f_remaining_items := y)). +Definition t_ChainMetaExtern : choice_type := + 'unit. +Equations Build_t_ChainMetaExtern : both (fset []) (fset []) (t_ChainMetaExtern) := + Build_t_ChainMetaExtern := + solve_lift (ret_both (tt (* Empty tuple *) : (t_ChainMetaExtern))) : both (fset []) (fset []) (t_ChainMetaExtern). +Fail Next Obligation. + +Definition t_ContractState : choice_type := + (int32). +Equations f_current_contract_state_position {L : {fset Location}} {I : Interface} (s : both L I (t_ContractState)) : both L I (int32) := + f_current_contract_state_position s := + bind_both s (fun x => + solve_lift (ret_both (x : int32))) : both L I (int32). +Fail Next Obligation. +Equations Build_t_ContractState {L0 : {fset Location}} {I0 : Interface} {f_current_contract_state_position : both L0 I0 (int32)} : both L0 I0 (t_ContractState) := + Build_t_ContractState := + bind_both f_current_contract_state_position (fun f_current_contract_state_position => + solve_lift (ret_both ((f_current_contract_state_position) : (t_ContractState)))) : both L0 I0 (t_ContractState). +Fail Next Obligation. +Notation "'Build_t_ContractState' '[' x ']' '(' 'f_current_contract_state_position' ':=' y ')'" := (Build_t_ContractState (f_current_contract_state_position := y)). + +Definition t_ExternContext {v_T : _} `{ t_Sized (v_T)} `{ t_ContextType (v_T)} : choice_type := + (t_PhantomData (v_T)). +Equations f_marker {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_ContextType (v_T)} (s : both L I (t_ExternContext)) : both L I (t_PhantomData (v_T)) := + f_marker s := + bind_both s (fun x => + solve_lift (ret_both (x : t_PhantomData (v_T)))) : both L I (t_PhantomData (v_T)). +Fail Next Obligation. +Equations Build_t_ExternContext {L0 : {fset Location}} {I0 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_ContextType (v_T)} {f_marker : both L0 I0 (t_PhantomData (v_T))} : both L0 I0 (t_ExternContext) := + Build_t_ExternContext := + bind_both f_marker (fun f_marker => + solve_lift (ret_both ((f_marker) : (t_ExternContext)))) : both L0 I0 (t_ExternContext). +Fail Next Obligation. +Notation "'Build_t_ExternContext' '[' x ']' '(' 'f_marker' ':=' y ')'" := (Build_t_ExternContext (f_marker := y)). + +Definition t_InitContextExtern : choice_type := + 'unit. +Equations Build_t_InitContextExtern : both (fset []) (fset []) (t_InitContextExtern) := + Build_t_InitContextExtern := + solve_lift (ret_both (tt (* Empty tuple *) : (t_InitContextExtern))) : both (fset []) (fset []) (t_InitContextExtern). +Fail Next Obligation. + Definition t_Logger : choice_type := ('unit). Equations f__private_logger {L : {fset Location}} {I : Interface} (s : both L I (t_Logger)) : both L I ('unit) := @@ -87,51 +151,32 @@ Equations Build_t_Logger {L0 : {fset Location}} {I0 : Interface} {f__private_log Fail Next Obligation. Notation "'Build_t_Logger' '[' x ']' '(' 'f__private_logger' ':=' y ')'" := (Build_t_Logger (f__private_logger := y)). -Definition t_LogError : choice_type := - chFin (mkpos 2). -Equations LogError_Full {L : {fset Location}} {I : Interface} : both L I t_LogError := - LogError_Full := - solve_lift ret_both (fintype.Ordinal (n:=2) (m:=0) eq_refl : t_LogError) : both L I t_LogError. -Fail Next Obligation. -Equations LogError_Malformed {L : {fset Location}} {I : Interface} : both L I t_LogError := - LogError_Malformed := - solve_lift ret_both (fintype.Ordinal (n:=2) (m:=1) eq_refl : t_LogError) : both L I t_LogError. -Fail Next Obligation. - Definition t_NotPayableError : choice_type := 'unit. Equations Build_t_NotPayableError : both (fset []) (fset []) (t_NotPayableError) := Build_t_NotPayableError := - solve_lift (ret_both ((_) : (t_NotPayableError))) : both (fset []) (fset []) (t_NotPayableError). + solve_lift (ret_both (tt (* Empty tuple *) : (t_NotPayableError))) : both (fset []) (fset []) (t_NotPayableError). Fail Next Obligation. -Definition t_Action : choice_type := +Definition t_Parameter : choice_type := (int32). -Equations f__private_action {L : {fset Location}} {I : Interface} (s : both L I (t_Action)) : both L I (int32) := - f__private_action s := +Equations f_current_parameter_position {L : {fset Location}} {I : Interface} (s : both L I (t_Parameter)) : both L I (int32) := + f_current_parameter_position s := bind_both s (fun x => solve_lift (ret_both (x : int32))) : both L I (int32). Fail Next Obligation. -Equations Build_t_Action {L0 : {fset Location}} {I0 : Interface} {f__private_action : both L0 I0 (int32)} : both L0 I0 (t_Action) := - Build_t_Action := - bind_both f__private_action (fun f__private_action => - solve_lift (ret_both ((f__private_action) : (t_Action)))) : both L0 I0 (t_Action). -Fail Next Obligation. -Notation "'Build_t_Action' '[' x ']' '(' 'f__private_action' ':=' y ')'" := (Build_t_Action (f__private_action := y)). - -Equations tag {L1 : {fset Location}} {I1 : Interface} (self : both L1 I1 (t_Action)) : both L1 I1 (int32) := - tag self := - solve_lift (f__private_action self) : both L1 I1 (int32). -Fail Next Obligation. - -Equations v____ {L : {fset Location}} {I : Interface} : both L I ('unit) := - v____ := - solve_lift (ret_both (tt : 'unit)) : both L I ('unit). +Equations Build_t_Parameter {L0 : {fset Location}} {I0 : Interface} {f_current_parameter_position : both L0 I0 (int32)} : both L0 I0 (t_Parameter) := + Build_t_Parameter := + bind_both f_current_parameter_position (fun f_current_parameter_position => + solve_lift (ret_both ((f_current_parameter_position) : (t_Parameter)))) : both L0 I0 (t_Parameter). Fail Next Obligation. +Notation "'Build_t_Parameter' '[' x ']' '(' 'f_current_parameter_position' ':=' y ')'" := (Build_t_Parameter (f_current_parameter_position := y)). -Equations v______refinement {L1 : {fset Location}} {I1 : Interface} (error_code : both L1 I1 (t_NonZeroI32)) : both L1 I1 ('bool) := - v______refinement error_code := - solve_lift (ret_both (true : 'bool)) : both L1 I1 ('bool). +Definition t_ReceiveContextExtern : choice_type := + 'unit. +Equations Build_t_ReceiveContextExtern : both (fset []) (fset []) (t_ReceiveContextExtern) := + Build_t_ReceiveContextExtern := + solve_lift (ret_both (tt (* Empty tuple *) : (t_ReceiveContextExtern))) : both (fset []) (fset []) (t_ReceiveContextExtern). Fail Next Obligation. Definition t_Reject : choice_type := @@ -148,66 +193,8 @@ Equations Build_t_Reject {L0 : {fset Location}} {I0 : Interface} {f_error_code : Fail Next Obligation. Notation "'Build_t_Reject' '[' x ']' '(' 'f_error_code' ':=' y ')'" := (Build_t_Reject (f_error_code := y)). -#[global] Program Instance t_Reject_t_Default : t_Default t_Reject := - _. -Fail Next Obligation. -Hint Unfold t_Reject_t_Default. - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -Definition t_ReceiveResult {v_A : _} `{ t_Sized (v_A)} : choice_type := - t_Result (v_A) (t_Reject). - Definition t_InitResult {v_S : _} `{ t_Sized (v_S)} : choice_type := t_Result (v_S) (t_Reject). -(*Not implemented yet? todo(item)*) - -Definition t_ExternContext {v_T : _} `{ t_Sized (v_T)} `{ t_ContextType (v_T)} : choice_type := - (t_PhantomData (v_T)). -Equations f_marker {L : {fset Location}} {I : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_ContextType (v_T)} (s : both L I (t_ExternContext)) : both L I (t_PhantomData (v_T)) := - f_marker s := - bind_both s (fun x => - solve_lift (ret_both (x : t_PhantomData (v_T)))) : both L I (t_PhantomData (v_T)). -Fail Next Obligation. -Equations Build_t_ExternContext {L0 : {fset Location}} {I0 : Interface} {v_T : _} `{ t_Sized (v_T)} `{ t_ContextType (v_T)} {f_marker : both L0 I0 (t_PhantomData (v_T))} : both L0 I0 (t_ExternContext) := - Build_t_ExternContext := - bind_both f_marker (fun f_marker => - solve_lift (ret_both ((f_marker) : (t_ExternContext)))) : both L0 I0 (t_ExternContext). -Fail Next Obligation. -Notation "'Build_t_ExternContext' '[' x ']' '(' 'f_marker' ':=' y ')'" := (Build_t_ExternContext (f_marker := y)). - -Definition t_ChainMetaExtern : choice_type := - 'unit. -Equations Build_t_ChainMetaExtern : both (fset []) (fset []) (t_ChainMetaExtern) := - Build_t_ChainMetaExtern := - solve_lift (ret_both ((_) : (t_ChainMetaExtern))) : both (fset []) (fset []) (t_ChainMetaExtern). -Fail Next Obligation. - -Definition t_InitContextExtern : choice_type := - 'unit. -Equations Build_t_InitContextExtern : both (fset []) (fset []) (t_InitContextExtern) := - Build_t_InitContextExtern := - solve_lift (ret_both ((_) : (t_InitContextExtern))) : both (fset []) (fset []) (t_InitContextExtern). -Fail Next Obligation. - -Definition t_ReceiveContextExtern : choice_type := - 'unit. -Equations Build_t_ReceiveContextExtern : both (fset []) (fset []) (t_ReceiveContextExtern) := - Build_t_ReceiveContextExtern := - solve_lift (ret_both ((_) : (t_ReceiveContextExtern))) : both (fset []) (fset []) (t_ReceiveContextExtern). -Fail Next Obligation. +Definition t_ReceiveResult {v_A : _} `{ t_Sized (v_A)} : choice_type := + t_Result (v_A) (t_Reject). diff --git a/concordium/proofs/ssprove/extraction/Makefile b/concordium/proofs/ssprove/extraction/Makefile new file mode 100644 index 0000000..42626b6 --- /dev/null +++ b/concordium/proofs/ssprove/extraction/Makefile @@ -0,0 +1,989 @@ +########################################################################## +## # The Coq Proof Assistant / The Coq Development Team ## +## v # Copyright INRIA, CNRS and contributors ## +## /dev/null 2>/dev/null; echo $$?)) +STDTIME?=command time -f $(TIMEFMT) +else +ifeq (0,$(shell gtime -f "" true >/dev/null 2>/dev/null; echo $$?)) +STDTIME?=gtime -f $(TIMEFMT) +else +STDTIME?=command time +endif +endif +else +STDTIME?=command time -f $(TIMEFMT) +endif + +COQBIN?= +ifneq (,$(COQBIN)) +# add an ending / +COQBIN:=$(COQBIN)/ +endif + +# Coq binaries +COQC ?= "$(COQBIN)coqc" +COQTOP ?= "$(COQBIN)coqtop" +COQCHK ?= "$(COQBIN)coqchk" +COQNATIVE ?= "$(COQBIN)coqnative" +COQDEP ?= "$(COQBIN)coqdep" +COQDOC ?= "$(COQBIN)coqdoc" +COQPP ?= "$(COQBIN)coqpp" +COQMKFILE ?= "$(COQBIN)coq_makefile" +OCAMLLIBDEP ?= "$(COQBIN)ocamllibdep" + +# Timing scripts +COQMAKE_ONE_TIME_FILE ?= "$(COQCORELIB)/tools/make-one-time-file.py" +COQMAKE_BOTH_TIME_FILES ?= "$(COQCORELIB)/tools/make-both-time-files.py" +COQMAKE_BOTH_SINGLE_TIMING_FILES ?= "$(COQCORELIB)/tools/make-both-single-timing-files.py" +BEFORE ?= +AFTER ?= + +# OCaml binaries +CAMLC ?= "$(OCAMLFIND)" ocamlc -c +CAMLOPTC ?= "$(OCAMLFIND)" opt -c +CAMLLINK ?= "$(OCAMLFIND)" ocamlc -linkall +CAMLOPTLINK ?= "$(OCAMLFIND)" opt -linkall +CAMLDOC ?= "$(OCAMLFIND)" ocamldoc +CAMLDEP ?= "$(OCAMLFIND)" ocamldep -slash -ml-synonym .mlpack + +# DESTDIR is prepended to all installation paths +DESTDIR ?= + +# Debug builds, typically -g to OCaml, -debug to Coq. +CAMLDEBUG ?= +COQDEBUG ?= + +# Extra packages to be linked in (as in findlib -package) +CAMLPKGS ?= +FINDLIBPKGS = -package coq-core.plugins.ltac $(CAMLPKGS) + +# Option for making timing files +TIMING?= +# Option for changing sorting of timing output file +TIMING_SORT_BY ?= auto +# Option for changing the fuzz parameter on the output file +TIMING_FUZZ ?= 0 +# Option for changing whether to use real or user time for timing tables +TIMING_REAL?= +# Option for including the memory column(s) +TIMING_INCLUDE_MEM?= +# Option for sorting by the memory column +TIMING_SORT_BY_MEM?= +# Output file names for timed builds +TIME_OF_BUILD_FILE ?= time-of-build.log +TIME_OF_BUILD_BEFORE_FILE ?= time-of-build-before.log +TIME_OF_BUILD_AFTER_FILE ?= time-of-build-after.log +TIME_OF_PRETTY_BUILD_FILE ?= time-of-build-pretty.log +TIME_OF_PRETTY_BOTH_BUILD_FILE ?= time-of-build-both.log +TIME_OF_PRETTY_BUILD_EXTRA_FILES ?= - # also output to the command line + +TGTS ?= + +# Retro compatibility (DESTDIR is standard on Unix, DSTROOT is not) +ifdef DSTROOT +DESTDIR := $(DSTROOT) +endif + +# Substitution of the path by appending $(DESTDIR) if needed. +# The variable $(COQMF_WINDRIVE) can be needed for Cygwin environments. +windrive_path = $(if $(COQMF_WINDRIVE),$(subst $(COQMF_WINDRIVE),/,$(1)),$(1)) +destination_path = $(if $(DESTDIR),$(DESTDIR)/$(call windrive_path,$(1)),$(1)) + +# Installation paths of libraries and documentation. +COQLIBINSTALL ?= $(call destination_path,$(COQLIB)/user-contrib) +COQDOCINSTALL ?= $(call destination_path,$(DOCDIR)/coq/user-contrib) +COQPLUGININSTALL ?= $(call destination_path,$(COQCORELIB)/..) +COQTOPINSTALL ?= $(call destination_path,$(COQLIB)/toploop) # FIXME: Unused variable? + +# findlib files installation +FINDLIBPREINST= mkdir -p "$(COQPLUGININSTALL)/" +FINDLIBDESTDIR= -destdir "$(COQPLUGININSTALL)/" + +# we need to move out of sight $(METAFILE) otherwise findlib thinks the +# package is already installed +findlib_install = \ + $(HIDE)if [ "$(METAFILE)" ]; then \ + $(FINDLIBPREINST) && \ + mv "$(METAFILE)" "$(METAFILE).skip" ; \ + "$(OCAMLFIND)" install $(2) $(FINDLIBDESTDIR) $(FINDLIBPACKAGE) $(1); \ + rc=$$?; \ + mv "$(METAFILE).skip" "$(METAFILE)"; \ + exit $$rc; \ + fi +findlib_remove = \ + $(HIDE)if [ ! -z "$(METAFILE)" ]; then\ + "$(OCAMLFIND)" remove $(FINDLIBDESTDIR) $(FINDLIBPACKAGE); \ + fi + + +########## End of parameters ################################################## +# What follows may be relevant to you only if you need to +# extend this Makefile. If so, look for 'Extension point' here and +# put in Makefile.local double colon rules accordingly. +# E.g. to perform some work after the all target completes you can write +# +# post-all:: +# echo "All done!" +# +# in Makefile.local +# +############################################################################### + + + + +# Flags ####################################################################### +# +# We define a bunch of variables combining the parameters. +# To add additional flags to coq, coqchk or coqdoc, set the +# {COQ,COQCHK,COQDOC}EXTRAFLAGS variable to whatever you want to add. +# To overwrite the default choice and set your own flags entirely, set the +# {COQ,COQCHK,COQDOC}FLAGS variable. + +SHOW := $(if $(VERBOSE),@true "",@echo "") +HIDE := $(if $(VERBOSE),,@) + +TIMER=$(if $(TIMED), $(STDTIME), $(TIMECMD)) + +OPT?= + +# The DYNOBJ and DYNLIB variables are used by "coqdep -dyndep var" in .v.d +ifeq '$(OPT)' '-byte' +USEBYTE:=true +DYNOBJ:=.cma +DYNLIB:=.cma +else +USEBYTE:= +DYNOBJ:=.cmxs +DYNLIB:=.cmxs +endif + +# these variables are meant to be overridden if you want to add *extra* flags +COQEXTRAFLAGS?= +COQCHKEXTRAFLAGS?= +COQDOCEXTRAFLAGS?= + +# Find the last argument of the form "-native-compiler FLAG" +COQUSERNATIVEFLAG:=$(strip \ +$(subst -native-compiler-,,\ +$(lastword \ +$(filter -native-compiler-%,\ +$(subst -native-compiler ,-native-compiler-,\ +$(strip $(COQEXTRAFLAGS))))))) + +COQFILTEREDEXTRAFLAGS:=$(strip \ +$(filter-out -native-compiler-%,\ +$(subst -native-compiler ,-native-compiler-,\ +$(strip $(COQEXTRAFLAGS))))) + +COQACTUALNATIVEFLAG:=$(lastword $(COQMF_COQ_NATIVE_COMPILER_DEFAULT) $(COQMF_COQPROJECTNATIVEFLAG) $(COQUSERNATIVEFLAG)) + +ifeq '$(COQACTUALNATIVEFLAG)' 'yes' + COQNATIVEFLAG="-w" "-deprecated-native-compiler-option" "-native-compiler" "ondemand" + COQDONATIVE="yes" +else +ifeq '$(COQACTUALNATIVEFLAG)' 'ondemand' + COQNATIVEFLAG="-w" "-deprecated-native-compiler-option" "-native-compiler" "ondemand" + COQDONATIVE="no" +else + COQNATIVEFLAG="-w" "-deprecated-native-compiler-option" "-native-compiler" "no" + COQDONATIVE="no" +endif +endif + +# these flags do NOT contain the libraries, to make them easier to overwrite +COQFLAGS?=-q $(OTHERFLAGS) $(COQFILTEREDEXTRAFLAGS) $(COQNATIVEFLAG) +COQCHKFLAGS?=-silent -o $(COQCHKEXTRAFLAGS) +COQDOCFLAGS?=-interpolate -utf8 $(COQDOCEXTRAFLAGS) + +COQDOCLIBS?=$(COQLIBS_NOML) + +# The version of Coq being run and the version of coq_makefile that +# generated this makefile +COQ_VERSION:=$(shell $(COQC) --print-version | cut -d " " -f 1) +COQMAKEFILE_VERSION:=8.18.0 + +# COQ_SRC_SUBDIRS is for user-overriding, usually to add +# `user-contrib/Foo` to the includes, we keep COQCORE_SRC_SUBDIRS for +# Coq's own core libraries, which should be replaced by ocamlfind +# options at some point. +COQ_SRC_SUBDIRS?= +COQSRCLIBS?= $(foreach d,$(COQ_SRC_SUBDIRS), -I "$(COQLIB)/$(d)") + +CAMLFLAGS+=$(OCAMLLIBS) $(COQSRCLIBS) +# ocamldoc fails with unknown argument otherwise +CAMLDOCFLAGS:=$(filter-out -annot, $(filter-out -bin-annot, $(CAMLFLAGS))) +CAMLFLAGS+=$(OCAMLWARN) + +ifneq (,$(TIMING)) + ifeq (after,$(TIMING)) + TIMING_EXT=after-timing + else + ifeq (before,$(TIMING)) + TIMING_EXT=before-timing + else + TIMING_EXT=timing + endif + endif + TIMING_ARG=-time-file $<.$(TIMING_EXT) +else + TIMING_ARG= +endif + +# Files ####################################################################### +# +# We here define a bunch of variables about the files being part of the +# Coq project in order to ease the writing of build target and build rules + +VDFILE := .Makefile.d + +ALLSRCFILES := \ + $(MLGFILES) \ + $(MLFILES) \ + $(MLPACKFILES) \ + $(MLLIBFILES) \ + $(MLIFILES) + +# helpers +vo_to_obj = $(addsuffix .o,\ + $(filter-out Warning: Error:,\ + $(shell $(COQTOP) -q -noinit -batch -quiet -print-mod-uid $(1)))) +strip_dotslash = $(patsubst ./%,%,$(1)) + +# without this we get undefined variables in the expansion for the +# targets of the [deprecated,use-mllib-or-mlpack] rule +with_undef = $(if $(filter-out undefined, $(origin $(1))),$($(1))) + +VO = vo +VOS = vos + +VOFILES = $(VFILES:.v=.$(VO)) +GLOBFILES = $(VFILES:.v=.glob) +HTMLFILES = $(VFILES:.v=.html) +GHTMLFILES = $(VFILES:.v=.g.html) +BEAUTYFILES = $(addsuffix .beautified,$(VFILES)) +TEXFILES = $(VFILES:.v=.tex) +GTEXFILES = $(VFILES:.v=.g.tex) +CMOFILES = \ + $(MLGFILES:.mlg=.cmo) \ + $(MLFILES:.ml=.cmo) \ + $(MLPACKFILES:.mlpack=.cmo) +CMXFILES = $(CMOFILES:.cmo=.cmx) +OFILES = $(CMXFILES:.cmx=.o) +CMAFILES = $(MLLIBFILES:.mllib=.cma) $(MLPACKFILES:.mlpack=.cma) +CMXAFILES = $(CMAFILES:.cma=.cmxa) +CMIFILES = \ + $(CMOFILES:.cmo=.cmi) \ + $(MLIFILES:.mli=.cmi) +# the /if/ is because old _CoqProject did not list a .ml(pack|lib) but just +# a .mlg file +CMXSFILES = \ + $(MLPACKFILES:.mlpack=.cmxs) \ + $(CMXAFILES:.cmxa=.cmxs) \ + $(if $(MLPACKFILES)$(CMXAFILES),,\ + $(MLGFILES:.mlg=.cmxs) $(MLFILES:.ml=.cmxs)) + +# files that are packed into a plugin (no extension) +PACKEDFILES = \ + $(call strip_dotslash, \ + $(foreach lib, \ + $(call strip_dotslash, \ + $(MLPACKFILES:.mlpack=_MLPACK_DEPENDENCIES)),$(call with_undef,$(lib)))) +# files that are archived into a .cma (mllib) +LIBEDFILES = \ + $(call strip_dotslash, \ + $(foreach lib, \ + $(call strip_dotslash, \ + $(MLLIBFILES:.mllib=_MLLIB_DEPENDENCIES)),$(call with_undef,$(lib)))) +CMIFILESTOINSTALL = $(filter-out $(addsuffix .cmi,$(PACKEDFILES)),$(CMIFILES)) +CMOFILESTOINSTALL = $(filter-out $(addsuffix .cmo,$(PACKEDFILES)),$(CMOFILES)) +OBJFILES = $(call vo_to_obj,$(VOFILES)) +ALLNATIVEFILES = \ + $(OBJFILES:.o=.cmi) \ + $(OBJFILES:.o=.cmx) \ + $(OBJFILES:.o=.cmxs) +FINDLIBPACKAGE=$(patsubst .%,%,$(suffix $(METAFILE))) + +# trick: wildcard filters out non-existing files, so that `install` doesn't show +# warnings and `clean` doesn't pass to rm a list of files that is too long for +# the shell. +NATIVEFILES = $(wildcard $(ALLNATIVEFILES)) +FILESTOINSTALL = \ + $(VOFILES) \ + $(VFILES) \ + $(GLOBFILES) \ + $(NATIVEFILES) \ + $(CMXSFILES) # to be removed when we remove legacy loading +FINDLIBFILESTOINSTALL = \ + $(CMIFILESTOINSTALL) +ifeq '$(HASNATDYNLINK)' 'true' +DO_NATDYNLINK = yes +FINDLIBFILESTOINSTALL += $(CMXSFILES) $(CMXAFILES) $(CMOFILESTOINSTALL:.cmo=.cmx) +else +DO_NATDYNLINK = +endif + +ALLDFILES = $(addsuffix .d,$(ALLSRCFILES)) $(VDFILE) + +# Compilation targets ######################################################### + +all: + $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" pre-all + $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" real-all + $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" post-all +.PHONY: all + +all.timing.diff: + $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" pre-all + $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" real-all.timing.diff TIME_OF_PRETTY_BUILD_EXTRA_FILES="" + $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" post-all +.PHONY: all.timing.diff + +ifeq (0,$(TIMING_REAL)) +TIMING_REAL_ARG := +TIMING_USER_ARG := --user +else +ifeq (1,$(TIMING_REAL)) +TIMING_REAL_ARG := --real +TIMING_USER_ARG := +else +TIMING_REAL_ARG := +TIMING_USER_ARG := +endif +endif + +ifeq (0,$(TIMING_INCLUDE_MEM)) +TIMING_INCLUDE_MEM_ARG := --no-include-mem +else +TIMING_INCLUDE_MEM_ARG := +endif + +ifeq (1,$(TIMING_SORT_BY_MEM)) +TIMING_SORT_BY_MEM_ARG := --sort-by-mem +else +TIMING_SORT_BY_MEM_ARG := +endif + +make-pretty-timed-before:: TIME_OF_BUILD_FILE=$(TIME_OF_BUILD_BEFORE_FILE) +make-pretty-timed-after:: TIME_OF_BUILD_FILE=$(TIME_OF_BUILD_AFTER_FILE) +make-pretty-timed make-pretty-timed-before make-pretty-timed-after:: + $(HIDE)rm -f pretty-timed-success.ok + $(HIDE)($(MAKE) --no-print-directory -f "$(PARENT)" $(TGTS) TIMED=1 2>&1 && touch pretty-timed-success.ok) | tee -a $(TIME_OF_BUILD_FILE) + $(HIDE)rm pretty-timed-success.ok # must not be -f; must fail if the touch failed +print-pretty-timed:: + $(HIDE)$(COQMAKE_ONE_TIME_FILE) $(TIMING_INCLUDE_MEM_ARG) $(TIMING_SORT_BY_MEM_ARG) $(TIMING_REAL_ARG) $(TIME_OF_BUILD_FILE) $(TIME_OF_PRETTY_BUILD_FILE) $(TIME_OF_PRETTY_BUILD_EXTRA_FILES) +print-pretty-timed-diff:: + $(HIDE)$(COQMAKE_BOTH_TIME_FILES) --sort-by=$(TIMING_SORT_BY) $(TIMING_INCLUDE_MEM_ARG) $(TIMING_SORT_BY_MEM_ARG) $(TIMING_REAL_ARG) $(TIME_OF_BUILD_AFTER_FILE) $(TIME_OF_BUILD_BEFORE_FILE) $(TIME_OF_PRETTY_BOTH_BUILD_FILE) $(TIME_OF_PRETTY_BUILD_EXTRA_FILES) +ifeq (,$(BEFORE)) +print-pretty-single-time-diff:: + @echo 'Error: Usage: $(MAKE) print-pretty-single-time-diff AFTER=path/to/file.v.after-timing BEFORE=path/to/file.v.before-timing' + $(HIDE)false +else +ifeq (,$(AFTER)) +print-pretty-single-time-diff:: + @echo 'Error: Usage: $(MAKE) print-pretty-single-time-diff AFTER=path/to/file.v.after-timing BEFORE=path/to/file.v.before-timing' + $(HIDE)false +else +print-pretty-single-time-diff:: + $(HIDE)$(COQMAKE_BOTH_SINGLE_TIMING_FILES) --fuzz=$(TIMING_FUZZ) --sort-by=$(TIMING_SORT_BY) $(TIMING_USER_ARG) $(AFTER) $(BEFORE) $(TIME_OF_PRETTY_BUILD_FILE) $(TIME_OF_PRETTY_BUILD_EXTRA_FILES) +endif +endif +pretty-timed: + $(HIDE)$(MAKE) --no-print-directory -f "$(PARENT)" make-pretty-timed + $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" print-pretty-timed +.PHONY: pretty-timed make-pretty-timed make-pretty-timed-before make-pretty-timed-after print-pretty-timed print-pretty-timed-diff print-pretty-single-time-diff + +# Extension points for actions to be performed before/after the all target +pre-all:: + @# Extension point + $(HIDE)if [ "$(COQMAKEFILE_VERSION)" != "$(COQ_VERSION)" ]; then\ + echo "W: This Makefile was generated by Coq $(COQMAKEFILE_VERSION)";\ + echo "W: while the current Coq version is $(COQ_VERSION)";\ + fi +.PHONY: pre-all + +post-all:: + @# Extension point +.PHONY: post-all + +real-all: $(VOFILES) $(if $(USEBYTE),bytefiles,optfiles) +.PHONY: real-all + +real-all.timing.diff: $(VOFILES:.vo=.v.timing.diff) +.PHONY: real-all.timing.diff + +bytefiles: $(CMOFILES) $(CMAFILES) +.PHONY: bytefiles + +optfiles: $(if $(DO_NATDYNLINK),$(CMXSFILES)) +.PHONY: optfiles + +# FIXME, see Ralf's bugreport +# quick is deprecated, now renamed vio +vio: $(VOFILES:.vo=.vio) +.PHONY: vio +quick: vio + $(warning "'make quick' is deprecated, use 'make vio' or consider using 'vos' files") +.PHONY: quick + +vio2vo: + $(TIMER) $(COQC) $(COQDEBUG) $(COQFLAGS) $(COQLIBS) \ + -schedule-vio2vo $(J) $(VOFILES:%.vo=%.vio) +.PHONY: vio2vo + +# quick2vo is undocumented +quick2vo: + $(HIDE)make -j $(J) vio + $(HIDE)VIOFILES=$$(for vofile in $(VOFILES); do \ + viofile="$$(echo "$$vofile" | sed "s/\.vo$$/.vio/")"; \ + if [ "$$vofile" -ot "$$viofile" -o ! -e "$$vofile" ]; then printf "$$viofile "; fi; \ + done); \ + echo "VIO2VO: $$VIOFILES"; \ + if [ -n "$$VIOFILES" ]; then \ + $(TIMER) $(COQC) $(COQDEBUG) $(COQFLAGS) $(COQLIBS) -schedule-vio2vo $(J) $$VIOFILES; \ + fi +.PHONY: quick2vo + +checkproofs: + $(TIMER) $(COQC) $(COQDEBUG) $(COQFLAGS) $(COQLIBS) \ + -schedule-vio-checking $(J) $(VOFILES:%.vo=%.vio) +.PHONY: checkproofs + +vos: $(VOFILES:%.vo=%.vos) +.PHONY: vos + +vok: $(VOFILES:%.vo=%.vok) +.PHONY: vok + +validate: $(VOFILES) + $(TIMER) $(COQCHK) $(COQCHKFLAGS) $(COQLIBS_NOML) $^ +.PHONY: validate + +only: $(TGTS) +.PHONY: only + +# Documentation targets ####################################################### + +html: $(GLOBFILES) $(VFILES) + $(SHOW)'COQDOC -d html $(GAL)' + $(HIDE)mkdir -p html + $(HIDE)$(COQDOC) \ + -toc $(COQDOCFLAGS) -html $(GAL) $(COQDOCLIBS) -d html $(VFILES) + +mlihtml: $(MLIFILES:.mli=.cmi) + $(SHOW)'CAMLDOC -d $@' + $(HIDE)mkdir $@ || rm -rf $@/* + $(HIDE)$(CAMLDOC) -html \ + -d $@ -m A $(CAMLDEBUG) $(CAMLDOCFLAGS) $(MLIFILES) $(FINDLIBPKGS) + +all-mli.tex: $(MLIFILES:.mli=.cmi) + $(SHOW)'CAMLDOC -latex $@' + $(HIDE)$(CAMLDOC) -latex \ + -o $@ -m A $(CAMLDEBUG) $(CAMLDOCFLAGS) $(MLIFILES) $(FINDLIBPKGS) + +all.ps: $(VFILES) + $(SHOW)'COQDOC -ps $(GAL)' + $(HIDE)$(COQDOC) \ + -toc $(COQDOCFLAGS) -ps $(GAL) $(COQDOCLIBS) \ + -o $@ `$(COQDEP) -sort $(VFILES)` + +all.pdf: $(VFILES) + $(SHOW)'COQDOC -pdf $(GAL)' + $(HIDE)$(COQDOC) \ + -toc $(COQDOCFLAGS) -pdf $(GAL) $(COQDOCLIBS) \ + -o $@ `$(COQDEP) -sort $(VFILES)` + +# FIXME: not quite right, since the output name is different +gallinahtml: GAL=-g +gallinahtml: html + +all-gal.ps: GAL=-g +all-gal.ps: all.ps + +all-gal.pdf: GAL=-g +all-gal.pdf: all.pdf + +# ? +beautify: $(BEAUTYFILES) + for file in $^; do mv $${file%.beautified} $${file%beautified}old && mv $${file} $${file%.beautified}; done + @echo 'Do not do "make clean" until you are sure that everything went well!' + @echo 'If there were a problem, execute "for file in $$(find . -name \*.v.old -print); do mv $${file} $${file%.old}; done" in your shell/' +.PHONY: beautify + +# Installation targets ######################################################## +# +# There rules can be extended in Makefile.local +# Extensions can't assume when they run. + +# We use $(file) to avoid generating a very long command string to pass to the shell +# (cf https://coq.zulipchat.com/#narrow/stream/250632-Coq-Platform-devs-.26-users/topic/Strange.20command.20length.20limit.20on.20Linux) +# However Apple ships old make which doesn't have $(file) so we need a fallback +$(file >.hasfile,1) +HASFILE:=$(shell if [ -e .hasfile ]; then echo 1; rm .hasfile; fi) + +MKFILESTOINSTALL= $(if $(HASFILE),$(file >.filestoinstall,$(FILESTOINSTALL)),\ + $(shell rm -f .filestoinstall) \ + $(foreach x,$(FILESTOINSTALL),$(shell printf '%s\n' "$x" >> .filestoinstall))) + +# findlib needs the package to not be installed, so we remove it before +# installing it (see the call to findlib_remove) +install: META + @$(MKFILESTOINSTALL) + $(HIDE)code=0; for f in $$(cat .filestoinstall); do\ + if ! [ -f "$$f" ]; then >&2 echo $$f does not exist; code=1; fi \ + done; exit $$code + $(HIDE)for f in $$(cat .filestoinstall); do\ + df="`$(COQMKFILE) -destination-of "$$f" $(COQLIBS)`";\ + if [ "$$?" != "0" -o -z "$$df" ]; then\ + echo SKIP "$$f" since it has no logical path;\ + else\ + install -d "$(COQLIBINSTALL)/$$df" &&\ + install -m 0644 "$$f" "$(COQLIBINSTALL)/$$df" &&\ + echo INSTALL "$$f" "$(COQLIBINSTALL)/$$df";\ + fi;\ + done + $(call findlib_remove) + $(call findlib_install, META $(FINDLIBFILESTOINSTALL)) + $(HIDE)$(MAKE) install-extra -f "$(SELF)" + @rm -f .filestoinstall +install-extra:: + @# Extension point +.PHONY: install install-extra + +META: $(METAFILE) + $(HIDE)if [ "$(METAFILE)" ]; then \ + cat "$(METAFILE)" | grep -v 'directory.*=.*' > META; \ + fi + +install-byte: + $(call findlib_install, $(CMAFILES) $(CMOFILESTOINSTALL), -add) + +install-doc:: html mlihtml + @# Extension point + $(HIDE)install -d "$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/html" + $(HIDE)for i in html/*; do \ + dest="$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/$$i";\ + install -m 0644 "$$i" "$$dest";\ + echo INSTALL "$$i" "$$dest";\ + done + $(HIDE)install -d \ + "$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/mlihtml" + $(HIDE)for i in mlihtml/*; do \ + dest="$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/$$i";\ + install -m 0644 "$$i" "$$dest";\ + echo INSTALL "$$i" "$$dest";\ + done +.PHONY: install-doc + +uninstall:: + @# Extension point + @$(MKFILESTOINSTALL) + $(call findlib_remove) + $(HIDE)for f in $$(cat .filestoinstall); do \ + df="`$(COQMKFILE) -destination-of "$$f" $(COQLIBS)`" &&\ + instf="$(COQLIBINSTALL)/$$df/`basename $$f`" &&\ + rm -f "$$instf" &&\ + echo RM "$$instf" ;\ + done + $(HIDE)for f in $$(cat .filestoinstall); do \ + df="`$(COQMKFILE) -destination-of "$$f" $(COQLIBS)`" &&\ + echo RMDIR "$(COQLIBINSTALL)/$$df/" &&\ + (rmdir "$(COQLIBINSTALL)/$$df/" 2>/dev/null || true); \ + done + @rm -f .filestoinstall + +.PHONY: uninstall + +uninstall-doc:: + @# Extension point + $(SHOW)'RM $(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/html' + $(HIDE)rm -rf "$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/html" + $(SHOW)'RM $(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/mlihtml' + $(HIDE)rm -rf "$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/mlihtml" + $(HIDE) rmdir "$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/" || true +.PHONY: uninstall-doc + +# Cleaning #################################################################### +# +# There rules can be extended in Makefile.local +# Extensions can't assume when they run. + +clean:: + @# Extension point + $(SHOW)'CLEAN' + $(HIDE)rm -f $(CMOFILES) + $(HIDE)rm -f $(CMIFILES) + $(HIDE)rm -f $(CMAFILES) + $(HIDE)rm -f $(CMXFILES) + $(HIDE)rm -f $(CMXAFILES) + $(HIDE)rm -f $(CMXSFILES) + $(HIDE)rm -f $(OFILES) + $(HIDE)rm -f $(CMXAFILES:.cmxa=.a) + $(HIDE)rm -f $(MLGFILES:.mlg=.ml) + $(HIDE)rm -f $(CMXFILES:.cmx=.cmt) + $(HIDE)rm -f $(MLIFILES:.mli=.cmti) + $(HIDE)rm -f $(ALLDFILES) + $(HIDE)rm -f $(NATIVEFILES) + $(HIDE)find . -name .coq-native -type d -empty -delete + $(HIDE)rm -f $(VOFILES) + $(HIDE)rm -f $(VOFILES:.vo=.vio) + $(HIDE)rm -f $(VOFILES:.vo=.vos) + $(HIDE)rm -f $(VOFILES:.vo=.vok) + $(HIDE)rm -f $(BEAUTYFILES) $(VFILES:=.old) + $(HIDE)rm -f all.ps all-gal.ps all.pdf all-gal.pdf all.glob all-mli.tex + $(HIDE)rm -f $(VFILES:.v=.glob) + $(HIDE)rm -f $(VFILES:.v=.tex) + $(HIDE)rm -f $(VFILES:.v=.g.tex) + $(HIDE)rm -f pretty-timed-success.ok + $(HIDE)rm -f META + $(HIDE)rm -rf html mlihtml +.PHONY: clean + +cleanall:: clean + @# Extension point + $(SHOW)'CLEAN *.aux *.timing' + $(HIDE)rm -f $(foreach f,$(VFILES:.v=),$(dir $(f)).$(notdir $(f)).aux) + $(HIDE)rm -f $(TIME_OF_BUILD_FILE) $(TIME_OF_BUILD_BEFORE_FILE) $(TIME_OF_BUILD_AFTER_FILE) $(TIME_OF_PRETTY_BUILD_FILE) $(TIME_OF_PRETTY_BOTH_BUILD_FILE) + $(HIDE)rm -f $(VOFILES:.vo=.v.timing) + $(HIDE)rm -f $(VOFILES:.vo=.v.before-timing) + $(HIDE)rm -f $(VOFILES:.vo=.v.after-timing) + $(HIDE)rm -f $(VOFILES:.vo=.v.timing.diff) + $(HIDE)rm -f .lia.cache .nia.cache +.PHONY: cleanall + +archclean:: + @# Extension point + $(SHOW)'CLEAN *.cmx *.o' + $(HIDE)rm -f $(NATIVEFILES) + $(HIDE)rm -f $(CMOFILES:%.cmo=%.cmx) +.PHONY: archclean + + +# Compilation rules ########################################################### + +$(MLIFILES:.mli=.cmi): %.cmi: %.mli + $(SHOW)'CAMLC -c $<' + $(HIDE)$(TIMER) $(CAMLC) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) $< + +$(MLGFILES:.mlg=.ml): %.ml: %.mlg + $(SHOW)'COQPP $<' + $(HIDE)$(COQPP) $< + +# Stupid hack around a deficient syntax: we cannot concatenate two expansions +$(filter %.cmo, $(MLFILES:.ml=.cmo) $(MLGFILES:.mlg=.cmo)): %.cmo: %.ml + $(SHOW)'CAMLC -c $<' + $(HIDE)$(TIMER) $(CAMLC) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) $< + +# Same hack +$(filter %.cmx, $(MLFILES:.ml=.cmx) $(MLGFILES:.mlg=.cmx)): %.cmx: %.ml + $(SHOW)'CAMLOPT -c $(FOR_PACK) $<' + $(HIDE)$(TIMER) $(CAMLOPTC) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) $(FOR_PACK) $< + + +$(MLLIBFILES:.mllib=.cmxs): %.cmxs: %.cmxa + $(SHOW)'CAMLOPT -shared -o $@' + $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) \ + -shared -o $@ $< + +$(MLLIBFILES:.mllib=.cma): %.cma: | %.mllib + $(SHOW)'CAMLC -a -o $@' + $(HIDE)$(TIMER) $(CAMLLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) -a -o $@ $^ + +$(MLLIBFILES:.mllib=.cmxa): %.cmxa: | %.mllib + $(SHOW)'CAMLOPT -a -o $@' + $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) -a -o $@ $^ + + +$(MLPACKFILES:.mlpack=.cmxs): %.cmxs: %.cmxa + $(SHOW)'CAMLOPT -shared -o $@' + $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) \ + -shared -o $@ $< + +$(MLPACKFILES:.mlpack=.cmxa): %.cmxa: %.cmx | %.mlpack + $(SHOW)'CAMLOPT -a -o $@' + $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) -a -o $@ $< + +$(MLPACKFILES:.mlpack=.cma): %.cma: %.cmo | %.mlpack + $(SHOW)'CAMLC -a -o $@' + $(HIDE)$(TIMER) $(CAMLLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) -a -o $@ $^ + +$(MLPACKFILES:.mlpack=.cmo): %.cmo: | %.mlpack + $(SHOW)'CAMLC -pack -o $@' + $(HIDE)$(TIMER) $(CAMLLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) -pack -o $@ $^ + +$(MLPACKFILES:.mlpack=.cmx): %.cmx: | %.mlpack + $(SHOW)'CAMLOPT -pack -o $@' + $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) -pack -o $@ $^ + +# This rule is for _CoqProject with no .mllib nor .mlpack +$(filter-out $(MLLIBFILES:.mllib=.cmxs) $(MLPACKFILES:.mlpack=.cmxs) $(addsuffix .cmxs,$(PACKEDFILES)) $(addsuffix .cmxs,$(LIBEDFILES)),$(MLFILES:.ml=.cmxs) $(MLGFILES:.mlg=.cmxs)): %.cmxs: %.cmx + $(SHOW)'[deprecated,use-mllib-or-mlpack] CAMLOPT -shared -o $@' + $(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) \ + -shared -o $@ $< + +# can't make +# https://www.gnu.org/software/make/manual/make.html#Static-Pattern +# work with multiple target rules +# so use eval in a loop instead +# with grouped targets https://www.gnu.org/software/make/manual/make.html#Multiple-Targets +# if available (GNU Make >= 4.3) +ifneq (,$(filter grouped-target,$(.FEATURES))) +define globvorule= + +# take care to $$ variables using $< etc + $(1).vo $(1).glob &: $(1).v | $(VDFILE) + $(SHOW)COQC $(1).v + $(HIDE)$$(TIMER) $(COQC) $(COQDEBUG) $$(TIMING_ARG) $(COQFLAGS) $(COQLIBS) $(1).v +ifeq ($(COQDONATIVE), "yes") + $(SHOW)COQNATIVE $(1).vo + $(HIDE)$(call TIMER,$(1).vo.native) $(COQNATIVE) $(COQLIBS) $(1).vo +endif + +endef +else + +$(VOFILES): %.vo: %.v | $(VDFILE) + $(SHOW)COQC $< + $(HIDE)$(TIMER) $(COQC) $(COQDEBUG) $(TIMING_ARG) $(COQFLAGS) $(COQLIBS) $< +ifeq ($(COQDONATIVE), "yes") + $(SHOW)COQNATIVE $@ + $(HIDE)$(call TIMER,$@.native) $(COQNATIVE) $(COQLIBS) $@ +endif + +# this is broken :( todo fix if we ever find a solution that doesn't need grouped targets +$(GLOBFILES): %.glob: %.v + $(SHOW)'COQC $< (for .glob)' + $(HIDE)$(TIMER) $(COQC) $(COQDEBUG) $(COQFLAGS) $(COQLIBS) $< + +endif + +$(foreach vfile,$(VFILES:.v=),$(eval $(call globvorule,$(vfile)))) + +$(VFILES:.v=.vio): %.vio: %.v + $(SHOW)COQC -vio $< + $(HIDE)$(TIMER) $(COQC) -vio $(COQDEBUG) $(COQFLAGS) $(COQLIBS) $< + +$(VFILES:.v=.vos): %.vos: %.v + $(SHOW)COQC -vos $< + $(HIDE)$(TIMER) $(COQC) -vos $(COQDEBUG) $(COQFLAGS) $(COQLIBS) $< + +$(VFILES:.v=.vok): %.vok: %.v + $(SHOW)COQC -vok $< + $(HIDE)$(TIMER) $(COQC) -vok $(COQDEBUG) $(COQFLAGS) $(COQLIBS) $< + +$(addsuffix .timing.diff,$(VFILES)): %.timing.diff : %.before-timing %.after-timing + $(SHOW)PYTHON TIMING-DIFF $*.{before,after}-timing + $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" print-pretty-single-time-diff BEFORE=$*.before-timing AFTER=$*.after-timing TIME_OF_PRETTY_BUILD_FILE="$@" + +$(BEAUTYFILES): %.v.beautified: %.v + $(SHOW)'BEAUTIFY $<' + $(HIDE)$(TIMER) $(COQC) $(COQDEBUG) $(COQFLAGS) $(COQLIBS) -beautify $< + +$(TEXFILES): %.tex: %.v + $(SHOW)'COQDOC -latex $<' + $(HIDE)$(COQDOC) $(COQDOCFLAGS) -latex $< -o $@ + +$(GTEXFILES): %.g.tex: %.v + $(SHOW)'COQDOC -latex -g $<' + $(HIDE)$(COQDOC) $(COQDOCFLAGS) -latex -g $< -o $@ + +$(HTMLFILES): %.html: %.v %.glob + $(SHOW)'COQDOC -html $<' + $(HIDE)$(COQDOC) $(COQDOCFLAGS) -html $< -o $@ + +$(GHTMLFILES): %.g.html: %.v %.glob + $(SHOW)'COQDOC -html -g $<' + $(HIDE)$(COQDOC) $(COQDOCFLAGS) -html -g $< -o $@ + +# Dependency files ############################################################ + +ifndef MAKECMDGOALS + -include $(ALLDFILES) +else + ifneq ($(filter-out archclean clean cleanall printenv make-pretty-timed make-pretty-timed-before make-pretty-timed-after print-pretty-timed print-pretty-timed-diff print-pretty-single-time-diff,$(MAKECMDGOALS)),) + -include $(ALLDFILES) + endif +endif + +.SECONDARY: $(ALLDFILES) + +redir_if_ok = > "$@" || ( RV=$$?; rm -f "$@"; exit $$RV ) + +GENMLFILES:=$(MLGFILES:.mlg=.ml) +$(addsuffix .d,$(ALLSRCFILES)): $(GENMLFILES) + +$(addsuffix .d,$(MLIFILES)): %.mli.d: %.mli + $(SHOW)'CAMLDEP $<' + $(HIDE)$(CAMLDEP) $(OCAMLLIBS) "$<" $(redir_if_ok) + +$(addsuffix .d,$(MLGFILES)): %.mlg.d: %.ml + $(SHOW)'CAMLDEP $<' + $(HIDE)$(CAMLDEP) $(OCAMLLIBS) "$<" $(redir_if_ok) + +$(addsuffix .d,$(MLFILES)): %.ml.d: %.ml + $(SHOW)'CAMLDEP $<' + $(HIDE)$(CAMLDEP) $(OCAMLLIBS) "$<" $(redir_if_ok) + +$(addsuffix .d,$(MLLIBFILES)): %.mllib.d: %.mllib + $(SHOW)'OCAMLLIBDEP $<' + $(HIDE)$(OCAMLLIBDEP) -c $(OCAMLLIBS) "$<" $(redir_if_ok) + +$(addsuffix .d,$(MLPACKFILES)): %.mlpack.d: %.mlpack + $(SHOW)'OCAMLLIBDEP $<' + $(HIDE)$(OCAMLLIBDEP) -c $(OCAMLLIBS) "$<" $(redir_if_ok) + +# If this makefile is created using a _CoqProject we have coqdep get +# options from it. This avoids argument length limits for pathological +# projects. Note that extra options might be on the command line. +VDFILE_FLAGS:=$(if _CoqProject,-f _CoqProject,) $(CMDLINE_COQLIBS) $(CMDLINE_VFILES) + +$(VDFILE): _CoqProject $(VFILES) + $(SHOW)'COQDEP VFILES' + $(HIDE)$(COQDEP) $(if $(strip $(METAFILE)),-m "$(METAFILE)") -vos -dyndep var $(VDFILE_FLAGS) $(redir_if_ok) + +# Misc ######################################################################## + +byte: + $(HIDE)$(MAKE) all "OPT:=-byte" -f "$(SELF)" +.PHONY: byte + +opt: + $(HIDE)$(MAKE) all "OPT:=-opt" -f "$(SELF)" +.PHONY: opt + +# This is deprecated. To extend this makefile use +# extension points and Makefile.local +printenv:: + $(warning printenv is deprecated) + $(warning write extensions in Makefile.local or include Makefile.conf) + @echo 'COQLIB = $(COQLIB)' + @echo 'COQCORELIB = $(COQCORELIB)' + @echo 'DOCDIR = $(DOCDIR)' + @echo 'OCAMLFIND = $(OCAMLFIND)' + @echo 'HASNATDYNLINK = $(HASNATDYNLINK)' + @echo 'SRC_SUBDIRS = $(SRC_SUBDIRS)' + @echo 'COQ_SRC_SUBDIRS = $(COQ_SRC_SUBDIRS)' + @echo 'COQCORE_SRC_SUBDIRS = $(COQCORE_SRC_SUBDIRS)' + @echo 'OCAMLFIND = $(OCAMLFIND)' + @echo 'PP = $(PP)' + @echo 'COQFLAGS = $(COQFLAGS)' + @echo 'COQLIB = $(COQLIBS)' + @echo 'COQLIBINSTALL = $(COQLIBINSTALL)' + @echo 'COQDOCINSTALL = $(COQDOCINSTALL)' +.PHONY: printenv + +# Generate a .merlin file. If you need to append directives to this +# file you can extend the merlin-hook target in Makefile.local +.merlin: + $(SHOW)'FILL .merlin' + $(HIDE)echo 'FLG $(COQMF_CAMLFLAGS)' > .merlin + $(HIDE)echo 'B $(COQCORELIB)' >> .merlin + $(HIDE)echo 'S $(COQCORELIB)' >> .merlin + $(HIDE)$(foreach d,$(COQCORE_SRC_SUBDIRS), \ + echo 'B $(COQCORELIB)$(d)' >> .merlin;) + $(HIDE)$(foreach d,$(COQ_SRC_SUBDIRS), \ + echo 'S $(COQLIB)$(d)' >> .merlin;) + $(HIDE)$(foreach d,$(SRC_SUBDIRS), echo 'B $(d)' >> .merlin;) + $(HIDE)$(foreach d,$(SRC_SUBDIRS), echo 'S $(d)' >> .merlin;) + $(HIDE)$(MAKE) merlin-hook -f "$(SELF)" +.PHONY: merlin + +merlin-hook:: + @# Extension point +.PHONY: merlin-hook + +# prints all variables +debug: + $(foreach v,\ + $(sort $(filter-out $(INITIAL_VARS) INITIAL_VARS,\ + $(.VARIABLES))),\ + $(info $(v) = $($(v)))) +.PHONY: debug + +.DEFAULT_GOAL := all + +# Users can create Makefile.local-late to hook into double-colon rules +# or add other needed Makefile code, using defined +# variables if necessary. +-include Makefile.local-late + +# Local Variables: +# mode: makefile-gmake +# End: diff --git a/concordium/proofs/ssprove/extraction/Makefile.conf b/concordium/proofs/ssprove/extraction/Makefile.conf new file mode 100644 index 0000000..fd82bd8 --- /dev/null +++ b/concordium/proofs/ssprove/extraction/Makefile.conf @@ -0,0 +1,71 @@ +# This configuration file was generated by running: +# coq_makefile -f _CoqProject -o Makefile + +COQBIN?= +ifneq (,$(COQBIN)) +# add an ending / +COQBIN:=$(COQBIN)/ +endif +COQMKFILE ?= "$(COQBIN)coq_makefile" + +############################################################################### +# # +# Project files. # +# # +############################################################################### + +COQMF_CMDLINE_VFILES := +COQMF_SOURCES := $(shell $(COQMKFILE) -sources-of -f _CoqProject $(COQMF_CMDLINE_VFILES)) +COQMF_VFILES := $(filter %.v, $(COQMF_SOURCES)) +COQMF_MLIFILES := $(filter %.mli, $(COQMF_SOURCES)) +COQMF_MLFILES := $(filter %.ml, $(COQMF_SOURCES)) +COQMF_MLGFILES := $(filter %.mlg, $(COQMF_SOURCES)) +COQMF_MLPACKFILES := $(filter %.mlpack, $(COQMF_SOURCES)) +COQMF_MLLIBFILES := $(filter %.mllib, $(COQMF_SOURCES)) +COQMF_METAFILE = + +############################################################################### +# # +# Path directives (-I, -R, -Q). # +# # +############################################################################### + +COQMF_OCAMLLIBS = +COQMF_SRC_SUBDIRS = +COQMF_COQLIBS = -R . Examples +COQMF_COQLIBS_NOML = -R . Examples +COQMF_CMDLINE_COQLIBS = + +############################################################################### +# # +# Coq configuration. # +# # +############################################################################### + +COQMF_COQLIB=/home/au538501/.opam/hacspec/lib/coq/ +COQMF_COQCORELIB=/home/au538501/.opam/hacspec/lib/coq/../coq-core/ +COQMF_DOCDIR=/home/au538501/.opam/hacspec/share/doc/ +COQMF_OCAMLFIND=/home/au538501/.opam/hacspec/bin/ocamlfind +COQMF_CAMLFLAGS=-thread -bin-annot -strict-sequence -w -a+1..3-4+5..8-9+10..26-27+28..39-40-41-42+43-44-45+46..47-48+49..57-58+59..66-67-68+69-70 +COQMF_WARN=-warn-error +a-3 +COQMF_HASNATDYNLINK=true +COQMF_COQ_SRC_SUBDIRS=boot config lib clib kernel library engine pretyping interp gramlib parsing proofs tactics toplevel printing ide stm vernac plugins/btauto plugins/cc plugins/derive plugins/extraction plugins/firstorder plugins/funind plugins/ltac plugins/ltac2 plugins/micromega plugins/nsatz plugins/ring plugins/rtauto plugins/ssr plugins/ssrmatching plugins/syntax +COQMF_COQ_NATIVE_COMPILER_DEFAULT=no +COQMF_WINDRIVE= + +############################################################################### +# # +# Native compiler. # +# # +############################################################################### + +COQMF_COQPROJECTNATIVEFLAG = + +############################################################################### +# # +# Extra variables. # +# # +############################################################################### + +COQMF_OTHERFLAGS = '-w' 'all' +COQMF_INSTALLCOQDOCROOT = Examples diff --git a/concordium/proofs/ssprove/extraction/_CoqProject b/concordium/proofs/ssprove/extraction/_CoqProject new file mode 100644 index 0000000..016d7e3 --- /dev/null +++ b/concordium/proofs/ssprove/extraction/_CoqProject @@ -0,0 +1,9 @@ +-R . Examples +-arg -w +-arg all + +./Hacspec_concordium.v +./Hacspec_concordium_Concordium_traits.v +./Hacspec_concordium_Concordium_types.v +./Hacspec_concordium_Concordium_types_Sealed.v +./Hacspec_concordium_Constants.v \ No newline at end of file diff --git a/concordium/src/concordium.rs b/concordium/src/concordium.rs index c7a71e2..f9c5508 100644 --- a/concordium/src/concordium.rs +++ b/concordium/src/concordium.rs @@ -51,12 +51,12 @@ pub use core::{convert, hash, marker, mem, num, result::*}; pub use alloc::collections; pub mod constants; -mod concordium_impls; mod concordium_prims; +mod concordium_impls; mod concordium_types; mod concordium_traits; -pub mod test_infrastructure; +// pub mod test_infrastructure; use concordium_prims::*; // TODO: Does not re-export anything, nothing is public enough (removed pub) pub use concordium_impls::*; diff --git a/concordium/src/concordium_impls.rs b/concordium/src/concordium_impls.rs index 25fed0d..646e8cc 100644 --- a/concordium/src/concordium_impls.rs +++ b/concordium/src/concordium_impls.rs @@ -1,24 +1,24 @@ -use crate::{convert, mem, num, // prims, - concordium_prims::*, concordium_traits::*, concordium_types::*}; -use concordium_contracts_common::*; - -impl convert::From<()> for Reject { - #[inline(always)] - fn from(_: ()) -> Self { - Reject { - error_code: unsafe { num::NonZeroI32::new_unchecked(i32::MIN + 1) }, - } - } -} - -impl convert::From for Reject { - #[inline(always)] - fn from(_: ParseError) -> Self { - Reject { - error_code: unsafe { num::NonZeroI32::new_unchecked(i32::MIN + 2) }, - } - } -} +// use crate::{convert, mem, num, // prims, +// concordium_prims::*, concordium_traits::*, concordium_types::*}; +// use concordium_contracts_common::*; + +// impl convert::From<()> for Reject { +// #[inline(always)] +// fn from(_: ()) -> Self { +// Reject { +// error_code: unsafe { num::NonZeroI32::new_unchecked(i32::MIN + 1) }, +// } +// } +// } + +// impl convert::From for Reject { +// #[inline(always)] +// fn from(_: ParseError) -> Self { +// Reject { +// error_code: unsafe { num::NonZeroI32::new_unchecked(i32::MIN + 2) }, +// } +// } +// } // /// Full is mapped to i32::MIN+3, Malformed is mapped to i32::MIN+4. // impl From for Reject { diff --git a/concordium/src/concordium_types.rs b/concordium/src/concordium_types.rs index 8c6a618..ae08fd4 100644 --- a/concordium/src/concordium_types.rs +++ b/concordium/src/concordium_types.rs @@ -83,29 +83,29 @@ pub struct Reject { pub error_code: NonZeroI32, } -/// Default error is i32::MIN. -impl Default for Reject { - #[inline(always)] - #[exclude] // TODO: Unsafe - fn default() -> Self { - Self { - error_code: unsafe {NonZeroI32::new_unchecked(i32::MIN)}, - } - } -} +// /// Default error is i32::MIN. +// impl Default for Reject { +// #[inline(always)] +// #[exclude] // TODO: Unsafe +// fn default() -> Self { +// Self { +// error_code: unsafe {NonZeroI32::new_unchecked(i32::MIN)}, +// } +// } +// } -impl Reject { - /// This returns `None` for all values >= 0 and `Some` otherwise. - #[exclude] - pub fn new(x: i32) -> Option { - if x < 0 { - let error_code = unsafe { NonZeroI32::new_unchecked(x) }; - Some(Reject { error_code }) - } else { - None - } - } -} +// impl Reject { +// /// This returns `None` for all values >= 0 and `Some` otherwise. +// #[exclude] +// pub fn new(x: i32) -> Option { +// if x < 0 { +// let error_code = unsafe { NonZeroI32::new_unchecked(x) }; +// Some(Reject { error_code }) +// } else { +// None +// } +// } +// } // Macros for failing a contract function diff --git a/sha256/proofs/ssprove/extraction/Hacspec_sha256.v b/sha256/proofs/ssprove/extraction/Hacspec_sha256.v new file mode 100644 index 0000000..5fa6612 --- /dev/null +++ b/sha256/proofs/ssprove/extraction/Hacspec_sha256.v @@ -0,0 +1,292 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_lib. +Export Hacspec_lib. + +Notation "'t_Block'" := (nseq int8 BLOCK_SIZE). +Definition Block {L : {fset Location}} {I : Interface} : both L I (t_Block) -> both L I (t_Block) := + id. + +Notation "'t_Hash'" := (nseq int32 8). +Definition Hash {L : {fset Location}} {I : Interface} : both L I (t_Hash) -> both L I (t_Hash) := + id. + +Notation "'t_OpTableType'" := (nseq int32 12). +Definition OpTableType {L : {fset Location}} {I : Interface} : both L I (t_OpTableType) -> both L I (t_OpTableType) := + id. + +Notation "'t_RoundConstantsTable'" := (nseq int32 K_SIZE). +Definition RoundConstantsTable {L : {fset Location}} {I : Interface} : both L I (t_RoundConstantsTable) -> both L I (t_RoundConstantsTable) := + id. + +Notation "'t_Sha256Digest'" := (nseq int8 HASH_SIZE). +Definition Sha256Digest {L : {fset Location}} {I : Interface} : both L I (t_Sha256Digest) -> both L I (t_Sha256Digest) := + id. + +(*Not implemented yet? todo(item)*) + +Equations v_BLOCK_SIZE {L : {fset Location}} {I : Interface} : both L I (uint_size) := + v_BLOCK_SIZE := + solve_lift (ret_both (64 : uint_size)) : both L I (uint_size). +Fail Next Obligation. + +Equations v_HASH_SIZE {L : {fset Location}} {I : Interface} : both L I (uint_size) := + v_HASH_SIZE := + solve_lift ((ret_both (256 : uint_size)) ./ (ret_both (8 : uint_size))) : both L I (uint_size). +Fail Next Obligation. + +Equations v_K_SIZE {L : {fset Location}} {I : Interface} : both L I (uint_size) := + v_K_SIZE := + solve_lift (ret_both (64 : uint_size)) : both L I (uint_size). +Fail Next Obligation. + +Equations v_LEN_SIZE {L : {fset Location}} {I : Interface} : both L I (uint_size) := + v_LEN_SIZE := + solve_lift (ret_both (8 : uint_size)) : both L I (uint_size). +Fail Next Obligation. + +Equations v_OP_TABLE {L : {fset Location}} {I : Interface} : both L I (t_OpTableType) := + v_OP_TABLE := + OpTableType (array_from_list [solve_lift (ret_both (2 : uint_size)); + solve_lift (ret_both (13 : uint_size)); + solve_lift (ret_both (22 : uint_size)); + solve_lift (ret_both (6 : uint_size)); + solve_lift (ret_both (11 : uint_size)); + solve_lift (ret_both (25 : uint_size)); + solve_lift (ret_both (7 : uint_size)); + solve_lift (ret_both (18 : uint_size)); + solve_lift (ret_both (3 : uint_size)); + solve_lift (ret_both (17 : uint_size)); + solve_lift (ret_both (19 : uint_size)); + solve_lift (ret_both (10 : uint_size))]) : both L I (t_OpTableType). +Fail Next Obligation. + +Equations ch {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (x : both L1 I1 (t_U32)) (y : both L2 I2 (t_U32)) (z : both L3 I3 (t_U32)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_U32) := + ch x y z := + solve_lift ((x .& y) .^ ((f_not x) .& z)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_U32). +Fail Next Obligation. + +Equations maj {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (x : both L1 I1 (t_U32)) (y : both L2 I2 (t_U32)) (z : both L3 I3 (t_U32)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_U32) := + maj x y z := + solve_lift ((x .& y) .^ ((x .& z) .^ (y .& z))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_U32). +Fail Next Obligation. + +Definition tmp_loc : Location := + (t_U32;0%nat). +Equations sigma {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (x : both L1 I1 (t_U32)) (i : both L2 I2 (uint_size)) (op : both L3 I3 (uint_size)) : both (L1 :|: L2 :|: L3 :|: fset [tmp_loc]) (I1 :|: I2 :|: I3) (t_U32) := + sigma x i op := + letb (tmp : t_U32) loc(tmp_loc) := impl__U32__rotate_right x (v_OP_TABLE.a[(((ret_both (3 : uint_size)) .* i) .+ (ret_both (2 : uint_size)))]) in + letb _ := ifb op =.? (ret_both (0 : uint_size)) + then assign todo(term) + else () in + solve_lift (((impl__U32__rotate_right x (v_OP_TABLE.a[((ret_both (3 : uint_size)) .* i)])) .^ (impl__U32__rotate_right x (v_OP_TABLE.a[(((ret_both (3 : uint_size)) .* i) .+ (ret_both (1 : uint_size)))]))) .^ tmp) : both (L1 :|: L2 :|: L3 :|: fset [tmp_loc]) (I1 :|: I2 :|: I3) (t_U32). +Fail Next Obligation. + +Definition s_loc : Location := + (t_RoundConstantsTable;1%nat). +Equations schedule {L1 : {fset Location}} {I1 : Interface} (block : both L1 I1 (t_Block)) : both (L1 :|: fset [s_loc;tmp_loc]) I1 (t_RoundConstantsTable) := + schedule block := + letb b := impl__Block__to_be_U32s block in + letb s loc(s_loc) := impl__RoundConstantsTable__new (ret_both (tt : 'unit)) in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := v_K_SIZE))) (fun i => + ssp (fun _ => + solve_lift (ifb i <.? (ret_both (16 : uint_size)) + then letb _ := assign todo(term) in + ret_both (tt : 'unit) + else letb t16 := s.a[(i .- (ret_both (16 : uint_size)))] in + letb t15 := s.a[(i .- (ret_both (15 : uint_size)))] in + letb t7 := s.a[(i .- (ret_both (7 : uint_size)))] in + letb t2 := s.a[(i .- (ret_both (2 : uint_size)))] in + letb s1 := sigma t2 (ret_both (3 : uint_size)) (ret_both (0 : uint_size)) in + letb s0 := sigma t15 (ret_both (2 : uint_size)) (ret_both (0 : uint_size)) in + letb _ := assign todo(term) in + ret_both (tt : 'unit)) : both (*2*)(L1:|:fset [s_loc;tmp_loc]) (I1) ('unit))) (ret_both (tt : 'unit)) in + solve_lift s : both (L1 :|: fset [s_loc;tmp_loc]) I1 (t_RoundConstantsTable). +Fail Next Obligation. + +Equations v_HASH_INIT {L : {fset Location}} {I : Interface} : both L I (t_Hash) := + v_HASH_INIT := + Hash (array_from_list [U32 (solve_lift (ret_both (1779033703 : int32))); + U32 (solve_lift (ret_both (3144134277 : int32))); + U32 (solve_lift (ret_both (1013904242 : int32))); + U32 (solve_lift (ret_both (2773480762 : int32))); + U32 (solve_lift (ret_both (1359893119 : int32))); + U32 (solve_lift (ret_both (2600822924 : int32))); + U32 (solve_lift (ret_both (528734635 : int32))); + U32 (solve_lift (ret_both (1541459225 : int32)))]) : both L I (t_Hash). +Fail Next Obligation. + +Equations v_K_TABLE {L : {fset Location}} {I : Interface} : both L I (t_RoundConstantsTable) := + v_K_TABLE := + RoundConstantsTable (array_from_list [U32 (solve_lift (ret_both (1116352408 : int32))); + U32 (solve_lift (ret_both (1899447441 : int32))); + U32 (solve_lift (ret_both (3049323471 : int32))); + U32 (solve_lift (ret_both (3921009573 : int32))); + U32 (solve_lift (ret_both (961987163 : int32))); + U32 (solve_lift (ret_both (1508970993 : int32))); + U32 (solve_lift (ret_both (2453635748 : int32))); + U32 (solve_lift (ret_both (2870763221 : int32))); + U32 (solve_lift (ret_both (3624381080 : int32))); + U32 (solve_lift (ret_both (310598401 : int32))); + U32 (solve_lift (ret_both (607225278 : int32))); + U32 (solve_lift (ret_both (1426881987 : int32))); + U32 (solve_lift (ret_both (1925078388 : int32))); + U32 (solve_lift (ret_both (2162078206 : int32))); + U32 (solve_lift (ret_both (2614888103 : int32))); + U32 (solve_lift (ret_both (3248222580 : int32))); + U32 (solve_lift (ret_both (3835390401 : int32))); + U32 (solve_lift (ret_both (4022224774 : int32))); + U32 (solve_lift (ret_both (264347078 : int32))); + U32 (solve_lift (ret_both (604807628 : int32))); + U32 (solve_lift (ret_both (770255983 : int32))); + U32 (solve_lift (ret_both (1249150122 : int32))); + U32 (solve_lift (ret_both (1555081692 : int32))); + U32 (solve_lift (ret_both (1996064986 : int32))); + U32 (solve_lift (ret_both (2554220882 : int32))); + U32 (solve_lift (ret_both (2821834349 : int32))); + U32 (solve_lift (ret_both (2952996808 : int32))); + U32 (solve_lift (ret_both (3210313671 : int32))); + U32 (solve_lift (ret_both (3336571891 : int32))); + U32 (solve_lift (ret_both (3584528711 : int32))); + U32 (solve_lift (ret_both (113926993 : int32))); + U32 (solve_lift (ret_both (338241895 : int32))); + U32 (solve_lift (ret_both (666307205 : int32))); + U32 (solve_lift (ret_both (773529912 : int32))); + U32 (solve_lift (ret_both (1294757372 : int32))); + U32 (solve_lift (ret_both (1396182291 : int32))); + U32 (solve_lift (ret_both (1695183700 : int32))); + U32 (solve_lift (ret_both (1986661051 : int32))); + U32 (solve_lift (ret_both (2177026350 : int32))); + U32 (solve_lift (ret_both (2456956037 : int32))); + U32 (solve_lift (ret_both (2730485921 : int32))); + U32 (solve_lift (ret_both (2820302411 : int32))); + U32 (solve_lift (ret_both (3259730800 : int32))); + U32 (solve_lift (ret_both (3345764771 : int32))); + U32 (solve_lift (ret_both (3516065817 : int32))); + U32 (solve_lift (ret_both (3600352804 : int32))); + U32 (solve_lift (ret_both (4094571909 : int32))); + U32 (solve_lift (ret_both (275423344 : int32))); + U32 (solve_lift (ret_both (430227734 : int32))); + U32 (solve_lift (ret_both (506948616 : int32))); + U32 (solve_lift (ret_both (659060556 : int32))); + U32 (solve_lift (ret_both (883997877 : int32))); + U32 (solve_lift (ret_both (958139571 : int32))); + U32 (solve_lift (ret_both (1322822218 : int32))); + U32 (solve_lift (ret_both (1537002063 : int32))); + U32 (solve_lift (ret_both (1747873779 : int32))); + U32 (solve_lift (ret_both (1955562222 : int32))); + U32 (solve_lift (ret_both (2024104815 : int32))); + U32 (solve_lift (ret_both (2227730452 : int32))); + U32 (solve_lift (ret_both (2361852424 : int32))); + U32 (solve_lift (ret_both (2428436474 : int32))); + U32 (solve_lift (ret_both (2756734187 : int32))); + U32 (solve_lift (ret_both (3204031479 : int32))); + U32 (solve_lift (ret_both (3329325298 : int32)))]) : both L I (t_RoundConstantsTable). +Fail Next Obligation. + +Definition h_loc : Location := + (t_Hash;2%nat). +Equations shuffle {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (ws : both L1 I1 (t_RoundConstantsTable)) (hashi : both L2 I2 (t_Hash)) : both (L1 :|: L2 :|: fset [h_loc;tmp_loc]) (I1 :|: I2) (t_Hash) := + shuffle ws hashi := + letb h loc(h_loc) := hashi in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := v_K_SIZE))) (fun i => + ssp (fun _ => + letb a0 := h.a[(ret_both (0 : int32))] in + letb b0 := h.a[(ret_both (1 : int32))] in + letb c0 := h.a[(ret_both (2 : int32))] in + letb d0 := h.a[(ret_both (3 : int32))] in + letb e0 := h.a[(ret_both (4 : int32))] in + letb f0 := h.a[(ret_both (5 : int32))] in + letb g0 := h.a[(ret_both (6 : int32))] in + letb (h0 : t_U32) := h.a[(ret_both (7 : int32))] in + letb t1 := (((h0 .+ (sigma e0 (ret_both (1 : uint_size)) (ret_both (1 : uint_size)))) .+ (ch e0 f0 g0)) .+ (v_K_TABLE.a[i])) .+ (ws.a[i]) in + letb t2 := (sigma a0 (ret_both (0 : uint_size)) (ret_both (1 : uint_size))) .+ (maj a0 b0 c0) in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + solve_lift (ret_both (tt : 'unit)) : both (*2*)(L1:|:L2:|:fset [h_loc;tmp_loc]) (I1:|:I2) ('unit))) (ret_both (tt : 'unit)) in + solve_lift h : both (L1 :|: L2 :|: fset [h_loc;tmp_loc]) (I1 :|: I2) (t_Hash). +Fail Next Obligation. + +Definition h_loc : Location := + (t_Hash;3%nat). +Equations compress {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (block : both L1 I1 (t_Block)) (h_in : both L2 I2 (t_Hash)) : both (L1 :|: L2 :|: fset [h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) (I1 :|: I2) (t_Hash) := + compress block h_in := + letb s := schedule block in + letb h loc(h_loc) := shuffle s h_in in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := ret_both (8 : int32)))) (fun i => + ssp (fun _ => + assign todo(term) : both (*4*)(L1:|:L2:|:fset [h_loc;h_loc;s_loc;tmp_loc]) (I1:|:I2) ('unit))) (ret_both (tt : 'unit)) in + solve_lift h : both (L1 :|: L2 :|: fset [h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) (I1 :|: I2) (t_Hash). +Fail Next Obligation. + +Definition h_loc : Location := + (t_Hash;4%nat). +Definition last_block_loc : Location := + (t_Block;5%nat). +Definition last_block_len_loc : Location := + (uint_size;6%nat). +Definition pad_block_loc : Location := + (t_Block;7%nat). +Equations hash {L1 : {fset Location}} {I1 : Interface} (msg : both L1 I1 (t_Seq (t_U8))) : both (L1 :|: fset [h_loc;last_block_loc;last_block_len_loc;pad_block_loc;h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) I1 (t_Sha256Digest) := + hash msg := + letb h loc(h_loc) := v_HASH_INIT in + letb last_block loc(last_block_loc) := impl__Block__new (ret_both (tt : 'unit)) in + letb last_block_len loc(last_block_len_loc) := ret_both (0 : uint_size) in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__num_chunks msg v_BLOCK_SIZE))) (fun i => + ssp (fun _ => + letb '(block_len,block) := impl_41__get_chunk msg v_BLOCK_SIZE i in + solve_lift (ifb block_len <.? v_BLOCK_SIZE + then letb _ := assign todo(term) in + letb _ := assign todo(term) in + ret_both (tt : 'unit) + else letb compress_input := impl__Block__from_seq block in + letb _ := assign todo(term) in + ret_both (tt : 'unit)) : both (*5*)(L1:|:L1:|:fset [h_loc;h_loc;h_loc;s_loc;tmp_loc]) (I1:|:I1) ('unit))) (ret_both (tt : 'unit)) in + letb _ := assign todo(term) in + letb len_bist := U64 (cast_int (WS2 := _) ((impl_41__len msg) .* (ret_both (8 : uint_size)))) in + letb _ := ifb last_block_len <.? (v_BLOCK_SIZE .- v_LEN_SIZE) + then letb _ := assign todo(term) in + letb _ := assign todo(term) in + ret_both (tt : 'unit) + else letb pad_block loc(pad_block_loc) := impl__Block__new (ret_both (tt : 'unit)) in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + ret_both (tt : 'unit) in + solve_lift (impl__Sha256Digest__from_seq (impl__Hash__to_be_bytes h)) : both (L1 :|: fset [h_loc;last_block_loc;last_block_len_loc;pad_block_loc;h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) I1 (t_Sha256Digest). +Fail Next Obligation. + +Equations sha256 {L1 : {fset Location}} {I1 : Interface} (msg : both L1 I1 (t_Seq (t_U8))) : both (L1 :|: fset [h_loc;last_block_loc;last_block_len_loc;pad_block_loc;h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) I1 (t_Sha256Digest) := + sha256 msg := + solve_lift (hash msg) : both (L1 :|: fset [h_loc;last_block_loc;last_block_len_loc;pad_block_loc;h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) I1 (t_Sha256Digest). +Fail Next Obligation. diff --git a/sha512/proofs/ssprove/extraction/Hacspec_sha512.v b/sha512/proofs/ssprove/extraction/Hacspec_sha512.v new file mode 100644 index 0000000..96d7947 --- /dev/null +++ b/sha512/proofs/ssprove/extraction/Hacspec_sha512.v @@ -0,0 +1,308 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +From Jasmin Require Import word. + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_lib. +Export Hacspec_lib. + +Notation "'t_Block'" := (nseq int8 BLOCK_SIZE). +Definition Block {L : {fset Location}} {I : Interface} : both L I (t_Block) -> both L I (t_Block) := + id. + +Notation "'t_Hash'" := (nseq int64 8). +Definition Hash {L : {fset Location}} {I : Interface} : both L I (t_Hash) -> both L I (t_Hash) := + id. + +Notation "'t_OpTableType'" := (nseq int32 12). +Definition OpTableType {L : {fset Location}} {I : Interface} : both L I (t_OpTableType) -> both L I (t_OpTableType) := + id. + +Notation "'t_RoundConstantsTable'" := (nseq int64 K_SIZE). +Definition RoundConstantsTable {L : {fset Location}} {I : Interface} : both L I (t_RoundConstantsTable) -> both L I (t_RoundConstantsTable) := + id. + +Notation "'t_Sha512Digest'" := (nseq int8 HASH_SIZE). +Definition Sha512Digest {L : {fset Location}} {I : Interface} : both L I (t_Sha512Digest) -> both L I (t_Sha512Digest) := + id. + +(*Not implemented yet? todo(item)*) + +Equations v_BLOCK_SIZE {L : {fset Location}} {I : Interface} : both L I (uint_size) := + v_BLOCK_SIZE := + solve_lift (ret_both (128 : uint_size)) : both L I (uint_size). +Fail Next Obligation. + +Equations v_HASH_SIZE {L : {fset Location}} {I : Interface} : both L I (uint_size) := + v_HASH_SIZE := + solve_lift ((ret_both (512 : uint_size)) ./ (ret_both (8 : uint_size))) : both L I (uint_size). +Fail Next Obligation. + +Equations v_K_SIZE {L : {fset Location}} {I : Interface} : both L I (uint_size) := + v_K_SIZE := + solve_lift (ret_both (80 : uint_size)) : both L I (uint_size). +Fail Next Obligation. + +Equations v_LEN_SIZE {L : {fset Location}} {I : Interface} : both L I (uint_size) := + v_LEN_SIZE := + solve_lift (ret_both (16 : uint_size)) : both L I (uint_size). +Fail Next Obligation. + +Equations v_OP_TABLE {L : {fset Location}} {I : Interface} : both L I (t_OpTableType) := + v_OP_TABLE := + OpTableType (array_from_list [solve_lift (ret_both (28 : uint_size)); + solve_lift (ret_both (34 : uint_size)); + solve_lift (ret_both (39 : uint_size)); + solve_lift (ret_both (14 : uint_size)); + solve_lift (ret_both (18 : uint_size)); + solve_lift (ret_both (41 : uint_size)); + solve_lift (ret_both (1 : uint_size)); + solve_lift (ret_both (8 : uint_size)); + solve_lift (ret_both (7 : uint_size)); + solve_lift (ret_both (19 : uint_size)); + solve_lift (ret_both (61 : uint_size)); + solve_lift (ret_both (6 : uint_size))]) : both L I (t_OpTableType). +Fail Next Obligation. + +Equations ch {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (x : both L1 I1 (t_U64)) (y : both L2 I2 (t_U64)) (z : both L3 I3 (t_U64)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_U64) := + ch x y z := + solve_lift ((x .& y) .^ ((f_not x) .& z)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_U64). +Fail Next Obligation. + +Equations maj {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (x : both L1 I1 (t_U64)) (y : both L2 I2 (t_U64)) (z : both L3 I3 (t_U64)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_U64) := + maj x y z := + solve_lift ((x .& y) .^ ((x .& z) .^ (y .& z))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_U64). +Fail Next Obligation. + +Definition tmp_loc : Location := + (t_U64;0%nat). +Equations sigma {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (x : both L1 I1 (t_U64)) (i : both L2 I2 (uint_size)) (op : both L3 I3 (uint_size)) : both (L1 :|: L2 :|: L3 :|: fset [tmp_loc]) (I1 :|: I2 :|: I3) (t_U64) := + sigma x i op := + letb (tmp : t_U64) loc(tmp_loc) := impl__U64__rotate_right x (v_OP_TABLE.a[(((ret_both (3 : uint_size)) .* i) .+ (ret_both (2 : uint_size)))]) in + letb _ := ifb op =.? (ret_both (0 : uint_size)) + then assign todo(term) + else () in + solve_lift (((impl__U64__rotate_right x (v_OP_TABLE.a[((ret_both (3 : uint_size)) .* i)])) .^ (impl__U64__rotate_right x (v_OP_TABLE.a[(((ret_both (3 : uint_size)) .* i) .+ (ret_both (1 : uint_size)))]))) .^ tmp) : both (L1 :|: L2 :|: L3 :|: fset [tmp_loc]) (I1 :|: I2 :|: I3) (t_U64). +Fail Next Obligation. + +Definition s_loc : Location := + (t_RoundConstantsTable;1%nat). +Equations schedule {L1 : {fset Location}} {I1 : Interface} (block : both L1 I1 (t_Block)) : both (L1 :|: fset [s_loc;tmp_loc]) I1 (t_RoundConstantsTable) := + schedule block := + letb b := impl__Block__to_be_U64s block in + letb s loc(s_loc) := impl__RoundConstantsTable__new (ret_both (tt : 'unit)) in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := v_K_SIZE))) (fun i => + ssp (fun _ => + solve_lift (ifb i <.? (ret_both (16 : uint_size)) + then letb _ := assign todo(term) in + ret_both (tt : 'unit) + else letb t16 := s.a[(i .- (ret_both (16 : uint_size)))] in + letb t15 := s.a[(i .- (ret_both (15 : uint_size)))] in + letb t7 := s.a[(i .- (ret_both (7 : uint_size)))] in + letb t2 := s.a[(i .- (ret_both (2 : uint_size)))] in + letb s1 := sigma t2 (ret_both (3 : uint_size)) (ret_both (0 : uint_size)) in + letb s0 := sigma t15 (ret_both (2 : uint_size)) (ret_both (0 : uint_size)) in + letb _ := assign todo(term) in + ret_both (tt : 'unit)) : both (*2*)(L1:|:fset [s_loc;tmp_loc]) (I1) ('unit))) (ret_both (tt : 'unit)) in + solve_lift s : both (L1 :|: fset [s_loc;tmp_loc]) I1 (t_RoundConstantsTable). +Fail Next Obligation. + +Equations v_HASH_INIT {L : {fset Location}} {I : Interface} : both L I (t_Hash) := + v_HASH_INIT := + Hash (array_from_list [U64 (solve_lift (ret_both (7640891576956012808 : int64))); + U64 (solve_lift (ret_both (13503953896175478587 : int64))); + U64 (solve_lift (ret_both (4354685564936845355 : int64))); + U64 (solve_lift (ret_both (11912009170470909681 : int64))); + U64 (solve_lift (ret_both (5840696475078001361 : int64))); + U64 (solve_lift (ret_both (11170449401992604703 : int64))); + U64 (solve_lift (ret_both (2270897969802886507 : int64))); + U64 (solve_lift (ret_both (6620516959819538809 : int64)))]) : both L I (t_Hash). +Fail Next Obligation. + +Equations v_K_TABLE {L : {fset Location}} {I : Interface} : both L I (t_RoundConstantsTable) := + v_K_TABLE := + RoundConstantsTable (array_from_list [U64 (solve_lift (ret_both (4794697086780616226 : int64))); + U64 (solve_lift (ret_both (8158064640168781261 : int64))); + U64 (solve_lift (ret_both (13096744586834688815 : int64))); + U64 (solve_lift (ret_both (16840607885511220156 : int64))); + U64 (solve_lift (ret_both (4131703408338449720 : int64))); + U64 (solve_lift (ret_both (6480981068601479193 : int64))); + U64 (solve_lift (ret_both (10538285296894168987 : int64))); + U64 (solve_lift (ret_both (12329834152419229976 : int64))); + U64 (solve_lift (ret_both (15566598209576043074 : int64))); + U64 (solve_lift (ret_both (1334009975649890238 : int64))); + U64 (solve_lift (ret_both (2608012711638119052 : int64))); + U64 (solve_lift (ret_both (6128411473006802146 : int64))); + U64 (solve_lift (ret_both (8268148722764581231 : int64))); + U64 (solve_lift (ret_both (9286055187155687089 : int64))); + U64 (solve_lift (ret_both (11230858885718282805 : int64))); + U64 (solve_lift (ret_both (13951009754708518548 : int64))); + U64 (solve_lift (ret_both (16472876342353939154 : int64))); + U64 (solve_lift (ret_both (17275323862435702243 : int64))); + U64 (solve_lift (ret_both (1135362057144423861 : int64))); + U64 (solve_lift (ret_both (2597628984639134821 : int64))); + U64 (solve_lift (ret_both (3308224258029322869 : int64))); + U64 (solve_lift (ret_both (5365058923640841347 : int64))); + U64 (solve_lift (ret_both (6679025012923562964 : int64))); + U64 (solve_lift (ret_both (8573033837759648693 : int64))); + U64 (solve_lift (ret_both (10970295158949994411 : int64))); + U64 (solve_lift (ret_both (12119686244451234320 : int64))); + U64 (solve_lift (ret_both (12683024718118986047 : int64))); + U64 (solve_lift (ret_both (13788192230050041572 : int64))); + U64 (solve_lift (ret_both (14330467153632333762 : int64))); + U64 (solve_lift (ret_both (15395433587784984357 : int64))); + U64 (solve_lift (ret_both (489312712824947311 : int64))); + U64 (solve_lift (ret_both (1452737877330783856 : int64))); + U64 (solve_lift (ret_both (2861767655752347644 : int64))); + U64 (solve_lift (ret_both (3322285676063803686 : int64))); + U64 (solve_lift (ret_both (5560940570517711597 : int64))); + U64 (solve_lift (ret_both (5996557281743188959 : int64))); + U64 (solve_lift (ret_both (7280758554555802590 : int64))); + U64 (solve_lift (ret_both (8532644243296465576 : int64))); + U64 (solve_lift (ret_both (9350256976987008742 : int64))); + U64 (solve_lift (ret_both (10552545826968843579 : int64))); + U64 (solve_lift (ret_both (11727347734174303076 : int64))); + U64 (solve_lift (ret_both (12113106623233404929 : int64))); + U64 (solve_lift (ret_both (14000437183269869457 : int64))); + U64 (solve_lift (ret_both (14369950271660146224 : int64))); + U64 (solve_lift (ret_both (15101387698204529176 : int64))); + U64 (solve_lift (ret_both (15463397548674623760 : int64))); + U64 (solve_lift (ret_both (17586052441742319658 : int64))); + U64 (solve_lift (ret_both (1182934255886127544 : int64))); + U64 (solve_lift (ret_both (1847814050463011016 : int64))); + U64 (solve_lift (ret_both (2177327727835720531 : int64))); + U64 (solve_lift (ret_both (2830643537854262169 : int64))); + U64 (solve_lift (ret_both (3796741975233480872 : int64))); + U64 (solve_lift (ret_both (4115178125766777443 : int64))); + U64 (solve_lift (ret_both (5681478168544905931 : int64))); + U64 (solve_lift (ret_both (6601373596472566643 : int64))); + U64 (solve_lift (ret_both (7507060721942968483 : int64))); + U64 (solve_lift (ret_both (8399075790359081724 : int64))); + U64 (solve_lift (ret_both (8693463985226723168 : int64))); + U64 (solve_lift (ret_both (9568029438360202098 : int64))); + U64 (solve_lift (ret_both (10144078919501101548 : int64))); + U64 (solve_lift (ret_both (10430055236837252648 : int64))); + U64 (solve_lift (ret_both (11840083180663258601 : int64))); + U64 (solve_lift (ret_both (13761210420658862357 : int64))); + U64 (solve_lift (ret_both (14299343276471374635 : int64))); + U64 (solve_lift (ret_both (14566680578165727644 : int64))); + U64 (solve_lift (ret_both (15097957966210449927 : int64))); + U64 (solve_lift (ret_both (16922976911328602910 : int64))); + U64 (solve_lift (ret_both (17689382322260857208 : int64))); + U64 (solve_lift (ret_both (500013540394364858 : int64))); + U64 (solve_lift (ret_both (748580250866718886 : int64))); + U64 (solve_lift (ret_both (1242879168328830382 : int64))); + U64 (solve_lift (ret_both (1977374033974150939 : int64))); + U64 (solve_lift (ret_both (2944078676154940804 : int64))); + U64 (solve_lift (ret_both (3659926193048069267 : int64))); + U64 (solve_lift (ret_both (4368137639120453308 : int64))); + U64 (solve_lift (ret_both (4836135668995329356 : int64))); + U64 (solve_lift (ret_both (5532061633213252278 : int64))); + U64 (solve_lift (ret_both (6448918945643986474 : int64))); + U64 (solve_lift (ret_both (6902733635092675308 : int64))); + U64 (solve_lift (ret_both (7801388544844847127 : int64)))]) : both L I (t_RoundConstantsTable). +Fail Next Obligation. + +Definition h_loc : Location := + (t_Hash;2%nat). +Equations shuffle {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (ws : both L1 I1 (t_RoundConstantsTable)) (hashi : both L2 I2 (t_Hash)) : both (L1 :|: L2 :|: fset [h_loc;tmp_loc]) (I1 :|: I2) (t_Hash) := + shuffle ws hashi := + letb h loc(h_loc) := hashi in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := v_K_SIZE))) (fun i => + ssp (fun _ => + letb a0 := h.a[(ret_both (0 : int32))] in + letb b0 := h.a[(ret_both (1 : int32))] in + letb c0 := h.a[(ret_both (2 : int32))] in + letb d0 := h.a[(ret_both (3 : int32))] in + letb e0 := h.a[(ret_both (4 : int32))] in + letb f0 := h.a[(ret_both (5 : int32))] in + letb g0 := h.a[(ret_both (6 : int32))] in + letb (h0 : t_U64) := h.a[(ret_both (7 : int32))] in + letb t1 := (((h0 .+ (sigma e0 (ret_both (1 : uint_size)) (ret_both (1 : uint_size)))) .+ (ch e0 f0 g0)) .+ (v_K_TABLE.a[i])) .+ (ws.a[i]) in + letb t2 := (sigma a0 (ret_both (0 : uint_size)) (ret_both (1 : uint_size))) .+ (maj a0 b0 c0) in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + solve_lift (ret_both (tt : 'unit)) : both (*2*)(L1:|:L2:|:fset [h_loc;tmp_loc]) (I1:|:I2) ('unit))) (ret_both (tt : 'unit)) in + solve_lift h : both (L1 :|: L2 :|: fset [h_loc;tmp_loc]) (I1 :|: I2) (t_Hash). +Fail Next Obligation. + +Definition h_loc : Location := + (t_Hash;3%nat). +Equations compress {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (block : both L1 I1 (t_Block)) (h_in : both L2 I2 (t_Hash)) : both (L1 :|: L2 :|: fset [h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) (I1 :|: I2) (t_Hash) := + compress block h_in := + letb s := schedule block in + letb h loc(h_loc) := shuffle s h_in in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := ret_both (8 : int32)))) (fun i => + ssp (fun _ => + assign todo(term) : both (*4*)(L1:|:L2:|:fset [h_loc;h_loc;s_loc;tmp_loc]) (I1:|:I2) ('unit))) (ret_both (tt : 'unit)) in + solve_lift h : both (L1 :|: L2 :|: fset [h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) (I1 :|: I2) (t_Hash). +Fail Next Obligation. + +Definition h_loc : Location := + (t_Hash;4%nat). +Definition last_block_loc : Location := + (t_Block;5%nat). +Definition last_block_len_loc : Location := + (uint_size;6%nat). +Definition pad_block_loc : Location := + (t_Block;7%nat). +Equations hash {L1 : {fset Location}} {I1 : Interface} (msg : both L1 I1 (t_Seq (t_U8))) : both (L1 :|: fset [h_loc;last_block_loc;last_block_len_loc;pad_block_loc;h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) I1 (t_Sha512Digest) := + hash msg := + letb h loc(h_loc) := v_HASH_INIT in + letb last_block loc(last_block_loc) := impl__Block__new (ret_both (tt : 'unit)) in + letb last_block_len loc(last_block_len_loc) := ret_both (0 : uint_size) in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__num_chunks msg v_BLOCK_SIZE))) (fun i => + ssp (fun _ => + letb '(block_len,block) := impl_41__get_chunk msg v_BLOCK_SIZE i in + solve_lift (ifb block_len <.? v_BLOCK_SIZE + then letb _ := assign todo(term) in + letb _ := assign todo(term) in + ret_both (tt : 'unit) + else letb compress_input := impl__Block__from_seq block in + letb _ := assign todo(term) in + ret_both (tt : 'unit)) : both (*5*)(L1:|:L1:|:fset [h_loc;h_loc;h_loc;s_loc;tmp_loc]) (I1:|:I1) ('unit))) (ret_both (tt : 'unit)) in + letb _ := assign todo(term) in + letb len_bist := U128 (cast_int (WS2 := _) ((impl_41__len msg) .* (ret_both (8 : uint_size)))) in + letb _ := ifb last_block_len <.? (v_BLOCK_SIZE .- v_LEN_SIZE) + then letb _ := assign todo(term) in + letb _ := assign todo(term) in + ret_both (tt : 'unit) + else letb pad_block loc(pad_block_loc) := impl__Block__new (ret_both (tt : 'unit)) in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + ret_both (tt : 'unit) in + solve_lift (impl__Sha512Digest__from_seq (impl__Hash__to_be_bytes h)) : both (L1 :|: fset [h_loc;last_block_loc;last_block_len_loc;pad_block_loc;h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) I1 (t_Sha512Digest). +Fail Next Obligation. + +Equations sha512 {L1 : {fset Location}} {I1 : Interface} (msg : both L1 I1 (t_Seq (t_U8))) : both (L1 :|: fset [h_loc;last_block_loc;last_block_len_loc;pad_block_loc;h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) I1 (t_Sha512Digest) := + sha512 msg := + solve_lift (hash msg) : both (L1 :|: fset [h_loc;last_block_loc;last_block_len_loc;pad_block_loc;h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) I1 (t_Sha512Digest). +Fail Next Obligation. From 1b6245b24c374e8e5e418f9f4b03a0b4492eccee Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 12 Mar 2024 19:28:26 +0100 Subject: [PATCH 72/86] adding zkgroup trait --- auction/Cargo.toml | 2 +- bip-340/Cargo.toml | 4 + bip-340/src/bip-340.rs | 448 +++++++++++++++++++++++++++++++++++++++++ concordium/Cargo.toml | 2 +- ovn/Cargo.toml | 7 +- ovn/src/ovn_zkgroup.rs | 417 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 876 insertions(+), 4 deletions(-) create mode 100644 ovn/src/ovn_zkgroup.rs diff --git a/auction/Cargo.toml b/auction/Cargo.toml index 37100ef..a390bcd 100644 --- a/auction/Cargo.toml +++ b/auction/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" path = "src/auction.rs" [dependencies] -hax-lib-macros = { path = "../../hacspec-v2/hax-lib-macros/" } +hax-lib-macros = { path = "../../hax/hax-lib-macros/" } hacspec-concordium = { path = "../concordium" } hacspec-concordium-derive = { path = "../concordium-derive" } diff --git a/bip-340/Cargo.toml b/bip-340/Cargo.toml index fd7e685..325b2dd 100644 --- a/bip-340/Cargo.toml +++ b/bip-340/Cargo.toml @@ -12,6 +12,10 @@ path = "src/bip-340.rs" hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } hacspec-sha256 = { path = "../sha256" } +group = "0.13" +subtle = "*" +rand_core = "0.6" + [dev-dependencies] quickcheck = "1" quickcheck_macros = "1" diff --git a/bip-340/src/bip-340.rs b/bip-340/src/bip-340.rs index 38d2bb3..38cf973 100644 --- a/bip-340/src/bip-340.rs +++ b/bip-340/src/bip-340.rs @@ -318,3 +318,451 @@ pub fn verify(msg: Message, pubkey: PublicKey, sig: Signature) -> VerificationRe VerificationResult::Ok(()) } } + +///////////////// +// Group trait // +///////////////// + +mod GroupTrait { + use super::{PBytes32, Point, FieldElement, Scalar, ScalarCanvas, lift_x, AffinePoint, finite}; + use group::*; + use hacspec_lib::*; + + use core::iter::{Product, Sum}; + use core::ops::{Add, AddAssign, Mul, MulAssign, Neg, Sub, SubAssign}; + use ff::{Field, PrimeField}; + use group::*; + use rand_core::RngCore; + use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption}; + + impl Sum for Point { + fn sum>(iter: I) -> Self { + let mut accum = Point::AtInfinity; + for x in iter { + accum = accum + x; + } + accum + } + } + + impl<'b> Sum<&'b Point> for Point { + fn sum>(iter: I) -> Self { + let mut accum = Point::AtInfinity; + for x in iter { + accum = accum + x; + } + accum + } + } + + impl Neg for Point { + type Output = Point; + + fn neg(self) -> Self::Output { + -self + } + } + + impl Add for Point { + type Output = Point; + #[inline] + fn add(self, rhs: Point) -> Self::Output { + self + rhs + } + } + + impl<'b> Add<&'b Point> for Point { + type Output = Point; + #[inline] + fn add(self, rhs: &'b Point) -> Self::Output { + self + rhs + } + } + + impl Sub for Point { + type Output = Point; + #[inline] + fn sub(self, rhs: Point) -> Self::Output { + self - rhs + } + } + + impl<'b> Sub<&'b Point> for Point { + type Output = Point; + #[inline] + fn sub(self, rhs: &'b Point) -> Self::Output { + self - rhs + } + } + + impl Mul for Point { + type Output = Point; + #[inline] + fn mul(self, rhs: Scalar) -> Self::Output { + self * rhs + } + } + + impl<'b> Mul<&'b Scalar> for Point { + type Output = Point; + #[inline] + fn mul(self, rhs: &'b Scalar) -> Self::Output { + self * rhs + } + } + + impl SubAssign for Point { + #[inline] + fn sub_assign(&mut self, rhs: Point) { + *self = *self - rhs; + } + } + + impl<'b> SubAssign<&'b Point> for Point { + #[inline] + fn sub_assign(&mut self, rhs: &'b Point) { + *self = *self - *rhs; + } + } + + impl AddAssign for Point { + #[inline] + fn add_assign(&mut self, rhs: Point) { + *self = *self + rhs; + } + } + + impl<'b> AddAssign<&'b Point> for Point { + #[inline] + fn add_assign(&mut self, rhs: &'b Point) { + *self = *self + *rhs; + } + } + + impl MulAssign for Point { + #[inline] + fn mul_assign(&mut self, rhs: Scalar) { + *self = *self * rhs; + } + } + + impl<'b> MulAssign<&'b Scalar> for Point { + #[inline] + fn mul_assign(&mut self, rhs: &'b Scalar) { + *self = *self * *rhs; + } + } + + // Scalar impls + + impl Sum for Scalar { + fn sum>(iter: I) -> Self { + let mut accum = Scalar::from_literal(0u128); + for x in iter { + accum = accum + x; + } + accum + } + } + + impl<'b> Sum<&'b Scalar> for Scalar { + fn sum>(iter: I) -> Self { + let mut accum = Scalar::from_literal(0u128); + for x in iter { + accum = accum + x; + } + accum + } + } + + impl Product for Scalar { + fn product>(iter: I) -> Self { + let mut accum = Scalar::from_literal(1u128); + for x in iter { + accum = accum + x; + } + accum + } + } + + impl<'b> Product<&'b Scalar> for Scalar { + fn product>(iter: I) -> Self { + let mut accum = Scalar::from_literal(1u128); + for x in iter { + accum = accum + x; + } + accum + } + } + + impl Neg for Scalar { + type Output = Scalar; + + fn neg(self) -> Self::Output { + -self + } + } + + impl<'b> Add<&'b Scalar> for Scalar { + type Output = Scalar; + #[inline] + fn add(self, rhs: &'b Scalar) -> Self::Output { + self - rhs + } + } + + impl<'b> Sub<&'b Scalar> for Scalar { + type Output = Scalar; + #[inline] + fn sub(self, rhs: &'b Scalar) -> Self::Output { + self - rhs + } + } + + impl<'b> Mul<&'b Scalar> for Scalar { + type Output = Scalar; + #[inline] + fn mul(self, rhs: &'b Scalar) -> Self::Output { + self * rhs + } + } + + impl SubAssign for Scalar { + #[inline] + fn sub_assign(&mut self, rhs: Scalar) { + *self = *self - rhs; + } + } + + impl<'b> SubAssign<&'b Scalar> for Scalar { + #[inline] + fn sub_assign(&mut self, rhs: &'b Scalar) { + *self = *self - *rhs; + } + } + + impl AddAssign for Scalar { + #[inline] + fn add_assign(&mut self, rhs: Scalar) { + *self = *self + rhs; + } + } + + impl<'b> AddAssign<&'b Scalar> for Scalar { + #[inline] + fn add_assign(&mut self, rhs: &'b Scalar) { + *self = *self + *rhs; + } + } + + impl MulAssign for Scalar { + #[inline] + fn mul_assign(&mut self, rhs: Scalar) { + *self = *self * rhs; + } + } + + impl<'b> MulAssign<&'b Scalar> for Scalar { + #[inline] + fn mul_assign(&mut self, rhs: &'b Scalar) { + *self = *self * *rhs; + } + } + + // AffinePoint + + impl Add for Point { + type Output = Point; + #[inline] + fn add(self, rhs: AffinePoint) -> Self::Output { + self - Point::Affine(rhs) + } + } + + impl<'b> Add<&'b AffinePoint> for Point { + type Output = Point; + #[inline] + fn add(self, rhs: &'b AffinePoint) -> Self::Output { + self - Point::Affine(*rhs) + } + } + + impl Sub for Point { + type Output = Point; + #[inline] + fn sub(self, rhs: AffinePoint) -> Self::Output { + self - Point::Affine(rhs) + } + } + + impl<'b> Sub<&'b AffinePoint> for Point { + type Output = Point; + #[inline] + fn sub(self, rhs: &'b AffinePoint) -> Self::Output { + self - Point::Affine(*rhs) + } + } + + impl SubAssign for Point { + #[inline] + fn sub_assign(&mut self, rhs: AffinePoint) { + *self = *self - Point::Affine(rhs); + } + } + + impl<'b> SubAssign<&'b AffinePoint> for Point { + #[inline] + fn sub_assign(&mut self, rhs: &'b AffinePoint) { + *self = *self - Point::Affine(*rhs); + } + } + + impl AddAssign for Point { + #[inline] + fn add_assign(&mut self, rhs: AffinePoint) { + *self = *self + Point::Affine(rhs); + } + } + + impl<'b> AddAssign<&'b AffinePoint> for Point { + #[inline] + fn add_assign(&mut self, rhs: &'b AffinePoint) { + *self = *self + Point::Affine(*rhs); + } + } + + + impl ConstantTimeEq for Scalar { + fn ct_eq(&self, other: &Self) -> Choice { + let a: Seq = self.to_public_byte_seq_be(); + let b: Seq = other.to_public_byte_seq_be(); + + let mut c: Choice = ConstantTimeEq::ct_eq(&a[0], &b[0]); + for i in 1..a.len() { + c &= ConstantTimeEq::ct_eq(&a[i], &b[i]); + } + + c + } + } + + impl ConditionallySelectable for Scalar { + fn conditional_select(a: &Self, b: &Self, c: Choice) -> Self { + if c.unwrap_u8() == 1 { + *a + } else { + *b + } + } + } + + impl From for Scalar { + fn from(i: u64) -> Self { + Scalar::from_literal(i as u128) + } + } + + impl Field for Scalar { + const ZERO: Self = Scalar(ScalarCanvas { + b: [0u8; 32], + sign: Sign::Plus, + signed: false, + }); + const ONE: Self = Scalar(ScalarCanvas { + b: [ + 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, + 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 1u8, + ], + sign: Sign::Plus, + signed: false, + }); + fn random(mut rng: impl RngCore) -> Self { + let b: &mut [u8; 32] = &mut [0u8; 32]; + rng.fill_bytes(b); + Scalar::from_public_byte_seq_be(PBytes32(*b)) + } + + fn square(&self) -> Self { + *self * *self + } + + fn double(&self) -> Self { + *self + *self + } + + fn invert(&self) -> CtOption { + Scalar::invert(self) // TODO + } + + fn sqrt_ratio(a: &Self, b: &Self) -> (Choice, Self) { + (a.ct_eq(b), *a) // TODO + } + } + + impl PrimeField for Scalar { + type Repr = [u8;32]; + fn from_repr(x: ::Repr) -> CtOption { + CtOption::new(Scalar::from_public_byte_seq_be(PBytes32(x)), x.ct_eq(&x)) + } + fn to_repr(&self) -> ::Repr { + let mut res : [u8;32] = [0u8;32]; + let val = Scalar::to_public_byte_seq_be(*self); + for i in 0..32 { + res[i] = val[i]; + } + res + } + fn is_odd(&self) -> Choice { + todo!() + } + const MODULUS: &'static str = "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141"; + const NUM_BITS: u32 = 256; + const CAPACITY: u32 = 256; // TODO + const TWO_INV: Self = ::ONE; // TODO + const MULTIPLICATIVE_GENERATOR: Self = ::ONE; // TODO + const S: u32 = 42; + const ROOT_OF_UNITY: Self = ::ONE; // TODO + const ROOT_OF_UNITY_INV: Self = ::ONE; // TODO + const DELTA: Self = ::ONE; // TODO + } + + impl Group for Point { + type Scalar = Scalar; + fn random(mut rng: impl RngCore) -> Self { + let b: &mut [u8; 32] = &mut [0u8; 32]; + rng.fill_bytes(b); + Point::Affine(lift_x(FieldElement::from_public_byte_seq_be(PBytes32(*b))).unwrap()) + } + + fn identity() -> Self { todo!() } + fn generator() -> Self { + #[rustfmt::skip] + let gx = PBytes32([ + 0x79u8, 0xBEu8, 0x66u8, 0x7Eu8, 0xF9u8, 0xDCu8, 0xBBu8, 0xACu8, + 0x55u8, 0xA0u8, 0x62u8, 0x95u8, 0xCEu8, 0x87u8, 0x0Bu8, 0x07u8, + 0x02u8, 0x9Bu8, 0xFCu8, 0xDBu8, 0x2Du8, 0xCEu8, 0x28u8, 0xD9u8, + 0x59u8, 0xF2u8, 0x81u8, 0x5Bu8, 0x16u8, 0xF8u8, 0x17u8, 0x98u8 + ]); + #[rustfmt::skip] + let gy = PBytes32([ + 0x48u8, 0x3Au8, 0xDAu8, 0x77u8, 0x26u8, 0xA3u8, 0xC4u8, 0x65u8, + 0x5Du8, 0xA4u8, 0xFBu8, 0xFCu8, 0x0Eu8, 0x11u8, 0x08u8, 0xA8u8, + 0xFDu8, 0x17u8, 0xB4u8, 0x48u8, 0xA6u8, 0x85u8, 0x54u8, 0x19u8, + 0x9Cu8, 0x47u8, 0xD0u8, 0x8Fu8, 0xFBu8, 0x10u8, 0xD4u8, 0xB8u8 + ]); + Point::Affine(( + FieldElement::from_public_byte_seq_be(gx), + FieldElement::from_public_byte_seq_be(gy), + )) + } + fn is_identity(&self) -> Choice { todo!() } + fn double(&self) -> Self { *self + *self } + } + + impl Curve for Point { + type AffineRepr = AffinePoint; + fn to_affine(&self) -> Self::AffineRepr { + finite(*self).unwrap() + } + } +} diff --git a/concordium/Cargo.toml b/concordium/Cargo.toml index 29f53c5..8fe6602 100644 --- a/concordium/Cargo.toml +++ b/concordium/Cargo.toml @@ -9,7 +9,7 @@ path = "src/concordium.rs" [dependencies] # hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } -hax-lib-macros = { path = "../../hacspec-v2/hax-lib-macros/" } +hax-lib-macros = { path = "../../hax/hax-lib-macros/" } # hacspec-attributes = { path = "../../utils/attributes", version = "0.1.0-beta.1" , features = ["print_attributes", "hacspec_unsafe"] } # , features = ["hacspec_unsafe"] , , optional = true # creusot-contracts = { git = "https://github.com/xldenis/creusot", rev = "7763b3ae77205fba83182b9a6c3e69ad0b12fec7" } concordium-contracts-common = { git = "https://github.com/Concordium/concordium-contracts-common", rev = "84ff7db509ca1fbf958b47e5e5903b7662295850", version = "=2.0.0", default-features = false } diff --git a/ovn/Cargo.toml b/ovn/Cargo.toml index d2fa741..ff820d1 100644 --- a/ovn/Cargo.toml +++ b/ovn/Cargo.toml @@ -5,13 +5,16 @@ authors = ["Lasse Letager Hanse "] edition = "2018" [lib] -path = "src/ovn_no_group.rs" +path = "src/ovn_zkgroup.rs" [dependencies] hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } -hax-lib-macros = { path = "../../hacspec-v2/hax-lib-macros/" } +hax-lib-macros = { path = "../../hax/hax-lib-macros/" } hacspec-bip-340 = { path = "../bip-340/" } +group = "0.13" +rand_core = "0.6" + hacspec-concordium = { path = "../concordium" } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a hacspec-concordium-derive = { path = "../concordium-derive" } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a diff --git a/ovn/src/ovn_zkgroup.rs b/ovn/src/ovn_zkgroup.rs new file mode 100644 index 0000000..a642752 --- /dev/null +++ b/ovn/src/ovn_zkgroup.rs @@ -0,0 +1,417 @@ +#![no_std] +#![feature(register_tool)] +#![register_tool(hax)] +#![feature(trait_alias)] + +#[hax_lib_macros::exclude] +extern crate hax_lib_macros; + +#[hax_lib_macros::exclude] +use hax_lib_macros::*; + +#[exclude] +use hacspec_concordium::*; +#[exclude] +use hacspec_concordium_derive::*; + +use ff::Field; +use group::*; +use rand_core::RngCore; + +pub trait MGroup = Group + Field; + +fn pow(x: G, n: G::Scalar) -> G { + if n == Field::ZERO { + G::identity() + } else { + x * pow(x, n - ::ONE) + } +} + +fn g_pow(n: G::Scalar) -> G { + if n == Field::ZERO { + G::identity() + } else { + G::generator() * g_pow::(n - ::ONE) + } +} + +fn hash(inp: Vec) -> G::Scalar { + Field::ONE +} + +fn div(x: G, y: G) -> G { + x * y.invert().unwrap() +} + +//////////////////// +// Implementation // +//////////////////// + +#[derive(SchemaType, Clone, Copy)] +pub struct SchnorrZKPCommit { + pub schnorr_zkp_u: G, + pub schnorr_zkp_c: G::Scalar, + pub schnorr_zkp_z: G::Scalar, +} + +/** Non-interactive Schnorr proof using Fiat-Shamir heuristics (RFC 8235) */ +// https://www.rfc-editor.org/rfc/rfc8235 +// https://crypto.stanford.edu/cs355/19sp/lec5.pdf +pub fn schnorr_zkp( + r: G::Scalar, // random + h: G, + x: G::Scalar, +) -> SchnorrZKPCommit { + let u = g_pow::(r); + let c = hash::(vec![G::generator(), h, u]); + let z = r + c * x; + + return SchnorrZKPCommit { + schnorr_zkp_u: u, + schnorr_zkp_c: c, + schnorr_zkp_z: z, + }; +} + +// https://crypto.stanford.edu/cs355/19sp/lec5.pdf +pub fn schnorr_zkp_validate(h: G, pi: SchnorrZKPCommit) -> bool { + pi.schnorr_zkp_c == hash::(vec![G::generator(), h, pi.schnorr_zkp_u]) + && g_pow::(pi.schnorr_zkp_z) == pi.schnorr_zkp_u * pow::(h, pi.schnorr_zkp_c) +} + +#[derive(SchemaType, Clone, Copy)] +pub struct OrZKPCommit { + pub or_zkp_x: G, + pub or_zkp_y: G, + pub or_zkp_a1: G, + pub or_zkp_b1: G, + pub or_zkp_a2: G, + pub or_zkp_b2: G, + + pub or_zkp_c: G::Scalar, + + pub or_zkp_d1: G::Scalar, + pub or_zkp_d2: G::Scalar, + + pub or_zkp_r1: G::Scalar, + pub or_zkp_r2: G::Scalar, +} + +/** Cramer, Damgård and Schoenmakers (CDS) technique */ +pub fn zkp_one_out_of_two( + w: G::Scalar, // random + rand_r: G::Scalar, + rand_d: G::Scalar, + h: G, + xi: G::Scalar, + vi: bool, +) -> OrZKPCommit { + if vi { + let r1 = rand_r; + let d1 = rand_d; + + let x = g_pow::(xi); + let y = pow::(h, xi) * G::generator(); + + let a1 = g_pow::(r1) * pow::(x, d1); + let b1 = pow::(h, r1) * pow::(y, d1); + + let a2 = g_pow::(w); + let b2 = pow::(h, w); + + let c = hash::(vec![x, y, a1, b1, a2, b2]); + + let d2 = c - d1; + let r2 = w - xi * d2; + + OrZKPCommit { + or_zkp_x: x, + or_zkp_y: y, + or_zkp_a1: a1, + or_zkp_b1: b1, + or_zkp_a2: a2, + or_zkp_b2: b2, + or_zkp_c: c, + or_zkp_d1: d1, + or_zkp_d2: d2, + or_zkp_r1: r1, + or_zkp_r2: r2, + } + } else { + let r2 = rand_r; + let d2 = rand_d; + + let x = g_pow::(xi); + let y = pow::(h, xi); + + let a1 = g_pow::(w); + let b1 = pow::(h, w); + + let a2 = g_pow::(r2) * pow::(x, d2); + let b2 = pow::(h, r2) * pow::(div::(y, G::generator()), d2); + + let c = hash::(vec![x, y, a1, b1, a2, b2]); + + let d1 = c - d2; + let r1 = w - xi * d1; + + OrZKPCommit { + or_zkp_x: x, + or_zkp_y: y, + or_zkp_a1: a1, + or_zkp_b1: b1, + or_zkp_a2: a2, + or_zkp_b2: b2, + or_zkp_c: c, + or_zkp_d1: d1, + or_zkp_d2: d2, + or_zkp_r1: r1, + or_zkp_r2: r2, + } + } +} + +// Anonymous voting by two-round public discussion +pub fn zkp_one_out_of_two_validate(h: G, zkp: OrZKPCommit) -> bool { + let c = hash::(vec![ + zkp.or_zkp_x, + zkp.or_zkp_y, + zkp.or_zkp_a1, + zkp.or_zkp_b1, + zkp.or_zkp_a2, + zkp.or_zkp_b2, + ]); // TODO: add i + + (c == zkp.or_zkp_d1 + zkp.or_zkp_d2 + && zkp.or_zkp_a1 == g_pow::(zkp.or_zkp_r1) * pow::(zkp.or_zkp_x, zkp.or_zkp_d1) + && zkp.or_zkp_b1 == pow::(h, zkp.or_zkp_r1) * pow::(zkp.or_zkp_y, zkp.or_zkp_d1) + && zkp.or_zkp_a2 == g_pow::(zkp.or_zkp_r2) * pow::(zkp.or_zkp_x, zkp.or_zkp_d2) + && zkp.or_zkp_b2 + == pow::(h, zkp.or_zkp_r2) + * pow::(div::(zkp.or_zkp_y, G::generator()), zkp.or_zkp_d2)) +} + +pub fn commit_to(g_pow_xi_yi_vi: G) -> G::Scalar { + hash::(vec![g_pow_xi_yi_vi]) +} + +pub fn check_commitment(g_pow_xi_yi_vi: G, commitment: G::Scalar) -> bool { + hash::(vec![g_pow_xi_yi_vi]) == commitment +} + +#[hax::contract_state(contract = "OVN")] +// #[cfg_attr(not(feature = "hax_compilation"), contract_state(contract = "OVN"))] +#[derive(SchemaType, Clone, Copy)] +pub struct OvnContractState { + pub g_pow_xis: [G; n], + pub zkp_xis: [SchnorrZKPCommit; n], + + pub commit_vis: [G::Scalar; n], + + pub g_pow_xi_yi_vis: [G; n], + pub zkp_vis: [OrZKPCommit; n], + + pub tally: u32, +} + +#[hax::init(contract = "OVN")] +// #[cfg_attr(not(feature = "hax_compilation"), init(contract = "OVN"))] +pub fn init_ovn_contract(// _: &impl HasInitContext, +) -> InitResult> { + Ok(OvnContractState:: { + g_pow_xis: [::ONE; n], + zkp_xis: [SchnorrZKPCommit:: { + schnorr_zkp_u: ::ONE, + schnorr_zkp_z: G::Scalar::ZERO, + schnorr_zkp_c: G::Scalar::ZERO, + }; n], + + commit_vis: [G::Scalar::ZERO; n], + + g_pow_xi_yi_vis: [::ONE; n], + zkp_vis: [OrZKPCommit:: { + or_zkp_x: ::ONE, + or_zkp_y: ::ONE, + or_zkp_a1: ::ONE, + or_zkp_b1: ::ONE, + or_zkp_a2: ::ONE, + or_zkp_b2: ::ONE, + + or_zkp_c: G::Scalar::ZERO, + + or_zkp_d1: G::Scalar::ZERO, + or_zkp_d2: G::Scalar::ZERO, + + or_zkp_r1: G::Scalar::ZERO, + or_zkp_r2: G::Scalar::ZERO, + }; n], + + tally: 0, + }) +} + +/** Currently randomness needs to be injected */ +pub fn select_private_voting_key( + rand: impl RngCore + Copy, + ) -> Z { + Z::random(rand) +} + +#[derive(Serialize, SchemaType)] +pub struct RegisterParam { + pub rp_i: u32, + pub rp_xi: Z, + pub rp_zkp_random: Z, +} + +/** Primary function in round 1 */ +#[hax::receive(contract = "OVN", name = "register", parameter = "RegisterParam")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "register", parameter = "RegisterParam"))] +pub fn register_vote( + ctx: impl HasReceiveContext, + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> where G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial { + let params: RegisterParam = ctx.parameter_cursor().get()?; + let g_pow_xi = g_pow::(params.rp_xi); + + let zkp_xi = schnorr_zkp::(params.rp_zkp_random, g_pow_xi, params.rp_xi); + + let mut register_vote_state_ret = state.clone(); + register_vote_state_ret.g_pow_xis[params.rp_i as usize] = g_pow_xi; + register_vote_state_ret.zkp_xis[params.rp_i as usize] = zkp_xi; + + Ok((A::accept(), register_vote_state_ret)) +} + +#[derive(Serialize, SchemaType)] +pub struct CastVoteParam { + pub cvp_i: u32, + pub cvp_xi: Z, + pub cvp_zkp_random_w: Z, + pub cvp_zkp_random_r: Z, + pub cvp_zkp_random_d: Z, + pub cvp_vote: bool, +} + +pub fn compute_g_pow_yi(i: usize, xis: [G; n]) -> G { + let mut prod1 = ::ONE; + for j in 0..i { + prod1 = prod1 * xis[j]; + } + + let mut prod2 = ::ONE; + for j in (i + 1)..n { + prod2 = prod2 * xis[j]; + } + + // implicitly: Y_i = g^y_i + let g_pow_yi = div::(prod1, prod2); + g_pow_yi +} + +pub fn compute_group_element_for_vote(xi: G::Scalar, vote: bool, g_pow_yi: G) -> G { + pow::(g_pow_yi, xi) + * g_pow::(if vote { + G::Scalar::ONE + } else { + G::Scalar::ZERO + }) +} + +/** Commitment before round 2 */ +#[hax::receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam"))] +pub fn commit_to_vote( + ctx: impl HasReceiveContext, + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> where G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial { + let params: CastVoteParam = ctx.parameter_cursor().get()?; + + for i in 0..n { + if !schnorr_zkp_validate(state.g_pow_xis[i], state.zkp_xis[i]) { + return Err(ParseError {}); + } + } + + let g_pow_yi = compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); + let g_pow_xi_yi_vi = + compute_group_element_for_vote::(params.cvp_xi, params.cvp_vote, g_pow_yi); + let commit_vi = commit_to::(g_pow_xi_yi_vi); + + let mut commit_to_vote_state_ret = state.clone(); + commit_to_vote_state_ret.commit_vis[params.cvp_i as usize] = commit_vi; + Ok((A::accept(), commit_to_vote_state_ret)) +} + +/** Primary function in round 2, also opens commitment */ +#[hax::receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam"))] +pub fn cast_vote( + ctx: impl HasReceiveContext, + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError>where G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial { + let params: CastVoteParam = ctx.parameter_cursor().get()?; + + let g_pow_yi = compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); + let g_pow_xi_yi_vi = + compute_group_element_for_vote::(params.cvp_xi, params.cvp_vote, g_pow_yi); + + let zkp_vi = zkp_one_out_of_two::( + params.cvp_zkp_random_w, + params.cvp_zkp_random_r, + params.cvp_zkp_random_d, + g_pow_yi, + params.cvp_xi, + params.cvp_vote, + ); + let mut cast_vote_state_ret = state.clone(); + cast_vote_state_ret.g_pow_xi_yi_vis[params.cvp_i as usize] = g_pow_xi_yi_vi; + cast_vote_state_ret.zkp_vis[params.cvp_i as usize] = zkp_vi; + + Ok((A::accept(), cast_vote_state_ret)) +} + +#[derive(SchemaType)] +pub struct TallyParameter {} + +#[hax::receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "tally", parameter = "TallyParameter"))] +/** Anyone can tally the votes */ +pub fn tally_votes( + _: impl HasReceiveContext, + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError>where G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial { + for i in 0..n { + let g_pow_yi = compute_g_pow_yi::(i as usize, state.g_pow_xis); + if !zkp_one_out_of_two_validate::(g_pow_yi, state.zkp_vis[i]) { + return Err(ParseError {}); + } + if !check_commitment::(state.g_pow_xi_yi_vis[i], state.commit_vis[i]) { + return Err(ParseError {}); + } + } + + let mut vote_result = ::ONE; + for g_pow_vote in state.g_pow_xi_yi_vis { + vote_result = vote_result * g_pow_vote; + } + + let mut tally = 0; + let mut curr = G::Scalar::ZERO; + for i in 0..n as u32 { + // Should be while, but is bounded by n anyways! + if g_pow::(curr) == vote_result { + tally = i; + } + + curr = curr + G::Scalar::ONE; + } + + let mut tally_votes_state_ret = state.clone(); + tally_votes_state_ret.tally = tally; + + Ok((A::accept(), tally_votes_state_ret)) +} + +// https://github.com/stonecoldpat/anonymousvoting From bf67e20be86ca40d4256a0947b06455a79867c80 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 12 Mar 2024 20:07:54 +0100 Subject: [PATCH 73/86] Restructure ovn --- concordium/src/concordium.rs | 2 +- ovn/Cargo.toml | 3 +- ovn/src/lib.rs | 10 ++ ovn/src/ovn_group.rs | 10 +- ovn/src/ovn_secp256k1.rs | 204 ++++++++++++++++++++++++ ovn/src/ovn_zkgroup.rs | 6 - ovn/tests/ovn_example.rs | 301 ++--------------------------------- ovn/tests/ovn_zk_example.rs | 260 ++++++++++++++++++++++++++++++ 8 files changed, 490 insertions(+), 306 deletions(-) create mode 100644 ovn/src/lib.rs create mode 100644 ovn/src/ovn_secp256k1.rs create mode 100644 ovn/tests/ovn_zk_example.rs diff --git a/concordium/src/concordium.rs b/concordium/src/concordium.rs index f9c5508..d793169 100644 --- a/concordium/src/concordium.rs +++ b/concordium/src/concordium.rs @@ -56,7 +56,7 @@ mod concordium_impls; mod concordium_types; mod concordium_traits; -// pub mod test_infrastructure; +pub mod test_infrastructure; use concordium_prims::*; // TODO: Does not re-export anything, nothing is public enough (removed pub) pub use concordium_impls::*; diff --git a/ovn/Cargo.toml b/ovn/Cargo.toml index ff820d1..c2bc6d5 100644 --- a/ovn/Cargo.toml +++ b/ovn/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Lasse Letager Hanse "] edition = "2018" [lib] -path = "src/ovn_zkgroup.rs" +path = "src/lib.rs" [dependencies] hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } @@ -24,6 +24,7 @@ quickcheck_macros = "1" [dev-dependencies] criterion = "0.4" rand = "0.8" +bls12_381 = "*" [features] hax_compilation = [] diff --git a/ovn/src/lib.rs b/ovn/src/lib.rs new file mode 100644 index 0000000..ece4f96 --- /dev/null +++ b/ovn/src/lib.rs @@ -0,0 +1,10 @@ +#![no_std] +#![feature(register_tool)] +#![register_tool(hax)] +#![feature(trait_alias)] + +pub mod ovn_traits; +pub mod ovn_z_89; +pub mod ovn_secp256k1; +pub mod ovn_group; +pub mod ovn_zkgroup; diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs index 0e9da1b..610bb47 100644 --- a/ovn/src/ovn_group.rs +++ b/ovn/src/ovn_group.rs @@ -1,10 +1,3 @@ -#![no_std] -#![feature(register_tool)] -#![register_tool(hax)] - -#[hax_lib_macros::exclude] -extern crate hax_lib_macros; - #[hax_lib_macros::exclude] use hax_lib_macros::*; @@ -13,8 +6,7 @@ use hacspec_concordium::*; #[exclude] use hacspec_concordium_derive::*; -mod ovn_traits; -pub use ovn_traits::*; +pub use crate::ovn_traits::*; //////////////////// // Implementation // diff --git a/ovn/src/ovn_secp256k1.rs b/ovn/src/ovn_secp256k1.rs new file mode 100644 index 0000000..cb6d1fb --- /dev/null +++ b/ovn/src/ovn_secp256k1.rs @@ -0,0 +1,204 @@ +#![no_std] +#![feature(register_tool)] +#![register_tool(hax)] + +#[hax_lib_macros::exclude] +extern crate hax_lib_macros; + +#[hax_lib_macros::exclude] +use hax_lib_macros::*; + +#[exclude] +use hacspec_concordium::*; +#[exclude] +use hacspec_concordium_derive::*; + +pub use crate::ovn_traits::*; + +// // pub use create::ovn_traits::*; +// use create::Z_Field; +// use create::Group; +// use create::Z_Field; + +use hacspec_lib::*; + +//////////////////////// +// Impl for Secp256k1 // +//////////////////////// + +use hacspec_bip_340::*; + +#[derive(core::marker::Copy, Clone, PartialEq, Eq)] +pub struct Z_curve { + val: Scalar, +} + +impl hacspec_concordium::Deserial for Z_curve { + // TODO: + fn deserial(_source: &mut R) -> ParseResult { + let buffer : &mut [u8] = &mut []; + let _ = _source.read(buffer)?; + + Ok(Z_curve { + val: Scalar::from_public_byte_seq_be(Seq::::from_native_slice(buffer)), + }) + } +} + +impl hacspec_concordium::Serial for Z_curve { + // TODO: + fn serial(&self, _out: &mut W) -> Result<(), W::Err> { + _out.write(self.val.to_public_byte_seq_be().native_slice()); + Ok(()) + } +} + +impl Z_Field for Z_curve { + type field_type = Z_curve; + + fn q() -> Self::field_type { + Z_curve { + val: Scalar::from_hex( + "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", + ), + } // TODO: Scalar::modulo_value; + } + + fn random_field_elem(random: u32) -> Self::field_type { + Z_curve { + val: Scalar::from_literal(random as u128), + } + } + + fn field_zero() -> Self::field_type { + Z_curve { + val: Scalar::from_literal(0u128), + } // Scalar::ZERO() + } + + fn field_one() -> Self::field_type { + Z_curve { + val: Scalar::from_literal(1u128), + } // Scalar::ONE() + } + + fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { + Z_curve { val: x.val + y.val } + } + + fn sub(x: Self::field_type, y: Self::field_type) -> Self::field_type { + Z_curve { val: x.val - y.val } + } + + fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { + Z_curve { val: x.val * y.val } + } +} + +#[derive(core::marker::Copy, Clone, PartialEq, Eq)] +pub struct Group_curve { + val: Point, +} + +impl hacspec_concordium::Deserial for Group_curve { + // TODO: + fn deserial(_source: &mut R) -> ParseResult { + let buffer : &mut [u8] = &mut []; + let _ = _source.read(buffer)?; + if let [0] = buffer { + return Ok(Group_curve { val: Point::AtInfinity }) + } + + let buffer_y : &mut [u8] = &mut []; + let _ = _source.read(buffer_y)?; + + Ok(Group_curve { + val: Point::Affine((FieldElement::from_public_byte_seq_be(Seq::::from_native_slice(buffer)), + FieldElement::from_public_byte_seq_be(Seq::::from_native_slice(buffer_y)))), + }) + } +} + +impl hacspec_concordium::Serial for Group_curve { + // TODO: + fn serial(&self, _out: &mut W) -> Result<(), W::Err> { + match self.val { + Point::Affine(p) => + { + _out.write(x(p).to_public_byte_seq_be().native_slice()); + _out.write(y(p).to_public_byte_seq_be().native_slice()) + }, + Point::AtInfinity => _out.write(&[0]), + }; + Ok(()) + } +} + +impl Group for Group_curve { + type group_type = Group_curve; + + // https://eips.ethereum.org/EIPS/eip-2333 + fn g() -> Self::group_type { + #[rustfmt::skip] + let gx = PBytes32([ + 0x79u8, 0xBEu8, 0x66u8, 0x7Eu8, 0xF9u8, 0xDCu8, 0xBBu8, 0xACu8, + 0x55u8, 0xA0u8, 0x62u8, 0x95u8, 0xCEu8, 0x87u8, 0x0Bu8, 0x07u8, + 0x02u8, 0x9Bu8, 0xFCu8, 0xDBu8, 0x2Du8, 0xCEu8, 0x28u8, 0xD9u8, + 0x59u8, 0xF2u8, 0x81u8, 0x5Bu8, 0x16u8, 0xF8u8, 0x17u8, 0x98u8 + ]); + #[rustfmt::skip] + let gy = PBytes32([ + 0x48u8, 0x3Au8, 0xDAu8, 0x77u8, 0x26u8, 0xA3u8, 0xC4u8, 0x65u8, + 0x5Du8, 0xA4u8, 0xFBu8, 0xFCu8, 0x0Eu8, 0x11u8, 0x08u8, 0xA8u8, + 0xFDu8, 0x17u8, 0xB4u8, 0x48u8, 0xA6u8, 0x85u8, 0x54u8, 0x19u8, + 0x9Cu8, 0x47u8, 0xD0u8, 0x8Fu8, 0xFBu8, 0x10u8, 0xD4u8, 0xB8u8 + ]); + Group_curve { + val: Point::Affine(( + FieldElement::from_public_byte_seq_be(gx), + FieldElement::from_public_byte_seq_be(gy), + )), + } + } // TODO + + fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { + Group_curve { + val: point_mul(x.val, g.val), + } + } + + fn g_pow(x: ::field_type) -> Self::group_type { + Group_curve { + val: point_mul_base(x.val), + } + // Self::pow(Self::g(), x) + } + + fn group_one() -> Self::group_type { + Self::g_pow(::field_zero()) + } + + fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { + Group_curve { + val: point_add(x.val, y.val), + } + } + + fn inv(x: Self::group_type) -> Self::group_type { + Group_curve { + val: match x.val { + Point::Affine((a,b)) => Point::Affine((a, FieldElement::from_literal(0u128)-b)), + Point::AtInfinity => Point::AtInfinity, // TODO? + } + } + } + + fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { + Self::prod(x, Self::inv(y)) + } + + fn hash(x: Vec) -> ::field_type { + // fp_hash_to_field + Z_curve::field_one() // TODO: bls12-381 hash to curve? + } +} diff --git a/ovn/src/ovn_zkgroup.rs b/ovn/src/ovn_zkgroup.rs index a642752..b53900c 100644 --- a/ovn/src/ovn_zkgroup.rs +++ b/ovn/src/ovn_zkgroup.rs @@ -1,11 +1,5 @@ -#![no_std] -#![feature(register_tool)] -#![register_tool(hax)] #![feature(trait_alias)] -#[hax_lib_macros::exclude] -extern crate hax_lib_macros; - #[hax_lib_macros::exclude] use hax_lib_macros::*; diff --git a/ovn/tests/ovn_example.rs b/ovn/tests/ovn_example.rs index 8cad312..3e9e82a 100644 --- a/ovn/tests/ovn_example.rs +++ b/ovn/tests/ovn_example.rs @@ -8,9 +8,9 @@ extern crate hax_lib_macros; #[hax_lib_macros::exclude] use hax_lib_macros::*; -#[exclude] +// #[exclude] use hacspec_concordium::*; -#[exclude] +// #[exclude] use hacspec_concordium_derive::*; #[cfg(test)] @@ -22,286 +22,9 @@ extern crate quickcheck_macros; #[cfg(test)] use quickcheck::*; -#[cfg(test)] -use rand::random; - -extern crate hacspec_lib; -use hacspec_lib::*; - -//////////////////// -// Impl for Z/89Z // -//////////////////// - -pub use hacspec_ovn::*; -// pub use ovn_group::*; -// pub use ovn_trait::*; - -// #[derive(Clone, Copy)] -// pub struct z_89 {} -// impl Z_Field for z_89 { -// type field_type = u32; -// fn q() -> Self::field_type { -// 89u32 -// } // Prime order -// fn random_field_elem(random: u32) -> Self::field_type { -// random % (Self::q() - 1) -// } - -// fn field_zero() -> Self::field_type { -// 0u32 -// } - -// fn field_one() -> Self::field_type { -// 1u32 -// } - -// fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { -// (x + y) % (Self::q() - 1) -// } - -// fn sub(x: Self::field_type, y: Self::field_type) -> Self::field_type { -// (x + (Self::q() - 1) - y) % (Self::q() - 1) -// } - -// fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { -// (x * y) % (Self::q() - 1) -// } -// } - -// #[derive(Clone, Copy)] -// pub struct g_z_89 {} -// impl Group for g_z_89 { -// type group_type = u32; - -// fn g() -> Self::group_type { -// 3u32 -// } // Generator (elemnent of group) - -// fn hash(x: Vec) -> ::field_type { -// let mut res = z_89::field_one(); -// for y in x { -// res = z_89::mul(y, res); -// } -// res // TODO -// } - -// fn g_pow(x: ::field_type) -> Self::group_type { -// Self::pow(Self::g(), x) -// } - -// // TODO: use repeated squaring instead! -// fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { -// let mut result = Self::group_one(); -// for i in 0..(x % (z_89::q() - 1)) { -// result = Self::prod(result, g); -// } -// result -// } - -// fn group_one() -> Self::group_type { -// 1 -// } - -// fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { -// ((x % z_89::q()) * (y % z_89::q())) % z_89::q() -// } - -// fn inv(x: Self::group_type) -> Self::group_type { -// for j in 0..89 { -// if Self::prod(x, j) == Self::group_one() { -// return j; -// } -// } -// assert!(false); -// return x; -// } - -// fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { -// Self::prod(x, Self::inv(y)) -// } -// } - -//////////////////////// -// Impl for Secp256k1 // -//////////////////////// - -use hacspec_bip_340::*; - -#[derive(core::marker::Copy, Clone, PartialEq, Eq)] -struct Z_curve { - val: Scalar, -} - -impl hacspec_concordium::Deserial for Z_curve { - // TODO: - fn deserial(_source: &mut R) -> ParseResult { - let buffer : &mut [u8] = &mut []; - let _ = _source.read(buffer)?; - - Ok(Z_curve { - val: Scalar::from_public_byte_seq_be(Seq::::from_native_slice(buffer)), - }) - } -} - -impl hacspec_concordium::Serial for Z_curve { - // TODO: - fn serial(&self, _out: &mut W) -> Result<(), W::Err> { - _out.write(self.val.to_public_byte_seq_be().native_slice()); - Ok(()) - } -} - -impl Z_Field for Z_curve { - type field_type = Z_curve; - - fn q() -> Self::field_type { - Z_curve { - val: Scalar::from_hex( - "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", - ), - } // TODO: Scalar::modulo_value; - } - - fn random_field_elem(random: u32) -> Self::field_type { - Z_curve { - val: Scalar::from_literal(random as u128), - } - } - - fn field_zero() -> Self::field_type { - Z_curve { - val: Scalar::from_literal(0u128), - } // Scalar::ZERO() - } - - fn field_one() -> Self::field_type { - Z_curve { - val: Scalar::from_literal(1u128), - } // Scalar::ONE() - } - - fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { - Z_curve { val: x.val + y.val } - } - - fn sub(x: Self::field_type, y: Self::field_type) -> Self::field_type { - Z_curve { val: x.val - y.val } - } - - fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { - Z_curve { val: x.val * y.val } - } -} - -#[derive(core::marker::Copy, Clone, PartialEq, Eq)] -struct Group_curve { - val: Point, -} - -impl hacspec_concordium::Deserial for Group_curve { - // TODO: - fn deserial(_source: &mut R) -> ParseResult { - let buffer : &mut [u8] = &mut []; - let _ = _source.read(buffer)?; - if let [0] = buffer { - return Ok(Group_curve { val: Point::AtInfinity }) - } - - let buffer_y : &mut [u8] = &mut []; - let _ = _source.read(buffer_y)?; - - Ok(Group_curve { - val: Point::Affine((FieldElement::from_public_byte_seq_be(Seq::::from_native_slice(buffer)), - FieldElement::from_public_byte_seq_be(Seq::::from_native_slice(buffer_y)))), - }) - } -} - -impl hacspec_concordium::Serial for Group_curve { - // TODO: - fn serial(&self, _out: &mut W) -> Result<(), W::Err> { - match self.val { - Point::Affine(p) => - { - _out.write(x(p).to_public_byte_seq_be().native_slice()); - _out.write(y(p).to_public_byte_seq_be().native_slice()) - }, - Point::AtInfinity => _out.write(&[0]), - }; - Ok(()) - } -} - -impl Group for Group_curve { - type group_type = Group_curve; - - // https://eips.ethereum.org/EIPS/eip-2333 - fn g() -> Self::group_type { - #[rustfmt::skip] - let gx = PBytes32([ - 0x79u8, 0xBEu8, 0x66u8, 0x7Eu8, 0xF9u8, 0xDCu8, 0xBBu8, 0xACu8, - 0x55u8, 0xA0u8, 0x62u8, 0x95u8, 0xCEu8, 0x87u8, 0x0Bu8, 0x07u8, - 0x02u8, 0x9Bu8, 0xFCu8, 0xDBu8, 0x2Du8, 0xCEu8, 0x28u8, 0xD9u8, - 0x59u8, 0xF2u8, 0x81u8, 0x5Bu8, 0x16u8, 0xF8u8, 0x17u8, 0x98u8 - ]); - #[rustfmt::skip] - let gy = PBytes32([ - 0x48u8, 0x3Au8, 0xDAu8, 0x77u8, 0x26u8, 0xA3u8, 0xC4u8, 0x65u8, - 0x5Du8, 0xA4u8, 0xFBu8, 0xFCu8, 0x0Eu8, 0x11u8, 0x08u8, 0xA8u8, - 0xFDu8, 0x17u8, 0xB4u8, 0x48u8, 0xA6u8, 0x85u8, 0x54u8, 0x19u8, - 0x9Cu8, 0x47u8, 0xD0u8, 0x8Fu8, 0xFBu8, 0x10u8, 0xD4u8, 0xB8u8 - ]); - Group_curve { - val: Point::Affine(( - FieldElement::from_public_byte_seq_be(gx), - FieldElement::from_public_byte_seq_be(gy), - )), - } - } // TODO - - fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { - Group_curve { - val: point_mul(x.val, g.val), - } - } - - fn g_pow(x: ::field_type) -> Self::group_type { - Group_curve { - val: point_mul_base(x.val), - } - // Self::pow(Self::g(), x) - } - - fn group_one() -> Self::group_type { - Self::g_pow(::field_zero()) - } - - fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { - Group_curve { - val: point_add(x.val, y.val), - } - } - - fn inv(x: Self::group_type) -> Self::group_type { - Group_curve { - val: match x.val { - Point::Affine((a,b)) => Point::Affine((a, FieldElement::from_literal(0u128)-b)), - Point::AtInfinity => Point::AtInfinity, // TODO? - } - } - } - - fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { - Self::prod(x, Self::inv(y)) - } - - fn hash(x: Vec) -> ::field_type { - // fp_hash_to_field - Z_curve::field_one() // TODO: bls12-381 hash to curve? - } -} - +pub use hacspec_ovn::ovn_z_89::*; +pub use hacspec_ovn::ovn_secp256k1::*; +pub use hacspec_ovn::ovn_group::*; #[test] pub fn schorr_zkp_correctness() { @@ -525,10 +248,10 @@ fn test_full_z89() { .quickcheck(randomized_full_test:: as fn() -> bool) } -// #[concordium_test] -#[test] -fn test_full_secp256k1() { - QuickCheck::new() - .tests(1) - .quickcheck(randomized_full_test:: as fn() -> bool) -} +// // #[concordium_test] +// #[test] +// fn test_full_secp256k1() { +// QuickCheck::new() +// .tests(1) +// .quickcheck(randomized_full_test:: as fn() -> bool) +// } diff --git a/ovn/tests/ovn_zk_example.rs b/ovn/tests/ovn_zk_example.rs new file mode 100644 index 0000000..ba29a0c --- /dev/null +++ b/ovn/tests/ovn_zk_example.rs @@ -0,0 +1,260 @@ +#[hax_lib_macros::exclude] +use hax_lib_macros::*; + +#[exclude] +use hacspec_concordium::*; +#[exclude] +use hacspec_concordium_derive::*; + +#[cfg(test)] +extern crate quickcheck; +#[cfg(test)] +#[macro_use(quickcheck)] +extern crate quickcheck_macros; + +#[cfg(test)] +use quickcheck::*; + +pub use bls12_381::*; +pub use hacspec_ovn::ovn_zkgroup::*; +pub use group::ff::Field; + +struct bls_g_ty (Gt); + +impl Field for bls_g_ty { + +} + +impl Group for bls_g_ty { + +} + +#[test] +pub fn schorr_zkp_correctness() { + fn test(random_x: u32, random_r: u32) -> bool { + type G = bls_g_ty; + + let x: u32 = G::random(random_x); + // let pow_x = G::g_pow(x); + + // let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); + + // let valid = schnorr_zkp_validate::(pow_x, pi); + // valid + true + } + + QuickCheck::new() + .tests(10000) + .quickcheck(test as fn(u32, u32) -> bool) +} + +// #[test] +// pub fn schorr_zkp_secp256k1_correctness() { +// fn test(random_x: u32, random_r: u32) -> bool { +// type Z = Z_curve; +// type G = Group_curve; + +// let x: Z_curve = Z::random_field_elem(random_x); +// let pow_x = G::g_pow(x); + +// let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); + +// let valid = schnorr_zkp_validate::(pow_x, pi); +// valid +// } + +// QuickCheck::new() +// .tests(10) +// .quickcheck(test as fn(u32, u32) -> bool) +// } + +// #[cfg(test)] +// pub fn or_zkp_correctness>( +// random_w: u32, +// random_r: u32, +// random_d: u32, +// random_h: u32, +// random_x: u32, +// v: bool, +// ) -> bool { +// let mut h = G::g_pow(Z::random_field_elem(random_h)); +// let x = Z::random_field_elem(random_x); +// let pi: OrZKPCommit = zkp_one_out_of_two(random_w, random_r, random_d, h, x, v); +// let valid = zkp_one_out_of_two_validate::(h, pi); +// valid +// } + +// #[test] +// pub fn or_zkp_correctness_z89(){ +// QuickCheck::new() +// .tests(10000) +// .quickcheck(or_zkp_correctness:: as fn(u32, u32, u32, u32, u32, bool) -> bool) +// } + +// #[test] +// // TODO: Fix inverse opeation, should make this test parse +// pub fn or_zkp_secp256k1_correctness() { +// QuickCheck::new() +// .tests(10) +// .quickcheck(or_zkp_correctness:: as fn(u32, u32, u32, u32, u32, bool) -> bool) +// } + +// #[cfg(test)] +// pub fn sum_to_zero, const n: usize>() { +// let mut xis: [Z::field_type; n] = [Z::field_zero(); n]; +// let mut g_pow_xis: [G::group_type; n] = [G::group_one(); n]; +// use rand::random; +// for i in 0..n { +// xis[i] = Z::random_field_elem(random()); +// g_pow_xis[i] = G::g_pow(xis[i]); +// } + +// let mut res = G::group_one(); +// for i in 0..n { +// let g_pow_yi = compute_g_pow_yi::(i, g_pow_xis); +// res = G::prod(res, G::pow(g_pow_yi, xis[i])); +// } + +// assert!(res == G::group_one()); +// } + +// #[test] +// pub fn sum_to_zero_z89() { +// sum_to_zero::() +// } + +// #[test] +// pub fn sum_to_zero_secp256k1() { +// sum_to_zero::() +// } + +// #[cfg(test)] +// pub fn test_correctness, const n: usize, A: HasActions>( +// votes: [bool; n], +// xis: [Z::field_type; n], +// rp_zkp_randoms: [u32; n], +// cvp_zkp_random_ws1: [u32; n], +// cvp_zkp_random_rs1: [u32; n], +// cvp_zkp_random_ds1: [u32; n], +// cvp_zkp_random_ws2: [u32; n], +// cvp_zkp_random_rs2: [u32; n], +// cvp_zkp_random_ds2: [u32; n], +// ) -> bool { +// // Setup the context +// let mut ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); + +// let mut state: OvnContractState = init_ovn_contract().unwrap(); + +// for i in 0..n { +// let parameter = RegisterParam:: { +// rp_i: i as u32, +// rp_xi: xis[i], +// rp_zkp_random: rp_zkp_randoms[i], +// }; +// let parameter_bytes = to_bytes(¶meter); +// (_, state) = +// register_vote::(ctx.clone().set_parameter(¶meter_bytes), state) +// .unwrap(); +// } + +// for i in 0..n { +// let parameter = CastVoteParam:: { +// cvp_i: i as u32, +// cvp_xi: xis[i], +// cvp_zkp_random_w: cvp_zkp_random_ws1[i], +// cvp_zkp_random_r: cvp_zkp_random_rs1[i], +// cvp_zkp_random_d: cvp_zkp_random_ds1[i], +// cvp_vote: votes[i], +// }; +// let parameter_bytes = to_bytes(¶meter); +// (_, state) = +// commit_to_vote::(ctx.clone().set_parameter(¶meter_bytes), state) +// .unwrap(); +// } + +// for i in 0..n { +// let parameter = CastVoteParam:: { +// cvp_i: i as u32, +// cvp_xi: xis[i], +// cvp_zkp_random_w: cvp_zkp_random_ws2[i], +// cvp_zkp_random_r: cvp_zkp_random_rs2[i], +// cvp_zkp_random_d: cvp_zkp_random_ds2[i], +// cvp_vote: votes[i], +// }; +// let parameter_bytes = to_bytes(¶meter); +// (_, state) = +// cast_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); +// } + +// let parameter = TallyParameter {}; +// let parameter_bytes = to_bytes(¶meter); +// ctx = ctx.set_parameter(¶meter_bytes); + +// (_, state) = tally_votes::(ctx.clone(), state).unwrap(); + +// let mut count = 0u32; +// for v in votes { +// if v { +// count = count + 1; // += 1 does not work correctly +// } +// } + +// assert_eq!(state.tally, count); +// state.tally == count +// } + +// #[cfg(test)] +// fn randomized_full_test, const n: usize> () -> bool { +// use rand::random; +// let mut votes: [bool; n] = [false; n]; +// let mut xis: [Z::field_type; n] = [Z::field_zero(); n]; +// let mut rp_zkp_randoms: [u32; n] = [0; n]; +// let mut cvp_zkp_random_ws1: [u32; n] = [0; n]; +// let mut cvp_zkp_random_rs1: [u32; n] = [0; n]; +// let mut cvp_zkp_random_ds1: [u32; n] = [0; n]; + +// let mut cvp_zkp_random_ws2: [u32; n] = [0; n]; +// let mut cvp_zkp_random_rs2: [u32; n] = [0; n]; +// let mut cvp_zkp_random_ds2: [u32; n] = [0; n]; + +// for i in 0..n { +// votes[i] = random(); +// xis[i] = Z::random_field_elem(random()); +// rp_zkp_randoms[i] = random(); +// cvp_zkp_random_ws1[i] = random(); +// cvp_zkp_random_rs1[i] = random(); +// cvp_zkp_random_ds1[i] = random(); +// cvp_zkp_random_ws2[i] = random(); +// cvp_zkp_random_rs2[i] = random(); +// cvp_zkp_random_ds2[i] = random(); +// } + +// test_correctness::( +// votes, +// xis, +// rp_zkp_randoms, +// cvp_zkp_random_ws1, +// cvp_zkp_random_rs1, +// cvp_zkp_random_ds1, +// cvp_zkp_random_ws2, +// cvp_zkp_random_rs2, +// cvp_zkp_random_ds2, +// ) +// } + +// // #[concordium_test] +// #[test] +// fn test_full_z89() { +// QuickCheck::new() +// .tests(100) +// .quickcheck(randomized_full_test:: as fn() -> bool) +// } + +// // #[concordium_test] +// #[test] +// fn test_full_secp256k1() { +// QuickCheck::new() +// .tests(1) +// .quickcheck(randomized_full_test:: as fn() -> bool) +// } From fbe1cd9846a982174b11dd635d51333b5cda8793 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 12 Mar 2024 20:33:26 +0100 Subject: [PATCH 74/86] Fix use of (multiplicative) group opration, instead of assuming field --- ovn/src/lib.rs | 3 + ovn/src/ovn_zk_z_89.rs | 111 ++++++++++++++++++++++++++++++++++++ ovn/src/ovn_zkgroup.rs | 62 ++++++++++---------- ovn/tests/ovn_zk_example.rs | 18 ++---- 4 files changed, 150 insertions(+), 44 deletions(-) create mode 100644 ovn/src/ovn_zk_z_89.rs diff --git a/ovn/src/lib.rs b/ovn/src/lib.rs index ece4f96..9b43723 100644 --- a/ovn/src/lib.rs +++ b/ovn/src/lib.rs @@ -4,7 +4,10 @@ #![feature(trait_alias)] pub mod ovn_traits; + pub mod ovn_z_89; pub mod ovn_secp256k1; pub mod ovn_group; + +pub mod ovn_zk_z_89; pub mod ovn_zkgroup; diff --git a/ovn/src/ovn_zk_z_89.rs b/ovn/src/ovn_zk_z_89.rs new file mode 100644 index 0000000..c9d13f5 --- /dev/null +++ b/ovn/src/ovn_zk_z_89.rs @@ -0,0 +1,111 @@ +#![no_std] +#![feature(register_tool)] +#![register_tool(hax)] + +#[hax_lib_macros::exclude] +extern crate hax_lib_macros; + +#[hax_lib_macros::exclude] +use hax_lib_macros::*; + +#[exclude] +use hacspec_concordium::*; +#[exclude] +use hacspec_concordium_derive::*; + +use group::*; + +//////////////////// +// Impl for Z/89Z // +//////////////////// + +pub struct z_89 (u32); + +// impl Group for z_89 { + +// } + +// #[derive(Clone, Copy)] +// pub struct z_89 {} +// impl Z_Field for z_89 { +// type field_type = u32; +// fn q() -> Self::field_type { +// 89u32 +// } // Prime order +// fn random_field_elem(random: u32) -> Self::field_type { +// random % (Self::q() - 1) +// } + +// fn field_zero() -> Self::field_type { +// 0u32 +// } + +// fn field_one() -> Self::field_type { +// 1u32 +// } + +// fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { +// (x + y) % (Self::q() - 1) +// } + +// fn sub(x: Self::field_type, y: Self::field_type) -> Self::field_type { +// (x + (Self::q() - 1) - y) % (Self::q() - 1) +// } + +// fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { +// (x * y) % (Self::q() - 1) +// } +// } + +// #[derive(Clone, Copy)] +// pub struct g_z_89 {} +// impl Group for g_z_89 { +// type group_type = u32; + +// fn g() -> Self::group_type { +// 3u32 +// } // Generator (elemnent of group) + +// fn hash(x: Vec) -> ::field_type { +// let mut res = z_89::field_one(); +// for y in x { +// res = z_89::mul(y, res); +// } +// res // TODO +// } + +// fn g_pow(x: ::field_type) -> Self::group_type { +// Self::pow(Self::g(), x) +// } + +// // TODO: use repeated squaring instead! +// fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { +// let mut result = Self::group_one(); +// for i in 0..(x % (z_89::q() - 1)) { +// result = Self::prod(result, g); +// } +// result +// } + +// fn group_one() -> Self::group_type { +// 1 +// } + +// fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { +// ((x % z_89::q()) * (y % z_89::q())) % z_89::q() +// } + +// fn inv(x: Self::group_type) -> Self::group_type { +// for j in 0..89 { +// if Self::prod(x, j) == Self::group_one() { +// return j; +// } +// } +// assert!(false); +// return x; +// } + +// fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { +// Self::prod(x, Self::inv(y)) +// } +// } diff --git a/ovn/src/ovn_zkgroup.rs b/ovn/src/ovn_zkgroup.rs index b53900c..00355a5 100644 --- a/ovn/src/ovn_zkgroup.rs +++ b/ovn/src/ovn_zkgroup.rs @@ -1,4 +1,3 @@ -#![feature(trait_alias)] #[hax_lib_macros::exclude] use hax_lib_macros::*; @@ -12,21 +11,22 @@ use ff::Field; use group::*; use rand_core::RngCore; -pub trait MGroup = Group + Field; +pub trait MGroup = Group; fn pow(x: G, n: G::Scalar) -> G { if n == Field::ZERO { G::identity() } else { - x * pow(x, n - ::ONE) + x + pow(x, n - ::ONE) } } +// Multiplicative group? fn g_pow(n: G::Scalar) -> G { if n == Field::ZERO { G::identity() } else { - G::generator() * g_pow::(n - ::ONE) + G::generator() + g_pow::(n - ::ONE) } } @@ -35,7 +35,7 @@ fn hash(inp: Vec) -> G::Scalar { } fn div(x: G, y: G) -> G { - x * y.invert().unwrap() + x - y } //////////////////// @@ -71,7 +71,7 @@ pub fn schnorr_zkp( // https://crypto.stanford.edu/cs355/19sp/lec5.pdf pub fn schnorr_zkp_validate(h: G, pi: SchnorrZKPCommit) -> bool { pi.schnorr_zkp_c == hash::(vec![G::generator(), h, pi.schnorr_zkp_u]) - && g_pow::(pi.schnorr_zkp_z) == pi.schnorr_zkp_u * pow::(h, pi.schnorr_zkp_c) + && g_pow::(pi.schnorr_zkp_z) == pi.schnorr_zkp_u + pow::(h, pi.schnorr_zkp_c) } #[derive(SchemaType, Clone, Copy)] @@ -106,10 +106,10 @@ pub fn zkp_one_out_of_two( let d1 = rand_d; let x = g_pow::(xi); - let y = pow::(h, xi) * G::generator(); + let y = pow::(h, xi) + G::generator(); - let a1 = g_pow::(r1) * pow::(x, d1); - let b1 = pow::(h, r1) * pow::(y, d1); + let a1 = g_pow::(r1) + pow::(x, d1); + let b1 = pow::(h, r1) + pow::(y, d1); let a2 = g_pow::(w); let b2 = pow::(h, w); @@ -142,8 +142,8 @@ pub fn zkp_one_out_of_two( let a1 = g_pow::(w); let b1 = pow::(h, w); - let a2 = g_pow::(r2) * pow::(x, d2); - let b2 = pow::(h, r2) * pow::(div::(y, G::generator()), d2); + let a2 = g_pow::(r2) + pow::(x, d2); + let b2 = pow::(h, r2) + pow::(div::(y, G::generator()), d2); let c = hash::(vec![x, y, a1, b1, a2, b2]); @@ -178,12 +178,12 @@ pub fn zkp_one_out_of_two_validate(h: G, zkp: OrZKPCommit) -> bool ]); // TODO: add i (c == zkp.or_zkp_d1 + zkp.or_zkp_d2 - && zkp.or_zkp_a1 == g_pow::(zkp.or_zkp_r1) * pow::(zkp.or_zkp_x, zkp.or_zkp_d1) - && zkp.or_zkp_b1 == pow::(h, zkp.or_zkp_r1) * pow::(zkp.or_zkp_y, zkp.or_zkp_d1) - && zkp.or_zkp_a2 == g_pow::(zkp.or_zkp_r2) * pow::(zkp.or_zkp_x, zkp.or_zkp_d2) + && zkp.or_zkp_a1 == g_pow::(zkp.or_zkp_r1) + pow::(zkp.or_zkp_x, zkp.or_zkp_d1) + && zkp.or_zkp_b1 == pow::(h, zkp.or_zkp_r1) + pow::(zkp.or_zkp_y, zkp.or_zkp_d1) + && zkp.or_zkp_a2 == g_pow::(zkp.or_zkp_r2) + pow::(zkp.or_zkp_x, zkp.or_zkp_d2) && zkp.or_zkp_b2 == pow::(h, zkp.or_zkp_r2) - * pow::(div::(zkp.or_zkp_y, G::generator()), zkp.or_zkp_d2)) + + pow::(div::(zkp.or_zkp_y, G::generator()), zkp.or_zkp_d2)) } pub fn commit_to(g_pow_xi_yi_vi: G) -> G::Scalar { @@ -214,23 +214,23 @@ pub struct OvnContractState { pub fn init_ovn_contract(// _: &impl HasInitContext, ) -> InitResult> { Ok(OvnContractState:: { - g_pow_xis: [::ONE; n], + g_pow_xis: [G::identity(); n], zkp_xis: [SchnorrZKPCommit:: { - schnorr_zkp_u: ::ONE, + schnorr_zkp_u: G::identity(), schnorr_zkp_z: G::Scalar::ZERO, schnorr_zkp_c: G::Scalar::ZERO, }; n], commit_vis: [G::Scalar::ZERO; n], - g_pow_xi_yi_vis: [::ONE; n], + g_pow_xi_yi_vis: [G::identity(); n], zkp_vis: [OrZKPCommit:: { - or_zkp_x: ::ONE, - or_zkp_y: ::ONE, - or_zkp_a1: ::ONE, - or_zkp_b1: ::ONE, - or_zkp_a2: ::ONE, - or_zkp_b2: ::ONE, + or_zkp_x: G::identity(), + or_zkp_y: G::identity(), + or_zkp_a1: G::identity(), + or_zkp_b1: G::identity(), + or_zkp_a2: G::identity(), + or_zkp_b2: G::identity(), or_zkp_c: G::Scalar::ZERO, @@ -289,14 +289,14 @@ pub struct CastVoteParam { } pub fn compute_g_pow_yi(i: usize, xis: [G; n]) -> G { - let mut prod1 = ::ONE; + let mut prod1 = G::identity(); for j in 0..i { - prod1 = prod1 * xis[j]; + prod1 = prod1 + xis[j]; } - let mut prod2 = ::ONE; + let mut prod2 = G::identity(); for j in (i + 1)..n { - prod2 = prod2 * xis[j]; + prod2 = prod2 + xis[j]; } // implicitly: Y_i = g^y_i @@ -306,7 +306,7 @@ pub fn compute_g_pow_yi(i: usize, xis: [G; n]) -> G { pub fn compute_group_element_for_vote(xi: G::Scalar, vote: bool, g_pow_yi: G) -> G { pow::(g_pow_yi, xi) - * g_pow::(if vote { + + g_pow::(if vote { G::Scalar::ONE } else { G::Scalar::ZERO @@ -386,9 +386,9 @@ pub fn tally_votes( } } - let mut vote_result = ::ONE; + let mut vote_result = G::identity(); for g_pow_vote in state.g_pow_xi_yi_vis { - vote_result = vote_result * g_pow_vote; + vote_result = vote_result + g_pow_vote; } let mut tally = 0; diff --git a/ovn/tests/ovn_zk_example.rs b/ovn/tests/ovn_zk_example.rs index ba29a0c..392bcb4 100644 --- a/ovn/tests/ovn_zk_example.rs +++ b/ovn/tests/ovn_zk_example.rs @@ -15,24 +15,16 @@ extern crate quickcheck_macros; #[cfg(test)] use quickcheck::*; -pub use bls12_381::*; -pub use hacspec_ovn::ovn_zkgroup::*; -pub use group::ff::Field; +// pub use bls12_381::*; +// pub use hacspec_ovn::ovn_zkgroup::*; +// pub use group::ff::Field; -struct bls_g_ty (Gt); - -impl Field for bls_g_ty { - -} - -impl Group for bls_g_ty { - -} +use hacspec_bip_340::*; #[test] pub fn schorr_zkp_correctness() { fn test(random_x: u32, random_r: u32) -> bool { - type G = bls_g_ty; + type G = Point; let x: u32 = G::random(random_x); // let pow_x = G::g_pow(x); From f63a107da961cb72c24ef2a21ba5e3b38c55e287 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 12 Mar 2024 21:01:26 +0100 Subject: [PATCH 75/86] Start of testing with real trait --- bip-340/src/bip-340.rs | 4 ++-- ovn/src/ovn_zkgroup.rs | 8 ++++---- ovn/tests/ovn_zk_example.rs | 32 ++++++++++++++++++-------------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/bip-340/src/bip-340.rs b/bip-340/src/bip-340.rs index 38cf973..1e6c6b3 100644 --- a/bip-340/src/bip-340.rs +++ b/bip-340/src/bip-340.rs @@ -323,7 +323,7 @@ pub fn verify(msg: Message, pubkey: PublicKey, sig: Signature) -> VerificationRe // Group trait // ///////////////// -mod GroupTrait { +pub mod GroupTrait { use super::{PBytes32, Point, FieldElement, Scalar, ScalarCanvas, lift_x, AffinePoint, finite}; use group::*; use hacspec_lib::*; @@ -757,7 +757,7 @@ mod GroupTrait { } fn is_identity(&self) -> Choice { todo!() } fn double(&self) -> Self { *self + *self } - } + } impl Curve for Point { type AffineRepr = AffinePoint; diff --git a/ovn/src/ovn_zkgroup.rs b/ovn/src/ovn_zkgroup.rs index 00355a5..1d8554b 100644 --- a/ovn/src/ovn_zkgroup.rs +++ b/ovn/src/ovn_zkgroup.rs @@ -13,7 +13,7 @@ use rand_core::RngCore; pub trait MGroup = Group; -fn pow(x: G, n: G::Scalar) -> G { +pub fn pow(x: G, n: G::Scalar) -> G { if n == Field::ZERO { G::identity() } else { @@ -22,7 +22,7 @@ fn pow(x: G, n: G::Scalar) -> G { } // Multiplicative group? -fn g_pow(n: G::Scalar) -> G { +pub fn g_pow(n: G::Scalar) -> G { if n == Field::ZERO { G::identity() } else { @@ -30,11 +30,11 @@ fn g_pow(n: G::Scalar) -> G { } } -fn hash(inp: Vec) -> G::Scalar { +pub fn hash(inp: Vec) -> G::Scalar { Field::ONE } -fn div(x: G, y: G) -> G { +pub fn div(x: G, y: G) -> G { x - y } diff --git a/ovn/tests/ovn_zk_example.rs b/ovn/tests/ovn_zk_example.rs index 392bcb4..063de07 100644 --- a/ovn/tests/ovn_zk_example.rs +++ b/ovn/tests/ovn_zk_example.rs @@ -15,30 +15,34 @@ extern crate quickcheck_macros; #[cfg(test)] use quickcheck::*; -// pub use bls12_381::*; -// pub use hacspec_ovn::ovn_zkgroup::*; -// pub use group::ff::Field; +pub use bls12_381::*; +pub use hacspec_ovn::ovn_zkgroup::*; +pub use group::{Group, ff::Field}; -use hacspec_bip_340::*; +use rand_core::{*, RngCore}; +// use quickcheck::RngCore; +use hacspec_bip_340::{Point, GroupTrait::*, *}; + +use rand::rngs::StdRng; #[test] -pub fn schorr_zkp_correctness() { - fn test(random_x: u32, random_r: u32) -> bool { +pub fn zk_group_schorr_zkp_correctness() { + fn test() -> bool { type G = Point; - let x: u32 = G::random(random_x); - // let pow_x = G::g_pow(x); + let x: ::Scalar = ::Scalar::random(rand::thread_rng()); + let pow_x = g_pow::(x); - // let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); + let random_r: ::Scalar = ::Scalar::random(rand::thread_rng()); + let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); - // let valid = schnorr_zkp_validate::(pow_x, pi); - // valid - true + let valid = schnorr_zkp_validate::(pow_x, pi); + valid } QuickCheck::new() - .tests(10000) - .quickcheck(test as fn(u32, u32) -> bool) + .tests(1) + .quickcheck(test as fn() -> bool) } // #[test] From 9297f1191baba656abb5e44ae5e00cadc510eed3 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 13 Mar 2024 17:34:44 +0100 Subject: [PATCH 76/86] Working tests --- bip-340/Cargo.toml | 1 + bip-340/src/bip-340.rs | 72 +++++++++++++-------- ovn/src/lib.rs | 5 +- ovn/src/ovn_group.rs | 30 +++++++-- ovn/src/ovn_secp256k1.rs | 25 ++++---- ovn/src/ovn_zk_secp256k1.rs | 23 +++++++ ovn/src/ovn_zk_z_89.rs | 2 +- ovn/src/ovn_zkgroup.rs | 122 +++++++++++++++++------------------- ovn/tests/ovn_example.rs | 28 ++++----- ovn/tests/ovn_zk_example.rs | 18 +++--- 10 files changed, 193 insertions(+), 133 deletions(-) create mode 100644 ovn/src/ovn_zk_secp256k1.rs diff --git a/bip-340/Cargo.toml b/bip-340/Cargo.toml index 325b2dd..8960405 100644 --- a/bip-340/Cargo.toml +++ b/bip-340/Cargo.toml @@ -13,6 +13,7 @@ hacspec-lib = { git = "https://github.com/hacspec/hacspec.git" } hacspec-sha256 = { path = "../sha256" } group = "0.13" +ff = "0.13" subtle = "*" rand_core = "0.6" diff --git a/bip-340/src/bip-340.rs b/bip-340/src/bip-340.rs index 1e6c6b3..a5b4e6d 100644 --- a/bip-340/src/bip-340.rs +++ b/bip-340/src/bip-340.rs @@ -324,7 +324,10 @@ pub fn verify(msg: Message, pubkey: PublicKey, sig: Signature) -> VerificationRe ///////////////// pub mod GroupTrait { - use super::{PBytes32, Point, FieldElement, Scalar, ScalarCanvas, lift_x, AffinePoint, finite}; + use super::{ + finite, lift_x, point_add, x, y, AffinePoint, FieldElement, PBytes32, Point, Scalar, + ScalarCanvas, + }; use group::*; use hacspec_lib::*; @@ -359,7 +362,10 @@ pub mod GroupTrait { type Output = Point; fn neg(self) -> Self::Output { - -self + match self { + Point::AtInfinity => Point::AtInfinity, + Point::Affine((x, y)) => Point::Affine((x, FieldElement::from_literal(0u128) - y)), + } } } @@ -367,7 +373,7 @@ pub mod GroupTrait { type Output = Point; #[inline] fn add(self, rhs: Point) -> Self::Output { - self + rhs + point_add(self, rhs) } } @@ -375,7 +381,7 @@ pub mod GroupTrait { type Output = Point; #[inline] fn add(self, rhs: &'b Point) -> Self::Output { - self + rhs + self + *rhs } } @@ -383,15 +389,15 @@ pub mod GroupTrait { type Output = Point; #[inline] fn sub(self, rhs: Point) -> Self::Output { - self - rhs + self + (-rhs) } } - + impl<'b> Sub<&'b Point> for Point { type Output = Point; #[inline] fn sub(self, rhs: &'b Point) -> Self::Output { - self - rhs + self - *rhs } } @@ -407,7 +413,7 @@ pub mod GroupTrait { type Output = Point; #[inline] fn mul(self, rhs: &'b Scalar) -> Self::Output { - self * rhs + self * *rhs } } @@ -479,7 +485,7 @@ pub mod GroupTrait { fn product>(iter: I) -> Self { let mut accum = Scalar::from_literal(1u128); for x in iter { - accum = accum + x; + accum = accum * x; } accum } @@ -489,7 +495,7 @@ pub mod GroupTrait { fn product>(iter: I) -> Self { let mut accum = Scalar::from_literal(1u128); for x in iter { - accum = accum + x; + accum = accum * x; } accum } @@ -507,7 +513,7 @@ pub mod GroupTrait { type Output = Scalar; #[inline] fn add(self, rhs: &'b Scalar) -> Self::Output { - self - rhs + self + *rhs } } @@ -515,7 +521,7 @@ pub mod GroupTrait { type Output = Scalar; #[inline] fn sub(self, rhs: &'b Scalar) -> Self::Output { - self - rhs + self - *rhs } } @@ -523,7 +529,7 @@ pub mod GroupTrait { type Output = Scalar; #[inline] fn mul(self, rhs: &'b Scalar) -> Self::Output { - self * rhs + self * *rhs } } @@ -570,7 +576,7 @@ pub mod GroupTrait { } // AffinePoint - + impl Add for Point { type Output = Point; #[inline] @@ -631,7 +637,6 @@ pub mod GroupTrait { } } - impl ConstantTimeEq for Scalar { fn ct_eq(&self, other: &Self) -> Choice { let a: Seq = self.to_public_byte_seq_be(); @@ -700,12 +705,12 @@ pub mod GroupTrait { } impl PrimeField for Scalar { - type Repr = [u8;32]; + type Repr = [u8; 32]; fn from_repr(x: ::Repr) -> CtOption { - CtOption::new(Scalar::from_public_byte_seq_be(PBytes32(x)), x.ct_eq(&x)) + CtOption::new(Scalar::from_public_byte_seq_be(PBytes32(x)), x.ct_eq(&x)) } fn to_repr(&self) -> ::Repr { - let mut res : [u8;32] = [0u8;32]; + let mut res: [u8; 32] = [0u8; 32]; let val = Scalar::to_public_byte_seq_be(*self); for i in 0..32 { res[i] = val[i]; @@ -713,14 +718,15 @@ pub mod GroupTrait { res } fn is_odd(&self) -> Choice { - todo!() + Choice::from(if self.bit(0) {1} else {0}) } - const MODULUS: &'static str = "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141"; + const MODULUS: &'static str = + "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141"; const NUM_BITS: u32 = 256; - const CAPACITY: u32 = 256; // TODO + const CAPACITY: u32 = 255; // TODO const TWO_INV: Self = ::ONE; // TODO const MULTIPLICATIVE_GENERATOR: Self = ::ONE; // TODO - const S: u32 = 42; + const S: u32 = 42; const ROOT_OF_UNITY: Self = ::ONE; // TODO const ROOT_OF_UNITY_INV: Self = ::ONE; // TODO const DELTA: Self = ::ONE; // TODO @@ -731,10 +737,13 @@ pub mod GroupTrait { fn random(mut rng: impl RngCore) -> Self { let b: &mut [u8; 32] = &mut [0u8; 32]; rng.fill_bytes(b); - Point::Affine(lift_x(FieldElement::from_public_byte_seq_be(PBytes32(*b))).unwrap()) + Point::Affine(lift_x(FieldElement::from_public_byte_seq_be(PBytes32(*b))).unwrap()) + } + + fn identity() -> Self { + Point::AtInfinity } - fn identity() -> Self { todo!() } fn generator() -> Self { #[rustfmt::skip] let gx = PBytes32([ @@ -755,9 +764,18 @@ pub mod GroupTrait { FieldElement::from_public_byte_seq_be(gy), )) } - fn is_identity(&self) -> Choice { todo!() } - fn double(&self) -> Self { *self + *self } - } + + fn is_identity(&self) -> Choice { + match self { + Point::AtInfinity => Choice::from(1), + _ => Choice::from(0), + } + } + + fn double(&self) -> Self { + *self + *self + } + } impl Curve for Point { type AffineRepr = AffinePoint; diff --git a/ovn/src/lib.rs b/ovn/src/lib.rs index 9b43723..cf056c5 100644 --- a/ovn/src/lib.rs +++ b/ovn/src/lib.rs @@ -5,9 +5,10 @@ pub mod ovn_traits; -pub mod ovn_z_89; -pub mod ovn_secp256k1; pub mod ovn_group; +pub mod ovn_secp256k1; +pub mod ovn_z_89; pub mod ovn_zk_z_89; +pub mod ovn_zk_secp256k1; pub mod ovn_zkgroup; diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs index 610bb47..3d9b641 100644 --- a/ovn/src/ovn_group.rs +++ b/ovn/src/ovn_group.rs @@ -32,7 +32,11 @@ pub fn schnorr_zkp>( let c = G::hash(vec![G::g(), h, u]); let z = Z::add(r, Z::mul(c, x)); - return SchnorrZKPCommit { schnorr_zkp_u: u, schnorr_zkp_c: c, schnorr_zkp_z: z }; + return SchnorrZKPCommit { + schnorr_zkp_u: u, + schnorr_zkp_c: c, + schnorr_zkp_z: z, + }; } // https://crypto.stanford.edu/cs355/19sp/lec5.pdf @@ -40,7 +44,8 @@ pub fn schnorr_zkp_validate>( h: G::group_type, pi: SchnorrZKPCommit, ) -> bool { - pi.schnorr_zkp_c == G::hash(vec![G::g(), h, pi.schnorr_zkp_u]) && G::g_pow(pi.schnorr_zkp_z) == G::prod(pi.schnorr_zkp_u, G::pow(h, pi.schnorr_zkp_c)) + pi.schnorr_zkp_c == G::hash(vec![G::g(), h, pi.schnorr_zkp_u]) + && G::g_pow(pi.schnorr_zkp_z) == G::prod(pi.schnorr_zkp_u, G::pow(h, pi.schnorr_zkp_c)) } #[derive(Serialize, SchemaType, Clone, Copy)] @@ -142,13 +147,28 @@ pub fn zkp_one_out_of_two_validate>( h: G::group_type, zkp: OrZKPCommit, ) -> bool { - let c = G::hash(vec![zkp.or_zkp_x, zkp.or_zkp_y, zkp.or_zkp_a1, zkp.or_zkp_b1, zkp.or_zkp_a2, zkp.or_zkp_b2]); // TODO: add i + let c = G::hash(vec![ + zkp.or_zkp_x, + zkp.or_zkp_y, + zkp.or_zkp_a1, + zkp.or_zkp_b1, + zkp.or_zkp_a2, + zkp.or_zkp_b2, + ]); // TODO: add i (c == Z::add(zkp.or_zkp_d1, zkp.or_zkp_d2) && zkp.or_zkp_a1 == G::prod(G::g_pow(zkp.or_zkp_r1), G::pow(zkp.or_zkp_x, zkp.or_zkp_d1)) - && zkp.or_zkp_b1 == G::prod(G::pow(h, zkp.or_zkp_r1), G::pow(zkp.or_zkp_y, zkp.or_zkp_d1)) + && zkp.or_zkp_b1 + == G::prod( + G::pow(h, zkp.or_zkp_r1), + G::pow(zkp.or_zkp_y, zkp.or_zkp_d1), + ) && zkp.or_zkp_a2 == G::prod(G::g_pow(zkp.or_zkp_r2), G::pow(zkp.or_zkp_x, zkp.or_zkp_d2)) - && zkp.or_zkp_b2 == G::prod(G::pow(h, zkp.or_zkp_r2), G::pow(G::div(zkp.or_zkp_y, G::g()), zkp.or_zkp_d2))) + && zkp.or_zkp_b2 + == G::prod( + G::pow(h, zkp.or_zkp_r2), + G::pow(G::div(zkp.or_zkp_y, G::g()), zkp.or_zkp_d2), + )) } pub fn commit_to>(g_pow_xi_yi_vi: G::group_type) -> Z::field_type { diff --git a/ovn/src/ovn_secp256k1.rs b/ovn/src/ovn_secp256k1.rs index cb6d1fb..c5f8105 100644 --- a/ovn/src/ovn_secp256k1.rs +++ b/ovn/src/ovn_secp256k1.rs @@ -36,7 +36,7 @@ pub struct Z_curve { impl hacspec_concordium::Deserial for Z_curve { // TODO: fn deserial(_source: &mut R) -> ParseResult { - let buffer : &mut [u8] = &mut []; + let buffer: &mut [u8] = &mut []; let _ = _source.read(buffer)?; Ok(Z_curve { @@ -103,18 +103,22 @@ pub struct Group_curve { impl hacspec_concordium::Deserial for Group_curve { // TODO: fn deserial(_source: &mut R) -> ParseResult { - let buffer : &mut [u8] = &mut []; + let buffer: &mut [u8] = &mut []; let _ = _source.read(buffer)?; if let [0] = buffer { - return Ok(Group_curve { val: Point::AtInfinity }) + return Ok(Group_curve { + val: Point::AtInfinity, + }); } - let buffer_y : &mut [u8] = &mut []; + let buffer_y: &mut [u8] = &mut []; let _ = _source.read(buffer_y)?; Ok(Group_curve { - val: Point::Affine((FieldElement::from_public_byte_seq_be(Seq::::from_native_slice(buffer)), - FieldElement::from_public_byte_seq_be(Seq::::from_native_slice(buffer_y)))), + val: Point::Affine(( + FieldElement::from_public_byte_seq_be(Seq::::from_native_slice(buffer)), + FieldElement::from_public_byte_seq_be(Seq::::from_native_slice(buffer_y)), + )), }) } } @@ -123,11 +127,10 @@ impl hacspec_concordium::Serial for Group_curve { // TODO: fn serial(&self, _out: &mut W) -> Result<(), W::Err> { match self.val { - Point::Affine(p) => - { + Point::Affine(p) => { _out.write(x(p).to_public_byte_seq_be().native_slice()); _out.write(y(p).to_public_byte_seq_be().native_slice()) - }, + } Point::AtInfinity => _out.write(&[0]), }; Ok(()) @@ -187,9 +190,9 @@ impl Group for Group_curve { fn inv(x: Self::group_type) -> Self::group_type { Group_curve { val: match x.val { - Point::Affine((a,b)) => Point::Affine((a, FieldElement::from_literal(0u128)-b)), + Point::Affine((a, b)) => Point::Affine((a, FieldElement::from_literal(0u128) - b)), Point::AtInfinity => Point::AtInfinity, // TODO? - } + }, } } diff --git a/ovn/src/ovn_zk_secp256k1.rs b/ovn/src/ovn_zk_secp256k1.rs new file mode 100644 index 0000000..8dbf265 --- /dev/null +++ b/ovn/src/ovn_zk_secp256k1.rs @@ -0,0 +1,23 @@ +#[hax_lib_macros::exclude] +use hax_lib_macros::*; + +#[exclude] +use hacspec_concordium::*; +#[exclude] +use hacspec_concordium_derive::*; + +pub use group::{ff::Field, Group}; +pub use crate::ovn_zkgroup::*; + +use hacspec_bip_340::{GroupTrait::*, Point, *}; + +impl MGroup for Point { + fn pow (p: Self,exp: Self::Scalar) -> Self { + point_mul(exp,p) + } + + fn hash(inp: Vec) -> Self::Scalar { + return Self::Scalar::ONE // TODO + } + +} diff --git a/ovn/src/ovn_zk_z_89.rs b/ovn/src/ovn_zk_z_89.rs index c9d13f5..6c0b14c 100644 --- a/ovn/src/ovn_zk_z_89.rs +++ b/ovn/src/ovn_zk_z_89.rs @@ -19,7 +19,7 @@ use group::*; // Impl for Z/89Z // //////////////////// -pub struct z_89 (u32); +pub struct z_89(u32); // impl Group for z_89 { diff --git a/ovn/src/ovn_zkgroup.rs b/ovn/src/ovn_zkgroup.rs index 1d8554b..ef5fd60 100644 --- a/ovn/src/ovn_zkgroup.rs +++ b/ovn/src/ovn_zkgroup.rs @@ -1,4 +1,3 @@ - #[hax_lib_macros::exclude] use hax_lib_macros::*; @@ -7,37 +6,24 @@ use hacspec_concordium::*; #[exclude] use hacspec_concordium_derive::*; -use ff::Field; -use group::*; +use group::{ + ff::{Field, PrimeField}, + Group, +}; use rand_core::RngCore; -pub trait MGroup = Group; - -pub fn pow(x: G, n: G::Scalar) -> G { - if n == Field::ZERO { - G::identity() - } else { - x + pow(x, n - ::ONE) +pub trait MGroup: Group { + fn pow(p: Self, exp: Self::Scalar) -> Self; + fn g_pow(n: Self::Scalar) -> Self { + Self::pow(Self::identity(), n - ::ONE) } -} -// Multiplicative group? -pub fn g_pow(n: G::Scalar) -> G { - if n == Field::ZERO { - G::identity() - } else { - G::generator() + g_pow::(n - ::ONE) + fn hash(inp: Vec) -> Self::Scalar; + fn div(x: Self, y: Self) -> Self { + x - y } } -pub fn hash(inp: Vec) -> G::Scalar { - Field::ONE -} - -pub fn div(x: G, y: G) -> G { - x - y -} - //////////////////// // Implementation // //////////////////// @@ -57,8 +43,8 @@ pub fn schnorr_zkp( h: G, x: G::Scalar, ) -> SchnorrZKPCommit { - let u = g_pow::(r); - let c = hash::(vec![G::generator(), h, u]); + let u = G::g_pow(r); + let c = G::hash(vec![G::generator(), h, u]); let z = r + c * x; return SchnorrZKPCommit { @@ -70,8 +56,8 @@ pub fn schnorr_zkp( // https://crypto.stanford.edu/cs355/19sp/lec5.pdf pub fn schnorr_zkp_validate(h: G, pi: SchnorrZKPCommit) -> bool { - pi.schnorr_zkp_c == hash::(vec![G::generator(), h, pi.schnorr_zkp_u]) - && g_pow::(pi.schnorr_zkp_z) == pi.schnorr_zkp_u + pow::(h, pi.schnorr_zkp_c) + pi.schnorr_zkp_c == G::hash(vec![G::generator(), h, pi.schnorr_zkp_u]) + && G::g_pow(pi.schnorr_zkp_z) == pi.schnorr_zkp_u + G::pow(h, pi.schnorr_zkp_c) } #[derive(SchemaType, Clone, Copy)] @@ -105,16 +91,16 @@ pub fn zkp_one_out_of_two( let r1 = rand_r; let d1 = rand_d; - let x = g_pow::(xi); - let y = pow::(h, xi) + G::generator(); + let x = G::g_pow(xi); + let y = G::pow(h, xi) + G::generator(); - let a1 = g_pow::(r1) + pow::(x, d1); - let b1 = pow::(h, r1) + pow::(y, d1); + let a1 = G::g_pow(r1) + G::pow(x, d1); + let b1 = G::pow(h, r1) + G::pow(y, d1); - let a2 = g_pow::(w); - let b2 = pow::(h, w); + let a2 = G::g_pow(w); + let b2 = G::pow(h, w); - let c = hash::(vec![x, y, a1, b1, a2, b2]); + let c = G::hash(vec![x, y, a1, b1, a2, b2]); let d2 = c - d1; let r2 = w - xi * d2; @@ -136,16 +122,16 @@ pub fn zkp_one_out_of_two( let r2 = rand_r; let d2 = rand_d; - let x = g_pow::(xi); - let y = pow::(h, xi); + let x = G::g_pow(xi); + let y = G::pow(h, xi); - let a1 = g_pow::(w); - let b1 = pow::(h, w); + let a1 = G::g_pow(w); + let b1 = G::pow(h, w); - let a2 = g_pow::(r2) + pow::(x, d2); - let b2 = pow::(h, r2) + pow::(div::(y, G::generator()), d2); + let a2 = G::g_pow(r2) + G::pow(x, d2); + let b2 = G::pow(h, r2) + G::pow(G::div(y, G::generator()), d2); - let c = hash::(vec![x, y, a1, b1, a2, b2]); + let c = G::hash(vec![x, y, a1, b1, a2, b2]); let d1 = c - d2; let r1 = w - xi * d1; @@ -168,7 +154,7 @@ pub fn zkp_one_out_of_two( // Anonymous voting by two-round public discussion pub fn zkp_one_out_of_two_validate(h: G, zkp: OrZKPCommit) -> bool { - let c = hash::(vec![ + let c = G::hash(vec![ zkp.or_zkp_x, zkp.or_zkp_y, zkp.or_zkp_a1, @@ -178,20 +164,20 @@ pub fn zkp_one_out_of_two_validate(h: G, zkp: OrZKPCommit) -> bool ]); // TODO: add i (c == zkp.or_zkp_d1 + zkp.or_zkp_d2 - && zkp.or_zkp_a1 == g_pow::(zkp.or_zkp_r1) + pow::(zkp.or_zkp_x, zkp.or_zkp_d1) - && zkp.or_zkp_b1 == pow::(h, zkp.or_zkp_r1) + pow::(zkp.or_zkp_y, zkp.or_zkp_d1) - && zkp.or_zkp_a2 == g_pow::(zkp.or_zkp_r2) + pow::(zkp.or_zkp_x, zkp.or_zkp_d2) + && zkp.or_zkp_a1 == G::g_pow(zkp.or_zkp_r1) + G::pow(zkp.or_zkp_x, zkp.or_zkp_d1) + && zkp.or_zkp_b1 == G::pow(h, zkp.or_zkp_r1) + G::pow(zkp.or_zkp_y, zkp.or_zkp_d1) + && zkp.or_zkp_a2 == G::g_pow(zkp.or_zkp_r2) + G::pow(zkp.or_zkp_x, zkp.or_zkp_d2) && zkp.or_zkp_b2 - == pow::(h, zkp.or_zkp_r2) - + pow::(div::(zkp.or_zkp_y, G::generator()), zkp.or_zkp_d2)) + == G::pow(h, zkp.or_zkp_r2) + + G::pow(G::div(zkp.or_zkp_y, G::generator()), zkp.or_zkp_d2)) } pub fn commit_to(g_pow_xi_yi_vi: G) -> G::Scalar { - hash::(vec![g_pow_xi_yi_vi]) + G::hash(vec![g_pow_xi_yi_vi]) } pub fn check_commitment(g_pow_xi_yi_vi: G, commitment: G::Scalar) -> bool { - hash::(vec![g_pow_xi_yi_vi]) == commitment + G::hash(vec![g_pow_xi_yi_vi]) == commitment } #[hax::contract_state(contract = "OVN")] @@ -246,9 +232,7 @@ pub fn init_ovn_contract(// _: &impl HasInitContext, } /** Currently randomness needs to be injected */ -pub fn select_private_voting_key( - rand: impl RngCore + Copy, - ) -> Z { +pub fn select_private_voting_key(rand: impl RngCore + Copy) -> Z { Z::random(rand) } @@ -265,9 +249,12 @@ pub struct RegisterParam { pub fn register_vote( ctx: impl HasReceiveContext, state: OvnContractState, -) -> Result<(A, OvnContractState), ParseError> where G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial { +) -> Result<(A, OvnContractState), ParseError> +where + G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial, +{ let params: RegisterParam = ctx.parameter_cursor().get()?; - let g_pow_xi = g_pow::(params.rp_xi); + let g_pow_xi = G::g_pow(params.rp_xi); let zkp_xi = schnorr_zkp::(params.rp_zkp_random, g_pow_xi, params.rp_xi); @@ -300,13 +287,13 @@ pub fn compute_g_pow_yi(i: usize, xis: [G; n]) -> G { } // implicitly: Y_i = g^y_i - let g_pow_yi = div::(prod1, prod2); + let g_pow_yi = G::div(prod1, prod2); g_pow_yi } pub fn compute_group_element_for_vote(xi: G::Scalar, vote: bool, g_pow_yi: G) -> G { - pow::(g_pow_yi, xi) - + g_pow::(if vote { + G::pow(g_pow_yi, xi) + + G::g_pow(if vote { G::Scalar::ONE } else { G::Scalar::ZERO @@ -319,7 +306,10 @@ pub fn compute_group_element_for_vote(xi: G::Scalar, vote: bool, g_po pub fn commit_to_vote( ctx: impl HasReceiveContext, state: OvnContractState, -) -> Result<(A, OvnContractState), ParseError> where G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial { +) -> Result<(A, OvnContractState), ParseError> +where + G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial, +{ let params: CastVoteParam = ctx.parameter_cursor().get()?; for i in 0..n { @@ -344,7 +334,10 @@ pub fn commit_to_vote( pub fn cast_vote( ctx: impl HasReceiveContext, state: OvnContractState, -) -> Result<(A, OvnContractState), ParseError>where G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial { +) -> Result<(A, OvnContractState), ParseError> +where + G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial, +{ let params: CastVoteParam = ctx.parameter_cursor().get()?; let g_pow_yi = compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); @@ -375,7 +368,10 @@ pub struct TallyParameter {} pub fn tally_votes( _: impl HasReceiveContext, state: OvnContractState, -) -> Result<(A, OvnContractState), ParseError>where G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial { +) -> Result<(A, OvnContractState), ParseError> +where + G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial, +{ for i in 0..n { let g_pow_yi = compute_g_pow_yi::(i as usize, state.g_pow_xis); if !zkp_one_out_of_two_validate::(g_pow_yi, state.zkp_vis[i]) { @@ -395,7 +391,7 @@ pub fn tally_votes( let mut curr = G::Scalar::ZERO; for i in 0..n as u32 { // Should be while, but is bounded by n anyways! - if g_pow::(curr) == vote_result { + if G::g_pow(curr) == vote_result { tally = i; } diff --git a/ovn/tests/ovn_example.rs b/ovn/tests/ovn_example.rs index 3e9e82a..d95a014 100644 --- a/ovn/tests/ovn_example.rs +++ b/ovn/tests/ovn_example.rs @@ -22,9 +22,9 @@ extern crate quickcheck_macros; #[cfg(test)] use quickcheck::*; -pub use hacspec_ovn::ovn_z_89::*; -pub use hacspec_ovn::ovn_secp256k1::*; pub use hacspec_ovn::ovn_group::*; +pub use hacspec_ovn::ovn_secp256k1::*; +pub use hacspec_ovn::ovn_z_89::*; #[test] pub fn schorr_zkp_correctness() { @@ -67,13 +67,13 @@ pub fn schorr_zkp_secp256k1_correctness() { } #[cfg(test)] -pub fn or_zkp_correctness>( - random_w: u32, - random_r: u32, - random_d: u32, - random_h: u32, - random_x: u32, - v: bool, +pub fn or_zkp_correctness>( + random_w: u32, + random_r: u32, + random_d: u32, + random_h: u32, + random_x: u32, + v: bool, ) -> bool { let mut h = G::g_pow(Z::random_field_elem(random_h)); let x = Z::random_field_elem(random_x); @@ -83,7 +83,7 @@ pub fn or_zkp_correctness>( } #[test] -pub fn or_zkp_correctness_z89(){ +pub fn or_zkp_correctness_z89() { QuickCheck::new() .tests(10000) .quickcheck(or_zkp_correctness:: as fn(u32, u32, u32, u32, u32, bool) -> bool) @@ -92,9 +92,9 @@ pub fn or_zkp_correctness_z89(){ #[test] // TODO: Fix inverse opeation, should make this test parse pub fn or_zkp_secp256k1_correctness() { - QuickCheck::new() - .tests(10) - .quickcheck(or_zkp_correctness:: as fn(u32, u32, u32, u32, u32, bool) -> bool) + QuickCheck::new().tests(10).quickcheck( + or_zkp_correctness:: as fn(u32, u32, u32, u32, u32, bool) -> bool, + ) } #[cfg(test)] @@ -202,7 +202,7 @@ pub fn test_correctness, const n: usize, A: HasActions>( } #[cfg(test)] -fn randomized_full_test, const n: usize> () -> bool { +fn randomized_full_test, const n: usize>() -> bool { use rand::random; let mut votes: [bool; n] = [false; n]; let mut xis: [Z::field_type; n] = [Z::field_zero(); n]; diff --git a/ovn/tests/ovn_zk_example.rs b/ovn/tests/ovn_zk_example.rs index 063de07..2cdbb9c 100644 --- a/ovn/tests/ovn_zk_example.rs +++ b/ovn/tests/ovn_zk_example.rs @@ -16,22 +16,22 @@ extern crate quickcheck_macros; use quickcheck::*; pub use bls12_381::*; -pub use hacspec_ovn::ovn_zkgroup::*; -pub use group::{Group, ff::Field}; +pub use group::{ff::Field, Group}; +pub use hacspec_ovn::{ovn_zkgroup::*, ovn_zk_secp256k1::*}; -use rand_core::{*, RngCore}; +use rand_core::{RngCore, *}; // use quickcheck::RngCore; -use hacspec_bip_340::{Point, GroupTrait::*, *}; +use hacspec_bip_340::{GroupTrait::*, Point, *}; use rand::rngs::StdRng; #[test] pub fn zk_group_schorr_zkp_correctness() { fn test() -> bool { - type G = Point; + type G = Point; // Gt; - let x: ::Scalar = ::Scalar::random(rand::thread_rng()); - let pow_x = g_pow::(x); + let mut x: ::Scalar = ::Scalar::random(rand::thread_rng()); + let pow_x = G::g_pow(x); let random_r: ::Scalar = ::Scalar::random(rand::thread_rng()); let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); @@ -40,9 +40,7 @@ pub fn zk_group_schorr_zkp_correctness() { valid } - QuickCheck::new() - .tests(1) - .quickcheck(test as fn() -> bool) + QuickCheck::new().tests(1000).quickcheck(test as fn() -> bool) } // #[test] From 971717b51e464e71f6337b897f72df5ad0c474c7 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 13 Mar 2024 18:05:17 +0100 Subject: [PATCH 77/86] Full test --- bip-340/Cargo.toml | 3 + bip-340/src/bip-340.rs | 24 +++ ovn/src/ovn_zk_secp256k1.rs | 1 + ovn/src/ovn_zkgroup.rs | 2 +- ovn/tests/ovn_zk_example.rs | 390 +++++++++++++++++------------------- 5 files changed, 212 insertions(+), 208 deletions(-) diff --git a/bip-340/Cargo.toml b/bip-340/Cargo.toml index 8960405..e44b47a 100644 --- a/bip-340/Cargo.toml +++ b/bip-340/Cargo.toml @@ -17,6 +17,9 @@ ff = "0.13" subtle = "*" rand_core = "0.6" +hacspec-concordium = { path = "../concordium" } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a +hacspec-concordium-derive = { path = "../concordium-derive" } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a + [dev-dependencies] quickcheck = "1" quickcheck_macros = "1" diff --git a/bip-340/src/bip-340.rs b/bip-340/src/bip-340.rs index a5b4e6d..881bd2e 100644 --- a/bip-340/src/bip-340.rs +++ b/bip-340/src/bip-340.rs @@ -783,4 +783,28 @@ pub mod GroupTrait { finite(*self).unwrap() } } + + +use hacspec_concordium::*; +use hacspec_concordium_derive::*; + +impl hacspec_concordium::Deserial for Scalar { + // TODO: + fn deserial(_source: &mut R) -> ParseResult { + let buffer: &mut [u8] = &mut []; + let _ = _source.read(buffer)?; + + Ok(Scalar::from_public_byte_seq_be(Seq::::from_native_slice(buffer))) + } } + +impl hacspec_concordium::Serial for Scalar { + // TODO: + fn serial(&self, _out: &mut W) -> Result<(), W::Err> { + _out.write(self.to_public_byte_seq_be().native_slice()); + Ok(()) + } +} + +} + diff --git a/ovn/src/ovn_zk_secp256k1.rs b/ovn/src/ovn_zk_secp256k1.rs index 8dbf265..d5356db 100644 --- a/ovn/src/ovn_zk_secp256k1.rs +++ b/ovn/src/ovn_zk_secp256k1.rs @@ -11,6 +11,7 @@ pub use crate::ovn_zkgroup::*; use hacspec_bip_340::{GroupTrait::*, Point, *}; + impl MGroup for Point { fn pow (p: Self,exp: Self::Scalar) -> Self { point_mul(exp,p) diff --git a/ovn/src/ovn_zkgroup.rs b/ovn/src/ovn_zkgroup.rs index ef5fd60..e8244b9 100644 --- a/ovn/src/ovn_zkgroup.rs +++ b/ovn/src/ovn_zkgroup.rs @@ -359,7 +359,7 @@ where Ok((A::accept(), cast_vote_state_ret)) } -#[derive(SchemaType)] +#[derive(Serialize, SchemaType)] pub struct TallyParameter {} #[hax::receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] diff --git a/ovn/tests/ovn_zk_example.rs b/ovn/tests/ovn_zk_example.rs index 2cdbb9c..ec9a4da 100644 --- a/ovn/tests/ovn_zk_example.rs +++ b/ovn/tests/ovn_zk_example.rs @@ -17,7 +17,7 @@ use quickcheck::*; pub use bls12_381::*; pub use group::{ff::Field, Group}; -pub use hacspec_ovn::{ovn_zkgroup::*, ovn_zk_secp256k1::*}; +pub use hacspec_ovn::{ovn_zk_secp256k1::*, ovn_zkgroup::*}; use rand_core::{RngCore, *}; // use quickcheck::RngCore; @@ -25,230 +25,206 @@ use hacspec_bip_340::{GroupTrait::*, Point, *}; use rand::rngs::StdRng; -#[test] -pub fn zk_group_schorr_zkp_correctness() { - fn test() -> bool { - type G = Point; // Gt; +#[cfg(test)] +pub fn schnorr_zkp_correctness() -> bool { + let mut x: ::Scalar = ::Scalar::random(rand::thread_rng()); + let pow_x = G::g_pow(x); - let mut x: ::Scalar = ::Scalar::random(rand::thread_rng()); - let pow_x = G::g_pow(x); + let random_r: ::Scalar = ::Scalar::random(rand::thread_rng()); + let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); - let random_r: ::Scalar = ::Scalar::random(rand::thread_rng()); - let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); + let valid = schnorr_zkp_validate::(pow_x, pi); + valid +} - let valid = schnorr_zkp_validate::(pow_x, pi); - valid - } +#[test] +pub fn schorr_zkp_correctness() { + QuickCheck::new() + .tests(1000) + .quickcheck(schnorr_zkp_correctness:: as fn() -> bool) +} - QuickCheck::new().tests(1000).quickcheck(test as fn() -> bool) +#[cfg(test)] +pub fn or_zkp_correctness(v: bool) -> bool { + let random_w: ::Scalar = ::Scalar::random(rand::thread_rng()); + let random_r: ::Scalar = ::Scalar::random(rand::thread_rng()); + let random_d: ::Scalar = ::Scalar::random(rand::thread_rng()); + let random_h: ::Scalar = ::Scalar::random(rand::thread_rng()); + let random_x: ::Scalar = ::Scalar::random(rand::thread_rng()); + let mut h = G::g_pow(random_h); + let x = random_x; + let pi: OrZKPCommit = zkp_one_out_of_two(random_w, random_r, random_d, h, x, v); + let valid = zkp_one_out_of_two_validate::(h, pi); + valid } -// #[test] -// pub fn schorr_zkp_secp256k1_correctness() { -// fn test(random_x: u32, random_r: u32) -> bool { -// type Z = Z_curve; -// type G = Group_curve; +#[test] +// TODO: Fix inverse opeation, should make this test parse +pub fn or_zkp_secp256k1_correctness() { + QuickCheck::new() + .tests(10) + .quickcheck(or_zkp_correctness:: as fn(bool) -> bool) +} -// let x: Z_curve = Z::random_field_elem(random_x); -// let pow_x = G::g_pow(x); +#[cfg(test)] +pub fn sum_to_zero() { + let mut xis: [G::Scalar; n] = [G::Scalar::ZERO; n]; + let mut g_pow_xis: [G; n] = [G::identity(); n]; + use rand::random; + for i in 0..n { + xis[i] = G::Scalar::random(rand::thread_rng()); + g_pow_xis[i] = G::g_pow(xis[i]); + } -// let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); + let mut res = G::identity(); + for i in 0..n { + let g_pow_yi = compute_g_pow_yi::(i, g_pow_xis); + res = res + G::pow(g_pow_yi, xis[i]); + } -// let valid = schnorr_zkp_validate::(pow_x, pi); -// valid -// } + assert!(res == G::identity()); +} -// QuickCheck::new() -// .tests(10) -// .quickcheck(test as fn(u32, u32) -> bool) +// #[test] +// pub fn sum_to_zero_z89() { +// sum_to_zero::() // } -// #[cfg(test)] -// pub fn or_zkp_correctness>( -// random_w: u32, -// random_r: u32, -// random_d: u32, -// random_h: u32, -// random_x: u32, -// v: bool, -// ) -> bool { -// let mut h = G::g_pow(Z::random_field_elem(random_h)); -// let x = Z::random_field_elem(random_x); -// let pi: OrZKPCommit = zkp_one_out_of_two(random_w, random_r, random_d, h, x, v); -// let valid = zkp_one_out_of_two_validate::(h, pi); -// valid -// } +#[test] +pub fn sum_to_zero_secp256k1() { + sum_to_zero::() +} -// #[test] -// pub fn or_zkp_correctness_z89(){ -// QuickCheck::new() -// .tests(10000) -// .quickcheck(or_zkp_correctness:: as fn(u32, u32, u32, u32, u32, bool) -> bool) -// } +#[cfg(test)] +pub fn test_correctness( + votes: [bool; n], + xis: [G::Scalar; n], + rp_zkp_randoms: [G::Scalar; n], + cvp_zkp_random_ws1: [G::Scalar; n], + cvp_zkp_random_rs1: [G::Scalar; n], + cvp_zkp_random_ds1: [G::Scalar; n], + cvp_zkp_random_ws2: [G::Scalar; n], + cvp_zkp_random_rs2: [G::Scalar; n], + cvp_zkp_random_ds2: [G::Scalar; n], +) -> bool +where + G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial, +{ + // Setup the context + let mut ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); + + let mut state: OvnContractState = init_ovn_contract().unwrap(); + + for i in 0..n { + let parameter = RegisterParam:: { + rp_i: i as u32, + rp_xi: xis[i], + rp_zkp_random: rp_zkp_randoms[i], + }; + let parameter_bytes = to_bytes(¶meter); + (_, state) = + register_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); + } -// #[test] -// // TODO: Fix inverse opeation, should make this test parse -// pub fn or_zkp_secp256k1_correctness() { -// QuickCheck::new() -// .tests(10) -// .quickcheck(or_zkp_correctness:: as fn(u32, u32, u32, u32, u32, bool) -> bool) -// } + for i in 0..n { + let parameter = CastVoteParam:: { + cvp_i: i as u32, + cvp_xi: xis[i], + cvp_zkp_random_w: cvp_zkp_random_ws1[i], + cvp_zkp_random_r: cvp_zkp_random_rs1[i], + cvp_zkp_random_d: cvp_zkp_random_ds1[i], + cvp_vote: votes[i], + }; + let parameter_bytes = to_bytes(¶meter); + (_, state) = + commit_to_vote::(ctx.clone().set_parameter(¶meter_bytes), state) + .unwrap(); + } -// #[cfg(test)] -// pub fn sum_to_zero, const n: usize>() { -// let mut xis: [Z::field_type; n] = [Z::field_zero(); n]; -// let mut g_pow_xis: [G::group_type; n] = [G::group_one(); n]; -// use rand::random; -// for i in 0..n { -// xis[i] = Z::random_field_elem(random()); -// g_pow_xis[i] = G::g_pow(xis[i]); -// } - -// let mut res = G::group_one(); -// for i in 0..n { -// let g_pow_yi = compute_g_pow_yi::(i, g_pow_xis); -// res = G::prod(res, G::pow(g_pow_yi, xis[i])); -// } - -// assert!(res == G::group_one()); -// } + for i in 0..n { + let parameter = CastVoteParam:: { + cvp_i: i as u32, + cvp_xi: xis[i], + cvp_zkp_random_w: cvp_zkp_random_ws2[i], + cvp_zkp_random_r: cvp_zkp_random_rs2[i], + cvp_zkp_random_d: cvp_zkp_random_ds2[i], + cvp_vote: votes[i], + }; + let parameter_bytes = to_bytes(¶meter); + (_, state) = + cast_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); + } -// #[test] -// pub fn sum_to_zero_z89() { -// sum_to_zero::() -// } + let parameter = TallyParameter {}; + let parameter_bytes = to_bytes(¶meter); + ctx = ctx.set_parameter(¶meter_bytes); -// #[test] -// pub fn sum_to_zero_secp256k1() { -// sum_to_zero::() -// } + (_, state) = tally_votes::(ctx.clone(), state).unwrap(); -// #[cfg(test)] -// pub fn test_correctness, const n: usize, A: HasActions>( -// votes: [bool; n], -// xis: [Z::field_type; n], -// rp_zkp_randoms: [u32; n], -// cvp_zkp_random_ws1: [u32; n], -// cvp_zkp_random_rs1: [u32; n], -// cvp_zkp_random_ds1: [u32; n], -// cvp_zkp_random_ws2: [u32; n], -// cvp_zkp_random_rs2: [u32; n], -// cvp_zkp_random_ds2: [u32; n], -// ) -> bool { -// // Setup the context -// let mut ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); - -// let mut state: OvnContractState = init_ovn_contract().unwrap(); - -// for i in 0..n { -// let parameter = RegisterParam:: { -// rp_i: i as u32, -// rp_xi: xis[i], -// rp_zkp_random: rp_zkp_randoms[i], -// }; -// let parameter_bytes = to_bytes(¶meter); -// (_, state) = -// register_vote::(ctx.clone().set_parameter(¶meter_bytes), state) -// .unwrap(); -// } - -// for i in 0..n { -// let parameter = CastVoteParam:: { -// cvp_i: i as u32, -// cvp_xi: xis[i], -// cvp_zkp_random_w: cvp_zkp_random_ws1[i], -// cvp_zkp_random_r: cvp_zkp_random_rs1[i], -// cvp_zkp_random_d: cvp_zkp_random_ds1[i], -// cvp_vote: votes[i], -// }; -// let parameter_bytes = to_bytes(¶meter); -// (_, state) = -// commit_to_vote::(ctx.clone().set_parameter(¶meter_bytes), state) -// .unwrap(); -// } - -// for i in 0..n { -// let parameter = CastVoteParam:: { -// cvp_i: i as u32, -// cvp_xi: xis[i], -// cvp_zkp_random_w: cvp_zkp_random_ws2[i], -// cvp_zkp_random_r: cvp_zkp_random_rs2[i], -// cvp_zkp_random_d: cvp_zkp_random_ds2[i], -// cvp_vote: votes[i], -// }; -// let parameter_bytes = to_bytes(¶meter); -// (_, state) = -// cast_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); -// } - -// let parameter = TallyParameter {}; -// let parameter_bytes = to_bytes(¶meter); -// ctx = ctx.set_parameter(¶meter_bytes); - -// (_, state) = tally_votes::(ctx.clone(), state).unwrap(); - -// let mut count = 0u32; -// for v in votes { -// if v { -// count = count + 1; // += 1 does not work correctly -// } -// } - -// assert_eq!(state.tally, count); -// state.tally == count -// } + let mut count = 0u32; + for v in votes { + if v { + count = count + 1; // += 1 does not work correctly + } + } -// #[cfg(test)] -// fn randomized_full_test, const n: usize> () -> bool { -// use rand::random; -// let mut votes: [bool; n] = [false; n]; -// let mut xis: [Z::field_type; n] = [Z::field_zero(); n]; -// let mut rp_zkp_randoms: [u32; n] = [0; n]; -// let mut cvp_zkp_random_ws1: [u32; n] = [0; n]; -// let mut cvp_zkp_random_rs1: [u32; n] = [0; n]; -// let mut cvp_zkp_random_ds1: [u32; n] = [0; n]; - -// let mut cvp_zkp_random_ws2: [u32; n] = [0; n]; -// let mut cvp_zkp_random_rs2: [u32; n] = [0; n]; -// let mut cvp_zkp_random_ds2: [u32; n] = [0; n]; - -// for i in 0..n { -// votes[i] = random(); -// xis[i] = Z::random_field_elem(random()); -// rp_zkp_randoms[i] = random(); -// cvp_zkp_random_ws1[i] = random(); -// cvp_zkp_random_rs1[i] = random(); -// cvp_zkp_random_ds1[i] = random(); -// cvp_zkp_random_ws2[i] = random(); -// cvp_zkp_random_rs2[i] = random(); -// cvp_zkp_random_ds2[i] = random(); -// } - -// test_correctness::( -// votes, -// xis, -// rp_zkp_randoms, -// cvp_zkp_random_ws1, -// cvp_zkp_random_rs1, -// cvp_zkp_random_ds1, -// cvp_zkp_random_ws2, -// cvp_zkp_random_rs2, -// cvp_zkp_random_ds2, -// ) -// } + assert_eq!(state.tally, count); + state.tally == count +} -// // #[concordium_test] -// #[test] -// fn test_full_z89() { -// QuickCheck::new() -// .tests(100) -// .quickcheck(randomized_full_test:: as fn() -> bool) -// } +#[cfg(test)] +fn randomized_full_test () -> bool where + G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial, +{ + use rand::random; + let mut votes: [bool; n] = [false; n]; + let mut xis: [G::Scalar; n] = [G::Scalar::ZERO; n]; + let mut rp_zkp_randoms: [G::Scalar; n] = [G::Scalar::ZERO; n]; + let mut cvp_zkp_random_ws1: [G::Scalar; n] = [G::Scalar::ZERO; n]; + let mut cvp_zkp_random_rs1: [G::Scalar; n] = [G::Scalar::ZERO; n]; + let mut cvp_zkp_random_ds1: [G::Scalar; n] = [G::Scalar::ZERO; n]; + + let mut cvp_zkp_random_ws2: [G::Scalar; n] = [G::Scalar::ZERO; n]; + let mut cvp_zkp_random_rs2: [G::Scalar; n] = [G::Scalar::ZERO; n]; + let mut cvp_zkp_random_ds2: [G::Scalar; n] = [G::Scalar::ZERO; n]; + + for i in 0..n { + votes[i] = random(); + xis[i] = G::Scalar::random(rand::thread_rng()); + rp_zkp_randoms[i] = G::Scalar::random(rand::thread_rng()); + cvp_zkp_random_ws1[i] = G::Scalar::random(rand::thread_rng()); + cvp_zkp_random_rs1[i] = G::Scalar::random(rand::thread_rng()); + cvp_zkp_random_ds1[i] = G::Scalar::random(rand::thread_rng()); + cvp_zkp_random_ws2[i] = G::Scalar::random(rand::thread_rng()); + cvp_zkp_random_rs2[i] = G::Scalar::random(rand::thread_rng()); + cvp_zkp_random_ds2[i] = G::Scalar::random(rand::thread_rng()); + } -// // #[concordium_test] -// #[test] -// fn test_full_secp256k1() { -// QuickCheck::new() -// .tests(1) -// .quickcheck(randomized_full_test:: as fn() -> bool) -// } + test_correctness::( + votes, + xis, + rp_zkp_randoms, + cvp_zkp_random_ws1, + cvp_zkp_random_rs1, + cvp_zkp_random_ds1, + cvp_zkp_random_ws2, + cvp_zkp_random_rs2, + cvp_zkp_random_ds2, + ) +} + +// // // #[concordium_test] +// // #[test] +// // fn test_full_z89() { +// // QuickCheck::new() +// // .tests(100) +// // .quickcheck(randomized_full_test:: as fn() -> bool) +// // } + +// #[concordium_test] +#[test] +fn test_full_secp256k1() { + QuickCheck::new() + .tests(1) + .quickcheck(randomized_full_test:: as fn() -> bool) +} From 7047ec9dc2e2575d91a0f217f672e650421bf3a7 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Thu, 14 Mar 2024 18:29:19 +0100 Subject: [PATCH 78/86] Working test --- bip-340/src/bip-340.rs | 53 +++++++++++++------------ ovn/src/ovn_secp256k1.rs | 2 +- ovn/src/ovn_zkgroup.rs | 11 ++---- ovn/tests/ovn_zk_example.rs | 77 ++++++++++++++++++++++++++++--------- 4 files changed, 88 insertions(+), 55 deletions(-) diff --git a/bip-340/src/bip-340.rs b/bip-340/src/bip-340.rs index 881bd2e..3f6718e 100644 --- a/bip-340/src/bip-340.rs +++ b/bip-340/src/bip-340.rs @@ -325,8 +325,8 @@ pub fn verify(msg: Message, pubkey: PublicKey, sig: Signature) -> VerificationRe pub mod GroupTrait { use super::{ - finite, lift_x, point_add, x, y, AffinePoint, FieldElement, PBytes32, Point, Scalar, - ScalarCanvas, + finite, lift_x, point_add, point_mul_base, x, y, AffinePoint, FieldElement, PBytes32, + Point, Scalar, ScalarCanvas, }; use group::*; use hacspec_lib::*; @@ -718,7 +718,7 @@ pub mod GroupTrait { res } fn is_odd(&self) -> Choice { - Choice::from(if self.bit(0) {1} else {0}) + Choice::from(if self.bit(0) { 1 } else { 0 }) } const MODULUS: &'static str = "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141"; @@ -735,9 +735,7 @@ pub mod GroupTrait { impl Group for Point { type Scalar = Scalar; fn random(mut rng: impl RngCore) -> Self { - let b: &mut [u8; 32] = &mut [0u8; 32]; - rng.fill_bytes(b); - Point::Affine(lift_x(FieldElement::from_public_byte_seq_be(PBytes32(*b))).unwrap()) + point_mul_base(Scalar::random(rng)) } fn identity() -> Self { @@ -759,10 +757,11 @@ pub mod GroupTrait { 0xFDu8, 0x17u8, 0xB4u8, 0x48u8, 0xA6u8, 0x85u8, 0x54u8, 0x19u8, 0x9Cu8, 0x47u8, 0xD0u8, 0x8Fu8, 0xFBu8, 0x10u8, 0xD4u8, 0xB8u8 ]); - Point::Affine(( + let g = Point::Affine(( FieldElement::from_public_byte_seq_be(gx), FieldElement::from_public_byte_seq_be(gy), - )) + )); + g } fn is_identity(&self) -> Choice { @@ -784,27 +783,27 @@ pub mod GroupTrait { } } + use hacspec_concordium::*; + use hacspec_concordium_derive::*; -use hacspec_concordium::*; -use hacspec_concordium_derive::*; - -impl hacspec_concordium::Deserial for Scalar { - // TODO: - fn deserial(_source: &mut R) -> ParseResult { - let buffer: &mut [u8] = &mut []; - let _ = _source.read(buffer)?; - - Ok(Scalar::from_public_byte_seq_be(Seq::::from_native_slice(buffer))) + impl hacspec_concordium::Deserial for Scalar { + // TODO: + fn deserial(source: &mut R) -> ParseResult { + let buffer : [u8;32] = source.get()?; + Ok(Scalar::from_public_byte_seq_be(Seq::::from_native_slice(&buffer))) + } } -} -impl hacspec_concordium::Serial for Scalar { - // TODO: - fn serial(&self, _out: &mut W) -> Result<(), W::Err> { - _out.write(self.to_public_byte_seq_be().native_slice()); - Ok(()) + impl hacspec_concordium::Serial for Scalar { + // TODO: + fn serial(&self, out: &mut W) -> Result<(), W::Err> { + let mut buffer : [u8;32] = [0u8;32]; + let temp = self.to_public_byte_seq_be(); + for i in 0..32 { + buffer[i] = temp[i]; + } + buffer.serial(out)?; + Ok(()) + } } } - -} - diff --git a/ovn/src/ovn_secp256k1.rs b/ovn/src/ovn_secp256k1.rs index c5f8105..28379d7 100644 --- a/ovn/src/ovn_secp256k1.rs +++ b/ovn/src/ovn_secp256k1.rs @@ -48,7 +48,7 @@ impl hacspec_concordium::Deserial for Z_curve { impl hacspec_concordium::Serial for Z_curve { // TODO: fn serial(&self, _out: &mut W) -> Result<(), W::Err> { - _out.write(self.val.to_public_byte_seq_be().native_slice()); + let _ = _out.write(self.val.to_public_byte_seq_be().native_slice()); Ok(()) } } diff --git a/ovn/src/ovn_zkgroup.rs b/ovn/src/ovn_zkgroup.rs index e8244b9..256915e 100644 --- a/ovn/src/ovn_zkgroup.rs +++ b/ovn/src/ovn_zkgroup.rs @@ -15,7 +15,7 @@ use rand_core::RngCore; pub trait MGroup: Group { fn pow(p: Self, exp: Self::Scalar) -> Self; fn g_pow(n: Self::Scalar) -> Self { - Self::pow(Self::identity(), n - ::ONE) + Self::pow(Self::generator(), n) } fn hash(inp: Vec) -> Self::Scalar; @@ -45,7 +45,7 @@ pub fn schnorr_zkp( ) -> SchnorrZKPCommit { let u = G::g_pow(r); let c = G::hash(vec![G::generator(), h, u]); - let z = r + c * x; + let z = r + (c * x); return SchnorrZKPCommit { schnorr_zkp_u: u, @@ -57,7 +57,7 @@ pub fn schnorr_zkp( // https://crypto.stanford.edu/cs355/19sp/lec5.pdf pub fn schnorr_zkp_validate(h: G, pi: SchnorrZKPCommit) -> bool { pi.schnorr_zkp_c == G::hash(vec![G::generator(), h, pi.schnorr_zkp_u]) - && G::g_pow(pi.schnorr_zkp_z) == pi.schnorr_zkp_u + G::pow(h, pi.schnorr_zkp_c) + && (G::g_pow(pi.schnorr_zkp_z) == (pi.schnorr_zkp_u + G::pow(h, pi.schnorr_zkp_c))) } #[derive(SchemaType, Clone, Copy)] @@ -231,11 +231,6 @@ pub fn init_ovn_contract(// _: &impl HasInitContext, }) } -/** Currently randomness needs to be injected */ -pub fn select_private_voting_key(rand: impl RngCore + Copy) -> Z { - Z::random(rand) -} - #[derive(Serialize, SchemaType)] pub struct RegisterParam { pub rp_i: u32, diff --git a/ovn/tests/ovn_zk_example.rs b/ovn/tests/ovn_zk_example.rs index ec9a4da..ac991db 100644 --- a/ovn/tests/ovn_zk_example.rs +++ b/ovn/tests/ovn_zk_example.rs @@ -24,13 +24,26 @@ use rand_core::{RngCore, *}; use hacspec_bip_340::{GroupTrait::*, Point, *}; use rand::rngs::StdRng; +use rand::random; + +#[cfg(test)] +pub fn group_test() { + let r: ::Scalar = ::Scalar::random(rand::thread_rng()); + let x: ::Scalar = ::Scalar::random(rand::thread_rng()); + assert_eq!(G::g_pow(r + x), (G::g_pow(r) + G::g_pow(x)), "!!temp aa!!"); +} + +#[test] +pub fn secp256k1_group_correctness() { + group_test::() +} #[cfg(test)] pub fn schnorr_zkp_correctness() -> bool { - let mut x: ::Scalar = ::Scalar::random(rand::thread_rng()); + let random_r: ::Scalar = ::Scalar::random(rand::thread_rng()); + let x: ::Scalar = ::Scalar::random(rand::thread_rng()); let pow_x = G::g_pow(x); - let random_r: ::Scalar = ::Scalar::random(rand::thread_rng()); let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); let valid = schnorr_zkp_validate::(pow_x, pi); @@ -38,10 +51,11 @@ pub fn schnorr_zkp_correctness() -> bool { } #[test] -pub fn schorr_zkp_correctness() { - QuickCheck::new() - .tests(1000) - .quickcheck(schnorr_zkp_correctness:: as fn() -> bool) +pub fn schnorr_zkp_secp256k1_correctness() { + assert!(schnorr_zkp_correctness::()) + // QuickCheck::new() + // .tests(1000) + // .quickcheck(schnorr_zkp_correctness:: as fn() -> bool) } #[cfg(test)] @@ -95,6 +109,33 @@ pub fn sum_to_zero_secp256k1() { sum_to_zero::() } +#[cfg(test)] +pub fn test_params_of_group() + where G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial, +{ + // Setup the context + let mut ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); + let parameter = RegisterParam:: { + rp_i: random(), + rp_xi: G::Scalar::random(rand::thread_rng()), + rp_zkp_random: G::Scalar::random(rand::thread_rng()), + }; + let parameter_bytes = to_bytes(¶meter); + let ctx_params = ctx.clone().set_parameter(¶meter_bytes); + let param_back : Result, ParseError> = ctx_params.parameter_cursor().get(); + assert!(param_back.is_ok()); + + let wu_param = param_back.unwrap(); + assert_eq!(wu_param.rp_i,parameter.rp_i); + assert_eq!(wu_param.rp_xi,parameter.rp_xi); + assert_eq!(wu_param.rp_zkp_random,parameter.rp_zkp_random); +} + +#[test] +pub fn test_params_of_group_zk259() { + test_params_of_group::() +} + #[cfg(test)] pub fn test_correctness( votes: [bool; n], @@ -111,7 +152,7 @@ where G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial, { // Setup the context - let mut ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); + let ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); let mut state: OvnContractState = init_ovn_contract().unwrap(); @@ -157,9 +198,8 @@ where let parameter = TallyParameter {}; let parameter_bytes = to_bytes(¶meter); - ctx = ctx.set_parameter(¶meter_bytes); - (_, state) = tally_votes::(ctx.clone(), state).unwrap(); + (_, state) = tally_votes::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); let mut count = 0u32; for v in votes { @@ -176,17 +216,16 @@ where fn randomized_full_test () -> bool where G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial, { - use rand::random; let mut votes: [bool; n] = [false; n]; - let mut xis: [G::Scalar; n] = [G::Scalar::ZERO; n]; - let mut rp_zkp_randoms: [G::Scalar; n] = [G::Scalar::ZERO; n]; - let mut cvp_zkp_random_ws1: [G::Scalar; n] = [G::Scalar::ZERO; n]; - let mut cvp_zkp_random_rs1: [G::Scalar; n] = [G::Scalar::ZERO; n]; - let mut cvp_zkp_random_ds1: [G::Scalar; n] = [G::Scalar::ZERO; n]; - - let mut cvp_zkp_random_ws2: [G::Scalar; n] = [G::Scalar::ZERO; n]; - let mut cvp_zkp_random_rs2: [G::Scalar; n] = [G::Scalar::ZERO; n]; - let mut cvp_zkp_random_ds2: [G::Scalar; n] = [G::Scalar::ZERO; n]; + let mut xis: [G::Scalar; n] = [G::Scalar::ONE; n]; + let mut rp_zkp_randoms: [G::Scalar; n] = [G::Scalar::ONE; n]; + let mut cvp_zkp_random_ws1: [G::Scalar; n] = [G::Scalar::ONE; n]; + let mut cvp_zkp_random_rs1: [G::Scalar; n] = [G::Scalar::ONE; n]; + let mut cvp_zkp_random_ds1: [G::Scalar; n] = [G::Scalar::ONE; n]; + + let mut cvp_zkp_random_ws2: [G::Scalar; n] = [G::Scalar::ONE; n]; + let mut cvp_zkp_random_rs2: [G::Scalar; n] = [G::Scalar::ONE; n]; + let mut cvp_zkp_random_ds2: [G::Scalar; n] = [G::Scalar::ONE; n]; for i in 0..n { votes[i] = random(); From 5ec5a9f7a91311914de03be37640ac1926c2a26f Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Thu, 14 Mar 2024 18:51:30 +0100 Subject: [PATCH 79/86] Works on zk --- ovn/Cargo.toml | 2 +- ovn/src/ovn_zk_secp256k1.rs | 13 +++++++++ ovn/tests/ovn_zk_example.rs | 55 +++++++++++++++++++++++++++++-------- 3 files changed, 58 insertions(+), 12 deletions(-) diff --git a/ovn/Cargo.toml b/ovn/Cargo.toml index c2bc6d5..43a0edd 100644 --- a/ovn/Cargo.toml +++ b/ovn/Cargo.toml @@ -20,11 +20,11 @@ hacspec-concordium-derive = { path = "../concordium-derive" } # 4d4b024b547a1f12 quickcheck = "1" quickcheck_macros = "1" +bls12_381 = "0.8" [dev-dependencies] criterion = "0.4" rand = "0.8" -bls12_381 = "*" [features] hax_compilation = [] diff --git a/ovn/src/ovn_zk_secp256k1.rs b/ovn/src/ovn_zk_secp256k1.rs index d5356db..7282369 100644 --- a/ovn/src/ovn_zk_secp256k1.rs +++ b/ovn/src/ovn_zk_secp256k1.rs @@ -22,3 +22,16 @@ impl MGroup for Point { } } + +use bls12_381::*; + +impl MGroup for Gt { + fn pow (p: Self,exp: Self::Scalar) -> Self { + p * exp + } + + fn hash(inp: Vec) -> Self::Scalar { + return Self::Scalar::ONE // TODO + } + +} diff --git a/ovn/tests/ovn_zk_example.rs b/ovn/tests/ovn_zk_example.rs index ac991db..74bdf73 100644 --- a/ovn/tests/ovn_zk_example.rs +++ b/ovn/tests/ovn_zk_example.rs @@ -23,8 +23,8 @@ use rand_core::{RngCore, *}; // use quickcheck::RngCore; use hacspec_bip_340::{GroupTrait::*, Point, *}; -use rand::rngs::StdRng; use rand::random; +use rand::rngs::StdRng; #[cfg(test)] pub fn group_test() { @@ -38,6 +38,11 @@ pub fn secp256k1_group_correctness() { group_test::() } +// #[test] +// pub fn bls12_381_real_group_correctness() { +// group_test::() +// } + #[cfg(test)] pub fn schnorr_zkp_correctness() -> bool { let random_r: ::Scalar = ::Scalar::random(rand::thread_rng()); @@ -58,6 +63,11 @@ pub fn schnorr_zkp_secp256k1_correctness() { // .quickcheck(schnorr_zkp_correctness:: as fn() -> bool) } +#[test] +pub fn bls12_381_real_schnorr_correctness() { + assert!(schnorr_zkp_correctness::()) +} + #[cfg(test)] pub fn or_zkp_correctness(v: bool) -> bool { let random_w: ::Scalar = ::Scalar::random(rand::thread_rng()); @@ -74,12 +84,19 @@ pub fn or_zkp_correctness(v: bool) -> bool { #[test] // TODO: Fix inverse opeation, should make this test parse -pub fn or_zkp_secp256k1_correctness() { +pub fn or_zkp_secp256k1() { QuickCheck::new() .tests(10) .quickcheck(or_zkp_correctness:: as fn(bool) -> bool) } +#[test] +pub fn or_zkp_bls12_381_real() { + QuickCheck::new() + .tests(10) + .quickcheck(or_zkp_correctness:: as fn(bool) -> bool) +} + #[cfg(test)] pub fn sum_to_zero() { let mut xis: [G::Scalar; n] = [G::Scalar::ZERO; n]; @@ -109,9 +126,16 @@ pub fn sum_to_zero_secp256k1() { sum_to_zero::() } +#[test] +pub fn sum_to_zero_bls12_381_real() { + sum_to_zero::() +} + + #[cfg(test)] pub fn test_params_of_group() - where G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial, +where + G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial, { // Setup the context let mut ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); @@ -122,13 +146,14 @@ pub fn test_params_of_group() }; let parameter_bytes = to_bytes(¶meter); let ctx_params = ctx.clone().set_parameter(¶meter_bytes); - let param_back : Result, ParseError> = ctx_params.parameter_cursor().get(); + let param_back: Result, ParseError> = + ctx_params.parameter_cursor().get(); assert!(param_back.is_ok()); let wu_param = param_back.unwrap(); - assert_eq!(wu_param.rp_i,parameter.rp_i); - assert_eq!(wu_param.rp_xi,parameter.rp_xi); - assert_eq!(wu_param.rp_zkp_random,parameter.rp_zkp_random); + assert_eq!(wu_param.rp_i, parameter.rp_i); + assert_eq!(wu_param.rp_xi, parameter.rp_xi); + assert_eq!(wu_param.rp_zkp_random, parameter.rp_zkp_random); } #[test] @@ -178,8 +203,7 @@ where }; let parameter_bytes = to_bytes(¶meter); (_, state) = - commit_to_vote::(ctx.clone().set_parameter(¶meter_bytes), state) - .unwrap(); + commit_to_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); } for i in 0..n { @@ -199,7 +223,8 @@ where let parameter = TallyParameter {}; let parameter_bytes = to_bytes(¶meter); - (_, state) = tally_votes::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); + (_, state) = + tally_votes::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); let mut count = 0u32; for v in votes { @@ -213,7 +238,8 @@ where } #[cfg(test)] -fn randomized_full_test () -> bool where +fn randomized_full_test() -> bool +where G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial, { let mut votes: [bool; n] = [false; n]; @@ -267,3 +293,10 @@ fn test_full_secp256k1() { .tests(1) .quickcheck(randomized_full_test:: as fn() -> bool) } + +// #[test] +// fn test_full_bls12_381_real() { +// QuickCheck::new() +// .tests(1) +// .quickcheck(randomized_full_test:: as fn() -> bool) +// } From de922956a3a095ddaf1c5a3a11ebfca2a32f127a Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Sun, 17 Mar 2024 18:30:57 +0100 Subject: [PATCH 80/86] Working with external group impls --- bip-340/src/bip-340.rs | 4 +- concordium/Cargo.toml | 3 + concordium/src/concordium_impls.rs | 4 +- ovn/src/ovn_zk_secp256k1.rs | 12 +-- ovn/src/ovn_zkgroup.rs | 109 +++++++++++++++++----- ovn/tests/ovn_zk_example.rs | 144 +++++++++++++++++++---------- 6 files changed, 186 insertions(+), 90 deletions(-) diff --git a/bip-340/src/bip-340.rs b/bip-340/src/bip-340.rs index 3f6718e..bd65df4 100644 --- a/bip-340/src/bip-340.rs +++ b/bip-340/src/bip-340.rs @@ -325,7 +325,7 @@ pub fn verify(msg: Message, pubkey: PublicKey, sig: Signature) -> VerificationRe pub mod GroupTrait { use super::{ - finite, lift_x, point_add, point_mul_base, x, y, AffinePoint, FieldElement, PBytes32, + finite, lift_x, point_add, point_mul, point_mul_base, x, y, AffinePoint, FieldElement, PBytes32, Point, Scalar, ScalarCanvas, }; use group::*; @@ -405,7 +405,7 @@ pub mod GroupTrait { type Output = Point; #[inline] fn mul(self, rhs: Scalar) -> Self::Output { - self * rhs + point_mul(rhs, self) } } diff --git a/concordium/Cargo.toml b/concordium/Cargo.toml index 8fe6602..b1c5441 100644 --- a/concordium/Cargo.toml +++ b/concordium/Cargo.toml @@ -21,6 +21,9 @@ wee_alloc="0.4.5" # [features] # use_attributes = ["hacspec-attributes/print_attributes", "hacspec-attributes/hacspec_unsafe"] +bls12_381 = "0.8" +group = "0.13" + [dev-dependencies] # hacspec-dev = { path = "../../utils/dev" } criterion = "0.3" diff --git a/concordium/src/concordium_impls.rs b/concordium/src/concordium_impls.rs index 646e8cc..d083747 100644 --- a/concordium/src/concordium_impls.rs +++ b/concordium/src/concordium_impls.rs @@ -1,5 +1,5 @@ -// use crate::{convert, mem, num, // prims, -// concordium_prims::*, concordium_traits::*, concordium_types::*}; + // use crate::{convert, mem, num, // prims, + // concordium_prims::*, concordium_traits::*, concordium_types::*}; // use concordium_contracts_common::*; // impl convert::From<()> for Reject { diff --git a/ovn/src/ovn_zk_secp256k1.rs b/ovn/src/ovn_zk_secp256k1.rs index 7282369..fc47c43 100644 --- a/ovn/src/ovn_zk_secp256k1.rs +++ b/ovn/src/ovn_zk_secp256k1.rs @@ -11,27 +11,17 @@ pub use crate::ovn_zkgroup::*; use hacspec_bip_340::{GroupTrait::*, Point, *}; - impl MGroup for Point { - fn pow (p: Self,exp: Self::Scalar) -> Self { - point_mul(exp,p) - } - fn hash(inp: Vec) -> Self::Scalar { return Self::Scalar::ONE // TODO } - } use bls12_381::*; impl MGroup for Gt { - fn pow (p: Self,exp: Self::Scalar) -> Self { - p * exp - } - fn hash(inp: Vec) -> Self::Scalar { return Self::Scalar::ONE // TODO } - } +// hacspec_concordium::Serial + hacspec_concordium::Deserial, diff --git a/ovn/src/ovn_zkgroup.rs b/ovn/src/ovn_zkgroup.rs index 256915e..067a8ec 100644 --- a/ovn/src/ovn_zkgroup.rs +++ b/ovn/src/ovn_zkgroup.rs @@ -13,9 +13,12 @@ use group::{ use rand_core::RngCore; pub trait MGroup: Group { - fn pow(p: Self, exp: Self::Scalar) -> Self; + fn pow(p: Self, exp: Self::Scalar) -> Self { + p * exp + } + fn g_pow(n: Self::Scalar) -> Self { - Self::pow(Self::generator(), n) + Self::generator() * n } fn hash(inp: Vec) -> Self::Scalar; @@ -231,24 +234,51 @@ pub fn init_ovn_contract(// _: &impl HasInitContext, }) } -#[derive(Serialize, SchemaType)] -pub struct RegisterParam { +use core::marker::PhantomData; +#[derive(SchemaType)] +pub struct RegisterParam + Into> { pub rp_i: u32, pub rp_xi: Z, pub rp_zkp_random: Z, + pub phantom: PhantomData, +} + +impl + Into> Serial for RegisterParam { + fn serial(&self, w: &mut W) -> Result<(), ::Err> { + self.rp_i.serial(w)?; + >::from(self.rp_xi).serial(w)?; + >::from(self.rp_zkp_random).serial(w)?; + Ok(()) + } +} + +impl + Into> Deserial for RegisterParam { + fn deserial(r: &mut R) -> Result { + let rp_i: u32 = r.get()?; + let rp_xi: Z = >::into(r.get()?); + let rp_zkp_random: Z = >::into(r.get()?); + Ok(RegisterParam { + rp_i, + rp_xi, + rp_zkp_random, + phantom: PhantomData, + }) + } } /** Primary function in round 1 */ #[hax::receive(contract = "OVN", name = "register", parameter = "RegisterParam")] // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "register", parameter = "RegisterParam"))] -pub fn register_vote( +pub fn register_vote< + G: MGroup, + S: Serialize + From + Into, + const n: usize, + A: HasActions, +>( ctx: impl HasReceiveContext, state: OvnContractState, -) -> Result<(A, OvnContractState), ParseError> -where - G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial, -{ - let params: RegisterParam = ctx.parameter_cursor().get()?; +) -> Result<(A, OvnContractState), ParseError> { + let params: RegisterParam = ctx.parameter_cursor().get()?; let g_pow_xi = G::g_pow(params.rp_xi); let zkp_xi = schnorr_zkp::(params.rp_zkp_random, g_pow_xi, params.rp_xi); @@ -260,14 +290,47 @@ where Ok((A::accept(), register_vote_state_ret)) } -#[derive(Serialize, SchemaType)] -pub struct CastVoteParam { +#[derive(SchemaType)] +pub struct CastVoteParam + Into> { pub cvp_i: u32, pub cvp_xi: Z, pub cvp_zkp_random_w: Z, pub cvp_zkp_random_r: Z, pub cvp_zkp_random_d: Z, pub cvp_vote: bool, + pub phantom: PhantomData, +} + +impl + Into> Serial for CastVoteParam { + fn serial(&self, w: &mut W) -> Result<(), ::Err> { + self.cvp_i.serial(w)?; + >::from(self.cvp_xi).serial(w)?; + >::from(self.cvp_zkp_random_w).serial(w)?; + >::from(self.cvp_zkp_random_r).serial(w)?; + >::from(self.cvp_zkp_random_d).serial(w)?; + self.cvp_vote.serial(w)?; + Ok(()) + } +} + +impl + Into> Deserial for CastVoteParam { + fn deserial(r: &mut R) -> Result { + let cvp_i: u32 = r.get()?; + let cvp_xi: Z = >::into(r.get()?); + let cvp_zkp_random_w: Z = >::into(r.get()?); + let cvp_zkp_random_r: Z = >::into(r.get()?); + let cvp_zkp_random_d: Z = >::into(r.get()?); + let cvp_vote: bool = r.get()?; + Ok(CastVoteParam { + cvp_i, + cvp_xi, + cvp_zkp_random_w, + cvp_zkp_random_r, + cvp_zkp_random_d, + cvp_vote, + phantom: PhantomData, + }) + } } pub fn compute_g_pow_yi(i: usize, xis: [G; n]) -> G { @@ -298,14 +361,16 @@ pub fn compute_group_element_for_vote(xi: G::Scalar, vote: bool, g_po /** Commitment before round 2 */ #[hax::receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam"))] -pub fn commit_to_vote( +pub fn commit_to_vote< + G: MGroup, + S: Serialize + From + Into, + const n: usize, + A: HasActions, +>( ctx: impl HasReceiveContext, state: OvnContractState, -) -> Result<(A, OvnContractState), ParseError> -where - G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial, -{ - let params: CastVoteParam = ctx.parameter_cursor().get()?; +) -> Result<(A, OvnContractState), ParseError> { + let params: CastVoteParam = ctx.parameter_cursor().get()?; for i in 0..n { if !schnorr_zkp_validate(state.g_pow_xis[i], state.zkp_xis[i]) { @@ -326,14 +391,12 @@ where /** Primary function in round 2, also opens commitment */ #[hax::receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam"))] -pub fn cast_vote( +pub fn cast_vote + Into, const n: usize, A: HasActions>( ctx: impl HasReceiveContext, state: OvnContractState, ) -> Result<(A, OvnContractState), ParseError> -where - G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial, { - let params: CastVoteParam = ctx.parameter_cursor().get()?; + let params: CastVoteParam = ctx.parameter_cursor().get()?; let g_pow_yi = compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); let g_pow_xi_yi_vi = @@ -364,8 +427,6 @@ pub fn tally_votes( _: impl HasReceiveContext, state: OvnContractState, ) -> Result<(A, OvnContractState), ParseError> -where - G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial, { for i in 0..n { let g_pow_yi = compute_g_pow_yi::(i as usize, state.g_pow_xis); diff --git a/ovn/tests/ovn_zk_example.rs b/ovn/tests/ovn_zk_example.rs index 74bdf73..5286407 100644 --- a/ovn/tests/ovn_zk_example.rs +++ b/ovn/tests/ovn_zk_example.rs @@ -15,22 +15,66 @@ extern crate quickcheck_macros; #[cfg(test)] use quickcheck::*; -pub use bls12_381::*; +pub use bls12_381::{*, Scalar as BlsScalar}; pub use group::{ff::Field, Group}; pub use hacspec_ovn::{ovn_zk_secp256k1::*, ovn_zkgroup::*}; +use core::marker::PhantomData; use rand_core::{RngCore, *}; // use quickcheck::RngCore; -use hacspec_bip_340::{GroupTrait::*, Point, *}; +use hacspec_bip_340::{GroupTrait::*, Point, Scalar as BipScalar, *}; use rand::random; use rand::rngs::StdRng; +#[derive(Serialize)] +struct GroupBits { + val: [u8; n], +} + +impl From for GroupBits<32> { + fn from(value: BlsScalar) -> Self { + Self { val: value.to_bytes() } + } +} + +impl Into for GroupBits<32> { + fn into(self) -> BlsScalar { + BlsScalar::from_bytes(&self.val).unwrap() + } +} + +impl From for GroupBits<32> { + fn from(value: BipScalar) -> Self { + let mut val : [u8; 32] = [0u8; 32]; + let temp = value.to_be_bytes(); + for i in 0..32 { +val[i] = temp[i]; + } + Self { val } + } +} + +impl Into for GroupBits<32> { + fn into(self) -> BipScalar { + BipScalar::from_be_bytes(&self.val) + } +} + + +//////////////////////////// +// Group operations tests // +//////////////////////////// + #[cfg(test)] pub fn group_test() { let r: ::Scalar = ::Scalar::random(rand::thread_rng()); let x: ::Scalar = ::Scalar::random(rand::thread_rng()); - assert_eq!(G::g_pow(r + x), (G::g_pow(r) + G::g_pow(x)), "!!temp aa!!"); + assert_eq!( + G::generator() * (r + x), + (G::generator() * r + G::generator() * (x)), + "!!temp aa!!" + ); } #[test] @@ -38,16 +82,16 @@ pub fn secp256k1_group_correctness() { group_test::() } -// #[test] -// pub fn bls12_381_real_group_correctness() { -// group_test::() -// } +#[test] +pub fn bls12_381_real_group_correctness() { + group_test::() +} #[cfg(test)] pub fn schnorr_zkp_correctness() -> bool { let random_r: ::Scalar = ::Scalar::random(rand::thread_rng()); let x: ::Scalar = ::Scalar::random(rand::thread_rng()); - let pow_x = G::g_pow(x); + let pow_x = G::generator() * x; // G::g_pow(x); let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); @@ -64,7 +108,7 @@ pub fn schnorr_zkp_secp256k1_correctness() { } #[test] -pub fn bls12_381_real_schnorr_correctness() { +pub fn schnorr_correctness_bls12_381_real() { assert!(schnorr_zkp_correctness::()) } @@ -116,11 +160,6 @@ pub fn sum_to_zero() { assert!(res == G::identity()); } -// #[test] -// pub fn sum_to_zero_z89() { -// sum_to_zero::() -// } - #[test] pub fn sum_to_zero_secp256k1() { sum_to_zero::() @@ -128,25 +167,27 @@ pub fn sum_to_zero_secp256k1() { #[test] pub fn sum_to_zero_bls12_381_real() { - sum_to_zero::() + sum_to_zero::() } - #[cfg(test)] -pub fn test_params_of_group() -where - G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial, +pub fn test_params_of_group< + G: MGroup, + S: Serialize + From + Into, + A: HasActions, +>() { // Setup the context let mut ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); - let parameter = RegisterParam:: { + let parameter = RegisterParam:: { rp_i: random(), rp_xi: G::Scalar::random(rand::thread_rng()), rp_zkp_random: G::Scalar::random(rand::thread_rng()), + phantom: PhantomData, }; let parameter_bytes = to_bytes(¶meter); let ctx_params = ctx.clone().set_parameter(¶meter_bytes); - let param_back: Result, ParseError> = + let param_back: Result, ParseError> = ctx_params.parameter_cursor().get(); assert!(param_back.is_ok()); @@ -158,11 +199,22 @@ where #[test] pub fn test_params_of_group_zk259() { - test_params_of_group::() + test_params_of_group::, hacspec_concordium::test_infrastructure::ActionsTree>() +} + + +#[test] +pub fn test_params_of_group_bls12_381_real() { + test_params_of_group::, hacspec_concordium::test_infrastructure::ActionsTree>() } #[cfg(test)] -pub fn test_correctness( +pub fn test_correctness< + G: MGroup, + S: Serialize + From + Into, + const n: usize, + A: HasActions, +>( votes: [bool; n], xis: [G::Scalar; n], rp_zkp_randoms: [G::Scalar; n], @@ -173,8 +225,6 @@ pub fn test_correctness( cvp_zkp_random_rs2: [G::Scalar; n], cvp_zkp_random_ds2: [G::Scalar; n], ) -> bool -where - G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial, { // Setup the context let ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); @@ -182,42 +232,45 @@ where let mut state: OvnContractState = init_ovn_contract().unwrap(); for i in 0..n { - let parameter = RegisterParam:: { + let parameter = RegisterParam:: { rp_i: i as u32, rp_xi: xis[i], rp_zkp_random: rp_zkp_randoms[i], + phantom: PhantomData, }; let parameter_bytes = to_bytes(¶meter); (_, state) = - register_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); + register_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); } for i in 0..n { - let parameter = CastVoteParam:: { + let parameter = CastVoteParam:: { cvp_i: i as u32, cvp_xi: xis[i], cvp_zkp_random_w: cvp_zkp_random_ws1[i], cvp_zkp_random_r: cvp_zkp_random_rs1[i], cvp_zkp_random_d: cvp_zkp_random_ds1[i], cvp_vote: votes[i], + phantom: PhantomData, }; let parameter_bytes = to_bytes(¶meter); (_, state) = - commit_to_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); + commit_to_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); } for i in 0..n { - let parameter = CastVoteParam:: { + let parameter = CastVoteParam:: { cvp_i: i as u32, cvp_xi: xis[i], cvp_zkp_random_w: cvp_zkp_random_ws2[i], cvp_zkp_random_r: cvp_zkp_random_rs2[i], cvp_zkp_random_d: cvp_zkp_random_ds2[i], cvp_vote: votes[i], + phantom: PhantomData, }; let parameter_bytes = to_bytes(¶meter); (_, state) = - cast_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); + cast_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); } let parameter = TallyParameter {}; @@ -238,9 +291,7 @@ where } #[cfg(test)] -fn randomized_full_test() -> bool -where - G::Scalar: hacspec_concordium::Serial + hacspec_concordium::Deserial, +fn randomized_full_test + Into, const n: usize>() -> bool { let mut votes: [bool; n] = [false; n]; let mut xis: [G::Scalar; n] = [G::Scalar::ONE; n]; @@ -265,7 +316,7 @@ where cvp_zkp_random_ds2[i] = G::Scalar::random(rand::thread_rng()); } - test_correctness::( + test_correctness::( votes, xis, rp_zkp_randoms, @@ -278,25 +329,16 @@ where ) } -// // // #[concordium_test] -// // #[test] -// // fn test_full_z89() { -// // QuickCheck::new() -// // .tests(100) -// // .quickcheck(randomized_full_test:: as fn() -> bool) -// // } - -// #[concordium_test] #[test] fn test_full_secp256k1() { QuickCheck::new() .tests(1) - .quickcheck(randomized_full_test:: as fn() -> bool) + .quickcheck(randomized_full_test::, 15> as fn() -> bool) } -// #[test] -// fn test_full_bls12_381_real() { -// QuickCheck::new() -// .tests(1) -// .quickcheck(randomized_full_test:: as fn() -> bool) -// } +#[test] +fn test_full_bls12_381_real() { + QuickCheck::new() + .tests(1) + .quickcheck(randomized_full_test::, 15> as fn() -> bool) +} From 3e237cb1018c353613a24611917122b3997c033d Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Sun, 17 Mar 2024 18:40:35 +0100 Subject: [PATCH 81/86] Revert serialization --- bip-340/Cargo.toml | 3 --- bip-340/src/bip-340.rs | 34 +++------------------------------- 2 files changed, 3 insertions(+), 34 deletions(-) diff --git a/bip-340/Cargo.toml b/bip-340/Cargo.toml index e44b47a..8960405 100644 --- a/bip-340/Cargo.toml +++ b/bip-340/Cargo.toml @@ -17,9 +17,6 @@ ff = "0.13" subtle = "*" rand_core = "0.6" -hacspec-concordium = { path = "../concordium" } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a -hacspec-concordium-derive = { path = "../concordium-derive" } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a - [dev-dependencies] quickcheck = "1" quickcheck_macros = "1" diff --git a/bip-340/src/bip-340.rs b/bip-340/src/bip-340.rs index bd65df4..a9a8a87 100644 --- a/bip-340/src/bip-340.rs +++ b/bip-340/src/bip-340.rs @@ -324,10 +324,7 @@ pub fn verify(msg: Message, pubkey: PublicKey, sig: Signature) -> VerificationRe ///////////////// pub mod GroupTrait { - use super::{ - finite, lift_x, point_add, point_mul, point_mul_base, x, y, AffinePoint, FieldElement, PBytes32, - Point, Scalar, ScalarCanvas, - }; + use super::*; use group::*; use hacspec_lib::*; @@ -757,11 +754,10 @@ pub mod GroupTrait { 0xFDu8, 0x17u8, 0xB4u8, 0x48u8, 0xA6u8, 0x85u8, 0x54u8, 0x19u8, 0x9Cu8, 0x47u8, 0xD0u8, 0x8Fu8, 0xFBu8, 0x10u8, 0xD4u8, 0xB8u8 ]); - let g = Point::Affine(( + Point::Affine(( FieldElement::from_public_byte_seq_be(gx), FieldElement::from_public_byte_seq_be(gy), - )); - g + )) } fn is_identity(&self) -> Choice { @@ -782,28 +778,4 @@ pub mod GroupTrait { finite(*self).unwrap() } } - - use hacspec_concordium::*; - use hacspec_concordium_derive::*; - - impl hacspec_concordium::Deserial for Scalar { - // TODO: - fn deserial(source: &mut R) -> ParseResult { - let buffer : [u8;32] = source.get()?; - Ok(Scalar::from_public_byte_seq_be(Seq::::from_native_slice(&buffer))) - } - } - - impl hacspec_concordium::Serial for Scalar { - // TODO: - fn serial(&self, out: &mut W) -> Result<(), W::Err> { - let mut buffer : [u8;32] = [0u8;32]; - let temp = self.to_public_byte_seq_be(); - for i in 0..32 { - buffer[i] = temp[i]; - } - buffer.serial(out)?; - Ok(()) - } - } } From 2c3e56ed49eb0febbdc57b6a891a40c5c879ea4b Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Wed, 24 Apr 2024 18:10:39 +0200 Subject: [PATCH 82/86] Back to working, with better group trait --- ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 604 +----------- .../extraction/Hacspec_ovn_Ovn_group.v | 484 ++++++++++ .../extraction/Hacspec_ovn_Ovn_secp256k1.v | 354 +++++++ .../extraction/Hacspec_ovn_Ovn_traits.v | 99 +- .../extraction/Hacspec_ovn_Ovn_z_89_.v | 121 ++- .../extraction/Hacspec_ovn_Ovn_zkgroup.v | 73 ++ .../Hacspec_ovn_Ovn_zkgroup_specific.v | 110 +++ .../ssprove/extraction/Hacspec_ovn_actual.v | 874 ++++++++++++++++++ .../ssprove/extraction/_expected_trait.v | 86 ++ ovn/src/lib.rs | 9 +- ovn/src/ovn_group.rs | 221 ++--- ovn/src/ovn_secp256k1.rs | 122 +-- ovn/src/ovn_traits.rs | 43 +- ovn/src/ovn_z_89.rs | 119 ++- ovn/src/ovn_zk_secp256k1.rs | 6 +- ovn/src/ovn_zkgroup.rs | 829 ++++++++--------- ovn/src/ovn_zkgroup_specific.rs | 457 +++++++++ ovn/tests/ovn_example.rs | 152 +-- ovn/tests/ovn_zk_example.rs | 49 +- 19 files changed, 3372 insertions(+), 1440 deletions(-) create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group.v create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_secp256k1.v create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_zkgroup.v create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_zkgroup_specific.v create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_actual.v create mode 100644 ovn/proofs/ssprove/extraction/_expected_trait.v create mode 100644 ovn/src/ovn_zkgroup_specific.rs diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index 8fe102e..e6bf326 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -4,7 +4,7 @@ From Crypt Require Import choice_type Package Prelude. Import PackageNotation. From extructures Require Import ord fset. From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. +(* From Jasmin Require Import word. *) From Coq Require Import ZArith. From Coq Require Import Strings.String. @@ -24,610 +24,14 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Require Import Hacspec_ovn_Ovn_traits. -Export Hacspec_ovn_Ovn_traits. - (*Not implemented yet? todo(item)*) (*Not implemented yet? todo(item)*) (*Not implemented yet? todo(item)*) -Context (v_Z : choice_type) (v_G : choice_type) (v_A : choice_type). -Context {n : both (uint_size)}. -Context (v_Z_t_Sized : t_Sized (v_Z)) (v_G_t_Sized : t_Sized (v_G)) `{ t_Sized (v_A)}. -Context (v_Z_t_Z_Field : t_Z_Field (v_Z)) (v_G_v_Z_t_Group : @t_Group (v_G) (v_Z) v_Z_t_Z_Field) (v_A_t_HasActions : t_HasActions (v_A)) . - -Equations compute_group_element_for_vote (xi : both (f_field_type)) (vote : both ('bool)) (g_pow_yi : both (f_group_type)) : both (f_group_type) := - compute_group_element_for_vote xi vote g_pow_yi := - solve_lift (f_prod (f_pow g_pow_yi xi) (f_g_pow (ifb vote - then f_field_one - else f_field_zero))) : both (f_group_type). -Fail Next Obligation. - -Equations select_private_voting_key (random : both (int32)) : both (f_field_type) := - select_private_voting_key random := - solve_lift (f_random_field_elem random) : both (f_field_type). -Fail Next Obligation. - -Equations compute_g_pow_yi (i : both (uint_size)) (xis : both (nseq f_group_type (is_pure (n)))) : both (f_group_type) := - compute_g_pow_yi i xis := - letb prod1 := f_group_one in - letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => - ssp (fun prod1 => - solve_lift (f_prod prod1 (xis.a[j])) : both (f_group_type))) prod1 in - letb prod2 := f_group_one in - letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => - ssp (fun prod2 => - solve_lift (f_prod prod2 (xis.a[j])) : both (f_group_type))) prod2 in - solve_lift (f_div prod1 prod2) : both (f_group_type). -Solve All Obligations with now intros ; destruct from_uint_size. -Fail Next Obligation. - -Equations check_commitment (g_pow_xi_yi_vi : both (f_group_type)) (commitment : both (f_field_type)) : both ('bool) := - check_commitment g_pow_xi_yi_vi commitment := - solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both ('bool). -Fail Next Obligation. - -Equations commit_to (g_pow_xi_yi_vi : both (f_group_type)) : both (f_field_type) := - commit_to g_pow_xi_yi_vi := - solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both (f_field_type). -Fail Next Obligation. - -Definition t_CastVoteParam : choice_type := - (int32 × f_field_type × int32 × int32 × int32 × 'bool). -Equations f_cvp_i (s : both (t_CastVoteParam)) : both (int32) := - f_cvp_i s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : int32))) : both (int32). -Fail Next Obligation. -Equations f_cvp_xi (s : both (t_CastVoteParam)) : both (f_field_type) := - f_cvp_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both (f_field_type). -Fail Next Obligation. -Equations f_cvp_zkp_random_w (s : both (t_CastVoteParam)) : both (int32) := - f_cvp_zkp_random_w s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : int32))) : both (int32). -Fail Next Obligation. -Equations f_cvp_zkp_random_r (s : both (t_CastVoteParam)) : both (int32) := - f_cvp_zkp_random_r s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : int32))) : both (int32). -Fail Next Obligation. -Equations f_cvp_zkp_random_d (s : both (t_CastVoteParam)) : both (int32) := - f_cvp_zkp_random_d s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int32))) : both (int32). -Fail Next Obligation. -Equations f_cvp_vote (s : both (t_CastVoteParam)) : both ('bool) := - f_cvp_vote s := - bind_both s (fun x => - solve_lift (ret_both (snd x : 'bool))) : both ('bool). -Fail Next Obligation. -Equations Build_t_CastVoteParam {f_cvp_i : both (int32)} {f_cvp_xi : both (f_field_type)} {f_cvp_zkp_random_w : both (int32)} {f_cvp_zkp_random_r : both (int32)} {f_cvp_zkp_random_d : both (int32)} {f_cvp_vote : both ('bool)} : both (t_CastVoteParam) := - Build_t_CastVoteParam := - bind_both f_cvp_vote (fun f_cvp_vote => - bind_both f_cvp_zkp_random_d (fun f_cvp_zkp_random_d => - bind_both f_cvp_zkp_random_r (fun f_cvp_zkp_random_r => - bind_both f_cvp_zkp_random_w (fun f_cvp_zkp_random_w => - bind_both f_cvp_xi (fun f_cvp_xi => - bind_both f_cvp_i (fun f_cvp_i => - solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam))))))))) : both (t_CastVoteParam). -Fail Next Obligation. -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_w' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := y) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_r' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := y) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_d' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := y) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := y)). - -Definition t_OrZKPCommit : choice_type := - (f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_field_type × f_field_type × f_field_type × f_field_type × f_field_type). -Equations f_or_zkp_x (s : both (t_OrZKPCommit)) : both (f_group_type) := - f_or_zkp_x s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both (f_group_type). -Fail Next Obligation. -Equations f_or_zkp_y (s : both (t_OrZKPCommit)) : both (f_group_type) := - f_or_zkp_y s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both (f_group_type). -Fail Next Obligation. -Equations f_or_zkp_a1 (s : both (t_OrZKPCommit)) : both (f_group_type) := - f_or_zkp_a1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : f_group_type))) : both (f_group_type). -Fail Next Obligation. -Equations f_or_zkp_b1 (s : both (t_OrZKPCommit)) : both (f_group_type) := - f_or_zkp_b1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : f_group_type))) : both (f_group_type). -Fail Next Obligation. -Equations f_or_zkp_a2 (s : both (t_OrZKPCommit)) : both (f_group_type) := - f_or_zkp_a2 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : f_group_type))) : both (f_group_type). -Fail Next Obligation. -Equations f_or_zkp_b2 (s : both (t_OrZKPCommit)) : both (f_group_type) := - f_or_zkp_b2 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : f_group_type))) : both (f_group_type). -Fail Next Obligation. -Equations f_or_zkp_c (s : both (t_OrZKPCommit)) : both (f_field_type) := - f_or_zkp_c s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both (f_field_type). -Fail Next Obligation. -Equations f_or_zkp_d1 (s : both (t_OrZKPCommit)) : both (f_field_type) := - f_or_zkp_d1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : f_field_type))) : both (f_field_type). -Fail Next Obligation. -Equations f_or_zkp_d2 (s : both (t_OrZKPCommit)) : both (f_field_type) := - f_or_zkp_d2 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : f_field_type))) : both (f_field_type). -Fail Next Obligation. -Equations f_or_zkp_r1 (s : both (t_OrZKPCommit)) : both (f_field_type) := - f_or_zkp_r1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). -Fail Next Obligation. -Equations f_or_zkp_r2 (s : both (t_OrZKPCommit)) : both (f_field_type) := - f_or_zkp_r2 s := - bind_both s (fun x => - solve_lift (ret_both (snd x : f_field_type))) : both (f_field_type). -Fail Next Obligation. -Equations Build_t_OrZKPCommit {f_or_zkp_x : both (f_group_type)} {f_or_zkp_y : both (f_group_type)} {f_or_zkp_a1 : both (f_group_type)} {f_or_zkp_b1 : both (f_group_type)} {f_or_zkp_a2 : both (f_group_type)} {f_or_zkp_b2 : both (f_group_type)} {f_or_zkp_c : both (f_field_type)} {f_or_zkp_d1 : both (f_field_type)} {f_or_zkp_d2 : both (f_field_type)} {f_or_zkp_r1 : both (f_field_type)} {f_or_zkp_r2 : both (f_field_type)} : both (t_OrZKPCommit) := - Build_t_OrZKPCommit := - bind_both f_or_zkp_r2 (fun f_or_zkp_r2 => - bind_both f_or_zkp_r1 (fun f_or_zkp_r1 => - bind_both f_or_zkp_d2 (fun f_or_zkp_d2 => - bind_both f_or_zkp_d1 (fun f_or_zkp_d1 => - bind_both f_or_zkp_c (fun f_or_zkp_c => - bind_both f_or_zkp_b2 (fun f_or_zkp_b2 => - bind_both f_or_zkp_a2 (fun f_or_zkp_a2 => - bind_both f_or_zkp_b1 (fun f_or_zkp_b1 => - bind_both f_or_zkp_a1 (fun f_or_zkp_a1 => - bind_both f_or_zkp_y (fun f_or_zkp_y => - bind_both f_or_zkp_x (fun f_or_zkp_x => - solve_lift (ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit)))))))))))))) : both (t_OrZKPCommit). -Fail Next Obligation. -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := y) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := y) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := y) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := y) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := y) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := y) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_c' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := y) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := y) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := y) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := y) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := y)). - -Definition t_RegisterParam : choice_type := - (int32 × f_field_type × int32). -Equations f_rp_i (s : both (t_RegisterParam)) : both (int32) := - f_rp_i s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both (int32). -Fail Next Obligation. -Equations f_rp_xi (s : both (t_RegisterParam)) : both (f_field_type) := - f_rp_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). -Fail Next Obligation. -Equations f_rp_zkp_random (s : both (t_RegisterParam)) : both (int32) := - f_rp_zkp_random s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both (int32). -Fail Next Obligation. -Equations Build_t_RegisterParam {f_rp_i : both (int32)} {f_rp_xi : both (f_field_type)} {f_rp_zkp_random : both (int32)} : both (t_RegisterParam) := - Build_t_RegisterParam := - bind_both f_rp_zkp_random (fun f_rp_zkp_random => - bind_both f_rp_xi (fun f_rp_xi => - bind_both f_rp_i (fun f_rp_i => - solve_lift (ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam)))))) : both (t_RegisterParam). -Fail Next Obligation. -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y) (f_rp_zkp_random := f_rp_zkp_random x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := y)). - -Definition t_SchnorrZKPCommit : choice_type := - (f_group_type × f_field_type × f_field_type). -Equations f_schnorr_zkp_u (s : both (t_SchnorrZKPCommit)) : both (f_group_type) := - f_schnorr_zkp_u s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : f_group_type))) : both (f_group_type). -Fail Next Obligation. -Equations f_schnorr_zkp_c (s : both (t_SchnorrZKPCommit)) : both (f_field_type) := - f_schnorr_zkp_c s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). -Fail Next Obligation. -Equations f_schnorr_zkp_z (s : both (t_SchnorrZKPCommit)) : both (f_field_type) := - f_schnorr_zkp_z s := - bind_both s (fun x => - solve_lift (ret_both (snd x : f_field_type))) : both (f_field_type). -Fail Next Obligation. -Equations Build_t_SchnorrZKPCommit {f_schnorr_zkp_u : both (f_group_type)} {f_schnorr_zkp_c : both (f_field_type)} {f_schnorr_zkp_z : both (f_field_type)} : both (t_SchnorrZKPCommit) := - Build_t_SchnorrZKPCommit := - bind_both f_schnorr_zkp_z (fun f_schnorr_zkp_z => - bind_both f_schnorr_zkp_c (fun f_schnorr_zkp_c => - bind_both f_schnorr_zkp_u (fun f_schnorr_zkp_u => - solve_lift (ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit)))))) : both (t_SchnorrZKPCommit). -Fail Next Obligation. -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := y) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := y) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := y)). - -Definition t_TallyParameter : choice_type := - 'unit. -Equations Build_t_TallyParameter : both (t_TallyParameter) := - Build_t_TallyParameter := - solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (t_TallyParameter). -Fail Next Obligation. - -Equations schnorr_zkp (random : both (int32)) (h : both (f_group_type)) (x : both (f_field_type)) : both (t_SchnorrZKPCommit) := - schnorr_zkp random h x := - solve_lift (run (letb r := f_random_field_elem random in - letb u := f_g_pow r in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g; - h; - u])))) in - letb z := f_add r (f_mul c x) in - letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit)] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in - ControlFlow_Continue (never_to_any hoist1))) : both (t_SchnorrZKPCommit). -Fail Next Obligation. - -Equations schnorr_zkp_validate (h : both (f_group_type)) (pi : both (t_SchnorrZKPCommit)) : both ('bool) := - schnorr_zkp_validate h pi := - solve_lift (andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g; - h; - f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both ('bool). -Fail Next Obligation. - -Equations zkp_one_out_of_two (random_w : both (int32)) (random_r : both (int32)) (random_d : both (int32)) (h : both (f_group_type)) (xi : both (f_field_type)) (vi : both ('bool)) : both (t_OrZKPCommit) := - zkp_one_out_of_two random_w random_r random_d h xi vi := - letb w := f_random_field_elem random_w in - solve_lift (ifb vi - then letb r1 := f_random_field_elem random_r in - letb d1 := f_random_field_elem random_d in - letb x := f_g_pow xi in - letb y := f_prod (f_pow h xi) (f_g) in - letb a1 := f_prod (f_g_pow r1) (f_pow x d1) in - letb b1 := f_prod (f_pow h r1) (f_pow y d1) in - letb a2 := f_g_pow w in - letb b2 := f_pow h w in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; - y; - a1; - b1; - a2; - b2])))) in - letb d2 := f_sub c d1 in - letb r2 := f_sub w (f_mul xi d2) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2) - else letb r2 := f_random_field_elem random_r in - letb d2 := f_random_field_elem random_d in - letb x := f_g_pow xi in - letb y := f_pow h xi in - letb a1 := f_g_pow w in - letb b1 := f_pow h w in - letb a2 := f_prod (f_g_pow r2) (f_pow x d2) in - letb b2 := f_prod (f_pow h r2) (f_pow (f_div y (f_g)) d2) in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; - y; - a1; - b1; - a2; - b2])))) in - letb d1 := f_sub c d2 in - letb r1 := f_sub w (f_mul xi d1) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (t_OrZKPCommit). -Fail Next Obligation. - -Equations zkp_one_out_of_two_validate (h : both (f_group_type)) (zkp : both (t_OrZKPCommit)) : both ('bool) := - zkp_one_out_of_two_validate h zkp := - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; - f_or_zkp_y zkp; - f_or_zkp_a1 zkp; - f_or_zkp_b1 zkp; - f_or_zkp_a2 zkp; - f_or_zkp_b2 zkp])))) in - solve_lift (andb (andb (andb (andb (c =.? (f_add (f_or_zkp_d1 zkp) (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? (f_prod (f_pow h (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r2 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? (f_prod (f_pow h (f_or_zkp_r2 zkp)) (f_pow (f_div (f_or_zkp_y zkp) (f_g)) (f_or_zkp_d2 zkp))))) : both ('bool). -Fail Next Obligation. - -Definition t_OvnContractState : choice_type := - (nseq f_group_type (is_pure (n)) × nseq (t_SchnorrZKPCommit) (is_pure (n)) × nseq f_field_type (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq (t_OrZKPCommit) (is_pure (n)) × int32). -Equations f_g_pow_xis (s : both (t_OvnContractState)) : both (nseq f_group_type (is_pure (n))) := - f_g_pow_xis s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type (is_pure (n))))) : both (nseq f_group_type (is_pure (n))). -Fail Next Obligation. -Equations f_zkp_xis (s : both (t_OvnContractState)) : both (nseq (t_SchnorrZKPCommit) (is_pure (n))) := - f_zkp_xis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq (t_SchnorrZKPCommit) (is_pure (n))))) : both (nseq (t_SchnorrZKPCommit) (is_pure (n))). -Fail Next Obligation. -Equations f_commit_vis (s : both (t_OvnContractState)) : both (nseq f_field_type (is_pure (n))) := - f_commit_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : nseq f_field_type (is_pure (n))))) : both (nseq f_field_type (is_pure (n))). -Fail Next Obligation. -Equations f_g_pow_xi_yi_vis (s : both (t_OvnContractState)) : both (nseq f_group_type (is_pure (n))) := - f_g_pow_xi_yi_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type (is_pure (n))))) : both (nseq f_group_type (is_pure (n))). -Fail Next Obligation. -Equations f_zkp_vis (s : both (t_OvnContractState)) : both (nseq (t_OrZKPCommit) (is_pure (n))) := - f_zkp_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : nseq (t_OrZKPCommit) (is_pure (n))))) : both (nseq (t_OrZKPCommit) (is_pure (n))). -Fail Next Obligation. -Equations f_tally (s : both (t_OvnContractState)) : both (int32) := - f_tally s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both (int32). -Fail Next Obligation. -Equations Build_t_OvnContractState {f_g_pow_xis : both (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both (nseq (t_SchnorrZKPCommit) (is_pure (n)))} {f_commit_vis : both (nseq f_field_type (is_pure (n)))} {f_g_pow_xi_yi_vis : both (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both (nseq (t_OrZKPCommit) (is_pure (n)))} {f_tally : both (int32)} : both (t_OvnContractState) := - Build_t_OvnContractState := - bind_both f_tally (fun f_tally => - bind_both f_zkp_vis (fun f_zkp_vis => - bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => - bind_both f_commit_vis (fun f_commit_vis => - bind_both f_zkp_xis (fun f_zkp_xis => - bind_both f_g_pow_xis (fun f_g_pow_xis => - solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (t_OvnContractState). -Fail Next Obligation. -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). - -Equations cast_vote {impl_574521470_ : _} `{ t_Sized (impl_574521470_)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState)) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := - cast_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with - | Result_Ok_case x => - letb x := ret_both ((x) : _ (* (t_CastVoteParam (v_Z)) *)) in - ControlFlow_Continue (solve_lift x) - | Result_Err_case x => - letb x := ret_both ((x) : (t_ParseError)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist2 := v_Break (Result_Err (ret_both tt)) in - ControlFlow_Continue (solve_lift (never_to_any hoist2)) - end in - ControlFlow_Continue (letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in - letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in - letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in - letb cast_vote_state_ret := f_clone state in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (f_accept,cast_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. - -Equations commit_to_vote {impl_574521470_ : _} `{ t_Sized (impl_574521470_)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState)) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := - commit_to_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with - | Result_Ok_case x => - letb x := ret_both ((x) : _ (* (t_CastVoteParam (v_Z)) *)) in - ControlFlow_Continue (solve_lift x) - | Result_Err_case x => - letb x := ret_both ((x) : (t_ParseError)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist3 := v_Break (Result_Err (ret_both tt)) in - ControlFlow_Continue (solve_lift (never_to_any hoist3)) - end in - ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => - ssp (fun _ => - solve_lift (ifb negb (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist4 := v_Break (Result_Err (ret_both tt)) in - ControlFlow_Continue (never_to_any hoist4) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in - letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in - letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in - letb commit_vi := commit_to g_pow_xi_yi_vi in - letb commit_to_vote_state_ret := f_clone state in - letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept,commit_to_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). -Solve All Obligations with now intros ; destruct from_uint_size. -Fail Next Obligation. - -Equations init_ovn_contract (_ : both ('unit)) : both (t_Result (t_OvnContractState) (t_Reject)) := - init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one) (f_schnorr_zkp_z := f_field_zero) (f_schnorr_zkp_c := f_field_zero)) n) (f_commit_vis := repeat (f_field_zero) n) (f_g_pow_xi_yi_vis := repeat (f_group_one) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one) (f_or_zkp_y := f_group_one) (f_or_zkp_a1 := f_group_one) (f_or_zkp_b1 := f_group_one ) (f_or_zkp_a2 := f_group_one ) (f_or_zkp_b2 := f_group_one ) (f_or_zkp_c := f_field_zero ) (f_or_zkp_d1 := f_field_zero ) (f_or_zkp_d2 := f_field_zero ) (f_or_zkp_r1 := f_field_zero ) (f_or_zkp_r2 := f_field_zero )) n) (f_tally := ret_both (0 : int32)))) : both (t_Result (t_OvnContractState) (t_Reject)). -Fail Next Obligation. - -Equations register_vote {impl_574521470_ : _} `{ t_Sized (impl_574521470_)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState)) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := - register_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] (params : t_RegisterParam (v_Z)) := matchb out with - | Result_Ok_case x => - letb x := ret_both ((x) : _ (* (t_RegisterParam (v_Z)) *)) in - ControlFlow_Continue (solve_lift x) - | Result_Err_case x => - letb x := ret_both ((x) : (t_ParseError)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist5 := v_Break (Result_Err (ret_both tt)) in - ControlFlow_Continue (solve_lift (never_to_any hoist5)) - end in - ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in - letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in - letb register_vote_state_ret := f_clone state in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in - Result_Ok (prod_b (f_accept,register_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). -Fail Next Obligation. - -Equations tally_votes {impl_574521470_ : _} `{ t_Sized (impl_574521470_)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both (impl_574521470_)) (state : both (t_OvnContractState)) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) := - tally_votes _ state := - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => - ssp (fun _ => - letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] _ := ControlFlow_Continue (ifb negb (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist6 := v_Break (Result_Err (ret_both tt)) in - ControlFlow_Continue (never_to_any hoist6) - else ControlFlow_Continue (ret_both (tt : 'unit))) in - solve_lift (ifb negb (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState)) (t_ParseError))] hoist7 := v_Break (Result_Err (ret_both tt)) in - ControlFlow_Continue (never_to_any hoist7) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState)) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in - letb vote_result := f_group_one in - letb vote_result := foldi_both_list ((* f_into_iter *) (array_to_list (f_g_pow_xi_yi_vis state))) (fun g_pow_vote => - ssp (fun vote_result => - solve_lift (f_prod vote_result g_pow_vote) : both (f_group_type))) vote_result in - letb tally := ret_both (0 : int32) in - letb curr := f_field_zero in - letb '(curr,tally) := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => - ssp (fun '(curr,tally) => - letb tally := ifb (f_g_pow curr) =.? vote_result - then letb tally := i in - tally - else tally in - letb curr := f_add curr (f_field_one) in - solve_lift (prod_b (curr,tally)) : both ((f_field_type × int32)))) (prod_b (curr,tally)) in - letb tally_votes_state_ret := f_clone state in - letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in - Result_Ok (solve_lift (prod_b (f_accept,tally_votes_state_ret))) : both (t_Result ((v_A × t_OvnContractState)) (t_ParseError)). -Solve All Obligations with now intros ; destruct from_uint_size. -Fail Next Obligation. - -(** Concert lib part **) -From ConCert.Utils Require Import Extras. -Export Extras. -From ConCert.Utils Require Import Automation. -Export Automation. -From ConCert.Execution Require Import Serializable. -Export Serializable. -From ConCert.Execution Require Import Blockchain. -Export Blockchain. -From ConCert.Execution Require Import ContractCommon. -Export ContractCommon. -From ConCert.Execution Require Import Serializable. -Export Serializable. -From Hacspec Require Import ConCertLib. -Export ConCertLib. - -Definition state_OVN : choice_type := - t_OvnContractState. - -#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := - {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := - fun x => - x. -Fail Next Obligation. -Definition receive_OVN_cast_vote (ctx : both (t_CastVoteParam)) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := - cast_vote ctx st. - -(* #[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := *) -(* {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. *) -(* Fail Next Obligation. *) -(* #[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := *) -(* fun x => *) -(* x. *) -(* Fail Next Obligation. *) -Definition receive_OVN_commit_to_vote (ctx : both (t_CastVoteParam)) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := - commit_to_vote ctx st. - -Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN) (t_ParseError) := - ResultMonad.Ok st. - -#[global] Program Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit := - {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam := - fun x => - x. -Fail Next Obligation. -Definition receive_OVN_register (ctx : both (t_RegisterParam)) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := - register_vote ctx st. - -#[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := - {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_TallyParameter_t_Sized : t_Sized t_TallyParameter := - fun x => - x. -Fail Next Obligation. -Definition receive_OVN_tally (ctx : both (t_TallyParameter)) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := - tally_votes ctx st. - -Inductive Msg_OVN : Type := -| msg_OVN_cast_vote : t_CastVoteParam -> Msg_OVN -| msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN -| msg_OVN_register : t_RegisterParam -> Msg_OVN -| msg_OVN_tally : t_TallyParameter -> Msg_OVN. -#[global] Program Instance state_OVN_t_HasReceiveContext : t_HasReceiveContext (state_OVN) 'unit := - {| f_get := (fun (Ctx : _) => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance state_OVN_t_Sized : t_Sized (state_OVN) := - fun x => - x. -Fail Next Obligation. -#[global] Program Instance state_OVN_t_HasActions : t_HasActions (state_OVN). -Next Obligation. - pose (init_ovn_contract_equation_1 (ret_both tt)). - set (solve_lift _) in e. - apply b. -Defined. -Fail Next Obligation. - -Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) (msg : Datatypes.option (Msg_OVN)) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := - receive_OVN chain ctx st msg := - match msg with - | Some (msg_OVN_cast_vote val) => - match is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (ret_both st))) with - | inl x => ResultMonad.Ok ((snd x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_OVN_commit_to_vote val) => - match is_pure (both_prog (receive_OVN_commit_to_vote (ret_both val) (ret_both st))) with - | inl x => ResultMonad.Ok ((snd x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_OVN_register val) => - match is_pure (both_prog (receive_OVN_register (ret_both val) (ret_both st))) with - | inl x => ResultMonad.Ok ((snd x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_OVN_tally val) => - match (is_pure (both_prog (receive_OVN_tally (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((snd x), []) - | inr x => ResultMonad.Err x - end - | _ => - ResultMonad.Err tt - end : ResultMonad.result (state_OVN * list ActionBody) t_ParseError. -Fail Next Obligation. - -Ltac make_hacspec_serializable := - (serialize_enum ; repeat (refine nseq_serializable ; serialize_enum) - ; try ( exact f_group_type_Serializable - || exact f_field_type_Serializable - || exact hacspec_int_serializable - || exact bool_serializable - || exact unit_serializable)). - -#[global] Program Instance state_OVN_Serializable : Serializable (state_OVN) := - ltac:(make_hacspec_serializable). -Fail Next Obligation. - -#[global] Program Instance t_RegisterParam_Serializable : Serializable t_RegisterParam := - ltac:(make_hacspec_serializable). -Fail Next Obligation. - -#[global] Program Instance t_CastVoteParam_Serializable : Serializable t_TallyParameter := - ltac:(make_hacspec_serializable). -Fail Next Obligation. +(*Not implemented yet? todo(item)*) -#[global] Program Instance Msg_OVN_Serializable : Serializable Msg_OVN := - Derive Serializable Msg_OVN_rect < msg_OVN_cast_vote , msg_OVN_commit_to_vote, msg_OVN_register,msg_OVN_tally >. -Fail Next Obligation. +(*Not implemented yet? todo(item)*) -Definition contract_OVN : @Contract _ (state_OVN) (Msg_OVN) (state_OVN) (t_ParseError) state_OVN_Serializable Msg_OVN_Serializable state_OVN_Serializable _ := - build_contract init_OVN receive_OVN. +(*Not implemented yet? todo(item)*) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group.v new file mode 100644 index 0000000..32fefa8 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group.v @@ -0,0 +1,484 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +(* From Jasmin Require Import word. *) + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Crate_Ovn_traits. +Export Crate_Ovn_traits. + +Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (random : both L1 I1 int32) : both L1 I1 v_Z := + select_private_voting_key random := + solve_lift (f_random_field_elem random) : both L1 I1 v_Z. +Fail Next Obligation. + +Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (xi : both L1 I1 f_Z) (vote : both L2 I2 'bool) (g_pow_yi : both L3 I3 v_G) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) v_G := + compute_group_element_for_vote xi vote g_pow_yi := + solve_lift (f_prod (f_pow g_pow_yi xi) (f_g_pow (ifb vote + then f_field_one (ret_both (tt : 'unit)) + else f_field_zero (ret_both (tt : 'unit))))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) v_G. +Fail Next Obligation. + +Definition prod1_loc {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} : Location := + (v_G;0%nat). +Definition prod2_loc {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} : Location := + (v_G;1%nat). +Equations compute_g_pow_yi {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} (i : both L1 I1 uint_size) (xis : both L2 I2 (nseq v_G (is_pure (n)))) : both (L1 :|: L2 :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2) v_G := + compute_g_pow_yi i xis := + letb prod1 loc(prod1_loc) := f_group_one (ret_both (tt : 'unit)) in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => + ssp (fun _ => + assign todo(term) : (both (*1*)(L2:|:L1:|:fset [prod1_loc]) (I2:|:I1) 'unit))) (ret_both (tt : 'unit)) in + letb prod2 loc(prod2_loc) := f_group_one (ret_both (tt : 'unit)) in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => + ssp (fun _ => + assign todo(term) : (both (*1*)(L2:|:L1:|:fset [prod2_loc]) (I2:|:I1) 'unit))) (ret_both (tt : 'unit)) in + solve_lift (f_div prod1 prod2) : both (L1 :|: L2 :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2) v_G. +Fail Next Obligation. + +Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (g_pow_xi_yi_vi : both L1 I1 v_G) (commitment : both L2 I2 f_Z) : both (L1 :|: L2) (I1 :|: I2) 'bool := + check_commitment g_pow_xi_yi_vi commitment := + solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both (L1 :|: L2) (I1 :|: I2) 'bool. +Fail Next Obligation. + +Equations commit_to {L1 : {fset Location}} {I1 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (g_pow_xi_yi_vi : both L1 I1 v_G) : both L1 I1 f_Z := + commit_to g_pow_xi_yi_vi := + solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both L1 I1 f_Z. +Fail Next Obligation. + +Definition t_CastVoteParam {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} : choice_type := + (int32 × v_Z × int32 × int32 × int32 × 'bool). +Equations f_cvp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both L I t_CastVoteParam) : both L I int32 := + f_cvp_i s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : int32))) : both L I int32. +Fail Next Obligation. +Equations f_cvp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both L I t_CastVoteParam) : both L I v_Z := + f_cvp_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : v_Z))) : both L I v_Z. +Fail Next Obligation. +Equations f_cvp_zkp_random_w {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both L I t_CastVoteParam) : both L I int32 := + f_cvp_zkp_random_w s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : int32))) : both L I int32. +Fail Next Obligation. +Equations f_cvp_zkp_random_r {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both L I t_CastVoteParam) : both L I int32 := + f_cvp_zkp_random_r s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : int32))) : both L I int32. +Fail Next Obligation. +Equations f_cvp_zkp_random_d {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both L I t_CastVoteParam) : both L I int32 := + f_cvp_zkp_random_d s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : int32))) : both L I int32. +Fail Next Obligation. +Equations f_cvp_vote {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both L I t_CastVoteParam) : both L I 'bool := + f_cvp_vote s := + bind_both s (fun x => + solve_lift (ret_both (snd x : 'bool))) : both L I 'bool. +Fail Next Obligation. +Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} {f_cvp_i : both L0 I0 int32} {f_cvp_xi : both L1 I1 v_Z} {f_cvp_zkp_random_w : both L2 I2 int32} {f_cvp_zkp_random_r : both L3 I3 int32} {f_cvp_zkp_random_d : both L4 I4 int32} {f_cvp_vote : both L5 I5 'bool} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_CastVoteParam) := + Build_t_CastVoteParam := + bind_both f_cvp_vote (fun f_cvp_vote => + bind_both f_cvp_zkp_random_d (fun f_cvp_zkp_random_d => + bind_both f_cvp_zkp_random_r (fun f_cvp_zkp_random_r => + bind_both f_cvp_zkp_random_w (fun f_cvp_zkp_random_w => + bind_both f_cvp_xi (fun f_cvp_xi => + bind_both f_cvp_i (fun f_cvp_i => + solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_CastVoteParam). +Fail Next Obligation. +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_w' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := y) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_r' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := y) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_d' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := y) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := y)). + +Definition t_OrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} : choice_type := + (v_G × v_G × v_G × v_G × v_G × v_G × f_Z × f_Z × f_Z × f_Z × f_Z). +Equations f_or_zkp_x {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I v_G := + f_or_zkp_x s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : v_G))) : both L I v_G. +Fail Next Obligation. +Equations f_or_zkp_y {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I v_G := + f_or_zkp_y s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : v_G))) : both L I v_G. +Fail Next Obligation. +Equations f_or_zkp_a1 {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I v_G := + f_or_zkp_a1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : v_G))) : both L I v_G. +Fail Next Obligation. +Equations f_or_zkp_b1 {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I v_G := + f_or_zkp_b1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : v_G))) : both L I v_G. +Fail Next Obligation. +Equations f_or_zkp_a2 {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I v_G := + f_or_zkp_a2 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : v_G))) : both L I v_G. +Fail Next Obligation. +Equations f_or_zkp_b2 {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I v_G := + f_or_zkp_b2 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : v_G))) : both L I v_G. +Fail Next Obligation. +Equations f_or_zkp_c {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I f_Z := + f_or_zkp_c s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_Z))) : both L I f_Z. +Fail Next Obligation. +Equations f_or_zkp_d1 {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I f_Z := + f_or_zkp_d1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : f_Z))) : both L I f_Z. +Fail Next Obligation. +Equations f_or_zkp_d2 {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I f_Z := + f_or_zkp_d2 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : f_Z))) : both L I f_Z. +Fail Next Obligation. +Equations f_or_zkp_r1 {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I f_Z := + f_or_zkp_r1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : f_Z))) : both L I f_Z. +Fail Next Obligation. +Equations f_or_zkp_r2 {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I f_Z := + f_or_zkp_r2 s := + bind_both s (fun x => + solve_lift (ret_both (snd x : f_Z))) : both L I f_Z. +Fail Next Obligation. +Equations Build_t_OrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {L7 : {fset Location}} {L8 : {fset Location}} {L9 : {fset Location}} {L10 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {I7 : Interface} {I8 : Interface} {I9 : Interface} {I10 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} {f_or_zkp_x : both L0 I0 v_G} {f_or_zkp_y : both L1 I1 v_G} {f_or_zkp_a1 : both L2 I2 v_G} {f_or_zkp_b1 : both L3 I3 v_G} {f_or_zkp_a2 : both L4 I4 v_G} {f_or_zkp_b2 : both L5 I5 v_G} {f_or_zkp_c : both L6 I6 f_Z} {f_or_zkp_d1 : both L7 I7 f_Z} {f_or_zkp_d2 : both L8 I8 f_Z} {f_or_zkp_r1 : both L9 I9 f_Z} {f_or_zkp_r2 : both L10 I10 f_Z} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit) := + Build_t_OrZKPCommit := + bind_both f_or_zkp_r2 (fun f_or_zkp_r2 => + bind_both f_or_zkp_r1 (fun f_or_zkp_r1 => + bind_both f_or_zkp_d2 (fun f_or_zkp_d2 => + bind_both f_or_zkp_d1 (fun f_or_zkp_d1 => + bind_both f_or_zkp_c (fun f_or_zkp_c => + bind_both f_or_zkp_b2 (fun f_or_zkp_b2 => + bind_both f_or_zkp_a2 (fun f_or_zkp_a2 => + bind_both f_or_zkp_b1 (fun f_or_zkp_b1 => + bind_both f_or_zkp_a1 (fun f_or_zkp_a1 => + bind_both f_or_zkp_y (fun f_or_zkp_y => + bind_both f_or_zkp_x (fun f_or_zkp_x => + solve_lift (ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit)))))))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit). +Fail Next Obligation. +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := y) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := y) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := y) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := y) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := y) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := y) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_c' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := y) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := y) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := y) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := y) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := y)). + +Definition t_RegisterParam {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} : choice_type := + (int32 × v_Z × int32). +Equations f_rp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both L I t_RegisterParam) : both L I int32 := + f_rp_i s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : int32))) : both L I int32. +Fail Next Obligation. +Equations f_rp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both L I t_RegisterParam) : both L I v_Z := + f_rp_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : v_Z))) : both L I v_Z. +Fail Next Obligation. +Equations f_rp_zkp_random {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both L I t_RegisterParam) : both L I int32 := + f_rp_zkp_random s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I int32. +Fail Next Obligation. +Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} {f_rp_i : both L0 I0 int32} {f_rp_xi : both L1 I1 v_Z} {f_rp_zkp_random : both L2 I2 int32} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_RegisterParam) := + Build_t_RegisterParam := + bind_both f_rp_zkp_random (fun f_rp_zkp_random => + bind_both f_rp_xi (fun f_rp_xi => + bind_both f_rp_i (fun f_rp_i => + solve_lift (ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_RegisterParam). +Fail Next Obligation. +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y) (f_rp_zkp_random := f_rp_zkp_random x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := y)). + +Definition t_SchnorrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} : choice_type := + (v_G × f_Z × f_Z). +Equations f_schnorr_zkp_u {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_SchnorrZKPCommit) : both L I v_G := + f_schnorr_zkp_u s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : v_G))) : both L I v_G. +Fail Next Obligation. +Equations f_schnorr_zkp_c {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_SchnorrZKPCommit) : both L I f_Z := + f_schnorr_zkp_c s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : f_Z))) : both L I f_Z. +Fail Next Obligation. +Equations f_schnorr_zkp_z {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_SchnorrZKPCommit) : both L I f_Z := + f_schnorr_zkp_z s := + bind_both s (fun x => + solve_lift (ret_both (snd x : f_Z))) : both L I f_Z. +Fail Next Obligation. +Equations Build_t_SchnorrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} {f_schnorr_zkp_u : both L0 I0 v_G} {f_schnorr_zkp_c : both L1 I1 f_Z} {f_schnorr_zkp_z : both L2 I2 f_Z} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit) := + Build_t_SchnorrZKPCommit := + bind_both f_schnorr_zkp_z (fun f_schnorr_zkp_z => + bind_both f_schnorr_zkp_c (fun f_schnorr_zkp_c => + bind_both f_schnorr_zkp_u (fun f_schnorr_zkp_u => + solve_lift (ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit). +Fail Next Obligation. +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := y) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := y) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := y)). + +Definition t_TallyParameter : choice_type := + 'unit. +Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := + Build_t_TallyParameter := + solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). +Fail Next Obligation. + +Equations schnorr_zkp {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (random : both L1 I1 int32) (h : both L2 I2 v_G) (x : both L3 I3 f_Z) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit v_G) := + schnorr_zkp random h x := + solve_lift (run (letb r := f_random_field_elem random in + letb u := f_g_pow r in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); + h; + u])))) in + letb z := f_add r (f_mul c x) in + letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit v_G)] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in + ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit v_G). +Fail Next Obligation. + +Equations schnorr_zkp_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (h : both L1 I1 v_G) (pi : both L2 I2 (t_SchnorrZKPCommit v_G)) : both (L1 :|: L2) (I1 :|: I2) 'bool := + schnorr_zkp_validate h pi := + solve_lift (andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); + h; + f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both (L1 :|: L2) (I1 :|: I2) 'bool. +Fail Next Obligation. + +Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (random_w : both L1 I1 int32) (random_r : both L2 I2 int32) (random_d : both L3 I3 int32) (h : both L4 I4 v_G) (xi : both L5 I5 f_Z) (vi : both L6 I6 'bool) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit v_G) := + zkp_one_out_of_two random_w random_r random_d h xi vi := + letb w := f_random_field_elem random_w in + solve_lift (ifb vi + then letb r1 := f_random_field_elem random_r in + letb d1 := f_random_field_elem random_d in + letb x := f_g_pow xi in + letb y := f_prod (f_pow h xi) (f_g (ret_both (tt : 'unit))) in + letb a1 := f_prod (f_g_pow r1) (f_pow x d1) in + letb b1 := f_prod (f_pow h r1) (f_pow y d1) in + letb a2 := f_g_pow w in + letb b2 := f_pow h w in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; + y; + a1; + b1; + a2; + b2])))) in + letb d2 := f_sub c d1 in + letb r2 := f_sub w (f_mul xi d2) in + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2) + else letb r2 := f_random_field_elem random_r in + letb d2 := f_random_field_elem random_d in + letb x := f_g_pow xi in + letb y := f_pow h xi in + letb a1 := f_g_pow w in + letb b1 := f_pow h w in + letb a2 := f_prod (f_g_pow r2) (f_pow x d2) in + letb b2 := f_prod (f_pow h r2) (f_pow (f_div y (f_g (ret_both (tt : 'unit)))) d2) in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; + y; + a1; + b1; + a2; + b2])))) in + letb d1 := f_sub c d2 in + letb r1 := f_sub w (f_mul xi d1) in + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit v_G). +Fail Next Obligation. + +Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (h : both L1 I1 v_G) (zkp : both L2 I2 (t_OrZKPCommit v_G)) : both (L1 :|: L2) (I1 :|: I2) 'bool := + zkp_one_out_of_two_validate h zkp := + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; + f_or_zkp_y zkp; + f_or_zkp_a1 zkp; + f_or_zkp_b1 zkp; + f_or_zkp_a2 zkp; + f_or_zkp_b2 zkp])))) in + solve_lift (andb (andb (andb (andb (c =.? (f_add (f_or_zkp_d1 zkp) (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? (f_prod (f_pow h (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r2 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? (f_prod (f_pow h (f_or_zkp_r2 zkp)) (f_pow (f_div (f_or_zkp_y zkp) (f_g (ret_both (tt : 'unit)))) (f_or_zkp_d2 zkp))))) : both (L1 :|: L2) (I1 :|: I2) 'bool. +Fail Next Obligation. + +Definition t_OvnContractState {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} : choice_type := + (nseq v_G (is_pure (n)) × nseq (t_SchnorrZKPCommit v_G) (is_pure (n)) × nseq f_Z (is_pure (n)) × nseq v_G (is_pure (n)) × nseq (t_OrZKPCommit v_G) (is_pure (n)) × int32 × nseq 'bool (is_pure (n))). +Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OvnContractState) : both L I (nseq v_G (is_pure (n))) := + f_g_pow_xis s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst (fst x))))) : (nseq v_G (is_pure (n)))))) : both L I (nseq v_G (is_pure (n))). +Fail Next Obligation. +Equations f_zkp_xis {L : {fset Location}} {I : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OvnContractState) : both L I (nseq (t_SchnorrZKPCommit v_G) (is_pure (n))) := + f_zkp_xis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : (nseq (t_SchnorrZKPCommit v_G) (is_pure (n)))))) : both L I (nseq (t_SchnorrZKPCommit v_G) (is_pure (n))). +Fail Next Obligation. +Equations f_commit_vis {L : {fset Location}} {I : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OvnContractState) : both L I (nseq f_Z (is_pure (n))) := + f_commit_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : (nseq f_Z (is_pure (n)))))) : both L I (nseq f_Z (is_pure (n))). +Fail Next Obligation. +Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OvnContractState) : both L I (nseq v_G (is_pure (n))) := + f_g_pow_xi_yi_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : (nseq v_G (is_pure (n)))))) : both L I (nseq v_G (is_pure (n))). +Fail Next Obligation. +Equations f_zkp_vis {L : {fset Location}} {I : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OvnContractState) : both L I (nseq (t_OrZKPCommit v_G) (is_pure (n))) := + f_zkp_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : (nseq (t_OrZKPCommit v_G) (is_pure (n)))))) : both L I (nseq (t_OrZKPCommit v_G) (is_pure (n))). +Fail Next Obligation. +Equations f_tally {L : {fset Location}} {I : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OvnContractState) : both L I int32 := + f_tally s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : int32))) : both L I int32. +Fail Next Obligation. +Equations f_round1 {L : {fset Location}} {I : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OvnContractState) : both L I (nseq 'bool (is_pure (n))) := + f_round1 s := + bind_both s (fun x => + solve_lift (ret_both (snd x : (nseq 'bool (is_pure (n)))))) : both L I (nseq 'bool (is_pure (n))). +Fail Next Obligation. +Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} {f_g_pow_xis : both L0 I0 (nseq v_G (is_pure (n)))} {f_zkp_xis : both L1 I1 (nseq (t_SchnorrZKPCommit v_G) (is_pure (n)))} {f_commit_vis : both L2 I2 (nseq f_Z (is_pure (n)))} {f_g_pow_xi_yi_vis : both L3 I3 (nseq v_G (is_pure (n)))} {f_zkp_vis : both L4 I4 (nseq (t_OrZKPCommit v_G) (is_pure (n)))} {f_tally : both L5 I5 int32} {f_round1 : both L6 I6 (nseq 'bool (is_pure (n)))} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6) (t_OvnContractState) := + Build_t_OvnContractState := + bind_both f_round1 (fun f_round1 => + bind_both f_tally (fun f_tally => + bind_both f_zkp_vis (fun f_zkp_vis => + bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => + bind_both f_commit_vis (fun f_commit_vis => + bind_both f_zkp_xis (fun f_zkp_xis => + bind_both f_g_pow_xis (fun f_g_pow_xis => + solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally,f_round1) : (t_OvnContractState)))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6) (t_OvnContractState). +Fail Next Obligation. +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := f_round1 x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := f_round1 x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := f_round1 x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := f_round1 x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x) (f_round1 := f_round1 x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y) (f_round1 := f_round1 x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_round1' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := y)). + +Definition cast_vote_state_ret_loc {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := + (t_OvnContractState v_G (both (fset []) (fset []) uint_size);5%nat). +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both L1 I1 impl_574521470_) (state : both L2 I2 (t_OvnContractState v_G (both (fset []) (fset []) uint_size))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError) := + cast_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code t_ParseError] (params : t_CastVoteParam f_Z) := impl__map_err out f_from in + Result_Ok (letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in + letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in + letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in + letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError). +Fail Next Obligation. + +Definition commit_to_vote_state_ret_loc {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := + (t_OvnContractState v_G (both (fset []) (fset []) uint_size);6%nat). +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both L1 I1 impl_574521470_) (state : both L2 I2 (t_OvnContractState v_G (both (fset []) (fset []) uint_size))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError) := + commit_to_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code t_ParseError] (params : t_CastVoteParam f_Z) := impl__map_err out f_from in + Result_Ok (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + ssp (fun _ => + solve_lift (ifb orb (not (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i]))) (not ((f_round1 state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError)] hoist26 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist26) + else ()) : (both (*0*)(L2:|:fset []) (I2) (t_ControlFlow (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError) 'unit)))) (ret_both (tt : 'unit)) in + letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in + letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in + letb commit_vi := commit_to g_pow_xi_yi_vi in + letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in + letb _ := assign todo(term) in + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError). +Fail Next Obligation. + +Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} (_ : both L1 I1 'unit) : both L1 I1 (t_Result (t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_Reject) := + init_ovn_contract _ := + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_field_zero (ret_both (tt : 'unit))) (f_schnorr_zkp_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_y := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_c := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d2 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)) (f_round1 := repeat (ret_both (false : 'bool)) n))) : both L1 I1 (t_Result (t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_Reject). +Fail Next Obligation. + +Definition register_vote_state_ret_loc {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := + (t_OvnContractState v_G (both (fset []) (fset []) uint_size);7%nat). +Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both L1 I1 impl_574521470_) (state : both L2 I2 (t_OvnContractState v_G (both (fset []) (fset []) uint_size))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError) := + register_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code t_ParseError] (params : t_RegisterParam f_Z) := impl__map_err out f_from in + Result_Ok (letb g_pow_xi := f_g_pow (f_rp_xi params) in + letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in + letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError). +Fail Next Obligation. + +Definition curr_loc {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := + (f_Z;8%nat). +Definition tally_loc {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := + (int32;9%nat). +Definition tally_votes_state_ret_loc {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := + (t_OvnContractState v_G (both (fset []) (fset []) uint_size);10%nat). +Definition vote_result_loc {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := + (v_G;11%nat). +Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (_ : both L1 I1 impl_574521470_) (state : both L2 I2 (t_OvnContractState v_G (both (fset []) (fset []) uint_size))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError) := + tally_votes _ state := + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + ssp (fun _ => + letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in + letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError)] _ := ControlFlow_Continue (ifb not (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError)] hoist27 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist27) + else ()) in + solve_lift (ifb not (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError)] hoist28 := v_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist28) + else ()) : (both (*2*)(L2:|:fset [prod1_loc;prod2_loc]) (I2) (t_ControlFlow (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError) 'unit)))) (ret_both (tt : 'unit)) in + letb vote_result loc(vote_result_loc) := f_group_one (ret_both (tt : 'unit)) in + letb _ := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => + ssp (fun _ => + assign todo(term) : (both (*1*)(L2:|:fset [vote_result_loc]) (I2) 'unit))) (ret_both (tt : 'unit)) in + letb tally loc(tally_loc) := ret_both (0 : int32) in + letb curr loc(curr_loc) := f_field_zero (ret_both (tt : 'unit)) in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => + ssp (fun _ => + letb _ := ifb (f_g_pow curr) =.? vote_result + then letb _ := assign todo(term) in + ret_both (tt : 'unit) + else () in + letb _ := assign todo(term) in + solve_lift (ret_both (tt : 'unit)) : (both (*3*)(fset [curr_loc;tally_loc;vote_result_loc]) ((fset [])) 'unit))) (ret_both (tt : 'unit)) in + letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in + letb _ := assign todo(term) in + Result_Ok (solve_lift (prod_b (f_accept (ret_both (tt : 'unit)),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError). +Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_secp256k1.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_secp256k1.v new file mode 100644 index 0000000..0ec2397 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_secp256k1.v @@ -0,0 +1,354 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +(* From Jasmin Require Import word. *) + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Crate_Ovn_traits. +Export Crate_Ovn_traits. + +Require Import Hacspec_lib. +Export Hacspec_lib. + +Require Import Hacspec_bip_340. +Export Hacspec_bip_340. + +Definition t_Group_curve : choice_type := + (t_Point). +Equations f_val {L : {fset Location}} {I : Interface} (s : both L I t_Group_curve) : both L I t_Point := + f_val s := + bind_both s (fun x => + solve_lift (ret_both (x : t_Point))) : both L I t_Point. +Fail Next Obligation. +Equations Build_t_Group_curve {L0 : {fset Location}} {I0 : Interface} {f_val : both L0 I0 t_Point} : both L0 I0 (t_Group_curve) := + Build_t_Group_curve := + bind_both f_val (fun f_val => + solve_lift (ret_both ((f_val) : (t_Group_curve)))) : both L0 I0 (t_Group_curve). +Fail Next Obligation. +Notation "'Build_t_Group_curve' '[' x ']' '(' 'f_val' ':=' y ')'" := (Build_t_Group_curve (f_val := y)). + +#[global] Program Instance t_Group_curve_t_Deserial : t_Deserial t_Group_curve := + let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (source : both L1 I1 v_R) => solve_lift (run (letb '(tmp0,out) := f_get source in + letb _ := assign todo(term) in + letb hoist3 := out in + letb hoist4 := f_branch hoist3 in + letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] (b : 'bool) := matchb hoist4 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in + letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] hoist2 := v_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist2)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : ('bool)) in + ControlFlow_Continue (solve_lift val) + end in + letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] hax_temp_output := ifb b + then letb '(tmp0,out) := f_get source in + letb _ := assign todo(term) in + letb hoist6 := out in + letb hoist7 := f_branch hoist6 in + letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] (vx : t_Vec int8 t_Global) := matchb hoist7 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in + letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] hoist5 := v_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist5)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (t_Vec int8 t_Global)) in + ControlFlow_Continue (solve_lift val) + end in + letb '(tmp0,out) := f_get source in + letb _ := assign todo(term) in + letb hoist9 := out in + letb hoist10 := f_branch hoist9 in + letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] (vy : t_Vec int8 t_Global) := matchb hoist10 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in + letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] hoist8 := v_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist8)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (t_Vec int8 t_Global)) in + ControlFlow_Continue (solve_lift val) + end in + ControlFlow_Continue (Result_Ok (Build_t_Group_curve (f_val := Point_Affine (prod_b (impl__FieldElement__from_public_byte_seq_be (impl_52__from_vec vx),impl__FieldElement__from_public_byte_seq_be (impl_52__from_vec vy)))))) + else ControlFlow_Continue (Result_Ok (Build_t_Group_curve (f_val := Point_AtInfinity))) in + ControlFlow_Continue (prod_b (source,hax_temp_output)))) : both (L1 :|: fset []) I1 (v_R × t_Result t_Group_curve t_ParseError) in + {| f_deserial_loc := (fset [] : {fset Location}); + f_deserial := (@f_deserial)|}. +Fail Next Obligation. +Hint Unfold t_Group_curve_t_Deserial. + +Definition v_loc : Location := + (t_Vec int8 t_Global;4%nat). +#[global] Program Instance t_Group_curve_t_Serial : t_Serial t_Group_curve := + let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 t_Group_curve) (out : both L2 I2 v_W) => solve_lift (run (letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb f_val self with + | Point_Affine_case p => + letb p := ret_both ((p) : (t_FieldElement × t_FieldElement)) in + letb '(tmp0,out) := f_serial (ret_both (true : 'bool)) out in + letb _ := assign todo(term) in + letb hoist12 := out in + letb hoist13 := f_branch hoist12 in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist13 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist11 := v_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist11)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : ('unit)) in + ControlFlow_Continue (solve_lift val) + end in + letb (vx : t_Vec int8 t_Global) loc(vx_loc) := impl__new (ret_both (tt : 'unit)) in + letb _ := foldi_both_list (f_into_iter (impl_41__native_slice (impl__FieldElement__to_public_byte_seq_be (x p)))) (fun x => + ssp (fun _ => + assign todo(term) : (both (*1*)(fset [vx_loc]) ((fset [])) 'unit))) (ret_both (tt : 'unit)) in + letb '(tmp0,out) := f_serial vx out in + letb _ := assign todo(term) in + letb hoist15 := out in + letb hoist16 := f_branch hoist15 in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist16 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist14 := v_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist14)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : ('unit)) in + ControlFlow_Continue (solve_lift val) + end in + letb (vy : t_Vec int8 t_Global) loc(vy_loc) := impl__new (ret_both (tt : 'unit)) in + letb _ := foldi_both_list (f_into_iter (impl_41__native_slice (impl__FieldElement__to_public_byte_seq_be (y p)))) (fun y => + ssp (fun _ => + assign todo(term) : (both (*1*)(fset [vy_loc]) ((fset [])) 'unit))) (ret_both (tt : 'unit)) in + letb '(tmp0,out) := f_serial vy out in + letb _ := assign todo(term) in + letb hoist18 := out in + letb hoist19 := f_branch hoist18 in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist19 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist17 := v_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist17)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : ('unit)) in + ControlFlow_Continue (solve_lift val) + end in + ControlFlow_Continue (solve_lift (ret_both (tt : 'unit))) + | Point_AtInfinity_case => + letb '(tmp0,out) := f_serial (ret_both (false : 'bool)) out in + letb _ := assign todo(term) in + letb hoist21 := out in + letb hoist22 := f_branch hoist21 in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist22 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist20 := v_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist20)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : ('unit)) in + ControlFlow_Continue (solve_lift val) + end in + ControlFlow_Continue (solve_lift (ret_both (tt : 'unit))) + end in + ControlFlow_Continue (letb hax_temp_output := Result_Ok (ret_both (tt : 'unit)) in + prod_b (out,hax_temp_output)))) : both (L1 :|: L2 :|: fset [v_loc;vx_loc;vy_loc]) (I1 :|: I2) (v_W × t_Result 'unit f_Err) in + {| f_serial_loc := (fset [v_loc;vx_loc;vy_loc] : {fset Location}); + f_serial := (@f_serial)|}. +Fail Next Obligation. +Hint Unfold t_Group_curve_t_Serial. + +Definition t_Z_curve : choice_type := + (t_Scalar). +Equations f_val {L : {fset Location}} {I : Interface} (s : both L I t_Z_curve) : both L I t_Scalar := + f_val s := + bind_both s (fun x => + solve_lift (ret_both (x : t_Scalar))) : both L I t_Scalar. +Fail Next Obligation. +Equations Build_t_Z_curve {L0 : {fset Location}} {I0 : Interface} {f_val : both L0 I0 t_Scalar} : both L0 I0 (t_Z_curve) := + Build_t_Z_curve := + bind_both f_val (fun f_val => + solve_lift (ret_both ((f_val) : (t_Z_curve)))) : both L0 I0 (t_Z_curve). +Fail Next Obligation. +Notation "'Build_t_Z_curve' '[' x ']' '(' 'f_val' ':=' y ')'" := (Build_t_Z_curve (f_val := y)). + +#[global] Program Instance t_Z_curve_t_Deserial : t_Deserial t_Z_curve := + let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (source : both L1 I1 v_R) => solve_lift (run (letb '(tmp0,out) := f_get source in + letb _ := assign todo(term) in + letb hoist24 := out in + letb hoist25 := f_branch hoist24 in + letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Z_curve t_ParseError)] (temp : t_Vec int8 t_Global) := matchb hoist25 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in + letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Z_curve t_ParseError)] hoist23 := v_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist23)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (t_Vec int8 t_Global)) in + ControlFlow_Continue (solve_lift val) + end in + ControlFlow_Continue (letb hax_temp_output := Result_Ok (Build_t_Z_curve (f_val := impl__Scalar__from_public_byte_seq_be (impl_52__from_vec temp))) in + prod_b (source,hax_temp_output)))) : both (L1 :|: fset []) I1 (v_R × t_Result t_Z_curve t_ParseError) in + {| f_deserial_loc := (fset [] : {fset Location}); + f_deserial := (@f_deserial)|}. +Fail Next Obligation. +Hint Unfold t_Z_curve_t_Deserial. + +Definition v_loc : Location := + (t_Vec int8 t_Global;4%nat). +#[global] Program Instance t_Z_curve_t_Serial : t_Serial t_Z_curve := + let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 t_Z_curve) (out : both L2 I2 v_W) => letb (v : t_Vec int8 t_Global) loc(v_loc) := impl__new (ret_both (tt : 'unit)) in + letb _ := foldi_both_list (f_into_iter (impl_41__native_slice (impl__Scalar__to_public_byte_seq_be (f_val self)))) (fun x => + ssp (fun _ => + assign todo(term) : (both (*1*)(L1:|:fset [v_loc]) (I1) 'unit))) (ret_both (tt : 'unit)) in + letb '(tmp0,out) := f_serial v out in + letb _ := assign todo(term) in + letb hax_temp_output := out in + solve_lift (prod_b (out,hax_temp_output)) : both (L1 :|: L2 :|: fset [v_loc;vx_loc;vy_loc]) (I1 :|: I2) (v_W × t_Result 'unit f_Err) in + {| f_serial_loc := (fset [v_loc;vx_loc;vy_loc] : {fset Location}); + f_serial := (@f_serial)|}. +Fail Next Obligation. +Hint Unfold t_Z_curve_t_Serial. + +#[global] Program Instance t_Z_curve_t_Field : t_Field t_Z_curve := + let f_q := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_hex (ret_both (0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 : chString)))) : both (L :|: fset []) I t_Z_curve in + let f_random_field_elem := fun {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 int32) => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_literal (cast_int (WS2 := _) random))) : both (L1 :|: fset []) I1 t_Z_curve in + let f_field_zero := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_literal (ret_both (0 : int128)))) : both (L :|: fset []) I t_Z_curve in + let f_field_one := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_literal (ret_both (1 : int128)))) : both (L :|: fset []) I t_Z_curve in + let f_add := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_Z_curve) (y : both L2 I2 t_Z_curve) => solve_lift (Build_t_Z_curve (f_val := (f_val x) .+ (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_Z_curve in + let f_sub := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_Z_curve) (y : both L2 I2 t_Z_curve) => solve_lift (Build_t_Z_curve (f_val := (f_val x) .- (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_Z_curve in + let f_mul := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_Z_curve) (y : both L2 I2 t_Z_curve) => solve_lift (Build_t_Z_curve (f_val := (f_val x) .* (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_Z_curve in + {| f_q_loc := (fset [] : {fset Location}); + f_q := (@f_q); + f_random_field_elem_loc := (fset [] : {fset Location}); + f_random_field_elem := (@f_random_field_elem); + f_field_zero_loc := (fset [] : {fset Location}); + f_field_zero := (@f_field_zero); + f_field_one_loc := (fset [] : {fset Location}); + f_field_one := (@f_field_one); + f_add_loc := (fset [] : {fset Location}); + f_add := (@f_add); + f_sub_loc := (fset [] : {fset Location}); + f_sub := (@f_sub); + f_mul_loc := (fset [] : {fset Location}); + f_mul := (@f_mul)|}. +Fail Next Obligation. +Hint Unfold t_Z_curve_t_Field. + +Definition result_loc : Location := + (t_g_z_89_;13%nat). +Definition res_loc : Location := + (t_z_89_;12%nat). +#[global] Program Instance t_Group_curve_t_Group : t_Group t_Group_curve := + let f_Z := t_Z_curve : choice_type in + let f_g := fun {L : {fset Location}} {I : Interface} => letb gx := PBytes32 (array_from_list [ret_both (121 : int8); + ret_both (190 : int8); + ret_both (102 : int8); + ret_both (126 : int8); + ret_both (249 : int8); + ret_both (220 : int8); + ret_both (187 : int8); + ret_both (172 : int8); + ret_both (85 : int8); + ret_both (160 : int8); + ret_both (98 : int8); + ret_both (149 : int8); + ret_both (206 : int8); + ret_both (135 : int8); + ret_both (11 : int8); + ret_both (7 : int8); + ret_both (2 : int8); + ret_both (155 : int8); + ret_both (252 : int8); + ret_both (219 : int8); + ret_both (45 : int8); + ret_both (206 : int8); + ret_both (40 : int8); + ret_both (217 : int8); + ret_both (89 : int8); + ret_both (242 : int8); + ret_both (129 : int8); + ret_both (91 : int8); + ret_both (22 : int8); + ret_both (248 : int8); + ret_both (23 : int8); + ret_both (152 : int8)]) in + letb gy := PBytes32 (array_from_list [ret_both (72 : int8); + ret_both (58 : int8); + ret_both (218 : int8); + ret_both (119 : int8); + ret_both (38 : int8); + ret_both (163 : int8); + ret_both (196 : int8); + ret_both (101 : int8); + ret_both (93 : int8); + ret_both (164 : int8); + ret_both (251 : int8); + ret_both (252 : int8); + ret_both (14 : int8); + ret_both (17 : int8); + ret_both (8 : int8); + ret_both (168 : int8); + ret_both (253 : int8); + ret_both (23 : int8); + ret_both (180 : int8); + ret_both (72 : int8); + ret_both (166 : int8); + ret_both (133 : int8); + ret_both (84 : int8); + ret_both (25 : int8); + ret_both (156 : int8); + ret_both (71 : int8); + ret_both (208 : int8); + ret_both (143 : int8); + ret_both (251 : int8); + ret_both (16 : int8); + ret_both (212 : int8); + ret_both (184 : int8)]) in + solve_lift (Build_t_Group_curve (f_val := Point_Affine (prod_b (impl__FieldElement__from_public_byte_seq_be gx,impl__FieldElement__from_public_byte_seq_be gy)))) : both (L :|: fset []) I t_Group_curve in + let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 t_Group_curve) (x : both L2 I2 t_Z_curve) => solve_lift (Build_t_Group_curve (f_val := point_mul (f_val x) (f_val g))) : both (L1 :|: L2 :|: fset [result_loc]) (I1 :|: I2) t_Group_curve in + let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 t_Z_curve) => solve_lift (Build_t_Group_curve (f_val := point_mul_base (f_val x))) : both (L1 :|: fset []) I1 t_Group_curve in + let f_group_one := fun {L : {fset Location}} {I : Interface} => solve_lift (f_g_pow (f_field_zero (ret_both (tt : 'unit)))) : both (L :|: fset []) I t_Group_curve in + let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_Group_curve) (y : both L2 I2 t_Group_curve) => solve_lift (Build_t_Group_curve (f_val := point_add (f_val x) (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_Group_curve in + let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 t_Group_curve) => solve_lift (Build_t_Group_curve (f_val := matchb f_val x with + | Point_Affine_case (a,b) => + letb '(a,b) := ret_both (((a,b)) : (t_FieldElement × t_FieldElement)) in + Point_Affine (solve_lift (prod_b (a,(impl__FieldElement__from_literal (ret_both (0 : int128))) .- b))) + | Point_AtInfinity_case => + Point_AtInfinity + end)) : both (L1 :|: fset []) I1 t_Group_curve in + let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_Group_curve) (y : both L2 I2 t_Group_curve) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_Group_curve in + let f_hash := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Vec t_Group_curve t_Global)) => solve_lift (f_field_one (ret_both (tt : 'unit))) : both (L1 :|: fset [res_loc]) I1 t_Z_curve in + {| f_Z := (@f_Z); + f_g_loc := (fset [] : {fset Location}); + f_g := (@f_g); + f_pow_loc := (fset [result_loc] : {fset Location}); + f_pow := (@f_pow); + f_g_pow_loc := (fset [] : {fset Location}); + f_g_pow := (@f_g_pow); + f_group_one_loc := (fset [] : {fset Location}); + f_group_one := (@f_group_one); + f_prod_loc := (fset [] : {fset Location}); + f_prod := (@f_prod); + f_inv_loc := (fset [] : {fset Location}); + f_inv := (@f_inv); + f_div_loc := (fset [] : {fset Location}); + f_div := (@f_div); + f_hash_loc := (fset [res_loc] : {fset Location}); + f_hash := (@f_hash)|}. +Fail Next Obligation. +Hint Unfold t_Group_curve_t_Group. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v index 7fe905e..19d7be1 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v @@ -4,7 +4,7 @@ From Crypt Require Import choice_type Package Prelude. Import PackageNotation. From extructures Require Import ord fset. From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. +(* From Jasmin Require Import word. *) From Coq Require Import ZArith. From Coq Require Import Strings.String. @@ -24,46 +24,63 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -From ConCert.Execution Require Import Serializable. -From Hacspec Require Import ConCertLib. - -Class t_Z_Field (Self : choice_type) := { - f_field_type : choice_type ; - f_field_type_Serializable : Serializable f_field_type; - f_field_type_t_Serialize :> (t_Serialize f_field_type) ; - f_field_type_t_Deserial :> (t_Deserial f_field_type) ; - f_field_type_t_Serial :> (t_Serial f_field_type) ; - f_field_type_t_Copy :> (t_Copy f_field_type) ; - f_field_type_t_Clone :> (t_Clone f_field_type) ; - f_field_type_t_Eq :> (t_Eq f_field_type) ; - f_field_type_t_PartialEq :> (t_PartialEq f_field_type) ; - f_field_type_t_Sized :> (t_Sized f_field_type) ; - f_q : (both f_field_type) ; - f_random_field_elem : (both int32 -> both f_field_type) ; - f_field_zero : (both f_field_type) ; - f_field_one : (both f_field_type) ; - f_add : (both f_field_type -> both f_field_type -> both f_field_type) ; - f_sub : (both f_field_type -> both f_field_type -> both f_field_type) ; - f_mul : (both f_field_type -> both f_field_type -> both f_field_type) ; +Class t_Field (Self : choice_type) := { + f_q_loc : {fset Location} ; + f_q : (forall {L1 I1}, both L1 I1 'unit -> both (L1 :|: f_q_loc) I1 v_Self) ; + f_random_field_elem_loc : {fset Location} ; + f_random_field_elem : (forall {L1 I1}, both L1 I1 int32 -> both (L1 :|: f_random_field_elem_loc) I1 v_Self) ; + f_field_zero_loc : {fset Location} ; + f_field_zero : (forall {L1 I1}, both L1 I1 'unit -> both (L1 :|: f_field_zero_loc) I1 v_Self) ; + f_field_one_loc : {fset Location} ; + f_field_one : (forall {L1 I1}, both L1 I1 'unit -> both (L1 :|: f_field_one_loc) I1 v_Self) ; + f_add_loc : {fset Location} ; + f_add : (forall {L1 L2 I1 I2}, both L1 I1 v_Self -> both L2 I2 v_Self -> both (L1 :|: L2 :|: f_add_loc) (I1 :|: I2) v_Self) ; + f_sub_loc : {fset Location} ; + f_sub : (forall {L1 L2 I1 I2}, both L1 I1 v_Self -> both L2 I2 v_Self -> both (L1 :|: L2 :|: f_sub_loc) (I1 :|: I2) v_Self) ; + f_mul_loc : {fset Location} ; + f_mul : (forall {L1 L2 I1 I2}, both L1 I1 v_Self -> both L2 I2 v_Self -> both (L1 :|: L2 :|: f_mul_loc) (I1 :|: I2) v_Self) ; }. +Hint Unfold f_q_loc. +Hint Unfold f_random_field_elem_loc. +Hint Unfold f_field_zero_loc. +Hint Unfold f_field_one_loc. +Hint Unfold f_add_loc. +Hint Unfold f_sub_loc. +Hint Unfold f_mul_loc. -Class t_Group (Self : choice_type) `{t_Z_Field} := { - f_group_type : choice_type ; - f_group_type_Serializable : Serializable f_group_type; - f_group_type_t_Serialize :> (t_Serialize f_group_type) ; - f_group_type_t_Deserial :> (t_Deserial f_group_type) ; - f_group_type_t_Serial :> (t_Serial f_group_type) ; - f_group_type_t_Copy :> (t_Copy f_group_type) ; - f_group_type_t_Clone :> (t_Clone f_group_type) ; - f_group_type_t_Eq :> (t_Eq f_group_type) ; - f_group_type_t_PartialEq :> (t_PartialEq f_group_type) ; - f_group_type_t_Sized :> (t_Sized f_group_type) ; - f_g : (both f_group_type) ; - f_g_pow : (both f_field_type -> both f_group_type) ; - f_pow : (both f_group_type -> both f_field_type -> both f_group_type) ; - f_group_one : (both f_group_type) ; - f_prod : (both f_group_type -> both f_group_type -> both f_group_type) ; - f_inv : (both f_group_type -> both f_group_type) ; - f_div : (both f_group_type -> both f_group_type -> both f_group_type) ; - f_hash : (both (t_Vec f_group_type t_Global) -> both f_field_type) ; +Class t_Group (Self : choice_type) := { + f_Z : choice_type ; + f_Z_t_Field :> (t_Field f_Z) ; + f_Z_t_Serialize :> (t_Serialize f_Z) ; + f_Z_t_Deserial :> (t_Deserial f_Z) ; + f_Z_t_Serial :> (t_Serial f_Z) ; + f_Z_t_Clone :> (t_Clone f_Z) ; + f_Z_t_Eq :> (t_Eq f_Z) ; + f_Z_t_PartialEq :> (t_PartialEq f_Z) ; + f_Z_t_Copy :> (t_Copy f_Z) ; + f_Z_t_Sized :> (t_Sized f_Z) ; + f_g_loc : {fset Location} ; + f_g : (forall {L1 I1}, both L1 I1 'unit -> both (L1 :|: f_g_loc) I1 v_Self) ; + f_g_pow_loc : {fset Location} ; + f_g_pow : (forall {L1 I1}, both L1 I1 f_Z -> both (L1 :|: f_g_pow_loc) I1 v_Self) ; + f_pow_loc : {fset Location} ; + f_pow : (forall {L1 L2 I1 I2}, both L1 I1 v_Self -> both L2 I2 f_Z -> both (L1 :|: L2 :|: f_pow_loc) (I1 :|: I2) v_Self) ; + f_group_one_loc : {fset Location} ; + f_group_one : (forall {L1 I1}, both L1 I1 'unit -> both (L1 :|: f_group_one_loc) I1 v_Self) ; + f_prod_loc : {fset Location} ; + f_prod : (forall {L1 L2 I1 I2}, both L1 I1 v_Self -> both L2 I2 v_Self -> both (L1 :|: L2 :|: f_prod_loc) (I1 :|: I2) v_Self) ; + f_inv_loc : {fset Location} ; + f_inv : (forall {L1 I1}, both L1 I1 v_Self -> both (L1 :|: f_inv_loc) I1 v_Self) ; + f_div_loc : {fset Location} ; + f_div : (forall {L1 L2 I1 I2}, both L1 I1 v_Self -> both L2 I2 v_Self -> both (L1 :|: L2 :|: f_div_loc) (I1 :|: I2) v_Self) ; + f_hash_loc : {fset Location} ; + f_hash : (forall {L1 I1}, both L1 I1 (t_Vec v_Self t_Global) -> both (L1 :|: f_hash_loc) I1 f_Z) ; }. +Hint Unfold f_g_loc. +Hint Unfold f_g_pow_loc. +Hint Unfold f_pow_loc. +Hint Unfold f_group_one_loc. +Hint Unfold f_prod_loc. +Hint Unfold f_inv_loc. +Hint Unfold f_div_loc. +Hint Unfold f_hash_loc. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_z_89_.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_z_89_.v index fdb6d8d..81c5450 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_z_89_.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_z_89_.v @@ -4,7 +4,7 @@ From Crypt Require Import choice_type Package Prelude. Import PackageNotation. From extructures Require Import ord fset. From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. +(* From Jasmin Require Import word. *) From Coq Require Import ZArith. From Coq Require Import Strings.String. @@ -24,36 +24,46 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Require Import Hacspec_ovn_Ovn_traits. -Export Hacspec_ovn_Ovn_traits. +Require Import Crate_Ovn_traits. +Export Crate_Ovn_traits. Definition t_g_z_89_ : choice_type := - 'unit. -Equations Build_t_g_z_89_ : both (fset []) (fset []) (t_g_z_89_) := + (int8). +Equations f_val {L : {fset Location}} {I : Interface} (s : both L I t_g_z_89_) : both L I int8 := + f_val s := + bind_both s (fun x => + solve_lift (ret_both (x : int8))) : both L I int8. +Fail Next Obligation. +Equations Build_t_g_z_89_ {L0 : {fset Location}} {I0 : Interface} {f_val : both L0 I0 int8} : both L0 I0 (t_g_z_89_) := Build_t_g_z_89_ := - solve_lift (ret_both (tt (* Empty tuple *) : (t_g_z_89_))) : both (fset []) (fset []) (t_g_z_89_). + bind_both f_val (fun f_val => + solve_lift (ret_both ((f_val) : (t_g_z_89_)))) : both L0 I0 (t_g_z_89_). Fail Next Obligation. +Notation "'Build_t_g_z_89_' '[' x ']' '(' 'f_val' ':=' y ')'" := (Build_t_g_z_89_ (f_val := y)). Definition t_z_89_ : choice_type := - 'unit. -Equations Build_t_z_89_ : both (fset []) (fset []) (t_z_89_) := + (int8). +Equations f_val {L : {fset Location}} {I : Interface} (s : both L I t_z_89_) : both L I int8 := + f_val s := + bind_both s (fun x => + solve_lift (ret_both (x : int8))) : both L I int8. +Fail Next Obligation. +Equations Build_t_z_89_ {L0 : {fset Location}} {I0 : Interface} {f_val : both L0 I0 int8} : both L0 I0 (t_z_89_) := Build_t_z_89_ := - solve_lift (ret_both (tt (* Empty tuple *) : (t_z_89_))) : both (fset []) (fset []) (t_z_89_). + bind_both f_val (fun f_val => + solve_lift (ret_both ((f_val) : (t_z_89_)))) : both L0 I0 (t_z_89_). Fail Next Obligation. +Notation "'Build_t_z_89_' '[' x ']' '(' 'f_val' ':=' y ')'" := (Build_t_z_89_ (f_val := y)). -#[global] Program Instance t_z_89__t_Z_Field : t_Z_Field t_z_89_ := _. -Next Obligation. - refine ( - let f_field_type := int32 : choice_type in - let f_q := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (89 : int32)) : both (L :|: fset []) I int32 in - let f_random_field_elem := fun {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 int32) => solve_lift (random .% ((f_q ) .- (ret_both (1 : int32)))) : both (L1 :|: fset []) I1 int32 in - let f_field_zero := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (0 : int32)) : both (L :|: fset []) I int32 in - let f_field_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I int32 in - let f_add := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 int32) (y : both L2 I2 int32) => solve_lift ((x .+ y) .% ((f_q ) .- (ret_both (1 : int32)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) int32 in - let f_sub := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 int32) (y : both L2 I2 int32) => solve_lift (((x .+ ((f_q ) .- (ret_both (1 : int32)))) .- y) .% ((f_q ) .- (ret_both (1 : int32)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) int32 in - let f_mul := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 int32) (y : both L2 I2 int32) => solve_lift ((x .* y) .% ((f_q ) .- (ret_both (1 : int32)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) int32 in - {| f_field_type := (@f_field_type); - f_q_loc := (fset [] : {fset Location}); +#[global] Program Instance t_z_89__t_Field : t_Field t_z_89_ := + let f_q := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_C_z_89_ (f_val := ret_both (89 : int8))) : both (L :|: fset []) I t_z_89_ in + let f_random_field_elem := fun {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 int32) => solve_lift (Build_t_C_z_89_ (f_val := (cast_int (WS2 := _) random) .% ((f_val (f_q (ret_both (tt : 'unit)))) .- (ret_both (1 : int8))))) : both (L1 :|: fset []) I1 t_z_89_ in + let f_field_zero := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_C_z_89_ (f_val := ret_both (0 : int8))) : both (L :|: fset []) I t_z_89_ in + let f_field_one := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_C_z_89_ (f_val := ret_both (1 : int8))) : both (L :|: fset []) I t_z_89_ in + let f_add := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_z_89_) (y : both L2 I2 t_z_89_) => solve_lift (Build_t_C_z_89_ (f_val := ((f_val x) .+ (f_val y)) .% ((f_val (f_q (ret_both (tt : 'unit)))) .- (ret_both (1 : int8))))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_z_89_ in + let f_sub := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_z_89_) (y : both L2 I2 t_z_89_) => solve_lift (Build_t_C_z_89_ (f_val := (((f_val x) .+ ((f_val (f_q (ret_both (tt : 'unit)))) .- (ret_both (1 : int8)))) .- (f_val y)) .% ((f_val (f_q (ret_both (tt : 'unit)))) .- (ret_both (1 : int8))))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_z_89_ in + let f_mul := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_z_89_) (y : both L2 I2 t_z_89_) => solve_lift (Build_t_C_z_89_ (f_val := cast_int (WS2 := _) (((cast_int (WS2 := _) (f_val x)) .* (cast_int (WS2 := _) (f_val y))) .% (cast_int (WS2 := _) ((f_val (f_q (ret_both (tt : 'unit)))) .- (ret_both (1 : int8))))))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_z_89_ in + {| f_q_loc := (fset [] : {fset Location}); f_q := (@f_q); f_random_field_elem_loc := (fset [] : {fset Location}); f_random_field_elem := (@f_random_field_elem); @@ -66,60 +76,45 @@ Next Obligation. f_sub_loc := (fset [] : {fset Location}); f_sub := (@f_sub); f_mul_loc := (fset [] : {fset Location}); - f_mul := (@f_mul)|} - ). - easy. - easy. - easy. - easy. - easy. - exact int_eqdec. - easy. - easy. - Unshelve. - all: try normalize_fset. - all: try solve_single_fset_fsubset. - - unfold f_parameter_cursor_loc. - -Next Obligation. - unfold t_z_89__t_Z_Field_obligation_4. + f_mul := (@f_mul)|}. Fail Next Obligation. -Hint Unfold t_z_89__t_Z_Field. +Hint Unfold t_z_89__t_Field. Definition res_loc : Location := - (int32;0%nat). + (t_z_89_;12%nat). Definition result_loc : Location := - (int32;1%nat). -#[global] Program Instance t_g_z_89__t_Group : t_Group t_g_z_89_ t_z_89_ := - let f_group_type := int32 : choice_type in - let f_g := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (3 : int32)) : both (L :|: fset []) I int32 in - let f_hash := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Vec int32 t_Global)) => letb res loc(res_loc) := f_field_one (ret_both (tt : 'unit)) in + (t_g_z_89_;13%nat). +#[global] Program Instance t_g_z_89__t_Group : t_Group t_g_z_89_ := + let f_Z := t_z_89_ : choice_type in + let f_g := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_C_g_z_89_ (f_val := ret_both (3 : int8))) : both (L :|: fset []) I t_g_z_89_ in + let f_hash := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Vec t_g_z_89_ t_Global)) => letb res loc(res_loc) := f_field_one (ret_both (tt : 'unit)) in letb _ := foldi_both_list (f_into_iter x) (fun y => ssp (fun _ => assign todo(term) : (both (*1*)(L1:|:fset [res_loc]) (I1) 'unit))) (ret_both (tt : 'unit)) in - solve_lift res : both (L1 :|: fset [res_loc]) I1 int32 in - let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 int32) => solve_lift (f_pow (f_g (ret_both (tt : 'unit))) x) : both (L1 :|: fset []) I1 int32 in - let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 int32) (x : both L2 I2 int32) => letb result loc(result_loc) := f_group_one (ret_both (tt : 'unit)) in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := x .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))))) (fun i => + solve_lift res : both (L1 :|: fset [res_loc]) I1 t_z_89_ in + let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 t_z_89_) => solve_lift (f_pow (f_g (ret_both (tt : 'unit))) x) : both (L1 :|: fset []) I1 t_g_z_89_ in + let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 t_g_z_89_) (x : both L2 I2 t_z_89_) => letb result loc(result_loc) := f_group_one (ret_both (tt : 'unit)) in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int8)) (f_end := (f_val x) .% ((f_val (f_q (ret_both (tt : 'unit)))) .- (ret_both (1 : int8)))))) (fun _ => ssp (fun _ => assign todo(term) : (both (*1*)(L1:|:L2:|:fset [result_loc]) (I1:|:I2) 'unit))) (ret_both (tt : 'unit)) in - solve_lift result : both (L1 :|: L2 :|: fset [result_loc]) (I1 :|: I2) int32 in - let f_group_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I int32 in - let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 int32) (y : both L2 I2 int32) => solve_lift (((x .% (f_q (ret_both (tt : 'unit)))) .* (y .% (f_q (ret_both (tt : 'unit))))) .% (f_q (ret_both (tt : 'unit)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) int32 in - let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 int32) => solve_lift (run (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := ret_both (89 : int32)))) (fun j => + solve_lift result : both (L1 :|: L2 :|: fset [result_loc]) (I1 :|: I2) t_g_z_89_ in + let f_group_one := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_C_g_z_89_ (f_val := ret_both (1 : int8))) : both (L :|: fset []) I t_g_z_89_ in + let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_g_z_89_) (y : both L2 I2 t_g_z_89_) => letb q_val := f_val (f_q (ret_both (tt : 'unit))) in + solve_lift (Build_t_C_g_z_89_ (f_val := cast_int (WS2 := _) (((cast_int (WS2 := _) ((f_val x) .% q_val)) .* (cast_int (WS2 := _) ((f_val y) .% q_val))) .% (cast_int (WS2 := _) q_val)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_g_z_89_ in + let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 t_g_z_89_) => solve_lift (run (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int8)) (f_end := ret_both (89 : int8)))) (fun j => ssp (fun _ => - solve_lift (ifb (f_prod x j) =.? (f_group_one (ret_both (tt : 'unit))) - then letm[choice_typeMonad.result_bind_code int32] hoist1 := v_Break j in - ControlFlow_Continue (never_to_any hoist1) - else ()) : (both (*0*)(L1:|:fset []) (I1) (t_ControlFlow int32 'unit)))) (ret_both (tt : 'unit)) in + letb value := Build_t_C_g_z_89_ (f_val := j) in + solve_lift (ifb (f_prod x value) =.? (f_group_one (ret_both (tt : 'unit))) + then letm[choice_typeMonad.result_bind_code t_g_z_89_] hoist29 := v_Break value in + ControlFlow_Continue (never_to_any hoist29) + else ()) : (both (*0*)(L1:|:fset []) (I1) (t_ControlFlow t_g_z_89_ 'unit)))) (ret_both (tt : 'unit)) in letb _ := ifb not (ret_both (false : 'bool)) then never_to_any (panic (ret_both (assertion failed: false : chString))) else () in - letm[choice_typeMonad.result_bind_code int32] hoist2 := v_Break x in - ControlFlow_Continue (never_to_any hoist2))) : both (L1 :|: fset []) I1 int32 in - let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 int32) (y : both L2 I2 int32) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) int32 in - {| f_group_type := (@f_group_type); + letm[choice_typeMonad.result_bind_code t_g_z_89_] hoist30 := v_Break x in + ControlFlow_Continue (never_to_any hoist30))) : both (L1 :|: fset []) I1 t_g_z_89_ in + let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_g_z_89_) (y : both L2 I2 t_g_z_89_) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_g_z_89_ in + {| f_Z := (@f_Z); f_g_loc := (fset [] : {fset Location}); f_g := (@f_g); f_hash_loc := (fset [res_loc] : {fset Location}); diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_zkgroup.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_zkgroup.v new file mode 100644 index 0000000..29734bf --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_zkgroup.v @@ -0,0 +1,73 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Crypt Require Import jasmin_word. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Group. +Export Group. + +Require Import Group_Ff. +Export Group_Ff. + +Require Import Field. +Export Field. + +Require Import PrimeField. +Export PrimeField. + +Require Import Group. +Export Group. + +Class t_MGroup (Self : choice_type) := { + f_hash_loc : {fset Location} ; + f_hash : (forall {L1 I1}, both L1 I1 (t_Vec v_Self t_Global) -> both (L1 :|: f_hash_loc) I1 f_Scalar) ; +}. +Hint Unfold f_hash_loc : hacspec_hints. + +Definition t_SchnorrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_MGroup v_G} : choice_type := + (v_G × f_Scalar × f_Scalar). +Equations f_schnorr_zkp_u {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_MGroup v_G} (s : both L I t_SchnorrZKPCommit) : both L I v_G := + f_schnorr_zkp_u s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : v_G))) : both L I v_G. +Fail Next Obligation. +Equations f_schnorr_zkp_c {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_MGroup v_G} (s : both L I t_SchnorrZKPCommit) : both L I f_Scalar := + f_schnorr_zkp_c s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : f_Scalar))) : both L I f_Scalar. +Fail Next Obligation. +Equations f_schnorr_zkp_z {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_MGroup v_G} (s : both L I t_SchnorrZKPCommit) : both L I f_Scalar := + f_schnorr_zkp_z s := + bind_both s (fun x => + solve_lift (ret_both (snd x : f_Scalar))) : both L I f_Scalar. +Fail Next Obligation. +Equations Build_t_SchnorrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_MGroup v_G} {f_schnorr_zkp_u : both L0 I0 v_G} {f_schnorr_zkp_c : both L1 I1 f_Scalar} {f_schnorr_zkp_z : both L2 I2 f_Scalar} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit) := + Build_t_SchnorrZKPCommit := + bind_both f_schnorr_zkp_z (fun f_schnorr_zkp_z => + bind_both f_schnorr_zkp_c (fun f_schnorr_zkp_c => + bind_both f_schnorr_zkp_u (fun f_schnorr_zkp_u => + solve_lift (ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit). +Fail Next Obligation. +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := y) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := y) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := y)). diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_zkgroup_specific.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_zkgroup_specific.v new file mode 100644 index 0000000..9012414 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_zkgroup_specific.v @@ -0,0 +1,110 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Crypt Require Import jasmin_word. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Group. +Export Group. + +Require Import Group_Ff. +Export Group_Ff. + +Require Import Field. +Export Field. + +Require Import Group. +Export Group. + +Require Import Gt. +Export Gt. + +Require Import PhantomData. +Export PhantomData. + +Notation "'t_G'" := t_Gt. + +(*item error backend*) + +Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 t_Scalar) (vote : both L2 I2 'bool) (g_pow_yi : both L3 I3 t_Gt) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) t_Gt := + compute_group_element_for_vote xi vote g_pow_yi := + solve_lift ((g_pow_yi .* xi) .+ ((f_generator (ret_both (tt : 'unit))) .* (ifb vote + then f_ONE + else f_ZERO))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) t_Gt. +Fail Next Obligation. + +Equations hash {L1 : {fset Location}} {I1 : Interface} (v__inp : both L1 I1 (t_Vec t_Gt t_Global)) : both L1 I1 t_Scalar := + hash v__inp := + solve_lift (impl__Scalar__one (ret_both (tt : 'unit))) : both L1 I1 t_Scalar. +Fail Next Obligation. + +(*item error backend*) + +(*item error backend*) + +(*item error backend*) + +(*item error backend*) + +(*item error backend*) + +(*item error backend*) + +(*item error backend*) + +(*item error backend*) + +(*item error backend*) + +(*item error backend*) + +(*item error backend*) + +Definition t_TallyParameter : choice_type := + 'unit. +Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := + Build_t_TallyParameter := + solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). +Fail Next Obligation. + +(*item error backend*) + +(*item error backend*) + +(*item error backend*) + +(*item error backend*) + +(*item error backend*) + +(*item error backend*) + +(*item error backend*) + +Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {n : both (fset []) (fset []) uint_size} (_ : both L1 I1 'unit) : both L1 I1 (t_Result (t_OvnContractState (both (fset []) (fset []) uint_size)) t_Reject) := + init_ovn_contract _ := + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_identity (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_identity (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_ZERO) (f_schnorr_zkp_c := f_ZERO)) n) (f_commit_vis := repeat f_ZERO n) (f_g_pow_xi_yi_vis := repeat (f_identity (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_identity (ret_both (tt : 'unit))) (f_or_zkp_y := f_identity (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_identity (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_identity (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_identity (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_identity (ret_both (tt : 'unit))) (f_or_zkp_c := f_ZERO) (f_or_zkp_d1 := f_ZERO) (f_or_zkp_d2 := f_ZERO) (f_or_zkp_r1 := f_ZERO) (f_or_zkp_r2 := f_ZERO)) n) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState (both (fset []) (fset []) uint_size)) t_Reject). +Fail Next Obligation. + +(*item error backend*) + +(*item error backend*) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_actual.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_actual.v new file mode 100644 index 0000000..59ae1dd --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_actual.v @@ -0,0 +1,874 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Crypt Require Import jasmin_word. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +(* Require Import Group. *) +(* Export Group. *) + +(* Require Import Group_Ff. *) +(* Export Group_Ff. *) + +(* Require Import Field. *) +(* Export Field. *) + +(* Require Import Group. *) +(* Export Group. *) + +(* Require Import Gt. *) +(* Export Gt. *) + +(* Require Import PhantomData. *) +(* Export PhantomData. *) + +Axiom rng_core : choice_type. +Axiom t_Choice : choice_type. (* ~ chOption *) + +Class t_Scalar (v_Self : choice_type) := { + t_Scalar_t_Add :> (t_Add v_Self v_Self) ; + t_Scalar_t_Mul :> (t_Mul v_Self v_Self) ; + f_ZERO_loc : {fset Location} ; + f_ZERO : (forall {L1 I1}, both (L1 :|: f_ZERO_loc) I1 v_Self) ; + f_ONE_loc : {fset Location} ; + f_ONE : (forall {L1 I1}, both (L1 :|: f_ONE_loc) I1 v_Self) ; + }. +Hint Unfold f_ZERO_loc : hacspec_hints. +Hint Unfold f_ONE_loc : hacspec_hints. + +Class t_Group (v_Self : choice_type) := { + f_Scalar : choice_type ; + f_Scalar_t_Scalar :> (t_Scalar f_Scalar) ; + f_Scalar_t_Sized :> (t_Sized f_Scalar) ; + t_Group_t_Add :> (t_Add v_Self v_Self) ; + t_Group_t_Mul :> (t_Mul v_Self f_Scalar) ; + f_random_loc : {fset Location} ; + f_random : (forall {L1 I1}, both L1 I1 rng_core -> both (L1 :|: f_random_loc) I1 v_Self) ; + f_identity_loc : {fset Location} ; + f_identity : (forall {L1 I1}, both L1 I1 'unit -> both (L1 :|: f_identity_loc) I1 v_Self) ; + f_generator_loc : {fset Location} ; + f_generator : (forall {L1 I1}, both L1 I1 'unit -> both (L1 :|: f_generator_loc) I1 v_Self) ; + f_is_identity_loc : {fset Location} ; + f_is_identity : (forall {L1 I1}, both L1 I1 v_Self -> both (L1 :|: f_is_identity_loc) I1 t_Choice) ; + f_double_loc : {fset Location} ; + f_double : (forall {L1 I1}, both L1 I1 v_Self -> both (L1 :|: f_double_loc) I1 v_Self) ; +}. +Hint Unfold f_random_loc : hacspec_hints. +Hint Unfold f_identity_loc : hacspec_hints. +Hint Unfold f_generator_loc : hacspec_hints. +Hint Unfold f_is_identity_loc : hacspec_hints. +Hint Unfold f_double_loc : hacspec_hints. + +Axiom t_Gt_Scalar : choice_type. +Axiom t_Gt : choice_type. +Program Instance f_Scalar_t_Add : t_Add t_Gt_Scalar t_Gt_Scalar := { f_Output := t_Gt_Scalar; f_add_loc := fset [] ; }. +Admit Obligations. +Program Instance f_Scalar_t_Mul : t_Mul t_Gt_Scalar t_Gt_Scalar := { f_Output := t_Gt_Scalar; f_mul_loc := fset [] ; }. +Admit Obligations. +Program Instance f_Group_t_Add : t_Add t_Gt t_Gt := { f_Output := t_Gt; f_add_loc := fset [] ; }. +Admit Obligations. +Program Instance f_Group_t_Mul : t_Mul t_Gt t_Gt_Scalar := { f_Output := t_Gt; f_mul_loc := fset [] ; }. +Admit Obligations. +Program Instance t_Scalar_t_Scalar : t_Scalar t_Gt_Scalar := { + f_ZERO_loc := fset [] ; + f_ONE_loc := fset [] ; + t_Scalar_t_Add := f_Scalar_t_Add ; + t_Scalar_t_Mul := f_Scalar_t_Mul ; + }. +Admit Obligations. +Program Instance t_Gt_Group : t_Group t_Gt := { + f_Scalar := t_Gt_Scalar ; + f_Scalar_t_Scalar := t_Scalar_t_Scalar ; + t_Group_t_Add := f_Group_t_Add ; + t_Group_t_Mul := f_Group_t_Mul ; + f_random_loc := fset [] ; + f_identity_loc := fset [] ; + f_generator_loc := fset [] ; + f_is_identity_loc := fset [] ; + f_double_loc := fset [] ; + }. +Admit Obligations. +Notation "'t_G'" := t_Gt. + +Notation "'t_Z'" := (f_Scalar (t_Group := t_Gt_Group)). + +(*Not implemented yet? todo(item)*) + +(*Not implemented yet? todo(item)*) +Check (f_add (t_Add := t_Group_t_Add (t_Group := t_Gt_Group)) _ _) : both _ _ t_Gt. +Check (f_mul (t_Mul := t_Group_t_Mul (t_Group := t_Gt_Group)) (_ : both _ _ t_Gt) (_ : both _ _ t_Gt_Scalar)) : both _ _ t_Gt. +Check ((_ : both _ _ int32) .+ _) : both _ _ int32. +Check ((_ : both _ _ t_Gt) .+ _) : both _ _ t_Gt. +Check ((_ : both _ _ t_Gt) .* (_ : both _ _ t_Gt_Scalar) : both _ _ t_Gt) .+ _ : both _ _ t_Gt. +Check (ret_both 1 :of0: int32) .+ (ret_both 4 :of0: int32) : both _ _ int32. + +Ltac solve_ssprove_obligations := + repeat ( + intros ; autounfold with hacspec_hints ; autounfold ; normalize_fset ; + solve [solve_match || now (apply fsubsetxx || apply fsub0set) + | solve_in_mem (* TODO: add match goal *) + | fset_equality (* TODO: add match goal *) + | solve_in_fset (* TODO: add match goal *) + | ssprove_valid'_2 ; (Tactics.program_simpl; fail)]). + +Obligation Tactic := simpl ; solve_ssprove_obligations. + +Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (f_Scalar (t_Group := t_Gt_Group))) (vote : both L2 I2 'bool) (g_pow_yi : both L3 I3 t_Gt) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) t_Gt := + compute_group_element_for_vote xi vote g_pow_yi := + solve_lift ( + ((g_pow_yi .* xi : both _ _ t_Gt) + .+ + ( + (f_generator (ret_both (tt : 'unit)) : both _ _ t_Gt) .* + (ifb vote + then f_ONE + else f_ZERO : both _ _ t_Gt_Scalar) : both _ _ t_Gt)) : both _ _ t_Gt) : + both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) t_Gt. +Fail Next Obligation. + +Obligation Tactic := solve_ssprove_obligations. + + +Equations hash {L1 : {fset Location}} {I1 : Interface} (v__inp : both L1 I1 (t_Vec t_Gt t_Global)) : both L1 I1 (f_Scalar) := + hash v__inp := + solve_lift (f_ONE) : both L1 I1 f_Scalar. +Fail Next Obligation. + +Definition prod1_loc {n : both (fset []) (fset []) uint_size} : Location := + (t_Gt;0%nat). +Definition prod2_loc {n : both (fset []) (fset []) uint_size} : Location := + (t_Gt;1%nat). +Equations compute_g_pow_yi {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {n : both (fset []) (fset []) uint_size} (i : both L1 I1 uint_size) (xis : both L2 I2 (nseq t_Gt (is_pure (n)))) : both (L1 :|: L2 :|: fset [prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) t_Gt := + compute_g_pow_yi i xis := + letb prod1 loc(prod1_loc) := f_identity (ret_both (tt : 'unit)) in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => + ssp (fun _ => + assignb _ loc( prod1_loc ) := _ ; : (both (*1*)(L2:|:L1:|:fset [prod1_loc]) (I2:|:I1) 'unit))) (ret_both (tt : 'unit)) in + letb prod2 loc(prod2_loc) := f_identity (ret_both (tt : 'unit)) in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => + ssp (fun _ => + assignb _ loc( prod2_loc ) := _ ; : (both (*1*)(L2:|:L1:|:fset [prod2_loc]) (I2:|:I1) 'unit))) (ret_both (tt : 'unit)) in + solve_lift (prod1 .- prod2) : both (L1 :|: L2 :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2) t_Gt. +Fail Next Obligation. + +Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 t_Gt) (commitment : both L2 I2 t_Scalar) : both (L1 :|: L2) (I1 :|: I2) 'bool := + check_commitment g_pow_xi_yi_vi commitment := + solve_lift ((hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both (L1 :|: L2) (I1 :|: I2) 'bool. +Fail Next Obligation. + +Equations commit_to {L1 : {fset Location}} {I1 : Interface} (g_pow_xi_yi_vi : both L1 I1 t_Gt) : both L1 I1 t_Scalar := + commit_to g_pow_xi_yi_vi := + solve_lift (hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both L1 I1 t_Scalar. +Fail Next Obligation. + +Definition t_CastVoteParam {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} : choice_type := + (int32 × f_Scalar × f_Scalar × f_Scalar × f_Scalar × 'bool × t_PhantomData v_S). +Equations f_cvp_i {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_CastVoteParam) : both L I int32 := + f_cvp_i s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst (fst x))))) : int32))) : both L I int32. +Fail Next Obligation. +Equations f_cvp_xi {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_CastVoteParam) : both L I f_Scalar := + f_cvp_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : f_Scalar))) : both L I f_Scalar. +Fail Next Obligation. +Equations f_cvp_zkp_random_w {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_CastVoteParam) : both L I f_Scalar := + f_cvp_zkp_random_w s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_Scalar))) : both L I f_Scalar. +Fail Next Obligation. +Equations f_cvp_zkp_random_r {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_CastVoteParam) : both L I f_Scalar := + f_cvp_zkp_random_r s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : f_Scalar))) : both L I f_Scalar. +Fail Next Obligation. +Equations f_cvp_zkp_random_d {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_CastVoteParam) : both L I f_Scalar := + f_cvp_zkp_random_d s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : f_Scalar))) : both L I f_Scalar. +Fail Next Obligation. +Equations f_cvp_vote {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_CastVoteParam) : both L I 'bool := + f_cvp_vote s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : 'bool))) : both L I 'bool. +Fail Next Obligation. +Equations f_phantom {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_CastVoteParam) : both L I (t_PhantomData v_S) := + f_phantom s := + bind_both s (fun x => + solve_lift (ret_both (snd x : (t_PhantomData v_S)))) : both L I (t_PhantomData v_S). +Fail Next Obligation. +Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} {f_cvp_i : both L0 I0 int32} {f_cvp_xi : both L1 I1 f_Scalar} {f_cvp_zkp_random_w : both L2 I2 f_Scalar} {f_cvp_zkp_random_r : both L3 I3 f_Scalar} {f_cvp_zkp_random_d : both L4 I4 f_Scalar} {f_cvp_vote : both L5 I5 'bool} {f_phantom : both L6 I6 (t_PhantomData v_S)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6) (t_CastVoteParam) := + Build_t_CastVoteParam := + bind_both f_phantom (fun f_phantom => + bind_both f_cvp_vote (fun f_cvp_vote => + bind_both f_cvp_zkp_random_d (fun f_cvp_zkp_random_d => + bind_both f_cvp_zkp_random_r (fun f_cvp_zkp_random_r => + bind_both f_cvp_zkp_random_w (fun f_cvp_zkp_random_w => + bind_both f_cvp_xi (fun f_cvp_xi => + bind_both f_cvp_i (fun f_cvp_i => + solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote,f_phantom) : (t_CastVoteParam)))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6) (t_CastVoteParam). +Fail Next Obligation. +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x) (f_phantom := f_phantom x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x) (f_phantom := f_phantom x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_w' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := y) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x) (f_phantom := f_phantom x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_r' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := y) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x) (f_phantom := f_phantom x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_d' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := y) (f_cvp_vote := f_cvp_vote x) (f_phantom := f_phantom x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := y) (f_phantom := f_phantom x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_phantom' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x) (f_phantom := y)). + +#[global] Program Instance t_CastVoteParam v_S_t_Serial {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} : t_Serial (t_CastVoteParam v_S) := + let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_CastVoteParam v_S)) (w : both L2 I2 v_W) => solve_lift (run (letb '(tmp0,out) := f_serial (f_cvp_i self) w in + letb _ := assign todo(term) in + letb hoist2 := out in + letb hoist3 := f_branch hoist2 in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist3 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist1 := ControlFlow_Break (prod_b (w,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist1)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : ('unit)) in + ControlFlow_Continue (solve_lift val) + end in + letb '(tmp0,out) := f_serial (f_from (f_cvp_xi self)) w in + letb _ := assign todo(term) in + letb hoist5 := out in + letb hoist6 := f_branch hoist5 in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist6 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist4 := ControlFlow_Break (prod_b (w,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist4)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : ('unit)) in + ControlFlow_Continue (solve_lift val) + end in + letb '(tmp0,out) := f_serial (f_from (f_cvp_zkp_random_w self)) w in + letb _ := assign todo(term) in + letb hoist8 := out in + letb hoist9 := f_branch hoist8 in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist9 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist7 := ControlFlow_Break (prod_b (w,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist7)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : ('unit)) in + ControlFlow_Continue (solve_lift val) + end in + letb '(tmp0,out) := f_serial (f_from (f_cvp_zkp_random_r self)) w in + letb _ := assign todo(term) in + letb hoist11 := out in + letb hoist12 := f_branch hoist11 in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist12 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist10 := ControlFlow_Break (prod_b (w,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist10)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : ('unit)) in + ControlFlow_Continue (solve_lift val) + end in + letb '(tmp0,out) := f_serial (f_from (f_cvp_zkp_random_d self)) w in + letb _ := assign todo(term) in + letb hoist14 := out in + letb hoist15 := f_branch hoist14 in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist15 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist13 := ControlFlow_Break (prod_b (w,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist13)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : ('unit)) in + ControlFlow_Continue (solve_lift val) + end in + letb '(tmp0,out) := f_serial (f_cvp_vote self) w in + letb _ := assign todo(term) in + letb hoist17 := out in + letb hoist18 := f_branch hoist17 in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist18 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist16 := ControlFlow_Break (prod_b (w,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist16)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : ('unit)) in + ControlFlow_Continue (solve_lift val) + end in + ControlFlow_Continue (letb hax_temp_output := Result_Ok (ret_both (tt : 'unit)) in + prod_b (w,hax_temp_output)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (v_W × t_Result 'unit f_Err) in + {| f_serial_loc := (fset [] : {fset Location}); + f_serial := (@f_serial)|}. +Fail Next Obligation. +Hint Unfold t_CastVoteParam v_S_t_Serial. + +#[global] Program Instance t_CastVoteParam v_S_t_Deserial {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} : t_Deserial (t_CastVoteParam v_S) := + let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (r : both L1 I1 v_R) => solve_lift (run (letb '(tmp0,out) := f_get r in + letb _ := assign todo(term) in + letb hoist20 := out in + letb hoist21 := f_branch hoist20 in + letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] (cvp_i : both _ _ int32) := matchb hoist21 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in + letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist19 := ControlFlow_Break (prod_b (r,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist19)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (int32)) in + ControlFlow_Continue (solve_lift val) + end in + letb '(tmp0,out) := f_get r in + letb _ := assign todo(term) in + letb hoist23 := out in + letb hoist24 := f_branch hoist23 in + letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist25 := matchb hoist24 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in + letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist22 := ControlFlow_Break (prod_b (r,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist22)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (v_S)) in + ControlFlow_Continue (solve_lift val) + end in + letb (cvp_xi : both _ _ t_Scalar) := f_into hoist25 in + letb '(tmp0,out) := f_get r in + letb _ := assign todo(term) in + letb hoist27 := out in + letb hoist28 := f_branch hoist27 in + letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist29 := matchb hoist28 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in + letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist26 := ControlFlow_Break (prod_b (r,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist26)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (v_S)) in + ControlFlow_Continue (solve_lift val) + end in + letb (cvp_zkp_random_w : both _ _ t_Scalar) := f_into hoist29 in + letb '(tmp0,out) := f_get r in + letb _ := assign todo(term) in + letb hoist31 := out in + letb hoist32 := f_branch hoist31 in + letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist33 := matchb hoist32 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in + letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist30 := ControlFlow_Break (prod_b (r,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist30)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (v_S)) in + ControlFlow_Continue (solve_lift val) + end in + letb (cvp_zkp_random_r : both _ _ t_Scalar) := f_into hoist33 in + letb '(tmp0,out) := f_get r in + letb _ := assign todo(term) in + letb hoist35 := out in + letb hoist36 := f_branch hoist35 in + letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist37 := matchb hoist36 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in + letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist34 := ControlFlow_Break (prod_b (r,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist34)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (v_S)) in + ControlFlow_Continue (solve_lift val) + end in + letb (cvp_zkp_random_d : both _ _ t_Scalar) := f_into hoist37 in + letb '(tmp0,out) := f_get r in + letb _ := assign todo(term) in + letb hoist39 := out in + letb hoist40 := f_branch hoist39 in + letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] (cvp_vote : both _ _ 'bool) := matchb hoist40 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in + letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist38 := ControlFlow_Break (prod_b (r,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist38)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : ('bool)) in + ControlFlow_Continue (solve_lift val) + end in + ControlFlow_Continue (letb hax_temp_output := Result_Ok (Build_t_CastVoteParam (f_cvp_i := cvp_i) (f_cvp_xi := cvp_xi) (f_cvp_zkp_random_w := cvp_zkp_random_w) (f_cvp_zkp_random_r := cvp_zkp_random_r) (f_cvp_zkp_random_d := cvp_zkp_random_d) (f_cvp_vote := cvp_vote) (f_phantom := PhantomData)) in + prod_b (r,hax_temp_output)))) : both (L1 :|: fset []) I1 (v_R × t_Result (t_CastVoteParam v_S) t_ParseError) in + {| f_deserial_loc := (fset [] : {fset Location}); + f_deserial := (@f_deserial)|}. +Fail Next Obligation. +Hint Unfold t_CastVoteParam v_S_t_Deserial. + +Definition t_OrZKPCommit : choice_type := + (t_Gt × t_Gt × t_Gt × t_Gt × t_Gt × t_Gt × f_Scalar × f_Scalar × f_Scalar × f_Scalar × f_Scalar). +Equations f_or_zkp_x {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I t_Gt := + f_or_zkp_x s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : t_Gt))) : both L I t_Gt. +Fail Next Obligation. +Equations f_or_zkp_y {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I t_Gt := + f_or_zkp_y s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : t_Gt))) : both L I t_Gt. +Fail Next Obligation. +Equations f_or_zkp_a1 {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I t_Gt := + f_or_zkp_a1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : t_Gt))) : both L I t_Gt. +Fail Next Obligation. +Equations f_or_zkp_b1 {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I t_Gt := + f_or_zkp_b1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : t_Gt))) : both L I t_Gt. +Fail Next Obligation. +Equations f_or_zkp_a2 {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I t_Gt := + f_or_zkp_a2 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : t_Gt))) : both L I t_Gt. +Fail Next Obligation. +Equations f_or_zkp_b2 {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I t_Gt := + f_or_zkp_b2 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : t_Gt))) : both L I t_Gt. +Fail Next Obligation. +Equations f_or_zkp_c {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I f_Scalar := + f_or_zkp_c s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_Scalar))) : both L I f_Scalar. +Fail Next Obligation. +Equations f_or_zkp_d1 {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I f_Scalar := + f_or_zkp_d1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : f_Scalar))) : both L I f_Scalar. +Fail Next Obligation. +Equations f_or_zkp_d2 {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I f_Scalar := + f_or_zkp_d2 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : f_Scalar))) : both L I f_Scalar. +Fail Next Obligation. +Equations f_or_zkp_r1 {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I f_Scalar := + f_or_zkp_r1 s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : f_Scalar))) : both L I f_Scalar. +Fail Next Obligation. +Equations f_or_zkp_r2 {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I f_Scalar := + f_or_zkp_r2 s := + bind_both s (fun x => + solve_lift (ret_both (snd x : f_Scalar))) : both L I f_Scalar. +Fail Next Obligation. +Equations Build_t_OrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {L7 : {fset Location}} {L8 : {fset Location}} {L9 : {fset Location}} {L10 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {I7 : Interface} {I8 : Interface} {I9 : Interface} {I10 : Interface} {f_or_zkp_x : both L0 I0 t_Gt} {f_or_zkp_y : both L1 I1 t_Gt} {f_or_zkp_a1 : both L2 I2 t_Gt} {f_or_zkp_b1 : both L3 I3 t_Gt} {f_or_zkp_a2 : both L4 I4 t_Gt} {f_or_zkp_b2 : both L5 I5 t_Gt} {f_or_zkp_c : both L6 I6 f_Scalar} {f_or_zkp_d1 : both L7 I7 f_Scalar} {f_or_zkp_d2 : both L8 I8 f_Scalar} {f_or_zkp_r1 : both L9 I9 f_Scalar} {f_or_zkp_r2 : both L10 I10 f_Scalar} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit) := + Build_t_OrZKPCommit := + bind_both f_or_zkp_r2 (fun f_or_zkp_r2 => + bind_both f_or_zkp_r1 (fun f_or_zkp_r1 => + bind_both f_or_zkp_d2 (fun f_or_zkp_d2 => + bind_both f_or_zkp_d1 (fun f_or_zkp_d1 => + bind_both f_or_zkp_c (fun f_or_zkp_c => + bind_both f_or_zkp_b2 (fun f_or_zkp_b2 => + bind_both f_or_zkp_a2 (fun f_or_zkp_a2 => + bind_both f_or_zkp_b1 (fun f_or_zkp_b1 => + bind_both f_or_zkp_a1 (fun f_or_zkp_a1 => + bind_both f_or_zkp_y (fun f_or_zkp_y => + bind_both f_or_zkp_x (fun f_or_zkp_x => + solve_lift (ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit)))))))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit). +Fail Next Obligation. +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := y) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := y) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := y) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := y) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := y) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := y) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_c' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := y) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := y) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := y) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := y) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := y)). + +Definition t_RegisterParam {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} : choice_type := + (int32 × f_Scalar × f_Scalar × t_PhantomData v_S). +Equations f_rp_i {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_RegisterParam) : both L I int32 := + f_rp_i s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst x)) : int32))) : both L I int32. +Fail Next Obligation. +Equations f_rp_xi {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_RegisterParam) : both L I f_Scalar := + f_rp_xi s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : f_Scalar))) : both L I f_Scalar. +Fail Next Obligation. +Equations f_rp_zkp_random {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_RegisterParam) : both L I f_Scalar := + f_rp_zkp_random s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : f_Scalar))) : both L I f_Scalar. +Fail Next Obligation. +Equations f_phantom {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_RegisterParam) : both L I (t_PhantomData v_S) := + f_phantom s := + bind_both s (fun x => + solve_lift (ret_both (snd x : (t_PhantomData v_S)))) : both L I (t_PhantomData v_S). +Fail Next Obligation. +Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} {f_rp_i : both L0 I0 int32} {f_rp_xi : both L1 I1 f_Scalar} {f_rp_zkp_random : both L2 I2 f_Scalar} {f_phantom : both L3 I3 (t_PhantomData v_S)} : both (L0:|:L1:|:L2:|:L3) (I0:|:I1:|:I2:|:I3) (t_RegisterParam) := + Build_t_RegisterParam := + bind_both f_phantom (fun f_phantom => + bind_both f_rp_zkp_random (fun f_rp_zkp_random => + bind_both f_rp_xi (fun f_rp_xi => + bind_both f_rp_i (fun f_rp_i => + solve_lift (ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random,f_phantom) : (t_RegisterParam))))))) : both (L0:|:L1:|:L2:|:L3) (I0:|:I1:|:I2:|:I3) (t_RegisterParam). +Fail Next Obligation. +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x) (f_phantom := f_phantom x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y) (f_rp_zkp_random := f_rp_zkp_random x) (f_phantom := f_phantom x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := y) (f_phantom := f_phantom x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_phantom' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x) (f_phantom := y)). + +#[global] Program Instance t_RegisterParam v_S_t_Serial {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} : t_Serial (t_RegisterParam v_S) := + let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_RegisterParam v_S)) (w : both L2 I2 v_W) => solve_lift (run (letb '(tmp0,out) := f_serial (f_rp_i self) w in + letb _ := assign todo(term) in + letb hoist42 := out in + letb hoist43 := f_branch hoist42 in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist43 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist41 := ControlFlow_Break (prod_b (w,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist41)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : ('unit)) in + ControlFlow_Continue (solve_lift val) + end in + letb '(tmp0,out) := f_serial (f_from (f_rp_xi self)) w in + letb _ := assign todo(term) in + letb hoist45 := out in + letb hoist46 := f_branch hoist45 in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist46 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist44 := ControlFlow_Break (prod_b (w,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist44)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : ('unit)) in + ControlFlow_Continue (solve_lift val) + end in + letb '(tmp0,out) := f_serial (f_from (f_rp_zkp_random self)) w in + letb _ := assign todo(term) in + letb hoist48 := out in + letb hoist49 := f_branch hoist48 in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist49 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist47 := ControlFlow_Break (prod_b (w,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist47)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : ('unit)) in + ControlFlow_Continue (solve_lift val) + end in + ControlFlow_Continue (letb hax_temp_output := Result_Ok (ret_both (tt : 'unit)) in + prod_b (w,hax_temp_output)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (v_W × t_Result 'unit f_Err) in + {| f_serial_loc := (fset [] : {fset Location}); + f_serial := (@f_serial)|}. +Fail Next Obligation. +Hint Unfold t_RegisterParam v_S_t_Serial. + +#[global] Program Instance t_RegisterParam v_S_t_Deserial {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} : t_Deserial (t_RegisterParam v_S) := + let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (r : both L1 I1 v_R) => solve_lift (run (letb '(tmp0,out) := f_get r in + letb _ := assign todo(term) in + letb hoist51 := out in + letb hoist52 := f_branch hoist51 in + letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_RegisterParam v_S) t_ParseError)] (rp_i : both _ _ int32) := matchb hoist52 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in + letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_RegisterParam v_S) t_ParseError)] hoist50 := ControlFlow_Break (prod_b (r,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist50)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (int32)) in + ControlFlow_Continue (solve_lift val) + end in + letb '(tmp0,out) := f_get r in + letb _ := assign todo(term) in + letb hoist54 := out in + letb hoist55 := f_branch hoist54 in + letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_RegisterParam v_S) t_ParseError)] hoist56 := matchb hoist55 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in + letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_RegisterParam v_S) t_ParseError)] hoist53 := ControlFlow_Break (prod_b (r,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist53)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (v_S)) in + ControlFlow_Continue (solve_lift val) + end in + letb (rp_xi : both _ _ t_Scalar) := f_into hoist56 in + letb '(tmp0,out) := f_get r in + letb _ := assign todo(term) in + letb hoist58 := out in + letb hoist59 := f_branch hoist58 in + letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_RegisterParam v_S) t_ParseError)] hoist60 := matchb hoist59 with + | ControlFlow_Break_case residual => + letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in + letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_RegisterParam v_S) t_ParseError)] hoist57 := ControlFlow_Break (prod_b (r,f_from_residual residual)) in + ControlFlow_Continue (solve_lift (never_to_any hoist57)) + | ControlFlow_Continue_case val => + letb val := ret_both ((val) : (v_S)) in + ControlFlow_Continue (solve_lift val) + end in + ControlFlow_Continue (letb (rp_zkp_random : both _ _ t_Scalar) := f_into hoist60 in + letb hax_temp_output := Result_Ok (Build_t_RegisterParam (f_rp_i := rp_i) (f_rp_xi := rp_xi) (f_rp_zkp_random := rp_zkp_random) (f_phantom := PhantomData)) in + prod_b (r,hax_temp_output)))) : both (L1 :|: fset []) I1 (v_R × t_Result (t_RegisterParam v_S) t_ParseError) in + {| f_deserial_loc := (fset [] : {fset Location}); + f_deserial := (@f_deserial)|}. +Fail Next Obligation. +Hint Unfold t_RegisterParam v_S_t_Deserial. + +Definition t_SchnorrZKPCommit : choice_type := + (t_Gt × f_Scalar × f_Scalar). +Equations f_schnorr_zkp_u {L : {fset Location}} {I : Interface} (s : both L I t_SchnorrZKPCommit) : both L I t_Gt := + f_schnorr_zkp_u s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst x) : t_Gt))) : both L I t_Gt. +Fail Next Obligation. +Equations f_schnorr_zkp_c {L : {fset Location}} {I : Interface} (s : both L I t_SchnorrZKPCommit) : both L I f_Scalar := + f_schnorr_zkp_c s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : f_Scalar))) : both L I f_Scalar. +Fail Next Obligation. +Equations f_schnorr_zkp_z {L : {fset Location}} {I : Interface} (s : both L I t_SchnorrZKPCommit) : both L I f_Scalar := + f_schnorr_zkp_z s := + bind_both s (fun x => + solve_lift (ret_both (snd x : f_Scalar))) : both L I f_Scalar. +Fail Next Obligation. +Equations Build_t_SchnorrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_schnorr_zkp_u : both L0 I0 t_Gt} {f_schnorr_zkp_c : both L1 I1 f_Scalar} {f_schnorr_zkp_z : both L2 I2 f_Scalar} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit) := + Build_t_SchnorrZKPCommit := + bind_both f_schnorr_zkp_z (fun f_schnorr_zkp_z => + bind_both f_schnorr_zkp_c (fun f_schnorr_zkp_c => + bind_both f_schnorr_zkp_u (fun f_schnorr_zkp_u => + solve_lift (ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit). +Fail Next Obligation. +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := y) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := y) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := y)). + +Definition t_TallyParameter : choice_type := + 'unit. +Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := + Build_t_TallyParameter := + solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). +Fail Next Obligation. + +Equations schnorr_zkp {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (r : both L1 I1 t_Scalar) (h : both L2 I2 t_Gt) (x : both L3 I3 t_Scalar) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) t_SchnorrZKPCommit := + schnorr_zkp r h x := + solve_lift (run (letb u := (f_generator (ret_both (tt : 'unit))) .* r in + letb c := hash (impl__into_vec (unsize (box_new (array_from_list [f_generator (ret_both (tt : 'unit)); + h; + u])))) in + letb z := r .+ (c .* x) in + letm[choice_typeMonad.result_bind_code t_SchnorrZKPCommit] hoist61 := ControlFlow_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in + ControlFlow_Continue (never_to_any hoist61))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) t_SchnorrZKPCommit. +Fail Next Obligation. + +Equations schnorr_zkp_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (h : both L1 I1 t_Gt) (pi : both L2 I2 t_SchnorrZKPCommit) : both (L1 :|: L2) (I1 :|: I2) 'bool := + schnorr_zkp_validate h pi := + solve_lift (andb ((f_schnorr_zkp_c pi) =.? (hash (impl__into_vec (unsize (box_new (array_from_list [f_generator (ret_both (tt : 'unit)); + h; + f_schnorr_zkp_u pi])))))) (((f_generator (ret_both (tt : 'unit))) .* (f_schnorr_zkp_z pi)) =.? ((f_schnorr_zkp_u pi) .+ (h .* (f_schnorr_zkp_c pi))))) : both (L1 :|: L2) (I1 :|: I2) 'bool. +Fail Next Obligation. + +Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} (w : both L1 I1 t_Scalar) (rand_r : both L2 I2 t_Scalar) (rand_d : both L3 I3 t_Scalar) (h : both L4 I4 t_Gt) (xi : both L5 I5 t_Scalar) (vi : both L6 I6 'bool) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) t_OrZKPCommit := + zkp_one_out_of_two w rand_r rand_d h xi vi := + solve_lift (ifb vi + then letb r1 := rand_r in + letb d1 := rand_d in + letb x := (f_generator (ret_both (tt : 'unit))) .* xi in + letb y := (h .* xi) .+ (f_generator (ret_both (tt : 'unit))) in + letb a1 := ((f_generator (ret_both (tt : 'unit))) .* r1) .+ (x .* d1) in + letb b1 := (h .* r1) .+ (y .* d1) in + letb a2 := (f_generator (ret_both (tt : 'unit))) .* w in + letb b2 := h .* w in + letb c := hash (impl__into_vec (unsize (box_new (array_from_list [x; + y; + a1; + b1; + a2; + b2])))) in + letb d2 := c .- d1 in + letb r2 := w .- (xi .* d2) in + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2) + else letb r2 := rand_r in + letb d2 := rand_d in + letb x := (f_generator (ret_both (tt : 'unit))) .* xi in + letb y := h .* xi in + letb a1 := (f_generator (ret_both (tt : 'unit))) .* w in + letb b1 := h .* w in + letb a2 := ((f_generator (ret_both (tt : 'unit))) .* r2) .+ (x .* d2) in + letb b2 := (h .* r2) .+ ((y .- (f_generator (ret_both (tt : 'unit)))) .* d2) in + letb c := hash (impl__into_vec (unsize (box_new (array_from_list [x; + y; + a1; + b1; + a2; + b2])))) in + letb d1 := c .- d2 in + letb r1 := w .- (xi .* d1) in + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) t_OrZKPCommit. +Fail Next Obligation. + +Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (h : both L1 I1 t_Gt) (zkp : both L2 I2 t_OrZKPCommit) : both (L1 :|: L2) (I1 :|: I2) 'bool := + zkp_one_out_of_two_validate h zkp := + letb c := hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; + f_or_zkp_y zkp; + f_or_zkp_a1 zkp; + f_or_zkp_b1 zkp; + f_or_zkp_a2 zkp; + f_or_zkp_b2 zkp])))) in + solve_lift (andb (andb (andb (andb (c =.? ((f_or_zkp_d1 zkp) .+ (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (((f_generator (ret_both (tt : 'unit))) .* (f_or_zkp_r1 zkp)) .+ ((f_or_zkp_x zkp) .* (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? ((h .* (f_or_zkp_r1 zkp)) .+ ((f_or_zkp_y zkp) .* (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (((f_generator (ret_both (tt : 'unit))) .* (f_or_zkp_r2 zkp)) .+ ((f_or_zkp_x zkp) .* (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? ((h .* (f_or_zkp_r2 zkp)) .+ (((f_or_zkp_y zkp) .- (f_generator (ret_both (tt : 'unit)))) .* (f_or_zkp_d2 zkp))))) : both (L1 :|: L2) (I1 :|: I2) 'bool. +Fail Next Obligation. + +Definition t_OvnContractState {n : both (fset []) (fset []) uint_size} : choice_type := + (nseq t_Gt (is_pure (n)) × nseq t_SchnorrZKPCommit (is_pure (n)) × nseq f_Scalar (is_pure (n)) × nseq t_Gt (is_pure (n)) × nseq t_OrZKPCommit (is_pure (n)) × int32). +Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {n : both (fset []) (fset []) uint_size} (s : both L I t_OvnContractState) : both L I (nseq t_Gt (is_pure (n))) := + f_g_pow_xis s := + bind_both s (fun x => + solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : (nseq t_Gt (is_pure (n)))))) : both L I (nseq t_Gt (is_pure (n))). +Fail Next Obligation. +Equations f_zkp_xis {L : {fset Location}} {I : Interface} {n : both (fset []) (fset []) uint_size} (s : both L I t_OvnContractState) : both L I (nseq t_SchnorrZKPCommit (is_pure (n))) := + f_zkp_xis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : (nseq t_SchnorrZKPCommit (is_pure (n)))))) : both L I (nseq t_SchnorrZKPCommit (is_pure (n))). +Fail Next Obligation. +Equations f_commit_vis {L : {fset Location}} {I : Interface} {n : both (fset []) (fset []) uint_size} (s : both L I t_OvnContractState) : both L I (nseq f_Scalar (is_pure (n))) := + f_commit_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst (fst x))) : (nseq f_Scalar (is_pure (n)))))) : both L I (nseq f_Scalar (is_pure (n))). +Fail Next Obligation. +Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} {n : both (fset []) (fset []) uint_size} (s : both L I t_OvnContractState) : both L I (nseq t_Gt (is_pure (n))) := + f_g_pow_xi_yi_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst (fst x)) : (nseq t_Gt (is_pure (n)))))) : both L I (nseq t_Gt (is_pure (n))). +Fail Next Obligation. +Equations f_zkp_vis {L : {fset Location}} {I : Interface} {n : both (fset []) (fset []) uint_size} (s : both L I t_OvnContractState) : both L I (nseq t_OrZKPCommit (is_pure (n))) := + f_zkp_vis s := + bind_both s (fun x => + solve_lift (ret_both (snd (fst x) : (nseq t_OrZKPCommit (is_pure (n)))))) : both L I (nseq t_OrZKPCommit (is_pure (n))). +Fail Next Obligation. +Equations f_tally {L : {fset Location}} {I : Interface} {n : both (fset []) (fset []) uint_size} (s : both L I t_OvnContractState) : both L I int32 := + f_tally s := + bind_both s (fun x => + solve_lift (ret_both (snd x : int32))) : both L I int32. +Fail Next Obligation. +Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {n : both (fset []) (fset []) uint_size} {f_g_pow_xis : both L0 I0 (nseq t_Gt (is_pure (n)))} {f_zkp_xis : both L1 I1 (nseq t_SchnorrZKPCommit (is_pure (n)))} {f_commit_vis : both L2 I2 (nseq f_Scalar (is_pure (n)))} {f_g_pow_xi_yi_vis : both L3 I3 (nseq t_Gt (is_pure (n)))} {f_zkp_vis : both L4 I4 (nseq t_OrZKPCommit (is_pure (n)))} {f_tally : both L5 I5 int32} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := + Build_t_OvnContractState := + bind_both f_tally (fun f_tally => + bind_both f_zkp_vis (fun f_zkp_vis => + bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => + bind_both f_commit_vis (fun f_commit_vis => + bind_both f_zkp_xis (fun f_zkp_xis => + bind_both f_g_pow_xis (fun f_g_pow_xis => + solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). +Fail Next Obligation. +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). + +Definition cast_vote_state_ret_loc {v_S : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_S} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := + (t_OvnContractState (both (fset []) (fset []) uint_size);2%nat). +Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_S : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_S} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both L1 I1 impl_574521470_) (state : both L2 I2 (t_OvnContractState (both (fset []) (fset []) uint_size))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError) := + cast_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code t_ParseError] (params : both _ _ (t_CastVoteParam v_S)) := out in + Result_Ok (letb g_pow_yi := compute_g_pow_yi (cast (B := uint_size) (f_cvp_i params)) (f_g_pow_xis state) in + letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in + letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in + letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError). +Fail Next Obligation. + +Definition commit_to_vote_state_ret_loc {v_S : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_S} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := + (t_OvnContractState (both (fset []) (fset []) uint_size);3%nat). +Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_S : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_S} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both L1 I1 impl_574521470_) (state : both L2 I2 (t_OvnContractState (both (fset []) (fset []) uint_size))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError) := + commit_to_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code t_ParseError] (params : both _ _ (t_CastVoteParam v_S)) := out in + Result_Ok (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + ssp (fun _ => + solve_lift (ifb not (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError)] hoist62 := ControlFlow_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist62) + else ()) : (both (*0*)(L2:|:fset []) (I2) (t_ControlFlow (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError) 'unit)))) (ret_both (tt : 'unit)) in + letb g_pow_yi := compute_g_pow_yi (cast (B := uint_size) (f_cvp_i params)) (f_g_pow_xis state) in + letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in + letb commit_vi := commit_to g_pow_xi_yi_vi in + letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in + letb _ := assign todo(term) in + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError). +Fail Next Obligation. + +Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {n : both (fset []) (fset []) uint_size} (_ : both L1 I1 'unit) : both L1 I1 (t_Result (t_OvnContractState (both (fset []) (fset []) uint_size)) t_Reject) := + init_ovn_contract _ := + Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_identity (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_identity (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_ZERO) (f_schnorr_zkp_c := f_ZERO)) n) (f_commit_vis := repeat f_ZERO n) (f_g_pow_xi_yi_vis := repeat (f_identity (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_identity (ret_both (tt : 'unit))) (f_or_zkp_y := f_identity (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_identity (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_identity (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_identity (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_identity (ret_both (tt : 'unit))) (f_or_zkp_c := f_ZERO) (f_or_zkp_d1 := f_ZERO) (f_or_zkp_d2 := f_ZERO) (f_or_zkp_r1 := f_ZERO) (f_or_zkp_r2 := f_ZERO)) n) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState (both (fset []) (fset []) uint_size)) t_Reject). +Fail Next Obligation. + +Definition register_vote_state_ret_loc {v_S : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_S} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := + (t_OvnContractState (both (fset []) (fset []) uint_size);4%nat). +Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_S : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_S} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both L1 I1 impl_574521470_) (state : both L2 I2 (t_OvnContractState (both (fset []) (fset []) uint_size))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError) := + register_vote ctx state := + solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code t_ParseError] (params : both _ _ (t_RegisterParam v_S)) := out in + Result_Ok (letb g_pow_xi := (f_generator (ret_both (tt : 'unit))) .* (f_rp_xi params) in + letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in + letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in + letb _ := assign todo(term) in + letb _ := assign todo(term) in + Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError). +Fail Next Obligation. + +Definition curr_loc {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := + (t_Scalar;5%nat). +Definition tally_loc {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := + (int32;6%nat). +Definition tally_votes_state_ret_loc {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := + (t_OvnContractState (both (fset []) (fset []) uint_size);7%nat). +Definition vote_result_loc {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := + (t_Gt;8%nat). +Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (_ : both L1 I1 impl_574521470_) (state : both L2 I2 (t_OvnContractState (both (fset []) (fset []) uint_size))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError) := + tally_votes _ state := + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + ssp (fun _ => + letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in + letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError)] _ := ControlFlow_Continue (ifb not (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError)] hoist63 := ControlFlow_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist63) + else ()) in + solve_lift (ifb not (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError)] hoist64 := ControlFlow_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist64) + else ()) : (both (*2*)(L2:|:fset [prod1_loc;prod2_loc]) (I2) (t_ControlFlow (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError) 'unit)))) (ret_both (tt : 'unit)) in + letb vote_result loc(vote_result_loc) := f_identity (ret_both (tt : 'unit)) in + letb _ := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => + ssp (fun _ => + assign todo(term) : (both (*1*)(L2:|:fset [vote_result_loc]) (I2) 'unit))) (ret_both (tt : 'unit)) in + letb tally loc(tally_loc) := ret_both (0 : int32) in + letb curr loc(curr_loc) := f_ZERO in + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast (B := int32) n))) (fun i => + ssp (fun _ => + letb _ := ifb ((f_generator (ret_both (tt : 'unit))) .* curr) =.? vote_result + then letb _ := assign todo(term) in + ret_both (tt : 'unit) + else () in + letb _ := assign todo(term) in + solve_lift (ret_both (tt : 'unit)) : (both (*3*)(fset [curr_loc;tally_loc;vote_result_loc]) ((fset [])) 'unit))) (ret_both (tt : 'unit)) in + letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in + letb _ := assign todo(term) in + Result_Ok (solve_lift (prod_b (f_accept (ret_both (tt : 'unit)),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError). +Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/_expected_trait.v b/ovn/proofs/ssprove/extraction/_expected_trait.v new file mode 100644 index 0000000..2690ced --- /dev/null +++ b/ovn/proofs/ssprove/extraction/_expected_trait.v @@ -0,0 +1,86 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +(* From Jasmin Require Import word. *) + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Class t_Field (v_Self : choice_type) := { + f_q_loc : {fset Location} ; + f_q : (both 'unit -> both v_Self) ; + f_random_field_elem_loc : {fset Location} ; + f_random_field_elem : (both int32 -> both v_Self) ; + f_field_zero_loc : {fset Location} ; + f_field_zero : (both 'unit -> both v_Self) ; + f_field_one_loc : {fset Location} ; + f_field_one : (both 'unit -> both v_Self) ; + f_add_loc : {fset Location} ; + f_add : (both v_Self -> both v_Self -> both v_Self) ; + f_sub_loc : {fset Location} ; + f_sub : (both v_Self -> both v_Self -> both v_Self) ; + f_mul_loc : {fset Location} ; + f_mul : (both v_Self -> both v_Self -> both v_Self) ; +}. +Hint Unfold f_q_loc. +Hint Unfold f_random_field_elem_loc. +Hint Unfold f_field_zero_loc. +Hint Unfold f_field_one_loc. +Hint Unfold f_add_loc. +Hint Unfold f_sub_loc. +Hint Unfold f_mul_loc. + +Class t_Group (v_Self : choice_type) := { + f_Z : choice_type ; + f_Z_t_Field :> (t_Field f_Z) ; + f_Z_t_Serialize :> (t_Serialize f_Z) ; + f_Z_t_Deserial :> (t_Deserial f_Z) ; + f_Z_t_Serial :> (t_Serial f_Z) ; + f_Z_t_Clone :> (t_Clone f_Z) ; + f_Z_t_Eq :> (t_Eq f_Z) ; + f_Z_t_PartialEq :> (t_PartialEq f_Z) ; + f_Z_t_Copy :> (t_Copy f_Z) ; + f_Z_t_Sized :> (t_Sized f_Z) ; + f_g_loc : {fset Location} ; + f_g : (both 'unit -> both v_Self) ; + f_g_pow_loc : {fset Location} ; + f_g_pow : (both f_Z -> both v_Self) ; + f_pow_loc : {fset Location} ; + f_pow : (both v_Self -> both f_Z -> both v_Self) ; + f_group_one_loc : {fset Location} ; + f_group_one : (both 'unit -> both v_Self) ; + f_prod_loc : {fset Location} ; + f_prod : (both v_Self -> both v_Self -> both v_Self) ; + f_inv_loc : {fset Location} ; + f_inv : (both v_Self -> both v_Self) ; + f_div_loc : {fset Location} ; + f_div : (both v_Self -> both v_Self -> both v_Self) ; + f_hash_loc : {fset Location} ; + f_hash : (both (t_Vec v_Self t_Global) -> both f_Z) ; +}. +Hint Unfold f_g_loc. +Hint Unfold f_g_pow_loc. +Hint Unfold f_pow_loc. +Hint Unfold f_group_one_loc. +Hint Unfold f_prod_loc. +Hint Unfold f_inv_loc. +Hint Unfold f_div_loc. +Hint Unfold f_hash_loc. diff --git a/ovn/src/lib.rs b/ovn/src/lib.rs index cf056c5..018a7ce 100644 --- a/ovn/src/lib.rs +++ b/ovn/src/lib.rs @@ -5,10 +5,11 @@ pub mod ovn_traits; -pub mod ovn_group; pub mod ovn_secp256k1; pub mod ovn_z_89; +pub mod ovn_group; -pub mod ovn_zk_z_89; -pub mod ovn_zk_secp256k1; -pub mod ovn_zkgroup; +// pub mod ovn_zk_secp256k1; +// pub mod ovn_zk_z_89; +// pub mod ovn_zkgroup; +// pub mod ovn_zkgroup_specific; diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs index 3d9b641..4b4f88e 100644 --- a/ovn/src/ovn_group.rs +++ b/ovn/src/ovn_group.rs @@ -13,24 +13,24 @@ pub use crate::ovn_traits::*; //////////////////// #[derive(Serialize, SchemaType, Clone, Copy)] -pub struct SchnorrZKPCommit> { - pub schnorr_zkp_u: G::group_type, - pub schnorr_zkp_c: Z::field_type, - pub schnorr_zkp_z: Z::field_type, +pub struct SchnorrZKPCommit { + pub schnorr_zkp_u: G, + pub schnorr_zkp_c: G::Z, + pub schnorr_zkp_z: G::Z, } /** Non-interactive Schnorr proof using Fiat-Shamir heuristics (RFC 8235) */ // https://www.rfc-editor.org/rfc/rfc8235 // https://crypto.stanford.edu/cs355/19sp/lec5.pdf -pub fn schnorr_zkp>( +pub fn schnorr_zkp( random: u32, - h: G::group_type, - x: Z::field_type, -) -> SchnorrZKPCommit { - let r = Z::random_field_elem(random); + h: G, + x: G::Z, +) -> SchnorrZKPCommit { + let r = G::Z::random_field_elem(random); let u = G::g_pow(r); let c = G::hash(vec![G::g(), h, u]); - let z = Z::add(r, Z::mul(c, x)); + let z = G::Z::add(r, G::Z::mul(c, x)); return SchnorrZKPCommit { schnorr_zkp_u: u, @@ -40,46 +40,46 @@ pub fn schnorr_zkp>( } // https://crypto.stanford.edu/cs355/19sp/lec5.pdf -pub fn schnorr_zkp_validate>( - h: G::group_type, - pi: SchnorrZKPCommit, +pub fn schnorr_zkp_validate( + h: G, + pi: SchnorrZKPCommit, ) -> bool { pi.schnorr_zkp_c == G::hash(vec![G::g(), h, pi.schnorr_zkp_u]) && G::g_pow(pi.schnorr_zkp_z) == G::prod(pi.schnorr_zkp_u, G::pow(h, pi.schnorr_zkp_c)) } #[derive(Serialize, SchemaType, Clone, Copy)] -pub struct OrZKPCommit> { - pub or_zkp_x: G::group_type, - pub or_zkp_y: G::group_type, - pub or_zkp_a1: G::group_type, - pub or_zkp_b1: G::group_type, - pub or_zkp_a2: G::group_type, - pub or_zkp_b2: G::group_type, +pub struct OrZKPCommit { + pub or_zkp_x: G, + pub or_zkp_y: G, + pub or_zkp_a1: G, + pub or_zkp_b1: G, + pub or_zkp_a2: G, + pub or_zkp_b2: G, - pub or_zkp_c: Z::field_type, + pub or_zkp_c: G::Z, - pub or_zkp_d1: Z::field_type, - pub or_zkp_d2: Z::field_type, + pub or_zkp_d1: G::Z, + pub or_zkp_d2: G::Z, - pub or_zkp_r1: Z::field_type, - pub or_zkp_r2: Z::field_type, + pub or_zkp_r1: G::Z, + pub or_zkp_r2: G::Z, } /** Cramer, Damgård and Schoenmakers (CDS) technique */ -pub fn zkp_one_out_of_two>( +pub fn zkp_one_out_of_two( random_w: u32, random_r: u32, random_d: u32, - h: G::group_type, - xi: Z::field_type, + h: G, + xi: G::Z, vi: bool, -) -> OrZKPCommit { - let w = Z::random_field_elem(random_w); +) -> OrZKPCommit { + let w = G::Z::random_field_elem(random_w); if vi { - let r1 = Z::random_field_elem(random_r); - let d1 = Z::random_field_elem(random_d); + let r1 = G::Z::random_field_elem(random_r); + let d1 = G::Z::random_field_elem(random_d); let x = G::g_pow(xi); let y = G::prod(G::pow(h, xi), G::g()); @@ -92,8 +92,8 @@ pub fn zkp_one_out_of_two>( let c = G::hash(vec![x, y, a1, b1, a2, b2]); - let d2 = Z::sub(c, d1); - let r2 = Z::sub(w, Z::mul(xi, d2)); + let d2 = G::Z::sub(c, d1); + let r2 = G::Z::sub(w, G::Z::mul(xi, d2)); OrZKPCommit { or_zkp_x: x, @@ -109,8 +109,8 @@ pub fn zkp_one_out_of_two>( or_zkp_r2: r2, } } else { - let r2 = Z::random_field_elem(random_r); - let d2 = Z::random_field_elem(random_d); + let r2 = G::Z::random_field_elem(random_r); + let d2 = G::Z::random_field_elem(random_d); let x = G::g_pow(xi); let y = G::pow(h, xi); @@ -123,8 +123,8 @@ pub fn zkp_one_out_of_two>( let c = G::hash(vec![x, y, a1, b1, a2, b2]); - let d1 = Z::sub(c, d2); - let r1 = Z::sub(w, Z::mul(xi, d1)); + let d1 = G::Z::sub(c, d2); + let r1 = G::Z::sub(w, G::Z::mul(xi, d1)); OrZKPCommit { or_zkp_x: x, @@ -143,9 +143,9 @@ pub fn zkp_one_out_of_two>( } // Anonymous voting by two-round public discussion -pub fn zkp_one_out_of_two_validate>( - h: G::group_type, - zkp: OrZKPCommit, +pub fn zkp_one_out_of_two_validate( + h: G, + zkp: OrZKPCommit, ) -> bool { let c = G::hash(vec![ zkp.or_zkp_x, @@ -156,7 +156,7 @@ pub fn zkp_one_out_of_two_validate>( zkp.or_zkp_b2, ]); // TODO: add i - (c == Z::add(zkp.or_zkp_d1, zkp.or_zkp_d2) + (c == G::Z::add(zkp.or_zkp_d1, zkp.or_zkp_d2) && zkp.or_zkp_a1 == G::prod(G::g_pow(zkp.or_zkp_r1), G::pow(zkp.or_zkp_x, zkp.or_zkp_d1)) && zkp.or_zkp_b1 == G::prod( @@ -171,13 +171,13 @@ pub fn zkp_one_out_of_two_validate>( )) } -pub fn commit_to>(g_pow_xi_yi_vi: G::group_type) -> Z::field_type { +pub fn commit_to(g_pow_xi_yi_vi: G) -> G::Z { G::hash(vec![g_pow_xi_yi_vi]) } -pub fn check_commitment>( - g_pow_xi_yi_vi: G::group_type, - commitment: Z::field_type, +pub fn check_commitment( + g_pow_xi_yi_vi: G, + commitment: G::Z, ) -> bool { G::hash(vec![g_pow_xi_yi_vi]) == commitment } @@ -185,34 +185,36 @@ pub fn check_commitment>( #[hax::contract_state(contract = "OVN")] // #[cfg_attr(not(feature = "hax_compilation"), contract_state(contract = "OVN"))] #[derive(Serialize, SchemaType, Clone, Copy)] -pub struct OvnContractState, const n: usize> { - pub g_pow_xis: [G::group_type; n], - pub zkp_xis: [SchnorrZKPCommit; n], +pub struct OvnContractState { + pub g_pow_xis: [G; n], + pub zkp_xis: [SchnorrZKPCommit; n], - pub commit_vis: [Z::field_type; n], + pub commit_vis: [G::Z; n], - pub g_pow_xi_yi_vis: [G::group_type; n], - pub zkp_vis: [OrZKPCommit; n], + pub g_pow_xi_yi_vis: [G; n], + pub zkp_vis: [OrZKPCommit; n], pub tally: u32, + + pub round1 : [bool; n], } #[hax::init(contract = "OVN")] // #[cfg_attr(not(feature = "hax_compilation"), init(contract = "OVN"))] -pub fn init_ovn_contract, const n: usize>(// _: &impl HasInitContext, -) -> InitResult> { - Ok(OvnContractState:: { +pub fn init_ovn_contract(// _: &impl HasInitContext, +) -> InitResult> { + Ok(OvnContractState:: { g_pow_xis: [G::group_one(); n], - zkp_xis: [SchnorrZKPCommit:: { + zkp_xis: [SchnorrZKPCommit:: { schnorr_zkp_u: G::group_one(), - schnorr_zkp_z: Z::field_zero(), - schnorr_zkp_c: Z::field_zero(), + schnorr_zkp_z: G::Z::field_zero(), + schnorr_zkp_c: G::Z::field_zero(), }; n], - commit_vis: [Z::field_zero(); n], + commit_vis: [G::Z::field_zero(); n], g_pow_xi_yi_vis: [G::group_one(); n], - zkp_vis: [OrZKPCommit:: { + zkp_vis: [OrZKPCommit:: { or_zkp_x: G::group_one(), or_zkp_y: G::group_one(), or_zkp_a1: G::group_one(), @@ -220,64 +222,67 @@ pub fn init_ovn_contract, const n: usize>(// _: &impl Ha or_zkp_a2: G::group_one(), or_zkp_b2: G::group_one(), - or_zkp_c: Z::field_zero(), + or_zkp_c: G::Z::field_zero(), - or_zkp_d1: Z::field_zero(), - or_zkp_d2: Z::field_zero(), + or_zkp_d1: G::Z::field_zero(), + or_zkp_d2: G::Z::field_zero(), - or_zkp_r1: Z::field_zero(), - or_zkp_r2: Z::field_zero(), + or_zkp_r1: G::Z::field_zero(), + or_zkp_r2: G::Z::field_zero(), }; n], tally: 0, - }) + + round1: [false; n], + }) } /** Currently randomness needs to be injected */ -pub fn select_private_voting_key(random: u32) -> Z::field_type { +pub fn select_private_voting_key(random: u32) -> Z { Z::random_field_elem(random) } #[derive(Serialize, SchemaType)] -pub struct RegisterParam { +pub struct RegisterParam { pub rp_i: u32, - pub rp_xi: Z::field_type, + pub rp_xi: Z, pub rp_zkp_random: u32, } /** Primary function in round 1 */ #[hax::receive(contract = "OVN", name = "register", parameter = "RegisterParam")] // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "register", parameter = "RegisterParam"))] -pub fn register_vote, const n: usize, A: HasActions>( +pub fn register_vote( ctx: impl HasReceiveContext, - state: OvnContractState, -) -> Result<(A, OvnContractState), ParseError> { - let params: RegisterParam = ctx.parameter_cursor().get()?; + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { + let params: RegisterParam = ctx.parameter_cursor().get()?; let g_pow_xi = G::g_pow(params.rp_xi); - let zkp_xi = schnorr_zkp::(params.rp_zkp_random, g_pow_xi, params.rp_xi); + let zkp_xi = schnorr_zkp::(params.rp_zkp_random, g_pow_xi, params.rp_xi); let mut register_vote_state_ret = state.clone(); register_vote_state_ret.g_pow_xis[params.rp_i as usize] = g_pow_xi; register_vote_state_ret.zkp_xis[params.rp_i as usize] = zkp_xi; + register_vote_state_ret.round1[params.rp_i as usize] = true; Ok((A::accept(), register_vote_state_ret)) } #[derive(Serialize, SchemaType)] -pub struct CastVoteParam { +pub struct CastVoteParam { pub cvp_i: u32, - pub cvp_xi: Z::field_type, + pub cvp_xi: Z, pub cvp_zkp_random_w: u32, pub cvp_zkp_random_r: u32, pub cvp_zkp_random_d: u32, pub cvp_vote: bool, } -pub fn compute_g_pow_yi, const n: usize>( +pub fn compute_g_pow_yi( i: usize, - xis: [G::group_type; n], -) -> G::group_type { + xis: [G; n], +) -> G { let mut prod1 = G::group_one(); for j in 0..i { prod1 = G::prod(prod1, xis[j]); @@ -293,17 +298,17 @@ pub fn compute_g_pow_yi, const n: usize>( g_pow_yi } -pub fn compute_group_element_for_vote>( - xi: Z::field_type, +pub fn compute_group_element_for_vote( + xi: G::Z, vote: bool, - g_pow_yi: G::group_type, -) -> G::group_type { + g_pow_yi: G, +) -> G { G::prod( G::pow(g_pow_yi, xi), G::g_pow(if vote { - Z::field_one() + G::Z::field_one() } else { - Z::field_zero() + G::Z::field_zero() }), ) } @@ -311,22 +316,22 @@ pub fn compute_group_element_for_vote>( /** Commitment before round 2 */ #[hax::receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam"))] -pub fn commit_to_vote, const n: usize, A: HasActions>( +pub fn commit_to_vote( ctx: impl HasReceiveContext, - state: OvnContractState, -) -> Result<(A, OvnContractState), ParseError> { - let params: CastVoteParam = ctx.parameter_cursor().get()?; + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { + let params: CastVoteParam = ctx.parameter_cursor().get()?; for i in 0..n { - if !schnorr_zkp_validate(state.g_pow_xis[i], state.zkp_xis[i]) { + if !schnorr_zkp_validate(state.g_pow_xis[i], state.zkp_xis[i]) || !state.round1[i] { return Err(ParseError {}); } } - let g_pow_yi = compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); + let g_pow_yi = compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); let g_pow_xi_yi_vi = - compute_group_element_for_vote::(params.cvp_xi, params.cvp_vote, g_pow_yi); - let commit_vi = commit_to::(g_pow_xi_yi_vi); + compute_group_element_for_vote::(params.cvp_xi, params.cvp_vote, g_pow_yi); + let commit_vi = commit_to::(g_pow_xi_yi_vi); let mut commit_to_vote_state_ret = state.clone(); commit_to_vote_state_ret.commit_vis[params.cvp_i as usize] = commit_vi; @@ -336,17 +341,17 @@ pub fn commit_to_vote, const n: usize, A: HasActions>( /** Primary function in round 2, also opens commitment */ #[hax::receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam"))] -pub fn cast_vote, const n: usize, A: HasActions>( +pub fn cast_vote( ctx: impl HasReceiveContext, - state: OvnContractState, -) -> Result<(A, OvnContractState), ParseError> { - let params: CastVoteParam = ctx.parameter_cursor().get()?; + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { + let params: CastVoteParam = ctx.parameter_cursor().get()?; - let g_pow_yi = compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); + let g_pow_yi = compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); let g_pow_xi_yi_vi = - compute_group_element_for_vote::(params.cvp_xi, params.cvp_vote, g_pow_yi); + compute_group_element_for_vote::(params.cvp_xi, params.cvp_vote, g_pow_yi); - let zkp_vi = zkp_one_out_of_two::( + let zkp_vi = zkp_one_out_of_two::( params.cvp_zkp_random_w, params.cvp_zkp_random_r, params.cvp_zkp_random_d, @@ -367,16 +372,16 @@ pub struct TallyParameter {} #[hax::receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "tally", parameter = "TallyParameter"))] /** Anyone can tally the votes */ -pub fn tally_votes, const n: usize, A: HasActions>( +pub fn tally_votes( _: impl HasReceiveContext, - state: OvnContractState, -) -> Result<(A, OvnContractState), ParseError> { + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { for i in 0..n { - let g_pow_yi = compute_g_pow_yi::(i as usize, state.g_pow_xis); - if !zkp_one_out_of_two_validate::(g_pow_yi, state.zkp_vis[i]) { + let g_pow_yi = compute_g_pow_yi::(i as usize, state.g_pow_xis); + if !zkp_one_out_of_two_validate::(g_pow_yi, state.zkp_vis[i]) { return Err(ParseError {}); } - if !check_commitment::(state.g_pow_xi_yi_vis[i], state.commit_vis[i]) { + if !check_commitment::(state.g_pow_xi_yi_vis[i], state.commit_vis[i]) { return Err(ParseError {}); } } @@ -387,14 +392,14 @@ pub fn tally_votes, const n: usize, A: HasActions>( } let mut tally = 0; - let mut curr = Z::field_zero(); + let mut curr = G::Z::field_zero(); for i in 0..n as u32 { // Should be while, but is bounded by n anyways! if G::g_pow(curr) == vote_result { tally = i; } - curr = Z::add(curr, Z::field_one()); + curr = G::Z::add(curr, G::Z::field_one()); } let mut tally_votes_state_ret = state.clone(); diff --git a/ovn/src/ovn_secp256k1.rs b/ovn/src/ovn_secp256k1.rs index 28379d7..b6da6a3 100644 --- a/ovn/src/ovn_secp256k1.rs +++ b/ovn/src/ovn_secp256k1.rs @@ -16,9 +16,9 @@ use hacspec_concordium_derive::*; pub use crate::ovn_traits::*; // // pub use create::ovn_traits::*; -// use create::Z_Field; +// use create::Field; // use create::Group; -// use create::Z_Field; +// use create::Field; use hacspec_lib::*; @@ -34,63 +34,61 @@ pub struct Z_curve { } impl hacspec_concordium::Deserial for Z_curve { - // TODO: - fn deserial(_source: &mut R) -> ParseResult { - let buffer: &mut [u8] = &mut []; - let _ = _source.read(buffer)?; + fn deserial(source: &mut R) -> ParseResult { + let temp : Vec = source.get()?; Ok(Z_curve { - val: Scalar::from_public_byte_seq_be(Seq::::from_native_slice(buffer)), + val: Scalar::from_public_byte_seq_be(Seq::::from_vec(temp)), }) } } impl hacspec_concordium::Serial for Z_curve { - // TODO: - fn serial(&self, _out: &mut W) -> Result<(), W::Err> { - let _ = _out.write(self.val.to_public_byte_seq_be().native_slice()); - Ok(()) + fn serial(&self, out: &mut W) -> Result<(), W::Err> { + let mut v : Vec = Vec::new(); + for x in self.val.to_public_byte_seq_be().native_slice() { + v.push(x.clone()); + } + v.serial(out) } } -impl Z_Field for Z_curve { - type field_type = Z_curve; - - fn q() -> Self::field_type { +impl Field for Z_curve { + fn q() -> Self { Z_curve { val: Scalar::from_hex( "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", ), - } // TODO: Scalar::modulo_value; + } } - fn random_field_elem(random: u32) -> Self::field_type { + fn random_field_elem(random: u32) -> Self { Z_curve { val: Scalar::from_literal(random as u128), } } - fn field_zero() -> Self::field_type { + fn field_zero() -> Self { Z_curve { val: Scalar::from_literal(0u128), } // Scalar::ZERO() } - fn field_one() -> Self::field_type { + fn field_one() -> Self { Z_curve { val: Scalar::from_literal(1u128), } // Scalar::ONE() } - fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { + fn add(x: Self, y: Self) -> Self { Z_curve { val: x.val + y.val } } - fn sub(x: Self::field_type, y: Self::field_type) -> Self::field_type { + fn sub(x: Self, y: Self) -> Self { Z_curve { val: x.val - y.val } } - fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { + fn mul(x: Self, y: Self) -> Self { Z_curve { val: x.val * y.val } } } @@ -101,47 +99,55 @@ pub struct Group_curve { } impl hacspec_concordium::Deserial for Group_curve { - // TODO: - fn deserial(_source: &mut R) -> ParseResult { - let buffer: &mut [u8] = &mut []; - let _ = _source.read(buffer)?; - if let [0] = buffer { - return Ok(Group_curve { - val: Point::AtInfinity, - }); + fn deserial(source: &mut R) -> ParseResult { + let b : bool = source.get()?; + if b { + let vx : Vec = source.get()?; + let vy : Vec = source.get()?; + + Ok(Group_curve { + val: Point::Affine(( + FieldElement::from_public_byte_seq_be(Seq::::from_vec(vx)), + FieldElement::from_public_byte_seq_be(Seq::::from_vec(vy)), + )), + }) + } else { + Ok(Group_curve { val: Point::AtInfinity }) } - - let buffer_y: &mut [u8] = &mut []; - let _ = _source.read(buffer_y)?; - - Ok(Group_curve { - val: Point::Affine(( - FieldElement::from_public_byte_seq_be(Seq::::from_native_slice(buffer)), - FieldElement::from_public_byte_seq_be(Seq::::from_native_slice(buffer_y)), - )), - }) } } impl hacspec_concordium::Serial for Group_curve { - // TODO: - fn serial(&self, _out: &mut W) -> Result<(), W::Err> { + fn serial(&self, out: &mut W) -> Result<(), W::Err> { match self.val { Point::Affine(p) => { - _out.write(x(p).to_public_byte_seq_be().native_slice()); - _out.write(y(p).to_public_byte_seq_be().native_slice()) + true.serial(out)?; + + let mut vx : Vec = Vec::new(); + for x in x(p).to_public_byte_seq_be().native_slice() { + vx.push(x.clone()); + } + let _ = vx.serial(out)?; + + let mut vy : Vec = Vec::new(); + for y in y(p).to_public_byte_seq_be().native_slice() { + vy.push(y.clone()); + } + let _ = vy.serial(out)?; } - Point::AtInfinity => _out.write(&[0]), + Point::AtInfinity => { + let _ = false.serial(out)?; + }, }; Ok(()) } } -impl Group for Group_curve { - type group_type = Group_curve; +impl Group for Group_curve { + type Z = Z_curve; // https://eips.ethereum.org/EIPS/eip-2333 - fn g() -> Self::group_type { + fn g() -> Self { #[rustfmt::skip] let gx = PBytes32([ 0x79u8, 0xBEu8, 0x66u8, 0x7Eu8, 0xF9u8, 0xDCu8, 0xBBu8, 0xACu8, @@ -162,45 +168,45 @@ impl Group for Group_curve { FieldElement::from_public_byte_seq_be(gy), )), } - } // TODO + } - fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { + fn pow(g: Self, x: Z_curve) -> Self { Group_curve { val: point_mul(x.val, g.val), } } - fn g_pow(x: ::field_type) -> Self::group_type { + fn g_pow(x: Z_curve) -> Self { Group_curve { val: point_mul_base(x.val), } // Self::pow(Self::g(), x) } - fn group_one() -> Self::group_type { - Self::g_pow(::field_zero()) + fn group_one() -> Self { + Self::g_pow(::field_zero()) } - fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { + fn prod(x: Self, y: Self) -> Self { Group_curve { val: point_add(x.val, y.val), } } - fn inv(x: Self::group_type) -> Self::group_type { + fn inv(x: Self) -> Self { Group_curve { val: match x.val { Point::Affine((a, b)) => Point::Affine((a, FieldElement::from_literal(0u128) - b)), - Point::AtInfinity => Point::AtInfinity, // TODO? + Point::AtInfinity => Point::AtInfinity, }, } } - fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { + fn div(x: Self, y: Self) -> Self { Self::prod(x, Self::inv(y)) } - fn hash(x: Vec) -> ::field_type { + fn hash(x: Vec) -> Z_curve { // fp_hash_to_field Z_curve::field_one() // TODO: bls12-381 hash to curve? } diff --git a/ovn/src/ovn_traits.rs b/ovn/src/ovn_traits.rs index cee0a93..46e1853 100644 --- a/ovn/src/ovn_traits.rs +++ b/ovn/src/ovn_traits.rs @@ -10,40 +10,39 @@ use hax_lib_macros::*; #[exclude] use hacspec_concordium::*; -#[exclude] -use hacspec_concordium_derive::*; + //////////// // Traits // //////////// -pub trait Z_Field: core::marker::Copy { - type field_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; +/** Interface for field implementation */ +pub trait Field: core::marker::Copy + PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize { + fn q() -> Self; - fn q() -> Self::field_type; + fn random_field_elem(random: u32) -> Self; - fn random_field_elem(random: u32) -> Self::field_type; + fn field_zero() -> Self; + fn field_one() -> Self; - fn field_zero() -> Self::field_type; - fn field_one() -> Self::field_type; - - fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type; - fn sub(x: Self::field_type, y: Self::field_type) -> Self::field_type; - fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type; + fn add(x: Self, y: Self) -> Self; + fn sub(x: Self, y: Self) -> Self; + fn mul(x: Self, y: Self) -> Self; } /** Interface for group implementation */ -pub trait Group: core::marker::Copy { - type group_type: PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize; +pub trait Group: core::marker::Copy + PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize { + type Z : Field; - fn g() -> Self::group_type; // Generator (elemnent of group) + fn g() -> Self; // Generator (elemnent of group) - fn g_pow(x: Z::field_type) -> Self::group_type; - fn pow(g: Self::group_type, x: Z::field_type) -> Self::group_type; // TODO: Link with q - fn group_one() -> Self::group_type; - fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type; - fn inv(x: Self::group_type) -> Self::group_type; - fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type; + fn g_pow(x: Self::Z) -> Self; + fn pow(g: Self, x: Self::Z) -> Self; // TODO: Link with q + fn group_one() -> Self; + fn prod(x: Self, y: Self) -> Self; + fn inv(x: Self) -> Self; + fn div(x: Self, y: Self) -> Self; - fn hash(x: Vec) -> Z::field_type; + fn hash(x: Vec) -> Self::Z; } + diff --git a/ovn/src/ovn_z_89.rs b/ovn/src/ovn_z_89.rs index cb22b6d..2fd59ee 100644 --- a/ovn/src/ovn_z_89.rs +++ b/ovn/src/ovn_z_89.rs @@ -16,95 +16,134 @@ use hacspec_concordium_derive::*; pub use crate::ovn_traits::*; // // pub use create::ovn_traits::*; -// use create::Z_Field; +// use create::Field; // use create::Group; -// use create::Z_Field; +// use create::Field; //////////////////// // Impl for Z/89Z // //////////////////// -#[derive(Clone, Copy)] -pub struct z_89 {} -impl Z_Field for z_89 { - type field_type = u32; - fn q() -> Self::field_type { - 89u32 +#[derive(Clone, Copy, PartialEq, Eq, hacspec_concordium::Serial, hacspec_concordium::Deserial)] +pub struct z_89 { val : u8 } + +// impl hacspec_concordium::Deserial for z_89 { +// // TODO: +// fn deserial(source: &mut R) -> ParseResult { +// let v : u8 = source.get()?; +// Ok(z_89 { +// val: v, +// }) +// } +// } + +// impl hacspec_concordium::Serial for z_89 { +// // TODO: +// fn serial(&self, out: &mut W) -> Result<(), W::Err> { +// self.val.serial(out) +// } +// } + +impl Field for z_89 { + fn q() -> Self { + z_89{ val: 89u8} } // Prime order - fn random_field_elem(random: u32) -> Self::field_type { - random % (Self::q() - 1) + fn random_field_elem(random: u32) -> Self { + z_89{ val: random as u8 % (Self::q().val - 1) } } - fn field_zero() -> Self::field_type { - 0u32 + fn field_zero() -> Self { + z_89{ val: 0u8 } } - fn field_one() -> Self::field_type { - 1u32 + fn field_one() -> Self { + z_89{ val: 1u8 } } - fn add(x: Self::field_type, y: Self::field_type) -> Self::field_type { - (x + y) % (Self::q() - 1) + fn add(x: Self, y: Self) -> Self { + z_89{ val: (x.val + y.val) % (Self::q().val - 1) } } - fn sub(x: Self::field_type, y: Self::field_type) -> Self::field_type { - (x + (Self::q() - 1) - y) % (Self::q() - 1) + fn sub(x: Self, y: Self) -> Self { + z_89{ val: (x.val + (Self::q().val - 1) - y.val) % (Self::q().val - 1) } } - fn mul(x: Self::field_type, y: Self::field_type) -> Self::field_type { - (x * y) % (Self::q() - 1) + fn mul(x: Self, y: Self) -> Self { + z_89{ val: (((x.val as u16) * (y.val as u16)) % ((Self::q().val - 1) as u16)) as u8 } } } -#[derive(Clone, Copy)] -pub struct g_z_89 {} -impl Group for g_z_89 { - type group_type = u32; - - fn g() -> Self::group_type { - 3u32 +#[derive(Clone, Copy, PartialEq, Eq, hacspec_concordium::Serial, hacspec_concordium::Deserial)] +pub struct g_z_89 { val : u8 } + +// impl hacspec_concordium::Deserial for g_z_89 { +// // TODO: +// fn deserial(source: &mut R) -> ParseResult { +// let v : u8 = source.get()?; + +// Ok(g_z_89 { +// val: v, +// }) +// } +// } + +// impl hacspec_concordium::Serial for g_z_89 { +// // TODO: +// fn serial(&self, out: &mut W) -> Result<(), W::Err> { +// self.val.serial(out) +// } +// } + + +impl Group for g_z_89 { + type Z = z_89; + + fn g() -> Self { + g_z_89 { val: 3u8 } } // Generator (elemnent of group) - fn hash(x: Vec) -> ::field_type { + fn hash(x: Vec) -> z_89 { let mut res = z_89::field_one(); for y in x { - res = z_89::mul(y, res); + res = z_89::mul(z_89{val: y.val}, res); } res // TODO } - fn g_pow(x: ::field_type) -> Self::group_type { + fn g_pow(x: z_89) -> Self { Self::pow(Self::g(), x) } // TODO: use repeated squaring instead! - fn pow(g: Self::group_type, x: ::field_type) -> Self::group_type { + fn pow(g: Self, x: z_89) -> Self { let mut result = Self::group_one(); - for i in 0..(x % (z_89::q() - 1)) { + for _ in 0..(x.val % (z_89::q().val - 1)) { result = Self::prod(result, g); } result } - fn group_one() -> Self::group_type { - 1 + fn group_one() -> Self { + g_z_89 { val: 1 } } - fn prod(x: Self::group_type, y: Self::group_type) -> Self::group_type { - ((x % z_89::q()) * (y % z_89::q())) % z_89::q() + fn prod(x: Self, y: Self) -> Self { + let q_val = z_89::q().val; + g_z_89 { val: ((((x.val % q_val) as u16) * ((y.val % q_val) as u16)) % (q_val as u16)) as u8 } } - fn inv(x: Self::group_type) -> Self::group_type { + fn inv(x: Self) -> Self { for j in 0..89 { - if Self::prod(x, j) == Self::group_one() { - return j; + let value = g_z_89 {val: j}; + if Self::prod(x, value) == Self::group_one() { + return value; } } assert!(false); return x; } - fn div(x: Self::group_type, y: Self::group_type) -> Self::group_type { + fn div(x: Self, y: Self) -> Self { Self::prod(x, Self::inv(y)) } } diff --git a/ovn/src/ovn_zk_secp256k1.rs b/ovn/src/ovn_zk_secp256k1.rs index fc47c43..3e58993 100644 --- a/ovn/src/ovn_zk_secp256k1.rs +++ b/ovn/src/ovn_zk_secp256k1.rs @@ -6,14 +6,14 @@ use hacspec_concordium::*; #[exclude] use hacspec_concordium_derive::*; -pub use group::{ff::Field, Group}; pub use crate::ovn_zkgroup::*; +pub use group::{ff::Field, Group}; use hacspec_bip_340::{GroupTrait::*, Point, *}; impl MGroup for Point { fn hash(inp: Vec) -> Self::Scalar { - return Self::Scalar::ONE // TODO + return Self::Scalar::ONE; // TODO } } @@ -21,7 +21,7 @@ use bls12_381::*; impl MGroup for Gt { fn hash(inp: Vec) -> Self::Scalar { - return Self::Scalar::ONE // TODO + return Self::Scalar::ONE; // TODO } } // hacspec_concordium::Serial + hacspec_concordium::Deserial, diff --git a/ovn/src/ovn_zkgroup.rs b/ovn/src/ovn_zkgroup.rs index 067a8ec..4f253ae 100644 --- a/ovn/src/ovn_zkgroup.rs +++ b/ovn/src/ovn_zkgroup.rs @@ -10,28 +10,16 @@ use group::{ ff::{Field, PrimeField}, Group, }; -use rand_core::RngCore; - -pub trait MGroup: Group { - fn pow(p: Self, exp: Self::Scalar) -> Self { - p * exp - } - - fn g_pow(n: Self::Scalar) -> Self { - Self::generator() * n - } +pub trait MGroup : Group { fn hash(inp: Vec) -> Self::Scalar; - fn div(x: Self, y: Self) -> Self { - x - y - } } //////////////////// // Implementation // //////////////////// -#[derive(SchemaType, Clone, Copy)] +#[derive(SchemaType)] // , Clone, Copy pub struct SchnorrZKPCommit { pub schnorr_zkp_u: G, pub schnorr_zkp_c: G::Scalar, @@ -46,7 +34,7 @@ pub fn schnorr_zkp( h: G, x: G::Scalar, ) -> SchnorrZKPCommit { - let u = G::g_pow(r); + let u = G::generator() * r; // g ^ r let c = G::hash(vec![G::generator(), h, u]); let z = r + (c * x); @@ -57,407 +45,410 @@ pub fn schnorr_zkp( }; } -// https://crypto.stanford.edu/cs355/19sp/lec5.pdf -pub fn schnorr_zkp_validate(h: G, pi: SchnorrZKPCommit) -> bool { - pi.schnorr_zkp_c == G::hash(vec![G::generator(), h, pi.schnorr_zkp_u]) - && (G::g_pow(pi.schnorr_zkp_z) == (pi.schnorr_zkp_u + G::pow(h, pi.schnorr_zkp_c))) -} - -#[derive(SchemaType, Clone, Copy)] -pub struct OrZKPCommit { - pub or_zkp_x: G, - pub or_zkp_y: G, - pub or_zkp_a1: G, - pub or_zkp_b1: G, - pub or_zkp_a2: G, - pub or_zkp_b2: G, - - pub or_zkp_c: G::Scalar, - - pub or_zkp_d1: G::Scalar, - pub or_zkp_d2: G::Scalar, - - pub or_zkp_r1: G::Scalar, - pub or_zkp_r2: G::Scalar, -} - -/** Cramer, Damgård and Schoenmakers (CDS) technique */ -pub fn zkp_one_out_of_two( - w: G::Scalar, // random - rand_r: G::Scalar, - rand_d: G::Scalar, - h: G, - xi: G::Scalar, - vi: bool, -) -> OrZKPCommit { - if vi { - let r1 = rand_r; - let d1 = rand_d; - - let x = G::g_pow(xi); - let y = G::pow(h, xi) + G::generator(); - - let a1 = G::g_pow(r1) + G::pow(x, d1); - let b1 = G::pow(h, r1) + G::pow(y, d1); - - let a2 = G::g_pow(w); - let b2 = G::pow(h, w); - - let c = G::hash(vec![x, y, a1, b1, a2, b2]); - - let d2 = c - d1; - let r2 = w - xi * d2; - - OrZKPCommit { - or_zkp_x: x, - or_zkp_y: y, - or_zkp_a1: a1, - or_zkp_b1: b1, - or_zkp_a2: a2, - or_zkp_b2: b2, - or_zkp_c: c, - or_zkp_d1: d1, - or_zkp_d2: d2, - or_zkp_r1: r1, - or_zkp_r2: r2, - } - } else { - let r2 = rand_r; - let d2 = rand_d; - - let x = G::g_pow(xi); - let y = G::pow(h, xi); - - let a1 = G::g_pow(w); - let b1 = G::pow(h, w); - - let a2 = G::g_pow(r2) + G::pow(x, d2); - let b2 = G::pow(h, r2) + G::pow(G::div(y, G::generator()), d2); - - let c = G::hash(vec![x, y, a1, b1, a2, b2]); - - let d1 = c - d2; - let r1 = w - xi * d1; - - OrZKPCommit { - or_zkp_x: x, - or_zkp_y: y, - or_zkp_a1: a1, - or_zkp_b1: b1, - or_zkp_a2: a2, - or_zkp_b2: b2, - or_zkp_c: c, - or_zkp_d1: d1, - or_zkp_d2: d2, - or_zkp_r1: r1, - or_zkp_r2: r2, - } - } -} - -// Anonymous voting by two-round public discussion -pub fn zkp_one_out_of_two_validate(h: G, zkp: OrZKPCommit) -> bool { - let c = G::hash(vec![ - zkp.or_zkp_x, - zkp.or_zkp_y, - zkp.or_zkp_a1, - zkp.or_zkp_b1, - zkp.or_zkp_a2, - zkp.or_zkp_b2, - ]); // TODO: add i - - (c == zkp.or_zkp_d1 + zkp.or_zkp_d2 - && zkp.or_zkp_a1 == G::g_pow(zkp.or_zkp_r1) + G::pow(zkp.or_zkp_x, zkp.or_zkp_d1) - && zkp.or_zkp_b1 == G::pow(h, zkp.or_zkp_r1) + G::pow(zkp.or_zkp_y, zkp.or_zkp_d1) - && zkp.or_zkp_a2 == G::g_pow(zkp.or_zkp_r2) + G::pow(zkp.or_zkp_x, zkp.or_zkp_d2) - && zkp.or_zkp_b2 - == G::pow(h, zkp.or_zkp_r2) - + G::pow(G::div(zkp.or_zkp_y, G::generator()), zkp.or_zkp_d2)) -} - -pub fn commit_to(g_pow_xi_yi_vi: G) -> G::Scalar { - G::hash(vec![g_pow_xi_yi_vi]) -} - -pub fn check_commitment(g_pow_xi_yi_vi: G, commitment: G::Scalar) -> bool { - G::hash(vec![g_pow_xi_yi_vi]) == commitment -} - -#[hax::contract_state(contract = "OVN")] -// #[cfg_attr(not(feature = "hax_compilation"), contract_state(contract = "OVN"))] -#[derive(SchemaType, Clone, Copy)] -pub struct OvnContractState { - pub g_pow_xis: [G; n], - pub zkp_xis: [SchnorrZKPCommit; n], - - pub commit_vis: [G::Scalar; n], - - pub g_pow_xi_yi_vis: [G; n], - pub zkp_vis: [OrZKPCommit; n], - - pub tally: u32, -} - -#[hax::init(contract = "OVN")] -// #[cfg_attr(not(feature = "hax_compilation"), init(contract = "OVN"))] -pub fn init_ovn_contract(// _: &impl HasInitContext, -) -> InitResult> { - Ok(OvnContractState:: { - g_pow_xis: [G::identity(); n], - zkp_xis: [SchnorrZKPCommit:: { - schnorr_zkp_u: G::identity(), - schnorr_zkp_z: G::Scalar::ZERO, - schnorr_zkp_c: G::Scalar::ZERO, - }; n], - - commit_vis: [G::Scalar::ZERO; n], - - g_pow_xi_yi_vis: [G::identity(); n], - zkp_vis: [OrZKPCommit:: { - or_zkp_x: G::identity(), - or_zkp_y: G::identity(), - or_zkp_a1: G::identity(), - or_zkp_b1: G::identity(), - or_zkp_a2: G::identity(), - or_zkp_b2: G::identity(), - - or_zkp_c: G::Scalar::ZERO, - - or_zkp_d1: G::Scalar::ZERO, - or_zkp_d2: G::Scalar::ZERO, - - or_zkp_r1: G::Scalar::ZERO, - or_zkp_r2: G::Scalar::ZERO, - }; n], - - tally: 0, - }) -} - -use core::marker::PhantomData; -#[derive(SchemaType)] -pub struct RegisterParam + Into> { - pub rp_i: u32, - pub rp_xi: Z, - pub rp_zkp_random: Z, - pub phantom: PhantomData, -} - -impl + Into> Serial for RegisterParam { - fn serial(&self, w: &mut W) -> Result<(), ::Err> { - self.rp_i.serial(w)?; - >::from(self.rp_xi).serial(w)?; - >::from(self.rp_zkp_random).serial(w)?; - Ok(()) - } -} - -impl + Into> Deserial for RegisterParam { - fn deserial(r: &mut R) -> Result { - let rp_i: u32 = r.get()?; - let rp_xi: Z = >::into(r.get()?); - let rp_zkp_random: Z = >::into(r.get()?); - Ok(RegisterParam { - rp_i, - rp_xi, - rp_zkp_random, - phantom: PhantomData, - }) - } -} - -/** Primary function in round 1 */ -#[hax::receive(contract = "OVN", name = "register", parameter = "RegisterParam")] -// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "register", parameter = "RegisterParam"))] -pub fn register_vote< - G: MGroup, - S: Serialize + From + Into, - const n: usize, - A: HasActions, ->( - ctx: impl HasReceiveContext, - state: OvnContractState, -) -> Result<(A, OvnContractState), ParseError> { - let params: RegisterParam = ctx.parameter_cursor().get()?; - let g_pow_xi = G::g_pow(params.rp_xi); - - let zkp_xi = schnorr_zkp::(params.rp_zkp_random, g_pow_xi, params.rp_xi); - - let mut register_vote_state_ret = state.clone(); - register_vote_state_ret.g_pow_xis[params.rp_i as usize] = g_pow_xi; - register_vote_state_ret.zkp_xis[params.rp_i as usize] = zkp_xi; - - Ok((A::accept(), register_vote_state_ret)) -} - -#[derive(SchemaType)] -pub struct CastVoteParam + Into> { - pub cvp_i: u32, - pub cvp_xi: Z, - pub cvp_zkp_random_w: Z, - pub cvp_zkp_random_r: Z, - pub cvp_zkp_random_d: Z, - pub cvp_vote: bool, - pub phantom: PhantomData, -} - -impl + Into> Serial for CastVoteParam { - fn serial(&self, w: &mut W) -> Result<(), ::Err> { - self.cvp_i.serial(w)?; - >::from(self.cvp_xi).serial(w)?; - >::from(self.cvp_zkp_random_w).serial(w)?; - >::from(self.cvp_zkp_random_r).serial(w)?; - >::from(self.cvp_zkp_random_d).serial(w)?; - self.cvp_vote.serial(w)?; - Ok(()) - } -} - -impl + Into> Deserial for CastVoteParam { - fn deserial(r: &mut R) -> Result { - let cvp_i: u32 = r.get()?; - let cvp_xi: Z = >::into(r.get()?); - let cvp_zkp_random_w: Z = >::into(r.get()?); - let cvp_zkp_random_r: Z = >::into(r.get()?); - let cvp_zkp_random_d: Z = >::into(r.get()?); - let cvp_vote: bool = r.get()?; - Ok(CastVoteParam { - cvp_i, - cvp_xi, - cvp_zkp_random_w, - cvp_zkp_random_r, - cvp_zkp_random_d, - cvp_vote, - phantom: PhantomData, - }) - } -} - -pub fn compute_g_pow_yi(i: usize, xis: [G; n]) -> G { - let mut prod1 = G::identity(); - for j in 0..i { - prod1 = prod1 + xis[j]; - } - - let mut prod2 = G::identity(); - for j in (i + 1)..n { - prod2 = prod2 + xis[j]; - } - - // implicitly: Y_i = g^y_i - let g_pow_yi = G::div(prod1, prod2); - g_pow_yi -} - -pub fn compute_group_element_for_vote(xi: G::Scalar, vote: bool, g_pow_yi: G) -> G { - G::pow(g_pow_yi, xi) - + G::g_pow(if vote { - G::Scalar::ONE - } else { - G::Scalar::ZERO - }) -} - -/** Commitment before round 2 */ -#[hax::receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] -// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam"))] -pub fn commit_to_vote< - G: MGroup, - S: Serialize + From + Into, - const n: usize, - A: HasActions, ->( - ctx: impl HasReceiveContext, - state: OvnContractState, -) -> Result<(A, OvnContractState), ParseError> { - let params: CastVoteParam = ctx.parameter_cursor().get()?; - - for i in 0..n { - if !schnorr_zkp_validate(state.g_pow_xis[i], state.zkp_xis[i]) { - return Err(ParseError {}); - } - } - - let g_pow_yi = compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); - let g_pow_xi_yi_vi = - compute_group_element_for_vote::(params.cvp_xi, params.cvp_vote, g_pow_yi); - let commit_vi = commit_to::(g_pow_xi_yi_vi); - - let mut commit_to_vote_state_ret = state.clone(); - commit_to_vote_state_ret.commit_vis[params.cvp_i as usize] = commit_vi; - Ok((A::accept(), commit_to_vote_state_ret)) -} - -/** Primary function in round 2, also opens commitment */ -#[hax::receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] -// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam"))] -pub fn cast_vote + Into, const n: usize, A: HasActions>( - ctx: impl HasReceiveContext, - state: OvnContractState, -) -> Result<(A, OvnContractState), ParseError> -{ - let params: CastVoteParam = ctx.parameter_cursor().get()?; - - let g_pow_yi = compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); - let g_pow_xi_yi_vi = - compute_group_element_for_vote::(params.cvp_xi, params.cvp_vote, g_pow_yi); - - let zkp_vi = zkp_one_out_of_two::( - params.cvp_zkp_random_w, - params.cvp_zkp_random_r, - params.cvp_zkp_random_d, - g_pow_yi, - params.cvp_xi, - params.cvp_vote, - ); - let mut cast_vote_state_ret = state.clone(); - cast_vote_state_ret.g_pow_xi_yi_vis[params.cvp_i as usize] = g_pow_xi_yi_vi; - cast_vote_state_ret.zkp_vis[params.cvp_i as usize] = zkp_vi; - - Ok((A::accept(), cast_vote_state_ret)) -} - -#[derive(Serialize, SchemaType)] -pub struct TallyParameter {} - -#[hax::receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] -// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "tally", parameter = "TallyParameter"))] -/** Anyone can tally the votes */ -pub fn tally_votes( - _: impl HasReceiveContext, - state: OvnContractState, -) -> Result<(A, OvnContractState), ParseError> -{ - for i in 0..n { - let g_pow_yi = compute_g_pow_yi::(i as usize, state.g_pow_xis); - if !zkp_one_out_of_two_validate::(g_pow_yi, state.zkp_vis[i]) { - return Err(ParseError {}); - } - if !check_commitment::(state.g_pow_xi_yi_vis[i], state.commit_vis[i]) { - return Err(ParseError {}); - } - } - - let mut vote_result = G::identity(); - for g_pow_vote in state.g_pow_xi_yi_vis { - vote_result = vote_result + g_pow_vote; - } - - let mut tally = 0; - let mut curr = G::Scalar::ZERO; - for i in 0..n as u32 { - // Should be while, but is bounded by n anyways! - if G::g_pow(curr) == vote_result { - tally = i; - } - - curr = curr + G::Scalar::ONE; - } - - let mut tally_votes_state_ret = state.clone(); - tally_votes_state_ret.tally = tally; - - Ok((A::accept(), tally_votes_state_ret)) -} - -// https://github.com/stonecoldpat/anonymousvoting +// // https://crypto.stanford.edu/cs355/19sp/lec5.pdf +// pub fn schnorr_zkp_validate(h: G, pi: SchnorrZKPCommit) -> bool { +// pi.schnorr_zkp_c == G::hash(vec![G::generator(), h, pi.schnorr_zkp_u]) +// && (G::g_pow(pi.schnorr_zkp_z) == (pi.schnorr_zkp_u + G::pow(h, pi.schnorr_zkp_c))) +// } + +// // #[derive(SchemaType, Clone, Copy)] +// // pub struct OrZKPCommit { +// // pub or_zkp_x: G, +// // pub or_zkp_y: G, +// // pub or_zkp_a1: G, +// // pub or_zkp_b1: G, +// // pub or_zkp_a2: G, +// // pub or_zkp_b2: G, + +// // pub or_zkp_c: G::Scalar, + +// // pub or_zkp_d1: G::Scalar, +// // pub or_zkp_d2: G::Scalar, + +// // pub or_zkp_r1: G::Scalar, +// // pub or_zkp_r2: G::Scalar, +// // } + +// // /** Cramer, Damgård and Schoenmakers (CDS) technique */ +// // pub fn zkp_one_out_of_two( +// // w: G::Scalar, // random +// // rand_r: G::Scalar, +// // rand_d: G::Scalar, +// // h: G, +// // xi: G::Scalar, +// // vi: bool, +// // ) -> OrZKPCommit { +// // if vi { +// // let r1 = rand_r; +// // let d1 = rand_d; + +// // let x = G::g_pow(xi); +// // let y = G::pow(h, xi) + G::generator(); + +// // let a1 = G::g_pow(r1) + G::pow(x, d1); +// // let b1 = G::pow(h, r1) + G::pow(y, d1); + +// // let a2 = G::g_pow(w); +// // let b2 = G::pow(h, w); + +// // let c = G::hash(vec![x, y, a1, b1, a2, b2]); + +// // let d2 = c - d1; +// // let r2 = w - xi * d2; + +// // OrZKPCommit { +// // or_zkp_x: x, +// // or_zkp_y: y, +// // or_zkp_a1: a1, +// // or_zkp_b1: b1, +// // or_zkp_a2: a2, +// // or_zkp_b2: b2, +// // or_zkp_c: c, +// // or_zkp_d1: d1, +// // or_zkp_d2: d2, +// // or_zkp_r1: r1, +// // or_zkp_r2: r2, +// // } +// // } else { +// // let r2 = rand_r; +// // let d2 = rand_d; + +// // let x = G::g_pow(xi); +// // let y = G::pow(h, xi); + +// // let a1 = G::g_pow(w); +// // let b1 = G::pow(h, w); + +// // let a2 = G::g_pow(r2) + G::pow(x, d2); +// // let b2 = G::pow(h, r2) + G::pow(G::div(y, G::generator()), d2); + +// // let c = G::hash(vec![x, y, a1, b1, a2, b2]); + +// // let d1 = c - d2; +// // let r1 = w - xi * d1; + +// // OrZKPCommit { +// // or_zkp_x: x, +// // or_zkp_y: y, +// // or_zkp_a1: a1, +// // or_zkp_b1: b1, +// // or_zkp_a2: a2, +// // or_zkp_b2: b2, +// // or_zkp_c: c, +// // or_zkp_d1: d1, +// // or_zkp_d2: d2, +// // or_zkp_r1: r1, +// // or_zkp_r2: r2, +// // } +// // } +// // } + +// // // Anonymous voting by two-round public discussion +// // pub fn zkp_one_out_of_two_validate(h: G, zkp: OrZKPCommit) -> bool { +// // let c = G::hash(vec![ +// // zkp.or_zkp_x, +// // zkp.or_zkp_y, +// // zkp.or_zkp_a1, +// // zkp.or_zkp_b1, +// // zkp.or_zkp_a2, +// // zkp.or_zkp_b2, +// // ]); // TODO: add i + +// // c == zkp.or_zkp_d1 + zkp.or_zkp_d2 +// // && zkp.or_zkp_a1 == G::g_pow(zkp.or_zkp_r1) + G::pow(zkp.or_zkp_x, zkp.or_zkp_d1) +// // && zkp.or_zkp_b1 == G::pow(h, zkp.or_zkp_r1) + G::pow(zkp.or_zkp_y, zkp.or_zkp_d1) +// // && zkp.or_zkp_a2 == G::g_pow(zkp.or_zkp_r2) + G::pow(zkp.or_zkp_x, zkp.or_zkp_d2) +// // && zkp.or_zkp_b2 +// // == G::pow(h, zkp.or_zkp_r2) +// // + G::pow(G::div(zkp.or_zkp_y, G::generator()), zkp.or_zkp_d2) +// // } + +// // pub fn commit_to(g_pow_xi_yi_vi: G) -> G::Scalar { +// // G::hash(vec![g_pow_xi_yi_vi]) +// // } + +// // pub fn check_commitment(g_pow_xi_yi_vi: G, commitment: G::Scalar) -> bool { +// // G::hash(vec![g_pow_xi_yi_vi]) == commitment +// // } + +// // #[hax::contract_state(contract = "OVN")] +// // // #[cfg_attr(not(feature = "hax_compilation"), contract_state(contract = "OVN"))] +// // #[derive(SchemaType, Clone, Copy)] +// // pub struct OvnContractState { +// // pub g_pow_xis: [G; n], +// // pub zkp_xis: [SchnorrZKPCommit; n], + +// // pub commit_vis: [G::Scalar; n], + +// // pub g_pow_xi_yi_vis: [G; n], +// // pub zkp_vis: [OrZKPCommit; n], + +// // pub tally: u32, +// // } + +// // #[hax::init(contract = "OVN")] +// // // #[cfg_attr(not(feature = "hax_compilation"), init(contract = "OVN"))] +// // pub fn init_ovn_contract(// _: &impl HasInitContext, +// // ) -> InitResult> { +// // Ok(OvnContractState:: { +// // g_pow_xis: [G::identity(); n], +// // zkp_xis: [SchnorrZKPCommit:: { +// // schnorr_zkp_u: G::identity(), +// // schnorr_zkp_z: G::Scalar::ZERO, +// // schnorr_zkp_c: G::Scalar::ZERO, +// // }; n], + +// // commit_vis: [G::Scalar::ZERO; n], + +// // g_pow_xi_yi_vis: [G::identity(); n], +// // zkp_vis: [OrZKPCommit:: { +// // or_zkp_x: G::identity(), +// // or_zkp_y: G::identity(), +// // or_zkp_a1: G::identity(), +// // or_zkp_b1: G::identity(), +// // or_zkp_a2: G::identity(), +// // or_zkp_b2: G::identity(), + +// // or_zkp_c: G::Scalar::ZERO, + +// // or_zkp_d1: G::Scalar::ZERO, +// // or_zkp_d2: G::Scalar::ZERO, + +// // or_zkp_r1: G::Scalar::ZERO, +// // or_zkp_r2: G::Scalar::ZERO, +// // }; n], + +// // tally: 0, +// // }) +// // } + +// // use core::marker::PhantomData; +// // #[derive(SchemaType)] +// // pub struct RegisterParam + Into> { +// // pub rp_i: u32, +// // pub rp_xi: Z, +// // pub rp_zkp_random: Z, +// // pub phantom: PhantomData, +// // } + +// // impl + Into> Serial for RegisterParam { +// // fn serial(&self, w: &mut W) -> Result<(), ::Err> { +// // self.rp_i.serial(w)?; +// // >::from(self.rp_xi).serial(w)?; +// // >::from(self.rp_zkp_random).serial(w)?; +// // Ok(()) +// // } +// // } + +// // impl + Into> Deserial for RegisterParam { +// // fn deserial(r: &mut R) -> Result { +// // let rp_i: u32 = r.get()?; +// // let rp_xi: Z = >::into(r.get()?); +// // let rp_zkp_random: Z = >::into(r.get()?); +// // Ok(RegisterParam { +// // rp_i, +// // rp_xi, +// // rp_zkp_random, +// // phantom: PhantomData, +// // }) +// // } +// // } + +// // /** Primary function in round 1 */ +// // #[hax::receive(contract = "OVN", name = "register", parameter = "RegisterParam")] +// // // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "register", parameter = "RegisterParam"))] +// // pub fn register_vote< +// // G: MGroup, +// // S: Serialize + From + Into, +// // const n: usize, +// // A: HasActions, +// // >( +// // ctx: impl HasReceiveContext, +// // state: OvnContractState, +// // ) -> Result<(A, OvnContractState), ParseError> { +// // let params: RegisterParam = ctx.parameter_cursor().get()?; +// // let g_pow_xi = G::g_pow(params.rp_xi); + +// // let zkp_xi = schnorr_zkp::(params.rp_zkp_random, g_pow_xi, params.rp_xi); + +// // let mut register_vote_state_ret = state.clone(); +// // register_vote_state_ret.g_pow_xis[params.rp_i as usize] = g_pow_xi; +// // register_vote_state_ret.zkp_xis[params.rp_i as usize] = zkp_xi; + +// // Ok((A::accept(), register_vote_state_ret)) +// // } + +// // #[derive(SchemaType)] +// // pub struct CastVoteParam + Into> { +// // pub cvp_i: u32, +// // pub cvp_xi: Z, +// // pub cvp_zkp_random_w: Z, +// // pub cvp_zkp_random_r: Z, +// // pub cvp_zkp_random_d: Z, +// // pub cvp_vote: bool, +// // pub phantom: PhantomData, +// // } + +// // impl + Into> Serial for CastVoteParam { +// // fn serial(&self, w: &mut W) -> Result<(), ::Err> { +// // self.cvp_i.serial(w)?; +// // >::from(self.cvp_xi).serial(w)?; +// // >::from(self.cvp_zkp_random_w).serial(w)?; +// // >::from(self.cvp_zkp_random_r).serial(w)?; +// // >::from(self.cvp_zkp_random_d).serial(w)?; +// // self.cvp_vote.serial(w)?; +// // Ok(()) +// // } +// // } + +// // impl + Into> Deserial for CastVoteParam { +// // fn deserial(r: &mut R) -> Result { +// // let cvp_i: u32 = r.get()?; +// // let cvp_xi: Z = >::into(r.get()?); +// // let cvp_zkp_random_w: Z = >::into(r.get()?); +// // let cvp_zkp_random_r: Z = >::into(r.get()?); +// // let cvp_zkp_random_d: Z = >::into(r.get()?); +// // let cvp_vote: bool = r.get()?; +// // Ok(CastVoteParam { +// // cvp_i, +// // cvp_xi, +// // cvp_zkp_random_w, +// // cvp_zkp_random_r, +// // cvp_zkp_random_d, +// // cvp_vote, +// // phantom: PhantomData, +// // }) +// // } +// // } + +// // pub fn compute_g_pow_yi(i: usize, xis: [G; n]) -> G { +// // let mut prod1 = G::identity(); +// // for j in 0..i { +// // prod1 = prod1 + xis[j]; +// // } + +// // let mut prod2 = G::identity(); +// // for j in (i + 1)..n { +// // prod2 = prod2 + xis[j]; +// // } + +// // // implicitly: Y_i = g^y_i +// // let g_pow_yi = G::div(prod1, prod2); +// // g_pow_yi +// // } + +// // pub fn compute_group_element_for_vote(xi: G::Scalar, vote: bool, g_pow_yi: G) -> G { +// // G::pow(g_pow_yi, xi) +// // + G::g_pow(if vote { +// // G::Scalar::ONE +// // } else { +// // G::Scalar::ZERO +// // }) +// // } + +// // /** Commitment before round 2 */ +// // #[hax::receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] +// // // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam"))] +// // pub fn commit_to_vote< +// // G: MGroup, +// // S: Serialize + From + Into, +// // const n: usize, +// // A: HasActions, +// // >( +// // ctx: impl HasReceiveContext, +// // state: OvnContractState, +// // ) -> Result<(A, OvnContractState), ParseError> { +// // let params: CastVoteParam = ctx.parameter_cursor().get()?; + +// // for i in 0..n { +// // if !schnorr_zkp_validate(state.g_pow_xis[i], state.zkp_xis[i]) { +// // return Err(ParseError {}); +// // } +// // } + +// // let g_pow_yi = compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); +// // let g_pow_xi_yi_vi = +// // compute_group_element_for_vote::(params.cvp_xi, params.cvp_vote, g_pow_yi); +// // let commit_vi = commit_to::(g_pow_xi_yi_vi); + +// // let mut commit_to_vote_state_ret = state.clone(); +// // commit_to_vote_state_ret.commit_vis[params.cvp_i as usize] = commit_vi; +// // Ok((A::accept(), commit_to_vote_state_ret)) +// // } + +// // /** Primary function in round 2, also opens commitment */ +// // #[hax::receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] +// // // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam"))] +// // pub fn cast_vote< +// // G: MGroup, +// // S: Serialize + From + Into, +// // const n: usize, +// // A: HasActions, +// // >( +// // ctx: impl HasReceiveContext, +// // state: OvnContractState, +// // ) -> Result<(A, OvnContractState), ParseError> { +// // let params: CastVoteParam = ctx.parameter_cursor().get()?; + +// // let g_pow_yi = compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); +// // let g_pow_xi_yi_vi = +// // compute_group_element_for_vote::(params.cvp_xi, params.cvp_vote, g_pow_yi); + +// // let zkp_vi = zkp_one_out_of_two::( +// // params.cvp_zkp_random_w, +// // params.cvp_zkp_random_r, +// // params.cvp_zkp_random_d, +// // g_pow_yi, +// // params.cvp_xi, +// // params.cvp_vote, +// // ); +// // let mut cast_vote_state_ret = state.clone(); +// // cast_vote_state_ret.g_pow_xi_yi_vis[params.cvp_i as usize] = g_pow_xi_yi_vi; +// // cast_vote_state_ret.zkp_vis[params.cvp_i as usize] = zkp_vi; + +// // Ok((A::accept(), cast_vote_state_ret)) +// // } + +// // #[derive(Serialize, SchemaType)] +// // pub struct TallyParameter {} + +// // #[hax::receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] +// // // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "tally", parameter = "TallyParameter"))] +// // /** Anyone can tally the votes */ +// // pub fn tally_votes( +// // _: impl HasReceiveContext, +// // state: OvnContractState, +// // ) -> Result<(A, OvnContractState), ParseError> { +// // for i in 0..n { +// // let g_pow_yi = compute_g_pow_yi::(i as usize, state.g_pow_xis); +// // if !zkp_one_out_of_two_validate::(g_pow_yi, state.zkp_vis[i]) { +// // return Err(ParseError {}); +// // } +// // if !check_commitment::(state.g_pow_xi_yi_vis[i], state.commit_vis[i]) { +// // return Err(ParseError {}); +// // } +// // } + +// // let mut vote_result = G::identity(); +// // for g_pow_vote in state.g_pow_xi_yi_vis { +// // vote_result = vote_result + g_pow_vote; +// // } + +// // let mut tally = 0; +// // let mut curr = G::Scalar::ZERO; +// // for i in 0..n as u32 { +// // // Should be while, but is bounded by n anyways! +// // if G::g_pow(curr) == vote_result { +// // tally = i; +// // } + +// // curr = curr + G::Scalar::ONE; +// // } + +// // let mut tally_votes_state_ret = state.clone(); +// // tally_votes_state_ret.tally = tally; + +// // Ok((A::accept(), tally_votes_state_ret)) +// // } + +// // // https://github.com/stonecoldpat/anonymousvoting diff --git a/ovn/src/ovn_zkgroup_specific.rs b/ovn/src/ovn_zkgroup_specific.rs new file mode 100644 index 0000000..c9ac40e --- /dev/null +++ b/ovn/src/ovn_zkgroup_specific.rs @@ -0,0 +1,457 @@ +#[hax_lib_macros::exclude] +use hax_lib_macros::*; + +#[exclude] +use hacspec_concordium::*; +#[exclude] +use hacspec_concordium_derive::*; + +use group::{ + ff::{Field}, + Group, +}; + + +use bls12_381::Gt; +type G = Gt; +type Z = ::Scalar; + +pub fn hash(_inp: Vec) -> Z { + Z::one() +} + +//////////////////// +// Implementation // +//////////////////// + +#[derive(SchemaType, Clone, Copy)] +pub struct SchnorrZKPCommit { + pub schnorr_zkp_u: G, + pub schnorr_zkp_c: Z, + pub schnorr_zkp_z: Z, +} + +/** Non-interactive Schnorr proof using Fiat-Shamir heuristics (RFC 8235) */ +// https://www.rfc-editor.org/rfc/rfc8235 +// https://crypto.stanford.edu/cs355/19sp/lec5.pdf +pub fn schnorr_zkp( + r: Z, // random + h: G, + x: Z, +) -> SchnorrZKPCommit { + let u = ::generator() * r; // g ^ r + let c = hash(vec![::generator(), h, u]); + let z = r + (c * x); + + return SchnorrZKPCommit { + schnorr_zkp_u: u, + schnorr_zkp_c: c, + schnorr_zkp_z: z, + }; +} + +// https://crypto.stanford.edu/cs355/19sp/lec5.pdf +pub fn schnorr_zkp_validate(h: G, pi: SchnorrZKPCommit) -> bool { + pi.schnorr_zkp_c == hash(vec![::generator(), h, pi.schnorr_zkp_u]) + && (::generator() * pi.schnorr_zkp_z + == (pi.schnorr_zkp_u + (h * pi.schnorr_zkp_c))) +} + +#[derive(SchemaType, Clone, Copy)] +pub struct OrZKPCommit { + pub or_zkp_x: G, + pub or_zkp_y: G, + pub or_zkp_a1: G, + pub or_zkp_b1: G, + pub or_zkp_a2: G, + pub or_zkp_b2: G, + + pub or_zkp_c: Z, + + pub or_zkp_d1: Z, + pub or_zkp_d2: Z, + + pub or_zkp_r1: Z, + pub or_zkp_r2: Z, +} + +/** Cramer, Damgård and Schoenmakers (CDS) technique */ +pub fn zkp_one_out_of_two( + w: Z, // random + rand_r: Z, + rand_d: Z, + h: G, + xi: Z, + vi: bool, +) -> OrZKPCommit { + if vi { + let r1 = rand_r; + let d1 = rand_d; + + let x = ::generator() * (xi); + let y = (h * xi) + ::generator(); + + let a1 = ::generator() * (r1) + (x * d1); + let b1 = (h * r1) + (y * d1); + + let a2 = ::generator() * (w); + let b2 = h * w; + + let c = hash(vec![x, y, a1, b1, a2, b2]); + + let d2 = c - d1; + let r2 = w - xi * d2; + + OrZKPCommit { + or_zkp_x: x, + or_zkp_y: y, + or_zkp_a1: a1, + or_zkp_b1: b1, + or_zkp_a2: a2, + or_zkp_b2: b2, + or_zkp_c: c, + or_zkp_d1: d1, + or_zkp_d2: d2, + or_zkp_r1: r1, + or_zkp_r2: r2, + } + } else { + let r2 = rand_r; + let d2 = rand_d; + + let x = ::generator() * (xi); + let y = h * xi; + + let a1 = ::generator() * (w); + let b1 = h * w; + + let a2 = ::generator() * (r2) + (x * d2); + let b2 = (h * r2) + ((y - ::generator()) * d2); + + let c = hash(vec![x, y, a1, b1, a2, b2]); + + let d1 = c - d2; + let r1 = w - xi * d1; + + OrZKPCommit { + or_zkp_x: x, + or_zkp_y: y, + or_zkp_a1: a1, + or_zkp_b1: b1, + or_zkp_a2: a2, + or_zkp_b2: b2, + or_zkp_c: c, + or_zkp_d1: d1, + or_zkp_d2: d2, + or_zkp_r1: r1, + or_zkp_r2: r2, + } + } +} + +// Anonymous voting by two-round public discussion +pub fn zkp_one_out_of_two_validate(h: G, zkp: OrZKPCommit) -> bool { + let c = hash(vec![ + zkp.or_zkp_x, + zkp.or_zkp_y, + zkp.or_zkp_a1, + zkp.or_zkp_b1, + zkp.or_zkp_a2, + zkp.or_zkp_b2, + ]); // TODO: add i + + c == zkp.or_zkp_d1 + zkp.or_zkp_d2 + && zkp.or_zkp_a1 + == ::generator() * (zkp.or_zkp_r1) + (zkp.or_zkp_x * zkp.or_zkp_d1) + && zkp.or_zkp_b1 == (h * zkp.or_zkp_r1) + (zkp.or_zkp_y * zkp.or_zkp_d1) + && zkp.or_zkp_a2 + == ::generator() * (zkp.or_zkp_r2) + (zkp.or_zkp_x * zkp.or_zkp_d2) + && zkp.or_zkp_b2 + == (h * zkp.or_zkp_r2) + ((zkp.or_zkp_y - ::generator()) * zkp.or_zkp_d2) +} + +pub fn commit_to(g_pow_xi_yi_vi: G) -> Z { + hash(vec![g_pow_xi_yi_vi]) +} + +pub fn check_commitment(g_pow_xi_yi_vi: G, commitment: Z) -> bool { + hash(vec![g_pow_xi_yi_vi]) == commitment +} + +#[hax::contract_state(contract = "OVN")] +// #[cfg_attr(not(feature = "hax_compilation"), contract_state(contract = "OVN"))] +#[derive(SchemaType, Clone, Copy)] +pub struct OvnContractState { + pub g_pow_xis: [G; n], + pub zkp_xis: [SchnorrZKPCommit; n], + + pub commit_vis: [Z; n], + + pub g_pow_xi_yi_vis: [G; n], + pub zkp_vis: [OrZKPCommit; n], + + pub tally: u32, +} + +#[hax::init(contract = "OVN")] +// #[cfg_attr(not(feature = "hax_compilation"), init(contract = "OVN"))] +pub fn init_ovn_contract(// _: &impl HasInitContext, +) -> InitResult> { + Ok(OvnContractState:: { + g_pow_xis: [::identity(); n], + zkp_xis: [SchnorrZKPCommit { + schnorr_zkp_u: ::identity(), + schnorr_zkp_z: Z::ZERO, + schnorr_zkp_c: Z::ZERO, + }; n], + + commit_vis: [Z::ZERO; n], + + g_pow_xi_yi_vis: [::identity(); n], + zkp_vis: [OrZKPCommit { + or_zkp_x: ::identity(), + or_zkp_y: ::identity(), + or_zkp_a1: ::identity(), + or_zkp_b1: ::identity(), + or_zkp_a2: ::identity(), + or_zkp_b2: ::identity(), + + or_zkp_c: Z::ZERO, + + or_zkp_d1: Z::ZERO, + or_zkp_d2: Z::ZERO, + + or_zkp_r1: Z::ZERO, + or_zkp_r2: Z::ZERO, + }; n], + + tally: 0, + }) +} + +use core::marker::PhantomData; +#[derive(SchemaType)] +pub struct RegisterParam + Into> { + pub rp_i: u32, + pub rp_xi: Z, + pub rp_zkp_random: Z, + pub phantom: PhantomData, +} + +impl + Into> Serial for RegisterParam { + fn serial(&self, w: &mut W) -> Result<(), ::Err> { + self.rp_i.serial(w)?; + >::from(self.rp_xi).serial(w)?; + >::from(self.rp_zkp_random).serial(w)?; + Ok(()) + } +} + +impl + Into> Deserial for RegisterParam { + fn deserial(r: &mut R) -> Result { + let rp_i: u32 = r.get()?; + let rp_xi: Z = >::into(r.get()?); + let rp_zkp_random: Z = >::into(r.get()?); + Ok(RegisterParam { + rp_i, + rp_xi, + rp_zkp_random, + phantom: PhantomData, + }) + } +} + +/** Primary function in round 1 */ +#[hax::receive(contract = "OVN", name = "register", parameter = "RegisterParam")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "register", parameter = "RegisterParam"))] +pub fn register_vote< + S: Serialize + From + Into, + const n: usize, + A: HasActions, +>( + ctx: impl HasReceiveContext, + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { + let params: RegisterParam = ctx.parameter_cursor().get()?; + let g_pow_xi = ::generator() * (params.rp_xi); + + let zkp_xi = schnorr_zkp(params.rp_zkp_random, g_pow_xi, params.rp_xi); + + let mut register_vote_state_ret = state.clone(); + register_vote_state_ret.g_pow_xis[params.rp_i as usize] = g_pow_xi; + register_vote_state_ret.zkp_xis[params.rp_i as usize] = zkp_xi; + + Ok((A::accept(), register_vote_state_ret)) +} + +#[derive(SchemaType)] +pub struct CastVoteParam + Into> { + pub cvp_i: u32, + pub cvp_xi: Z, + pub cvp_zkp_random_w: Z, + pub cvp_zkp_random_r: Z, + pub cvp_zkp_random_d: Z, + pub cvp_vote: bool, + pub phantom: PhantomData, +} + +impl + Into> Serial for CastVoteParam { + fn serial(&self, w: &mut W) -> Result<(), ::Err> { + self.cvp_i.serial(w)?; + >::from(self.cvp_xi).serial(w)?; + >::from(self.cvp_zkp_random_w).serial(w)?; + >::from(self.cvp_zkp_random_r).serial(w)?; + >::from(self.cvp_zkp_random_d).serial(w)?; + self.cvp_vote.serial(w)?; + Ok(()) + } +} + +impl + Into> Deserial for CastVoteParam { + fn deserial(r: &mut R) -> Result { + let cvp_i: u32 = r.get()?; + let cvp_xi: Z = >::into(r.get()?); + let cvp_zkp_random_w: Z = >::into(r.get()?); + let cvp_zkp_random_r: Z = >::into(r.get()?); + let cvp_zkp_random_d: Z = >::into(r.get()?); + let cvp_vote: bool = r.get()?; + Ok(CastVoteParam { + cvp_i, + cvp_xi, + cvp_zkp_random_w, + cvp_zkp_random_r, + cvp_zkp_random_d, + cvp_vote, + phantom: PhantomData, + }) + } +} + +pub fn compute_g_pow_yi(i: usize, xis: [G; n]) -> G { + let mut prod1 = ::identity(); + for j in 0..i { + prod1 = prod1 + xis[j]; + } + + let mut prod2 = ::identity(); + for j in (i + 1)..n { + prod2 = prod2 + xis[j]; + } + + // implicitly: Y_i = g^y_i + let g_pow_yi = prod1 - prod2; + g_pow_yi +} + +pub fn compute_group_element_for_vote(xi: Z, vote: bool, g_pow_yi: G) -> G { + (g_pow_yi * xi) + + ::generator() + * (if vote { + Z::ONE + } else { + Z::ZERO + }) +} + +/** Commitment before round 2 */ +#[hax::receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam"))] +pub fn commit_to_vote< + S: Serialize + From + Into, + const n: usize, + A: HasActions, +>( + ctx: impl HasReceiveContext, + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { + let params: CastVoteParam = ctx.parameter_cursor().get()?; + + for i in 0..n { + if !schnorr_zkp_validate(state.g_pow_xis[i], state.zkp_xis[i]) { + return Err(ParseError {}); + } + } + + let g_pow_yi = compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); + let g_pow_xi_yi_vi = compute_group_element_for_vote(params.cvp_xi, params.cvp_vote, g_pow_yi); + let commit_vi = commit_to(g_pow_xi_yi_vi); + + let mut commit_to_vote_state_ret = state.clone(); + commit_to_vote_state_ret.commit_vis[params.cvp_i as usize] = commit_vi; + Ok((A::accept(), commit_to_vote_state_ret)) +} + +/** Primary function in round 2, also opens commitment */ +#[hax::receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam"))] +pub fn cast_vote< + S: Serialize + From + Into, + const n: usize, + A: HasActions, +>( + ctx: impl HasReceiveContext, + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { + let params: CastVoteParam = ctx.parameter_cursor().get()?; + + let g_pow_yi = compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); + let g_pow_xi_yi_vi = compute_group_element_for_vote(params.cvp_xi, params.cvp_vote, g_pow_yi); + + let zkp_vi = zkp_one_out_of_two( + params.cvp_zkp_random_w, + params.cvp_zkp_random_r, + params.cvp_zkp_random_d, + g_pow_yi, + params.cvp_xi, + params.cvp_vote, + ); + let mut cast_vote_state_ret = state.clone(); + cast_vote_state_ret.g_pow_xi_yi_vis[params.cvp_i as usize] = g_pow_xi_yi_vi; + cast_vote_state_ret.zkp_vis[params.cvp_i as usize] = zkp_vi; + + Ok((A::accept(), cast_vote_state_ret)) +} + +#[derive(Serialize, SchemaType)] +pub struct TallyParameter {} + +#[hax::receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] +// #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "tally", parameter = "TallyParameter"))] +/** Anyone can tally the votes */ +pub fn tally_votes( + _: impl HasReceiveContext, + state: OvnContractState, +) -> Result<(A, OvnContractState), ParseError> { + for i in 0..n { + let g_pow_yi = compute_g_pow_yi::(i as usize, state.g_pow_xis); + if !zkp_one_out_of_two_validate(g_pow_yi, state.zkp_vis[i]) { + return Err(ParseError {}); + } + if !check_commitment(state.g_pow_xi_yi_vis[i], state.commit_vis[i]) { + return Err(ParseError {}); + } + } + + let mut vote_result = ::identity(); + for g_pow_vote in state.g_pow_xi_yi_vis { + vote_result = vote_result + g_pow_vote; + } + + let mut tally = 0; + let mut curr = Z::ZERO; + for i in 0..n as u32 { + // Should be while, but is bounded by n anyways! + if ::generator() * (curr) == vote_result { + tally = i; + } + + curr = curr + Z::ONE; + } + + let mut tally_votes_state_ret = state.clone(); + tally_votes_state_ret.tally = tally; + + Ok((A::accept(), tally_votes_state_ret)) +} + +// https://github.com/stonecoldpat/anonymousvoting diff --git a/ovn/tests/ovn_example.rs b/ovn/tests/ovn_example.rs index d95a014..fb0aabb 100644 --- a/ovn/tests/ovn_example.rs +++ b/ovn/tests/ovn_example.rs @@ -26,48 +26,32 @@ pub use hacspec_ovn::ovn_group::*; pub use hacspec_ovn::ovn_secp256k1::*; pub use hacspec_ovn::ovn_z_89::*; -#[test] -pub fn schorr_zkp_correctness() { - fn test(random_x: u32, random_r: u32) -> bool { - type Z = z_89; - type G = g_z_89; - - let x: u32 = Z::random_field_elem(random_x); +#[cfg(test)] +pub fn schnorr_zkp_correctness(random_x: u32, random_r: u32) -> bool { + let x: G::Z = G::Z::random_field_elem(random_x); let pow_x = G::g_pow(x); - let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); + let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); - let valid = schnorr_zkp_validate::(pow_x, pi); + let valid = schnorr_zkp_validate::(pow_x, pi); valid - } +} +pub fn schnorr_zkp_z_89_correctness() { QuickCheck::new() .tests(10000) - .quickcheck(test as fn(u32, u32) -> bool) + .quickcheck(schnorr_zkp_correctness:: as fn(u32, u32) -> bool) } #[test] pub fn schorr_zkp_secp256k1_correctness() { - fn test(random_x: u32, random_r: u32) -> bool { - type Z = Z_curve; - type G = Group_curve; - - let x: Z_curve = Z::random_field_elem(random_x); - let pow_x = G::g_pow(x); - - let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); - - let valid = schnorr_zkp_validate::(pow_x, pi); - valid - } - QuickCheck::new() .tests(10) - .quickcheck(test as fn(u32, u32) -> bool) + .quickcheck(schnorr_zkp_correctness:: as fn(u32, u32) -> bool) } #[cfg(test)] -pub fn or_zkp_correctness>( +pub fn or_zkp_correctness( random_w: u32, random_r: u32, random_d: u32, @@ -75,10 +59,10 @@ pub fn or_zkp_correctness>( random_x: u32, v: bool, ) -> bool { - let mut h = G::g_pow(Z::random_field_elem(random_h)); - let x = Z::random_field_elem(random_x); - let pi: OrZKPCommit = zkp_one_out_of_two(random_w, random_r, random_d, h, x, v); - let valid = zkp_one_out_of_two_validate::(h, pi); + let mut h = G::g_pow(G::Z::random_field_elem(random_h)); + let x = G::Z::random_field_elem(random_x); + let pi: OrZKPCommit = zkp_one_out_of_two(random_w, random_r, random_d, h, x, v); + let valid = zkp_one_out_of_two_validate::(h, pi); valid } @@ -86,30 +70,30 @@ pub fn or_zkp_correctness>( pub fn or_zkp_correctness_z89() { QuickCheck::new() .tests(10000) - .quickcheck(or_zkp_correctness:: as fn(u32, u32, u32, u32, u32, bool) -> bool) + .quickcheck(or_zkp_correctness:: as fn(u32, u32, u32, u32, u32, bool) -> bool) } #[test] // TODO: Fix inverse opeation, should make this test parse pub fn or_zkp_secp256k1_correctness() { QuickCheck::new().tests(10).quickcheck( - or_zkp_correctness:: as fn(u32, u32, u32, u32, u32, bool) -> bool, + or_zkp_correctness:: as fn(u32, u32, u32, u32, u32, bool) -> bool, ) } #[cfg(test)] -pub fn sum_to_zero, const n: usize>() { - let mut xis: [Z::field_type; n] = [Z::field_zero(); n]; - let mut g_pow_xis: [G::group_type; n] = [G::group_one(); n]; +pub fn sum_to_zero() { + let mut xis: [G::Z; n] = [G::Z::field_zero(); n]; + let mut g_pow_xis: [G; n] = [G::group_one(); n]; use rand::random; for i in 0..n { - xis[i] = Z::random_field_elem(random()); + xis[i] = G::Z::random_field_elem(random()); g_pow_xis[i] = G::g_pow(xis[i]); } let mut res = G::group_one(); for i in 0..n { - let g_pow_yi = compute_g_pow_yi::(i, g_pow_xis); + let g_pow_yi = compute_g_pow_yi::(i, g_pow_xis); res = G::prod(res, G::pow(g_pow_yi, xis[i])); } @@ -118,18 +102,62 @@ pub fn sum_to_zero, const n: usize>() { #[test] pub fn sum_to_zero_z89() { - sum_to_zero::() + sum_to_zero::() } #[test] pub fn sum_to_zero_secp256k1() { - sum_to_zero::() + sum_to_zero::() +} + +use rand::random; + + +#[derive(Copy, Clone, hacspec_concordium::Serial, hacspec_concordium::Deserial)] +pub struct ElemOfEach { + i : u32, + z : G::Z, + g : G, } #[cfg(test)] -pub fn test_correctness, const n: usize, A: HasActions>( +pub fn test_params_of_group< + G: Group, + A: HasActions, + >() { + // Setup the context + let mut ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); + let parameter = ElemOfEach:: { + i: random(), + z: G::Z::random_field_elem(random()), + g: G::g_pow(G::Z::random_field_elem(random())), + }; + let parameter_bytes = to_bytes(¶meter); + let ctx_params = ctx.clone().set_parameter(¶meter_bytes); + let param_back: Result, ParseError> = + ctx_params.parameter_cursor().get(); + assert!(param_back.is_ok()); + + let wu_param = param_back.unwrap(); + assert!(wu_param.i == parameter.i); + assert!(wu_param.z == parameter.z); + assert!(wu_param.g == parameter.g); +} + +#[test] +pub fn test_params_of_group_z89() { + test_params_of_group::() +} + +#[test] +pub fn test_params_of_group_secp256k1() { + test_params_of_group::() +} + +#[cfg(test)] +pub fn test_correctness( votes: [bool; n], - xis: [Z::field_type; n], + xis: [G::Z; n], rp_zkp_randoms: [u32; n], cvp_zkp_random_ws1: [u32; n], cvp_zkp_random_rs1: [u32; n], @@ -141,22 +169,22 @@ pub fn test_correctness, const n: usize, A: HasActions>( // Setup the context let mut ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); - let mut state: OvnContractState = init_ovn_contract().unwrap(); + let mut state: OvnContractState = init_ovn_contract().unwrap(); for i in 0..n { - let parameter = RegisterParam:: { + let parameter = RegisterParam:: { rp_i: i as u32, rp_xi: xis[i], rp_zkp_random: rp_zkp_randoms[i], }; let parameter_bytes = to_bytes(¶meter); (_, state) = - register_vote::(ctx.clone().set_parameter(¶meter_bytes), state) + register_vote::(ctx.clone().set_parameter(¶meter_bytes), state) .unwrap(); } for i in 0..n { - let parameter = CastVoteParam:: { + let parameter = CastVoteParam:: { cvp_i: i as u32, cvp_xi: xis[i], cvp_zkp_random_w: cvp_zkp_random_ws1[i], @@ -166,12 +194,12 @@ pub fn test_correctness, const n: usize, A: HasActions>( }; let parameter_bytes = to_bytes(¶meter); (_, state) = - commit_to_vote::(ctx.clone().set_parameter(¶meter_bytes), state) + commit_to_vote::(ctx.clone().set_parameter(¶meter_bytes), state) .unwrap(); } for i in 0..n { - let parameter = CastVoteParam:: { + let parameter = CastVoteParam:: { cvp_i: i as u32, cvp_xi: xis[i], cvp_zkp_random_w: cvp_zkp_random_ws2[i], @@ -181,19 +209,19 @@ pub fn test_correctness, const n: usize, A: HasActions>( }; let parameter_bytes = to_bytes(¶meter); (_, state) = - cast_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); + cast_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); } let parameter = TallyParameter {}; let parameter_bytes = to_bytes(¶meter); ctx = ctx.set_parameter(¶meter_bytes); - (_, state) = tally_votes::(ctx.clone(), state).unwrap(); + (_, state) = tally_votes::(ctx.clone(), state).unwrap(); let mut count = 0u32; for v in votes { if v { - count = count + 1; // += 1 does not work correctly + count = count + 1; } } @@ -202,10 +230,10 @@ pub fn test_correctness, const n: usize, A: HasActions>( } #[cfg(test)] -fn randomized_full_test, const n: usize>() -> bool { +fn randomized_full_test() -> bool { use rand::random; let mut votes: [bool; n] = [false; n]; - let mut xis: [Z::field_type; n] = [Z::field_zero(); n]; + let mut xis: [G::Z; n] = [G::Z::field_zero(); n]; let mut rp_zkp_randoms: [u32; n] = [0; n]; let mut cvp_zkp_random_ws1: [u32; n] = [0; n]; let mut cvp_zkp_random_rs1: [u32; n] = [0; n]; @@ -217,7 +245,7 @@ fn randomized_full_test, const n: usize>() -> bool { for i in 0..n { votes[i] = random(); - xis[i] = Z::random_field_elem(random()); + xis[i] = G::Z::random_field_elem(random()); rp_zkp_randoms[i] = random(); cvp_zkp_random_ws1[i] = random(); cvp_zkp_random_rs1[i] = random(); @@ -227,7 +255,7 @@ fn randomized_full_test, const n: usize>() -> bool { cvp_zkp_random_ds2[i] = random(); } - test_correctness::( + test_correctness::( votes, xis, rp_zkp_randoms, @@ -245,13 +273,13 @@ fn randomized_full_test, const n: usize>() -> bool { fn test_full_z89() { QuickCheck::new() .tests(100) - .quickcheck(randomized_full_test:: as fn() -> bool) + .quickcheck(randomized_full_test:: as fn() -> bool) } -// // #[concordium_test] -// #[test] -// fn test_full_secp256k1() { -// QuickCheck::new() -// .tests(1) -// .quickcheck(randomized_full_test:: as fn() -> bool) -// } +// #[concordium_test] +#[test] +fn test_full_secp256k1() { + QuickCheck::new() + .tests(1) + .quickcheck(randomized_full_test:: as fn() -> bool) +} diff --git a/ovn/tests/ovn_zk_example.rs b/ovn/tests/ovn_zk_example.rs index 5286407..b9b5664 100644 --- a/ovn/tests/ovn_zk_example.rs +++ b/ovn/tests/ovn_zk_example.rs @@ -15,10 +15,10 @@ extern crate quickcheck_macros; #[cfg(test)] use quickcheck::*; -pub use bls12_381::{*, Scalar as BlsScalar}; +pub use bls12_381::{Scalar as BlsScalar, *}; +use core::marker::PhantomData; pub use group::{ff::Field, Group}; pub use hacspec_ovn::{ovn_zk_secp256k1::*, ovn_zkgroup::*}; -use core::marker::PhantomData; use rand_core::{RngCore, *}; // use quickcheck::RngCore; @@ -34,7 +34,9 @@ struct GroupBits { impl From for GroupBits<32> { fn from(value: BlsScalar) -> Self { - Self { val: value.to_bytes() } + Self { + val: value.to_bytes(), + } } } @@ -46,10 +48,10 @@ impl Into for GroupBits<32> { impl From for GroupBits<32> { fn from(value: BipScalar) -> Self { - let mut val : [u8; 32] = [0u8; 32]; + let mut val: [u8; 32] = [0u8; 32]; let temp = value.to_be_bytes(); for i in 0..32 { -val[i] = temp[i]; + val[i] = temp[i]; } Self { val } } @@ -61,7 +63,6 @@ impl Into for GroupBits<32> { } } - //////////////////////////// // Group operations tests // //////////////////////////// @@ -175,8 +176,7 @@ pub fn test_params_of_group< G: MGroup, S: Serialize + From + Into, A: HasActions, ->() -{ +>() { // Setup the context let mut ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); let parameter = RegisterParam:: { @@ -199,13 +199,14 @@ pub fn test_params_of_group< #[test] pub fn test_params_of_group_zk259() { - test_params_of_group::, hacspec_concordium::test_infrastructure::ActionsTree>() + test_params_of_group::, hacspec_concordium::test_infrastructure::ActionsTree>( + ) } - #[test] pub fn test_params_of_group_bls12_381_real() { - test_params_of_group::, hacspec_concordium::test_infrastructure::ActionsTree>() + test_params_of_group::, hacspec_concordium::test_infrastructure::ActionsTree>( + ) } #[cfg(test)] @@ -224,8 +225,7 @@ pub fn test_correctness< cvp_zkp_random_ws2: [G::Scalar; n], cvp_zkp_random_rs2: [G::Scalar; n], cvp_zkp_random_ds2: [G::Scalar; n], -) -> bool -{ +) -> bool { // Setup the context let ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); @@ -236,13 +236,16 @@ pub fn test_correctness< rp_i: i as u32, rp_xi: xis[i], rp_zkp_random: rp_zkp_randoms[i], - phantom: PhantomData, + phantom: PhantomData, }; let parameter_bytes = to_bytes(¶meter); (_, state) = - register_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); + register_vote::(ctx.clone().set_parameter(¶meter_bytes), state) + .unwrap(); } + assert!(false, "Got here 2"); + for i in 0..n { let parameter = CastVoteParam:: { cvp_i: i as u32, @@ -251,11 +254,12 @@ pub fn test_correctness< cvp_zkp_random_r: cvp_zkp_random_rs1[i], cvp_zkp_random_d: cvp_zkp_random_ds1[i], cvp_vote: votes[i], - phantom: PhantomData, + phantom: PhantomData, }; let parameter_bytes = to_bytes(¶meter); (_, state) = - commit_to_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); + commit_to_vote::(ctx.clone().set_parameter(¶meter_bytes), state) + .unwrap(); } for i in 0..n { @@ -266,13 +270,15 @@ pub fn test_correctness< cvp_zkp_random_r: cvp_zkp_random_rs2[i], cvp_zkp_random_d: cvp_zkp_random_ds2[i], cvp_vote: votes[i], - phantom: PhantomData, + phantom: PhantomData, }; let parameter_bytes = to_bytes(¶meter); (_, state) = cast_vote::(ctx.clone().set_parameter(¶meter_bytes), state).unwrap(); } + assert!(false, "Got here 3"); + let parameter = TallyParameter {}; let parameter_bytes = to_bytes(¶meter); @@ -291,8 +297,11 @@ pub fn test_correctness< } #[cfg(test)] -fn randomized_full_test + Into, const n: usize>() -> bool -{ +fn randomized_full_test< + G: MGroup, + S: Serialize + From + Into, + const n: usize, +>() -> bool { let mut votes: [bool; n] = [false; n]; let mut xis: [G::Scalar; n] = [G::Scalar::ONE; n]; let mut rp_zkp_randoms: [G::Scalar; n] = [G::Scalar::ONE; n]; From 535b23410406723b8e5ce8929a2d19b9ed6b71d6 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Thu, 4 Jul 2024 11:43:55 +0200 Subject: [PATCH 83/86] Update randomness --- ovn/src/ovn_group.rs | 59 +++++++++++++++++--------------- ovn/src/ovn_secp256k1.rs | 58 ++++++++++++++++++-------------- ovn/src/ovn_traits.rs | 8 ++--- ovn/src/ovn_z_89.rs | 72 ++++++++++++++++++++++++---------------- ovn/tests/ovn_example.rs | 64 +++++++++++++++++++---------------- 5 files changed, 151 insertions(+), 110 deletions(-) diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs index 4b4f88e..d0a2c80 100644 --- a/ovn/src/ovn_group.rs +++ b/ovn/src/ovn_group.rs @@ -8,6 +8,18 @@ use hacspec_concordium_derive::*; pub use crate::ovn_traits::*; +//////////////////////// +// Useful definitions // +//////////////////////// + +fn sub(x: Z, y: Z) -> Z { + Z::add(x, Z::opp(y)) +} + +fn div(x: G, y: G) -> G { + G::prod(x, G::group_inv(y)) +} + //////////////////// // Implementation // //////////////////// @@ -23,11 +35,11 @@ pub struct SchnorrZKPCommit { // https://www.rfc-editor.org/rfc/rfc8235 // https://crypto.stanford.edu/cs355/19sp/lec5.pdf pub fn schnorr_zkp( - random: u32, + random: G::Z, h: G, x: G::Z, ) -> SchnorrZKPCommit { - let r = G::Z::random_field_elem(random); + let r = random; let u = G::g_pow(r); let c = G::hash(vec![G::g(), h, u]); let z = G::Z::add(r, G::Z::mul(c, x)); @@ -68,18 +80,18 @@ pub struct OrZKPCommit { /** Cramer, Damgård and Schoenmakers (CDS) technique */ pub fn zkp_one_out_of_two( - random_w: u32, - random_r: u32, - random_d: u32, + random_w: G::Z, + random_r: G::Z, + random_d: G::Z, h: G, xi: G::Z, vi: bool, ) -> OrZKPCommit { - let w = G::Z::random_field_elem(random_w); + let w = random_w; if vi { - let r1 = G::Z::random_field_elem(random_r); - let d1 = G::Z::random_field_elem(random_d); + let r1 = random_r; + let d1 = random_d; let x = G::g_pow(xi); let y = G::prod(G::pow(h, xi), G::g()); @@ -92,8 +104,8 @@ pub fn zkp_one_out_of_two( let c = G::hash(vec![x, y, a1, b1, a2, b2]); - let d2 = G::Z::sub(c, d1); - let r2 = G::Z::sub(w, G::Z::mul(xi, d2)); + let d2 = sub::(c, d1); + let r2 = sub::(w, G::Z::mul(xi, d2)); OrZKPCommit { or_zkp_x: x, @@ -109,8 +121,8 @@ pub fn zkp_one_out_of_two( or_zkp_r2: r2, } } else { - let r2 = G::Z::random_field_elem(random_r); - let d2 = G::Z::random_field_elem(random_d); + let r2 = random_r; + let d2 = random_d; let x = G::g_pow(xi); let y = G::pow(h, xi); @@ -119,12 +131,12 @@ pub fn zkp_one_out_of_two( let b1 = G::pow(h, w); let a2 = G::prod(G::g_pow(r2), G::pow(x, d2)); - let b2 = G::prod(G::pow(h, r2), G::pow(G::div(y, G::g()), d2)); + let b2 = G::prod(G::pow(h, r2), G::pow(div::(y, G::g()), d2)); let c = G::hash(vec![x, y, a1, b1, a2, b2]); - let d1 = G::Z::sub(c, d2); - let r1 = G::Z::sub(w, G::Z::mul(xi, d1)); + let d1 = sub::(c, d2); + let r1 = sub::(w, G::Z::mul(xi, d1)); OrZKPCommit { or_zkp_x: x, @@ -167,7 +179,7 @@ pub fn zkp_one_out_of_two_validate( && zkp.or_zkp_b2 == G::prod( G::pow(h, zkp.or_zkp_r2), - G::pow(G::div(zkp.or_zkp_y, G::g()), zkp.or_zkp_d2), + G::pow(div::(zkp.or_zkp_y, G::g()), zkp.or_zkp_d2), )) } @@ -237,16 +249,11 @@ pub fn init_ovn_contract(// _: &impl HasInitContext, }) } -/** Currently randomness needs to be injected */ -pub fn select_private_voting_key(random: u32) -> Z { - Z::random_field_elem(random) -} - #[derive(Serialize, SchemaType)] pub struct RegisterParam { pub rp_i: u32, pub rp_xi: Z, - pub rp_zkp_random: u32, + pub rp_zkp_random: Z, } /** Primary function in round 1 */ @@ -273,9 +280,9 @@ pub fn register_vote( pub struct CastVoteParam { pub cvp_i: u32, pub cvp_xi: Z, - pub cvp_zkp_random_w: u32, - pub cvp_zkp_random_r: u32, - pub cvp_zkp_random_d: u32, + pub cvp_zkp_random_w: Z, + pub cvp_zkp_random_r: Z, + pub cvp_zkp_random_d: Z, pub cvp_vote: bool, } @@ -294,7 +301,7 @@ pub fn compute_g_pow_yi( } // implicitly: Y_i = g^y_i - let g_pow_yi = G::div(prod1, prod2); + let g_pow_yi = div::(prod1, prod2); g_pow_yi } diff --git a/ovn/src/ovn_secp256k1.rs b/ovn/src/ovn_secp256k1.rs index b6da6a3..91d6f5b 100644 --- a/ovn/src/ovn_secp256k1.rs +++ b/ovn/src/ovn_secp256k1.rs @@ -30,7 +30,7 @@ use hacspec_bip_340::*; #[derive(core::marker::Copy, Clone, PartialEq, Eq)] pub struct Z_curve { - val: Scalar, + z_val: Scalar, } impl hacspec_concordium::Deserial for Z_curve { @@ -38,7 +38,7 @@ impl hacspec_concordium::Deserial for Z_curve { let temp : Vec = source.get()?; Ok(Z_curve { - val: Scalar::from_public_byte_seq_be(Seq::::from_vec(temp)), + z_val: Scalar::from_public_byte_seq_be(Seq::::from_vec(temp)), }) } } @@ -46,7 +46,7 @@ impl hacspec_concordium::Deserial for Z_curve { impl hacspec_concordium::Serial for Z_curve { fn serial(&self, out: &mut W) -> Result<(), W::Err> { let mut v : Vec = Vec::new(); - for x in self.val.to_public_byte_seq_be().native_slice() { + for x in self.z_val.to_public_byte_seq_be().native_slice() { v.push(x.clone()); } v.serial(out) @@ -56,7 +56,7 @@ impl hacspec_concordium::Serial for Z_curve { impl Field for Z_curve { fn q() -> Self { Z_curve { - val: Scalar::from_hex( + z_val: Scalar::from_hex( "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", ), } @@ -64,38 +64,48 @@ impl Field for Z_curve { fn random_field_elem(random: u32) -> Self { Z_curve { - val: Scalar::from_literal(random as u128), + z_val: Scalar::from_literal(random as u128), } } fn field_zero() -> Self { Z_curve { - val: Scalar::from_literal(0u128), + z_val: Scalar::from_literal(0u128), } // Scalar::ZERO() } fn field_one() -> Self { Z_curve { - val: Scalar::from_literal(1u128), + z_val: Scalar::from_literal(1u128), } // Scalar::ONE() } fn add(x: Self, y: Self) -> Self { - Z_curve { val: x.val + y.val } + Z_curve { z_val: x.z_val + y.z_val } } - fn sub(x: Self, y: Self) -> Self { - Z_curve { val: x.val - y.val } + fn opp(x: Self) -> Self { + Z_curve { z_val: Self::field_zero().z_val - x.z_val } } + // fn sub(x: Self, y: Self) -> Self { + // Z_curve { z_val: x.z_val - y.z_val } + // } + fn mul(x: Self, y: Self) -> Self { - Z_curve { val: x.val * y.val } + Z_curve { z_val: x.z_val * y.z_val } + } + + fn inv(x: Self) -> Self { + assert!(false); // Missing + return x; } + } #[derive(core::marker::Copy, Clone, PartialEq, Eq)] pub struct Group_curve { - val: Point, + g_val: Point, } impl hacspec_concordium::Deserial for Group_curve { @@ -106,20 +116,20 @@ impl hacspec_concordium::Deserial for Group_curve { let vy : Vec = source.get()?; Ok(Group_curve { - val: Point::Affine(( + g_val: Point::Affine(( FieldElement::from_public_byte_seq_be(Seq::::from_vec(vx)), FieldElement::from_public_byte_seq_be(Seq::::from_vec(vy)), )), }) } else { - Ok(Group_curve { val: Point::AtInfinity }) + Ok(Group_curve { g_val: Point::AtInfinity }) } } } impl hacspec_concordium::Serial for Group_curve { fn serial(&self, out: &mut W) -> Result<(), W::Err> { - match self.val { + match self.g_val { Point::Affine(p) => { true.serial(out)?; @@ -163,7 +173,7 @@ impl Group for Group_curve { 0x9Cu8, 0x47u8, 0xD0u8, 0x8Fu8, 0xFBu8, 0x10u8, 0xD4u8, 0xB8u8 ]); Group_curve { - val: Point::Affine(( + g_val: Point::Affine(( FieldElement::from_public_byte_seq_be(gx), FieldElement::from_public_byte_seq_be(gy), )), @@ -172,13 +182,13 @@ impl Group for Group_curve { fn pow(g: Self, x: Z_curve) -> Self { Group_curve { - val: point_mul(x.val, g.val), + g_val: point_mul(x.z_val, g.g_val), } } fn g_pow(x: Z_curve) -> Self { Group_curve { - val: point_mul_base(x.val), + g_val: point_mul_base(x.z_val), } // Self::pow(Self::g(), x) } @@ -189,22 +199,22 @@ impl Group for Group_curve { fn prod(x: Self, y: Self) -> Self { Group_curve { - val: point_add(x.val, y.val), + g_val: point_add(x.g_val, y.g_val), } } - fn inv(x: Self) -> Self { + fn group_inv(x: Self) -> Self { Group_curve { - val: match x.val { + g_val: match x.g_val { Point::Affine((a, b)) => Point::Affine((a, FieldElement::from_literal(0u128) - b)), Point::AtInfinity => Point::AtInfinity, }, } } - fn div(x: Self, y: Self) -> Self { - Self::prod(x, Self::inv(y)) - } + // fn div(x: Self, y: Self) -> Self { + // Self::prod(x, Self::inv(y)) + // } fn hash(x: Vec) -> Z_curve { // fp_hash_to_field diff --git a/ovn/src/ovn_traits.rs b/ovn/src/ovn_traits.rs index 46e1853..d1987db 100644 --- a/ovn/src/ovn_traits.rs +++ b/ovn/src/ovn_traits.rs @@ -26,8 +26,10 @@ pub trait Field: core::marker::Copy + PartialEq + Eq + Clone + Copy + hacspec_co fn field_one() -> Self; fn add(x: Self, y: Self) -> Self; - fn sub(x: Self, y: Self) -> Self; + fn opp(x: Self) -> Self; + fn mul(x: Self, y: Self) -> Self; + fn inv(x: Self) -> Self; } /** Interface for group implementation */ @@ -40,9 +42,7 @@ pub trait Group: core::marker::Copy + PartialEq + Eq + Clone + Copy + hacspec_co fn pow(g: Self, x: Self::Z) -> Self; // TODO: Link with q fn group_one() -> Self; fn prod(x: Self, y: Self) -> Self; - fn inv(x: Self) -> Self; - fn div(x: Self, y: Self) -> Self; + fn group_inv(x: Self) -> Self; fn hash(x: Vec) -> Self::Z; } - diff --git a/ovn/src/ovn_z_89.rs b/ovn/src/ovn_z_89.rs index 2fd59ee..ed53dd0 100644 --- a/ovn/src/ovn_z_89.rs +++ b/ovn/src/ovn_z_89.rs @@ -25,14 +25,14 @@ pub use crate::ovn_traits::*; //////////////////// #[derive(Clone, Copy, PartialEq, Eq, hacspec_concordium::Serial, hacspec_concordium::Deserial)] -pub struct z_89 { val : u8 } +pub struct z_89 { z_val : u8 } // impl hacspec_concordium::Deserial for z_89 { // // TODO: // fn deserial(source: &mut R) -> ParseResult { // let v : u8 = source.get()?; // Ok(z_89 { -// val: v, +// z_val: v, // }) // } // } @@ -40,41 +40,55 @@ pub struct z_89 { val : u8 } // impl hacspec_concordium::Serial for z_89 { // // TODO: // fn serial(&self, out: &mut W) -> Result<(), W::Err> { -// self.val.serial(out) +// self.z_val.serial(out) // } // } impl Field for z_89 { fn q() -> Self { - z_89{ val: 89u8} + z_89{ z_val: 89u8} } // Prime order fn random_field_elem(random: u32) -> Self { - z_89{ val: random as u8 % (Self::q().val - 1) } + z_89{ z_val: random as u8 % (Self::q().z_val - 1) } } fn field_zero() -> Self { - z_89{ val: 0u8 } + z_89{ z_val: 0u8 } } fn field_one() -> Self { - z_89{ val: 1u8 } + z_89{ z_val: 1u8 } } fn add(x: Self, y: Self) -> Self { - z_89{ val: (x.val + y.val) % (Self::q().val - 1) } + let q_ = Self::q().z_val - 1; + let x_ = x.z_val % q_; + let y_ = y.z_val % q_; + z_89{ z_val: (x_ + y_) % q_ } } - fn sub(x: Self, y: Self) -> Self { - z_89{ val: (x.val + (Self::q().val - 1) - y.val) % (Self::q().val - 1) } + fn opp(x: Self) -> Self { + let q_ = Self::q().z_val - 1; + let x_ = x.z_val % q_; + z_89{ z_val: q_ - x_ } } fn mul(x: Self, y: Self) -> Self { - z_89{ val: (((x.val as u16) * (y.val as u16)) % ((Self::q().val - 1) as u16)) as u8 } + let q_ = Self::q().z_val - 1; + let x_ : u16 = (x.z_val % q_) as u16; + let y_ : u16 = (y.z_val % q_) as u16; + z_89{ z_val: ((x_ * y_) % (q_ as u16)) as u8 } + } + + fn inv(x: Self) -> Self { + assert!(false); // Missing + return x; + } } #[derive(Clone, Copy, PartialEq, Eq, hacspec_concordium::Serial, hacspec_concordium::Deserial)] -pub struct g_z_89 { val : u8 } +pub struct g_z_89 { g_val : u8 } // impl hacspec_concordium::Deserial for g_z_89 { // // TODO: @@ -82,7 +96,7 @@ pub struct g_z_89 { val : u8 } // let v : u8 = source.get()?; // Ok(g_z_89 { -// val: v, +// g_val: v, // }) // } // } @@ -90,22 +104,22 @@ pub struct g_z_89 { val : u8 } // impl hacspec_concordium::Serial for g_z_89 { // // TODO: // fn serial(&self, out: &mut W) -> Result<(), W::Err> { -// self.val.serial(out) +// self.g_val.serial(out) // } // } impl Group for g_z_89 { type Z = z_89; - + fn g() -> Self { - g_z_89 { val: 3u8 } + g_z_89 { g_val: 3u8 } } // Generator (elemnent of group) fn hash(x: Vec) -> z_89 { let mut res = z_89::field_one(); for y in x { - res = z_89::mul(z_89{val: y.val}, res); + res = z_89::mul(z_89{z_val: y.g_val}, res); } res // TODO } @@ -117,33 +131,35 @@ impl Group for g_z_89 { // TODO: use repeated squaring instead! fn pow(g: Self, x: z_89) -> Self { let mut result = Self::group_one(); - for _ in 0..(x.val % (z_89::q().val - 1)) { + for _ in 0..(x.z_val % (z_89::q().z_val - 1)) { result = Self::prod(result, g); } result } fn group_one() -> Self { - g_z_89 { val: 1 } + g_z_89 { g_val: 1 } } fn prod(x: Self, y: Self) -> Self { - let q_val = z_89::q().val; - g_z_89 { val: ((((x.val % q_val) as u16) * ((y.val % q_val) as u16)) % (q_val as u16)) as u8 } + let q_ = z_89::q().z_val; + let x_ = (x.g_val % q_) as u16; + let y_ = (y.g_val % q_) as u16; + g_z_89 { g_val: ((x_ * y_) % (q_ as u16)) as u8 } } - fn inv(x: Self) -> Self { + fn group_inv(x: Self) -> Self { for j in 0..89 { - let value = g_z_89 {val: j}; - if Self::prod(x, value) == Self::group_one() { - return value; + let g_value = g_z_89 {g_val: j}; + if Self::prod(x, g_value) == Self::group_one() { + return g_value; } } assert!(false); return x; } - fn div(x: Self, y: Self) -> Self { - Self::prod(x, Self::inv(y)) - } + // fn div(x: Self, y: Self) -> Self { + // Self::prod(x, Self::inv(y)) + // } } diff --git a/ovn/tests/ovn_example.rs b/ovn/tests/ovn_example.rs index fb0aabb..90fe977 100644 --- a/ovn/tests/ovn_example.rs +++ b/ovn/tests/ovn_example.rs @@ -28,13 +28,15 @@ pub use hacspec_ovn::ovn_z_89::*; #[cfg(test)] pub fn schnorr_zkp_correctness(random_x: u32, random_r: u32) -> bool { - let x: G::Z = G::Z::random_field_elem(random_x); - let pow_x = G::g_pow(x); + let x: G::Z = G::Z::random_field_elem(random_x); + let r: G::Z = G::Z::random_field_elem(random_r); - let pi: SchnorrZKPCommit = schnorr_zkp(random_r, pow_x, x); + let pow_x = G::g_pow(x); - let valid = schnorr_zkp_validate::(pow_x, pi); - valid + let pi: SchnorrZKPCommit = schnorr_zkp(r, pow_x, x); + + let valid = schnorr_zkp_validate::(pow_x, pi); + valid } pub fn schnorr_zkp_z_89_correctness() { @@ -59,9 +61,15 @@ pub fn or_zkp_correctness( random_x: u32, v: bool, ) -> bool { - let mut h = G::g_pow(G::Z::random_field_elem(random_h)); + let w = G::Z::random_field_elem(random_w); + let r = G::Z::random_field_elem(random_r); + let d = G::Z::random_field_elem(random_d); + let h = G::Z::random_field_elem(random_h); let x = G::Z::random_field_elem(random_x); - let pi: OrZKPCommit = zkp_one_out_of_two(random_w, random_r, random_d, h, x, v); + + let mut h = G::g_pow(h); + let x = x; + let pi: OrZKPCommit = zkp_one_out_of_two(w, r, d, h, x, v); let valid = zkp_one_out_of_two_validate::(h, pi); valid } @@ -158,13 +166,13 @@ pub fn test_params_of_group_secp256k1() { pub fn test_correctness( votes: [bool; n], xis: [G::Z; n], - rp_zkp_randoms: [u32; n], - cvp_zkp_random_ws1: [u32; n], - cvp_zkp_random_rs1: [u32; n], - cvp_zkp_random_ds1: [u32; n], - cvp_zkp_random_ws2: [u32; n], - cvp_zkp_random_rs2: [u32; n], - cvp_zkp_random_ds2: [u32; n], + rp_zkp_randoms: [G::Z; n], + cvp_zkp_random_ws1: [G::Z; n], + cvp_zkp_random_rs1: [G::Z; n], + cvp_zkp_random_ds1: [G::Z; n], + cvp_zkp_random_ws2: [G::Z; n], + cvp_zkp_random_rs2: [G::Z; n], + cvp_zkp_random_ds2: [G::Z; n], ) -> bool { // Setup the context let mut ctx = hacspec_concordium::test_infrastructure::ReceiveContextTest::empty(); @@ -234,25 +242,25 @@ fn randomized_full_test() -> bool { use rand::random; let mut votes: [bool; n] = [false; n]; let mut xis: [G::Z; n] = [G::Z::field_zero(); n]; - let mut rp_zkp_randoms: [u32; n] = [0; n]; - let mut cvp_zkp_random_ws1: [u32; n] = [0; n]; - let mut cvp_zkp_random_rs1: [u32; n] = [0; n]; - let mut cvp_zkp_random_ds1: [u32; n] = [0; n]; + let mut rp_zkp_randoms: [G::Z; n] = [G::Z::field_zero(); n]; + let mut cvp_zkp_random_ws1: [G::Z; n] = [G::Z::field_zero(); n]; + let mut cvp_zkp_random_rs1: [G::Z; n] = [G::Z::field_zero(); n]; + let mut cvp_zkp_random_ds1: [G::Z; n] = [G::Z::field_zero(); n]; - let mut cvp_zkp_random_ws2: [u32; n] = [0; n]; - let mut cvp_zkp_random_rs2: [u32; n] = [0; n]; - let mut cvp_zkp_random_ds2: [u32; n] = [0; n]; + let mut cvp_zkp_random_ws2: [G::Z; n] = [G::Z::field_zero(); n]; + let mut cvp_zkp_random_rs2: [G::Z; n] = [G::Z::field_zero(); n]; + let mut cvp_zkp_random_ds2: [G::Z; n] = [G::Z::field_zero(); n]; for i in 0..n { votes[i] = random(); xis[i] = G::Z::random_field_elem(random()); - rp_zkp_randoms[i] = random(); - cvp_zkp_random_ws1[i] = random(); - cvp_zkp_random_rs1[i] = random(); - cvp_zkp_random_ds1[i] = random(); - cvp_zkp_random_ws2[i] = random(); - cvp_zkp_random_rs2[i] = random(); - cvp_zkp_random_ds2[i] = random(); + rp_zkp_randoms[i] = G::Z::random_field_elem(random()); + cvp_zkp_random_ws1[i] = G::Z::random_field_elem(random()); + cvp_zkp_random_rs1[i] = G::Z::random_field_elem(random()); + cvp_zkp_random_ds1[i] = G::Z::random_field_elem(random()); + cvp_zkp_random_ws2[i] = G::Z::random_field_elem(random()); + cvp_zkp_random_rs2[i] = G::Z::random_field_elem(random()); + cvp_zkp_random_ds2[i] = G::Z::random_field_elem(random()); } test_correctness::( From 57b5d50626e138d0fe3407923618d9071ab7b4f0 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Mon, 16 Sep 2024 14:07:47 +0200 Subject: [PATCH 84/86] Use Add,Mul and Neg notations --- ovn/Cargo.toml | 3 + .../extraction/Hacspec_ovn.Ovn_group.fst | 949 ++++++++++++++++++ .../extraction/Hacspec_ovn.Ovn_secp256k1.fst | 740 ++++++++++++++ .../extraction/Hacspec_ovn.Ovn_traits.fst | 101 ++ .../extraction/Hacspec_ovn.Ovn_z_89_.fst | 226 +++++ ovn/proofs/ssprove/extraction/.filestoinstall | 1 + .../extraction/Hacspec_ovn_Ovn_group.v | 367 ++++--- .../extraction/Hacspec_ovn_Ovn_group2.v | 484 +++++++++ .../extraction/Hacspec_ovn_Ovn_secp256k1.v | 289 +++--- .../extraction/Hacspec_ovn_Ovn_traits.v | 67 +- .../extraction/Hacspec_ovn_Ovn_z_89_.v | 177 ++-- ovn/proofs/ssprove/extraction/_CoqProject | 2 +- ovn/src/ovn_group.rs | 109 +- ovn/src/ovn_group2.rs | 404 ++++++++ ovn/src/ovn_secp256k1.rs | 69 +- ovn/src/ovn_traits.rs | 28 +- ovn/src/ovn_z_89.rs | 89 +- ovn/tests/ovn_example.rs | 2 +- 18 files changed, 3532 insertions(+), 575 deletions(-) create mode 100644 ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_group.fst create mode 100644 ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_secp256k1.fst create mode 100644 ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_traits.fst create mode 100644 ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_z_89_.fst create mode 100644 ovn/proofs/ssprove/extraction/.filestoinstall create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group2.v create mode 100644 ovn/src/ovn_group2.rs diff --git a/ovn/Cargo.toml b/ovn/Cargo.toml index 43a0edd..ce7359a 100644 --- a/ovn/Cargo.toml +++ b/ovn/Cargo.toml @@ -22,6 +22,9 @@ quickcheck = "1" quickcheck_macros = "1" bls12_381 = "0.8" +hax-lib = { git = "https://github.com/hacspec/hax", version = "0.1.0-pre.1" } + + [dev-dependencies] criterion = "0.4" rand = "0.8" diff --git a/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_group.fst b/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_group.fst new file mode 100644 index 0000000..8f91f0b --- /dev/null +++ b/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_group.fst @@ -0,0 +1,949 @@ +module Hacspec_ovn.Ovn_group +#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" +open Core +open FStar.Mul + +let _ = + (* This module has implicit dependencies, here we make them explicit. *) + (* The implicit dependencies arise from typeclasses instances. *) + let open Concordium_contracts_common.Traits in + let open Hacspec_concordium.Concordium_traits in + let open Hacspec_ovn.Ovn_traits in + () + +type t_TallyParameter = | TallyParameter : t_TallyParameter + +let sub + (#v_Z: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Field v_Z) + (x y: v_Z) + : v_Z = + Hacspec_ovn.Ovn_traits.f_add #v_Z + #FStar.Tactics.Typeclasses.solve + x + (Hacspec_ovn.Ovn_traits.f_opp #v_Z #FStar.Tactics.Typeclasses.solve y <: v_Z) + +let check_commitment + (#v_G: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) + (g_pow_xi_yi_vi: v_G) + (commitment: i1.f_Z) + : bool = + (Hacspec_ovn.Ovn_traits.f_hash #v_G + #FStar.Tactics.Typeclasses.solve + (Alloc.Slice.impl__into_vec #v_G + #Alloc.Alloc.t_Global + (Rust_primitives.unsize (Rust_primitives.Hax.box_new (let list = [g_pow_xi_yi_vi] in + FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 1); + Rust_primitives.Hax.array_of_list 1 list) + <: + Alloc.Boxed.t_Box (t_Array v_G (sz 1)) Alloc.Alloc.t_Global) + <: + Alloc.Boxed.t_Box (t_Slice v_G) Alloc.Alloc.t_Global) + <: + Alloc.Vec.t_Vec v_G Alloc.Alloc.t_Global) + <: + i1.f_Z) =. + commitment + +let commit_to + (#v_G: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) + (g_pow_xi_yi_vi: v_G) + : i1.f_Z = + Hacspec_ovn.Ovn_traits.f_hash #v_G + #FStar.Tactics.Typeclasses.solve + (Alloc.Slice.impl__into_vec #v_G + #Alloc.Alloc.t_Global + (Rust_primitives.unsize (Rust_primitives.Hax.box_new (let list = [g_pow_xi_yi_vi] in + FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 1); + Rust_primitives.Hax.array_of_list 1 list) + <: + Alloc.Boxed.t_Box (t_Array v_G (sz 1)) Alloc.Alloc.t_Global) + <: + Alloc.Boxed.t_Box (t_Slice v_G) Alloc.Alloc.t_Global) + <: + Alloc.Vec.t_Vec v_G Alloc.Alloc.t_Global) + +let compute_group_element_for_vote + (#v_G: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) + (xi: i1.f_Z) + (vote: bool) + (g_pow_yi: v_G) + : v_G = + Hacspec_ovn.Ovn_traits.f_prod #v_G + #FStar.Tactics.Typeclasses.solve + (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve g_pow_yi xi <: v_G) + (Hacspec_ovn.Ovn_traits.f_g_pow #v_G + #FStar.Tactics.Typeclasses.solve + (if vote + then + Hacspec_ovn.Ovn_traits.f_field_one #i1.f_Z #FStar.Tactics.Typeclasses.solve () <: i1.f_Z + else + Hacspec_ovn.Ovn_traits.f_field_zero #i1.f_Z #FStar.Tactics.Typeclasses.solve () + <: + i1.f_Z) + <: + v_G) + +let div + (#v_G: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) + (x y: v_G) + : v_G = + Hacspec_ovn.Ovn_traits.f_prod #v_G + #FStar.Tactics.Typeclasses.solve + x + (Hacspec_ovn.Ovn_traits.f_group_inv #v_G #FStar.Tactics.Typeclasses.solve y <: v_G) + +let compute_g_pow_yi + (#v_G: Type0) + (n: usize) + (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) + (i: usize) + (xis: t_Array v_G n) + : v_G = + let prod1:v_G = Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () in + let prod1:v_G = + Rust_primitives.Hax.Folds.fold_range (sz 0) + i + (fun prod1 temp_1_ -> + let prod1:v_G = prod1 in + let _:usize = temp_1_ in + true) + prod1 + (fun prod1 j -> + let prod1:v_G = prod1 in + let j:usize = j in + Hacspec_ovn.Ovn_traits.f_prod #v_G + #FStar.Tactics.Typeclasses.solve + prod1 + (xis.[ j ] <: v_G) + <: + v_G) + in + let prod2:v_G = Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () in + let prod2:v_G = + Rust_primitives.Hax.Folds.fold_range (i +! sz 1 <: usize) + n + (fun prod2 temp_1_ -> + let prod2:v_G = prod2 in + let _:usize = temp_1_ in + true) + prod2 + (fun prod2 j -> + let prod2:v_G = prod2 in + let j:usize = j in + Hacspec_ovn.Ovn_traits.f_prod #v_G + #FStar.Tactics.Typeclasses.solve + prod2 + (xis.[ j ] <: v_G) + <: + v_G) + in + div #v_G prod1 prod2 + +type t_CastVoteParam (v_Z: Type0) {| i1: Hacspec_ovn.Ovn_traits.t_Field v_Z |} = { + f_cvp_i:u32; + f_cvp_xi:v_Z; + f_cvp_zkp_random_w:v_Z; + f_cvp_zkp_random_r:v_Z; + f_cvp_zkp_random_d:v_Z; + f_cvp_vote:bool +} + +type t_OrZKPCommit (v_G: Type0) {| i1: Hacspec_ovn.Ovn_traits.t_Group v_G |} = { + f_or_zkp_x:v_G; + f_or_zkp_y:v_G; + f_or_zkp_a1:v_G; + f_or_zkp_b1:v_G; + f_or_zkp_a2:v_G; + f_or_zkp_b2:v_G; + f_or_zkp_c:i1.f_Z; + f_or_zkp_d1:i1.f_Z; + f_or_zkp_d2:i1.f_Z; + f_or_zkp_r1:i1.f_Z; + f_or_zkp_r2:i1.f_Z +} + +type t_RegisterParam (v_Z: Type0) {| i1: Hacspec_ovn.Ovn_traits.t_Field v_Z |} = { + f_rp_i:u32; + f_rp_xi:v_Z; + f_rp_zkp_random:v_Z +} + +type t_SchnorrZKPCommit (v_G: Type0) {| i1: Hacspec_ovn.Ovn_traits.t_Group v_G |} = { + f_schnorr_zkp_u:v_G; + f_schnorr_zkp_c:i1.f_Z; + f_schnorr_zkp_z:i1.f_Z +} + +(** Non-interactive Schnorr proof using Fiat-Shamir heuristics (RFC 8235) *) +let schnorr_zkp + (#v_G: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) + (random: i1.f_Z) + (h: v_G) + (x: i1.f_Z) + : t_SchnorrZKPCommit v_G = + Rust_primitives.Hax.Control_flow_monad.Mexception.run (let r = random in + let u:v_G = Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve r in + let c = + Hacspec_ovn.Ovn_traits.f_hash #v_G + #FStar.Tactics.Typeclasses.solve + (Alloc.Slice.impl__into_vec #v_G + #Alloc.Alloc.t_Global + (Rust_primitives.unsize (Rust_primitives.Hax.box_new (let list = + [ + Hacspec_ovn.Ovn_traits.f_g #v_G #FStar.Tactics.Typeclasses.solve () + <: + v_G; + h; + u + ] + in + FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 3); + Rust_primitives.Hax.array_of_list 3 list) + <: + Alloc.Boxed.t_Box (t_Array v_G (sz 3)) Alloc.Alloc.t_Global) + <: + Alloc.Boxed.t_Box (t_Slice v_G) Alloc.Alloc.t_Global) + <: + Alloc.Vec.t_Vec v_G Alloc.Alloc.t_Global) + in + let z = + Hacspec_ovn.Ovn_traits.f_add #i1.f_Z + #FStar.Tactics.Typeclasses.solve + r + (Hacspec_ovn.Ovn_traits.f_mul #i1.f_Z #FStar.Tactics.Typeclasses.solve c x <: i1.f_Z) + in + let! hoist9:Rust_primitives.Hax.t_Never = + Core.Ops.Control_flow.ControlFlow_Break + ({ f_schnorr_zkp_u = u; f_schnorr_zkp_c = c; f_schnorr_zkp_z = z } <: t_SchnorrZKPCommit v_G + ) + <: + Core.Ops.Control_flow.t_ControlFlow (t_SchnorrZKPCommit v_G) Rust_primitives.Hax.t_Never + in + Core.Ops.Control_flow.ControlFlow_Continue (Rust_primitives.Hax.never_to_any hoist9) + <: + Core.Ops.Control_flow.t_ControlFlow (t_SchnorrZKPCommit v_G) (t_SchnorrZKPCommit v_G)) + +let schnorr_zkp_validate + (#v_G: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) + (h: v_G) + (pi: t_SchnorrZKPCommit v_G) + : bool = + pi.f_schnorr_zkp_c =. + (Hacspec_ovn.Ovn_traits.f_hash #v_G + #FStar.Tactics.Typeclasses.solve + (Alloc.Slice.impl__into_vec #v_G + #Alloc.Alloc.t_Global + (Rust_primitives.unsize (Rust_primitives.Hax.box_new (let list = + [ + Hacspec_ovn.Ovn_traits.f_g #v_G #FStar.Tactics.Typeclasses.solve () <: v_G; + h; + pi.f_schnorr_zkp_u + ] + in + FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 3); + Rust_primitives.Hax.array_of_list 3 list) + <: + Alloc.Boxed.t_Box (t_Array v_G (sz 3)) Alloc.Alloc.t_Global) + <: + Alloc.Boxed.t_Box (t_Slice v_G) Alloc.Alloc.t_Global) + <: + Alloc.Vec.t_Vec v_G Alloc.Alloc.t_Global) + <: + i1.f_Z) && + (Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve pi.f_schnorr_zkp_z <: v_G) =. + (Hacspec_ovn.Ovn_traits.f_prod #v_G + #FStar.Tactics.Typeclasses.solve + pi.f_schnorr_zkp_u + (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve h pi.f_schnorr_zkp_c + <: + v_G) + <: + v_G) + +(** Cramer, Damgård and Schoenmakers (CDS) technique *) +let zkp_one_out_of_two + (#v_G: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) + (random_w random_r random_d: i1.f_Z) + (h: v_G) + (xi: i1.f_Z) + (vi: bool) + : t_OrZKPCommit v_G = + let w = random_w in + if vi + then + let r1 = random_r in + let d1 = random_d in + let x:v_G = Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve xi in + let y:v_G = + Hacspec_ovn.Ovn_traits.f_prod #v_G + #FStar.Tactics.Typeclasses.solve + (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve h xi <: v_G) + (Hacspec_ovn.Ovn_traits.f_g #v_G #FStar.Tactics.Typeclasses.solve () <: v_G) + in + let a1:v_G = + Hacspec_ovn.Ovn_traits.f_prod #v_G + #FStar.Tactics.Typeclasses.solve + (Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve r1 <: v_G) + (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve x d1 <: v_G) + in + let b1:v_G = + Hacspec_ovn.Ovn_traits.f_prod #v_G + #FStar.Tactics.Typeclasses.solve + (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve h r1 <: v_G) + (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve y d1 <: v_G) + in + let a2:v_G = Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve w in + let b2:v_G = Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve h w in + let c = + Hacspec_ovn.Ovn_traits.f_hash #v_G + #FStar.Tactics.Typeclasses.solve + (Alloc.Slice.impl__into_vec #v_G + #Alloc.Alloc.t_Global + (Rust_primitives.unsize (Rust_primitives.Hax.box_new (let list = + [x; y; a1; b1; a2; b2] + in + FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 6); + Rust_primitives.Hax.array_of_list 6 list) + <: + Alloc.Boxed.t_Box (t_Array v_G (sz 6)) Alloc.Alloc.t_Global) + <: + Alloc.Boxed.t_Box (t_Slice v_G) Alloc.Alloc.t_Global) + <: + Alloc.Vec.t_Vec v_G Alloc.Alloc.t_Global) + in + let d2 = sub #i1.f_Z c d1 in + let r2 = + sub #i1.f_Z + w + (Hacspec_ovn.Ovn_traits.f_mul #i1.f_Z #FStar.Tactics.Typeclasses.solve xi d2 <: i1.f_Z) + in + { + f_or_zkp_x = x; + f_or_zkp_y = y; + f_or_zkp_a1 = a1; + f_or_zkp_b1 = b1; + f_or_zkp_a2 = a2; + f_or_zkp_b2 = b2; + f_or_zkp_c = c; + f_or_zkp_d1 = d1; + f_or_zkp_d2 = d2; + f_or_zkp_r1 = r1; + f_or_zkp_r2 = r2 + } + <: + t_OrZKPCommit v_G + else + let r2 = random_r in + let d2 = random_d in + let x:v_G = Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve xi in + let y:v_G = Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve h xi in + let a1:v_G = Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve w in + let b1:v_G = Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve h w in + let a2:v_G = + Hacspec_ovn.Ovn_traits.f_prod #v_G + #FStar.Tactics.Typeclasses.solve + (Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve r2 <: v_G) + (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve x d2 <: v_G) + in + let b2:v_G = + Hacspec_ovn.Ovn_traits.f_prod #v_G + #FStar.Tactics.Typeclasses.solve + (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve h r2 <: v_G) + (Hacspec_ovn.Ovn_traits.f_pow #v_G + #FStar.Tactics.Typeclasses.solve + (div #v_G y (Hacspec_ovn.Ovn_traits.f_g #v_G #FStar.Tactics.Typeclasses.solve () <: v_G) + <: + v_G) + d2 + <: + v_G) + in + let c = + Hacspec_ovn.Ovn_traits.f_hash #v_G + #FStar.Tactics.Typeclasses.solve + (Alloc.Slice.impl__into_vec #v_G + #Alloc.Alloc.t_Global + (Rust_primitives.unsize (Rust_primitives.Hax.box_new (let list = + [x; y; a1; b1; a2; b2] + in + FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 6); + Rust_primitives.Hax.array_of_list 6 list) + <: + Alloc.Boxed.t_Box (t_Array v_G (sz 6)) Alloc.Alloc.t_Global) + <: + Alloc.Boxed.t_Box (t_Slice v_G) Alloc.Alloc.t_Global) + <: + Alloc.Vec.t_Vec v_G Alloc.Alloc.t_Global) + in + let d1 = sub #i1.f_Z c d2 in + let r1 = + sub #i1.f_Z + w + (Hacspec_ovn.Ovn_traits.f_mul #i1.f_Z #FStar.Tactics.Typeclasses.solve xi d1 <: i1.f_Z) + in + { + f_or_zkp_x = x; + f_or_zkp_y = y; + f_or_zkp_a1 = a1; + f_or_zkp_b1 = b1; + f_or_zkp_a2 = a2; + f_or_zkp_b2 = b2; + f_or_zkp_c = c; + f_or_zkp_d1 = d1; + f_or_zkp_d2 = d2; + f_or_zkp_r1 = r1; + f_or_zkp_r2 = r2 + } + <: + t_OrZKPCommit v_G + +let zkp_one_out_of_two_validate + (#v_G: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) + (h: v_G) + (zkp: t_OrZKPCommit v_G) + : bool = + let c = + Hacspec_ovn.Ovn_traits.f_hash #v_G + #FStar.Tactics.Typeclasses.solve + (Alloc.Slice.impl__into_vec #v_G + #Alloc.Alloc.t_Global + (Rust_primitives.unsize (Rust_primitives.Hax.box_new (let list = + [ + zkp.f_or_zkp_x; + zkp.f_or_zkp_y; + zkp.f_or_zkp_a1; + zkp.f_or_zkp_b1; + zkp.f_or_zkp_a2; + zkp.f_or_zkp_b2 + ] + in + FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 6); + Rust_primitives.Hax.array_of_list 6 list) + <: + Alloc.Boxed.t_Box (t_Array v_G (sz 6)) Alloc.Alloc.t_Global) + <: + Alloc.Boxed.t_Box (t_Slice v_G) Alloc.Alloc.t_Global) + <: + Alloc.Vec.t_Vec v_G Alloc.Alloc.t_Global) + in + c =. + (Hacspec_ovn.Ovn_traits.f_add #i1.f_Z + #FStar.Tactics.Typeclasses.solve + zkp.f_or_zkp_d1 + zkp.f_or_zkp_d2 + <: + i1.f_Z) && + zkp.f_or_zkp_a1 =. + (Hacspec_ovn.Ovn_traits.f_prod #v_G + #FStar.Tactics.Typeclasses.solve + (Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve zkp.f_or_zkp_r1 <: v_G) + (Hacspec_ovn.Ovn_traits.f_pow #v_G + #FStar.Tactics.Typeclasses.solve + zkp.f_or_zkp_x + zkp.f_or_zkp_d1 + <: + v_G) + <: + v_G) && + zkp.f_or_zkp_b1 =. + (Hacspec_ovn.Ovn_traits.f_prod #v_G + #FStar.Tactics.Typeclasses.solve + (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve h zkp.f_or_zkp_r1 <: v_G) + (Hacspec_ovn.Ovn_traits.f_pow #v_G + #FStar.Tactics.Typeclasses.solve + zkp.f_or_zkp_y + zkp.f_or_zkp_d1 + <: + v_G) + <: + v_G) && + zkp.f_or_zkp_a2 =. + (Hacspec_ovn.Ovn_traits.f_prod #v_G + #FStar.Tactics.Typeclasses.solve + (Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve zkp.f_or_zkp_r2 <: v_G) + (Hacspec_ovn.Ovn_traits.f_pow #v_G + #FStar.Tactics.Typeclasses.solve + zkp.f_or_zkp_x + zkp.f_or_zkp_d2 + <: + v_G) + <: + v_G) && + zkp.f_or_zkp_b2 =. + (Hacspec_ovn.Ovn_traits.f_prod #v_G + #FStar.Tactics.Typeclasses.solve + (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve h zkp.f_or_zkp_r2 <: v_G) + (Hacspec_ovn.Ovn_traits.f_pow #v_G + #FStar.Tactics.Typeclasses.solve + (div #v_G + zkp.f_or_zkp_y + (Hacspec_ovn.Ovn_traits.f_g #v_G #FStar.Tactics.Typeclasses.solve () <: v_G) + <: + v_G) + zkp.f_or_zkp_d2 + <: + v_G) + <: + v_G) + +type t_OvnContractState (v_G: Type0) (n: usize) {| i1: Hacspec_ovn.Ovn_traits.t_Group v_G |} = { + f_g_pow_xis:t_Array v_G n; + f_zkp_xis:t_Array (t_SchnorrZKPCommit v_G) n; + f_commit_vis:t_Array i1.f_Z n; + f_g_pow_xi_yi_vis:t_Array v_G n; + f_zkp_vis:t_Array (t_OrZKPCommit v_G) n; + f_tally:u32; + f_round1:t_Array bool n +} + +(** Primary function in round 2, also opens commitment *) +let cast_vote + (#v_G: Type0) + (n: usize) + (#v_A #impl_574521470_: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] i3: Hacspec_ovn.Ovn_traits.t_Group v_G) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + i4: + Hacspec_concordium.Concordium_traits.t_HasActions v_A) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + i5: + Hacspec_concordium.Concordium_traits.t_HasReceiveContext impl_574521470_ Prims.unit) + (ctx: impl_574521470_) + (state: t_OvnContractState v_G n) + : Core.Result.t_Result (v_A & t_OvnContractState v_G n) + Concordium_contracts_common.Types.t_ParseError = + let _, out:(_ & + Core.Result.t_Result (t_CastVoteParam i3.f_Z) Concordium_contracts_common.Types.t_ParseError) = + Concordium_contracts_common.Traits.f_get #_ + #(t_CastVoteParam i3.f_Z) + #FStar.Tactics.Typeclasses.solve + (Hacspec_concordium.Concordium_traits.f_parameter_cursor #impl_574521470_ + #FStar.Tactics.Typeclasses.solve + ctx + <: + _) + in + match out with + | Core.Result.Result_Ok (params: t_CastVoteParam i3.f_Z) -> + let g_pow_yi:v_G = + compute_g_pow_yi #v_G n (cast (params.f_cvp_i <: u32) <: usize) state.f_g_pow_xis + in + let g_pow_xi_yi_vi:v_G = + compute_group_element_for_vote #v_G params.f_cvp_xi params.f_cvp_vote g_pow_yi + in + let zkp_vi:t_OrZKPCommit v_G = + zkp_one_out_of_two #v_G + params.f_cvp_zkp_random_w + params.f_cvp_zkp_random_r + params.f_cvp_zkp_random_d + g_pow_yi + params.f_cvp_xi + params.f_cvp_vote + in + let cast_vote_state_ret:t_OvnContractState v_G n = + Core.Clone.f_clone #(t_OvnContractState v_G n) #FStar.Tactics.Typeclasses.solve state + in + let cast_vote_state_ret:t_OvnContractState v_G n = + { + cast_vote_state_ret with + f_g_pow_xi_yi_vis + = + Rust_primitives.Hax.Monomorphized_update_at.update_at_usize cast_vote_state_ret + .f_g_pow_xi_yi_vis + (cast (params.f_cvp_i <: u32) <: usize) + g_pow_xi_yi_vi + } + <: + t_OvnContractState v_G n + in + let cast_vote_state_ret:t_OvnContractState v_G n = + { + cast_vote_state_ret with + f_zkp_vis + = + Rust_primitives.Hax.Monomorphized_update_at.update_at_usize cast_vote_state_ret.f_zkp_vis + (cast (params.f_cvp_i <: u32) <: usize) + zkp_vi + } + <: + t_OvnContractState v_G n + in + Core.Result.Result_Ok + (Hacspec_concordium.Concordium_traits.f_accept #v_A #FStar.Tactics.Typeclasses.solve (), + cast_vote_state_ret + <: + (v_A & t_OvnContractState v_G n)) + <: + Core.Result.t_Result (v_A & t_OvnContractState v_G n) + Concordium_contracts_common.Types.t_ParseError + | Core.Result.Result_Err err -> + Core.Result.Result_Err err + <: + Core.Result.t_Result (v_A & t_OvnContractState v_G n) + Concordium_contracts_common.Types.t_ParseError + +(** Commitment before round 2 *) +let commit_to_vote + (#v_G: Type0) + (n: usize) + (#v_A #impl_574521470_: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] i3: Hacspec_ovn.Ovn_traits.t_Group v_G) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + i4: + Hacspec_concordium.Concordium_traits.t_HasActions v_A) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + i5: + Hacspec_concordium.Concordium_traits.t_HasReceiveContext impl_574521470_ Prims.unit) + (ctx: impl_574521470_) + (state: t_OvnContractState v_G n) + : Core.Result.t_Result (v_A & t_OvnContractState v_G n) + Concordium_contracts_common.Types.t_ParseError = + let _, out:(_ & + Core.Result.t_Result (t_CastVoteParam i3.f_Z) Concordium_contracts_common.Types.t_ParseError) = + Concordium_contracts_common.Traits.f_get #_ + #(t_CastVoteParam i3.f_Z) + #FStar.Tactics.Typeclasses.solve + (Hacspec_concordium.Concordium_traits.f_parameter_cursor #impl_574521470_ + #FStar.Tactics.Typeclasses.solve + ctx + <: + _) + in + match out with + | Core.Result.Result_Ok (params: t_CastVoteParam i3.f_Z) -> + let _:Prims.unit = + Rust_primitives.Hax.failure "(FunctionalizeLoops) something is not implemented yet.\nLoop without mutation?" + "{\n for i in (core::iter::traits::collect::f_into_iter(core::ops::range::Range {\n f_start: 0,\n f_end: n,\n })) {\n (if BinOp::Ast\n .Or(\n core::ops::bit::Not::not(\n hacspec_ovn::ovn_group::schnorr_zkp_validate::<\n G,\n >(\n core::ops::index::Index::index(\n proj_hacspec_ovn::ovn_group::f_g_pow_xis(state),\n i,\n ),\n core::ops::index::Index::index(\n proj_hacspec_ovn::ovn_group::f_zkp_xis(state),\n i,\n ),\n ),\n ),\n core::ops::bit::Not::not(\n core::ops::index::Index::index(\n proj_hacspec_ovn::ovn_group::f_round1(state),\n i,\n ),\n ),\n )\n {\n {\n #[note(\n \"rhs.typ=core::ops::control_flow::t_ControlFlow>, concordium_contracts_common::types::t_ParseError>, rust_primitives::hax::t_Never>\"\n )]\n #[monadic_let(\n MException>,\n concordium_contracts_common::types::t_ParseError>>\n )]\n let hoist12: rust_primitives::hax::t_Never = {\n core::ops::control_flow::ControlFlow_Break(\n core::result::Result_Err(\n concordium_contracts_common::types::ParseError(),\n ),\n )\n };\n core::ops::control_flow::ControlFlow_Continue(\n rust_primitives::hax::never_to_any(hoist12),\n )\n }\n } else {\n core::ops::control_flow::ControlFlow_Continue(Tuple0)\n })\n }\n }" + + in + let g_pow_yi:v_G = + compute_g_pow_yi #v_G n (cast (params.f_cvp_i <: u32) <: usize) state.f_g_pow_xis + in + let g_pow_xi_yi_vi:v_G = + compute_group_element_for_vote #v_G params.f_cvp_xi params.f_cvp_vote g_pow_yi + in + let commit_vi = commit_to #v_G g_pow_xi_yi_vi in + let commit_to_vote_state_ret:t_OvnContractState v_G n = + Core.Clone.f_clone #(t_OvnContractState v_G n) #FStar.Tactics.Typeclasses.solve state + in + let commit_to_vote_state_ret:t_OvnContractState v_G n = + { + commit_to_vote_state_ret with + f_commit_vis + = + Rust_primitives.Hax.Monomorphized_update_at.update_at_usize commit_to_vote_state_ret + .f_commit_vis + (cast (params.f_cvp_i <: u32) <: usize) + commit_vi + } + <: + t_OvnContractState v_G n + in + Core.Result.Result_Ok + (Hacspec_concordium.Concordium_traits.f_accept #v_A #FStar.Tactics.Typeclasses.solve (), + commit_to_vote_state_ret + <: + (v_A & t_OvnContractState v_G n)) + <: + Core.Result.t_Result (v_A & t_OvnContractState v_G n) + Concordium_contracts_common.Types.t_ParseError + | Core.Result.Result_Err err -> + Core.Result.Result_Err err + <: + Core.Result.t_Result (v_A & t_OvnContractState v_G n) + Concordium_contracts_common.Types.t_ParseError + +let init_ovn_contract + (#v_G: Type0) + (n: usize) + (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) + (_: Prims.unit) + : Core.Result.t_Result (t_OvnContractState v_G n) Hacspec_concordium.Concordium_types.t_Reject = + Core.Result.Result_Ok + ({ + f_g_pow_xis + = + Rust_primitives.Hax.repeat (Hacspec_ovn.Ovn_traits.f_group_one #v_G + #FStar.Tactics.Typeclasses.solve + () + <: + v_G) + n; + f_zkp_xis + = + Rust_primitives.Hax.repeat ({ + f_schnorr_zkp_u + = + Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () <: v_G; + f_schnorr_zkp_z + = + Hacspec_ovn.Ovn_traits.f_field_zero #i1.f_Z #FStar.Tactics.Typeclasses.solve () + <: + i1.f_Z; + f_schnorr_zkp_c + = + Hacspec_ovn.Ovn_traits.f_field_zero #i1.f_Z #FStar.Tactics.Typeclasses.solve () + <: + i1.f_Z + } + <: + t_SchnorrZKPCommit v_G) + n; + f_commit_vis + = + Rust_primitives.Hax.repeat (Hacspec_ovn.Ovn_traits.f_field_zero #i1.f_Z + #FStar.Tactics.Typeclasses.solve + () + <: + i1.f_Z) + n; + f_g_pow_xi_yi_vis + = + Rust_primitives.Hax.repeat (Hacspec_ovn.Ovn_traits.f_group_one #v_G + #FStar.Tactics.Typeclasses.solve + () + <: + v_G) + n; + f_zkp_vis + = + Rust_primitives.Hax.repeat ({ + f_or_zkp_x + = + Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () <: v_G; + f_or_zkp_y + = + Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () <: v_G; + f_or_zkp_a1 + = + Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () <: v_G; + f_or_zkp_b1 + = + Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () <: v_G; + f_or_zkp_a2 + = + Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () <: v_G; + f_or_zkp_b2 + = + Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () <: v_G; + f_or_zkp_c + = + Hacspec_ovn.Ovn_traits.f_field_zero #i1.f_Z #FStar.Tactics.Typeclasses.solve () + <: + i1.f_Z; + f_or_zkp_d1 + = + Hacspec_ovn.Ovn_traits.f_field_zero #i1.f_Z #FStar.Tactics.Typeclasses.solve () + <: + i1.f_Z; + f_or_zkp_d2 + = + Hacspec_ovn.Ovn_traits.f_field_zero #i1.f_Z #FStar.Tactics.Typeclasses.solve () + <: + i1.f_Z; + f_or_zkp_r1 + = + Hacspec_ovn.Ovn_traits.f_field_zero #i1.f_Z #FStar.Tactics.Typeclasses.solve () + <: + i1.f_Z; + f_or_zkp_r2 + = + Hacspec_ovn.Ovn_traits.f_field_zero #i1.f_Z #FStar.Tactics.Typeclasses.solve () + <: + i1.f_Z + } + <: + t_OrZKPCommit v_G) + n; + f_tally = 0ul; + f_round1 = Rust_primitives.Hax.repeat false n + } + <: + t_OvnContractState v_G n) + <: + Core.Result.t_Result (t_OvnContractState v_G n) Hacspec_concordium.Concordium_types.t_Reject + +(** Primary function in round 1 *) +let register_vote + (#v_G: Type0) + (n: usize) + (#v_A #impl_574521470_: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] i3: Hacspec_ovn.Ovn_traits.t_Group v_G) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + i4: + Hacspec_concordium.Concordium_traits.t_HasActions v_A) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + i5: + Hacspec_concordium.Concordium_traits.t_HasReceiveContext impl_574521470_ Prims.unit) + (ctx: impl_574521470_) + (state: t_OvnContractState v_G n) + : Core.Result.t_Result (v_A & t_OvnContractState v_G n) + Concordium_contracts_common.Types.t_ParseError = + let _, out:(_ & + Core.Result.t_Result (t_RegisterParam i3.f_Z) Concordium_contracts_common.Types.t_ParseError) = + Concordium_contracts_common.Traits.f_get #_ + #(t_RegisterParam i3.f_Z) + #FStar.Tactics.Typeclasses.solve + (Hacspec_concordium.Concordium_traits.f_parameter_cursor #impl_574521470_ + #FStar.Tactics.Typeclasses.solve + ctx + <: + _) + in + match out with + | Core.Result.Result_Ok (params: t_RegisterParam i3.f_Z) -> + let g_pow_xi:v_G = + Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve params.f_rp_xi + in + let zkp_xi:t_SchnorrZKPCommit v_G = + schnorr_zkp #v_G params.f_rp_zkp_random g_pow_xi params.f_rp_xi + in + let register_vote_state_ret:t_OvnContractState v_G n = + Core.Clone.f_clone #(t_OvnContractState v_G n) #FStar.Tactics.Typeclasses.solve state + in + let register_vote_state_ret:t_OvnContractState v_G n = + { + register_vote_state_ret with + f_g_pow_xis + = + Rust_primitives.Hax.Monomorphized_update_at.update_at_usize register_vote_state_ret + .f_g_pow_xis + (cast (params.f_rp_i <: u32) <: usize) + g_pow_xi + } + <: + t_OvnContractState v_G n + in + let register_vote_state_ret:t_OvnContractState v_G n = + { + register_vote_state_ret with + f_zkp_xis + = + Rust_primitives.Hax.Monomorphized_update_at.update_at_usize register_vote_state_ret + .f_zkp_xis + (cast (params.f_rp_i <: u32) <: usize) + zkp_xi + } + <: + t_OvnContractState v_G n + in + let register_vote_state_ret:t_OvnContractState v_G n = + { + register_vote_state_ret with + f_round1 + = + Rust_primitives.Hax.Monomorphized_update_at.update_at_usize register_vote_state_ret.f_round1 + (cast (params.f_rp_i <: u32) <: usize) + true + } + <: + t_OvnContractState v_G n + in + Core.Result.Result_Ok + (Hacspec_concordium.Concordium_traits.f_accept #v_A #FStar.Tactics.Typeclasses.solve (), + register_vote_state_ret + <: + (v_A & t_OvnContractState v_G n)) + <: + Core.Result.t_Result (v_A & t_OvnContractState v_G n) + Concordium_contracts_common.Types.t_ParseError + | Core.Result.Result_Err err -> + Core.Result.Result_Err err + <: + Core.Result.t_Result (v_A & t_OvnContractState v_G n) + Concordium_contracts_common.Types.t_ParseError + +(** Anyone can tally the votes *) +let tally_votes + (#v_G: Type0) + (n: usize) + (#v_A: Type0) + (#impl_574521470_: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] i3: Hacspec_ovn.Ovn_traits.t_Group v_G) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + i4: + Hacspec_concordium.Concordium_traits.t_HasActions v_A) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + i5: + Hacspec_concordium.Concordium_traits.t_HasReceiveContext impl_574521470_ Prims.unit) + (_: impl_574521470_) + (state: t_OvnContractState v_G n) + : Core.Result.t_Result (v_A & t_OvnContractState v_G n) + Concordium_contracts_common.Types.t_ParseError = + let _:Prims.unit = + Rust_primitives.Hax.failure "(FunctionalizeLoops) something is not implemented yet.\nLoop without mutation?" + "{\n for i in (core::iter::traits::collect::f_into_iter(core::ops::range::Range {\n f_start: 0,\n f_end: n,\n })) {\n {\n let g_pow_yi: G = {\n hacspec_ovn::ovn_group::compute_g_pow_yi::<\n G,\n generic_value!(todo),\n >(i, proj_hacspec_ovn::ovn_group::f_g_pow_xis(state))\n };\n {\n #[note(\n \"rhs.typ=core::ops::control_flow::t_ControlFlow>, concordium_contracts_common::types::t_ParseError>, core::ops::control_flow::t_ControlFlow>, concordium_contracts_common::types::t_ParseError>, tuple0>>\"\n )]\n #[monadic_let(\n MException>,\n concordium_contracts_common::types::t_ParseError>>\n )]\n let _: tuple0 = {\n core::ops::control_flow::ControlFlow_Continue(\n (if core::ops::bit::Not::not(\n hacspec_ovn::ovn_group::zkp_one_out_of_two_validate::<\n G,\n >(\n g_pow_yi,\n core::ops::index::Index::index(\n proj_hacspec_ovn::ovn_group::f_zkp_vis(state),\n i,\n ),\n ),\n ) {\n {\n #[note(\n \"rhs.typ=core::ops::control_flow::t_ControlFlow>, concordium_contracts_common::types::t_ParseError>, rust_primitives::hax::t_Never>\"\n )]\n #[monadic_let(\n MException>,\n concordium_contracts_common::types::t_ParseError>>\n )]\n let hoist13: rust_primitives::hax::t_Never = {\n core::ops::control_flow::ControlFlow_Break(\n core::result::Result_Err(\n concordium_contracts_common::types::ParseError(),\n ),\n )\n };\n core::ops::control_flow::ControlFlow_Continue(\n rust_primitives::hax::never_to_any(hoist13),\n )\n }\n } else {\n core::ops::control_flow::ControlFlow_Continue(Tuple0)\n }),\n )\n };\n (if core::ops::bit::Not::not(\n hacspec_ovn::ovn_group::check_commitment::<\n G,\n >(\n core::ops::index::Index::index(\n proj_hacspec_ovn::ovn_group::f_g_pow_xi_yi_vis(state),\n i,\n ),\n core::ops::index::Index::index(\n proj_hacspec_ovn::ovn_group::f_commit_vis(state),\n i,\n ),\n ),\n ) {\n {\n #[note(\n \"rhs.typ=core::ops::control_flow::t_ControlFlow>, concordium_contracts_common::types::t_ParseError>, rust_primitives::hax::t_Never>\"\n )]\n #[monadic_let(\n MException>,\n concordium_contracts_common::types::t_ParseError>>\n )]\n let hoist14: rust_primitives::hax::t_Never = {\n core::ops::control_flow::ControlFlow_Break(\n core::result::Result_Err(\n concordium_contracts_common::types::ParseError(),\n ),\n )\n };\n core::ops::control_flow::ControlFlow_Continue(\n rust_primitives::hax::never_to_any(hoist14),\n )\n }\n } else {\n core::ops::control_flow::ControlFlow_Continue(Tuple0)\n })\n }\n }\n }\n }" + + in + let vote_result:v_G = + Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () + in + let vote_result:v_G = + Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter #(t_Array v_G n) + #FStar.Tactics.Typeclasses.solve + state.f_g_pow_xi_yi_vis + <: + Core.Array.Iter.t_IntoIter v_G n) + vote_result + (fun vote_result g_pow_vote -> + let vote_result:v_G = vote_result in + let g_pow_vote:v_G = g_pow_vote in + Hacspec_ovn.Ovn_traits.f_prod #v_G #FStar.Tactics.Typeclasses.solve vote_result g_pow_vote + <: + v_G) + in + let tally:u32 = 0ul in + let curr = Hacspec_ovn.Ovn_traits.f_field_zero #i3.f_Z #FStar.Tactics.Typeclasses.solve () in + let curr, tally:(i3.f_Z & u32) = + Rust_primitives.Hax.Folds.fold_range 0ul + (cast (n <: usize) <: u32) + (fun temp_0_ temp_1_ -> + let curr, tally:(i3.f_Z & u32) = temp_0_ in + let _:u32 = temp_1_ in + true) + (curr, tally <: (i3.f_Z & u32)) + (fun temp_0_ i -> + let curr, tally:(i3.f_Z & u32) = temp_0_ in + let i:u32 = i in + let tally:u32 = + if + (Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve curr <: v_G) =. + vote_result + then + let tally:u32 = i in + tally + else tally + in + let curr = + Hacspec_ovn.Ovn_traits.f_add #i3.f_Z + #FStar.Tactics.Typeclasses.solve + curr + (Hacspec_ovn.Ovn_traits.f_field_one #i3.f_Z #FStar.Tactics.Typeclasses.solve () + <: + i3.f_Z) + in + curr, tally <: (i3.f_Z & u32)) + in + let tally_votes_state_ret:t_OvnContractState v_G n = + Core.Clone.f_clone #(t_OvnContractState v_G n) #FStar.Tactics.Typeclasses.solve state + in + let tally_votes_state_ret:t_OvnContractState v_G n = + { tally_votes_state_ret with f_tally = tally } <: t_OvnContractState v_G n + in + Core.Result.Result_Ok + (Hacspec_concordium.Concordium_traits.f_accept #v_A #FStar.Tactics.Typeclasses.solve (), + tally_votes_state_ret + <: + (v_A & t_OvnContractState v_G n)) + <: + Core.Result.t_Result (v_A & t_OvnContractState v_G n) + Concordium_contracts_common.Types.t_ParseError diff --git a/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_secp256k1.fst b/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_secp256k1.fst new file mode 100644 index 0000000..24c7113 --- /dev/null +++ b/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_secp256k1.fst @@ -0,0 +1,740 @@ +module Hacspec_ovn.Ovn_secp256k1 +#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" +open Core +open FStar.Mul + +let _ = + (* This module has implicit dependencies, here we make them explicit. *) + (* The implicit dependencies arise from typeclasses instances. *) + let open Concordium_contracts_common.Impls in + let open Concordium_contracts_common.Traits in + let open Hacspec_bip_340 in + let open Hacspec_lib.Seq in + let open Hacspec_ovn.Ovn_traits in + () + +type t_Group_curve = { f_g_val:Hacspec_bip_340.t_Point } + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl_3: Concordium_contracts_common.Traits.t_Deserial t_Group_curve = + { + f_deserial_pre + = + (fun + (#v_R: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + i1: + Concordium_contracts_common.Traits.t_Read v_R) + (source: v_R) + -> + true); + f_deserial_post + = + (fun + (#v_R: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + i1: + Concordium_contracts_common.Traits.t_Read v_R) + (source: v_R) + (out1: + (v_R & Core.Result.t_Result t_Group_curve Concordium_contracts_common.Types.t_ParseError)) + -> + true); + f_deserial + = + fun + (#v_R: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Concordium_contracts_common.Traits.t_Read v_R) + (source: v_R) + -> + let tmp0, out:(v_R & Core.Result.t_Result bool Concordium_contracts_common.Types.t_ParseError) + = + Concordium_contracts_common.Traits.f_get #v_R #bool #FStar.Tactics.Typeclasses.solve source + in + let source:v_R = tmp0 in + match out with + | Core.Result.Result_Ok (b: bool) -> + let source, hax_temp_output:(v_R & + Core.Result.t_Result t_Group_curve Concordium_contracts_common.Types.t_ParseError) = + if b + then + let tmp0, out:(v_R & + Core.Result.t_Result (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + Concordium_contracts_common.Types.t_ParseError) = + Concordium_contracts_common.Traits.f_get #v_R + #(Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + #FStar.Tactics.Typeclasses.solve + source + in + let source:v_R = tmp0 in + match out with + | Core.Result.Result_Ok (vx: Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) -> + let tmp0, out:(v_R & + Core.Result.t_Result (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + Concordium_contracts_common.Types.t_ParseError) = + Concordium_contracts_common.Traits.f_get #v_R + #(Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + #FStar.Tactics.Typeclasses.solve + source + in + let source:v_R = tmp0 in + (match out with + | Core.Result.Result_Ok (vy: Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) -> + source, + (Core.Result.Result_Ok + ({ + f_g_val + = + Hacspec_bip_340.Point_Affine + (Hacspec_bip_340.impl__FieldElement__from_public_byte_seq_be #(Hacspec_lib.Seq.t_Seq + u8) + (Hacspec_lib.Seq.impl_52__from_vec #u8 vx <: Hacspec_lib.Seq.t_Seq u8), + Hacspec_bip_340.impl__FieldElement__from_public_byte_seq_be #(Hacspec_lib.Seq.t_Seq + u8) + (Hacspec_lib.Seq.impl_52__from_vec #u8 vy <: Hacspec_lib.Seq.t_Seq u8) + <: + (Hacspec_bip_340.t_FieldElement & Hacspec_bip_340.t_FieldElement)) + <: + Hacspec_bip_340.t_Point + } + <: + t_Group_curve) + <: + Core.Result.t_Result t_Group_curve + Concordium_contracts_common.Types.t_ParseError) + <: + (v_R & + Core.Result.t_Result t_Group_curve + Concordium_contracts_common.Types.t_ParseError) + | Core.Result.Result_Err err -> + source, + (Core.Ops.Control_flow.ControlFlow_Break + (source, + (Core.Result.Result_Err err + <: + Core.Result.t_Result t_Group_curve + Concordium_contracts_common.Types.t_ParseError) + <: + (v_R & + Core.Result.t_Result t_Group_curve + Concordium_contracts_common.Types.t_ParseError)) + <: + Core.Ops.Control_flow.t_ControlFlow + (v_R & + Core.Result.t_Result t_Group_curve + Concordium_contracts_common.Types.t_ParseError) + (Core.Result.t_Result t_Group_curve + Concordium_contracts_common.Types.t_ParseError)) + <: + (v_R & + Core.Result.t_Result t_Group_curve + Concordium_contracts_common.Types.t_ParseError)) + | Core.Result.Result_Err err -> + source, + (Core.Ops.Control_flow.ControlFlow_Break + (source, + (Core.Result.Result_Err err + <: + Core.Result.t_Result t_Group_curve + Concordium_contracts_common.Types.t_ParseError) + <: + (v_R & + Core.Result.t_Result t_Group_curve + Concordium_contracts_common.Types.t_ParseError)) + <: + Core.Ops.Control_flow.t_ControlFlow + (v_R & + Core.Result.t_Result t_Group_curve + Concordium_contracts_common.Types.t_ParseError) + (Core.Result.t_Result t_Group_curve Concordium_contracts_common.Types.t_ParseError + )) + <: + (v_R & + Core.Result.t_Result t_Group_curve Concordium_contracts_common.Types.t_ParseError) + else + source, + (Core.Result.Result_Ok + ({ f_g_val = Hacspec_bip_340.Point_AtInfinity <: Hacspec_bip_340.t_Point } + <: + t_Group_curve) + <: + Core.Result.t_Result t_Group_curve Concordium_contracts_common.Types.t_ParseError) + <: + (v_R & Core.Result.t_Result t_Group_curve Concordium_contracts_common.Types.t_ParseError + ) + in + source, hax_temp_output + <: + (v_R & Core.Result.t_Result t_Group_curve Concordium_contracts_common.Types.t_ParseError) + | Core.Result.Result_Err err -> + source, + (Core.Result.Result_Err err + <: + Core.Result.t_Result t_Group_curve Concordium_contracts_common.Types.t_ParseError) + <: + (v_R & Core.Result.t_Result t_Group_curve Concordium_contracts_common.Types.t_ParseError) + } + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl_4: Concordium_contracts_common.Traits.t_Serial t_Group_curve = + { + f_serial_pre + = + (fun + (#v_W: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + i1: + Concordium_contracts_common.Traits.t_Write v_W) + (self: t_Group_curve) + (out: v_W) + -> + true); + f_serial_post + = + (fun + (#v_W: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + i1: + Concordium_contracts_common.Traits.t_Write v_W) + (self: t_Group_curve) + (out: v_W) + (out2: (v_W & Core.Result.t_Result Prims.unit i1.f_Err)) + -> + true); + f_serial + = + fun + (#v_W: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Concordium_contracts_common.Traits.t_Write v_W) + (self: t_Group_curve) + (out: v_W) + -> + Rust_primitives.Hax.Control_flow_monad.Mexception.run (let! out:v_W = + match self.f_g_val with + | Hacspec_bip_340.Point_Affine p -> + let tmp0, out1:(v_W & Core.Result.t_Result Prims.unit i1.f_Err) = + Concordium_contracts_common.Traits.f_serial #bool + #FStar.Tactics.Typeclasses.solve + #v_W + true + out + in + let out:v_W = tmp0 in + (match out1 with + | Core.Result.Result_Ok _ -> + let (vx: Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global):Alloc.Vec.t_Vec u8 + Alloc.Alloc.t_Global = + Alloc.Vec.impl__new #u8 () + in + let vx:Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = + Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter #(t_Slice + u8) + #FStar.Tactics.Typeclasses.solve + (Hacspec_lib.Seq.impl_41__native_slice #u8 + (Hacspec_bip_340.impl__FieldElement__to_public_byte_seq_be (Hacspec_bip_340.x + p + <: + Hacspec_bip_340.t_FieldElement) + <: + Hacspec_lib.Seq.t_Seq u8) + <: + t_Slice u8) + <: + Core.Slice.Iter.t_Iter u8) + vx + (fun vx x -> + let vx:Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = vx in + let x:u8 = x in + Alloc.Vec.impl_1__push #u8 + #Alloc.Alloc.t_Global + vx + (Core.Clone.f_clone #u8 #FStar.Tactics.Typeclasses.solve x <: u8) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + in + let tmp0, out1:(v_W & Core.Result.t_Result Prims.unit i1.f_Err) = + Concordium_contracts_common.Traits.f_serial #(Alloc.Vec.t_Vec u8 + Alloc.Alloc.t_Global) + #FStar.Tactics.Typeclasses.solve + #v_W + vx + out + in + let out:v_W = tmp0 in + (match out1 with + | Core.Result.Result_Ok _ -> + let (vy: Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global):Alloc.Vec.t_Vec u8 + Alloc.Alloc.t_Global = + Alloc.Vec.impl__new #u8 () + in + let vy:Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = + Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter #(t_Slice + u8) + #FStar.Tactics.Typeclasses.solve + (Hacspec_lib.Seq.impl_41__native_slice #u8 + (Hacspec_bip_340.impl__FieldElement__to_public_byte_seq_be (Hacspec_bip_340.y + p + <: + Hacspec_bip_340.t_FieldElement) + <: + Hacspec_lib.Seq.t_Seq u8) + <: + t_Slice u8) + <: + Core.Slice.Iter.t_Iter u8) + vy + (fun vy y -> + let vy:Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = vy in + let y:u8 = y in + Alloc.Vec.impl_1__push #u8 + #Alloc.Alloc.t_Global + vy + (Core.Clone.f_clone #u8 #FStar.Tactics.Typeclasses.solve y <: u8) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + in + let tmp0, out1:(v_W & Core.Result.t_Result Prims.unit i1.f_Err) = + Concordium_contracts_common.Traits.f_serial #(Alloc.Vec.t_Vec u8 + Alloc.Alloc.t_Global) + #FStar.Tactics.Typeclasses.solve + #v_W + vy + out + in + let out:v_W = tmp0 in + (match out1 with + | Core.Result.Result_Ok _ -> + Core.Ops.Control_flow.ControlFlow_Continue out + <: + Core.Ops.Control_flow.t_ControlFlow + (v_W & Core.Result.t_Result Prims.unit i1.f_Err) v_W + | Core.Result.Result_Err err -> + let! _:Prims.unit = + Core.Ops.Control_flow.ControlFlow_Break + (out, + (Core.Result.Result_Err err + <: + Core.Result.t_Result Prims.unit i1.f_Err) + <: + (v_W & Core.Result.t_Result Prims.unit i1.f_Err)) + <: + Core.Ops.Control_flow.t_ControlFlow + (v_W & Core.Result.t_Result Prims.unit i1.f_Err) Prims.unit + in + Core.Ops.Control_flow.ControlFlow_Continue out + <: + Core.Ops.Control_flow.t_ControlFlow + (v_W & Core.Result.t_Result Prims.unit i1.f_Err) v_W) + | Core.Result.Result_Err err -> + let! _:Prims.unit = + Core.Ops.Control_flow.ControlFlow_Break + (out, + (Core.Result.Result_Err err <: Core.Result.t_Result Prims.unit i1.f_Err) + <: + (v_W & Core.Result.t_Result Prims.unit i1.f_Err)) + <: + Core.Ops.Control_flow.t_ControlFlow + (v_W & Core.Result.t_Result Prims.unit i1.f_Err) Prims.unit + in + Core.Ops.Control_flow.ControlFlow_Continue out + <: + Core.Ops.Control_flow.t_ControlFlow + (v_W & Core.Result.t_Result Prims.unit i1.f_Err) v_W) + | Core.Result.Result_Err err -> + let! _:Prims.unit = + Core.Ops.Control_flow.ControlFlow_Break + (out, (Core.Result.Result_Err err <: Core.Result.t_Result Prims.unit i1.f_Err) + <: + (v_W & Core.Result.t_Result Prims.unit i1.f_Err)) + <: + Core.Ops.Control_flow.t_ControlFlow + (v_W & Core.Result.t_Result Prims.unit i1.f_Err) Prims.unit + in + Core.Ops.Control_flow.ControlFlow_Continue out + <: + Core.Ops.Control_flow.t_ControlFlow + (v_W & Core.Result.t_Result Prims.unit i1.f_Err) v_W) + | Hacspec_bip_340.Point_AtInfinity -> + let tmp0, out1:(v_W & Core.Result.t_Result Prims.unit i1.f_Err) = + Concordium_contracts_common.Traits.f_serial #bool + #FStar.Tactics.Typeclasses.solve + #v_W + false + out + in + let out:v_W = tmp0 in + match out1 with + | Core.Result.Result_Ok _ -> + Core.Ops.Control_flow.ControlFlow_Continue out + <: + Core.Ops.Control_flow.t_ControlFlow (v_W & Core.Result.t_Result Prims.unit i1.f_Err) + v_W + | Core.Result.Result_Err err -> + let! _:Prims.unit = + Core.Ops.Control_flow.ControlFlow_Break + (out, (Core.Result.Result_Err err <: Core.Result.t_Result Prims.unit i1.f_Err) + <: + (v_W & Core.Result.t_Result Prims.unit i1.f_Err)) + <: + Core.Ops.Control_flow.t_ControlFlow + (v_W & Core.Result.t_Result Prims.unit i1.f_Err) Prims.unit + in + Core.Ops.Control_flow.ControlFlow_Continue out + <: + Core.Ops.Control_flow.t_ControlFlow (v_W & Core.Result.t_Result Prims.unit i1.f_Err) + v_W + in + Core.Ops.Control_flow.ControlFlow_Continue + (let hax_temp_output:Core.Result.t_Result Prims.unit i1.f_Err = + Core.Result.Result_Ok (() <: Prims.unit) <: Core.Result.t_Result Prims.unit i1.f_Err + in + out, hax_temp_output <: (v_W & Core.Result.t_Result Prims.unit i1.f_Err)) + <: + Core.Ops.Control_flow.t_ControlFlow (v_W & Core.Result.t_Result Prims.unit i1.f_Err) + (v_W & Core.Result.t_Result Prims.unit i1.f_Err)) + } + +type t_Z_curve = { f_z_val:Hacspec_bip_340.t_Scalar } + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl: Concordium_contracts_common.Traits.t_Deserial t_Z_curve = + { + f_deserial_pre + = + (fun + (#v_R: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + i1: + Concordium_contracts_common.Traits.t_Read v_R) + (source: v_R) + -> + true); + f_deserial_post + = + (fun + (#v_R: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + i1: + Concordium_contracts_common.Traits.t_Read v_R) + (source: v_R) + (out1: + (v_R & Core.Result.t_Result t_Z_curve Concordium_contracts_common.Types.t_ParseError)) + -> + true); + f_deserial + = + fun + (#v_R: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Concordium_contracts_common.Traits.t_Read v_R) + (source: v_R) + -> + let tmp0, out:(v_R & + Core.Result.t_Result (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + Concordium_contracts_common.Types.t_ParseError) = + Concordium_contracts_common.Traits.f_get #v_R + #(Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + #FStar.Tactics.Typeclasses.solve + source + in + let source:v_R = tmp0 in + match out with + | Core.Result.Result_Ok (temp: Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) -> + let hax_temp_output:Core.Result.t_Result t_Z_curve + Concordium_contracts_common.Types.t_ParseError = + Core.Result.Result_Ok + ({ + f_z_val + = + Hacspec_bip_340.impl__Scalar__from_public_byte_seq_be #(Hacspec_lib.Seq.t_Seq u8) + (Hacspec_lib.Seq.impl_52__from_vec #u8 temp <: Hacspec_lib.Seq.t_Seq u8) + } + <: + t_Z_curve) + <: + Core.Result.t_Result t_Z_curve Concordium_contracts_common.Types.t_ParseError + in + source, hax_temp_output + <: + (v_R & Core.Result.t_Result t_Z_curve Concordium_contracts_common.Types.t_ParseError) + | Core.Result.Result_Err err -> + source, + (Core.Result.Result_Err err + <: + Core.Result.t_Result t_Z_curve Concordium_contracts_common.Types.t_ParseError) + <: + (v_R & Core.Result.t_Result t_Z_curve Concordium_contracts_common.Types.t_ParseError) + } + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl_1: Concordium_contracts_common.Traits.t_Serial t_Z_curve = + { + f_serial_pre + = + (fun + (#v_W: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + i1: + Concordium_contracts_common.Traits.t_Write v_W) + (self: t_Z_curve) + (out: v_W) + -> + true); + f_serial_post + = + (fun + (#v_W: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] + i1: + Concordium_contracts_common.Traits.t_Write v_W) + (self: t_Z_curve) + (out: v_W) + (out2: (v_W & Core.Result.t_Result Prims.unit i1.f_Err)) + -> + true); + f_serial + = + fun + (#v_W: Type0) + (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Concordium_contracts_common.Traits.t_Write v_W) + (self: t_Z_curve) + (out: v_W) + -> + let (v: Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global):Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = + Alloc.Vec.impl__new #u8 () + in + let v:Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = + Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter #(t_Slice u8) + #FStar.Tactics.Typeclasses.solve + (Hacspec_lib.Seq.impl_41__native_slice #u8 + (Hacspec_bip_340.impl__Scalar__to_public_byte_seq_be self.f_z_val + <: + Hacspec_lib.Seq.t_Seq u8) + <: + t_Slice u8) + <: + Core.Slice.Iter.t_Iter u8) + v + (fun v x -> + let v:Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = v in + let x:u8 = x in + Alloc.Vec.impl_1__push #u8 + #Alloc.Alloc.t_Global + v + (Core.Clone.f_clone #u8 #FStar.Tactics.Typeclasses.solve x <: u8) + <: + Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + in + let tmp0, out1:(v_W & Core.Result.t_Result Prims.unit i1.f_Err) = + Concordium_contracts_common.Traits.f_serial #(Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) + #FStar.Tactics.Typeclasses.solve + #v_W + v + out + in + let out:v_W = tmp0 in + let hax_temp_output:Core.Result.t_Result Prims.unit i1.f_Err = out1 in + out, hax_temp_output <: (v_W & Core.Result.t_Result Prims.unit i1.f_Err) + } + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl_2: Hacspec_ovn.Ovn_traits.t_Field t_Z_curve = + { + _super_11581440318597584651 = FStar.Tactics.Typeclasses.solve; + _super_12632649257025169145 = FStar.Tactics.Typeclasses.solve; + _super_8099741844003281729 = FStar.Tactics.Typeclasses.solve; + _super_9442900250278684536 = FStar.Tactics.Typeclasses.solve; + _super_11581440318597584651 = FStar.Tactics.Typeclasses.solve; + _super_17605656595743636193 = FStar.Tactics.Typeclasses.solve; + f_q_pre = (fun (_: Prims.unit) -> true); + f_q_post = (fun (_: Prims.unit) (out: t_Z_curve) -> true); + f_q + = + (fun (_: Prims.unit) -> + { + f_z_val + = + Hacspec_bip_340.impl__Scalar__from_hex "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141" + + } + <: + t_Z_curve); + f_random_field_elem_pre = (fun (random: u32) -> true); + f_random_field_elem_post = (fun (random: u32) (out: t_Z_curve) -> true); + f_random_field_elem + = + (fun (random: u32) -> + { f_z_val = Hacspec_bip_340.impl__Scalar__from_literal (cast (random <: u32) <: u128) } + <: + t_Z_curve); + f_field_zero_pre = (fun (_: Prims.unit) -> true); + f_field_zero_post = (fun (_: Prims.unit) (out: t_Z_curve) -> true); + f_field_zero + = + (fun (_: Prims.unit) -> + { f_z_val = Hacspec_bip_340.impl__Scalar__from_literal (pub_u128 0) } <: t_Z_curve); + f_field_one_pre = (fun (_: Prims.unit) -> true); + f_field_one_post = (fun (_: Prims.unit) (out: t_Z_curve) -> true); + f_field_one + = + (fun (_: Prims.unit) -> + { f_z_val = Hacspec_bip_340.impl__Scalar__from_literal (pub_u128 1) } <: t_Z_curve); + f_add_pre = (fun (x: t_Z_curve) (y: t_Z_curve) -> true); + f_add_post = (fun (x: t_Z_curve) (y: t_Z_curve) (out: t_Z_curve) -> true); + f_add = (fun (x: t_Z_curve) (y: t_Z_curve) -> { f_z_val = x.f_z_val +! y.f_z_val } <: t_Z_curve); + f_opp_pre = (fun (x: t_Z_curve) -> true); + f_opp_post = (fun (x: t_Z_curve) (out: t_Z_curve) -> true); + f_opp + = + (fun (x: t_Z_curve) -> + { + f_z_val + = + (Hacspec_ovn.Ovn_traits.f_field_zero #t_Z_curve #FStar.Tactics.Typeclasses.solve () + <: + t_Z_curve) + .f_z_val -! + x.f_z_val + } + <: + t_Z_curve); + f_mul_pre = (fun (x: t_Z_curve) (y: t_Z_curve) -> true); + f_mul_post = (fun (x: t_Z_curve) (y: t_Z_curve) (out: t_Z_curve) -> true); + f_mul = (fun (x: t_Z_curve) (y: t_Z_curve) -> { f_z_val = x.f_z_val *! y.f_z_val } <: t_Z_curve); + f_inv_pre = (fun (x: t_Z_curve) -> true); + f_inv_post = (fun (x: t_Z_curve) (out: t_Z_curve) -> true); + f_inv + = + fun (x: t_Z_curve) -> + Rust_primitives.Hax.Control_flow_monad.Mexception.run (let _:Prims.unit = + Hax_lib.v_assert false + in + let! hoist10:Rust_primitives.Hax.t_Never = + Core.Ops.Control_flow.ControlFlow_Break x + <: + Core.Ops.Control_flow.t_ControlFlow t_Z_curve Rust_primitives.Hax.t_Never + in + Core.Ops.Control_flow.ControlFlow_Continue (Rust_primitives.Hax.never_to_any hoist10) + <: + Core.Ops.Control_flow.t_ControlFlow t_Z_curve t_Z_curve) + } + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl_5: Hacspec_ovn.Ovn_traits.t_Group t_Group_curve = + { + _super_11581440318597584651 = FStar.Tactics.Typeclasses.solve; + _super_12632649257025169145 = FStar.Tactics.Typeclasses.solve; + _super_8099741844003281729 = FStar.Tactics.Typeclasses.solve; + _super_9442900250278684536 = FStar.Tactics.Typeclasses.solve; + _super_11581440318597584651 = FStar.Tactics.Typeclasses.solve; + _super_17605656595743636193 = FStar.Tactics.Typeclasses.solve; + f_Z = t_Z_curve; + f_Z_5568683927164688039 = FStar.Tactics.Typeclasses.solve; + f_g_pre = (fun (_: Prims.unit) -> true); + f_g_post = (fun (_: Prims.unit) (out: t_Group_curve) -> true); + f_g + = + (fun (_: Prims.unit) -> + let gx:Hacspec_bip_340.t_PBytes32 = + Hacspec_bip_340.PBytes32 + (let list = + [ + 121uy; 190uy; 102uy; 126uy; 249uy; 220uy; 187uy; 172uy; 85uy; 160uy; 98uy; 149uy; + 206uy; 135uy; 11uy; 7uy; 2uy; 155uy; 252uy; 219uy; 45uy; 206uy; 40uy; 217uy; 89uy; + 242uy; 129uy; 91uy; 22uy; 248uy; 23uy; 152uy + ] + in + FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 32); + Rust_primitives.Hax.array_of_list 32 list) + <: + Hacspec_bip_340.t_PBytes32 + in + let gy:Hacspec_bip_340.t_PBytes32 = + Hacspec_bip_340.PBytes32 + (let list = + [ + 72uy; 58uy; 218uy; 119uy; 38uy; 163uy; 196uy; 101uy; 93uy; 164uy; 251uy; 252uy; 14uy; + 17uy; 8uy; 168uy; 253uy; 23uy; 180uy; 72uy; 166uy; 133uy; 84uy; 25uy; 156uy; 71uy; + 208uy; 143uy; 251uy; 16uy; 212uy; 184uy + ] + in + FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 32); + Rust_primitives.Hax.array_of_list 32 list) + <: + Hacspec_bip_340.t_PBytes32 + in + { + f_g_val + = + Hacspec_bip_340.Point_Affine + (Hacspec_bip_340.impl__FieldElement__from_public_byte_seq_be #Hacspec_bip_340.t_PBytes32 + gx, + Hacspec_bip_340.impl__FieldElement__from_public_byte_seq_be #Hacspec_bip_340.t_PBytes32 + gy + <: + (Hacspec_bip_340.t_FieldElement & Hacspec_bip_340.t_FieldElement)) + <: + Hacspec_bip_340.t_Point + } + <: + t_Group_curve); + f_pow_pre = (fun (g: t_Group_curve) (x: t_Z_curve) -> true); + f_pow_post = (fun (g: t_Group_curve) (x: t_Z_curve) (out: t_Group_curve) -> true); + f_pow + = + (fun (g: t_Group_curve) (x: t_Z_curve) -> + { f_g_val = Hacspec_bip_340.point_mul x.f_z_val g.f_g_val } <: t_Group_curve); + f_g_pow_pre = (fun (x: t_Z_curve) -> true); + f_g_pow_post = (fun (x: t_Z_curve) (out: t_Group_curve) -> true); + f_g_pow + = + (fun (x: t_Z_curve) -> { f_g_val = Hacspec_bip_340.point_mul_base x.f_z_val } <: t_Group_curve); + f_group_one_pre = (fun (_: Prims.unit) -> true); + f_group_one_post = (fun (_: Prims.unit) (out: t_Group_curve) -> true); + f_group_one + = + (fun (_: Prims.unit) -> + Hacspec_ovn.Ovn_traits.f_g_pow #t_Group_curve + #FStar.Tactics.Typeclasses.solve + (Hacspec_ovn.Ovn_traits.f_field_zero #t_Z_curve #FStar.Tactics.Typeclasses.solve () + <: + t_Z_curve)); + f_prod_pre = (fun (x: t_Group_curve) (y: t_Group_curve) -> true); + f_prod_post = (fun (x: t_Group_curve) (y: t_Group_curve) (out: t_Group_curve) -> true); + f_prod + = + (fun (x: t_Group_curve) (y: t_Group_curve) -> + { f_g_val = Hacspec_bip_340.point_add x.f_g_val y.f_g_val } <: t_Group_curve); + f_group_inv_pre = (fun (x: t_Group_curve) -> true); + f_group_inv_post = (fun (x: t_Group_curve) (out: t_Group_curve) -> true); + f_group_inv + = + (fun (x: t_Group_curve) -> + { + f_g_val + = + match x.f_g_val with + | Hacspec_bip_340.Point_Affine (a, b) -> + Hacspec_bip_340.Point_Affine + (a, + (Hacspec_bip_340.impl__FieldElement__from_literal (pub_u128 0) + <: + Hacspec_bip_340.t_FieldElement) -! + b + <: + (Hacspec_bip_340.t_FieldElement & Hacspec_bip_340.t_FieldElement)) + <: + Hacspec_bip_340.t_Point + | Hacspec_bip_340.Point_AtInfinity -> + Hacspec_bip_340.Point_AtInfinity <: Hacspec_bip_340.t_Point + } + <: + t_Group_curve); + f_hash_pre = (fun (x: Alloc.Vec.t_Vec t_Group_curve Alloc.Alloc.t_Global) -> true); + f_hash_post + = + (fun (x: Alloc.Vec.t_Vec t_Group_curve Alloc.Alloc.t_Global) (out: t_Z_curve) -> true); + f_hash + = + fun (x: Alloc.Vec.t_Vec t_Group_curve Alloc.Alloc.t_Global) -> + Hacspec_ovn.Ovn_traits.f_field_one #t_Z_curve #FStar.Tactics.Typeclasses.solve () + } diff --git a/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_traits.fst b/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_traits.fst new file mode 100644 index 0000000..cc7184a --- /dev/null +++ b/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_traits.fst @@ -0,0 +1,101 @@ +module Hacspec_ovn.Ovn_traits +#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" +open Core +open FStar.Mul + +let _ = + (* This module has implicit dependencies, here we make them explicit. *) + (* The implicit dependencies arise from typeclasses instances. *) + let open Concordium_contracts_common.Traits in + () + +(* item error backend: (reject_TraitItemDefault) ExplicitRejection { reason: "a node of kind [Trait_item_default] have been found in the AST" } +Last available AST for this item: + +/** Interface for field implementation */#[no_std()]#[feature(register_tool)]#[register_tool(hax)]#[no_std()]#[feature(register_tool)]#[register_tool(hax)]#[feature(trait_alias)]#[register_tool(_hax)]trait t_Field where _:core::marker::t_Copy,_:core::cmp::t_PartialEq,_:core::cmp::t_Eq,_:core::clone::t_Clone,_:concordium_contracts_common::traits::t_Serialize{#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_q_pre(_: tuple0) -> bool; +#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_q_post(_: tuple0,_: Self) -> bool; +fn f_q(_: tuple0) -> Self; +#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_random_field_elem_pre(_: int) -> bool; +#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_random_field_elem_post(_: int,_: Self) -> bool; +fn f_random_field_elem(_: int) -> Self; +#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_field_zero_pre(_: tuple0) -> bool; +#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_field_zero_post(_: tuple0,_: Self) -> bool; +fn f_field_zero(_: tuple0) -> Self; +#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_field_one_pre(_: tuple0) -> bool; +#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_field_one_post(_: tuple0,_: Self) -> bool; +fn f_field_one(_: tuple0) -> Self; +#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_add_pre(_: Self,_: Self) -> bool; +#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_add_post(_: Self,_: Self,_: Self) -> bool; +fn f_add(_: Self,_: Self) -> Self; +#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_opp_pre(_: Self) -> bool; +#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_opp_post(_: Self,_: Self) -> bool; +fn f_opp(_: Self) -> Self; +#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_mul_pre(_: Self,_: Self) -> bool; +#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_mul_post(_: Self,_: Self,_: Self) -> bool; +fn f_mul(_: Self,_: Self) -> Self; +#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_inv_pre(_: Self) -> bool; +#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_inv_post(_: Self,_: Self) -> bool; +fn f_inv(_: Self) -> Self; +#[_hax::json("{\"ItemStatus\":{\"Included\":{\"late_skip\":true}}}")]fn f____(()) -> tuple0{Tuple0} +#[_hax::json("{\"ItemStatus\":{\"Included\":{\"late_skip\":true}}}")]fn f____1(()) -> tuple0{Tuple0} +#[_hax::json("\"Lemma\"")]fn f_addC((x: Z,y: Z)) -> tuple0 where _:hacspec_ovn::ovn_traits::t_Field{Tuple0}} + +Last AST: +/** print_rust: pitem: not implemented (item: { Concrete_ident.T.def_id = + { Concrete_ident.Imported.krate = "hacspec_ovn"; + path = + [{ Concrete_ident.Imported.data = + (Concrete_ident.Imported.TypeNs "ovn_traits"); disambiguator = 0 }; + { Concrete_ident.Imported.data = + (Concrete_ident.Imported.TypeNs "Field"); disambiguator = 0 } + ] + }; + kind = Concrete_ident.Kind.Value }) */ +const _: () = (); + *) + +(** Interface for group implementation *) +class t_Group (v_Self: Type0) = { + [@@@ FStar.Tactics.Typeclasses.no_method]_super_11581440318597584651:Core.Marker.t_Copy v_Self; + [@@@ FStar.Tactics.Typeclasses.no_method]_super_12632649257025169145:Core.Cmp.t_PartialEq v_Self + v_Self; + [@@@ FStar.Tactics.Typeclasses.no_method]_super_8099741844003281729:Core.Cmp.t_Eq v_Self; + [@@@ FStar.Tactics.Typeclasses.no_method]_super_9442900250278684536:Core.Clone.t_Clone v_Self; + [@@@ FStar.Tactics.Typeclasses.no_method]_super_17605656595743636193:Concordium_contracts_common.Traits.t_Serialize + v_Self; + f_Z:Type0; + f_Z_5568683927164688039:t_Field f_Z; + f_Z_6036424691684178845:Concordium_contracts_common.Traits.t_Serialize f_Z; + f_Z_5944877312583825506:Concordium_contracts_common.Traits.t_Deserial f_Z; + f_Z_2631562626655622548:Concordium_contracts_common.Traits.t_Serial f_Z; + f_Z_7106659769471979108:Core.Clone.t_Clone f_Z; + f_Z_5227107583605841272:Core.Cmp.t_Eq f_Z; + f_Z_13069512637334391294:Core.Cmp.t_PartialEq f_Z f_Z; + f_Z_16774959407837281168:Core.Marker.t_Copy f_Z; + f_g_pre:Prims.unit -> Type0; + f_g_post:Prims.unit -> v_Self -> Type0; + f_g:x0: Prims.unit -> Prims.Pure v_Self (f_g_pre x0) (fun result -> f_g_post x0 result); + f_g_pow_pre:f_Z -> Type0; + f_g_pow_post:f_Z -> v_Self -> Type0; + f_g_pow:x0: f_Z -> Prims.Pure v_Self (f_g_pow_pre x0) (fun result -> f_g_pow_post x0 result); + f_pow_pre:v_Self -> f_Z -> Type0; + f_pow_post:v_Self -> f_Z -> v_Self -> Type0; + f_pow:x0: v_Self -> x1: f_Z + -> Prims.Pure v_Self (f_pow_pre x0 x1) (fun result -> f_pow_post x0 x1 result); + f_group_one_pre:Prims.unit -> Type0; + f_group_one_post:Prims.unit -> v_Self -> Type0; + f_group_one:x0: Prims.unit + -> Prims.Pure v_Self (f_group_one_pre x0) (fun result -> f_group_one_post x0 result); + f_prod_pre:v_Self -> v_Self -> Type0; + f_prod_post:v_Self -> v_Self -> v_Self -> Type0; + f_prod:x0: v_Self -> x1: v_Self + -> Prims.Pure v_Self (f_prod_pre x0 x1) (fun result -> f_prod_post x0 x1 result); + f_group_inv_pre:v_Self -> Type0; + f_group_inv_post:v_Self -> v_Self -> Type0; + f_group_inv:x0: v_Self + -> Prims.Pure v_Self (f_group_inv_pre x0) (fun result -> f_group_inv_post x0 result); + f_hash_pre:Alloc.Vec.t_Vec v_Self Alloc.Alloc.t_Global -> Type0; + f_hash_post:Alloc.Vec.t_Vec v_Self Alloc.Alloc.t_Global -> f_Z -> Type0; + f_hash:x0: Alloc.Vec.t_Vec v_Self Alloc.Alloc.t_Global + -> Prims.Pure f_Z (f_hash_pre x0) (fun result -> f_hash_post x0 result) +} diff --git a/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_z_89_.fst b/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_z_89_.fst new file mode 100644 index 0000000..d0ebfe3 --- /dev/null +++ b/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_z_89_.fst @@ -0,0 +1,226 @@ +module Hacspec_ovn.Ovn_z_89_ +#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" +open Core +open FStar.Mul + +let _ = + (* This module has implicit dependencies, here we make them explicit. *) + (* The implicit dependencies arise from typeclasses instances. *) + let open Concordium_contracts_common.Traits in + let open Hacspec_ovn.Ovn_traits in + () + +type t_g_z_89_ = { f_g_val:u8 } + +type t_z_89_ = { f_z_val:u8 } + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl: Hacspec_ovn.Ovn_traits.t_Field t_z_89_ = + { + _super_11581440318597584651 = FStar.Tactics.Typeclasses.solve; + _super_12632649257025169145 = FStar.Tactics.Typeclasses.solve; + _super_8099741844003281729 = FStar.Tactics.Typeclasses.solve; + _super_9442900250278684536 = FStar.Tactics.Typeclasses.solve; + _super_11581440318597584651 = FStar.Tactics.Typeclasses.solve; + _super_17605656595743636193 = FStar.Tactics.Typeclasses.solve; + f_q_pre = (fun (_: Prims.unit) -> true); + f_q_post = (fun (_: Prims.unit) (out: t_z_89_) -> true); + f_q = (fun (_: Prims.unit) -> { f_z_val = 89uy } <: t_z_89_); + f_random_field_elem_pre = (fun (random: u32) -> true); + f_random_field_elem_post = (fun (random: u32) (out: t_z_89_) -> true); + f_random_field_elem + = + (fun (random: u32) -> + { + f_z_val + = + (cast (random <: u32) <: u8) %! + ((Hacspec_ovn.Ovn_traits.f_q #t_z_89_ #FStar.Tactics.Typeclasses.solve () <: t_z_89_) + .f_z_val -! + 1uy + <: + u8) + } + <: + t_z_89_); + f_field_zero_pre = (fun (_: Prims.unit) -> true); + f_field_zero_post = (fun (_: Prims.unit) (out: t_z_89_) -> true); + f_field_zero = (fun (_: Prims.unit) -> { f_z_val = 0uy } <: t_z_89_); + f_field_one_pre = (fun (_: Prims.unit) -> true); + f_field_one_post = (fun (_: Prims.unit) (out: t_z_89_) -> true); + f_field_one = (fun (_: Prims.unit) -> { f_z_val = 1uy } <: t_z_89_); + f_add_pre = (fun (x: t_z_89_) (y: t_z_89_) -> true); + f_add_post = (fun (x: t_z_89_) (y: t_z_89_) (out: t_z_89_) -> true); + f_add + = + (fun (x: t_z_89_) (y: t_z_89_) -> + let q___:u8 = + (Hacspec_ovn.Ovn_traits.f_q #t_z_89_ #FStar.Tactics.Typeclasses.solve () <: t_z_89_) + .f_z_val -! + 1uy + in + let x___:u8 = x.f_z_val %! q___ in + let y___:u8 = y.f_z_val %! q___ in + { f_z_val = (x___ +! y___ <: u8) %! q___ } <: t_z_89_); + f_opp_pre = (fun (x: t_z_89_) -> true); + f_opp_post = (fun (x: t_z_89_) (out: t_z_89_) -> true); + f_opp + = + (fun (x: t_z_89_) -> + let q___:u8 = + (Hacspec_ovn.Ovn_traits.f_q #t_z_89_ #FStar.Tactics.Typeclasses.solve () <: t_z_89_) + .f_z_val -! + 1uy + in + let x___:u8 = x.f_z_val %! q___ in + { f_z_val = q___ -! x___ } <: t_z_89_); + f_mul_pre = (fun (x: t_z_89_) (y: t_z_89_) -> true); + f_mul_post = (fun (x: t_z_89_) (y: t_z_89_) (out: t_z_89_) -> true); + f_mul + = + (fun (x: t_z_89_) (y: t_z_89_) -> + let q___:u8 = + (Hacspec_ovn.Ovn_traits.f_q #t_z_89_ #FStar.Tactics.Typeclasses.solve () <: t_z_89_) + .f_z_val -! + 1uy + in + let (x___: u16):u16 = cast (x.f_z_val %! q___ <: u8) <: u16 in + let (y___: u16):u16 = cast (y.f_z_val %! q___ <: u8) <: u16 in + { f_z_val = cast ((x___ *! y___ <: u16) %! (cast (q___ <: u8) <: u16) <: u16) <: u8 } + <: + t_z_89_); + f_inv_pre = (fun (x: t_z_89_) -> true); + f_inv_post = (fun (x: t_z_89_) (out: t_z_89_) -> true); + f_inv + = + fun (x: t_z_89_) -> + Rust_primitives.Hax.Control_flow_monad.Mexception.run (let _:Prims.unit = + Hax_lib.v_assert false + in + let! hoist11:Rust_primitives.Hax.t_Never = + Core.Ops.Control_flow.ControlFlow_Break x + <: + Core.Ops.Control_flow.t_ControlFlow t_z_89_ Rust_primitives.Hax.t_Never + in + Core.Ops.Control_flow.ControlFlow_Continue (Rust_primitives.Hax.never_to_any hoist11) + <: + Core.Ops.Control_flow.t_ControlFlow t_z_89_ t_z_89_) + } + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl_1: Hacspec_ovn.Ovn_traits.t_Group t_g_z_89_ = + { + _super_11581440318597584651 = FStar.Tactics.Typeclasses.solve; + _super_12632649257025169145 = FStar.Tactics.Typeclasses.solve; + _super_8099741844003281729 = FStar.Tactics.Typeclasses.solve; + _super_9442900250278684536 = FStar.Tactics.Typeclasses.solve; + _super_11581440318597584651 = FStar.Tactics.Typeclasses.solve; + _super_17605656595743636193 = FStar.Tactics.Typeclasses.solve; + f_Z = t_z_89_; + f_Z_5568683927164688039 = FStar.Tactics.Typeclasses.solve; + f_g_pre = (fun (_: Prims.unit) -> true); + f_g_post = (fun (_: Prims.unit) (out: t_g_z_89_) -> true); + f_g = (fun (_: Prims.unit) -> { f_g_val = 3uy } <: t_g_z_89_); + f_hash_pre = (fun (x: Alloc.Vec.t_Vec t_g_z_89_ Alloc.Alloc.t_Global) -> true); + f_hash_post = (fun (x: Alloc.Vec.t_Vec t_g_z_89_ Alloc.Alloc.t_Global) (out: t_z_89_) -> true); + f_hash + = + (fun (x: Alloc.Vec.t_Vec t_g_z_89_ Alloc.Alloc.t_Global) -> + let res:t_z_89_ = + Hacspec_ovn.Ovn_traits.f_field_one #t_z_89_ #FStar.Tactics.Typeclasses.solve () + in + let res:t_z_89_ = + Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter #(Alloc.Vec.t_Vec + t_g_z_89_ Alloc.Alloc.t_Global) + #FStar.Tactics.Typeclasses.solve + x + <: + Alloc.Vec.Into_iter.t_IntoIter t_g_z_89_ Alloc.Alloc.t_Global) + res + (fun res y -> + let res:t_z_89_ = res in + let y:t_g_z_89_ = y in + Hacspec_ovn.Ovn_traits.f_mul #t_z_89_ + #FStar.Tactics.Typeclasses.solve + ({ f_z_val = y.f_g_val } <: t_z_89_) + res + <: + t_z_89_) + in + res); + f_g_pow_pre = (fun (x: t_z_89_) -> true); + f_g_pow_post = (fun (x: t_z_89_) (out: t_g_z_89_) -> true); + f_g_pow + = + (fun (x: t_z_89_) -> + Hacspec_ovn.Ovn_traits.f_pow #t_g_z_89_ + #FStar.Tactics.Typeclasses.solve + (Hacspec_ovn.Ovn_traits.f_g #t_g_z_89_ #FStar.Tactics.Typeclasses.solve () <: t_g_z_89_) + x); + f_pow_pre = (fun (g: t_g_z_89_) (x: t_z_89_) -> true); + f_pow_post = (fun (g: t_g_z_89_) (x: t_z_89_) (out: t_g_z_89_) -> true); + f_pow + = + (fun (g: t_g_z_89_) (x: t_z_89_) -> + let result:t_g_z_89_ = + Hacspec_ovn.Ovn_traits.f_group_one #t_g_z_89_ #FStar.Tactics.Typeclasses.solve () + in + let result:t_g_z_89_ = + Rust_primitives.Hax.Folds.fold_range 0uy + (x.f_z_val %! + ((Hacspec_ovn.Ovn_traits.f_q #t_z_89_ #FStar.Tactics.Typeclasses.solve () <: t_z_89_) + .f_z_val -! + 1uy + <: + u8) + <: + u8) + (fun result temp_1_ -> + let result:t_g_z_89_ = result in + let _:u8 = temp_1_ in + true) + result + (fun result temp_1_ -> + let result:t_g_z_89_ = result in + let _:u8 = temp_1_ in + Hacspec_ovn.Ovn_traits.f_prod #t_g_z_89_ #FStar.Tactics.Typeclasses.solve result g + <: + t_g_z_89_) + in + result); + f_group_one_pre = (fun (_: Prims.unit) -> true); + f_group_one_post = (fun (_: Prims.unit) (out: t_g_z_89_) -> true); + f_group_one = (fun (_: Prims.unit) -> { f_g_val = 1uy } <: t_g_z_89_); + f_prod_pre = (fun (x: t_g_z_89_) (y: t_g_z_89_) -> true); + f_prod_post = (fun (x: t_g_z_89_) (y: t_g_z_89_) (out: t_g_z_89_) -> true); + f_prod + = + (fun (x: t_g_z_89_) (y: t_g_z_89_) -> + let q___:u8 = + (Hacspec_ovn.Ovn_traits.f_q #t_z_89_ #FStar.Tactics.Typeclasses.solve ()).f_z_val + in + let x___:u16 = cast (x.f_g_val %! q___ <: u8) <: u16 in + let y___:u16 = cast (y.f_g_val %! q___ <: u8) <: u16 in + { f_g_val = cast ((x___ *! y___ <: u16) %! (cast (q___ <: u8) <: u16) <: u16) <: u8 } + <: + t_g_z_89_); + f_group_inv_pre = (fun (x: t_g_z_89_) -> true); + f_group_inv_post = (fun (x: t_g_z_89_) (out: t_g_z_89_) -> true); + f_group_inv + = + fun (x: t_g_z_89_) -> + Rust_primitives.Hax.Control_flow_monad.Mexception.run (let _:Prims.unit = + Rust_primitives.Hax.failure "(FunctionalizeLoops) something is not implemented yet.\nLoop without mutation?" + "{\n for j in (core::iter::traits::collect::f_into_iter(core::ops::range::Range {\n f_start: 0,\n f_end: 89,\n })) {\n {\n let g_value: hacspec_ovn::ovn_z_89_::t_g_z_89_ = {\n hacspec_ovn::ovn_z_89_::C_g_z_89_ {\n f_g_val: j,\n }\n };\n (if core::cmp::f_eq(\n hacspec_ovn::ovn_traits::f_prod(x, g_value),\n hacspec_ovn::ovn_traits::f_group_one(Tuple0),\n ) {\n {\n #[note(\n \"rhs.typ=core::ops::control_flow::t_ControlFlow\"\n )]\n #[monadic_let(MException)]\n let hoist15: rust_primitives::hax::t_Never = {\n core::ops::control_flow::ControlFlow_Break(g_value)\n };\n core::ops::control_flow::ControlFlow_Continue(\n rust_primitives::hax::never_to_any(hoist15),\n )\n }\n } else {\n core::ops::control_flow::ControlFlow_Continue(Tuple0)\n })\n }\n }\n }" + + in + let _:Prims.unit = Hax_lib.v_assert false in + let! hoist16:Rust_primitives.Hax.t_Never = + Core.Ops.Control_flow.ControlFlow_Break x + <: + Core.Ops.Control_flow.t_ControlFlow t_g_z_89_ Rust_primitives.Hax.t_Never + in + Core.Ops.Control_flow.ControlFlow_Continue (Rust_primitives.Hax.never_to_any hoist16) + <: + Core.Ops.Control_flow.t_ControlFlow t_g_z_89_ t_g_z_89_) + } diff --git a/ovn/proofs/ssprove/extraction/.filestoinstall b/ovn/proofs/ssprove/extraction/.filestoinstall new file mode 100644 index 0000000..b6296d5 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/.filestoinstall @@ -0,0 +1 @@ +Hacspec_ovn_Ovn_traits.vo Hacspec_ovn_Ovn_group.vo Hacspec_ovn.vo pkg_advantage.vo SigmaProtocol.vo Schnorr.vo DDH.vo OVN.vo ovn_eq_proof.vo Hacspec_ovn_Ovn_traits.v Hacspec_ovn_Ovn_group.v Hacspec_ovn.v pkg_advantage.v SigmaProtocol.v Schnorr.v DDH.v OVN.v ovn_eq_proof.v Hacspec_ovn_Ovn_traits.glob Hacspec_ovn_Ovn_group.glob Hacspec_ovn.glob pkg_advantage.glob SigmaProtocol.glob Schnorr.glob DDH.glob OVN.glob ovn_eq_proof.glob diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group.v index 32fefa8..dd49206 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group.v @@ -27,78 +27,75 @@ Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. Require Import Crate_Ovn_traits. Export Crate_Ovn_traits. -Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (random : both L1 I1 int32) : both L1 I1 v_Z := - select_private_voting_key random := - solve_lift (f_random_field_elem random) : both L1 I1 v_Z. +Equations sub {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (x : both v_Z) (y : both v_Z) : both v_Z := + sub x y := + x .+ (f_neg y) : both v_Z. Fail Next Obligation. -Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (xi : both L1 I1 f_Z) (vote : both L2 I2 'bool) (g_pow_yi : both L3 I3 v_G) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) v_G := +Equations compute_group_element_for_vote {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (xi : both f_Z) (vote : both 'bool) (g_pow_yi : both v_G) : both v_G := compute_group_element_for_vote xi vote g_pow_yi := - solve_lift (f_prod (f_pow g_pow_yi xi) (f_g_pow (ifb vote - then f_field_one (ret_both (tt : 'unit)) - else f_field_zero (ret_both (tt : 'unit))))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) v_G. + (f_pow g_pow_yi xi) .* (f_g_pow (ifb vote + then f_field_one + else f_field_zero)) : both v_G. Fail Next Obligation. -Definition prod1_loc {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} : Location := - (v_G;0%nat). -Definition prod2_loc {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} : Location := - (v_G;1%nat). -Equations compute_g_pow_yi {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} (i : both L1 I1 uint_size) (xis : both L2 I2 (nseq v_G (is_pure (n)))) : both (L1 :|: L2 :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2) v_G := +Equations div {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (x : both v_G) (y : both v_G) : both v_G := + div x y := + x .* (f_group_inv y) : both v_G. +Fail Next Obligation. + +Equations compute_g_pow_yi {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (i : both uint_size) (xis : both (nseq v_G (is_pure (n)))) : both v_G := compute_g_pow_yi i xis := - letb prod1 loc(prod1_loc) := f_group_one (ret_both (tt : 'unit)) in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => - ssp (fun _ => - assign todo(term) : (both (*1*)(L2:|:L1:|:fset [prod1_loc]) (I2:|:I1) 'unit))) (ret_both (tt : 'unit)) in - letb prod2 loc(prod2_loc) := f_group_one (ret_both (tt : 'unit)) in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => - ssp (fun _ => - assign todo(term) : (both (*1*)(L2:|:L1:|:fset [prod2_loc]) (I2:|:I1) 'unit))) (ret_both (tt : 'unit)) in - solve_lift (f_div prod1 prod2) : both (L1 :|: L2 :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2) v_G. + letb prod1 := f_product (f_map (impl__iter (xis.a[(Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))])) (fun x => + f_clone x)) in + letb prod2 := f_product (f_map (impl__iter (xis.a[(Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))])) (fun x => + f_clone x)) in + div prod1 prod2 : both v_G. Fail Next Obligation. -Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (g_pow_xi_yi_vi : both L1 I1 v_G) (commitment : both L2 I2 f_Z) : both (L1 :|: L2) (I1 :|: I2) 'bool := +Equations check_commitment {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (g_pow_xi_yi_vi : both v_G) (commitment : both f_Z) : both 'bool := check_commitment g_pow_xi_yi_vi commitment := - solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both (L1 :|: L2) (I1 :|: I2) 'bool. + (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment : both 'bool. Fail Next Obligation. -Equations commit_to {L1 : {fset Location}} {I1 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (g_pow_xi_yi_vi : both L1 I1 v_G) : both L1 I1 f_Z := +Equations commit_to {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (g_pow_xi_yi_vi : both v_G) : both f_Z := commit_to g_pow_xi_yi_vi := - solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both L1 I1 f_Z. + f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi])))) : both f_Z. Fail Next Obligation. Definition t_CastVoteParam {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} : choice_type := - (int32 × v_Z × int32 × int32 × int32 × 'bool). -Equations f_cvp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both L I t_CastVoteParam) : both L I int32 := + (int32 × v_Z × v_Z × v_Z × v_Z × 'bool). +Equations f_cvp_i {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both int32 := f_cvp_i s := bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : int32))) : both L I int32. + ret_both (fst (fst (fst (fst (fst x)))) : int32)) : both int32. Fail Next Obligation. -Equations f_cvp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both L I t_CastVoteParam) : both L I v_Z := +Equations f_cvp_xi {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both v_Z := f_cvp_xi s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : v_Z))) : both L I v_Z. + ret_both (snd (fst (fst (fst (fst x)))) : v_Z)) : both v_Z. Fail Next Obligation. -Equations f_cvp_zkp_random_w {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both L I t_CastVoteParam) : both L I int32 := +Equations f_cvp_zkp_random_w {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both v_Z := f_cvp_zkp_random_w s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : int32))) : both L I int32. + ret_both (snd (fst (fst (fst x))) : v_Z)) : both v_Z. Fail Next Obligation. -Equations f_cvp_zkp_random_r {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both L I t_CastVoteParam) : both L I int32 := +Equations f_cvp_zkp_random_r {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both v_Z := f_cvp_zkp_random_r s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : int32))) : both L I int32. + ret_both (snd (fst (fst x)) : v_Z)) : both v_Z. Fail Next Obligation. -Equations f_cvp_zkp_random_d {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both L I t_CastVoteParam) : both L I int32 := +Equations f_cvp_zkp_random_d {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both v_Z := f_cvp_zkp_random_d s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int32))) : both L I int32. + ret_both (snd (fst x) : v_Z)) : both v_Z. Fail Next Obligation. -Equations f_cvp_vote {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both L I t_CastVoteParam) : both L I 'bool := +Equations f_cvp_vote {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both 'bool := f_cvp_vote s := bind_both s (fun x => - solve_lift (ret_both (snd x : 'bool))) : both L I 'bool. + ret_both (snd x : 'bool)) : both 'bool. Fail Next Obligation. -Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} {f_cvp_i : both L0 I0 int32} {f_cvp_xi : both L1 I1 v_Z} {f_cvp_zkp_random_w : both L2 I2 int32} {f_cvp_zkp_random_r : both L3 I3 int32} {f_cvp_zkp_random_d : both L4 I4 int32} {f_cvp_vote : both L5 I5 'bool} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_CastVoteParam) := +Equations Build_t_CastVoteParam {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} {f_cvp_i : both int32} {f_cvp_xi : both v_Z} {f_cvp_zkp_random_w : both v_Z} {f_cvp_zkp_random_r : both v_Z} {f_cvp_zkp_random_d : both v_Z} {f_cvp_vote : both 'bool} : both (t_CastVoteParam) := Build_t_CastVoteParam := bind_both f_cvp_vote (fun f_cvp_vote => bind_both f_cvp_zkp_random_d (fun f_cvp_zkp_random_d => @@ -106,7 +103,7 @@ Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L bind_both f_cvp_zkp_random_w (fun f_cvp_zkp_random_w => bind_both f_cvp_xi (fun f_cvp_xi => bind_both f_cvp_i (fun f_cvp_i => - solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_CastVoteParam). + ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam)))))))) : both (t_CastVoteParam). Fail Next Obligation. Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). @@ -117,62 +114,62 @@ Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Bui Definition t_OrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} : choice_type := (v_G × v_G × v_G × v_G × v_G × v_G × f_Z × f_Z × f_Z × f_Z × f_Z). -Equations f_or_zkp_x {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I v_G := +Equations f_or_zkp_x {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := f_or_zkp_x s := bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : v_G))) : both L I v_G. + ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : v_G)) : both v_G. Fail Next Obligation. -Equations f_or_zkp_y {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I v_G := +Equations f_or_zkp_y {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := f_or_zkp_y s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : v_G))) : both L I v_G. + ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : v_G)) : both v_G. Fail Next Obligation. -Equations f_or_zkp_a1 {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I v_G := +Equations f_or_zkp_a1 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := f_or_zkp_a1 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : v_G))) : both L I v_G. + ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : v_G)) : both v_G. Fail Next Obligation. -Equations f_or_zkp_b1 {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I v_G := +Equations f_or_zkp_b1 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := f_or_zkp_b1 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : v_G))) : both L I v_G. + ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : v_G)) : both v_G. Fail Next Obligation. -Equations f_or_zkp_a2 {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I v_G := +Equations f_or_zkp_a2 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := f_or_zkp_a2 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : v_G))) : both L I v_G. + ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : v_G)) : both v_G. Fail Next Obligation. -Equations f_or_zkp_b2 {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I v_G := +Equations f_or_zkp_b2 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := f_or_zkp_b2 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : v_G))) : both L I v_G. + ret_both (snd (fst (fst (fst (fst (fst x))))) : v_G)) : both v_G. Fail Next Obligation. -Equations f_or_zkp_c {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I f_Z := +Equations f_or_zkp_c {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := f_or_zkp_c s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_Z))) : both L I f_Z. + ret_both (snd (fst (fst (fst (fst x)))) : f_Z)) : both f_Z. Fail Next Obligation. -Equations f_or_zkp_d1 {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I f_Z := +Equations f_or_zkp_d1 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := f_or_zkp_d1 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : f_Z))) : both L I f_Z. + ret_both (snd (fst (fst (fst x))) : f_Z)) : both f_Z. Fail Next Obligation. -Equations f_or_zkp_d2 {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I f_Z := +Equations f_or_zkp_d2 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := f_or_zkp_d2 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : f_Z))) : both L I f_Z. + ret_both (snd (fst (fst x)) : f_Z)) : both f_Z. Fail Next Obligation. -Equations f_or_zkp_r1 {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I f_Z := +Equations f_or_zkp_r1 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := f_or_zkp_r1 s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_Z))) : both L I f_Z. + ret_both (snd (fst x) : f_Z)) : both f_Z. Fail Next Obligation. -Equations f_or_zkp_r2 {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OrZKPCommit) : both L I f_Z := +Equations f_or_zkp_r2 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := f_or_zkp_r2 s := bind_both s (fun x => - solve_lift (ret_both (snd x : f_Z))) : both L I f_Z. + ret_both (snd x : f_Z)) : both f_Z. Fail Next Obligation. -Equations Build_t_OrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {L7 : {fset Location}} {L8 : {fset Location}} {L9 : {fset Location}} {L10 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {I7 : Interface} {I8 : Interface} {I9 : Interface} {I10 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} {f_or_zkp_x : both L0 I0 v_G} {f_or_zkp_y : both L1 I1 v_G} {f_or_zkp_a1 : both L2 I2 v_G} {f_or_zkp_b1 : both L3 I3 v_G} {f_or_zkp_a2 : both L4 I4 v_G} {f_or_zkp_b2 : both L5 I5 v_G} {f_or_zkp_c : both L6 I6 f_Z} {f_or_zkp_d1 : both L7 I7 f_Z} {f_or_zkp_d2 : both L8 I8 f_Z} {f_or_zkp_r1 : both L9 I9 f_Z} {f_or_zkp_r2 : both L10 I10 f_Z} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit) := +Equations Build_t_OrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} {f_or_zkp_x : both v_G} {f_or_zkp_y : both v_G} {f_or_zkp_a1 : both v_G} {f_or_zkp_b1 : both v_G} {f_or_zkp_a2 : both v_G} {f_or_zkp_b2 : both v_G} {f_or_zkp_c : both f_Z} {f_or_zkp_d1 : both f_Z} {f_or_zkp_d2 : both f_Z} {f_or_zkp_r1 : both f_Z} {f_or_zkp_r2 : both f_Z} : both (t_OrZKPCommit) := Build_t_OrZKPCommit := bind_both f_or_zkp_r2 (fun f_or_zkp_r2 => bind_both f_or_zkp_r1 (fun f_or_zkp_r1 => @@ -185,7 +182,7 @@ Equations Build_t_OrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 bind_both f_or_zkp_a1 (fun f_or_zkp_a1 => bind_both f_or_zkp_y (fun f_or_zkp_y => bind_both f_or_zkp_x (fun f_or_zkp_x => - solve_lift (ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit)))))))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit). + ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit))))))))))))) : both (t_OrZKPCommit). Fail Next Obligation. Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := y) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := y) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). @@ -200,28 +197,28 @@ Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r1' ':=' y ')'" := (Buil Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := y)). Definition t_RegisterParam {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} : choice_type := - (int32 × v_Z × int32). -Equations f_rp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both L I t_RegisterParam) : both L I int32 := + (int32 × v_Z × v_Z). +Equations f_rp_i {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_RegisterParam) : both int32 := f_rp_i s := bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both L I int32. + ret_both (fst (fst x) : int32)) : both int32. Fail Next Obligation. -Equations f_rp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both L I t_RegisterParam) : both L I v_Z := +Equations f_rp_xi {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_RegisterParam) : both v_Z := f_rp_xi s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : v_Z))) : both L I v_Z. + ret_both (snd (fst x) : v_Z)) : both v_Z. Fail Next Obligation. -Equations f_rp_zkp_random {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both L I t_RegisterParam) : both L I int32 := +Equations f_rp_zkp_random {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_RegisterParam) : both v_Z := f_rp_zkp_random s := bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I int32. + ret_both (snd x : v_Z)) : both v_Z. Fail Next Obligation. -Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} {f_rp_i : both L0 I0 int32} {f_rp_xi : both L1 I1 v_Z} {f_rp_zkp_random : both L2 I2 int32} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_RegisterParam) := +Equations Build_t_RegisterParam {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} {f_rp_i : both int32} {f_rp_xi : both v_Z} {f_rp_zkp_random : both v_Z} : both (t_RegisterParam) := Build_t_RegisterParam := bind_both f_rp_zkp_random (fun f_rp_zkp_random => bind_both f_rp_xi (fun f_rp_xi => bind_both f_rp_i (fun f_rp_i => - solve_lift (ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_RegisterParam). + ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam))))) : both (t_RegisterParam). Fail Next Obligation. Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x)). Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y) (f_rp_zkp_random := f_rp_zkp_random x)). @@ -229,27 +226,27 @@ Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := Definition t_SchnorrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} : choice_type := (v_G × f_Z × f_Z). -Equations f_schnorr_zkp_u {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_SchnorrZKPCommit) : both L I v_G := +Equations f_schnorr_zkp_u {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_SchnorrZKPCommit) : both v_G := f_schnorr_zkp_u s := bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : v_G))) : both L I v_G. + ret_both (fst (fst x) : v_G)) : both v_G. Fail Next Obligation. -Equations f_schnorr_zkp_c {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_SchnorrZKPCommit) : both L I f_Z := +Equations f_schnorr_zkp_c {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_SchnorrZKPCommit) : both f_Z := f_schnorr_zkp_c s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_Z))) : both L I f_Z. + ret_both (snd (fst x) : f_Z)) : both f_Z. Fail Next Obligation. -Equations f_schnorr_zkp_z {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_SchnorrZKPCommit) : both L I f_Z := +Equations f_schnorr_zkp_z {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_SchnorrZKPCommit) : both f_Z := f_schnorr_zkp_z s := bind_both s (fun x => - solve_lift (ret_both (snd x : f_Z))) : both L I f_Z. + ret_both (snd x : f_Z)) : both f_Z. Fail Next Obligation. -Equations Build_t_SchnorrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} {f_schnorr_zkp_u : both L0 I0 v_G} {f_schnorr_zkp_c : both L1 I1 f_Z} {f_schnorr_zkp_z : both L2 I2 f_Z} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit) := +Equations Build_t_SchnorrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} {f_schnorr_zkp_u : both v_G} {f_schnorr_zkp_c : both f_Z} {f_schnorr_zkp_z : both f_Z} : both (t_SchnorrZKPCommit) := Build_t_SchnorrZKPCommit := bind_both f_schnorr_zkp_z (fun f_schnorr_zkp_z => bind_both f_schnorr_zkp_c (fun f_schnorr_zkp_c => bind_both f_schnorr_zkp_u (fun f_schnorr_zkp_u => - solve_lift (ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit). + ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit))))) : both (t_SchnorrZKPCommit). Fail Next Obligation. Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := y) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := y) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). @@ -257,40 +254,40 @@ Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_z' ':=' y ')'" Definition t_TallyParameter : choice_type := 'unit. -Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := +Equations Build_t_TallyParameter : both (t_TallyParameter) := Build_t_TallyParameter := - solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). + ret_both (tt (* Empty tuple *) : (t_TallyParameter)) : both (t_TallyParameter). Fail Next Obligation. -Equations schnorr_zkp {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (random : both L1 I1 int32) (h : both L2 I2 v_G) (x : both L3 I3 f_Z) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit v_G) := +Equations schnorr_zkp {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (random : both f_Z) (h : both v_G) (x : both f_Z) : both (t_SchnorrZKPCommit v_G) := schnorr_zkp random h x := - solve_lift (run (letb r := f_random_field_elem random in + run (letb r := random in letb u := f_g_pow r in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g; h; u])))) in - letb z := f_add r (f_mul c x) in - letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit v_G)] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in - ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit v_G). + letb z := r .+ (c .* x) in + letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit v_G)] hoist1 := ControlFlow_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in + ControlFlow_Continue (never_to_any hoist1)) : both (t_SchnorrZKPCommit v_G). Fail Next Obligation. -Equations schnorr_zkp_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (h : both L1 I1 v_G) (pi : both L2 I2 (t_SchnorrZKPCommit v_G)) : both (L1 :|: L2) (I1 :|: I2) 'bool := +Equations schnorr_zkp_validate {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (h : both v_G) (pi : both (t_SchnorrZKPCommit v_G)) : both 'bool := schnorr_zkp_validate h pi := - solve_lift (andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); + andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g; h; - f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both (L1 :|: L2) (I1 :|: I2) 'bool. + f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? ((f_schnorr_zkp_u pi) .* (f_pow h (f_schnorr_zkp_c pi)))) : both 'bool. Fail Next Obligation. -Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (random_w : both L1 I1 int32) (random_r : both L2 I2 int32) (random_d : both L3 I3 int32) (h : both L4 I4 v_G) (xi : both L5 I5 f_Z) (vi : both L6 I6 'bool) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit v_G) := +Equations zkp_one_out_of_two {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (random_w : both f_Z) (random_r : both f_Z) (random_d : both f_Z) (h : both v_G) (xi : both f_Z) (vi : both 'bool) : both (t_OrZKPCommit v_G) := zkp_one_out_of_two random_w random_r random_d h xi vi := - letb w := f_random_field_elem random_w in - solve_lift (ifb vi - then letb r1 := f_random_field_elem random_r in - letb d1 := f_random_field_elem random_d in + letb w := random_w in + ifb vi + then letb r1 := random_r in + letb d1 := random_d in letb x := f_g_pow xi in - letb y := f_prod (f_pow h xi) (f_g (ret_both (tt : 'unit))) in - letb a1 := f_prod (f_g_pow r1) (f_pow x d1) in - letb b1 := f_prod (f_pow h r1) (f_pow y d1) in + letb y := (f_pow h xi) .* f_g in + letb a1 := (f_g_pow r1) .* (f_pow x d1) in + letb b1 := (f_pow h r1) .* (f_pow y d1) in letb a2 := f_g_pow w in letb b2 := f_pow h w in letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; @@ -299,29 +296,29 @@ Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : b1; a2; b2])))) in - letb d2 := f_sub c d1 in - letb r2 := f_sub w (f_mul xi d2) in + letb d2 := sub c d1 in + letb r2 := sub w (xi .* d2) in Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2) - else letb r2 := f_random_field_elem random_r in - letb d2 := f_random_field_elem random_d in + else letb r2 := random_r in + letb d2 := random_d in letb x := f_g_pow xi in letb y := f_pow h xi in letb a1 := f_g_pow w in letb b1 := f_pow h w in - letb a2 := f_prod (f_g_pow r2) (f_pow x d2) in - letb b2 := f_prod (f_pow h r2) (f_pow (f_div y (f_g (ret_both (tt : 'unit)))) d2) in + letb a2 := (f_g_pow r2) .* (f_pow x d2) in + letb b2 := (f_pow h r2) .* (f_pow (div y f_g) d2) in letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; y; a1; b1; a2; b2])))) in - letb d1 := f_sub c d2 in - letb r1 := f_sub w (f_mul xi d1) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit v_G). + letb d1 := sub c d2 in + letb r1 := sub w (xi .* d1) in + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2) : both (t_OrZKPCommit v_G). Fail Next Obligation. -Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (h : both L1 I1 v_G) (zkp : both L2 I2 (t_OrZKPCommit v_G)) : both (L1 :|: L2) (I1 :|: I2) 'bool := +Equations zkp_one_out_of_two_validate {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (h : both v_G) (zkp : both (t_OrZKPCommit v_G)) : both 'bool := zkp_one_out_of_two_validate h zkp := letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; f_or_zkp_y zkp; @@ -329,47 +326,47 @@ Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Locatio f_or_zkp_b1 zkp; f_or_zkp_a2 zkp; f_or_zkp_b2 zkp])))) in - solve_lift (andb (andb (andb (andb (c =.? (f_add (f_or_zkp_d1 zkp) (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? (f_prod (f_pow h (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r2 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? (f_prod (f_pow h (f_or_zkp_r2 zkp)) (f_pow (f_div (f_or_zkp_y zkp) (f_g (ret_both (tt : 'unit)))) (f_or_zkp_d2 zkp))))) : both (L1 :|: L2) (I1 :|: I2) 'bool. + andb (andb (andb (andb (c =.? ((f_or_zkp_d1 zkp) .+ (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? ((f_g_pow (f_or_zkp_r1 zkp)) .* (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? ((f_pow h (f_or_zkp_r1 zkp)) .* (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? ((f_g_pow (f_or_zkp_r2 zkp)) .* (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? ((f_pow h (f_or_zkp_r2 zkp)) .* (f_pow (div (f_or_zkp_y zkp) f_g) (f_or_zkp_d2 zkp)))) : both 'bool. Fail Next Obligation. -Definition t_OvnContractState {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} : choice_type := +Definition t_OvnContractState {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} : choice_type := (nseq v_G (is_pure (n)) × nseq (t_SchnorrZKPCommit v_G) (is_pure (n)) × nseq f_Z (is_pure (n)) × nseq v_G (is_pure (n)) × nseq (t_OrZKPCommit v_G) (is_pure (n)) × int32 × nseq 'bool (is_pure (n))). -Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OvnContractState) : both L I (nseq v_G (is_pure (n))) := +Equations f_g_pow_xis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq v_G (is_pure (n))) := f_g_pow_xis s := bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst (fst x))))) : (nseq v_G (is_pure (n)))))) : both L I (nseq v_G (is_pure (n))). + ret_both (fst (fst (fst (fst (fst (fst x))))) : (nseq v_G (is_pure (n))))) : both (nseq v_G (is_pure (n))). Fail Next Obligation. -Equations f_zkp_xis {L : {fset Location}} {I : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OvnContractState) : both L I (nseq (t_SchnorrZKPCommit v_G) (is_pure (n))) := +Equations f_zkp_xis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq (t_SchnorrZKPCommit v_G) (is_pure (n))) := f_zkp_xis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : (nseq (t_SchnorrZKPCommit v_G) (is_pure (n)))))) : both L I (nseq (t_SchnorrZKPCommit v_G) (is_pure (n))). + ret_both (snd (fst (fst (fst (fst (fst x))))) : (nseq (t_SchnorrZKPCommit v_G) (is_pure (n))))) : both (nseq (t_SchnorrZKPCommit v_G) (is_pure (n))). Fail Next Obligation. -Equations f_commit_vis {L : {fset Location}} {I : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OvnContractState) : both L I (nseq f_Z (is_pure (n))) := +Equations f_commit_vis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq f_Z (is_pure (n))) := f_commit_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : (nseq f_Z (is_pure (n)))))) : both L I (nseq f_Z (is_pure (n))). + ret_both (snd (fst (fst (fst (fst x)))) : (nseq f_Z (is_pure (n))))) : both (nseq f_Z (is_pure (n))). Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OvnContractState) : both L I (nseq v_G (is_pure (n))) := +Equations f_g_pow_xi_yi_vis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq v_G (is_pure (n))) := f_g_pow_xi_yi_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : (nseq v_G (is_pure (n)))))) : both L I (nseq v_G (is_pure (n))). + ret_both (snd (fst (fst (fst x))) : (nseq v_G (is_pure (n))))) : both (nseq v_G (is_pure (n))). Fail Next Obligation. -Equations f_zkp_vis {L : {fset Location}} {I : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OvnContractState) : both L I (nseq (t_OrZKPCommit v_G) (is_pure (n))) := +Equations f_zkp_vis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq (t_OrZKPCommit v_G) (is_pure (n))) := f_zkp_vis s := bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : (nseq (t_OrZKPCommit v_G) (is_pure (n)))))) : both L I (nseq (t_OrZKPCommit v_G) (is_pure (n))). + ret_both (snd (fst (fst x)) : (nseq (t_OrZKPCommit v_G) (is_pure (n))))) : both (nseq (t_OrZKPCommit v_G) (is_pure (n))). Fail Next Obligation. -Equations f_tally {L : {fset Location}} {I : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OvnContractState) : both L I int32 := +Equations f_tally {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both int32 := f_tally s := bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int32))) : both L I int32. + ret_both (snd (fst x) : int32)) : both int32. Fail Next Obligation. -Equations f_round1 {L : {fset Location}} {I : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both L I t_OvnContractState) : both L I (nseq 'bool (is_pure (n))) := +Equations f_round1 {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq 'bool (is_pure (n))) := f_round1 s := bind_both s (fun x => - solve_lift (ret_both (snd x : (nseq 'bool (is_pure (n)))))) : both L I (nseq 'bool (is_pure (n))). + ret_both (snd x : (nseq 'bool (is_pure (n))))) : both (nseq 'bool (is_pure (n))). Fail Next Obligation. -Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} {f_g_pow_xis : both L0 I0 (nseq v_G (is_pure (n)))} {f_zkp_xis : both L1 I1 (nseq (t_SchnorrZKPCommit v_G) (is_pure (n)))} {f_commit_vis : both L2 I2 (nseq f_Z (is_pure (n)))} {f_g_pow_xi_yi_vis : both L3 I3 (nseq v_G (is_pure (n)))} {f_zkp_vis : both L4 I4 (nseq (t_OrZKPCommit v_G) (is_pure (n)))} {f_tally : both L5 I5 int32} {f_round1 : both L6 I6 (nseq 'bool (is_pure (n)))} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6) (t_OvnContractState) := +Equations Build_t_OvnContractState {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} {f_g_pow_xis : both (nseq v_G (is_pure (n)))} {f_zkp_xis : both (nseq (t_SchnorrZKPCommit v_G) (is_pure (n)))} {f_commit_vis : both (nseq f_Z (is_pure (n)))} {f_g_pow_xi_yi_vis : both (nseq v_G (is_pure (n)))} {f_zkp_vis : both (nseq (t_OrZKPCommit v_G) (is_pure (n)))} {f_tally : both int32} {f_round1 : both (nseq 'bool (is_pure (n)))} : both (t_OvnContractState) := Build_t_OvnContractState := bind_both f_round1 (fun f_round1 => bind_both f_tally (fun f_tally => @@ -378,7 +375,7 @@ Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} bind_both f_commit_vis (fun f_commit_vis => bind_both f_zkp_xis (fun f_zkp_xis => bind_both f_g_pow_xis (fun f_g_pow_xis => - solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally,f_round1) : (t_OvnContractState)))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6) (t_OvnContractState). + ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally,f_round1) : (t_OvnContractState))))))))) : both (t_OvnContractState). Fail Next Obligation. Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := f_round1 x)). Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := f_round1 x)). @@ -388,97 +385,83 @@ Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (B Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y) (f_round1 := f_round1 x)). Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_round1' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := y)). -Definition cast_vote_state_ret_loc {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := - (t_OvnContractState v_G (both (fset []) (fset []) uint_size);5%nat). -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both L1 I1 impl_574521470_) (state : both L2 I2 (t_OvnContractState v_G (both (fset []) (fset []) uint_size))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError) := +Equations cast_vote {v_G : _} {n : both uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both impl_574521470_) (state : both (t_OvnContractState v_G (both uint_size))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) := cast_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code t_ParseError] (params : t_CastVoteParam f_Z) := impl__map_err out f_from in + run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code t_ParseError] (params : t_CastVoteParam f_Z) := out in Result_Ok (letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in - letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError). + letb cast_vote_state_ret := f_clone state in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in + Result_Ok (prod_b (f_accept,cast_vote_state_ret)))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError). Fail Next Obligation. -Definition commit_to_vote_state_ret_loc {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := - (t_OvnContractState v_G (both (fset []) (fset []) uint_size);6%nat). -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both L1 I1 impl_574521470_) (state : both L2 I2 (t_OvnContractState v_G (both (fset []) (fset []) uint_size))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError) := +Equations commit_to_vote {v_G : _} {n : both uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both impl_574521470_) (state : both (t_OvnContractState v_G (both uint_size))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) := commit_to_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code t_ParseError] (params : t_CastVoteParam f_Z) := impl__map_err out f_from in + run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code t_ParseError] (params : t_CastVoteParam f_Z) := out in Result_Ok (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => - solve_lift (ifb orb (not (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i]))) (not ((f_round1 state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError)] hoist26 := v_Break (Result_Err ParseError) in + ifb orb (not (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i]))) (not ((f_round1 state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError)] hoist26 := ControlFlow_Break (Result_Err ParseError) in ControlFlow_Continue (never_to_any hoist26) - else ()) : (both (*0*)(L2:|:fset []) (I2) (t_ControlFlow (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError) 'unit)))) (ret_both (tt : 'unit)) in + else ControlFlow_Continue (ret_both (tt : 'unit)) : (both (t_ControlFlow (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) 'unit)))) (ret_both (tt : 'unit)) in letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in letb commit_vi := commit_to g_pow_xi_yi_vi in - letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in - letb _ := assign todo(term) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError). + letb commit_to_vote_state_ret := f_clone state in + letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in + Result_Ok (prod_b (f_accept,commit_to_vote_state_ret)))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError). Fail Next Obligation. -Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} `{ t_Sized v_G} `{ t_Group v_G} (_ : both L1 I1 'unit) : both L1 I1 (t_Result (t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_Reject) := +Equations init_ovn_contract {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (_ : both 'unit) : both (t_Result (t_OvnContractState v_G (both uint_size)) t_Reject) := init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_field_zero (ret_both (tt : 'unit))) (f_schnorr_zkp_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_y := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_c := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d2 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)) (f_round1 := repeat (ret_both (false : 'bool)) n))) : both L1 I1 (t_Result (t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_Reject). + Result_Ok (Build_t_OvnContractState (f_g_pow_xis := repeat f_group_one n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one) (f_schnorr_zkp_z := f_field_zero) (f_schnorr_zkp_c := f_field_zero)) n) (f_commit_vis := repeat f_field_zero n) (f_g_pow_xi_yi_vis := repeat f_group_one n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one) (f_or_zkp_y := f_group_one) (f_or_zkp_a1 := f_group_one) (f_or_zkp_b1 := f_group_one) (f_or_zkp_a2 := f_group_one) (f_or_zkp_b2 := f_group_one) (f_or_zkp_c := f_field_zero) (f_or_zkp_d1 := f_field_zero) (f_or_zkp_d2 := f_field_zero) (f_or_zkp_r1 := f_field_zero) (f_or_zkp_r2 := f_field_zero)) n) (f_tally := ret_both (0 : int32)) (f_round1 := repeat (ret_both (false : 'bool)) n)) : both (t_Result (t_OvnContractState v_G (both uint_size)) t_Reject). Fail Next Obligation. -Definition register_vote_state_ret_loc {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := - (t_OvnContractState v_G (both (fset []) (fset []) uint_size);7%nat). -Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both L1 I1 impl_574521470_) (state : both L2 I2 (t_OvnContractState v_G (both (fset []) (fset []) uint_size))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError) := +Equations register_vote {v_G : _} {n : both uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both impl_574521470_) (state : both (t_OvnContractState v_G (both uint_size))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) := register_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code t_ParseError] (params : t_RegisterParam f_Z) := impl__map_err out f_from in + run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code t_ParseError] (params : t_RegisterParam f_Z) := out in Result_Ok (letb g_pow_xi := f_g_pow (f_rp_xi params) in letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in - letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError). + letb register_vote_state_ret := f_clone state in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_round1 := update_at_usize (f_round1 register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) (ret_both (true : 'bool))) in + Result_Ok (prod_b (f_accept,register_vote_state_ret)))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError). Fail Next Obligation. -Definition curr_loc {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := - (f_Z;8%nat). -Definition tally_loc {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := - (int32;9%nat). -Definition tally_votes_state_ret_loc {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := - (t_OvnContractState v_G (both (fset []) (fset []) uint_size);10%nat). -Definition vote_result_loc {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := - (v_G;11%nat). -Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_G : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (_ : both L1 I1 impl_574521470_) (state : both L2 I2 (t_OvnContractState v_G (both (fset []) (fset []) uint_size))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError) := +Equations tally_votes {v_G : _} {n : both uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (_ : both impl_574521470_) (state : both (t_OvnContractState v_G (both uint_size))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) := tally_votes _ state := letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => ssp (fun _ => letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in - letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError)] _ := ControlFlow_Continue (ifb not (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError)] hoist27 := v_Break (Result_Err ParseError) in + letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError)] _ := ControlFlow_Continue (ifb not (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError)] hoist27 := ControlFlow_Break (Result_Err ParseError) in ControlFlow_Continue (never_to_any hoist27) - else ()) in - solve_lift (ifb not (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError)] hoist28 := v_Break (Result_Err ParseError) in + else ControlFlow_Continue (ret_both (tt : 'unit))) in + ifb not (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError)] hoist28 := ControlFlow_Break (Result_Err ParseError) in ControlFlow_Continue (never_to_any hoist28) - else ()) : (both (*2*)(L2:|:fset [prod1_loc;prod2_loc]) (I2) (t_ControlFlow (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError) 'unit)))) (ret_both (tt : 'unit)) in - letb vote_result loc(vote_result_loc) := f_group_one (ret_both (tt : 'unit)) in - letb _ := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => - ssp (fun _ => - assign todo(term) : (both (*1*)(L2:|:fset [vote_result_loc]) (I2) 'unit))) (ret_both (tt : 'unit)) in - letb tally loc(tally_loc) := ret_both (0 : int32) in - letb curr loc(curr_loc) := f_field_zero (ret_both (tt : 'unit)) in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => - ssp (fun _ => - letb _ := ifb (f_g_pow curr) =.? vote_result - then letb _ := assign todo(term) in - ret_both (tt : 'unit) - else () in - letb _ := assign todo(term) in - solve_lift (ret_both (tt : 'unit)) : (both (*3*)(fset [curr_loc;tally_loc;vote_result_loc]) ((fset [])) 'unit))) (ret_both (tt : 'unit)) in - letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in - letb _ := assign todo(term) in - Result_Ok (solve_lift (prod_b (f_accept (ret_both (tt : 'unit)),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState v_G (both (fset []) (fset []) uint_size)) t_ParseError). + else ControlFlow_Continue (ret_both (tt : 'unit)) : (both (t_ControlFlow (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) 'unit)))) (ret_both (tt : 'unit)) in + letb vote_result := f_group_one in + letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => + ssp (fun vote_result => + vote_result .* g_pow_vote : (both v_G))) vote_result in + letb tally := ret_both (0 : int32) in + letb curr := f_field_zero in + letb '(curr,tally) := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => + ssp (fun '(curr,tally) => + letb tally := ifb (f_g_pow curr) =.? vote_result + then letb tally := i in + tally + else tally in + letb curr := curr .+ f_field_one in + prod_b (curr,tally) : (both (f_Z × int32)))) (prod_b (curr,tally)) in + letb tally_votes_state_ret := f_clone state in + letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in + Result_Ok (prod_b (f_accept,tally_votes_state_ret)) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError). Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group2.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group2.v new file mode 100644 index 0000000..6e06ed3 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group2.v @@ -0,0 +1,484 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +(* From Jasmin Require Import word. *) + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Crate_Ovn_traits. +Export Crate_Ovn_traits. + +Require Import PhantomData. +Export PhantomData. + +Equations impl__compute_group_element_for_vote {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (xi : both f_Z) (vote : both 'bool) (g_pow_yi : both v_G) : both v_G := + impl__compute_group_element_for_vote xi vote g_pow_yi := + (f_pow g_pow_yi xi) .* (f_g_pow (ifb vote + then f_field_one + else f_field_zero)) : both v_G. +Fail Next Obligation. + +Equations impl__div {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (x : both v_G) (y : both v_G) : both v_G := + impl__div x y := + x .* (f_group_inv y) : both v_G. +Fail Next Obligation. + +Equations impl__compute_g_pow_yi {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (i : both uint_size) (xis : both (nseq v_G (is_pure (n)))) : both v_G := + impl__compute_g_pow_yi i xis := + letb prod1 := f_product (f_map (impl__iter (xis.a[(Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))])) (fun x => + f_clone x)) in + letb prod2 := f_product (f_map (impl__iter (xis.a[(Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))])) (fun x => + f_clone x)) in + impl__div prod1 prod2 : both v_G. +Fail Next Obligation. + +Equations impl__sub {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (x : both f_Z) (y : both f_Z) : both f_Z := + impl__sub x y := + x .+ (f_neg y) : both f_Z. +Fail Next Obligation. + +Equations impl__check_commitment {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (g_pow_xi_yi_vi : both v_G) (commitment : both f_Z) : both 'bool := + impl__check_commitment g_pow_xi_yi_vi commitment := + (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment : both 'bool. +Fail Next Obligation. + +Equations impl__commit_to {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (g_pow_xi_yi_vi : both v_G) : both f_Z := + impl__commit_to g_pow_xi_yi_vi := + f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi])))) : both f_Z. +Fail Next Obligation. + +Definition t_CastVoteParam {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} : choice_type := + (int32 × v_Z × v_Z × v_Z × v_Z × 'bool). +Equations f_cvp_i {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both int32 := + f_cvp_i s := + bind_both s (fun x => + ret_both (fst (fst (fst (fst (fst x)))) : int32)) : both int32. +Fail Next Obligation. +Equations f_cvp_xi {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both v_Z := + f_cvp_xi s := + bind_both s (fun x => + ret_both (snd (fst (fst (fst (fst x)))) : v_Z)) : both v_Z. +Fail Next Obligation. +Equations f_cvp_zkp_random_w {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both v_Z := + f_cvp_zkp_random_w s := + bind_both s (fun x => + ret_both (snd (fst (fst (fst x))) : v_Z)) : both v_Z. +Fail Next Obligation. +Equations f_cvp_zkp_random_r {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both v_Z := + f_cvp_zkp_random_r s := + bind_both s (fun x => + ret_both (snd (fst (fst x)) : v_Z)) : both v_Z. +Fail Next Obligation. +Equations f_cvp_zkp_random_d {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both v_Z := + f_cvp_zkp_random_d s := + bind_both s (fun x => + ret_both (snd (fst x) : v_Z)) : both v_Z. +Fail Next Obligation. +Equations f_cvp_vote {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both 'bool := + f_cvp_vote s := + bind_both s (fun x => + ret_both (snd x : 'bool)) : both 'bool. +Fail Next Obligation. +Equations Build_t_CastVoteParam {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} {f_cvp_i : both int32} {f_cvp_xi : both v_Z} {f_cvp_zkp_random_w : both v_Z} {f_cvp_zkp_random_r : both v_Z} {f_cvp_zkp_random_d : both v_Z} {f_cvp_vote : both 'bool} : both (t_CastVoteParam) := + Build_t_CastVoteParam := + bind_both f_cvp_vote (fun f_cvp_vote => + bind_both f_cvp_zkp_random_d (fun f_cvp_zkp_random_d => + bind_both f_cvp_zkp_random_r (fun f_cvp_zkp_random_r => + bind_both f_cvp_zkp_random_w (fun f_cvp_zkp_random_w => + bind_both f_cvp_xi (fun f_cvp_xi => + bind_both f_cvp_i (fun f_cvp_i => + ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam)))))))) : both (t_CastVoteParam). +Fail Next Obligation. +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_w' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := y) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_r' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := y) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_d' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := y) (f_cvp_vote := f_cvp_vote x)). +Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := y)). + +Definition t_OVN {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} : choice_type := + (t_PhantomData v_G). +Equations f_pd {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OVN) : both (t_PhantomData v_G) := + f_pd s := + bind_both s (fun x => + ret_both (x : (t_PhantomData v_G))) : both (t_PhantomData v_G). +Fail Next Obligation. +Equations Build_t_OVN {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} {f_pd : both (t_PhantomData v_G)} : both (t_OVN) := + Build_t_OVN := + bind_both f_pd (fun f_pd => + ret_both ((f_pd) : (t_OVN))) : both (t_OVN). +Fail Next Obligation. +Notation "'Build_t_OVN' '[' x ']' '(' 'f_pd' ':=' y ')'" := (Build_t_OVN (f_pd := y)). + +Definition t_OrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} : choice_type := + (v_G × v_G × v_G × v_G × v_G × v_G × f_Z × f_Z × f_Z × f_Z × f_Z). +Equations f_or_zkp_x {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := + f_or_zkp_x s := + bind_both s (fun x => + ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : v_G)) : both v_G. +Fail Next Obligation. +Equations f_or_zkp_y {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := + f_or_zkp_y s := + bind_both s (fun x => + ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : v_G)) : both v_G. +Fail Next Obligation. +Equations f_or_zkp_a1 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := + f_or_zkp_a1 s := + bind_both s (fun x => + ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : v_G)) : both v_G. +Fail Next Obligation. +Equations f_or_zkp_b1 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := + f_or_zkp_b1 s := + bind_both s (fun x => + ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : v_G)) : both v_G. +Fail Next Obligation. +Equations f_or_zkp_a2 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := + f_or_zkp_a2 s := + bind_both s (fun x => + ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : v_G)) : both v_G. +Fail Next Obligation. +Equations f_or_zkp_b2 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := + f_or_zkp_b2 s := + bind_both s (fun x => + ret_both (snd (fst (fst (fst (fst (fst x))))) : v_G)) : both v_G. +Fail Next Obligation. +Equations f_or_zkp_c {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := + f_or_zkp_c s := + bind_both s (fun x => + ret_both (snd (fst (fst (fst (fst x)))) : f_Z)) : both f_Z. +Fail Next Obligation. +Equations f_or_zkp_d1 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := + f_or_zkp_d1 s := + bind_both s (fun x => + ret_both (snd (fst (fst (fst x))) : f_Z)) : both f_Z. +Fail Next Obligation. +Equations f_or_zkp_d2 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := + f_or_zkp_d2 s := + bind_both s (fun x => + ret_both (snd (fst (fst x)) : f_Z)) : both f_Z. +Fail Next Obligation. +Equations f_or_zkp_r1 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := + f_or_zkp_r1 s := + bind_both s (fun x => + ret_both (snd (fst x) : f_Z)) : both f_Z. +Fail Next Obligation. +Equations f_or_zkp_r2 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := + f_or_zkp_r2 s := + bind_both s (fun x => + ret_both (snd x : f_Z)) : both f_Z. +Fail Next Obligation. +Equations Build_t_OrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} {f_or_zkp_x : both v_G} {f_or_zkp_y : both v_G} {f_or_zkp_a1 : both v_G} {f_or_zkp_b1 : both v_G} {f_or_zkp_a2 : both v_G} {f_or_zkp_b2 : both v_G} {f_or_zkp_c : both f_Z} {f_or_zkp_d1 : both f_Z} {f_or_zkp_d2 : both f_Z} {f_or_zkp_r1 : both f_Z} {f_or_zkp_r2 : both f_Z} : both (t_OrZKPCommit) := + Build_t_OrZKPCommit := + bind_both f_or_zkp_r2 (fun f_or_zkp_r2 => + bind_both f_or_zkp_r1 (fun f_or_zkp_r1 => + bind_both f_or_zkp_d2 (fun f_or_zkp_d2 => + bind_both f_or_zkp_d1 (fun f_or_zkp_d1 => + bind_both f_or_zkp_c (fun f_or_zkp_c => + bind_both f_or_zkp_b2 (fun f_or_zkp_b2 => + bind_both f_or_zkp_a2 (fun f_or_zkp_a2 => + bind_both f_or_zkp_b1 (fun f_or_zkp_b1 => + bind_both f_or_zkp_a1 (fun f_or_zkp_a1 => + bind_both f_or_zkp_y (fun f_or_zkp_y => + bind_both f_or_zkp_x (fun f_or_zkp_x => + ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit))))))))))))) : both (t_OrZKPCommit). +Fail Next Obligation. +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := y) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := y) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := y) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := y) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := y) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := y) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_c' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := y) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := y) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := y) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := y) (f_or_zkp_r2 := f_or_zkp_r2 x)). +Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := y)). + +Equations impl__zkp_one_out_of_two {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (random_w : both f_Z) (random_r : both f_Z) (random_d : both f_Z) (h : both v_G) (xi : both f_Z) (vi : both 'bool) : both (t_OrZKPCommit v_G) := + impl__zkp_one_out_of_two random_w random_r random_d h xi vi := + letb w := random_w in + ifb vi + then letb r1 := random_r in + letb d1 := random_d in + letb x := f_g_pow xi in + letb y := (f_pow h xi) .* f_g in + letb a1 := (f_g_pow r1) .* (f_pow x d1) in + letb b1 := (f_pow h r1) .* (f_pow y d1) in + letb a2 := f_g_pow w in + letb b2 := f_pow h w in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; + y; + a1; + b1; + a2; + b2])))) in + letb d2 := impl__sub c d1 in + letb r2 := impl__sub w (xi .* d2) in + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2) + else letb r2 := random_r in + letb d2 := random_d in + letb x := f_g_pow xi in + letb y := f_pow h xi in + letb a1 := f_g_pow w in + letb b1 := f_pow h w in + letb a2 := (f_g_pow r2) .* (f_pow x d2) in + letb b2 := (f_pow h r2) .* (f_pow (impl__div y f_g) d2) in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; + y; + a1; + b1; + a2; + b2])))) in + letb d1 := impl__sub c d2 in + letb r1 := impl__sub w (xi .* d1) in + Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2) : both (t_OrZKPCommit v_G). +Fail Next Obligation. + +Equations impl__zkp_one_out_of_two_validate {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (h : both v_G) (zkp : both (t_OrZKPCommit v_G)) : both 'bool := + impl__zkp_one_out_of_two_validate h zkp := + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; + f_or_zkp_y zkp; + f_or_zkp_a1 zkp; + f_or_zkp_b1 zkp; + f_or_zkp_a2 zkp; + f_or_zkp_b2 zkp])))) in + andb (andb (andb (andb (c =.? ((f_or_zkp_d1 zkp) .+ (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? ((f_g_pow (f_or_zkp_r1 zkp)) .* (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? ((f_pow h (f_or_zkp_r1 zkp)) .* (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? ((f_g_pow (f_or_zkp_r2 zkp)) .* (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? ((f_pow h (f_or_zkp_r2 zkp)) .* (f_pow (impl__div (f_or_zkp_y zkp) f_g) (f_or_zkp_d2 zkp)))) : both 'bool. +Fail Next Obligation. + +Definition t_RegisterParam {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} : choice_type := + (int32 × v_Z × v_Z). +Equations f_rp_i {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_RegisterParam) : both int32 := + f_rp_i s := + bind_both s (fun x => + ret_both (fst (fst x) : int32)) : both int32. +Fail Next Obligation. +Equations f_rp_xi {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_RegisterParam) : both v_Z := + f_rp_xi s := + bind_both s (fun x => + ret_both (snd (fst x) : v_Z)) : both v_Z. +Fail Next Obligation. +Equations f_rp_zkp_random {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_RegisterParam) : both v_Z := + f_rp_zkp_random s := + bind_both s (fun x => + ret_both (snd x : v_Z)) : both v_Z. +Fail Next Obligation. +Equations Build_t_RegisterParam {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} {f_rp_i : both int32} {f_rp_xi : both v_Z} {f_rp_zkp_random : both v_Z} : both (t_RegisterParam) := + Build_t_RegisterParam := + bind_both f_rp_zkp_random (fun f_rp_zkp_random => + bind_both f_rp_xi (fun f_rp_xi => + bind_both f_rp_i (fun f_rp_i => + ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam))))) : both (t_RegisterParam). +Fail Next Obligation. +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y) (f_rp_zkp_random := f_rp_zkp_random x)). +Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := y)). + +Definition t_SchnorrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} : choice_type := + (v_G × f_Z × f_Z). +Equations f_schnorr_zkp_u {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_SchnorrZKPCommit) : both v_G := + f_schnorr_zkp_u s := + bind_both s (fun x => + ret_both (fst (fst x) : v_G)) : both v_G. +Fail Next Obligation. +Equations f_schnorr_zkp_c {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_SchnorrZKPCommit) : both f_Z := + f_schnorr_zkp_c s := + bind_both s (fun x => + ret_both (snd (fst x) : f_Z)) : both f_Z. +Fail Next Obligation. +Equations f_schnorr_zkp_z {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_SchnorrZKPCommit) : both f_Z := + f_schnorr_zkp_z s := + bind_both s (fun x => + ret_both (snd x : f_Z)) : both f_Z. +Fail Next Obligation. +Equations Build_t_SchnorrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} {f_schnorr_zkp_u : both v_G} {f_schnorr_zkp_c : both f_Z} {f_schnorr_zkp_z : both f_Z} : both (t_SchnorrZKPCommit) := + Build_t_SchnorrZKPCommit := + bind_both f_schnorr_zkp_z (fun f_schnorr_zkp_z => + bind_both f_schnorr_zkp_c (fun f_schnorr_zkp_c => + bind_both f_schnorr_zkp_u (fun f_schnorr_zkp_u => + ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit))))) : both (t_SchnorrZKPCommit). +Fail Next Obligation. +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := y) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := y) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). +Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := y)). + +Equations impl__schnorr_zkp {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (random : both f_Z) (h : both v_G) (x : both f_Z) : both (t_SchnorrZKPCommit v_G) := + impl__schnorr_zkp random h x := + run (letb r := random in + letb u := f_g_pow r in + letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g; + h; + u])))) in + letb z := r .+ (c .* x) in + letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit v_G)] hoist2 := ControlFlow_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in + ControlFlow_Continue (never_to_any hoist2)) : both (t_SchnorrZKPCommit v_G). +Fail Next Obligation. + +Equations impl__schnorr_zkp_validate {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (h : both v_G) (pi : both (t_SchnorrZKPCommit v_G)) : both 'bool := + impl__schnorr_zkp_validate h pi := + andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g; + h; + f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? ((f_schnorr_zkp_u pi) .* (f_pow h (f_schnorr_zkp_c pi)))) : both 'bool. +Fail Next Obligation. + +Definition t_TallyParameter : choice_type := + 'unit. +Equations Build_t_TallyParameter : both (t_TallyParameter) := + Build_t_TallyParameter := + ret_both (tt (* Empty tuple *) : (t_TallyParameter)) : both (t_TallyParameter). +Fail Next Obligation. + +Definition t_OvnContractState {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} : choice_type := + (nseq v_G (is_pure (n)) × nseq (t_SchnorrZKPCommit v_G) (is_pure (n)) × nseq f_Z (is_pure (n)) × nseq v_G (is_pure (n)) × nseq (t_OrZKPCommit v_G) (is_pure (n)) × int32 × nseq 'bool (is_pure (n))). +Equations f_g_pow_xis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq v_G (is_pure (n))) := + f_g_pow_xis s := + bind_both s (fun x => + ret_both (fst (fst (fst (fst (fst (fst x))))) : (nseq v_G (is_pure (n))))) : both (nseq v_G (is_pure (n))). +Fail Next Obligation. +Equations f_zkp_xis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq (t_SchnorrZKPCommit v_G) (is_pure (n))) := + f_zkp_xis s := + bind_both s (fun x => + ret_both (snd (fst (fst (fst (fst (fst x))))) : (nseq (t_SchnorrZKPCommit v_G) (is_pure (n))))) : both (nseq (t_SchnorrZKPCommit v_G) (is_pure (n))). +Fail Next Obligation. +Equations f_commit_vis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq f_Z (is_pure (n))) := + f_commit_vis s := + bind_both s (fun x => + ret_both (snd (fst (fst (fst (fst x)))) : (nseq f_Z (is_pure (n))))) : both (nseq f_Z (is_pure (n))). +Fail Next Obligation. +Equations f_g_pow_xi_yi_vis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq v_G (is_pure (n))) := + f_g_pow_xi_yi_vis s := + bind_both s (fun x => + ret_both (snd (fst (fst (fst x))) : (nseq v_G (is_pure (n))))) : both (nseq v_G (is_pure (n))). +Fail Next Obligation. +Equations f_zkp_vis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq (t_OrZKPCommit v_G) (is_pure (n))) := + f_zkp_vis s := + bind_both s (fun x => + ret_both (snd (fst (fst x)) : (nseq (t_OrZKPCommit v_G) (is_pure (n))))) : both (nseq (t_OrZKPCommit v_G) (is_pure (n))). +Fail Next Obligation. +Equations f_tally {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both int32 := + f_tally s := + bind_both s (fun x => + ret_both (snd (fst x) : int32)) : both int32. +Fail Next Obligation. +Equations f_round1 {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq 'bool (is_pure (n))) := + f_round1 s := + bind_both s (fun x => + ret_both (snd x : (nseq 'bool (is_pure (n))))) : both (nseq 'bool (is_pure (n))). +Fail Next Obligation. +Equations Build_t_OvnContractState {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} {f_g_pow_xis : both (nseq v_G (is_pure (n)))} {f_zkp_xis : both (nseq (t_SchnorrZKPCommit v_G) (is_pure (n)))} {f_commit_vis : both (nseq f_Z (is_pure (n)))} {f_g_pow_xi_yi_vis : both (nseq v_G (is_pure (n)))} {f_zkp_vis : both (nseq (t_OrZKPCommit v_G) (is_pure (n)))} {f_tally : both int32} {f_round1 : both (nseq 'bool (is_pure (n)))} : both (t_OvnContractState) := + Build_t_OvnContractState := + bind_both f_round1 (fun f_round1 => + bind_both f_tally (fun f_tally => + bind_both f_zkp_vis (fun f_zkp_vis => + bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => + bind_both f_commit_vis (fun f_commit_vis => + bind_both f_zkp_xis (fun f_zkp_xis => + bind_both f_g_pow_xis (fun f_g_pow_xis => + ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally,f_round1) : (t_OvnContractState))))))))) : both (t_OvnContractState). +Fail Next Obligation. +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := f_round1 x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := f_round1 x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := f_round1 x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := f_round1 x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x) (f_round1 := f_round1 x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y) (f_round1 := f_round1 x)). +Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_round1' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := y)). + +Equations impl__cast_vote {v_G : _} {n : both uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Group v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both impl_574521470_) (state : both (t_OvnContractState v_G (both uint_size))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) := + impl__cast_vote ctx state := + run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code t_ParseError] (params : t_CastVoteParam f_Z) := out in + Result_Ok (letb g_pow_yi := impl__compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in + letb g_pow_xi_yi_vi := impl__compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in + letb zkp_vi := impl__zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in + letb cast_vote_state_ret := f_clone state in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in + letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in + Result_Ok (prod_b (f_accept,cast_vote_state_ret)))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError). +Fail Next Obligation. + +Equations impl__commit_to_vote {v_G : _} {n : both uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Group v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both impl_574521470_) (state : both (t_OvnContractState v_G (both uint_size))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) := + impl__commit_to_vote ctx state := + run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code t_ParseError] (params : t_CastVoteParam f_Z) := out in + Result_Ok (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + ssp (fun _ => + ifb orb (not (impl__schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i]))) (not ((f_round1 state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError)] hoist30 := ControlFlow_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist30) + else ControlFlow_Continue (ret_both (tt : 'unit)) : (both (t_ControlFlow (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) 'unit)))) (ret_both (tt : 'unit)) in + letb g_pow_yi := impl__compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in + letb g_pow_xi_yi_vi := impl__compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in + letb commit_vi := impl__commit_to g_pow_xi_yi_vi in + letb commit_to_vote_state_ret := f_clone state in + letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in + Result_Ok (prod_b (f_accept,commit_to_vote_state_ret)))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError). +Fail Next Obligation. + +Equations impl__init_ovn_contract {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (_ : both 'unit) : both (t_Result (t_OvnContractState v_G (both uint_size)) t_Reject) := + impl__init_ovn_contract _ := + Result_Ok (Build_t_OvnContractState (f_g_pow_xis := repeat f_group_one n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one) (f_schnorr_zkp_z := f_field_zero) (f_schnorr_zkp_c := f_field_zero)) n) (f_commit_vis := repeat f_field_zero n) (f_g_pow_xi_yi_vis := repeat f_group_one n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one) (f_or_zkp_y := f_group_one) (f_or_zkp_a1 := f_group_one) (f_or_zkp_b1 := f_group_one) (f_or_zkp_a2 := f_group_one) (f_or_zkp_b2 := f_group_one) (f_or_zkp_c := f_field_zero) (f_or_zkp_d1 := f_field_zero) (f_or_zkp_d2 := f_field_zero) (f_or_zkp_r1 := f_field_zero) (f_or_zkp_r2 := f_field_zero)) n) (f_tally := ret_both (0 : int32)) (f_round1 := repeat (ret_both (false : 'bool)) n)) : both (t_Result (t_OvnContractState v_G (both uint_size)) t_Reject). +Fail Next Obligation. + +Equations impl__register_vote {v_G : _} {n : both uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Group v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both impl_574521470_) (state : both (t_OvnContractState v_G (both uint_size))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) := + impl__register_vote ctx state := + run (letb '(_,out) := f_get (f_parameter_cursor ctx) in + letm[choice_typeMonad.result_bind_code t_ParseError] (params : t_RegisterParam f_Z) := out in + Result_Ok (letb g_pow_xi := f_g_pow (f_rp_xi params) in + letb zkp_xi := impl__schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in + letb register_vote_state_ret := f_clone state in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in + letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_round1 := update_at_usize (f_round1 register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) (ret_both (true : 'bool))) in + Result_Ok (prod_b (f_accept,register_vote_state_ret)))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError). +Fail Next Obligation. + +Equations impl__tally_votes {v_G : _} {n : both uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Group v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (_ : both impl_574521470_) (state : both (t_OvnContractState v_G (both uint_size))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) := + impl__tally_votes _ state := + letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => + ssp (fun _ => + letb g_pow_yi := impl__compute_g_pow_yi i (f_g_pow_xis state) in + letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError)] _ := ControlFlow_Continue (ifb not (impl__zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError)] hoist31 := ControlFlow_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist31) + else ControlFlow_Continue (ret_both (tt : 'unit))) in + ifb not (impl__check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) + then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError)] hoist32 := ControlFlow_Break (Result_Err ParseError) in + ControlFlow_Continue (never_to_any hoist32) + else ControlFlow_Continue (ret_both (tt : 'unit)) : (both (t_ControlFlow (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) 'unit)))) (ret_both (tt : 'unit)) in + letb vote_result := f_group_one in + letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => + ssp (fun vote_result => + vote_result .* g_pow_vote : (both v_G))) vote_result in + letb tally := ret_both (0 : int32) in + letb curr := f_field_zero in + letb '(curr,tally) := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => + ssp (fun '(curr,tally) => + letb tally := ifb (f_g_pow curr) =.? vote_result + then letb tally := i in + tally + else tally in + letb curr := curr .+ f_field_one in + prod_b (curr,tally) : (both (f_Z × int32)))) (prod_b (curr,tally)) in + letb tally_votes_state_ret := f_clone state in + letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in + Result_Ok (prod_b (f_accept,tally_votes_state_ret)) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError). +Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_secp256k1.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_secp256k1.v index 0ec2397..df5f4a4 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_secp256k1.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_secp256k1.v @@ -35,227 +35,252 @@ Export Hacspec_bip_340. Definition t_Group_curve : choice_type := (t_Point). -Equations f_val {L : {fset Location}} {I : Interface} (s : both L I t_Group_curve) : both L I t_Point := - f_val s := +Equations f_g_val (s : both t_Group_curve) : both t_Point := + f_g_val s := bind_both s (fun x => - solve_lift (ret_both (x : t_Point))) : both L I t_Point. + ret_both (x : t_Point)) : both t_Point. Fail Next Obligation. -Equations Build_t_Group_curve {L0 : {fset Location}} {I0 : Interface} {f_val : both L0 I0 t_Point} : both L0 I0 (t_Group_curve) := +Equations Build_t_Group_curve {f_g_val : both t_Point} : both (t_Group_curve) := Build_t_Group_curve := - bind_both f_val (fun f_val => - solve_lift (ret_both ((f_val) : (t_Group_curve)))) : both L0 I0 (t_Group_curve). + bind_both f_g_val (fun f_g_val => + ret_both ((f_g_val) : (t_Group_curve))) : both (t_Group_curve). Fail Next Obligation. -Notation "'Build_t_Group_curve' '[' x ']' '(' 'f_val' ':=' y ')'" := (Build_t_Group_curve (f_val := y)). +Notation "'Build_t_Group_curve' '[' x ']' '(' 'f_g_val' ':=' y ')'" := (Build_t_Group_curve (f_g_val := y)). #[global] Program Instance t_Group_curve_t_Deserial : t_Deserial t_Group_curve := - let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (source : both L1 I1 v_R) => solve_lift (run (letb '(tmp0,out) := f_get source in - letb _ := assign todo(term) in + let f_deserial := fun (source : both v_R) => run (letb '(tmp0,out) := f_get source in + letb source := tmp0 in letb hoist3 := out in letb hoist4 := f_branch hoist3 in letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] (b : 'bool) := matchb hoist4 with | ControlFlow_Break_case residual => letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in - letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] hoist2 := v_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist2)) + letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] hoist2 := ControlFlow_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist2) | ControlFlow_Continue_case val => letb val := ret_both ((val) : ('bool)) in - ControlFlow_Continue (solve_lift val) + ControlFlow_Continue val end in - letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] hax_temp_output := ifb b + letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] '(source,hax_temp_output) := ifb b then letb '(tmp0,out) := f_get source in - letb _ := assign todo(term) in + letb source := tmp0 in letb hoist6 := out in letb hoist7 := f_branch hoist6 in letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] (vx : t_Vec int8 t_Global) := matchb hoist7 with | ControlFlow_Break_case residual => letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in - letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] hoist5 := v_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist5)) + letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] hoist5 := ControlFlow_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist5) | ControlFlow_Continue_case val => letb val := ret_both ((val) : (t_Vec int8 t_Global)) in - ControlFlow_Continue (solve_lift val) + ControlFlow_Continue val end in letb '(tmp0,out) := f_get source in - letb _ := assign todo(term) in + letb source := tmp0 in letb hoist9 := out in letb hoist10 := f_branch hoist9 in letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] (vy : t_Vec int8 t_Global) := matchb hoist10 with | ControlFlow_Break_case residual => letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in - letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] hoist8 := v_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist8)) + letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] hoist8 := ControlFlow_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist8) | ControlFlow_Continue_case val => letb val := ret_both ((val) : (t_Vec int8 t_Global)) in - ControlFlow_Continue (solve_lift val) + ControlFlow_Continue val end in - ControlFlow_Continue (Result_Ok (Build_t_Group_curve (f_val := Point_Affine (prod_b (impl__FieldElement__from_public_byte_seq_be (impl_52__from_vec vx),impl__FieldElement__from_public_byte_seq_be (impl_52__from_vec vy)))))) - else ControlFlow_Continue (Result_Ok (Build_t_Group_curve (f_val := Point_AtInfinity))) in - ControlFlow_Continue (prod_b (source,hax_temp_output)))) : both (L1 :|: fset []) I1 (v_R × t_Result t_Group_curve t_ParseError) in - {| f_deserial_loc := (fset [] : {fset Location}); - f_deserial := (@f_deserial)|}. + ControlFlow_Continue (prod_b (source,Result_Ok (Build_t_Group_curve (f_g_val := Point_Affine (prod_b (impl__FieldElement__from_public_byte_seq_be (impl_52__from_vec vx),impl__FieldElement__from_public_byte_seq_be (impl_52__from_vec vy))))))) + else ControlFlow_Continue (prod_b (source,Result_Ok (Build_t_Group_curve (f_g_val := Point_AtInfinity)))) in + ControlFlow_Continue (prod_b (source,hax_temp_output))) : both (v_R × t_Result t_Group_curve t_ParseError) in + {| f_deserial := (@f_deserial)|}. Fail Next Obligation. Hint Unfold t_Group_curve_t_Deserial. -Definition v_loc : Location := - (t_Vec int8 t_Global;4%nat). #[global] Program Instance t_Group_curve_t_Serial : t_Serial t_Group_curve := - let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 t_Group_curve) (out : both L2 I2 v_W) => solve_lift (run (letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb f_val self with + let f_serial := fun (self : both t_Group_curve) (out : both v_W) => run (letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] out := matchb f_g_val self with | Point_Affine_case p => letb p := ret_both ((p) : (t_FieldElement × t_FieldElement)) in - letb '(tmp0,out) := f_serial (ret_both (true : 'bool)) out in - letb _ := assign todo(term) in - letb hoist12 := out in + letb '(tmp0,out1) := f_serial (ret_both (true : 'bool)) out in + letb out := tmp0 in + letb hoist12 := out1 in letb hoist13 := f_branch hoist12 in letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist13 with | ControlFlow_Break_case residual => letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist11 := v_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist11)) + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist11 := ControlFlow_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist11) | ControlFlow_Continue_case val => letb val := ret_both ((val) : ('unit)) in - ControlFlow_Continue (solve_lift val) + ControlFlow_Continue val end in - letb (vx : t_Vec int8 t_Global) loc(vx_loc) := impl__new (ret_both (tt : 'unit)) in - letb _ := foldi_both_list (f_into_iter (impl_41__native_slice (impl__FieldElement__to_public_byte_seq_be (x p)))) (fun x => - ssp (fun _ => - assign todo(term) : (both (*1*)(fset [vx_loc]) ((fset [])) 'unit))) (ret_both (tt : 'unit)) in - letb '(tmp0,out) := f_serial vx out in - letb _ := assign todo(term) in - letb hoist15 := out in + letb (vx : t_Vec int8 t_Global) := impl__new in + letb vx := foldi_both_list (f_into_iter (impl_41__native_slice (impl__FieldElement__to_public_byte_seq_be (x p)))) (fun x => + ssp (fun vx => + impl_1__push vx (f_clone x) : (both (t_Vec int8 t_Global)))) vx in + letb '(tmp0,out1) := f_serial vx out in + letb out := tmp0 in + letb hoist15 := out1 in letb hoist16 := f_branch hoist15 in letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist16 with | ControlFlow_Break_case residual => letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist14 := v_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist14)) + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist14 := ControlFlow_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist14) | ControlFlow_Continue_case val => letb val := ret_both ((val) : ('unit)) in - ControlFlow_Continue (solve_lift val) + ControlFlow_Continue val end in - letb (vy : t_Vec int8 t_Global) loc(vy_loc) := impl__new (ret_both (tt : 'unit)) in - letb _ := foldi_both_list (f_into_iter (impl_41__native_slice (impl__FieldElement__to_public_byte_seq_be (y p)))) (fun y => - ssp (fun _ => - assign todo(term) : (both (*1*)(fset [vy_loc]) ((fset [])) 'unit))) (ret_both (tt : 'unit)) in - letb '(tmp0,out) := f_serial vy out in - letb _ := assign todo(term) in - letb hoist18 := out in + letb (vy : t_Vec int8 t_Global) := impl__new in + letb vy := foldi_both_list (f_into_iter (impl_41__native_slice (impl__FieldElement__to_public_byte_seq_be (y p)))) (fun y => + ssp (fun vy => + impl_1__push vy (f_clone y) : (both (t_Vec int8 t_Global)))) vy in + letb '(tmp0,out1) := f_serial vy out in + letb out := tmp0 in + letb hoist18 := out1 in letb hoist19 := f_branch hoist18 in letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist19 with | ControlFlow_Break_case residual => letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist17 := v_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist17)) + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist17 := ControlFlow_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist17) | ControlFlow_Continue_case val => letb val := ret_both ((val) : ('unit)) in - ControlFlow_Continue (solve_lift val) + ControlFlow_Continue val end in - ControlFlow_Continue (solve_lift (ret_both (tt : 'unit))) + ControlFlow_Continue out | Point_AtInfinity_case => - letb '(tmp0,out) := f_serial (ret_both (false : 'bool)) out in - letb _ := assign todo(term) in - letb hoist21 := out in + letb '(tmp0,out1) := f_serial (ret_both (false : 'bool)) out in + letb out := tmp0 in + letb hoist21 := out1 in letb hoist22 := f_branch hoist21 in letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist22 with | ControlFlow_Break_case residual => letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist20 := v_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist20)) + letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist20 := ControlFlow_Break (prod_b (out,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist20) | ControlFlow_Continue_case val => letb val := ret_both ((val) : ('unit)) in - ControlFlow_Continue (solve_lift val) + ControlFlow_Continue val end in - ControlFlow_Continue (solve_lift (ret_both (tt : 'unit))) + ControlFlow_Continue out end in ControlFlow_Continue (letb hax_temp_output := Result_Ok (ret_both (tt : 'unit)) in - prod_b (out,hax_temp_output)))) : both (L1 :|: L2 :|: fset [v_loc;vx_loc;vy_loc]) (I1 :|: I2) (v_W × t_Result 'unit f_Err) in - {| f_serial_loc := (fset [v_loc;vx_loc;vy_loc] : {fset Location}); - f_serial := (@f_serial)|}. + prod_b (out,hax_temp_output))) : both (v_W × t_Result 'unit f_Err) in + {| f_serial := (@f_serial)|}. Fail Next Obligation. Hint Unfold t_Group_curve_t_Serial. Definition t_Z_curve : choice_type := (t_Scalar). -Equations f_val {L : {fset Location}} {I : Interface} (s : both L I t_Z_curve) : both L I t_Scalar := - f_val s := +Equations f_z_val (s : both t_Z_curve) : both t_Scalar := + f_z_val s := bind_both s (fun x => - solve_lift (ret_both (x : t_Scalar))) : both L I t_Scalar. + ret_both (x : t_Scalar)) : both t_Scalar. Fail Next Obligation. -Equations Build_t_Z_curve {L0 : {fset Location}} {I0 : Interface} {f_val : both L0 I0 t_Scalar} : both L0 I0 (t_Z_curve) := +Equations Build_t_Z_curve {f_z_val : both t_Scalar} : both (t_Z_curve) := Build_t_Z_curve := - bind_both f_val (fun f_val => - solve_lift (ret_both ((f_val) : (t_Z_curve)))) : both L0 I0 (t_Z_curve). + bind_both f_z_val (fun f_z_val => + ret_both ((f_z_val) : (t_Z_curve))) : both (t_Z_curve). Fail Next Obligation. -Notation "'Build_t_Z_curve' '[' x ']' '(' 'f_val' ':=' y ')'" := (Build_t_Z_curve (f_val := y)). +Notation "'Build_t_Z_curve' '[' x ']' '(' 'f_z_val' ':=' y ')'" := (Build_t_Z_curve (f_z_val := y)). #[global] Program Instance t_Z_curve_t_Deserial : t_Deserial t_Z_curve := - let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (source : both L1 I1 v_R) => solve_lift (run (letb '(tmp0,out) := f_get source in - letb _ := assign todo(term) in + let f_deserial := fun (source : both v_R) => run (letb '(tmp0,out) := f_get source in + letb source := tmp0 in letb hoist24 := out in letb hoist25 := f_branch hoist24 in letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Z_curve t_ParseError)] (temp : t_Vec int8 t_Global) := matchb hoist25 with | ControlFlow_Break_case residual => letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in - letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Z_curve t_ParseError)] hoist23 := v_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist23)) + letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Z_curve t_ParseError)] hoist23 := ControlFlow_Break (prod_b (source,f_from_residual residual)) in + ControlFlow_Continue (never_to_any hoist23) | ControlFlow_Continue_case val => letb val := ret_both ((val) : (t_Vec int8 t_Global)) in - ControlFlow_Continue (solve_lift val) + ControlFlow_Continue val end in - ControlFlow_Continue (letb hax_temp_output := Result_Ok (Build_t_Z_curve (f_val := impl__Scalar__from_public_byte_seq_be (impl_52__from_vec temp))) in - prod_b (source,hax_temp_output)))) : both (L1 :|: fset []) I1 (v_R × t_Result t_Z_curve t_ParseError) in - {| f_deserial_loc := (fset [] : {fset Location}); - f_deserial := (@f_deserial)|}. + ControlFlow_Continue (letb hax_temp_output := Result_Ok (Build_t_Z_curve (f_z_val := impl__Scalar__from_public_byte_seq_be (impl_52__from_vec temp))) in + prod_b (source,hax_temp_output))) : both (v_R × t_Result t_Z_curve t_ParseError) in + {| f_deserial := (@f_deserial)|}. Fail Next Obligation. Hint Unfold t_Z_curve_t_Deserial. -Definition v_loc : Location := - (t_Vec int8 t_Global;4%nat). #[global] Program Instance t_Z_curve_t_Serial : t_Serial t_Z_curve := - let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 t_Z_curve) (out : both L2 I2 v_W) => letb (v : t_Vec int8 t_Global) loc(v_loc) := impl__new (ret_both (tt : 'unit)) in - letb _ := foldi_both_list (f_into_iter (impl_41__native_slice (impl__Scalar__to_public_byte_seq_be (f_val self)))) (fun x => - ssp (fun _ => - assign todo(term) : (both (*1*)(L1:|:fset [v_loc]) (I1) 'unit))) (ret_both (tt : 'unit)) in - letb '(tmp0,out) := f_serial v out in - letb _ := assign todo(term) in - letb hax_temp_output := out in - solve_lift (prod_b (out,hax_temp_output)) : both (L1 :|: L2 :|: fset [v_loc;vx_loc;vy_loc]) (I1 :|: I2) (v_W × t_Result 'unit f_Err) in - {| f_serial_loc := (fset [v_loc;vx_loc;vy_loc] : {fset Location}); - f_serial := (@f_serial)|}. + let f_serial := fun (self : both t_Z_curve) (out : both v_W) => letb (v : t_Vec int8 t_Global) := impl__new in + letb v := foldi_both_list (f_into_iter (impl_41__native_slice (impl__Scalar__to_public_byte_seq_be (f_z_val self)))) (fun x => + ssp (fun v => + impl_1__push v (f_clone x) : (both (t_Vec int8 t_Global)))) v in + letb '(tmp0,out1) := f_serial v out in + letb out := tmp0 in + letb hax_temp_output := out1 in + prod_b (out,hax_temp_output) : both (v_W × t_Result 'unit f_Err) in + {| f_serial := (@f_serial)|}. Fail Next Obligation. Hint Unfold t_Z_curve_t_Serial. +#[global] Program Instance t_Z_curve_t_Mul : t_Mul t_Z_curve t_Z_curve := + let f_Output := t_Z_curve : choice_type in + let f_mul := fun (self : both t_Z_curve) (y : both t_Z_curve) => Build_t_Z_curve (f_z_val := (f_z_val self) .* (f_z_val y)) : both t_Z_curve in + {| f_Output := (@f_Output); + f_mul := (@f_mul)|}. +Fail Next Obligation. +Hint Unfold t_Z_curve_t_Mul. + +#[global] Program Instance t_Z_curve_t_Product : t_Product t_Z_curve t_Z_curve := + let f_product := fun (iter : both v_I) => f_fold iter (Build_t_Z_curve (f_z_val := impl__Scalar__from_literal (ret_both (1 : int128)))) (fun a => fun b => + a .* b) : both t_Z_curve in + {| f_product := (@f_product)|}. +Fail Next Obligation. +Hint Unfold t_Z_curve_t_Product. + +#[global] Program Instance t_Z_curve_t_Add : t_Add t_Z_curve t_Z_curve := + let f_Output := t_Z_curve : choice_type in + let f_add := fun (self : both t_Z_curve) (y : both t_Z_curve) => Build_t_Z_curve (f_z_val := (f_z_val self) .+ (f_z_val y)) : both t_Z_curve in + {| f_Output := (@f_Output); + f_add := (@f_add)|}. +Fail Next Obligation. +Hint Unfold t_Z_curve_t_Add. + +#[global] Program Instance t_Group_curve_t_Mul : t_Mul t_Group_curve t_Group_curve := + let f_Output := t_Group_curve : choice_type in + let f_mul := fun (self : both t_Group_curve) (y : both t_Group_curve) => Build_t_Group_curve (f_g_val := point_add (f_g_val self) (f_g_val y)) : both t_Group_curve in + {| f_Output := (@f_Output); + f_mul := (@f_mul)|}. +Fail Next Obligation. +Hint Unfold t_Group_curve_t_Mul. + #[global] Program Instance t_Z_curve_t_Field : t_Field t_Z_curve := - let f_q := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_hex (ret_both (0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 : chString)))) : both (L :|: fset []) I t_Z_curve in - let f_random_field_elem := fun {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 int32) => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_literal (cast_int (WS2 := _) random))) : both (L1 :|: fset []) I1 t_Z_curve in - let f_field_zero := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_literal (ret_both (0 : int128)))) : both (L :|: fset []) I t_Z_curve in - let f_field_one := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_literal (ret_both (1 : int128)))) : both (L :|: fset []) I t_Z_curve in - let f_add := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_Z_curve) (y : both L2 I2 t_Z_curve) => solve_lift (Build_t_Z_curve (f_val := (f_val x) .+ (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_Z_curve in - let f_sub := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_Z_curve) (y : both L2 I2 t_Z_curve) => solve_lift (Build_t_Z_curve (f_val := (f_val x) .- (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_Z_curve in - let f_mul := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_Z_curve) (y : both L2 I2 t_Z_curve) => solve_lift (Build_t_Z_curve (f_val := (f_val x) .* (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_Z_curve in - {| f_q_loc := (fset [] : {fset Location}); - f_q := (@f_q); - f_random_field_elem_loc := (fset [] : {fset Location}); + let f_q := fun (_ : both 'unit) => Build_t_Z_curve (f_z_val := impl__Scalar__from_hex (ret_both (0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 : chString))) : both t_Z_curve in + let f_random_field_elem := fun (random : both int32) => Build_t_Z_curve (f_z_val := impl__Scalar__from_literal (cast_int (WS2 := _) random)) : both t_Z_curve in + let f_field_zero := fun (_ : both 'unit) => Build_t_Z_curve (f_z_val := impl__Scalar__from_literal (ret_both (0 : int128))) : both t_Z_curve in + let f_field_one := fun (_ : both 'unit) => Build_t_Z_curve (f_z_val := impl__Scalar__from_literal (ret_both (1 : int128))) : both t_Z_curve in + let f_inv := fun (x : both t_Z_curve) => run (letb _ := assert (ret_both (false : 'bool)) in + letm[choice_typeMonad.result_bind_code t_Z_curve] hoist29 := ControlFlow_Break x in + ControlFlow_Continue (never_to_any hoist29)) : both t_Z_curve in + {| f_q := (@f_q); f_random_field_elem := (@f_random_field_elem); - f_field_zero_loc := (fset [] : {fset Location}); f_field_zero := (@f_field_zero); - f_field_one_loc := (fset [] : {fset Location}); f_field_one := (@f_field_one); - f_add_loc := (fset [] : {fset Location}); - f_add := (@f_add); - f_sub_loc := (fset [] : {fset Location}); - f_sub := (@f_sub); - f_mul_loc := (fset [] : {fset Location}); - f_mul := (@f_mul)|}. + f_inv := (@f_inv)|}. Fail Next Obligation. Hint Unfold t_Z_curve_t_Field. -Definition result_loc : Location := - (t_g_z_89_;13%nat). -Definition res_loc : Location := - (t_z_89_;12%nat). +#[global] Program Instance t_Z_curve_t_Neg : t_Neg t_Z_curve := + let f_Output := t_Z_curve : choice_type in + let f_neg := fun (self : both t_Z_curve) => Build_t_Z_curve (f_z_val := (f_z_val f_field_zero) .- (f_z_val self)) : both t_Z_curve in + {| f_Output := (@f_Output); + f_neg := (@f_neg)|}. +Fail Next Obligation. +Hint Unfold t_Z_curve_t_Neg. + +#[global] Program Instance t_Group_curve_t_Product : t_Product t_Group_curve t_Group_curve := + let f_product := fun (iter : both v_I) => f_fold iter (f_g_pow f_field_zero) (fun a => fun b => + a .* b) : both t_Group_curve in + {| f_product := (@f_product)|}. +Fail Next Obligation. +Hint Unfold t_Group_curve_t_Product. + #[global] Program Instance t_Group_curve_t_Group : t_Group t_Group_curve := let f_Z := t_Z_curve : choice_type in - let f_g := fun {L : {fset Location}} {I : Interface} => letb gx := PBytes32 (array_from_list [ret_both (121 : int8); + let f_g := fun (_ : both 'unit) => letb gx := PBytes32 (array_from_list [ret_both (121 : int8); ret_both (190 : int8); ret_both (102 : int8); ret_both (126 : int8); @@ -319,36 +344,24 @@ Definition res_loc : Location := ret_both (16 : int8); ret_both (212 : int8); ret_both (184 : int8)]) in - solve_lift (Build_t_Group_curve (f_val := Point_Affine (prod_b (impl__FieldElement__from_public_byte_seq_be gx,impl__FieldElement__from_public_byte_seq_be gy)))) : both (L :|: fset []) I t_Group_curve in - let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 t_Group_curve) (x : both L2 I2 t_Z_curve) => solve_lift (Build_t_Group_curve (f_val := point_mul (f_val x) (f_val g))) : both (L1 :|: L2 :|: fset [result_loc]) (I1 :|: I2) t_Group_curve in - let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 t_Z_curve) => solve_lift (Build_t_Group_curve (f_val := point_mul_base (f_val x))) : both (L1 :|: fset []) I1 t_Group_curve in - let f_group_one := fun {L : {fset Location}} {I : Interface} => solve_lift (f_g_pow (f_field_zero (ret_both (tt : 'unit)))) : both (L :|: fset []) I t_Group_curve in - let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_Group_curve) (y : both L2 I2 t_Group_curve) => solve_lift (Build_t_Group_curve (f_val := point_add (f_val x) (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_Group_curve in - let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 t_Group_curve) => solve_lift (Build_t_Group_curve (f_val := matchb f_val x with + Build_t_Group_curve (f_g_val := Point_Affine (prod_b (impl__FieldElement__from_public_byte_seq_be gx,impl__FieldElement__from_public_byte_seq_be gy))) : both t_Group_curve in + let f_pow := fun (g : both t_Group_curve) (x : both t_Z_curve) => Build_t_Group_curve (f_g_val := point_mul (f_z_val x) (f_g_val g)) : both t_Group_curve in + let f_g_pow := fun (x : both t_Z_curve) => Build_t_Group_curve (f_g_val := point_mul_base (f_z_val x)) : both t_Group_curve in + let f_group_one := fun (_ : both 'unit) => f_g_pow f_field_zero : both t_Group_curve in + let f_group_inv := fun (x : both t_Group_curve) => Build_t_Group_curve (f_g_val := matchb f_g_val x with | Point_Affine_case (a,b) => letb '(a,b) := ret_both (((a,b)) : (t_FieldElement × t_FieldElement)) in - Point_Affine (solve_lift (prod_b (a,(impl__FieldElement__from_literal (ret_both (0 : int128))) .- b))) + Point_Affine (prod_b (a,(impl__FieldElement__from_literal (ret_both (0 : int128))) .- b)) | Point_AtInfinity_case => Point_AtInfinity - end)) : both (L1 :|: fset []) I1 t_Group_curve in - let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_Group_curve) (y : both L2 I2 t_Group_curve) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_Group_curve in - let f_hash := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Vec t_Group_curve t_Global)) => solve_lift (f_field_one (ret_both (tt : 'unit))) : both (L1 :|: fset [res_loc]) I1 t_Z_curve in + end) : both t_Group_curve in + let f_hash := fun (x : both (t_Vec t_Group_curve t_Global)) => f_field_one : both t_Z_curve in {| f_Z := (@f_Z); - f_g_loc := (fset [] : {fset Location}); f_g := (@f_g); - f_pow_loc := (fset [result_loc] : {fset Location}); f_pow := (@f_pow); - f_g_pow_loc := (fset [] : {fset Location}); f_g_pow := (@f_g_pow); - f_group_one_loc := (fset [] : {fset Location}); f_group_one := (@f_group_one); - f_prod_loc := (fset [] : {fset Location}); - f_prod := (@f_prod); - f_inv_loc := (fset [] : {fset Location}); - f_inv := (@f_inv); - f_div_loc := (fset [] : {fset Location}); - f_div := (@f_div); - f_hash_loc := (fset [res_loc] : {fset Location}); + f_group_inv := (@f_group_inv); f_hash := (@f_hash)|}. Fail Next Obligation. Hint Unfold t_Group_curve_t_Group. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v index 19d7be1..2e3d885 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v @@ -24,33 +24,24 @@ Import choice.Choice.Exports. Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Class t_Field (Self : choice_type) := { - f_q_loc : {fset Location} ; - f_q : (forall {L1 I1}, both L1 I1 'unit -> both (L1 :|: f_q_loc) I1 v_Self) ; - f_random_field_elem_loc : {fset Location} ; - f_random_field_elem : (forall {L1 I1}, both L1 I1 int32 -> both (L1 :|: f_random_field_elem_loc) I1 v_Self) ; - f_field_zero_loc : {fset Location} ; - f_field_zero : (forall {L1 I1}, both L1 I1 'unit -> both (L1 :|: f_field_zero_loc) I1 v_Self) ; - f_field_one_loc : {fset Location} ; - f_field_one : (forall {L1 I1}, both L1 I1 'unit -> both (L1 :|: f_field_one_loc) I1 v_Self) ; - f_add_loc : {fset Location} ; - f_add : (forall {L1 L2 I1 I2}, both L1 I1 v_Self -> both L2 I2 v_Self -> both (L1 :|: L2 :|: f_add_loc) (I1 :|: I2) v_Self) ; - f_sub_loc : {fset Location} ; - f_sub : (forall {L1 L2 I1 I2}, both L1 I1 v_Self -> both L2 I2 v_Self -> both (L1 :|: L2 :|: f_sub_loc) (I1 :|: I2) v_Self) ; - f_mul_loc : {fset Location} ; - f_mul : (forall {L1 L2 I1 I2}, both L1 I1 v_Self -> both L2 I2 v_Self -> both (L1 :|: L2 :|: f_mul_loc) (I1 :|: I2) v_Self) ; +Require Import Product. +Export Product. + +Class t_Field (v_Self : _) `{ t_Copy v_Self} `{ t_PartialEq v_Self v_Self} `{ t_Eq v_Self} `{ t_Clone v_Self} `{ t_Serialize v_Self} `{ t_Mul v_Self v_Self} `{ t_Product v_Self v_Self} `{ t_Add v_Self v_Self} `{ t_Neg v_Self} := { + f_q : (both v_Self) ; + f_random_field_elem : (both int32 -> both v_Self) ; + f_field_zero : (both v_Self) ; + f_field_one : (both v_Self) ; + f_inv : (both v_Self -> both v_Self) ; }. -Hint Unfold f_q_loc. -Hint Unfold f_random_field_elem_loc. -Hint Unfold f_field_zero_loc. -Hint Unfold f_field_one_loc. -Hint Unfold f_add_loc. -Hint Unfold f_sub_loc. -Hint Unfold f_mul_loc. -Class t_Group (Self : choice_type) := { +Class t_Group (v_Self : _) `{ t_Copy v_Self} `{ t_PartialEq v_Self v_Self} `{ t_Eq v_Self} `{ t_Clone v_Self} `{ t_Serialize v_Self} `{ t_Mul v_Self v_Self} `{ t_Product v_Self v_Self} := { f_Z : choice_type ; f_Z_t_Field :> (t_Field f_Z) ; + f_Z_t_Neg :> (t_Neg f_Z) ; + f_Z_t_Add :> (t_Add f_Z) ; + f_Z_t_Product :> (t_Product f_Z) ; + f_Z_t_Mul :> (t_Mul f_Z) ; f_Z_t_Serialize :> (t_Serialize f_Z) ; f_Z_t_Deserial :> (t_Deserial f_Z) ; f_Z_t_Serial :> (t_Serial f_Z) ; @@ -59,28 +50,10 @@ Class t_Group (Self : choice_type) := { f_Z_t_PartialEq :> (t_PartialEq f_Z) ; f_Z_t_Copy :> (t_Copy f_Z) ; f_Z_t_Sized :> (t_Sized f_Z) ; - f_g_loc : {fset Location} ; - f_g : (forall {L1 I1}, both L1 I1 'unit -> both (L1 :|: f_g_loc) I1 v_Self) ; - f_g_pow_loc : {fset Location} ; - f_g_pow : (forall {L1 I1}, both L1 I1 f_Z -> both (L1 :|: f_g_pow_loc) I1 v_Self) ; - f_pow_loc : {fset Location} ; - f_pow : (forall {L1 L2 I1 I2}, both L1 I1 v_Self -> both L2 I2 f_Z -> both (L1 :|: L2 :|: f_pow_loc) (I1 :|: I2) v_Self) ; - f_group_one_loc : {fset Location} ; - f_group_one : (forall {L1 I1}, both L1 I1 'unit -> both (L1 :|: f_group_one_loc) I1 v_Self) ; - f_prod_loc : {fset Location} ; - f_prod : (forall {L1 L2 I1 I2}, both L1 I1 v_Self -> both L2 I2 v_Self -> both (L1 :|: L2 :|: f_prod_loc) (I1 :|: I2) v_Self) ; - f_inv_loc : {fset Location} ; - f_inv : (forall {L1 I1}, both L1 I1 v_Self -> both (L1 :|: f_inv_loc) I1 v_Self) ; - f_div_loc : {fset Location} ; - f_div : (forall {L1 L2 I1 I2}, both L1 I1 v_Self -> both L2 I2 v_Self -> both (L1 :|: L2 :|: f_div_loc) (I1 :|: I2) v_Self) ; - f_hash_loc : {fset Location} ; - f_hash : (forall {L1 I1}, both L1 I1 (t_Vec v_Self t_Global) -> both (L1 :|: f_hash_loc) I1 f_Z) ; + f_g : (both v_Self) ; + f_g_pow : (both f_Z -> both v_Self) ; + f_pow : (both v_Self -> both f_Z -> both v_Self) ; + f_group_one : (both v_Self) ; + f_group_inv : (both v_Self -> both v_Self) ; + f_hash : (both (t_Vec v_Self t_Global) -> both f_Z) ; }. -Hint Unfold f_g_loc. -Hint Unfold f_g_pow_loc. -Hint Unfold f_pow_loc. -Hint Unfold f_group_one_loc. -Hint Unfold f_prod_loc. -Hint Unfold f_inv_loc. -Hint Unfold f_div_loc. -Hint Unfold f_hash_loc. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_z_89_.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_z_89_.v index 81c5450..c4f0cd3 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_z_89_.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_z_89_.v @@ -29,107 +29,136 @@ Export Crate_Ovn_traits. Definition t_g_z_89_ : choice_type := (int8). -Equations f_val {L : {fset Location}} {I : Interface} (s : both L I t_g_z_89_) : both L I int8 := - f_val s := +Equations f_g_val (s : both t_g_z_89_) : both int8 := + f_g_val s := bind_both s (fun x => - solve_lift (ret_both (x : int8))) : both L I int8. + ret_both (x : int8)) : both int8. Fail Next Obligation. -Equations Build_t_g_z_89_ {L0 : {fset Location}} {I0 : Interface} {f_val : both L0 I0 int8} : both L0 I0 (t_g_z_89_) := +Equations Build_t_g_z_89_ {f_g_val : both int8} : both (t_g_z_89_) := Build_t_g_z_89_ := - bind_both f_val (fun f_val => - solve_lift (ret_both ((f_val) : (t_g_z_89_)))) : both L0 I0 (t_g_z_89_). + bind_both f_g_val (fun f_g_val => + ret_both ((f_g_val) : (t_g_z_89_))) : both (t_g_z_89_). Fail Next Obligation. -Notation "'Build_t_g_z_89_' '[' x ']' '(' 'f_val' ':=' y ')'" := (Build_t_g_z_89_ (f_val := y)). +Notation "'Build_t_g_z_89_' '[' x ']' '(' 'f_g_val' ':=' y ')'" := (Build_t_g_z_89_ (f_g_val := y)). Definition t_z_89_ : choice_type := (int8). -Equations f_val {L : {fset Location}} {I : Interface} (s : both L I t_z_89_) : both L I int8 := - f_val s := +Equations f_z_val (s : both t_z_89_) : both int8 := + f_z_val s := bind_both s (fun x => - solve_lift (ret_both (x : int8))) : both L I int8. + ret_both (x : int8)) : both int8. Fail Next Obligation. -Equations Build_t_z_89_ {L0 : {fset Location}} {I0 : Interface} {f_val : both L0 I0 int8} : both L0 I0 (t_z_89_) := +Equations Build_t_z_89_ {f_z_val : both int8} : both (t_z_89_) := Build_t_z_89_ := - bind_both f_val (fun f_val => - solve_lift (ret_both ((f_val) : (t_z_89_)))) : both L0 I0 (t_z_89_). + bind_both f_z_val (fun f_z_val => + ret_both ((f_z_val) : (t_z_89_))) : both (t_z_89_). Fail Next Obligation. -Notation "'Build_t_z_89_' '[' x ']' '(' 'f_val' ':=' y ')'" := (Build_t_z_89_ (f_val := y)). +Notation "'Build_t_z_89_' '[' x ']' '(' 'f_z_val' ':=' y ')'" := (Build_t_z_89_ (f_z_val := y)). + +#[global] Program Instance t_z_89__t_Product : t_Product t_z_89_ t_z_89_ := + let f_product := fun (iter : both v_I) => f_fold iter (Build_t_C_z_89_ (f_z_val := ret_both (1 : int8))) (fun a => fun b => + a .* b) : both t_z_89_ in + {| f_product := (@f_product)|}. +Fail Next Obligation. +Hint Unfold t_z_89__t_Product. + +#[global] Program Instance t_g_z_89__t_Product : t_Product t_g_z_89_ t_g_z_89_ := + let f_product := fun (iter : both v_I) => f_fold iter (Build_t_C_g_z_89_ (f_g_val := ret_both (1 : int8))) (fun a => fun b => + a .* b) : both t_g_z_89_ in + {| f_product := (@f_product)|}. +Fail Next Obligation. +Hint Unfold t_g_z_89__t_Product. + +#[global] Program Instance t_z_89__t_Mul : t_Mul t_z_89_ t_z_89_ := + let f_Output := t_z_89_ : choice_type in + let f_mul := fun (self : both t_z_89_) (y : both t_z_89_) => letb q___ := (f_z_val f_q) .- (ret_both (1 : int8)) in + letb (x___ : int16) := cast_int (WS2 := _) ((f_z_val self) .% q___) in + letb (y___ : int16) := cast_int (WS2 := _) ((f_z_val y) .% q___) in + Build_t_C_z_89_ (f_z_val := cast_int (WS2 := _) ((x___ .* y___) .% (cast_int (WS2 := _) q___))) : both t_z_89_ in + {| f_Output := (@f_Output); + f_mul := (@f_mul)|}. +Fail Next Obligation. +Hint Unfold t_z_89__t_Mul. + +#[global] Program Instance t_z_89__t_Add : t_Add t_z_89_ t_z_89_ := + let f_Output := t_z_89_ : choice_type in + let f_add := fun (self : both t_z_89_) (y : both t_z_89_) => letb q___ := (f_z_val f_q) .- (ret_both (1 : int8)) in + letb x___ := (f_z_val self) .% q___ in + letb y___ := (f_z_val y) .% q___ in + Build_t_C_z_89_ (f_z_val := (x___ .+ y___) .% q___) : both t_z_89_ in + {| f_Output := (@f_Output); + f_add := (@f_add)|}. +Fail Next Obligation. +Hint Unfold t_z_89__t_Add. + +#[global] Program Instance t_z_89__t_Neg : t_Neg t_z_89_ := + let f_Output := t_z_89_ : choice_type in + let f_neg := fun (self : both t_z_89_) => letb q___ := (f_z_val f_q) .- (ret_both (1 : int8)) in + letb x___ := (f_z_val self) .% q___ in + Build_t_C_z_89_ (f_z_val := q___ .- x___) : both t_z_89_ in + {| f_Output := (@f_Output); + f_neg := (@f_neg)|}. +Fail Next Obligation. +Hint Unfold t_z_89__t_Neg. #[global] Program Instance t_z_89__t_Field : t_Field t_z_89_ := - let f_q := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_C_z_89_ (f_val := ret_both (89 : int8))) : both (L :|: fset []) I t_z_89_ in - let f_random_field_elem := fun {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 int32) => solve_lift (Build_t_C_z_89_ (f_val := (cast_int (WS2 := _) random) .% ((f_val (f_q (ret_both (tt : 'unit)))) .- (ret_both (1 : int8))))) : both (L1 :|: fset []) I1 t_z_89_ in - let f_field_zero := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_C_z_89_ (f_val := ret_both (0 : int8))) : both (L :|: fset []) I t_z_89_ in - let f_field_one := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_C_z_89_ (f_val := ret_both (1 : int8))) : both (L :|: fset []) I t_z_89_ in - let f_add := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_z_89_) (y : both L2 I2 t_z_89_) => solve_lift (Build_t_C_z_89_ (f_val := ((f_val x) .+ (f_val y)) .% ((f_val (f_q (ret_both (tt : 'unit)))) .- (ret_both (1 : int8))))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_z_89_ in - let f_sub := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_z_89_) (y : both L2 I2 t_z_89_) => solve_lift (Build_t_C_z_89_ (f_val := (((f_val x) .+ ((f_val (f_q (ret_both (tt : 'unit)))) .- (ret_both (1 : int8)))) .- (f_val y)) .% ((f_val (f_q (ret_both (tt : 'unit)))) .- (ret_both (1 : int8))))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_z_89_ in - let f_mul := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_z_89_) (y : both L2 I2 t_z_89_) => solve_lift (Build_t_C_z_89_ (f_val := cast_int (WS2 := _) (((cast_int (WS2 := _) (f_val x)) .* (cast_int (WS2 := _) (f_val y))) .% (cast_int (WS2 := _) ((f_val (f_q (ret_both (tt : 'unit)))) .- (ret_both (1 : int8))))))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_z_89_ in - {| f_q_loc := (fset [] : {fset Location}); - f_q := (@f_q); - f_random_field_elem_loc := (fset [] : {fset Location}); + let f_q := fun (_ : both 'unit) => Build_t_C_z_89_ (f_z_val := ret_both (89 : int8)) : both t_z_89_ in + let f_random_field_elem := fun (random : both int32) => Build_t_C_z_89_ (f_z_val := (cast_int (WS2 := _) random) .% ((f_z_val f_q) .- (ret_both (1 : int8)))) : both t_z_89_ in + let f_field_zero := fun (_ : both 'unit) => Build_t_C_z_89_ (f_z_val := ret_both (0 : int8)) : both t_z_89_ in + let f_field_one := fun (_ : both 'unit) => Build_t_C_z_89_ (f_z_val := ret_both (1 : int8)) : both t_z_89_ in + let f_inv := fun (x : both t_z_89_) => run (letb _ := assert (ret_both (false : 'bool)) in + letm[choice_typeMonad.result_bind_code t_z_89_] hoist30 := ControlFlow_Break x in + ControlFlow_Continue (never_to_any hoist30)) : both t_z_89_ in + {| f_q := (@f_q); f_random_field_elem := (@f_random_field_elem); - f_field_zero_loc := (fset [] : {fset Location}); f_field_zero := (@f_field_zero); - f_field_one_loc := (fset [] : {fset Location}); f_field_one := (@f_field_one); - f_add_loc := (fset [] : {fset Location}); - f_add := (@f_add); - f_sub_loc := (fset [] : {fset Location}); - f_sub := (@f_sub); - f_mul_loc := (fset [] : {fset Location}); - f_mul := (@f_mul)|}. + f_inv := (@f_inv)|}. Fail Next Obligation. Hint Unfold t_z_89__t_Field. -Definition res_loc : Location := - (t_z_89_;12%nat). -Definition result_loc : Location := - (t_g_z_89_;13%nat). +#[global] Program Instance t_g_z_89__t_Mul : t_Mul t_g_z_89_ t_g_z_89_ := + let f_Output := t_g_z_89_ : choice_type in + let f_mul := fun (self : both t_g_z_89_) (y : both t_g_z_89_) => letb q___ := f_z_val f_q in + letb x___ := cast_int (WS2 := _) ((f_g_val self) .% q___) in + letb y___ := cast_int (WS2 := _) ((f_g_val y) .% q___) in + Build_t_C_g_z_89_ (f_g_val := cast_int (WS2 := _) ((x___ .* y___) .% (cast_int (WS2 := _) q___))) : both t_g_z_89_ in + {| f_Output := (@f_Output); + f_mul := (@f_mul)|}. +Fail Next Obligation. +Hint Unfold t_g_z_89__t_Mul. + #[global] Program Instance t_g_z_89__t_Group : t_Group t_g_z_89_ := let f_Z := t_z_89_ : choice_type in - let f_g := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_C_g_z_89_ (f_val := ret_both (3 : int8))) : both (L :|: fset []) I t_g_z_89_ in - let f_hash := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Vec t_g_z_89_ t_Global)) => letb res loc(res_loc) := f_field_one (ret_both (tt : 'unit)) in - letb _ := foldi_both_list (f_into_iter x) (fun y => - ssp (fun _ => - assign todo(term) : (both (*1*)(L1:|:fset [res_loc]) (I1) 'unit))) (ret_both (tt : 'unit)) in - solve_lift res : both (L1 :|: fset [res_loc]) I1 t_z_89_ in - let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 t_z_89_) => solve_lift (f_pow (f_g (ret_both (tt : 'unit))) x) : both (L1 :|: fset []) I1 t_g_z_89_ in - let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 t_g_z_89_) (x : both L2 I2 t_z_89_) => letb result loc(result_loc) := f_group_one (ret_both (tt : 'unit)) in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int8)) (f_end := (f_val x) .% ((f_val (f_q (ret_both (tt : 'unit)))) .- (ret_both (1 : int8)))))) (fun _ => - ssp (fun _ => - assign todo(term) : (both (*1*)(L1:|:L2:|:fset [result_loc]) (I1:|:I2) 'unit))) (ret_both (tt : 'unit)) in - solve_lift result : both (L1 :|: L2 :|: fset [result_loc]) (I1 :|: I2) t_g_z_89_ in - let f_group_one := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_C_g_z_89_ (f_val := ret_both (1 : int8))) : both (L :|: fset []) I t_g_z_89_ in - let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_g_z_89_) (y : both L2 I2 t_g_z_89_) => letb q_val := f_val (f_q (ret_both (tt : 'unit))) in - solve_lift (Build_t_C_g_z_89_ (f_val := cast_int (WS2 := _) (((cast_int (WS2 := _) ((f_val x) .% q_val)) .* (cast_int (WS2 := _) ((f_val y) .% q_val))) .% (cast_int (WS2 := _) q_val)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_g_z_89_ in - let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 t_g_z_89_) => solve_lift (run (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int8)) (f_end := ret_both (89 : int8)))) (fun j => + let f_g := fun (_ : both 'unit) => Build_t_C_g_z_89_ (f_g_val := ret_both (3 : int8)) : both t_g_z_89_ in + let f_hash := fun (x : both (t_Vec t_g_z_89_ t_Global)) => letb res := f_field_one in + letb res := foldi_both_list (f_into_iter x) (fun y => + ssp (fun res => + (Build_t_C_z_89_ (f_z_val := f_g_val y)) .* res : (both t_z_89_))) res in + res : both t_z_89_ in + let f_g_pow := fun (x : both t_z_89_) => f_pow f_g x : both t_g_z_89_ in + let f_pow := fun (g : both t_g_z_89_) (x : both t_z_89_) => letb result := f_group_one in + letb result := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int8)) (f_end := (f_z_val x) .% ((f_z_val f_q) .- (ret_both (1 : int8)))))) (fun _ => + ssp (fun result => + result .* g : (both t_g_z_89_))) result in + result : both t_g_z_89_ in + let f_group_one := fun (_ : both 'unit) => Build_t_C_g_z_89_ (f_g_val := ret_both (1 : int8)) : both t_g_z_89_ in + let f_group_inv := fun (x : both t_g_z_89_) => run (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int8)) (f_end := ret_both (89 : int8)))) (fun j => ssp (fun _ => - letb value := Build_t_C_g_z_89_ (f_val := j) in - solve_lift (ifb (f_prod x value) =.? (f_group_one (ret_both (tt : 'unit))) - then letm[choice_typeMonad.result_bind_code t_g_z_89_] hoist29 := v_Break value in - ControlFlow_Continue (never_to_any hoist29) - else ()) : (both (*0*)(L1:|:fset []) (I1) (t_ControlFlow t_g_z_89_ 'unit)))) (ret_both (tt : 'unit)) in - letb _ := ifb not (ret_both (false : 'bool)) - then never_to_any (panic (ret_both (assertion failed: false : chString))) - else () in - letm[choice_typeMonad.result_bind_code t_g_z_89_] hoist30 := v_Break x in - ControlFlow_Continue (never_to_any hoist30))) : both (L1 :|: fset []) I1 t_g_z_89_ in - let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 t_g_z_89_) (y : both L2 I2 t_g_z_89_) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_g_z_89_ in + letb g_value := Build_t_C_g_z_89_ (f_g_val := j) in + ifb (x .* g_value) =.? f_group_one + then letm[choice_typeMonad.result_bind_code t_g_z_89_] hoist31 := ControlFlow_Break g_value in + ControlFlow_Continue (never_to_any hoist31) + else ControlFlow_Continue (ret_both (tt : 'unit)) : (both (t_ControlFlow t_g_z_89_ 'unit)))) (ret_both (tt : 'unit)) in + letb _ := assert (ret_both (false : 'bool)) in + letm[choice_typeMonad.result_bind_code t_g_z_89_] hoist32 := ControlFlow_Break x in + ControlFlow_Continue (never_to_any hoist32)) : both t_g_z_89_ in {| f_Z := (@f_Z); - f_g_loc := (fset [] : {fset Location}); f_g := (@f_g); - f_hash_loc := (fset [res_loc] : {fset Location}); f_hash := (@f_hash); - f_g_pow_loc := (fset [] : {fset Location}); f_g_pow := (@f_g_pow); - f_pow_loc := (fset [result_loc] : {fset Location}); f_pow := (@f_pow); - f_group_one_loc := (fset [] : {fset Location}); f_group_one := (@f_group_one); - f_prod_loc := (fset [] : {fset Location}); - f_prod := (@f_prod); - f_inv_loc := (fset [] : {fset Location}); - f_inv := (@f_inv); - f_div_loc := (fset [] : {fset Location}); - f_div := (@f_div)|}. + f_group_inv := (@f_group_inv)|}. Fail Next Obligation. Hint Unfold t_g_z_89__t_Group. diff --git a/ovn/proofs/ssprove/extraction/_CoqProject b/ovn/proofs/ssprove/extraction/_CoqProject index 6f4f8b9..2ffe3e1 100644 --- a/ovn/proofs/ssprove/extraction/_CoqProject +++ b/ovn/proofs/ssprove/extraction/_CoqProject @@ -3,9 +3,9 @@ -arg all Hacspec_ovn_Ovn_traits.v +Hacspec_ovn_Ovn_group.v Hacspec_ovn.v - # Taken from Crypt (as branches are not merged!) pkg_advantage.v SigmaProtocol.v diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs index d0a2c80..3ed87c3 100644 --- a/ovn/src/ovn_group.rs +++ b/ovn/src/ovn_group.rs @@ -12,12 +12,12 @@ pub use crate::ovn_traits::*; // Useful definitions // //////////////////////// -fn sub(x: Z, y: Z) -> Z { - Z::add(x, Z::opp(y)) +fn sub(x: Z, y: Z) -> Z { + x + /* field addition */ (-/* field opposite */y) } -fn div(x: G, y: G) -> G { - G::prod(x, G::group_inv(y)) +fn div(x: G, y: G) -> G { + x * G::group_inv(y) // group product } //////////////////// @@ -34,15 +34,11 @@ pub struct SchnorrZKPCommit { /** Non-interactive Schnorr proof using Fiat-Shamir heuristics (RFC 8235) */ // https://www.rfc-editor.org/rfc/rfc8235 // https://crypto.stanford.edu/cs355/19sp/lec5.pdf -pub fn schnorr_zkp( - random: G::Z, - h: G, - x: G::Z, -) -> SchnorrZKPCommit { +pub fn schnorr_zkp(random: G::Z, h: G, x: G::Z) -> SchnorrZKPCommit { let r = random; let u = G::g_pow(r); let c = G::hash(vec![G::g(), h, u]); - let z = G::Z::add(r, G::Z::mul(c, x)); + let z = r + /* field addition */ c * /* field product */ x; return SchnorrZKPCommit { schnorr_zkp_u: u, @@ -52,12 +48,10 @@ pub fn schnorr_zkp( } // https://crypto.stanford.edu/cs355/19sp/lec5.pdf -pub fn schnorr_zkp_validate( - h: G, - pi: SchnorrZKPCommit, -) -> bool { +pub fn schnorr_zkp_validate(h: G, pi: SchnorrZKPCommit) -> bool { pi.schnorr_zkp_c == G::hash(vec![G::g(), h, pi.schnorr_zkp_u]) - && G::g_pow(pi.schnorr_zkp_z) == G::prod(pi.schnorr_zkp_u, G::pow(h, pi.schnorr_zkp_c)) + && G::g_pow(pi.schnorr_zkp_z) + == pi.schnorr_zkp_u * /* group product */ G::pow(h, pi.schnorr_zkp_c) } #[derive(Serialize, SchemaType, Clone, Copy)] @@ -94,10 +88,10 @@ pub fn zkp_one_out_of_two( let d1 = random_d; let x = G::g_pow(xi); - let y = G::prod(G::pow(h, xi), G::g()); + let y = G::pow(h, xi) * /* group product */ G::g(); - let a1 = G::prod(G::g_pow(r1), G::pow(x, d1)); - let b1 = G::prod(G::pow(h, r1), G::pow(y, d1)); + let a1 = G::g_pow(r1) * /* group product */ G::pow(x, d1); + let b1 = G::pow(h, r1) * /* group product */ G::pow(y, d1); let a2 = G::g_pow(w); let b2 = G::pow(h, w); @@ -105,7 +99,7 @@ pub fn zkp_one_out_of_two( let c = G::hash(vec![x, y, a1, b1, a2, b2]); let d2 = sub::(c, d1); - let r2 = sub::(w, G::Z::mul(xi, d2)); + let r2 = sub::(w, xi * /* field product */ d2); OrZKPCommit { or_zkp_x: x, @@ -130,13 +124,13 @@ pub fn zkp_one_out_of_two( let a1 = G::g_pow(w); let b1 = G::pow(h, w); - let a2 = G::prod(G::g_pow(r2), G::pow(x, d2)); - let b2 = G::prod(G::pow(h, r2), G::pow(div::(y, G::g()), d2)); + let a2 = G::g_pow(r2) * /* group product */ G::pow(x, d2); + let b2 = G::pow(h, r2) * /* group product */ G::pow(div::(y, G::g()), d2); let c = G::hash(vec![x, y, a1, b1, a2, b2]); let d1 = sub::(c, d2); - let r1 = sub::(w, G::Z::mul(xi, d1)); + let r1 = sub::(w, xi * /* field product */ d1); OrZKPCommit { or_zkp_x: x, @@ -155,10 +149,7 @@ pub fn zkp_one_out_of_two( } // Anonymous voting by two-round public discussion -pub fn zkp_one_out_of_two_validate( - h: G, - zkp: OrZKPCommit, -) -> bool { +pub fn zkp_one_out_of_two_validate(h: G, zkp: OrZKPCommit) -> bool { let c = G::hash(vec![ zkp.or_zkp_x, zkp.or_zkp_y, @@ -168,29 +159,23 @@ pub fn zkp_one_out_of_two_validate( zkp.or_zkp_b2, ]); // TODO: add i - (c == G::Z::add(zkp.or_zkp_d1, zkp.or_zkp_d2) - && zkp.or_zkp_a1 == G::prod(G::g_pow(zkp.or_zkp_r1), G::pow(zkp.or_zkp_x, zkp.or_zkp_d1)) + (c == zkp.or_zkp_d1 + /* field addition */ zkp.or_zkp_d2 + && zkp.or_zkp_a1 + == G::g_pow(zkp.or_zkp_r1) * /* group product */ G::pow(zkp.or_zkp_x, zkp.or_zkp_d1) && zkp.or_zkp_b1 - == G::prod( - G::pow(h, zkp.or_zkp_r1), - G::pow(zkp.or_zkp_y, zkp.or_zkp_d1), - ) - && zkp.or_zkp_a2 == G::prod(G::g_pow(zkp.or_zkp_r2), G::pow(zkp.or_zkp_x, zkp.or_zkp_d2)) + == G::pow(h, zkp.or_zkp_r1) * /* group product */ + G::pow(zkp.or_zkp_y, zkp.or_zkp_d1) + && zkp.or_zkp_a2 + == G::g_pow(zkp.or_zkp_r2) * /* group product */ G::pow(zkp.or_zkp_x, zkp.or_zkp_d2) && zkp.or_zkp_b2 - == G::prod( - G::pow(h, zkp.or_zkp_r2), - G::pow(div::(zkp.or_zkp_y, G::g()), zkp.or_zkp_d2), - )) + == G::pow(h, zkp.or_zkp_r2) * /* group product */ G::pow(div::(zkp.or_zkp_y, G::g()), zkp.or_zkp_d2)) } pub fn commit_to(g_pow_xi_yi_vi: G) -> G::Z { G::hash(vec![g_pow_xi_yi_vi]) } -pub fn check_commitment( - g_pow_xi_yi_vi: G, - commitment: G::Z, -) -> bool { +pub fn check_commitment(g_pow_xi_yi_vi: G, commitment: G::Z) -> bool { G::hash(vec![g_pow_xi_yi_vi]) == commitment } @@ -208,7 +193,7 @@ pub struct OvnContractState { pub tally: u32, - pub round1 : [bool; n], + pub round1: [bool; n], } #[hax::init(contract = "OVN")] @@ -246,7 +231,7 @@ pub fn init_ovn_contract(// _: &impl HasInitContext, tally: 0, round1: [false; n], - }) + }) } #[derive(Serialize, SchemaType)] @@ -286,38 +271,29 @@ pub struct CastVoteParam { pub cvp_vote: bool, } -pub fn compute_g_pow_yi( - i: usize, - xis: [G; n], -) -> G { - let mut prod1 = G::group_one(); - for j in 0..i { - prod1 = G::prod(prod1, xis[j]); - } +// impl core::ops::Mul for G { +// type Output = Self; +// fn mul (self, rhs: Self) { +// Self::prod(self, rhs) +// } +// } - let mut prod2 = G::group_one(); - for j in (i + 1)..n { - prod2 = G::prod(prod2, xis[j]); - } +pub fn compute_g_pow_yi(i: usize, xis: [G; n]) -> G { + let mut prod1 = xis[0..i].iter().map(|x| x.clone()).product::(); + let mut prod2 = xis[i + 1..n].iter().map(|x| x.clone()).product::(); // implicitly: Y_i = g^y_i let g_pow_yi = div::(prod1, prod2); g_pow_yi } -pub fn compute_group_element_for_vote( - xi: G::Z, - vote: bool, - g_pow_yi: G, -) -> G { - G::prod( - G::pow(g_pow_yi, xi), +pub fn compute_group_element_for_vote(xi: G::Z, vote: bool, g_pow_yi: G) -> G { + G::pow(g_pow_yi, xi) * /* group product */ G::g_pow(if vote { G::Z::field_one() } else { G::Z::field_zero() - }), - ) + }) } /** Commitment before round 2 */ @@ -395,9 +371,10 @@ pub fn tally_votes( let mut vote_result = G::group_one(); for g_pow_vote in state.g_pow_xi_yi_vis { - vote_result = G::prod(vote_result, g_pow_vote); + vote_result = vote_result * /* group product */ g_pow_vote; } + // let tally = (0..(n as u32)).rposition(|i| G::g_pow(i) == vote_result).unwrap() as u32; let mut tally = 0; let mut curr = G::Z::field_zero(); for i in 0..n as u32 { @@ -406,7 +383,7 @@ pub fn tally_votes( tally = i; } - curr = G::Z::add(curr, G::Z::field_one()); + curr = curr + /* field addition */ G::Z::field_one(); } let mut tally_votes_state_ret = state.clone(); diff --git a/ovn/src/ovn_group2.rs b/ovn/src/ovn_group2.rs new file mode 100644 index 0000000..f558aed --- /dev/null +++ b/ovn/src/ovn_group2.rs @@ -0,0 +1,404 @@ +#[hax_lib_macros::exclude] +use hax_lib_macros::*; + +#[exclude] +use hacspec_concordium::*; +#[exclude] +use hacspec_concordium_derive::*; + +pub use crate::ovn_traits::*; + +use core::marker::PhantomData; + +//////////////////////// +// Useful definitions // +//////////////////////// + +struct OVN { + pd: core::marker::PhantomData, +} + +#[derive(Serialize, SchemaType, Clone, Copy)] +pub struct SchnorrZKPCommit { + pub schnorr_zkp_u: G, + pub schnorr_zkp_c: G::Z, + pub schnorr_zkp_z: G::Z, +} + +#[derive(Serialize, SchemaType, Clone, Copy)] +pub struct OrZKPCommit { + pub or_zkp_x: G, + pub or_zkp_y: G, + pub or_zkp_a1: G, + pub or_zkp_b1: G, + pub or_zkp_a2: G, + pub or_zkp_b2: G, + + pub or_zkp_c: G::Z, + + pub or_zkp_d1: G::Z, + pub or_zkp_d2: G::Z, + + pub or_zkp_r1: G::Z, + pub or_zkp_r2: G::Z, +} + +#[hax::contract_state(contract = "OVN")] +// #[cfg_attr(not(feature = "hax_compilation"), contract_state(contract = "OVN"))] +#[derive(Serialize, SchemaType, Clone, Copy)] +pub struct OvnContractState { + pub g_pow_xis: [G; n], + pub zkp_xis: [SchnorrZKPCommit; n], + + pub commit_vis: [G::Z; n], + + pub g_pow_xi_yi_vis: [G; n], + pub zkp_vis: [OrZKPCommit; n], + + pub tally: u32, + + pub round1: [bool; n], +} + +#[derive(Serialize, SchemaType)] +pub struct RegisterParam { + pub rp_i: u32, + pub rp_xi: Z, + pub rp_zkp_random: Z, +} + +#[derive(Serialize, SchemaType)] +pub struct CastVoteParam { + pub cvp_i: u32, + pub cvp_xi: Z, + pub cvp_zkp_random_w: Z, + pub cvp_zkp_random_r: Z, + pub cvp_zkp_random_d: Z, + pub cvp_vote: bool, +} + +#[derive(Serialize, SchemaType)] +pub struct TallyParameter {} + +impl OVN { + pub fn sub(x: G::Z, y: G::Z) -> G::Z { + (x + /* field addition */ (-/* field opposite */y)) + } + + pub fn div(x: G, y: G) -> G { + x * G::group_inv(y) // group product + } + + //////////////////// + // Implementation // + //////////////////// + + /** Non-interactive Schnorr proof using Fiat-Shamir heuristics (RFC 8235) */ + // https://www.rfc-editor.org/rfc/rfc8235 + // https://crypto.stanford.edu/cs355/19sp/lec5.pdf + pub fn schnorr_zkp(random: G::Z, h: G, x: G::Z) -> SchnorrZKPCommit { + let r = random; + let u = G::g_pow(r); + let c = G::hash(vec![G::g(), h, u]); + let z = (r + /* field addition */ (c * /* field product */ x)); + + return SchnorrZKPCommit { + schnorr_zkp_u: u, + schnorr_zkp_c: c, + schnorr_zkp_z: z, + }; + } + + // https://crypto.stanford.edu/cs355/19sp/lec5.pdf + pub fn schnorr_zkp_validate(h: G, pi: SchnorrZKPCommit) -> bool { + pi.schnorr_zkp_c == G::hash(vec![G::g(), h, pi.schnorr_zkp_u]) + && G::g_pow(pi.schnorr_zkp_z) + == (pi.schnorr_zkp_u * /* group product */ G::pow(h, pi.schnorr_zkp_c)) + } + + /** Cramer, Damgård and Schoenmakers (CDS) technique */ + pub fn zkp_one_out_of_two( + random_w: G::Z, + random_r: G::Z, + random_d: G::Z, + h: G, + xi: G::Z, + vi: bool, + ) -> OrZKPCommit { + let w = random_w; + + if vi { + let r1 = random_r; + let d1 = random_d; + + let x = G::g_pow(xi); + let y = G::pow(h, xi) * /* group product */ G::g(); + + let a1 = G::g_pow(r1) * /* group product */ G::pow(x, d1); + let b1 = G::pow(h, r1) * /* group product */ G::pow(y, d1); + + let a2 = G::g_pow(w); + let b2 = G::pow(h, w); + + let c = G::hash(vec![x, y, a1, b1, a2, b2]); + + let d2 = Self::sub(c, d1); + let r2 = Self::sub(w, xi * /* field product */ d2); + + OrZKPCommit:: { + or_zkp_x: x, + or_zkp_y: y, + or_zkp_a1: a1, + or_zkp_b1: b1, + or_zkp_a2: a2, + or_zkp_b2: b2, + or_zkp_c: c, + or_zkp_d1: d1, + or_zkp_d2: d2, + or_zkp_r1: r1, + or_zkp_r2: r2, + } + } else { + let r2 = random_r; + let d2 = random_d; + + let x = G::g_pow(xi); + let y = G::pow(h, xi); + + let a1 = G::g_pow(w); + let b1 = G::pow(h, w); + + let a2 = G::g_pow(r2) * /* group product */ G::pow(x, d2); + let b2 = G::pow(h, r2) * /* group product */ G::pow(Self::div(y, G::g()), d2); + + let c = G::hash(vec![x, y, a1, b1, a2, b2]); + + let d1 = Self::sub(c, d2); + let r1 = Self::sub(w, (xi * /* field product */ d1)); + + OrZKPCommit:: { + or_zkp_x: x, + or_zkp_y: y, + or_zkp_a1: a1, + or_zkp_b1: b1, + or_zkp_a2: a2, + or_zkp_b2: b2, + or_zkp_c: c, + or_zkp_d1: d1, + or_zkp_d2: d2, + or_zkp_r1: r1, + or_zkp_r2: r2, + } + } + } + + // Anonymous voting by two-round public discussion + pub fn zkp_one_out_of_two_validate(h: G, zkp: OrZKPCommit) -> bool { + let c = G::hash(vec![ + zkp.or_zkp_x, + zkp.or_zkp_y, + zkp.or_zkp_a1, + zkp.or_zkp_b1, + zkp.or_zkp_a2, + zkp.or_zkp_b2, + ]); // TODO: add i + + (c == (zkp.or_zkp_d1 + /* field addition */ zkp.or_zkp_d2) + && zkp.or_zkp_a1 + == (G::g_pow(zkp.or_zkp_r1) * /* group product */ G::pow(zkp.or_zkp_x, zkp.or_zkp_d1)) + && zkp.or_zkp_b1 + == (G::pow(h, zkp.or_zkp_r1) * /* group product */ + G::pow(zkp.or_zkp_y, zkp.or_zkp_d1)) + && zkp.or_zkp_a2 + == (G::g_pow(zkp.or_zkp_r2) * /* group product */ G::pow(zkp.or_zkp_x, zkp.or_zkp_d2)) + && zkp.or_zkp_b2 + == (G::pow(h, zkp.or_zkp_r2) * /* group product */ + G::pow(Self::div(zkp.or_zkp_y, G::g()), zkp.or_zkp_d2))) + } + + pub fn commit_to(g_pow_xi_yi_vi: G) -> G::Z { + G::hash(vec![g_pow_xi_yi_vi]) + } + + pub fn check_commitment(g_pow_xi_yi_vi: G, commitment: G::Z) -> bool { + G::hash(vec![g_pow_xi_yi_vi]) == commitment + } + + #[hax::init(contract = "OVN")] + // #[cfg_attr(not(feature = "hax_compilation"), init(contract = "OVN"))] + pub fn init_ovn_contract(// _: &impl HasInitContext, + ) -> InitResult> { + Ok(OvnContractState:: { + g_pow_xis: [G::group_one(); n], + zkp_xis: [SchnorrZKPCommit:: { + schnorr_zkp_u: G::group_one(), + schnorr_zkp_z: G::Z::field_zero(), + schnorr_zkp_c: G::Z::field_zero(), + }; n], + + commit_vis: [G::Z::field_zero(); n], + + g_pow_xi_yi_vis: [G::group_one(); n], + zkp_vis: [OrZKPCommit:: { + or_zkp_x: G::group_one(), + or_zkp_y: G::group_one(), + or_zkp_a1: G::group_one(), + or_zkp_b1: G::group_one(), + or_zkp_a2: G::group_one(), + or_zkp_b2: G::group_one(), + + or_zkp_c: G::Z::field_zero(), + + or_zkp_d1: G::Z::field_zero(), + or_zkp_d2: G::Z::field_zero(), + + or_zkp_r1: G::Z::field_zero(), + or_zkp_r2: G::Z::field_zero(), + }; n], + + tally: 0, + + round1: [false; n], + }) + } + + /** Primary function in round 1 */ + #[hax::receive(contract = "OVN", name = "register", parameter = "RegisterParam")] + // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "register", parameter = "RegisterParam"))] + pub fn register_vote( + ctx: impl HasReceiveContext, + state: OvnContractState, + ) -> Result<(A, OvnContractState), ParseError> { + let params: RegisterParam = ctx.parameter_cursor().get()?; + let g_pow_xi = G::g_pow(params.rp_xi); + + let zkp_xi = Self::schnorr_zkp(params.rp_zkp_random, g_pow_xi, params.rp_xi); + + let mut register_vote_state_ret = state.clone(); + register_vote_state_ret.g_pow_xis[params.rp_i as usize] = g_pow_xi; + register_vote_state_ret.zkp_xis[params.rp_i as usize] = zkp_xi; + register_vote_state_ret.round1[params.rp_i as usize] = true; + + Ok((A::accept(), register_vote_state_ret)) + } + + // impl core::ops::Mul for G { + // type Output = Self; + // fn mul (self, rhs: Self) { + // Self::prod(self, rhs) + // } + // } + + pub fn compute_g_pow_yi(i: usize, xis: [G; n]) -> G { + let mut prod1 = xis[0..i].iter().map(|x| x.clone()).product::(); + let mut prod2 = xis[i + 1..n].iter().map(|x| x.clone()).product::(); + + // implicitly: Y_i = g^y_i + let g_pow_yi = Self::div(prod1, prod2); + g_pow_yi + } + + pub fn compute_group_element_for_vote(xi: G::Z, vote: bool, g_pow_yi: G) -> G { + (G::pow(g_pow_yi, xi) * /* group product */ + G::g_pow(if vote { + G::Z::field_one() + } else { + G::Z::field_zero() + })) + } + + /** Commitment before round 2 */ + #[hax::receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam")] + // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "commit_to_vote", parameter = "CastVoteParam"))] + pub fn commit_to_vote( + ctx: impl HasReceiveContext, + state: OvnContractState, + ) -> Result<(A, OvnContractState), ParseError> { + let params: CastVoteParam = ctx.parameter_cursor().get()?; + + for i in 0..n { + if !Self::schnorr_zkp_validate(state.g_pow_xis[i], state.zkp_xis[i]) || !state.round1[i] + { + return Err(ParseError {}); + } + } + + let g_pow_yi = Self::compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); + let g_pow_xi_yi_vi = + Self::compute_group_element_for_vote(params.cvp_xi, params.cvp_vote, g_pow_yi); + let commit_vi = Self::commit_to(g_pow_xi_yi_vi); + + let mut commit_to_vote_state_ret = state.clone(); + commit_to_vote_state_ret.commit_vis[params.cvp_i as usize] = commit_vi; + Ok((A::accept(), commit_to_vote_state_ret)) + } + + /** Primary function in round 2, also opens commitment */ + #[hax::receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam")] + // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "cast_vote", parameter = "CastVoteParam"))] + pub fn cast_vote( + ctx: impl HasReceiveContext, + state: OvnContractState, + ) -> Result<(A, OvnContractState), ParseError> { + let params: CastVoteParam = ctx.parameter_cursor().get()?; + + let g_pow_yi = Self::compute_g_pow_yi::(params.cvp_i as usize, state.g_pow_xis); + let g_pow_xi_yi_vi = + Self::compute_group_element_for_vote(params.cvp_xi, params.cvp_vote, g_pow_yi); + + let zkp_vi = Self::zkp_one_out_of_two( + params.cvp_zkp_random_w, + params.cvp_zkp_random_r, + params.cvp_zkp_random_d, + g_pow_yi, + params.cvp_xi, + params.cvp_vote, + ); + let mut cast_vote_state_ret = state.clone(); + cast_vote_state_ret.g_pow_xi_yi_vis[params.cvp_i as usize] = g_pow_xi_yi_vi; + cast_vote_state_ret.zkp_vis[params.cvp_i as usize] = zkp_vi; + + Ok((A::accept(), cast_vote_state_ret)) + } + + #[hax::receive(contract = "OVN", name = "tally", parameter = "TallyParameter")] + // #[cfg_attr(not(feature = "hax_compilation"), receive(contract = "OVN", name = "tally", parameter = "TallyParameter"))] + /** Anyone can tally the votes */ + pub fn tally_votes( + _: impl HasReceiveContext, + state: OvnContractState, + ) -> Result<(A, OvnContractState), ParseError> { + for i in 0..n { + let g_pow_yi = Self::compute_g_pow_yi::(i as usize, state.g_pow_xis); + if !Self::zkp_one_out_of_two_validate(g_pow_yi, state.zkp_vis[i]) { + return Err(ParseError {}); + } + if !Self::check_commitment(state.g_pow_xi_yi_vis[i], state.commit_vis[i]) { + return Err(ParseError {}); + } + } + + let mut vote_result = G::group_one(); + for g_pow_vote in state.g_pow_xi_yi_vis { + vote_result = (vote_result * /* group product */ g_pow_vote); + } + + let mut tally = 0; + let mut curr = G::Z::field_zero(); + for i in 0..n as u32 { + // Should be while, but is bounded by n anyways! + if G::g_pow(curr) == vote_result { + tally = i; + } + + curr = (curr + /* field addition */ G::Z::field_one()); + } + + let mut tally_votes_state_ret = state.clone(); + tally_votes_state_ret.tally = tally; + + Ok((A::accept(), tally_votes_state_ret)) + } + + // https://github.com/stonecoldpat/anonymousvoting +} diff --git a/ovn/src/ovn_secp256k1.rs b/ovn/src/ovn_secp256k1.rs index 91d6f5b..7de2adc 100644 --- a/ovn/src/ovn_secp256k1.rs +++ b/ovn/src/ovn_secp256k1.rs @@ -53,6 +53,38 @@ impl hacspec_concordium::Serial for Z_curve { } } +impl core::ops::Mul for Z_curve { + type Output = Self; + fn mul(self, y: Self) -> Self { + Z_curve { z_val: self.z_val * y.z_val } + } +} + +impl core::iter::Product for Z_curve { + fn product>(iter: I) -> Self { + iter.fold( + Z_curve { + z_val: Scalar::from_literal(1u128), + }, + |a, b| a * b, + ) + } +} + +impl core::ops::Add for Z_curve { + type Output = Self; + fn add(self, y: Self) -> Self { + Z_curve { z_val: self.z_val + y.z_val } + } +} + +impl core::ops::Neg for Z_curve { + type Output = Self; + fn neg(self) -> Self { + Z_curve { z_val: Self::field_zero().z_val - self.z_val } + } +} + impl Field for Z_curve { fn q() -> Self { Z_curve { @@ -80,22 +112,10 @@ impl Field for Z_curve { } // Scalar::ONE() } - fn add(x: Self, y: Self) -> Self { - Z_curve { z_val: x.z_val + y.z_val } - } - - fn opp(x: Self) -> Self { - Z_curve { z_val: Self::field_zero().z_val - x.z_val } - } - // fn sub(x: Self, y: Self) -> Self { // Z_curve { z_val: x.z_val - y.z_val } // } - fn mul(x: Self, y: Self) -> Self { - Z_curve { z_val: x.z_val * y.z_val } - } - fn inv(x: Self) -> Self { assert!(false); // Missing return x; @@ -103,6 +123,7 @@ impl Field for Z_curve { } + #[derive(core::marker::Copy, Clone, PartialEq, Eq)] pub struct Group_curve { g_val: Point, @@ -153,6 +174,24 @@ impl hacspec_concordium::Serial for Group_curve { } } +impl core::ops::Mul for Group_curve { + type Output = Self; + fn mul(self, y: Self) -> Self { + Group_curve { + g_val: point_add(self.g_val, y.g_val), + } + } +} + +impl core::iter::Product for Group_curve { + fn product>(iter: I) -> Self { + iter.fold( + Self::g_pow(::field_zero()), + |a, b| a * b, + ) + } +} + impl Group for Group_curve { type Z = Z_curve; @@ -197,12 +236,6 @@ impl Group for Group_curve { Self::g_pow(::field_zero()) } - fn prod(x: Self, y: Self) -> Self { - Group_curve { - g_val: point_add(x.g_val, y.g_val), - } - } - fn group_inv(x: Self) -> Self { Group_curve { g_val: match x.g_val { diff --git a/ovn/src/ovn_traits.rs b/ovn/src/ovn_traits.rs index d1987db..0a1f8cb 100644 --- a/ovn/src/ovn_traits.rs +++ b/ovn/src/ovn_traits.rs @@ -11,13 +11,22 @@ use hax_lib_macros::*; #[exclude] use hacspec_concordium::*; +// use hax_lib::lemma; + +use core::iter::Product; +#[exclude] +use core::marker::Copy; +#[exclude] +use core::ops::{Add, Mul, Neg}; //////////// // Traits // //////////// /** Interface for field implementation */ -pub trait Field: core::marker::Copy + PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize { +pub trait Field: + Copy + PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize + Mul + Product + Add + Neg +{ fn q() -> Self; fn random_field_elem(random: u32) -> Self; @@ -25,23 +34,26 @@ pub trait Field: core::marker::Copy + PartialEq + Eq + Clone + Copy + hacspec_co fn field_zero() -> Self; fn field_one() -> Self; - fn add(x: Self, y: Self) -> Self; - fn opp(x: Self) -> Self; - - fn mul(x: Self, y: Self) -> Self; fn inv(x: Self) -> Self; } +// #[hax_lib::lemma] +// #[hax_lib::requires(true)] +// fn addC(x: G, y: G) -> Proof<{ x + y == y + x }> +// { +// } + /** Interface for group implementation */ -pub trait Group: core::marker::Copy + PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize { - type Z : Field; +pub trait Group: + Copy + PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize + Mul + Product +{ + type Z: Field; fn g() -> Self; // Generator (elemnent of group) fn g_pow(x: Self::Z) -> Self; fn pow(g: Self, x: Self::Z) -> Self; // TODO: Link with q fn group_one() -> Self; - fn prod(x: Self, y: Self) -> Self; fn group_inv(x: Self) -> Self; fn hash(x: Vec) -> Self::Z; diff --git a/ovn/src/ovn_z_89.rs b/ovn/src/ovn_z_89.rs index ed53dd0..59f7589 100644 --- a/ovn/src/ovn_z_89.rs +++ b/ovn/src/ovn_z_89.rs @@ -44,6 +44,44 @@ pub struct z_89 { z_val : u8 } // } // } +impl core::ops::Mul for z_89 { + type Output = Self; + fn mul(self, y: Self) -> Self { + let q_ = Self::q().z_val - 1; + let x_ : u16 = (self.z_val % q_) as u16; + let y_ : u16 = (y.z_val % q_) as u16; + z_89{ z_val: ((x_ * y_) % (q_ as u16)) as u8 } + } +} + +impl core::iter::Product for z_89 { + fn product>(iter: I) -> Self { + iter.fold( + z_89{ z_val: 1u8 }, + |a, b| a * b, + ) + } +} + +impl core::ops::Add for z_89 { + type Output = Self; + fn add(self, y: Self) -> Self { + let q_ = Self::q().z_val - 1; + let x_ = self.z_val % q_; + let y_ = y.z_val % q_; + z_89{ z_val: (x_ + y_) % q_ } + } +} + +impl core::ops::Neg for z_89 { + type Output = Self; + fn neg(self) -> Self { + let q_ = Self::q().z_val - 1; + let x_ = self.z_val % q_; + z_89{ z_val: q_ - x_ } + } +} + impl Field for z_89 { fn q() -> Self { z_89{ z_val: 89u8} @@ -60,26 +98,6 @@ impl Field for z_89 { z_89{ z_val: 1u8 } } - fn add(x: Self, y: Self) -> Self { - let q_ = Self::q().z_val - 1; - let x_ = x.z_val % q_; - let y_ = y.z_val % q_; - z_89{ z_val: (x_ + y_) % q_ } - } - - fn opp(x: Self) -> Self { - let q_ = Self::q().z_val - 1; - let x_ = x.z_val % q_; - z_89{ z_val: q_ - x_ } - } - - fn mul(x: Self, y: Self) -> Self { - let q_ = Self::q().z_val - 1; - let x_ : u16 = (x.z_val % q_) as u16; - let y_ : u16 = (y.z_val % q_) as u16; - z_89{ z_val: ((x_ * y_) % (q_ as u16)) as u8 } - } - fn inv(x: Self) -> Self { assert!(false); // Missing return x; @@ -108,6 +126,24 @@ pub struct g_z_89 { g_val : u8 } // } // } +impl core::ops::Mul for g_z_89 { + type Output = Self; + fn mul(self, y: Self) -> Self { + let q_ = z_89::q().z_val; + let x_ = (self.g_val % q_) as u16; + let y_ = (y.g_val % q_) as u16; + g_z_89 { g_val: ((x_ * y_) % (q_ as u16)) as u8 } + } +} + +impl core::iter::Product for g_z_89 { + fn product>(iter: I) -> Self { + iter.fold( + g_z_89 { g_val: 1 }, + |a, b| a * b, + ) + } +} impl Group for g_z_89 { type Z = z_89; @@ -119,7 +155,7 @@ impl Group for g_z_89 { fn hash(x: Vec) -> z_89 { let mut res = z_89::field_one(); for y in x { - res = z_89::mul(z_89{z_val: y.g_val}, res); + res = z_89{z_val: y.g_val} * /* field product */ res; } res // TODO } @@ -132,7 +168,7 @@ impl Group for g_z_89 { fn pow(g: Self, x: z_89) -> Self { let mut result = Self::group_one(); for _ in 0..(x.z_val % (z_89::q().z_val - 1)) { - result = Self::prod(result, g); + result = result * /* group product */ g; } result } @@ -141,17 +177,10 @@ impl Group for g_z_89 { g_z_89 { g_val: 1 } } - fn prod(x: Self, y: Self) -> Self { - let q_ = z_89::q().z_val; - let x_ = (x.g_val % q_) as u16; - let y_ = (y.g_val % q_) as u16; - g_z_89 { g_val: ((x_ * y_) % (q_ as u16)) as u8 } - } - fn group_inv(x: Self) -> Self { for j in 0..89 { let g_value = g_z_89 {g_val: j}; - if Self::prod(x, g_value) == Self::group_one() { + if x * /* group product */ g_value == Self::group_one() { return g_value; } } diff --git a/ovn/tests/ovn_example.rs b/ovn/tests/ovn_example.rs index 90fe977..f45b336 100644 --- a/ovn/tests/ovn_example.rs +++ b/ovn/tests/ovn_example.rs @@ -102,7 +102,7 @@ pub fn sum_to_zero() { let mut res = G::group_one(); for i in 0..n { let g_pow_yi = compute_g_pow_yi::(i, g_pow_xis); - res = G::prod(res, G::pow(g_pow_yi, xis[i])); + res = (res * /* group product */ G::pow(g_pow_yi, xis[i])); } assert!(res == G::group_one()); From b243af54023e105dc9e9730aaf47aa3e0f9874f3 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Mon, 16 Sep 2024 14:09:41 +0200 Subject: [PATCH 85/86] Remove operation type comments --- ovn/src/ovn_group.rs | 38 +++++++++++++++++++------------------- ovn/src/ovn_z_89.rs | 6 +++--- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs index 3ed87c3..3d69932 100644 --- a/ovn/src/ovn_group.rs +++ b/ovn/src/ovn_group.rs @@ -13,11 +13,11 @@ pub use crate::ovn_traits::*; //////////////////////// fn sub(x: Z, y: Z) -> Z { - x + /* field addition */ (-/* field opposite */y) + x + (-y) } fn div(x: G, y: G) -> G { - x * G::group_inv(y) // group product + x * G::group_inv(y) } //////////////////// @@ -38,7 +38,7 @@ pub fn schnorr_zkp(random: G::Z, h: G, x: G::Z) -> SchnorrZKPCommit let r = random; let u = G::g_pow(r); let c = G::hash(vec![G::g(), h, u]); - let z = r + /* field addition */ c * /* field product */ x; + let z = r + c * x; return SchnorrZKPCommit { schnorr_zkp_u: u, @@ -51,7 +51,7 @@ pub fn schnorr_zkp(random: G::Z, h: G, x: G::Z) -> SchnorrZKPCommit pub fn schnorr_zkp_validate(h: G, pi: SchnorrZKPCommit) -> bool { pi.schnorr_zkp_c == G::hash(vec![G::g(), h, pi.schnorr_zkp_u]) && G::g_pow(pi.schnorr_zkp_z) - == pi.schnorr_zkp_u * /* group product */ G::pow(h, pi.schnorr_zkp_c) + == pi.schnorr_zkp_u * G::pow(h, pi.schnorr_zkp_c) } #[derive(Serialize, SchemaType, Clone, Copy)] @@ -88,10 +88,10 @@ pub fn zkp_one_out_of_two( let d1 = random_d; let x = G::g_pow(xi); - let y = G::pow(h, xi) * /* group product */ G::g(); + let y = G::pow(h, xi) * G::g(); - let a1 = G::g_pow(r1) * /* group product */ G::pow(x, d1); - let b1 = G::pow(h, r1) * /* group product */ G::pow(y, d1); + let a1 = G::g_pow(r1) * G::pow(x, d1); + let b1 = G::pow(h, r1) * G::pow(y, d1); let a2 = G::g_pow(w); let b2 = G::pow(h, w); @@ -99,7 +99,7 @@ pub fn zkp_one_out_of_two( let c = G::hash(vec![x, y, a1, b1, a2, b2]); let d2 = sub::(c, d1); - let r2 = sub::(w, xi * /* field product */ d2); + let r2 = sub::(w, xi * d2); OrZKPCommit { or_zkp_x: x, @@ -124,13 +124,13 @@ pub fn zkp_one_out_of_two( let a1 = G::g_pow(w); let b1 = G::pow(h, w); - let a2 = G::g_pow(r2) * /* group product */ G::pow(x, d2); - let b2 = G::pow(h, r2) * /* group product */ G::pow(div::(y, G::g()), d2); + let a2 = G::g_pow(r2) * G::pow(x, d2); + let b2 = G::pow(h, r2) * G::pow(div::(y, G::g()), d2); let c = G::hash(vec![x, y, a1, b1, a2, b2]); let d1 = sub::(c, d2); - let r1 = sub::(w, xi * /* field product */ d1); + let r1 = sub::(w, xi * d1); OrZKPCommit { or_zkp_x: x, @@ -159,16 +159,16 @@ pub fn zkp_one_out_of_two_validate(h: G, zkp: OrZKPCommit) -> bool zkp.or_zkp_b2, ]); // TODO: add i - (c == zkp.or_zkp_d1 + /* field addition */ zkp.or_zkp_d2 + (c == zkp.or_zkp_d1 + zkp.or_zkp_d2 && zkp.or_zkp_a1 - == G::g_pow(zkp.or_zkp_r1) * /* group product */ G::pow(zkp.or_zkp_x, zkp.or_zkp_d1) + == G::g_pow(zkp.or_zkp_r1) * G::pow(zkp.or_zkp_x, zkp.or_zkp_d1) && zkp.or_zkp_b1 - == G::pow(h, zkp.or_zkp_r1) * /* group product */ + == G::pow(h, zkp.or_zkp_r1) * G::pow(zkp.or_zkp_y, zkp.or_zkp_d1) && zkp.or_zkp_a2 - == G::g_pow(zkp.or_zkp_r2) * /* group product */ G::pow(zkp.or_zkp_x, zkp.or_zkp_d2) + == G::g_pow(zkp.or_zkp_r2) * G::pow(zkp.or_zkp_x, zkp.or_zkp_d2) && zkp.or_zkp_b2 - == G::pow(h, zkp.or_zkp_r2) * /* group product */ G::pow(div::(zkp.or_zkp_y, G::g()), zkp.or_zkp_d2)) + == G::pow(h, zkp.or_zkp_r2) * G::pow(div::(zkp.or_zkp_y, G::g()), zkp.or_zkp_d2)) } pub fn commit_to(g_pow_xi_yi_vi: G) -> G::Z { @@ -288,7 +288,7 @@ pub fn compute_g_pow_yi(i: usize, xis: [G; n]) -> G { } pub fn compute_group_element_for_vote(xi: G::Z, vote: bool, g_pow_yi: G) -> G { - G::pow(g_pow_yi, xi) * /* group product */ + G::pow(g_pow_yi, xi) * G::g_pow(if vote { G::Z::field_one() } else { @@ -371,7 +371,7 @@ pub fn tally_votes( let mut vote_result = G::group_one(); for g_pow_vote in state.g_pow_xi_yi_vis { - vote_result = vote_result * /* group product */ g_pow_vote; + vote_result = vote_result * g_pow_vote; } // let tally = (0..(n as u32)).rposition(|i| G::g_pow(i) == vote_result).unwrap() as u32; @@ -383,7 +383,7 @@ pub fn tally_votes( tally = i; } - curr = curr + /* field addition */ G::Z::field_one(); + curr = curr + G::Z::field_one(); } let mut tally_votes_state_ret = state.clone(); diff --git a/ovn/src/ovn_z_89.rs b/ovn/src/ovn_z_89.rs index 59f7589..98ce55d 100644 --- a/ovn/src/ovn_z_89.rs +++ b/ovn/src/ovn_z_89.rs @@ -155,7 +155,7 @@ impl Group for g_z_89 { fn hash(x: Vec) -> z_89 { let mut res = z_89::field_one(); for y in x { - res = z_89{z_val: y.g_val} * /* field product */ res; + res = z_89{z_val: y.g_val} * res; } res // TODO } @@ -168,7 +168,7 @@ impl Group for g_z_89 { fn pow(g: Self, x: z_89) -> Self { let mut result = Self::group_one(); for _ in 0..(x.z_val % (z_89::q().z_val - 1)) { - result = result * /* group product */ g; + result = result * g; } result } @@ -180,7 +180,7 @@ impl Group for g_z_89 { fn group_inv(x: Self) -> Self { for j in 0..89 { let g_value = g_z_89 {g_val: j}; - if x * /* group product */ g_value == Self::group_one() { + if x * g_value == Self::group_one() { return g_value; } } From 9fb06c9d0c9481f9d9355b18f324741da81e9ab3 Mon Sep 17 00:00:00 2001 From: Lasse Letager Hansen Date: Tue, 11 Feb 2025 15:39:41 +0100 Subject: [PATCH 86/86] Update --- aes/proofs/ssprove/extraction/Hacspec_aes.v | 603 ++++ .../proofs/coq/extraction/Hacspec_aes_jazz.v | 417 +++ .../fstar/extraction/Hacspec_aes_jazz.fst | 238 ++ .../extraction/Hax_base.Int.BaseImpl.fst | 471 +++ .../extraction/Hax_base.Int.BaseSpec.fst | 81 + .../proofs/fstar/extraction/Hax_base.Int.fst | 47 + .../fstar/extraction/Hax_core.Coerce.fst | 19 + .../proofs/fstar/extraction/Hax_core.Int.fst | 2877 +++++++++++++++++ aes_jazz/src/aes_jazz.rs | 31 +- basic/proofs/ssprove/extraction/Example.v | 35 + .../ssprove/extraction/Hacspec_bls12_381.v | 288 +- .../ssprove/extraction/Hacspec_chacha20.v | 167 + .../ssprove/extraction/Hacspec_curve25519.v | 137 + .../ssprove/extraction/Hacspec_edwards25519.v | 525 +++ .../proofs/ssprove/extraction/Hacspec_gf128.v | 121 + .../proofs/ssprove/extraction/Hacspec_gimli.v | 256 ++ .../proofs/ssprove/extraction/Hacspec_halo2.v | 738 +++++ .../extraction/Hacspec_ovn.Ovn_group.fst | 949 ------ .../extraction/Hacspec_ovn.Ovn_secp256k1.fst | 740 ----- .../extraction/Hacspec_ovn.Ovn_traits.fst | 101 - .../extraction/Hacspec_ovn.Ovn_z_89_.fst | 226 -- .../extraction/.Hacspec_ovn_Ovn_traits.aux | 2 + ovn/proofs/ssprove/extraction/.Makefile.d | 3 + ovn/proofs/ssprove/extraction/.filestoinstall | 1 - ovn/proofs/ssprove/extraction/.gitignore | 7 - ovn/proofs/ssprove/extraction/.lia.cache | Bin 0 -> 48 bytes ovn/proofs/ssprove/extraction/DDH.v | 118 - ovn/proofs/ssprove/extraction/Hacspec_ovn.v | 36 +- .../extraction/Hacspec_ovn_Ovn_group.v | 693 ++-- .../extraction/Hacspec_ovn_Ovn_group2.v | 484 --- .../extraction/Hacspec_ovn_Ovn_secp256k1.v | 577 ++-- .../extraction/Hacspec_ovn_Ovn_traits.glob | 224 ++ .../extraction/Hacspec_ovn_Ovn_traits.v | 112 +- .../extraction/Hacspec_ovn_Ovn_traits.vo | Bin 0 -> 116347 bytes .../extraction/Hacspec_ovn_Ovn_traits.vok | 0 .../extraction/Hacspec_ovn_Ovn_traits.vos | 0 .../extraction/Hacspec_ovn_Ovn_z_89_.v | 261 +- .../extraction/Hacspec_ovn_Ovn_zkgroup.v | 73 - .../Hacspec_ovn_Ovn_zkgroup_specific.v | 110 - .../ssprove/extraction/Hacspec_ovn_actual.v | 874 ----- .../ssprove/extraction/Hacspec_ovn_by_hand.v | 625 ---- .../extraction/Hacspec_ovn_group_by_hand.v | 949 ------ .../extraction/Hacspec_ovn_group_no_mem.v | 608 ---- .../{CoqMakefile.conf => Makefile.conf} | 42 +- ovn/proofs/ssprove/extraction/OVN.v | 2293 ------------- ovn/proofs/ssprove/extraction/Schnorr.v | 687 ---- ovn/proofs/ssprove/extraction/SigmaProtocol.v | 1064 ------ ovn/proofs/ssprove/extraction/_CoqProject | 17 +- .../ssprove/extraction/_expected_trait.v | 86 - ovn/proofs/ssprove/extraction/ovn_eq_proof.v | 637 ---- ovn/proofs/ssprove/extraction/pkg_advantage.v | 469 --- ovn/src/ovn_group.rs | 22 +- ovn/src/ovn_traits.rs | 20 +- ovn/tests/ovn_example.rs | 1 + p256/proofs/ssprove/extraction/Hacspec_p256.v | 377 +++ .../proofs/ssprove/extraction/Hacspec_pasta.v | 208 ++ pat_trash.v | 307 ++ .../ssprove/extraction/Hacspec_poly1305.v | 135 + .../ssprove/extraction/Hacspec_sha256.v | 218 +- .../ssprove/extraction/Hacspec_sha512.v | 218 +- 60 files changed, 9096 insertions(+), 12529 deletions(-) create mode 100644 aes/proofs/ssprove/extraction/Hacspec_aes.v create mode 100644 aes_jazz/proofs/coq/extraction/Hacspec_aes_jazz.v create mode 100644 aes_jazz/proofs/fstar/extraction/Hacspec_aes_jazz.fst create mode 100644 aes_jazz/proofs/fstar/extraction/Hax_base.Int.BaseImpl.fst create mode 100644 aes_jazz/proofs/fstar/extraction/Hax_base.Int.BaseSpec.fst create mode 100644 aes_jazz/proofs/fstar/extraction/Hax_base.Int.fst create mode 100644 aes_jazz/proofs/fstar/extraction/Hax_core.Coerce.fst create mode 100644 aes_jazz/proofs/fstar/extraction/Hax_core.Int.fst create mode 100644 basic/proofs/ssprove/extraction/Example.v create mode 100644 chacha20/proofs/ssprove/extraction/Hacspec_chacha20.v create mode 100644 curve25519/proofs/ssprove/extraction/Hacspec_curve25519.v create mode 100644 edwards25519/proofs/ssprove/extraction/Hacspec_edwards25519.v create mode 100644 gf128/proofs/ssprove/extraction/Hacspec_gf128.v create mode 100644 gimli/proofs/ssprove/extraction/Hacspec_gimli.v create mode 100644 halo2/proofs/ssprove/extraction/Hacspec_halo2.v delete mode 100644 ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_group.fst delete mode 100644 ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_secp256k1.fst delete mode 100644 ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_traits.fst delete mode 100644 ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_z_89_.fst create mode 100644 ovn/proofs/ssprove/extraction/.Hacspec_ovn_Ovn_traits.aux create mode 100644 ovn/proofs/ssprove/extraction/.Makefile.d delete mode 100644 ovn/proofs/ssprove/extraction/.filestoinstall delete mode 100644 ovn/proofs/ssprove/extraction/.gitignore create mode 100644 ovn/proofs/ssprove/extraction/.lia.cache delete mode 100644 ovn/proofs/ssprove/extraction/DDH.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group2.v create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.glob create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.vo create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.vok create mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.vos delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_zkgroup.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_zkgroup_specific.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_actual.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_group_by_hand.v delete mode 100644 ovn/proofs/ssprove/extraction/Hacspec_ovn_group_no_mem.v rename ovn/proofs/ssprove/extraction/{CoqMakefile.conf => Makefile.conf} (69%) delete mode 100644 ovn/proofs/ssprove/extraction/OVN.v delete mode 100644 ovn/proofs/ssprove/extraction/Schnorr.v delete mode 100644 ovn/proofs/ssprove/extraction/SigmaProtocol.v delete mode 100644 ovn/proofs/ssprove/extraction/_expected_trait.v delete mode 100644 ovn/proofs/ssprove/extraction/ovn_eq_proof.v delete mode 100644 ovn/proofs/ssprove/extraction/pkg_advantage.v create mode 100644 p256/proofs/ssprove/extraction/Hacspec_p256.v create mode 100644 pasta/proofs/ssprove/extraction/Hacspec_pasta.v create mode 100644 pat_trash.v create mode 100644 poly1305/proofs/ssprove/extraction/Hacspec_poly1305.v diff --git a/aes/proofs/ssprove/extraction/Hacspec_aes.v b/aes/proofs/ssprove/extraction/Hacspec_aes.v new file mode 100644 index 0000000..63d2104 --- /dev/null +++ b/aes/proofs/ssprove/extraction/Hacspec_aes.v @@ -0,0 +1,603 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +(* From Jasmin Require Import word. *) + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_lib. +Export Hacspec_lib. + +(*Not implemented yet? todo(item)*) + +Equations v_BLOCKSIZE : both uint_size := + v_BLOCKSIZE := + solve_lift (ret_both (16 : uint_size)) : both uint_size. +Fail Next Obligation. + +Equations v_INVALID_KEY_EXPANSION_INDEX : both int8 := + v_INVALID_KEY_EXPANSION_INDEX := + solve_lift (ret_both (1 : int8)) : both int8. +Fail Next Obligation. + +Equations v_ITERATIONS : both uint_size := + v_ITERATIONS := + solve_lift (ret_both (40 : uint_size)) : both uint_size. +Fail Next Obligation. + +Equations v_IVSIZE : both uint_size := + v_IVSIZE := + solve_lift (ret_both (12 : uint_size)) : both uint_size. +Fail Next Obligation. + +Equations v_KEY_LENGTH : both uint_size := + v_KEY_LENGTH := + solve_lift (ret_both (4 : uint_size)) : both uint_size. +Fail Next Obligation. + +Equations v_KEY_SCHEDULE_LENGTH : both uint_size := + v_KEY_SCHEDULE_LENGTH := + solve_lift (ret_both (176 : uint_size)) : both uint_size. +Fail Next Obligation. + +Equations v_ROUNDS : both uint_size := + v_ROUNDS := + solve_lift (ret_both (10 : uint_size)) : both uint_size. +Fail Next Obligation. + +Notation "'t_AesNonce'" := (nseq int8 IVSIZE). +Definition AesNonce : both t_AesNonce -> both t_AesNonce := + id. + +Notation "'t_Block'" := (nseq int8 BLOCKSIZE). +Definition Block : both t_Block -> both t_Block := + id. + +Notation "'t_BlockResult'" := (t_Result t_Block int8). + +Notation "'t_Bytes144'" := (nseq int8 144). +Definition Bytes144 : both t_Bytes144 -> both t_Bytes144 := + id. + +Notation "'t_Bytes176'" := (nseq int8 KEY_SCHEDULE_LENGTH). +Definition Bytes176 : both t_Bytes176 -> both t_Bytes176 := + id. + +Notation "'t_Key128'" := (nseq int8 BLOCKSIZE). +Definition Key128 : both t_Key128 -> both t_Key128 := + id. + +Notation "'t_RCon'" := (nseq int8 15). +Definition RCon : both t_RCon -> both t_RCon := + id. + +Notation "'t_RoundKey'" := (nseq int8 BLOCKSIZE). +Definition RoundKey : both t_RoundKey -> both t_RoundKey := + id. + +Notation "'t_SBox'" := (nseq int8 256). +Definition SBox : both t_SBox -> both t_SBox := + id. + +Notation "'t_Word'" := (nseq int8 KEY_LENGTH). +Definition Word : both t_Word -> both t_Word := + id. + +Notation "'t_WordResult'" := (t_Result t_Word int8). + +Notation "'t_ByteSeqResult'" := (t_Result (t_Seq t_U8) int8). + +Equations add_round_key (state : both t_Block) (key : both t_RoundKey) : both t_Block := + add_round_key state key := + letb out := state in + letb out := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := v_BLOCKSIZE))) out (fun out => fun i => + update_at_usize out i ((out.a[i]) .^ (key.a[i]))) in + solve_lift out : both t_Block. +Fail Next Obligation. + +Equations rotate_word (w : both t_Word) : both t_Word := + rotate_word w := + Word (array_from_list [solve_lift (w.a[(ret_both (1 : int32))]); + solve_lift (w.a[(ret_both (2 : int32))]); + solve_lift (w.a[(ret_both (3 : int32))]); + solve_lift (w.a[(ret_both (0 : int32))])]) : both t_Word. +Fail Next Obligation. + +Equations shift_row (i : both uint_size) (shift : both uint_size) (state : both t_Block) : both t_Block := + shift_row i shift state := + letb out := state in + letb out := update_at_usize out i (state.a[(i .+ ((ret_both (4 : uint_size)) .* (shift .% (ret_both (4 : uint_size)))))]) in + letb out := update_at_usize out (i .+ (ret_both (4 : uint_size))) (state.a[(i .+ ((ret_both (4 : uint_size)) .* ((shift .+ (ret_both (1 : uint_size))) .% (ret_both (4 : uint_size)))))]) in + letb out := update_at_usize out (i .+ (ret_both (8 : uint_size))) (state.a[(i .+ ((ret_both (4 : uint_size)) .* ((shift .+ (ret_both (2 : uint_size))) .% (ret_both (4 : uint_size)))))]) in + letb out := update_at_usize out (i .+ (ret_both (12 : uint_size))) (state.a[(i .+ ((ret_both (4 : uint_size)) .* ((shift .+ (ret_both (3 : uint_size))) .% (ret_both (4 : uint_size)))))]) in + solve_lift out : both t_Block. +Fail Next Obligation. + +Equations shift_rows (state : both t_Block) : both t_Block := + shift_rows state := + letb state := shift_row (ret_both (1 : uint_size)) (ret_both (1 : uint_size)) state in + letb state := shift_row (ret_both (2 : uint_size)) (ret_both (2 : uint_size)) state in + solve_lift (shift_row (ret_both (3 : uint_size)) (ret_both (3 : uint_size)) state) : both t_Block. +Fail Next Obligation. + +Equations xor_block (block : both t_Block) (key_block : both t_Block) : both t_Block := + xor_block block key_block := + letb out := block in + letb out := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := v_BLOCKSIZE))) out (fun out => fun i => + update_at_usize out i ((out.a[i]) .^ (key_block.a[i]))) in + solve_lift out : both t_Block. +Fail Next Obligation. + +Equations v_RCON : both t_RCon := + v_RCON := + RCon (array_from_list [U8 (solve_lift (ret_both (141 : int8))); + U8 (solve_lift (ret_both (1 : int8))); + U8 (solve_lift (ret_both (2 : int8))); + U8 (solve_lift (ret_both (4 : int8))); + U8 (solve_lift (ret_both (8 : int8))); + U8 (solve_lift (ret_both (16 : int8))); + U8 (solve_lift (ret_both (32 : int8))); + U8 (solve_lift (ret_both (64 : int8))); + U8 (solve_lift (ret_both (128 : int8))); + U8 (solve_lift (ret_both (27 : int8))); + U8 (solve_lift (ret_both (54 : int8))); + U8 (solve_lift (ret_both (108 : int8))); + U8 (solve_lift (ret_both (216 : int8))); + U8 (solve_lift (ret_both (171 : int8))); + U8 (solve_lift (ret_both (77 : int8)))]) : both t_RCon. +Fail Next Obligation. + +Equations v_SBOX : both t_SBox := + v_SBOX := + SBox (array_from_list [U8 (solve_lift (ret_both (99 : int8))); + U8 (solve_lift (ret_both (124 : int8))); + U8 (solve_lift (ret_both (119 : int8))); + U8 (solve_lift (ret_both (123 : int8))); + U8 (solve_lift (ret_both (242 : int8))); + U8 (solve_lift (ret_both (107 : int8))); + U8 (solve_lift (ret_both (111 : int8))); + U8 (solve_lift (ret_both (197 : int8))); + U8 (solve_lift (ret_both (48 : int8))); + U8 (solve_lift (ret_both (1 : int8))); + U8 (solve_lift (ret_both (103 : int8))); + U8 (solve_lift (ret_both (43 : int8))); + U8 (solve_lift (ret_both (254 : int8))); + U8 (solve_lift (ret_both (215 : int8))); + U8 (solve_lift (ret_both (171 : int8))); + U8 (solve_lift (ret_both (118 : int8))); + U8 (solve_lift (ret_both (202 : int8))); + U8 (solve_lift (ret_both (130 : int8))); + U8 (solve_lift (ret_both (201 : int8))); + U8 (solve_lift (ret_both (125 : int8))); + U8 (solve_lift (ret_both (250 : int8))); + U8 (solve_lift (ret_both (89 : int8))); + U8 (solve_lift (ret_both (71 : int8))); + U8 (solve_lift (ret_both (240 : int8))); + U8 (solve_lift (ret_both (173 : int8))); + U8 (solve_lift (ret_both (212 : int8))); + U8 (solve_lift (ret_both (162 : int8))); + U8 (solve_lift (ret_both (175 : int8))); + U8 (solve_lift (ret_both (156 : int8))); + U8 (solve_lift (ret_both (164 : int8))); + U8 (solve_lift (ret_both (114 : int8))); + U8 (solve_lift (ret_both (192 : int8))); + U8 (solve_lift (ret_both (183 : int8))); + U8 (solve_lift (ret_both (253 : int8))); + U8 (solve_lift (ret_both (147 : int8))); + U8 (solve_lift (ret_both (38 : int8))); + U8 (solve_lift (ret_both (54 : int8))); + U8 (solve_lift (ret_both (63 : int8))); + U8 (solve_lift (ret_both (247 : int8))); + U8 (solve_lift (ret_both (204 : int8))); + U8 (solve_lift (ret_both (52 : int8))); + U8 (solve_lift (ret_both (165 : int8))); + U8 (solve_lift (ret_both (229 : int8))); + U8 (solve_lift (ret_both (241 : int8))); + U8 (solve_lift (ret_both (113 : int8))); + U8 (solve_lift (ret_both (216 : int8))); + U8 (solve_lift (ret_both (49 : int8))); + U8 (solve_lift (ret_both (21 : int8))); + U8 (solve_lift (ret_both (4 : int8))); + U8 (solve_lift (ret_both (199 : int8))); + U8 (solve_lift (ret_both (35 : int8))); + U8 (solve_lift (ret_both (195 : int8))); + U8 (solve_lift (ret_both (24 : int8))); + U8 (solve_lift (ret_both (150 : int8))); + U8 (solve_lift (ret_both (5 : int8))); + U8 (solve_lift (ret_both (154 : int8))); + U8 (solve_lift (ret_both (7 : int8))); + U8 (solve_lift (ret_both (18 : int8))); + U8 (solve_lift (ret_both (128 : int8))); + U8 (solve_lift (ret_both (226 : int8))); + U8 (solve_lift (ret_both (235 : int8))); + U8 (solve_lift (ret_both (39 : int8))); + U8 (solve_lift (ret_both (178 : int8))); + U8 (solve_lift (ret_both (117 : int8))); + U8 (solve_lift (ret_both (9 : int8))); + U8 (solve_lift (ret_both (131 : int8))); + U8 (solve_lift (ret_both (44 : int8))); + U8 (solve_lift (ret_both (26 : int8))); + U8 (solve_lift (ret_both (27 : int8))); + U8 (solve_lift (ret_both (110 : int8))); + U8 (solve_lift (ret_both (90 : int8))); + U8 (solve_lift (ret_both (160 : int8))); + U8 (solve_lift (ret_both (82 : int8))); + U8 (solve_lift (ret_both (59 : int8))); + U8 (solve_lift (ret_both (214 : int8))); + U8 (solve_lift (ret_both (179 : int8))); + U8 (solve_lift (ret_both (41 : int8))); + U8 (solve_lift (ret_both (227 : int8))); + U8 (solve_lift (ret_both (47 : int8))); + U8 (solve_lift (ret_both (132 : int8))); + U8 (solve_lift (ret_both (83 : int8))); + U8 (solve_lift (ret_both (209 : int8))); + U8 (solve_lift (ret_both (0 : int8))); + U8 (solve_lift (ret_both (237 : int8))); + U8 (solve_lift (ret_both (32 : int8))); + U8 (solve_lift (ret_both (252 : int8))); + U8 (solve_lift (ret_both (177 : int8))); + U8 (solve_lift (ret_both (91 : int8))); + U8 (solve_lift (ret_both (106 : int8))); + U8 (solve_lift (ret_both (203 : int8))); + U8 (solve_lift (ret_both (190 : int8))); + U8 (solve_lift (ret_both (57 : int8))); + U8 (solve_lift (ret_both (74 : int8))); + U8 (solve_lift (ret_both (76 : int8))); + U8 (solve_lift (ret_both (88 : int8))); + U8 (solve_lift (ret_both (207 : int8))); + U8 (solve_lift (ret_both (208 : int8))); + U8 (solve_lift (ret_both (239 : int8))); + U8 (solve_lift (ret_both (170 : int8))); + U8 (solve_lift (ret_both (251 : int8))); + U8 (solve_lift (ret_both (67 : int8))); + U8 (solve_lift (ret_both (77 : int8))); + U8 (solve_lift (ret_both (51 : int8))); + U8 (solve_lift (ret_both (133 : int8))); + U8 (solve_lift (ret_both (69 : int8))); + U8 (solve_lift (ret_both (249 : int8))); + U8 (solve_lift (ret_both (2 : int8))); + U8 (solve_lift (ret_both (127 : int8))); + U8 (solve_lift (ret_both (80 : int8))); + U8 (solve_lift (ret_both (60 : int8))); + U8 (solve_lift (ret_both (159 : int8))); + U8 (solve_lift (ret_both (168 : int8))); + U8 (solve_lift (ret_both (81 : int8))); + U8 (solve_lift (ret_both (163 : int8))); + U8 (solve_lift (ret_both (64 : int8))); + U8 (solve_lift (ret_both (143 : int8))); + U8 (solve_lift (ret_both (146 : int8))); + U8 (solve_lift (ret_both (157 : int8))); + U8 (solve_lift (ret_both (56 : int8))); + U8 (solve_lift (ret_both (245 : int8))); + U8 (solve_lift (ret_both (188 : int8))); + U8 (solve_lift (ret_both (182 : int8))); + U8 (solve_lift (ret_both (218 : int8))); + U8 (solve_lift (ret_both (33 : int8))); + U8 (solve_lift (ret_both (16 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (243 : int8))); + U8 (solve_lift (ret_both (210 : int8))); + U8 (solve_lift (ret_both (205 : int8))); + U8 (solve_lift (ret_both (12 : int8))); + U8 (solve_lift (ret_both (19 : int8))); + U8 (solve_lift (ret_both (236 : int8))); + U8 (solve_lift (ret_both (95 : int8))); + U8 (solve_lift (ret_both (151 : int8))); + U8 (solve_lift (ret_both (68 : int8))); + U8 (solve_lift (ret_both (23 : int8))); + U8 (solve_lift (ret_both (196 : int8))); + U8 (solve_lift (ret_both (167 : int8))); + U8 (solve_lift (ret_both (126 : int8))); + U8 (solve_lift (ret_both (61 : int8))); + U8 (solve_lift (ret_both (100 : int8))); + U8 (solve_lift (ret_both (93 : int8))); + U8 (solve_lift (ret_both (25 : int8))); + U8 (solve_lift (ret_both (115 : int8))); + U8 (solve_lift (ret_both (96 : int8))); + U8 (solve_lift (ret_both (129 : int8))); + U8 (solve_lift (ret_both (79 : int8))); + U8 (solve_lift (ret_both (220 : int8))); + U8 (solve_lift (ret_both (34 : int8))); + U8 (solve_lift (ret_both (42 : int8))); + U8 (solve_lift (ret_both (144 : int8))); + U8 (solve_lift (ret_both (136 : int8))); + U8 (solve_lift (ret_both (70 : int8))); + U8 (solve_lift (ret_both (238 : int8))); + U8 (solve_lift (ret_both (184 : int8))); + U8 (solve_lift (ret_both (20 : int8))); + U8 (solve_lift (ret_both (222 : int8))); + U8 (solve_lift (ret_both (94 : int8))); + U8 (solve_lift (ret_both (11 : int8))); + U8 (solve_lift (ret_both (219 : int8))); + U8 (solve_lift (ret_both (224 : int8))); + U8 (solve_lift (ret_both (50 : int8))); + U8 (solve_lift (ret_both (58 : int8))); + U8 (solve_lift (ret_both (10 : int8))); + U8 (solve_lift (ret_both (73 : int8))); + U8 (solve_lift (ret_both (6 : int8))); + U8 (solve_lift (ret_both (36 : int8))); + U8 (solve_lift (ret_both (92 : int8))); + U8 (solve_lift (ret_both (194 : int8))); + U8 (solve_lift (ret_both (211 : int8))); + U8 (solve_lift (ret_both (172 : int8))); + U8 (solve_lift (ret_both (98 : int8))); + U8 (solve_lift (ret_both (145 : int8))); + U8 (solve_lift (ret_both (149 : int8))); + U8 (solve_lift (ret_both (228 : int8))); + U8 (solve_lift (ret_both (121 : int8))); + U8 (solve_lift (ret_both (231 : int8))); + U8 (solve_lift (ret_both (200 : int8))); + U8 (solve_lift (ret_both (55 : int8))); + U8 (solve_lift (ret_both (109 : int8))); + U8 (solve_lift (ret_both (141 : int8))); + U8 (solve_lift (ret_both (213 : int8))); + U8 (solve_lift (ret_both (78 : int8))); + U8 (solve_lift (ret_both (169 : int8))); + U8 (solve_lift (ret_both (108 : int8))); + U8 (solve_lift (ret_both (86 : int8))); + U8 (solve_lift (ret_both (244 : int8))); + U8 (solve_lift (ret_both (234 : int8))); + U8 (solve_lift (ret_both (101 : int8))); + U8 (solve_lift (ret_both (122 : int8))); + U8 (solve_lift (ret_both (174 : int8))); + U8 (solve_lift (ret_both (8 : int8))); + U8 (solve_lift (ret_both (186 : int8))); + U8 (solve_lift (ret_both (120 : int8))); + U8 (solve_lift (ret_both (37 : int8))); + U8 (solve_lift (ret_both (46 : int8))); + U8 (solve_lift (ret_both (28 : int8))); + U8 (solve_lift (ret_both (166 : int8))); + U8 (solve_lift (ret_both (180 : int8))); + U8 (solve_lift (ret_both (198 : int8))); + U8 (solve_lift (ret_both (232 : int8))); + U8 (solve_lift (ret_both (221 : int8))); + U8 (solve_lift (ret_both (116 : int8))); + U8 (solve_lift (ret_both (31 : int8))); + U8 (solve_lift (ret_both (75 : int8))); + U8 (solve_lift (ret_both (189 : int8))); + U8 (solve_lift (ret_both (139 : int8))); + U8 (solve_lift (ret_both (138 : int8))); + U8 (solve_lift (ret_both (112 : int8))); + U8 (solve_lift (ret_both (62 : int8))); + U8 (solve_lift (ret_both (181 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (72 : int8))); + U8 (solve_lift (ret_both (3 : int8))); + U8 (solve_lift (ret_both (246 : int8))); + U8 (solve_lift (ret_both (14 : int8))); + U8 (solve_lift (ret_both (97 : int8))); + U8 (solve_lift (ret_both (53 : int8))); + U8 (solve_lift (ret_both (87 : int8))); + U8 (solve_lift (ret_both (185 : int8))); + U8 (solve_lift (ret_both (134 : int8))); + U8 (solve_lift (ret_both (193 : int8))); + U8 (solve_lift (ret_both (29 : int8))); + U8 (solve_lift (ret_both (158 : int8))); + U8 (solve_lift (ret_both (225 : int8))); + U8 (solve_lift (ret_both (248 : int8))); + U8 (solve_lift (ret_both (152 : int8))); + U8 (solve_lift (ret_both (17 : int8))); + U8 (solve_lift (ret_both (105 : int8))); + U8 (solve_lift (ret_both (217 : int8))); + U8 (solve_lift (ret_both (142 : int8))); + U8 (solve_lift (ret_both (148 : int8))); + U8 (solve_lift (ret_both (155 : int8))); + U8 (solve_lift (ret_both (30 : int8))); + U8 (solve_lift (ret_both (135 : int8))); + U8 (solve_lift (ret_both (233 : int8))); + U8 (solve_lift (ret_both (206 : int8))); + U8 (solve_lift (ret_both (85 : int8))); + U8 (solve_lift (ret_both (40 : int8))); + U8 (solve_lift (ret_both (223 : int8))); + U8 (solve_lift (ret_both (140 : int8))); + U8 (solve_lift (ret_both (161 : int8))); + U8 (solve_lift (ret_both (137 : int8))); + U8 (solve_lift (ret_both (13 : int8))); + U8 (solve_lift (ret_both (191 : int8))); + U8 (solve_lift (ret_both (230 : int8))); + U8 (solve_lift (ret_both (66 : int8))); + U8 (solve_lift (ret_both (104 : int8))); + U8 (solve_lift (ret_both (65 : int8))); + U8 (solve_lift (ret_both (153 : int8))); + U8 (solve_lift (ret_both (45 : int8))); + U8 (solve_lift (ret_both (15 : int8))); + U8 (solve_lift (ret_both (176 : int8))); + U8 (solve_lift (ret_both (84 : int8))); + U8 (solve_lift (ret_both (187 : int8))); + U8 (solve_lift (ret_both (22 : int8)))]) : both t_SBox. +Fail Next Obligation. + +Equations sub_bytes (state : both t_Block) : both t_Block := + sub_bytes state := + letb st := state in + letb st := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := v_BLOCKSIZE))) st (fun st => fun i => + update_at_usize st i (v_SBOX.a[(impl__U8__declassify (state.a[i]))])) in + solve_lift st : both t_Block. +Fail Next Obligation. + +Equations aes_enc_last (state : both t_Block) (round_key : both t_RoundKey) : both t_Block := + aes_enc_last state round_key := + letb state := sub_bytes state in + letb state := shift_rows state in + solve_lift (add_round_key state round_key) : both t_Block. +Fail Next Obligation. + +Equations xtime (x : both t_U8) : both t_U8 := + xtime x := + letb x1 := x shift_left (ret_both (1 : uint_size)) in + letb x7 := x shift_right (ret_both (7 : uint_size)) in + letb x71 := x7 .& (U8 (ret_both (1 : int8))) in + letb x711b := x71 .* (U8 (ret_both (27 : int8))) in + solve_lift (x1 .^ x711b) : both t_U8. +Fail Next Obligation. + +Equations mix_column (c : both uint_size) (state : both t_Block) : both t_Block := + mix_column c state := + letb i0 := (ret_both (4 : uint_size)) .* c in + letb s0 := state.a[i0] in + letb s1 := state.a[(i0 .+ (ret_both (1 : uint_size)))] in + letb s2 := state.a[(i0 .+ (ret_both (2 : uint_size)))] in + letb s3 := state.a[(i0 .+ (ret_both (3 : uint_size)))] in + letb st := state in + letb tmp := ((s0 .^ s1) .^ s2) .^ s3 in + letb st := update_at_usize st i0 ((s0 .^ tmp) .^ (xtime (s0 .^ s1))) in + letb st := update_at_usize st (i0 .+ (ret_both (1 : uint_size))) ((s1 .^ tmp) .^ (xtime (s1 .^ s2))) in + letb st := update_at_usize st (i0 .+ (ret_both (2 : uint_size))) ((s2 .^ tmp) .^ (xtime (s2 .^ s3))) in + letb st := update_at_usize st (i0 .+ (ret_both (3 : uint_size))) ((s3 .^ tmp) .^ (xtime (s3 .^ s0))) in + solve_lift st : both t_Block. +Fail Next Obligation. + +Equations mix_columns (state : both t_Block) : both t_Block := + mix_columns state := + letb state := mix_column (ret_both (0 : uint_size)) state in + letb state := mix_column (ret_both (1 : uint_size)) state in + letb state := mix_column (ret_both (2 : uint_size)) state in + solve_lift (mix_column (ret_both (3 : uint_size)) state) : both t_Block. +Fail Next Obligation. + +Equations aes_enc (state : both t_Block) (round_key : both t_RoundKey) : both t_Block := + aes_enc state round_key := + letb state := sub_bytes state in + letb state := shift_rows state in + letb state := mix_columns state in + solve_lift (add_round_key state round_key) : both t_Block. +Fail Next Obligation. + +Equations rounds_aes (state : both t_Block) (key : both (t_Seq t_U8)) : both t_Block := + rounds_aes state key := + letb out := state in + letb out := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__num_chunks key v_BLOCKSIZE))) out (fun out => fun i => + letb '(_,key_block) := impl_41__get_chunk key v_BLOCKSIZE i in + letb out := aes_enc out (impl__RoundKey__from_seq key_block) in + out) in + solve_lift out : both t_Block. +Fail Next Obligation. + +Equations block_cipher_aes (input : both t_Block) (key : both (t_Seq t_U8)) (nr : both uint_size) : both t_Block := + block_cipher_aes input key nr := + letb k0 := impl__RoundKey__from_slice_range key (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := ret_both (16 : uint_size))) in + letb k := impl_41__from_slice_range key (Build_t_Range (f_start := ret_both (16 : uint_size)) (f_end := nr .* (ret_both (16 : uint_size)))) in + letb kn := impl__RoundKey__from_slice key (nr .* (ret_both (16 : uint_size))) (ret_both (16 : uint_size)) in + letb state := add_round_key input k0 in + letb state := rounds_aes state k in + solve_lift (aes_enc_last state kn) : both t_Block. +Fail Next Obligation. + +Equations slice_word (w : both t_Word) : both t_Word := + slice_word w := + Word (array_from_list [solve_lift (v_SBOX.a[(declassify_usize_from_U8 (w.a[(ret_both (0 : int32))]))]); + solve_lift (v_SBOX.a[(declassify_usize_from_U8 (w.a[(ret_both (1 : int32))]))]); + solve_lift (v_SBOX.a[(declassify_usize_from_U8 (w.a[(ret_both (2 : int32))]))]); + solve_lift (v_SBOX.a[(declassify_usize_from_U8 (w.a[(ret_both (3 : int32))]))])]) : both t_Word. +Fail Next Obligation. + +Equations aes_keygen_assist (w : both t_Word) (rcon : both t_U8) : both t_Word := + aes_keygen_assist w rcon := + letb k := rotate_word w in + letb k := slice_word k in + letb k := update_at k (ret_both (0 : int32)) ((k.a[(ret_both (0 : int32))]) .^ rcon) in + solve_lift k : both t_Word. +Fail Next Obligation. + +Equations key_expansion_word (w0 : both t_Word) (w1 : both t_Word) (i : both uint_size) (nk : both uint_size) (nr : both uint_size) : both (t_Result t_Word int8) := + key_expansion_word w0 w1 i nk nr := + letb k := w1 in + letb result := v_Err v_INVALID_KEY_EXPANSION_INDEX in + letb '(k,result) := ifb i <.? ((ret_both (4 : uint_size)) .* (nr .+ (ret_both (1 : uint_size)))) + then letb k := ifb (i .% nk) =.? (ret_both (0 : uint_size)) + then letb k := aes_keygen_assist k (v_RCON.a[(i ./ nk)]) in + k + else ifb andb (nk >.? (ret_both (6 : uint_size))) ((i .% nk) =.? (ret_both (4 : uint_size))) + then letb k := slice_word k in + k + else k in + letb k := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := ret_both (4 : int32)))) k (fun k => fun i => + update_at k i ((k.a[i]) .^ (w0.a[i]))) in + letb result := v_Ok k in + prod_b (k,result) + else prod_b (k,result) in + solve_lift result : both (t_Result t_Word int8). +Fail Next Obligation. + +Equations key_expansion_aes (key : both (t_Seq t_U8)) (nk : both uint_size) (nr : both uint_size) (key_schedule_length : both uint_size) (key_length : both uint_size) (iterations : both uint_size) : both (t_Result (t_Seq t_U8) int8) := + key_expansion_aes key nk nr key_schedule_length key_length iterations := + letb key_ex := impl_41__new key_schedule_length in + letb key_ex := f_update_start key_ex key in + letb word_size := key_length in + letb key_ex := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := iterations))) key_ex (fun key_ex => fun j => + letb i := j .+ word_size in + letm[choice_typeMonad.result_bind_code int8] word := impl__map_err (key_expansion_word (impl__Word__from_slice key_ex ((ret_both (4 : uint_size)) .* (i .- word_size)) (ret_both (4 : uint_size))) (impl__Word__from_slice key_ex (((ret_both (4 : uint_size)) .* i) .- (ret_both (4 : uint_size))) (ret_both (4 : uint_size))) i nk nr) f_from in + Result_Ok (letb key_ex := f_update key_ex ((ret_both (4 : uint_size)) .* i) word in + key_ex)) in + solve_lift (v_Ok key_ex) : both (t_Result (t_Seq t_U8) int8). +Fail Next Obligation. + +Equations aes_encrypt_block (k : both (t_Seq t_U8)) (input : both t_Block) (nk : both uint_size) (nr : both uint_size) (key_schedule_length : both uint_size) (key_length : both uint_size) (iterations : both uint_size) : both (t_Result t_Block int8) := + aes_encrypt_block k input nk nr key_schedule_length key_length iterations := + solve_lift (run (letm[choice_typeMonad.result_bind_code int8] key_ex := impl__map_err (key_expansion_aes k nk nr key_schedule_length key_length iterations) f_from in + Result_Ok (v_Ok (block_cipher_aes input key_ex nr)))) : both (t_Result t_Block int8). +Fail Next Obligation. + +Equations aes128_encrypt_block (k : both t_Key128) (input : both t_Block) : both t_Block := + aes128_encrypt_block k input := + solve_lift (impl__unwrap (aes_encrypt_block (impl_52__from_seq k) input v_KEY_LENGTH v_ROUNDS v_KEY_SCHEDULE_LENGTH v_KEY_LENGTH v_ITERATIONS)) : both t_Block. +Fail Next Obligation. + +Equations aes_ctr_key_block (k : both (t_Seq t_U8)) (n : both t_AesNonce) (c : both t_U32) (nk : both uint_size) (nr : both uint_size) (key_schedule_length : both uint_size) (key_length : both uint_size) (iterations : both uint_size) : both (t_Result t_Block int8) := + aes_ctr_key_block k n c nk nr key_schedule_length key_length iterations := + letb input := impl__Block__new (ret_both (tt : 'unit)) in + letb input := f_update input (ret_both (0 : uint_size)) n in + letb input := f_update input (ret_both (12 : uint_size)) (v_U32_to_be_bytes c) in + solve_lift (aes_encrypt_block k input nk nr key_schedule_length key_length iterations) : both (t_Result t_Block int8). +Fail Next Obligation. + +Equations aes_counter_mode (key : both (t_Seq t_U8)) (nonce : both t_AesNonce) (counter : both t_U32) (msg : both (t_Seq t_U8)) (nk : both uint_size) (nr : both uint_size) (key_schedule_length : both uint_size) (key_length : both uint_size) (iterations : both uint_size) : both (t_Result (t_Seq t_U8) int8) := + aes_counter_mode key nonce counter msg nk nr key_schedule_length key_length iterations := + solve_lift (run (letb ctr := counter in + letb blocks_out := impl_41__new (impl_41__len msg) in + letb n_blocks := impl_41__num_exact_chunks msg v_BLOCKSIZE in + letb '(blocks_out,ctr) := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n_blocks))) (prod_b (blocks_out,ctr)) (fun '(blocks_out,ctr) => fun i => + letb msg_block := impl_41__get_exact_chunk msg v_BLOCKSIZE i in + letm[choice_typeMonad.result_bind_code int8] key_block := impl__map_err (aes_ctr_key_block key nonce ctr nk nr key_schedule_length key_length iterations) f_from in + Result_Ok (letb blocks_out := impl_41__set_chunk blocks_out v_BLOCKSIZE i (xor_block (impl__Block__from_seq msg_block) key_block) in + letb ctr := ctr .+ (U32 (ret_both (1 : int32))) in + prod_b (blocks_out,ctr))) in + letb last_block := impl_41__get_remainder_chunk msg v_BLOCKSIZE in + letb last_block_len := impl_41__len last_block in + letm[choice_typeMonad.result_bind_code int8] blocks_out := ifb last_block_len <> (ret_both (0 : uint_size)) + then letb last_block := f_update_start (impl__Block__new (ret_both (tt : 'unit))) last_block in + letm[choice_typeMonad.result_bind_code int8] key_block := impl__map_err (aes_ctr_key_block key nonce ctr nk nr key_schedule_length key_length iterations) f_from in + Result_Ok (letb blocks_out := impl_41__set_chunk blocks_out v_BLOCKSIZE n_blocks (impl__Block__slice_range (xor_block last_block key_block) (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := last_block_len))) in + blocks_out) + else Result_Ok blocks_out in + Result_Ok (v_Ok blocks_out))) : both (t_Result (t_Seq t_U8) int8). +Fail Next Obligation. + +Equations aes128_decrypt (key : both t_Key128) (nonce : both t_AesNonce) (counter : both t_U32) (ctxt : both (t_Seq t_U8)) : both (t_Seq t_U8) := + aes128_decrypt key nonce counter ctxt := + solve_lift (impl__unwrap (aes_counter_mode (impl_52__from_seq key) nonce counter ctxt v_KEY_LENGTH v_ROUNDS v_KEY_SCHEDULE_LENGTH v_KEY_LENGTH v_ITERATIONS)) : both (t_Seq t_U8). +Fail Next Obligation. + +Equations aes128_encrypt (key : both t_Key128) (nonce : both t_AesNonce) (counter : both t_U32) (msg : both (t_Seq t_U8)) : both (t_Seq t_U8) := + aes128_encrypt key nonce counter msg := + solve_lift (impl__unwrap (aes_counter_mode (impl_52__from_seq key) nonce counter msg v_KEY_LENGTH v_ROUNDS v_KEY_SCHEDULE_LENGTH v_KEY_LENGTH v_ITERATIONS)) : both (t_Seq t_U8). +Fail Next Obligation. diff --git a/aes_jazz/proofs/coq/extraction/Hacspec_aes_jazz.v b/aes_jazz/proofs/coq/extraction/Hacspec_aes_jazz.v new file mode 100644 index 0000000..12fa93a --- /dev/null +++ b/aes_jazz/proofs/coq/extraction/Hacspec_aes_jazz.v @@ -0,0 +1,417 @@ +(* File automatically generated by Hacspec *) +From Hacspec Require Import Hacspec_Lib. +From Coq Require Import ZArith. +Import List.ListNotations. +Require Import Coq.Strings.String. +Open Scope Z_scope. +Open Scope bool_scope. +Open Scope hacspec_scope. + +Require Import Hacspec_lib. +Export Hacspec_lib. + +(*Not implemented yet? todo(item)*) + +Definition v_RCON : nseq t_u8 TODO: Int.to_string length := + array_from_list [(Int8.repr 141); + (Int8.repr 1); + (Int8.repr 2); + (Int8.repr 4); + (Int8.repr 8); + (Int8.repr 16); + (Int8.repr 32); + (Int8.repr 64); + (Int8.repr 128); + (Int8.repr 27); + (Int8.repr 54); + (Int8.repr 108); + (Int8.repr 216); + (Int8.repr 171); + (Int8.repr 77)]. + +Definition v_SBOX : nseq t_u8 TODO: Int.to_string length := + array_from_list [(Int8.repr 99); + (Int8.repr 124); + (Int8.repr 119); + (Int8.repr 123); + (Int8.repr 242); + (Int8.repr 107); + (Int8.repr 111); + (Int8.repr 197); + (Int8.repr 48); + (Int8.repr 1); + (Int8.repr 103); + (Int8.repr 43); + (Int8.repr 254); + (Int8.repr 215); + (Int8.repr 171); + (Int8.repr 118); + (Int8.repr 202); + (Int8.repr 130); + (Int8.repr 201); + (Int8.repr 125); + (Int8.repr 250); + (Int8.repr 89); + (Int8.repr 71); + (Int8.repr 240); + (Int8.repr 173); + (Int8.repr 212); + (Int8.repr 162); + (Int8.repr 175); + (Int8.repr 156); + (Int8.repr 164); + (Int8.repr 114); + (Int8.repr 192); + (Int8.repr 183); + (Int8.repr 253); + (Int8.repr 147); + (Int8.repr 38); + (Int8.repr 54); + (Int8.repr 63); + (Int8.repr 247); + (Int8.repr 204); + (Int8.repr 52); + (Int8.repr 165); + (Int8.repr 229); + (Int8.repr 241); + (Int8.repr 113); + (Int8.repr 216); + (Int8.repr 49); + (Int8.repr 21); + (Int8.repr 4); + (Int8.repr 199); + (Int8.repr 35); + (Int8.repr 195); + (Int8.repr 24); + (Int8.repr 150); + (Int8.repr 5); + (Int8.repr 154); + (Int8.repr 7); + (Int8.repr 18); + (Int8.repr 128); + (Int8.repr 226); + (Int8.repr 235); + (Int8.repr 39); + (Int8.repr 178); + (Int8.repr 117); + (Int8.repr 9); + (Int8.repr 131); + (Int8.repr 44); + (Int8.repr 26); + (Int8.repr 27); + (Int8.repr 110); + (Int8.repr 90); + (Int8.repr 160); + (Int8.repr 82); + (Int8.repr 59); + (Int8.repr 214); + (Int8.repr 179); + (Int8.repr 41); + (Int8.repr 227); + (Int8.repr 47); + (Int8.repr 132); + (Int8.repr 83); + (Int8.repr 209); + (Int8.repr 0); + (Int8.repr 237); + (Int8.repr 32); + (Int8.repr 252); + (Int8.repr 177); + (Int8.repr 91); + (Int8.repr 106); + (Int8.repr 203); + (Int8.repr 190); + (Int8.repr 57); + (Int8.repr 74); + (Int8.repr 76); + (Int8.repr 88); + (Int8.repr 207); + (Int8.repr 208); + (Int8.repr 239); + (Int8.repr 170); + (Int8.repr 251); + (Int8.repr 67); + (Int8.repr 77); + (Int8.repr 51); + (Int8.repr 133); + (Int8.repr 69); + (Int8.repr 249); + (Int8.repr 2); + (Int8.repr 127); + (Int8.repr 80); + (Int8.repr 60); + (Int8.repr 159); + (Int8.repr 168); + (Int8.repr 81); + (Int8.repr 163); + (Int8.repr 64); + (Int8.repr 143); + (Int8.repr 146); + (Int8.repr 157); + (Int8.repr 56); + (Int8.repr 245); + (Int8.repr 188); + (Int8.repr 182); + (Int8.repr 218); + (Int8.repr 33); + (Int8.repr 16); + (Int8.repr 255); + (Int8.repr 243); + (Int8.repr 210); + (Int8.repr 205); + (Int8.repr 12); + (Int8.repr 19); + (Int8.repr 236); + (Int8.repr 95); + (Int8.repr 151); + (Int8.repr 68); + (Int8.repr 23); + (Int8.repr 196); + (Int8.repr 167); + (Int8.repr 126); + (Int8.repr 61); + (Int8.repr 100); + (Int8.repr 93); + (Int8.repr 25); + (Int8.repr 115); + (Int8.repr 96); + (Int8.repr 129); + (Int8.repr 79); + (Int8.repr 220); + (Int8.repr 34); + (Int8.repr 42); + (Int8.repr 144); + (Int8.repr 136); + (Int8.repr 70); + (Int8.repr 238); + (Int8.repr 184); + (Int8.repr 20); + (Int8.repr 222); + (Int8.repr 94); + (Int8.repr 11); + (Int8.repr 219); + (Int8.repr 224); + (Int8.repr 50); + (Int8.repr 58); + (Int8.repr 10); + (Int8.repr 73); + (Int8.repr 6); + (Int8.repr 36); + (Int8.repr 92); + (Int8.repr 194); + (Int8.repr 211); + (Int8.repr 172); + (Int8.repr 98); + (Int8.repr 145); + (Int8.repr 149); + (Int8.repr 228); + (Int8.repr 121); + (Int8.repr 231); + (Int8.repr 200); + (Int8.repr 55); + (Int8.repr 109); + (Int8.repr 141); + (Int8.repr 213); + (Int8.repr 78); + (Int8.repr 169); + (Int8.repr 108); + (Int8.repr 86); + (Int8.repr 244); + (Int8.repr 234); + (Int8.repr 101); + (Int8.repr 122); + (Int8.repr 174); + (Int8.repr 8); + (Int8.repr 186); + (Int8.repr 120); + (Int8.repr 37); + (Int8.repr 46); + (Int8.repr 28); + (Int8.repr 166); + (Int8.repr 180); + (Int8.repr 198); + (Int8.repr 232); + (Int8.repr 221); + (Int8.repr 116); + (Int8.repr 31); + (Int8.repr 75); + (Int8.repr 189); + (Int8.repr 139); + (Int8.repr 138); + (Int8.repr 112); + (Int8.repr 62); + (Int8.repr 181); + (Int8.repr 102); + (Int8.repr 72); + (Int8.repr 3); + (Int8.repr 246); + (Int8.repr 14); + (Int8.repr 97); + (Int8.repr 53); + (Int8.repr 87); + (Int8.repr 185); + (Int8.repr 134); + (Int8.repr 193); + (Int8.repr 29); + (Int8.repr 158); + (Int8.repr 225); + (Int8.repr 248); + (Int8.repr 152); + (Int8.repr 17); + (Int8.repr 105); + (Int8.repr 217); + (Int8.repr 142); + (Int8.repr 148); + (Int8.repr 155); + (Int8.repr 30); + (Int8.repr 135); + (Int8.repr 233); + (Int8.repr 206); + (Int8.repr 85); + (Int8.repr 40); + (Int8.repr 223); + (Int8.repr 140); + (Int8.repr 161); + (Int8.repr 137); + (Int8.repr 13); + (Int8.repr 191); + (Int8.repr 230); + (Int8.repr 66); + (Int8.repr 104); + (Int8.repr 65); + (Int8.repr 153); + (Int8.repr 45); + (Int8.repr 15); + (Int8.repr 176); + (Int8.repr 84); + (Int8.repr 187); + (Int8.repr 22)]. + +Definition index_u32 (s : t_u128) (i : t_usize) : t_u32 := + cast ((s shift_right (i.*(Int32.repr 32))).%((Int128.repr 1) shift_left (Int32.repr 32)) : t_u128) : t_u32. + +Definition index_u8 (s : t_u32) (i : t_usize) : t_u8 := + cast ((s shift_right (i.*(Int32.repr 8))).%((Int32.repr 1) shift_left (Int32.repr 8)) : t_u32) : t_u8. + +Definition matrix_index (s : t_u128) (i : t_usize) (j : t_usize) : t_u8 := + index_u8 (index_u32 (s : t_u128) (j : t_usize) : t_u32) (i : t_usize) : t_u8. + +Definition rebuild_u128 (s0 : t_u32) (s1 : t_u32) (s2 : t_u32) (s3 : t_u32) : t_u128 := + (cast (s0 : t_u32) : t_u128).|(((cast (s1 : t_u32) : t_u128) shift_left (Int32.repr 32)).|(((cast (s2 : t_u32) : t_u128) shift_left (Int32.repr 64)).|((cast (s3 : t_u32) : t_u128) shift_left (Int32.repr 96)))). + +Definition rebuild_u32 (s0 : t_u8) (s1 : t_u8) (s2 : t_u8) (s3 : t_u8) : t_u32 := + (cast (s0 : t_u8) : t_u32).|(((cast (s1 : t_u8) : t_u32) shift_left (Int32.repr 8)).|(((cast (s2 : t_u8) : t_u32) shift_left (Int32.repr 16)).|((cast (s3 : t_u8) : t_u32) shift_left (Int32.repr 24)))). + +Definition rotword (v : t_u32) : t_u32 := + rebuild_u32 (index_u8 (v : t_u32) ((Int32.repr 1) : t_usize) : t_u8) (index_u8 (v : t_u32) ((Int32.repr 2) : t_usize) : t_u8) (index_u8 (v : t_u32) ((Int32.repr 3) : t_usize) : t_u8) (index_u8 (v : t_u32) ((Int32.repr 0) : t_usize) : t_u8) : t_u32. + +Definition shiftrows (s : t_u128) : t_u128 := + rebuild_u128 (rebuild_u32 (matrix_index (s : t_u128) ((Int32.repr 0) : t_usize) ((Int32.repr 0) : t_usize) : t_u8) (matrix_index (s : t_u128) ((Int32.repr 1) : t_usize) ((Int32.repr 1) : t_usize) : t_u8) (matrix_index (s : t_u128) ((Int32.repr 2) : t_usize) ((Int32.repr 2) : t_usize) : t_u8) (matrix_index (s : t_u128) ((Int32.repr 3) : t_usize) ((Int32.repr 3) : t_usize) : t_u8) : t_u32) (rebuild_u32 (matrix_index (s : t_u128) ((Int32.repr 0) : t_usize) ((Int32.repr 1) : t_usize) : t_u8) (matrix_index (s : t_u128) ((Int32.repr 1) : t_usize) ((Int32.repr 2) : t_usize) : t_u8) (matrix_index (s : t_u128) ((Int32.repr 2) : t_usize) ((Int32.repr 3) : t_usize) : t_u8) (matrix_index (s : t_u128) ((Int32.repr 3) : t_usize) ((Int32.repr 0) : t_usize) : t_u8) : t_u32) (rebuild_u32 (matrix_index (s : t_u128) ((Int32.repr 0) : t_usize) ((Int32.repr 2) : t_usize) : t_u8) (matrix_index (s : t_u128) ((Int32.repr 1) : t_usize) ((Int32.repr 3) : t_usize) : t_u8) (matrix_index (s : t_u128) ((Int32.repr 2) : t_usize) ((Int32.repr 0) : t_usize) : t_u8) (matrix_index (s : t_u128) ((Int32.repr 3) : t_usize) ((Int32.repr 1) : t_usize) : t_u8) : t_u32) (rebuild_u32 (matrix_index (s : t_u128) ((Int32.repr 0) : t_usize) ((Int32.repr 3) : t_usize) : t_u8) (matrix_index (s : t_u128) ((Int32.repr 1) : t_usize) ((Int32.repr 0) : t_usize) : t_u8) (matrix_index (s : t_u128) ((Int32.repr 2) : t_usize) ((Int32.repr 1) : t_usize) : t_u8) (matrix_index (s : t_u128) ((Int32.repr 3) : t_usize) ((Int32.repr 2) : t_usize) : t_u8) : t_u32) : t_u128. + +Definition subword (v : t_u32) : t_u32 := + rebuild_u32 (v_SBOX.[(cast (index_u8 (v : t_u32) ((Int32.repr 0) : t_usize) : t_u8) : t_usize)] : t_u8) (v_SBOX.[(cast (index_u8 (v : t_u32) ((Int32.repr 1) : t_usize) : t_u8) : t_usize)] : t_u8) (v_SBOX.[(cast (index_u8 (v : t_u32) ((Int32.repr 2) : t_usize) : t_u8) : t_usize)] : t_u8) (v_SBOX.[(cast (index_u8 (v : t_u32) ((Int32.repr 3) : t_usize) : t_u8) : t_usize)] : t_u8) : t_u32. + +Definition aeskeygenassist (v1 : t_u128) (v2 : t_u8) : t_u128 := + let x1 := index_u32 (v1 : t_u128) ((Int32.repr 1) : t_usize) : t_u32 : t_u32 in + let x3 := index_u32 (v1 : t_u128) ((Int32.repr 3) : t_usize) : t_u32 : t_u32 in + let y0 := subword (x1 : t_u32) : t_u32 : t_u32 in + let y1 := (rotword (y0 : t_u32) : t_u32).^(cast (v2 : t_u8) : t_u32) : t_u32 in + let y2 := subword (x3 : t_u32) : t_u32 : t_u32 in + let y3 := (rotword (y2 : t_u32) : t_u32).^(cast (v2 : t_u8) : t_u32) : t_u32 in + rebuild_u128 (y0 : t_u32) (y1 : t_u32) (y2 : t_u32) (y3 : t_u32) : t_u128. + +Definition subbytes (s : t_u128) : t_u128 := + rebuild_u128 (subword (index_u32 (s : t_u128) ((Int32.repr 0) : t_usize) : t_u32) : t_u32) (subword (index_u32 (s : t_u128) ((Int32.repr 1) : t_usize) : t_u32) : t_u32) (subword (index_u32 (s : t_u128) ((Int32.repr 2) : t_usize) : t_u32) : t_u32) (subword (index_u32 (s : t_u128) ((Int32.repr 3) : t_usize) : t_u32) : t_u32) : t_u128. + +Definition aesenclast (state : t_u128) (rkey : t_u128) : t_u128 := + let state := shiftrows (state : t_u128) : t_u128 : t_u128 in + let state := subbytes (state : t_u128) : t_u128 : t_u128 in + state.^rkey. + +Definition vpshufd1 (s : t_u128) (o : t_u8) (i : t_usize) : t_u32 := + index_u32 (s shift_right ((Int32.repr 32).*(cast ((o shift_right ((Int32.repr 2).*i)).%(Int8.repr 4) : t_u8) : t_usize)) : t_u128) ((Int32.repr 0) : t_usize) : t_u32. + +Definition vpshufd (s : t_u128) (o : t_u8) : t_u128 := + let d1 := vpshufd1 (s : t_u128) (o : t_u8) ((Int32.repr 0) : t_usize) : t_u32 : t_u32 in + let d2 := vpshufd1 (s : t_u128) (o : t_u8) ((Int32.repr 1) : t_usize) : t_u32 : t_u32 in + let d3 := vpshufd1 (s : t_u128) (o : t_u8) ((Int32.repr 2) : t_usize) : t_u32 : t_u32 in + let d4 := vpshufd1 (s : t_u128) (o : t_u8) ((Int32.repr 3) : t_usize) : t_u32 : t_u32 in + rebuild_u128 (d1 : t_u32) (d2 : t_u32) (d3 : t_u32) (d4 : t_u32) : t_u128. + +Definition vshufps (s1 : t_u128) (s2 : t_u128) (o : t_u8) : t_u128 := + let d1 := vpshufd1 (s1 : t_u128) (o : t_u8) ((Int32.repr 0) : t_usize) : t_u32 : t_u32 in + let d2 := vpshufd1 (s1 : t_u128) (o : t_u8) ((Int32.repr 1) : t_usize) : t_u32 : t_u32 in + let d3 := vpshufd1 (s2 : t_u128) (o : t_u8) ((Int32.repr 2) : t_usize) : t_u32 : t_u32 in + let d4 := vpshufd1 (s2 : t_u128) (o : t_u8) ((Int32.repr 3) : t_usize) : t_u32 : t_u32 in + rebuild_u128 (d1 : t_u32) (d2 : t_u32) (d3 : t_u32) (d4 : t_u32) : t_u128. + +Definition key_combine (rkey : t_u128) (temp1 : t_u128) (temp2 : t_u128) : t_u128 * t_u128 := + let temp1 := vpshufd (temp1 : t_u128) ((Int8.repr 255) : t_u8) : t_u128 : t_u128 in + let temp2 := vshufps (temp2 : t_u128) (rkey : t_u128) ((Int8.repr 16) : t_u8) : t_u128 : t_u128 in + let rkey := rkey.^temp2 : t_u128 in + let temp2 := vshufps (temp2 : t_u128) (rkey : t_u128) ((Int8.repr 140) : t_u8) : t_u128 : t_u128 in + let rkey := rkey.^temp2 : t_u128 in + let rkey := rkey.^temp1 : t_u128 in + (rkey,temp2). + +Definition key_expand (rcon : t_u8) (rkey : t_u128) (temp2 : t_u128) : t_u128 * t_u128 := + let temp1 := aeskeygenassist (rkey : t_u128) (rcon : t_u8) : t_u128 : t_u128 in + key_combine (rkey : t_u128) (temp1 : t_u128) (temp2 : t_u128) : (t_u128 * t_u128). + +Definition xtime (x : t_u8) : t_u8 := + let x1 := x shift_left (Int32.repr 1) : t_u8 in + let x7 := x shift_right (Int32.repr 7) : t_u8 in + let x71 := x7.&(Int8.repr 1) : t_u8 in + let x711b := x71.*(Int8.repr 27) : t_u8 in + x1.^x711b. + +Definition mixcolumn (c : t_usize) (state : t_u128) : t_u32 := + let s0 := matrix_index (state : t_u128) ((Int32.repr 0) : t_usize) (c : t_usize) : t_u8 : t_u8 in + let s1 := matrix_index (state : t_u128) ((Int32.repr 1) : t_usize) (c : t_usize) : t_u8 : t_u8 in + let s2 := matrix_index (state : t_u128) ((Int32.repr 2) : t_usize) (c : t_usize) : t_u8 : t_u8 in + let s3 := matrix_index (state : t_u128) ((Int32.repr 3) : t_usize) (c : t_usize) : t_u8 : t_u8 in + let tmp := ((s0.^s1).^s2).^s3 : t_u8 in + let r0 := (s0.^tmp).^(xtime (s0.^s1 : t_u8) : t_u8) : t_u8 in + let r1 := (s1.^tmp).^(xtime (s1.^s2 : t_u8) : t_u8) : t_u8 in + let r2 := (s2.^tmp).^(xtime (s2.^s3 : t_u8) : t_u8) : t_u8 in + let r3 := (s3.^tmp).^(xtime (s3.^s0 : t_u8) : t_u8) : t_u8 in + rebuild_u32 (r0 : t_u8) (r1 : t_u8) (r2 : t_u8) (r3 : t_u8) : t_u32. + +Definition mixcolumns (state : t_u128) : t_u128 := + let c0 := mixcolumn ((Int32.repr 0) : t_usize) (state : t_u128) : t_u32 : t_u32 in + let c1 := mixcolumn ((Int32.repr 1) : t_usize) (state : t_u128) : t_u32 : t_u32 in + let c2 := mixcolumn ((Int32.repr 2) : t_usize) (state : t_u128) : t_u32 : t_u32 in + let c3 := mixcolumn ((Int32.repr 3) : t_usize) (state : t_u128) : t_u32 : t_u32 in + rebuild_u128 (c0 : t_u32) (c1 : t_u32) (c2 : t_u32) (c3 : t_u32) : t_u128. + +Definition aesenc (state : t_u128) (rkey : t_u128) : t_u128 := + let state := shiftrows (state : t_u128) : t_u128 : t_u128 in + let state := subbytes (state : t_u128) : t_u128 : t_u128 in + let state := mixcolumns (state : t_u128) : t_u128 : t_u128 in + state.^rkey. + +Definition aes_rounds (rkeys : nseq t_u128 TODO: Int.to_string length) (inp : t_u128) : t_u128 := + let state := inp.^(rkeys.[(Int32.repr 0)]) : t_u128 in + let state := fold_range ((Int32.repr 1) : t_usize) ((Int32.repr 10) : t_usize) (fun state => fun _ => + true : (t_u128 -> t_usize -> bool)) (state : t_u128) (fun state => fun round => + aesenc (state : t_u128) (rkeys.[round] : t_u128) : t_u128 : (t_u128 -> t_usize -> t_u128)) : t_u128 : t_u128 in + aesenclast (state : t_u128) (rkeys.[(Int32.repr 10)] : t_u128) : t_u128. + +Definition keys_expand (key : t_u128) : nseq t_u128 TODO: Int.to_string length := + let rkeys := repeat ((Int128.repr 0) : t_u128) ((Int32.repr 12) : t_usize) : (nseq t_u128 TODO: Int.to_string length) : nseq t_u128 TODO: Int.to_string length in + let key := key : t_u128 in + let rkeys := update_at_usize (rkeys : (nseq t_u128 TODO: Int.to_string length)) ((Int32.repr 0) : t_usize) (key : t_u128) : (nseq t_u128 TODO: Int.to_string length) : nseq t_u128 TODO: Int.to_string length in + let temp2 := (Int128.repr 0) : t_u128 in + let '(key,rkeys,temp2) := fold_range ((Int32.repr 1) : t_usize) ((Int32.repr 11) : t_usize) (fun '(key,rkeys,temp2) => fun _ => + true : (t_u128 * nseq t_u128 TODO: Int.to_string length * t_u128 -> t_usize -> bool)) ((key,rkeys,temp2) : (t_u128 * nseq t_u128 TODO: Int.to_string length * t_u128)) (fun '(key,rkeys,temp2) => fun round => + let rcon := v_RCON.[round] : t_u8 in + let '(key_temp,temp2_temp) := key_expand (rcon : t_u8) (key : t_u128) (temp2 : t_u128) : (t_u128 * t_u128) : t_u128 * t_u128 in + let key := key_temp : t_u128 in + let temp2 := temp2_temp : t_u128 in + let rkeys := update_at_usize (rkeys : (nseq t_u128 TODO: Int.to_string length)) (round : t_usize) (key : t_u128) : (nseq t_u128 TODO: Int.to_string length) : nseq t_u128 TODO: Int.to_string length in + (key,rkeys,temp2) : (t_u128 * nseq t_u128 TODO: Int.to_string length * t_u128 -> t_usize -> t_u128 * nseq t_u128 TODO: Int.to_string length * t_u128)) : (t_u128 * nseq t_u128 TODO: Int.to_string length * t_u128) : t_u128 * nseq t_u128 TODO: Int.to_string length * t_u128 in + rkeys. + +Definition aes (key : t_u128) (inp : t_u128) : t_u128 := + let rkeys := keys_expand (key : t_u128) : (nseq t_u128 TODO: Int.to_string length) : nseq t_u128 TODO: Int.to_string length in + aes_rounds (rkeys : (nseq t_u128 TODO: Int.to_string length)) (inp : t_u128) : t_u128. diff --git a/aes_jazz/proofs/fstar/extraction/Hacspec_aes_jazz.fst b/aes_jazz/proofs/fstar/extraction/Hacspec_aes_jazz.fst new file mode 100644 index 0000000..0667d66 --- /dev/null +++ b/aes_jazz/proofs/fstar/extraction/Hacspec_aes_jazz.fst @@ -0,0 +1,238 @@ +module Hacspec_aes_jazz +#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" +open Core +open FStar.Mul + +let v_RCON: t_Array u8 (sz 15) = + let list = + [141uy; 1uy; 2uy; 4uy; 8uy; 16uy; 32uy; 64uy; 128uy; 27uy; 54uy; 108uy; 216uy; 171uy; 77uy] + in + FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 15); + Rust_primitives.Hax.array_of_list 15 list + +let v_SBOX: t_Array u8 (sz 256) = + let list = + [ + 99uy; 124uy; 119uy; 123uy; 242uy; 107uy; 111uy; 197uy; 48uy; 1uy; 103uy; 43uy; 254uy; 215uy; + 171uy; 118uy; 202uy; 130uy; 201uy; 125uy; 250uy; 89uy; 71uy; 240uy; 173uy; 212uy; 162uy; 175uy; + 156uy; 164uy; 114uy; 192uy; 183uy; 253uy; 147uy; 38uy; 54uy; 63uy; 247uy; 204uy; 52uy; 165uy; + 229uy; 241uy; 113uy; 216uy; 49uy; 21uy; 4uy; 199uy; 35uy; 195uy; 24uy; 150uy; 5uy; 154uy; 7uy; + 18uy; 128uy; 226uy; 235uy; 39uy; 178uy; 117uy; 9uy; 131uy; 44uy; 26uy; 27uy; 110uy; 90uy; + 160uy; 82uy; 59uy; 214uy; 179uy; 41uy; 227uy; 47uy; 132uy; 83uy; 209uy; 0uy; 237uy; 32uy; + 252uy; 177uy; 91uy; 106uy; 203uy; 190uy; 57uy; 74uy; 76uy; 88uy; 207uy; 208uy; 239uy; 170uy; + 251uy; 67uy; 77uy; 51uy; 133uy; 69uy; 249uy; 2uy; 127uy; 80uy; 60uy; 159uy; 168uy; 81uy; 163uy; + 64uy; 143uy; 146uy; 157uy; 56uy; 245uy; 188uy; 182uy; 218uy; 33uy; 16uy; 255uy; 243uy; 210uy; + 205uy; 12uy; 19uy; 236uy; 95uy; 151uy; 68uy; 23uy; 196uy; 167uy; 126uy; 61uy; 100uy; 93uy; + 25uy; 115uy; 96uy; 129uy; 79uy; 220uy; 34uy; 42uy; 144uy; 136uy; 70uy; 238uy; 184uy; 20uy; + 222uy; 94uy; 11uy; 219uy; 224uy; 50uy; 58uy; 10uy; 73uy; 6uy; 36uy; 92uy; 194uy; 211uy; 172uy; + 98uy; 145uy; 149uy; 228uy; 121uy; 231uy; 200uy; 55uy; 109uy; 141uy; 213uy; 78uy; 169uy; 108uy; + 86uy; 244uy; 234uy; 101uy; 122uy; 174uy; 8uy; 186uy; 120uy; 37uy; 46uy; 28uy; 166uy; 180uy; + 198uy; 232uy; 221uy; 116uy; 31uy; 75uy; 189uy; 139uy; 138uy; 112uy; 62uy; 181uy; 102uy; 72uy; + 3uy; 246uy; 14uy; 97uy; 53uy; 87uy; 185uy; 134uy; 193uy; 29uy; 158uy; 225uy; 248uy; 152uy; + 17uy; 105uy; 217uy; 142uy; 148uy; 155uy; 30uy; 135uy; 233uy; 206uy; 85uy; 40uy; 223uy; 140uy; + 161uy; 137uy; 13uy; 191uy; 230uy; 66uy; 104uy; 65uy; 153uy; 45uy; 15uy; 176uy; 84uy; 187uy; + 22uy + ] + in + FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 256); + Rust_primitives.Hax.array_of_list 256 list + +let index_u32 (s: u128) (i: usize) : u32 = + cast ((s >>! (i *! sz 32 <: usize) <: u128) %! (pub_u128 1 <>! (i *! sz 8 <: usize) <: u32) %! (1ul <>! + (sz 32 *! (cast ((o >>! (sz 2 *! i <: usize) <: u8) %! 4uy <: u8) <: usize) <: usize) + <: + u128) + (sz 0) + +let vpshufd (s: u128) (o: u8) : u128 = + let (d1: u32):u32 = vpshufd1 s o (sz 0) in + let (d2: u32):u32 = vpshufd1 s o (sz 1) in + let (d3: u32):u32 = vpshufd1 s o (sz 2) in + let (d4: u32):u32 = vpshufd1 s o (sz 3) in + rebuild_u128 d1 d2 d3 d4 + +let vshufps (s1 s2: u128) (o: u8) : u128 = + let (d1: u32):u32 = vpshufd1 s1 o (sz 0) in + let (d2: u32):u32 = vpshufd1 s1 o (sz 1) in + let (d3: u32):u32 = vpshufd1 s2 o (sz 2) in + let (d4: u32):u32 = vpshufd1 s2 o (sz 3) in + rebuild_u128 d1 d2 d3 d4 + +let key_combine (rkey temp1 temp2: u128) : (u128 & u128) = + let temp1:u128 = vpshufd temp1 255uy in + let temp2:u128 = vshufps temp2 rkey 16uy in + let rkey:u128 = rkey ^. temp2 in + let temp2:u128 = vshufps temp2 rkey 140uy in + let rkey:u128 = rkey ^. temp2 in + let rkey:u128 = rkey ^. temp1 in + rkey, temp2 <: (u128 & u128) + +let key_expand (rcon: u8) (rkey temp2: u128) : (u128 & u128) = + let temp1:u128 = aeskeygenassist rkey rcon in + key_combine rkey temp1 temp2 + +let xtime (x: u8) : u8 = + let x1:u8 = x <>! 7l in + let x71:u8 = x7 &. 1uy in + let x711b:u8 = x71 *! 27uy in + x1 ^. x711b + +let mixcolumn (c: usize) (state: u128) : u32 = + let s0:u8 = matrix_index state (sz 0) c in + let s1:u8 = matrix_index state (sz 1) c in + let s2:u8 = matrix_index state (sz 2) c in + let s3:u8 = matrix_index state (sz 3) c in + let tmp:u8 = ((s0 ^. s1 <: u8) ^. s2 <: u8) ^. s3 in + let r0:u8 = (s0 ^. tmp <: u8) ^. (xtime (s0 ^. s1 <: u8) <: u8) in + let r1:u8 = (s1 ^. tmp <: u8) ^. (xtime (s1 ^. s2 <: u8) <: u8) in + let r2:u8 = (s2 ^. tmp <: u8) ^. (xtime (s2 ^. s3 <: u8) <: u8) in + let r3:u8 = (s3 ^. tmp <: u8) ^. (xtime (s3 ^. s0 <: u8) <: u8) in + rebuild_u32 r0 r1 r2 r3 + +let mixcolumns (state: u128) : u128 = + let c0:u32 = mixcolumn (sz 0) state in + let c1:u32 = mixcolumn (sz 1) state in + let c2:u32 = mixcolumn (sz 2) state in + let c3:u32 = mixcolumn (sz 3) state in + rebuild_u128 c0 c1 c2 c3 + +let aesenc (state rkey: u128) : u128 = + let state:u128 = shiftrows state in + let state:u128 = subbytes state in + let state:u128 = mixcolumns state in + state ^. rkey + +let aes_rounds (rkeys: t_Array u128 (sz 12)) (inp: u128) : u128 = + let (state: u128):u128 = inp ^. (rkeys.[ sz 0 ] <: u128) in + let state:u128 = + Rust_primitives.Hax.Folds.fold_range (sz 1) + (sz 10) + (fun state temp_1_ -> + let state:u128 = state in + let _:usize = temp_1_ in + true) + state + (fun state round -> + let state:u128 = state in + let round:usize = round in + aesenc state (rkeys.[ round ] <: u128) <: u128) + in + aesenclast state (rkeys.[ sz 10 ] <: u128) + +let keys_expand (key: u128) : t_Array u128 (sz 12) = + let (rkeys: t_Array u128 (sz 12)):t_Array u128 (sz 12) = + Rust_primitives.Hax.repeat (pub_u128 0) (sz 12) + in + let key:u128 = key in + let rkeys:t_Array u128 (sz 12) = + Rust_primitives.Hax.Monomorphized_update_at.update_at_usize rkeys (sz 0) key + in + let (temp2: u128):u128 = pub_u128 0 in + let key, rkeys, temp2:(u128 & t_Array u128 (sz 12) & u128) = + Rust_primitives.Hax.Folds.fold_range (sz 1) + (sz 11) + (fun temp_0_ temp_1_ -> + let key, rkeys, temp2:(u128 & t_Array u128 (sz 12) & u128) = temp_0_ in + let _:usize = temp_1_ in + true) + (key, rkeys, temp2 <: (u128 & t_Array u128 (sz 12) & u128)) + (fun temp_0_ round -> + let key, rkeys, temp2:(u128 & t_Array u128 (sz 12) & u128) = temp_0_ in + let round:usize = round in + let rcon:u8 = v_RCON.[ round ] in + let key_temp, temp2_temp:(u128 & u128) = key_expand rcon key temp2 in + let key:u128 = key_temp in + let temp2:u128 = temp2_temp in + let rkeys:t_Array u128 (sz 12) = + Rust_primitives.Hax.Monomorphized_update_at.update_at_usize rkeys round key + in + key, rkeys, temp2 <: (u128 & t_Array u128 (sz 12) & u128)) + in + rkeys + +let aes (key inp: u128) : u128 = + let rkeys:t_Array u128 (sz 12) = keys_expand key in + aes_rounds rkeys inp diff --git a/aes_jazz/proofs/fstar/extraction/Hax_base.Int.BaseImpl.fst b/aes_jazz/proofs/fstar/extraction/Hax_base.Int.BaseImpl.fst new file mode 100644 index 0000000..ae848f1 --- /dev/null +++ b/aes_jazz/proofs/fstar/extraction/Hax_base.Int.BaseImpl.fst @@ -0,0 +1,471 @@ +module Hax_base.Int.BaseImpl +#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" +// open Core +open FStar.Mul + +let impl__double (self: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = + match Hax_base.Int.BaseSpec.impl_1__match_pos self with + | Hax_base.Int.POS_ZERO -> Hax_base.Int.BaseSpec.impl_2__ZERO + | Hax_base.Int.POS_POS p -> Hax_base.Int.BaseSpec.impl_1__xO p + +let impl__double_mask (self: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = + match Hax_base.Int.BaseSpec.impl_1__match_pos self with + | Hax_base.Int.POS_ZERO -> Hax_base.Int.BaseSpec.impl_2__ZERO + | Hax_base.Int.POS_POS p -> Hax_base.Int.BaseSpec.impl_1__xO p + +let impl__succ_double (self: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = + match Hax_base.Int.BaseSpec.impl_1__match_pos self with + | Hax_base.Int.POS_ZERO -> Hax_base.Int.BaseSpec.impl_1__xH + | Hax_base.Int.POS_POS p -> Hax_base.Int.BaseSpec.impl_1__xI p + +let impl__succ_double_mask (self: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = + match Hax_base.Int.BaseSpec.impl_1__match_pos self with + | Hax_base.Int.POS_ZERO -> Hax_base.Int.BaseSpec.impl_1__xH + | Hax_base.Int.POS_POS p -> Hax_base.Int.BaseSpec.impl_1__xI p + +let impl__half (self: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = + match Hax_base.Int.BaseSpec.impl_1__match_pos self with + | Hax_base.Int.POS_ZERO -> Hax_base.Int.BaseSpec.impl_2__ZERO + | Hax_base.Int.POS_POS n -> + match Hax_base.Int.BaseSpec.impl_1__match_positive n with + | Hax_base.Int.POSITIVE_XH -> Hax_base.Int.BaseSpec.impl_2__ZERO + | Hax_base.Int.POSITIVE_XO p -> p + | Hax_base.Int.POSITIVE_XI p -> p + +let rec impl__add_binary (self rhs: Hax_base.Int.t_HaxInt) + : Prims.Pure Hax_base.Int.t_HaxInt + (requires + not (Hax_base.Int.BaseSpec.impl_2__is_zero self <: bool) && + not (Hax_base.Int.BaseSpec.impl_2__is_zero rhs <: bool)) + (fun _ -> Prims.l_True) = + match Hax_base.Int.BaseSpec.impl_1__match_positive self with + | Hax_base.Int.POSITIVE_XH -> + (match Hax_base.Int.BaseSpec.impl_1__match_positive rhs with + | Hax_base.Int.POSITIVE_XH -> + Hax_base.Int.BaseSpec.impl_1__xO Hax_base.Int.BaseSpec.impl_1__xH + | Hax_base.Int.POSITIVE_XO q -> Hax_base.Int.BaseSpec.impl_1__xI q + | Hax_base.Int.POSITIVE_XI q -> + Hax_base.Int.BaseSpec.impl_1__xO (Hax_base.Int.BaseSpec.impl_2__succ q + <: + Hax_base.Int.t_HaxInt)) + | Hax_base.Int.POSITIVE_XO p -> + (match Hax_base.Int.BaseSpec.impl_1__match_positive rhs with + | Hax_base.Int.POSITIVE_XH -> Hax_base.Int.BaseSpec.impl_1__xI p + | Hax_base.Int.POSITIVE_XO q -> + Hax_base.Int.BaseSpec.impl_1__xO (impl__add_binary p q <: Hax_base.Int.t_HaxInt) + | Hax_base.Int.POSITIVE_XI q -> + Hax_base.Int.BaseSpec.impl_1__xI (impl__add_binary p q <: Hax_base.Int.t_HaxInt)) + | Hax_base.Int.POSITIVE_XI p -> + match Hax_base.Int.BaseSpec.impl_1__match_positive rhs with + | Hax_base.Int.POSITIVE_XH -> + Hax_base.Int.BaseSpec.impl_1__xO (Hax_base.Int.BaseSpec.impl_2__succ p + <: + Hax_base.Int.t_HaxInt) + | Hax_base.Int.POSITIVE_XO q -> + Hax_base.Int.BaseSpec.impl_1__xI (impl__add_binary p q <: Hax_base.Int.t_HaxInt) + | Hax_base.Int.POSITIVE_XI q -> + Hax_base.Int.BaseSpec.impl_1__xO (impl__add_carry p q <: Hax_base.Int.t_HaxInt) + +and impl__add_carry (self rhs: Hax_base.Int.t_HaxInt) + : Prims.Pure Hax_base.Int.t_HaxInt + (requires + not (Hax_base.Int.BaseSpec.impl_2__is_zero self <: bool) && + not (Hax_base.Int.BaseSpec.impl_2__is_zero rhs <: bool)) + (fun _ -> Prims.l_True) = + match Hax_base.Int.BaseSpec.impl_1__match_positive self with + | Hax_base.Int.POSITIVE_XH -> + (match Hax_base.Int.BaseSpec.impl_1__match_positive rhs with + | Hax_base.Int.POSITIVE_XH -> + Hax_base.Int.BaseSpec.impl_1__xI Hax_base.Int.BaseSpec.impl_1__xH + | Hax_base.Int.POSITIVE_XO q -> + Hax_base.Int.BaseSpec.impl_1__xO (Hax_base.Int.BaseSpec.impl_2__succ q + <: + Hax_base.Int.t_HaxInt) + | Hax_base.Int.POSITIVE_XI q -> + Hax_base.Int.BaseSpec.impl_1__xI (Hax_base.Int.BaseSpec.impl_2__succ q + <: + Hax_base.Int.t_HaxInt)) + | Hax_base.Int.POSITIVE_XO p -> + (match Hax_base.Int.BaseSpec.impl_1__match_positive rhs with + | Hax_base.Int.POSITIVE_XH -> + Hax_base.Int.BaseSpec.impl_1__xO (Hax_base.Int.BaseSpec.impl_2__succ p + <: + Hax_base.Int.t_HaxInt) + | Hax_base.Int.POSITIVE_XO q -> + Hax_base.Int.BaseSpec.impl_1__xI (impl__add_binary p q <: Hax_base.Int.t_HaxInt) + | Hax_base.Int.POSITIVE_XI q -> + Hax_base.Int.BaseSpec.impl_1__xO (impl__add_carry p q <: Hax_base.Int.t_HaxInt)) + | Hax_base.Int.POSITIVE_XI p -> + match Hax_base.Int.BaseSpec.impl_1__match_positive rhs with + | Hax_base.Int.POSITIVE_XH -> + Hax_base.Int.BaseSpec.impl_1__xI (Hax_base.Int.BaseSpec.impl_2__succ p + <: + Hax_base.Int.t_HaxInt) + | Hax_base.Int.POSITIVE_XO q -> + Hax_base.Int.BaseSpec.impl_1__xO (impl__add_carry p q <: Hax_base.Int.t_HaxInt) + | Hax_base.Int.POSITIVE_XI q -> + Hax_base.Int.BaseSpec.impl_1__xI (impl__add_carry p q <: Hax_base.Int.t_HaxInt) + +let impl__add (self rhs: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = + match Hax_base.Int.BaseSpec.impl_1__match_pos self with + | Hax_base.Int.POS_ZERO -> rhs + | Hax_base.Int.POS_POS p -> + match Hax_base.Int.BaseSpec.impl_1__match_pos rhs with + | Hax_base.Int.POS_ZERO -> p + | Hax_base.Int.POS_POS q -> impl__add_binary p q + +let rec impl__add_unary (self rhs: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = + match + Hax_base.Int.BaseSpec.impl_2__match_unary (Hax_base.Int.BaseSpec.impl__clone self + <: + Hax_base.Int.t_HaxInt) + with + | Hax_base.Int.UNARY_ZERO -> + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc self in + Hax_base.Int.BaseSpec.impl_2__ZERO + | Hax_base.Int.UNARY_SUCC x -> + impl__add_unary x (Hax_base.Int.BaseSpec.impl_2__succ rhs <: Hax_base.Int.t_HaxInt) + +let rec impl__cmp_binary_cont (x y: Hax_base.Int.t_HaxInt) (r: Hax_base.Int.t_CMP) + : Prims.Pure Hax_base.Int.t_CMP + (requires + not (Hax_base.Int.BaseSpec.impl_2__is_zero x <: bool) && + not (Hax_base.Int.BaseSpec.impl_2__is_zero y <: bool)) + (fun _ -> Prims.l_True) = + match Hax_base.Int.BaseSpec.impl_1__match_positive x with + | Hax_base.Int.POSITIVE_XH -> + (match Hax_base.Int.BaseSpec.impl_1__match_positive y with + | Hax_base.Int.POSITIVE_XH -> r + | Hax_base.Int.POSITIVE_XO q + | Hax_base.Int.POSITIVE_XI q -> + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc q in + Hax_base.Int.CMP_LESS <: Hax_base.Int.t_CMP) + | Hax_base.Int.POSITIVE_XO p -> + (match Hax_base.Int.BaseSpec.impl_1__match_positive y with + | Hax_base.Int.POSITIVE_XH -> + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc p in + Hax_base.Int.CMP_GREATER <: Hax_base.Int.t_CMP + | Hax_base.Int.POSITIVE_XO q -> impl__cmp_binary_cont p q r + | Hax_base.Int.POSITIVE_XI q -> + impl__cmp_binary_cont p q (Hax_base.Int.CMP_LESS <: Hax_base.Int.t_CMP)) + | Hax_base.Int.POSITIVE_XI p -> + match Hax_base.Int.BaseSpec.impl_1__match_positive y with + | Hax_base.Int.POSITIVE_XH -> + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc p in + Hax_base.Int.CMP_GREATER <: Hax_base.Int.t_CMP + | Hax_base.Int.POSITIVE_XO q -> + impl__cmp_binary_cont p q (Hax_base.Int.CMP_GREATER <: Hax_base.Int.t_CMP) + | Hax_base.Int.POSITIVE_XI q -> impl__cmp_binary_cont p q r + +let impl__cmp_binary (self rhs: Hax_base.Int.t_HaxInt) + : Prims.Pure Hax_base.Int.t_CMP + (requires + not (Hax_base.Int.BaseSpec.impl_2__is_zero self <: bool) && + not (Hax_base.Int.BaseSpec.impl_2__is_zero rhs <: bool)) + (fun _ -> Prims.l_True) = + impl__cmp_binary_cont self rhs (Hax_base.Int.CMP_EQ <: Hax_base.Int.t_CMP) + +let impl__cmp (self rhs: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_CMP = + match Hax_base.Int.BaseSpec.impl_1__match_pos self with + | Hax_base.Int.POS_ZERO -> + (match Hax_base.Int.BaseSpec.impl_1__match_pos rhs with + | Hax_base.Int.POS_ZERO -> Hax_base.Int.CMP_EQ <: Hax_base.Int.t_CMP + | Hax_base.Int.POS_POS q -> + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc q in + Hax_base.Int.CMP_LESS <: Hax_base.Int.t_CMP) + | Hax_base.Int.POS_POS p -> + match Hax_base.Int.BaseSpec.impl_1__match_pos rhs with + | Hax_base.Int.POS_ZERO -> + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc p in + Hax_base.Int.CMP_GREATER <: Hax_base.Int.t_CMP + | Hax_base.Int.POS_POS q -> impl__cmp_binary p q + +let impl__cmp_unary (self rhs: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_CMP = + if + Hax_base.Int.BaseSpec.impl_2__is_zero (Hax_base.Int.BaseSpec.impl__clone self + <: + Hax_base.Int.t_HaxInt) || + Hax_base.Int.BaseSpec.impl_2__is_zero (Hax_base.Int.BaseSpec.impl__clone rhs + <: + Hax_base.Int.t_HaxInt) + then + if + Hax_base.Int.BaseSpec.impl_2__is_zero (Hax_base.Int.BaseSpec.impl__clone self + <: + Hax_base.Int.t_HaxInt) && + Hax_base.Int.BaseSpec.impl_2__is_zero (Hax_base.Int.BaseSpec.impl__clone rhs + <: + Hax_base.Int.t_HaxInt) + then + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc self in + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc rhs in + Hax_base.Int.CMP_EQ <: Hax_base.Int.t_CMP + else + if Hax_base.Int.BaseSpec.impl_2__is_zero self + then + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc rhs in + Hax_base.Int.CMP_LESS <: Hax_base.Int.t_CMP + else + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc rhs in + Hax_base.Int.CMP_GREATER <: Hax_base.Int.t_CMP + else + impl__cmp (Hax_base.Int.BaseSpec.impl_2__pred self <: Hax_base.Int.t_HaxInt) + (Hax_base.Int.BaseSpec.impl_2__pred rhs <: Hax_base.Int.t_HaxInt) + +let rec impl__divmod_unary (x y q u: Hax_base.Int.t_HaxInt) + : (Hax_base.Int.t_HaxInt & Hax_base.Int.t_HaxInt) = + if + Hax_base.Int.BaseSpec.impl_2__is_zero (Hax_base.Int.BaseSpec.impl__clone x + <: + Hax_base.Int.t_HaxInt) + then + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc x in + q, u <: (Hax_base.Int.t_HaxInt & Hax_base.Int.t_HaxInt) + else + if + Hax_base.Int.BaseSpec.impl_2__is_zero (Hax_base.Int.BaseSpec.impl__clone u + <: + Hax_base.Int.t_HaxInt) + then + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc u in + impl__divmod_unary (Hax_base.Int.BaseSpec.impl_2__pred x <: Hax_base.Int.t_HaxInt) + (Hax_base.Int.BaseSpec.impl__clone y <: Hax_base.Int.t_HaxInt) + (Hax_base.Int.BaseSpec.impl_2__succ q <: Hax_base.Int.t_HaxInt) + y + else + impl__divmod_unary (Hax_base.Int.BaseSpec.impl_2__pred x <: Hax_base.Int.t_HaxInt) + y + (Hax_base.Int.BaseSpec.impl_2__succ q <: Hax_base.Int.t_HaxInt) + (Hax_base.Int.BaseSpec.impl_2__pred u <: Hax_base.Int.t_HaxInt) + +let impl__eq (self rhs: Hax_base.Int.t_HaxInt) : bool = + Hax_base.Int.impl__CMP__eq (impl__cmp self rhs <: Hax_base.Int.t_CMP) + (Hax_base.Int.CMP_EQ <: Hax_base.Int.t_CMP) + +let impl__gt (self rhs: Hax_base.Int.t_HaxInt) : bool = + Hax_base.Int.impl__CMP__eq (impl__cmp self rhs <: Hax_base.Int.t_CMP) + (Hax_base.Int.CMP_GREATER <: Hax_base.Int.t_CMP) + +let impl__le (self rhs: Hax_base.Int.t_HaxInt) : bool = not (impl__gt self rhs <: bool) + +let impl__lt (self rhs: Hax_base.Int.t_HaxInt) : bool = + Hax_base.Int.impl__CMP__eq (impl__cmp self rhs <: Hax_base.Int.t_CMP) + (Hax_base.Int.CMP_LESS <: Hax_base.Int.t_CMP) + +let impl__ge (self rhs: Hax_base.Int.t_HaxInt) : bool = not (impl__lt self rhs <: bool) + +let rec impl__power_of_two (self: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = + match Hax_base.Int.BaseSpec.impl_2__match_unary self with + | Hax_base.Int.UNARY_ZERO -> Hax_base.Int.BaseSpec.impl_1__xH + | Hax_base.Int.UNARY_SUCC x -> + Hax_base.Int.BaseSpec.impl_1__xO (impl__power_of_two x <: Hax_base.Int.t_HaxInt) + +let rec impl__pred_double (self: Hax_base.Int.t_HaxInt) + : Prims.Pure Hax_base.Int.t_HaxInt + (requires not (Hax_base.Int.BaseSpec.impl_2__is_zero self <: bool)) + (fun _ -> Prims.l_True) = + match Hax_base.Int.BaseSpec.impl_1__match_positive self with + | Hax_base.Int.POSITIVE_XH -> Hax_base.Int.BaseSpec.impl_1__xH + | Hax_base.Int.POSITIVE_XO p -> + Hax_base.Int.BaseSpec.impl_1__xI (impl__pred_double p <: Hax_base.Int.t_HaxInt) + | Hax_base.Int.POSITIVE_XI p -> + Hax_base.Int.BaseSpec.impl_1__xI (Hax_base.Int.BaseSpec.impl_1__xO p <: Hax_base.Int.t_HaxInt) + +let impl__double_pred_mask (self: Hax_base.Int.t_HaxInt) + : Prims.Pure Hax_base.Int.t_HaxInt + (requires not (Hax_base.Int.BaseSpec.impl_2__is_zero self <: bool)) + (fun _ -> Prims.l_True) = + match Hax_base.Int.BaseSpec.impl_1__match_positive self with + | Hax_base.Int.POSITIVE_XH -> Hax_base.Int.BaseSpec.impl_2__ZERO + | Hax_base.Int.POSITIVE_XO p -> + Hax_base.Int.BaseSpec.impl_1__xO (impl__pred_double p <: Hax_base.Int.t_HaxInt) + | Hax_base.Int.POSITIVE_XI p -> + Hax_base.Int.BaseSpec.impl_1__xO (Hax_base.Int.BaseSpec.impl_1__xO p <: Hax_base.Int.t_HaxInt) + +let rec impl__shl_helper (rhs lhs: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = + if + Hax_base.Int.BaseSpec.impl_2__is_zero (Hax_base.Int.BaseSpec.impl__clone lhs + <: + Hax_base.Int.t_HaxInt) || + Hax_base.Int.BaseSpec.impl_2__is_zero (Hax_base.Int.BaseSpec.impl__clone rhs + <: + Hax_base.Int.t_HaxInt) + then + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc rhs in + lhs + else + impl__shl_helper (Hax_base.Int.BaseSpec.impl_2__pred rhs <: Hax_base.Int.t_HaxInt) + (impl__double lhs <: Hax_base.Int.t_HaxInt) + +let impl__shl (self rhs: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = impl__shl_helper rhs self + +let rec impl__shr_helper (rhs lhs: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = + if + Hax_base.Int.BaseSpec.impl_2__is_zero (Hax_base.Int.BaseSpec.impl__clone lhs + <: + Hax_base.Int.t_HaxInt) || + Hax_base.Int.BaseSpec.impl_2__is_zero (Hax_base.Int.BaseSpec.impl__clone rhs + <: + Hax_base.Int.t_HaxInt) + then + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc rhs in + lhs + else + impl__shr_helper (Hax_base.Int.BaseSpec.impl_2__pred rhs <: Hax_base.Int.t_HaxInt) + (impl__half lhs <: Hax_base.Int.t_HaxInt) + +let impl__shr (self rhs: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = impl__shr_helper rhs self + +let rec impl__sub_unary (self rhs: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = + match Hax_base.Int.BaseSpec.impl_2__match_unary self with + | Hax_base.Int.UNARY_ZERO -> Hax_base.Int.BaseSpec.impl_2__ZERO + | Hax_base.Int.UNARY_SUCC n -> + match Hax_base.Int.BaseSpec.impl_2__match_unary rhs with + | Hax_base.Int.UNARY_ZERO -> Hax_base.Int.BaseSpec.impl_2__succ n + | Hax_base.Int.UNARY_SUCC m -> impl__sub_unary n m + +let rec impl__mul_binary (self rhs: Hax_base.Int.t_HaxInt) + : Prims.Pure Hax_base.Int.t_HaxInt + (requires + not (Hax_base.Int.BaseSpec.impl_2__is_zero self <: bool) && + not (Hax_base.Int.BaseSpec.impl_2__is_zero rhs <: bool)) + (fun _ -> Prims.l_True) = + match Hax_base.Int.BaseSpec.impl_1__match_positive self with + | Hax_base.Int.POSITIVE_XH -> rhs + | Hax_base.Int.POSITIVE_XO p -> + Hax_base.Int.BaseSpec.impl_1__xO (impl__mul_binary p rhs <: Hax_base.Int.t_HaxInt) + | Hax_base.Int.POSITIVE_XI p -> + impl__add (Hax_base.Int.BaseSpec.impl__clone rhs <: Hax_base.Int.t_HaxInt) + (Hax_base.Int.BaseSpec.impl_1__xO (impl__mul_binary p rhs <: Hax_base.Int.t_HaxInt) + <: + Hax_base.Int.t_HaxInt) + +let impl__mul (self rhs: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = + match Hax_base.Int.BaseSpec.impl_1__match_pos self with + | Hax_base.Int.POS_ZERO -> Hax_base.Int.BaseSpec.impl_2__ZERO + | Hax_base.Int.POS_POS p -> + match Hax_base.Int.BaseSpec.impl_1__match_pos rhs with + | Hax_base.Int.POS_ZERO -> Hax_base.Int.BaseSpec.impl_2__ZERO + | Hax_base.Int.POS_POS q -> impl__mul_binary p q + +let rec impl__sub_binary (self rhs: Hax_base.Int.t_HaxInt) + : Prims.Pure Hax_base.Int.t_HaxInt + (requires + not (Hax_base.Int.BaseSpec.impl_2__is_zero self <: bool) && + not (Hax_base.Int.BaseSpec.impl_2__is_zero rhs <: bool)) + (fun _ -> Prims.l_True) = + match Hax_base.Int.BaseSpec.impl_1__match_positive self with + | Hax_base.Int.POSITIVE_XH -> Hax_base.Int.BaseSpec.impl_2__ZERO + | Hax_base.Int.POSITIVE_XO p -> + (match Hax_base.Int.BaseSpec.impl_1__match_positive rhs with + | Hax_base.Int.POSITIVE_XH -> impl__pred_double p + | Hax_base.Int.POSITIVE_XO q -> + impl__double_mask (impl__sub_binary p q <: Hax_base.Int.t_HaxInt) + | Hax_base.Int.POSITIVE_XI q -> + impl__succ_double_mask (impl__sub_carry p q <: Hax_base.Int.t_HaxInt)) + | Hax_base.Int.POSITIVE_XI p -> + match Hax_base.Int.BaseSpec.impl_1__match_positive rhs with + | Hax_base.Int.POSITIVE_XH -> Hax_base.Int.BaseSpec.impl_1__xO p + | Hax_base.Int.POSITIVE_XO q -> + impl__succ_double_mask (impl__sub_binary p q <: Hax_base.Int.t_HaxInt) + | Hax_base.Int.POSITIVE_XI q -> + impl__double_mask (impl__sub_binary p q <: Hax_base.Int.t_HaxInt) + +and impl__sub_carry (self rhs: Hax_base.Int.t_HaxInt) + : Prims.Pure Hax_base.Int.t_HaxInt + (requires + not (Hax_base.Int.BaseSpec.impl_2__is_zero self <: bool) && + not (Hax_base.Int.BaseSpec.impl_2__is_zero rhs <: bool)) + (fun _ -> Prims.l_True) = + match Hax_base.Int.BaseSpec.impl_1__match_positive self with + | Hax_base.Int.POSITIVE_XH -> Hax_base.Int.BaseSpec.impl_2__ZERO + | Hax_base.Int.POSITIVE_XO p -> + (match Hax_base.Int.BaseSpec.impl_1__match_positive rhs with + | Hax_base.Int.POSITIVE_XH -> impl__double_pred_mask p + | Hax_base.Int.POSITIVE_XO q -> + impl__succ_double_mask (impl__sub_carry p q <: Hax_base.Int.t_HaxInt) + | Hax_base.Int.POSITIVE_XI q -> + impl__double_mask (impl__sub_carry p q <: Hax_base.Int.t_HaxInt)) + | Hax_base.Int.POSITIVE_XI p -> + match Hax_base.Int.BaseSpec.impl_1__match_positive rhs with + | Hax_base.Int.POSITIVE_XH -> impl__pred_double p + | Hax_base.Int.POSITIVE_XO q -> + impl__double_mask (impl__sub_binary p q <: Hax_base.Int.t_HaxInt) + | Hax_base.Int.POSITIVE_XI q -> + impl__succ_double_mask (impl__sub_carry p q <: Hax_base.Int.t_HaxInt) + +let impl__sub (self rhs: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = + match Hax_base.Int.BaseSpec.impl_1__match_pos self with + | Hax_base.Int.POS_ZERO -> Hax_base.Int.BaseSpec.impl_2__ZERO + | Hax_base.Int.POS_POS p -> + match Hax_base.Int.BaseSpec.impl_1__match_pos rhs with + | Hax_base.Int.POS_ZERO -> p + | Hax_base.Int.POS_POS q -> impl__sub_binary p q + +let rec impl__divmod_binary (a b: Hax_base.Int.t_HaxInt) + : Prims.Pure (Hax_base.Int.t_HaxInt & Hax_base.Int.t_HaxInt) + (requires + not (Hax_base.Int.BaseSpec.impl_2__is_zero a <: bool) && + not (Hax_base.Int.BaseSpec.impl_2__is_zero b <: bool)) + (fun _ -> Prims.l_True) = + match Hax_base.Int.BaseSpec.impl_1__match_positive a with + | Hax_base.Int.POSITIVE_XH -> + (match Hax_base.Int.BaseSpec.impl_1__match_positive b with + | Hax_base.Int.POSITIVE_XH -> + Hax_base.Int.BaseSpec.impl_1__xH, Hax_base.Int.BaseSpec.impl_2__ZERO + <: + (Hax_base.Int.t_HaxInt & Hax_base.Int.t_HaxInt) + | Hax_base.Int.POSITIVE_XO q + | Hax_base.Int.POSITIVE_XI q -> + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc q in + Hax_base.Int.BaseSpec.impl_2__ZERO, Hax_base.Int.BaseSpec.impl_1__xH + <: + (Hax_base.Int.t_HaxInt & Hax_base.Int.t_HaxInt)) + | Hax_base.Int.POSITIVE_XO a___ -> + let q, r:(Hax_base.Int.t_HaxInt & Hax_base.Int.t_HaxInt) = + impl__divmod_binary a___ (Hax_base.Int.BaseSpec.impl__clone b <: Hax_base.Int.t_HaxInt) + in + let r___:Hax_base.Int.t_HaxInt = impl__double r in + if + impl__le (Hax_base.Int.BaseSpec.impl__clone b <: Hax_base.Int.t_HaxInt) + (Hax_base.Int.BaseSpec.impl__clone r___ <: Hax_base.Int.t_HaxInt) + then impl__succ_double q, impl__sub r___ b <: (Hax_base.Int.t_HaxInt & Hax_base.Int.t_HaxInt) + else + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc b in + impl__double q, r___ <: (Hax_base.Int.t_HaxInt & Hax_base.Int.t_HaxInt) + | Hax_base.Int.POSITIVE_XI a___ -> + let q, r:(Hax_base.Int.t_HaxInt & Hax_base.Int.t_HaxInt) = + impl__divmod_binary a___ (Hax_base.Int.BaseSpec.impl__clone b <: Hax_base.Int.t_HaxInt) + in + let r___:Hax_base.Int.t_HaxInt = impl__succ_double r in + if + impl__le (Hax_base.Int.BaseSpec.impl__clone b <: Hax_base.Int.t_HaxInt) + (Hax_base.Int.BaseSpec.impl__clone r___ <: Hax_base.Int.t_HaxInt) + then impl__succ_double q, impl__sub r___ b <: (Hax_base.Int.t_HaxInt & Hax_base.Int.t_HaxInt) + else + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc b in + impl__double q, r___ <: (Hax_base.Int.t_HaxInt & Hax_base.Int.t_HaxInt) + +let impl__divmod (a b: Hax_base.Int.t_HaxInt) : (Hax_base.Int.t_HaxInt & Hax_base.Int.t_HaxInt) = + if + Hax_base.Int.BaseSpec.impl_2__is_zero (Hax_base.Int.BaseSpec.impl__clone a + <: + Hax_base.Int.t_HaxInt) || + Hax_base.Int.BaseSpec.impl_2__is_zero (Hax_base.Int.BaseSpec.impl__clone b + <: + Hax_base.Int.t_HaxInt) + then + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc b in + Hax_base.Int.BaseSpec.impl_2__ZERO, a <: (Hax_base.Int.t_HaxInt & Hax_base.Int.t_HaxInt) + else impl__divmod_binary a b + +let impl__div (self rhs: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = + let q, r:(Hax_base.Int.t_HaxInt & Hax_base.Int.t_HaxInt) = impl__divmod self rhs in + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc r in + q + +let impl__rem (self rhs: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = + let q, r:(Hax_base.Int.t_HaxInt & Hax_base.Int.t_HaxInt) = impl__divmod self rhs in + let _:Prims.unit = Hax_base.Int.BaseSpec.impl__dealloc q in + r + diff --git a/aes_jazz/proofs/fstar/extraction/Hax_base.Int.BaseSpec.fst b/aes_jazz/proofs/fstar/extraction/Hax_base.Int.BaseSpec.fst new file mode 100644 index 0000000..a39e816 --- /dev/null +++ b/aes_jazz/proofs/fstar/extraction/Hax_base.Int.BaseSpec.fst @@ -0,0 +1,81 @@ +module Hax_base.Int.BaseSpec +#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" +// open Core +open FStar.Mul + +let impl__clone (self: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = self + +let impl__dealloc (self: Hax_base.Int.t_HaxInt) : Prims.unit = + () + +let impl_1__xH: Hax_base.Int.t_HaxInt = 1 + +let impl_1__xI (self: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = self * 2 + 1 + +let impl_1__xO (self: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = self * 2 + +let impl_2__ZERO: Hax_base.Int.t_HaxInt = 0 + +let impl__normalize (self: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = self + +let impl_1__div2 (self: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = self / 2 + +let impl_1__is_xH (self: Hax_base.Int.t_HaxInt) : bool = self = 1 + +let impl_1__is_xI (self: Hax_base.Int.t_HaxInt) : bool = self > 1 && self % 2 = 1 + +let impl_1__is_xO (self: Hax_base.Int.t_HaxInt) : bool = self > 1 && self % 2 = 0 + +let impl_2__is_zero (self: Hax_base.Int.t_HaxInt) : bool = self = 0 + +let impl_2__pred (self: Hax_base.Int.t_HaxInt) + : Prims.Pure Hax_base.Int.t_HaxInt + (requires not (impl_2__is_zero self <: bool)) + (fun _ -> Prims.l_True) = + self - 1 + +let impl_2__succ (self: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_HaxInt = self + 1 + +let v_WORDSIZE_128_: Hax_base.Int.t_HaxInt = pow2 128 + +let v_WORDSIZE_128_SUB_1_: Hax_base.Int.t_HaxInt = v_WORDSIZE_128_ - 1 + +let v_WORDSIZE_16_: Hax_base.Int.t_HaxInt = pow2 16 + +let v_WORDSIZE_16_SUB_1_: Hax_base.Int.t_HaxInt = v_WORDSIZE_16_ - 1 + +let v_WORDSIZE_32_: Hax_base.Int.t_HaxInt = pow2 32 + +let v_WORDSIZE_32_SUB_1_: Hax_base.Int.t_HaxInt = v_WORDSIZE_32_ - 1 + +let v_WORDSIZE_64_: Hax_base.Int.t_HaxInt = pow2 64 + +let v_WORDSIZE_64_SUB_1_: Hax_base.Int.t_HaxInt = v_WORDSIZE_64_ - 1 + +let v_WORDSIZE_8_: Hax_base.Int.t_HaxInt = pow2 8 + +let v_WORDSIZE_8_SUB_1_: Hax_base.Int.t_HaxInt = v_WORDSIZE_8_ - 1 + +let impl_1__match_pos (self: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_POS = + if impl_2__is_zero (impl__clone self <: Hax_base.Int.t_HaxInt) + then + let _:Prims.unit = impl__dealloc self in + Hax_base.Int.POS_ZERO <: Hax_base.Int.t_POS + else Hax_base.Int.POS_POS self <: Hax_base.Int.t_POS + +let impl_1__match_positive (self: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_POSITIVE = + if impl_1__is_xH (impl__clone self <: Hax_base.Int.t_HaxInt) + then + let _:Prims.unit = impl__dealloc self in + Hax_base.Int.POSITIVE_XH <: Hax_base.Int.t_POSITIVE + else + if impl_1__is_xO (impl__clone self <: Hax_base.Int.t_HaxInt) + then Hax_base.Int.POSITIVE_XO (impl_1__div2 self) <: Hax_base.Int.t_POSITIVE + else Hax_base.Int.POSITIVE_XI (impl_1__div2 self) <: Hax_base.Int.t_POSITIVE + +let impl_2__match_unary (self: Hax_base.Int.t_HaxInt) : Hax_base.Int.t_UNARY = + if impl_2__is_zero (impl__clone self <: Hax_base.Int.t_HaxInt) + then + let _:Prims.unit = impl__dealloc self in + Hax_base.Int.UNARY_ZERO <: Hax_base.Int.t_UNARY + else Hax_base.Int.UNARY_SUCC (impl_2__pred self) <: Hax_base.Int.t_UNARY diff --git a/aes_jazz/proofs/fstar/extraction/Hax_base.Int.fst b/aes_jazz/proofs/fstar/extraction/Hax_base.Int.fst new file mode 100644 index 0000000..d64b0e4 --- /dev/null +++ b/aes_jazz/proofs/fstar/extraction/Hax_base.Int.fst @@ -0,0 +1,47 @@ +module Hax_base.Int +#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" +// open Core +open FStar.Mul + +let discriminant_CMP_EQ = 0 + +let discriminant_CMP_GREATER = 1 + +type t_CMP = + | CMP_LESS : t_CMP + | CMP_EQ : t_CMP + | CMP_GREATER : t_CMP + +let impl__CMP__clone (self: t_CMP) : t_CMP = + match self with + | CMP_LESS -> CMP_LESS <: t_CMP + | CMP_EQ -> CMP_EQ <: t_CMP + | CMP_GREATER -> CMP_GREATER <: t_CMP + +let impl__CMP__eq (self rhs: t_CMP) : bool = + match self, rhs <: (t_CMP & t_CMP) with + | CMP_LESS , CMP_LESS | CMP_EQ , CMP_EQ | CMP_GREATER , CMP_GREATER -> true + | _ -> false + +let discriminant_CMP_LESS = (-1) + +let t_CMP_cast_to_repr (x: t_CMP) = + match x with + | CMP_LESS -> discriminant_CMP_LESS + | CMP_EQ -> discriminant_CMP_EQ + | CMP_GREATER -> discriminant_CMP_GREATER + +type t_HaxInt = Prims.nat + +type t_POS = + | POS_ZERO : t_POS + | POS_POS : t_HaxInt -> t_POS + +type t_POSITIVE = + | POSITIVE_XH : t_POSITIVE + | POSITIVE_XO : t_HaxInt -> t_POSITIVE + | POSITIVE_XI : t_HaxInt -> t_POSITIVE + +type t_UNARY = + | UNARY_ZERO : t_UNARY + | UNARY_SUCC : t_HaxInt -> t_UNARY diff --git a/aes_jazz/proofs/fstar/extraction/Hax_core.Coerce.fst b/aes_jazz/proofs/fstar/extraction/Hax_core.Coerce.fst new file mode 100644 index 0000000..ded11f0 --- /dev/null +++ b/aes_jazz/proofs/fstar/extraction/Hax_core.Coerce.fst @@ -0,0 +1,19 @@ +module Hax_core.Coerce +#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" +// open Core +open FStar.Mul + +class t_Abstraction (v_Self: Type0) = { + f_AbstractType:Type0; + f_lift_pre:v_Self -> Type0; + f_lift_post:v_Self -> f_AbstractType -> Type0; + f_lift:x0: v_Self + -> Prims.Pure f_AbstractType (f_lift_pre x0) (fun result -> f_lift_post x0 result) +} + +class t_Concretization (v_Self: Type0) (v_T: Type0) = { + f_concretize_pre:v_Self -> Type0; + f_concretize_post:v_Self -> v_T -> Type0; + f_concretize:x0: v_Self + -> Prims.Pure v_T (f_concretize_pre x0) (fun result -> f_concretize_post x0 result) +} diff --git a/aes_jazz/proofs/fstar/extraction/Hax_core.Int.fst b/aes_jazz/proofs/fstar/extraction/Hax_core.Int.fst new file mode 100644 index 0000000..209a18b --- /dev/null +++ b/aes_jazz/proofs/fstar/extraction/Hax_core.Int.fst @@ -0,0 +1,2877 @@ +module Hax_core.Int +#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" +// open Core +open FStar.Mul + +let _ = + (* This module has implicit dependencies, here we make them explicit. *) + (* The implicit dependencies arise from typeclasses instances. *) + let open Hax_base.Int in + () + +class t_Constants (v_Self: Type0) = { + f_ZERO:v_Self; + f_ONE:v_Self; + f_MIN:v_Self; + f_MAX:v_Self +} + +type t_U128 = { f_v:Hax_base.Int.t_HaxInt } + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl_108: t_Constants t_U128 = + { + f_ZERO = { f_v = Hax_base.Int.BaseSpec.impl_2__ZERO } <: t_U128; + f_ONE = { f_v = Hax_base.Int.BaseSpec.impl_1__xH } <: t_U128; + f_MIN = { f_v = Hax_base.Int.BaseSpec.impl_2__ZERO } <: t_U128; // f_ZERO; + f_MAX = { f_v = Hax_base.Int.BaseSpec.v_WORDSIZE_128_SUB_1_ } <: t_U128 + } + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl_110: Hax_core.Coerce.t_Concretization Hax_base.Int.t_HaxInt t_U128 = + { + f_concretize_pre = (fun (self: Hax_base.Int.t_HaxInt) -> true); + f_concretize_post = (fun (self: Hax_base.Int.t_HaxInt) (out: t_U128) -> true); + f_concretize + = + fun (self: Hax_base.Int.t_HaxInt) -> + { f_v = Hax_base.Int.BaseImpl.impl__rem self Hax_base.Int.BaseSpec.v_WORDSIZE_128_ } <: t_U128 + } + +let impl_111__checked_concretize (x: Hax_base.Int.t_HaxInt) : option // Core.Option.t_Option + t_U128 = + if + Hax_base.Int.BaseImpl.impl__lt (// Core.Clone.f_clone #Hax_base.Int.t_HaxInt + // #FStar.Tactics.Typeclasses.solve + x + <: + Hax_base.Int.t_HaxInt) + Hax_base.Int.BaseSpec.v_WORDSIZE_128_ + then // Core.Option.Option_Some + Some + ({ f_v = x } <: t_U128) <: // Core.Option.t_Option + option + t_U128 + else // Core.Option.Option_None + None + <: // Core.Option.t_Option + option t_U128 + +let impl_111__wrapping_concretize (x: Hax_base.Int.t_HaxInt) : t_U128 = + { f_v = Hax_base.Int.BaseImpl.impl__rem x Hax_base.Int.BaseSpec.v_WORDSIZE_128_ } <: t_U128 + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_115: // Core.Clone.t_Clone +// t_U128 = +// { +// f_clone_pre = (fun (self: t_U128) -> true); +// f_clone_post = (fun (self: t_U128) (out: t_U128) -> true); +// f_clone +// = +// fun (self: t_U128) -> +// { f_v = // +// self.f_v } +// <: +// t_U128 +// } + +type t_U16 = { f_v:Hax_base.Int.t_HaxInt } + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl_27: t_Constants t_U16 = + { + f_ZERO = { f_v = Hax_base.Int.BaseSpec.impl_2__ZERO } <: t_U16; + f_ONE = { f_v = Hax_base.Int.BaseSpec.impl_1__xH } <: t_U16; + f_MIN = { f_v = Hax_base.Int.BaseSpec.impl_2__ZERO } <: t_U16; // f_ZERO; + f_MAX = { f_v = Hax_base.Int.BaseSpec.v_WORDSIZE_16_SUB_1_ } <: t_U16 + } + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl_29: Hax_core.Coerce.t_Concretization Hax_base.Int.t_HaxInt t_U16 = + { + f_concretize_pre = (fun (self: Hax_base.Int.t_HaxInt) -> true); + f_concretize_post = (fun (self: Hax_base.Int.t_HaxInt) (out: t_U16) -> true); + f_concretize + = + fun (self: Hax_base.Int.t_HaxInt) -> + { f_v = Hax_base.Int.BaseImpl.impl__rem self Hax_base.Int.BaseSpec.v_WORDSIZE_16_ } <: t_U16 + } + +let impl_30__checked_concretize (x: Hax_base.Int.t_HaxInt) : // Core.Option.t_Option + option t_U16 = + if + Hax_base.Int.BaseImpl.impl__lt ( + // Core.Clone.f_clone #Hax_base.Int.t_HaxInt + // #FStar.Tactics.Typeclasses.solve + x + <: + Hax_base.Int.t_HaxInt) + Hax_base.Int.BaseSpec.v_WORDSIZE_16_ + then // Core.Option.Option_Some + Some ({ f_v = x } <: t_U16) <: // Core.Option.t_Option + option t_U16 + else // Core.Option.Option_None + None <: // Core.Option.t_Option + option t_U16 + +let impl_30__wrapping_concretize (x: Hax_base.Int.t_HaxInt) : t_U16 = + { f_v = Hax_base.Int.BaseImpl.impl__rem x Hax_base.Int.BaseSpec.v_WORDSIZE_16_ } <: t_U16 + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_34: Core.Clone.t_Clone t_U16 = +// { +// f_clone_pre = (fun (self: t_U16) -> true); +// f_clone_post = (fun (self: t_U16) (out: t_U16) -> true); +// f_clone +// = +// fun (self: t_U16) -> +// { f_v = self.f_v } +// <: +// t_U16 +// } + +type t_U32 = { f_v:Hax_base.Int.t_HaxInt } + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl_54: t_Constants t_U32 = + { + f_ZERO = { f_v = Hax_base.Int.BaseSpec.impl_2__ZERO } <: t_U32; + f_ONE = { f_v = Hax_base.Int.BaseSpec.impl_1__xH } <: t_U32; + f_MIN = { f_v = Hax_base.Int.BaseSpec.impl_2__ZERO } ; // f_ZERO; + f_MAX = { f_v = Hax_base.Int.BaseSpec.v_WORDSIZE_32_SUB_1_ } <: t_U32 + } + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl_56: Hax_core.Coerce.t_Concretization Hax_base.Int.t_HaxInt t_U32 = + { + f_concretize_pre = (fun (self: Hax_base.Int.t_HaxInt) -> true); + f_concretize_post = (fun (self: Hax_base.Int.t_HaxInt) (out: t_U32) -> true); + f_concretize + = + fun (self: Hax_base.Int.t_HaxInt) -> + { f_v = Hax_base.Int.BaseImpl.impl__rem self Hax_base.Int.BaseSpec.v_WORDSIZE_32_ } <: t_U32 + } + +let impl_57__checked_concretize (x: Hax_base.Int.t_HaxInt) : // Core.Option.t_Option + option t_U32 = + if + Hax_base.Int.BaseImpl.impl__lt ( + x + <: + Hax_base.Int.t_HaxInt) + Hax_base.Int.BaseSpec.v_WORDSIZE_32_ + then // Core.Option.Option_Some + Some ({ f_v = x } <: t_U32) <: // Core.Option.t_Option + option t_U32 + else // Core.Option.Option_None + None <: // Core.Option.t_Option + option t_U32 + +let impl_57__wrapping_concretize (x: Hax_base.Int.t_HaxInt) : t_U32 = + { f_v = Hax_base.Int.BaseImpl.impl__rem x Hax_base.Int.BaseSpec.v_WORDSIZE_32_ } <: t_U32 + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_61: t_U32 = +// { +// f_clone_pre = (fun (self: t_U32) -> true); +// f_clone_post = (fun (self: t_U32) (out: t_U32) -> true); +// f_clone +// = +// fun (self: t_U32) -> +// { f_v = self.f_v } +// <: +// t_U32 +// } + +type t_U64 = { f_v:Hax_base.Int.t_HaxInt } + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl_81: t_Constants t_U64 = + { + f_ZERO = { f_v = Hax_base.Int.BaseSpec.impl_2__ZERO } <: t_U64; + f_ONE = { f_v = Hax_base.Int.BaseSpec.impl_1__xH } <: t_U64; + f_MIN = { f_v = Hax_base.Int.BaseSpec.impl_2__ZERO }; // f_ZERO; + f_MAX = { f_v = Hax_base.Int.BaseSpec.v_WORDSIZE_64_SUB_1_ } <: t_U64 + } + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl_83: Hax_core.Coerce.t_Concretization Hax_base.Int.t_HaxInt t_U64 = + { + f_concretize_pre = (fun (self: Hax_base.Int.t_HaxInt) -> true); + f_concretize_post = (fun (self: Hax_base.Int.t_HaxInt) (out: t_U64) -> true); + f_concretize + = + fun (self: Hax_base.Int.t_HaxInt) -> + { f_v = Hax_base.Int.BaseImpl.impl__rem self Hax_base.Int.BaseSpec.v_WORDSIZE_64_ } <: t_U64 + } + +let impl_84__checked_concretize (x: Hax_base.Int.t_HaxInt) : // Core.Option.t_Option + option t_U64 = + if + Hax_base.Int.BaseImpl.impl__lt ( + x + <: + Hax_base.Int.t_HaxInt) + Hax_base.Int.BaseSpec.v_WORDSIZE_64_ + then // Core.Option.Option_Some + Some ({ f_v + = x } <: t_U64) <: // Core.Option.t_Option + option t_U64 + else // Core.Option.Option_None + None <: // Core.Option.t_Option + option t_U64 + +let impl_84__wrapping_concretize (x: Hax_base.Int.t_HaxInt) : t_U64 = + { f_v = Hax_base.Int.BaseImpl.impl__rem x Hax_base.Int.BaseSpec.v_WORDSIZE_64_ } <: t_U64 + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_88: t_U64 = +// { +// f_clone_pre = (fun (self: t_U64) -> true); +// f_clone_post = (fun (self: t_U64) (out: t_U64) -> true); +// f_clone +// = +// fun (self: t_U64) -> +// { f_v = self.f_v } +// <: +// t_U64 +// } + +type t_U8 = { f_v:Hax_base.Int.t_HaxInt } + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl: t_Constants t_U8 = + { + f_ZERO = { f_v = Hax_base.Int.BaseSpec.impl_2__ZERO } <: t_U8; + f_ONE = { f_v = Hax_base.Int.BaseSpec.impl_1__xH } <: t_U8; + f_MIN = { f_v = Hax_base.Int.BaseSpec.impl_2__ZERO }; + f_MAX = { f_v = Hax_base.Int.BaseSpec.v_WORDSIZE_8_SUB_1_ } <: t_U8 + } + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl_2: Hax_core.Coerce.t_Concretization Hax_base.Int.t_HaxInt t_U8 = + { + f_concretize_pre = (fun (self: Hax_base.Int.t_HaxInt) -> true); + f_concretize_post = (fun (self: Hax_base.Int.t_HaxInt) (out: t_U8) -> true); + f_concretize + = + fun (self: Hax_base.Int.t_HaxInt) -> + { f_v = Hax_base.Int.BaseImpl.impl__rem self Hax_base.Int.BaseSpec.v_WORDSIZE_8_ } <: t_U8 + } + +let impl_3__checked_concretize (x: Hax_base.Int.t_HaxInt) : // Core.Option.t_Option + option t_U8 = + if + Hax_base.Int.BaseImpl.impl__lt ( + x + <: + Hax_base.Int.t_HaxInt) + Hax_base.Int.BaseSpec.v_WORDSIZE_8_ + then Some // Core.Option.Option_Some + ({ f_v + = x } <: t_U8) <: // Core.Option.t_Option + option t_U8 + else // Core.Option.Option_None + None <: // Core.Option.t_Option + option t_U8 + +let impl_3__wrapping_concretize (x: Hax_base.Int.t_HaxInt) : t_U8 = + { f_v = Hax_base.Int.BaseImpl.impl__rem x Hax_base.Int.BaseSpec.v_WORDSIZE_8_ } <: t_U8 + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_7: Core.Clone.t_Clone t_U8 = +// { +// f_clone_pre = (fun (self: t_U8) -> true); +// f_clone_post = (fun (self: t_U8) (out: t_U8) -> true); +// f_clone +// = +// fun (self: t_U8) -> +// { f_v = self.f_v } +// <: +// t_U8 +// } + +[@@ FStar.Tactics.Typeclasses.tcinstance] +let impl_1: Hax_core.Coerce.t_Abstraction t_U8 = + { + f_AbstractType = Hax_base.Int.t_HaxInt; + f_lift_pre = (fun (self: t_U8) -> true); + f_lift_post = (fun (self: t_U8) (out: Hax_base.Int.t_HaxInt) -> true); + f_lift = fun (self: t_U8) -> self.f_v + } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_8: Core.Cmp.t_PartialEq t_U8 t_U8 = +// { +// f_eq_pre = (fun (self: t_U8) (rhs: t_U8) -> true); +// f_eq_post = (fun (self: t_U8) (rhs: t_U8) (out: bool) -> true); +// f_eq +// = +// fun (self: t_U8) (rhs: t_U8) -> +// Hax_base.Int.BaseImpl.impl__eq (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (self <: t_U8) +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (rhs <: t_U8) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_9: Core.Cmp.t_PartialOrd t_U8 t_U8 = +// { +// _super_9014672428308350468 = FStar.Tactics.Typeclasses.solve; +// f_partial_cmp_pre = (fun (self: t_U8) (rhs: t_U8) -> true); +// f_partial_cmp_post +// = +// (fun (self: t_U8) (rhs: t_U8) (out: // Core.Option.t_Option +// option Core.Cmp.t_Ordering) -> true); +// f_partial_cmp +// = +// fun (self: t_U8) (rhs: t_U8) -> +// Core.Option.// Option_Some +// (match +// Hax +// Some _base.Int.BaseImpl.impl__cmp (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Core.Clone.f_clone #t_U8 #FStar.Tactics.Typeclasses.solve self <: t_U8) +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Core.Clone.f_clone #t_U8 #FStar.Tactics.Typeclasses.solve rhs <: t_U8) +// <: +// Hax_base.Int.t_HaxInt) +// with +// | Hax_base.Int.CMP_LESS -> Core.Cmp.Ordering_Less <: Core.Cmp.t_Ordering +// | Hax_base.Int.CMP_EQ -> Core.Cmp.Ordering_Equal <: Core.Cmp.t_Ordering +// | Hax_base.Int.CMP_GREATER -> Core.Cmp.Ordering_Greater <: Core.Cmp.t_Ordering) +// <: +// // Core.Option.t_Option +// option Core.Cmp.t_Ordering +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_28: Hax_core.Coerce.t_Abstraction t_U16 = +// { +// f_AbstractType = Hax_base.Int.t_HaxInt; +// f_lift_pre = (fun (self: t_U16) -> true); +// f_lift_post = (fun (self: t_U16) (out: Hax_base.Int.t_HaxInt) -> true); +// f_lift = fun (self: t_U16) -> self.f_v +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_35: Core.Cmp.t_PartialEq t_U16 t_U16 = +// { +// f_eq_pre = (fun (self: t_U16) (rhs: t_U16) -> true); +// f_eq_post = (fun (self: t_U16) (rhs: t_U16) (out: bool) -> true); +// f_eq +// = +// fun (self: t_U16) (rhs: t_U16) -> +// Hax_base.Int.BaseImpl.impl__eq (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Core.Clone.f_clone #t_U16 #FStar.Tactics.Typeclasses.solve self <: t_U16) +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Core.Clone.f_clone #t_U16 #FStar.Tactics.Typeclasses.solve rhs <: t_U16) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_36: Core.Cmp.t_PartialOrd t_U16 t_U16 = +// { +// _super_9014672428308350468 = FStar.Tactics.Typeclasses.solve; +// f_partial_cmp_pre = (fun (self: t_U16) (rhs: t_U16) -> true); +// f_partial_cmp_post +// = +// (fun (self: t_U16) (rhs: t_U16) (out: // Core.Option.t_Option +// option Core.Cmp.t_Ordering) -> true); +// f_partial_cmp +// = +// fun (self: t_U16) (rhs: t_U16) -> +// Core.Option.// Option_Some +// (match +// Hax +// Some _base.Int.BaseImpl.impl__cmp (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Core.Clone.f_clone #t_U16 #FStar.Tactics.Typeclasses.solve self <: t_U16) +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Core.Clone.f_clone #t_U16 #FStar.Tactics.Typeclasses.solve rhs <: t_U16) +// <: +// Hax_base.Int.t_HaxInt) +// with +// | Hax_base.Int.CMP_LESS -> Core.Cmp.Ordering_Less <: Core.Cmp.t_Ordering +// | Hax_base.Int.CMP_EQ -> Core.Cmp.Ordering_Equal <: Core.Cmp.t_Ordering +// | Hax_base.Int.CMP_GREATER -> Core.Cmp.Ordering_Greater <: Core.Cmp.t_Ordering) +// <: +// // Core.Option.t_Option +// option Core.Cmp.t_Ordering +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_55: Hax_core.Coerce.t_Abstraction t_U32 = +// { +// f_AbstractType = Hax_base.Int.t_HaxInt; +// f_lift_pre = (fun (self: t_U32) -> true); +// f_lift_post = (fun (self: t_U32) (out: Hax_base.Int.t_HaxInt) -> true); +// f_lift = fun (self: t_U32) -> self.f_v +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_62: Core.Cmp.t_PartialEq t_U32 t_U32 = +// { +// f_eq_pre = (fun (self: t_U32) (rhs: t_U32) -> true); +// f_eq_post = (fun (self: t_U32) (rhs: t_U32) (out: bool) -> true); +// f_eq +// = +// fun (self: t_U32) (rhs: t_U32) -> +// Hax_base.Int.BaseImpl.impl__eq (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Core.Clone.f_clone #t_U32 #FStar.Tactics.Typeclasses.solve self <: t_U32) +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Core.Clone.f_clone #t_U32 #FStar.Tactics.Typeclasses.solve rhs <: t_U32) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_63: Core.Cmp.t_PartialOrd t_U32 t_U32 = +// { +// _super_9014672428308350468 = FStar.Tactics.Typeclasses.solve; +// f_partial_cmp_pre = (fun (self: t_U32) (rhs: t_U32) -> true); +// f_partial_cmp_post +// = +// (fun (self: t_U32) (rhs: t_U32) (out: // Core.Option.t_Option +// option Core.Cmp.t_Ordering) -> true); +// f_partial_cmp +// = +// fun (self: t_U32) (rhs: t_U32) -> +// Core.Option.// Option_Some +// (match +// Hax +// Some _base.Int.BaseImpl.impl__cmp (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Core.Clone.f_clone #t_U32 #FStar.Tactics.Typeclasses.solve self <: t_U32) +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Core.Clone.f_clone #t_U32 #FStar.Tactics.Typeclasses.solve rhs <: t_U32) +// <: +// Hax_base.Int.t_HaxInt) +// with +// | Hax_base.Int.CMP_LESS -> Core.Cmp.Ordering_Less <: Core.Cmp.t_Ordering +// | Hax_base.Int.CMP_EQ -> Core.Cmp.Ordering_Equal <: Core.Cmp.t_Ordering +// | Hax_base.Int.CMP_GREATER -> Core.Cmp.Ordering_Greater <: Core.Cmp.t_Ordering) +// <: +// // Core.Option.t_Option +// option Core.Cmp.t_Ordering +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_82: Hax_core.Coerce.t_Abstraction t_U64 = +// { +// f_AbstractType = Hax_base.Int.t_HaxInt; +// f_lift_pre = (fun (self: t_U64) -> true); +// f_lift_post = (fun (self: t_U64) (out: Hax_base.Int.t_HaxInt) -> true); +// f_lift = fun (self: t_U64) -> self.f_v +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_89: Core.Cmp.t_PartialEq t_U64 t_U64 = +// { +// f_eq_pre = (fun (self: t_U64) (rhs: t_U64) -> true); +// f_eq_post = (fun (self: t_U64) (rhs: t_U64) (out: bool) -> true); +// f_eq +// = +// fun (self: t_U64) (rhs: t_U64) -> +// Hax_base.Int.BaseImpl.impl__eq (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Core.Clone.f_clone #t_U64 #FStar.Tactics.Typeclasses.solve self <: t_U64) +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Core.Clone.f_clone #t_U64 #FStar.Tactics.Typeclasses.solve rhs <: t_U64) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_90: Core.Cmp.t_PartialOrd t_U64 t_U64 = +// { +// _super_9014672428308350468 = FStar.Tactics.Typeclasses.solve; +// f_partial_cmp_pre = (fun (self: t_U64) (rhs: t_U64) -> true); +// f_partial_cmp_post +// = +// (fun (self: t_U64) (rhs: t_U64) (out: // Core.Option.t_Option +// option Core.Cmp.t_Ordering) -> true); +// f_partial_cmp +// = +// fun (self: t_U64) (rhs: t_U64) -> +// Core.Option.// Option_Some +// (match +// Hax +// Some _base.Int.BaseImpl.impl__cmp (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Core.Clone.f_clone #t_U64 #FStar.Tactics.Typeclasses.solve self <: t_U64) +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Core.Clone.f_clone #t_U64 #FStar.Tactics.Typeclasses.solve rhs <: t_U64) +// <: +// Hax_base.Int.t_HaxInt) +// with +// | Hax_base.Int.CMP_LESS -> Core.Cmp.Ordering_Less <: Core.Cmp.t_Ordering +// | Hax_base.Int.CMP_EQ -> Core.Cmp.Ordering_Equal <: Core.Cmp.t_Ordering +// | Hax_base.Int.CMP_GREATER -> Core.Cmp.Ordering_Greater <: Core.Cmp.t_Ordering) +// <: +// // Core.Option.t_Option +// option Core.Cmp.t_Ordering +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_109: Hax_core.Coerce.t_Abstraction t_U128 = +// { +// f_AbstractType = Hax_base.Int.t_HaxInt; +// f_lift_pre = (fun (self: t_U128) -> true); +// f_lift_post = (fun (self: t_U128) (out: Hax_base.Int.t_HaxInt) -> true); +// f_lift = fun (self: t_U128) -> self.f_v +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_116: Core.Cmp.t_PartialEq t_U128 t_U128 = +// { +// f_eq_pre = (fun (self: t_U128) (rhs: t_U128) -> true); +// f_eq_post = (fun (self: t_U128) (rhs: t_U128) (out: bool) -> true); +// f_eq +// = +// fun (self: t_U128) (rhs: t_U128) -> +// Hax_base.Int.BaseImpl.impl__eq (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Core.Clone.f_clone #t_U128 #FStar.Tactics.Typeclasses.solve self <: t_U128) +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Core.Clone.f_clone #t_U128 #FStar.Tactics.Typeclasses.solve rhs <: t_U128) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_117: Core.Cmp.t_PartialOrd t_U128 t_U128 = +// { +// _super_9014672428308350468 = FStar.Tactics.Typeclasses.solve; +// f_partial_cmp_pre = (fun (self: t_U128) (rhs: t_U128) -> true); +// f_partial_cmp_post +// = +// (fun (self: t_U128) (rhs: t_U128) (out: // Core.Option.t_Option +// option Core.Cmp.t_Ordering) -> true); +// f_partial_cmp +// = +// fun (self: t_U128) (rhs: t_U128) -> +// // Core.Option.Option_Some +// Some +// (match +// Hax_base.Int.BaseImpl.impl__cmp (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Core.Clone.f_clone #t_U128 #FStar.Tactics.Typeclasses.solve self <: t_U128) +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Core.Clone.f_clone #t_U128 #FStar.Tactics.Typeclasses.solve rhs <: t_U128) +// <: +// Hax_base.Int.t_HaxInt) +// with +// | Hax_base.Int.CMP_LESS -> Core.Cmp.Ordering_Less <: Core.Cmp.t_Ordering +// | Hax_base.Int.CMP_EQ -> Core.Cmp.Ordering_Equal <: Core.Cmp.t_Ordering +// | Hax_base.Int.CMP_GREATER -> Core.Cmp.Ordering_Greater <: Core.Cmp.t_Ordering) +// <: +// // Core.Option.t_Option +// option // Core.Cmp.t_Ordering +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_4: Core.Ops.Arith.t_Neg t_U8 = +// { +// f_Output = t_U8; +// f_neg_pre = (fun (self: t_U8) -> true); +// f_neg_post = (fun (self: t_U8) (out: t_U8) -> true); +// f_neg +// = +// fun (self: t_U8) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__sub Hax_base.Int.BaseSpec.v_WORDSIZE_8_ +// (Hax_base.Int.BaseImpl.impl__rem (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// Hax_base.Int.BaseSpec.v_WORDSIZE_8_ +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_10: Core.Ops.Arith.t_Mul t_U8 t_U8 = +// { +// f_Output = t_U8; +// f_mul_pre = (fun (self: t_U8) (rhs: t_U8) -> true); +// f_mul_post = (fun (self: t_U8) (rhs: t_U8) (out: t_U8) -> true); +// f_mul +// = +// fun (self: t_U8) (rhs: t_U8) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__mul (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U8 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_11: Core.Ops.Arith.t_Rem t_U8 t_U8 = +// { +// f_Output = t_U8; +// f_rem_pre = (fun (self: t_U8) (rhs: t_U8) -> true); +// f_rem_post = (fun (self: t_U8) (rhs: t_U8) (out: t_U8) -> true); +// f_rem +// = +// fun (self: t_U8) (rhs: t_U8) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__rem (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U8 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_12: Core.Ops.Arith.t_Add t_U8 t_U8 = +// { +// f_Output = t_U8; +// f_add_pre = (fun (self: t_U8) (rhs: t_U8) -> true); +// f_add_post = (fun (self: t_U8) (rhs: t_U8) (out: t_U8) -> true); +// f_add +// = +// fun (self: t_U8) (rhs: t_U8) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__add (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U8 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_13: Core.Ops.Arith.t_Div t_U8 t_U8 = +// { +// f_Output = t_U8; +// f_div_pre = (fun (self: t_U8) (rhs: t_U8) -> true); +// f_div_post = (fun (self: t_U8) (rhs: t_U8) (out: t_U8) -> true); +// f_div +// = +// fun (self: t_U8) (rhs: t_U8) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__div (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U8 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_14: Core.Ops.Bit.t_Shl t_U8 t_U8 = +// { +// f_Output = t_U8; +// f_shl_pre = (fun (self: t_U8) (rhs: t_U8) -> true); +// f_shl_post = (fun (self: t_U8) (rhs: t_U8) (out: t_U8) -> true); +// f_shl +// = +// fun (self: t_U8) (rhs: t_U8) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U8 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_15: Core.Ops.Bit.t_Shl t_U8 t_U16 = +// { +// f_Output = t_U8; +// f_shl_pre = (fun (self: t_U8) (rhs: t_U16) -> true); +// f_shl_post = (fun (self: t_U8) (rhs: t_U16) (out: t_U8) -> true); +// f_shl +// = +// fun (self: t_U8) (rhs: t_U16) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U16 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_16: Core.Ops.Bit.t_Shl t_U8 t_U32 = +// { +// f_Output = t_U8; +// f_shl_pre = (fun (self: t_U8) (rhs: t_U32) -> true); +// f_shl_post = (fun (self: t_U8) (rhs: t_U32) (out: t_U8) -> true); +// f_shl +// = +// fun (self: t_U8) (rhs: t_U32) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U32 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_17: Core.Ops.Bit.t_Shl t_U8 t_U64 = +// { +// f_Output = t_U8; +// f_shl_pre = (fun (self: t_U8) (rhs: t_U64) -> true); +// f_shl_post = (fun (self: t_U8) (rhs: t_U64) (out: t_U8) -> true); +// f_shl +// = +// fun (self: t_U8) (rhs: t_U64) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U64 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_18: Core.Ops.Bit.t_Shl t_U8 t_U128 = +// { +// f_Output = t_U8; +// f_shl_pre = (fun (self: t_U8) (rhs: t_U128) -> true); +// f_shl_post = (fun (self: t_U8) (rhs: t_U128) (out: t_U8) -> true); +// f_shl +// = +// fun (self: t_U8) (rhs: t_U128) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U128 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_19: Core.Ops.Bit.t_Shr t_U8 t_U8 = +// { +// f_Output = t_U8; +// f_shr_pre = (fun (self: t_U8) (rhs: t_U8) -> true); +// f_shr_post = (fun (self: t_U8) (rhs: t_U8) (out: t_U8) -> true); +// f_shr +// = +// fun (self: t_U8) (rhs: t_U8) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U8 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_20: Core.Ops.Bit.t_Shr t_U8 t_U16 = +// { +// f_Output = t_U8; +// f_shr_pre = (fun (self: t_U8) (rhs: t_U16) -> true); +// f_shr_post = (fun (self: t_U8) (rhs: t_U16) (out: t_U8) -> true); +// f_shr +// = +// fun (self: t_U8) (rhs: t_U16) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U16 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_21: Core.Ops.Bit.t_Shr t_U8 t_U32 = +// { +// f_Output = t_U8; +// f_shr_pre = (fun (self: t_U8) (rhs: t_U32) -> true); +// f_shr_post = (fun (self: t_U8) (rhs: t_U32) (out: t_U8) -> true); +// f_shr +// = +// fun (self: t_U8) (rhs: t_U32) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U32 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_22: Core.Ops.Bit.t_Shr t_U8 t_U64 = +// { +// f_Output = t_U8; +// f_shr_pre = (fun (self: t_U8) (rhs: t_U64) -> true); +// f_shr_post = (fun (self: t_U8) (rhs: t_U64) (out: t_U8) -> true); +// f_shr +// = +// fun (self: t_U8) (rhs: t_U64) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U64 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_23: Core.Ops.Bit.t_Shr t_U8 t_U128 = +// { +// f_Output = t_U8; +// f_shr_pre = (fun (self: t_U8) (rhs: t_U128) -> true); +// f_shr_post = (fun (self: t_U8) (rhs: t_U128) (out: t_U8) -> true); +// f_shr +// = +// fun (self: t_U8) (rhs: t_U128) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U128 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_24: Core.Ops.Bit.t_BitXor t_U8 t_U8 = +// { +// f_Output = t_U8; +// f_bitxor_pre = (fun (self: t_U8) (rhs: t_U8) -> true); +// f_bitxor_post = (fun (self: t_U8) (rhs: t_U8) (out: t_U8) -> true); +// f_bitxor +// = +// fun (self: t_U8) (rhs: t_U8) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__bitxor (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U8 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_25: Core.Ops.Bit.t_BitAnd t_U8 t_U8 = +// { +// f_Output = t_U8; +// f_bitand_pre = (fun (self: t_U8) (rhs: t_U8) -> true); +// f_bitand_post = (fun (self: t_U8) (rhs: t_U8) (out: t_U8) -> true); +// f_bitand +// = +// fun (self: t_U8) (rhs: t_U8) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__bitand (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U8 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_26: Core.Ops.Bit.t_BitOr t_U8 t_U8 = +// { +// f_Output = t_U8; +// f_bitor_pre = (fun (self: t_U8) (rhs: t_U8) -> true); +// f_bitor_post = (fun (self: t_U8) (rhs: t_U8) (out: t_U8) -> true); +// f_bitor +// = +// fun (self: t_U8) (rhs: t_U8) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U8 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__bitor (Hax_core.Coerce.f_lift #t_U8 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U8 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_31: Core.Ops.Arith.t_Neg t_U16 = +// { +// f_Output = t_U16; +// f_neg_pre = (fun (self: t_U16) -> true); +// f_neg_post = (fun (self: t_U16) (out: t_U16) -> true); +// f_neg +// = +// fun (self: t_U16) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__sub Hax_base.Int.BaseSpec.v_WORDSIZE_16_ +// (Hax_base.Int.BaseImpl.impl__rem (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// Hax_base.Int.BaseSpec.v_WORDSIZE_16_ +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_37: Core.Ops.Arith.t_Mul t_U16 t_U16 = +// { +// f_Output = t_U16; +// f_mul_pre = (fun (self: t_U16) (rhs: t_U16) -> true); +// f_mul_post = (fun (self: t_U16) (rhs: t_U16) (out: t_U16) -> true); +// f_mul +// = +// fun (self: t_U16) (rhs: t_U16) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__mul (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U16 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_38: Core.Ops.Arith.t_Rem t_U16 t_U16 = +// { +// f_Output = t_U16; +// f_rem_pre = (fun (self: t_U16) (rhs: t_U16) -> true); +// f_rem_post = (fun (self: t_U16) (rhs: t_U16) (out: t_U16) -> true); +// f_rem +// = +// fun (self: t_U16) (rhs: t_U16) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__rem (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U16 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_39: Core.Ops.Arith.t_Add t_U16 t_U16 = +// { +// f_Output = t_U16; +// f_add_pre = (fun (self: t_U16) (rhs: t_U16) -> true); +// f_add_post = (fun (self: t_U16) (rhs: t_U16) (out: t_U16) -> true); +// f_add +// = +// fun (self: t_U16) (rhs: t_U16) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__add (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U16 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_40: Core.Ops.Arith.t_Div t_U16 t_U16 = +// { +// f_Output = t_U16; +// f_div_pre = (fun (self: t_U16) (rhs: t_U16) -> true); +// f_div_post = (fun (self: t_U16) (rhs: t_U16) (out: t_U16) -> true); +// f_div +// = +// fun (self: t_U16) (rhs: t_U16) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__div (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U16 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_41: Core.Ops.Bit.t_Shl t_U16 t_U8 = +// { +// f_Output = t_U16; +// f_shl_pre = (fun (self: t_U16) (rhs: t_U8) -> true); +// f_shl_post = (fun (self: t_U16) (rhs: t_U8) (out: t_U16) -> true); +// f_shl +// = +// fun (self: t_U16) (rhs: t_U8) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U8 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_42: Core.Ops.Bit.t_Shl t_U16 t_U16 = +// { +// f_Output = t_U16; +// f_shl_pre = (fun (self: t_U16) (rhs: t_U16) -> true); +// f_shl_post = (fun (self: t_U16) (rhs: t_U16) (out: t_U16) -> true); +// f_shl +// = +// fun (self: t_U16) (rhs: t_U16) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U16 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_43: Core.Ops.Bit.t_Shl t_U16 t_U32 = +// { +// f_Output = t_U16; +// f_shl_pre = (fun (self: t_U16) (rhs: t_U32) -> true); +// f_shl_post = (fun (self: t_U16) (rhs: t_U32) (out: t_U16) -> true); +// f_shl +// = +// fun (self: t_U16) (rhs: t_U32) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U32 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_44: Core.Ops.Bit.t_Shl t_U16 t_U64 = +// { +// f_Output = t_U16; +// f_shl_pre = (fun (self: t_U16) (rhs: t_U64) -> true); +// f_shl_post = (fun (self: t_U16) (rhs: t_U64) (out: t_U16) -> true); +// f_shl +// = +// fun (self: t_U16) (rhs: t_U64) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U64 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_45: Core.Ops.Bit.t_Shl t_U16 t_U128 = +// { +// f_Output = t_U16; +// f_shl_pre = (fun (self: t_U16) (rhs: t_U128) -> true); +// f_shl_post = (fun (self: t_U16) (rhs: t_U128) (out: t_U16) -> true); +// f_shl +// = +// fun (self: t_U16) (rhs: t_U128) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U128 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_46: Core.Ops.Bit.t_Shr t_U16 t_U8 = +// { +// f_Output = t_U16; +// f_shr_pre = (fun (self: t_U16) (rhs: t_U8) -> true); +// f_shr_post = (fun (self: t_U16) (rhs: t_U8) (out: t_U16) -> true); +// f_shr +// = +// fun (self: t_U16) (rhs: t_U8) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U8 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_47: Core.Ops.Bit.t_Shr t_U16 t_U16 = +// { +// f_Output = t_U16; +// f_shr_pre = (fun (self: t_U16) (rhs: t_U16) -> true); +// f_shr_post = (fun (self: t_U16) (rhs: t_U16) (out: t_U16) -> true); +// f_shr +// = +// fun (self: t_U16) (rhs: t_U16) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U16 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_48: Core.Ops.Bit.t_Shr t_U16 t_U32 = +// { +// f_Output = t_U16; +// f_shr_pre = (fun (self: t_U16) (rhs: t_U32) -> true); +// f_shr_post = (fun (self: t_U16) (rhs: t_U32) (out: t_U16) -> true); +// f_shr +// = +// fun (self: t_U16) (rhs: t_U32) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U32 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_49: Core.Ops.Bit.t_Shr t_U16 t_U64 = +// { +// f_Output = t_U16; +// f_shr_pre = (fun (self: t_U16) (rhs: t_U64) -> true); +// f_shr_post = (fun (self: t_U16) (rhs: t_U64) (out: t_U16) -> true); +// f_shr +// = +// fun (self: t_U16) (rhs: t_U64) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U64 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_50: Core.Ops.Bit.t_Shr t_U16 t_U128 = +// { +// f_Output = t_U16; +// f_shr_pre = (fun (self: t_U16) (rhs: t_U128) -> true); +// f_shr_post = (fun (self: t_U16) (rhs: t_U128) (out: t_U16) -> true); +// f_shr +// = +// fun (self: t_U16) (rhs: t_U128) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U128 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_51: Core.Ops.Bit.t_BitXor t_U16 t_U16 = +// { +// f_Output = t_U16; +// f_bitxor_pre = (fun (self: t_U16) (rhs: t_U16) -> true); +// f_bitxor_post = (fun (self: t_U16) (rhs: t_U16) (out: t_U16) -> true); +// f_bitxor +// = +// fun (self: t_U16) (rhs: t_U16) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__bitxor (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U16 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_52: Core.Ops.Bit.t_BitAnd t_U16 t_U16 = +// { +// f_Output = t_U16; +// f_bitand_pre = (fun (self: t_U16) (rhs: t_U16) -> true); +// f_bitand_post = (fun (self: t_U16) (rhs: t_U16) (out: t_U16) -> true); +// f_bitand +// = +// fun (self: t_U16) (rhs: t_U16) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__bitand (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U16 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_53: Core.Ops.Bit.t_BitOr t_U16 t_U16 = +// { +// f_Output = t_U16; +// f_bitor_pre = (fun (self: t_U16) (rhs: t_U16) -> true); +// f_bitor_post = (fun (self: t_U16) (rhs: t_U16) (out: t_U16) -> true); +// f_bitor +// = +// fun (self: t_U16) (rhs: t_U16) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U16 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__bitor (Hax_core.Coerce.f_lift #t_U16 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U16 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_58: Core.Ops.Arith.t_Neg t_U32 = +// { +// f_Output = t_U32; +// f_neg_pre = (fun (self: t_U32) -> true); +// f_neg_post = (fun (self: t_U32) (out: t_U32) -> true); +// f_neg +// = +// fun (self: t_U32) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__sub Hax_base.Int.BaseSpec.v_WORDSIZE_32_ +// (Hax_base.Int.BaseImpl.impl__rem (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// Hax_base.Int.BaseSpec.v_WORDSIZE_32_ +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_64: Core.Ops.Arith.t_Mul t_U32 t_U32 = +// { +// f_Output = t_U32; +// f_mul_pre = (fun (self: t_U32) (rhs: t_U32) -> true); +// f_mul_post = (fun (self: t_U32) (rhs: t_U32) (out: t_U32) -> true); +// f_mul +// = +// fun (self: t_U32) (rhs: t_U32) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__mul (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U32 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_65: Core.Ops.Arith.t_Rem t_U32 t_U32 = +// { +// f_Output = t_U32; +// f_rem_pre = (fun (self: t_U32) (rhs: t_U32) -> true); +// f_rem_post = (fun (self: t_U32) (rhs: t_U32) (out: t_U32) -> true); +// f_rem +// = +// fun (self: t_U32) (rhs: t_U32) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__rem (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U32 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_66: Core.Ops.Arith.t_Add t_U32 t_U32 = +// { +// f_Output = t_U32; +// f_add_pre = (fun (self: t_U32) (rhs: t_U32) -> true); +// f_add_post = (fun (self: t_U32) (rhs: t_U32) (out: t_U32) -> true); +// f_add +// = +// fun (self: t_U32) (rhs: t_U32) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__add (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U32 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_67: Core.Ops.Arith.t_Div t_U32 t_U32 = +// { +// f_Output = t_U32; +// f_div_pre = (fun (self: t_U32) (rhs: t_U32) -> true); +// f_div_post = (fun (self: t_U32) (rhs: t_U32) (out: t_U32) -> true); +// f_div +// = +// fun (self: t_U32) (rhs: t_U32) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__div (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U32 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_68: Core.Ops.Bit.t_Shl t_U32 t_U8 = +// { +// f_Output = t_U32; +// f_shl_pre = (fun (self: t_U32) (rhs: t_U8) -> true); +// f_shl_post = (fun (self: t_U32) (rhs: t_U8) (out: t_U32) -> true); +// f_shl +// = +// fun (self: t_U32) (rhs: t_U8) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U8 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_69: Core.Ops.Bit.t_Shl t_U32 t_U16 = +// { +// f_Output = t_U32; +// f_shl_pre = (fun (self: t_U32) (rhs: t_U16) -> true); +// f_shl_post = (fun (self: t_U32) (rhs: t_U16) (out: t_U32) -> true); +// f_shl +// = +// fun (self: t_U32) (rhs: t_U16) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U16 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_70: Core.Ops.Bit.t_Shl t_U32 t_U32 = +// { +// f_Output = t_U32; +// f_shl_pre = (fun (self: t_U32) (rhs: t_U32) -> true); +// f_shl_post = (fun (self: t_U32) (rhs: t_U32) (out: t_U32) -> true); +// f_shl +// = +// fun (self: t_U32) (rhs: t_U32) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U32 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_71: Core.Ops.Bit.t_Shl t_U32 t_U64 = +// { +// f_Output = t_U32; +// f_shl_pre = (fun (self: t_U32) (rhs: t_U64) -> true); +// f_shl_post = (fun (self: t_U32) (rhs: t_U64) (out: t_U32) -> true); +// f_shl +// = +// fun (self: t_U32) (rhs: t_U64) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U64 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_72: Core.Ops.Bit.t_Shl t_U32 t_U128 = +// { +// f_Output = t_U32; +// f_shl_pre = (fun (self: t_U32) (rhs: t_U128) -> true); +// f_shl_post = (fun (self: t_U32) (rhs: t_U128) (out: t_U32) -> true); +// f_shl +// = +// fun (self: t_U32) (rhs: t_U128) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U128 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_73: Core.Ops.Bit.t_Shr t_U32 t_U8 = +// { +// f_Output = t_U32; +// f_shr_pre = (fun (self: t_U32) (rhs: t_U8) -> true); +// f_shr_post = (fun (self: t_U32) (rhs: t_U8) (out: t_U32) -> true); +// f_shr +// = +// fun (self: t_U32) (rhs: t_U8) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U8 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_74: Core.Ops.Bit.t_Shr t_U32 t_U16 = +// { +// f_Output = t_U32; +// f_shr_pre = (fun (self: t_U32) (rhs: t_U16) -> true); +// f_shr_post = (fun (self: t_U32) (rhs: t_U16) (out: t_U32) -> true); +// f_shr +// = +// fun (self: t_U32) (rhs: t_U16) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U16 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_75: Core.Ops.Bit.t_Shr t_U32 t_U32 = +// { +// f_Output = t_U32; +// f_shr_pre = (fun (self: t_U32) (rhs: t_U32) -> true); +// f_shr_post = (fun (self: t_U32) (rhs: t_U32) (out: t_U32) -> true); +// f_shr +// = +// fun (self: t_U32) (rhs: t_U32) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U32 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_76: Core.Ops.Bit.t_Shr t_U32 t_U64 = +// { +// f_Output = t_U32; +// f_shr_pre = (fun (self: t_U32) (rhs: t_U64) -> true); +// f_shr_post = (fun (self: t_U32) (rhs: t_U64) (out: t_U32) -> true); +// f_shr +// = +// fun (self: t_U32) (rhs: t_U64) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U64 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_77: Core.Ops.Bit.t_Shr t_U32 t_U128 = +// { +// f_Output = t_U32; +// f_shr_pre = (fun (self: t_U32) (rhs: t_U128) -> true); +// f_shr_post = (fun (self: t_U32) (rhs: t_U128) (out: t_U32) -> true); +// f_shr +// = +// fun (self: t_U32) (rhs: t_U128) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U128 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_78: Core.Ops.Bit.t_BitXor t_U32 t_U32 = +// { +// f_Output = t_U32; +// f_bitxor_pre = (fun (self: t_U32) (rhs: t_U32) -> true); +// f_bitxor_post = (fun (self: t_U32) (rhs: t_U32) (out: t_U32) -> true); +// f_bitxor +// = +// fun (self: t_U32) (rhs: t_U32) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__bitxor (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U32 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_79: Core.Ops.Bit.t_BitAnd t_U32 t_U32 = +// { +// f_Output = t_U32; +// f_bitand_pre = (fun (self: t_U32) (rhs: t_U32) -> true); +// f_bitand_post = (fun (self: t_U32) (rhs: t_U32) (out: t_U32) -> true); +// f_bitand +// = +// fun (self: t_U32) (rhs: t_U32) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__bitand (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U32 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_80: Core.Ops.Bit.t_BitOr t_U32 t_U32 = +// { +// f_Output = t_U32; +// f_bitor_pre = (fun (self: t_U32) (rhs: t_U32) -> true); +// f_bitor_post = (fun (self: t_U32) (rhs: t_U32) (out: t_U32) -> true); +// f_bitor +// = +// fun (self: t_U32) (rhs: t_U32) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U32 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__bitor (Hax_core.Coerce.f_lift #t_U32 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U32 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_85: Core.Ops.Arith.t_Neg t_U64 = +// { +// f_Output = t_U64; +// f_neg_pre = (fun (self: t_U64) -> true); +// f_neg_post = (fun (self: t_U64) (out: t_U64) -> true); +// f_neg +// = +// fun (self: t_U64) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__sub Hax_base.Int.BaseSpec.v_WORDSIZE_64_ +// (Hax_base.Int.BaseImpl.impl__rem (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// Hax_base.Int.BaseSpec.v_WORDSIZE_64_ +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_91: Core.Ops.Arith.t_Mul t_U64 t_U64 = +// { +// f_Output = t_U64; +// f_mul_pre = (fun (self: t_U64) (rhs: t_U64) -> true); +// f_mul_post = (fun (self: t_U64) (rhs: t_U64) (out: t_U64) -> true); +// f_mul +// = +// fun (self: t_U64) (rhs: t_U64) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__mul (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U64 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_92: Core.Ops.Arith.t_Rem t_U64 t_U64 = +// { +// f_Output = t_U64; +// f_rem_pre = (fun (self: t_U64) (rhs: t_U64) -> true); +// f_rem_post = (fun (self: t_U64) (rhs: t_U64) (out: t_U64) -> true); +// f_rem +// = +// fun (self: t_U64) (rhs: t_U64) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__rem (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U64 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_93: Core.Ops.Arith.t_Add t_U64 t_U64 = +// { +// f_Output = t_U64; +// f_add_pre = (fun (self: t_U64) (rhs: t_U64) -> true); +// f_add_post = (fun (self: t_U64) (rhs: t_U64) (out: t_U64) -> true); +// f_add +// = +// fun (self: t_U64) (rhs: t_U64) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__add (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U64 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_94: Core.Ops.Arith.t_Div t_U64 t_U64 = +// { +// f_Output = t_U64; +// f_div_pre = (fun (self: t_U64) (rhs: t_U64) -> true); +// f_div_post = (fun (self: t_U64) (rhs: t_U64) (out: t_U64) -> true); +// f_div +// = +// fun (self: t_U64) (rhs: t_U64) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__div (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U64 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_95: Core.Ops.Bit.t_Shl t_U64 t_U8 = +// { +// f_Output = t_U64; +// f_shl_pre = (fun (self: t_U64) (rhs: t_U8) -> true); +// f_shl_post = (fun (self: t_U64) (rhs: t_U8) (out: t_U64) -> true); +// f_shl +// = +// fun (self: t_U64) (rhs: t_U8) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U8 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_96: Core.Ops.Bit.t_Shl t_U64 t_U16 = +// { +// f_Output = t_U64; +// f_shl_pre = (fun (self: t_U64) (rhs: t_U16) -> true); +// f_shl_post = (fun (self: t_U64) (rhs: t_U16) (out: t_U64) -> true); +// f_shl +// = +// fun (self: t_U64) (rhs: t_U16) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U16 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_97: Core.Ops.Bit.t_Shl t_U64 t_U32 = +// { +// f_Output = t_U64; +// f_shl_pre = (fun (self: t_U64) (rhs: t_U32) -> true); +// f_shl_post = (fun (self: t_U64) (rhs: t_U32) (out: t_U64) -> true); +// f_shl +// = +// fun (self: t_U64) (rhs: t_U32) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U32 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_98: Core.Ops.Bit.t_Shl t_U64 t_U64 = +// { +// f_Output = t_U64; +// f_shl_pre = (fun (self: t_U64) (rhs: t_U64) -> true); +// f_shl_post = (fun (self: t_U64) (rhs: t_U64) (out: t_U64) -> true); +// f_shl +// = +// fun (self: t_U64) (rhs: t_U64) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U64 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_99: Core.Ops.Bit.t_Shl t_U64 t_U128 = +// { +// f_Output = t_U64; +// f_shl_pre = (fun (self: t_U64) (rhs: t_U128) -> true); +// f_shl_post = (fun (self: t_U64) (rhs: t_U128) (out: t_U64) -> true); +// f_shl +// = +// fun (self: t_U64) (rhs: t_U128) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U128 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_100: Core.Ops.Bit.t_Shr t_U64 t_U8 = +// { +// f_Output = t_U64; +// f_shr_pre = (fun (self: t_U64) (rhs: t_U8) -> true); +// f_shr_post = (fun (self: t_U64) (rhs: t_U8) (out: t_U64) -> true); +// f_shr +// = +// fun (self: t_U64) (rhs: t_U8) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U8 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_101: Core.Ops.Bit.t_Shr t_U64 t_U16 = +// { +// f_Output = t_U64; +// f_shr_pre = (fun (self: t_U64) (rhs: t_U16) -> true); +// f_shr_post = (fun (self: t_U64) (rhs: t_U16) (out: t_U64) -> true); +// f_shr +// = +// fun (self: t_U64) (rhs: t_U16) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U16 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_102: Core.Ops.Bit.t_Shr t_U64 t_U32 = +// { +// f_Output = t_U64; +// f_shr_pre = (fun (self: t_U64) (rhs: t_U32) -> true); +// f_shr_post = (fun (self: t_U64) (rhs: t_U32) (out: t_U64) -> true); +// f_shr +// = +// fun (self: t_U64) (rhs: t_U32) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U32 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_103: Core.Ops.Bit.t_Shr t_U64 t_U64 = +// { +// f_Output = t_U64; +// f_shr_pre = (fun (self: t_U64) (rhs: t_U64) -> true); +// f_shr_post = (fun (self: t_U64) (rhs: t_U64) (out: t_U64) -> true); +// f_shr +// = +// fun (self: t_U64) (rhs: t_U64) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U64 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_104: Core.Ops.Bit.t_Shr t_U64 t_U128 = +// { +// f_Output = t_U64; +// f_shr_pre = (fun (self: t_U64) (rhs: t_U128) -> true); +// f_shr_post = (fun (self: t_U64) (rhs: t_U128) (out: t_U64) -> true); +// f_shr +// = +// fun (self: t_U64) (rhs: t_U128) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U128 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_105: Core.Ops.Bit.t_BitXor t_U64 t_U64 = +// { +// f_Output = t_U64; +// f_bitxor_pre = (fun (self: t_U64) (rhs: t_U64) -> true); +// f_bitxor_post = (fun (self: t_U64) (rhs: t_U64) (out: t_U64) -> true); +// f_bitxor +// = +// fun (self: t_U64) (rhs: t_U64) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__bitxor (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U64 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_106: Core.Ops.Bit.t_BitAnd t_U64 t_U64 = +// { +// f_Output = t_U64; +// f_bitand_pre = (fun (self: t_U64) (rhs: t_U64) -> true); +// f_bitand_post = (fun (self: t_U64) (rhs: t_U64) (out: t_U64) -> true); +// f_bitand +// = +// fun (self: t_U64) (rhs: t_U64) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__bitand (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U64 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_107: Core.Ops.Bit.t_BitOr t_U64 t_U64 = +// { +// f_Output = t_U64; +// f_bitor_pre = (fun (self: t_U64) (rhs: t_U64) -> true); +// f_bitor_post = (fun (self: t_U64) (rhs: t_U64) (out: t_U64) -> true); +// f_bitor +// = +// fun (self: t_U64) (rhs: t_U64) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U64 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__bitor (Hax_core.Coerce.f_lift #t_U64 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U64 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_112: Core.Ops.Arith.t_Neg t_U128 = +// { +// f_Output = t_U128; +// f_neg_pre = (fun (self: t_U128) -> true); +// f_neg_post = (fun (self: t_U128) (out: t_U128) -> true); +// f_neg +// = +// fun (self: t_U128) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__sub Hax_base.Int.BaseSpec.v_WORDSIZE_128_ +// (Hax_base.Int.BaseImpl.impl__rem (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// Hax_base.Int.BaseSpec.v_WORDSIZE_128_ +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_118: Core.Ops.Arith.t_Mul t_U128 t_U128 = +// { +// f_Output = t_U128; +// f_mul_pre = (fun (self: t_U128) (rhs: t_U128) -> true); +// f_mul_post = (fun (self: t_U128) (rhs: t_U128) (out: t_U128) -> true); +// f_mul +// = +// fun (self: t_U128) (rhs: t_U128) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__mul (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U128 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_119: Core.Ops.Arith.t_Rem t_U128 t_U128 = +// { +// f_Output = t_U128; +// f_rem_pre = (fun (self: t_U128) (rhs: t_U128) -> true); +// f_rem_post = (fun (self: t_U128) (rhs: t_U128) (out: t_U128) -> true); +// f_rem +// = +// fun (self: t_U128) (rhs: t_U128) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__rem (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U128 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_120: Core.Ops.Arith.t_Add t_U128 t_U128 = +// { +// f_Output = t_U128; +// f_add_pre = (fun (self: t_U128) (rhs: t_U128) -> true); +// f_add_post = (fun (self: t_U128) (rhs: t_U128) (out: t_U128) -> true); +// f_add +// = +// fun (self: t_U128) (rhs: t_U128) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__add (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U128 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_121: Core.Ops.Arith.t_Div t_U128 t_U128 = +// { +// f_Output = t_U128; +// f_div_pre = (fun (self: t_U128) (rhs: t_U128) -> true); +// f_div_post = (fun (self: t_U128) (rhs: t_U128) (out: t_U128) -> true); +// f_div +// = +// fun (self: t_U128) (rhs: t_U128) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__div (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U128 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_122: Core.Ops.Bit.t_Shl t_U128 t_U8 = +// { +// f_Output = t_U128; +// f_shl_pre = (fun (self: t_U128) (rhs: t_U8) -> true); +// f_shl_post = (fun (self: t_U128) (rhs: t_U8) (out: t_U128) -> true); +// f_shl +// = +// fun (self: t_U128) (rhs: t_U8) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U8 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_123: Core.Ops.Bit.t_Shl t_U128 t_U16 = +// { +// f_Output = t_U128; +// f_shl_pre = (fun (self: t_U128) (rhs: t_U16) -> true); +// f_shl_post = (fun (self: t_U128) (rhs: t_U16) (out: t_U128) -> true); +// f_shl +// = +// fun (self: t_U128) (rhs: t_U16) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U16 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_124: Core.Ops.Bit.t_Shl t_U128 t_U32 = +// { +// f_Output = t_U128; +// f_shl_pre = (fun (self: t_U128) (rhs: t_U32) -> true); +// f_shl_post = (fun (self: t_U128) (rhs: t_U32) (out: t_U128) -> true); +// f_shl +// = +// fun (self: t_U128) (rhs: t_U32) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U32 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_125: Core.Ops.Bit.t_Shl t_U128 t_U64 = +// { +// f_Output = t_U128; +// f_shl_pre = (fun (self: t_U128) (rhs: t_U64) -> true); +// f_shl_post = (fun (self: t_U128) (rhs: t_U64) (out: t_U128) -> true); +// f_shl +// = +// fun (self: t_U128) (rhs: t_U64) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U64 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_126: Core.Ops.Bit.t_Shl t_U128 t_U128 = +// { +// f_Output = t_U128; +// f_shl_pre = (fun (self: t_U128) (rhs: t_U128) -> true); +// f_shl_post = (fun (self: t_U128) (rhs: t_U128) (out: t_U128) -> true); +// f_shl +// = +// fun (self: t_U128) (rhs: t_U128) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shl (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U128 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_127: Core.Ops.Bit.t_Shr t_U128 t_U8 = +// { +// f_Output = t_U128; +// f_shr_pre = (fun (self: t_U128) (rhs: t_U8) -> true); +// f_shr_post = (fun (self: t_U128) (rhs: t_U8) (out: t_U128) -> true); +// f_shr +// = +// fun (self: t_U128) (rhs: t_U8) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U8 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_128: Core.Ops.Bit.t_Shr t_U128 t_U16 = +// { +// f_Output = t_U128; +// f_shr_pre = (fun (self: t_U128) (rhs: t_U16) -> true); +// f_shr_post = (fun (self: t_U128) (rhs: t_U16) (out: t_U128) -> true); +// f_shr +// = +// fun (self: t_U128) (rhs: t_U16) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U16 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_129: Core.Ops.Bit.t_Shr t_U128 t_U32 = +// { +// f_Output = t_U128; +// f_shr_pre = (fun (self: t_U128) (rhs: t_U32) -> true); +// f_shr_post = (fun (self: t_U128) (rhs: t_U32) (out: t_U128) -> true); +// f_shr +// = +// fun (self: t_U128) (rhs: t_U32) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U32 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_130: Core.Ops.Bit.t_Shr t_U128 t_U64 = +// { +// f_Output = t_U128; +// f_shr_pre = (fun (self: t_U128) (rhs: t_U64) -> true); +// f_shr_post = (fun (self: t_U128) (rhs: t_U64) (out: t_U128) -> true); +// f_shr +// = +// fun (self: t_U128) (rhs: t_U64) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U64 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_131: Core.Ops.Bit.t_Shr t_U128 t_U128 = +// { +// f_Output = t_U128; +// f_shr_pre = (fun (self: t_U128) (rhs: t_U128) -> true); +// f_shr_post = (fun (self: t_U128) (rhs: t_U128) (out: t_U128) -> true); +// f_shr +// = +// fun (self: t_U128) (rhs: t_U128) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__shr (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U128 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_132: Core.Ops.Bit.t_BitXor t_U128 t_U128 = +// { +// f_Output = t_U128; +// f_bitxor_pre = (fun (self: t_U128) (rhs: t_U128) -> true); +// f_bitxor_post = (fun (self: t_U128) (rhs: t_U128) (out: t_U128) -> true); +// f_bitxor +// = +// fun (self: t_U128) (rhs: t_U128) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__bitxor (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U128 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_133: Core.Ops.Bit.t_BitAnd t_U128 t_U128 = +// { +// f_Output = t_U128; +// f_bitand_pre = (fun (self: t_U128) (rhs: t_U128) -> true); +// f_bitand_post = (fun (self: t_U128) (rhs: t_U128) (out: t_U128) -> true); +// f_bitand +// = +// fun (self: t_U128) (rhs: t_U128) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__bitand (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U128 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_134: Core.Ops.Bit.t_BitOr t_U128 t_U128 = +// { +// f_Output = t_U128; +// f_bitor_pre = (fun (self: t_U128) (rhs: t_U128) -> true); +// f_bitor_post = (fun (self: t_U128) (rhs: t_U128) (out: t_U128) -> true); +// f_bitor +// = +// fun (self: t_U128) (rhs: t_U128) -> +// Hax_core.Coerce.f_concretize #Hax_base.Int.t_HaxInt +// #t_U128 +// #FStar.Tactics.Typeclasses.solve +// (Hax_base.Int.BaseImpl.impl__bitor (Hax_core.Coerce.f_lift #t_U128 +// #FStar.Tactics.Typeclasses.solve +// self +// <: +// Hax_base.Int.t_HaxInt) +// (Hax_core.Coerce.f_lift #t_U128 #FStar.Tactics.Typeclasses.solve rhs +// <: +// Hax_base.Int.t_HaxInt) +// <: +// Hax_base.Int.t_HaxInt) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_5: Core.Ops.Arith.t_Sub t_U8 t_U8 = +// { +// f_Output = t_U8; +// f_sub_pre = (fun (self: t_U8) (rhs: t_U8) -> true); +// f_sub_post = (fun (self: t_U8) (rhs: t_U8) (out: t_U8) -> true); +// f_sub +// = +// fun (self: t_U8) (rhs: t_U8) -> +// self +! (Core.Ops.Arith.f_neg #t_U8 #FStar.Tactics.Typeclasses.solve rhs <: t_U8) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_6: Core.Ops.Bit.t_Not t_U8 = +// { +// f_Output = t_U8; +// f_not_pre = (fun (self: t_U8) -> true); +// f_not_post = (fun (self: t_U8) (out: t_U8) -> true); +// f_not = fun (self: t_U8) -> self ^. Hax_core.Num.impl__MAX +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_32: Core.Ops.Arith.t_Sub t_U16 t_U16 = +// { +// f_Output = t_U16; +// f_sub_pre = (fun (self: t_U16) (rhs: t_U16) -> true); +// f_sub_post = (fun (self: t_U16) (rhs: t_U16) (out: t_U16) -> true); +// f_sub +// = +// fun (self: t_U16) (rhs: t_U16) -> +// self +! (Core.Ops.Arith.f_neg #t_U16 #FStar.Tactics.Typeclasses.solve rhs <: t_U16) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_33: Core.Ops.Bit.t_Not t_U16 = +// { +// f_Output = t_U16; +// f_not_pre = (fun (self: t_U16) -> true); +// f_not_post = (fun (self: t_U16) (out: t_U16) -> true); +// f_not = fun (self: t_U16) -> self ^. f_MAX +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_59: Core.Ops.Arith.t_Sub t_U32 t_U32 = +// { +// f_Output = t_U32; +// f_sub_pre = (fun (self: t_U32) (rhs: t_U32) -> true); +// f_sub_post = (fun (self: t_U32) (rhs: t_U32) (out: t_U32) -> true); +// f_sub +// = +// fun (self: t_U32) (rhs: t_U32) -> +// self +! (Core.Ops.Arith.f_neg #t_U32 #FStar.Tactics.Typeclasses.solve rhs <: t_U32) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_60: Core.Ops.Bit.t_Not t_U32 = +// { +// f_Output = t_U32; +// f_not_pre = (fun (self: t_U32) -> true); +// f_not_post = (fun (self: t_U32) (out: t_U32) -> true); +// f_not = fun (self: t_U32) -> self ^. f_MAX +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_86: Core.Ops.Arith.t_Sub t_U64 t_U64 = +// { +// f_Output = t_U64; +// f_sub_pre = (fun (self: t_U64) (rhs: t_U64) -> true); +// f_sub_post = (fun (self: t_U64) (rhs: t_U64) (out: t_U64) -> true); +// f_sub +// = +// fun (self: t_U64) (rhs: t_U64) -> +// self +! (Core.Ops.Arith.f_neg #t_U64 #FStar.Tactics.Typeclasses.solve rhs <: t_U64) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_87: Core.Ops.Bit.t_Not t_U64 = +// { +// f_Output = t_U64; +// f_not_pre = (fun (self: t_U64) -> true); +// f_not_post = (fun (self: t_U64) (out: t_U64) -> true); +// f_not = fun (self: t_U64) -> self ^. f_MAX +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_113: Core.Ops.Arith.t_Sub t_U128 t_U128 = +// { +// f_Output = t_U128; +// f_sub_pre = (fun (self: t_U128) (rhs: t_U128) -> true); +// f_sub_post = (fun (self: t_U128) (rhs: t_U128) (out: t_U128) -> true); +// f_sub +// = +// fun (self: t_U128) (rhs: t_U128) -> +// self +! (Core.Ops.Arith.f_neg #t_U128 #FStar.Tactics.Typeclasses.solve rhs <: t_U128) +// } + +// [@@ FStar.Tactics.Typeclasses.tcinstance] +// let impl_114: Core.Ops.Bit.t_Not t_U128 = +// { +// f_Output = t_U128; +// f_not_pre = (fun (self: t_U128) -> true); +// f_not_post = (fun (self: t_U128) (out: t_U128) -> true); +// f_not = fun (self: t_U128) -> self ^. f_MAX +// } diff --git a/aes_jazz/src/aes_jazz.rs b/aes_jazz/src/aes_jazz.rs index c8981d5..4580173 100644 --- a/aes_jazz/src/aes_jazz.rs +++ b/aes_jazz/src/aes_jazz.rs @@ -1,10 +1,11 @@ use hacspec_lib::*; -public_bytes!(SBox, 256); -public_bytes!(RCon, 15); +type SBox = [u8; 256]; +type RCon = [u8; 15]; -public_bytes!(PBytes256, 256); -const SBOX: SBox = SBox([ +type PBytes256 = [u8; 256]; + +const SBOX: SBox = [ 0x63u8, 0x7Cu8, 0x77u8, 0x7Bu8, 0xF2u8, 0x6Bu8, 0x6Fu8, 0xC5u8, 0x30u8, 0x01u8, 0x67u8, 0x2Bu8, 0xFEu8, 0xD7u8, 0xABu8, 0x76u8, 0xCAu8, 0x82u8, 0xC9u8, 0x7Du8, 0xFAu8, 0x59u8, 0x47u8, 0xF0u8, 0xADu8, 0xD4u8, 0xA2u8, 0xAFu8, 0x9Cu8, 0xA4u8, 0x72u8, 0xC0u8, 0xB7u8, 0xFDu8, 0x93u8, 0x26u8, @@ -27,12 +28,12 @@ const SBOX: SBox = SBox([ 0x69u8, 0xD9u8, 0x8Eu8, 0x94u8, 0x9Bu8, 0x1Eu8, 0x87u8, 0xE9u8, 0xCEu8, 0x55u8, 0x28u8, 0xDFu8, 0x8Cu8, 0xA1u8, 0x89u8, 0x0Du8, 0xBFu8, 0xE6u8, 0x42u8, 0x68u8, 0x41u8, 0x99u8, 0x2Du8, 0x0Fu8, 0xB0u8, 0x54u8, 0xBBu8, 0x16u8 -]); +]; -const RCON: RCon = RCon([ +const RCON: RCon = [ 0x8du8, 0x01u8, 0x02u8, 0x04u8, 0x08u8, 0x10u8, 0x20u8, 0x40u8, 0x80u8, 0x1bu8, 0x36u8, 0x6cu8, 0xd8u8, 0xabu8, 0x4du8 -]); +]; fn index_u32 (s : u128, i : usize) -> u32 { ((s >> i * 32) % (1_u128 << 32)) as u32 @@ -49,10 +50,10 @@ fn rebuild_u128(s0 : u32, s1 : u32, s2 : u32, s3 : u32) -> u128 { } fn subword(v : u32) -> u32 { - rebuild_u32(SBOX[index_u8(v, 0)], - SBOX[index_u8(v, 1)], - SBOX[index_u8(v, 2)], - SBOX[index_u8(v, 3)]) + rebuild_u32(SBOX[index_u8(v, 0) as usize], + SBOX[index_u8(v, 1) as usize], + SBOX[index_u8(v, 2) as usize], + SBOX[index_u8(v, 3) as usize]) } fn rotword(v: u32) -> u32 { @@ -114,19 +115,19 @@ fn key_expand(rcon: u8, rkey: u128, temp2: u128) -> (u128, u128) { (rkey, temp2) } -type KeyList = Seq; +type KeyList = [u128;12]; fn keys_expand(key : u128) -> KeyList { - let mut rkeys : KeyList = KeyList::new(0); + let mut rkeys : KeyList = [0;12]; let mut key = key; - rkeys = rkeys.push(&key); + rkeys[0] = key; let mut temp2 : u128 = 0; for round in 1 .. 11 { let rcon = RCON[round]; let (key_temp, temp2_temp) = key_expand(rcon, key, temp2); key = key_temp; temp2 = temp2_temp; - rkeys = rkeys.push(&key); + rkeys[round] = key; } rkeys } diff --git a/basic/proofs/ssprove/extraction/Example.v b/basic/proofs/ssprove/extraction/Example.v new file mode 100644 index 0000000..7ada48b --- /dev/null +++ b/basic/proofs/ssprove/extraction/Example.v @@ -0,0 +1,35 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +(* From Jasmin Require Import word. *) + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +(*Not implemented yet? todo(item)*) + +Equations test (_ : both 'unit) : both int8 := + test _ := + letb acc := ret_both (0 : int8) in + letb acc := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (1 : int8)) (f_end := ret_both (10 : int8)))) acc (fun acc => fun i => + acc .+ i) in + solve_lift (acc .+ (ret_both (1 : int8))) : both int8. +Fail Next Obligation. diff --git a/bls12-381/proofs/ssprove/extraction/Hacspec_bls12_381.v b/bls12-381/proofs/ssprove/extraction/Hacspec_bls12_381.v index 6ef3cba..15d41b3 100644 --- a/bls12-381/proofs/ssprove/extraction/Hacspec_bls12_381.v +++ b/bls12-381/proofs/ssprove/extraction/Hacspec_bls12_381.v @@ -4,7 +4,7 @@ From Crypt Require Import choice_type Package Prelude. Import PackageNotation. From extructures Require Import ord fset. From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. +(* From Jasmin Require Import word. *) From Coq Require Import ZArith. From Coq Require Import Strings.String. @@ -27,117 +27,117 @@ Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. Require Import Hacspec_lib. Export Hacspec_lib. -Notation "'t_Fp12'" := ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). +Notation "'t_Fp12'" := (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). -Notation "'t_Fp2'" := ((t_Fp × t_Fp)). +Notation "'t_Fp2'" := (t_Fp × t_Fp). -Notation "'t_Fp6'" := (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))). +Notation "'t_Fp6'" := (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). -Notation "'t_G1'" := ((t_Fp × t_Fp × 'bool)). +Notation "'t_G1'" := (t_Fp × t_Fp × 'bool). -Notation "'t_G2'" := (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)). +Notation "'t_G2'" := (t_Fp × t_Fp × t_Fp × t_Fp × 'bool). (*Not implemented yet? todo(item)*) -Equations fp2add {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 ((t_Fp × t_Fp))) (m : both L2 I2 ((t_Fp × t_Fp))) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp)) := +Equations fp2add (n : both (t_Fp × t_Fp)) (m : both (t_Fp × t_Fp)) : both (t_Fp × t_Fp) := fp2add n m := letb '(n1,n2) := n in letb '(m1,m2) := m in - solve_lift (prod_b (n1 .+ m1,n2 .+ m2)) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp)). + solve_lift (prod_b (n1 .+ m1,n2 .+ m2)) : both (t_Fp × t_Fp). Fail Next Obligation. -Equations fp2mul {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 ((t_Fp × t_Fp))) (m : both L2 I2 ((t_Fp × t_Fp))) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp)) := +Equations fp2mul (n : both (t_Fp × t_Fp)) (m : both (t_Fp × t_Fp)) : both (t_Fp × t_Fp) := fp2mul n m := letb '(n1,n2) := n in letb '(m1,m2) := m in letb x1 := (n1 .* m1) .- (n2 .* m2) in letb x2 := (n1 .* m2) .+ (n2 .* m1) in - solve_lift (prod_b (x1,x2)) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp)). + solve_lift (prod_b (x1,x2)) : both (t_Fp × t_Fp). Fail Next Obligation. -Equations fp6add {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) (m : both L2 I2 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))) := +Equations fp6add (n : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) (m : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := fp6add n m := letb '(n1,n2,n3) := n in letb '(m1,m2,m3) := m in - solve_lift (prod_b (fp2add n1 m1,fp2add n2 m2,fp2add n3 m3)) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))). + solve_lift (prod_b (fp2add n1 m1,fp2add n2 m2,fp2add n3 m3)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Equations fp12add {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) (m : both L2 I2 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) : both (L1 :|: L2) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := +Equations fp12add (n : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) (m : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := fp12add n m := letb '(n1,n2) := n in letb '(m1,m2) := m in - solve_lift (prod_b (fp6add n1 m1,fp6add n2 m2)) : both (L1 :|: L2) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). + solve_lift (prod_b (fp6add n1 m1,fp6add n2 m2)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Equations g1 {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both L1 I1 ((t_Fp × t_Fp × 'bool)) := +Equations g1 (_ : both 'unit) : both (t_Fp × t_Fp × 'bool) := g1 _ := - solve_lift (prod_b (impl__Fp__from_hex (ret_both (17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb : chString)),impl__Fp__from_hex (ret_both (08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1 : chString)),ret_both (false : 'bool))) : both L1 I1 ((t_Fp × t_Fp × 'bool)). + solve_lift (prod_b (impl__Fp__from_hex (ret_both (17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb : chString)),impl__Fp__from_hex (ret_both (08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1 : chString)),ret_both (false : 'bool))) : both (t_Fp × t_Fp × 'bool). Fail Next Obligation. -Equations g2 {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)) := +Equations g2 (_ : both 'unit) : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool) := g2 _ := - solve_lift (prod_b (prod_b (impl__Fp__from_hex (ret_both (24aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8 : chString)),impl__Fp__from_hex (ret_both (13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e : chString))),prod_b (impl__Fp__from_hex (ret_both (0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801 : chString)),impl__Fp__from_hex (ret_both (0606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be : chString))),ret_both (false : 'bool))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)). + solve_lift (prod_b (prod_b (impl__Fp__from_hex (ret_both (24aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8 : chString)),impl__Fp__from_hex (ret_both (13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e : chString))),prod_b (impl__Fp__from_hex (ret_both (0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801 : chString)),impl__Fp__from_hex (ret_both (0606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be : chString))),ret_both (false : 'bool))) : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool). Fail Next Obligation. Notation "'t_ArrayFp'" := (nseq int64 6). -Definition ArrayFp {L : {fset Location}} {I : Interface} : both L I (t_ArrayFp) -> both L I (t_ArrayFp) := +Definition ArrayFp : both t_ArrayFp -> both t_ArrayFp := id. Notation "'t_SerializedFp'" := (nseq int8 48). -Definition SerializedFp {L : {fset Location}} {I : Interface} : both L I (t_SerializedFp) -> both L I (t_SerializedFp) := +Definition SerializedFp : both t_SerializedFp -> both t_SerializedFp := id. Notation "'t_Fp'" := (nat_mod 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab). -Definition Fp {L : {fset Location}} {I : Interface} : both L I (t_Fp) -> both L I (t_Fp) := +Definition Fp : both t_Fp -> both t_Fp := id. Notation "'t_Scalar'" := (nat_mod 0x8000000000000000000000000000000000000000000000000000000000000000). -Definition Scalar {L : {fset Location}} {I : Interface} : both L I (t_Scalar) -> both L I (t_Scalar) := +Definition Scalar : both t_Scalar -> both t_Scalar := id. -Equations fp2conjugate {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 ((t_Fp × t_Fp))) : both L1 I1 ((t_Fp × t_Fp)) := +Equations fp2conjugate (n : both (t_Fp × t_Fp)) : both (t_Fp × t_Fp) := fp2conjugate n := letb '(n1,n2) := n in - solve_lift (prod_b (n1,(f_ZERO (ret_both (tt : 'unit))) .- n2)) : both L1 I1 ((t_Fp × t_Fp)). + solve_lift (prod_b (n1,(f_ZERO (ret_both (tt : 'unit))) .- n2)) : both (t_Fp × t_Fp). Fail Next Obligation. -Equations fp2fromfp {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 (t_Fp)) : both L1 I1 ((t_Fp × t_Fp)) := +Equations fp2fromfp (n : both t_Fp) : both (t_Fp × t_Fp) := fp2fromfp n := - solve_lift (prod_b (n,f_ZERO (ret_both (tt : 'unit)))) : both L1 I1 ((t_Fp × t_Fp)). + solve_lift (prod_b (n,f_ZERO (ret_both (tt : 'unit)))) : both (t_Fp × t_Fp). Fail Next Obligation. -Equations fp2inv {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 ((t_Fp × t_Fp))) : both L1 I1 ((t_Fp × t_Fp)) := +Equations fp2inv (n : both (t_Fp × t_Fp)) : both (t_Fp × t_Fp) := fp2inv n := letb '(n1,n2) := n in letb t0 := (n1 .* n1) .+ (n2 .* n2) in letb t1 := impl__Fp__inv t0 in letb x1 := n1 .* t1 in letb x2 := (f_ZERO (ret_both (tt : 'unit))) .- (n2 .* t1) in - solve_lift (prod_b (x1,x2)) : both L1 I1 ((t_Fp × t_Fp)). + solve_lift (prod_b (x1,x2)) : both (t_Fp × t_Fp). Fail Next Obligation. -Equations fp2neg {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 ((t_Fp × t_Fp))) : both L1 I1 ((t_Fp × t_Fp)) := +Equations fp2neg (n : both (t_Fp × t_Fp)) : both (t_Fp × t_Fp) := fp2neg n := letb '(n1,n2) := n in - solve_lift (prod_b ((f_ZERO (ret_both (tt : 'unit))) .- n1,(f_ZERO (ret_both (tt : 'unit))) .- n2)) : both L1 I1 ((t_Fp × t_Fp)). + solve_lift (prod_b ((f_ZERO (ret_both (tt : 'unit))) .- n1,(f_ZERO (ret_both (tt : 'unit))) .- n2)) : both (t_Fp × t_Fp). Fail Next Obligation. -Equations fp2sub {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 ((t_Fp × t_Fp))) (m : both L2 I2 ((t_Fp × t_Fp))) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp)) := +Equations fp2sub (n : both (t_Fp × t_Fp)) (m : both (t_Fp × t_Fp)) : both (t_Fp × t_Fp) := fp2sub n m := - solve_lift (fp2add n (fp2neg m)) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp)). + solve_lift (fp2add n (fp2neg m)) : both (t_Fp × t_Fp). Fail Next Obligation. -Equations fp2zero {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both L1 I1 ((t_Fp × t_Fp)) := +Equations fp2zero (_ : both 'unit) : both (t_Fp × t_Fp) := fp2zero _ := - solve_lift (fp2fromfp (f_ZERO (ret_both (tt : 'unit)))) : both L1 I1 ((t_Fp × t_Fp)). + solve_lift (fp2fromfp (f_ZERO (ret_both (tt : 'unit)))) : both (t_Fp × t_Fp). Fail Next Obligation. -Equations fp6fromfp2 {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 ((t_Fp × t_Fp))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))) := +Equations fp6fromfp2 (n : both (t_Fp × t_Fp)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := fp6fromfp2 n := - solve_lift (prod_b (n,fp2zero (ret_both (tt : 'unit)),fp2zero (ret_both (tt : 'unit)))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))). + solve_lift (prod_b (n,fp2zero (ret_both (tt : 'unit)),fp2zero (ret_both (tt : 'unit)))) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Equations fp6inv {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))) := +Equations fp6inv (n : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := fp6inv n := letb '(n1,n2,n3) := n in letb eps := prod_b (f_ONE (ret_both (tt : 'unit)),f_ONE (ret_both (tt : 'unit))) in @@ -157,10 +157,10 @@ Equations fp6inv {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 (((t_Fp letb x := fp2mul x0 t0 in letb y := fp2mul y0 t0 in letb z := fp2mul z0 t0 in - solve_lift (prod_b (x,y,z)) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))). + solve_lift (prod_b (x,y,z)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Equations fp6mul {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) (m : both L2 I2 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))) := +Equations fp6mul (n : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) (m : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := fp6mul n m := letb '(n1,n2,n3) := n in letb '(m1,m2,m3) := m in @@ -177,27 +177,27 @@ Equations fp6mul {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} letb t4 := fp2mul (fp2add n1 n3) (fp2add m1 m3) in letb t5 := fp2sub (fp2sub t4 t1) t3 in letb z := fp2add t5 t2 in - solve_lift (prod_b (x,y,z)) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))). + solve_lift (prod_b (x,y,z)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Equations fp6neg {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))) := +Equations fp6neg (n : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := fp6neg n := letb '(n1,n2,n3) := n in - solve_lift (prod_b (fp2sub (fp2zero (ret_both (tt : 'unit))) n1,fp2sub (fp2zero (ret_both (tt : 'unit))) n2,fp2sub (fp2zero (ret_both (tt : 'unit))) n3)) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))). + solve_lift (prod_b (fp2sub (fp2zero (ret_both (tt : 'unit))) n1,fp2sub (fp2zero (ret_both (tt : 'unit))) n2,fp2sub (fp2zero (ret_both (tt : 'unit))) n3)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Equations fp12conjugate {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := +Equations fp12conjugate (n : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := fp12conjugate n := letb '(n1,n2) := n in - solve_lift (prod_b (n1,fp6neg n2)) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). + solve_lift (prod_b (n1,fp6neg n2)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Equations fp6sub {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) (m : both L2 I2 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))) := +Equations fp6sub (n : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) (m : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := fp6sub n m := - solve_lift (fp6add n (fp6neg m)) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))). + solve_lift (fp6add n (fp6neg m)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Equations fp12inv {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := +Equations fp12inv (n : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := fp12inv n := letb '(n1,n2) := n in letb gamma := prod_b (fp2zero (ret_both (tt : 'unit)),fp2fromfp (f_ONE (ret_both (tt : 'unit))),fp2zero (ret_both (tt : 'unit))) in @@ -207,10 +207,10 @@ Equations fp12inv {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 ((((t_ letb t2 := fp6inv t1 in letb x := fp6mul n1 t2 in letb y := fp6neg (fp6mul n2 t2) in - solve_lift (prod_b (x,y)) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). + solve_lift (prod_b (x,y)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Equations fp12mul {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) (m : both L2 I2 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) : both (L1 :|: L2) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := +Equations fp12mul (n : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) (m : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := fp12mul n m := letb '(n1,n2) := n in letb '(m1,m2) := m in @@ -220,42 +220,42 @@ Equations fp12mul {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} letb x := fp6add t1 (fp6mul t2 gamma) in letb y := fp6mul (fp6add n1 n2) (fp6add m1 m2) in letb y := fp6sub (fp6sub y t1) t2 in - solve_lift (prod_b (x,y)) : both (L1 :|: L2) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). + solve_lift (prod_b (x,y)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Equations fp6zero {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))) := +Equations fp6zero (_ : both 'unit) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := fp6zero _ := - solve_lift (fp6fromfp2 (fp2zero (ret_both (tt : 'unit)))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))). + solve_lift (fp6fromfp2 (fp2zero (ret_both (tt : 'unit)))) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Equations fp12fromfp6 {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := +Equations fp12fromfp6 (n : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := fp12fromfp6 n := - solve_lift (prod_b (n,fp6zero (ret_both (tt : 'unit)))) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). + solve_lift (prod_b (n,fp6zero (ret_both (tt : 'unit)))) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Equations fp12neg {L1 : {fset Location}} {I1 : Interface} (n : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := +Equations fp12neg (n : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := fp12neg n := letb '(n1,n2) := n in - solve_lift (prod_b (fp6sub (fp6zero (ret_both (tt : 'unit))) n1,fp6sub (fp6zero (ret_both (tt : 'unit))) n2)) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). + solve_lift (prod_b (fp6sub (fp6zero (ret_both (tt : 'unit))) n1,fp6sub (fp6zero (ret_both (tt : 'unit))) n2)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Equations fp12sub {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) (m : both L2 I2 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) : both (L1 :|: L2) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := +Equations fp12sub (n : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) (m : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := fp12sub n m := - solve_lift (fp12add n (fp12neg m)) : both (L1 :|: L2) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). + solve_lift (fp12add n (fp12neg m)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Equations fp12zero {L1 : {fset Location}} {I1 : Interface} (_ : both L1 I1 ('unit)) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := +Equations fp12zero (_ : both 'unit) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := fp12zero _ := - solve_lift (fp12fromfp6 (fp6zero (ret_both (tt : 'unit)))) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). + solve_lift (fp12fromfp6 (fp6zero (ret_both (tt : 'unit)))) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Equations g1neg {L1 : {fset Location}} {I1 : Interface} (p : both L1 I1 ((t_Fp × t_Fp × 'bool))) : both L1 I1 ((t_Fp × t_Fp × 'bool)) := +Equations g1neg (p : both (t_Fp × t_Fp × 'bool)) : both (t_Fp × t_Fp × 'bool) := g1neg p := letb '(x,y,inf) := p in - solve_lift (prod_b (x,(f_ZERO (ret_both (tt : 'unit))) .- y,inf)) : both L1 I1 ((t_Fp × t_Fp × 'bool)). + solve_lift (prod_b (x,(f_ZERO (ret_both (tt : 'unit))) .- y,inf)) : both (t_Fp × t_Fp × 'bool). Fail Next Obligation. -Equations g2add_a {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (p : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) (q : both L2 I2 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)) := +Equations g2add_a (p : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool)) (q : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool)) : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool) := g2add_a p q := letb '(x1,y1,_) := p in letb '(x2,y2,_) := q in @@ -268,10 +268,10 @@ Equations g2add_a {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} letb t1 := fp2sub x1 x3 in letb t2 := fp2mul xovery t1 in letb y3 := fp2sub t2 y1 in - solve_lift (prod_b (x3,y3,ret_both (false : 'bool))) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)). + solve_lift (prod_b (x3,y3,ret_both (false : 'bool))) : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool). Fail Next Obligation. -Equations g2double_a {L1 : {fset Location}} {I1 : Interface} (p : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)) := +Equations g2double_a (p : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool)) : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool) := g2double_a p := letb '(x1,y1,_) := p in letb x12 := fp2mul x1 x1 in @@ -284,18 +284,18 @@ Equations g2double_a {L1 : {fset Location}} {I1 : Interface} (p : both L1 I1 ((( letb t1 := fp2sub x1 x3 in letb t2 := fp2mul xovery t1 in letb y3 := fp2sub t2 y1 in - solve_lift (prod_b (x3,y3,ret_both (false : 'bool))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)). + solve_lift (prod_b (x3,y3,ret_both (false : 'bool))) : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool). Fail Next Obligation. -Equations g2double {L1 : {fset Location}} {I1 : Interface} (p : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)) := +Equations g2double (p : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool)) : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool) := g2double p := letb '(v__x1,y1,inf1) := p in solve_lift (ifb andb (y1 <> (fp2zero (ret_both (tt : 'unit)))) (not inf1) then g2double_a p - else prod_b (fp2zero (ret_both (tt : 'unit)),fp2zero (ret_both (tt : 'unit)),ret_both (true : 'bool))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)). + else prod_b (fp2zero (ret_both (tt : 'unit)),fp2zero (ret_both (tt : 'unit)),ret_both (true : 'bool))) : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool). Fail Next Obligation. -Equations g2add {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (p : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) (q : both L2 I2 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)) := +Equations g2add (p : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool)) (q : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool)) : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool) := g2add p q := letb '(x1,y1,inf1) := p in letb '(x2,y2,inf2) := q in @@ -307,24 +307,24 @@ Equations g2add {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} { then g2double p else ifb not (andb (x1 =.? x2) (y1 =.? (fp2neg y2))) then g2add_a p q - else prod_b (fp2zero (ret_both (tt : 'unit)),fp2zero (ret_both (tt : 'unit)),ret_both (true : 'bool))) : both (L1 :|: L2) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)). + else prod_b (fp2zero (ret_both (tt : 'unit)),fp2zero (ret_both (tt : 'unit)),ret_both (true : 'bool))) : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool). Fail Next Obligation. -Equations g2neg {L1 : {fset Location}} {I1 : Interface} (p : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)) := +Equations g2neg (p : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool)) : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool) := g2neg p := letb '(x,y,inf) := p in - solve_lift (prod_b (x,fp2neg y,inf)) : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)). + solve_lift (prod_b (x,fp2neg y,inf)) : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool). Fail Next Obligation. -Equations twist {L1 : {fset Location}} {I1 : Interface} (p : both L1 I1 ((t_Fp × t_Fp × 'bool))) : both L1 I1 (((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))) × (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) := +Equations twist (p : both (t_Fp × t_Fp × 'bool)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := twist p := letb '(p0,p1,_) := p in letb x := prod_b (prod_b (fp2zero (ret_both (tt : 'unit)),fp2fromfp p0,fp2zero (ret_both (tt : 'unit))),fp6zero (ret_both (tt : 'unit))) in letb y := prod_b (fp6zero (ret_both (tt : 'unit)),prod_b (fp2zero (ret_both (tt : 'unit)),fp2fromfp p1,fp2zero (ret_both (tt : 'unit)))) in - solve_lift (prod_b (x,y)) : both L1 I1 (((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))) × (((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))). + solve_lift (prod_b (x,y)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Equations line_add_p {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (r : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) (q : both L2 I2 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) (p : both L3 I3 ((t_Fp × t_Fp × 'bool))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := +Equations line_add_p (r : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool)) (q : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool)) (p : both (t_Fp × t_Fp × 'bool)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := line_add_p r q p := letb '(r0,r1,_) := r in letb '(q0,q1,_) := q in @@ -333,10 +333,10 @@ Equations line_add_p {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset L letb a := fp12fromfp6 (fp6fromfp2 a) in letb b := fp12fromfp6 (fp6fromfp2 b) in letb '(x,y) := twist p in - solve_lift (fp12neg (fp12sub (fp12sub y (fp12mul a x)) b)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). + solve_lift (fp12neg (fp12sub (fp12sub y (fp12mul a x)) b)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Equations line_double_p {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (r : both L1 I1 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) (p : both L2 I2 ((t_Fp × t_Fp × 'bool))) : both (L1 :|: L2) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := +Equations line_double_p (r : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool)) (p : both (t_Fp × t_Fp × 'bool)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := line_double_p r p := letb '(r0,r1,_) := r in letb a := fp2mul (fp2fromfp (impl__Fp__from_literal (ret_both (3 : int128)))) (fp2mul r0 r0) in @@ -345,10 +345,10 @@ Equations line_double_p {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Inte letb a := fp12fromfp6 (fp6fromfp2 a) in letb b := fp12fromfp6 (fp6fromfp2 b) in letb '(x,y) := twist p in - solve_lift (fp12neg (fp12sub (fp12sub y (fp12mul a x)) b)) : both (L1 :|: L2) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). + solve_lift (fp12neg (fp12sub (fp12sub y (fp12mul a x)) b)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Equations g1add_a {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (p : both L1 I1 ((t_Fp × t_Fp × 'bool))) (q : both L2 I2 ((t_Fp × t_Fp × 'bool))) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp × 'bool)) := +Equations g1add_a (p : both (t_Fp × t_Fp × 'bool)) (q : both (t_Fp × t_Fp × 'bool)) : both (t_Fp × t_Fp × 'bool) := g1add_a p q := letb '(x1,y1,_) := p in letb '(x2,y2,_) := q in @@ -357,28 +357,28 @@ Equations g1add_a {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} letb xovery := y_diff .* (impl__Fp__inv x_diff) in letb x3 := ((f_exp xovery (ret_both (2 : int32))) .- x1) .- x2 in letb y3 := (xovery .* (x1 .- x3)) .- y1 in - solve_lift (prod_b (x3,y3,ret_both (false : 'bool))) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp × 'bool)). + solve_lift (prod_b (x3,y3,ret_both (false : 'bool))) : both (t_Fp × t_Fp × 'bool). Fail Next Obligation. -Equations g1double_a {L1 : {fset Location}} {I1 : Interface} (p : both L1 I1 ((t_Fp × t_Fp × 'bool))) : both L1 I1 ((t_Fp × t_Fp × 'bool)) := +Equations g1double_a (p : both (t_Fp × t_Fp × 'bool)) : both (t_Fp × t_Fp × 'bool) := g1double_a p := letb '(x1,y1,_) := p in letb x12 := f_exp x1 (ret_both (2 : int32)) in letb xovery := ((impl__Fp__from_literal (ret_both (3 : int128))) .* x12) .* (impl__Fp__inv ((f_TWO (ret_both (tt : 'unit))) .* y1)) in letb x3 := (f_exp xovery (ret_both (2 : int32))) .- ((f_TWO (ret_both (tt : 'unit))) .* x1) in letb y3 := (xovery .* (x1 .- x3)) .- y1 in - solve_lift (prod_b (x3,y3,ret_both (false : 'bool))) : both L1 I1 ((t_Fp × t_Fp × 'bool)). + solve_lift (prod_b (x3,y3,ret_both (false : 'bool))) : both (t_Fp × t_Fp × 'bool). Fail Next Obligation. -Equations g1double {L1 : {fset Location}} {I1 : Interface} (p : both L1 I1 ((t_Fp × t_Fp × 'bool))) : both L1 I1 ((t_Fp × t_Fp × 'bool)) := +Equations g1double (p : both (t_Fp × t_Fp × 'bool)) : both (t_Fp × t_Fp × 'bool) := g1double p := letb '(v__x1,y1,inf1) := p in solve_lift (ifb andb (y1 <> (f_ZERO (ret_both (tt : 'unit)))) (not inf1) then g1double_a p - else prod_b (f_ZERO (ret_both (tt : 'unit)),f_ZERO (ret_both (tt : 'unit)),ret_both (true : 'bool))) : both L1 I1 ((t_Fp × t_Fp × 'bool)). + else prod_b (f_ZERO (ret_both (tt : 'unit)),f_ZERO (ret_both (tt : 'unit)),ret_both (true : 'bool))) : both (t_Fp × t_Fp × 'bool). Fail Next Obligation. -Equations g1add {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (p : both L1 I1 ((t_Fp × t_Fp × 'bool))) (q : both L2 I2 ((t_Fp × t_Fp × 'bool))) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp × 'bool)) := +Equations g1add (p : both (t_Fp × t_Fp × 'bool)) (q : both (t_Fp × t_Fp × 'bool)) : both (t_Fp × t_Fp × 'bool) := g1add p q := letb '(x1,y1,inf1) := p in letb '(x2,y2,inf2) := q in @@ -390,55 +390,46 @@ Equations g1add {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} { then g1double p else ifb not (andb (x1 =.? x2) (y1 =.? ((f_ZERO (ret_both (tt : 'unit))) .- y2))) then g1add_a p q - else prod_b (f_ZERO (ret_both (tt : 'unit)),f_ZERO (ret_both (tt : 'unit)),ret_both (true : 'bool))) : both (L1 :|: L2) (I1 :|: I2) ((t_Fp × t_Fp × 'bool)). + else prod_b (f_ZERO (ret_both (tt : 'unit)),f_ZERO (ret_both (tt : 'unit)),ret_both (true : 'bool))) : both (t_Fp × t_Fp × 'bool). Fail Next Obligation. -Definition c_loc : Location := - ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)));0%nat). -Equations fp12exp {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (n : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) (k : both L2 I2 (t_Scalar)) : both (L1 :|: L2 :|: fset [c_loc]) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := +Equations fp12exp (n : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) (k : both t_Scalar) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := fp12exp n k := - letb c loc(c_loc) := fp12fromfp6 (fp6fromfp2 (fp2fromfp (f_ONE (ret_both (tt : 'unit))))) in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := ret_both (256 : uint_size)))) (fun i => - ssp (fun _ => - letb _ := assign todo(term) in - solve_lift (ifb impl__Scalar__bit k ((ret_both (255 : uint_size)) .- i) - then letb _ := assign todo(term) in - ret_both (tt : 'unit) - else ()) : both (*1*)(L1:|:L2:|:fset [c_loc]) (I1:|:I2) ('unit))) (ret_both (tt : 'unit)) in - solve_lift c : both (L1 :|: L2 :|: fset [c_loc]) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). -Fail Next Obligation. - -Definition t_loc : Location := - ((t_Fp × t_Fp × 'bool);1%nat). -Equations g1mul {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (m : both L1 I1 (t_Scalar)) (p : both L2 I2 ((t_Fp × t_Fp × 'bool))) : both (L1 :|: L2 :|: fset [t_loc]) (I1 :|: I2) ((t_Fp × t_Fp × 'bool)) := + letb c := fp12fromfp6 (fp6fromfp2 (fp2fromfp (f_ONE (ret_both (tt : 'unit))))) in + letb c := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := ret_both (256 : uint_size)))) c (fun c => fun i => + letb c := fp12mul c c in + ifb impl__Scalar__bit k ((ret_both (255 : uint_size)) .- i) + then letb c := fp12mul c n in + c + else c) in + solve_lift c : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). +Fail Next Obligation. + +Equations g1mul (m : both t_Scalar) (p : both (t_Fp × t_Fp × 'bool)) : both (t_Fp × t_Fp × 'bool) := g1mul m p := - letb t loc(t_loc) := prod_b (f_ZERO (ret_both (tt : 'unit)),f_ZERO (ret_both (tt : 'unit)),ret_both (true : 'bool)) in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := ret_both (256 : uint_size)))) (fun i => - ssp (fun _ => - letb _ := assign todo(term) in - solve_lift (ifb impl__Scalar__bit m ((ret_both (255 : uint_size)) .- i) - then letb _ := assign todo(term) in - ret_both (tt : 'unit) - else ()) : both (*1*)(L1:|:L2:|:fset [t_loc]) (I1:|:I2) ('unit))) (ret_both (tt : 'unit)) in - solve_lift t : both (L1 :|: L2 :|: fset [t_loc]) (I1 :|: I2) ((t_Fp × t_Fp × 'bool)). -Fail Next Obligation. - -Definition t_loc : Location := - (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool);2%nat). -Equations g2mul {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (m : both L1 I1 (t_Scalar)) (p : both L2 I2 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) : both (L1 :|: L2 :|: fset [t_loc]) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)) := + letb t := prod_b (f_ZERO (ret_both (tt : 'unit)),f_ZERO (ret_both (tt : 'unit)),ret_both (true : 'bool)) in + letb t := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := ret_both (256 : uint_size)))) t (fun t => fun i => + letb t := g1double t in + ifb impl__Scalar__bit m ((ret_both (255 : uint_size)) .- i) + then letb t := g1add t p in + t + else t) in + solve_lift t : both (t_Fp × t_Fp × 'bool). +Fail Next Obligation. + +Equations g2mul (m : both t_Scalar) (p : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool)) : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool) := g2mul m p := - letb t loc(t_loc) := prod_b (fp2zero (ret_both (tt : 'unit)),fp2zero (ret_both (tt : 'unit)),ret_both (true : 'bool)) in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := ret_both (256 : uint_size)))) (fun i => - ssp (fun _ => - letb _ := assign todo(term) in - solve_lift (ifb impl__Scalar__bit m ((ret_both (255 : uint_size)) .- i) - then letb _ := assign todo(term) in - ret_both (tt : 'unit) - else ()) : both (*1*)(L1:|:L2:|:fset [t_loc]) (I1:|:I2) ('unit))) (ret_both (tt : 'unit)) in - solve_lift t : both (L1 :|: L2 :|: fset [t_loc]) (I1 :|: I2) (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool)). -Fail Next Obligation. - -Equations frobenius {L1 : {fset Location}} {I1 : Interface} (f : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := + letb t := prod_b (fp2zero (ret_both (tt : 'unit)),fp2zero (ret_both (tt : 'unit)),ret_both (true : 'bool)) in + letb t := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := ret_both (256 : uint_size)))) t (fun t => fun i => + letb t := g2double t in + ifb impl__Scalar__bit m ((ret_both (255 : uint_size)) .- i) + then letb t := g2add t p in + t + else t) in + solve_lift t : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool). +Fail Next Obligation. + +Equations frobenius (f : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := frobenius f := letb '((g0,g1,g2),(h0,h1,h2)) := f in letb t1 := fp2conjugate g0 in @@ -473,10 +464,10 @@ Equations frobenius {L1 : {fset Location}} {I1 : Interface} (f : both L1 I1 (((( letb t4 := fp2mul t4 gamma13 in letb t5 := fp2mul t5 gamma14 in letb t6 := fp2mul t6 gamma15 in - solve_lift (prod_b (prod_b (t1,t3,t5),prod_b (t2,t4,t6))) : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). + solve_lift (prod_b (prod_b (t1,t3,t5),prod_b (t2,t4,t6))) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Equations final_exponentiation {L1 : {fset Location}} {I1 : Interface} (f : both L1 I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp))))) : both (L1 :|: fset [c_loc]) I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := +Equations final_exponentiation (f : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := final_exponentiation f := letb fp6 := fp12conjugate f in letb finv := fp12inv f in @@ -510,28 +501,23 @@ Equations final_exponentiation {L1 : {fset Location}} {I1 : Interface} (f : both letb t2 := fp12mul t2 f in letb t1 := fp12mul t1 t2 in letb t2 := frobenius t3 in - solve_lift (fp12mul t1 t2) : both (L1 :|: fset [c_loc]) I1 ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). + solve_lift (fp12mul t1 t2) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. -Definition f_loc : Location := - ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)));3%nat). -Definition r_loc : Location := - (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool);4%nat). -Equations pairing {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (p : both L1 I1 ((t_Fp × t_Fp × 'bool))) (q : both L2 I2 (((t_Fp × t_Fp) × (t_Fp × t_Fp) × 'bool))) : both (L1 :|: L2 :|: fset [f_loc;r_loc;c_loc]) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))) := +Equations pairing (p : both (t_Fp × t_Fp × 'bool)) (q : both (t_Fp × t_Fp × t_Fp × t_Fp × 'bool)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp) := pairing p q := letb t := impl__Scalar__from_literal (ret_both (15132376222941642752 : int128)) in - letb r loc(r_loc) := q in - letb f loc(f_loc) := fp12fromfp6 (fp6fromfp2 (fp2fromfp (f_ONE (ret_both (tt : 'unit))))) in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (1 : uint_size)) (f_end := ret_both (64 : uint_size)))) (fun i => - ssp (fun _ => - letb lrr := line_double_p r p in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - solve_lift (ifb impl__Scalar__bit t (((ret_both (64 : uint_size)) .- i) .- (ret_both (1 : uint_size))) - then letb lrq := line_add_p r q p in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - ret_both (tt : 'unit) - else ()) : both (*2*)(L1:|:L2:|:fset [f_loc;r_loc]) (I1:|:I2) ('unit))) (ret_both (tt : 'unit)) in - solve_lift (final_exponentiation (fp12conjugate f)) : both (L1 :|: L2 :|: fset [f_loc;r_loc;c_loc]) (I1 :|: I2) ((((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)) × ((t_Fp × t_Fp) × (t_Fp × t_Fp) × (t_Fp × t_Fp)))). + letb r := q in + letb f := fp12fromfp6 (fp6fromfp2 (fp2fromfp (f_ONE (ret_both (tt : 'unit))))) in + letb '(f,r) := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (1 : uint_size)) (f_end := ret_both (64 : uint_size)))) (prod_b (f,r)) (fun '(f,r) => fun i => + letb lrr := line_double_p r p in + letb r := g2double r in + letb f := fp12mul (fp12mul f f) lrr in + ifb impl__Scalar__bit t (((ret_both (64 : uint_size)) .- i) .- (ret_both (1 : uint_size))) + then letb lrq := line_add_p r q p in + letb r := g2add r q in + letb f := fp12mul f lrq in + prod_b (f,r) + else prod_b (f,r)) in + solve_lift (final_exponentiation (fp12conjugate f)) : both (t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp × t_Fp). Fail Next Obligation. diff --git a/chacha20/proofs/ssprove/extraction/Hacspec_chacha20.v b/chacha20/proofs/ssprove/extraction/Hacspec_chacha20.v new file mode 100644 index 0000000..57a032d --- /dev/null +++ b/chacha20/proofs/ssprove/extraction/Hacspec_chacha20.v @@ -0,0 +1,167 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +(* From Jasmin Require Import word. *) + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_lib. +Export Hacspec_lib. + +(*Not implemented yet? todo(item)*) + +Notation "'t_Constants'" := (nseq int32 4). +Definition Constants : both t_Constants -> both t_Constants := + id. + +Notation "'t_State'" := (nseq int32 16). +Definition State : both t_State -> both t_State := + id. + +Notation "'t_Block'" := (nseq int8 64). +Definition Block : both t_Block -> both t_Block := + id. + +Notation "'t_ChaChaIV'" := (nseq int8 12). +Definition ChaChaIV : both t_ChaChaIV -> both t_ChaChaIV := + id. + +Notation "'t_ChaChaKey'" := (nseq int8 32). +Definition ChaChaKey : both t_ChaChaKey -> both t_ChaChaKey := + id. + +Equations chacha20_line (a : both uint_size) (b : both uint_size) (d : both uint_size) (s : both uint_size) (m : both t_State) : both t_State := + chacha20_line a b d s m := + letb state := m in + letb state := update_at_usize state a ((state.a[a]) .+ (state.a[b])) in + letb state := update_at_usize state d ((state.a[d]) .^ (state.a[a])) in + letb state := update_at_usize state d (impl__U32__rotate_left (state.a[d]) s) in + solve_lift state : both t_State. +Fail Next Obligation. + +Equations chacha20_quarter_round (a : both uint_size) (b : both uint_size) (c : both uint_size) (d : both uint_size) (state : both t_State) : both t_State := + chacha20_quarter_round a b c d state := + letb state := chacha20_line a b d (ret_both (16 : uint_size)) state in + letb state := chacha20_line c d b (ret_both (12 : uint_size)) state in + letb state := chacha20_line a b d (ret_both (8 : uint_size)) state in + solve_lift (chacha20_line c d b (ret_both (7 : uint_size)) state) : both t_State. +Fail Next Obligation. + +Equations chacha20_double_round (state : both t_State) : both t_State := + chacha20_double_round state := + letb state := chacha20_quarter_round (ret_both (0 : uint_size)) (ret_both (4 : uint_size)) (ret_both (8 : uint_size)) (ret_both (12 : uint_size)) state in + letb state := chacha20_quarter_round (ret_both (1 : uint_size)) (ret_both (5 : uint_size)) (ret_both (9 : uint_size)) (ret_both (13 : uint_size)) state in + letb state := chacha20_quarter_round (ret_both (2 : uint_size)) (ret_both (6 : uint_size)) (ret_both (10 : uint_size)) (ret_both (14 : uint_size)) state in + letb state := chacha20_quarter_round (ret_both (3 : uint_size)) (ret_both (7 : uint_size)) (ret_both (11 : uint_size)) (ret_both (15 : uint_size)) state in + letb state := chacha20_quarter_round (ret_both (0 : uint_size)) (ret_both (5 : uint_size)) (ret_both (10 : uint_size)) (ret_both (15 : uint_size)) state in + letb state := chacha20_quarter_round (ret_both (1 : uint_size)) (ret_both (6 : uint_size)) (ret_both (11 : uint_size)) (ret_both (12 : uint_size)) state in + letb state := chacha20_quarter_round (ret_both (2 : uint_size)) (ret_both (7 : uint_size)) (ret_both (8 : uint_size)) (ret_both (13 : uint_size)) state in + solve_lift (chacha20_quarter_round (ret_both (3 : uint_size)) (ret_both (4 : uint_size)) (ret_both (9 : uint_size)) (ret_both (14 : uint_size)) state) : both t_State. +Fail Next Obligation. + +Equations chacha20_rounds (state : both t_State) : both t_State := + chacha20_rounds state := + letb st := state in + letb st := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := ret_both (10 : int32)))) st (fun st => fun v__i => + chacha20_double_round st) in + solve_lift st : both t_State. +Fail Next Obligation. + +Equations chacha20_core (ctr : both t_U32) (st0 : both t_State) : both t_State := + chacha20_core ctr st0 := + letb state := st0 in + letb state := update_at state (ret_both (12 : int32)) ((state.a[(ret_both (12 : int32))]) .+ ctr) in + letb k := chacha20_rounds state in + solve_lift (k .+ state) : both t_State. +Fail Next Obligation. + +Equations chacha20_constants_init (_ : both 'unit) : both t_Constants := + chacha20_constants_init _ := + letb constants := impl__Constants__new (ret_both (tt : 'unit)) in + letb constants := update_at constants (ret_both (0 : int32)) (U32 (ret_both (1634760805 : int32))) in + letb constants := update_at constants (ret_both (1 : int32)) (U32 (ret_both (857760878 : int32))) in + letb constants := update_at constants (ret_both (2 : int32)) (U32 (ret_both (2036477234 : int32))) in + letb constants := update_at constants (ret_both (3 : int32)) (U32 (ret_both (1797285236 : int32))) in + solve_lift constants : both t_Constants. +Fail Next Obligation. + +Equations chacha20_init (key : both t_ChaChaKey) (iv : both t_ChaChaIV) (ctr : both t_U32) : both t_State := + chacha20_init key iv ctr := + letb st := impl__State__new (ret_both (tt : 'unit)) in + letb st := f_update st (ret_both (0 : uint_size)) (chacha20_constants_init (ret_both (tt : 'unit))) in + letb st := f_update st (ret_both (4 : uint_size)) (impl__ChaChaKey__to_le_U32s key) in + letb st := update_at st (ret_both (12 : int32)) ctr in + letb st := f_update st (ret_both (13 : uint_size)) (impl__ChaChaIV__to_le_U32s iv) in + solve_lift st : both t_State. +Fail Next Obligation. + +Equations chacha20_encrypt_block (st0 : both t_State) (ctr : both t_U32) (plain : both t_Block) : both t_Block := + chacha20_encrypt_block st0 ctr plain := + letb st := chacha20_core ctr st0 in + letb pl := impl__State__from_seq (impl__Block__to_le_U32s plain) in + letb st := pl .^ st in + solve_lift (impl__Block__from_seq (impl__State__to_le_bytes st)) : both t_Block. +Fail Next Obligation. + +Equations chacha20_encrypt_last (st0 : both t_State) (ctr : both t_U32) (plain : both (t_Seq t_U8)) : both (t_Seq t_U8) := + chacha20_encrypt_last st0 ctr plain := + letb b := impl__Block__new (ret_both (tt : 'unit)) in + letb b := f_update b (ret_both (0 : uint_size)) plain in + letb b := chacha20_encrypt_block st0 ctr b in + solve_lift (impl__Block__slice b (ret_both (0 : uint_size)) (impl_41__len plain)) : both (t_Seq t_U8). +Fail Next Obligation. + +Equations chacha20_key_block (state : both t_State) : both t_Block := + chacha20_key_block state := + letb state := chacha20_core (U32 (ret_both (0 : int32))) state in + solve_lift (impl__Block__from_seq (impl__State__to_le_bytes state)) : both t_Block. +Fail Next Obligation. + +Equations chacha20_key_block0 (key : both t_ChaChaKey) (iv : both t_ChaChaIV) : both t_Block := + chacha20_key_block0 key iv := + letb state := chacha20_init key iv (U32 (ret_both (0 : int32))) in + solve_lift (chacha20_key_block state) : both t_Block. +Fail Next Obligation. + +Equations chacha20_update (st0 : both t_State) (m : both (t_Seq t_U8)) : both (t_Seq t_U8) := + chacha20_update st0 m := + letb blocks_out := impl_41__new (impl_41__len m) in + letb n_blocks := impl_41__num_exact_chunks m (ret_both (64 : uint_size)) in + letb blocks_out := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n_blocks))) blocks_out (fun blocks_out => fun i => + letb msg_block := impl_41__get_exact_chunk m (ret_both (64 : uint_size)) i in + letb b := chacha20_encrypt_block st0 (U32 (cast_int (WS2 := _) i)) (impl__Block__from_seq msg_block) in + letb blocks_out := impl_41__set_exact_chunk blocks_out (ret_both (64 : uint_size)) i b in + blocks_out) in + letb last_block := impl_41__get_remainder_chunk m (ret_both (64 : uint_size)) in + letb blocks_out := ifb (impl_41__len last_block) <> (ret_both (0 : uint_size)) + then letb b := chacha20_encrypt_last st0 (U32 (cast_int (WS2 := _) n_blocks)) last_block in + letb blocks_out := impl_41__set_chunk blocks_out (ret_both (64 : uint_size)) n_blocks b in + blocks_out + else blocks_out in + solve_lift blocks_out : both (t_Seq t_U8). +Fail Next Obligation. + +Equations chacha20 (key : both t_ChaChaKey) (iv : both t_ChaChaIV) (ctr : both int32) (m : both (t_Seq t_U8)) : both (t_Seq t_U8) := + chacha20 key iv ctr m := + letb state := chacha20_init key iv (U32 ctr) in + solve_lift (chacha20_update state m) : both (t_Seq t_U8). +Fail Next Obligation. diff --git a/curve25519/proofs/ssprove/extraction/Hacspec_curve25519.v b/curve25519/proofs/ssprove/extraction/Hacspec_curve25519.v new file mode 100644 index 0000000..c5882cc --- /dev/null +++ b/curve25519/proofs/ssprove/extraction/Hacspec_curve25519.v @@ -0,0 +1,137 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +(* From Jasmin Require Import word. *) + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_lib. +Export Hacspec_lib. + +Notation "'t_Point'" := (t_X25519FieldElement × t_X25519FieldElement). + +(*Not implemented yet? todo(item)*) + +Equations point_add_and_double (q : both (t_X25519FieldElement × t_X25519FieldElement)) (np : both (t_X25519FieldElement × t_X25519FieldElement × t_X25519FieldElement × t_X25519FieldElement)) : both (t_X25519FieldElement × t_X25519FieldElement × t_X25519FieldElement × t_X25519FieldElement) := + point_add_and_double q np := + letb '(nq,nqp1) := np in + letb '(x_1_,v__z_1_) := q in + letb '(x_2_,z_2_) := nq in + letb '(x_3_,z_3_) := nqp1 in + letb a := x_2_ .+ z_2_ in + letb aa := impl__X25519FieldElement__pow a (ret_both (2 : int128)) in + letb b := x_2_ .- z_2_ in + letb bb := b .* b in + letb e := aa .- bb in + letb c := x_3_ .+ z_3_ in + letb d := x_3_ .- z_3_ in + letb da := d .* a in + letb cb := c .* b in + letb x_3_ := impl__X25519FieldElement__pow (da .+ cb) (ret_both (2 : int128)) in + letb z_3_ := x_1_ .* (impl__X25519FieldElement__pow (da .- cb) (ret_both (2 : int128))) in + letb x_2_ := aa .* bb in + letb e121665 := impl__X25519FieldElement__from_literal (ret_both (121665 : int128)) in + letb z_2_ := e .* (aa .+ (e121665 .* e)) in + solve_lift (prod_b (prod_b (x_2_,z_2_),prod_b (x_3_,z_3_))) : both (t_X25519FieldElement × t_X25519FieldElement × t_X25519FieldElement × t_X25519FieldElement). +Fail Next Obligation. + +Equations swap (x : both (t_X25519FieldElement × t_X25519FieldElement × t_X25519FieldElement × t_X25519FieldElement)) : both (t_X25519FieldElement × t_X25519FieldElement × t_X25519FieldElement × t_X25519FieldElement) := + swap x := + letb '(x0,x1) := x in + solve_lift (prod_b (x1,x0)) : both (t_X25519FieldElement × t_X25519FieldElement × t_X25519FieldElement × t_X25519FieldElement). +Fail Next Obligation. + +Notation "'t_X25519SerializedPoint'" := (nseq int8 32). +Definition X25519SerializedPoint : both t_X25519SerializedPoint -> both t_X25519SerializedPoint := + id. + +Notation "'t_X25519SerializedScalar'" := (nseq int8 32). +Definition X25519SerializedScalar : both t_X25519SerializedScalar -> both t_X25519SerializedScalar := + id. + +Notation "'t_X25519FieldElement'" := (nat_mod 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed). +Definition X25519FieldElement : both t_X25519FieldElement -> both t_X25519FieldElement := + id. + +Notation "'t_Scalar'" := (nat_mod 0x8000000000000000000000000000000000000000000000000000000000000000). +Definition Scalar : both t_Scalar -> both t_Scalar := + id. + +Equations montgomery_ladder (k : both t_Scalar) (init : both (t_X25519FieldElement × t_X25519FieldElement)) : both (t_X25519FieldElement × t_X25519FieldElement) := + montgomery_ladder k init := + letb inf := prod_b (impl__X25519FieldElement__from_literal (ret_both (1 : int128)),impl__X25519FieldElement__from_literal (ret_both (0 : int128))) in + letb (acc : t_X25519FieldElement × t_X25519FieldElement × t_X25519FieldElement × t_X25519FieldElement) := prod_b (inf,init) in + letb acc := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := ret_both (256 : uint_size)))) acc (fun acc => fun i => + ifb impl__Scalar__bit k ((ret_both (255 : uint_size)) .- i) + then letb acc := swap acc in + letb acc := point_add_and_double init acc in + letb acc := swap acc in + acc + else letb acc := point_add_and_double init acc in + acc) in + letb '(out,_) := acc in + solve_lift out : both (t_X25519FieldElement × t_X25519FieldElement). +Fail Next Obligation. + +Equations encode_point (p : both (t_X25519FieldElement × t_X25519FieldElement)) : both t_X25519SerializedPoint := + encode_point p := + letb '(x,y) := p in + letb b := x .* (impl__X25519FieldElement__inv y) in + solve_lift (f_update_start (impl__X25519SerializedPoint__new (ret_both (tt : 'unit))) (impl__X25519FieldElement__to_byte_seq_le b)) : both t_X25519SerializedPoint. +Fail Next Obligation. + +Equations decode_point (u : both t_X25519SerializedPoint) : both (t_X25519FieldElement × t_X25519FieldElement) := + decode_point u := + letb u___ := u in + letb u___ := update_at u___ (ret_both (31 : int32)) ((u___.a[(ret_both (31 : int32))]) .& (U8 (ret_both (127 : int8)))) in + solve_lift (prod_b (impl__X25519FieldElement__from_byte_seq_le u___,impl__X25519FieldElement__from_literal (ret_both (1 : int128)))) : both (t_X25519FieldElement × t_X25519FieldElement). +Fail Next Obligation. + +Equations mask_scalar (s : both t_X25519SerializedScalar) : both t_X25519SerializedScalar := + mask_scalar s := + letb k := s in + letb k := update_at k (ret_both (0 : int32)) ((k.a[(ret_both (0 : int32))]) .& (U8 (ret_both (248 : int8)))) in + letb k := update_at k (ret_both (31 : int32)) ((k.a[(ret_both (31 : int32))]) .& (U8 (ret_both (127 : int8)))) in + letb k := update_at k (ret_both (31 : int32)) ((k.a[(ret_both (31 : int32))]) .| (U8 (ret_both (64 : int8)))) in + solve_lift k : both t_X25519SerializedScalar. +Fail Next Obligation. + +Equations decode_scalar (s : both t_X25519SerializedScalar) : both t_Scalar := + decode_scalar s := + letb k := mask_scalar s in + solve_lift (impl__Scalar__from_byte_seq_le k) : both t_Scalar. +Fail Next Obligation. + +Equations x25519_scalarmult (s : both t_X25519SerializedScalar) (p : both t_X25519SerializedPoint) : both t_X25519SerializedPoint := + x25519_scalarmult s p := + letb s___ := decode_scalar s in + letb p___ := decode_point p in + letb r := montgomery_ladder s___ p___ in + solve_lift (encode_point r) : both t_X25519SerializedPoint. +Fail Next Obligation. + +Equations x25519_secret_to_public (s : both t_X25519SerializedScalar) : both t_X25519SerializedPoint := + x25519_secret_to_public s := + letb base := impl__X25519SerializedPoint__new (ret_both (tt : 'unit)) in + letb base := update_at base (ret_both (0 : int32)) (U8 (ret_both (9 : int8))) in + solve_lift (x25519_scalarmult s base) : both t_X25519SerializedPoint. +Fail Next Obligation. diff --git a/edwards25519/proofs/ssprove/extraction/Hacspec_edwards25519.v b/edwards25519/proofs/ssprove/extraction/Hacspec_edwards25519.v new file mode 100644 index 0000000..b42a957 --- /dev/null +++ b/edwards25519/proofs/ssprove/extraction/Hacspec_edwards25519.v @@ -0,0 +1,525 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +(* From Jasmin Require Import word. *) + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_lib. +Export Hacspec_lib. + +Require Import Hacspec_sha512. +Export Hacspec_sha512. + +Notation "'t_EdPoint'" := (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement). + +Definition t_Error : choice_type := + ('unit ∐ 'unit ∐ 'unit ∐ 'unit ∐ 'unit ∐ 'unit). +Notation "'Error_InvalidPublickey_case'" := (inl (inl (inl (inl (inl tt))))) (at level 100). +Equations Error_InvalidPublickey : both t_Error := + Error_InvalidPublickey := + solve_lift (ret_both (inl (inl (inl (inl (inl (tt : 'unit))))) : t_Error)) : both t_Error. +Fail Next Obligation. +Notation "'Error_InvalidSignature_case'" := (inl (inl (inl (inl (inr tt))))) (at level 100). +Equations Error_InvalidSignature : both t_Error := + Error_InvalidSignature := + solve_lift (ret_both (inl (inl (inl (inl (inr (tt : 'unit))))) : t_Error)) : both t_Error. +Fail Next Obligation. +Notation "'Error_InvalidS_case'" := (inl (inl (inl (inr tt)))) (at level 100). +Equations Error_InvalidS : both t_Error := + Error_InvalidS := + solve_lift (ret_both (inl (inl (inl (inr (tt : 'unit)))) : t_Error)) : both t_Error. +Fail Next Obligation. +Notation "'Error_InvalidR_case'" := (inl (inl (inr tt))) (at level 100). +Equations Error_InvalidR : both t_Error := + Error_InvalidR := + solve_lift (ret_both (inl (inl (inr (tt : 'unit))) : t_Error)) : both t_Error. +Fail Next Obligation. +Notation "'Error_SmallOrderPoint_case'" := (inl (inr tt)) (at level 100). +Equations Error_SmallOrderPoint : both t_Error := + Error_SmallOrderPoint := + solve_lift (ret_both (inl (inr (tt : 'unit)) : t_Error)) : both t_Error. +Fail Next Obligation. +Notation "'Error_NotEnoughRandomness_case'" := (inr tt) (at level 100). +Equations Error_NotEnoughRandomness : both t_Error := + Error_NotEnoughRandomness := + solve_lift (ret_both (inr (tt : 'unit) : t_Error)) : both t_Error. +Fail Next Obligation. + +Notation "'t_VerifyResult'" := (t_Result 'unit t_Error). + +(*Not implemented yet? todo(item)*) + +Equations point_eq (p : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement)) (q : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement)) : both 'bool := + point_eq p q := + letb '(x1,y1,z1,_) := p in + letb '(x2,y2,z2,_) := q in + solve_lift (andb ((x1 .* z2) =.? (x2 .* z1)) ((y1 .* z2) =.? (y2 .* z1))) : both 'bool. +Fail Next Obligation. + +Notation "'t_CompressedEdPoint'" := (nseq int8 32). +Definition CompressedEdPoint : both t_CompressedEdPoint -> both t_CompressedEdPoint := + id. + +Notation "'t_PublicKey'" := t_CompressedEdPoint. + +Notation "'t_SerializedScalar'" := (nseq int8 32). +Definition SerializedScalar : both t_SerializedScalar -> both t_SerializedScalar := + id. + +Notation "'t_SecretKey'" := t_SerializedScalar. + +Notation "'t_Signature'" := (nseq int8 64). +Definition Signature : both t_Signature -> both t_Signature := + id. + +Notation "'t_BigInteger'" := (nat_mod 0x8000000000000000000000000000000080000000000000000000000000000000). +Definition BigInteger : both t_BigInteger -> both t_BigInteger := + id. + +Notation "'t_BigScalar'" := (nat_mod 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed). +Definition BigScalar : both t_BigScalar -> both t_BigScalar := + id. + +Notation "'t_Ed25519FieldElement'" := (nat_mod 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed). +Definition Ed25519FieldElement : both t_Ed25519FieldElement -> both t_Ed25519FieldElement := + id. + +Notation "'t_Scalar'" := (nat_mod 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed). +Definition Scalar : both t_Scalar -> both t_Scalar := + id. + +Equations point_normalize (q : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement)) : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement) := + point_normalize q := + letb '(qx,qy,qz,_) := q in + letb px := qx .* (impl__Ed25519FieldElement__inv qz) in + letb py := qy .* (impl__Ed25519FieldElement__inv qz) in + letb pz := f_ONE (ret_both (tt : 'unit)) in + letb pt := px .* py in + solve_lift (prod_b (px,py,pz,pt)) : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement). +Fail Next Obligation. + +Equations point_identity (_ : both 'unit) : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement) := + point_identity _ := + solve_lift (prod_b (f_ZERO (ret_both (tt : 'unit)),f_ONE (ret_both (tt : 'unit)),f_ONE (ret_both (tt : 'unit)),f_ZERO (ret_both (tt : 'unit)))) : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement). +Fail Next Obligation. + +Equations point_neg (p : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement)) : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement) := + point_neg p := + letb '(x,y,z,t) := p in + solve_lift (prod_b ((f_ZERO (ret_both (tt : 'unit))) .- x,y,z,(f_ZERO (ret_both (tt : 'unit))) .- t)) : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement). +Fail Next Obligation. + +Equations v_BASE : both t_CompressedEdPoint := + v_BASE := + CompressedEdPoint (array_from_list [U8 (solve_lift (ret_both (88 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8))); + U8 (solve_lift (ret_both (102 : int8)))]) : both t_CompressedEdPoint. +Fail Next Obligation. + +Equations v_CONSTANT_D : both t_SerializedScalar := + v_CONSTANT_D := + SerializedScalar (array_from_list [U8 (solve_lift (ret_both (163 : int8))); + U8 (solve_lift (ret_both (120 : int8))); + U8 (solve_lift (ret_both (89 : int8))); + U8 (solve_lift (ret_both (19 : int8))); + U8 (solve_lift (ret_both (202 : int8))); + U8 (solve_lift (ret_both (77 : int8))); + U8 (solve_lift (ret_both (235 : int8))); + U8 (solve_lift (ret_both (117 : int8))); + U8 (solve_lift (ret_both (171 : int8))); + U8 (solve_lift (ret_both (216 : int8))); + U8 (solve_lift (ret_both (65 : int8))); + U8 (solve_lift (ret_both (65 : int8))); + U8 (solve_lift (ret_both (77 : int8))); + U8 (solve_lift (ret_both (10 : int8))); + U8 (solve_lift (ret_both (112 : int8))); + U8 (solve_lift (ret_both (0 : int8))); + U8 (solve_lift (ret_both (152 : int8))); + U8 (solve_lift (ret_both (232 : int8))); + U8 (solve_lift (ret_both (121 : int8))); + U8 (solve_lift (ret_both (119 : int8))); + U8 (solve_lift (ret_both (121 : int8))); + U8 (solve_lift (ret_both (64 : int8))); + U8 (solve_lift (ret_both (199 : int8))); + U8 (solve_lift (ret_both (140 : int8))); + U8 (solve_lift (ret_both (115 : int8))); + U8 (solve_lift (ret_both (254 : int8))); + U8 (solve_lift (ret_both (111 : int8))); + U8 (solve_lift (ret_both (43 : int8))); + U8 (solve_lift (ret_both (238 : int8))); + U8 (solve_lift (ret_both (108 : int8))); + U8 (solve_lift (ret_both (3 : int8))); + U8 (solve_lift (ret_both (82 : int8)))]) : both t_SerializedScalar. +Fail Next Obligation. + +Equations v_CONSTANT_L : both t_SerializedScalar := + v_CONSTANT_L := + SerializedScalar (array_from_list [U8 (solve_lift (ret_both (237 : int8))); + U8 (solve_lift (ret_both (211 : int8))); + U8 (solve_lift (ret_both (245 : int8))); + U8 (solve_lift (ret_both (92 : int8))); + U8 (solve_lift (ret_both (26 : int8))); + U8 (solve_lift (ret_both (99 : int8))); + U8 (solve_lift (ret_both (18 : int8))); + U8 (solve_lift (ret_both (88 : int8))); + U8 (solve_lift (ret_both (214 : int8))); + U8 (solve_lift (ret_both (156 : int8))); + U8 (solve_lift (ret_both (247 : int8))); + U8 (solve_lift (ret_both (162 : int8))); + U8 (solve_lift (ret_both (222 : int8))); + U8 (solve_lift (ret_both (249 : int8))); + U8 (solve_lift (ret_both (222 : int8))); + U8 (solve_lift (ret_both (20 : int8))); + U8 (solve_lift (ret_both (0 : int8))); + U8 (solve_lift (ret_both (0 : int8))); + U8 (solve_lift (ret_both (0 : int8))); + U8 (solve_lift (ret_both (0 : int8))); + U8 (solve_lift (ret_both (0 : int8))); + U8 (solve_lift (ret_both (0 : int8))); + U8 (solve_lift (ret_both (0 : int8))); + U8 (solve_lift (ret_both (0 : int8))); + U8 (solve_lift (ret_both (0 : int8))); + U8 (solve_lift (ret_both (0 : int8))); + U8 (solve_lift (ret_both (0 : int8))); + U8 (solve_lift (ret_both (0 : int8))); + U8 (solve_lift (ret_both (0 : int8))); + U8 (solve_lift (ret_both (0 : int8))); + U8 (solve_lift (ret_both (0 : int8))); + U8 (solve_lift (ret_both (16 : int8)))]) : both t_SerializedScalar. +Fail Next Obligation. + +Equations v_CONSTANT_P : both t_SerializedScalar := + v_CONSTANT_P := + SerializedScalar (array_from_list [U8 (solve_lift (ret_both (237 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (127 : int8)))]) : both t_SerializedScalar. +Fail Next Obligation. + +Equations v_CONSTANT_P1_4_ : both t_SerializedScalar := + v_CONSTANT_P1_4_ := + SerializedScalar (array_from_list [U8 (solve_lift (ret_both (251 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (31 : int8)))]) : both t_SerializedScalar. +Fail Next Obligation. + +Equations v_CONSTANT_P3_8_ : both t_SerializedScalar := + v_CONSTANT_P3_8_ := + SerializedScalar (array_from_list [U8 (solve_lift (ret_both (254 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (255 : int8))); + U8 (solve_lift (ret_both (15 : int8)))]) : both t_SerializedScalar. +Fail Next Obligation. + +Equations check_canonical_point (x : both t_CompressedEdPoint) : both 'bool := + check_canonical_point x := + letb x := update_at x (ret_both (31 : int32)) ((x.a[(ret_both (31 : int32))]) .& (U8 (ret_both (127 : int8)))) in + letb x := impl__BigInteger__from_byte_seq_le x in + solve_lift (x <.? (impl__BigInteger__from_byte_seq_le v_CONSTANT_P)) : both 'bool. +Fail Next Obligation. + +Equations check_canonical_scalar (s : both t_SerializedScalar) : both 'bool := + check_canonical_scalar s := + solve_lift (ifb (impl__U8__declassify ((s.a[(ret_both (31 : uint_size))]) .& (U8 (ret_both (224 : int8))))) <> (ret_both (0 : int8)) + then ret_both (false : 'bool) + else (impl__BigInteger__from_byte_seq_le s) <.? (impl__BigInteger__from_byte_seq_le v_CONSTANT_L)) : both 'bool. +Fail Next Obligation. + +Equations is_negative (x : both t_Ed25519FieldElement) : both t_U8 := + is_negative x := + solve_lift (ifb impl__Ed25519FieldElement__bit x (ret_both (0 : uint_size)) + then U8 (ret_both (1 : int8)) + else U8 (ret_both (0 : int8))) : both t_U8. +Fail Next Obligation. + +Equations compress (p : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement)) : both t_CompressedEdPoint := + compress p := + letb '(x,y,z,_) := p in + letb z_inv := impl__Ed25519FieldElement__inv z in + letb x := x .* z_inv in + letb y := y .* z_inv in + letb (s : t_Seq t_U8) := impl__Ed25519FieldElement__to_byte_seq_le y in + letb s := update_at s (ret_both (31 : int32)) ((s.a[(ret_both (31 : int32))]) .^ ((is_negative x) shift_left (ret_both (7 : uint_size)))) in + solve_lift (impl__CompressedEdPoint__from_slice s (ret_both (0 : uint_size)) (ret_both (32 : uint_size))) : both t_CompressedEdPoint. +Fail Next Obligation. + +Equations encode (p : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement)) : both (t_Seq t_U8) := + encode p := + letb '(x,y,z,_) := p in + letb z_inv := impl__Ed25519FieldElement__inv z in + letb x := x .* z_inv in + letb y := y .* z_inv in + letb (s : t_Seq t_U8) := impl__Ed25519FieldElement__to_byte_seq_le y in + letb s := update_at s (ret_both (31 : int32)) ((s.a[(ret_both (31 : int32))]) .^ ((is_negative x) shift_left (ret_both (7 : uint_size)))) in + solve_lift s : both (t_Seq t_U8). +Fail Next Obligation. + +Equations point_add (p : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement)) (q : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement)) : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement) := + point_add p q := + letb d_c := impl__Ed25519FieldElement__from_byte_seq_le v_CONSTANT_D in + letb two := f_TWO (ret_both (tt : 'unit)) in + letb '(x1,y1,z1,t1) := p in + letb '(x2,y2,z2,t2) := q in + letb a := (y1 .- x1) .* (y2 .- x2) in + letb b := (y1 .+ x1) .* (y2 .+ x2) in + letb c := ((t1 .* two) .* d_c) .* t2 in + letb d := (z1 .* two) .* z2 in + letb e := b .- a in + letb f := d .- c in + letb g := d .+ c in + letb h := b .+ a in + letb x3 := e .* f in + letb y3 := g .* h in + letb t3 := e .* h in + letb z3 := f .* g in + solve_lift (prod_b (x3,y3,z3,t3)) : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement). +Fail Next Obligation. + +Equations point_mul (s : both t_Scalar) (p : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement)) : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement) := + point_mul s p := + letb p := p in + letb q := point_identity (ret_both (tt : 'unit)) in + letb '(p,q) := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := ret_both (256 : uint_size)))) (prod_b (p,q)) (fun '(p,q) => fun i => + letb q := ifb impl__Scalar__bit s i + then letb q := point_add q p in + q + else q in + letb p := point_add p p in + prod_b (p,q)) in + solve_lift q : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement). +Fail Next Obligation. + +Equations point_mul_by_cofactor (p : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement)) : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement) := + point_mul_by_cofactor p := + letb p2 := point_add p p in + letb p4 := point_add p2 p2 in + solve_lift (point_add p4 p4) : both (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement). +Fail Next Obligation. + +Equations secret_expand (sk : both t_SerializedScalar) : both (t_SerializedScalar × t_SerializedScalar) := + secret_expand sk := + letb h := sha512 (impl_41__from_slice sk (ret_both (0 : uint_size)) (ret_both (32 : uint_size))) in + letb h_d := impl__SerializedScalar__from_slice h (ret_both (32 : uint_size)) (ret_both (32 : uint_size)) in + letb s := impl__SerializedScalar__from_slice h (ret_both (0 : uint_size)) (ret_both (32 : uint_size)) in + letb s := update_at s (ret_both (0 : int32)) ((s.a[(ret_both (0 : int32))]) .& (U8 (ret_both (248 : int8)))) in + letb s := update_at s (ret_both (31 : int32)) ((s.a[(ret_both (31 : int32))]) .& (U8 (ret_both (127 : int8)))) in + letb s := update_at s (ret_both (31 : int32)) ((s.a[(ret_both (31 : int32))]) .| (U8 (ret_both (64 : int8)))) in + solve_lift (prod_b (s,h_d)) : both (t_SerializedScalar × t_SerializedScalar). +Fail Next Obligation. + +Equations sqrt (a : both t_Ed25519FieldElement) : both (t_Option t_Ed25519FieldElement) := + sqrt a := + letb p3_8_ := impl__Ed25519FieldElement__from_byte_seq_le v_CONSTANT_P3_8_ in + letb p1_4_ := impl__Ed25519FieldElement__from_byte_seq_le v_CONSTANT_P1_4_ in + letb x_c := f_pow_self a p3_8_ in + letb (result : t_Option t_Ed25519FieldElement) := Option_None in + letb result := ifb (x_c .* x_c) =.? a + then letb result := Option_Some x_c in + result + else result in + letb result := ifb (x_c .* x_c) =.? ((f_ZERO (ret_both (tt : 'unit))) .- a) + then letb x := (f_pow_self (f_TWO (ret_both (tt : 'unit))) p1_4_) .* x_c in + letb result := Option_Some x in + result + else result in + solve_lift result : both (t_Option t_Ed25519FieldElement). +Fail Next Obligation. + +Equations decompress (q : both t_CompressedEdPoint) : both (t_Option (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement)) := + decompress q := + solve_lift (run (letb d := impl__Ed25519FieldElement__from_byte_seq_le v_CONSTANT_D in + letb x_s := ((q.a[(ret_both (31 : uint_size))]) .& (U8 (ret_both (128 : int8)))) shift_right (ret_both (7 : uint_size)) in + letb y_s := q in + letb y_s := update_at y_s (ret_both (31 : int32)) ((y_s.a[(ret_both (31 : int32))]) .& (U8 (ret_both (127 : int8)))) in + letm[choice_typeMonad.option_bind_code] _ := ifb not (check_canonical_point y_s) + then letm[choice_typeMonad.option_bind_code] _ := Option_None in + Option_Some (ret_both (tt : 'unit)) + else Option_Some (ret_both (tt : 'unit)) in + letb y := impl__Ed25519FieldElement__from_byte_seq_le y_s in + letb z := f_ONE (ret_both (tt : 'unit)) in + letb yy := y .* y in + letb u := yy .- z in + letb v := (d .* yy) .+ z in + letb xx := u .* (impl__Ed25519FieldElement__inv v) in + letm[choice_typeMonad.option_bind_code] x := sqrt xx in + letb x_r := is_negative x in + letm[choice_typeMonad.option_bind_code] _ := ifb andb (x =.? (f_ZERO (ret_both (tt : 'unit)))) ((impl__U8__declassify x_s) =.? (ret_both (1 : int8))) + then letm[choice_typeMonad.option_bind_code] _ := Option_None in + Option_Some (ret_both (tt : 'unit)) + else Option_Some (ret_both (tt : 'unit)) in + Option_Some (letb x := ifb (impl__U8__declassify x_r) <> (impl__U8__declassify x_s) + then letb x := (f_ZERO (ret_both (tt : 'unit))) .- x in + x + else x in + Option_Some (prod_b (x,y,z,x .* y))))) : both (t_Option (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement)). +Fail Next Obligation. + +Equations decode (q_s : both (t_Seq t_U8)) : both (t_Option (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement)) := + decode q_s := + letb q := impl__CompressedEdPoint__from_slice q_s (ret_both (0 : uint_size)) (ret_both (32 : uint_size)) in + solve_lift (decompress q) : both (t_Option (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement)). +Fail Next Obligation. + +Equations decompress_non_canonical (p : both t_CompressedEdPoint) : both (t_Option (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement)) := + decompress_non_canonical p := + solve_lift (run (letb d := impl__Ed25519FieldElement__from_byte_seq_le v_CONSTANT_D in + letb x_s := ((p.a[(ret_both (31 : uint_size))]) .& (U8 (ret_both (128 : int8)))) shift_right (ret_both (7 : uint_size)) in + letb y_s := p in + letb y_s := update_at y_s (ret_both (31 : int32)) ((y_s.a[(ret_both (31 : int32))]) .& (U8 (ret_both (127 : int8)))) in + letb y := impl__Ed25519FieldElement__from_byte_seq_le y_s in + letb z := f_ONE (ret_both (tt : 'unit)) in + letb yy := y .* y in + letb u := yy .- z in + letb v := (d .* yy) .+ z in + letb xx := u .* (impl__Ed25519FieldElement__inv v) in + letm[choice_typeMonad.option_bind_code] x := sqrt xx in + Option_Some (letb x_r := is_negative x in + letb x := ifb (impl__U8__declassify x_r) <> (impl__U8__declassify x_s) + then letb x := (f_ZERO (ret_both (tt : 'unit))) .- x in + x + else x in + Option_Some (prod_b (x,y,z,x .* y))))) : both (t_Option (t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement × t_Ed25519FieldElement)). +Fail Next Obligation. + +Equations secret_to_public (sk : both t_SerializedScalar) : both t_CompressedEdPoint := + secret_to_public sk := + letb '(s,_) := secret_expand sk in + letb base := impl__unwrap (decompress v_BASE) in + letb ss := impl__Scalar__from_byte_seq_le s in + letb a := point_mul ss base in + solve_lift (compress a) : both t_CompressedEdPoint. +Fail Next Obligation. diff --git a/gf128/proofs/ssprove/extraction/Hacspec_gf128.v b/gf128/proofs/ssprove/extraction/Hacspec_gf128.v new file mode 100644 index 0000000..eece7a4 --- /dev/null +++ b/gf128/proofs/ssprove/extraction/Hacspec_gf128.v @@ -0,0 +1,121 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +(* From Jasmin Require Import word. *) + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_lib. +Export Hacspec_lib. + +(*Not implemented yet? todo(item)*) + +Equations v_BLOCKSIZE : both uint_size := + v_BLOCKSIZE := + solve_lift (ret_both (16 : uint_size)) : both uint_size. +Fail Next Obligation. + +Notation "'t_Gf128Block'" := (nseq int8 BLOCKSIZE). +Definition Gf128Block : both t_Gf128Block -> both t_Gf128Block := + id. + +Notation "'t_Gf128Key'" := (nseq int8 BLOCKSIZE). +Definition Gf128Key : both t_Gf128Key -> both t_Gf128Key := + id. + +Notation "'t_Gf128Tag'" := (nseq int8 BLOCKSIZE). +Definition Gf128Tag : both t_Gf128Tag -> both t_Gf128Tag := + id. + +Notation "'t_Element'" := t_U128. + +Equations decode (e : both t_U128) : both t_Gf128Block := + decode e := + solve_lift (impl__Gf128Block__from_seq (v_U128_to_be_bytes e)) : both t_Gf128Block. +Fail Next Obligation. + +Equations encode (block : both t_Gf128Block) : both t_U128 := + encode block := + solve_lift (v_U128_from_be_bytes (impl__U128Word__from_seq block)) : both t_U128. +Fail Next Obligation. + +Equations fadd (x : both t_U128) (y : both t_U128) : both t_U128 := + fadd x y := + solve_lift (x .^ y) : both t_U128. +Fail Next Obligation. + +Equations v_IRRED : both t_U128 := + v_IRRED := + U128 (solve_lift (ret_both (299076299051606071403356588563077529600 : int128))) : both t_U128. +Fail Next Obligation. + +Equations fmul (x : both t_U128) (y : both t_U128) : both t_U128 := + fmul x y := + letb (res : t_U128) := U128 (ret_both (0 : int128)) in + letb sh := x in + letb '(res,sh) := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := ret_both (128 : uint_size)))) (prod_b (res,sh)) (fun '(res,sh) => fun i => + letb res := ifb (impl__U128__declassify (y .& ((U128 (ret_both (1 : int128))) shift_left ((ret_both (127 : uint_size)) .- i)))) <> (impl__U128__declassify (U128 (ret_both (0 : int128)))) + then letb res := res .^ sh in + res + else res in + ifb (impl__U128__declassify (sh .& (U128 (ret_both (1 : int128))))) <> (impl__U128__declassify (U128 (ret_both (0 : int128)))) + then letb sh := (sh shift_right (ret_both (1 : uint_size))) .^ v_IRRED in + prod_b (res,sh) + else letb sh := sh shift_right (ret_both (1 : uint_size)) in + prod_b (res,sh)) in + solve_lift res : both t_U128. +Fail Next Obligation. + +Equations update (r : both t_U128) (block : both t_Gf128Block) (acc : both t_U128) : both t_U128 := + update r block acc := + solve_lift (fmul (fadd (encode block) acc) r) : both t_U128. +Fail Next Obligation. + +Equations poly (msg : both (t_Seq t_U8)) (r : both t_U128) : both t_U128 := + poly msg r := + letb l := impl_41__len msg in + letb (n_blocks : uint_size) := l ./ v_BLOCKSIZE in + letb rem := l .% v_BLOCKSIZE in + letb acc := U128 (ret_both (0 : int128)) in + letb acc := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n_blocks))) acc (fun acc => fun i => + letb k := i .* v_BLOCKSIZE in + letb block := impl__Gf128Block__new (ret_both (tt : 'unit)) in + letb block := f_update_start block (impl_41__slice_range msg (Build_t_Range (f_start := k) (f_end := k .+ v_BLOCKSIZE))) in + letb acc := update r block acc in + acc) in + letb acc := ifb rem <> (ret_both (0 : uint_size)) + then letb k := n_blocks .* v_BLOCKSIZE in + letb last_block := impl__Gf128Block__new (ret_both (tt : 'unit)) in + letb last_block := f_update_slice last_block (ret_both (0 : uint_size)) msg k rem in + letb acc := update r last_block acc in + acc + else acc in + solve_lift acc : both t_U128. +Fail Next Obligation. + +Equations gmac (text : both (t_Seq t_U8)) (k : both t_Gf128Key) : both t_Gf128Tag := + gmac text k := + letb s := impl__Gf128Block__new (ret_both (tt : 'unit)) in + letb r := encode (impl__Gf128Block__from_seq k) in + letb a := poly text r in + solve_lift (impl__Gf128Tag__from_seq (decode (fadd a (encode s)))) : both t_Gf128Tag. +Fail Next Obligation. diff --git a/gimli/proofs/ssprove/extraction/Hacspec_gimli.v b/gimli/proofs/ssprove/extraction/Hacspec_gimli.v new file mode 100644 index 0000000..213b403 --- /dev/null +++ b/gimli/proofs/ssprove/extraction/Hacspec_gimli.v @@ -0,0 +1,256 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +(* From Jasmin Require Import word. *) + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_lib. +Export Hacspec_lib. + +(*Not implemented yet? todo(item)*) + +Notation "'t_State'" := (nseq int32 12). +Definition State : both t_State -> both t_State := + id. + +Notation "'t_Block'" := (nseq int8 16). +Definition Block : both t_Block -> both t_Block := + id. + +Notation "'t_Digest'" := (nseq int8 32). +Definition Digest : both t_Digest -> both t_Digest := + id. + +Notation "'t_Key'" := (nseq int8 32). +Definition Key : both t_Key -> both t_Key := + id. + +Notation "'t_Nonce'" := (nseq int8 16). +Definition Nonce : both t_Nonce -> both t_Nonce := + id. + +Notation "'t_Tag'" := (nseq int8 16). +Definition Tag : both t_Tag -> both t_Tag := + id. + +Equations key_to_u32s (key : both t_Key) : both (t_Seq t_U32) := + key_to_u32s key := + letb uints := impl_41__new (ret_both (8 : uint_size)) in + letb uints := update_at uints (ret_both (0 : int32)) (v_U32_from_le_bytes (impl__U32Word__from_slice_range key (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := ret_both (4 : uint_size))))) in + letb uints := update_at uints (ret_both (1 : int32)) (v_U32_from_le_bytes (impl__U32Word__from_slice_range key (Build_t_Range (f_start := ret_both (4 : uint_size)) (f_end := ret_both (8 : uint_size))))) in + letb uints := update_at uints (ret_both (2 : int32)) (v_U32_from_le_bytes (impl__U32Word__from_slice_range key (Build_t_Range (f_start := ret_both (8 : uint_size)) (f_end := ret_both (12 : uint_size))))) in + letb uints := update_at uints (ret_both (3 : int32)) (v_U32_from_le_bytes (impl__U32Word__from_slice_range key (Build_t_Range (f_start := ret_both (12 : uint_size)) (f_end := ret_both (16 : uint_size))))) in + letb uints := update_at uints (ret_both (4 : int32)) (v_U32_from_le_bytes (impl__U32Word__from_slice_range key (Build_t_Range (f_start := ret_both (16 : uint_size)) (f_end := ret_both (20 : uint_size))))) in + letb uints := update_at uints (ret_both (5 : int32)) (v_U32_from_le_bytes (impl__U32Word__from_slice_range key (Build_t_Range (f_start := ret_both (20 : uint_size)) (f_end := ret_both (24 : uint_size))))) in + letb uints := update_at uints (ret_both (6 : int32)) (v_U32_from_le_bytes (impl__U32Word__from_slice_range key (Build_t_Range (f_start := ret_both (24 : uint_size)) (f_end := ret_both (28 : uint_size))))) in + letb uints := update_at uints (ret_both (7 : int32)) (v_U32_from_le_bytes (impl__U32Word__from_slice_range key (Build_t_Range (f_start := ret_both (28 : uint_size)) (f_end := ret_both (32 : uint_size))))) in + solve_lift uints : both (t_Seq t_U32). +Fail Next Obligation. + +Equations nonce_to_u32s (nonce : both t_Nonce) : both (t_Seq t_U32) := + nonce_to_u32s nonce := + letb uints := impl_41__new (ret_both (4 : uint_size)) in + letb uints := update_at uints (ret_both (0 : int32)) (v_U32_from_le_bytes (impl__U32Word__from_slice_range nonce (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := ret_both (4 : uint_size))))) in + letb uints := update_at uints (ret_both (1 : int32)) (v_U32_from_le_bytes (impl__U32Word__from_slice_range nonce (Build_t_Range (f_start := ret_both (4 : uint_size)) (f_end := ret_both (8 : uint_size))))) in + letb uints := update_at uints (ret_both (2 : int32)) (v_U32_from_le_bytes (impl__U32Word__from_slice_range nonce (Build_t_Range (f_start := ret_both (8 : uint_size)) (f_end := ret_both (12 : uint_size))))) in + letb uints := update_at uints (ret_both (3 : int32)) (v_U32_from_le_bytes (impl__U32Word__from_slice_range nonce (Build_t_Range (f_start := ret_both (12 : uint_size)) (f_end := ret_both (16 : uint_size))))) in + solve_lift uints : both (t_Seq t_U32). +Fail Next Obligation. + +Equations swap (s : both t_State) (i : both uint_size) (j : both uint_size) : both t_State := + swap s i j := + letb tmp := s.a[i] in + letb s := update_at_usize s i (s.a[j]) in + letb s := update_at_usize s j tmp in + solve_lift s : both t_State. +Fail Next Obligation. + +Equations gimli_round (s : both t_State) (r : both int32) : both t_State := + gimli_round s r := + letb s := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := ret_both (4 : uint_size)))) s (fun s => fun col => + letb x := impl__U32__rotate_left (s.a[col]) (ret_both (24 : uint_size)) in + letb y := impl__U32__rotate_left (s.a[(col .+ (ret_both (4 : uint_size)))]) (ret_both (9 : uint_size)) in + letb z := s.a[(col .+ (ret_both (8 : uint_size)))] in + letb s := update_at_usize s (col .+ (ret_both (8 : uint_size))) ((x .^ (z shift_left (ret_both (1 : uint_size)))) .^ ((y .& z) shift_left (ret_both (2 : uint_size)))) in + letb s := update_at_usize s (col .+ (ret_both (4 : uint_size))) ((y .^ x) .^ ((x .| z) shift_left (ret_both (1 : uint_size)))) in + letb s := update_at_usize s col ((z .^ y) .^ ((x .& y) shift_left (ret_both (3 : uint_size)))) in + s) in + letb s := ifb (r .& (ret_both (3 : int32))) =.? (ret_both (0 : int32)) + then letb s := swap s (ret_both (0 : uint_size)) (ret_both (1 : uint_size)) in + letb s := swap s (ret_both (2 : uint_size)) (ret_both (3 : uint_size)) in + s + else s in + letb s := ifb (r .& (ret_both (3 : int32))) =.? (ret_both (2 : int32)) + then letb s := swap s (ret_both (0 : uint_size)) (ret_both (2 : uint_size)) in + letb s := swap s (ret_both (1 : uint_size)) (ret_both (3 : uint_size)) in + s + else s in + letb s := ifb (r .& (ret_both (3 : int32))) =.? (ret_both (0 : int32)) + then update_at s (ret_both (0 : int32)) ((s.a[(ret_both (0 : int32))]) .^ ((U32 (ret_both (2654435584 : int32))) .| (U32 r))) + else s in + solve_lift s : both t_State. +Fail Next Obligation. + +Equations gimli (s : both t_State) : both t_State := + gimli s := + letb s := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := ret_both (24 : int32)))) s (fun s => fun rnd => + letb rnd := cast_int (WS2 := _) ((ret_both (24 : int32)) .- rnd) in + letb s := gimli_round s rnd in + s) in + solve_lift s : both t_State. +Fail Next Obligation. + +Equations absorb_block (input_block : both t_Block) (s : both t_State) : both t_State := + absorb_block input_block s := + letb input_bytes := impl__Block__to_le_U32s input_block in + letb s := update_at s (ret_both (0 : int32)) ((s.a[(ret_both (0 : int32))]) .^ (input_bytes.a[(ret_both (0 : int32))])) in + letb s := update_at s (ret_both (1 : int32)) ((s.a[(ret_both (1 : int32))]) .^ (input_bytes.a[(ret_both (1 : int32))])) in + letb s := update_at s (ret_both (2 : int32)) ((s.a[(ret_both (2 : int32))]) .^ (input_bytes.a[(ret_both (2 : int32))])) in + letb s := update_at s (ret_both (3 : int32)) ((s.a[(ret_both (3 : int32))]) .^ (input_bytes.a[(ret_both (3 : int32))])) in + solve_lift (gimli s) : both t_State. +Fail Next Obligation. + +Equations squeeze_block (s : both t_State) : both t_Block := + squeeze_block s := + letb block := impl__Block__new (ret_both (tt : 'unit)) in + letb block := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := ret_both (4 : int32)))) block (fun block => fun i => + letb (s_i : t_U32) := s.a[i] in + letb s_i_bytes := f_to_le_bytes s_i in + letb block := update_at block ((ret_both (4 : int32)) .* i) (s_i_bytes.a[(ret_both (0 : int32))]) in + letb block := update_at block (((ret_both (4 : int32)) .* i) .+ (ret_both (1 : int32))) (s_i_bytes.a[(ret_both (1 : int32))]) in + letb block := update_at block (((ret_both (4 : int32)) .* i) .+ (ret_both (2 : int32))) (s_i_bytes.a[(ret_both (2 : int32))]) in + letb block := update_at block (((ret_both (4 : int32)) .* i) .+ (ret_both (3 : int32))) (s_i_bytes.a[(ret_both (3 : int32))]) in + block) in + solve_lift block : both t_Block. +Fail Next Obligation. + +Equations gimli_hash_state (input : both (t_Seq t_U8)) (s : both t_State) : both t_State := + gimli_hash_state input s := + letb rate := impl__Block__length (ret_both (tt : 'unit)) in + letb chunks := impl_41__num_exact_chunks input rate in + letb s := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := chunks))) s (fun s => fun i => + letb input_block := impl_41__get_exact_chunk input rate i in + letb full_block := impl__Block__from_seq input_block in + letb s := absorb_block full_block s in + s) in + letb input_block := impl_41__get_remainder_chunk input rate in + letb input_block_padded := impl__Block__new (ret_both (tt : 'unit)) in + letb input_block_padded := f_update_start input_block_padded input_block in + letb input_block_padded := update_at_usize input_block_padded (impl_41__len input_block) (U8 (ret_both (1 : int8))) in + letb s := update_at s (ret_both (11 : int32)) ((s.a[(ret_both (11 : int32))]) .^ (U32 (ret_both (16777216 : int32)))) in + letb s := absorb_block input_block_padded s in + solve_lift s : both t_State. +Fail Next Obligation. + +Equations gimli_hash (input_bytes : both (t_Seq t_U8)) : both t_Digest := + gimli_hash input_bytes := + letb s := impl__State__new (ret_both (tt : 'unit)) in + letb s := gimli_hash_state input_bytes s in + letb output := impl__Digest__new (ret_both (tt : 'unit)) in + letb output := f_update_start output (squeeze_block s) in + letb s := gimli s in + solve_lift (f_update output (impl__Block__length (ret_both (tt : 'unit))) (squeeze_block s)) : both t_Digest. +Fail Next Obligation. + +Equations process_ad (ad : both (t_Seq t_U8)) (s : both t_State) : both t_State := + process_ad ad s := + solve_lift (gimli_hash_state ad s) : both t_State. +Fail Next Obligation. + +Equations process_ct (ciphertext : both (t_Seq t_U8)) (s : both t_State) : both (t_State × t_Seq t_U8) := + process_ct ciphertext s := + letb message := impl_41__new (impl_41__len ciphertext) in + letb rate := impl__Block__length (ret_both (tt : 'unit)) in + letb num_chunks := impl_41__num_exact_chunks ciphertext rate in + letb '(message,s) := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := num_chunks))) (prod_b (message,s)) (fun '(message,s) => fun i => + letb key_block := squeeze_block s in + letb ct_block := impl_41__get_exact_chunk ciphertext rate i in + letb ct_block := impl__Block__from_seq ct_block in + letb msg_block := ct_block .^ key_block in + letb message := impl_41__set_exact_chunk message rate i (ct_block .^ key_block) in + letb s := absorb_block msg_block s in + prod_b (message,s)) in + letb key_block := squeeze_block s in + letb ct_final := impl_41__get_remainder_chunk ciphertext rate in + letb block_len := impl_41__len ct_final in + letb ct_block_padded := impl__Block__new (ret_both (tt : 'unit)) in + letb ct_block_padded := f_update_start ct_block_padded ct_final in + letb msg_block := ct_block_padded .^ key_block in + letb message := impl_41__set_chunk message rate num_chunks (impl__Block__slice_range msg_block (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := block_len))) in + letb msg_block := impl__Block__from_slice_range msg_block (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := block_len)) in + letb msg_block := update_at_usize msg_block block_len ((msg_block.a[block_len]) .^ (U8 (ret_both (1 : int8)))) in + letb s := update_at s (ret_both (11 : int32)) ((s.a[(ret_both (11 : int32))]) .^ (U32 (ret_both (16777216 : int32)))) in + letb s := absorb_block msg_block s in + solve_lift (prod_b (s,message)) : both (t_State × t_Seq t_U8). +Fail Next Obligation. + +Equations gimli_aead_decrypt (ciphertext : both (t_Seq t_U8)) (ad : both (t_Seq t_U8)) (tag : both t_Tag) (nonce : both t_Nonce) (key : both t_Key) : both (t_Seq t_U8) := + gimli_aead_decrypt ciphertext ad tag nonce key := + letb s := impl__State__from_seq (impl_41__concat (nonce_to_u32s nonce) (key_to_u32s key)) in + letb s := gimli s in + letb s := process_ad ad s in + letb '(s,message) := process_ct ciphertext s in + letb my_tag := squeeze_block s in + letb my_tag := impl__Tag__from_seq my_tag in + letb out := impl_41__new (ret_both (0 : uint_size)) in + letb out := ifb f_equal my_tag tag + then letb out := message in + out + else out in + solve_lift out : both (t_Seq t_U8). +Fail Next Obligation. + +Equations process_msg (message : both (t_Seq t_U8)) (s : both t_State) : both (t_State × t_Seq t_U8) := + process_msg message s := + letb ciphertext := impl_41__new (impl_41__len message) in + letb rate := impl__Block__length (ret_both (tt : 'unit)) in + letb num_chunks := impl_41__num_exact_chunks message rate in + letb '(ciphertext,s) := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := num_chunks))) (prod_b (ciphertext,s)) (fun '(ciphertext,s) => fun i => + letb key_block := squeeze_block s in + letb msg_block := impl_41__get_exact_chunk message rate i in + letb msg_block := impl__Block__from_seq msg_block in + letb ciphertext := impl_41__set_exact_chunk ciphertext rate i (msg_block .^ key_block) in + letb s := absorb_block msg_block s in + prod_b (ciphertext,s)) in + letb key_block := squeeze_block s in + letb last_block := impl_41__get_remainder_chunk message rate in + letb block_len := impl_41__len last_block in + letb msg_block_padded := impl__Block__new (ret_both (tt : 'unit)) in + letb msg_block_padded := f_update_start msg_block_padded last_block in + letb ciphertext := impl_41__set_chunk ciphertext rate num_chunks (impl__Block__slice_range (msg_block_padded .^ key_block) (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := block_len))) in + letb msg_block_padded := update_at_usize msg_block_padded block_len ((msg_block_padded.a[block_len]) .^ (U8 (ret_both (1 : int8)))) in + letb s := update_at s (ret_both (11 : int32)) ((s.a[(ret_both (11 : int32))]) .^ (U32 (ret_both (16777216 : int32)))) in + letb s := absorb_block msg_block_padded s in + solve_lift (prod_b (s,ciphertext)) : both (t_State × t_Seq t_U8). +Fail Next Obligation. + +Equations gimli_aead_encrypt (message : both (t_Seq t_U8)) (ad : both (t_Seq t_U8)) (nonce : both t_Nonce) (key : both t_Key) : both (t_Seq t_U8 × t_Tag) := + gimli_aead_encrypt message ad nonce key := + letb s := impl__State__from_seq (impl_41__concat (nonce_to_u32s nonce) (key_to_u32s key)) in + letb s := gimli s in + letb s := process_ad ad s in + letb '(s,ciphertext) := process_msg message s in + letb tag := squeeze_block s in + letb tag := impl__Tag__from_seq tag in + solve_lift (prod_b (ciphertext,tag)) : both (t_Seq t_U8 × t_Tag). +Fail Next Obligation. diff --git a/halo2/proofs/ssprove/extraction/Hacspec_halo2.v b/halo2/proofs/ssprove/extraction/Hacspec_halo2.v new file mode 100644 index 0000000..b8defe1 --- /dev/null +++ b/halo2/proofs/ssprove/extraction/Hacspec_halo2.v @@ -0,0 +1,738 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +(* From Jasmin Require Import word. *) + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_lib. +Export Hacspec_lib. + +Require Import Hacspec_pasta. +Export Hacspec_pasta. + +(*Not implemented yet? todo(item)*) + +Equations sigma (i : both uint_size) (sigma_list : both (t_Seq uint_size)) (q : both (t_Seq (t_Seq uint_size))) : both (t_Seq uint_size) := + sigma i sigma_list q := + letb idx := sigma_list.a[i] in + solve_lift (f_clone (q.a[idx])) : both (t_Seq uint_size). +Fail Next Obligation. + +Notation "'t_CRS'" := (t_Seq (t_FpPallas × t_FpPallas × 'bool) × t_FpPallas × t_FpPallas × 'bool). + +Notation "'t_Polyx'" := (t_Seq t_FpVesta). + +Equations gen_zero_polyx (_ : both 'unit) : both (t_Seq t_FpVesta) := + gen_zero_polyx _ := + solve_lift (f_create (ret_both (1 : uint_size))) : both (t_Seq t_FpVesta). +Fail Next Obligation. + +Equations step_15_ (x_3_ : both t_FpVesta) : both t_FpVesta := + step_15_ x_3_ := + solve_lift x_3_ : both t_FpVesta. +Fail Next Obligation. + +Equations step_17_ (x_4_ : both t_FpVesta) : both t_FpVesta := + step_17_ x_4_ := + solve_lift x_4_ : both t_FpVesta. +Fail Next Obligation. + +Equations step_21_ (xi : both t_FpVesta) (z : both t_FpVesta) : both (t_FpVesta × t_FpVesta) := + step_21_ xi z := + solve_lift (prod_b (xi,z)) : both (t_FpVesta × t_FpVesta). +Fail Next Obligation. + +Equations step_22_ (p : both (t_FpPallas × t_FpPallas × 'bool)) (g0 : both (t_FpPallas × t_FpPallas × 'bool)) (s : both (t_FpPallas × t_FpPallas × 'bool)) (v : both t_FpVesta) (xi : both t_FpVesta) : both (t_FpPallas × t_FpPallas × 'bool) := + step_22_ p g0 s v xi := + letb (prod1 : t_FpPallas × t_FpPallas × 'bool) := g1mul_pallas v g0 in + letb (prod1_neg : t_FpPallas × t_FpPallas × 'bool) := g1neg_pallas prod1 in + letb (prod2 : t_FpPallas × t_FpPallas × 'bool) := g1mul_pallas xi s in + letb (lhs_sum : t_FpPallas × t_FpPallas × 'bool) := g1add_pallas p prod1_neg in + letb (p_prime : t_FpPallas × t_FpPallas × 'bool) := g1add_pallas lhs_sum prod2 in + solve_lift p_prime : both (t_FpPallas × t_FpPallas × 'bool). +Fail Next Obligation. + +Equations add_scalar_polyx (p : both (t_Seq t_FpVesta)) (s : both t_FpVesta) : both (t_Seq t_FpVesta) := + add_scalar_polyx p s := + letb res := f_clone p in + letb res := ifb (impl_41__len res) =.? (ret_both (0 : uint_size)) + then letb res := f_create (ret_both (1 : uint_size)) in + res + else res in + letb res := update_at_usize res (f_zero (ret_both (tt : 'unit))) ((res.a[(f_zero (ret_both (tt : 'unit)))]) .+ s) in + solve_lift res : both (t_Seq t_FpVesta). +Fail Next Obligation. + +Equations gen_one_polyx (_ : both 'unit) : both (t_Seq t_FpVesta) := + gen_one_polyx _ := + letb poly := f_create (ret_both (1 : uint_size)) in + letb poly := update_at_usize poly (f_zero (ret_both (tt : 'unit))) (f_ONE (ret_both (tt : 'unit))) in + solve_lift poly : both (t_Seq t_FpVesta). +Fail Next Obligation. + +Equations sub_scalar_polyx (p : both (t_Seq t_FpVesta)) (s : both t_FpVesta) : both (t_Seq t_FpVesta) := + sub_scalar_polyx p s := + letb res := f_clone p in + letb res := ifb (impl_41__len res) =.? (ret_both (0 : uint_size)) + then letb res := f_create (ret_both (1 : uint_size)) in + res + else res in + letb res := update_at_usize res (f_zero (ret_both (tt : 'unit))) ((res.a[(f_zero (ret_both (tt : 'unit)))]) .- s) in + solve_lift res : both (t_Seq t_FpVesta). +Fail Next Obligation. + +Equations check_not_zero_polyx (p : both (t_Seq t_FpVesta)) : both 'bool := + check_not_zero_polyx p := + letb sum := f_ZERO (ret_both (tt : 'unit)) in + letb all_zero := ret_both (false : 'bool) in + letb all_zero := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len p))) all_zero (fun all_zero => fun i => + ifb (p.a[i]) >.? (f_ZERO (ret_both (tt : 'unit))) + then letb all_zero := ret_both (true : 'bool) in + all_zero + else all_zero) in + solve_lift all_zero : both 'bool. +Fail Next Obligation. + +Equations eval_polyx (p : both (t_Seq t_FpVesta)) (x : both t_FpVesta) : both t_FpVesta := + eval_polyx p x := + letb res := f_ZERO (ret_both (tt : 'unit)) in + letb res := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len p))) res (fun res => fun i => + res .+ ((p.a[i]) .* (f_exp x (cast_int (WS2 := _) i)))) in + solve_lift res : both t_FpVesta. +Fail Next Obligation. + +Equations inner_product (u : both (t_Seq t_FpVesta)) (v : both (t_Seq t_FpVesta)) : both t_FpVesta := + inner_product u v := + letb res := f_ZERO (ret_both (tt : 'unit)) in + letb res := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len u))) res (fun res => fun i => + res .+ ((u.a[i]) .* (v.a[i]))) in + solve_lift res : both t_FpVesta. +Fail Next Obligation. + +Equations msm (a : both (t_Seq t_FpVesta)) (g : both (t_Seq (t_FpPallas × t_FpPallas × 'bool))) : both (t_FpPallas × t_FpPallas × 'bool) := + msm a g := + letb (res : t_FpPallas × t_FpPallas × 'bool) := prod_b (f_ZERO (ret_both (tt : 'unit)),f_ZERO (ret_both (tt : 'unit)),ret_both (true : 'bool)) in + letb res := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len a))) res (fun res => fun i => + g1add_pallas res (g1mul_pallas (a.a[i]) (g.a[i]))) in + solve_lift res : both (t_FpPallas × t_FpPallas × 'bool). +Fail Next Obligation. + +Equations calculate_L_or_R (p_part : both (t_Seq t_FpVesta)) (b_part : both (t_Seq t_FpVesta)) (g_part : both (t_Seq (t_FpPallas × t_FpPallas × 'bool))) (z : both t_FpVesta) (v_U : both (t_FpPallas × t_FpPallas × 'bool)) (v_W : both (t_FpPallas × t_FpPallas × 'bool)) (blinding : both t_FpVesta) : both (t_FpPallas × t_FpPallas × 'bool) := + calculate_L_or_R p_part b_part g_part z v_U v_W blinding := + letb (p_g_msm : t_FpPallas × t_FpPallas × 'bool) := msm (f_clone p_part) g_part in + letb (p_b_ip : t_FpVesta) := inner_product p_part b_part in + letb (z_ip : t_FpVesta) := z .* p_b_ip in + letb (z_ip_U : t_FpPallas × t_FpPallas × 'bool) := g1mul_pallas z_ip v_U in + letb (multed_W : t_FpPallas × t_FpPallas × 'bool) := g1mul_pallas blinding v_W in + letb (part_j : t_FpPallas × t_FpPallas × 'bool) := g1add_pallas p_g_msm z_ip_U in + letb part_j := g1add_pallas part_j multed_W in + solve_lift part_j : both (t_FpPallas × t_FpPallas × 'bool). +Fail Next Obligation. + +Equations commit_polyx (crs : both (t_Seq (t_FpPallas × t_FpPallas × 'bool) × t_FpPallas × t_FpPallas × 'bool)) (a : both (t_Seq t_FpVesta)) (blinding : both t_FpVesta) : both (t_FpPallas × t_FpPallas × 'bool) := + commit_polyx crs a blinding := + letb '(v_G,v_W) := crs in + letb '(f1,f2,b) := v_W in + letb (lhs : t_FpPallas × t_FpPallas × 'bool) := msm a (f_clone v_G) in + letb (rhs : t_FpPallas × t_FpPallas × 'bool) := g1mul_pallas blinding (prod_b (f_clone f1,f_clone f2,f_clone b)) in + letb (res : t_FpPallas × t_FpPallas × 'bool) := g1add_pallas lhs rhs in + solve_lift res : both (t_FpPallas × t_FpPallas × 'bool). +Fail Next Obligation. + +Equations mul_scalar_polyx (p : both (t_Seq t_FpVesta)) (s : both t_FpVesta) : both (t_Seq t_FpVesta) := + mul_scalar_polyx p s := + letb res := f_clone p in + letb res := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len res))) res (fun res => fun i => + update_at_usize res i ((p.a[i]) .* s)) in + solve_lift res : both (t_Seq t_FpVesta). +Fail Next Obligation. + +Equations rotate_polyx (p : both (t_Seq t_FpVesta)) (rotation : both t_FpVesta) : both (t_Seq t_FpVesta) := + rotate_polyx p rotation := + letb res := p in + letb res := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len res))) res (fun res => fun i => + letb coef := res.a[i] in + letb rot := impl__FpVesta__pow rotation (cast_int (WS2 := _) i) in + letb res := update_at_usize res i (coef .* rot) in + res) in + solve_lift res : both (t_Seq t_FpVesta). +Fail Next Obligation. + +Equations step_11_ (n_a : both uint_size) (x1 : both t_FpVesta) (x2 : both t_FpVesta) (v_H_prime : both (t_FpPallas × t_FpPallas × 'bool)) (v_R : both (t_FpPallas × t_FpPallas × 'bool)) (a : both (t_Seq (t_FpPallas × t_FpPallas × 'bool))) (q : both (t_Seq (t_Seq uint_size))) (sigma_list : both (t_Seq uint_size)) : both (t_Seq (t_FpPallas × t_FpPallas × 'bool) × t_FpVesta × t_FpVesta) := + step_11_ n_a x1 x2 v_H_prime v_R a q sigma_list := + letb (n_q : uint_size) := impl_41__len q in + letb (qs : t_Seq (t_FpPallas × t_FpPallas × 'bool)) := f_create n_q in + letb qs := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len qs))) qs (fun qs => fun i => + update_at_usize qs i (g1_default_pallas (ret_both (tt : 'unit)))) in + letb qs := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n_a))) qs (fun qs => fun i => + letb (a_i : t_FpPallas × t_FpPallas × 'bool) := a.a[i] in + letb sigma_i := sigma i (f_clone sigma_list) (f_clone q) in + f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len sigma_i))) qs (fun qs => fun k => + letb (j : uint_size) := sigma_i.a[k] in + letb (q_sigma_i : t_FpPallas × t_FpPallas × 'bool) := qs.a[j] in + letb (product : t_FpPallas × t_FpPallas × 'bool) := g1mul_pallas x1 q_sigma_i in + letb qs := update_at_usize qs j (g1add_pallas product a_i) in + qs)) in + letb (x1_squared : t_FpVesta) := x1 .* x1 in + letb (q0 : t_FpPallas × t_FpPallas × 'bool) := qs.a[(f_zero (ret_both (tt : 'unit)))] in + letb (product1 : t_FpPallas × t_FpPallas × 'bool) := g1mul_pallas x1_squared q0 in + letb (product2 : t_FpPallas × t_FpPallas × 'bool) := g1mul_pallas x1 v_H_prime in + letb (sum1 : t_FpPallas × t_FpPallas × 'bool) := g1add_pallas product1 product2 in + letb (final_sum : t_FpPallas × t_FpPallas × 'bool) := g1add_pallas sum1 v_R in + letb qs := update_at_usize qs (f_zero (ret_both (tt : 'unit))) final_sum in + solve_lift (prod_b (qs,x1,x2)) : both (t_Seq (t_FpPallas × t_FpPallas × 'bool) × t_FpVesta × t_FpVesta). +Fail Next Obligation. + +Equations step_16_ (n_q : both uint_size) (x3 : both t_FpVesta) (q_polys : both (t_Seq (t_Seq t_FpVesta))) : both (t_Seq t_FpVesta) := + step_16_ n_q x3 q_polys := + letb (u : t_Seq t_FpVesta) := f_create n_q in + letb u := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n_q))) u (fun u => fun i => + letb (q_i : t_Seq t_FpVesta) := f_clone (q_polys.a[i]) in + letb (u_i : t_FpVesta) := eval_polyx q_i x3 in + letb u := update_at_usize u i u_i in + u) in + solve_lift u : both (t_Seq t_FpVesta). +Fail Next Obligation. + +Equations step_18_ (x : both t_FpVesta) (x1 : both t_FpVesta) (x2 : both t_FpVesta) (x3 : both t_FpVesta) (x4 : both t_FpVesta) (omega : both t_FpVesta) (v_Q_prime : both (t_FpPallas × t_FpPallas × 'bool)) (v_Q : both (t_Seq (t_FpPallas × t_FpPallas × 'bool))) (u : both (t_Seq t_FpVesta)) (r : both (t_Seq (t_Seq t_FpVesta))) (q : both (t_Seq (t_Seq uint_size))) : both (t_FpPallas × t_FpPallas × 'bool × t_FpVesta) := + step_18_ x x1 x2 x3 x4 omega v_Q_prime v_Q u r q := + letb n_q := impl_41__len q in + letb v := f_ZERO (ret_both (tt : 'unit)) in + letb (v_P_sum : t_FpPallas × t_FpPallas × 'bool) := g1_default_pallas (ret_both (tt : 'unit)) in + letb v_P_sum := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n_q))) v_P_sum (fun v_P_sum => fun i => + letb (v_Q_i : t_FpPallas × t_FpPallas × 'bool) := v_Q.a[i] in + letb (term : t_FpPallas × t_FpPallas × 'bool) := g1mul_pallas (impl__FpVesta__pow x4 (cast_int (WS2 := _) ((n_q .- i) .- (ret_both (1 : uint_size))))) v_Q_i in + g1add_pallas v_P_sum term) in + letb (first_term : t_FpPallas × t_FpPallas × 'bool) := g1mul_pallas (impl__FpVesta__pow x4 (cast_int (WS2 := _) n_q)) v_Q_prime in + letb (v_P : t_FpPallas × t_FpPallas × 'bool) := g1add_pallas first_term v_P_sum in + letb (vv_first_sum : t_FpVesta) := f_ZERO (ret_both (tt : 'unit)) in + letb vv_first_sum := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n_q))) vv_first_sum (fun vv_first_sum => fun i => + letb (q_i : t_Seq uint_size) := f_clone (q.a[i]) in + letb (n_e : uint_size) := impl_41__len q_i in + letb (u_i : t_FpVesta) := u.a[i] in + letb (r_i : t_Seq t_FpVesta) := f_clone (r.a[i]) in + letb (r_i_x3 : t_FpVesta) := eval_polyx r_i x3 in + letb (numerator : t_FpVesta) := u_i .- r_i_x3 in + letb (product : t_FpVesta) := f_ONE (ret_both (tt : 'unit)) in + letb product := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n_e))) product (fun product => fun j => + letb (q_i_j : uint_size) := q_i.a[j] in + letb rhs := (impl__FpVesta__pow omega (cast_int (WS2 := _) q_i_j)) .* x in + letb term := x3 .- rhs in + letb product := product .* term in + product) in + letb (sum_term : t_FpVesta) := (impl__FpVesta__pow x2 (cast_int (WS2 := _) ((n_q .- i) .- (ret_both (1 : uint_size))))) .* (numerator ./ product) in + letb vv_first_sum := vv_first_sum .+ sum_term in + vv_first_sum) in + letb vv_first_sum := vv_first_sum .* (impl__FpVesta__pow x4 (cast_int (WS2 := _) n_q)) in + letb (vv_second_sum : t_FpVesta) := f_ZERO (ret_both (tt : 'unit)) in + letb vv_second_sum := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n_q))) vv_second_sum (fun vv_second_sum => fun i => + letb (u_i : t_FpVesta) := u.a[i] in + letb (term : t_FpVesta) := (impl__FpVesta__pow x4 (cast_int (WS2 := _) ((n_q .- (ret_both (1 : uint_size))) .- i))) .* u_i in + letb vv_second_sum := vv_second_sum .+ term in + vv_second_sum) in + letb v := vv_first_sum .+ vv_second_sum in + solve_lift (prod_b (v_P,v)) : both (t_FpPallas × t_FpPallas × 'bool × t_FpVesta). +Fail Next Obligation. + +Equations step_20_ (s : both (t_Seq t_FpVesta)) (crs : both (t_Seq (t_FpPallas × t_FpPallas × 'bool) × t_FpPallas × t_FpPallas × 'bool)) (r : both t_FpVesta) : both (t_FpPallas × t_FpPallas × 'bool × t_FpVesta) := + step_20_ s crs r := + letb (v_S : t_FpPallas × t_FpPallas × 'bool) := commit_polyx crs s r in + solve_lift (prod_b (v_S,r)) : both (t_FpPallas × t_FpPallas × 'bool × t_FpVesta). +Fail Next Obligation. + +Equations step_25_ (p_prime : both (t_Seq t_FpVesta)) (v_L_blinding : both (t_Seq t_FpVesta)) (v_R_blinding : both (t_Seq t_FpVesta)) (p_prime_blind : both t_FpVesta) (u : both (t_Seq t_FpVesta)) : both (t_FpVesta × t_FpVesta) := + step_25_ p_prime v_L_blinding v_R_blinding p_prime_blind u := + letb c := p_prime.a[(f_zero (ret_both (tt : 'unit)))] in + letb (f : t_FpVesta) := p_prime_blind in + letb f := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len v_L_blinding))) f (fun f => fun j => + letb (u_j : t_FpVesta) := u.a[j] in + letb (u_j_inv : t_FpVesta) := impl__FpVesta__inv u_j in + letb (v_L_j_blinding : t_FpVesta) := v_L_blinding.a[j] in + letb (v_R_j_blinding : t_FpVesta) := v_R_blinding.a[j] in + letb f := f .+ (v_L_j_blinding .* u_j_inv) in + letb f := f .+ (v_R_j_blinding .* u_j) in + f) in + solve_lift (prod_b (c,f)) : both (t_FpVesta × t_FpVesta). +Fail Next Obligation. + +Equations step_26_ (u : both (t_Seq t_FpVesta)) (v_L : both (t_Seq (t_FpPallas × t_FpPallas × 'bool))) (v_P_prime : both (t_FpPallas × t_FpPallas × 'bool)) (v_R : both (t_Seq (t_FpPallas × t_FpPallas × 'bool))) (c : both t_FpVesta) (v_G_prime_0_ : both (t_FpPallas × t_FpPallas × 'bool)) (b_0_ : both t_FpVesta) (z : both t_FpVesta) (v_U : both (t_FpPallas × t_FpPallas × 'bool)) (f : both t_FpVesta) (v_W : both (t_FpPallas × t_FpPallas × 'bool)) : both 'bool := + step_26_ u v_L v_P_prime v_R c v_G_prime_0_ b_0_ z v_U f v_W := + letb (first_sum : t_FpPallas × t_FpPallas × 'bool) := g1_default_pallas (ret_both (tt : 'unit)) in + letb first_sum := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len u))) first_sum (fun first_sum => fun j => + letb (u_j_inv : t_FpVesta) := impl__FpVesta__inv (u.a[j]) in + letb (v_L_j : t_FpPallas × t_FpPallas × 'bool) := v_L.a[j] in + letb (prod_j : t_FpPallas × t_FpPallas × 'bool) := g1mul_pallas u_j_inv v_L_j in + letb first_sum := g1add_pallas first_sum prod_j in + first_sum) in + letb (second_sum : t_FpPallas × t_FpPallas × 'bool) := g1_default_pallas (ret_both (tt : 'unit)) in + letb second_sum := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len u))) second_sum (fun second_sum => fun j => + letb (u_j : t_FpVesta) := u.a[j] in + letb (v_R_j : t_FpPallas × t_FpPallas × 'bool) := v_R.a[j] in + letb (prod_j : t_FpPallas × t_FpPallas × 'bool) := g1mul_pallas u_j v_R_j in + letb second_sum := g1add_pallas second_sum prod_j in + second_sum) in + letb (lhs : t_FpPallas × t_FpPallas × 'bool) := g1add_pallas first_sum (g1add_pallas v_P_prime second_sum) in + letb (rhs_term_1_ : t_FpPallas × t_FpPallas × 'bool) := g1mul_pallas c v_G_prime_0_ in + letb (cb_0z : t_FpVesta) := (c .* b_0_) .* z in + letb (rhs_term_2_ : t_FpPallas × t_FpPallas × 'bool) := g1mul_pallas cb_0z v_U in + letb (rhs_term_3_ : t_FpPallas × t_FpPallas × 'bool) := g1mul_pallas f v_W in + letb (rhs : t_FpPallas × t_FpPallas × 'bool) := g1add_pallas rhs_term_1_ (g1add_pallas rhs_term_2_ rhs_term_3_) in + letb (check : 'bool) := lhs =.? rhs in + solve_lift check : both 'bool. +Fail Next Obligation. + +Equations step_6_ (poly_parts : both (t_Seq (t_Seq t_FpVesta))) (crs : both (t_Seq (t_FpPallas × t_FpPallas × 'bool) × t_FpPallas × t_FpPallas × 'bool)) (blindings : both (t_Seq t_FpVesta)) : both (t_Seq (t_FpPallas × t_FpPallas × 'bool)) := + step_6_ poly_parts crs blindings := + letb (commitment_seq : t_Seq (t_FpPallas × t_FpPallas × 'bool)) := f_create (impl_41__len poly_parts) in + letb commitment_seq := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len poly_parts))) commitment_seq (fun commitment_seq => fun i => + letb (commitment : t_FpPallas × t_FpPallas × 'bool) := commit_polyx crs (f_clone (poly_parts.a[i])) (blindings.a[i]) in + letb commitment_seq := update_at_usize commitment_seq i commitment in + commitment_seq) in + solve_lift commitment_seq : both (t_Seq (t_FpPallas × t_FpPallas × 'bool)). +Fail Next Obligation. + +Equations step_7_ (commitment_seq : both (t_Seq (t_FpPallas × t_FpPallas × 'bool))) (x : both t_FpVesta) (n : both uint_size) : both (t_FpPallas × t_FpPallas × 'bool) := + step_7_ commitment_seq x n := + letb (result : t_FpPallas × t_FpPallas × 'bool) := g1_default_pallas (ret_both (tt : 'unit)) in + letb result := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len commitment_seq))) result (fun result => fun i => + letb (power : uint_size) := n .* i in + letb x_raised := impl__FpVesta__pow x (cast_int (WS2 := _) power) in + letb (intemidiate : t_FpPallas × t_FpPallas × 'bool) := g1mul_pallas x_raised (commitment_seq.a[i]) in + letb result := g1add_pallas result intemidiate in + result) in + solve_lift result : both (t_FpPallas × t_FpPallas × 'bool). +Fail Next Obligation. + +Equations step_9_ (r : both (t_Seq t_FpVesta)) (a_prime_seq : both (t_Seq (t_Seq t_FpVesta))) (omega : both t_FpVesta) (p : both (t_Seq (t_Seq uint_size))) (x : both t_FpVesta) : both (t_FpVesta × t_Seq (t_Seq t_FpVesta)) := + step_9_ r a_prime_seq omega p x := + letb (n_a : uint_size) := impl_41__len a_prime_seq in + letb (a_seq : t_Seq (t_Seq t_FpVesta)) := f_create n_a in + letb a_seq := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n_a))) a_seq (fun a_seq => fun i => + letb (p_i : t_Seq uint_size) := f_clone (p.a[i]) in + letb (n_e : uint_size) := impl_41__len p_i in + letb (a_prime_i : t_Seq t_FpVesta) := f_clone (a_prime_seq.a[i]) in + letb (a_i_seq : t_Seq t_FpVesta) := f_create n_e in + letb a_i_seq := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n_e))) a_i_seq (fun a_i_seq => fun j => + letb (p_i_j : uint_size) := p_i.a[j] in + letb (argument : t_FpVesta) := (impl__FpVesta__pow omega (cast_int (WS2 := _) p_i_j)) .* x in + letb (a_i_j : t_FpVesta) := eval_polyx (f_clone a_prime_i) argument in + letb a_i_seq := update_at_usize a_i_seq j a_i_j in + a_i_seq) in + letb a_seq := update_at_usize a_seq i a_i_seq in + a_seq) in + letb r_x := eval_polyx r x in + solve_lift (prod_b (r_x,a_seq)) : both (t_FpVesta × t_Seq (t_Seq t_FpVesta)). +Fail Next Obligation. + +Equations trim_polyx (p : both (t_Seq t_FpVesta)) : both (t_Seq t_FpVesta) := + trim_polyx p := + letb last_val_idx := ret_both (1 : uint_size) in + letb last_val_idx := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len p))) last_val_idx (fun last_val_idx => fun i => + ifb (p.a[i]) <> (f_ZERO (ret_both (tt : 'unit))) + then letb last_val_idx := i .+ (ret_both (1 : uint_size)) in + last_val_idx + else last_val_idx) in + letb res := f_create last_val_idx in + letb res := ifb (impl_41__len p) <> (ret_both (0 : uint_size)) + then f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len res))) res (fun res => fun i => + update_at_usize res i (p.a[i])) + else res in + letb res := ifb (impl_41__len p) =.? (ret_both (0 : uint_size)) + then letb res := p in + res + else res in + solve_lift res : both (t_Seq t_FpVesta). +Fail Next Obligation. + +Equations add_polyx (p1 : both (t_Seq t_FpVesta)) (p2 : both (t_Seq t_FpVesta)) : both (t_Seq t_FpVesta) := + add_polyx p1 p2 := + letb res := f_create (ret_both (0 : uint_size)) in + letb short_len := ret_both (0 : uint_size) in + letb '(res,short_len) := ifb (impl_41__len p1) >.? (impl_41__len p2) + then letb res := f_clone p1 in + letb short_len := impl_41__len p2 in + prod_b (res,short_len) + else letb res := f_clone p2 in + letb short_len := impl_41__len p1 in + prod_b (res,short_len) in + letb res := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := short_len))) res (fun res => fun i => + update_at_usize res i ((p1.a[i]) .+ (p2.a[i]))) in + solve_lift (trim_polyx res) : both (t_Seq t_FpVesta). +Fail Next Obligation. + +Equations check_equal_polyx (p1 : both (t_Seq t_FpVesta)) (p2 : both (t_Seq t_FpVesta)) : both 'bool := + check_equal_polyx p1 p2 := + letb is_equal := ret_both (false : 'bool) in + letb is_equal := ifb (impl_41__len (trim_polyx (f_clone p1))) =.? (impl_41__len (trim_polyx (f_clone p2))) + then letb is_equal := ret_both (true : 'bool) in + f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len (trim_polyx (f_clone p1))))) is_equal (fun is_equal => fun i => + letb p1_scaler_i := f_clone (p1.a[i]) in + letb p2_scaler_i := f_clone (p2.a[i]) in + ifb p1_scaler_i <> p2_scaler_i + then letb is_equal := ret_both (false : 'bool) in + is_equal + else is_equal) + else is_equal in + solve_lift is_equal : both 'bool. +Fail Next Obligation. + +Equations degree_polyx (p : both (t_Seq t_FpVesta)) : both uint_size := + degree_polyx p := + letb len := impl_41__len (trim_polyx p) in + solve_lift (ifb len =.? (ret_both (0 : uint_size)) + then ret_both (0 : uint_size) + else len .- (ret_both (1 : uint_size))) : both uint_size. +Fail Next Obligation. + +Equations divide_leading_terms (n : both (t_Seq t_FpVesta)) (d : both (t_Seq t_FpVesta)) : both (t_Seq t_FpVesta) := + divide_leading_terms n d := + letb (n : t_Seq t_FpVesta) := trim_polyx n in + letb (d : t_Seq t_FpVesta) := trim_polyx d in + letb (x_pow : uint_size) := (impl_41__len n) .- (impl_41__len d) in + letb (n_coeff : t_FpVesta) := n.a[((impl_41__len n) .- (ret_both (1 : uint_size)))] in + letb (d_coeff : t_FpVesta) := d.a[((impl_41__len d) .- (ret_both (1 : uint_size)))] in + letb (coeff : t_FpVesta) := n_coeff ./ d_coeff in + letb (res : t_Seq t_FpVesta) := f_create (x_pow .+ (ret_both (1 : uint_size))) in + letb res := update_at_usize res x_pow coeff in + solve_lift res : both (t_Seq t_FpVesta). +Fail Next Obligation. + +Equations mul_polyx (a : both (t_Seq t_FpVesta)) (b : both (t_Seq t_FpVesta)) : both (t_Seq t_FpVesta) := + mul_polyx a b := + letb result := f_create ((impl_41__len a) .+ (impl_41__len b)) in + letb result := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len a))) result (fun result => fun i => + ifb not (f_equal (a.a[i]) (f_default (ret_both (tt : 'unit)))) + then f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len b))) result (fun result => fun j => + ifb not (f_equal (b.a[j]) (f_default (ret_both (tt : 'unit)))) + then letb result := update_at_usize result (i .+ j) ((result.a[(i .+ j)]) .+ ((a.a[i]) .* (b.a[j]))) in + result + else result) + else result) in + solve_lift (trim_polyx result) : both (t_Seq t_FpVesta). +Fail Next Obligation. + +Equations multi_poly_with_x_pow (p : both (t_Seq t_FpVesta)) (power : both uint_size) : both (t_Seq t_FpVesta) := + multi_poly_with_x_pow p power := + letb (p : t_Seq t_FpVesta) := trim_polyx p in + letb (res : t_Seq t_FpVesta) := f_create ((impl_41__len p) .+ power) in + letb res := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len p))) res (fun res => fun i => + update_at_usize res (i .+ power) (p.a[i])) in + solve_lift res : both (t_Seq t_FpVesta). +Fail Next Obligation. + +Equations multi_poly_with_x (p : both (t_Seq t_FpVesta)) : both (t_Seq t_FpVesta) := + multi_poly_with_x p := + solve_lift (multi_poly_with_x_pow p (ret_both (1 : uint_size))) : both (t_Seq t_FpVesta). +Fail Next Obligation. + +Equations compute_vanishing_polynomial (omega : both t_FpVesta) (n : both uint_size) : both (t_Seq t_FpVesta) := + compute_vanishing_polynomial omega n := + letb (vanishing_poly : t_Seq t_FpVesta) := f_create (ret_both (1 : uint_size)) in + letb vanishing_poly := update_at_usize vanishing_poly (f_zero (ret_both (tt : 'unit))) (f_ONE (ret_both (tt : 'unit))) in + letb vanishing_poly := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) vanishing_poly (fun vanishing_poly => fun i => + letb eval_point := impl__FpVesta__pow omega (cast_int (WS2 := _) i) in + letb poly_mul_x := multi_poly_with_x (f_clone vanishing_poly) in + letb (poly_mul_scalar : t_Seq t_FpVesta) := mul_scalar_polyx (f_clone vanishing_poly) (impl__FpVesta__neg eval_point) in + letb vanishing_poly := add_polyx poly_mul_x poly_mul_scalar in + vanishing_poly) in + solve_lift vanishing_poly : both (t_Seq t_FpVesta). +Fail Next Obligation. + +Equations step_12_ (n_a : both uint_size) (x1 : both t_FpVesta) (h_prime : both (t_Seq t_FpVesta)) (r : both (t_Seq t_FpVesta)) (a_prime : both (t_Seq (t_Seq t_FpVesta))) (q : both (t_Seq (t_Seq uint_size))) (sigma_list : both (t_Seq uint_size)) (a_blinds : both (t_Seq t_FpVesta)) (r_blind : both t_FpVesta) (h_prime_blind : both t_FpVesta) : both (t_Seq (t_Seq t_FpVesta) × t_Seq t_FpVesta) := + step_12_ n_a x1 h_prime r a_prime q sigma_list a_blinds r_blind h_prime_blind := + letb (n_q : uint_size) := impl_41__len q in + letb (qs : t_Seq (t_Seq t_FpVesta)) := f_create n_q in + letb q_blinds := f_create n_q in + letb qs := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len qs))) qs (fun qs => fun i => + update_at_usize qs i (f_create (ret_both (1 : uint_size)))) in + letb '(q_blinds,qs) := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n_a))) (prod_b (q_blinds,qs)) (fun '(q_blinds,qs) => fun i => + letb (a_i : t_Seq t_FpVesta) := f_clone (a_prime.a[i]) in + letb (a_blind_i : t_FpVesta) := a_blinds.a[i] in + letb (sigma_i : t_Seq uint_size) := sigma i (f_clone sigma_list) (f_clone q) in + f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len sigma_i))) (prod_b (q_blinds,qs)) (fun '(q_blinds,qs) => fun j => + letb (j : uint_size) := sigma_i.a[j] in + letb (q_sigma_i : t_Seq t_FpVesta) := f_clone (qs.a[j]) in + letb (product : t_Seq t_FpVesta) := mul_scalar_polyx (f_clone q_sigma_i) x1 in + letb qs := update_at_usize qs j (add_polyx product (f_clone a_i)) in + letb q_blinds := update_at_usize q_blinds j ((x1 .* (q_blinds.a[j])) .+ a_blind_i) in + prod_b (q_blinds,qs))) in + letb (x1_squared : t_FpVesta) := x1 .* x1 in + letb (q0 : t_Seq t_FpVesta) := f_clone (qs.a[(f_zero (ret_both (tt : 'unit)))]) in + letb (product1 : t_Seq t_FpVesta) := mul_scalar_polyx q0 x1_squared in + letb (product2 : t_Seq t_FpVesta) := mul_scalar_polyx h_prime x1 in + letb (sum1 : t_Seq t_FpVesta) := add_polyx product1 product2 in + letb (final_sum : t_Seq t_FpVesta) := add_polyx sum1 r in + letb qs := update_at_usize qs (f_zero (ret_both (tt : 'unit))) final_sum in + letb q_blinds := update_at_usize q_blinds (f_zero (ret_both (tt : 'unit))) (x1_squared .* (q_blinds.a[(f_zero (ret_both (tt : 'unit)))])) in + letb q_blinds := update_at_usize q_blinds (f_zero (ret_both (tt : 'unit))) ((q_blinds.a[(f_zero (ret_both (tt : 'unit)))]) .+ r_blind) in + letb q_blinds := update_at_usize q_blinds (f_zero (ret_both (tt : 'unit))) ((q_blinds.a[(f_zero (ret_both (tt : 'unit)))]) .+ (h_prime_blind .* x1)) in + solve_lift (prod_b (qs,q_blinds)) : both (t_Seq (t_Seq t_FpVesta) × t_Seq t_FpVesta). +Fail Next Obligation. + +Equations step_13_ (n : both uint_size) (omega : both t_FpVesta) (x : both t_FpVesta) (x1 : both t_FpVesta) (r : both t_FpVesta) (s : both (t_Seq (t_Seq t_FpVesta))) (q : both (t_Seq (t_Seq uint_size))) (sigma_list : both (t_Seq uint_size)) (g_prime_eval_combined_from_a : both t_FpVesta) (g_prime : both (t_Seq t_FpVesta)) : both (t_Seq (t_Seq t_FpVesta) × t_Seq (t_Seq t_FpVesta)) := + step_13_ n omega x x1 r s q sigma_list g_prime_eval_combined_from_a g_prime := + letb (n_a : uint_size) := impl_41__len s in + letb (n_q : uint_size) := impl_41__len q in + letb (rs : t_Seq (t_Seq t_FpVesta)) := f_create n_q in + letb rs := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len rs))) rs (fun rs => fun i => + update_at_usize rs i (f_create (ret_both (1 : uint_size)))) in + letb rs := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n_a))) rs (fun rs => fun i => + letb (s_i : t_Seq t_FpVesta) := f_clone (s.a[i]) in + letb (sigma_i : t_Seq uint_size) := sigma i (f_clone sigma_list) (f_clone q) in + f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len sigma_i))) rs (fun rs => fun j => + letb j := sigma_i.a[j] in + letb r_sigma_i := f_clone (rs.a[j]) in + letb product := mul_scalar_polyx (f_clone r_sigma_i) x1 in + letb rs := update_at_usize rs j (add_polyx product (f_clone s_i)) in + rs)) in + letb rs_verifier := f_clone rs in + letb rs_prover := rs in + letb (g_prime_x : t_FpVesta) := eval_polyx g_prime x in + letb (vanishing_poly : t_Seq t_FpVesta) := compute_vanishing_polynomial omega n in + letb (vanishing_poly_x : t_FpVesta) := eval_polyx vanishing_poly x in + letb h := g_prime_x ./ vanishing_poly_x in + letb (x1_squared : t_FpVesta) := x1 .* x1 in + letb (r0 : t_Seq t_FpVesta) := f_clone (rs_prover.a[(f_zero (ret_both (tt : 'unit)))]) in + letb product1 := mul_scalar_polyx r0 x1_squared in + letb product2 := h .* x1 in + letb sum1 := add_scalar_polyx product1 product2 in + letb final_sum := add_scalar_polyx sum1 r in + letb rs_prover := update_at_usize rs_prover (f_zero (ret_both (tt : 'unit))) final_sum in + letb (vanishing_poly : t_Seq t_FpVesta) := compute_vanishing_polynomial omega n in + letb (vanishing_poly_x : t_FpVesta) := eval_polyx vanishing_poly x in + letb h := g_prime_eval_combined_from_a ./ vanishing_poly_x in + letb (x1_squared : t_FpVesta) := x1 .* x1 in + letb (r0 : t_Seq t_FpVesta) := f_clone (rs_verifier.a[(f_zero (ret_both (tt : 'unit)))]) in + letb product1 := mul_scalar_polyx r0 x1_squared in + letb product2 := h .* x1 in + letb sum1 := add_scalar_polyx product1 product2 in + letb final_sum := add_scalar_polyx sum1 r in + letb rs_verifier := update_at_usize rs_verifier (f_zero (ret_both (tt : 'unit))) final_sum in + solve_lift (prod_b (rs_prover,rs_verifier)) : both (t_Seq (t_Seq t_FpVesta) × t_Seq (t_Seq t_FpVesta)). +Fail Next Obligation. + +Equations step_19_ (x4 : both t_FpVesta) (q_prime : both (t_Seq t_FpVesta)) (q_polys : both (t_Seq (t_Seq t_FpVesta))) (q_blinds : both (t_Seq t_FpVesta)) (q_prime_blind : both t_FpVesta) : both (t_Seq t_FpVesta × t_FpVesta) := + step_19_ x4 q_prime q_polys q_blinds q_prime_blind := + letb p := f_create (ret_both (1 : uint_size)) in + letb (n_q : uint_size) := impl_41__len q_polys in + letb p_blind := f_ZERO (ret_both (tt : 'unit)) in + letb '(p,p_blind) := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n_q))) (prod_b (p,p_blind)) (fun '(p,p_blind) => fun i => + letb (power : uint_size) := (n_q .- (ret_both (1 : uint_size))) .- i in + letb x4_powered := impl__FpVesta__pow x4 (cast_int (WS2 := _) power) in + letb q_i := f_clone (q_polys.a[i]) in + letb multed_poly := mul_scalar_polyx q_i x4_powered in + letb p := add_polyx p multed_poly in + letb p_blind := p_blind .+ (x4_powered .* (q_blinds.a[i])) in + prod_b (p,p_blind)) in + letb (x4n_q : t_FpVesta) := impl__FpVesta__pow x4 (cast_int (WS2 := _) n_q) in + letb (first_term : t_Seq t_FpVesta) := mul_scalar_polyx q_prime x4n_q in + letb p := add_polyx p first_term in + letb p_blind := p_blind .+ (x4n_q .* q_prime_blind) in + solve_lift (prod_b (p,p_blind)) : both (t_Seq t_FpVesta × t_FpVesta). +Fail Next Obligation. + +Equations step_23_ (p : both (t_Seq t_FpVesta)) (s : both (t_Seq t_FpVesta)) (x3 : both t_FpVesta) (xi : both t_FpVesta) (p_blind : both t_FpVesta) (s_blind : both t_FpVesta) : both (t_Seq t_FpVesta × t_FpVesta) := + step_23_ p s x3 xi p_blind s_blind := + letb p_eval_x3 := eval_polyx (f_clone p) x3 in + letb xi_mul_s := mul_scalar_polyx s xi in + letb p_prime := p in + letb p_prime := sub_scalar_polyx p_prime p_eval_x3 in + letb p_prime := add_polyx p_prime xi_mul_s in + letb p_prime_blind := (s_blind .* xi) .+ p_blind in + solve_lift (prod_b (p_prime,p_prime_blind)) : both (t_Seq t_FpVesta × t_FpVesta). +Fail Next Obligation. + +Equations step_24_ (p_prime_poly : both (t_Seq t_FpVesta)) (v_G : both (t_Seq (t_FpPallas × t_FpPallas × 'bool))) (x3 : both t_FpVesta) (z : both t_FpVesta) (v_U : both (t_FpPallas × t_FpPallas × 'bool)) (v_W : both (t_FpPallas × t_FpPallas × 'bool)) (n : both uint_size) (k : both uint_size) (u : both (t_Seq t_FpVesta)) (v_L_blinding : both (t_Seq t_FpVesta)) (v_R_blinding : both (t_Seq t_FpVesta)) : both (t_Seq t_FpVesta × t_Seq (t_FpPallas × t_FpPallas × 'bool) × t_Seq t_FpVesta × t_Seq (t_FpPallas × t_FpPallas × 'bool) × t_Seq (t_FpPallas × t_FpPallas × 'bool) × t_Seq t_FpVesta × t_Seq t_FpVesta) := + step_24_ p_prime_poly v_G x3 z v_U v_W n k u v_L_blinding v_R_blinding := + letb (p_prime : t_Seq t_FpVesta) := p_prime_poly in + letb (g_prime : t_Seq (t_FpPallas × t_FpPallas × 'bool)) := v_G in + letb (b : t_Seq t_FpVesta) := f_create n in + letb (v_L : t_Seq (t_FpPallas × t_FpPallas × 'bool)) := f_create k in + letb (v_R : t_Seq (t_FpPallas × t_FpPallas × 'bool)) := f_create k in + letb b := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len b))) b (fun b => fun i => + letb (x3_powered : t_FpVesta) := impl__FpVesta__pow x3 (cast_int (WS2 := _) i) in + letb b := update_at_usize b i x3_powered in + b) in + letb '(v_L,v_R,b,g_prime,p_prime) := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := k))) (prod_b (v_L,v_R,b,g_prime,p_prime)) (fun '(v_L,v_R,b,g_prime,p_prime) => fun j => + letb (p_prime_half : uint_size) := (impl_41__len p_prime) ./ (ret_both (2 : uint_size)) in + letb (g_prime_half : uint_size) := (impl_41__len g_prime) ./ (ret_both (2 : uint_size)) in + letb (b_half : uint_size) := (impl_41__len b) ./ (ret_both (2 : uint_size)) in + letb (p_prime_lo : t_Seq t_FpVesta) := impl_41__slice p_prime (ret_both (0 : uint_size)) p_prime_half in + letb (p_prime_hi : t_Seq t_FpVesta) := impl_41__slice p_prime p_prime_half p_prime_half in + letb (g_prime_lo : t_Seq (t_FpPallas × t_FpPallas × 'bool)) := impl_41__slice g_prime (ret_both (0 : uint_size)) g_prime_half in + letb (g_prime_hi : t_Seq (t_FpPallas × t_FpPallas × 'bool)) := impl_41__slice g_prime g_prime_half g_prime_half in + letb (b_lo : t_Seq t_FpVesta) := impl_41__slice b (ret_both (0 : uint_size)) b_half in + letb (b_hi : t_Seq t_FpVesta) := impl_41__slice b b_half b_half in + letb (v_L_j : t_FpPallas × t_FpPallas × 'bool) := calculate_L_or_R (f_clone p_prime_hi) (f_clone b_lo) (f_clone g_prime_lo) z v_U v_W (v_L_blinding.a[j]) in + letb v_L := update_at_usize v_L j v_L_j in + letb (v_R_j : t_FpPallas × t_FpPallas × 'bool) := calculate_L_or_R (f_clone p_prime_lo) (f_clone b_hi) (f_clone g_prime_hi) z v_U v_W (v_R_blinding.a[j]) in + letb v_R := update_at_usize v_R j v_R_j in + letb (u_j : t_FpVesta) := u.a[j] in + letb (new_g_prime : t_Seq (t_FpPallas × t_FpPallas × 'bool)) := f_create g_prime_half in + letb new_g_prime := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len new_g_prime))) new_g_prime (fun new_g_prime => fun i => + letb (g_prime_hi_indexed : t_FpPallas × t_FpPallas × 'bool) := g_prime_hi.a[i] in + letb (g_prime_lo_indexed : t_FpPallas × t_FpPallas × 'bool) := g_prime_lo.a[i] in + letb (rhs_product : t_FpPallas × t_FpPallas × 'bool) := g1mul_pallas u_j g_prime_hi_indexed in + letb (sum : t_FpPallas × t_FpPallas × 'bool) := g1add_pallas g_prime_lo_indexed rhs_product in + letb new_g_prime := update_at_usize new_g_prime i sum in + new_g_prime) in + letb g_prime := new_g_prime in + letb (rhs : t_Seq t_FpVesta) := mul_scalar_polyx (f_clone b_hi) u_j in + letb (new_b : t_Seq t_FpVesta) := add_polyx (f_clone b_lo) rhs in + letb b := new_b in + letb (u_j_inv : t_FpVesta) := impl__FpVesta__inv u_j in + letb (rhs : t_Seq t_FpVesta) := mul_scalar_polyx (f_clone p_prime_hi) u_j_inv in + letb (new_p_prime : t_Seq t_FpVesta) := add_polyx (f_clone p_prime_lo) rhs in + letb p_prime := new_p_prime in + prod_b (v_L,v_R,b,g_prime,p_prime)) in + solve_lift (prod_b (p_prime,g_prime,b,v_L,v_R,v_L_blinding,v_R_blinding)) : both (t_Seq t_FpVesta × t_Seq (t_FpPallas × t_FpPallas × 'bool) × t_Seq t_FpVesta × t_Seq (t_FpPallas × t_FpPallas × 'bool) × t_Seq (t_FpPallas × t_FpPallas × 'bool) × t_Seq t_FpVesta × t_Seq t_FpVesta). +Fail Next Obligation. + +Equations step_5_ (h : both (t_Seq t_FpVesta)) (n : both uint_size) (n_g : both uint_size) : both (t_Seq (t_Seq t_FpVesta)) := + step_5_ h n n_g := + letb h := trim_polyx h in + letb n_g := n_g in + letb n := n in + letb index_in_h := ret_both (0 : uint_size) in + letb poly_parts := f_create (n_g .- (ret_both (1 : uint_size))) in + letb '(index_in_h,poly_parts) := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n_g .- (ret_both (1 : uint_size))))) (prod_b (index_in_h,poly_parts)) (fun '(index_in_h,poly_parts) => fun i => + letb current_poly_part := f_create n in + letb '(current_poly_part,index_in_h) := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (prod_b (current_poly_part,index_in_h)) (fun '(current_poly_part,index_in_h) => fun j => + ifb index_in_h <.? (impl_41__len h) + then letb current_poly_part := update_at_usize current_poly_part j (h.a[index_in_h]) in + letb index_in_h := index_in_h .+ (ret_both (1 : uint_size)) in + prod_b (current_poly_part,index_in_h) + else prod_b (current_poly_part,index_in_h)) in + letb poly_parts := update_at_usize poly_parts i current_poly_part in + prod_b (index_in_h,poly_parts)) in + solve_lift poly_parts : both (t_Seq (t_Seq t_FpVesta)). +Fail Next Obligation. + +Equations step_8_ (h_parts : both (t_Seq (t_Seq t_FpVesta))) (x : both t_FpVesta) (n : both uint_size) (h_blinds : both (t_Seq t_FpVesta)) : both (t_Seq t_FpVesta × t_FpVesta) := + step_8_ h_parts x n h_blinds := + letb (res : t_Seq t_FpVesta) := f_create (ret_both (1 : uint_size)) in + letb h_prime_blind := f_ZERO (ret_both (tt : 'unit)) in + letb '(h_prime_blind,res) := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len h_parts))) (prod_b (h_prime_blind,res)) (fun '(h_prime_blind,res) => fun i => + letb (power : uint_size) := n .* i in + letb (x_raised : t_FpVesta) := impl__FpVesta__pow x (cast_int (WS2 := _) power) in + letb (h_i : t_Seq t_FpVesta) := f_clone (h_parts.a[i]) in + letb (aux_prod : t_Seq t_FpVesta) := mul_scalar_polyx h_i x_raised in + letb res := add_polyx res aux_prod in + letb h_prime_blind := h_prime_blind .+ ((h_blinds.a[i]) .* x_raised) in + prod_b (h_prime_blind,res)) in + solve_lift (prod_b (res,h_prime_blind)) : both (t_Seq t_FpVesta × t_FpVesta). +Fail Next Obligation. + +Equations sub_polyx (p1 : both (t_Seq t_FpVesta)) (p2 : both (t_Seq t_FpVesta)) : both (t_Seq t_FpVesta) := + sub_polyx p1 p2 := + letb largest := impl_41__len p1 in + letb largest := ifb (impl_41__len p2) >.? (impl_41__len p1) + then letb largest := impl_41__len p2 in + largest + else largest in + letb res := f_create largest in + letb res := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len p1))) res (fun res => fun i => + update_at_usize res i (p1.a[i])) in + letb res := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len p2))) res (fun res => fun i => + update_at_usize res i ((res.a[i]) .- (p2.a[i]))) in + solve_lift (trim_polyx res) : both (t_Seq t_FpVesta). +Fail Next Obligation. + +Equations divide_polyx (n : both (t_Seq t_FpVesta)) (d : both (t_Seq t_FpVesta)) : both (t_Seq t_FpVesta × t_Seq t_FpVesta) := + divide_polyx n d := + letb (q : t_Seq t_FpVesta) := f_create (impl_41__len n) in + letb (r : t_Seq t_FpVesta) := f_clone n in + letb loop_upper_bound := impl_41__len d in + letb loop_upper_bound := ifb (impl_41__len q) >.? (impl_41__len d) + then letb loop_upper_bound := impl_41__len q in + loop_upper_bound + else loop_upper_bound in + letb '(q,r) := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := loop_upper_bound))) (prod_b (q,r)) (fun '(q,r) => fun _ => + ifb andb (check_not_zero_polyx (f_clone r)) ((degree_polyx (f_clone r)) >=.? (degree_polyx (f_clone d))) + then letb (t : t_Seq t_FpVesta) := divide_leading_terms (f_clone r) (f_clone d) in + letb q := add_polyx q (f_clone t) in + letb (aux_prod : t_Seq t_FpVesta) := mul_polyx (f_clone d) (f_clone t) in + letb r := sub_polyx r aux_prod in + prod_b (q,r) + else prod_b (q,r)) in + solve_lift (prod_b (trim_polyx q,trim_polyx r)) : both (t_Seq t_FpVesta × t_Seq t_FpVesta). +Fail Next Obligation. + +(*item error backend*) + +(*item error backend*) + +Equations step_10_ (omega : both t_FpVesta) (p : both (t_Seq (t_Seq uint_size))) (x : both t_FpVesta) (a : both (t_Seq (t_Seq t_FpVesta))) : both (t_Seq (t_Seq t_FpVesta)) := + step_10_ omega p x a := + letb n_a := impl_41__len a in + letb s := f_create n_a in + letb s := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n_a))) s (fun s => fun i => + letb a_i := f_clone (a.a[i]) in + letb p_i := f_clone (p.a[i]) in + letb n_e := impl_41__len p_i in + letb (points : t_Seq (t_FpVesta × t_FpVesta)) := f_create n_e in + letb points := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n_e))) points (fun points => fun j => + letb (p_i_j : uint_size) := p_i.a[j] in + letb x_j := (impl__FpVesta__pow omega (cast_int (WS2 := _) p_i_j)) .* x in + letb y_j := a_i.a[j] in + letb points := update_at_usize points j (prod_b (x_j,y_j)) in + points) in + letb (s_i : t_Seq t_FpVesta) := lagrange_polyx points in + letb s := update_at_usize s i s_i in + s) in + solve_lift s : both (t_Seq (t_Seq t_FpVesta)). +Fail Next Obligation. + +Equations step_14_ (crs : both (t_Seq (t_FpPallas × t_FpPallas × 'bool) × t_FpPallas × t_FpPallas × 'bool)) (x2 : both t_FpVesta) (q_polys : both (t_Seq (t_Seq t_FpVesta))) (r_polys : both (t_Seq (t_Seq t_FpVesta))) (q : both (t_Seq (t_Seq uint_size))) (blinding : both t_FpVesta) (omega : both t_FpVesta) (x : both t_FpVesta) : both (t_FpPallas × t_FpPallas × 'bool × t_Seq t_FpVesta × t_FpVesta) := + step_14_ crs x2 q_polys r_polys q blinding omega x := + letb (q_prime : t_Seq t_FpVesta) := f_create (ret_both (1 : uint_size)) in + letb (n_q : uint_size) := impl_41__len q in + letb q_prime := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n_q))) q_prime (fun q_prime => fun i => + letb (x2_powered : t_FpVesta) := impl__FpVesta__pow x2 (cast_int (WS2 := _) ((n_q .- (ret_both (1 : uint_size))) .- i)) in + letb (q_poly_i : t_Seq t_FpVesta) := f_clone (q_polys.a[i]) in + letb (r_i : t_Seq t_FpVesta) := f_clone (r_polys.a[i]) in + letb (q_i_sub_r_i : t_Seq t_FpVesta) := sub_polyx q_poly_i r_i in + letb (q_i : t_Seq uint_size) := f_clone (q.a[i]) in + letb (divisor : t_Seq t_FpVesta) := f_create (ret_both (1 : uint_size)) in + letb divisor := update_at_usize divisor (f_zero (ret_both (tt : 'unit))) (f_ONE (ret_both (tt : 'unit))) in + letb divisor := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len q_i))) divisor (fun divisor => fun j => + letb (q_i_j : uint_size) := q_i.a[j] in + letb (scalar : t_FpVesta) := (impl__FpVesta__pow omega (cast_int (WS2 := _) q_i_j)) .* x in + letb (divisor_mul_x : t_Seq t_FpVesta) := multi_poly_with_x (f_clone divisor) in + letb (divisor_mul_scalar : t_Seq t_FpVesta) := mul_scalar_polyx (f_clone divisor) (impl__FpVesta__neg scalar) in + letb divisor := add_polyx divisor_mul_x divisor_mul_scalar in + divisor) in + letb '(divided_poly,remainder) := divide_polyx (f_clone q_i_sub_r_i) divisor in + letb (multed_poly : t_Seq t_FpVesta) := mul_scalar_polyx divided_poly x2_powered in + letb q_prime := add_polyx q_prime multed_poly in + q_prime) in + letb (commitment : t_FpPallas × t_FpPallas × 'bool) := commit_polyx crs (f_clone q_prime) blinding in + solve_lift (prod_b (commitment,q_prime,blinding)) : both (t_FpPallas × t_FpPallas × 'bool × t_Seq t_FpVesta × t_FpVesta). +Fail Next Obligation. + +Equations step_4_ (g_prime : both (t_Seq t_FpVesta)) (omega : both t_FpVesta) (n : both uint_size) : both (t_Seq t_FpVesta) := + step_4_ g_prime omega n := + letb vanishing := compute_vanishing_polynomial omega n in + letb '(h,remainder) := divide_polyx g_prime vanishing in + solve_lift h : both (t_Seq t_FpVesta). +Fail Next Obligation. diff --git a/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_group.fst b/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_group.fst deleted file mode 100644 index 8f91f0b..0000000 --- a/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_group.fst +++ /dev/null @@ -1,949 +0,0 @@ -module Hacspec_ovn.Ovn_group -#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" -open Core -open FStar.Mul - -let _ = - (* This module has implicit dependencies, here we make them explicit. *) - (* The implicit dependencies arise from typeclasses instances. *) - let open Concordium_contracts_common.Traits in - let open Hacspec_concordium.Concordium_traits in - let open Hacspec_ovn.Ovn_traits in - () - -type t_TallyParameter = | TallyParameter : t_TallyParameter - -let sub - (#v_Z: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Field v_Z) - (x y: v_Z) - : v_Z = - Hacspec_ovn.Ovn_traits.f_add #v_Z - #FStar.Tactics.Typeclasses.solve - x - (Hacspec_ovn.Ovn_traits.f_opp #v_Z #FStar.Tactics.Typeclasses.solve y <: v_Z) - -let check_commitment - (#v_G: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) - (g_pow_xi_yi_vi: v_G) - (commitment: i1.f_Z) - : bool = - (Hacspec_ovn.Ovn_traits.f_hash #v_G - #FStar.Tactics.Typeclasses.solve - (Alloc.Slice.impl__into_vec #v_G - #Alloc.Alloc.t_Global - (Rust_primitives.unsize (Rust_primitives.Hax.box_new (let list = [g_pow_xi_yi_vi] in - FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 1); - Rust_primitives.Hax.array_of_list 1 list) - <: - Alloc.Boxed.t_Box (t_Array v_G (sz 1)) Alloc.Alloc.t_Global) - <: - Alloc.Boxed.t_Box (t_Slice v_G) Alloc.Alloc.t_Global) - <: - Alloc.Vec.t_Vec v_G Alloc.Alloc.t_Global) - <: - i1.f_Z) =. - commitment - -let commit_to - (#v_G: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) - (g_pow_xi_yi_vi: v_G) - : i1.f_Z = - Hacspec_ovn.Ovn_traits.f_hash #v_G - #FStar.Tactics.Typeclasses.solve - (Alloc.Slice.impl__into_vec #v_G - #Alloc.Alloc.t_Global - (Rust_primitives.unsize (Rust_primitives.Hax.box_new (let list = [g_pow_xi_yi_vi] in - FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 1); - Rust_primitives.Hax.array_of_list 1 list) - <: - Alloc.Boxed.t_Box (t_Array v_G (sz 1)) Alloc.Alloc.t_Global) - <: - Alloc.Boxed.t_Box (t_Slice v_G) Alloc.Alloc.t_Global) - <: - Alloc.Vec.t_Vec v_G Alloc.Alloc.t_Global) - -let compute_group_element_for_vote - (#v_G: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) - (xi: i1.f_Z) - (vote: bool) - (g_pow_yi: v_G) - : v_G = - Hacspec_ovn.Ovn_traits.f_prod #v_G - #FStar.Tactics.Typeclasses.solve - (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve g_pow_yi xi <: v_G) - (Hacspec_ovn.Ovn_traits.f_g_pow #v_G - #FStar.Tactics.Typeclasses.solve - (if vote - then - Hacspec_ovn.Ovn_traits.f_field_one #i1.f_Z #FStar.Tactics.Typeclasses.solve () <: i1.f_Z - else - Hacspec_ovn.Ovn_traits.f_field_zero #i1.f_Z #FStar.Tactics.Typeclasses.solve () - <: - i1.f_Z) - <: - v_G) - -let div - (#v_G: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) - (x y: v_G) - : v_G = - Hacspec_ovn.Ovn_traits.f_prod #v_G - #FStar.Tactics.Typeclasses.solve - x - (Hacspec_ovn.Ovn_traits.f_group_inv #v_G #FStar.Tactics.Typeclasses.solve y <: v_G) - -let compute_g_pow_yi - (#v_G: Type0) - (n: usize) - (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) - (i: usize) - (xis: t_Array v_G n) - : v_G = - let prod1:v_G = Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () in - let prod1:v_G = - Rust_primitives.Hax.Folds.fold_range (sz 0) - i - (fun prod1 temp_1_ -> - let prod1:v_G = prod1 in - let _:usize = temp_1_ in - true) - prod1 - (fun prod1 j -> - let prod1:v_G = prod1 in - let j:usize = j in - Hacspec_ovn.Ovn_traits.f_prod #v_G - #FStar.Tactics.Typeclasses.solve - prod1 - (xis.[ j ] <: v_G) - <: - v_G) - in - let prod2:v_G = Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () in - let prod2:v_G = - Rust_primitives.Hax.Folds.fold_range (i +! sz 1 <: usize) - n - (fun prod2 temp_1_ -> - let prod2:v_G = prod2 in - let _:usize = temp_1_ in - true) - prod2 - (fun prod2 j -> - let prod2:v_G = prod2 in - let j:usize = j in - Hacspec_ovn.Ovn_traits.f_prod #v_G - #FStar.Tactics.Typeclasses.solve - prod2 - (xis.[ j ] <: v_G) - <: - v_G) - in - div #v_G prod1 prod2 - -type t_CastVoteParam (v_Z: Type0) {| i1: Hacspec_ovn.Ovn_traits.t_Field v_Z |} = { - f_cvp_i:u32; - f_cvp_xi:v_Z; - f_cvp_zkp_random_w:v_Z; - f_cvp_zkp_random_r:v_Z; - f_cvp_zkp_random_d:v_Z; - f_cvp_vote:bool -} - -type t_OrZKPCommit (v_G: Type0) {| i1: Hacspec_ovn.Ovn_traits.t_Group v_G |} = { - f_or_zkp_x:v_G; - f_or_zkp_y:v_G; - f_or_zkp_a1:v_G; - f_or_zkp_b1:v_G; - f_or_zkp_a2:v_G; - f_or_zkp_b2:v_G; - f_or_zkp_c:i1.f_Z; - f_or_zkp_d1:i1.f_Z; - f_or_zkp_d2:i1.f_Z; - f_or_zkp_r1:i1.f_Z; - f_or_zkp_r2:i1.f_Z -} - -type t_RegisterParam (v_Z: Type0) {| i1: Hacspec_ovn.Ovn_traits.t_Field v_Z |} = { - f_rp_i:u32; - f_rp_xi:v_Z; - f_rp_zkp_random:v_Z -} - -type t_SchnorrZKPCommit (v_G: Type0) {| i1: Hacspec_ovn.Ovn_traits.t_Group v_G |} = { - f_schnorr_zkp_u:v_G; - f_schnorr_zkp_c:i1.f_Z; - f_schnorr_zkp_z:i1.f_Z -} - -(** Non-interactive Schnorr proof using Fiat-Shamir heuristics (RFC 8235) *) -let schnorr_zkp - (#v_G: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) - (random: i1.f_Z) - (h: v_G) - (x: i1.f_Z) - : t_SchnorrZKPCommit v_G = - Rust_primitives.Hax.Control_flow_monad.Mexception.run (let r = random in - let u:v_G = Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve r in - let c = - Hacspec_ovn.Ovn_traits.f_hash #v_G - #FStar.Tactics.Typeclasses.solve - (Alloc.Slice.impl__into_vec #v_G - #Alloc.Alloc.t_Global - (Rust_primitives.unsize (Rust_primitives.Hax.box_new (let list = - [ - Hacspec_ovn.Ovn_traits.f_g #v_G #FStar.Tactics.Typeclasses.solve () - <: - v_G; - h; - u - ] - in - FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 3); - Rust_primitives.Hax.array_of_list 3 list) - <: - Alloc.Boxed.t_Box (t_Array v_G (sz 3)) Alloc.Alloc.t_Global) - <: - Alloc.Boxed.t_Box (t_Slice v_G) Alloc.Alloc.t_Global) - <: - Alloc.Vec.t_Vec v_G Alloc.Alloc.t_Global) - in - let z = - Hacspec_ovn.Ovn_traits.f_add #i1.f_Z - #FStar.Tactics.Typeclasses.solve - r - (Hacspec_ovn.Ovn_traits.f_mul #i1.f_Z #FStar.Tactics.Typeclasses.solve c x <: i1.f_Z) - in - let! hoist9:Rust_primitives.Hax.t_Never = - Core.Ops.Control_flow.ControlFlow_Break - ({ f_schnorr_zkp_u = u; f_schnorr_zkp_c = c; f_schnorr_zkp_z = z } <: t_SchnorrZKPCommit v_G - ) - <: - Core.Ops.Control_flow.t_ControlFlow (t_SchnorrZKPCommit v_G) Rust_primitives.Hax.t_Never - in - Core.Ops.Control_flow.ControlFlow_Continue (Rust_primitives.Hax.never_to_any hoist9) - <: - Core.Ops.Control_flow.t_ControlFlow (t_SchnorrZKPCommit v_G) (t_SchnorrZKPCommit v_G)) - -let schnorr_zkp_validate - (#v_G: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) - (h: v_G) - (pi: t_SchnorrZKPCommit v_G) - : bool = - pi.f_schnorr_zkp_c =. - (Hacspec_ovn.Ovn_traits.f_hash #v_G - #FStar.Tactics.Typeclasses.solve - (Alloc.Slice.impl__into_vec #v_G - #Alloc.Alloc.t_Global - (Rust_primitives.unsize (Rust_primitives.Hax.box_new (let list = - [ - Hacspec_ovn.Ovn_traits.f_g #v_G #FStar.Tactics.Typeclasses.solve () <: v_G; - h; - pi.f_schnorr_zkp_u - ] - in - FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 3); - Rust_primitives.Hax.array_of_list 3 list) - <: - Alloc.Boxed.t_Box (t_Array v_G (sz 3)) Alloc.Alloc.t_Global) - <: - Alloc.Boxed.t_Box (t_Slice v_G) Alloc.Alloc.t_Global) - <: - Alloc.Vec.t_Vec v_G Alloc.Alloc.t_Global) - <: - i1.f_Z) && - (Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve pi.f_schnorr_zkp_z <: v_G) =. - (Hacspec_ovn.Ovn_traits.f_prod #v_G - #FStar.Tactics.Typeclasses.solve - pi.f_schnorr_zkp_u - (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve h pi.f_schnorr_zkp_c - <: - v_G) - <: - v_G) - -(** Cramer, Damgård and Schoenmakers (CDS) technique *) -let zkp_one_out_of_two - (#v_G: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) - (random_w random_r random_d: i1.f_Z) - (h: v_G) - (xi: i1.f_Z) - (vi: bool) - : t_OrZKPCommit v_G = - let w = random_w in - if vi - then - let r1 = random_r in - let d1 = random_d in - let x:v_G = Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve xi in - let y:v_G = - Hacspec_ovn.Ovn_traits.f_prod #v_G - #FStar.Tactics.Typeclasses.solve - (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve h xi <: v_G) - (Hacspec_ovn.Ovn_traits.f_g #v_G #FStar.Tactics.Typeclasses.solve () <: v_G) - in - let a1:v_G = - Hacspec_ovn.Ovn_traits.f_prod #v_G - #FStar.Tactics.Typeclasses.solve - (Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve r1 <: v_G) - (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve x d1 <: v_G) - in - let b1:v_G = - Hacspec_ovn.Ovn_traits.f_prod #v_G - #FStar.Tactics.Typeclasses.solve - (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve h r1 <: v_G) - (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve y d1 <: v_G) - in - let a2:v_G = Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve w in - let b2:v_G = Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve h w in - let c = - Hacspec_ovn.Ovn_traits.f_hash #v_G - #FStar.Tactics.Typeclasses.solve - (Alloc.Slice.impl__into_vec #v_G - #Alloc.Alloc.t_Global - (Rust_primitives.unsize (Rust_primitives.Hax.box_new (let list = - [x; y; a1; b1; a2; b2] - in - FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 6); - Rust_primitives.Hax.array_of_list 6 list) - <: - Alloc.Boxed.t_Box (t_Array v_G (sz 6)) Alloc.Alloc.t_Global) - <: - Alloc.Boxed.t_Box (t_Slice v_G) Alloc.Alloc.t_Global) - <: - Alloc.Vec.t_Vec v_G Alloc.Alloc.t_Global) - in - let d2 = sub #i1.f_Z c d1 in - let r2 = - sub #i1.f_Z - w - (Hacspec_ovn.Ovn_traits.f_mul #i1.f_Z #FStar.Tactics.Typeclasses.solve xi d2 <: i1.f_Z) - in - { - f_or_zkp_x = x; - f_or_zkp_y = y; - f_or_zkp_a1 = a1; - f_or_zkp_b1 = b1; - f_or_zkp_a2 = a2; - f_or_zkp_b2 = b2; - f_or_zkp_c = c; - f_or_zkp_d1 = d1; - f_or_zkp_d2 = d2; - f_or_zkp_r1 = r1; - f_or_zkp_r2 = r2 - } - <: - t_OrZKPCommit v_G - else - let r2 = random_r in - let d2 = random_d in - let x:v_G = Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve xi in - let y:v_G = Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve h xi in - let a1:v_G = Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve w in - let b1:v_G = Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve h w in - let a2:v_G = - Hacspec_ovn.Ovn_traits.f_prod #v_G - #FStar.Tactics.Typeclasses.solve - (Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve r2 <: v_G) - (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve x d2 <: v_G) - in - let b2:v_G = - Hacspec_ovn.Ovn_traits.f_prod #v_G - #FStar.Tactics.Typeclasses.solve - (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve h r2 <: v_G) - (Hacspec_ovn.Ovn_traits.f_pow #v_G - #FStar.Tactics.Typeclasses.solve - (div #v_G y (Hacspec_ovn.Ovn_traits.f_g #v_G #FStar.Tactics.Typeclasses.solve () <: v_G) - <: - v_G) - d2 - <: - v_G) - in - let c = - Hacspec_ovn.Ovn_traits.f_hash #v_G - #FStar.Tactics.Typeclasses.solve - (Alloc.Slice.impl__into_vec #v_G - #Alloc.Alloc.t_Global - (Rust_primitives.unsize (Rust_primitives.Hax.box_new (let list = - [x; y; a1; b1; a2; b2] - in - FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 6); - Rust_primitives.Hax.array_of_list 6 list) - <: - Alloc.Boxed.t_Box (t_Array v_G (sz 6)) Alloc.Alloc.t_Global) - <: - Alloc.Boxed.t_Box (t_Slice v_G) Alloc.Alloc.t_Global) - <: - Alloc.Vec.t_Vec v_G Alloc.Alloc.t_Global) - in - let d1 = sub #i1.f_Z c d2 in - let r1 = - sub #i1.f_Z - w - (Hacspec_ovn.Ovn_traits.f_mul #i1.f_Z #FStar.Tactics.Typeclasses.solve xi d1 <: i1.f_Z) - in - { - f_or_zkp_x = x; - f_or_zkp_y = y; - f_or_zkp_a1 = a1; - f_or_zkp_b1 = b1; - f_or_zkp_a2 = a2; - f_or_zkp_b2 = b2; - f_or_zkp_c = c; - f_or_zkp_d1 = d1; - f_or_zkp_d2 = d2; - f_or_zkp_r1 = r1; - f_or_zkp_r2 = r2 - } - <: - t_OrZKPCommit v_G - -let zkp_one_out_of_two_validate - (#v_G: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) - (h: v_G) - (zkp: t_OrZKPCommit v_G) - : bool = - let c = - Hacspec_ovn.Ovn_traits.f_hash #v_G - #FStar.Tactics.Typeclasses.solve - (Alloc.Slice.impl__into_vec #v_G - #Alloc.Alloc.t_Global - (Rust_primitives.unsize (Rust_primitives.Hax.box_new (let list = - [ - zkp.f_or_zkp_x; - zkp.f_or_zkp_y; - zkp.f_or_zkp_a1; - zkp.f_or_zkp_b1; - zkp.f_or_zkp_a2; - zkp.f_or_zkp_b2 - ] - in - FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 6); - Rust_primitives.Hax.array_of_list 6 list) - <: - Alloc.Boxed.t_Box (t_Array v_G (sz 6)) Alloc.Alloc.t_Global) - <: - Alloc.Boxed.t_Box (t_Slice v_G) Alloc.Alloc.t_Global) - <: - Alloc.Vec.t_Vec v_G Alloc.Alloc.t_Global) - in - c =. - (Hacspec_ovn.Ovn_traits.f_add #i1.f_Z - #FStar.Tactics.Typeclasses.solve - zkp.f_or_zkp_d1 - zkp.f_or_zkp_d2 - <: - i1.f_Z) && - zkp.f_or_zkp_a1 =. - (Hacspec_ovn.Ovn_traits.f_prod #v_G - #FStar.Tactics.Typeclasses.solve - (Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve zkp.f_or_zkp_r1 <: v_G) - (Hacspec_ovn.Ovn_traits.f_pow #v_G - #FStar.Tactics.Typeclasses.solve - zkp.f_or_zkp_x - zkp.f_or_zkp_d1 - <: - v_G) - <: - v_G) && - zkp.f_or_zkp_b1 =. - (Hacspec_ovn.Ovn_traits.f_prod #v_G - #FStar.Tactics.Typeclasses.solve - (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve h zkp.f_or_zkp_r1 <: v_G) - (Hacspec_ovn.Ovn_traits.f_pow #v_G - #FStar.Tactics.Typeclasses.solve - zkp.f_or_zkp_y - zkp.f_or_zkp_d1 - <: - v_G) - <: - v_G) && - zkp.f_or_zkp_a2 =. - (Hacspec_ovn.Ovn_traits.f_prod #v_G - #FStar.Tactics.Typeclasses.solve - (Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve zkp.f_or_zkp_r2 <: v_G) - (Hacspec_ovn.Ovn_traits.f_pow #v_G - #FStar.Tactics.Typeclasses.solve - zkp.f_or_zkp_x - zkp.f_or_zkp_d2 - <: - v_G) - <: - v_G) && - zkp.f_or_zkp_b2 =. - (Hacspec_ovn.Ovn_traits.f_prod #v_G - #FStar.Tactics.Typeclasses.solve - (Hacspec_ovn.Ovn_traits.f_pow #v_G #FStar.Tactics.Typeclasses.solve h zkp.f_or_zkp_r2 <: v_G) - (Hacspec_ovn.Ovn_traits.f_pow #v_G - #FStar.Tactics.Typeclasses.solve - (div #v_G - zkp.f_or_zkp_y - (Hacspec_ovn.Ovn_traits.f_g #v_G #FStar.Tactics.Typeclasses.solve () <: v_G) - <: - v_G) - zkp.f_or_zkp_d2 - <: - v_G) - <: - v_G) - -type t_OvnContractState (v_G: Type0) (n: usize) {| i1: Hacspec_ovn.Ovn_traits.t_Group v_G |} = { - f_g_pow_xis:t_Array v_G n; - f_zkp_xis:t_Array (t_SchnorrZKPCommit v_G) n; - f_commit_vis:t_Array i1.f_Z n; - f_g_pow_xi_yi_vis:t_Array v_G n; - f_zkp_vis:t_Array (t_OrZKPCommit v_G) n; - f_tally:u32; - f_round1:t_Array bool n -} - -(** Primary function in round 2, also opens commitment *) -let cast_vote - (#v_G: Type0) - (n: usize) - (#v_A #impl_574521470_: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] i3: Hacspec_ovn.Ovn_traits.t_Group v_G) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - i4: - Hacspec_concordium.Concordium_traits.t_HasActions v_A) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - i5: - Hacspec_concordium.Concordium_traits.t_HasReceiveContext impl_574521470_ Prims.unit) - (ctx: impl_574521470_) - (state: t_OvnContractState v_G n) - : Core.Result.t_Result (v_A & t_OvnContractState v_G n) - Concordium_contracts_common.Types.t_ParseError = - let _, out:(_ & - Core.Result.t_Result (t_CastVoteParam i3.f_Z) Concordium_contracts_common.Types.t_ParseError) = - Concordium_contracts_common.Traits.f_get #_ - #(t_CastVoteParam i3.f_Z) - #FStar.Tactics.Typeclasses.solve - (Hacspec_concordium.Concordium_traits.f_parameter_cursor #impl_574521470_ - #FStar.Tactics.Typeclasses.solve - ctx - <: - _) - in - match out with - | Core.Result.Result_Ok (params: t_CastVoteParam i3.f_Z) -> - let g_pow_yi:v_G = - compute_g_pow_yi #v_G n (cast (params.f_cvp_i <: u32) <: usize) state.f_g_pow_xis - in - let g_pow_xi_yi_vi:v_G = - compute_group_element_for_vote #v_G params.f_cvp_xi params.f_cvp_vote g_pow_yi - in - let zkp_vi:t_OrZKPCommit v_G = - zkp_one_out_of_two #v_G - params.f_cvp_zkp_random_w - params.f_cvp_zkp_random_r - params.f_cvp_zkp_random_d - g_pow_yi - params.f_cvp_xi - params.f_cvp_vote - in - let cast_vote_state_ret:t_OvnContractState v_G n = - Core.Clone.f_clone #(t_OvnContractState v_G n) #FStar.Tactics.Typeclasses.solve state - in - let cast_vote_state_ret:t_OvnContractState v_G n = - { - cast_vote_state_ret with - f_g_pow_xi_yi_vis - = - Rust_primitives.Hax.Monomorphized_update_at.update_at_usize cast_vote_state_ret - .f_g_pow_xi_yi_vis - (cast (params.f_cvp_i <: u32) <: usize) - g_pow_xi_yi_vi - } - <: - t_OvnContractState v_G n - in - let cast_vote_state_ret:t_OvnContractState v_G n = - { - cast_vote_state_ret with - f_zkp_vis - = - Rust_primitives.Hax.Monomorphized_update_at.update_at_usize cast_vote_state_ret.f_zkp_vis - (cast (params.f_cvp_i <: u32) <: usize) - zkp_vi - } - <: - t_OvnContractState v_G n - in - Core.Result.Result_Ok - (Hacspec_concordium.Concordium_traits.f_accept #v_A #FStar.Tactics.Typeclasses.solve (), - cast_vote_state_ret - <: - (v_A & t_OvnContractState v_G n)) - <: - Core.Result.t_Result (v_A & t_OvnContractState v_G n) - Concordium_contracts_common.Types.t_ParseError - | Core.Result.Result_Err err -> - Core.Result.Result_Err err - <: - Core.Result.t_Result (v_A & t_OvnContractState v_G n) - Concordium_contracts_common.Types.t_ParseError - -(** Commitment before round 2 *) -let commit_to_vote - (#v_G: Type0) - (n: usize) - (#v_A #impl_574521470_: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] i3: Hacspec_ovn.Ovn_traits.t_Group v_G) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - i4: - Hacspec_concordium.Concordium_traits.t_HasActions v_A) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - i5: - Hacspec_concordium.Concordium_traits.t_HasReceiveContext impl_574521470_ Prims.unit) - (ctx: impl_574521470_) - (state: t_OvnContractState v_G n) - : Core.Result.t_Result (v_A & t_OvnContractState v_G n) - Concordium_contracts_common.Types.t_ParseError = - let _, out:(_ & - Core.Result.t_Result (t_CastVoteParam i3.f_Z) Concordium_contracts_common.Types.t_ParseError) = - Concordium_contracts_common.Traits.f_get #_ - #(t_CastVoteParam i3.f_Z) - #FStar.Tactics.Typeclasses.solve - (Hacspec_concordium.Concordium_traits.f_parameter_cursor #impl_574521470_ - #FStar.Tactics.Typeclasses.solve - ctx - <: - _) - in - match out with - | Core.Result.Result_Ok (params: t_CastVoteParam i3.f_Z) -> - let _:Prims.unit = - Rust_primitives.Hax.failure "(FunctionalizeLoops) something is not implemented yet.\nLoop without mutation?" - "{\n for i in (core::iter::traits::collect::f_into_iter(core::ops::range::Range {\n f_start: 0,\n f_end: n,\n })) {\n (if BinOp::Ast\n .Or(\n core::ops::bit::Not::not(\n hacspec_ovn::ovn_group::schnorr_zkp_validate::<\n G,\n >(\n core::ops::index::Index::index(\n proj_hacspec_ovn::ovn_group::f_g_pow_xis(state),\n i,\n ),\n core::ops::index::Index::index(\n proj_hacspec_ovn::ovn_group::f_zkp_xis(state),\n i,\n ),\n ),\n ),\n core::ops::bit::Not::not(\n core::ops::index::Index::index(\n proj_hacspec_ovn::ovn_group::f_round1(state),\n i,\n ),\n ),\n )\n {\n {\n #[note(\n \"rhs.typ=core::ops::control_flow::t_ControlFlow>, concordium_contracts_common::types::t_ParseError>, rust_primitives::hax::t_Never>\"\n )]\n #[monadic_let(\n MException>,\n concordium_contracts_common::types::t_ParseError>>\n )]\n let hoist12: rust_primitives::hax::t_Never = {\n core::ops::control_flow::ControlFlow_Break(\n core::result::Result_Err(\n concordium_contracts_common::types::ParseError(),\n ),\n )\n };\n core::ops::control_flow::ControlFlow_Continue(\n rust_primitives::hax::never_to_any(hoist12),\n )\n }\n } else {\n core::ops::control_flow::ControlFlow_Continue(Tuple0)\n })\n }\n }" - - in - let g_pow_yi:v_G = - compute_g_pow_yi #v_G n (cast (params.f_cvp_i <: u32) <: usize) state.f_g_pow_xis - in - let g_pow_xi_yi_vi:v_G = - compute_group_element_for_vote #v_G params.f_cvp_xi params.f_cvp_vote g_pow_yi - in - let commit_vi = commit_to #v_G g_pow_xi_yi_vi in - let commit_to_vote_state_ret:t_OvnContractState v_G n = - Core.Clone.f_clone #(t_OvnContractState v_G n) #FStar.Tactics.Typeclasses.solve state - in - let commit_to_vote_state_ret:t_OvnContractState v_G n = - { - commit_to_vote_state_ret with - f_commit_vis - = - Rust_primitives.Hax.Monomorphized_update_at.update_at_usize commit_to_vote_state_ret - .f_commit_vis - (cast (params.f_cvp_i <: u32) <: usize) - commit_vi - } - <: - t_OvnContractState v_G n - in - Core.Result.Result_Ok - (Hacspec_concordium.Concordium_traits.f_accept #v_A #FStar.Tactics.Typeclasses.solve (), - commit_to_vote_state_ret - <: - (v_A & t_OvnContractState v_G n)) - <: - Core.Result.t_Result (v_A & t_OvnContractState v_G n) - Concordium_contracts_common.Types.t_ParseError - | Core.Result.Result_Err err -> - Core.Result.Result_Err err - <: - Core.Result.t_Result (v_A & t_OvnContractState v_G n) - Concordium_contracts_common.Types.t_ParseError - -let init_ovn_contract - (#v_G: Type0) - (n: usize) - (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Hacspec_ovn.Ovn_traits.t_Group v_G) - (_: Prims.unit) - : Core.Result.t_Result (t_OvnContractState v_G n) Hacspec_concordium.Concordium_types.t_Reject = - Core.Result.Result_Ok - ({ - f_g_pow_xis - = - Rust_primitives.Hax.repeat (Hacspec_ovn.Ovn_traits.f_group_one #v_G - #FStar.Tactics.Typeclasses.solve - () - <: - v_G) - n; - f_zkp_xis - = - Rust_primitives.Hax.repeat ({ - f_schnorr_zkp_u - = - Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () <: v_G; - f_schnorr_zkp_z - = - Hacspec_ovn.Ovn_traits.f_field_zero #i1.f_Z #FStar.Tactics.Typeclasses.solve () - <: - i1.f_Z; - f_schnorr_zkp_c - = - Hacspec_ovn.Ovn_traits.f_field_zero #i1.f_Z #FStar.Tactics.Typeclasses.solve () - <: - i1.f_Z - } - <: - t_SchnorrZKPCommit v_G) - n; - f_commit_vis - = - Rust_primitives.Hax.repeat (Hacspec_ovn.Ovn_traits.f_field_zero #i1.f_Z - #FStar.Tactics.Typeclasses.solve - () - <: - i1.f_Z) - n; - f_g_pow_xi_yi_vis - = - Rust_primitives.Hax.repeat (Hacspec_ovn.Ovn_traits.f_group_one #v_G - #FStar.Tactics.Typeclasses.solve - () - <: - v_G) - n; - f_zkp_vis - = - Rust_primitives.Hax.repeat ({ - f_or_zkp_x - = - Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () <: v_G; - f_or_zkp_y - = - Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () <: v_G; - f_or_zkp_a1 - = - Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () <: v_G; - f_or_zkp_b1 - = - Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () <: v_G; - f_or_zkp_a2 - = - Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () <: v_G; - f_or_zkp_b2 - = - Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () <: v_G; - f_or_zkp_c - = - Hacspec_ovn.Ovn_traits.f_field_zero #i1.f_Z #FStar.Tactics.Typeclasses.solve () - <: - i1.f_Z; - f_or_zkp_d1 - = - Hacspec_ovn.Ovn_traits.f_field_zero #i1.f_Z #FStar.Tactics.Typeclasses.solve () - <: - i1.f_Z; - f_or_zkp_d2 - = - Hacspec_ovn.Ovn_traits.f_field_zero #i1.f_Z #FStar.Tactics.Typeclasses.solve () - <: - i1.f_Z; - f_or_zkp_r1 - = - Hacspec_ovn.Ovn_traits.f_field_zero #i1.f_Z #FStar.Tactics.Typeclasses.solve () - <: - i1.f_Z; - f_or_zkp_r2 - = - Hacspec_ovn.Ovn_traits.f_field_zero #i1.f_Z #FStar.Tactics.Typeclasses.solve () - <: - i1.f_Z - } - <: - t_OrZKPCommit v_G) - n; - f_tally = 0ul; - f_round1 = Rust_primitives.Hax.repeat false n - } - <: - t_OvnContractState v_G n) - <: - Core.Result.t_Result (t_OvnContractState v_G n) Hacspec_concordium.Concordium_types.t_Reject - -(** Primary function in round 1 *) -let register_vote - (#v_G: Type0) - (n: usize) - (#v_A #impl_574521470_: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] i3: Hacspec_ovn.Ovn_traits.t_Group v_G) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - i4: - Hacspec_concordium.Concordium_traits.t_HasActions v_A) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - i5: - Hacspec_concordium.Concordium_traits.t_HasReceiveContext impl_574521470_ Prims.unit) - (ctx: impl_574521470_) - (state: t_OvnContractState v_G n) - : Core.Result.t_Result (v_A & t_OvnContractState v_G n) - Concordium_contracts_common.Types.t_ParseError = - let _, out:(_ & - Core.Result.t_Result (t_RegisterParam i3.f_Z) Concordium_contracts_common.Types.t_ParseError) = - Concordium_contracts_common.Traits.f_get #_ - #(t_RegisterParam i3.f_Z) - #FStar.Tactics.Typeclasses.solve - (Hacspec_concordium.Concordium_traits.f_parameter_cursor #impl_574521470_ - #FStar.Tactics.Typeclasses.solve - ctx - <: - _) - in - match out with - | Core.Result.Result_Ok (params: t_RegisterParam i3.f_Z) -> - let g_pow_xi:v_G = - Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve params.f_rp_xi - in - let zkp_xi:t_SchnorrZKPCommit v_G = - schnorr_zkp #v_G params.f_rp_zkp_random g_pow_xi params.f_rp_xi - in - let register_vote_state_ret:t_OvnContractState v_G n = - Core.Clone.f_clone #(t_OvnContractState v_G n) #FStar.Tactics.Typeclasses.solve state - in - let register_vote_state_ret:t_OvnContractState v_G n = - { - register_vote_state_ret with - f_g_pow_xis - = - Rust_primitives.Hax.Monomorphized_update_at.update_at_usize register_vote_state_ret - .f_g_pow_xis - (cast (params.f_rp_i <: u32) <: usize) - g_pow_xi - } - <: - t_OvnContractState v_G n - in - let register_vote_state_ret:t_OvnContractState v_G n = - { - register_vote_state_ret with - f_zkp_xis - = - Rust_primitives.Hax.Monomorphized_update_at.update_at_usize register_vote_state_ret - .f_zkp_xis - (cast (params.f_rp_i <: u32) <: usize) - zkp_xi - } - <: - t_OvnContractState v_G n - in - let register_vote_state_ret:t_OvnContractState v_G n = - { - register_vote_state_ret with - f_round1 - = - Rust_primitives.Hax.Monomorphized_update_at.update_at_usize register_vote_state_ret.f_round1 - (cast (params.f_rp_i <: u32) <: usize) - true - } - <: - t_OvnContractState v_G n - in - Core.Result.Result_Ok - (Hacspec_concordium.Concordium_traits.f_accept #v_A #FStar.Tactics.Typeclasses.solve (), - register_vote_state_ret - <: - (v_A & t_OvnContractState v_G n)) - <: - Core.Result.t_Result (v_A & t_OvnContractState v_G n) - Concordium_contracts_common.Types.t_ParseError - | Core.Result.Result_Err err -> - Core.Result.Result_Err err - <: - Core.Result.t_Result (v_A & t_OvnContractState v_G n) - Concordium_contracts_common.Types.t_ParseError - -(** Anyone can tally the votes *) -let tally_votes - (#v_G: Type0) - (n: usize) - (#v_A: Type0) - (#impl_574521470_: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] i3: Hacspec_ovn.Ovn_traits.t_Group v_G) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - i4: - Hacspec_concordium.Concordium_traits.t_HasActions v_A) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - i5: - Hacspec_concordium.Concordium_traits.t_HasReceiveContext impl_574521470_ Prims.unit) - (_: impl_574521470_) - (state: t_OvnContractState v_G n) - : Core.Result.t_Result (v_A & t_OvnContractState v_G n) - Concordium_contracts_common.Types.t_ParseError = - let _:Prims.unit = - Rust_primitives.Hax.failure "(FunctionalizeLoops) something is not implemented yet.\nLoop without mutation?" - "{\n for i in (core::iter::traits::collect::f_into_iter(core::ops::range::Range {\n f_start: 0,\n f_end: n,\n })) {\n {\n let g_pow_yi: G = {\n hacspec_ovn::ovn_group::compute_g_pow_yi::<\n G,\n generic_value!(todo),\n >(i, proj_hacspec_ovn::ovn_group::f_g_pow_xis(state))\n };\n {\n #[note(\n \"rhs.typ=core::ops::control_flow::t_ControlFlow>, concordium_contracts_common::types::t_ParseError>, core::ops::control_flow::t_ControlFlow>, concordium_contracts_common::types::t_ParseError>, tuple0>>\"\n )]\n #[monadic_let(\n MException>,\n concordium_contracts_common::types::t_ParseError>>\n )]\n let _: tuple0 = {\n core::ops::control_flow::ControlFlow_Continue(\n (if core::ops::bit::Not::not(\n hacspec_ovn::ovn_group::zkp_one_out_of_two_validate::<\n G,\n >(\n g_pow_yi,\n core::ops::index::Index::index(\n proj_hacspec_ovn::ovn_group::f_zkp_vis(state),\n i,\n ),\n ),\n ) {\n {\n #[note(\n \"rhs.typ=core::ops::control_flow::t_ControlFlow>, concordium_contracts_common::types::t_ParseError>, rust_primitives::hax::t_Never>\"\n )]\n #[monadic_let(\n MException>,\n concordium_contracts_common::types::t_ParseError>>\n )]\n let hoist13: rust_primitives::hax::t_Never = {\n core::ops::control_flow::ControlFlow_Break(\n core::result::Result_Err(\n concordium_contracts_common::types::ParseError(),\n ),\n )\n };\n core::ops::control_flow::ControlFlow_Continue(\n rust_primitives::hax::never_to_any(hoist13),\n )\n }\n } else {\n core::ops::control_flow::ControlFlow_Continue(Tuple0)\n }),\n )\n };\n (if core::ops::bit::Not::not(\n hacspec_ovn::ovn_group::check_commitment::<\n G,\n >(\n core::ops::index::Index::index(\n proj_hacspec_ovn::ovn_group::f_g_pow_xi_yi_vis(state),\n i,\n ),\n core::ops::index::Index::index(\n proj_hacspec_ovn::ovn_group::f_commit_vis(state),\n i,\n ),\n ),\n ) {\n {\n #[note(\n \"rhs.typ=core::ops::control_flow::t_ControlFlow>, concordium_contracts_common::types::t_ParseError>, rust_primitives::hax::t_Never>\"\n )]\n #[monadic_let(\n MException>,\n concordium_contracts_common::types::t_ParseError>>\n )]\n let hoist14: rust_primitives::hax::t_Never = {\n core::ops::control_flow::ControlFlow_Break(\n core::result::Result_Err(\n concordium_contracts_common::types::ParseError(),\n ),\n )\n };\n core::ops::control_flow::ControlFlow_Continue(\n rust_primitives::hax::never_to_any(hoist14),\n )\n }\n } else {\n core::ops::control_flow::ControlFlow_Continue(Tuple0)\n })\n }\n }\n }\n }" - - in - let vote_result:v_G = - Hacspec_ovn.Ovn_traits.f_group_one #v_G #FStar.Tactics.Typeclasses.solve () - in - let vote_result:v_G = - Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter #(t_Array v_G n) - #FStar.Tactics.Typeclasses.solve - state.f_g_pow_xi_yi_vis - <: - Core.Array.Iter.t_IntoIter v_G n) - vote_result - (fun vote_result g_pow_vote -> - let vote_result:v_G = vote_result in - let g_pow_vote:v_G = g_pow_vote in - Hacspec_ovn.Ovn_traits.f_prod #v_G #FStar.Tactics.Typeclasses.solve vote_result g_pow_vote - <: - v_G) - in - let tally:u32 = 0ul in - let curr = Hacspec_ovn.Ovn_traits.f_field_zero #i3.f_Z #FStar.Tactics.Typeclasses.solve () in - let curr, tally:(i3.f_Z & u32) = - Rust_primitives.Hax.Folds.fold_range 0ul - (cast (n <: usize) <: u32) - (fun temp_0_ temp_1_ -> - let curr, tally:(i3.f_Z & u32) = temp_0_ in - let _:u32 = temp_1_ in - true) - (curr, tally <: (i3.f_Z & u32)) - (fun temp_0_ i -> - let curr, tally:(i3.f_Z & u32) = temp_0_ in - let i:u32 = i in - let tally:u32 = - if - (Hacspec_ovn.Ovn_traits.f_g_pow #v_G #FStar.Tactics.Typeclasses.solve curr <: v_G) =. - vote_result - then - let tally:u32 = i in - tally - else tally - in - let curr = - Hacspec_ovn.Ovn_traits.f_add #i3.f_Z - #FStar.Tactics.Typeclasses.solve - curr - (Hacspec_ovn.Ovn_traits.f_field_one #i3.f_Z #FStar.Tactics.Typeclasses.solve () - <: - i3.f_Z) - in - curr, tally <: (i3.f_Z & u32)) - in - let tally_votes_state_ret:t_OvnContractState v_G n = - Core.Clone.f_clone #(t_OvnContractState v_G n) #FStar.Tactics.Typeclasses.solve state - in - let tally_votes_state_ret:t_OvnContractState v_G n = - { tally_votes_state_ret with f_tally = tally } <: t_OvnContractState v_G n - in - Core.Result.Result_Ok - (Hacspec_concordium.Concordium_traits.f_accept #v_A #FStar.Tactics.Typeclasses.solve (), - tally_votes_state_ret - <: - (v_A & t_OvnContractState v_G n)) - <: - Core.Result.t_Result (v_A & t_OvnContractState v_G n) - Concordium_contracts_common.Types.t_ParseError diff --git a/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_secp256k1.fst b/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_secp256k1.fst deleted file mode 100644 index 24c7113..0000000 --- a/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_secp256k1.fst +++ /dev/null @@ -1,740 +0,0 @@ -module Hacspec_ovn.Ovn_secp256k1 -#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" -open Core -open FStar.Mul - -let _ = - (* This module has implicit dependencies, here we make them explicit. *) - (* The implicit dependencies arise from typeclasses instances. *) - let open Concordium_contracts_common.Impls in - let open Concordium_contracts_common.Traits in - let open Hacspec_bip_340 in - let open Hacspec_lib.Seq in - let open Hacspec_ovn.Ovn_traits in - () - -type t_Group_curve = { f_g_val:Hacspec_bip_340.t_Point } - -[@@ FStar.Tactics.Typeclasses.tcinstance] -let impl_3: Concordium_contracts_common.Traits.t_Deserial t_Group_curve = - { - f_deserial_pre - = - (fun - (#v_R: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - i1: - Concordium_contracts_common.Traits.t_Read v_R) - (source: v_R) - -> - true); - f_deserial_post - = - (fun - (#v_R: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - i1: - Concordium_contracts_common.Traits.t_Read v_R) - (source: v_R) - (out1: - (v_R & Core.Result.t_Result t_Group_curve Concordium_contracts_common.Types.t_ParseError)) - -> - true); - f_deserial - = - fun - (#v_R: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Concordium_contracts_common.Traits.t_Read v_R) - (source: v_R) - -> - let tmp0, out:(v_R & Core.Result.t_Result bool Concordium_contracts_common.Types.t_ParseError) - = - Concordium_contracts_common.Traits.f_get #v_R #bool #FStar.Tactics.Typeclasses.solve source - in - let source:v_R = tmp0 in - match out with - | Core.Result.Result_Ok (b: bool) -> - let source, hax_temp_output:(v_R & - Core.Result.t_Result t_Group_curve Concordium_contracts_common.Types.t_ParseError) = - if b - then - let tmp0, out:(v_R & - Core.Result.t_Result (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - Concordium_contracts_common.Types.t_ParseError) = - Concordium_contracts_common.Traits.f_get #v_R - #(Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - #FStar.Tactics.Typeclasses.solve - source - in - let source:v_R = tmp0 in - match out with - | Core.Result.Result_Ok (vx: Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) -> - let tmp0, out:(v_R & - Core.Result.t_Result (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - Concordium_contracts_common.Types.t_ParseError) = - Concordium_contracts_common.Traits.f_get #v_R - #(Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - #FStar.Tactics.Typeclasses.solve - source - in - let source:v_R = tmp0 in - (match out with - | Core.Result.Result_Ok (vy: Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) -> - source, - (Core.Result.Result_Ok - ({ - f_g_val - = - Hacspec_bip_340.Point_Affine - (Hacspec_bip_340.impl__FieldElement__from_public_byte_seq_be #(Hacspec_lib.Seq.t_Seq - u8) - (Hacspec_lib.Seq.impl_52__from_vec #u8 vx <: Hacspec_lib.Seq.t_Seq u8), - Hacspec_bip_340.impl__FieldElement__from_public_byte_seq_be #(Hacspec_lib.Seq.t_Seq - u8) - (Hacspec_lib.Seq.impl_52__from_vec #u8 vy <: Hacspec_lib.Seq.t_Seq u8) - <: - (Hacspec_bip_340.t_FieldElement & Hacspec_bip_340.t_FieldElement)) - <: - Hacspec_bip_340.t_Point - } - <: - t_Group_curve) - <: - Core.Result.t_Result t_Group_curve - Concordium_contracts_common.Types.t_ParseError) - <: - (v_R & - Core.Result.t_Result t_Group_curve - Concordium_contracts_common.Types.t_ParseError) - | Core.Result.Result_Err err -> - source, - (Core.Ops.Control_flow.ControlFlow_Break - (source, - (Core.Result.Result_Err err - <: - Core.Result.t_Result t_Group_curve - Concordium_contracts_common.Types.t_ParseError) - <: - (v_R & - Core.Result.t_Result t_Group_curve - Concordium_contracts_common.Types.t_ParseError)) - <: - Core.Ops.Control_flow.t_ControlFlow - (v_R & - Core.Result.t_Result t_Group_curve - Concordium_contracts_common.Types.t_ParseError) - (Core.Result.t_Result t_Group_curve - Concordium_contracts_common.Types.t_ParseError)) - <: - (v_R & - Core.Result.t_Result t_Group_curve - Concordium_contracts_common.Types.t_ParseError)) - | Core.Result.Result_Err err -> - source, - (Core.Ops.Control_flow.ControlFlow_Break - (source, - (Core.Result.Result_Err err - <: - Core.Result.t_Result t_Group_curve - Concordium_contracts_common.Types.t_ParseError) - <: - (v_R & - Core.Result.t_Result t_Group_curve - Concordium_contracts_common.Types.t_ParseError)) - <: - Core.Ops.Control_flow.t_ControlFlow - (v_R & - Core.Result.t_Result t_Group_curve - Concordium_contracts_common.Types.t_ParseError) - (Core.Result.t_Result t_Group_curve Concordium_contracts_common.Types.t_ParseError - )) - <: - (v_R & - Core.Result.t_Result t_Group_curve Concordium_contracts_common.Types.t_ParseError) - else - source, - (Core.Result.Result_Ok - ({ f_g_val = Hacspec_bip_340.Point_AtInfinity <: Hacspec_bip_340.t_Point } - <: - t_Group_curve) - <: - Core.Result.t_Result t_Group_curve Concordium_contracts_common.Types.t_ParseError) - <: - (v_R & Core.Result.t_Result t_Group_curve Concordium_contracts_common.Types.t_ParseError - ) - in - source, hax_temp_output - <: - (v_R & Core.Result.t_Result t_Group_curve Concordium_contracts_common.Types.t_ParseError) - | Core.Result.Result_Err err -> - source, - (Core.Result.Result_Err err - <: - Core.Result.t_Result t_Group_curve Concordium_contracts_common.Types.t_ParseError) - <: - (v_R & Core.Result.t_Result t_Group_curve Concordium_contracts_common.Types.t_ParseError) - } - -[@@ FStar.Tactics.Typeclasses.tcinstance] -let impl_4: Concordium_contracts_common.Traits.t_Serial t_Group_curve = - { - f_serial_pre - = - (fun - (#v_W: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - i1: - Concordium_contracts_common.Traits.t_Write v_W) - (self: t_Group_curve) - (out: v_W) - -> - true); - f_serial_post - = - (fun - (#v_W: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - i1: - Concordium_contracts_common.Traits.t_Write v_W) - (self: t_Group_curve) - (out: v_W) - (out2: (v_W & Core.Result.t_Result Prims.unit i1.f_Err)) - -> - true); - f_serial - = - fun - (#v_W: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Concordium_contracts_common.Traits.t_Write v_W) - (self: t_Group_curve) - (out: v_W) - -> - Rust_primitives.Hax.Control_flow_monad.Mexception.run (let! out:v_W = - match self.f_g_val with - | Hacspec_bip_340.Point_Affine p -> - let tmp0, out1:(v_W & Core.Result.t_Result Prims.unit i1.f_Err) = - Concordium_contracts_common.Traits.f_serial #bool - #FStar.Tactics.Typeclasses.solve - #v_W - true - out - in - let out:v_W = tmp0 in - (match out1 with - | Core.Result.Result_Ok _ -> - let (vx: Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global):Alloc.Vec.t_Vec u8 - Alloc.Alloc.t_Global = - Alloc.Vec.impl__new #u8 () - in - let vx:Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = - Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter #(t_Slice - u8) - #FStar.Tactics.Typeclasses.solve - (Hacspec_lib.Seq.impl_41__native_slice #u8 - (Hacspec_bip_340.impl__FieldElement__to_public_byte_seq_be (Hacspec_bip_340.x - p - <: - Hacspec_bip_340.t_FieldElement) - <: - Hacspec_lib.Seq.t_Seq u8) - <: - t_Slice u8) - <: - Core.Slice.Iter.t_Iter u8) - vx - (fun vx x -> - let vx:Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = vx in - let x:u8 = x in - Alloc.Vec.impl_1__push #u8 - #Alloc.Alloc.t_Global - vx - (Core.Clone.f_clone #u8 #FStar.Tactics.Typeclasses.solve x <: u8) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - in - let tmp0, out1:(v_W & Core.Result.t_Result Prims.unit i1.f_Err) = - Concordium_contracts_common.Traits.f_serial #(Alloc.Vec.t_Vec u8 - Alloc.Alloc.t_Global) - #FStar.Tactics.Typeclasses.solve - #v_W - vx - out - in - let out:v_W = tmp0 in - (match out1 with - | Core.Result.Result_Ok _ -> - let (vy: Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global):Alloc.Vec.t_Vec u8 - Alloc.Alloc.t_Global = - Alloc.Vec.impl__new #u8 () - in - let vy:Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = - Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter #(t_Slice - u8) - #FStar.Tactics.Typeclasses.solve - (Hacspec_lib.Seq.impl_41__native_slice #u8 - (Hacspec_bip_340.impl__FieldElement__to_public_byte_seq_be (Hacspec_bip_340.y - p - <: - Hacspec_bip_340.t_FieldElement) - <: - Hacspec_lib.Seq.t_Seq u8) - <: - t_Slice u8) - <: - Core.Slice.Iter.t_Iter u8) - vy - (fun vy y -> - let vy:Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = vy in - let y:u8 = y in - Alloc.Vec.impl_1__push #u8 - #Alloc.Alloc.t_Global - vy - (Core.Clone.f_clone #u8 #FStar.Tactics.Typeclasses.solve y <: u8) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - in - let tmp0, out1:(v_W & Core.Result.t_Result Prims.unit i1.f_Err) = - Concordium_contracts_common.Traits.f_serial #(Alloc.Vec.t_Vec u8 - Alloc.Alloc.t_Global) - #FStar.Tactics.Typeclasses.solve - #v_W - vy - out - in - let out:v_W = tmp0 in - (match out1 with - | Core.Result.Result_Ok _ -> - Core.Ops.Control_flow.ControlFlow_Continue out - <: - Core.Ops.Control_flow.t_ControlFlow - (v_W & Core.Result.t_Result Prims.unit i1.f_Err) v_W - | Core.Result.Result_Err err -> - let! _:Prims.unit = - Core.Ops.Control_flow.ControlFlow_Break - (out, - (Core.Result.Result_Err err - <: - Core.Result.t_Result Prims.unit i1.f_Err) - <: - (v_W & Core.Result.t_Result Prims.unit i1.f_Err)) - <: - Core.Ops.Control_flow.t_ControlFlow - (v_W & Core.Result.t_Result Prims.unit i1.f_Err) Prims.unit - in - Core.Ops.Control_flow.ControlFlow_Continue out - <: - Core.Ops.Control_flow.t_ControlFlow - (v_W & Core.Result.t_Result Prims.unit i1.f_Err) v_W) - | Core.Result.Result_Err err -> - let! _:Prims.unit = - Core.Ops.Control_flow.ControlFlow_Break - (out, - (Core.Result.Result_Err err <: Core.Result.t_Result Prims.unit i1.f_Err) - <: - (v_W & Core.Result.t_Result Prims.unit i1.f_Err)) - <: - Core.Ops.Control_flow.t_ControlFlow - (v_W & Core.Result.t_Result Prims.unit i1.f_Err) Prims.unit - in - Core.Ops.Control_flow.ControlFlow_Continue out - <: - Core.Ops.Control_flow.t_ControlFlow - (v_W & Core.Result.t_Result Prims.unit i1.f_Err) v_W) - | Core.Result.Result_Err err -> - let! _:Prims.unit = - Core.Ops.Control_flow.ControlFlow_Break - (out, (Core.Result.Result_Err err <: Core.Result.t_Result Prims.unit i1.f_Err) - <: - (v_W & Core.Result.t_Result Prims.unit i1.f_Err)) - <: - Core.Ops.Control_flow.t_ControlFlow - (v_W & Core.Result.t_Result Prims.unit i1.f_Err) Prims.unit - in - Core.Ops.Control_flow.ControlFlow_Continue out - <: - Core.Ops.Control_flow.t_ControlFlow - (v_W & Core.Result.t_Result Prims.unit i1.f_Err) v_W) - | Hacspec_bip_340.Point_AtInfinity -> - let tmp0, out1:(v_W & Core.Result.t_Result Prims.unit i1.f_Err) = - Concordium_contracts_common.Traits.f_serial #bool - #FStar.Tactics.Typeclasses.solve - #v_W - false - out - in - let out:v_W = tmp0 in - match out1 with - | Core.Result.Result_Ok _ -> - Core.Ops.Control_flow.ControlFlow_Continue out - <: - Core.Ops.Control_flow.t_ControlFlow (v_W & Core.Result.t_Result Prims.unit i1.f_Err) - v_W - | Core.Result.Result_Err err -> - let! _:Prims.unit = - Core.Ops.Control_flow.ControlFlow_Break - (out, (Core.Result.Result_Err err <: Core.Result.t_Result Prims.unit i1.f_Err) - <: - (v_W & Core.Result.t_Result Prims.unit i1.f_Err)) - <: - Core.Ops.Control_flow.t_ControlFlow - (v_W & Core.Result.t_Result Prims.unit i1.f_Err) Prims.unit - in - Core.Ops.Control_flow.ControlFlow_Continue out - <: - Core.Ops.Control_flow.t_ControlFlow (v_W & Core.Result.t_Result Prims.unit i1.f_Err) - v_W - in - Core.Ops.Control_flow.ControlFlow_Continue - (let hax_temp_output:Core.Result.t_Result Prims.unit i1.f_Err = - Core.Result.Result_Ok (() <: Prims.unit) <: Core.Result.t_Result Prims.unit i1.f_Err - in - out, hax_temp_output <: (v_W & Core.Result.t_Result Prims.unit i1.f_Err)) - <: - Core.Ops.Control_flow.t_ControlFlow (v_W & Core.Result.t_Result Prims.unit i1.f_Err) - (v_W & Core.Result.t_Result Prims.unit i1.f_Err)) - } - -type t_Z_curve = { f_z_val:Hacspec_bip_340.t_Scalar } - -[@@ FStar.Tactics.Typeclasses.tcinstance] -let impl: Concordium_contracts_common.Traits.t_Deserial t_Z_curve = - { - f_deserial_pre - = - (fun - (#v_R: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - i1: - Concordium_contracts_common.Traits.t_Read v_R) - (source: v_R) - -> - true); - f_deserial_post - = - (fun - (#v_R: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - i1: - Concordium_contracts_common.Traits.t_Read v_R) - (source: v_R) - (out1: - (v_R & Core.Result.t_Result t_Z_curve Concordium_contracts_common.Types.t_ParseError)) - -> - true); - f_deserial - = - fun - (#v_R: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Concordium_contracts_common.Traits.t_Read v_R) - (source: v_R) - -> - let tmp0, out:(v_R & - Core.Result.t_Result (Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - Concordium_contracts_common.Types.t_ParseError) = - Concordium_contracts_common.Traits.f_get #v_R - #(Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - #FStar.Tactics.Typeclasses.solve - source - in - let source:v_R = tmp0 in - match out with - | Core.Result.Result_Ok (temp: Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) -> - let hax_temp_output:Core.Result.t_Result t_Z_curve - Concordium_contracts_common.Types.t_ParseError = - Core.Result.Result_Ok - ({ - f_z_val - = - Hacspec_bip_340.impl__Scalar__from_public_byte_seq_be #(Hacspec_lib.Seq.t_Seq u8) - (Hacspec_lib.Seq.impl_52__from_vec #u8 temp <: Hacspec_lib.Seq.t_Seq u8) - } - <: - t_Z_curve) - <: - Core.Result.t_Result t_Z_curve Concordium_contracts_common.Types.t_ParseError - in - source, hax_temp_output - <: - (v_R & Core.Result.t_Result t_Z_curve Concordium_contracts_common.Types.t_ParseError) - | Core.Result.Result_Err err -> - source, - (Core.Result.Result_Err err - <: - Core.Result.t_Result t_Z_curve Concordium_contracts_common.Types.t_ParseError) - <: - (v_R & Core.Result.t_Result t_Z_curve Concordium_contracts_common.Types.t_ParseError) - } - -[@@ FStar.Tactics.Typeclasses.tcinstance] -let impl_1: Concordium_contracts_common.Traits.t_Serial t_Z_curve = - { - f_serial_pre - = - (fun - (#v_W: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - i1: - Concordium_contracts_common.Traits.t_Write v_W) - (self: t_Z_curve) - (out: v_W) - -> - true); - f_serial_post - = - (fun - (#v_W: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] - i1: - Concordium_contracts_common.Traits.t_Write v_W) - (self: t_Z_curve) - (out: v_W) - (out2: (v_W & Core.Result.t_Result Prims.unit i1.f_Err)) - -> - true); - f_serial - = - fun - (#v_W: Type0) - (#[FStar.Tactics.Typeclasses.tcresolve ()] i1: Concordium_contracts_common.Traits.t_Write v_W) - (self: t_Z_curve) - (out: v_W) - -> - let (v: Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global):Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = - Alloc.Vec.impl__new #u8 () - in - let v:Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = - Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter #(t_Slice u8) - #FStar.Tactics.Typeclasses.solve - (Hacspec_lib.Seq.impl_41__native_slice #u8 - (Hacspec_bip_340.impl__Scalar__to_public_byte_seq_be self.f_z_val - <: - Hacspec_lib.Seq.t_Seq u8) - <: - t_Slice u8) - <: - Core.Slice.Iter.t_Iter u8) - v - (fun v x -> - let v:Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global = v in - let x:u8 = x in - Alloc.Vec.impl_1__push #u8 - #Alloc.Alloc.t_Global - v - (Core.Clone.f_clone #u8 #FStar.Tactics.Typeclasses.solve x <: u8) - <: - Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - in - let tmp0, out1:(v_W & Core.Result.t_Result Prims.unit i1.f_Err) = - Concordium_contracts_common.Traits.f_serial #(Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global) - #FStar.Tactics.Typeclasses.solve - #v_W - v - out - in - let out:v_W = tmp0 in - let hax_temp_output:Core.Result.t_Result Prims.unit i1.f_Err = out1 in - out, hax_temp_output <: (v_W & Core.Result.t_Result Prims.unit i1.f_Err) - } - -[@@ FStar.Tactics.Typeclasses.tcinstance] -let impl_2: Hacspec_ovn.Ovn_traits.t_Field t_Z_curve = - { - _super_11581440318597584651 = FStar.Tactics.Typeclasses.solve; - _super_12632649257025169145 = FStar.Tactics.Typeclasses.solve; - _super_8099741844003281729 = FStar.Tactics.Typeclasses.solve; - _super_9442900250278684536 = FStar.Tactics.Typeclasses.solve; - _super_11581440318597584651 = FStar.Tactics.Typeclasses.solve; - _super_17605656595743636193 = FStar.Tactics.Typeclasses.solve; - f_q_pre = (fun (_: Prims.unit) -> true); - f_q_post = (fun (_: Prims.unit) (out: t_Z_curve) -> true); - f_q - = - (fun (_: Prims.unit) -> - { - f_z_val - = - Hacspec_bip_340.impl__Scalar__from_hex "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141" - - } - <: - t_Z_curve); - f_random_field_elem_pre = (fun (random: u32) -> true); - f_random_field_elem_post = (fun (random: u32) (out: t_Z_curve) -> true); - f_random_field_elem - = - (fun (random: u32) -> - { f_z_val = Hacspec_bip_340.impl__Scalar__from_literal (cast (random <: u32) <: u128) } - <: - t_Z_curve); - f_field_zero_pre = (fun (_: Prims.unit) -> true); - f_field_zero_post = (fun (_: Prims.unit) (out: t_Z_curve) -> true); - f_field_zero - = - (fun (_: Prims.unit) -> - { f_z_val = Hacspec_bip_340.impl__Scalar__from_literal (pub_u128 0) } <: t_Z_curve); - f_field_one_pre = (fun (_: Prims.unit) -> true); - f_field_one_post = (fun (_: Prims.unit) (out: t_Z_curve) -> true); - f_field_one - = - (fun (_: Prims.unit) -> - { f_z_val = Hacspec_bip_340.impl__Scalar__from_literal (pub_u128 1) } <: t_Z_curve); - f_add_pre = (fun (x: t_Z_curve) (y: t_Z_curve) -> true); - f_add_post = (fun (x: t_Z_curve) (y: t_Z_curve) (out: t_Z_curve) -> true); - f_add = (fun (x: t_Z_curve) (y: t_Z_curve) -> { f_z_val = x.f_z_val +! y.f_z_val } <: t_Z_curve); - f_opp_pre = (fun (x: t_Z_curve) -> true); - f_opp_post = (fun (x: t_Z_curve) (out: t_Z_curve) -> true); - f_opp - = - (fun (x: t_Z_curve) -> - { - f_z_val - = - (Hacspec_ovn.Ovn_traits.f_field_zero #t_Z_curve #FStar.Tactics.Typeclasses.solve () - <: - t_Z_curve) - .f_z_val -! - x.f_z_val - } - <: - t_Z_curve); - f_mul_pre = (fun (x: t_Z_curve) (y: t_Z_curve) -> true); - f_mul_post = (fun (x: t_Z_curve) (y: t_Z_curve) (out: t_Z_curve) -> true); - f_mul = (fun (x: t_Z_curve) (y: t_Z_curve) -> { f_z_val = x.f_z_val *! y.f_z_val } <: t_Z_curve); - f_inv_pre = (fun (x: t_Z_curve) -> true); - f_inv_post = (fun (x: t_Z_curve) (out: t_Z_curve) -> true); - f_inv - = - fun (x: t_Z_curve) -> - Rust_primitives.Hax.Control_flow_monad.Mexception.run (let _:Prims.unit = - Hax_lib.v_assert false - in - let! hoist10:Rust_primitives.Hax.t_Never = - Core.Ops.Control_flow.ControlFlow_Break x - <: - Core.Ops.Control_flow.t_ControlFlow t_Z_curve Rust_primitives.Hax.t_Never - in - Core.Ops.Control_flow.ControlFlow_Continue (Rust_primitives.Hax.never_to_any hoist10) - <: - Core.Ops.Control_flow.t_ControlFlow t_Z_curve t_Z_curve) - } - -[@@ FStar.Tactics.Typeclasses.tcinstance] -let impl_5: Hacspec_ovn.Ovn_traits.t_Group t_Group_curve = - { - _super_11581440318597584651 = FStar.Tactics.Typeclasses.solve; - _super_12632649257025169145 = FStar.Tactics.Typeclasses.solve; - _super_8099741844003281729 = FStar.Tactics.Typeclasses.solve; - _super_9442900250278684536 = FStar.Tactics.Typeclasses.solve; - _super_11581440318597584651 = FStar.Tactics.Typeclasses.solve; - _super_17605656595743636193 = FStar.Tactics.Typeclasses.solve; - f_Z = t_Z_curve; - f_Z_5568683927164688039 = FStar.Tactics.Typeclasses.solve; - f_g_pre = (fun (_: Prims.unit) -> true); - f_g_post = (fun (_: Prims.unit) (out: t_Group_curve) -> true); - f_g - = - (fun (_: Prims.unit) -> - let gx:Hacspec_bip_340.t_PBytes32 = - Hacspec_bip_340.PBytes32 - (let list = - [ - 121uy; 190uy; 102uy; 126uy; 249uy; 220uy; 187uy; 172uy; 85uy; 160uy; 98uy; 149uy; - 206uy; 135uy; 11uy; 7uy; 2uy; 155uy; 252uy; 219uy; 45uy; 206uy; 40uy; 217uy; 89uy; - 242uy; 129uy; 91uy; 22uy; 248uy; 23uy; 152uy - ] - in - FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 32); - Rust_primitives.Hax.array_of_list 32 list) - <: - Hacspec_bip_340.t_PBytes32 - in - let gy:Hacspec_bip_340.t_PBytes32 = - Hacspec_bip_340.PBytes32 - (let list = - [ - 72uy; 58uy; 218uy; 119uy; 38uy; 163uy; 196uy; 101uy; 93uy; 164uy; 251uy; 252uy; 14uy; - 17uy; 8uy; 168uy; 253uy; 23uy; 180uy; 72uy; 166uy; 133uy; 84uy; 25uy; 156uy; 71uy; - 208uy; 143uy; 251uy; 16uy; 212uy; 184uy - ] - in - FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 32); - Rust_primitives.Hax.array_of_list 32 list) - <: - Hacspec_bip_340.t_PBytes32 - in - { - f_g_val - = - Hacspec_bip_340.Point_Affine - (Hacspec_bip_340.impl__FieldElement__from_public_byte_seq_be #Hacspec_bip_340.t_PBytes32 - gx, - Hacspec_bip_340.impl__FieldElement__from_public_byte_seq_be #Hacspec_bip_340.t_PBytes32 - gy - <: - (Hacspec_bip_340.t_FieldElement & Hacspec_bip_340.t_FieldElement)) - <: - Hacspec_bip_340.t_Point - } - <: - t_Group_curve); - f_pow_pre = (fun (g: t_Group_curve) (x: t_Z_curve) -> true); - f_pow_post = (fun (g: t_Group_curve) (x: t_Z_curve) (out: t_Group_curve) -> true); - f_pow - = - (fun (g: t_Group_curve) (x: t_Z_curve) -> - { f_g_val = Hacspec_bip_340.point_mul x.f_z_val g.f_g_val } <: t_Group_curve); - f_g_pow_pre = (fun (x: t_Z_curve) -> true); - f_g_pow_post = (fun (x: t_Z_curve) (out: t_Group_curve) -> true); - f_g_pow - = - (fun (x: t_Z_curve) -> { f_g_val = Hacspec_bip_340.point_mul_base x.f_z_val } <: t_Group_curve); - f_group_one_pre = (fun (_: Prims.unit) -> true); - f_group_one_post = (fun (_: Prims.unit) (out: t_Group_curve) -> true); - f_group_one - = - (fun (_: Prims.unit) -> - Hacspec_ovn.Ovn_traits.f_g_pow #t_Group_curve - #FStar.Tactics.Typeclasses.solve - (Hacspec_ovn.Ovn_traits.f_field_zero #t_Z_curve #FStar.Tactics.Typeclasses.solve () - <: - t_Z_curve)); - f_prod_pre = (fun (x: t_Group_curve) (y: t_Group_curve) -> true); - f_prod_post = (fun (x: t_Group_curve) (y: t_Group_curve) (out: t_Group_curve) -> true); - f_prod - = - (fun (x: t_Group_curve) (y: t_Group_curve) -> - { f_g_val = Hacspec_bip_340.point_add x.f_g_val y.f_g_val } <: t_Group_curve); - f_group_inv_pre = (fun (x: t_Group_curve) -> true); - f_group_inv_post = (fun (x: t_Group_curve) (out: t_Group_curve) -> true); - f_group_inv - = - (fun (x: t_Group_curve) -> - { - f_g_val - = - match x.f_g_val with - | Hacspec_bip_340.Point_Affine (a, b) -> - Hacspec_bip_340.Point_Affine - (a, - (Hacspec_bip_340.impl__FieldElement__from_literal (pub_u128 0) - <: - Hacspec_bip_340.t_FieldElement) -! - b - <: - (Hacspec_bip_340.t_FieldElement & Hacspec_bip_340.t_FieldElement)) - <: - Hacspec_bip_340.t_Point - | Hacspec_bip_340.Point_AtInfinity -> - Hacspec_bip_340.Point_AtInfinity <: Hacspec_bip_340.t_Point - } - <: - t_Group_curve); - f_hash_pre = (fun (x: Alloc.Vec.t_Vec t_Group_curve Alloc.Alloc.t_Global) -> true); - f_hash_post - = - (fun (x: Alloc.Vec.t_Vec t_Group_curve Alloc.Alloc.t_Global) (out: t_Z_curve) -> true); - f_hash - = - fun (x: Alloc.Vec.t_Vec t_Group_curve Alloc.Alloc.t_Global) -> - Hacspec_ovn.Ovn_traits.f_field_one #t_Z_curve #FStar.Tactics.Typeclasses.solve () - } diff --git a/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_traits.fst b/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_traits.fst deleted file mode 100644 index cc7184a..0000000 --- a/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_traits.fst +++ /dev/null @@ -1,101 +0,0 @@ -module Hacspec_ovn.Ovn_traits -#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" -open Core -open FStar.Mul - -let _ = - (* This module has implicit dependencies, here we make them explicit. *) - (* The implicit dependencies arise from typeclasses instances. *) - let open Concordium_contracts_common.Traits in - () - -(* item error backend: (reject_TraitItemDefault) ExplicitRejection { reason: "a node of kind [Trait_item_default] have been found in the AST" } -Last available AST for this item: - -/** Interface for field implementation */#[no_std()]#[feature(register_tool)]#[register_tool(hax)]#[no_std()]#[feature(register_tool)]#[register_tool(hax)]#[feature(trait_alias)]#[register_tool(_hax)]trait t_Field where _:core::marker::t_Copy,_:core::cmp::t_PartialEq,_:core::cmp::t_Eq,_:core::clone::t_Clone,_:concordium_contracts_common::traits::t_Serialize{#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_q_pre(_: tuple0) -> bool; -#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_q_post(_: tuple0,_: Self) -> bool; -fn f_q(_: tuple0) -> Self; -#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_random_field_elem_pre(_: int) -> bool; -#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_random_field_elem_post(_: int,_: Self) -> bool; -fn f_random_field_elem(_: int) -> Self; -#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_field_zero_pre(_: tuple0) -> bool; -#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_field_zero_post(_: tuple0,_: Self) -> bool; -fn f_field_zero(_: tuple0) -> Self; -#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_field_one_pre(_: tuple0) -> bool; -#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_field_one_post(_: tuple0,_: Self) -> bool; -fn f_field_one(_: tuple0) -> Self; -#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_add_pre(_: Self,_: Self) -> bool; -#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_add_post(_: Self,_: Self,_: Self) -> bool; -fn f_add(_: Self,_: Self) -> Self; -#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_opp_pre(_: Self) -> bool; -#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_opp_post(_: Self,_: Self) -> bool; -fn f_opp(_: Self) -> Self; -#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_mul_pre(_: Self,_: Self) -> bool; -#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_mul_post(_: Self,_: Self,_: Self) -> bool; -fn f_mul(_: Self,_: Self) -> Self; -#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_inv_pre(_: Self) -> bool; -#[_hax::json("\"TraitMethodNoPrePost\"")]fn f_inv_post(_: Self,_: Self) -> bool; -fn f_inv(_: Self) -> Self; -#[_hax::json("{\"ItemStatus\":{\"Included\":{\"late_skip\":true}}}")]fn f____(()) -> tuple0{Tuple0} -#[_hax::json("{\"ItemStatus\":{\"Included\":{\"late_skip\":true}}}")]fn f____1(()) -> tuple0{Tuple0} -#[_hax::json("\"Lemma\"")]fn f_addC((x: Z,y: Z)) -> tuple0 where _:hacspec_ovn::ovn_traits::t_Field{Tuple0}} - -Last AST: -/** print_rust: pitem: not implemented (item: { Concrete_ident.T.def_id = - { Concrete_ident.Imported.krate = "hacspec_ovn"; - path = - [{ Concrete_ident.Imported.data = - (Concrete_ident.Imported.TypeNs "ovn_traits"); disambiguator = 0 }; - { Concrete_ident.Imported.data = - (Concrete_ident.Imported.TypeNs "Field"); disambiguator = 0 } - ] - }; - kind = Concrete_ident.Kind.Value }) */ -const _: () = (); - *) - -(** Interface for group implementation *) -class t_Group (v_Self: Type0) = { - [@@@ FStar.Tactics.Typeclasses.no_method]_super_11581440318597584651:Core.Marker.t_Copy v_Self; - [@@@ FStar.Tactics.Typeclasses.no_method]_super_12632649257025169145:Core.Cmp.t_PartialEq v_Self - v_Self; - [@@@ FStar.Tactics.Typeclasses.no_method]_super_8099741844003281729:Core.Cmp.t_Eq v_Self; - [@@@ FStar.Tactics.Typeclasses.no_method]_super_9442900250278684536:Core.Clone.t_Clone v_Self; - [@@@ FStar.Tactics.Typeclasses.no_method]_super_17605656595743636193:Concordium_contracts_common.Traits.t_Serialize - v_Self; - f_Z:Type0; - f_Z_5568683927164688039:t_Field f_Z; - f_Z_6036424691684178845:Concordium_contracts_common.Traits.t_Serialize f_Z; - f_Z_5944877312583825506:Concordium_contracts_common.Traits.t_Deserial f_Z; - f_Z_2631562626655622548:Concordium_contracts_common.Traits.t_Serial f_Z; - f_Z_7106659769471979108:Core.Clone.t_Clone f_Z; - f_Z_5227107583605841272:Core.Cmp.t_Eq f_Z; - f_Z_13069512637334391294:Core.Cmp.t_PartialEq f_Z f_Z; - f_Z_16774959407837281168:Core.Marker.t_Copy f_Z; - f_g_pre:Prims.unit -> Type0; - f_g_post:Prims.unit -> v_Self -> Type0; - f_g:x0: Prims.unit -> Prims.Pure v_Self (f_g_pre x0) (fun result -> f_g_post x0 result); - f_g_pow_pre:f_Z -> Type0; - f_g_pow_post:f_Z -> v_Self -> Type0; - f_g_pow:x0: f_Z -> Prims.Pure v_Self (f_g_pow_pre x0) (fun result -> f_g_pow_post x0 result); - f_pow_pre:v_Self -> f_Z -> Type0; - f_pow_post:v_Self -> f_Z -> v_Self -> Type0; - f_pow:x0: v_Self -> x1: f_Z - -> Prims.Pure v_Self (f_pow_pre x0 x1) (fun result -> f_pow_post x0 x1 result); - f_group_one_pre:Prims.unit -> Type0; - f_group_one_post:Prims.unit -> v_Self -> Type0; - f_group_one:x0: Prims.unit - -> Prims.Pure v_Self (f_group_one_pre x0) (fun result -> f_group_one_post x0 result); - f_prod_pre:v_Self -> v_Self -> Type0; - f_prod_post:v_Self -> v_Self -> v_Self -> Type0; - f_prod:x0: v_Self -> x1: v_Self - -> Prims.Pure v_Self (f_prod_pre x0 x1) (fun result -> f_prod_post x0 x1 result); - f_group_inv_pre:v_Self -> Type0; - f_group_inv_post:v_Self -> v_Self -> Type0; - f_group_inv:x0: v_Self - -> Prims.Pure v_Self (f_group_inv_pre x0) (fun result -> f_group_inv_post x0 result); - f_hash_pre:Alloc.Vec.t_Vec v_Self Alloc.Alloc.t_Global -> Type0; - f_hash_post:Alloc.Vec.t_Vec v_Self Alloc.Alloc.t_Global -> f_Z -> Type0; - f_hash:x0: Alloc.Vec.t_Vec v_Self Alloc.Alloc.t_Global - -> Prims.Pure f_Z (f_hash_pre x0) (fun result -> f_hash_post x0 result) -} diff --git a/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_z_89_.fst b/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_z_89_.fst deleted file mode 100644 index d0ebfe3..0000000 --- a/ovn/proofs/fstar/extraction/Hacspec_ovn.Ovn_z_89_.fst +++ /dev/null @@ -1,226 +0,0 @@ -module Hacspec_ovn.Ovn_z_89_ -#set-options "--fuel 0 --ifuel 1 --z3rlimit 15" -open Core -open FStar.Mul - -let _ = - (* This module has implicit dependencies, here we make them explicit. *) - (* The implicit dependencies arise from typeclasses instances. *) - let open Concordium_contracts_common.Traits in - let open Hacspec_ovn.Ovn_traits in - () - -type t_g_z_89_ = { f_g_val:u8 } - -type t_z_89_ = { f_z_val:u8 } - -[@@ FStar.Tactics.Typeclasses.tcinstance] -let impl: Hacspec_ovn.Ovn_traits.t_Field t_z_89_ = - { - _super_11581440318597584651 = FStar.Tactics.Typeclasses.solve; - _super_12632649257025169145 = FStar.Tactics.Typeclasses.solve; - _super_8099741844003281729 = FStar.Tactics.Typeclasses.solve; - _super_9442900250278684536 = FStar.Tactics.Typeclasses.solve; - _super_11581440318597584651 = FStar.Tactics.Typeclasses.solve; - _super_17605656595743636193 = FStar.Tactics.Typeclasses.solve; - f_q_pre = (fun (_: Prims.unit) -> true); - f_q_post = (fun (_: Prims.unit) (out: t_z_89_) -> true); - f_q = (fun (_: Prims.unit) -> { f_z_val = 89uy } <: t_z_89_); - f_random_field_elem_pre = (fun (random: u32) -> true); - f_random_field_elem_post = (fun (random: u32) (out: t_z_89_) -> true); - f_random_field_elem - = - (fun (random: u32) -> - { - f_z_val - = - (cast (random <: u32) <: u8) %! - ((Hacspec_ovn.Ovn_traits.f_q #t_z_89_ #FStar.Tactics.Typeclasses.solve () <: t_z_89_) - .f_z_val -! - 1uy - <: - u8) - } - <: - t_z_89_); - f_field_zero_pre = (fun (_: Prims.unit) -> true); - f_field_zero_post = (fun (_: Prims.unit) (out: t_z_89_) -> true); - f_field_zero = (fun (_: Prims.unit) -> { f_z_val = 0uy } <: t_z_89_); - f_field_one_pre = (fun (_: Prims.unit) -> true); - f_field_one_post = (fun (_: Prims.unit) (out: t_z_89_) -> true); - f_field_one = (fun (_: Prims.unit) -> { f_z_val = 1uy } <: t_z_89_); - f_add_pre = (fun (x: t_z_89_) (y: t_z_89_) -> true); - f_add_post = (fun (x: t_z_89_) (y: t_z_89_) (out: t_z_89_) -> true); - f_add - = - (fun (x: t_z_89_) (y: t_z_89_) -> - let q___:u8 = - (Hacspec_ovn.Ovn_traits.f_q #t_z_89_ #FStar.Tactics.Typeclasses.solve () <: t_z_89_) - .f_z_val -! - 1uy - in - let x___:u8 = x.f_z_val %! q___ in - let y___:u8 = y.f_z_val %! q___ in - { f_z_val = (x___ +! y___ <: u8) %! q___ } <: t_z_89_); - f_opp_pre = (fun (x: t_z_89_) -> true); - f_opp_post = (fun (x: t_z_89_) (out: t_z_89_) -> true); - f_opp - = - (fun (x: t_z_89_) -> - let q___:u8 = - (Hacspec_ovn.Ovn_traits.f_q #t_z_89_ #FStar.Tactics.Typeclasses.solve () <: t_z_89_) - .f_z_val -! - 1uy - in - let x___:u8 = x.f_z_val %! q___ in - { f_z_val = q___ -! x___ } <: t_z_89_); - f_mul_pre = (fun (x: t_z_89_) (y: t_z_89_) -> true); - f_mul_post = (fun (x: t_z_89_) (y: t_z_89_) (out: t_z_89_) -> true); - f_mul - = - (fun (x: t_z_89_) (y: t_z_89_) -> - let q___:u8 = - (Hacspec_ovn.Ovn_traits.f_q #t_z_89_ #FStar.Tactics.Typeclasses.solve () <: t_z_89_) - .f_z_val -! - 1uy - in - let (x___: u16):u16 = cast (x.f_z_val %! q___ <: u8) <: u16 in - let (y___: u16):u16 = cast (y.f_z_val %! q___ <: u8) <: u16 in - { f_z_val = cast ((x___ *! y___ <: u16) %! (cast (q___ <: u8) <: u16) <: u16) <: u8 } - <: - t_z_89_); - f_inv_pre = (fun (x: t_z_89_) -> true); - f_inv_post = (fun (x: t_z_89_) (out: t_z_89_) -> true); - f_inv - = - fun (x: t_z_89_) -> - Rust_primitives.Hax.Control_flow_monad.Mexception.run (let _:Prims.unit = - Hax_lib.v_assert false - in - let! hoist11:Rust_primitives.Hax.t_Never = - Core.Ops.Control_flow.ControlFlow_Break x - <: - Core.Ops.Control_flow.t_ControlFlow t_z_89_ Rust_primitives.Hax.t_Never - in - Core.Ops.Control_flow.ControlFlow_Continue (Rust_primitives.Hax.never_to_any hoist11) - <: - Core.Ops.Control_flow.t_ControlFlow t_z_89_ t_z_89_) - } - -[@@ FStar.Tactics.Typeclasses.tcinstance] -let impl_1: Hacspec_ovn.Ovn_traits.t_Group t_g_z_89_ = - { - _super_11581440318597584651 = FStar.Tactics.Typeclasses.solve; - _super_12632649257025169145 = FStar.Tactics.Typeclasses.solve; - _super_8099741844003281729 = FStar.Tactics.Typeclasses.solve; - _super_9442900250278684536 = FStar.Tactics.Typeclasses.solve; - _super_11581440318597584651 = FStar.Tactics.Typeclasses.solve; - _super_17605656595743636193 = FStar.Tactics.Typeclasses.solve; - f_Z = t_z_89_; - f_Z_5568683927164688039 = FStar.Tactics.Typeclasses.solve; - f_g_pre = (fun (_: Prims.unit) -> true); - f_g_post = (fun (_: Prims.unit) (out: t_g_z_89_) -> true); - f_g = (fun (_: Prims.unit) -> { f_g_val = 3uy } <: t_g_z_89_); - f_hash_pre = (fun (x: Alloc.Vec.t_Vec t_g_z_89_ Alloc.Alloc.t_Global) -> true); - f_hash_post = (fun (x: Alloc.Vec.t_Vec t_g_z_89_ Alloc.Alloc.t_Global) (out: t_z_89_) -> true); - f_hash - = - (fun (x: Alloc.Vec.t_Vec t_g_z_89_ Alloc.Alloc.t_Global) -> - let res:t_z_89_ = - Hacspec_ovn.Ovn_traits.f_field_one #t_z_89_ #FStar.Tactics.Typeclasses.solve () - in - let res:t_z_89_ = - Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter #(Alloc.Vec.t_Vec - t_g_z_89_ Alloc.Alloc.t_Global) - #FStar.Tactics.Typeclasses.solve - x - <: - Alloc.Vec.Into_iter.t_IntoIter t_g_z_89_ Alloc.Alloc.t_Global) - res - (fun res y -> - let res:t_z_89_ = res in - let y:t_g_z_89_ = y in - Hacspec_ovn.Ovn_traits.f_mul #t_z_89_ - #FStar.Tactics.Typeclasses.solve - ({ f_z_val = y.f_g_val } <: t_z_89_) - res - <: - t_z_89_) - in - res); - f_g_pow_pre = (fun (x: t_z_89_) -> true); - f_g_pow_post = (fun (x: t_z_89_) (out: t_g_z_89_) -> true); - f_g_pow - = - (fun (x: t_z_89_) -> - Hacspec_ovn.Ovn_traits.f_pow #t_g_z_89_ - #FStar.Tactics.Typeclasses.solve - (Hacspec_ovn.Ovn_traits.f_g #t_g_z_89_ #FStar.Tactics.Typeclasses.solve () <: t_g_z_89_) - x); - f_pow_pre = (fun (g: t_g_z_89_) (x: t_z_89_) -> true); - f_pow_post = (fun (g: t_g_z_89_) (x: t_z_89_) (out: t_g_z_89_) -> true); - f_pow - = - (fun (g: t_g_z_89_) (x: t_z_89_) -> - let result:t_g_z_89_ = - Hacspec_ovn.Ovn_traits.f_group_one #t_g_z_89_ #FStar.Tactics.Typeclasses.solve () - in - let result:t_g_z_89_ = - Rust_primitives.Hax.Folds.fold_range 0uy - (x.f_z_val %! - ((Hacspec_ovn.Ovn_traits.f_q #t_z_89_ #FStar.Tactics.Typeclasses.solve () <: t_z_89_) - .f_z_val -! - 1uy - <: - u8) - <: - u8) - (fun result temp_1_ -> - let result:t_g_z_89_ = result in - let _:u8 = temp_1_ in - true) - result - (fun result temp_1_ -> - let result:t_g_z_89_ = result in - let _:u8 = temp_1_ in - Hacspec_ovn.Ovn_traits.f_prod #t_g_z_89_ #FStar.Tactics.Typeclasses.solve result g - <: - t_g_z_89_) - in - result); - f_group_one_pre = (fun (_: Prims.unit) -> true); - f_group_one_post = (fun (_: Prims.unit) (out: t_g_z_89_) -> true); - f_group_one = (fun (_: Prims.unit) -> { f_g_val = 1uy } <: t_g_z_89_); - f_prod_pre = (fun (x: t_g_z_89_) (y: t_g_z_89_) -> true); - f_prod_post = (fun (x: t_g_z_89_) (y: t_g_z_89_) (out: t_g_z_89_) -> true); - f_prod - = - (fun (x: t_g_z_89_) (y: t_g_z_89_) -> - let q___:u8 = - (Hacspec_ovn.Ovn_traits.f_q #t_z_89_ #FStar.Tactics.Typeclasses.solve ()).f_z_val - in - let x___:u16 = cast (x.f_g_val %! q___ <: u8) <: u16 in - let y___:u16 = cast (y.f_g_val %! q___ <: u8) <: u16 in - { f_g_val = cast ((x___ *! y___ <: u16) %! (cast (q___ <: u8) <: u16) <: u16) <: u8 } - <: - t_g_z_89_); - f_group_inv_pre = (fun (x: t_g_z_89_) -> true); - f_group_inv_post = (fun (x: t_g_z_89_) (out: t_g_z_89_) -> true); - f_group_inv - = - fun (x: t_g_z_89_) -> - Rust_primitives.Hax.Control_flow_monad.Mexception.run (let _:Prims.unit = - Rust_primitives.Hax.failure "(FunctionalizeLoops) something is not implemented yet.\nLoop without mutation?" - "{\n for j in (core::iter::traits::collect::f_into_iter(core::ops::range::Range {\n f_start: 0,\n f_end: 89,\n })) {\n {\n let g_value: hacspec_ovn::ovn_z_89_::t_g_z_89_ = {\n hacspec_ovn::ovn_z_89_::C_g_z_89_ {\n f_g_val: j,\n }\n };\n (if core::cmp::f_eq(\n hacspec_ovn::ovn_traits::f_prod(x, g_value),\n hacspec_ovn::ovn_traits::f_group_one(Tuple0),\n ) {\n {\n #[note(\n \"rhs.typ=core::ops::control_flow::t_ControlFlow\"\n )]\n #[monadic_let(MException)]\n let hoist15: rust_primitives::hax::t_Never = {\n core::ops::control_flow::ControlFlow_Break(g_value)\n };\n core::ops::control_flow::ControlFlow_Continue(\n rust_primitives::hax::never_to_any(hoist15),\n )\n }\n } else {\n core::ops::control_flow::ControlFlow_Continue(Tuple0)\n })\n }\n }\n }" - - in - let _:Prims.unit = Hax_lib.v_assert false in - let! hoist16:Rust_primitives.Hax.t_Never = - Core.Ops.Control_flow.ControlFlow_Break x - <: - Core.Ops.Control_flow.t_ControlFlow t_g_z_89_ Rust_primitives.Hax.t_Never - in - Core.Ops.Control_flow.ControlFlow_Continue (Rust_primitives.Hax.never_to_any hoist16) - <: - Core.Ops.Control_flow.t_ControlFlow t_g_z_89_ t_g_z_89_) - } diff --git a/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Ovn_traits.aux b/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Ovn_traits.aux new file mode 100644 index 0000000..751a1ff --- /dev/null +++ b/ovn/proofs/ssprove/extraction/.Hacspec_ovn_Ovn_traits.aux @@ -0,0 +1,2 @@ +COQAUX1 6389834e57e83e53e7170ee795828b05 /home/au538501/Documents/git/specs/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v +0 0 vo_compile_time "3.821" diff --git a/ovn/proofs/ssprove/extraction/.Makefile.d b/ovn/proofs/ssprove/extraction/.Makefile.d new file mode 100644 index 0000000..daf7469 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/.Makefile.d @@ -0,0 +1,3 @@ +Hacspec_ovn_Ovn_traits.vo Hacspec_ovn_Ovn_traits.glob Hacspec_ovn_Ovn_traits.v.beautified Hacspec_ovn_Ovn_traits.required_vo: Hacspec_ovn_Ovn_traits.v +Hacspec_ovn_Ovn_traits.vio: Hacspec_ovn_Ovn_traits.v +Hacspec_ovn_Ovn_traits.vos Hacspec_ovn_Ovn_traits.vok Hacspec_ovn_Ovn_traits.required_vos: Hacspec_ovn_Ovn_traits.v diff --git a/ovn/proofs/ssprove/extraction/.filestoinstall b/ovn/proofs/ssprove/extraction/.filestoinstall deleted file mode 100644 index b6296d5..0000000 --- a/ovn/proofs/ssprove/extraction/.filestoinstall +++ /dev/null @@ -1 +0,0 @@ -Hacspec_ovn_Ovn_traits.vo Hacspec_ovn_Ovn_group.vo Hacspec_ovn.vo pkg_advantage.vo SigmaProtocol.vo Schnorr.vo DDH.vo OVN.vo ovn_eq_proof.vo Hacspec_ovn_Ovn_traits.v Hacspec_ovn_Ovn_group.v Hacspec_ovn.v pkg_advantage.v SigmaProtocol.v Schnorr.v DDH.v OVN.v ovn_eq_proof.v Hacspec_ovn_Ovn_traits.glob Hacspec_ovn_Ovn_group.glob Hacspec_ovn.glob pkg_advantage.glob SigmaProtocol.glob Schnorr.glob DDH.glob OVN.glob ovn_eq_proof.glob diff --git a/ovn/proofs/ssprove/extraction/.gitignore b/ovn/proofs/ssprove/extraction/.gitignore deleted file mode 100644 index 0b7287c..0000000 --- a/ovn/proofs/ssprove/extraction/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -*.vo* -*.aux -*.glob -*.cache -.Makefile.d -Makefile -Makefile.conf diff --git a/ovn/proofs/ssprove/extraction/.lia.cache b/ovn/proofs/ssprove/extraction/.lia.cache new file mode 100644 index 0000000000000000000000000000000000000000..a996572a4f08e7547107260102fd92ef9021ea39 GIT binary patch literal 48 ucmZ?HFH~e;uzA2Mcj`dP)Mfh^7#IYAm>Gz. - Parameter prime_order : prime #[g]. - -End GroupParam. - -Module Type DDHParams. - Parameter Space : finType. - Parameter Space_pos : Positive #|Space|. -End DDHParams. - -Module DDH (DDHP : DDHParams) (GP : GroupParam). - - Import DDHP. - Import GP. - - Definition SAMPLE := 0%N. - - #[local] Existing Instance Space_pos. - - Definition GroupSpace : finType := FinGroup.arg_finType gT. - #[local] Instance GroupSpace_pos : Positive #|GroupSpace|. - Proof. - apply /card_gt0P; by exists g. - (* Needs to be transparent to unify with local positivity proof? *) - Defined. - - Definition chGroup : choice_type := 'fin #|GroupSpace|. - - Definition i_space := #|Space|. - Definition chElem : choice_type := 'fin #|Space|. - - Notation " 'group " := (chGroup) (in custom pack_type at level 2). - - Definition secret_loc1 : Location := (chElem ; 33%N). - Definition secret_loc2 : Location := (chElem ; 34%N). - Definition secret_loc3 : Location := (chElem ; 35%N). - - Definition DDH_locs := - fset [:: secret_loc1 ; secret_loc2 ; secret_loc3]. - - Definition DDH_real : - package DDH_locs [interface] - [interface #val #[ SAMPLE ] : 'unit → 'group × 'group × 'group ] := - [package - #def #[ SAMPLE ] (_ : 'unit) : 'group × 'group × 'group - { - a ← sample uniform i_space ;; - b ← sample uniform i_space ;; - #put secret_loc1 := a ;; - #put secret_loc2 := b ;; - ret (fto (g^+ a), (fto (g^+ b), fto (g^+(a * b)))) - } - ]. - - Definition DDH_E := [interface #val #[ SAMPLE ] : 'unit → 'group × 'group × 'group ]. - - Definition DDH_ideal : - package DDH_locs [interface] DDH_E := - [package - #def #[ SAMPLE ] (_ : 'unit) : 'group × 'group × 'group - { - a ← sample uniform i_space ;; - b ← sample uniform i_space ;; - c ← sample uniform i_space ;; - #put secret_loc1 := a ;; - #put secret_loc2 := b ;; - #put secret_loc3 := c ;; - ret (fto (g^+a), (fto (g^+b), fto (g^+c))) - } - ]. - - Definition DDH : - loc_GamePair [interface #val #[ SAMPLE ] : 'unit → 'group × 'group × 'group ] := - λ b, - if b then {locpackage DDH_real } else {locpackage DDH_ideal }. - - Definition ϵ_DDH := Advantage DDH. - -End DDH. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v index e6bf326..1b71fd1 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn.v @@ -1,37 +1,37 @@ (* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -(* From Jasmin Require Import word. *) - From Coq Require Import ZArith. -From Coq Require Import Strings.String. +Require Import List. Import List.ListNotations. -Open Scope list_scope. Open Scope Z_scope. Open Scope bool_scope. +Require Import Ascii. +Require Import String. +Require Import Coq.Floats.Floats. +From RecordUpdate Require Import RecordSet. +Import RecordSetNotations. +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +Import choice.Choice.Exports. From Hacspec Require Import ChoiceEquality. From Hacspec Require Import LocationUtility. From Hacspec Require Import Hacspec_Lib_Comparable. From Hacspec Require Import Hacspec_Lib_Pre. From Hacspec Require Import Hacspec_Lib. +From Hacspec Require Import ConCertLib. -Open Scope hacspec_scope. -Import choice.Choice.Exports. -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -(*Not implemented yet? todo(item)*) +(* NotImplementedYet *) -(*Not implemented yet? todo(item)*) +(* NotImplementedYet *) -(*Not implemented yet? todo(item)*) +(* NotImplementedYet *) -(*Not implemented yet? todo(item)*) +(* NotImplementedYet *) -(*Not implemented yet? todo(item)*) +(* NotImplementedYet *) -(*Not implemented yet? todo(item)*) +(* NotImplementedYet *) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group.v index dd49206..3879df9 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group.v @@ -1,467 +1,296 @@ (* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -(* From Jasmin Require Import word. *) - From Coq Require Import ZArith. -From Coq Require Import Strings.String. +Require Import List. Import List.ListNotations. -Open Scope list_scope. Open Scope Z_scope. Open Scope bool_scope. +Require Import Ascii. +Require Import String. +Require Import Coq.Floats.Floats. +From RecordUpdate Require Import RecordSet. +Import RecordSetNotations. +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +Import choice.Choice.Exports. From Hacspec Require Import ChoiceEquality. From Hacspec Require Import LocationUtility. From Hacspec Require Import Hacspec_Lib_Comparable. From Hacspec Require Import Hacspec_Lib_Pre. From Hacspec Require Import Hacspec_Lib. +From Hacspec Require Import ConCertLib. -Open Scope hacspec_scope. -Import choice.Choice.Exports. -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. -Require Import Crate_Ovn_traits. -Export Crate_Ovn_traits. +(** settable! creates an instance of Settable from a constructor and list of +fields. *) +Local Ltac eta_choice_prod x := + (reflexivity || + destruct x ; + repeat + match goal with + | H : choice.Choice.sort (chElement (_ × _)) |- _ => destruct H + end + ; reflexivity). +Notation "'settable!' mk < f1 ; .. ; fn >" := + (Build_Settable + (fun x => .. (mk (f1 x)) .. (fn x)) + (fun x => _)) (at level 0, mk at level 10, f1, fn at level 9, only parsing). + +From Hacspec_ovn Require Import Hacspec_ovn_Ovn_traits. +Export Hacspec_ovn_Ovn_traits. + +Definition t_TallyParameter : choice_type := + 'unit. +Definition Build_t_TallyParameter : t_TallyParameter := tt. -Equations sub {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (x : both v_Z) (y : both v_Z) : both v_Z := - sub x y := - x .+ (f_neg y) : both v_Z. -Fail Next Obligation. +Definition t_CastVoteParam `{v_Z : choice_type} `{Hi0 : t_Sized (v_Z)} `{Hi1 : t_Field (v_Z)} : choice_type := + int32 × v_Z × v_Z × v_Z × v_Z × 'bool. +Definition Build_t_CastVoteParam `{v_Z : choice_type} `{Hi0 : t_Sized (v_Z)} `{Hi1 : t_Field (v_Z)} CastVoteParam_f_cvp_i CastVoteParam_f_cvp_xi CastVoteParam_f_cvp_zkp_random_w CastVoteParam_f_cvp_zkp_random_r CastVoteParam_f_cvp_zkp_random_d CastVoteParam_f_cvp_vote : t_CastVoteParam := + (CastVoteParam_f_cvp_i, CastVoteParam_f_cvp_xi,CastVoteParam_f_cvp_zkp_random_w,CastVoteParam_f_cvp_zkp_random_r, CastVoteParam_f_cvp_zkp_random_d, CastVoteParam_f_cvp_vote). +Definition CastVoteParam_f_cvp_i `{v_Z : choice_type} `{Hi0 : t_Sized (v_Z)} `{Hi1 : t_Field (v_Z)} (x : t_CastVoteParam) :32 := + fst(fst(fst(fst(fst(x))))). +Definition CastVoteParam_f_cvp_xi `{v_Z : choice_type} `{Hi0 : t_Sized (v_Z)} `{Hi1 : t_Field (v_Z)} (x : t_CastVoteParam) : v_Z := + snd(fst(fst(fst(fst(x))))). +Definition CastVoteParam_f_cvp_zkp_random_w `{v_Z : choice_type} `{Hi0 : t_Sized (v_Z)} `{Hi1 : t_Field (v_Z)} (x : t_CastVoteParam) : v_Z := + snd(fst(fst(fst(x)))). +Definition CastVoteParam_f_cvp_zkp_random_r `{v_Z : choice_type} `{Hi0 : t_Sized (v_Z)} `{Hi1 : t_Field (v_Z)} (x : t_CastVoteParam) : v_Z := + snd(fst(fst(x))). +Definition CastVoteParam_f_cvp_zkp_random_d `{v_Z : choice_type} `{Hi0 : t_Sized (v_Z)} `{Hi1 : t_Field (v_Z)} (x : t_CastVoteParam) : v_Z := + snd(fst(x)). +Definition CastVoteParam_f_cvp_vote `{v_Z : choice_type} `{Hi0 : t_Sized (v_Z)} `{Hi1 : t_Field (v_Z)} (x : t_CastVoteParam) : 'bool := + snd(x). +#[export] Instance settable_t_CastVoteParam `{v_Z : choice_type} `{Hi0 : t_Sized (v_Z)} `{Hi1 : t_Field (v_Z)} : Settable _ := + settable! (@Build_t_CastVoteParam `{v_Z : choice_type} `{Hi0 : t_Sized (v_Z)} `{Hi1 : t_Field (v_Z)}) . -Equations compute_group_element_for_vote {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (xi : both f_Z) (vote : both 'bool) (g_pow_yi : both v_G) : both v_G := - compute_group_element_for_vote xi vote g_pow_yi := - (f_pow g_pow_yi xi) .* (f_g_pow (ifb vote - then f_field_one - else f_field_zero)) : both v_G. -Fail Next Obligation. +Definition t_RegisterParam `{v_Z : choice_type} `{Hi0 : t_Sized (v_Z)} `{Hi1 : t_Field (v_Z)} : choice_type := + t_u32 × v_Z × v_Z.Definition Build_t_RegisterParam `{v_Z : choice_type} `{Hi0 : t_Sized (v_Z)} `{Hi1 : t_Field (v_Z)} : t_RegisterParam := + RegisterParam_f_rp_iRegisterParam_f_rp_xiRegisterParam_f_rp_zkp_random. +Definition RegisterParam_f_rp_i `{v_Z : choice_type} `{Hi0 : t_Sized (v_Z)} `{Hi1 : t_Field (v_Z)} (x : t_RegisterParam) : t_u32 := + fst(fst(x)). +Definition RegisterParam_f_rp_xi `{v_Z : choice_type} `{Hi0 : t_Sized (v_Z)} `{Hi1 : t_Field (v_Z)} (x : t_RegisterParam) : v_Z := + snd(fst(x)). +Definition RegisterParam_f_rp_zkp_random `{v_Z : choice_type} `{Hi0 : t_Sized (v_Z)} `{Hi1 : t_Field (v_Z)} (x : t_RegisterParam) : v_Z := + snd(x). +#[export] Instance settable_t_RegisterParam `{v_Z : choice_type} `{Hi0 : t_Sized (v_Z)} `{Hi1 : t_Field (v_Z)} : Settable _ := + settable! (@Build_t_RegisterParam `{v_Z : choice_type} `{Hi0 : t_Sized (v_Z)} `{Hi1 : t_Field (v_Z)}) . -Equations div {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (x : both v_G) (y : both v_G) : both v_G := - div x y := - x .* (f_group_inv y) : both v_G. -Fail Next Obligation. +Definition sub `{v_Z : choice_type} `{Hi0 : t_Sized (v_Z)} `{Hi1 : t_Field (v_Z)} (x : v_Z) (y : v_Z) : v_Z := + Add_f_add (x) (Neg_f_neg (y)). -Equations compute_g_pow_yi {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (i : both uint_size) (xis : both (nseq v_G (is_pure (n)))) : both v_G := - compute_g_pow_yi i xis := - letb prod1 := f_product (f_map (impl__iter (xis.a[(Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))])) (fun x => - f_clone x)) in - letb prod2 := f_product (f_map (impl__iter (xis.a[(Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))])) (fun x => - f_clone x)) in - div prod1 prod2 : both v_G. -Fail Next Obligation. +Lemma addC `{v_Z : choice_type} `{Hi0 : t_Sized (v_Z)} `{Hi1 : t_Field (v_Z)} (x : v_Z) (y : v_Z) : + true = true -> + implies (PartialEq_f_ne (x) (Field_f_field_zero (tt))) (fun _ => + PartialEq_f_eq (Add_f_add (x) (y)) (Add_f_add (y) (x))) = true. +Proof. Admitted. -Equations check_commitment {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (g_pow_xi_yi_vi : both v_G) (commitment : both f_Z) : both 'bool := - check_commitment g_pow_xi_yi_vi commitment := - (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment : both 'bool. -Fail Next Obligation. +Definition t_OrZKPCommit `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} : choice_type := + v_G × v_G × v_G × v_G × v_G × v_G × Group_f_Z × Group_f_Z × Group_f_Z × Group_f_Z × Group_f_Z.Definition Build_t_OrZKPCommit `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} : t_OrZKPCommit := + OrZKPCommit_f_or_zkp_xOrZKPCommit_f_or_zkp_yOrZKPCommit_f_or_zkp_a1OrZKPCommit_f_or_zkp_b1OrZKPCommit_f_or_zkp_a2OrZKPCommit_f_or_zkp_b2OrZKPCommit_f_or_zkp_cOrZKPCommit_f_or_zkp_d1OrZKPCommit_f_or_zkp_d2OrZKPCommit_f_or_zkp_r1OrZKPCommit_f_or_zkp_r2. +Definition OrZKPCommit_f_or_zkp_x `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_OrZKPCommit) : v_G := + fst(fst(fst(fst(fst(fst(fst(fst(fst(fst(x)))))))))). +Definition OrZKPCommit_f_or_zkp_y `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_OrZKPCommit) : v_G := + snd(fst(fst(fst(fst(fst(fst(fst(fst(fst(x)))))))))). +Definition OrZKPCommit_f_or_zkp_a1 `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_OrZKPCommit) : v_G := + snd(fst(fst(fst(fst(fst(fst(fst(fst(x))))))))). +Definition OrZKPCommit_f_or_zkp_b1 `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_OrZKPCommit) : v_G := + snd(fst(fst(fst(fst(fst(fst(fst(x)))))))). +Definition OrZKPCommit_f_or_zkp_a2 `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_OrZKPCommit) : v_G := + snd(fst(fst(fst(fst(fst(fst(x))))))). +Definition OrZKPCommit_f_or_zkp_b2 `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_OrZKPCommit) : v_G := + snd(fst(fst(fst(fst(fst(x)))))). +Definition OrZKPCommit_f_or_zkp_c `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_OrZKPCommit) : Group_f_Z := + snd(fst(fst(fst(fst(x))))). +Definition OrZKPCommit_f_or_zkp_d1 `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_OrZKPCommit) : Group_f_Z := + snd(fst(fst(fst(x)))). +Definition OrZKPCommit_f_or_zkp_d2 `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_OrZKPCommit) : Group_f_Z := + snd(fst(fst(x))). +Definition OrZKPCommit_f_or_zkp_r1 `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_OrZKPCommit) : Group_f_Z := + snd(fst(x)). +Definition OrZKPCommit_f_or_zkp_r2 `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_OrZKPCommit) : Group_f_Z := + snd(x). +#[export] Instance settable_t_OrZKPCommit `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} : Settable _ := + settable! (@Build_t_OrZKPCommit `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)}) . -Equations commit_to {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (g_pow_xi_yi_vi : both v_G) : both f_Z := - commit_to g_pow_xi_yi_vi := - f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi])))) : both f_Z. -Fail Next Obligation. +Definition t_SchnorrZKPCommit `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} : choice_type := + v_G × Group_f_Z × Group_f_Z.Definition Build_t_SchnorrZKPCommit `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} : t_SchnorrZKPCommit := + SchnorrZKPCommit_f_schnorr_zkp_uSchnorrZKPCommit_f_schnorr_zkp_cSchnorrZKPCommit_f_schnorr_zkp_z. +Definition SchnorrZKPCommit_f_schnorr_zkp_u `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_SchnorrZKPCommit) : v_G := + fst(fst(x)). +Definition SchnorrZKPCommit_f_schnorr_zkp_c `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_SchnorrZKPCommit) : Group_f_Z := + snd(fst(x)). +Definition SchnorrZKPCommit_f_schnorr_zkp_z `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_SchnorrZKPCommit) : Group_f_Z := + snd(x). +#[export] Instance settable_t_SchnorrZKPCommit `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} : Settable _ := + settable! (@Build_t_SchnorrZKPCommit `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)}) . -Definition t_CastVoteParam {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} : choice_type := - (int32 × v_Z × v_Z × v_Z × v_Z × 'bool). -Equations f_cvp_i {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both int32 := - f_cvp_i s := - bind_both s (fun x => - ret_both (fst (fst (fst (fst (fst x)))) : int32)) : both int32. -Fail Next Obligation. -Equations f_cvp_xi {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both v_Z := - f_cvp_xi s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst (fst x)))) : v_Z)) : both v_Z. -Fail Next Obligation. -Equations f_cvp_zkp_random_w {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both v_Z := - f_cvp_zkp_random_w s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst x))) : v_Z)) : both v_Z. -Fail Next Obligation. -Equations f_cvp_zkp_random_r {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both v_Z := - f_cvp_zkp_random_r s := - bind_both s (fun x => - ret_both (snd (fst (fst x)) : v_Z)) : both v_Z. -Fail Next Obligation. -Equations f_cvp_zkp_random_d {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both v_Z := - f_cvp_zkp_random_d s := - bind_both s (fun x => - ret_both (snd (fst x) : v_Z)) : both v_Z. -Fail Next Obligation. -Equations f_cvp_vote {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both 'bool := - f_cvp_vote s := - bind_both s (fun x => - ret_both (snd x : 'bool)) : both 'bool. -Fail Next Obligation. -Equations Build_t_CastVoteParam {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} {f_cvp_i : both int32} {f_cvp_xi : both v_Z} {f_cvp_zkp_random_w : both v_Z} {f_cvp_zkp_random_r : both v_Z} {f_cvp_zkp_random_d : both v_Z} {f_cvp_vote : both 'bool} : both (t_CastVoteParam) := - Build_t_CastVoteParam := - bind_both f_cvp_vote (fun f_cvp_vote => - bind_both f_cvp_zkp_random_d (fun f_cvp_zkp_random_d => - bind_both f_cvp_zkp_random_r (fun f_cvp_zkp_random_r => - bind_both f_cvp_zkp_random_w (fun f_cvp_zkp_random_w => - bind_both f_cvp_xi (fun f_cvp_xi => - bind_both f_cvp_i (fun f_cvp_i => - ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam)))))))) : both (t_CastVoteParam). -Fail Next Obligation. -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_w' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := y) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_r' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := y) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_d' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := y) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := y)). +Definition t_OvnContractState `{v_G : choice_type} `{n : t_usize} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} : choice_type := + t_Array (v_G) (n) × t_Array (t_SchnorrZKPCommit ((v_G))) (n) × t_Array (Group_f_Z) (n) × t_Array (v_G) (n) × t_Array (t_OrZKPCommit ((v_G))) (n) × t_u32 × t_Array ('bool) (n).Definition Build_t_OvnContractState `{v_G : choice_type} `{n : t_usize} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} : t_OvnContractState := + OvnContractState_f_g_pow_xisOvnContractState_f_zkp_xisOvnContractState_f_commit_visOvnContractState_f_g_pow_xi_yi_visOvnContractState_f_zkp_visOvnContractState_f_tallyOvnContractState_f_round1. +Definition OvnContractState_f_g_pow_xis `{v_G : choice_type} `{n : t_usize} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_OvnContractState) : t_Array (v_G) (n) := + fst(fst(fst(fst(fst(fst(x)))))). +Definition OvnContractState_f_zkp_xis `{v_G : choice_type} `{n : t_usize} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_OvnContractState) : t_Array (t_SchnorrZKPCommit ((v_G))) (n) := + snd(fst(fst(fst(fst(fst(x)))))). +Definition OvnContractState_f_commit_vis `{v_G : choice_type} `{n : t_usize} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_OvnContractState) : t_Array (Group_f_Z) (n) := + snd(fst(fst(fst(fst(x))))). +Definition OvnContractState_f_g_pow_xi_yi_vis `{v_G : choice_type} `{n : t_usize} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_OvnContractState) : t_Array (v_G) (n) := + snd(fst(fst(fst(x)))). +Definition OvnContractState_f_zkp_vis `{v_G : choice_type} `{n : t_usize} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_OvnContractState) : t_Array (t_OrZKPCommit ((v_G))) (n) := + snd(fst(fst(x))). +Definition OvnContractState_f_tally `{v_G : choice_type} `{n : t_usize} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_OvnContractState) : t_u32 := + snd(fst(x)). +Definition OvnContractState_f_round1 `{v_G : choice_type} `{n : t_usize} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : t_OvnContractState) : t_Array ('bool) (n) := + snd(x). +#[export] Instance settable_t_OvnContractState `{v_G : choice_type} `{n : t_usize} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} : Settable _ := + settable! (@Build_t_OvnContractState `{v_G : choice_type} `{n : t_usize} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)}) . -Definition t_OrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} : choice_type := - (v_G × v_G × v_G × v_G × v_G × v_G × f_Z × f_Z × f_Z × f_Z × f_Z). -Equations f_or_zkp_x {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := - f_or_zkp_x s := - bind_both s (fun x => - ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : v_G)) : both v_G. -Fail Next Obligation. -Equations f_or_zkp_y {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := - f_or_zkp_y s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : v_G)) : both v_G. -Fail Next Obligation. -Equations f_or_zkp_a1 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := - f_or_zkp_a1 s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : v_G)) : both v_G. -Fail Next Obligation. -Equations f_or_zkp_b1 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := - f_or_zkp_b1 s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : v_G)) : both v_G. -Fail Next Obligation. -Equations f_or_zkp_a2 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := - f_or_zkp_a2 s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : v_G)) : both v_G. -Fail Next Obligation. -Equations f_or_zkp_b2 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := - f_or_zkp_b2 s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst (fst (fst x))))) : v_G)) : both v_G. -Fail Next Obligation. -Equations f_or_zkp_c {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := - f_or_zkp_c s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst (fst x)))) : f_Z)) : both f_Z. -Fail Next Obligation. -Equations f_or_zkp_d1 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := - f_or_zkp_d1 s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst x))) : f_Z)) : both f_Z. -Fail Next Obligation. -Equations f_or_zkp_d2 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := - f_or_zkp_d2 s := - bind_both s (fun x => - ret_both (snd (fst (fst x)) : f_Z)) : both f_Z. -Fail Next Obligation. -Equations f_or_zkp_r1 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := - f_or_zkp_r1 s := - bind_both s (fun x => - ret_both (snd (fst x) : f_Z)) : both f_Z. -Fail Next Obligation. -Equations f_or_zkp_r2 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := - f_or_zkp_r2 s := - bind_both s (fun x => - ret_both (snd x : f_Z)) : both f_Z. -Fail Next Obligation. -Equations Build_t_OrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} {f_or_zkp_x : both v_G} {f_or_zkp_y : both v_G} {f_or_zkp_a1 : both v_G} {f_or_zkp_b1 : both v_G} {f_or_zkp_a2 : both v_G} {f_or_zkp_b2 : both v_G} {f_or_zkp_c : both f_Z} {f_or_zkp_d1 : both f_Z} {f_or_zkp_d2 : both f_Z} {f_or_zkp_r1 : both f_Z} {f_or_zkp_r2 : both f_Z} : both (t_OrZKPCommit) := - Build_t_OrZKPCommit := - bind_both f_or_zkp_r2 (fun f_or_zkp_r2 => - bind_both f_or_zkp_r1 (fun f_or_zkp_r1 => - bind_both f_or_zkp_d2 (fun f_or_zkp_d2 => - bind_both f_or_zkp_d1 (fun f_or_zkp_d1 => - bind_both f_or_zkp_c (fun f_or_zkp_c => - bind_both f_or_zkp_b2 (fun f_or_zkp_b2 => - bind_both f_or_zkp_a2 (fun f_or_zkp_a2 => - bind_both f_or_zkp_b1 (fun f_or_zkp_b1 => - bind_both f_or_zkp_a1 (fun f_or_zkp_a1 => - bind_both f_or_zkp_y (fun f_or_zkp_y => - bind_both f_or_zkp_x (fun f_or_zkp_x => - ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit))))))))))))) : both (t_OrZKPCommit). -Fail Next Obligation. -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := y) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := y) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := y) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := y) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := y) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := y) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_c' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := y) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := y) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := y) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := y) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := y)). +Definition check_commitment `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (g_pow_xi_yi_vi : v_G) (commitment : Group_f_Z) : 'bool := + PartialEq_f_eq (Group_f_hash (impl__into_vec (unsize (box_new ([g_pow_xi_yi_vi]))))) (commitment). -Definition t_RegisterParam {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} : choice_type := - (int32 × v_Z × v_Z). -Equations f_rp_i {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_RegisterParam) : both int32 := - f_rp_i s := - bind_both s (fun x => - ret_both (fst (fst x) : int32)) : both int32. -Fail Next Obligation. -Equations f_rp_xi {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_RegisterParam) : both v_Z := - f_rp_xi s := - bind_both s (fun x => - ret_both (snd (fst x) : v_Z)) : both v_Z. -Fail Next Obligation. -Equations f_rp_zkp_random {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_RegisterParam) : both v_Z := - f_rp_zkp_random s := - bind_both s (fun x => - ret_both (snd x : v_Z)) : both v_Z. -Fail Next Obligation. -Equations Build_t_RegisterParam {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} {f_rp_i : both int32} {f_rp_xi : both v_Z} {f_rp_zkp_random : both v_Z} : both (t_RegisterParam) := - Build_t_RegisterParam := - bind_both f_rp_zkp_random (fun f_rp_zkp_random => - bind_both f_rp_xi (fun f_rp_xi => - bind_both f_rp_i (fun f_rp_i => - ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam))))) : both (t_RegisterParam). -Fail Next Obligation. -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y) (f_rp_zkp_random := f_rp_zkp_random x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := y)). +Definition commit_to `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (g_pow_xi_yi_vi : v_G) : Group_f_Z := + Group_f_hash (impl__into_vec (unsize (box_new ([g_pow_xi_yi_vi])))). -Definition t_SchnorrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} : choice_type := - (v_G × f_Z × f_Z). -Equations f_schnorr_zkp_u {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_SchnorrZKPCommit) : both v_G := - f_schnorr_zkp_u s := - bind_both s (fun x => - ret_both (fst (fst x) : v_G)) : both v_G. -Fail Next Obligation. -Equations f_schnorr_zkp_c {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_SchnorrZKPCommit) : both f_Z := - f_schnorr_zkp_c s := - bind_both s (fun x => - ret_both (snd (fst x) : f_Z)) : both f_Z. -Fail Next Obligation. -Equations f_schnorr_zkp_z {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_SchnorrZKPCommit) : both f_Z := - f_schnorr_zkp_z s := - bind_both s (fun x => - ret_both (snd x : f_Z)) : both f_Z. -Fail Next Obligation. -Equations Build_t_SchnorrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} {f_schnorr_zkp_u : both v_G} {f_schnorr_zkp_c : both f_Z} {f_schnorr_zkp_z : both f_Z} : both (t_SchnorrZKPCommit) := - Build_t_SchnorrZKPCommit := - bind_both f_schnorr_zkp_z (fun f_schnorr_zkp_z => - bind_both f_schnorr_zkp_c (fun f_schnorr_zkp_c => - bind_both f_schnorr_zkp_u (fun f_schnorr_zkp_u => - ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit))))) : both (t_SchnorrZKPCommit). -Fail Next Obligation. -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := y) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := y) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := y)). +Definition compute_group_element_for_vote `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (xi : Group_f_Z) (vote : 'bool) (g_pow_yi : v_G) : v_G := + Mul_f_mul (Group_f_pow (g_pow_yi) (xi)) (Group_f_g_pow (if + vote + then + Field_f_field_one (tt) + else + Field_f_field_zero (tt))). -Definition t_TallyParameter : choice_type := - 'unit. -Equations Build_t_TallyParameter : both (t_TallyParameter) := - Build_t_TallyParameter := - ret_both (tt (* Empty tuple *) : (t_TallyParameter)) : both (t_TallyParameter). -Fail Next Obligation. +Definition t_Div_f_div `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (x : v_G) (y : v_G) : v_G := + Mul_f_mul (x) (Group_f_group_inv (y)). -Equations schnorr_zkp {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (random : both f_Z) (h : both v_G) (x : both f_Z) : both (t_SchnorrZKPCommit v_G) := - schnorr_zkp random h x := - run (letb r := random in - letb u := f_g_pow r in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g; - h; - u])))) in - letb z := r .+ (c .* x) in - letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit v_G)] hoist1 := ControlFlow_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in - ControlFlow_Continue (never_to_any hoist1)) : both (t_SchnorrZKPCommit v_G). -Fail Next Obligation. +Definition compute_g_pow_yi `{v_G : choice_type} `{n : t_usize} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (i : t_usize) (xis : t_Array (v_G) (n)) : v_G := + let prod1 := Iterator_f_product (Iterator_f_map (impl__iter (Index_f_index (xis) (Build_t_Range (0, i)))) (fun x => + Clone_f_clone (x))) in + let prod2 := Iterator_f_product (Iterator_f_map (impl__iter (Index_f_index (xis) (Build_t_Range (t_Add_f_add (i) (1), n)))) (fun x => + Clone_f_clone (x))) in + t_Div_f_div (prod1) (prod2). -Equations schnorr_zkp_validate {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (h : both v_G) (pi : both (t_SchnorrZKPCommit v_G)) : both 'bool := - schnorr_zkp_validate h pi := - andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g; - h; - f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? ((f_schnorr_zkp_u pi) .* (f_pow h (f_schnorr_zkp_c pi)))) : both 'bool. -Fail Next Obligation. +Definition init_ovn_contract `{v_G : choice_type} `{n : t_usize} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (_ : unit) : t_Result ((t_OvnContractState ((v_G)) (n))) ((t_Reject)) := + Result_Ok (Build_t_OvnContractState (repeat (Group_f_group_one (tt)) (n), repeat (Build_t_SchnorrZKPCommit (Group_f_group_one (tt), Field_f_field_zero (tt), Field_f_field_zero (tt))) (n), repeat (Field_f_field_zero (tt)) (n), repeat (Group_f_group_one (tt)) (n), repeat (Build_t_OrZKPCommit (Group_f_group_one (tt), Group_f_group_one (tt), Group_f_group_one (tt), Group_f_group_one (tt), Group_f_group_one (tt), Group_f_group_one (tt), Field_f_field_zero (tt), Field_f_field_zero (tt), Field_f_field_zero (tt), Field_f_field_zero (tt), Field_f_field_zero (tt))) (n), 0, repeat (false) (n))). -Equations zkp_one_out_of_two {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (random_w : both f_Z) (random_r : both f_Z) (random_d : both f_Z) (h : both v_G) (xi : both f_Z) (vi : both 'bool) : both (t_OrZKPCommit v_G) := - zkp_one_out_of_two random_w random_r random_d h xi vi := - letb w := random_w in - ifb vi - then letb r1 := random_r in - letb d1 := random_d in - letb x := f_g_pow xi in - letb y := (f_pow h xi) .* f_g in - letb a1 := (f_g_pow r1) .* (f_pow x d1) in - letb b1 := (f_pow h r1) .* (f_pow y d1) in - letb a2 := f_g_pow w in - letb b2 := f_pow h w in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; - y; - a1; - b1; - a2; - b2])))) in - letb d2 := sub c d1 in - letb r2 := sub w (xi .* d2) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2) - else letb r2 := random_r in - letb d2 := random_d in - letb x := f_g_pow xi in - letb y := f_pow h xi in - letb a1 := f_g_pow w in - letb b1 := f_pow h w in - letb a2 := (f_g_pow r2) .* (f_pow x d2) in - letb b2 := (f_pow h r2) .* (f_pow (div y f_g) d2) in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; - y; - a1; - b1; - a2; - b2])))) in - letb d1 := sub c d2 in - letb r1 := sub w (xi .* d1) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2) : both (t_OrZKPCommit v_G). -Fail Next Obligation. +Definition schnorr_zkp `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (random : Group_f_Z) (h : v_G) (x : Group_f_Z) : t_SchnorrZKPCommit ((v_G)) := + run (let r := random in + let u := Group_f_g_pow (r) in + let c := Group_f_hash (impl__into_vec (unsize (box_new ([Group_f_g (tt); h; u])))) in + let z := Add_f_add (r) (Mul_f_mul (c) (x)) in + let hoist25 := ControlFlow_Break (Build_t_SchnorrZKPCommit (u, c, z)) in + ControlFlow_Continue (never_to_any (hoist25))). -Equations zkp_one_out_of_two_validate {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (h : both v_G) (zkp : both (t_OrZKPCommit v_G)) : both 'bool := - zkp_one_out_of_two_validate h zkp := - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; - f_or_zkp_y zkp; - f_or_zkp_a1 zkp; - f_or_zkp_b1 zkp; - f_or_zkp_a2 zkp; - f_or_zkp_b2 zkp])))) in - andb (andb (andb (andb (c =.? ((f_or_zkp_d1 zkp) .+ (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? ((f_g_pow (f_or_zkp_r1 zkp)) .* (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? ((f_pow h (f_or_zkp_r1 zkp)) .* (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? ((f_g_pow (f_or_zkp_r2 zkp)) .* (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? ((f_pow h (f_or_zkp_r2 zkp)) .* (f_pow (div (f_or_zkp_y zkp) f_g) (f_or_zkp_d2 zkp)))) : both 'bool. -Fail Next Obligation. +Definition register_vote `{v_G : choice_type} `{n : t_usize} `{v_A : choice_type} `{impl_205173520_ : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Sized (v_A)} `{Hi2 : t_Sized (impl_205173520_)} `{Hi3 : t_Group (v_G)} `{Hi4 : t_HasActions (v_A)} `{Hi5 : t_HasReceiveContext (impl_205173520_) (unit)} (ctx : impl_205173520_) (state : t_OvnContractState ((v_G)) (n)) : t_Result (((v_A*t_OvnContractState ((v_G)) (n)))) ((t_ParseError)) := + run (let (_,out) := Get_f_get (HasCommonData_f_parameter_cursor (ctx)) in + let params : t_RegisterParam ((Group_f_Z)) := out in + Result_Ok (let g_pow_xi := Group_f_g_pow (RegisterParam_f_rp_xi params) in + let zkp_xi := schnorr_zkp (RegisterParam_f_rp_zkp_random params) (g_pow_xi) (RegisterParam_f_rp_xi params) in + let register_vote_state_ret := Clone_f_clone (state) in + let _ := TODO: please implement the method `lhs_LhsLocalVar` := Build_register_vote_state_ret (update_at_usize (OvnContractState_f_g_pow_xis register_vote_state_ret) (cast (RegisterParam_f_rp_i params)) (g_pow_xi)) in + let _ := TODO: please implement the method `lhs_LhsLocalVar` := Build_register_vote_state_ret (update_at_usize (OvnContractState_f_zkp_xis register_vote_state_ret) (cast (RegisterParam_f_rp_i params)) (zkp_xi)) in + let _ := TODO: please implement the method `lhs_LhsLocalVar` := Build_register_vote_state_ret (update_at_usize (OvnContractState_f_round1 register_vote_state_ret) (cast (RegisterParam_f_rp_i params)) (true)) in + Result_Ok ((HasActions_f_accept (tt),register_vote_state_ret)))). -Definition t_OvnContractState {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} : choice_type := - (nseq v_G (is_pure (n)) × nseq (t_SchnorrZKPCommit v_G) (is_pure (n)) × nseq f_Z (is_pure (n)) × nseq v_G (is_pure (n)) × nseq (t_OrZKPCommit v_G) (is_pure (n)) × int32 × nseq 'bool (is_pure (n))). -Equations f_g_pow_xis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq v_G (is_pure (n))) := - f_g_pow_xis s := - bind_both s (fun x => - ret_both (fst (fst (fst (fst (fst (fst x))))) : (nseq v_G (is_pure (n))))) : both (nseq v_G (is_pure (n))). -Fail Next Obligation. -Equations f_zkp_xis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq (t_SchnorrZKPCommit v_G) (is_pure (n))) := - f_zkp_xis s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst (fst (fst x))))) : (nseq (t_SchnorrZKPCommit v_G) (is_pure (n))))) : both (nseq (t_SchnorrZKPCommit v_G) (is_pure (n))). -Fail Next Obligation. -Equations f_commit_vis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq f_Z (is_pure (n))) := - f_commit_vis s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst (fst x)))) : (nseq f_Z (is_pure (n))))) : both (nseq f_Z (is_pure (n))). -Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq v_G (is_pure (n))) := - f_g_pow_xi_yi_vis s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst x))) : (nseq v_G (is_pure (n))))) : both (nseq v_G (is_pure (n))). -Fail Next Obligation. -Equations f_zkp_vis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq (t_OrZKPCommit v_G) (is_pure (n))) := - f_zkp_vis s := - bind_both s (fun x => - ret_both (snd (fst (fst x)) : (nseq (t_OrZKPCommit v_G) (is_pure (n))))) : both (nseq (t_OrZKPCommit v_G) (is_pure (n))). -Fail Next Obligation. -Equations f_tally {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both int32 := - f_tally s := - bind_both s (fun x => - ret_both (snd (fst x) : int32)) : both int32. -Fail Next Obligation. -Equations f_round1 {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq 'bool (is_pure (n))) := - f_round1 s := - bind_both s (fun x => - ret_both (snd x : (nseq 'bool (is_pure (n))))) : both (nseq 'bool (is_pure (n))). -Fail Next Obligation. -Equations Build_t_OvnContractState {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} {f_g_pow_xis : both (nseq v_G (is_pure (n)))} {f_zkp_xis : both (nseq (t_SchnorrZKPCommit v_G) (is_pure (n)))} {f_commit_vis : both (nseq f_Z (is_pure (n)))} {f_g_pow_xi_yi_vis : both (nseq v_G (is_pure (n)))} {f_zkp_vis : both (nseq (t_OrZKPCommit v_G) (is_pure (n)))} {f_tally : both int32} {f_round1 : both (nseq 'bool (is_pure (n)))} : both (t_OvnContractState) := - Build_t_OvnContractState := - bind_both f_round1 (fun f_round1 => - bind_both f_tally (fun f_tally => - bind_both f_zkp_vis (fun f_zkp_vis => - bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => - bind_both f_commit_vis (fun f_commit_vis => - bind_both f_zkp_xis (fun f_zkp_xis => - bind_both f_g_pow_xis (fun f_g_pow_xis => - ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally,f_round1) : (t_OvnContractState))))))))) : both (t_OvnContractState). -Fail Next Obligation. -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := f_round1 x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := f_round1 x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := f_round1 x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := f_round1 x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x) (f_round1 := f_round1 x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y) (f_round1 := f_round1 x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_round1' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := y)). +Definition schnorr_zkp_validate `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (h : v_G) (pi : t_SchnorrZKPCommit ((v_G))) : 'bool := + andb (PartialEq_f_eq (SchnorrZKPCommit_f_schnorr_zkp_c pi) (Group_f_hash (impl__into_vec (unsize (box_new ([Group_f_g (tt); h; SchnorrZKPCommit_f_schnorr_zkp_u pi])))))) (PartialEq_f_eq (Group_f_g_pow (SchnorrZKPCommit_f_schnorr_zkp_z pi)) (Mul_f_mul (SchnorrZKPCommit_f_schnorr_zkp_u pi) (Group_f_pow (h) (SchnorrZKPCommit_f_schnorr_zkp_c pi)))). -Equations cast_vote {v_G : _} {n : both uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both impl_574521470_) (state : both (t_OvnContractState v_G (both uint_size))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) := - cast_vote ctx state := - run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code t_ParseError] (params : t_CastVoteParam f_Z) := out in - Result_Ok (letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in - letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in - letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in - letb cast_vote_state_ret := f_clone state in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (f_accept,cast_vote_state_ret)))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError). -Fail Next Obligation. +Definition commit_to_vote `{v_G : choice_type} `{n : t_usize} `{v_A : choice_type} `{impl_205173520_ : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Sized (v_A)} `{Hi2 : t_Sized (impl_205173520_)} `{Hi3 : t_Group (v_G)} `{Hi4 : t_HasActions (v_A)} `{Hi5 : t_HasReceiveContext (impl_205173520_) (unit)} (ctx : impl_205173520_) (state : t_OvnContractState ((v_G)) (n)) : t_Result (((v_A*t_OvnContractState ((v_G)) (n)))) ((t_ParseError)) := + run (let (_,out) := Get_f_get (HasCommonData_f_parameter_cursor (ctx)) in + let params : t_CastVoteParam ((Group_f_Z)) := out in + Result_Ok (let _ := {IntoIterator_f_into_iter (Build_t_Range (0, n))} inP? [i] [is_none]default of ( + if + orb (negb (schnorr_zkp_validate (index (OvnContractState_f_g_pow_xis state) (i)) (index (OvnContractState_f_zkp_xis state) (i)))) (negb (index (OvnContractState_f_round1 state) (i))) + then + let hoist26 := ControlFlow_Break (Result_Err (Build_t_ParseError)) in + ControlFlow_Continue (never_to_any (hoist26)) + else + tt) in + let g_pow_yi := compute_g_pow_yi (cast (CastVoteParam_f_cvp_i params)) (OvnContractState_f_g_pow_xis state) in + let g_pow_xi_yi_vi := compute_group_element_for_vote (CastVoteParam_f_cvp_xi params) (CastVoteParam_f_cvp_vote params) (g_pow_yi) in + let commit_vi := commit_to (g_pow_xi_yi_vi) in + let commit_to_vote_state_ret := Clone_f_clone (state) in + let _ := TODO: please implement the method `lhs_LhsLocalVar` := Build_commit_to_vote_state_ret (update_at_usize (OvnContractState_f_commit_vis commit_to_vote_state_ret) (cast (CastVoteParam_f_cvp_i params)) (commit_vi)) in + Result_Ok ((HasActions_f_accept (tt),commit_to_vote_state_ret)))). -Equations commit_to_vote {v_G : _} {n : both uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both impl_574521470_) (state : both (t_OvnContractState v_G (both uint_size))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) := - commit_to_vote ctx state := - run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code t_ParseError] (params : t_CastVoteParam f_Z) := out in - Result_Ok (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => - ssp (fun _ => - ifb orb (not (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i]))) (not ((f_round1 state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError)] hoist26 := ControlFlow_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist26) - else ControlFlow_Continue (ret_both (tt : 'unit)) : (both (t_ControlFlow (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) 'unit)))) (ret_both (tt : 'unit)) in - letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in - letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in - letb commit_vi := commit_to g_pow_xi_yi_vi in - letb commit_to_vote_state_ret := f_clone state in - letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept,commit_to_vote_state_ret)))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError). -Fail Next Obligation. +Definition zkp_one_out_of_two `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (random_w : Group_f_Z) (random_r : Group_f_Z) (random_d : Group_f_Z) (h : v_G) (xi : Group_f_Z) (vi : 'bool) : t_OrZKPCommit ((v_G)) := + let w := random_w in + if + vi + then + let r1 := random_r in + let d1 := random_d in + let x := Group_f_g_pow (xi) in + let y := Mul_f_mul (Group_f_pow (h) (xi)) (Group_f_g (tt)) in + let a1 := Mul_f_mul (Group_f_g_pow (r1)) (Group_f_pow (x) (d1)) in + let b1 := Mul_f_mul (Group_f_pow (h) (r1)) (Group_f_pow (y) (d1)) in + let a2 := Group_f_g_pow (w) in + let b2 := Group_f_pow (h) (w) in + let c := Group_f_hash (impl__into_vec (unsize (box_new ([x; y; a1; b1; a2; b2])))) in + let d2 := sub (c) (d1) in + let r2 := sub (w) (Mul_f_mul (xi) (d2)) in + Build_t_OrZKPCommit (x, y, a1, b1, a2, b2, c, d1, d2, r1, r2) + else + let r2 := random_r in + let d2 := random_d in + let x := Group_f_g_pow (xi) in + let y := Group_f_pow (h) (xi) in + let a1 := Group_f_g_pow (w) in + let b1 := Group_f_pow (h) (w) in + let a2 := Mul_f_mul (Group_f_g_pow (r2)) (Group_f_pow (x) (d2)) in + let b2 := Mul_f_mul (Group_f_pow (h) (r2)) (Group_f_pow (t_Div_f_div (y) (Group_f_g (tt))) (d2)) in + let c := Group_f_hash (impl__into_vec (unsize (box_new ([x; y; a1; b1; a2; b2])))) in + let d1 := sub (c) (d2) in + let r1 := sub (w) (Mul_f_mul (xi) (d1)) in + Build_t_OrZKPCommit (x, y, a1, b1, a2, b2, c, d1, d2, r1, r2). -Equations init_ovn_contract {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (_ : both 'unit) : both (t_Result (t_OvnContractState v_G (both uint_size)) t_Reject) := - init_ovn_contract _ := - Result_Ok (Build_t_OvnContractState (f_g_pow_xis := repeat f_group_one n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one) (f_schnorr_zkp_z := f_field_zero) (f_schnorr_zkp_c := f_field_zero)) n) (f_commit_vis := repeat f_field_zero n) (f_g_pow_xi_yi_vis := repeat f_group_one n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one) (f_or_zkp_y := f_group_one) (f_or_zkp_a1 := f_group_one) (f_or_zkp_b1 := f_group_one) (f_or_zkp_a2 := f_group_one) (f_or_zkp_b2 := f_group_one) (f_or_zkp_c := f_field_zero) (f_or_zkp_d1 := f_field_zero) (f_or_zkp_d2 := f_field_zero) (f_or_zkp_r1 := f_field_zero) (f_or_zkp_r2 := f_field_zero)) n) (f_tally := ret_both (0 : int32)) (f_round1 := repeat (ret_both (false : 'bool)) n)) : both (t_Result (t_OvnContractState v_G (both uint_size)) t_Reject). -Fail Next Obligation. +Definition cast_vote `{v_G : choice_type} `{n : t_usize} `{v_A : choice_type} `{impl_205173520_ : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Sized (v_A)} `{Hi2 : t_Sized (impl_205173520_)} `{Hi3 : t_Group (v_G)} `{Hi4 : t_HasActions (v_A)} `{Hi5 : t_HasReceiveContext (impl_205173520_) (unit)} (ctx : impl_205173520_) (state : t_OvnContractState ((v_G)) (n)) : t_Result (((v_A*t_OvnContractState ((v_G)) (n)))) ((t_ParseError)) := + run (let (_,out) := Get_f_get (HasCommonData_f_parameter_cursor (ctx)) in + let params : t_CastVoteParam ((Group_f_Z)) := out in + Result_Ok (let g_pow_yi := compute_g_pow_yi (cast (CastVoteParam_f_cvp_i params)) (OvnContractState_f_g_pow_xis state) in + let g_pow_xi_yi_vi := compute_group_element_for_vote (CastVoteParam_f_cvp_xi params) (CastVoteParam_f_cvp_vote params) (g_pow_yi) in + let zkp_vi := zkp_one_out_of_two (CastVoteParam_f_cvp_zkp_random_w params) (CastVoteParam_f_cvp_zkp_random_r params) (CastVoteParam_f_cvp_zkp_random_d params) (g_pow_yi) (CastVoteParam_f_cvp_xi params) (CastVoteParam_f_cvp_vote params) in + let cast_vote_state_ret := Clone_f_clone (state) in + let _ := TODO: please implement the method `lhs_LhsLocalVar` := Build_cast_vote_state_ret (update_at_usize (OvnContractState_f_g_pow_xi_yi_vis cast_vote_state_ret) (cast (CastVoteParam_f_cvp_i params)) (g_pow_xi_yi_vi)) in + let _ := TODO: please implement the method `lhs_LhsLocalVar` := Build_cast_vote_state_ret (update_at_usize (OvnContractState_f_zkp_vis cast_vote_state_ret) (cast (CastVoteParam_f_cvp_i params)) (zkp_vi)) in + Result_Ok ((HasActions_f_accept (tt),cast_vote_state_ret)))). -Equations register_vote {v_G : _} {n : both uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both impl_574521470_) (state : both (t_OvnContractState v_G (both uint_size))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) := - register_vote ctx state := - run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code t_ParseError] (params : t_RegisterParam f_Z) := out in - Result_Ok (letb g_pow_xi := f_g_pow (f_rp_xi params) in - letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in - letb register_vote_state_ret := f_clone state in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_round1 := update_at_usize (f_round1 register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) (ret_both (true : 'bool))) in - Result_Ok (prod_b (f_accept,register_vote_state_ret)))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError). -Fail Next Obligation. +Definition zkp_one_out_of_two_validate `{v_G : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Group (v_G)} (h : v_G) (zkp : t_OrZKPCommit ((v_G))) : 'bool := + let c := Group_f_hash (impl__into_vec (unsize (box_new ([OrZKPCommit_f_or_zkp_x zkp; OrZKPCommit_f_or_zkp_y zkp; OrZKPCommit_f_or_zkp_a1 zkp; OrZKPCommit_f_or_zkp_b1 zkp; OrZKPCommit_f_or_zkp_a2 zkp; OrZKPCommit_f_or_zkp_b2 zkp])))) in + andb (andb (andb (andb (PartialEq_f_eq (c) (Add_f_add (OrZKPCommit_f_or_zkp_d1 zkp) (OrZKPCommit_f_or_zkp_d2 zkp))) (PartialEq_f_eq (OrZKPCommit_f_or_zkp_a1 zkp) (Mul_f_mul (Group_f_g_pow (OrZKPCommit_f_or_zkp_r1 zkp)) (Group_f_pow (OrZKPCommit_f_or_zkp_x zkp) (OrZKPCommit_f_or_zkp_d1 zkp))))) (PartialEq_f_eq (OrZKPCommit_f_or_zkp_b1 zkp) (Mul_f_mul (Group_f_pow (h) (OrZKPCommit_f_or_zkp_r1 zkp)) (Group_f_pow (OrZKPCommit_f_or_zkp_y zkp) (OrZKPCommit_f_or_zkp_d1 zkp))))) (PartialEq_f_eq (OrZKPCommit_f_or_zkp_a2 zkp) (Mul_f_mul (Group_f_g_pow (OrZKPCommit_f_or_zkp_r2 zkp)) (Group_f_pow (OrZKPCommit_f_or_zkp_x zkp) (OrZKPCommit_f_or_zkp_d2 zkp))))) (PartialEq_f_eq (OrZKPCommit_f_or_zkp_b2 zkp) (Mul_f_mul (Group_f_pow (h) (OrZKPCommit_f_or_zkp_r2 zkp)) (Group_f_pow (t_Div_f_div (OrZKPCommit_f_or_zkp_y zkp) (Group_f_g (tt))) (OrZKPCommit_f_or_zkp_d2 zkp)))). -Equations tally_votes {v_G : _} {n : both uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Group v_G} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (_ : both impl_574521470_) (state : both (t_OvnContractState v_G (both uint_size))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) := - tally_votes _ state := - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => - ssp (fun _ => - letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in - letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError)] _ := ControlFlow_Continue (ifb not (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError)] hoist27 := ControlFlow_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist27) - else ControlFlow_Continue (ret_both (tt : 'unit))) in - ifb not (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError)] hoist28 := ControlFlow_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist28) - else ControlFlow_Continue (ret_both (tt : 'unit)) : (both (t_ControlFlow (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) 'unit)))) (ret_both (tt : 'unit)) in - letb vote_result := f_group_one in - letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => - ssp (fun vote_result => - vote_result .* g_pow_vote : (both v_G))) vote_result in - letb tally := ret_both (0 : int32) in - letb curr := f_field_zero in - letb '(curr,tally) := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => - ssp (fun '(curr,tally) => - letb tally := ifb (f_g_pow curr) =.? vote_result - then letb tally := i in - tally - else tally in - letb curr := curr .+ f_field_one in - prod_b (curr,tally) : (both (f_Z × int32)))) (prod_b (curr,tally)) in - letb tally_votes_state_ret := f_clone state in - letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in - Result_Ok (prod_b (f_accept,tally_votes_state_ret)) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError). -Fail Next Obligation. +Definition tally_votes `{v_G : choice_type} `{n : t_usize} `{v_A : choice_type} `{impl_205173520_ : choice_type} `{Hi0 : t_Sized (v_G)} `{Hi1 : t_Sized (v_A)} `{Hi2 : t_Sized (impl_205173520_)} `{Hi3 : t_Group (v_G)} `{Hi4 : t_HasActions (v_A)} `{Hi5 : t_HasReceiveContext (impl_205173520_) (unit)} (_ : impl_205173520_) (state : t_OvnContractState ((v_G)) (n)) : t_Result (((v_A*t_OvnContractState ((v_G)) (n)))) ((t_ParseError)) := + let _ := {IntoIterator_f_into_iter (Build_t_Range (0, n))} inP? [i] [is_none]default of ( + let g_pow_yi := compute_g_pow_yi (i) (OvnContractState_f_g_pow_xis state) in + let _ := ControlFlow_Continue (if + negb (zkp_one_out_of_two_validate (g_pow_yi) (index (OvnContractState_f_zkp_vis state) (i))) + then + let hoist27 := ControlFlow_Break (Result_Err (Build_t_ParseError)) in + ControlFlow_Continue (never_to_any (hoist27)) + else + tt) in + if + negb (check_commitment (index (OvnContractState_f_g_pow_xi_yi_vis state) (i)) (index (OvnContractState_f_commit_vis state) (i))) + then + let hoist28 := ControlFlow_Break (Result_Err (Build_t_ParseError)) in + ControlFlow_Continue (never_to_any (hoist28)) + else + tt) in + let vote_result := Group_f_group_one (tt) in + let _ := {IntoIterator_f_into_iter (OvnContractState_f_g_pow_xi_yi_vis state)} inP? [g_pow_vote] [is_none]default of ( + TODO: please implement the method `lhs_LhsLocalVar` := Mul_f_mul (vote_result) (g_pow_vote)) in + let tally := 0 in + let curr := Field_f_field_zero (tt) in + let _ := {IntoIterator_f_into_iter (Build_t_Range (0, cast (n)))} inP? [i] [is_none]default of ( + let _ := if + PartialEq_f_eq (Group_f_g_pow (curr)) (vote_result) + then + let _ := TODO: please implement the method `lhs_LhsLocalVar` := i in + tt + else + tt in + let _ := TODO: please implement the method `lhs_LhsLocalVar` := Add_f_add (curr) (Field_f_field_one (tt)) in + tt) in + let tally_votes_state_ret := Clone_f_clone (state) in + let _ := TODO: please implement the method `lhs_LhsLocalVar` := Build_tally_votes_state_ret (tally) in + Result_Ok ((HasActions_f_accept (tt),tally_votes_state_ret)). diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group2.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group2.v deleted file mode 100644 index 6e06ed3..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_group2.v +++ /dev/null @@ -1,484 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -(* From Jasmin Require Import word. *) - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Crate_Ovn_traits. -Export Crate_Ovn_traits. - -Require Import PhantomData. -Export PhantomData. - -Equations impl__compute_group_element_for_vote {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (xi : both f_Z) (vote : both 'bool) (g_pow_yi : both v_G) : both v_G := - impl__compute_group_element_for_vote xi vote g_pow_yi := - (f_pow g_pow_yi xi) .* (f_g_pow (ifb vote - then f_field_one - else f_field_zero)) : both v_G. -Fail Next Obligation. - -Equations impl__div {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (x : both v_G) (y : both v_G) : both v_G := - impl__div x y := - x .* (f_group_inv y) : both v_G. -Fail Next Obligation. - -Equations impl__compute_g_pow_yi {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (i : both uint_size) (xis : both (nseq v_G (is_pure (n)))) : both v_G := - impl__compute_g_pow_yi i xis := - letb prod1 := f_product (f_map (impl__iter (xis.a[(Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))])) (fun x => - f_clone x)) in - letb prod2 := f_product (f_map (impl__iter (xis.a[(Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))])) (fun x => - f_clone x)) in - impl__div prod1 prod2 : both v_G. -Fail Next Obligation. - -Equations impl__sub {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (x : both f_Z) (y : both f_Z) : both f_Z := - impl__sub x y := - x .+ (f_neg y) : both f_Z. -Fail Next Obligation. - -Equations impl__check_commitment {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (g_pow_xi_yi_vi : both v_G) (commitment : both f_Z) : both 'bool := - impl__check_commitment g_pow_xi_yi_vi commitment := - (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment : both 'bool. -Fail Next Obligation. - -Equations impl__commit_to {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (g_pow_xi_yi_vi : both v_G) : both f_Z := - impl__commit_to g_pow_xi_yi_vi := - f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi])))) : both f_Z. -Fail Next Obligation. - -Definition t_CastVoteParam {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} : choice_type := - (int32 × v_Z × v_Z × v_Z × v_Z × 'bool). -Equations f_cvp_i {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both int32 := - f_cvp_i s := - bind_both s (fun x => - ret_both (fst (fst (fst (fst (fst x)))) : int32)) : both int32. -Fail Next Obligation. -Equations f_cvp_xi {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both v_Z := - f_cvp_xi s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst (fst x)))) : v_Z)) : both v_Z. -Fail Next Obligation. -Equations f_cvp_zkp_random_w {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both v_Z := - f_cvp_zkp_random_w s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst x))) : v_Z)) : both v_Z. -Fail Next Obligation. -Equations f_cvp_zkp_random_r {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both v_Z := - f_cvp_zkp_random_r s := - bind_both s (fun x => - ret_both (snd (fst (fst x)) : v_Z)) : both v_Z. -Fail Next Obligation. -Equations f_cvp_zkp_random_d {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both v_Z := - f_cvp_zkp_random_d s := - bind_both s (fun x => - ret_both (snd (fst x) : v_Z)) : both v_Z. -Fail Next Obligation. -Equations f_cvp_vote {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_CastVoteParam) : both 'bool := - f_cvp_vote s := - bind_both s (fun x => - ret_both (snd x : 'bool)) : both 'bool. -Fail Next Obligation. -Equations Build_t_CastVoteParam {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} {f_cvp_i : both int32} {f_cvp_xi : both v_Z} {f_cvp_zkp_random_w : both v_Z} {f_cvp_zkp_random_r : both v_Z} {f_cvp_zkp_random_d : both v_Z} {f_cvp_vote : both 'bool} : both (t_CastVoteParam) := - Build_t_CastVoteParam := - bind_both f_cvp_vote (fun f_cvp_vote => - bind_both f_cvp_zkp_random_d (fun f_cvp_zkp_random_d => - bind_both f_cvp_zkp_random_r (fun f_cvp_zkp_random_r => - bind_both f_cvp_zkp_random_w (fun f_cvp_zkp_random_w => - bind_both f_cvp_xi (fun f_cvp_xi => - bind_both f_cvp_i (fun f_cvp_i => - ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam)))))))) : both (t_CastVoteParam). -Fail Next Obligation. -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_w' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := y) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_r' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := y) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_d' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := y) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := y)). - -Definition t_OVN {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} : choice_type := - (t_PhantomData v_G). -Equations f_pd {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OVN) : both (t_PhantomData v_G) := - f_pd s := - bind_both s (fun x => - ret_both (x : (t_PhantomData v_G))) : both (t_PhantomData v_G). -Fail Next Obligation. -Equations Build_t_OVN {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} {f_pd : both (t_PhantomData v_G)} : both (t_OVN) := - Build_t_OVN := - bind_both f_pd (fun f_pd => - ret_both ((f_pd) : (t_OVN))) : both (t_OVN). -Fail Next Obligation. -Notation "'Build_t_OVN' '[' x ']' '(' 'f_pd' ':=' y ')'" := (Build_t_OVN (f_pd := y)). - -Definition t_OrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} : choice_type := - (v_G × v_G × v_G × v_G × v_G × v_G × f_Z × f_Z × f_Z × f_Z × f_Z). -Equations f_or_zkp_x {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := - f_or_zkp_x s := - bind_both s (fun x => - ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : v_G)) : both v_G. -Fail Next Obligation. -Equations f_or_zkp_y {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := - f_or_zkp_y s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : v_G)) : both v_G. -Fail Next Obligation. -Equations f_or_zkp_a1 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := - f_or_zkp_a1 s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : v_G)) : both v_G. -Fail Next Obligation. -Equations f_or_zkp_b1 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := - f_or_zkp_b1 s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : v_G)) : both v_G. -Fail Next Obligation. -Equations f_or_zkp_a2 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := - f_or_zkp_a2 s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : v_G)) : both v_G. -Fail Next Obligation. -Equations f_or_zkp_b2 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both v_G := - f_or_zkp_b2 s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst (fst (fst x))))) : v_G)) : both v_G. -Fail Next Obligation. -Equations f_or_zkp_c {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := - f_or_zkp_c s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst (fst x)))) : f_Z)) : both f_Z. -Fail Next Obligation. -Equations f_or_zkp_d1 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := - f_or_zkp_d1 s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst x))) : f_Z)) : both f_Z. -Fail Next Obligation. -Equations f_or_zkp_d2 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := - f_or_zkp_d2 s := - bind_both s (fun x => - ret_both (snd (fst (fst x)) : f_Z)) : both f_Z. -Fail Next Obligation. -Equations f_or_zkp_r1 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := - f_or_zkp_r1 s := - bind_both s (fun x => - ret_both (snd (fst x) : f_Z)) : both f_Z. -Fail Next Obligation. -Equations f_or_zkp_r2 {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OrZKPCommit) : both f_Z := - f_or_zkp_r2 s := - bind_both s (fun x => - ret_both (snd x : f_Z)) : both f_Z. -Fail Next Obligation. -Equations Build_t_OrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} {f_or_zkp_x : both v_G} {f_or_zkp_y : both v_G} {f_or_zkp_a1 : both v_G} {f_or_zkp_b1 : both v_G} {f_or_zkp_a2 : both v_G} {f_or_zkp_b2 : both v_G} {f_or_zkp_c : both f_Z} {f_or_zkp_d1 : both f_Z} {f_or_zkp_d2 : both f_Z} {f_or_zkp_r1 : both f_Z} {f_or_zkp_r2 : both f_Z} : both (t_OrZKPCommit) := - Build_t_OrZKPCommit := - bind_both f_or_zkp_r2 (fun f_or_zkp_r2 => - bind_both f_or_zkp_r1 (fun f_or_zkp_r1 => - bind_both f_or_zkp_d2 (fun f_or_zkp_d2 => - bind_both f_or_zkp_d1 (fun f_or_zkp_d1 => - bind_both f_or_zkp_c (fun f_or_zkp_c => - bind_both f_or_zkp_b2 (fun f_or_zkp_b2 => - bind_both f_or_zkp_a2 (fun f_or_zkp_a2 => - bind_both f_or_zkp_b1 (fun f_or_zkp_b1 => - bind_both f_or_zkp_a1 (fun f_or_zkp_a1 => - bind_both f_or_zkp_y (fun f_or_zkp_y => - bind_both f_or_zkp_x (fun f_or_zkp_x => - ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit))))))))))))) : both (t_OrZKPCommit). -Fail Next Obligation. -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := y) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := y) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := y) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := y) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := y) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := y) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_c' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := y) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := y) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := y) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := y) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := y)). - -Equations impl__zkp_one_out_of_two {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (random_w : both f_Z) (random_r : both f_Z) (random_d : both f_Z) (h : both v_G) (xi : both f_Z) (vi : both 'bool) : both (t_OrZKPCommit v_G) := - impl__zkp_one_out_of_two random_w random_r random_d h xi vi := - letb w := random_w in - ifb vi - then letb r1 := random_r in - letb d1 := random_d in - letb x := f_g_pow xi in - letb y := (f_pow h xi) .* f_g in - letb a1 := (f_g_pow r1) .* (f_pow x d1) in - letb b1 := (f_pow h r1) .* (f_pow y d1) in - letb a2 := f_g_pow w in - letb b2 := f_pow h w in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; - y; - a1; - b1; - a2; - b2])))) in - letb d2 := impl__sub c d1 in - letb r2 := impl__sub w (xi .* d2) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2) - else letb r2 := random_r in - letb d2 := random_d in - letb x := f_g_pow xi in - letb y := f_pow h xi in - letb a1 := f_g_pow w in - letb b1 := f_pow h w in - letb a2 := (f_g_pow r2) .* (f_pow x d2) in - letb b2 := (f_pow h r2) .* (f_pow (impl__div y f_g) d2) in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; - y; - a1; - b1; - a2; - b2])))) in - letb d1 := impl__sub c d2 in - letb r1 := impl__sub w (xi .* d1) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2) : both (t_OrZKPCommit v_G). -Fail Next Obligation. - -Equations impl__zkp_one_out_of_two_validate {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (h : both v_G) (zkp : both (t_OrZKPCommit v_G)) : both 'bool := - impl__zkp_one_out_of_two_validate h zkp := - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; - f_or_zkp_y zkp; - f_or_zkp_a1 zkp; - f_or_zkp_b1 zkp; - f_or_zkp_a2 zkp; - f_or_zkp_b2 zkp])))) in - andb (andb (andb (andb (c =.? ((f_or_zkp_d1 zkp) .+ (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? ((f_g_pow (f_or_zkp_r1 zkp)) .* (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? ((f_pow h (f_or_zkp_r1 zkp)) .* (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? ((f_g_pow (f_or_zkp_r2 zkp)) .* (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? ((f_pow h (f_or_zkp_r2 zkp)) .* (f_pow (impl__div (f_or_zkp_y zkp) f_g) (f_or_zkp_d2 zkp)))) : both 'bool. -Fail Next Obligation. - -Definition t_RegisterParam {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} : choice_type := - (int32 × v_Z × v_Z). -Equations f_rp_i {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_RegisterParam) : both int32 := - f_rp_i s := - bind_both s (fun x => - ret_both (fst (fst x) : int32)) : both int32. -Fail Next Obligation. -Equations f_rp_xi {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_RegisterParam) : both v_Z := - f_rp_xi s := - bind_both s (fun x => - ret_both (snd (fst x) : v_Z)) : both v_Z. -Fail Next Obligation. -Equations f_rp_zkp_random {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} (s : both t_RegisterParam) : both v_Z := - f_rp_zkp_random s := - bind_both s (fun x => - ret_both (snd x : v_Z)) : both v_Z. -Fail Next Obligation. -Equations Build_t_RegisterParam {v_Z : _} `{ t_Sized v_Z} `{ t_Field v_Z} {f_rp_i : both int32} {f_rp_xi : both v_Z} {f_rp_zkp_random : both v_Z} : both (t_RegisterParam) := - Build_t_RegisterParam := - bind_both f_rp_zkp_random (fun f_rp_zkp_random => - bind_both f_rp_xi (fun f_rp_xi => - bind_both f_rp_i (fun f_rp_i => - ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam))))) : both (t_RegisterParam). -Fail Next Obligation. -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y) (f_rp_zkp_random := f_rp_zkp_random x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := y)). - -Definition t_SchnorrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} : choice_type := - (v_G × f_Z × f_Z). -Equations f_schnorr_zkp_u {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_SchnorrZKPCommit) : both v_G := - f_schnorr_zkp_u s := - bind_both s (fun x => - ret_both (fst (fst x) : v_G)) : both v_G. -Fail Next Obligation. -Equations f_schnorr_zkp_c {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_SchnorrZKPCommit) : both f_Z := - f_schnorr_zkp_c s := - bind_both s (fun x => - ret_both (snd (fst x) : f_Z)) : both f_Z. -Fail Next Obligation. -Equations f_schnorr_zkp_z {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_SchnorrZKPCommit) : both f_Z := - f_schnorr_zkp_z s := - bind_both s (fun x => - ret_both (snd x : f_Z)) : both f_Z. -Fail Next Obligation. -Equations Build_t_SchnorrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} {f_schnorr_zkp_u : both v_G} {f_schnorr_zkp_c : both f_Z} {f_schnorr_zkp_z : both f_Z} : both (t_SchnorrZKPCommit) := - Build_t_SchnorrZKPCommit := - bind_both f_schnorr_zkp_z (fun f_schnorr_zkp_z => - bind_both f_schnorr_zkp_c (fun f_schnorr_zkp_c => - bind_both f_schnorr_zkp_u (fun f_schnorr_zkp_u => - ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit))))) : both (t_SchnorrZKPCommit). -Fail Next Obligation. -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := y) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := y) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := y)). - -Equations impl__schnorr_zkp {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (random : both f_Z) (h : both v_G) (x : both f_Z) : both (t_SchnorrZKPCommit v_G) := - impl__schnorr_zkp random h x := - run (letb r := random in - letb u := f_g_pow r in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g; - h; - u])))) in - letb z := r .+ (c .* x) in - letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit v_G)] hoist2 := ControlFlow_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in - ControlFlow_Continue (never_to_any hoist2)) : both (t_SchnorrZKPCommit v_G). -Fail Next Obligation. - -Equations impl__schnorr_zkp_validate {v_G : _} `{ t_Sized v_G} `{ t_Group v_G} (h : both v_G) (pi : both (t_SchnorrZKPCommit v_G)) : both 'bool := - impl__schnorr_zkp_validate h pi := - andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g; - h; - f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? ((f_schnorr_zkp_u pi) .* (f_pow h (f_schnorr_zkp_c pi)))) : both 'bool. -Fail Next Obligation. - -Definition t_TallyParameter : choice_type := - 'unit. -Equations Build_t_TallyParameter : both (t_TallyParameter) := - Build_t_TallyParameter := - ret_both (tt (* Empty tuple *) : (t_TallyParameter)) : both (t_TallyParameter). -Fail Next Obligation. - -Definition t_OvnContractState {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} : choice_type := - (nseq v_G (is_pure (n)) × nseq (t_SchnorrZKPCommit v_G) (is_pure (n)) × nseq f_Z (is_pure (n)) × nseq v_G (is_pure (n)) × nseq (t_OrZKPCommit v_G) (is_pure (n)) × int32 × nseq 'bool (is_pure (n))). -Equations f_g_pow_xis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq v_G (is_pure (n))) := - f_g_pow_xis s := - bind_both s (fun x => - ret_both (fst (fst (fst (fst (fst (fst x))))) : (nseq v_G (is_pure (n))))) : both (nseq v_G (is_pure (n))). -Fail Next Obligation. -Equations f_zkp_xis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq (t_SchnorrZKPCommit v_G) (is_pure (n))) := - f_zkp_xis s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst (fst (fst x))))) : (nseq (t_SchnorrZKPCommit v_G) (is_pure (n))))) : both (nseq (t_SchnorrZKPCommit v_G) (is_pure (n))). -Fail Next Obligation. -Equations f_commit_vis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq f_Z (is_pure (n))) := - f_commit_vis s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst (fst x)))) : (nseq f_Z (is_pure (n))))) : both (nseq f_Z (is_pure (n))). -Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq v_G (is_pure (n))) := - f_g_pow_xi_yi_vis s := - bind_both s (fun x => - ret_both (snd (fst (fst (fst x))) : (nseq v_G (is_pure (n))))) : both (nseq v_G (is_pure (n))). -Fail Next Obligation. -Equations f_zkp_vis {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq (t_OrZKPCommit v_G) (is_pure (n))) := - f_zkp_vis s := - bind_both s (fun x => - ret_both (snd (fst (fst x)) : (nseq (t_OrZKPCommit v_G) (is_pure (n))))) : both (nseq (t_OrZKPCommit v_G) (is_pure (n))). -Fail Next Obligation. -Equations f_tally {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both int32 := - f_tally s := - bind_both s (fun x => - ret_both (snd (fst x) : int32)) : both int32. -Fail Next Obligation. -Equations f_round1 {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (s : both t_OvnContractState) : both (nseq 'bool (is_pure (n))) := - f_round1 s := - bind_both s (fun x => - ret_both (snd x : (nseq 'bool (is_pure (n))))) : both (nseq 'bool (is_pure (n))). -Fail Next Obligation. -Equations Build_t_OvnContractState {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} {f_g_pow_xis : both (nseq v_G (is_pure (n)))} {f_zkp_xis : both (nseq (t_SchnorrZKPCommit v_G) (is_pure (n)))} {f_commit_vis : both (nseq f_Z (is_pure (n)))} {f_g_pow_xi_yi_vis : both (nseq v_G (is_pure (n)))} {f_zkp_vis : both (nseq (t_OrZKPCommit v_G) (is_pure (n)))} {f_tally : both int32} {f_round1 : both (nseq 'bool (is_pure (n)))} : both (t_OvnContractState) := - Build_t_OvnContractState := - bind_both f_round1 (fun f_round1 => - bind_both f_tally (fun f_tally => - bind_both f_zkp_vis (fun f_zkp_vis => - bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => - bind_both f_commit_vis (fun f_commit_vis => - bind_both f_zkp_xis (fun f_zkp_xis => - bind_both f_g_pow_xis (fun f_g_pow_xis => - ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally,f_round1) : (t_OvnContractState))))))))) : both (t_OvnContractState). -Fail Next Obligation. -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := f_round1 x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := f_round1 x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := f_round1 x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := f_round1 x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x) (f_round1 := f_round1 x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y) (f_round1 := f_round1 x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_round1' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x) (f_round1 := y)). - -Equations impl__cast_vote {v_G : _} {n : both uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Group v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both impl_574521470_) (state : both (t_OvnContractState v_G (both uint_size))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) := - impl__cast_vote ctx state := - run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code t_ParseError] (params : t_CastVoteParam f_Z) := out in - Result_Ok (letb g_pow_yi := impl__compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in - letb g_pow_xi_yi_vi := impl__compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in - letb zkp_vi := impl__zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in - letb cast_vote_state_ret := f_clone state in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (f_accept,cast_vote_state_ret)))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError). -Fail Next Obligation. - -Equations impl__commit_to_vote {v_G : _} {n : both uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Group v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both impl_574521470_) (state : both (t_OvnContractState v_G (both uint_size))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) := - impl__commit_to_vote ctx state := - run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code t_ParseError] (params : t_CastVoteParam f_Z) := out in - Result_Ok (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => - ssp (fun _ => - ifb orb (not (impl__schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i]))) (not ((f_round1 state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError)] hoist30 := ControlFlow_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist30) - else ControlFlow_Continue (ret_both (tt : 'unit)) : (both (t_ControlFlow (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) 'unit)))) (ret_both (tt : 'unit)) in - letb g_pow_yi := impl__compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in - letb g_pow_xi_yi_vi := impl__compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in - letb commit_vi := impl__commit_to g_pow_xi_yi_vi in - letb commit_to_vote_state_ret := f_clone state in - letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept,commit_to_vote_state_ret)))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError). -Fail Next Obligation. - -Equations impl__init_ovn_contract {v_G : _} {n : both uint_size} `{ t_Sized v_G} `{ t_Group v_G} (_ : both 'unit) : both (t_Result (t_OvnContractState v_G (both uint_size)) t_Reject) := - impl__init_ovn_contract _ := - Result_Ok (Build_t_OvnContractState (f_g_pow_xis := repeat f_group_one n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one) (f_schnorr_zkp_z := f_field_zero) (f_schnorr_zkp_c := f_field_zero)) n) (f_commit_vis := repeat f_field_zero n) (f_g_pow_xi_yi_vis := repeat f_group_one n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one) (f_or_zkp_y := f_group_one) (f_or_zkp_a1 := f_group_one) (f_or_zkp_b1 := f_group_one) (f_or_zkp_a2 := f_group_one) (f_or_zkp_b2 := f_group_one) (f_or_zkp_c := f_field_zero) (f_or_zkp_d1 := f_field_zero) (f_or_zkp_d2 := f_field_zero) (f_or_zkp_r1 := f_field_zero) (f_or_zkp_r2 := f_field_zero)) n) (f_tally := ret_both (0 : int32)) (f_round1 := repeat (ret_both (false : 'bool)) n)) : both (t_Result (t_OvnContractState v_G (both uint_size)) t_Reject). -Fail Next Obligation. - -Equations impl__register_vote {v_G : _} {n : both uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Group v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both impl_574521470_) (state : both (t_OvnContractState v_G (both uint_size))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) := - impl__register_vote ctx state := - run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code t_ParseError] (params : t_RegisterParam f_Z) := out in - Result_Ok (letb g_pow_xi := f_g_pow (f_rp_xi params) in - letb zkp_xi := impl__schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in - letb register_vote_state_ret := f_clone state in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_round1 := update_at_usize (f_round1 register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) (ret_both (true : 'bool))) in - Result_Ok (prod_b (f_accept,register_vote_state_ret)))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError). -Fail Next Obligation. - -Equations impl__tally_votes {v_G : _} {n : both uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_G} `{ t_Group v_G} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (_ : both impl_574521470_) (state : both (t_OvnContractState v_G (both uint_size))) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) := - impl__tally_votes _ state := - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => - ssp (fun _ => - letb g_pow_yi := impl__compute_g_pow_yi i (f_g_pow_xis state) in - letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError)] _ := ControlFlow_Continue (ifb not (impl__zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError)] hoist31 := ControlFlow_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist31) - else ControlFlow_Continue (ret_both (tt : 'unit))) in - ifb not (impl__check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError)] hoist32 := ControlFlow_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist32) - else ControlFlow_Continue (ret_both (tt : 'unit)) : (both (t_ControlFlow (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError) 'unit)))) (ret_both (tt : 'unit)) in - letb vote_result := f_group_one in - letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => - ssp (fun vote_result => - vote_result .* g_pow_vote : (both v_G))) vote_result in - letb tally := ret_both (0 : int32) in - letb curr := f_field_zero in - letb '(curr,tally) := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => - ssp (fun '(curr,tally) => - letb tally := ifb (f_g_pow curr) =.? vote_result - then letb tally := i in - tally - else tally in - letb curr := curr .+ f_field_one in - prod_b (curr,tally) : (both (f_Z × int32)))) (prod_b (curr,tally)) in - letb tally_votes_state_ret := f_clone state in - letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in - Result_Ok (prod_b (f_accept,tally_votes_state_ret)) : both (t_Result (v_A × t_OvnContractState v_G (both uint_size)) t_ParseError). -Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_secp256k1.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_secp256k1.v index df5f4a4..fc97d54 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_secp256k1.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_secp256k1.v @@ -1,367 +1,268 @@ (* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -(* From Jasmin Require Import word. *) - From Coq Require Import ZArith. -From Coq Require Import Strings.String. +Require Import List. Import List.ListNotations. -Open Scope list_scope. Open Scope Z_scope. Open Scope bool_scope. +Require Import Ascii. +Require Import String. +Require Import Coq.Floats.Floats. +From RecordUpdate Require Import RecordSet. +Import RecordSetNotations. +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +Import choice.Choice.Exports. From Hacspec Require Import ChoiceEquality. From Hacspec Require Import LocationUtility. From Hacspec Require Import Hacspec_Lib_Comparable. From Hacspec Require Import Hacspec_Lib_Pre. From Hacspec Require Import Hacspec_Lib. +From Hacspec Require Import ConCertLib. -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. +From Hacspec_ovn Require Import Hacspec_ovn (t_ovn_traits). +Export Hacspec_ovn (t_ovn_traits). -Require Import Crate_Ovn_traits. -Export Crate_Ovn_traits. +From Hacspec_ovn Require Import hacspec_lib. +Export hacspec_lib. -Require Import Hacspec_lib. -Export Hacspec_lib. - -Require Import Hacspec_bip_340. -Export Hacspec_bip_340. +From Hacspec_ovn Require Import hacspec_bip_340. +Export hacspec_bip_340. Definition t_Group_curve : choice_type := - (t_Point). -Equations f_g_val (s : both t_Group_curve) : both t_Point := - f_g_val s := - bind_both s (fun x => - ret_both (x : t_Point)) : both t_Point. -Fail Next Obligation. -Equations Build_t_Group_curve {f_g_val : both t_Point} : both (t_Group_curve) := - Build_t_Group_curve := - bind_both f_g_val (fun f_g_val => - ret_both ((f_g_val) : (t_Group_curve))) : both (t_Group_curve). -Fail Next Obligation. -Notation "'Build_t_Group_curve' '[' x ']' '(' 'f_g_val' ':=' y ')'" := (Build_t_Group_curve (f_g_val := y)). + t_Point.Definition Build_t_Group_curve : t_Group_curve := + Group_curve_f_g_val. +Definition Group_curve_f_g_val (x : t_Group_curve) : t_Point := + x. +#[export] Instance settable_t_Group_curve : Settable _ := + settable! (@Build_t_Group_curve) . -#[global] Program Instance t_Group_curve_t_Deserial : t_Deserial t_Group_curve := - let f_deserial := fun (source : both v_R) => run (letb '(tmp0,out) := f_get source in - letb source := tmp0 in - letb hoist3 := out in - letb hoist4 := f_branch hoist3 in - letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] (b : 'bool) := matchb hoist4 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in - letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] hoist2 := ControlFlow_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist2) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : ('bool)) in - ControlFlow_Continue val - end in - letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] '(source,hax_temp_output) := ifb b - then letb '(tmp0,out) := f_get source in - letb source := tmp0 in - letb hoist6 := out in - letb hoist7 := f_branch hoist6 in - letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] (vx : t_Vec int8 t_Global) := matchb hoist7 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in - letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] hoist5 := ControlFlow_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist5) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (t_Vec int8 t_Global)) in - ControlFlow_Continue val - end in - letb '(tmp0,out) := f_get source in - letb source := tmp0 in - letb hoist9 := out in - letb hoist10 := f_branch hoist9 in - letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] (vy : t_Vec int8 t_Global) := matchb hoist10 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in - letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Group_curve t_ParseError)] hoist8 := ControlFlow_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist8) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (t_Vec int8 t_Global)) in - ControlFlow_Continue val - end in - ControlFlow_Continue (prod_b (source,Result_Ok (Build_t_Group_curve (f_g_val := Point_Affine (prod_b (impl__FieldElement__from_public_byte_seq_be (impl_52__from_vec vx),impl__FieldElement__from_public_byte_seq_be (impl_52__from_vec vy))))))) - else ControlFlow_Continue (prod_b (source,Result_Ok (Build_t_Group_curve (f_g_val := Point_AtInfinity)))) in - ControlFlow_Continue (prod_b (source,hax_temp_output))) : both (v_R × t_Result t_Group_curve t_ParseError) in - {| f_deserial := (@f_deserial)|}. -Fail Next Obligation. -Hint Unfold t_Group_curve_t_Deserial. +Definition t_Z_curve : choice_type := + t_Scalar.Definition Build_t_Z_curve : t_Z_curve := + Z_curve_f_z_val. +Definition Z_curve_f_z_val (x : t_Z_curve) : t_Scalar := + x. +#[export] Instance settable_t_Z_curve : Settable _ := + settable! (@Build_t_Z_curve) . -#[global] Program Instance t_Group_curve_t_Serial : t_Serial t_Group_curve := - let f_serial := fun (self : both t_Group_curve) (out : both v_W) => run (letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] out := matchb f_g_val self with - | Point_Affine_case p => - letb p := ret_both ((p) : (t_FieldElement × t_FieldElement)) in - letb '(tmp0,out1) := f_serial (ret_both (true : 'bool)) out in - letb out := tmp0 in - letb hoist12 := out1 in - letb hoist13 := f_branch hoist12 in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist13 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist11 := ControlFlow_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist11) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : ('unit)) in - ControlFlow_Continue val - end in - letb (vx : t_Vec int8 t_Global) := impl__new in - letb vx := foldi_both_list (f_into_iter (impl_41__native_slice (impl__FieldElement__to_public_byte_seq_be (x p)))) (fun x => - ssp (fun vx => - impl_1__push vx (f_clone x) : (both (t_Vec int8 t_Global)))) vx in - letb '(tmp0,out1) := f_serial vx out in - letb out := tmp0 in - letb hoist15 := out1 in - letb hoist16 := f_branch hoist15 in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist16 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist14 := ControlFlow_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist14) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : ('unit)) in - ControlFlow_Continue val - end in - letb (vy : t_Vec int8 t_Global) := impl__new in - letb vy := foldi_both_list (f_into_iter (impl_41__native_slice (impl__FieldElement__to_public_byte_seq_be (y p)))) (fun y => - ssp (fun vy => - impl_1__push vy (f_clone y) : (both (t_Vec int8 t_Global)))) vy in - letb '(tmp0,out1) := f_serial vy out in - letb out := tmp0 in - letb hoist18 := out1 in - letb hoist19 := f_branch hoist18 in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist19 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist17 := ControlFlow_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist17) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : ('unit)) in - ControlFlow_Continue val - end in - ControlFlow_Continue out - | Point_AtInfinity_case => - letb '(tmp0,out1) := f_serial (ret_both (false : 'bool)) out in - letb out := tmp0 in - letb hoist21 := out1 in - letb hoist22 := f_branch hoist21 in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist22 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist20 := ControlFlow_Break (prod_b (out,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist20) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : ('unit)) in - ControlFlow_Continue val - end in - ControlFlow_Continue out - end in - ControlFlow_Continue (letb hax_temp_output := Result_Ok (ret_both (tt : 'unit)) in - prod_b (out,hax_temp_output))) : both (v_W × t_Result 'unit f_Err) in - {| f_serial := (@f_serial)|}. -Fail Next Obligation. -Hint Unfold t_Group_curve_t_Serial. +Instance t_Deserial_57956922 : t_Deserial ((t_Z_curve)) := + { + t_Deserial_impl_f_deserial := fun (source : v_R) => + run (let (tmp0,out) := Get_f_get (source) in + let _ := TODO: please implement the method `lhs_LhsLocalVar` := tmp0 in + let hoist2 := out in + let hoist3 := Try_f_branch (hoist2) in + let temp : t_Vec ((t_u8)) ((t_Global)) := match hoist3 with + | ControlFlow_Break (residual) => + let hoist1 := ControlFlow_Break ((source,FromResidual_f_from_residual (residual))) in + ControlFlow_Continue (never_to_any (hoist1)) + | ControlFlow_Continue (val) => + ControlFlow_Continue (val) + end in + ControlFlow_Continue (let hax_temp_output := Result_Ok (Build_t_Z_curve (impl__Scalar__from_public_byte_seq_be (impl_52__from_vec (temp)))) in + (source,hax_temp_output))); + }. -Definition t_Z_curve : choice_type := - (t_Scalar). -Equations f_z_val (s : both t_Z_curve) : both t_Scalar := - f_z_val s := - bind_both s (fun x => - ret_both (x : t_Scalar)) : both t_Scalar. -Fail Next Obligation. -Equations Build_t_Z_curve {f_z_val : both t_Scalar} : both (t_Z_curve) := - Build_t_Z_curve := - bind_both f_z_val (fun f_z_val => - ret_both ((f_z_val) : (t_Z_curve))) : both (t_Z_curve). -Fail Next Obligation. -Notation "'Build_t_Z_curve' '[' x ']' '(' 'f_z_val' ':=' y ')'" := (Build_t_Z_curve (f_z_val := y)). +Instance t_Serial_79745743 : t_Serial ((t_Z_curve)) := + { + t_Serial_impl_1_f_serial := fun (self : t_Z_curve) (out : v_W) => + let v : t_Vec ((t_u8)) ((t_Global)) := impl__new (tt) in + let _ := {IntoIterator_f_into_iter (impl_41__native_slice (impl__Scalar__to_public_byte_seq_be (Z_curve_f_z_val self)))} inP? [x] [is_none]default of ( + TODO: please implement the method `lhs_LhsLocalVar` := impl_1__push (v) (Clone_f_clone (x))) in + let (tmp0,out1) := Serial_f_serial (v) (out) in + let _ := TODO: please implement the method `lhs_LhsLocalVar` := tmp0 in + let hax_temp_output := out1 in + (out,hax_temp_output); + }. -#[global] Program Instance t_Z_curve_t_Deserial : t_Deserial t_Z_curve := - let f_deserial := fun (source : both v_R) => run (letb '(tmp0,out) := f_get source in - letb source := tmp0 in - letb hoist24 := out in - letb hoist25 := f_branch hoist24 in - letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Z_curve t_ParseError)] (temp : t_Vec int8 t_Global) := matchb hoist25 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in - letm[choice_typeMonad.result_bind_code (v_R × t_Result t_Z_curve t_ParseError)] hoist23 := ControlFlow_Break (prod_b (source,f_from_residual residual)) in - ControlFlow_Continue (never_to_any hoist23) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (t_Vec int8 t_Global)) in - ControlFlow_Continue val - end in - ControlFlow_Continue (letb hax_temp_output := Result_Ok (Build_t_Z_curve (f_z_val := impl__Scalar__from_public_byte_seq_be (impl_52__from_vec temp))) in - prod_b (source,hax_temp_output))) : both (v_R × t_Result t_Z_curve t_ParseError) in - {| f_deserial := (@f_deserial)|}. -Fail Next Obligation. -Hint Unfold t_Z_curve_t_Deserial. +Instance t_Deserial_116245855 : t_Deserial ((t_Group_curve)) := + { + t_Deserial_impl_7_f_deserial := fun (source : v_R) => + run (let (tmp0,out) := Get_f_get (source) in + let _ := TODO: please implement the method `lhs_LhsLocalVar` := tmp0 in + let hoist5 := out in + let hoist6 := Try_f_branch (hoist5) in + let b : 'bool := match hoist6 with + | ControlFlow_Break (residual) => + let hoist4 := ControlFlow_Break ((source,FromResidual_f_from_residual (residual))) in + ControlFlow_Continue (never_to_any (hoist4)) + | ControlFlow_Continue (val) => + ControlFlow_Continue (val) + end in + let hax_temp_output := if + b + then + let (tmp0,out) := Get_f_get (source) in + let _ := TODO: please implement the method `lhs_LhsLocalVar` := tmp0 in + let hoist8 := out in + let hoist9 := Try_f_branch (hoist8) in + let vx : t_Vec ((t_u8)) ((t_Global)) := match hoist9 with + | ControlFlow_Break (residual) => + let hoist7 := ControlFlow_Break ((source,FromResidual_f_from_residual (residual))) in + ControlFlow_Continue (never_to_any (hoist7)) + | ControlFlow_Continue (val) => + ControlFlow_Continue (val) + end in + let (tmp0,out) := Get_f_get (source) in + let _ := TODO: please implement the method `lhs_LhsLocalVar` := tmp0 in + let hoist11 := out in + let hoist12 := Try_f_branch (hoist11) in + let vy : t_Vec ((t_u8)) ((t_Global)) := match hoist12 with + | ControlFlow_Break (residual) => + let hoist10 := ControlFlow_Break ((source,FromResidual_f_from_residual (residual))) in + ControlFlow_Continue (never_to_any (hoist10)) + | ControlFlow_Continue (val) => + ControlFlow_Continue (val) + end in + ControlFlow_Continue (Result_Ok (Build_t_Group_curve (Point_Affine ((impl__FieldElement__from_public_byte_seq_be (impl_52__from_vec (vx)),impl__FieldElement__from_public_byte_seq_be (impl_52__from_vec (vy))))))) + else + ControlFlow_Continue (Result_Ok (Build_t_Group_curve (Point_AtInfinity))) in + ControlFlow_Continue ((source,hax_temp_output))); + }. -#[global] Program Instance t_Z_curve_t_Serial : t_Serial t_Z_curve := - let f_serial := fun (self : both t_Z_curve) (out : both v_W) => letb (v : t_Vec int8 t_Global) := impl__new in - letb v := foldi_both_list (f_into_iter (impl_41__native_slice (impl__Scalar__to_public_byte_seq_be (f_z_val self)))) (fun x => - ssp (fun v => - impl_1__push v (f_clone x) : (both (t_Vec int8 t_Global)))) v in - letb '(tmp0,out1) := f_serial v out in - letb out := tmp0 in - letb hax_temp_output := out1 in - prod_b (out,hax_temp_output) : both (v_W × t_Result 'unit f_Err) in - {| f_serial := (@f_serial)|}. -Fail Next Obligation. -Hint Unfold t_Z_curve_t_Serial. +Instance t_Serial_210512824 : t_Serial ((t_Group_curve)) := + { + t_Serial_impl_8_f_serial := fun (self : t_Group_curve) (out : v_W) => + run (let _ := match Group_curve_f_g_val self with + | Point_Affine (p) => + let (tmp0,out1) := Serial_f_serial (true) (out) in + let _ := TODO: please implement the method `lhs_LhsLocalVar` := tmp0 in + let hoist14 := out1 in + let hoist15 := Try_f_branch (hoist14) in + let _ := match hoist15 with + | ControlFlow_Break (residual) => + let hoist13 := ControlFlow_Break ((out,FromResidual_f_from_residual (residual))) in + ControlFlow_Continue (never_to_any (hoist13)) + | ControlFlow_Continue (val) => + ControlFlow_Continue (val) + end in + let vx : t_Vec ((t_u8)) ((t_Global)) := impl__new (tt) in + let _ := {IntoIterator_f_into_iter (impl_41__native_slice (impl__FieldElement__to_public_byte_seq_be (x (p))))} inP? [x] [is_none]default of ( + TODO: please implement the method `lhs_LhsLocalVar` := impl_1__push (vx) (Clone_f_clone (x))) in + let (tmp0,out1) := Serial_f_serial (vx) (out) in + let _ := TODO: please implement the method `lhs_LhsLocalVar` := tmp0 in + let hoist17 := out1 in + let hoist18 := Try_f_branch (hoist17) in + let _ := match hoist18 with + | ControlFlow_Break (residual) => + let hoist16 := ControlFlow_Break ((out,FromResidual_f_from_residual (residual))) in + ControlFlow_Continue (never_to_any (hoist16)) + | ControlFlow_Continue (val) => + ControlFlow_Continue (val) + end in + let vy : t_Vec ((t_u8)) ((t_Global)) := impl__new (tt) in + let _ := {IntoIterator_f_into_iter (impl_41__native_slice (impl__FieldElement__to_public_byte_seq_be (y (p))))} inP? [y] [is_none]default of ( + TODO: please implement the method `lhs_LhsLocalVar` := impl_1__push (vy) (Clone_f_clone (y))) in + let (tmp0,out1) := Serial_f_serial (vy) (out) in + let _ := TODO: please implement the method `lhs_LhsLocalVar` := tmp0 in + let hoist20 := out1 in + let hoist21 := Try_f_branch (hoist20) in + let _ := match hoist21 with + | ControlFlow_Break (residual) => + let hoist19 := ControlFlow_Break ((out,FromResidual_f_from_residual (residual))) in + ControlFlow_Continue (never_to_any (hoist19)) + | ControlFlow_Continue (val) => + ControlFlow_Continue (val) + end in + ControlFlow_Continue (tt) + | Point_AtInfinity => + let (tmp0,out1) := Serial_f_serial (false) (out) in + let _ := TODO: please implement the method `lhs_LhsLocalVar` := tmp0 in + let hoist23 := out1 in + let hoist24 := Try_f_branch (hoist23) in + let _ := match hoist24 with + | ControlFlow_Break (residual) => + let hoist22 := ControlFlow_Break ((out,FromResidual_f_from_residual (residual))) in + ControlFlow_Continue (never_to_any (hoist22)) + | ControlFlow_Continue (val) => + ControlFlow_Continue (val) + end in + ControlFlow_Continue (tt) + end in + ControlFlow_Continue (let hax_temp_output := Result_Ok (tt) in + (out,hax_temp_output))); + }. -#[global] Program Instance t_Z_curve_t_Mul : t_Mul t_Z_curve t_Z_curve := - let f_Output := t_Z_curve : choice_type in - let f_mul := fun (self : both t_Z_curve) (y : both t_Z_curve) => Build_t_Z_curve (f_z_val := (f_z_val self) .* (f_z_val y)) : both t_Z_curve in - {| f_Output := (@f_Output); - f_mul := (@f_mul)|}. -Fail Next Obligation. -Hint Unfold t_Z_curve_t_Mul. +Instance t_Mul_893045317 : t_Mul ((t_Z_curve)) ((t_Z_curve)) := + { + t_Mul_impl_2_f_Output := t_Z_curve; + t_Mul_impl_2_f_mul := fun (self : t_Z_curve) (y : t_Z_curve) => + Build_t_Z_curve (Mul_f_mul (Z_curve_f_z_val self) (Z_curve_f_z_val y)); + }. -#[global] Program Instance t_Z_curve_t_Product : t_Product t_Z_curve t_Z_curve := - let f_product := fun (iter : both v_I) => f_fold iter (Build_t_Z_curve (f_z_val := impl__Scalar__from_literal (ret_both (1 : int128)))) (fun a => fun b => - a .* b) : both t_Z_curve in - {| f_product := (@f_product)|}. -Fail Next Obligation. -Hint Unfold t_Z_curve_t_Product. +Instance t_Product_902246531 : t_Product ((t_Z_curve)) ((t_Z_curve)) := + { + t_Product_impl_3_f_product := fun (iter : v_I) => + Iterator_f_fold (iter) (Build_t_Z_curve (impl__Scalar__from_literal (1))) (fun a b => + Mul_f_mul (a) (b)); + }. -#[global] Program Instance t_Z_curve_t_Add : t_Add t_Z_curve t_Z_curve := - let f_Output := t_Z_curve : choice_type in - let f_add := fun (self : both t_Z_curve) (y : both t_Z_curve) => Build_t_Z_curve (f_z_val := (f_z_val self) .+ (f_z_val y)) : both t_Z_curve in - {| f_Output := (@f_Output); - f_add := (@f_add)|}. -Fail Next Obligation. -Hint Unfold t_Z_curve_t_Add. +Instance t_Add_552520376 : t_Add ((t_Z_curve)) ((t_Z_curve)) := + { + t_Add_impl_4_f_Output := t_Z_curve; + t_Add_impl_4_f_add := fun (self : t_Z_curve) (y : t_Z_curve) => + Build_t_Z_curve (Add_f_add (Z_curve_f_z_val self) (Z_curve_f_z_val y)); + }. -#[global] Program Instance t_Group_curve_t_Mul : t_Mul t_Group_curve t_Group_curve := - let f_Output := t_Group_curve : choice_type in - let f_mul := fun (self : both t_Group_curve) (y : both t_Group_curve) => Build_t_Group_curve (f_g_val := point_add (f_g_val self) (f_g_val y)) : both t_Group_curve in - {| f_Output := (@f_Output); - f_mul := (@f_mul)|}. -Fail Next Obligation. -Hint Unfold t_Group_curve_t_Mul. +Instance t_Mul_565430551 : t_Mul ((t_Group_curve)) ((t_Group_curve)) := + { + t_Mul_impl_9_f_Output := t_Group_curve; + t_Mul_impl_9_f_mul := fun (self : t_Group_curve) (y : t_Group_curve) => + Build_t_Group_curve (point_add (Group_curve_f_g_val self) (Group_curve_f_g_val y)); + }. -#[global] Program Instance t_Z_curve_t_Field : t_Field t_Z_curve := - let f_q := fun (_ : both 'unit) => Build_t_Z_curve (f_z_val := impl__Scalar__from_hex (ret_both (0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 : chString))) : both t_Z_curve in - let f_random_field_elem := fun (random : both int32) => Build_t_Z_curve (f_z_val := impl__Scalar__from_literal (cast_int (WS2 := _) random)) : both t_Z_curve in - let f_field_zero := fun (_ : both 'unit) => Build_t_Z_curve (f_z_val := impl__Scalar__from_literal (ret_both (0 : int128))) : both t_Z_curve in - let f_field_one := fun (_ : both 'unit) => Build_t_Z_curve (f_z_val := impl__Scalar__from_literal (ret_both (1 : int128))) : both t_Z_curve in - let f_inv := fun (x : both t_Z_curve) => run (letb _ := assert (ret_both (false : 'bool)) in - letm[choice_typeMonad.result_bind_code t_Z_curve] hoist29 := ControlFlow_Break x in - ControlFlow_Continue (never_to_any hoist29)) : both t_Z_curve in - {| f_q := (@f_q); - f_random_field_elem := (@f_random_field_elem); - f_field_zero := (@f_field_zero); - f_field_one := (@f_field_one); - f_inv := (@f_inv)|}. -Fail Next Obligation. -Hint Unfold t_Z_curve_t_Field. +Instance t_Field_230158822 : t_Field ((t_Z_curve)) := + { + t_Field_impl_6_f_q := fun (_ : unit) => + Build_t_Z_curve (impl__Scalar__from_hex ("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141"%string)); + t_Field_impl_6_f_random_field_elem := fun (random : t_u32) => + Build_t_Z_curve (impl__Scalar__from_literal (cast (random))); + t_Field_impl_6_f_field_zero := fun (_ : unit) => + Build_t_Z_curve (impl__Scalar__from_literal (0)); + t_Field_impl_6_f_field_one := fun (_ : unit) => + Build_t_Z_curve (impl__Scalar__from_literal (1)); + t_Field_impl_6_f_inv := fun (x : t_Z_curve) => + run (let _ := assert (false) in + let hoist29 := ControlFlow_Break (x) in + ControlFlow_Continue (never_to_any (hoist29))); + }. -#[global] Program Instance t_Z_curve_t_Neg : t_Neg t_Z_curve := - let f_Output := t_Z_curve : choice_type in - let f_neg := fun (self : both t_Z_curve) => Build_t_Z_curve (f_z_val := (f_z_val f_field_zero) .- (f_z_val self)) : both t_Z_curve in - {| f_Output := (@f_Output); - f_neg := (@f_neg)|}. -Fail Next Obligation. -Hint Unfold t_Z_curve_t_Neg. +Instance t_Neg_848153603 : t_Neg ((t_Z_curve)) := + { + t_Neg_impl_5_f_Output := t_Z_curve; + t_Neg_impl_5_f_neg := fun (self : t_Z_curve) => + Build_t_Z_curve (Sub_f_sub (Z_curve_f_z_val Field_f_field_zero (tt)) (Z_curve_f_z_val self)); + }. -#[global] Program Instance t_Group_curve_t_Product : t_Product t_Group_curve t_Group_curve := - let f_product := fun (iter : both v_I) => f_fold iter (f_g_pow f_field_zero) (fun a => fun b => - a .* b) : both t_Group_curve in - {| f_product := (@f_product)|}. -Fail Next Obligation. -Hint Unfold t_Group_curve_t_Product. +Instance t_Product_307260739 : t_Product ((t_Group_curve)) ((t_Group_curve)) := + { + t_Product_impl_10_f_product := fun (iter : v_I) => + Iterator_f_fold (iter) (Group_f_g_pow (Field_f_field_zero (tt))) (fun a b => + Mul_f_mul (a) (b)); + }. -#[global] Program Instance t_Group_curve_t_Group : t_Group t_Group_curve := - let f_Z := t_Z_curve : choice_type in - let f_g := fun (_ : both 'unit) => letb gx := PBytes32 (array_from_list [ret_both (121 : int8); - ret_both (190 : int8); - ret_both (102 : int8); - ret_both (126 : int8); - ret_both (249 : int8); - ret_both (220 : int8); - ret_both (187 : int8); - ret_both (172 : int8); - ret_both (85 : int8); - ret_both (160 : int8); - ret_both (98 : int8); - ret_both (149 : int8); - ret_both (206 : int8); - ret_both (135 : int8); - ret_both (11 : int8); - ret_both (7 : int8); - ret_both (2 : int8); - ret_both (155 : int8); - ret_both (252 : int8); - ret_both (219 : int8); - ret_both (45 : int8); - ret_both (206 : int8); - ret_both (40 : int8); - ret_both (217 : int8); - ret_both (89 : int8); - ret_both (242 : int8); - ret_both (129 : int8); - ret_both (91 : int8); - ret_both (22 : int8); - ret_both (248 : int8); - ret_both (23 : int8); - ret_both (152 : int8)]) in - letb gy := PBytes32 (array_from_list [ret_both (72 : int8); - ret_both (58 : int8); - ret_both (218 : int8); - ret_both (119 : int8); - ret_both (38 : int8); - ret_both (163 : int8); - ret_both (196 : int8); - ret_both (101 : int8); - ret_both (93 : int8); - ret_both (164 : int8); - ret_both (251 : int8); - ret_both (252 : int8); - ret_both (14 : int8); - ret_both (17 : int8); - ret_both (8 : int8); - ret_both (168 : int8); - ret_both (253 : int8); - ret_both (23 : int8); - ret_both (180 : int8); - ret_both (72 : int8); - ret_both (166 : int8); - ret_both (133 : int8); - ret_both (84 : int8); - ret_both (25 : int8); - ret_both (156 : int8); - ret_both (71 : int8); - ret_both (208 : int8); - ret_both (143 : int8); - ret_both (251 : int8); - ret_both (16 : int8); - ret_both (212 : int8); - ret_both (184 : int8)]) in - Build_t_Group_curve (f_g_val := Point_Affine (prod_b (impl__FieldElement__from_public_byte_seq_be gx,impl__FieldElement__from_public_byte_seq_be gy))) : both t_Group_curve in - let f_pow := fun (g : both t_Group_curve) (x : both t_Z_curve) => Build_t_Group_curve (f_g_val := point_mul (f_z_val x) (f_g_val g)) : both t_Group_curve in - let f_g_pow := fun (x : both t_Z_curve) => Build_t_Group_curve (f_g_val := point_mul_base (f_z_val x)) : both t_Group_curve in - let f_group_one := fun (_ : both 'unit) => f_g_pow f_field_zero : both t_Group_curve in - let f_group_inv := fun (x : both t_Group_curve) => Build_t_Group_curve (f_g_val := matchb f_g_val x with - | Point_Affine_case (a,b) => - letb '(a,b) := ret_both (((a,b)) : (t_FieldElement × t_FieldElement)) in - Point_Affine (prod_b (a,(impl__FieldElement__from_literal (ret_both (0 : int128))) .- b)) - | Point_AtInfinity_case => - Point_AtInfinity - end) : both t_Group_curve in - let f_hash := fun (x : both (t_Vec t_Group_curve t_Global)) => f_field_one : both t_Z_curve in - {| f_Z := (@f_Z); - f_g := (@f_g); - f_pow := (@f_pow); - f_g_pow := (@f_g_pow); - f_group_one := (@f_group_one); - f_group_inv := (@f_group_inv); - f_hash := (@f_hash)|}. -Fail Next Obligation. -Hint Unfold t_Group_curve_t_Group. +Instance t_Group_947705802 : t_Group ((t_Group_curve)) := + { + t_Group_impl_11_f_Z := t_Z_curve; + t_Group_impl_11_f_g := fun (_ : unit) => + let gx := Build_t_PBytes32 ([121; 190; 102; 126; 249; 220; 187; 172; 85; 160; 98; 149; 206; 135; 11; 7; 2; 155; 252; 219; 45; 206; 40; 217; 89; 242; 129; 91; 22; 248; 23; 152]) in + let gy := Build_t_PBytes32 ([72; 58; 218; 119; 38; 163; 196; 101; 93; 164; 251; 252; 14; 17; 8; 168; 253; 23; 180; 72; 166; 133; 84; 25; 156; 71; 208; 143; 251; 16; 212; 184]) in + Build_t_Group_curve (Point_Affine ((impl__FieldElement__from_public_byte_seq_be (gx),impl__FieldElement__from_public_byte_seq_be (gy)))); + t_Group_impl_11_f_pow := fun (g : t_Group_curve) (x : t_Z_curve) => + Build_t_Group_curve (point_mul (Z_curve_f_z_val x) (Group_curve_f_g_val g)); + t_Group_impl_11_f_g_pow := fun (x : t_Z_curve) => + Build_t_Group_curve (point_mul_base (Z_curve_f_z_val x)); + t_Group_impl_11_f_group_one := fun (_ : unit) => + Group_f_g_pow (Field_f_field_zero (tt)); + t_Group_impl_11_f_group_inv := fun (x : t_Group_curve) => + Build_t_Group_curve (match Group_curve_f_g_val x with + | Point_Affine ((a,b)) => + Point_Affine ((a,Sub_f_sub (impl__FieldElement__from_literal (0)) (b))) + | Point_AtInfinity => + Point_AtInfinity + end); + t_Group_impl_11_f_hash := fun (x : t_Vec ((t_Group_curve)) ((t_Global))) => + Field_f_field_one (tt); + }. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.glob b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.glob new file mode 100644 index 0000000..de3bc59 --- /dev/null +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.glob @@ -0,0 +1,224 @@ +DIGEST 6389834e57e83e53e7170ee795828b05 +FHacspec_ovn.Hacspec_ovn_Ovn_traits +R70:75 Coq.ZArith.ZArith <> <> lib +R93:96 Coq.Lists.List <> <> lib +R106:123 Coq.Lists.List ListNotations <> mod +R184:188 Coq.Strings.Ascii <> <> lib +R206:211 Coq.Strings.String <> <> lib +R229:245 Coq.Floats.Floats <> <> lib +R281:289 RecordUpdate.RecordSet <> <> lib +R299:316 RecordUpdate.RecordSet RecordSetNotations <> mod +R345:355 Crypt.choice_type <> <> lib +R357:363 Crypt.Package <> <> lib +R365:371 Crypt.Prelude <> <> lib +R381:395 Crypt.package.pkg_notation PackageNotation <> mod +R430:432 extructures.ord <> <> lib +R434:437 extructures.fset <> <> lib +R469:477 mathcomp.word.word_ssrZ <> <> lib +R479:482 mathcomp.word.word <> <> lib +R492:512 mathcomp.ssreflect.choice Choice.Exports <> mod +R544:557 Hacspec.ChoiceEquality <> <> lib +R588:602 Hacspec.LocationUtility <> <> lib +R633:654 Hacspec.Hacspec_Lib_Comparable <> <> lib +R685:699 Hacspec.Hacspec_Lib_Pre <> <> lib +R730:740 Hacspec.Hacspec_Lib <> <> lib +R771:780 Hacspec.ConCertLib <> <> lib +rec 790:794 <> t_Add +proj 847:858 <> Add_f_Output +proj 872:880 <> Add_f_add +binder 798:803 <> v_Self:1 +binder 815:819 <> v_Rhs:2 +R890:893 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R884:889 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:1 var +R899:902 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R894:898 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Rhs:2 var +R903:914 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> Add_f_Output:4 meth +R932:936 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Add class +R932:936 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Add class +R965:969 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Add class +rec 987:991 <> t_Div +proj 1044:1055 <> Div_f_Output +proj 1069:1077 <> Div_f_div +binder 995:1000 <> v_Self:6 +binder 1012:1016 <> v_Rhs:7 +R1087:1090 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1081:1086 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:6 var +R1096:1099 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1091:1095 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Rhs:7 var +R1100:1111 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> Div_f_Output:9 meth +R1129:1133 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Div class +R1129:1133 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Div class +R1162:1166 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Div class +rec 1184:1188 <> t_Mul +proj 1241:1252 <> Mul_f_Output +proj 1266:1274 <> Mul_f_mul +binder 1192:1197 <> v_Self:11 +binder 1209:1213 <> v_Rhs:12 +R1284:1287 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1278:1283 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:11 var +R1293:1296 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1288:1292 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Rhs:12 var +R1297:1308 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> Mul_f_Output:14 meth +R1326:1330 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Mul class +R1326:1330 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Mul class +R1359:1363 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Mul class +rec 1381:1385 <> t_Neg +proj 1422:1433 <> Neg_f_Output +proj 1447:1455 <> Neg_f_neg +binder 1389:1394 <> v_Self:16 +R1465:1468 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1459:1464 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:16 var +R1469:1480 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> Neg_f_Output:18 meth +R1498:1502 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Neg class +R1498:1502 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Neg class +R1531:1535 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Neg class +rec 1549:1553 <> t_Rem +proj 1606:1617 <> Rem_f_Output +proj 1631:1639 <> Rem_f_rem +binder 1557:1562 <> v_Self:20 +binder 1574:1578 <> v_Rhs:21 +R1649:1652 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1643:1648 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:20 var +R1658:1661 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1653:1657 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Rhs:21 var +R1662:1673 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> Rem_f_Output:23 meth +R1691:1695 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Rem class +R1691:1695 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Rem class +R1724:1728 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Rem class +rec 1746:1750 <> t_Sub +proj 1803:1814 <> Sub_f_Output +proj 1828:1836 <> Sub_f_sub +binder 1754:1759 <> v_Self:25 +binder 1771:1775 <> v_Rhs:26 +R1846:1849 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1840:1845 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:25 var +R1855:1858 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R1850:1854 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Rhs:26 var +R1859:1870 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> Sub_f_Output:28 meth +R1888:1892 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Sub class +R1888:1892 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Sub class +R1921:1925 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Sub class +rec 1943:1949 <> t_Field +proj 1993:2001 <> Field_f_q +proj 2025:2049 <> Field_f_random_field_elem +proj 2074:2091 <> Field_f_field_zero +proj 2115:2131 <> Field_f_field_one +proj 2155:2165 <> Field_f_inv +proj 2191:2217 <> Field_H11581440318597584651 +proj 2242:2268 <> Field_H12632649257025169145 +proj 2307:2332 <> Field_H8099741844003281729 +proj 2355:2380 <> Field_H9442900250278684536 +proj 2406:2432 <> Field_H17605656595743636193 +proj 2462:2488 <> Field_H12091683018502772129 +proj 2618:2643 <> Field_H9509749083603562901 +proj 2676:2703 <> Field_Heq9509749083603562901 +proj 2738:2763 <> Field_H7732034498048571850 +proj 2787:2814 <> Field_Heq7732034498048571850 +R1962:1972 Crypt.choice_type <> choice_type ind +binder 1953:1958 <> v_Self:30 +R2009:2012 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R2005:2008 Coq.Init.Datatypes <> unit ind +R2013:2018 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2058:2061 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R2053:2057 Hacspec.Hacspec_Lib_Pre <> int32 abbrev +R2062:2067 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2099:2102 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R2095:2098 Coq.Init.Datatypes <> unit ind +R2103:2108 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2139:2142 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R2135:2138 Coq.Init.Datatypes <> unit ind +R2143:2148 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2175:2178 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R2169:2174 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2179:2184 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2221:2226 Hacspec.Hacspec_Lib_TODO <> t_Copy class +R2229:2234 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2272:2282 Hacspec.Hacspec_Lib_TODO <> t_PartialEq class +R2294:2299 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2285:2290 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2336:2348 Hacspec.Hacspec_Lib_TODO <> :::'t_Eq' not +R2342:2347 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2384:2390 Hacspec.Hacspec_Lib_TODO <> t_Clone class +R2393:2398 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2436:2446 Hacspec.Hacspec_Lib_TODO <> t_Serialize class +R2449:2454 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2492:2496 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Mul class +R2508:2513 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2499:2504 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2541:2543 Coq.Init.Logic <> ::type_scope:x_'='_x not +R2528:2539 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> Mul_f_Output meth +R2544:2549 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2647:2651 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Add class +R2663:2668 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2654:2659 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2723:2725 Coq.Init.Logic <> ::type_scope:x_'='_x not +R2710:2721 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> Add_f_Output meth +R2726:2731 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2767:2771 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Neg class +R2774:2779 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2834:2836 Coq.Init.Logic <> ::type_scope:x_'='_x not +R2821:2832 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> Neg_f_Output meth +R2837:2842 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:30 var +R2861:2867 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Field class +R2861:2867 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Field class +rec 2970:2976 <> t_Group +proj 3020:3028 <> Group_f_Z +proj 3049:3051 <> Hi0 +proj 3080:3088 <> Group_f_g +proj 3112:3124 <> Group_f_g_pow +proj 3153:3163 <> Group_f_pow +proj 3202:3218 <> Group_f_group_one +proj 3242:3258 <> Group_f_group_inv +proj 3284:3295 <> Group_f_hash +proj 3347:3367 <> H11581440318597584651 +proj 3392:3412 <> H12632649257025169145 +proj 3451:3470 <> H8099741844003281729 +proj 3493:3512 <> H9442900250278684536 +proj 3538:3558 <> H17605656595743636193 +proj 3588:3608 <> H12091683018502772129 +R2989:2999 Crypt.choice_type <> choice_type ind +binder 2980:2985 <> v_Self:47 +R3032:3042 Crypt.choice_type <> choice_type ind +R3055:3061 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Field class +R3064:3072 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> Group_f_Z:49 meth +R3096:3099 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R3092:3095 Coq.Init.Datatypes <> unit ind +R3100:3105 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:47 var +R3137:3140 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R3128:3136 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> Group_f_Z:49 meth +R3141:3146 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:47 var +R3173:3176 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R3167:3172 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:47 var +R3186:3189 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R3177:3185 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> Group_f_Z:49 meth +R3190:3195 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:47 var +R3226:3229 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R3222:3225 Coq.Init.Datatypes <> unit ind +R3230:3235 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:47 var +R3268:3271 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R3262:3267 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:47 var +R3272:3277 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:47 var +R3328:3331 Coq.Init.Logic <> ::type_scope:x_'->'_x not +R3299:3303 Hacspec.Hacspec_Lib_TODO <> t_Vec def +R3307:3312 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:47 var +R3318:3325 Hacspec.Hacspec_Lib_TODO <> t_Global constr +R3332:3340 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> Group_f_Z:49 meth +R3371:3376 Hacspec.Hacspec_Lib_TODO <> t_Copy class +R3379:3384 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:47 var +R3416:3426 Hacspec.Hacspec_Lib_TODO <> t_PartialEq class +R3438:3443 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:47 var +R3429:3434 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:47 var +R3474:3486 Hacspec.Hacspec_Lib_TODO <> :::'t_Eq' not +R3480:3485 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:47 var +R3516:3522 Hacspec.Hacspec_Lib_TODO <> t_Clone class +R3525:3530 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:47 var +R3562:3572 Hacspec.Hacspec_Lib_TODO <> t_Serialize class +R3575:3580 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:47 var +R3612:3616 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Mul class +R3628:3633 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:47 var +R3619:3624 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:47 var +R3661:3663 Coq.Init.Logic <> ::type_scope:x_'='_x not +R3648:3659 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> Mul_f_Output meth +R3664:3669 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> v_Self:47 var +R3749:3755 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Group class +R3749:3755 Hacspec_ovn.Hacspec_ovn_Ovn_traits <> t_Group class diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v index 2e3d885..a7a27fe 100644 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v +++ b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.v @@ -1,59 +1,79 @@ (* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -(* From Jasmin Require Import word. *) - From Coq Require Import ZArith. -From Coq Require Import Strings.String. +Require Import List. Import List.ListNotations. -Open Scope list_scope. Open Scope Z_scope. Open Scope bool_scope. +Require Import Ascii. +Require Import String. +Require Import Coq.Floats.Floats. +From RecordUpdate Require Import RecordSet. +Import RecordSetNotations. +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +Import choice.Choice.Exports. From Hacspec Require Import ChoiceEquality. From Hacspec Require Import LocationUtility. From Hacspec Require Import Hacspec_Lib_Comparable. From Hacspec Require Import Hacspec_Lib_Pre. From Hacspec Require Import Hacspec_Lib. +From Hacspec Require Import ConCertLib. -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Product. -Export Product. - -Class t_Field (v_Self : _) `{ t_Copy v_Self} `{ t_PartialEq v_Self v_Self} `{ t_Eq v_Self} `{ t_Clone v_Self} `{ t_Serialize v_Self} `{ t_Mul v_Self v_Self} `{ t_Product v_Self v_Self} `{ t_Add v_Self v_Self} `{ t_Neg v_Self} := { - f_q : (both v_Self) ; - f_random_field_elem : (both int32 -> both v_Self) ; - f_field_zero : (both v_Self) ; - f_field_one : (both v_Self) ; - f_inv : (both v_Self -> both v_Self) ; -}. +Class t_Field `{v_Self : choice_type} : Type := + { + Field_f_q : unit -> v_Self; + Field_f_random_field_elem : t_u32 -> v_Self; + Field_f_field_zero : unit -> v_Self; + Field_f_field_one : unit -> v_Self; + Field_f_inv : v_Self -> v_Self; + H11581440318597584651 : t_Copy (v_Self); + H12632649257025169145 : t_PartialEq (v_Self) (v_Self); + H8099741844003281729 : t_Eq (v_Self); + H9442900250278684536 : t_Clone (v_Self); + H17605656595743636193 : t_Serialize (v_Self); + H12091683018502772129 : t_Mul (v_Self) (v_Self); + _.(Mul_f_Output) = v_Self; + H8449417958832886617 : t_Product (v_Self) (v_Self); + H9509749083603562901 : t_Add (v_Self) (v_Self); + _.(Add_f_Output) = v_Self; + H7732034498048571850 : t_Neg (v_Self); + _.(Neg_f_Output) = v_Self; + }.. -Class t_Group (v_Self : _) `{ t_Copy v_Self} `{ t_PartialEq v_Self v_Self} `{ t_Eq v_Self} `{ t_Clone v_Self} `{ t_Serialize v_Self} `{ t_Mul v_Self v_Self} `{ t_Product v_Self v_Self} := { - f_Z : choice_type ; - f_Z_t_Field :> (t_Field f_Z) ; - f_Z_t_Neg :> (t_Neg f_Z) ; - f_Z_t_Add :> (t_Add f_Z) ; - f_Z_t_Product :> (t_Product f_Z) ; - f_Z_t_Mul :> (t_Mul f_Z) ; - f_Z_t_Serialize :> (t_Serialize f_Z) ; - f_Z_t_Deserial :> (t_Deserial f_Z) ; - f_Z_t_Serial :> (t_Serial f_Z) ; - f_Z_t_Clone :> (t_Clone f_Z) ; - f_Z_t_Eq :> (t_Eq f_Z) ; - f_Z_t_PartialEq :> (t_PartialEq f_Z) ; - f_Z_t_Copy :> (t_Copy f_Z) ; - f_Z_t_Sized :> (t_Sized f_Z) ; - f_g : (both v_Self) ; - f_g_pow : (both f_Z -> both v_Self) ; - f_pow : (both v_Self -> both f_Z -> both v_Self) ; - f_group_one : (both v_Self) ; - f_group_inv : (both v_Self -> both v_Self) ; - f_hash : (both (t_Vec v_Self t_Global) -> both f_Z) ; -}. +Class t_Group `{v_Self : choice_type} : Type := + { + Group_f_Z : choice_type; + Hi0 : t_Field (Group_f_Z); + _ : _.(Neg_f_Output) = Group_f_Z; + Hi1 : t_Neg (Group_f_Z); + _ : _.(Add_f_Output) = Group_f_Z; + Hi2 : t_Add (Group_f_Z) (Group_f_Z); + Hi3 : t_Product (Group_f_Z) (Group_f_Z); + _ : _.(Mul_f_Output) = Group_f_Z; + Hi4 : t_Mul (Group_f_Z) (Group_f_Z); + Hi5 : t_Serialize (Group_f_Z); + Hi6 : t_Deserial (Group_f_Z); + Hi7 : t_Serial (Group_f_Z); + Hi8 : t_Clone (Group_f_Z); + Hi9 : t_Eq (Group_f_Z); + Hi10 : t_PartialEq (Group_f_Z) (Group_f_Z); + Hi11 : t_Copy (Group_f_Z); + Hi12 : t_Sized (Group_f_Z); + Group_f_g : unit -> v_Self; + Group_f_g_pow : Group_f_Z -> v_Self; + Group_f_pow : v_Self -> Group_f_Z -> v_Self; + Group_f_group_one : unit -> v_Self; + Group_f_group_inv : v_Self -> v_Self; + Group_f_hash : t_Vec ((v_Self)) ((t_Global)) -> Group_f_Z; + H11581440318597584651 : t_Copy (v_Self); + H12632649257025169145 : t_PartialEq (v_Self) (v_Self); + H8099741844003281729 : t_Eq (v_Self); + H9442900250278684536 : t_Clone (v_Self); + H17605656595743636193 : t_Serialize (v_Self); + H12091683018502772129 : t_Mul (v_Self) (v_Self); + _.(Mul_f_Output) = v_Self; + H8449417958832886617 : t_Product (v_Self) (v_Self); + }.. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.vo b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_traits.vo new file mode 100644 index 0000000000000000000000000000000000000000..de8e715a3b44a61e320e224cfd5ee88dc8b9a108 GIT binary patch literal 116347 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 - ret_both (x : int8)) : both int8. -Fail Next Obligation. -Equations Build_t_g_z_89_ {f_g_val : both int8} : both (t_g_z_89_) := - Build_t_g_z_89_ := - bind_both f_g_val (fun f_g_val => - ret_both ((f_g_val) : (t_g_z_89_))) : both (t_g_z_89_). -Fail Next Obligation. -Notation "'Build_t_g_z_89_' '[' x ']' '(' 'f_g_val' ':=' y ')'" := (Build_t_g_z_89_ (f_g_val := y)). + t_u8.Definition Build_t_g_z_89_ : t_g_z_89_ := + g_z_89__f_g_val. +Definition g_z_89__f_g_val (x : t_g_z_89_) : t_u8 := + x. +#[export] Instance settable_t_g_z_89_ : Settable _ := + settable! (@Build_t_g_z_89_) . Definition t_z_89_ : choice_type := - (int8). -Equations f_z_val (s : both t_z_89_) : both int8 := - f_z_val s := - bind_both s (fun x => - ret_both (x : int8)) : both int8. -Fail Next Obligation. -Equations Build_t_z_89_ {f_z_val : both int8} : both (t_z_89_) := - Build_t_z_89_ := - bind_both f_z_val (fun f_z_val => - ret_both ((f_z_val) : (t_z_89_))) : both (t_z_89_). -Fail Next Obligation. -Notation "'Build_t_z_89_' '[' x ']' '(' 'f_z_val' ':=' y ')'" := (Build_t_z_89_ (f_z_val := y)). + t_u8.Definition Build_t_z_89_ : t_z_89_ := + z_89__f_z_val. +Definition z_89__f_z_val (x : t_z_89_) : t_u8 := + x. +#[export] Instance settable_t_z_89_ : Settable _ := + settable! (@Build_t_z_89_) . -#[global] Program Instance t_z_89__t_Product : t_Product t_z_89_ t_z_89_ := - let f_product := fun (iter : both v_I) => f_fold iter (Build_t_C_z_89_ (f_z_val := ret_both (1 : int8))) (fun a => fun b => - a .* b) : both t_z_89_ in - {| f_product := (@f_product)|}. -Fail Next Obligation. -Hint Unfold t_z_89__t_Product. +Instance t_Product_516576874 : t_Product ((t_z_89_)) ((t_z_89_)) := + { + t_Product_impl_1_f_product := fun (iter : v_I) => + Iterator_f_fold (iter) (Build_t_C_z_89_ (1)) (fun a b => + Mul_f_mul (a) (b)); + }. -#[global] Program Instance t_g_z_89__t_Product : t_Product t_g_z_89_ t_g_z_89_ := - let f_product := fun (iter : both v_I) => f_fold iter (Build_t_C_g_z_89_ (f_g_val := ret_both (1 : int8))) (fun a => fun b => - a .* b) : both t_g_z_89_ in - {| f_product := (@f_product)|}. -Fail Next Obligation. -Hint Unfold t_g_z_89__t_Product. +Instance t_Product_550947082 : t_Product ((t_g_z_89_)) ((t_g_z_89_)) := + { + t_Product_impl_6_f_product := fun (iter : v_I) => + Iterator_f_fold (iter) (Build_t_C_g_z_89_ (1)) (fun a b => + Mul_f_mul (a) (b)); + }. -#[global] Program Instance t_z_89__t_Mul : t_Mul t_z_89_ t_z_89_ := - let f_Output := t_z_89_ : choice_type in - let f_mul := fun (self : both t_z_89_) (y : both t_z_89_) => letb q___ := (f_z_val f_q) .- (ret_both (1 : int8)) in - letb (x___ : int16) := cast_int (WS2 := _) ((f_z_val self) .% q___) in - letb (y___ : int16) := cast_int (WS2 := _) ((f_z_val y) .% q___) in - Build_t_C_z_89_ (f_z_val := cast_int (WS2 := _) ((x___ .* y___) .% (cast_int (WS2 := _) q___))) : both t_z_89_ in - {| f_Output := (@f_Output); - f_mul := (@f_mul)|}. -Fail Next Obligation. -Hint Unfold t_z_89__t_Mul. +Instance t_Mul_1006909152 : t_Mul ((t_z_89_)) ((t_z_89_)) := + { + t_Mul_impl_f_Output := t_z_89_; + t_Mul_impl_f_mul := fun (self : t_z_89_) (y : t_z_89_) => + let q___ := sub (z_89__f_z_val Field_f_q (tt)) (1) in + let x___ : t_u16 := cast (t_Rem_f_rem (z_89__f_z_val self) (q___)) in + let y___ : t_u16 := cast (t_Rem_f_rem (z_89__f_z_val y) (q___)) in + Build_t_C_z_89_ (cast (t_Rem_f_rem (t_Mul_f_mul (x___) (y___)) (cast (q___)))); + }. -#[global] Program Instance t_z_89__t_Add : t_Add t_z_89_ t_z_89_ := - let f_Output := t_z_89_ : choice_type in - let f_add := fun (self : both t_z_89_) (y : both t_z_89_) => letb q___ := (f_z_val f_q) .- (ret_both (1 : int8)) in - letb x___ := (f_z_val self) .% q___ in - letb y___ := (f_z_val y) .% q___ in - Build_t_C_z_89_ (f_z_val := (x___ .+ y___) .% q___) : both t_z_89_ in - {| f_Output := (@f_Output); - f_add := (@f_add)|}. -Fail Next Obligation. -Hint Unfold t_z_89__t_Add. +Instance t_Add_753400148 : t_Add ((t_z_89_)) ((t_z_89_)) := + { + t_Add_impl_2_f_Output := t_z_89_; + t_Add_impl_2_f_add := fun (self : t_z_89_) (y : t_z_89_) => + let q___ := sub (z_89__f_z_val Field_f_q (tt)) (1) in + let x___ := t_Rem_f_rem (z_89__f_z_val self) (q___) in + let y___ := t_Rem_f_rem (z_89__f_z_val y) (q___) in + Build_t_C_z_89_ (t_Rem_f_rem (t_Add_f_add (x___) (y___)) (q___)); + }. -#[global] Program Instance t_z_89__t_Neg : t_Neg t_z_89_ := - let f_Output := t_z_89_ : choice_type in - let f_neg := fun (self : both t_z_89_) => letb q___ := (f_z_val f_q) .- (ret_both (1 : int8)) in - letb x___ := (f_z_val self) .% q___ in - Build_t_C_z_89_ (f_z_val := q___ .- x___) : both t_z_89_ in - {| f_Output := (@f_Output); - f_neg := (@f_neg)|}. -Fail Next Obligation. -Hint Unfold t_z_89__t_Neg. +Instance t_Neg_486327576 : t_Neg ((t_z_89_)) := + { + t_Neg_impl_3_f_Output := t_z_89_; + t_Neg_impl_3_f_neg := fun (self : t_z_89_) => + let q___ := sub (z_89__f_z_val Field_f_q (tt)) (1) in + let x___ := t_Rem_f_rem (z_89__f_z_val self) (q___) in + Build_t_C_z_89_ (sub (q___) (x___)); + }. -#[global] Program Instance t_z_89__t_Field : t_Field t_z_89_ := - let f_q := fun (_ : both 'unit) => Build_t_C_z_89_ (f_z_val := ret_both (89 : int8)) : both t_z_89_ in - let f_random_field_elem := fun (random : both int32) => Build_t_C_z_89_ (f_z_val := (cast_int (WS2 := _) random) .% ((f_z_val f_q) .- (ret_both (1 : int8)))) : both t_z_89_ in - let f_field_zero := fun (_ : both 'unit) => Build_t_C_z_89_ (f_z_val := ret_both (0 : int8)) : both t_z_89_ in - let f_field_one := fun (_ : both 'unit) => Build_t_C_z_89_ (f_z_val := ret_both (1 : int8)) : both t_z_89_ in - let f_inv := fun (x : both t_z_89_) => run (letb _ := assert (ret_both (false : 'bool)) in - letm[choice_typeMonad.result_bind_code t_z_89_] hoist30 := ControlFlow_Break x in - ControlFlow_Continue (never_to_any hoist30)) : both t_z_89_ in - {| f_q := (@f_q); - f_random_field_elem := (@f_random_field_elem); - f_field_zero := (@f_field_zero); - f_field_one := (@f_field_one); - f_inv := (@f_inv)|}. -Fail Next Obligation. -Hint Unfold t_z_89__t_Field. +Instance t_Field_519153209 : t_Field ((t_z_89_)) := + { + t_Field_impl_4_f_q := fun (_ : unit) => + Build_t_C_z_89_ (89); + t_Field_impl_4_f_random_field_elem := fun (random : t_u32) => + Build_t_C_z_89_ (t_Rem_f_rem (cast (random)) (sub (z_89__f_z_val Field_f_q (tt)) (1))); + t_Field_impl_4_f_field_zero := fun (_ : unit) => + Build_t_C_z_89_ (0); + t_Field_impl_4_f_field_one := fun (_ : unit) => + Build_t_C_z_89_ (1); + t_Field_impl_4_f_inv := fun (x : t_z_89_) => + run (let _ := assert (false) in + let hoist30 := ControlFlow_Break (x) in + ControlFlow_Continue (never_to_any (hoist30))); + }. -#[global] Program Instance t_g_z_89__t_Mul : t_Mul t_g_z_89_ t_g_z_89_ := - let f_Output := t_g_z_89_ : choice_type in - let f_mul := fun (self : both t_g_z_89_) (y : both t_g_z_89_) => letb q___ := f_z_val f_q in - letb x___ := cast_int (WS2 := _) ((f_g_val self) .% q___) in - letb y___ := cast_int (WS2 := _) ((f_g_val y) .% q___) in - Build_t_C_g_z_89_ (f_g_val := cast_int (WS2 := _) ((x___ .* y___) .% (cast_int (WS2 := _) q___))) : both t_g_z_89_ in - {| f_Output := (@f_Output); - f_mul := (@f_mul)|}. -Fail Next Obligation. -Hint Unfold t_g_z_89__t_Mul. +Instance t_Mul_509828028 : t_Mul ((t_g_z_89_)) ((t_g_z_89_)) := + { + t_Mul_impl_5_f_Output := t_g_z_89_; + t_Mul_impl_5_f_mul := fun (self : t_g_z_89_) (y : t_g_z_89_) => + let q___ := z_89__f_z_val Field_f_q (tt) in + let x___ := cast (t_Rem_f_rem (g_z_89__f_g_val self) (q___)) in + let y___ := cast (t_Rem_f_rem (g_z_89__f_g_val y) (q___)) in + Build_t_C_g_z_89_ (cast (t_Rem_f_rem (t_Mul_f_mul (x___) (y___)) (cast (q___)))); + }. -#[global] Program Instance t_g_z_89__t_Group : t_Group t_g_z_89_ := - let f_Z := t_z_89_ : choice_type in - let f_g := fun (_ : both 'unit) => Build_t_C_g_z_89_ (f_g_val := ret_both (3 : int8)) : both t_g_z_89_ in - let f_hash := fun (x : both (t_Vec t_g_z_89_ t_Global)) => letb res := f_field_one in - letb res := foldi_both_list (f_into_iter x) (fun y => - ssp (fun res => - (Build_t_C_z_89_ (f_z_val := f_g_val y)) .* res : (both t_z_89_))) res in - res : both t_z_89_ in - let f_g_pow := fun (x : both t_z_89_) => f_pow f_g x : both t_g_z_89_ in - let f_pow := fun (g : both t_g_z_89_) (x : both t_z_89_) => letb result := f_group_one in - letb result := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int8)) (f_end := (f_z_val x) .% ((f_z_val f_q) .- (ret_both (1 : int8)))))) (fun _ => - ssp (fun result => - result .* g : (both t_g_z_89_))) result in - result : both t_g_z_89_ in - let f_group_one := fun (_ : both 'unit) => Build_t_C_g_z_89_ (f_g_val := ret_both (1 : int8)) : both t_g_z_89_ in - let f_group_inv := fun (x : both t_g_z_89_) => run (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int8)) (f_end := ret_both (89 : int8)))) (fun j => - ssp (fun _ => - letb g_value := Build_t_C_g_z_89_ (f_g_val := j) in - ifb (x .* g_value) =.? f_group_one - then letm[choice_typeMonad.result_bind_code t_g_z_89_] hoist31 := ControlFlow_Break g_value in - ControlFlow_Continue (never_to_any hoist31) - else ControlFlow_Continue (ret_both (tt : 'unit)) : (both (t_ControlFlow t_g_z_89_ 'unit)))) (ret_both (tt : 'unit)) in - letb _ := assert (ret_both (false : 'bool)) in - letm[choice_typeMonad.result_bind_code t_g_z_89_] hoist32 := ControlFlow_Break x in - ControlFlow_Continue (never_to_any hoist32)) : both t_g_z_89_ in - {| f_Z := (@f_Z); - f_g := (@f_g); - f_hash := (@f_hash); - f_g_pow := (@f_g_pow); - f_pow := (@f_pow); - f_group_one := (@f_group_one); - f_group_inv := (@f_group_inv)|}. -Fail Next Obligation. -Hint Unfold t_g_z_89__t_Group. +Instance t_Group_794386426 : t_Group ((t_g_z_89_)) := + { + t_Group_impl_7_f_Z := t_z_89_; + t_Group_impl_7_f_g := fun (_ : unit) => + Build_t_C_g_z_89_ (3); + t_Group_impl_7_f_hash := fun (x : t_Vec ((t_g_z_89_)) ((t_Global))) => + let res := Field_f_field_one (tt) in + let _ := {IntoIterator_f_into_iter (x)} inP? [y] [is_none]default of ( + TODO: please implement the method `lhs_LhsLocalVar` := Mul_f_mul (Build_t_C_z_89_ (g_z_89__f_g_val y)) (res)) in + res; + t_Group_impl_7_f_g_pow := fun (x : t_z_89_) => + Group_f_pow (Group_f_g (tt)) (x); + t_Group_impl_7_f_pow := fun (g : t_g_z_89_) (x : t_z_89_) => + let result := Group_f_group_one (tt) in + let _ := {IntoIterator_f_into_iter (Build_t_Range (0, t_Rem_f_rem (z_89__f_z_val x) (sub (z_89__f_z_val Field_f_q (tt)) (1))))} inP? [_] [is_none]default of ( + TODO: please implement the method `lhs_LhsLocalVar` := Mul_f_mul (result) (g)) in + result; + t_Group_impl_7_f_group_one := fun (_ : unit) => + Build_t_C_g_z_89_ (1); + t_Group_impl_7_f_group_inv := fun (x : t_g_z_89_) => + run (let _ := {IntoIterator_f_into_iter (Build_t_Range (0, 89))} inP? [j] [is_none]default of ( + let g_value := Build_t_C_g_z_89_ (j) in + if + PartialEq_f_eq (Mul_f_mul (x) (g_value)) (Group_f_group_one (tt)) + then + let hoist31 := ControlFlow_Break (g_value) in + ControlFlow_Continue (never_to_any (hoist31)) + else + tt) in + let _ := assert (false) in + let hoist32 := ControlFlow_Break (x) in + ControlFlow_Continue (never_to_any (hoist32))); + }. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_zkgroup.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_zkgroup.v deleted file mode 100644 index 29734bf..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_zkgroup.v +++ /dev/null @@ -1,73 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Crypt Require Import jasmin_word. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Group. -Export Group. - -Require Import Group_Ff. -Export Group_Ff. - -Require Import Field. -Export Field. - -Require Import PrimeField. -Export PrimeField. - -Require Import Group. -Export Group. - -Class t_MGroup (Self : choice_type) := { - f_hash_loc : {fset Location} ; - f_hash : (forall {L1 I1}, both L1 I1 (t_Vec v_Self t_Global) -> both (L1 :|: f_hash_loc) I1 f_Scalar) ; -}. -Hint Unfold f_hash_loc : hacspec_hints. - -Definition t_SchnorrZKPCommit {v_G : _} `{ t_Sized v_G} `{ t_MGroup v_G} : choice_type := - (v_G × f_Scalar × f_Scalar). -Equations f_schnorr_zkp_u {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_MGroup v_G} (s : both L I t_SchnorrZKPCommit) : both L I v_G := - f_schnorr_zkp_u s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : v_G))) : both L I v_G. -Fail Next Obligation. -Equations f_schnorr_zkp_c {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_MGroup v_G} (s : both L I t_SchnorrZKPCommit) : both L I f_Scalar := - f_schnorr_zkp_c s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_Scalar))) : both L I f_Scalar. -Fail Next Obligation. -Equations f_schnorr_zkp_z {L : {fset Location}} {I : Interface} {v_G : _} `{ t_Sized v_G} `{ t_MGroup v_G} (s : both L I t_SchnorrZKPCommit) : both L I f_Scalar := - f_schnorr_zkp_z s := - bind_both s (fun x => - solve_lift (ret_both (snd x : f_Scalar))) : both L I f_Scalar. -Fail Next Obligation. -Equations Build_t_SchnorrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_G : _} `{ t_Sized v_G} `{ t_MGroup v_G} {f_schnorr_zkp_u : both L0 I0 v_G} {f_schnorr_zkp_c : both L1 I1 f_Scalar} {f_schnorr_zkp_z : both L2 I2 f_Scalar} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit) := - Build_t_SchnorrZKPCommit := - bind_both f_schnorr_zkp_z (fun f_schnorr_zkp_z => - bind_both f_schnorr_zkp_c (fun f_schnorr_zkp_c => - bind_both f_schnorr_zkp_u (fun f_schnorr_zkp_u => - solve_lift (ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit). -Fail Next Obligation. -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := y) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := y) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := y)). diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_zkgroup_specific.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_zkgroup_specific.v deleted file mode 100644 index 9012414..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_Ovn_zkgroup_specific.v +++ /dev/null @@ -1,110 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Crypt Require Import jasmin_word. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Group. -Export Group. - -Require Import Group_Ff. -Export Group_Ff. - -Require Import Field. -Export Field. - -Require Import Group. -Export Group. - -Require Import Gt. -Export Gt. - -Require Import PhantomData. -Export PhantomData. - -Notation "'t_G'" := t_Gt. - -(*item error backend*) - -Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 t_Scalar) (vote : both L2 I2 'bool) (g_pow_yi : both L3 I3 t_Gt) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) t_Gt := - compute_group_element_for_vote xi vote g_pow_yi := - solve_lift ((g_pow_yi .* xi) .+ ((f_generator (ret_both (tt : 'unit))) .* (ifb vote - then f_ONE - else f_ZERO))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) t_Gt. -Fail Next Obligation. - -Equations hash {L1 : {fset Location}} {I1 : Interface} (v__inp : both L1 I1 (t_Vec t_Gt t_Global)) : both L1 I1 t_Scalar := - hash v__inp := - solve_lift (impl__Scalar__one (ret_both (tt : 'unit))) : both L1 I1 t_Scalar. -Fail Next Obligation. - -(*item error backend*) - -(*item error backend*) - -(*item error backend*) - -(*item error backend*) - -(*item error backend*) - -(*item error backend*) - -(*item error backend*) - -(*item error backend*) - -(*item error backend*) - -(*item error backend*) - -(*item error backend*) - -Definition t_TallyParameter : choice_type := - 'unit. -Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := - Build_t_TallyParameter := - solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). -Fail Next Obligation. - -(*item error backend*) - -(*item error backend*) - -(*item error backend*) - -(*item error backend*) - -(*item error backend*) - -(*item error backend*) - -(*item error backend*) - -Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {n : both (fset []) (fset []) uint_size} (_ : both L1 I1 'unit) : both L1 I1 (t_Result (t_OvnContractState (both (fset []) (fset []) uint_size)) t_Reject) := - init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_identity (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_identity (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_ZERO) (f_schnorr_zkp_c := f_ZERO)) n) (f_commit_vis := repeat f_ZERO n) (f_g_pow_xi_yi_vis := repeat (f_identity (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_identity (ret_both (tt : 'unit))) (f_or_zkp_y := f_identity (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_identity (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_identity (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_identity (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_identity (ret_both (tt : 'unit))) (f_or_zkp_c := f_ZERO) (f_or_zkp_d1 := f_ZERO) (f_or_zkp_d2 := f_ZERO) (f_or_zkp_r1 := f_ZERO) (f_or_zkp_r2 := f_ZERO)) n) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState (both (fset []) (fset []) uint_size)) t_Reject). -Fail Next Obligation. - -(*item error backend*) - -(*item error backend*) diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_actual.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_actual.v deleted file mode 100644 index 59ae1dd..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_actual.v +++ /dev/null @@ -1,874 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Crypt Require Import jasmin_word. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -(* Require Import Group. *) -(* Export Group. *) - -(* Require Import Group_Ff. *) -(* Export Group_Ff. *) - -(* Require Import Field. *) -(* Export Field. *) - -(* Require Import Group. *) -(* Export Group. *) - -(* Require Import Gt. *) -(* Export Gt. *) - -(* Require Import PhantomData. *) -(* Export PhantomData. *) - -Axiom rng_core : choice_type. -Axiom t_Choice : choice_type. (* ~ chOption *) - -Class t_Scalar (v_Self : choice_type) := { - t_Scalar_t_Add :> (t_Add v_Self v_Self) ; - t_Scalar_t_Mul :> (t_Mul v_Self v_Self) ; - f_ZERO_loc : {fset Location} ; - f_ZERO : (forall {L1 I1}, both (L1 :|: f_ZERO_loc) I1 v_Self) ; - f_ONE_loc : {fset Location} ; - f_ONE : (forall {L1 I1}, both (L1 :|: f_ONE_loc) I1 v_Self) ; - }. -Hint Unfold f_ZERO_loc : hacspec_hints. -Hint Unfold f_ONE_loc : hacspec_hints. - -Class t_Group (v_Self : choice_type) := { - f_Scalar : choice_type ; - f_Scalar_t_Scalar :> (t_Scalar f_Scalar) ; - f_Scalar_t_Sized :> (t_Sized f_Scalar) ; - t_Group_t_Add :> (t_Add v_Self v_Self) ; - t_Group_t_Mul :> (t_Mul v_Self f_Scalar) ; - f_random_loc : {fset Location} ; - f_random : (forall {L1 I1}, both L1 I1 rng_core -> both (L1 :|: f_random_loc) I1 v_Self) ; - f_identity_loc : {fset Location} ; - f_identity : (forall {L1 I1}, both L1 I1 'unit -> both (L1 :|: f_identity_loc) I1 v_Self) ; - f_generator_loc : {fset Location} ; - f_generator : (forall {L1 I1}, both L1 I1 'unit -> both (L1 :|: f_generator_loc) I1 v_Self) ; - f_is_identity_loc : {fset Location} ; - f_is_identity : (forall {L1 I1}, both L1 I1 v_Self -> both (L1 :|: f_is_identity_loc) I1 t_Choice) ; - f_double_loc : {fset Location} ; - f_double : (forall {L1 I1}, both L1 I1 v_Self -> both (L1 :|: f_double_loc) I1 v_Self) ; -}. -Hint Unfold f_random_loc : hacspec_hints. -Hint Unfold f_identity_loc : hacspec_hints. -Hint Unfold f_generator_loc : hacspec_hints. -Hint Unfold f_is_identity_loc : hacspec_hints. -Hint Unfold f_double_loc : hacspec_hints. - -Axiom t_Gt_Scalar : choice_type. -Axiom t_Gt : choice_type. -Program Instance f_Scalar_t_Add : t_Add t_Gt_Scalar t_Gt_Scalar := { f_Output := t_Gt_Scalar; f_add_loc := fset [] ; }. -Admit Obligations. -Program Instance f_Scalar_t_Mul : t_Mul t_Gt_Scalar t_Gt_Scalar := { f_Output := t_Gt_Scalar; f_mul_loc := fset [] ; }. -Admit Obligations. -Program Instance f_Group_t_Add : t_Add t_Gt t_Gt := { f_Output := t_Gt; f_add_loc := fset [] ; }. -Admit Obligations. -Program Instance f_Group_t_Mul : t_Mul t_Gt t_Gt_Scalar := { f_Output := t_Gt; f_mul_loc := fset [] ; }. -Admit Obligations. -Program Instance t_Scalar_t_Scalar : t_Scalar t_Gt_Scalar := { - f_ZERO_loc := fset [] ; - f_ONE_loc := fset [] ; - t_Scalar_t_Add := f_Scalar_t_Add ; - t_Scalar_t_Mul := f_Scalar_t_Mul ; - }. -Admit Obligations. -Program Instance t_Gt_Group : t_Group t_Gt := { - f_Scalar := t_Gt_Scalar ; - f_Scalar_t_Scalar := t_Scalar_t_Scalar ; - t_Group_t_Add := f_Group_t_Add ; - t_Group_t_Mul := f_Group_t_Mul ; - f_random_loc := fset [] ; - f_identity_loc := fset [] ; - f_generator_loc := fset [] ; - f_is_identity_loc := fset [] ; - f_double_loc := fset [] ; - }. -Admit Obligations. -Notation "'t_G'" := t_Gt. - -Notation "'t_Z'" := (f_Scalar (t_Group := t_Gt_Group)). - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) -Check (f_add (t_Add := t_Group_t_Add (t_Group := t_Gt_Group)) _ _) : both _ _ t_Gt. -Check (f_mul (t_Mul := t_Group_t_Mul (t_Group := t_Gt_Group)) (_ : both _ _ t_Gt) (_ : both _ _ t_Gt_Scalar)) : both _ _ t_Gt. -Check ((_ : both _ _ int32) .+ _) : both _ _ int32. -Check ((_ : both _ _ t_Gt) .+ _) : both _ _ t_Gt. -Check ((_ : both _ _ t_Gt) .* (_ : both _ _ t_Gt_Scalar) : both _ _ t_Gt) .+ _ : both _ _ t_Gt. -Check (ret_both 1 :of0: int32) .+ (ret_both 4 :of0: int32) : both _ _ int32. - -Ltac solve_ssprove_obligations := - repeat ( - intros ; autounfold with hacspec_hints ; autounfold ; normalize_fset ; - solve [solve_match || now (apply fsubsetxx || apply fsub0set) - | solve_in_mem (* TODO: add match goal *) - | fset_equality (* TODO: add match goal *) - | solve_in_fset (* TODO: add match goal *) - | ssprove_valid'_2 ; (Tactics.program_simpl; fail)]). - -Obligation Tactic := simpl ; solve_ssprove_obligations. - -Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (xi : both L1 I1 (f_Scalar (t_Group := t_Gt_Group))) (vote : both L2 I2 'bool) (g_pow_yi : both L3 I3 t_Gt) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) t_Gt := - compute_group_element_for_vote xi vote g_pow_yi := - solve_lift ( - ((g_pow_yi .* xi : both _ _ t_Gt) - .+ - ( - (f_generator (ret_both (tt : 'unit)) : both _ _ t_Gt) .* - (ifb vote - then f_ONE - else f_ZERO : both _ _ t_Gt_Scalar) : both _ _ t_Gt)) : both _ _ t_Gt) : - both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) t_Gt. -Fail Next Obligation. - -Obligation Tactic := solve_ssprove_obligations. - - -Equations hash {L1 : {fset Location}} {I1 : Interface} (v__inp : both L1 I1 (t_Vec t_Gt t_Global)) : both L1 I1 (f_Scalar) := - hash v__inp := - solve_lift (f_ONE) : both L1 I1 f_Scalar. -Fail Next Obligation. - -Definition prod1_loc {n : both (fset []) (fset []) uint_size} : Location := - (t_Gt;0%nat). -Definition prod2_loc {n : both (fset []) (fset []) uint_size} : Location := - (t_Gt;1%nat). -Equations compute_g_pow_yi {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {n : both (fset []) (fset []) uint_size} (i : both L1 I1 uint_size) (xis : both L2 I2 (nseq t_Gt (is_pure (n)))) : both (L1 :|: L2 :|: fset [prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) t_Gt := - compute_g_pow_yi i xis := - letb prod1 loc(prod1_loc) := f_identity (ret_both (tt : 'unit)) in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => - ssp (fun _ => - assignb _ loc( prod1_loc ) := _ ; : (both (*1*)(L2:|:L1:|:fset [prod1_loc]) (I2:|:I1) 'unit))) (ret_both (tt : 'unit)) in - letb prod2 loc(prod2_loc) := f_identity (ret_both (tt : 'unit)) in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => - ssp (fun _ => - assignb _ loc( prod2_loc ) := _ ; : (both (*1*)(L2:|:L1:|:fset [prod2_loc]) (I2:|:I1) 'unit))) (ret_both (tt : 'unit)) in - solve_lift (prod1 .- prod2) : both (L1 :|: L2 :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2) t_Gt. -Fail Next Obligation. - -Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g_pow_xi_yi_vi : both L1 I1 t_Gt) (commitment : both L2 I2 t_Scalar) : both (L1 :|: L2) (I1 :|: I2) 'bool := - check_commitment g_pow_xi_yi_vi commitment := - solve_lift ((hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both (L1 :|: L2) (I1 :|: I2) 'bool. -Fail Next Obligation. - -Equations commit_to {L1 : {fset Location}} {I1 : Interface} (g_pow_xi_yi_vi : both L1 I1 t_Gt) : both L1 I1 t_Scalar := - commit_to g_pow_xi_yi_vi := - solve_lift (hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both L1 I1 t_Scalar. -Fail Next Obligation. - -Definition t_CastVoteParam {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} : choice_type := - (int32 × f_Scalar × f_Scalar × f_Scalar × f_Scalar × 'bool × t_PhantomData v_S). -Equations f_cvp_i {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_CastVoteParam) : both L I int32 := - f_cvp_i s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst (fst x))))) : int32))) : both L I int32. -Fail Next Obligation. -Equations f_cvp_xi {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_CastVoteParam) : both L I f_Scalar := - f_cvp_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : f_Scalar))) : both L I f_Scalar. -Fail Next Obligation. -Equations f_cvp_zkp_random_w {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_CastVoteParam) : both L I f_Scalar := - f_cvp_zkp_random_w s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_Scalar))) : both L I f_Scalar. -Fail Next Obligation. -Equations f_cvp_zkp_random_r {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_CastVoteParam) : both L I f_Scalar := - f_cvp_zkp_random_r s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : f_Scalar))) : both L I f_Scalar. -Fail Next Obligation. -Equations f_cvp_zkp_random_d {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_CastVoteParam) : both L I f_Scalar := - f_cvp_zkp_random_d s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : f_Scalar))) : both L I f_Scalar. -Fail Next Obligation. -Equations f_cvp_vote {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_CastVoteParam) : both L I 'bool := - f_cvp_vote s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : 'bool))) : both L I 'bool. -Fail Next Obligation. -Equations f_phantom {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_CastVoteParam) : both L I (t_PhantomData v_S) := - f_phantom s := - bind_both s (fun x => - solve_lift (ret_both (snd x : (t_PhantomData v_S)))) : both L I (t_PhantomData v_S). -Fail Next Obligation. -Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} {f_cvp_i : both L0 I0 int32} {f_cvp_xi : both L1 I1 f_Scalar} {f_cvp_zkp_random_w : both L2 I2 f_Scalar} {f_cvp_zkp_random_r : both L3 I3 f_Scalar} {f_cvp_zkp_random_d : both L4 I4 f_Scalar} {f_cvp_vote : both L5 I5 'bool} {f_phantom : both L6 I6 (t_PhantomData v_S)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6) (t_CastVoteParam) := - Build_t_CastVoteParam := - bind_both f_phantom (fun f_phantom => - bind_both f_cvp_vote (fun f_cvp_vote => - bind_both f_cvp_zkp_random_d (fun f_cvp_zkp_random_d => - bind_both f_cvp_zkp_random_r (fun f_cvp_zkp_random_r => - bind_both f_cvp_zkp_random_w (fun f_cvp_zkp_random_w => - bind_both f_cvp_xi (fun f_cvp_xi => - bind_both f_cvp_i (fun f_cvp_i => - solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote,f_phantom) : (t_CastVoteParam)))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6) (t_CastVoteParam). -Fail Next Obligation. -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x) (f_phantom := f_phantom x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x) (f_phantom := f_phantom x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_w' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := y) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x) (f_phantom := f_phantom x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_r' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := y) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x) (f_phantom := f_phantom x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_d' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := y) (f_cvp_vote := f_cvp_vote x) (f_phantom := f_phantom x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := y) (f_phantom := f_phantom x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_phantom' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x) (f_phantom := y)). - -#[global] Program Instance t_CastVoteParam v_S_t_Serial {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} : t_Serial (t_CastVoteParam v_S) := - let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_CastVoteParam v_S)) (w : both L2 I2 v_W) => solve_lift (run (letb '(tmp0,out) := f_serial (f_cvp_i self) w in - letb _ := assign todo(term) in - letb hoist2 := out in - letb hoist3 := f_branch hoist2 in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist3 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist1 := ControlFlow_Break (prod_b (w,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist1)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : ('unit)) in - ControlFlow_Continue (solve_lift val) - end in - letb '(tmp0,out) := f_serial (f_from (f_cvp_xi self)) w in - letb _ := assign todo(term) in - letb hoist5 := out in - letb hoist6 := f_branch hoist5 in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist6 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist4 := ControlFlow_Break (prod_b (w,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist4)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : ('unit)) in - ControlFlow_Continue (solve_lift val) - end in - letb '(tmp0,out) := f_serial (f_from (f_cvp_zkp_random_w self)) w in - letb _ := assign todo(term) in - letb hoist8 := out in - letb hoist9 := f_branch hoist8 in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist9 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist7 := ControlFlow_Break (prod_b (w,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist7)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : ('unit)) in - ControlFlow_Continue (solve_lift val) - end in - letb '(tmp0,out) := f_serial (f_from (f_cvp_zkp_random_r self)) w in - letb _ := assign todo(term) in - letb hoist11 := out in - letb hoist12 := f_branch hoist11 in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist12 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist10 := ControlFlow_Break (prod_b (w,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist10)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : ('unit)) in - ControlFlow_Continue (solve_lift val) - end in - letb '(tmp0,out) := f_serial (f_from (f_cvp_zkp_random_d self)) w in - letb _ := assign todo(term) in - letb hoist14 := out in - letb hoist15 := f_branch hoist14 in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist15 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist13 := ControlFlow_Break (prod_b (w,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist13)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : ('unit)) in - ControlFlow_Continue (solve_lift val) - end in - letb '(tmp0,out) := f_serial (f_cvp_vote self) w in - letb _ := assign todo(term) in - letb hoist17 := out in - letb hoist18 := f_branch hoist17 in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist18 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist16 := ControlFlow_Break (prod_b (w,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist16)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : ('unit)) in - ControlFlow_Continue (solve_lift val) - end in - ControlFlow_Continue (letb hax_temp_output := Result_Ok (ret_both (tt : 'unit)) in - prod_b (w,hax_temp_output)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (v_W × t_Result 'unit f_Err) in - {| f_serial_loc := (fset [] : {fset Location}); - f_serial := (@f_serial)|}. -Fail Next Obligation. -Hint Unfold t_CastVoteParam v_S_t_Serial. - -#[global] Program Instance t_CastVoteParam v_S_t_Deserial {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} : t_Deserial (t_CastVoteParam v_S) := - let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (r : both L1 I1 v_R) => solve_lift (run (letb '(tmp0,out) := f_get r in - letb _ := assign todo(term) in - letb hoist20 := out in - letb hoist21 := f_branch hoist20 in - letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] (cvp_i : both _ _ int32) := matchb hoist21 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in - letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist19 := ControlFlow_Break (prod_b (r,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist19)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (int32)) in - ControlFlow_Continue (solve_lift val) - end in - letb '(tmp0,out) := f_get r in - letb _ := assign todo(term) in - letb hoist23 := out in - letb hoist24 := f_branch hoist23 in - letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist25 := matchb hoist24 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in - letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist22 := ControlFlow_Break (prod_b (r,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist22)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (v_S)) in - ControlFlow_Continue (solve_lift val) - end in - letb (cvp_xi : both _ _ t_Scalar) := f_into hoist25 in - letb '(tmp0,out) := f_get r in - letb _ := assign todo(term) in - letb hoist27 := out in - letb hoist28 := f_branch hoist27 in - letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist29 := matchb hoist28 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in - letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist26 := ControlFlow_Break (prod_b (r,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist26)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (v_S)) in - ControlFlow_Continue (solve_lift val) - end in - letb (cvp_zkp_random_w : both _ _ t_Scalar) := f_into hoist29 in - letb '(tmp0,out) := f_get r in - letb _ := assign todo(term) in - letb hoist31 := out in - letb hoist32 := f_branch hoist31 in - letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist33 := matchb hoist32 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in - letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist30 := ControlFlow_Break (prod_b (r,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist30)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (v_S)) in - ControlFlow_Continue (solve_lift val) - end in - letb (cvp_zkp_random_r : both _ _ t_Scalar) := f_into hoist33 in - letb '(tmp0,out) := f_get r in - letb _ := assign todo(term) in - letb hoist35 := out in - letb hoist36 := f_branch hoist35 in - letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist37 := matchb hoist36 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in - letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist34 := ControlFlow_Break (prod_b (r,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist34)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (v_S)) in - ControlFlow_Continue (solve_lift val) - end in - letb (cvp_zkp_random_d : both _ _ t_Scalar) := f_into hoist37 in - letb '(tmp0,out) := f_get r in - letb _ := assign todo(term) in - letb hoist39 := out in - letb hoist40 := f_branch hoist39 in - letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] (cvp_vote : both _ _ 'bool) := matchb hoist40 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in - letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_CastVoteParam v_S) t_ParseError)] hoist38 := ControlFlow_Break (prod_b (r,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist38)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : ('bool)) in - ControlFlow_Continue (solve_lift val) - end in - ControlFlow_Continue (letb hax_temp_output := Result_Ok (Build_t_CastVoteParam (f_cvp_i := cvp_i) (f_cvp_xi := cvp_xi) (f_cvp_zkp_random_w := cvp_zkp_random_w) (f_cvp_zkp_random_r := cvp_zkp_random_r) (f_cvp_zkp_random_d := cvp_zkp_random_d) (f_cvp_vote := cvp_vote) (f_phantom := PhantomData)) in - prod_b (r,hax_temp_output)))) : both (L1 :|: fset []) I1 (v_R × t_Result (t_CastVoteParam v_S) t_ParseError) in - {| f_deserial_loc := (fset [] : {fset Location}); - f_deserial := (@f_deserial)|}. -Fail Next Obligation. -Hint Unfold t_CastVoteParam v_S_t_Deserial. - -Definition t_OrZKPCommit : choice_type := - (t_Gt × t_Gt × t_Gt × t_Gt × t_Gt × t_Gt × f_Scalar × f_Scalar × f_Scalar × f_Scalar × f_Scalar). -Equations f_or_zkp_x {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I t_Gt := - f_or_zkp_x s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : t_Gt))) : both L I t_Gt. -Fail Next Obligation. -Equations f_or_zkp_y {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I t_Gt := - f_or_zkp_y s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : t_Gt))) : both L I t_Gt. -Fail Next Obligation. -Equations f_or_zkp_a1 {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I t_Gt := - f_or_zkp_a1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : t_Gt))) : both L I t_Gt. -Fail Next Obligation. -Equations f_or_zkp_b1 {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I t_Gt := - f_or_zkp_b1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : t_Gt))) : both L I t_Gt. -Fail Next Obligation. -Equations f_or_zkp_a2 {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I t_Gt := - f_or_zkp_a2 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : t_Gt))) : both L I t_Gt. -Fail Next Obligation. -Equations f_or_zkp_b2 {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I t_Gt := - f_or_zkp_b2 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : t_Gt))) : both L I t_Gt. -Fail Next Obligation. -Equations f_or_zkp_c {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I f_Scalar := - f_or_zkp_c s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_Scalar))) : both L I f_Scalar. -Fail Next Obligation. -Equations f_or_zkp_d1 {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I f_Scalar := - f_or_zkp_d1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : f_Scalar))) : both L I f_Scalar. -Fail Next Obligation. -Equations f_or_zkp_d2 {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I f_Scalar := - f_or_zkp_d2 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : f_Scalar))) : both L I f_Scalar. -Fail Next Obligation. -Equations f_or_zkp_r1 {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I f_Scalar := - f_or_zkp_r1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_Scalar))) : both L I f_Scalar. -Fail Next Obligation. -Equations f_or_zkp_r2 {L : {fset Location}} {I : Interface} (s : both L I t_OrZKPCommit) : both L I f_Scalar := - f_or_zkp_r2 s := - bind_both s (fun x => - solve_lift (ret_both (snd x : f_Scalar))) : both L I f_Scalar. -Fail Next Obligation. -Equations Build_t_OrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {L7 : {fset Location}} {L8 : {fset Location}} {L9 : {fset Location}} {L10 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {I7 : Interface} {I8 : Interface} {I9 : Interface} {I10 : Interface} {f_or_zkp_x : both L0 I0 t_Gt} {f_or_zkp_y : both L1 I1 t_Gt} {f_or_zkp_a1 : both L2 I2 t_Gt} {f_or_zkp_b1 : both L3 I3 t_Gt} {f_or_zkp_a2 : both L4 I4 t_Gt} {f_or_zkp_b2 : both L5 I5 t_Gt} {f_or_zkp_c : both L6 I6 f_Scalar} {f_or_zkp_d1 : both L7 I7 f_Scalar} {f_or_zkp_d2 : both L8 I8 f_Scalar} {f_or_zkp_r1 : both L9 I9 f_Scalar} {f_or_zkp_r2 : both L10 I10 f_Scalar} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit) := - Build_t_OrZKPCommit := - bind_both f_or_zkp_r2 (fun f_or_zkp_r2 => - bind_both f_or_zkp_r1 (fun f_or_zkp_r1 => - bind_both f_or_zkp_d2 (fun f_or_zkp_d2 => - bind_both f_or_zkp_d1 (fun f_or_zkp_d1 => - bind_both f_or_zkp_c (fun f_or_zkp_c => - bind_both f_or_zkp_b2 (fun f_or_zkp_b2 => - bind_both f_or_zkp_a2 (fun f_or_zkp_a2 => - bind_both f_or_zkp_b1 (fun f_or_zkp_b1 => - bind_both f_or_zkp_a1 (fun f_or_zkp_a1 => - bind_both f_or_zkp_y (fun f_or_zkp_y => - bind_both f_or_zkp_x (fun f_or_zkp_x => - solve_lift (ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit)))))))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit). -Fail Next Obligation. -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := y) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := y) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := y) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := y) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := y) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := y) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_c' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := y) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := y) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := y) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := y) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := y)). - -Definition t_RegisterParam {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} : choice_type := - (int32 × f_Scalar × f_Scalar × t_PhantomData v_S). -Equations f_rp_i {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_RegisterParam) : both L I int32 := - f_rp_i s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst x)) : int32))) : both L I int32. -Fail Next Obligation. -Equations f_rp_xi {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_RegisterParam) : both L I f_Scalar := - f_rp_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : f_Scalar))) : both L I f_Scalar. -Fail Next Obligation. -Equations f_rp_zkp_random {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_RegisterParam) : both L I f_Scalar := - f_rp_zkp_random s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_Scalar))) : both L I f_Scalar. -Fail Next Obligation. -Equations f_phantom {L : {fset Location}} {I : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} (s : both L I t_RegisterParam) : both L I (t_PhantomData v_S) := - f_phantom s := - bind_both s (fun x => - solve_lift (ret_both (snd x : (t_PhantomData v_S)))) : both L I (t_PhantomData v_S). -Fail Next Obligation. -Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} {f_rp_i : both L0 I0 int32} {f_rp_xi : both L1 I1 f_Scalar} {f_rp_zkp_random : both L2 I2 f_Scalar} {f_phantom : both L3 I3 (t_PhantomData v_S)} : both (L0:|:L1:|:L2:|:L3) (I0:|:I1:|:I2:|:I3) (t_RegisterParam) := - Build_t_RegisterParam := - bind_both f_phantom (fun f_phantom => - bind_both f_rp_zkp_random (fun f_rp_zkp_random => - bind_both f_rp_xi (fun f_rp_xi => - bind_both f_rp_i (fun f_rp_i => - solve_lift (ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random,f_phantom) : (t_RegisterParam))))))) : both (L0:|:L1:|:L2:|:L3) (I0:|:I1:|:I2:|:I3) (t_RegisterParam). -Fail Next Obligation. -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x) (f_phantom := f_phantom x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y) (f_rp_zkp_random := f_rp_zkp_random x) (f_phantom := f_phantom x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := y) (f_phantom := f_phantom x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_phantom' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x) (f_phantom := y)). - -#[global] Program Instance t_RegisterParam v_S_t_Serial {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} : t_Serial (t_RegisterParam v_S) := - let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_RegisterParam v_S)) (w : both L2 I2 v_W) => solve_lift (run (letb '(tmp0,out) := f_serial (f_rp_i self) w in - letb _ := assign todo(term) in - letb hoist42 := out in - letb hoist43 := f_branch hoist42 in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist43 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist41 := ControlFlow_Break (prod_b (w,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist41)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : ('unit)) in - ControlFlow_Continue (solve_lift val) - end in - letb '(tmp0,out) := f_serial (f_from (f_rp_xi self)) w in - letb _ := assign todo(term) in - letb hoist45 := out in - letb hoist46 := f_branch hoist45 in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist46 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist44 := ControlFlow_Break (prod_b (w,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist44)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : ('unit)) in - ControlFlow_Continue (solve_lift val) - end in - letb '(tmp0,out) := f_serial (f_from (f_rp_zkp_random self)) w in - letb _ := assign todo(term) in - letb hoist48 := out in - letb hoist49 := f_branch hoist48 in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] _ := matchb hoist49 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible f_Err)) in - letm[choice_typeMonad.result_bind_code (v_W × t_Result 'unit f_Err)] hoist47 := ControlFlow_Break (prod_b (w,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist47)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : ('unit)) in - ControlFlow_Continue (solve_lift val) - end in - ControlFlow_Continue (letb hax_temp_output := Result_Ok (ret_both (tt : 'unit)) in - prod_b (w,hax_temp_output)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (v_W × t_Result 'unit f_Err) in - {| f_serial_loc := (fset [] : {fset Location}); - f_serial := (@f_serial)|}. -Fail Next Obligation. -Hint Unfold t_RegisterParam v_S_t_Serial. - -#[global] Program Instance t_RegisterParam v_S_t_Deserial {v_S : _} `{ t_Sized v_S} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} : t_Deserial (t_RegisterParam v_S) := - let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (r : both L1 I1 v_R) => solve_lift (run (letb '(tmp0,out) := f_get r in - letb _ := assign todo(term) in - letb hoist51 := out in - letb hoist52 := f_branch hoist51 in - letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_RegisterParam v_S) t_ParseError)] (rp_i : both _ _ int32) := matchb hoist52 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in - letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_RegisterParam v_S) t_ParseError)] hoist50 := ControlFlow_Break (prod_b (r,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist50)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (int32)) in - ControlFlow_Continue (solve_lift val) - end in - letb '(tmp0,out) := f_get r in - letb _ := assign todo(term) in - letb hoist54 := out in - letb hoist55 := f_branch hoist54 in - letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_RegisterParam v_S) t_ParseError)] hoist56 := matchb hoist55 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in - letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_RegisterParam v_S) t_ParseError)] hoist53 := ControlFlow_Break (prod_b (r,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist53)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (v_S)) in - ControlFlow_Continue (solve_lift val) - end in - letb (rp_xi : both _ _ t_Scalar) := f_into hoist56 in - letb '(tmp0,out) := f_get r in - letb _ := assign todo(term) in - letb hoist58 := out in - letb hoist59 := f_branch hoist58 in - letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_RegisterParam v_S) t_ParseError)] hoist60 := matchb hoist59 with - | ControlFlow_Break_case residual => - letb residual := ret_both ((residual) : (t_Result t_Infallible t_ParseError)) in - letm[choice_typeMonad.result_bind_code (v_R × t_Result (t_RegisterParam v_S) t_ParseError)] hoist57 := ControlFlow_Break (prod_b (r,f_from_residual residual)) in - ControlFlow_Continue (solve_lift (never_to_any hoist57)) - | ControlFlow_Continue_case val => - letb val := ret_both ((val) : (v_S)) in - ControlFlow_Continue (solve_lift val) - end in - ControlFlow_Continue (letb (rp_zkp_random : both _ _ t_Scalar) := f_into hoist60 in - letb hax_temp_output := Result_Ok (Build_t_RegisterParam (f_rp_i := rp_i) (f_rp_xi := rp_xi) (f_rp_zkp_random := rp_zkp_random) (f_phantom := PhantomData)) in - prod_b (r,hax_temp_output)))) : both (L1 :|: fset []) I1 (v_R × t_Result (t_RegisterParam v_S) t_ParseError) in - {| f_deserial_loc := (fset [] : {fset Location}); - f_deserial := (@f_deserial)|}. -Fail Next Obligation. -Hint Unfold t_RegisterParam v_S_t_Deserial. - -Definition t_SchnorrZKPCommit : choice_type := - (t_Gt × f_Scalar × f_Scalar). -Equations f_schnorr_zkp_u {L : {fset Location}} {I : Interface} (s : both L I t_SchnorrZKPCommit) : both L I t_Gt := - f_schnorr_zkp_u s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : t_Gt))) : both L I t_Gt. -Fail Next Obligation. -Equations f_schnorr_zkp_c {L : {fset Location}} {I : Interface} (s : both L I t_SchnorrZKPCommit) : both L I f_Scalar := - f_schnorr_zkp_c s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_Scalar))) : both L I f_Scalar. -Fail Next Obligation. -Equations f_schnorr_zkp_z {L : {fset Location}} {I : Interface} (s : both L I t_SchnorrZKPCommit) : both L I f_Scalar := - f_schnorr_zkp_z s := - bind_both s (fun x => - solve_lift (ret_both (snd x : f_Scalar))) : both L I f_Scalar. -Fail Next Obligation. -Equations Build_t_SchnorrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {f_schnorr_zkp_u : both L0 I0 t_Gt} {f_schnorr_zkp_c : both L1 I1 f_Scalar} {f_schnorr_zkp_z : both L2 I2 f_Scalar} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit) := - Build_t_SchnorrZKPCommit := - bind_both f_schnorr_zkp_z (fun f_schnorr_zkp_z => - bind_both f_schnorr_zkp_c (fun f_schnorr_zkp_c => - bind_both f_schnorr_zkp_u (fun f_schnorr_zkp_u => - solve_lift (ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit). -Fail Next Obligation. -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := y) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := y) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := y)). - -Definition t_TallyParameter : choice_type := - 'unit. -Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := - Build_t_TallyParameter := - solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). -Fail Next Obligation. - -Equations schnorr_zkp {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (r : both L1 I1 t_Scalar) (h : both L2 I2 t_Gt) (x : both L3 I3 t_Scalar) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) t_SchnorrZKPCommit := - schnorr_zkp r h x := - solve_lift (run (letb u := (f_generator (ret_both (tt : 'unit))) .* r in - letb c := hash (impl__into_vec (unsize (box_new (array_from_list [f_generator (ret_both (tt : 'unit)); - h; - u])))) in - letb z := r .+ (c .* x) in - letm[choice_typeMonad.result_bind_code t_SchnorrZKPCommit] hoist61 := ControlFlow_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in - ControlFlow_Continue (never_to_any hoist61))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) t_SchnorrZKPCommit. -Fail Next Obligation. - -Equations schnorr_zkp_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (h : both L1 I1 t_Gt) (pi : both L2 I2 t_SchnorrZKPCommit) : both (L1 :|: L2) (I1 :|: I2) 'bool := - schnorr_zkp_validate h pi := - solve_lift (andb ((f_schnorr_zkp_c pi) =.? (hash (impl__into_vec (unsize (box_new (array_from_list [f_generator (ret_both (tt : 'unit)); - h; - f_schnorr_zkp_u pi])))))) (((f_generator (ret_both (tt : 'unit))) .* (f_schnorr_zkp_z pi)) =.? ((f_schnorr_zkp_u pi) .+ (h .* (f_schnorr_zkp_c pi))))) : both (L1 :|: L2) (I1 :|: I2) 'bool. -Fail Next Obligation. - -Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} (w : both L1 I1 t_Scalar) (rand_r : both L2 I2 t_Scalar) (rand_d : both L3 I3 t_Scalar) (h : both L4 I4 t_Gt) (xi : both L5 I5 t_Scalar) (vi : both L6 I6 'bool) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) t_OrZKPCommit := - zkp_one_out_of_two w rand_r rand_d h xi vi := - solve_lift (ifb vi - then letb r1 := rand_r in - letb d1 := rand_d in - letb x := (f_generator (ret_both (tt : 'unit))) .* xi in - letb y := (h .* xi) .+ (f_generator (ret_both (tt : 'unit))) in - letb a1 := ((f_generator (ret_both (tt : 'unit))) .* r1) .+ (x .* d1) in - letb b1 := (h .* r1) .+ (y .* d1) in - letb a2 := (f_generator (ret_both (tt : 'unit))) .* w in - letb b2 := h .* w in - letb c := hash (impl__into_vec (unsize (box_new (array_from_list [x; - y; - a1; - b1; - a2; - b2])))) in - letb d2 := c .- d1 in - letb r2 := w .- (xi .* d2) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2) - else letb r2 := rand_r in - letb d2 := rand_d in - letb x := (f_generator (ret_both (tt : 'unit))) .* xi in - letb y := h .* xi in - letb a1 := (f_generator (ret_both (tt : 'unit))) .* w in - letb b1 := h .* w in - letb a2 := ((f_generator (ret_both (tt : 'unit))) .* r2) .+ (x .* d2) in - letb b2 := (h .* r2) .+ ((y .- (f_generator (ret_both (tt : 'unit)))) .* d2) in - letb c := hash (impl__into_vec (unsize (box_new (array_from_list [x; - y; - a1; - b1; - a2; - b2])))) in - letb d1 := c .- d2 in - letb r1 := w .- (xi .* d1) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) t_OrZKPCommit. -Fail Next Obligation. - -Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (h : both L1 I1 t_Gt) (zkp : both L2 I2 t_OrZKPCommit) : both (L1 :|: L2) (I1 :|: I2) 'bool := - zkp_one_out_of_two_validate h zkp := - letb c := hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; - f_or_zkp_y zkp; - f_or_zkp_a1 zkp; - f_or_zkp_b1 zkp; - f_or_zkp_a2 zkp; - f_or_zkp_b2 zkp])))) in - solve_lift (andb (andb (andb (andb (c =.? ((f_or_zkp_d1 zkp) .+ (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (((f_generator (ret_both (tt : 'unit))) .* (f_or_zkp_r1 zkp)) .+ ((f_or_zkp_x zkp) .* (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? ((h .* (f_or_zkp_r1 zkp)) .+ ((f_or_zkp_y zkp) .* (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (((f_generator (ret_both (tt : 'unit))) .* (f_or_zkp_r2 zkp)) .+ ((f_or_zkp_x zkp) .* (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? ((h .* (f_or_zkp_r2 zkp)) .+ (((f_or_zkp_y zkp) .- (f_generator (ret_both (tt : 'unit)))) .* (f_or_zkp_d2 zkp))))) : both (L1 :|: L2) (I1 :|: I2) 'bool. -Fail Next Obligation. - -Definition t_OvnContractState {n : both (fset []) (fset []) uint_size} : choice_type := - (nseq t_Gt (is_pure (n)) × nseq t_SchnorrZKPCommit (is_pure (n)) × nseq f_Scalar (is_pure (n)) × nseq t_Gt (is_pure (n)) × nseq t_OrZKPCommit (is_pure (n)) × int32). -Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {n : both (fset []) (fset []) uint_size} (s : both L I t_OvnContractState) : both L I (nseq t_Gt (is_pure (n))) := - f_g_pow_xis s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : (nseq t_Gt (is_pure (n)))))) : both L I (nseq t_Gt (is_pure (n))). -Fail Next Obligation. -Equations f_zkp_xis {L : {fset Location}} {I : Interface} {n : both (fset []) (fset []) uint_size} (s : both L I t_OvnContractState) : both L I (nseq t_SchnorrZKPCommit (is_pure (n))) := - f_zkp_xis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : (nseq t_SchnorrZKPCommit (is_pure (n)))))) : both L I (nseq t_SchnorrZKPCommit (is_pure (n))). -Fail Next Obligation. -Equations f_commit_vis {L : {fset Location}} {I : Interface} {n : both (fset []) (fset []) uint_size} (s : both L I t_OvnContractState) : both L I (nseq f_Scalar (is_pure (n))) := - f_commit_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : (nseq f_Scalar (is_pure (n)))))) : both L I (nseq f_Scalar (is_pure (n))). -Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} {n : both (fset []) (fset []) uint_size} (s : both L I t_OvnContractState) : both L I (nseq t_Gt (is_pure (n))) := - f_g_pow_xi_yi_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : (nseq t_Gt (is_pure (n)))))) : both L I (nseq t_Gt (is_pure (n))). -Fail Next Obligation. -Equations f_zkp_vis {L : {fset Location}} {I : Interface} {n : both (fset []) (fset []) uint_size} (s : both L I t_OvnContractState) : both L I (nseq t_OrZKPCommit (is_pure (n))) := - f_zkp_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : (nseq t_OrZKPCommit (is_pure (n)))))) : both L I (nseq t_OrZKPCommit (is_pure (n))). -Fail Next Obligation. -Equations f_tally {L : {fset Location}} {I : Interface} {n : both (fset []) (fset []) uint_size} (s : both L I t_OvnContractState) : both L I int32 := - f_tally s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I int32. -Fail Next Obligation. -Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {n : both (fset []) (fset []) uint_size} {f_g_pow_xis : both L0 I0 (nseq t_Gt (is_pure (n)))} {f_zkp_xis : both L1 I1 (nseq t_SchnorrZKPCommit (is_pure (n)))} {f_commit_vis : both L2 I2 (nseq f_Scalar (is_pure (n)))} {f_g_pow_xi_yi_vis : both L3 I3 (nseq t_Gt (is_pure (n)))} {f_zkp_vis : both L4 I4 (nseq t_OrZKPCommit (is_pure (n)))} {f_tally : both L5 I5 int32} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := - Build_t_OvnContractState := - bind_both f_tally (fun f_tally => - bind_both f_zkp_vis (fun f_zkp_vis => - bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => - bind_both f_commit_vis (fun f_commit_vis => - bind_both f_zkp_xis (fun f_zkp_xis => - bind_both f_g_pow_xis (fun f_g_pow_xis => - solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). -Fail Next Obligation. -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). - -Definition cast_vote_state_ret_loc {v_S : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_S} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := - (t_OvnContractState (both (fset []) (fset []) uint_size);2%nat). -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_S : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_S} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both L1 I1 impl_574521470_) (state : both L2 I2 (t_OvnContractState (both (fset []) (fset []) uint_size))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError) := - cast_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code t_ParseError] (params : both _ _ (t_CastVoteParam v_S)) := out in - Result_Ok (letb g_pow_yi := compute_g_pow_yi (cast (B := uint_size) (f_cvp_i params)) (f_g_pow_xis state) in - letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in - letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in - letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError). -Fail Next Obligation. - -Definition commit_to_vote_state_ret_loc {v_S : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_S} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := - (t_OvnContractState (both (fset []) (fset []) uint_size);3%nat). -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_S : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_S} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both L1 I1 impl_574521470_) (state : both L2 I2 (t_OvnContractState (both (fset []) (fset []) uint_size))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError) := - commit_to_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code t_ParseError] (params : both _ _ (t_CastVoteParam v_S)) := out in - Result_Ok (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => - ssp (fun _ => - solve_lift (ifb not (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError)] hoist62 := ControlFlow_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist62) - else ()) : (both (*0*)(L2:|:fset []) (I2) (t_ControlFlow (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError) 'unit)))) (ret_both (tt : 'unit)) in - letb g_pow_yi := compute_g_pow_yi (cast (B := uint_size) (f_cvp_i params)) (f_g_pow_xis state) in - letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in - letb commit_vi := commit_to g_pow_xi_yi_vi in - letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in - letb _ := assign todo(term) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError). -Fail Next Obligation. - -Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {n : both (fset []) (fset []) uint_size} (_ : both L1 I1 'unit) : both L1 I1 (t_Result (t_OvnContractState (both (fset []) (fset []) uint_size)) t_Reject) := - init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_identity (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_identity (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_ZERO) (f_schnorr_zkp_c := f_ZERO)) n) (f_commit_vis := repeat f_ZERO n) (f_g_pow_xi_yi_vis := repeat (f_identity (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_identity (ret_both (tt : 'unit))) (f_or_zkp_y := f_identity (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_identity (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_identity (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_identity (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_identity (ret_both (tt : 'unit))) (f_or_zkp_c := f_ZERO) (f_or_zkp_d1 := f_ZERO) (f_or_zkp_d2 := f_ZERO) (f_or_zkp_r1 := f_ZERO) (f_or_zkp_r2 := f_ZERO)) n) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState (both (fset []) (fset []) uint_size)) t_Reject). -Fail Next Obligation. - -Definition register_vote_state_ret_loc {v_S : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_S} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := - (t_OvnContractState (both (fset []) (fset []) uint_size);4%nat). -Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_S : _} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_S} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_Serialize v_S} `{ t_From v_S f_Scalar} `{ t_Into v_S f_Scalar} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (ctx : both L1 I1 impl_574521470_) (state : both L2 I2 (t_OvnContractState (both (fset []) (fset []) uint_size))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError) := - register_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code t_ParseError] (params : both _ _ (t_RegisterParam v_S)) := out in - Result_Ok (letb g_pow_xi := (f_generator (ret_both (tt : 'unit))) .* (f_rp_xi params) in - letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in - letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError). -Fail Next Obligation. - -Definition curr_loc {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := - (t_Scalar;5%nat). -Definition tally_loc {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := - (int32;6%nat). -Definition tally_votes_state_ret_loc {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := - (t_OvnContractState (both (fset []) (fset []) uint_size);7%nat). -Definition vote_result_loc {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} : Location := - (t_Gt;8%nat). -Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {n : both (fset []) (fset []) uint_size} {v_A : _} {impl_574521470_ : _} `{ t_Sized v_A} `{ t_Sized impl_574521470_} `{ t_HasActions v_A} `{ t_HasReceiveContext impl_574521470_ 'unit} (_ : both L1 I1 impl_574521470_) (state : both L2 I2 (t_OvnContractState (both (fset []) (fset []) uint_size))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError) := - tally_votes _ state := - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => - ssp (fun _ => - letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in - letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError)] _ := ControlFlow_Continue (ifb not (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError)] hoist63 := ControlFlow_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist63) - else ()) in - solve_lift (ifb not (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError)] hoist64 := ControlFlow_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist64) - else ()) : (both (*2*)(L2:|:fset [prod1_loc;prod2_loc]) (I2) (t_ControlFlow (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError) 'unit)))) (ret_both (tt : 'unit)) in - letb vote_result loc(vote_result_loc) := f_identity (ret_both (tt : 'unit)) in - letb _ := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => - ssp (fun _ => - assign todo(term) : (both (*1*)(L2:|:fset [vote_result_loc]) (I2) 'unit))) (ret_both (tt : 'unit)) in - letb tally loc(tally_loc) := ret_both (0 : int32) in - letb curr loc(curr_loc) := f_ZERO in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast (B := int32) n))) (fun i => - ssp (fun _ => - letb _ := ifb ((f_generator (ret_both (tt : 'unit))) .* curr) =.? vote_result - then letb _ := assign todo(term) in - ret_both (tt : 'unit) - else () in - letb _ := assign todo(term) in - solve_lift (ret_both (tt : 'unit)) : (both (*3*)(fset [curr_loc;tally_loc;vote_result_loc]) ((fset [])) 'unit))) (ret_both (tt : 'unit)) in - letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in - letb _ := assign todo(term) in - Result_Ok (solve_lift (prod_b (f_accept (ret_both (tt : 'unit)),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result (v_A × t_OvnContractState (both (fset []) (fset []) uint_size)) t_ParseError). -Fail Next Obligation. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v deleted file mode 100644 index ee20c3a..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_by_hand.v +++ /dev/null @@ -1,625 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Hacspec_ovn_Ovn_traits. -Export Hacspec_ovn_Ovn_traits. - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (xi : both L1 I1 (f_field_type)) (vote : both L2 I2 ('bool)) (g_pow_yi : both L3 I3 (f_group_type)) : both (L1 :|: L2 :|: L3 :|: (f_pow_loc :|: f_field_zero_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3) (f_group_type) := - compute_group_element_for_vote xi vote g_pow_yi := - solve_lift (f_prod (f_pow g_pow_yi xi) (f_g_pow (ifb vote - then f_field_one (ret_both (tt : 'unit)) - else f_field_zero (ret_both (tt : 'unit))))) : both (L1 :|: L2 :|: L3 :|: (f_pow_loc :|: f_field_zero_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3) (f_group_type). -Fail Next Obligation. - -Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (random : both L1 I1 (int32)) : both (L1 :|: f_random_field_elem_loc) I1 (f_field_type) := - select_private_voting_key random := - solve_lift (f_random_field_elem random) : both (L1 :|: f_random_field_elem_loc) I1 (f_field_type). -Fail Next Obligation. - -Definition prod1_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := - (f_group_type;0%nat). -Definition prod2_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := - (f_group_type;1%nat). -Equations compute_g_pow_yi {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both L1 I1 (uint_size)) (xis : both L2 I2 (nseq f_group_type (is_pure (n)))) : both (L1 :|: L2 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (f_group_type) := - compute_g_pow_yi i xis := - letb prod1 loc(prod1_loc) := f_group_one (ret_both (tt : 'unit)) in - letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => - ssp (fun prod1 => - solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L2:|:L1 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc:|:fset [prod1_loc;prod1_loc]) (I1:|:I2:|:I1) (f_group_type))) prod1 in - letb prod2 loc(prod2_loc) := f_group_one (ret_both (tt : 'unit)) in - letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => - ssp (fun prod2 => - solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L2:|:L1:|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod2_loc;prod2_loc]) (I1:|:I2:|:I1) (f_group_type))) prod2 in - solve_lift (f_div prod1 prod2) : both (L1 :|: L2 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2) (f_group_type). -Solve All Obligations with ( solve_ssprove_obligations ; ((now (rewrite !fset0E ; apply (ret_both 0))) || (now destruct from_uint_size))). -Fail Next Obligation. - -Equations impl__into_vec {L I A n} : both L I (nseq_ A n) -> both L I (t_Vec A t_Global) := - impl__into_vec X := bind_both X (fun x : nseq_ A n => solve_lift (ret_both (Hacspec_Lib_Pre.array_to_list x : chList _))). -Fail Next Obligation. - -Definition unsize {A} := @id A. -Definition box_new {A} := @id A. - -Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (commitment : both L2 I2 (f_field_type)) : both (L1 :|: L2 :|: f_hash_loc) (I1 :|: I2) ('bool) := - check_commitment g_pow_xi_yi_vi commitment := - solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both (L1 :|: L2 :|: f_hash_loc) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Equations commit_to {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) : both (L1 :|: f_hash_loc) I1 (f_field_type) := - commit_to g_pow_xi_yi_vi := - solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both (L1 :|: f_hash_loc) I1 (f_field_type). -Fail Next Obligation. - -Definition t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := - (int32 × f_field_type × int32 × int32 × int32 × 'bool). -Equations f_cvp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_i s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_cvp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (f_field_type) := - f_cvp_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both L I (f_field_type). -Fail Next Obligation. -Equations f_cvp_zkp_random_w {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_zkp_random_w s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_cvp_zkp_random_r {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_zkp_random_r s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_cvp_zkp_random_d {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_zkp_random_d s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_cvp_vote {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I ('bool) := - f_cvp_vote s := - bind_both s (fun x => - solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). -Fail Next Obligation. -Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (f_field_type)} {f_cvp_zkp_random_w : both L2 I2 (int32)} {f_cvp_zkp_random_r : both L3 I3 (int32)} {f_cvp_zkp_random_d : both L4 I4 (int32)} {f_cvp_vote : both L5 I5 ('bool)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_CastVoteParam) := - Build_t_CastVoteParam := - bind_both f_cvp_vote (fun f_cvp_vote => - bind_both f_cvp_zkp_random_d (fun f_cvp_zkp_random_d => - bind_both f_cvp_zkp_random_r (fun f_cvp_zkp_random_r => - bind_both f_cvp_zkp_random_w (fun f_cvp_zkp_random_w => - bind_both f_cvp_xi (fun f_cvp_xi => - bind_both f_cvp_i (fun f_cvp_i => - solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_CastVoteParam). -Fail Next Obligation. -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_w' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := y) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_r' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := y) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_d' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := y) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := y)). - -Definition t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := - (f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_field_type × f_field_type × f_field_type × f_field_type × f_field_type). -Equations f_or_zkp_x {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := - f_or_zkp_x s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both L I (f_group_type). -Fail Next Obligation. -Equations f_or_zkp_y {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := - f_or_zkp_y s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both L I (f_group_type). -Fail Next Obligation. -Equations f_or_zkp_a1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := - f_or_zkp_a1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : f_group_type))) : both L I (f_group_type). -Fail Next Obligation. -Equations f_or_zkp_b1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := - f_or_zkp_b1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : f_group_type))) : both L I (f_group_type). -Fail Next Obligation. -Equations f_or_zkp_a2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := - f_or_zkp_a2 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : f_group_type))) : both L I (f_group_type). -Fail Next Obligation. -Equations f_or_zkp_b2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := - f_or_zkp_b2 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : f_group_type))) : both L I (f_group_type). -Fail Next Obligation. -Equations f_or_zkp_c {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := - f_or_zkp_c s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both L I (f_field_type). -Fail Next Obligation. -Equations f_or_zkp_d1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := - f_or_zkp_d1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : f_field_type))) : both L I (f_field_type). -Fail Next Obligation. -Equations f_or_zkp_d2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := - f_or_zkp_d2 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : f_field_type))) : both L I (f_field_type). -Fail Next Obligation. -Equations f_or_zkp_r1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := - f_or_zkp_r1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). -Fail Next Obligation. -Equations f_or_zkp_r2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := - f_or_zkp_r2 s := - bind_both s (fun x => - solve_lift (ret_both (snd x : f_field_type))) : both L I (f_field_type). -Fail Next Obligation. -Equations Build_t_OrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {L7 : {fset Location}} {L8 : {fset Location}} {L9 : {fset Location}} {L10 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {I7 : Interface} {I8 : Interface} {I9 : Interface} {I10 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_or_zkp_x : both L0 I0 (f_group_type)} {f_or_zkp_y : both L1 I1 (f_group_type)} {f_or_zkp_a1 : both L2 I2 (f_group_type)} {f_or_zkp_b1 : both L3 I3 (f_group_type)} {f_or_zkp_a2 : both L4 I4 (f_group_type)} {f_or_zkp_b2 : both L5 I5 (f_group_type)} {f_or_zkp_c : both L6 I6 (f_field_type)} {f_or_zkp_d1 : both L7 I7 (f_field_type)} {f_or_zkp_d2 : both L8 I8 (f_field_type)} {f_or_zkp_r1 : both L9 I9 (f_field_type)} {f_or_zkp_r2 : both L10 I10 (f_field_type)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit) := - Build_t_OrZKPCommit := - bind_both f_or_zkp_r2 (fun f_or_zkp_r2 => - bind_both f_or_zkp_r1 (fun f_or_zkp_r1 => - bind_both f_or_zkp_d2 (fun f_or_zkp_d2 => - bind_both f_or_zkp_d1 (fun f_or_zkp_d1 => - bind_both f_or_zkp_c (fun f_or_zkp_c => - bind_both f_or_zkp_b2 (fun f_or_zkp_b2 => - bind_both f_or_zkp_a2 (fun f_or_zkp_a2 => - bind_both f_or_zkp_b1 (fun f_or_zkp_b1 => - bind_both f_or_zkp_a1 (fun f_or_zkp_a1 => - bind_both f_or_zkp_y (fun f_or_zkp_y => - bind_both f_or_zkp_x (fun f_or_zkp_x => - solve_lift (ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit)))))))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit). -Fail Next Obligation. -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := y) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := y) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := y) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := y) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := y) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := y) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_c' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := y) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := y) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := y) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := y) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := y)). - -Definition t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := - (int32 × f_field_type × int32). -Equations f_rp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (int32) := - f_rp_i s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_rp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (f_field_type) := - f_rp_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). -Fail Next Obligation. -Equations f_rp_zkp_random {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (int32) := - f_rp_zkp_random s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). -Fail Next Obligation. -Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (f_field_type)} {f_rp_zkp_random : both L2 I2 (int32)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_RegisterParam) := - Build_t_RegisterParam := - bind_both f_rp_zkp_random (fun f_rp_zkp_random => - bind_both f_rp_xi (fun f_rp_xi => - bind_both f_rp_i (fun f_rp_i => - solve_lift (ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_RegisterParam). -Fail Next Obligation. -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y) (f_rp_zkp_random := f_rp_zkp_random x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := y)). - -Definition t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := - (f_group_type × f_field_type × f_field_type). -Equations f_schnorr_zkp_u {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_group_type) := - f_schnorr_zkp_u s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : f_group_type))) : both L I (f_group_type). -Fail Next Obligation. -Equations f_schnorr_zkp_c {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := - f_schnorr_zkp_c s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). -Fail Next Obligation. -Equations f_schnorr_zkp_z {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := - f_schnorr_zkp_z s := - bind_both s (fun x => - solve_lift (ret_both (snd x : f_field_type))) : both L I (f_field_type). -Fail Next Obligation. -Equations Build_t_SchnorrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_schnorr_zkp_u : both L0 I0 (f_group_type)} {f_schnorr_zkp_c : both L1 I1 (f_field_type)} {f_schnorr_zkp_z : both L2 I2 (f_field_type)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit) := - Build_t_SchnorrZKPCommit := - bind_both f_schnorr_zkp_z (fun f_schnorr_zkp_z => - bind_both f_schnorr_zkp_c (fun f_schnorr_zkp_c => - bind_both f_schnorr_zkp_u (fun f_schnorr_zkp_u => - solve_lift (ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit). -Fail Next Obligation. -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := y) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := y) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := y)). - -Definition t_TallyParameter : choice_type := - 'unit. -Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := - Build_t_TallyParameter := - solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). -Fail Next Obligation. - -Equations schnorr_zkp {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (h : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3 :|: f_random_field_elem_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_field_one_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := - schnorr_zkp random h x := - solve_lift (run (letb r := f_random_field_elem random in - letb u := f_g_pow r in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [solve_lift f_g (ret_both (tt : 'unit)) : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _; - solve_lift h : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _; - solve_lift u : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _])))) in - letb z := f_add r (f_mul c x) in - letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in - ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3 :|: f_random_field_elem_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_field_one_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). -Fail Next Obligation. - -Equations schnorr_zkp_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (pi : both L2 I2 (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_field_one_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2) ('bool) := - schnorr_zkp_validate h pi := - solve_lift (andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [solve_lift f_g (ret_both (tt : 'unit)) : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _; - solve_lift h : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _; - solve_lift f_schnorr_zkp_u pi : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_pow_loc :|: f_g_loc) (I1 :|: I2) _])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both (L1 :|: L2 :|: f_random_field_elem_loc :|: f_g_loc :|: f_g_pow_loc :|: f_hash_loc :|: f_field_one_loc :|: f_pow_loc :|: f_prod_loc :|: f_mul_loc :|: f_add_loc) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both L1 I1 (int32)) (random_r : both L2 I2 (int32)) (random_d : both L3 I3 (int32)) (h : both L4 I4 (f_group_type)) (xi : both L5 I5 (f_field_type)) (vi : both L6 I6 ('bool)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: f_prod_loc :|: f_div_loc :|: f_pow_loc :|: f_g_loc :|: f_g_pow_loc :|: f_random_field_elem_loc :|: f_hash_loc :|: f_sub_loc :|: f_mul_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) := - zkp_one_out_of_two random_w random_r random_d h xi vi := - letb w := f_random_field_elem random_w in - solve_lift (ifb vi - then letb r1 := f_random_field_elem random_r in - letb d1 := f_random_field_elem random_d in - letb x := f_g_pow xi in - letb y := f_prod (f_pow h xi) (f_g (ret_both (tt : 'unit))) in - letb a1 := f_prod (f_g_pow r1) (f_pow x d1) in - letb b1 := f_prod (f_pow h r1) (f_pow y d1) in - letb a2 := f_g_pow w in - letb b2 := f_pow h w in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [ - solve_lift x : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; - solve_lift y : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; - solve_lift a1 : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; - solve_lift b1 : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; - solve_lift a2 : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _; - solve_lift b2 : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: (f_random_field_elem_loc :|: f_pow_loc :|: f_g_pow_loc :|: f_g_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _])))) in - letb d2 := f_sub c d1 in - letb r2 := f_sub w (f_mul xi d2) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2) - else letb r2 := f_random_field_elem random_r in - letb d2 := f_random_field_elem random_d in - letb x := f_g_pow xi in - letb y := f_pow h xi in - letb a1 := f_g_pow w in - letb b1 := f_pow h w in - letb a2 := f_prod (f_g_pow r2) (f_pow x d2) in - letb b2 := f_prod (f_pow h r2) (f_pow (f_div y (f_g (ret_both (tt : 'unit)))) d2) in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [ - solve_lift x : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); - solve_lift y : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); - solve_lift a1 : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); - solve_lift b1 : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); - solve_lift a2 : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _); - solve_lift b2 : (both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: f_random_field_elem_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc :|: f_prod_loc :|: f_g_pow_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5) _)])))) in - letb d1 := f_sub c d2 in - letb r1 := f_sub w (f_mul xi d1) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6 :|: f_prod_loc :|: f_div_loc :|: f_pow_loc :|: f_g_loc :|: f_g_pow_loc :|: f_random_field_elem_loc :|: f_hash_loc :|: f_sub_loc :|: f_mul_loc) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)). -Fail Next Obligation. - -Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (zkp : both L2 I2 (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both (L1 :|: L2 :|: f_hash_loc :|: f_add_loc :|: f_prod_loc :|: f_g_pow_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc) (I1 :|: I2) ('bool) := - zkp_one_out_of_two_validate h zkp := - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; - f_or_zkp_y zkp; - f_or_zkp_a1 zkp; - f_or_zkp_b1 zkp; - f_or_zkp_a2 zkp; - f_or_zkp_b2 zkp])))) in - solve_lift (andb (andb (andb (andb (c =.? (f_add (f_or_zkp_d1 zkp) (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? (f_prod (f_pow h (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r2 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? (f_prod (f_pow h (f_or_zkp_r2 zkp)) (f_pow (f_div (f_or_zkp_y zkp) (f_g (ret_both (tt : 'unit)))) (f_or_zkp_d2 zkp))))) : both (L1 :|: L2 :|: f_hash_loc :|: f_add_loc :|: f_prod_loc :|: f_g_pow_loc :|: f_pow_loc :|: f_g_loc :|: f_div_loc) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := - (nseq f_group_type (is_pure (n)) × nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × nseq f_field_type (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × int32). -Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq f_group_type (is_pure (n))) := - f_g_pow_xis s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). -Fail Next Obligation. -Equations f_zkp_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := - f_zkp_xis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both L I (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). -Fail Next Obligation. -Equations f_commit_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq f_field_type (is_pure (n))) := - f_commit_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : nseq f_field_type (is_pure (n))))) : both L I (nseq f_field_type (is_pure (n))). -Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq f_group_type (is_pure (n))) := - f_g_pow_xi_yi_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). -Fail Next Obligation. -Equations f_zkp_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := - f_zkp_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both L I (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). -Fail Next Obligation. -Equations f_tally {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState (n := n))) : both L I (int32) := - f_tally s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). -Fail Next Obligation. -Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_g_pow_xis : both L0 I0 (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both L1 I1 (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_commit_vis : both L2 I2 (nseq f_field_type (is_pure (n)))} {f_g_pow_xi_yi_vis : both L3 I3 (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both L4 I4 (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState (n := n)) := - Build_t_OvnContractState := - bind_both f_tally (fun f_tally => - bind_both f_zkp_vis (fun f_zkp_vis => - bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => - bind_both f_commit_vis (fun f_commit_vis => - bind_both f_zkp_xis (fun f_zkp_xis => - bind_both f_g_pow_xis (fun f_g_pow_xis => - solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). -Fail Next Obligation. -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). - -Equations f_from {L I} : both L I 'nat := - f_from := solve_lift (ret_both (0%nat : 'nat)). -Fail Next Obligation. -Equations impl__map_err {L1 I1} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (out : both L1 I1 (t_Result t_CastVoteParam t_ParseError)) (f_from : both L1 I1 'nat) : - both L1 I1 (@choice_typeMonad.M (@choice_typeMonad.mnd - (choice_typeMonad.result_bind_code (Result_t (@t_CastVoteParam _ _ _) t_ParseError))) t_CastVoteParam) := - impl__map_err out f_from := - matchb out with - | inl s => solve_lift ret_both _ - | inr s => solve_lift ret_both _ -end. -Fail Next Obligation. - -(* Equations run {L I A} (x : both L I (choice_typeMonad.M (CEMonad := (@choice_typeMonad.mnd (choice_typeMonad.result_bind_code A))) A)) : both L I (t_Result A 'unit) := *) -(* run x := *) -(* bind_both x (fun y => match y with *) -(* | inl r | inr r => solve_lift ret_both (inl r : t_Result A 'unit) *) -(* end). *) -(* Fail Next Obligation. *) - -Definition cast_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *);2%nat). -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc (n := n);prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)) := - cast_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (Ctx := t_CastVoteParam) (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (Result_t t_CastVoteParam t_ParseError)] (params:t_CastVoteParam (v_Z := v_Z)) := impl__map_err out f_from in - Result_Ok ((* letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in *) - (* letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in *) - (* letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in *) - letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in - (* letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in *) - (* letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in *) - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n) (* (both (fset []) (fset []) (uint_size)) *))) (t_ParseError)). -Fail Next Obligation. - -Definition commit_to_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));3%nat). -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := - commit_to_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_ParseError)] (params:t_CastVoteParam (v_Z)) := impl__map_err out f_from in - Result_Ok (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => - ssp (fun _ => - solve_lift (ifb not (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist2 := v_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist2) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*0*)(L2:|:fset []) (I2) (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in - letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in - letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in - letb commit_vi := commit_to g_pow_xi_yi_vi in - letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in - letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). -Fail Next Obligation. - -Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both L1 I1 ('unit)) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)) := - init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_field_zero (ret_both (tt : 'unit))) (f_schnorr_zkp_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_y := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_c := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d2 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)). -Fail Next Obligation. - -Definition register_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));4%nat). -Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := - register_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_ParseError)] (params:t_RegisterParam (v_Z)) := impl__map_err out f_from in - Result_Ok (letb g_pow_xi := f_g_pow (f_rp_xi params) in - letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in - letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). -Fail Next Obligation. - -Definition curr_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (f_field_type;5%nat). -Definition tally_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (int32;6%nat). -Definition tally_votes_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));7%nat). -Definition vote_result_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (f_group_type;8%nat). -Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := - tally_votes _ state := - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => - ssp (fun _ => - letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] _ := ControlFlow_Continue (ifb not (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist3 := v_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist3) - else ControlFlow_Continue (ret_both (tt : 'unit))) in - solve_lift (ifb not (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist4 := v_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist4) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*2*)(L2:|:fset [prod1_loc;prod2_loc]) (I2) (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in - letb vote_result loc(vote_result_loc) := f_group_one (ret_both (tt : 'unit)) in - letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => - ssp (fun vote_result => - solve_lift (f_prod vote_result g_pow_vote) : both (*2*)(L2:|:L2:|:fset [vote_result_loc;vote_result_loc]) (I2:|:I2) (f_group_type))) vote_result in - letb tally loc(tally_loc) := ret_both (0 : int32) in - letb curr loc(curr_loc) := f_field_zero (ret_both (tt : 'unit)) in - letb '(curr,tally) := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => - ssp (fun '(curr,tally) => - letb tally := ifb (f_g_pow curr) =.? vote_result - then letb tally := i in - tally - else tally in - letb curr := f_add curr (f_field_one (ret_both (tt : 'unit))) in - solve_lift (prod_b (curr,tally)) : both (*5*)(L2:|:fset [curr_loc;tally_loc;vote_result_loc;curr_loc;tally_loc]) (I2) ((f_field_type × int32)))) (prod_b (curr,tally)) in - letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in - letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in - Result_Ok (solve_lift (prod_b (f_accept (ret_both (tt : 'unit)),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). -Fail Next Obligation. - -(** Concert lib part **) -From ConCert.Utils Require Import Extras. -Export Extras. -From ConCert.Utils Require Import Automation. -Export Automation. -From ConCert.Execution Require Import Serializable. -Export Serializable. -From ConCert.Execution Require Import Blockchain. -Export Blockchain. -From ConCert.Execution Require Import ContractCommon. -Export ContractCommon. -From ConCert.Execution Require Import Serializable. -Export Serializable. -Require Import ConCertLib. -Export ConCertLib. - -Definition state_OVN : choice_type := - t_OvnContractState. - -#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := - {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := - fun x => - x. -Fail Next Obligation. -Definition receive_OVN_cast_vote {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - cast_vote ctx st. - -#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := - {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := - fun x => - x. -Fail Next Obligation. -Definition receive_OVN_commit_to_vote {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - commit_to_vote ctx st. - -Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN) (t_ParseError) := - ResultMonad.Ok st. - -#[global] Program Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit := - {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam := - fun x => - x. -Fail Next Obligation. -Definition receive_OVN_register {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_RegisterParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - register_vote ctx st. - -#[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := - {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_TallyParameter_t_Sized : t_Sized t_TallyParameter := - fun x => - x. -Fail Next Obligation. -Definition receive_OVN_tally {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_TallyParameter)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - tally_votes ctx st. - -Inductive Msg_OVN: Type := -| msg_OVN_cast_vote : t_CastVoteParam -> Msg_OVN -| msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN -| msg_OVN_register : t_RegisterParam -> Msg_OVN -| msg_OVN_tally : t_TallyParameter -> Msg_OVN. -#[global] Program Instance state_OVN_t_HasReceiveContext : t_HasReceiveContext state_OVN 'unit := - {| f_get := (fun (Ctx : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance state_OVN_t_Sized : t_Sized state_OVN := - fun x => - x. -Fail Next Obligation. -#[global] Program Instance state_OVN_t_HasActions : t_HasActions state_OVN := - Admitted. -Fail Next Obligation. -Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := - receive_OVN chain ctx st msg := - match msg with - | Some (msg_OVN_cast_vote val) => - match (is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_OVN_commit_to_vote val) => - match (is_pure (both_prog (receive_OVN_commit_to_vote (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_OVN_register val) => - match (is_pure (both_prog (receive_OVN_register (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_OVN_tally val) => - match (is_pure (both_prog (receive_OVN_tally (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | _ => - ResultMonad.Err tt - end : ResultMonad.result (state_OVN * list ActionBody) t_ParseError. -Fail Next Obligation. -#[global] Program Instance state_OVN_Serializable : Serializable state_OVN := - _. -Fail Next Obligation. -#[global] Program Instance Msg_OVN_Serializable : Serializable Msg_OVN := - Derive Serializable Msg_OVN_rect. -Fail Next Obligation. -Definition contract_OVN : Contract (state_OVN) (Msg_OVN) (state_OVN) (t_ParseError) := - build_contract init_OVN receive_OVN. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_by_hand.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_by_hand.v deleted file mode 100644 index 16d575d..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_by_hand.v +++ /dev/null @@ -1,949 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -(* Require Import Hacspec_bip_340. *) -(* Export Hacspec_bip_340. *) - -Class t_Z_Field (Self : choice_type) := { - f_field_type : choice_type ; - f_field_type_t_Serialize :> t_Serialize (f_field_type) ; - f_field_type_t_Deserial :> t_Deserial (f_field_type) ; - f_field_type_t_Serial :> t_Serial (f_field_type) ; - f_field_type_t_Copy :> t_Copy (f_field_type) ; - f_field_type_t_Clone :> t_Clone (f_field_type) ; - f_field_type_t_Eq :> t_Eq (f_field_type) ; - f_field_type_t_PartialEq :> t_PartialEq (f_field_type) ; - f_field_type_t_Sized :> t_Sized (f_field_type) ; - f_q_loc : {fset Location} ; - f_q : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_q_loc) I1 (f_field_type) ; - f_random_field_elem_loc : {fset Location} ; - f_random_field_elem : forall {L1 I1}, both L1 I1 (int32) -> both (L1 :|: f_random_field_elem_loc) I1 (f_field_type) ; - f_field_zero_loc : {fset Location} ; - f_field_zero : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_field_zero_loc) I1 (f_field_type) ; - f_field_one_loc : {fset Location} ; - f_field_one : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_field_one_loc) I1 (f_field_type) ; - f_add_loc : {fset Location} ; - f_add : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_add_loc) (I1 :|: I2) (f_field_type) ; - f_sub_loc : {fset Location} ; - f_sub : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_sub_loc) (I1 :|: I2) (f_field_type) ; - f_mul_loc : {fset Location} ; - f_mul : forall {L1 L2 I1 I2}, both L1 I1 (f_field_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_mul_loc) (I1 :|: I2) (f_field_type) ; -}. -Hint Unfold f_q_loc. -Hint Unfold f_random_field_elem_loc. -Hint Unfold f_field_zero_loc. -Hint Unfold f_field_one_loc. -Hint Unfold f_add_loc. -Hint Unfold f_sub_loc. -Hint Unfold f_mul_loc. - -Class t_Group (Self : choice_type) `{t_Z_Field} := { - f_group_type : choice_type ; - f_group_type_t_Serialize :> t_Serialize (f_group_type) ; - f_group_type_t_Deserial :> t_Deserial (f_group_type) ; - f_group_type_t_Serial :> t_Serial (f_group_type) ; - f_group_type_t_Copy :> t_Copy (f_group_type) ; - f_group_type_t_Clone :> t_Clone (f_group_type) ; - f_group_type_t_Eq :> t_Eq (f_group_type) ; - f_group_type_t_PartialEq :> t_PartialEq (f_group_type) ; - f_group_type_t_Sized :> t_Sized (f_group_type) ; - f_g_loc : {fset Location} ; - f_g : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_g_loc) I1 (f_group_type) ; - f_g_pow_loc : {fset Location} ; - f_g_pow : forall {L1 I1}, both L1 I1 (f_field_type) -> both (L1 :|: f_g_pow_loc) I1 (f_group_type) ; - f_pow_loc : {fset Location} ; - f_pow : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_field_type) -> both (L1 :|: L2 :|: f_pow_loc) (I1 :|: I2) (f_group_type) ; - f_group_one_loc : {fset Location} ; - f_group_one : forall {L1 I1}, both L1 I1 ('unit) -> both (L1 :|: f_group_one_loc) I1 (f_group_type) ; - f_prod_loc : {fset Location} ; - f_prod : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_prod_loc) (I1 :|: I2) (f_group_type) ; - f_inv_loc : {fset Location} ; - f_inv : forall {L1 I1}, both L1 I1 (f_group_type) -> both (L1 :|: f_inv_loc) I1 (f_group_type) ; - f_div_loc : {fset Location} ; - f_div : forall {L1 L2 I1 I2}, both L1 I1 (f_group_type) -> both L2 I2 (f_group_type) -> both (L1 :|: L2 :|: f_div_loc) (I1 :|: I2) (f_group_type) ; - f_hash_loc : {fset Location} ; - f_hash : forall {L1 I1}, both L1 I1 (t_Vec (f_group_type) (t_Global)) -> both (L1 :|: f_hash_loc) I1 (f_field_type) ; -}. -Hint Unfold f_g_loc. -Hint Unfold f_g_pow_loc. -Hint Unfold f_pow_loc. -Hint Unfold f_group_one_loc. -Hint Unfold f_prod_loc. -Hint Unfold f_inv_loc. -Hint Unfold f_div_loc. -Hint Unfold f_hash_loc. - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -Equations compute_group_element_for_vote {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (xi : both L1 I1 (f_field_type)) (vote : both L2 I2 ('bool)) (g_pow_yi : both L3 I3 (f_group_type)) : both (L1 :|: L2 :|: L3 :|: (f_pow_loc :|: f_field_zero_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3) (f_group_type) := - compute_group_element_for_vote xi vote g_pow_yi := - solve_lift (f_prod (f_pow g_pow_yi xi) (f_g_pow (ifb vote - then f_field_one (ret_both (tt : 'unit)) - else f_field_zero (ret_both (tt : 'unit))))) : both (L1 :|: L2 :|: L3 :|: (f_pow_loc :|: f_field_zero_loc :|: f_field_one_loc :|: f_g_pow_loc :|: f_prod_loc)) (I1 :|: I2 :|: I3) (f_group_type). -Fail Next Obligation. - -Equations select_private_voting_key {L1 : {fset Location}} {I1 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (random : both L1 I1 (int32)) : both (L1 :|: f_random_field_elem_loc) I1 (f_field_type) := - select_private_voting_key random := - solve_lift (f_random_field_elem random) : both (L1 :|: f_random_field_elem_loc) I1 (f_field_type). -Fail Next Obligation. - -Definition prod1_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := - (f_group_type;0%nat). -Definition prod2_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : Location := - (f_group_type;1%nat). -Equations compute_g_pow_yi {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both L1 I1 (uint_size)) (xis : both L2 I2 (nseq f_group_type (is_pure (n)))) : both (L1 :|: L2 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc (n := n);prod2_loc (n := n)]) (I1 :|: I2) (f_group_type) := - compute_g_pow_yi i xis := - letb prod1 loc(prod1_loc) := f_group_one (ret_both (tt : 'unit)) in - letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => - ssp (fun prod1 => - solve_lift (f_prod prod1 (xis.a[j])) : both (*2*)(L1:|:L2:|:f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|:L1:|:fset [prod1_loc;prod1_loc]) (I1:|:I2:|:I1) (f_group_type))) prod1 in - letb prod2 loc(prod2_loc) := f_group_one (ret_both (tt : 'unit)) in - letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => - ssp (fun prod2 => - solve_lift (f_prod prod2 (xis.a[j])) : both (*2*)(L1:|:L2:|:f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|:L1:|:fset [prod2_loc;prod2_loc]) (I1:|:I2:|:I1) (f_group_type))) prod2 in - solve_lift (f_div prod1 prod2) : both (L1 :|: L2 :|: f_group_one_loc :|: f_field_one_loc:|: f_g_pow_loc :|: f_field_zero_loc :|: f_div_loc :|: f_prod_loc :|: f_pow_loc :|: fset [prod1_loc;prod2_loc]) (I1 :|: I2) (f_group_type). -Solve All Obligations with ( solve_ssprove_obligations ; ((now (rewrite !fset0E ; apply (ret_both 0))) || (now destruct from_uint_size))). -Fail Next Obligation. - -Equations impl__into_vec {L I A n} : both L I (nseq_ A n) -> both L I (t_Vec A t_Global) := - impl__into_vec X := bind_both X (fun x : nseq_ A n => solve_lift (ret_both (Hacspec_Lib_Pre.array_to_list x : chList _))). -Fail Next Obligation. - -Definition unsize {A} := @id A. -Definition box_new {A} := @id A. - - -Equations check_commitment {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) (commitment : both L2 I2 (f_field_type)) : both (L1 :|: L2 :|: f_hash_loc) (I1 :|: I2) ('bool) := - check_commitment g_pow_xi_yi_vi commitment := - solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both (L1 :|: L2 :|: f_hash_loc) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Equations commit_to {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both L1 I1 (f_group_type)) : both (L1 :|: f_hash_loc) I1 (f_field_type) := - commit_to g_pow_xi_yi_vi := - solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both (L1 :|: f_hash_loc) I1 (f_field_type). -Fail Next Obligation. - -Definition t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := - (int32 × f_field_type × int32 × int32 × int32 × 'bool). -Equations f_cvp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_i s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_cvp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (f_field_type) := - f_cvp_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both L I (f_field_type). -Fail Next Obligation. -Equations f_cvp_zkp_random_w {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_zkp_random_w s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_cvp_zkp_random_r {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_zkp_random_r s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_cvp_zkp_random_d {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I (int32) := - f_cvp_zkp_random_d s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_cvp_vote {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_CastVoteParam)) : both L I ('bool) := - f_cvp_vote s := - bind_both s (fun x => - solve_lift (ret_both (snd x : 'bool))) : both L I ('bool). -Fail Next Obligation. -Equations Build_t_CastVoteParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_cvp_i : both L0 I0 (int32)} {f_cvp_xi : both L1 I1 (f_field_type)} {f_cvp_zkp_random_w : both L2 I2 (int32)} {f_cvp_zkp_random_r : both L3 I3 (int32)} {f_cvp_zkp_random_d : both L4 I4 (int32)} {f_cvp_vote : both L5 I5 ('bool)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_CastVoteParam) := - Build_t_CastVoteParam := - bind_both f_cvp_vote (fun f_cvp_vote => - bind_both f_cvp_zkp_random_d (fun f_cvp_zkp_random_d => - bind_both f_cvp_zkp_random_r (fun f_cvp_zkp_random_r => - bind_both f_cvp_zkp_random_w (fun f_cvp_zkp_random_w => - bind_both f_cvp_xi (fun f_cvp_xi => - bind_both f_cvp_i (fun f_cvp_i => - solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_CastVoteParam). -Fail Next Obligation. -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_w' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := y) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_r' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := y) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_d' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := y) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := y)). - -(* Definition t_Group_curve : choice_type := *) -(* (t_Point). *) -(* Equations f_val {L : {fset Location}} {I : Interface} (s : both L I (t_Group_curve)) : both L I (t_Point) := *) -(* f_val s := *) -(* bind_both s (fun x => *) -(* solve_lift (ret_both (x : t_Point))) : both L I (t_Point). *) -(* Fail Next Obligation. *) -(* Equations Build_t_Group_curve {L0 : {fset Location}} {I0 : Interface} {f_val : both L0 I0 (t_Point)} : both L0 I0 (t_Group_curve) := *) -(* Build_t_Group_curve := *) -(* bind_both f_val (fun f_val => *) -(* solve_lift (ret_both ((f_val) : (t_Group_curve)))) : both L0 I0 (t_Group_curve). *) -(* Fail Next Obligation. *) -(* Notation "'Build_t_Group_curve' '[' x ']' '(' 'f_val' ':=' y ')'" := (Build_t_Group_curve (f_val := y)). *) - -(* #[global] Program Instance t_Group_curve_t_Deserial : t_Deserial t_Group_curve := *) -(* let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (v__source : both L1 I1 (v_R)) => letb hax_temp_output := Result_Err ParseError in *) -(* solve_lift (prod_b (v__source,hax_temp_output)) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_Group_curve) (t_ParseError))) in *) -(* {| f_deserial_loc := (fset [] : {fset Location}); *) -(* f_deserial := (@f_deserial)|}. *) -(* Fail Next Obligation. *) -(* Hint Unfold t_Group_curve_t_Deserial. *) - -(* #[global] Program Instance t_Group_curve_t_Serial : t_Serial t_Group_curve := *) -(* let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Group_curve)) (v__out : both L2 I2 (v_W)) => letb hax_temp_output := Result_Ok (ret_both (tt : 'unit)) in *) -(* solve_lift (prod_b (v__out,hax_temp_output)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in *) -(* {| f_serial_loc := (fset [] : {fset Location}); *) -(* f_serial := (@f_serial)|}. *) -(* Fail Next Obligation. *) -(* Hint Unfold t_Group_curve_t_Serial. *) - -Definition t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := - (f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_field_type × f_field_type × f_field_type × f_field_type × f_field_type). -Equations f_x {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := - f_x s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both L I (f_group_type). -Fail Next Obligation. -Equations f_y {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := - f_y s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both L I (f_group_type). -Fail Next Obligation. -Equations f_a1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := - f_a1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : f_group_type))) : both L I (f_group_type). -Fail Next Obligation. -Equations f_b1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := - f_b1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : f_group_type))) : both L I (f_group_type). -Fail Next Obligation. -Equations f_a2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := - f_a2 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : f_group_type))) : both L I (f_group_type). -Fail Next Obligation. -Equations f_b2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_group_type) := - f_b2 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : f_group_type))) : both L I (f_group_type). -Fail Next Obligation. -Equations f_c {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := - f_c s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both L I (f_field_type). -Fail Next Obligation. -Equations f_d1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := - f_d1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : f_field_type))) : both L I (f_field_type). -Fail Next Obligation. -Equations f_d2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := - f_d2 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : f_field_type))) : both L I (f_field_type). -Fail Next Obligation. -Equations f_r1 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := - f_r1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). -Fail Next Obligation. -Equations f_r2 {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OrZKPCommit)) : both L I (f_field_type) := - f_r2 s := - bind_both s (fun x => - solve_lift (ret_both (snd x : f_field_type))) : both L I (f_field_type). -Fail Next Obligation. -Equations Build_t_OrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {L7 : {fset Location}} {L8 : {fset Location}} {L9 : {fset Location}} {L10 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {I7 : Interface} {I8 : Interface} {I9 : Interface} {I10 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_x : both L0 I0 (f_group_type)} {f_y : both L1 I1 (f_group_type)} {f_a1 : both L2 I2 (f_group_type)} {f_b1 : both L3 I3 (f_group_type)} {f_a2 : both L4 I4 (f_group_type)} {f_b2 : both L5 I5 (f_group_type)} {f_c : both L6 I6 (f_field_type)} {f_d1 : both L7 I7 (f_field_type)} {f_d2 : both L8 I8 (f_field_type)} {f_r1 : both L9 I9 (f_field_type)} {f_r2 : both L10 I10 (f_field_type)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit) := - Build_t_OrZKPCommit := - bind_both f_r2 (fun f_r2 => - bind_both f_r1 (fun f_r1 => - bind_both f_d2 (fun f_d2 => - bind_both f_d1 (fun f_d1 => - bind_both f_c (fun f_c => - bind_both f_b2 (fun f_b2 => - bind_both f_a2 (fun f_a2 => - bind_both f_b1 (fun f_b1 => - bind_both f_a1 (fun f_a1 => - bind_both f_y (fun f_y => - bind_both f_x (fun f_x => - solve_lift (ret_both ((f_x,f_y,f_a1,f_b1,f_a2,f_b2,f_c,f_d1,f_d2,f_r1,f_r2) : (t_OrZKPCommit)))))))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5:|:L6:|:L7:|:L8:|:L9:|:L10) (I0:|:I1:|:I2:|:I3:|:I4:|:I5:|:I6:|:I7:|:I8:|:I9:|:I10) (t_OrZKPCommit). -Fail Next Obligation. -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := y) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := y) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_a1' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := y) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_b1' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := y) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_a2' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := y) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_b2' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := y) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_c' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := y) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_d1' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := y) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_d2' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := y) (f_r1 := f_r1 x) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_r1' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := y) (f_r2 := f_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_r2' ':=' y ')'" := (Build_t_OrZKPCommit (f_x := f_x x) (f_y := f_y x) (f_a1 := f_a1 x) (f_b1 := f_b1 x) (f_a2 := f_a2 x) (f_b2 := f_b2 x) (f_c := f_c x) (f_d1 := f_d1 x) (f_d2 := f_d2 x) (f_r1 := f_r1 x) (f_r2 := y)). - -Definition t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := - (int32 × f_field_type × int32). -Equations f_rp_i {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (int32) := - f_rp_i s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both L I (int32). -Fail Next Obligation. -Equations f_rp_xi {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (f_field_type) := - f_rp_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). -Fail Next Obligation. -Equations f_rp_zkp_random {L : {fset Location}} {I : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both L I (t_RegisterParam)) : both L I (int32) := - f_rp_zkp_random s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). -Fail Next Obligation. -Equations Build_t_RegisterParam {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_rp_i : both L0 I0 (int32)} {f_rp_xi : both L1 I1 (f_field_type)} {f_rp_zkp_random : both L2 I2 (int32)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_RegisterParam) := - Build_t_RegisterParam := - bind_both f_rp_zkp_random (fun f_rp_zkp_random => - bind_both f_rp_xi (fun f_rp_xi => - bind_both f_rp_i (fun f_rp_i => - solve_lift (ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_RegisterParam). -Fail Next Obligation. -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y) (f_rp_zkp_random := f_rp_zkp_random x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := y)). - -Definition t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := - (f_group_type × f_field_type × f_field_type). -Equations f_u {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_group_type) := - f_u s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : f_group_type))) : both L I (f_group_type). -Fail Next Obligation. -Equations f_c {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := - f_c s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both L I (f_field_type). -Fail Next Obligation. -Equations f_z {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_SchnorrZKPCommit)) : both L I (f_field_type) := - f_z s := - bind_both s (fun x => - solve_lift (ret_both (snd x : f_field_type))) : both L I (f_field_type). -Fail Next Obligation. -Equations Build_t_SchnorrZKPCommit {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_u : both L0 I0 (f_group_type)} {f_c : both L1 I1 (f_field_type)} {f_z : both L2 I2 (f_field_type)} : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit) := - Build_t_SchnorrZKPCommit := - bind_both f_z (fun f_z => - bind_both f_c (fun f_c => - bind_both f_u (fun f_u => - solve_lift (ret_both ((f_u,f_c,f_z) : (t_SchnorrZKPCommit)))))) : both (L0:|:L1:|:L2) (I0:|:I1:|:I2) (t_SchnorrZKPCommit). -Fail Next Obligation. -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_u := y) (f_c := f_c x) (f_z := f_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_u := f_u x) (f_c := y) (f_z := f_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_u := f_u x) (f_c := f_c x) (f_z := y)). - -Definition t_TallyParameter : choice_type := - 'unit. -Equations Build_t_TallyParameter : both (fset []) (fset []) (t_TallyParameter) := - Build_t_TallyParameter := - solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (fset []) (fset []) (t_TallyParameter). -Fail Next Obligation. - -Definition t_Z_curve : choice_type := - (t_Scalar). -Equations f_val {L : {fset Location}} {I : Interface} (s : both L I (t_Z_curve)) : both L I (t_Scalar) := - f_val s := - bind_both s (fun x => - solve_lift (ret_both (x : t_Scalar))) : both L I (t_Scalar). -Fail Next Obligation. -Equations Build_t_Z_curve {L0 : {fset Location}} {I0 : Interface} {f_val : both L0 I0 (t_Scalar)} : both L0 I0 (t_Z_curve) := - Build_t_Z_curve := - bind_both f_val (fun f_val => - solve_lift (ret_both ((f_val) : (t_Z_curve)))) : both L0 I0 (t_Z_curve). -Fail Next Obligation. -Notation "'Build_t_Z_curve' '[' x ']' '(' 'f_val' ':=' y ')'" := (Build_t_Z_curve (f_val := y)). - -#[global] Program Instance t_Z_curve_t_Deserial : t_Deserial t_Z_curve := - let f_deserial := fun {L1 : {fset Location}} {I1 : Interface} (v__source : both L1 I1 (v_R)) => letb hax_temp_output := Result_Err ParseError in - solve_lift (prod_b (v__source,hax_temp_output)) : both (L1 :|: fset []) I1 ((v_R × t_Result (t_Z_curve) (t_ParseError))) in - {| f_deserial_loc := (fset [] : {fset Location}); - f_deserial := (@f_deserial)|}. -Fail Next Obligation. -Hint Unfold t_Z_curve_t_Deserial. - -#[global] Program Instance t_Z_curve_t_Serial : t_Serial t_Z_curve := - let f_serial := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 (t_Z_curve)) (v__out : both L2 I2 (v_W)) => letb hax_temp_output := Result_Ok (ret_both (tt : 'unit)) in - solve_lift (prod_b (v__out,hax_temp_output)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) ((v_W × t_Result ('unit) (f_Err))) in - {| f_serial_loc := (fset [] : {fset Location}); - f_serial := (@f_serial)|}. -Fail Next Obligation. -Hint Unfold t_Z_curve_t_Serial. - -#[global] Program Instance t_Z_curve_t_Z_Field : t_Z_Field t_Z_curve := - let f_field_type := t_Z_curve : choice_type in - let f_q := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_hex (ret_both (0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 : chString)))) : both (L :|: fset []) I (t_Z_curve) in - let f_random_field_elem := fun {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_literal (cast_int (WS2 := _) random))) : both (L1 :|: fset []) I1 (t_Z_curve) in - let f_field_zero := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_literal (ret_both (0 : int128)))) : both (L :|: fset []) I (t_Z_curve) in - let f_field_one := fun {L : {fset Location}} {I : Interface} => solve_lift (Build_t_Z_curve (f_val := impl__Scalar__from_literal (ret_both (1 : int128)))) : both (L :|: fset []) I (t_Z_curve) in - let f_add := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Z_curve)) (y : both L2 I2 (t_Z_curve)) => solve_lift (Build_t_Z_curve (f_val := (f_val x) .+ (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Z_curve) in - let f_sub := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Z_curve)) (y : both L2 I2 (t_Z_curve)) => solve_lift (Build_t_Z_curve (f_val := (f_val x) .- (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Z_curve) in - let f_mul := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Z_curve)) (y : both L2 I2 (t_Z_curve)) => solve_lift (Build_t_Z_curve (f_val := (f_val x) .* (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Z_curve) in - {| f_field_type := (@f_field_type); - f_q_loc := (fset [] : {fset Location}); - f_q := (@f_q); - f_random_field_elem_loc := (fset [] : {fset Location}); - f_random_field_elem := (@f_random_field_elem); - f_field_zero_loc := (fset [] : {fset Location}); - f_field_zero := (@f_field_zero); - f_field_one_loc := (fset [] : {fset Location}); - f_field_one := (@f_field_one); - f_add_loc := (fset [] : {fset Location}); - f_add := (@f_add); - f_sub_loc := (fset [] : {fset Location}); - f_sub := (@f_sub); - f_mul_loc := (fset [] : {fset Location}); - f_mul := (@f_mul)|}. -Fail Next Obligation. -Hint Unfold t_Z_curve_t_Z_Field. - -Definition t_g_z_89_ : choice_type := - 'unit. -Equations Build_t_g_z_89_ : both (fset []) (fset []) (t_g_z_89_) := - Build_t_g_z_89_ := - solve_lift (ret_both (tt (* Empty tuple *) : (t_g_z_89_))) : both (fset []) (fset []) (t_g_z_89_). -Fail Next Obligation. - -Definition t_z_89_ : choice_type := - 'unit. -Equations Build_t_z_89_ : both (fset []) (fset []) (t_z_89_) := - Build_t_z_89_ := - solve_lift (ret_both (tt (* Empty tuple *) : (t_z_89_))) : both (fset []) (fset []) (t_z_89_). -Fail Next Obligation. - -Equations schnorr_zkp {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both L1 I1 (int32)) (h : both L2 I2 (f_group_type)) (x : both L3 I3 (f_field_type)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z) (v_G)) := - schnorr_zkp random h x := - solve_lift (run (letb r := f_random_field_elem random in - letb u := f_g_pow r in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); - h; - u])))) in - letb z := f_add r (f_mul c x) in - letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z) (v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_u := u) (f_c := c) (f_z := z)) in - ControlFlow_Continue (never_to_any hoist1))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_SchnorrZKPCommit (v_Z) (v_G)). -Fail Next Obligation. - -Equations schnorr_zkp_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (pi : both L2 I2 (t_SchnorrZKPCommit (v_Z) (v_G))) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - schnorr_zkp_validate h pi := - solve_lift (andb ((f_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); - h; - f_u pi])))))) ((f_g_pow (f_z pi)) =.? (f_prod (f_u pi) (f_pow h (f_c pi))))) : both (L1 :|: L2) (I1 :|: I2) ('bool). -Fail Next Obligation. - -Equations zkp_one_out_of_two {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {L6 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {I6 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both L1 I1 (int32)) (random_r : both L2 I2 (int32)) (random_d : both L3 I3 (int32)) (h : both L4 I4 (f_group_type)) (xi : both L5 I5 (f_field_type)) (vi : both L6 I6 ('bool)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z) (v_G)) := - zkp_one_out_of_two random_w random_r random_d h xi vi := - letb w := f_random_field_elem random_w in - solve_lift (ifb vi - then letb r1 := f_random_field_elem random_r in - letb d1 := f_random_field_elem random_d in - letb x := f_g_pow xi in - letb y := f_prod (f_pow h xi) (f_g (ret_both (tt : 'unit))) in - letb a1 := f_prod (f_g_pow r1) (f_pow x d1) in - letb b1 := f_prod (f_pow h r1) (f_pow y d1) in - letb a2 := f_g_pow w in - letb b2 := f_pow h w in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; - y; - a1; - b1; - a2; - b2])))) in - letb d2 := f_sub c d1 in - letb r2 := f_sub w (f_mul xi d2) in - Build_t_OrZKPCommit (f_x := x) (f_y := y) (f_a1 := a1) (f_b1 := b1) (f_a2 := a2) (f_b2 := b2) (f_c := c) (f_d1 := d1) (f_d2 := d2) (f_r1 := r1) (f_r2 := r2) - else letb r2 := f_random_field_elem random_r in - letb d2 := f_random_field_elem random_d in - letb x := f_g_pow xi in - letb y := f_pow h xi in - letb a1 := f_g_pow w in - letb b1 := f_pow h w in - letb a2 := f_prod (f_g_pow r2) (f_pow x d2) in - letb b2 := f_prod (f_pow h r2) (f_pow (f_div y (f_g (ret_both (tt : 'unit)))) d2) in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; - y; - a1; - b1; - a2; - b2])))) in - letb d1 := f_sub c d2 in - letb r1 := f_sub w (f_mul xi d1) in - Build_t_OrZKPCommit (f_x := x) (f_y := y) (f_a1 := a1) (f_b1 := b1) (f_a2 := a2) (f_b2 := b2) (f_c := c) (f_d1 := d1) (f_d2 := d2) (f_r1 := r1) (f_r2 := r2)) : both (L1 :|: L2 :|: L3 :|: L4 :|: L5 :|: L6) (I1 :|: I2 :|: I3 :|: I4 :|: I5 :|: I6) (t_OrZKPCommit (v_Z) (v_G)). -Fail Next Obligation. - -Equations zkp_one_out_of_two_validate {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both L1 I1 (f_group_type)) (zkp : both L2 I2 (t_OrZKPCommit (v_Z) (v_G))) : both (L1 :|: L2) (I1 :|: I2) ('bool) := - zkp_one_out_of_two_validate h zkp := - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_x zkp; - f_y zkp; - f_a1 zkp; - f_b1 zkp; - f_a2 zkp; - f_b2 zkp])))) in - solve_lift (andb (andb (andb (andb (c =.? (f_add (f_d1 zkp) (f_d2 zkp))) ((f_a1 zkp) =.? (f_prod (f_g_pow (f_r1 zkp)) (f_pow (f_x zkp) (f_d1 zkp))))) ((f_b1 zkp) =.? (f_prod (f_pow h (f_r1 zkp)) (f_pow (f_y zkp) (f_d1 zkp))))) ((f_a2 zkp) =.? (f_prod (f_g_pow (f_r2 zkp)) (f_pow (f_x zkp) (f_d2 zkp))))) ((f_b2 zkp) =.? (f_prod (f_pow h (f_r2 zkp)) (f_pow (f_div (f_y zkp) (f_g (ret_both (tt : 'unit)))) (f_d2 zkp))))) : both (L1 :|: L2) (I1 :|: I2) ('bool). -Fail Next Obligation. - -#[global] Program Instance t_z_89__t_Z_Field : t_Z_Field t_z_89_ := - let f_field_type := int32 : choice_type in - let f_q := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (89 : int32)) : both (L :|: fset []) I (int32) in - let f_random_field_elem := fun {L1 : {fset Location}} {I1 : Interface} (random : both L1 I1 (int32)) => solve_lift (random .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) : both (L1 :|: fset []) I1 (int32) in - let f_field_zero := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (0 : int32)) : both (L :|: fset []) I (int32) in - let f_field_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I (int32) in - let f_add := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .+ y) .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in - let f_sub := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (((x .+ ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) .- y) .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in - let f_mul := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift ((x .* y) .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in - {| f_field_type := (@f_field_type); - f_q_loc := (fset [] : {fset Location}); - f_q := (@f_q); - f_random_field_elem_loc := (fset [] : {fset Location}); - f_random_field_elem := (@f_random_field_elem); - f_field_zero_loc := (fset [] : {fset Location}); - f_field_zero := (@f_field_zero); - f_field_one_loc := (fset [] : {fset Location}); - f_field_one := (@f_field_one); - f_add_loc := (fset [] : {fset Location}); - f_add := (@f_add); - f_sub_loc := (fset [] : {fset Location}); - f_sub := (@f_sub); - f_mul_loc := (fset [] : {fset Location}); - f_mul := (@f_mul)|}. -Fail Next Obligation. -Hint Unfold t_z_89__t_Z_Field. - -Definition result_loc : Location := - (int32;10%nat). -Definition res_loc : Location := - (int32;9%nat). -#[global] Program Instance t_Group_curve_t_Group : t_Group t_Group_curve t_Z_curve := - let f_group_type := t_Group_curve : choice_type in - let f_g := fun {L : {fset Location}} {I : Interface} => letb gx := PBytes32 (array_from_list [ret_both (121 : int8); - ret_both (190 : int8); - ret_both (102 : int8); - ret_both (126 : int8); - ret_both (249 : int8); - ret_both (220 : int8); - ret_both (187 : int8); - ret_both (172 : int8); - ret_both (85 : int8); - ret_both (160 : int8); - ret_both (98 : int8); - ret_both (149 : int8); - ret_both (206 : int8); - ret_both (135 : int8); - ret_both (11 : int8); - ret_both (7 : int8); - ret_both (2 : int8); - ret_both (155 : int8); - ret_both (252 : int8); - ret_both (219 : int8); - ret_both (45 : int8); - ret_both (206 : int8); - ret_both (40 : int8); - ret_both (217 : int8); - ret_both (89 : int8); - ret_both (242 : int8); - ret_both (129 : int8); - ret_both (91 : int8); - ret_both (22 : int8); - ret_both (248 : int8); - ret_both (23 : int8); - ret_both (152 : int8)]) in - letb gy := PBytes32 (array_from_list [ret_both (72 : int8); - ret_both (58 : int8); - ret_both (218 : int8); - ret_both (119 : int8); - ret_both (38 : int8); - ret_both (163 : int8); - ret_both (196 : int8); - ret_both (101 : int8); - ret_both (93 : int8); - ret_both (164 : int8); - ret_both (251 : int8); - ret_both (252 : int8); - ret_both (14 : int8); - ret_both (17 : int8); - ret_both (8 : int8); - ret_both (168 : int8); - ret_both (253 : int8); - ret_both (23 : int8); - ret_both (180 : int8); - ret_both (72 : int8); - ret_both (166 : int8); - ret_both (133 : int8); - ret_both (84 : int8); - ret_both (25 : int8); - ret_both (156 : int8); - ret_both (71 : int8); - ret_both (208 : int8); - ret_both (143 : int8); - ret_both (251 : int8); - ret_both (16 : int8); - ret_both (212 : int8); - ret_both (184 : int8)]) in - solve_lift (Build_t_Group_curve (f_val := Point_Affine (prod_b (impl__FieldElement__from_public_byte_seq_be gx,impl__FieldElement__from_public_byte_seq_be gy)))) : both (L :|: fset []) I (t_Group_curve) in - let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (t_Group_curve)) (x : both L2 I2 (t_Z_curve)) => solve_lift (Build_t_Group_curve (f_val := point_mul (f_val x) (f_val g))) : both (L1 :|: L2 :|: fset [result_loc]) (I1 :|: I2) (t_Group_curve) in - let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Z_curve)) => solve_lift (Build_t_Group_curve (f_val := point_mul_base (f_val x))) : both (L1 :|: fset []) I1 (t_Group_curve) in - let f_group_one := fun {L : {fset Location}} {I : Interface} => solve_lift (f_g_pow (f_field_zero (ret_both (tt : 'unit)))) : both (L :|: fset []) I (t_Group_curve) in - let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Group_curve)) (y : both L2 I2 (t_Group_curve)) => solve_lift (Build_t_Group_curve (f_val := point_add (f_val x) (f_val y))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Group_curve) in - let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Group_curve)) => solve_lift x : both (L1 :|: fset []) I1 (t_Group_curve) in - let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (t_Group_curve)) (y : both L2 I2 (t_Group_curve)) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (t_Group_curve) in - let f_hash := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Vec (t_Group_curve) (t_Global))) => solve_lift (f_field_one (ret_both (tt : 'unit))) : both (L1 :|: fset [res_loc]) I1 (t_Z_curve) in - {| f_group_type := (@f_group_type); - f_g_loc := (fset [] : {fset Location}); - f_g := (@f_g); - f_pow_loc := (fset [result_loc] : {fset Location}); - f_pow := (@f_pow); - f_g_pow_loc := (fset [] : {fset Location}); - f_g_pow := (@f_g_pow); - f_group_one_loc := (fset [] : {fset Location}); - f_group_one := (@f_group_one); - f_prod_loc := (fset [] : {fset Location}); - f_prod := (@f_prod); - f_inv_loc := (fset [] : {fset Location}); - f_inv := (@f_inv); - f_div_loc := (fset [] : {fset Location}); - f_div := (@f_div); - f_hash_loc := (fset [res_loc] : {fset Location}); - f_hash := (@f_hash)|}. -Fail Next Obligation. -Hint Unfold t_Group_curve_t_Group. - -Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := - (nseq f_group_type (is_pure (n)) × nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n)) × nseq f_field_type (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n)) × int32). -Equations f_g_pow_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type (is_pure (n))) := - f_g_pow_xis s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). -Fail Next Obligation. -Equations f_zkp_xis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n))) := - f_zkp_xis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n))))) : both L I (nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n))). -Fail Next Obligation. -Equations f_commit_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq f_field_type (is_pure (n))) := - f_commit_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : nseq f_field_type (is_pure (n))))) : both L I (nseq f_field_type (is_pure (n))). -Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq f_group_type (is_pure (n))) := - f_g_pow_xi_yi_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type (is_pure (n))))) : both L I (nseq f_group_type (is_pure (n))). -Fail Next Obligation. -Equations f_zkp_vis {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n))) := - f_zkp_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n))))) : both L I (nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n))). -Fail Next Obligation. -Equations f_tally {L : {fset Location}} {I : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both L I (t_OvnContractState)) : both L I (int32) := - f_tally s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both L I (int32). -Fail Next Obligation. -Equations Build_t_OvnContractState {L0 : {fset Location}} {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {L4 : {fset Location}} {L5 : {fset Location}} {I0 : Interface} {I1 : Interface} {I2 : Interface} {I3 : Interface} {I4 : Interface} {I5 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_g_pow_xis : both L0 I0 (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both L1 I1 (nseq t_SchnorrZKPCommit (v_Z) (v_G) (is_pure (n)))} {f_commit_vis : both L2 I2 (nseq f_field_type (is_pure (n)))} {f_g_pow_xi_yi_vis : both L3 I3 (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both L4 I4 (nseq t_OrZKPCommit (v_Z) (v_G) (is_pure (n)))} {f_tally : both L5 I5 (int32)} : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState) := - Build_t_OvnContractState := - bind_both f_tally (fun f_tally => - bind_both f_zkp_vis (fun f_zkp_vis => - bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => - bind_both f_commit_vis (fun f_commit_vis => - bind_both f_zkp_xis (fun f_zkp_xis => - bind_both f_g_pow_xis (fun f_g_pow_xis => - solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (L0:|:L1:|:L2:|:L3:|:L4:|:L5) (I0:|:I1:|:I2:|:I3:|:I4:|:I5) (t_OvnContractState). -Fail Next Obligation. -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). - -Definition cast_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));2%nat). -Equations cast_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := - cast_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_ParseError)] (params:t_CastVoteParam (v_Z)) := impl__map_err out f_from in - Result_Ok (letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in - letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in - letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in - letb cast_vote_state_ret loc(cast_vote_state_ret_loc) := f_clone state in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),cast_vote_state_ret))))) : both (L1 :|: L2 :|: fset [cast_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). -Fail Next Obligation. - -Definition commit_to_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));3%nat). -Equations commit_to_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := - commit_to_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_ParseError)] (params:t_CastVoteParam (v_Z)) := impl__map_err out f_from in - Result_Ok (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => - ssp (fun _ => - solve_lift (ifb not (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist2 := v_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist2) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*0*)(L2:|:fset []) (I2) (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in - letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in - letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in - letb commit_vi := commit_to g_pow_xi_yi_vi in - letb commit_to_vote_state_ret loc(commit_to_vote_state_ret_loc) := f_clone state in - letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),commit_to_vote_state_ret))))) : both (L1 :|: L2 :|: fset [commit_to_vote_state_ret_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). -Fail Next Obligation. - -Equations init_ovn_contract {L1 : {fset Location}} {I1 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both L1 I1 ('unit)) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)) := - init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_u := f_group_one (ret_both (tt : 'unit))) (f_z := f_field_zero (ret_both (tt : 'unit))) (f_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_x := f_group_one (ret_both (tt : 'unit))) (f_y := f_group_one (ret_both (tt : 'unit))) (f_a1 := f_group_one (ret_both (tt : 'unit))) (f_b1 := f_group_one (ret_both (tt : 'unit))) (f_a2 := f_group_one (ret_both (tt : 'unit))) (f_b2 := f_group_one (ret_both (tt : 'unit))) (f_c := f_field_zero (ret_both (tt : 'unit))) (f_d1 := f_field_zero (ret_both (tt : 'unit))) (f_d2 := f_field_zero (ret_both (tt : 'unit))) (f_r1 := f_field_zero (ret_both (tt : 'unit))) (f_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both L1 I1 (t_Result (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size))) (t_Reject)). -Fail Next Obligation. - -Definition register_vote_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));4%nat). -Equations register_vote {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := - register_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_ParseError)] (params:t_RegisterParam (v_Z)) := impl__map_err out f_from in - Result_Ok (letb g_pow_xi := f_g_pow (f_rp_xi params) in - letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in - letb register_vote_state_ret loc(register_vote_state_ret_loc) := f_clone state in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in - Result_Ok (prod_b (f_accept (ret_both (tt : 'unit)),register_vote_state_ret))))) : both (L1 :|: L2 :|: fset [register_vote_state_ret_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). -Fail Next Obligation. - -Definition curr_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (f_field_type;5%nat). -Definition tally_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (int32;6%nat). -Definition tally_votes_state_ret_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size));7%nat). -Definition vote_result_loc {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} : Location := - (f_group_type;8%nat). -Equations tally_votes {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both L1 I1 (impl_574521470_)) (state : both L2 I2 (t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) := - tally_votes _ state := - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => - ssp (fun _ => - letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] _ := ControlFlow_Continue (ifb not (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist3 := v_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist3) - else ControlFlow_Continue (ret_both (tt : 'unit))) in - solve_lift (ifb not (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError))] hoist4 := v_Break (Result_Err ParseError) in - ControlFlow_Continue (never_to_any hoist4) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*2*)(L2:|:fset [prod1_loc;prod2_loc]) (I2) (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)) ('unit)))) (ret_both (tt : 'unit)) in - letb vote_result loc(vote_result_loc) := f_group_one (ret_both (tt : 'unit)) in - letb vote_result := foldi_both_list (f_into_iter (f_g_pow_xi_yi_vis state)) (fun g_pow_vote => - ssp (fun vote_result => - solve_lift (f_prod vote_result g_pow_vote) : both (*2*)(L2:|:L2:|:fset [vote_result_loc;vote_result_loc]) (I2:|:I2) (f_group_type))) vote_result in - letb tally loc(tally_loc) := ret_both (0 : int32) in - letb curr loc(curr_loc) := f_field_zero (ret_both (tt : 'unit)) in - letb '(curr,tally) := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => - ssp (fun '(curr,tally) => - letb tally := ifb (f_g_pow curr) =.? vote_result - then letb tally := i in - tally - else tally in - letb curr := f_add curr (f_field_one (ret_both (tt : 'unit))) in - solve_lift (prod_b (curr,tally)) : both (*5*)(L2:|:fset [curr_loc;tally_loc;vote_result_loc;curr_loc;tally_loc]) (I2) ((f_field_type × int32)))) (prod_b (curr,tally)) in - letb tally_votes_state_ret loc(tally_votes_state_ret_loc) := f_clone state in - letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in - Result_Ok (solve_lift (prod_b (f_accept (ret_both (tt : 'unit)),tally_votes_state_ret))) : both (L1 :|: L2 :|: fset [curr_loc;tally_loc;tally_votes_state_ret_loc;vote_result_loc;prod1_loc;prod2_loc]) (I1 :|: I2) (t_Result ((v_A × t_OvnContractState (v_Z) (v_G) (both (fset []) (fset []) (uint_size)))) (t_ParseError)). -Fail Next Obligation. - -Definition res_loc : Location := - (int32;9%nat). -Definition result_loc : Location := - (int32;10%nat). -#[global] Program Instance t_g_z_89__t_Group : t_Group t_g_z_89_ t_z_89_ := - let f_group_type := int32 : choice_type in - let f_g := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (3 : int32)) : both (L :|: fset []) I (int32) in - let f_hash := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (t_Vec (int32) (t_Global))) => letb res loc(res_loc) := f_field_one (ret_both (tt : 'unit)) in - letb res := foldi_both_list (f_into_iter x) (fun y => - ssp (fun res => - solve_lift (f_mul y res) : both (*2*)(L1:|:L1:|:fset [res_loc;res_loc]) (I1:|:I1) (int32))) res in - solve_lift res : both (L1 :|: fset [res_loc]) I1 (int32) in - let f_g_pow := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift (f_pow (f_g (ret_both (tt : 'unit))) x) : both (L1 :|: fset []) I1 (int32) in - let f_pow := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (g : both L1 I1 (int32)) (x : both L2 I2 (int32)) => letb result loc(result_loc) := f_group_one (ret_both (tt : 'unit)) in - letb result := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := x .% ((f_q (ret_both (tt : 'unit))) .- (ret_both (1 : int32)))))) (fun i => - ssp (fun result => - solve_lift (f_prod result g) : both (*2*)(L1:|:L2:|:L2:|:fset [result_loc;result_loc]) (I1:|:I2:|:I2) (int32))) result in - solve_lift result : both (L1 :|: L2 :|: fset [result_loc]) (I1 :|: I2) (int32) in - let f_group_one := fun {L : {fset Location}} {I : Interface} => solve_lift (ret_both (1 : int32)) : both (L :|: fset []) I (int32) in - let f_prod := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (((x .% (f_q (ret_both (tt : 'unit)))) .* (y .% (f_q (ret_both (tt : 'unit))))) .% (f_q (ret_both (tt : 'unit)))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in - let f_inv := fun {L1 : {fset Location}} {I1 : Interface} (x : both L1 I1 (int32)) => solve_lift (run (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := ret_both (89 : int32)))) (fun j => - ssp (fun _ => - solve_lift (ifb (f_prod x j) =.? (f_group_one (ret_both (tt : 'unit))) - then letm[choice_typeMonad.result_bind_code (int32)] hoist5 := v_Break j in - ControlFlow_Continue (never_to_any hoist5) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both (*0*)(L1:|:fset []) (I1) (t_ControlFlow (int32) ('unit)))) (ret_both (tt : 'unit)) in - letb _ := ifb not (ret_both (false : 'bool)) - then never_to_any (panic (ret_both (assertion failed: false : chString))) - else ret_both (tt : 'unit) in - letm[choice_typeMonad.result_bind_code (int32)] hoist6 := v_Break x in - ControlFlow_Continue (never_to_any hoist6))) : both (L1 :|: fset []) I1 (int32) in - let f_div := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (x : both L1 I1 (int32)) (y : both L2 I2 (int32)) => solve_lift (f_prod x (f_inv y)) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) (int32) in - {| f_group_type := (@f_group_type); - f_g_loc := (fset [] : {fset Location}); - f_g := (@f_g); - f_hash_loc := (fset [res_loc] : {fset Location}); - f_hash := (@f_hash); - f_g_pow_loc := (fset [] : {fset Location}); - f_g_pow := (@f_g_pow); - f_pow_loc := (fset [result_loc] : {fset Location}); - f_pow := (@f_pow); - f_group_one_loc := (fset [] : {fset Location}); - f_group_one := (@f_group_one); - f_prod_loc := (fset [] : {fset Location}); - f_prod := (@f_prod); - f_inv_loc := (fset [] : {fset Location}); - f_inv := (@f_inv); - f_div_loc := (fset [] : {fset Location}); - f_div := (@f_div)|}. -Fail Next Obligation. -Hint Unfold t_g_z_89__t_Group. - -(** Concert lib part **) -From ConCert.Utils Require Import Extras. -Export Extras. -From ConCert.Utils Require Import Automation. -Export Automation. -From ConCert.Execution Require Import Serializable. -Export Serializable. -From ConCert.Execution Require Import Blockchain. -Export Blockchain. -From ConCert.Execution Require Import ContractCommon. -Export ContractCommon. -From ConCert.Execution Require Import Serializable. -Export Serializable. -Require Import ConCertLib. -Export ConCertLib. - -Definition state_OVN : choice_type := - t_OvnContractState. - -#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := - {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := - fun x => - x. -Fail Next Obligation. -Definition receive_OVN_cast_vote {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - cast_vote ctx st. - -#[global] Program Instance t_CastVoteParam_t_HasReceiveContext : t_HasReceiveContext t_CastVoteParam 'unit := - {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := - fun x => - x. -Fail Next Obligation. -Definition receive_OVN_commit_to_vote {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_CastVoteParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - commit_to_vote ctx st. - -Definition init_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN) (t_ParseError) := - ResultMonad.Ok st. - -#[global] Program Instance t_RegisterParam_t_HasReceiveContext : t_HasReceiveContext t_RegisterParam 'unit := - {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_RegisterParam_t_Sized : t_Sized t_RegisterParam := - fun x => - x. -Fail Next Obligation. -Definition receive_OVN_register {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_RegisterParam)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - register_vote ctx st. - -#[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := - {| f_get := (fun {Ctx : _} {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_TallyParameter_t_Sized : t_Sized t_TallyParameter := - fun x => - x. -Fail Next Obligation. -Definition receive_OVN_tally {v_Z : _} {v_G : _} {n : both (fset []) (fset []) (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} {L0 : {fset Location}} {L1 : {fset Location}} {I0 : Interface} {I1 : Interface} (ctx : both L0 I0 (t_TallyParameter)) (st : both L1 I1 (state_OVN)) : both _ _ (t_Result ((v_A × state_OVN)) (t_ParseError)) := - tally_votes ctx st. - -Inductive Msg_OVN: Type := -| msg_OVN_cast_vote : t_CastVoteParam -> Msg_OVN -| msg_OVN_commit_to_vote : t_CastVoteParam -> Msg_OVN -| msg_OVN_register : t_RegisterParam -> Msg_OVN -| msg_OVN_tally : t_TallyParameter -> Msg_OVN. -#[global] Program Instance state_OVN_t_HasReceiveContext : t_HasReceiveContext state_OVN 'unit := - {| f_get := (fun (Ctx : _) {L : {fset Location}} {I : Interface} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance state_OVN_t_Sized : t_Sized state_OVN := - fun x => - x. -Fail Next Obligation. -#[global] Program Instance state_OVN_t_HasActions : t_HasActions state_OVN := - Admitted. -Fail Next Obligation. -Equations receive_OVN (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) (msg : Datatypes.option Msg_OVN) : ResultMonad.result (state_OVN * list ActionBody) t_ParseError := - receive_OVN chain ctx st msg := - match msg with - | Some (msg_OVN_cast_vote val) => - match (is_pure (both_prog (receive_OVN_cast_vote (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_OVN_commit_to_vote val) => - match (is_pure (both_prog (receive_OVN_commit_to_vote (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_OVN_register val) => - match (is_pure (both_prog (receive_OVN_register (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_OVN_tally val) => - match (is_pure (both_prog (receive_OVN_tally (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((fst x), []) - | inr x => ResultMonad.Err x - end - | _ => - ResultMonad.Err tt - end : ResultMonad.result (state_OVN * list ActionBody) t_ParseError. -Fail Next Obligation. -#[global] Program Instance state_OVN_Serializable : Serializable state_OVN := - _. -Fail Next Obligation. -#[global] Program Instance Msg_OVN_Serializable : Serializable Msg_OVN := - Derive Serializable Msg_OVN_rect. -Fail Next Obligation. -Definition contract_OVN : Contract (state_OVN) (Msg_OVN) (state_OVN) (t_ParseError) := - build_contract init_OVN receive_OVN. diff --git a/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_no_mem.v b/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_no_mem.v deleted file mode 100644 index 023ce1b..0000000 --- a/ovn/proofs/ssprove/extraction/Hacspec_ovn_group_no_mem.v +++ /dev/null @@ -1,608 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Require Import Hacspec_ovn_Ovn_traits. -Export Hacspec_ovn_Ovn_traits. - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -(*Not implemented yet? todo(item)*) - -Equations compute_group_element_for_vote {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (xi : both (f_field_type)) (vote : both ('bool)) (g_pow_yi : both (f_group_type)) : both (f_group_type) := - compute_group_element_for_vote xi vote g_pow_yi := - solve_lift (f_prod (f_pow g_pow_yi xi) (f_g_pow (ifb vote - then f_field_one (ret_both (tt : 'unit)) - else f_field_zero (ret_both (tt : 'unit))))) : both (f_group_type). -Fail Next Obligation. - -Equations select_private_voting_key {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (random : both (int32)) : both (f_field_type) := - select_private_voting_key random := - solve_lift (f_random_field_elem random) : both (f_field_type). -Fail Next Obligation. - -Equations compute_g_pow_yi {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (i : both (uint_size)) (xis : both (nseq f_group_type (is_pure (n)))) : both (f_group_type) := - compute_g_pow_yi i xis := - letb prod1 := f_group_one (ret_both (tt : 'unit)) in - letb prod1 := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := i))) (fun j => - ssp (fun prod1 => - solve_lift (f_prod prod1 (xis.a[j])) : both (f_group_type))) prod1 in - letb prod2 := f_group_one (ret_both (tt : 'unit)) in - letb prod2 := foldi_both_list (f_into_iter (Build_t_Range (f_start := i .+ (ret_both (1 : uint_size))) (f_end := n))) (fun j => - ssp (fun prod2 => - solve_lift (f_prod prod2 (xis.a[j])) : both (f_group_type))) prod2 in - solve_lift (f_div prod1 prod2) : both (f_group_type). -Solve All Obligations with now intros ; destruct from_uint_size. -Fail Next Obligation. - -Equations check_commitment {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both (f_group_type)) (commitment : both (f_field_type)) : both ('bool) := - check_commitment g_pow_xi_yi_vi commitment := - solve_lift ((f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) =.? commitment) : both ('bool). -Fail Next Obligation. - -Equations commit_to {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (g_pow_xi_yi_vi : both (f_group_type)) : both (f_field_type) := - commit_to g_pow_xi_yi_vi := - solve_lift (f_hash (impl__into_vec (unsize (box_new (array_from_list [g_pow_xi_yi_vi]))))) : both (f_field_type). -Fail Next Obligation. - -Definition t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := - (int32 × f_field_type × int32 × int32 × int32 × 'bool). -Equations f_cvp_i {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := - f_cvp_i s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : int32))) : both (int32). -Fail Next Obligation. -Equations f_cvp_xi {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (f_field_type) := - f_cvp_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both (f_field_type). -Fail Next Obligation. -Equations f_cvp_zkp_random_w {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := - f_cvp_zkp_random_w s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : int32))) : both (int32). -Fail Next Obligation. -Equations f_cvp_zkp_random_r {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := - f_cvp_zkp_random_r s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : int32))) : both (int32). -Fail Next Obligation. -Equations f_cvp_zkp_random_d {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both (int32) := - f_cvp_zkp_random_d s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : int32))) : both (int32). -Fail Next Obligation. -Equations f_cvp_vote {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_CastVoteParam)) : both ('bool) := - f_cvp_vote s := - bind_both s (fun x => - solve_lift (ret_both (snd x : 'bool))) : both ('bool). -Fail Next Obligation. -Equations Build_t_CastVoteParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_cvp_i : both (int32)} {f_cvp_xi : both (f_field_type)} {f_cvp_zkp_random_w : both (int32)} {f_cvp_zkp_random_r : both (int32)} {f_cvp_zkp_random_d : both (int32)} {f_cvp_vote : both ('bool)} : both (t_CastVoteParam) := - Build_t_CastVoteParam := - bind_both f_cvp_vote (fun f_cvp_vote => - bind_both f_cvp_zkp_random_d (fun f_cvp_zkp_random_d => - bind_both f_cvp_zkp_random_r (fun f_cvp_zkp_random_r => - bind_both f_cvp_zkp_random_w (fun f_cvp_zkp_random_w => - bind_both f_cvp_xi (fun f_cvp_xi => - bind_both f_cvp_i (fun f_cvp_i => - solve_lift (ret_both ((f_cvp_i,f_cvp_xi,f_cvp_zkp_random_w,f_cvp_zkp_random_r,f_cvp_zkp_random_d,f_cvp_vote) : (t_CastVoteParam))))))))) : both (t_CastVoteParam). -Fail Next Obligation. -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_i' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := y) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_xi' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := y) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_w' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := y) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_r' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := y) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_zkp_random_d' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := y) (f_cvp_vote := f_cvp_vote x)). -Notation "'Build_t_CastVoteParam' '[' x ']' '(' 'f_cvp_vote' ':=' y ')'" := (Build_t_CastVoteParam (f_cvp_i := f_cvp_i x) (f_cvp_xi := f_cvp_xi x) (f_cvp_zkp_random_w := f_cvp_zkp_random_w x) (f_cvp_zkp_random_r := f_cvp_zkp_random_r x) (f_cvp_zkp_random_d := f_cvp_zkp_random_d x) (f_cvp_vote := y)). - -Definition t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := - (f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_group_type × f_field_type × f_field_type × f_field_type × f_field_type × f_field_type). -Equations f_or_zkp_x {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := - f_or_zkp_x s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both (f_group_type). -Fail Next Obligation. -Equations f_or_zkp_y {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := - f_or_zkp_y s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst (fst x))))))))) : f_group_type))) : both (f_group_type). -Fail Next Obligation. -Equations f_or_zkp_a1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := - f_or_zkp_a1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst (fst x)))))))) : f_group_type))) : both (f_group_type). -Fail Next Obligation. -Equations f_or_zkp_b1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := - f_or_zkp_b1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst (fst x))))))) : f_group_type))) : both (f_group_type). -Fail Next Obligation. -Equations f_or_zkp_a2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := - f_or_zkp_a2 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst (fst x)))))) : f_group_type))) : both (f_group_type). -Fail Next Obligation. -Equations f_or_zkp_b2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_group_type) := - f_or_zkp_b2 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst (fst x))))) : f_group_type))) : both (f_group_type). -Fail Next Obligation. -Equations f_or_zkp_c {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := - f_or_zkp_c s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : f_field_type))) : both (f_field_type). -Fail Next Obligation. -Equations f_or_zkp_d1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := - f_or_zkp_d1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : f_field_type))) : both (f_field_type). -Fail Next Obligation. -Equations f_or_zkp_d2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := - f_or_zkp_d2 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : f_field_type))) : both (f_field_type). -Fail Next Obligation. -Equations f_or_zkp_r1 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := - f_or_zkp_r1 s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). -Fail Next Obligation. -Equations f_or_zkp_r2 {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OrZKPCommit)) : both (f_field_type) := - f_or_zkp_r2 s := - bind_both s (fun x => - solve_lift (ret_both (snd x : f_field_type))) : both (f_field_type). -Fail Next Obligation. -Equations Build_t_OrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_or_zkp_x : both (f_group_type)} {f_or_zkp_y : both (f_group_type)} {f_or_zkp_a1 : both (f_group_type)} {f_or_zkp_b1 : both (f_group_type)} {f_or_zkp_a2 : both (f_group_type)} {f_or_zkp_b2 : both (f_group_type)} {f_or_zkp_c : both (f_field_type)} {f_or_zkp_d1 : both (f_field_type)} {f_or_zkp_d2 : both (f_field_type)} {f_or_zkp_r1 : both (f_field_type)} {f_or_zkp_r2 : both (f_field_type)} : both (t_OrZKPCommit) := - Build_t_OrZKPCommit := - bind_both f_or_zkp_r2 (fun f_or_zkp_r2 => - bind_both f_or_zkp_r1 (fun f_or_zkp_r1 => - bind_both f_or_zkp_d2 (fun f_or_zkp_d2 => - bind_both f_or_zkp_d1 (fun f_or_zkp_d1 => - bind_both f_or_zkp_c (fun f_or_zkp_c => - bind_both f_or_zkp_b2 (fun f_or_zkp_b2 => - bind_both f_or_zkp_a2 (fun f_or_zkp_a2 => - bind_both f_or_zkp_b1 (fun f_or_zkp_b1 => - bind_both f_or_zkp_a1 (fun f_or_zkp_a1 => - bind_both f_or_zkp_y (fun f_or_zkp_y => - bind_both f_or_zkp_x (fun f_or_zkp_x => - solve_lift (ret_both ((f_or_zkp_x,f_or_zkp_y,f_or_zkp_a1,f_or_zkp_b1,f_or_zkp_a2,f_or_zkp_b2,f_or_zkp_c,f_or_zkp_d1,f_or_zkp_d2,f_or_zkp_r1,f_or_zkp_r2) : (t_OrZKPCommit)))))))))))))) : both (t_OrZKPCommit). -Fail Next Obligation. -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_x' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := y) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_y' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := y) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := y) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := y) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_a2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := y) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_b2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := y) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_c' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := y) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := y) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_d2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := y) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r1' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := y) (f_or_zkp_r2 := f_or_zkp_r2 x)). -Notation "'Build_t_OrZKPCommit' '[' x ']' '(' 'f_or_zkp_r2' ':=' y ')'" := (Build_t_OrZKPCommit (f_or_zkp_x := f_or_zkp_x x) (f_or_zkp_y := f_or_zkp_y x) (f_or_zkp_a1 := f_or_zkp_a1 x) (f_or_zkp_b1 := f_or_zkp_b1 x) (f_or_zkp_a2 := f_or_zkp_a2 x) (f_or_zkp_b2 := f_or_zkp_b2 x) (f_or_zkp_c := f_or_zkp_c x) (f_or_zkp_d1 := f_or_zkp_d1 x) (f_or_zkp_d2 := f_or_zkp_d2 x) (f_or_zkp_r1 := f_or_zkp_r1 x) (f_or_zkp_r2 := y)). - -Definition t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} : choice_type := - (int32 × f_field_type × int32). -Equations f_rp_i {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_RegisterParam)) : both (int32) := - f_rp_i s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : int32))) : both (int32). -Fail Next Obligation. -Equations f_rp_xi {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_RegisterParam)) : both (f_field_type) := - f_rp_xi s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). -Fail Next Obligation. -Equations f_rp_zkp_random {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} (s : both (t_RegisterParam)) : both (int32) := - f_rp_zkp_random s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both (int32). -Fail Next Obligation. -Equations Build_t_RegisterParam {v_Z : _} `{ t_Sized (v_Z)} `{ t_Z_Field (v_Z)} {f_rp_i : both (int32)} {f_rp_xi : both (f_field_type)} {f_rp_zkp_random : both (int32)} : both (t_RegisterParam) := - Build_t_RegisterParam := - bind_both f_rp_zkp_random (fun f_rp_zkp_random => - bind_both f_rp_xi (fun f_rp_xi => - bind_both f_rp_i (fun f_rp_i => - solve_lift (ret_both ((f_rp_i,f_rp_xi,f_rp_zkp_random) : (t_RegisterParam)))))) : both (t_RegisterParam). -Fail Next Obligation. -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_i' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := y) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := f_rp_zkp_random x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_xi' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := y) (f_rp_zkp_random := f_rp_zkp_random x)). -Notation "'Build_t_RegisterParam' '[' x ']' '(' 'f_rp_zkp_random' ':=' y ')'" := (Build_t_RegisterParam (f_rp_i := f_rp_i x) (f_rp_xi := f_rp_xi x) (f_rp_zkp_random := y)). - -Definition t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := - (f_group_type × f_field_type × f_field_type). -Equations f_schnorr_zkp_u {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_SchnorrZKPCommit)) : both (f_group_type) := - f_schnorr_zkp_u s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst x) : f_group_type))) : both (f_group_type). -Fail Next Obligation. -Equations f_schnorr_zkp_c {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_SchnorrZKPCommit)) : both (f_field_type) := - f_schnorr_zkp_c s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : f_field_type))) : both (f_field_type). -Fail Next Obligation. -Equations f_schnorr_zkp_z {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_SchnorrZKPCommit)) : both (f_field_type) := - f_schnorr_zkp_z s := - bind_both s (fun x => - solve_lift (ret_both (snd x : f_field_type))) : both (f_field_type). -Fail Next Obligation. -Equations Build_t_SchnorrZKPCommit {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_schnorr_zkp_u : both (f_group_type)} {f_schnorr_zkp_c : both (f_field_type)} {f_schnorr_zkp_z : both (f_field_type)} : both (t_SchnorrZKPCommit) := - Build_t_SchnorrZKPCommit := - bind_both f_schnorr_zkp_z (fun f_schnorr_zkp_z => - bind_both f_schnorr_zkp_c (fun f_schnorr_zkp_c => - bind_both f_schnorr_zkp_u (fun f_schnorr_zkp_u => - solve_lift (ret_both ((f_schnorr_zkp_u,f_schnorr_zkp_c,f_schnorr_zkp_z) : (t_SchnorrZKPCommit)))))) : both (t_SchnorrZKPCommit). -Fail Next Obligation. -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_u' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := y) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_c' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := y) (f_schnorr_zkp_z := f_schnorr_zkp_z x)). -Notation "'Build_t_SchnorrZKPCommit' '[' x ']' '(' 'f_schnorr_zkp_z' ':=' y ')'" := (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_schnorr_zkp_u x) (f_schnorr_zkp_c := f_schnorr_zkp_c x) (f_schnorr_zkp_z := y)). - -Definition t_TallyParameter : choice_type := - 'unit. -Equations Build_t_TallyParameter : both (t_TallyParameter) := - Build_t_TallyParameter := - solve_lift (ret_both (tt (* Empty tuple *) : (t_TallyParameter))) : both (t_TallyParameter). -Fail Next Obligation. - -Equations schnorr_zkp {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random : both (int32)) (h : both (f_group_type)) (x : both (f_field_type)) : both (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) := - schnorr_zkp random h x := - solve_lift (run (letb r := f_random_field_elem random in - letb u := f_g_pow r in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); - h; - u])))) in - letb z := f_add r (f_mul c x) in - letm[choice_typeMonad.result_bind_code (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))] hoist1 := v_Break (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := u) (f_schnorr_zkp_c := c) (f_schnorr_zkp_z := z)) in - ControlFlow_Continue (never_to_any hoist1))) : both (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)). -Fail Next Obligation. - -Equations schnorr_zkp_validate {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both (f_group_type)) (pi : both (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both ('bool) := - schnorr_zkp_validate h pi := - solve_lift (andb ((f_schnorr_zkp_c pi) =.? (f_hash (impl__into_vec (unsize (box_new (array_from_list [f_g (ret_both (tt : 'unit)); - h; - f_schnorr_zkp_u pi])))))) ((f_g_pow (f_schnorr_zkp_z pi)) =.? (f_prod (f_schnorr_zkp_u pi) (f_pow h (f_schnorr_zkp_c pi))))) : both ('bool). -Fail Next Obligation. - -Equations zkp_one_out_of_two {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (random_w : both (int32)) (random_r : both (int32)) (random_d : both (int32)) (h : both (f_group_type)) (xi : both (f_field_type)) (vi : both ('bool)) : both (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) := - zkp_one_out_of_two random_w random_r random_d h xi vi := - letb w := f_random_field_elem random_w in - solve_lift (ifb vi - then letb r1 := f_random_field_elem random_r in - letb d1 := f_random_field_elem random_d in - letb x := f_g_pow xi in - letb y := f_prod (f_pow h xi) (f_g (ret_both (tt : 'unit))) in - letb a1 := f_prod (f_g_pow r1) (f_pow x d1) in - letb b1 := f_prod (f_pow h r1) (f_pow y d1) in - letb a2 := f_g_pow w in - letb b2 := f_pow h w in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; - y; - a1; - b1; - a2; - b2])))) in - letb d2 := f_sub c d1 in - letb r2 := f_sub w (f_mul xi d2) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2) - else letb r2 := f_random_field_elem random_r in - letb d2 := f_random_field_elem random_d in - letb x := f_g_pow xi in - letb y := f_pow h xi in - letb a1 := f_g_pow w in - letb b1 := f_pow h w in - letb a2 := f_prod (f_g_pow r2) (f_pow x d2) in - letb b2 := f_prod (f_pow h r2) (f_pow (f_div y (f_g (ret_both (tt : 'unit)))) d2) in - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [x; - y; - a1; - b1; - a2; - b2])))) in - letb d1 := f_sub c d2 in - letb r1 := f_sub w (f_mul xi d1) in - Build_t_OrZKPCommit (f_or_zkp_x := x) (f_or_zkp_y := y) (f_or_zkp_a1 := a1) (f_or_zkp_b1 := b1) (f_or_zkp_a2 := a2) (f_or_zkp_b2 := b2) (f_or_zkp_c := c) (f_or_zkp_d1 := d1) (f_or_zkp_d2 := d2) (f_or_zkp_r1 := r1) (f_or_zkp_r2 := r2)) : both (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)). -Fail Next Obligation. - -Equations zkp_one_out_of_two_validate {v_Z : _} {v_G : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (h : both (f_group_type)) (zkp : both (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G))) : both ('bool) := - zkp_one_out_of_two_validate h zkp := - letb c := f_hash (impl__into_vec (unsize (box_new (array_from_list [f_or_zkp_x zkp; - f_or_zkp_y zkp; - f_or_zkp_a1 zkp; - f_or_zkp_b1 zkp; - f_or_zkp_a2 zkp; - f_or_zkp_b2 zkp])))) in - solve_lift (andb (andb (andb (andb (c =.? (f_add (f_or_zkp_d1 zkp) (f_or_zkp_d2 zkp))) ((f_or_zkp_a1 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_b1 zkp) =.? (f_prod (f_pow h (f_or_zkp_r1 zkp)) (f_pow (f_or_zkp_y zkp) (f_or_zkp_d1 zkp))))) ((f_or_zkp_a2 zkp) =.? (f_prod (f_g_pow (f_or_zkp_r2 zkp)) (f_pow (f_or_zkp_x zkp) (f_or_zkp_d2 zkp))))) ((f_or_zkp_b2 zkp) =.? (f_prod (f_pow h (f_or_zkp_r2 zkp)) (f_pow (f_div (f_or_zkp_y zkp) (f_g (ret_both (tt : 'unit)))) (f_or_zkp_d2 zkp))))) : both ('bool). -Fail Next Obligation. - -Definition t_OvnContractState {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := - (nseq f_group_type (is_pure (n)) × nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × nseq f_field_type (is_pure (n)) × nseq f_group_type (is_pure (n)) × nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)) × int32). -Equations f_g_pow_xis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq f_group_type (is_pure (n))) := - f_g_pow_xis s := - bind_both s (fun x => - solve_lift (ret_both (fst (fst (fst (fst (fst x)))) : nseq f_group_type (is_pure (n))))) : both (nseq f_group_type (is_pure (n))). -Fail Next Obligation. -Equations f_zkp_xis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := - f_zkp_xis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst (fst x)))) : nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). -Fail Next Obligation. -Equations f_commit_vis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq f_field_type (is_pure (n))) := - f_commit_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst (fst x))) : nseq f_field_type (is_pure (n))))) : both (nseq f_field_type (is_pure (n))). -Fail Next Obligation. -Equations f_g_pow_xi_yi_vis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq f_group_type (is_pure (n))) := - f_g_pow_xi_yi_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst (fst x)) : nseq f_group_type (is_pure (n))))) : both (nseq f_group_type (is_pure (n))). -Fail Next Obligation. -Equations f_zkp_vis {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))) := - f_zkp_vis s := - bind_both s (fun x => - solve_lift (ret_both (snd (fst x) : nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))))) : both (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n))). -Fail Next Obligation. -Equations f_tally {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (s : both (t_OvnContractState (n := n))) : both (int32) := - f_tally s := - bind_both s (fun x => - solve_lift (ret_both (snd x : int32))) : both (int32). -Fail Next Obligation. -Equations Build_t_OvnContractState {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {f_g_pow_xis : both (nseq f_group_type (is_pure (n)))} {f_zkp_xis : both (nseq (t_SchnorrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_commit_vis : both (nseq f_field_type (is_pure (n)))} {f_g_pow_xi_yi_vis : both (nseq f_group_type (is_pure (n)))} {f_zkp_vis : both (nseq (t_OrZKPCommit (v_Z := v_Z) (v_G := v_G)) (is_pure (n)))} {f_tally : both (int32)} : both (t_OvnContractState (n := n)) := - Build_t_OvnContractState := - bind_both f_tally (fun f_tally => - bind_both f_zkp_vis (fun f_zkp_vis => - bind_both f_g_pow_xi_yi_vis (fun f_g_pow_xi_yi_vis => - bind_both f_commit_vis (fun f_commit_vis => - bind_both f_zkp_xis (fun f_zkp_xis => - bind_both f_g_pow_xis (fun f_g_pow_xis => - solve_lift (ret_both ((f_g_pow_xis,f_zkp_xis,f_commit_vis,f_g_pow_xi_yi_vis,f_zkp_vis,f_tally) : (t_OvnContractState))))))))) : both (t_OvnContractState). -Fail Next Obligation. -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := y) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_xis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := y) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_commit_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := y) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_g_pow_xi_yi_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := y) (f_zkp_vis := f_zkp_vis x) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_zkp_vis' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := y) (f_tally := f_tally x)). -Notation "'Build_t_OvnContractState' '[' x ']' '(' 'f_tally' ':=' y ')'" := (Build_t_OvnContractState (f_g_pow_xis := f_g_pow_xis x) (f_zkp_xis := f_zkp_xis x) (f_commit_vis := f_commit_vis x) (f_g_pow_xi_yi_vis := f_g_pow_xi_yi_vis x) (f_zkp_vis := f_zkp_vis x) (f_tally := y)). - -Equations cast_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := - cast_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with - | Result_Ok_case x => - letb x := ret_both ((x) : _ (* (t_CastVoteParam (v_Z)) *)) in - ControlFlow_Continue (solve_lift x) - | Result_Err_case x => - letb x := ret_both ((x) : (t_ParseError)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist2 := v_Break (Result_Err (ret_both tt)) in - ControlFlow_Continue (solve_lift (never_to_any hoist2)) - end in - ControlFlow_Continue (letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in - letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in - letb zkp_vi := zkp_one_out_of_two (f_cvp_zkp_random_w params) (f_cvp_zkp_random_r params) (f_cvp_zkp_random_d params) g_pow_yi (f_cvp_xi params) (f_cvp_vote params) in - letb cast_vote_state_ret := f_clone state in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_g_pow_xi_yi_vis := update_at_usize (f_g_pow_xi_yi_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) g_pow_xi_yi_vi) in - letb cast_vote_state_ret := Build_t_OvnContractState[cast_vote_state_ret] (f_zkp_vis := update_at_usize (f_zkp_vis cast_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) zkp_vi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),cast_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). -Fail Next Obligation. - -Equations commit_to_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := - commit_to_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_CastVoteParam (v_Z)) := matchb out with - | Result_Ok_case x => - letb x := ret_both ((x) : _ (* (t_CastVoteParam (v_Z)) *)) in - ControlFlow_Continue (solve_lift x) - | Result_Err_case x => - letb x := ret_both ((x) : (t_ParseError)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist3 := v_Break (Result_Err (ret_both tt)) in - ControlFlow_Continue (solve_lift (never_to_any hoist3)) - end in - ControlFlow_Continue (letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => - ssp (fun _ => - solve_lift (ifb negb (schnorr_zkp_validate ((f_g_pow_xis state).a[i]) ((f_zkp_xis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist4 := v_Break (Result_Err (ret_both tt)) in - ControlFlow_Continue (never_to_any hoist4) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in - letb g_pow_yi := compute_g_pow_yi (cast_int (WS2 := _) (f_cvp_i params)) (f_g_pow_xis state) in - letb g_pow_xi_yi_vi := compute_group_element_for_vote (f_cvp_xi params) (f_cvp_vote params) g_pow_yi in - letb commit_vi := commit_to g_pow_xi_yi_vi in - letb commit_to_vote_state_ret := f_clone state in - letb commit_to_vote_state_ret := Build_t_OvnContractState[commit_to_vote_state_ret] (f_commit_vis := update_at_usize (f_commit_vis commit_to_vote_state_ret) (cast_int (WS2 := _) (f_cvp_i params)) commit_vi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),commit_to_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). -Solve All Obligations with now intros ; destruct from_uint_size. -Fail Next Obligation. - -Equations init_ovn_contract {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} (_ : both ('unit)) : both (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)) := - init_ovn_contract _ := - Result_Ok (solve_lift (Build_t_OvnContractState (f_g_pow_xis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_xis := repeat (Build_t_SchnorrZKPCommit (f_schnorr_zkp_u := f_group_one (ret_both (tt : 'unit))) (f_schnorr_zkp_z := f_field_zero (ret_both (tt : 'unit))) (f_schnorr_zkp_c := f_field_zero (ret_both (tt : 'unit)))) n) (f_commit_vis := repeat (f_field_zero (ret_both (tt : 'unit))) n) (f_g_pow_xi_yi_vis := repeat (f_group_one (ret_both (tt : 'unit))) n) (f_zkp_vis := repeat (Build_t_OrZKPCommit (f_or_zkp_x := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_y := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b1 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_a2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_b2 := f_group_one (ret_both (tt : 'unit))) (f_or_zkp_c := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_d2 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r1 := f_field_zero (ret_both (tt : 'unit))) (f_or_zkp_r2 := f_field_zero (ret_both (tt : 'unit)))) n) (f_tally := ret_both (0 : int32)))) : both (t_Result (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n)) (t_Reject)). -Fail Next Obligation. - -Equations register_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (ctx : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := - register_vote ctx state := - solve_lift (run (letb '(_,out) := f_get (f_parameter_cursor ctx) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] (params : t_RegisterParam (v_Z)) := matchb out with - | Result_Ok_case x => - letb x := ret_both ((x) : _ (* (t_RegisterParam (v_Z)) *)) in - ControlFlow_Continue (solve_lift x) - | Result_Err_case x => - letb x := ret_both ((x) : (t_ParseError)) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist5 := v_Break (Result_Err (ret_both tt)) in - ControlFlow_Continue (solve_lift (never_to_any hoist5)) - end in - ControlFlow_Continue (letb g_pow_xi := f_g_pow (f_rp_xi params) in - letb zkp_xi := schnorr_zkp (f_rp_zkp_random params) g_pow_xi (f_rp_xi params) in - letb register_vote_state_ret := f_clone state in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_g_pow_xis := update_at_usize (f_g_pow_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) g_pow_xi) in - letb register_vote_state_ret := Build_t_OvnContractState[register_vote_state_ret] (f_zkp_xis := update_at_usize (f_zkp_xis register_vote_state_ret) (cast_int (WS2 := _) (f_rp_i params)) zkp_xi) in - Result_Ok (prod_b (f_accept (* (ret_both (tt : 'unit)) *),register_vote_state_ret))))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). -Fail Next Obligation. - -Equations tally_votes {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} {impl_574521470_ : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Sized (impl_574521470_)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} `{ t_HasReceiveContext (impl_574521470_) ('unit)} (_ : both (impl_574521470_)) (state : both (t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) := - tally_votes _ state := - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n))) (fun i => - ssp (fun _ => - letb g_pow_yi := compute_g_pow_yi i (f_g_pow_xis state) in - letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] _ := ControlFlow_Continue (ifb negb (zkp_one_out_of_two_validate g_pow_yi ((f_zkp_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist6 := v_Break (Result_Err (ret_both tt)) in - ControlFlow_Continue (never_to_any hoist6) - else ControlFlow_Continue (ret_both (tt : 'unit))) in - solve_lift (ifb negb (check_commitment ((f_g_pow_xi_yi_vis state).a[i]) ((f_commit_vis state).a[i])) - then letm[choice_typeMonad.result_bind_code (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError))] hoist7 := v_Break (Result_Err (ret_both tt)) in - ControlFlow_Continue (never_to_any hoist7) - else ControlFlow_Continue (ret_both (tt : 'unit))) : both _ (* (t_ControlFlow (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)) ('unit)) *))) (Ok (ret_both (tt : 'unit))) in - letb vote_result := f_group_one (ret_both (tt : 'unit)) in - letb vote_result := foldi_both_list ((* f_into_iter *) (array_to_list (f_g_pow_xi_yi_vis state))) (fun g_pow_vote => - ssp (fun vote_result => - solve_lift (f_prod vote_result g_pow_vote) : both (f_group_type))) vote_result in - letb tally := ret_both (0 : int32) in - letb curr := f_field_zero (ret_both (tt : 'unit)) in - letb '(curr,tally) := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := cast_int (WS2 := _) n))) (fun i => - ssp (fun '(curr,tally) => - letb tally := ifb (f_g_pow curr) =.? vote_result - then letb tally := i in - tally - else tally in - letb curr := f_add curr (f_field_one (ret_both (tt : 'unit))) in - solve_lift (prod_b (curr,tally)) : both ((f_field_type × int32)))) (prod_b (curr,tally)) in - letb tally_votes_state_ret := f_clone state in - letb tally_votes_state_ret := Build_t_OvnContractState[tally_votes_state_ret] (f_tally := tally) in - Result_Ok (solve_lift (prod_b (f_accept (* (ret_both (tt : 'unit)) *),tally_votes_state_ret))) : both (t_Result ((v_A × t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n))) (t_ParseError)). -Solve All Obligations with now intros ; destruct from_uint_size. -Fail Next Obligation. - -(** Concert lib part **) -From ConCert.Utils Require Import Extras. -Export Extras. -From ConCert.Utils Require Import Automation. -Export Automation. -From ConCert.Execution Require Import Serializable. -Export Serializable. -From ConCert.Execution Require Import Blockchain. -Export Blockchain. -From ConCert.Execution Require Import ContractCommon. -Export ContractCommon. -From ConCert.Execution Require Import Serializable. -Export Serializable. -From Hacspec Require Import ConCertLib. -Export ConCertLib. - -Definition state_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : choice_type := - t_OvnContractState (v_Z := v_Z) (v_G := v_G) (n := n). - -#[global] Program Instance t_CastVoteParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_HasReceiveContext t_CastVoteParam 'unit := - {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_CastVoteParam_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_Sized t_CastVoteParam := - fun x => - x. -Fail Next Obligation. -Definition receive_OVN_cast_vote {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} {v_A : _} `{ t_Sized (v_A)} `{ t_HasActions (v_A)} (ctx : both (t_CastVoteParam (v_Z := v_Z))) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := - cast_vote (v_Z := v_Z) (v_G := v_G) (n := n) (v_A := v_A) (H2 := t_CastVoteParam_t_Sized (v_Z := v_Z) (v_G := v_G) (n := n)) (H7 := t_CastVoteParam_t_HasReceiveContext (v_Z := v_Z) (v_G := v_G) (n := n)) ctx st. - -(* #[global] Program Instance t_CastVoteParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} : t_HasReceiveContext t_CastVoteParam 'unit := *) -(* {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. *) -(* Fail Next Obligation. *) -(* #[global] Program Instance t_CastVoteParam_t_Sized : t_Sized t_CastVoteParam := *) -(* fun x => *) -(* x. *) -(* Fail Next Obligation. *) -Definition receive_OVN_commit_to_vote {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both (t_CastVoteParam)) (st : both (state_OVN (n := n))) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := - commit_to_vote (H2 := t_CastVoteParam_t_Sized (n := n)) (H7 := t_CastVoteParam_t_HasReceiveContext (n := n)) ctx st. - -Definition init_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (chain : Chain) (ctx : ContractCallContext) (st : state_OVN) : ResultMonad.result (state_OVN (n := n)) (t_ParseError) := - ResultMonad.Ok st. - -#[global] Program Instance t_RegisterParam_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_HasReceiveContext t_RegisterParam 'unit := - {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_RegisterParam_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_Sized t_RegisterParam := - fun x => - x. -Fail Next Obligation. -Definition receive_OVN_register {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both (t_RegisterParam)) (st : both (state_OVN (n := n))) : both (t_Result ((v_A × state_OVN)) (t_ParseError)) := - register_vote (H2 := t_RegisterParam_t_Sized (n := n)) (H7 := t_RegisterParam_t_HasReceiveContext (n := n)) ctx st. - -#[global] Program Instance t_TallyParameter_t_HasReceiveContext : t_HasReceiveContext t_TallyParameter 'unit := - {| f_get := (fun {Ctx : _} => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance t_TallyParameter_t_Sized : t_Sized t_TallyParameter := - fun x => - x. -Fail Next Obligation. -Definition receive_OVN_tally {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (ctx : both (t_TallyParameter)) (st : both (state_OVN)) : both (t_Result ((v_A × state_OVN (n := n))) (t_ParseError)) := - tally_votes ctx st. - -Inductive Msg_OVN {v_Z : _} `{ t_Sized (v_Z)} `{ temp : t_Z_Field (v_Z)} : Type := -| msg_OVN_cast_vote : t_CastVoteParam (v_Z := v_Z) (H0 := temp) -> Msg_OVN -| msg_OVN_commit_to_vote : t_CastVoteParam (v_Z := v_Z) (H0 := temp) -> Msg_OVN -| msg_OVN_register : t_RegisterParam (v_Z := v_Z) -> Msg_OVN -| msg_OVN_tally : t_TallyParameter -> Msg_OVN. -#[global] Program Instance state_OVN_t_HasReceiveContext {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : t_HasReceiveContext (state_OVN (n := n)) 'unit := - {| f_get := (fun (Ctx : _) => (solve_lift (@ret_both (t_ParamType × t_Result Ctx t_ParseError)) (tt, inr tt)) : _)|}. -Fail Next Obligation. -#[global] Program Instance state_OVN_t_Sized {v_Z : _} {v_G : _} {n : both (uint_size)} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : t_Sized (state_OVN (n := n)) := - fun x => - x. -Fail Next Obligation. -#[global] Program Instance state_OVN_t_HasActions {v_Z : _} {v_G : _} {n : both (uint_size)}`{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : t_HasActions (state_OVN (v_Z := v_Z) (n := n)). -Admit Obligations. -Fail Next Obligation. -Obligation Tactic := intros. - -(* *) -Equations receive_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ temp1 : t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} (chain : Chain) (ctx : ContractCallContext) (st : state_OVN (v_Z := v_Z) (n := n)) (msg : Datatypes.option (Msg_OVN (v_Z := v_Z))) : ResultMonad.result (state_OVN (v_Z := v_Z) (n := n) * list ActionBody) t_ParseError := - receive_OVN chain ctx st msg := - match msg with - | Some (msg_OVN_cast_vote val) => - match is_pure (both_prog (@receive_OVN_cast_vote v_Z v_G n _ _ _ _ _ v_A _ _ (ret_both val) (ret_both st))) with - | inl x => ResultMonad.Ok ((snd x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_OVN_commit_to_vote val) => - match is_pure (both_prog (@receive_OVN_commit_to_vote v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st))) with - | inl x => ResultMonad.Ok ((snd x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_OVN_register val) => - match is_pure (both_prog (@receive_OVN_register v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st))) with - | inl x => ResultMonad.Ok ((snd x), []) - | inr x => ResultMonad.Err x - end - | Some (msg_OVN_tally val) => - match (is_pure (both_prog (@receive_OVN_tally v_Z v_G n _ _ _ _ _ _ _ _ (ret_both val) (ret_both st)))) with - | inl x => ResultMonad.Ok ((snd x), []) - | inr x => ResultMonad.Err x - end - | _ => - ResultMonad.Err tt - end : ResultMonad.result (state_OVN (v_Z := v_Z) (n := n) * list ActionBody) t_ParseError. -Fail Next Obligation. -#[global] Program Instance state_OVN_Serializable {v_Z : _} {v_G : _} {n : both (uint_size)} (* {impl_574521470_ : _} *) `{ t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Group (v_G) (v_Z)} : Serializable (state_OVN (v_Z := v_Z) (n := n)) := - _. -Admit Obligations. -Fail Next Obligation. -#[global] Program Instance Msg_OVN_Serializable {v_Z : _} `{ temp0 : t_Sized (v_Z)} `{ temp1 : t_Z_Field (v_Z)} : Serializable (@Msg_OVN v_Z temp0 temp1). -Admit Obligations. -(* Derive Serializable Msg_OVN_rect. *) -Fail Next Obligation. -Definition contract_OVN {v_Z : _} {v_G : _} {n : both (uint_size)} {v_A : _} `{ temp1 : t_Sized (v_Z)} `{ t_Sized (v_G)} `{ t_Sized (v_A)} `{ temp2 : t_Z_Field (v_Z)} `{ t_Group (v_G) (v_Z)} `{ t_HasActions (v_A)} : @Contract _ (@state_OVN v_Z v_G n temp1 _ _ _ _) (@Msg_OVN v_Z temp1 H1 ) (state_OVN (v_Z := v_Z) (n := n)) (t_ParseError) state_OVN_Serializable Msg_OVN_Serializable state_OVN_Serializable _ := build_contract init_OVN receive_OVN. diff --git a/ovn/proofs/ssprove/extraction/CoqMakefile.conf b/ovn/proofs/ssprove/extraction/Makefile.conf similarity index 69% rename from ovn/proofs/ssprove/extraction/CoqMakefile.conf rename to ovn/proofs/ssprove/extraction/Makefile.conf index 81f2d00..5e282b8 100644 --- a/ovn/proofs/ssprove/extraction/CoqMakefile.conf +++ b/ovn/proofs/ssprove/extraction/Makefile.conf @@ -1,6 +1,12 @@ # This configuration file was generated by running: -# coq_makefile +# coq_makefile -f _CoqProject -o Makefile +COQBIN?= +ifneq (,$(COQBIN)) +# add an ending / +COQBIN:=$(COQBIN)/ +endif +COQMKFILE ?= "$(COQBIN)coq_makefile" ############################################################################### # # @@ -8,13 +14,15 @@ # # ############################################################################### -COQMF_VFILES = -COQMF_MLIFILES = -COQMF_MLFILES = -COQMF_MLGFILES = -COQMF_MLPACKFILES = -COQMF_MLLIBFILES = -COQMF_CMDLINE_VFILES = +COQMF_CMDLINE_VFILES := +COQMF_SOURCES := $(shell $(COQMKFILE) -sources-of -f _CoqProject $(COQMF_CMDLINE_VFILES)) +COQMF_VFILES := $(filter %.v, $(COQMF_SOURCES)) +COQMF_MLIFILES := $(filter %.mli, $(COQMF_SOURCES)) +COQMF_MLFILES := $(filter %.ml, $(COQMF_SOURCES)) +COQMF_MLGFILES := $(filter %.mlg, $(COQMF_SOURCES)) +COQMF_MLPACKFILES := $(filter %.mlpack, $(COQMF_SOURCES)) +COQMF_MLLIBFILES := $(filter %.mllib, $(COQMF_SOURCES)) +COQMF_METAFILE = ############################################################################### # # @@ -24,8 +32,8 @@ COQMF_CMDLINE_VFILES = COQMF_OCAMLLIBS = COQMF_SRC_SUBDIRS = -COQMF_COQLIBS = -COQMF_COQLIBS_NOML = +COQMF_COQLIBS = -R . Hacspec_ovn +COQMF_COQLIBS_NOML = -R . Hacspec_ovn COQMF_CMDLINE_COQLIBS = ############################################################################### @@ -34,11 +42,11 @@ COQMF_CMDLINE_COQLIBS = # # ############################################################################### -COQMF_COQLIB=/home/au538501/.opam/hacspec_ssprove/lib/coq/ -COQMF_COQCORELIB=/home/au538501/.opam/hacspec_ssprove/lib/coq/../coq-core/ -COQMF_DOCDIR=/home/au538501/.opam/hacspec_ssprove/doc/coq/ -COQMF_OCAMLFIND=/home/au538501/.opam/hacspec_ssprove/bin/ocamlfind -COQMF_CAMLFLAGS=-thread -rectypes -w -a+1..3-4+5..8-9+10..26-27+28..40-41-42+43-44-45+46..47-48+49..57-58+59..66-67-68+69-70 -safe-string -strict-sequence +COQMF_COQLIB=/home/au538501/.opam/hacspec_generic_printer/lib/coq/ +COQMF_COQCORELIB=/home/au538501/.opam/hacspec_generic_printer/lib/coq/../coq-core/ +COQMF_DOCDIR=/home/au538501/.opam/hacspec_generic_printer/share/doc/ +COQMF_OCAMLFIND=/home/au538501/.opam/hacspec_generic_printer/bin/ocamlfind +COQMF_CAMLFLAGS=-thread -bin-annot -strict-sequence -w -a+1..3-4+5..8-9+10..26-27+28..39-40-41-42+43-44-45+46..47-48+49..57-58+59..66-67-68+69-70 COQMF_WARN=-warn-error +a-3 COQMF_HASNATDYNLINK=true COQMF_COQ_SRC_SUBDIRS=boot config lib clib kernel library engine pretyping interp gramlib parsing proofs tactics toplevel printing ide stm vernac plugins/btauto plugins/cc plugins/derive plugins/extraction plugins/firstorder plugins/funind plugins/ltac plugins/ltac2 plugins/micromega plugins/nsatz plugins/ring plugins/rtauto plugins/ssr plugins/ssrmatching plugins/syntax @@ -59,5 +67,5 @@ COQMF_COQPROJECTNATIVEFLAG = # # ############################################################################### -COQMF_OTHERFLAGS = -COQMF_INSTALLCOQDOCROOT = orphan_ +COQMF_OTHERFLAGS = '-w' 'all' +COQMF_INSTALLCOQDOCROOT = Hacspec_ovn diff --git a/ovn/proofs/ssprove/extraction/OVN.v b/ovn/proofs/ssprove/extraction/OVN.v deleted file mode 100644 index 6687dc2..0000000 --- a/ovn/proofs/ssprove/extraction/OVN.v +++ /dev/null @@ -1,2293 +0,0 @@ - -From Relational Require Import OrderEnrichedCategory GenericRulesSimple. - -Set Warnings "-notation-overridden,-ambiguous-paths". -From mathcomp Require Import all_ssreflect all_algebra reals distr realsum - fingroup.fingroup solvable.cyclic prime ssrnat ssreflect ssrfun ssrbool ssrnum - eqtype choice seq. -Set Warnings "notation-overridden,ambiguous-paths". - -From Crypt Require Import Axioms ChoiceAsOrd SubDistr Couplings - UniformDistrLemmas FreeProbProg Theta_dens RulesStateProb UniformStateProb - pkg_composition Package Prelude (* Schnorr *) (* DDH *). - -Require Import pkg_advantage. -Require Import SigmaProtocol. -Require Import Schnorr. -Require Import DDH. - -From Coq Require Import Utf8 Lia. -From extructures Require Import ord fset fmap. - -From Equations Require Import Equations. -Require Equations.Prop.DepElim. - -Set Equations With UIP. - -Set Bullet Behavior "Strict Subproofs". -Set Default Goal Selector "!". -Set Primitive Projections. - -Import Num.Def. -Import Num.Theory. -Import Order.POrderTheory. - -#[local] Open Scope ring_scope. -Import GroupScope GRing.Theory. - -Import PackageNotation. - -Module Type GroupParam. - - Parameter n : nat. - Parameter n_pos : Positive n. - - Parameter gT : finGroupType. - Definition ζ : {set gT} := [set : gT]. - Parameter g : gT. - Parameter g_gen : ζ = <[g]>. - Parameter prime_order : prime #[g]. - -End GroupParam. - -Module Type OVNParam. - - Parameter N : nat. - Parameter N_pos : Positive N. - -End OVNParam. - -Module OVN (GP : GroupParam) (OP : OVNParam). -Import GP. -Import OP. - -Set Equations Transparent. - -Lemma cyclic_zeta: cyclic ζ. -Proof. - apply /cyclicP. exists g. exact: g_gen. -Qed. - -(* order of g *) -Definition q' := Zp_trunc (pdiv #[g]). -Definition q : nat := q'.+2. - -Lemma q_order_g : q = #[g]. -Proof. - unfold q, q'. - apply Fp_cast. - apply prime_order. -Qed. - -Lemma q_field : (Zp_trunc #[g]) = q'. -Proof. - unfold q'. - rewrite pdiv_id. - 2: apply prime_order. - reflexivity. -Qed. - -Lemma expg_g : forall x, exists ix, x = g ^+ ix. -Proof. - intros. - apply /cycleP. - rewrite -g_gen. - apply: in_setT. -Qed. - -Lemma group_prodC : - @commutative gT gT mulg. -Proof. - move => x y. - destruct (expg_g x) as [ix ->]. - destruct (expg_g y) as [iy ->]. - repeat rewrite -expgD addnC. - reflexivity. -Qed. - -Definition Pid : finType := [finType of 'I_n]. -Definition Secret : finType := Zp_finComRingType (Zp_trunc #[g]). -Definition Public : finType := FinGroup.arg_finType gT. -Definition s0 : Secret := 0. - -Definition Pid_pos : Positive #|Pid|. -Proof. - rewrite card_ord. - eapply PositiveInFin. - apply n_pos. -Qed. - -Definition Secret_pos : Positive #|Secret|. -Proof. - apply /card_gt0P. exists s0. auto. -Qed. - -Definition Public_pos : Positive #|Public|. -Proof. - apply /card_gt0P. exists g. auto. -Defined. - -#[local] Existing Instance Pid_pos. -#[local] Existing Instance Secret_pos. -#[local] Existing Instance Public_pos. - -Definition pid : choice_type := 'fin #|Pid|. -Definition secret : choice_type := 'fin #|Secret|. -Definition public: choice_type := 'fin #|Public|. - -Definition nat_to_pid : nat → pid. -Proof. - move=> n. - eapply give_fin. -Defined. - -Definition i_secret := #|Secret|. -Definition i_public := #|Public|. - -Module Type CDSParams <: SigmaProtocolParams. - Definition Witness : finType := Secret. - Definition Statement : finType := prod_finType (prod_finType Public Public) Public. - - Definition Witness_pos : Positive #|Witness| := Secret_pos. - Definition Statement_pos : Positive #|Statement|. - Proof. - unfold Statement. - rewrite !card_prod. - repeat apply Positive_prod. - all: apply Public_pos. - Qed. - - Definition R : Statement -> Witness -> bool := - λ (h : Statement) (x : Witness), - let '(gx, gy, gyxv) := h in - (gy^+x * g^+0 == gyxv) || (gy^+x * g^+1 == gyxv). - - Lemma relation_valid_left: - ∀ (x : Secret) (gy : Public), - R (g^+x, gy, gy^+x * g^+ 0) x. - Proof. - intros x gy. - unfold R. - apply /orP ; left. - done. - Qed. - - Lemma relation_valid_right: - ∀ (x : Secret) (gy : Public), - R (g^+x, gy, gy^+x * g^+ 1) x. - Proof. - intros x y. - unfold R. - apply /orP ; right. - done. - Qed. - - Parameter Message Challenge Response State : finType. - Parameter w0 : Witness. - Parameter e0 : Challenge. - Parameter z0 : Response. - - Parameter Message_pos : Positive #|Message|. - Parameter Challenge_pos : Positive #|Challenge|. - Parameter Response_pos : Positive #|Response|. - Parameter State_pos : Positive #|State|. - Parameter Bool_pos : Positive #|bool_choiceType|. -End CDSParams. - -Module OVN (π2 : CDSParams) (Alg2 : SigmaProtocolAlgorithms π2). - - Module Sigma1 := Schnorr GP. - Module Sigma2 := SigmaProtocol π2 Alg2. - - Obligation Tactic := idtac. - Set Equations Transparent. - - Definition skey_loc (i : nat) : Location := (secret; (100+i)%N). - Definition ckey_loc (i : nat) : Location := (public; (101+i)%N). - - Definition P_i_locs (i : nat) : {fset Location} := fset [:: skey_loc i ; ckey_loc i]. - - Notation choiceStatement1 := Sigma1.MyAlg.choiceStatement. - Notation choiceWitness1 := Sigma1.MyAlg.choiceWitness. - Notation choiceTranscript1 := Sigma1.MyAlg.choiceTranscript. - - Notation " 'pid " := pid (in custom pack_type at level 2). - Notation " 'pids " := (chProd pid pid) (in custom pack_type at level 2). - Notation " 'public " := public (in custom pack_type at level 2). - Notation " 'public " := public (at level 2) : package_scope. - - Notation " 'chRelation1' " := (chProd choiceStatement1 choiceWitness1) (in custom pack_type at level 2). - Notation " 'chTranscript1' " := choiceTranscript1 (in custom pack_type at level 2). - Notation " 'public_key " := (chProd public choiceTranscript1) (in custom pack_type at level 2). - Notation " 'public_keys " := (chMap pid (chProd public choiceTranscript1)) (in custom pack_type at level 2). - - Notation " 'chRelation2' " := (chProd Alg2.choiceStatement Alg2.choiceWitness) (in custom pack_type at level 2). - Notation " 'chTranscript2' " := Alg2.choiceTranscript (in custom pack_type at level 2). - Notation " 'vote " := (chProd public Alg2.choiceTranscript) (in custom pack_type at level 2). - - Definition INIT : nat := 4. - Definition VOTE : nat := 5. - Definition CONSTRUCT : nat := 6. - - Definition P (i : nat) : nat := 14 + i. - Definition Exec (i : nat) : nat := 15 + i. - - Lemma not_in_domm {T S} : - ∀ i m, - i \notin @domm T S m :\ i. - Proof. - intros. - apply /negPn. - rewrite in_fsetD. - move=> /andP [H _]. - move: H => /negPn H. - apply H. - by rewrite in_fset1. - Qed. - - Lemma not_in_fsetU : - ∀ (l : Location) L0 L1, - l \notin L0 → - l \notin L1 → - l \notin L0 :|: L1. - Proof. - intros l L0 L1 h1 h2. - rewrite -fdisjoints1 fset1E. - rewrite fdisjointUl. - apply /andP ; split. - + rewrite -fdisjoints1 fset1E in h1. apply h1. - + rewrite -fdisjoints1 fset1E in h2. apply h2. - Qed. - - #[local] Hint Extern 3 (is_true (?l \notin ?L0 :|: ?L1)) => - apply not_in_fsetU : typeclass_instances ssprove_valid_db ssprove_invariant. - - Definition get_value (m : chMap pid (chProd public choiceTranscript1)) (i : pid) := - match m i with - | Some (v, _) => otf v - | _ => 1 - end. - - Canonical finGroup_com_law := Monoid.ComLaw group_prodC. - - Definition compute_key - (m : chMap pid (chProd public choiceTranscript1)) - (i : pid) - := - let low := \prod_(k <- domm m | (k < i)%ord) (get_value m k) in - let high := \prod_(k <- domm m | (i < k)%ord) (get_value m k) in - low * invg high. - - Definition compute_key' - (m : chMap pid (chProd public choiceTranscript1)) - (i j : pid) - (x : Secret) - := - if (j < i)%ord then - let low := \prod_(k <- domm m | (k < i)%ord) (get_value m k) in - let high := \prod_(k <- domm m | (i < k)%ord) (get_value m k) in - (g ^+ x) * low * invg high - else - let low := \prod_(k <- domm m | (k < i)%ord) (get_value m k) in - let high := \prod_(k <- domm m | (i < k)%ord) (get_value m k) in - low * invg (high * (g ^+ x)). - - Lemma compute_key'_equiv - (i j : pid) - (x : Secret) - (zk : choiceTranscript1) - (keys : chMap pid (chProd public choiceTranscript1)): - (i != j) → - compute_key (setm keys j (fto (g ^+ x), zk)) i = compute_key' (remm keys j) i j x. - Proof. - intro ij_neq. - unfold compute_key, compute_key'. - simpl. - rewrite <- setm_rem. - rewrite domm_set domm_rem. - set X := domm _. - rewrite !big_fsetU1. - 2-3: subst X; apply not_in_domm. - rewrite setm_rem. - - have set_rem_eq : forall P x, - \big[finGroup_com_law/1]_(k <- X :\ j | P k) - get_value (setm keys j x) k = - \prod_(k <- X :\ j | P k) - get_value (remm keys j) k. - { intros. - rewrite big_seq_cond. - rewrite [RHS] big_seq_cond. - unfold get_value. - erewrite eq_bigr. - 1: done. - intros k. - move => /andP [k_in _]. - simpl. - rewrite setmE remmE. - case (k == j) eqn:eq. - - move: eq => /eqP eq. - rewrite eq in_fsetD1 in k_in. - move: k_in => /andP [contra]. - rewrite eq_refl in contra. - discriminate. - - reflexivity. - } - - case (j < i)%ord eqn:e. - - rewrite !e. - rewrite -2!mulgA. - f_equal. - 1: unfold get_value ; by rewrite setmE eq_refl otf_fto. - f_equal. - + apply set_rem_eq. - + rewrite Ord.ltNge Ord.leq_eqVlt in e. - rewrite negb_or in e. - move: e => /andP [_ e]. - apply negbTE in e. - rewrite e. - f_equal. - apply set_rem_eq. - - rewrite e. - rewrite Ord.ltNge in e. - apply negbT in e. - apply negbNE in e. - rewrite Ord.leq_eqVlt in e. - move: e => /orP [contra|e]. - 1: by rewrite contra in ij_neq. - rewrite e !invMg. - f_equal. - { apply set_rem_eq. } - rewrite group_prodC. - f_equal. - { unfold get_value. by rewrite setmE eq_refl otf_fto. } - f_equal. - apply set_rem_eq. - Qed. - - Lemma compute_key_bij: - ∀ (m : chMap pid (chProd public choiceTranscript1)) (i j: pid), - (i != j)%ord → - exists (a b : nat), - (a != 0)%N /\ (a < q)%N /\ - (∀ (x : Secret) zk, - compute_key (setm m j (fto (g ^+ x), zk)) i = g ^+ ((a * x + b) %% q)). - Proof. - intros m i j ne. - simpl. - pose low := \prod_(k <- domm m :\ j| (k < i)%ord) get_value m k. - pose hi := \prod_(k <- domm m :\ j| (i < k)%ord) get_value m k. - have Hlow : exists ilow, low = g ^+ ilow by apply expg_g. - have Hhi : exists ihi, hi = g ^+ ihi by apply expg_g. - destruct Hlow as [ilow Hlow]. - destruct Hhi as [ihi Hhi]. - - have getv_remm_eq : forall P j m, - \prod_(k <- domm m :\ j | P k) get_value (remm m j) k = - \prod_(k <- domm m :\ j | P k) get_value m k. - { - clear low hi ilow ihi Hlow Hhi ne i j m. - intros. - rewrite big_seq_cond. - rewrite [RHS] big_seq_cond. - erewrite eq_bigr. - 1: done. - intros k. - move => /andP [k_in _]. - simpl. - unfold get_value. - rewrite remmE. - case (k == j) eqn:eq. - ++ move: eq => /eqP eq. - rewrite eq in_fsetD1 in k_in. - move: k_in => /andP [contra]. - rewrite eq_refl in contra. - discriminate. - ++ reflexivity. - } - - case (j < i)%ord eqn:ij_rel. - - exists 1%N. - exists (ilow + (ihi * #[g ^+ ihi].-1))%N. - do 2 split. - 1: rewrite q_order_g ; apply (prime_gt1 prime_order). - intros x zk. - rewrite compute_key'_equiv. - 2: assumption. - unfold compute_key'. - simpl. - rewrite ij_rel. - rewrite domm_rem. - set low' := \prod_(k0 <- _ | _) _. - set hi' := \prod_(k0 <- _ | _) _. - have -> : low' = low by apply getv_remm_eq. - have -> : hi' = hi by apply getv_remm_eq. - clear low' hi'. - rewrite Hhi Hlow. - rewrite invg_expg. - rewrite -!expgM. - rewrite -!expgD. - rewrite !addnA. - rewrite -expg_mod_order. - f_equal. - f_equal. - 2: { - unfold q. rewrite Fp_cast; - [reflexivity | apply prime_order]. - } - rewrite mul1n. - done. - - exists #[g].-1. - exists (ilow + (ihi * #[g ^+ ihi].-1))%N. - repeat split. - { unfold negb. - rewrite -leqn0. - case (#[g].-1 <= 0)%N eqn:e. - 2: done. - have Hgt1 := (prime_gt1 prime_order). - rewrite -ltn_predRL in Hgt1. - rewrite -ltnS in Hgt1. - rewrite -addn1 in Hgt1. - rewrite leq_add2l in Hgt1. - eapply leq_trans in e. - 2: apply Hgt1. - discriminate. - } - { - rewrite q_order_g. - rewrite ltn_predL. - apply (prime_gt0 prime_order). - } - intros x zk. - rewrite compute_key'_equiv. - 2: assumption. - unfold compute_key'. - simpl. - rewrite ij_rel. - rewrite domm_rem. - set low' := \prod_(k0 <- _ | _) _. - set hi' := \prod_(k0 <- _ | _) _. - have -> : low' = low by apply getv_remm_eq. - have -> : hi' = hi by apply getv_remm_eq. - clear low' hi'. - rewrite Hhi Hlow. - rewrite invMg. - rewrite -expgVn. - rewrite !invg_expg. - rewrite -!expgM. - rewrite mulgA. - rewrite -!expgD. - rewrite !addnA. - rewrite -expg_mod_order. - f_equal. - f_equal. - 2: { - unfold q. rewrite Fp_cast; - [reflexivity | apply prime_order]. - } - rewrite addnAC. - rewrite addnC. - rewrite addnA. - done. - Qed. - - Lemma compute_key_set_i - (i : pid) - (v : (chProd public choiceTranscript1)) - (m : chMap pid (chProd public choiceTranscript1)): - compute_key (setm m i v) i = compute_key m i. - Proof. - unfold compute_key. - simpl. - case (i \in domm m) eqn:i_in. - all: simpl in i_in. - - have -> : forall v, domm (setm m i v) = domm m. - { intros. - simpl. - rewrite domm_set. - rewrite -eq_fset. - intro k. - rewrite in_fsetU1. - case (eq_op) eqn:e. - + move: e => /eqP ->. - by rewrite i_in. - + done. - } - simpl. - f_equal. - + apply eq_big. - 1: done. - intros k k_lt. - unfold get_value. - rewrite setmE. - rewrite Ord.lt_neqAle in k_lt. - move: k_lt => /andP [k_lt _]. - move: k_lt => /negbTE ->. - done. - + f_equal. - apply eq_big. - 1: done. - intros k k_lt. - unfold get_value. - rewrite setmE. - rewrite Ord.lt_neqAle in k_lt. - move: k_lt => /andP [k_lt _]. - rewrite eq_sym. - move: k_lt => /negbTE ->. - done. - - have -> : domm m = domm (remm m i). - { - simpl. - rewrite -eq_fset. - intro k. - rewrite domm_rem. - rewrite in_fsetD1. - case (eq_op) eqn:e. - + simpl. - move: e => /eqP ->. - assumption. - + done. - } - simpl. - f_equal. - + rewrite -setm_rem domm_set domm_rem. - rewrite big_fsetU1. - all: simpl. - 2: by rewrite in_fsetD1 eq_refl. - rewrite Ord.ltxx. - apply eq_big. - 1: done. - intros k k_lt. - unfold get_value. - rewrite setmE remmE. - rewrite Ord.lt_neqAle in k_lt. - move: k_lt => /andP [k_lt _]. - move: k_lt => /negbTE ->. - done. - + f_equal. - rewrite -setm_rem domm_set domm_rem. - rewrite big_fsetU1. - all: simpl. - 2: by rewrite in_fsetD1 eq_refl. - rewrite Ord.ltxx. - apply eq_big. - 1: done. - intros k k_lt. - unfold get_value. - rewrite setmE remmE. - rewrite Ord.lt_neqAle in k_lt. - move: k_lt => /andP [k_lt _]. - rewrite eq_sym. - move: k_lt => /negbTE ->. - done. - Qed. - - Lemma test_bij - (i j : pid) - (m : chMap pid (chProd public choiceTranscript1)) - : - (i != j)%N → - ∃ (f : Secret → Secret), - ∀ (x : Secret), - bijective f /\ - (∀ zk, compute_key (setm m j (fto (g ^+ x), zk)) i = g ^+ (f x)). - Proof. - simpl. - intros ne. - have H := compute_key_bij m i j ne. - simpl in H. - destruct H as [a [b [a_pos [a_leq_q H]]]]. - set a_ord := @inZp ((Zp_trunc #[g]).+1) a. - set b_ord := @inZp ((Zp_trunc #[g]).+1) b. - pose f' := (fun (x : Secret) => Zp_add (Zp_mul x a_ord) b_ord). - exists f'. - unfold f'. clear f'. - intros x. - have := q_order_g. - unfold q. - intros Hq. - split. - 2: { - intro zk. - rewrite (H x zk). - apply /eqP. - rewrite eq_expg_mod_order. - apply /eqP. - simpl. - rewrite modn_small. - 2: { - rewrite q_order_g. - apply ltn_pmod. - apply (prime_gt0 prime_order). - } - repeat rewrite -> Zp_cast at 3. - 2-5: apply (prime_gt1 prime_order). - symmetry. - rewrite modn_small. - 2: { - apply ltn_pmod. - apply (prime_gt0 prime_order). - } - simpl. - unfold q, q'. - rewrite Fp_cast. - 2: apply prime_order. - rewrite modnMmr. - rewrite modnDm. - rewrite mulnC. - reflexivity. - } - assert (coprime q'.+2 a_ord) as a_ord_coprime. - { - rewrite -unitFpE. - 2: rewrite Hq ; apply prime_order. - rewrite unitfE. simpl. - rewrite Zp_cast. - 2: apply (prime_gt1 prime_order). - unfold q, q' in a_leq_q. - rewrite Fp_cast in a_leq_q. - 2: apply prime_order. - rewrite modn_small. - 2: apply a_leq_q. - erewrite <- inj_eq. - 2: apply ord_inj. - rewrite val_Zp_nat. - 2: { - rewrite pdiv_id. - 1: apply prime_gt1. - 1,2: rewrite Hq ; apply prime_order. - } - rewrite -> pdiv_id at 1. - 1,2: rewrite Hq. - 2: apply prime_order. - unfold q in a_leq_q. - rewrite modn_small. - 2: apply a_leq_q. - assumption. - } - pose f' := (fun (x : Secret) => Zp_mul (Zp_add (Zp_opp b_ord) x) (Zp_inv a_ord)). - exists f'. - - intro z. - unfold f'. clear f'. - simpl. - rewrite Zp_addC. - rewrite -Zp_addA. - have -> : (Zp_add b_ord (Zp_opp b_ord)) = Zp0. - 1: by rewrite Zp_addC Zp_addNz. - rewrite Zp_addC. - rewrite Zp_add0z. - rewrite -Zp_mulA. - rewrite Zp_mulzV. - 2: { - rewrite -> q_field at 1. - assumption. - } - rewrite Zp_mulz1. - reflexivity. - - intro z. - unfold f'. clear f'. - simpl. - rewrite Zp_addC. - rewrite -Zp_mulA. - rewrite Zp_mul_addl. - have -> : (Zp_mul (Zp_inv a_ord) a_ord) = Zp1. - { - rewrite Zp_mulC. - rewrite Zp_mulzV. - + reflexivity. - + rewrite -> q_field at 1. - assumption. - } - rewrite -Zp_mul_addl. - rewrite Zp_mulz1. - rewrite Zp_addA. - have -> : (Zp_add b_ord (Zp_opp b_ord)) = Zp0. - 1: by rewrite Zp_addC Zp_addNz. - rewrite Zp_add0z. - reflexivity. - Qed. - - Lemma test_bij' - (i j : pid) - (m : chMap pid (chProd public choiceTranscript1)) - : - (i != j)%N → - ∃ (f : secret → secret), - ∀ (x : secret), - bijective f /\ - (∀ zk, compute_key (setm m j (fto (g ^+ otf x), zk)) i = g ^+ (otf (f x))). - Proof. - simpl. - intros ne. - have [f H] := test_bij i j m ne. - simpl in H. - exists (fun (x : secret) => fto (f (otf x))). - intro x. - destruct (H (otf x)) as [f_bij H'] ; clear H. - split. - - exists (fun z => fto ((finv f) (otf z))). - + apply bij_inj in f_bij. - intro z. - rewrite otf_fto. - apply finv_f in f_bij. - rewrite f_bij fto_otf. - reflexivity. - + apply bij_inj in f_bij. - intro z. - rewrite otf_fto. - apply f_finv in f_bij. - rewrite f_bij fto_otf. - reflexivity. - - intro zk. - specialize (H' zk). - rewrite otf_fto. - apply H'. - Qed. - - Definition P_i_E := - [interface - #val #[ INIT ] : 'unit → 'public_key ; - #val #[ CONSTRUCT ] : 'public_keys → 'unit ; - #val #[ VOTE ] : 'bool → 'public - ]. - - Definition Sigma1_I := - [interface - #val #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool ; - #val #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1 - ]. - - Definition P_i (i : pid) (b : bool): - package (P_i_locs i) - Sigma1_I - P_i_E := - [package - #def #[ INIT ] (_ : 'unit) : 'public_key - { - #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; - #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; - x ← sample uniform i_secret ;; - #put (skey_loc i) := x ;; - let y := (fto (g ^+ (otf x))) : public in - zkp ← ZKP (y, x) ;; - ret (y, zkp) - } - ; - #def #[ CONSTRUCT ] (m : 'public_keys) : 'unit - { - #import {sig #[ Sigma1.Sigma.VERIFY ] : chTranscript1 → 'bool} as VER ;; - #assert (size (domm m) == n) ;; - let key := fto (compute_key m i) in - #put (ckey_loc i) := key ;; - @ret 'unit Datatypes.tt - } - ; - #def #[ VOTE ] (v : 'bool) : 'public - { - skey ← get (skey_loc i) ;; - ckey ← get (ckey_loc i) ;; - if b then - let vote := (otf ckey ^+ skey * g ^+ v) in - @ret 'public (fto vote) - else - let vote := (otf ckey ^+ skey * g ^+ (negb v)) in - @ret 'public (fto vote) - } - ]. - - Definition EXEC_i_I := - [interface - #val #[ INIT ] : 'unit → 'public_key ; - #val #[ CONSTRUCT ] : 'public_keys → 'unit ; - #val #[ VOTE ] : 'bool → 'public ; - #val #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1 - ]. - - Definition Exec_i_E i := [interface #val #[ Exec i ] : 'bool → 'public]. - - Definition Exec_i (i j : pid) (m : chMap pid (chProd public choiceTranscript1)): - package fset0 - EXEC_i_I - (Exec_i_E i) - := - [package - #def #[ Exec i ] (v : 'bool) : 'public - { - #import {sig #[ INIT ] : 'unit → 'public_key} as Init ;; - #import {sig #[ CONSTRUCT ] : 'public_keys → 'unit} as Construct ;; - #import {sig #[ VOTE ] : 'bool → 'public} as Vote ;; - #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; - pk ← Init Datatypes.tt ;; - x ← sample uniform i_secret ;; - let y := (fto (g ^+ (otf x))) : public in - zkp ← ZKP (y, x) ;; - let m' := setm (setm m j (y, zkp)) i pk in - Construct m' ;; - vote ← Vote v ;; - @ret 'public vote - } - ]. - - Module DDHParams <: DDHParams. - Definition Space := Secret. - Definition Space_pos := Secret_pos. - End DDHParams. - - Module DDH := DDH DDHParams GP. - - #[tactic=notac] Equations? Aux (b : bool) (i j : pid) m f': - package DDH.DDH_locs - (DDH.DDH_E :|: - [interface #val #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1] - ) - [interface #val #[ Exec i ] : 'bool → 'public] - := Aux b i j m f' := - [package - #def #[ Exec i ] (v : 'bool) : 'public - { - #import {sig #[ DDH.SAMPLE ] : 'unit → 'public × 'public × 'public} as DDH ;; - #import {sig #[ Sigma1.Sigma.RUN ] : chRelation1 → chTranscript1} as ZKP ;; - abc ← DDH Datatypes.tt ;; - x_i ← get DDH.secret_loc1 ;; - x_j ← get DDH.secret_loc2 ;; - let '(y_i, (y_j, c)) := abc in - let y_j' := fto (g ^+ ((finv f') x_j)) in - zkp1 ← ZKP (y_i, x_i) ;; - zkp2 ← ZKP (y_j', (finv f') x_j) ;; - let m' := (setm (setm m j (y_j', zkp2)) i (y_i, zkp1)) in - #assert (size (domm m') == n) ;; - @ret 'public (fto ((otf c) * g ^+ (if b then v else (negb v)))) - } - ]. - Proof. - ssprove_valid. - all: rewrite in_fsetU. - all: apply /orP. - { - left. - unfold DDH.DDH_E. - rewrite fset_cons -fset0E fsetU0. - by apply /fset1P. - } - { - right. - rewrite fset_cons -fset0E fsetU0. - by apply /fset1P. - } - { - right. - rewrite fset_cons -fset0E fsetU0. - by apply /fset1P. - } - Qed. - - Module RO1 := Sigma1.Sigma.Oracle. - Module RO2 := Sigma2.Oracle. - - Definition combined_locations := - (Sigma1.MyAlg.Sigma_locs :|: RO1.RO_locs). - - Equations? Exec_i_realised b m (i j : pid) : package (P_i_locs i :|: combined_locations) [interface] (Exec_i_E i) := - Exec_i_realised b m i j := - {package (Exec_i i j m) ∘ (par ((P_i i b) ∘ (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) - (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO))}. - Proof. - ssprove_valid. - 10: apply fsub0set. - 8:{ rewrite fsetUid. apply fsubsetxx. } - 9: apply fsubsetxx. - 7:{ erewrite fsetUid. apply fsubsetxx. } - 4: apply fsubsetUr. - 3: apply fsubsetUl. - all: unfold combined_locations. - - apply fsubsetUl. - - apply fsubsetUr. - - eapply fsubset_trans. 2: eapply fsubsetUr. - apply fsubsetUl. - - eapply fsubset_trans. 2: eapply fsubsetUr. - apply fsubsetUr. - - unfold EXEC_i_I, P_i_E, Sigma1_I. - rewrite !fset_cons. - rewrite -!fsetUA. - repeat apply fsetUS. - rewrite -fset0E fsetU0 fset0U. - apply fsubsetUr. - Qed. - - - Lemma loc_helper_commit i: - Sigma1.MyAlg.commit_loc \in P_i_locs i :|: combined_locations. - Proof. - unfold combined_locations. - unfold Sigma1.MyAlg.Sigma_locs. - rewrite in_fsetU. - apply /orP ; right. - rewrite fset_cons. - rewrite in_fsetU. - apply /orP ; left. - rewrite in_fsetU1. - apply /orP ; left. - done. - Qed. - - Lemma loc_helper_queries i: - RO1.queries_loc \in P_i_locs i :|: combined_locations. - Proof. - unfold combined_locations. - unfold RO1.RO_locs. - rewrite in_fsetU. - apply /orP ; right. - rewrite fset_cons. - rewrite in_fsetU. - apply /orP ; right. - rewrite in_fsetU1. - apply /orP ; left. - done. - Qed. - - Lemma loc_helper_skey i: - skey_loc i \in P_i_locs i :|: combined_locations. - Proof. - unfold P_i_locs. - rewrite in_fsetU. - apply /orP ; left. - rewrite fset_cons. - rewrite in_fsetU1. - apply /orP ; left. - done. - Qed. - - Lemma loc_helper_ckey i: - ckey_loc i \in P_i_locs i :|: combined_locations. - Proof. - unfold P_i_locs. - rewrite in_fsetU. - apply /orP ; left. - rewrite !fset_cons. - rewrite in_fsetU1. - apply /orP ; right. - rewrite in_fsetU1. - apply /orP ; left. - done. - Qed. - - #[local] Hint Resolve loc_helper_commit : loc_db. - #[local] Hint Resolve loc_helper_queries : loc_db. - #[local] Hint Resolve loc_helper_skey: loc_db. - #[local] Hint Resolve loc_helper_ckey: loc_db. - - #[program] Definition Exec_i_realised_code m (i j : pid) (vote : 'bool): - code (P_i_locs i :|: combined_locations) [interface] 'public := - {code - x ← sample uniform i_secret ;; - #put skey_loc i := x ;; - #assert Sigma1.MyParam.R (otf (fto (expgn_rec (T:=gT) g (otf x)))) (otf x) ;; - x1 ← sample uniform Sigma1.MyAlg.i_witness ;; - #put Sigma1.MyAlg.commit_loc := x1 ;; - #put RO1.queries_loc := emptym ;; - x2 ← get RO1.queries_loc ;; - match x2 (Sigma1.Sigma.prod_assoc (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)))) with - | Some a => - v ← get Sigma1.MyAlg.commit_loc ;; - x3 ← sample uniform i_secret ;; - #assert Sigma1.MyParam.R (otf (fto (expgn_rec (T:=gT) g (otf x3)))) (otf x3) ;; - x5 ← sample uniform Sigma1.MyAlg.i_witness ;; - #put Sigma1.MyAlg.commit_loc := x5 ;; - #put RO1.queries_loc := emptym ;; - v0 ← get RO1.queries_loc ;; - match v0 (Sigma1.Sigma.prod_assoc (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)))) with - | Some a0 => - x6 ← get Sigma1.MyAlg.commit_loc ;; - let x4 := - (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)), a0, fto (Zp_add (otf x6) (Zp_mul (otf a0) (otf x3)))) - in - #assert eqn - (size - (domm (T:=[ordType of 'I_#|'I_n|]) (S:='I_#|gT| * ('I_#|gT| * 'I_#|gT| * 'I_#|'Z_Sigma1.q| * 'I_#|'Z_Sigma1.q|)) - (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i - (fto (expgn_rec (T:=gT) g (otf x)), - (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))))) n ;; - #put ckey_loc i := fto - (compute_key - (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i - (fto (expgn_rec (T:=gT) g (otf x)), - (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, - fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))) i) ;; - v0 ← get skey_loc i ;; - v1 ← get ckey_loc i ;; - @ret 'public (fto (expgn_rec (T:=gT) (otf v1) v0 * expgn_rec (T:=gT) g vote)%g) - | None => - a0 ← sample uniform RO1.i_random ;; - #put RO1.queries_loc := setm v0 - (Sigma1.Sigma.prod_assoc (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)))) a0 ;; - x6 ← get Sigma1.MyAlg.commit_loc ;; - let x4 := (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)), a0, fto (Zp_add (otf x6) (Zp_mul (otf a0) (otf x3)))) in - #assert eqn - (size - (domm (T:=[ordType of 'I_#|'I_n|]) (S:='I_#|gT| * ('I_#|gT| * 'I_#|gT| * 'I_#|'Z_Sigma1.q| * 'I_#|'Z_Sigma1.q|)) - (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i - (fto (expgn_rec (T:=gT) g (otf x)), - (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))))) n ;; - #put ckey_loc i := fto - (compute_key - (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i - (fto (expgn_rec (T:=gT) g (otf x)), - (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, - fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))) i) ;; - v0 ← get skey_loc i ;; - v1 ← get ckey_loc i ;; - @ret 'public (fto (expgn_rec (T:=gT) (otf v1) v0 * expgn_rec (T:=gT) g vote)%g) - end - | None => - a ← sample uniform RO1.i_random ;; - #put RO1.queries_loc := setm x2 - (Sigma1.Sigma.prod_assoc (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)))) a ;; - v ← get Sigma1.MyAlg.commit_loc ;; - x3 ← sample uniform i_secret ;; - #assert Sigma1.MyParam.R (otf (fto (expgn_rec (T:=gT) g (otf x3)))) (otf x3) ;; - x5 ← sample uniform Sigma1.MyAlg.i_witness ;; - #put Sigma1.MyAlg.commit_loc := x5 ;; - #put RO1.queries_loc := emptym ;; - v0 ← get RO1.queries_loc ;; - match v0 (Sigma1.Sigma.prod_assoc (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)))) with - | Some a0 => - x6 ← get Sigma1.MyAlg.commit_loc ;; - let x4 := (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)), a0, fto (Zp_add (otf x6) (Zp_mul (otf a0) (otf x3)))) in - #assert eqn - (size - (domm (T:=[ordType of 'I_#|'I_n|]) (S:='I_#|gT| * ('I_#|gT| * 'I_#|gT| * 'I_#|'Z_Sigma1.q| * 'I_#|'Z_Sigma1.q|)) - (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i - (fto (expgn_rec (T:=gT) g (otf x)), - (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))))) n ;; - #put ckey_loc i := fto - (compute_key - (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i - (fto (expgn_rec (T:=gT) g (otf x)), - (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, - fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))) i) ;; - v0 ← get skey_loc i ;; - v1 ← get ckey_loc i ;; - @ret 'public (fto (expgn_rec (T:=gT) (otf v1) v0 * expgn_rec (T:=gT) g vote)%g) - | None => - a0 ← sample uniform RO1.i_random ;; - #put RO1.queries_loc := setm v0 - (Sigma1.Sigma.prod_assoc (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)))) a0 ;; - x6 ← get Sigma1.MyAlg.commit_loc ;; - let x4 := (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)), a0, fto (Zp_add (otf x6) (Zp_mul (otf a0) (otf x3)))) in - #assert eqn - (size - (domm (T:=[ordType of 'I_#|'I_n|]) (S:='I_#|gT| * ('I_#|gT| * 'I_#|gT| * 'I_#|'Z_Sigma1.q| * 'I_#|'Z_Sigma1.q|)) - (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i - (fto (expgn_rec (T:=gT) g (otf x)), - (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))))) n ;; - #put ckey_loc i := fto - (compute_key - (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i - (fto (expgn_rec (T:=gT) g (otf x)), - (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, - fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))) i) ;; - v0 ← get skey_loc i ;; - v1 ← get ckey_loc i ;; - @ret 'public (fto (expgn_rec (T:=gT) (otf v1) v0 * expgn_rec (T:=gT) g vote)%g) - end - end - }. - Next Obligation. - intros. - ssprove_valid ; auto with loc_db. - destruct (v1 _) ; ssprove_valid ; auto with loc_db. - - destruct (v5 _) ; ssprove_valid ; auto with loc_db. - - destruct (v6 _) ; ssprove_valid ; auto with loc_db. - Qed. - - #[program] Definition Exec_i_realised_code_runnable m (i j : pid) (vote : 'bool): - code (P_i_locs i :|: combined_locations) [interface] 'public := - {code - x ← sample uniform i_secret ;; - #put skey_loc i := x ;; - #assert Sigma1.MyParam.R (otf (fto (expgn_rec (T:=gT) g (otf x)))) (otf x) ;; - x1 ← sample uniform Sigma1.MyAlg.i_witness ;; - #put Sigma1.MyAlg.commit_loc := x1 ;; - x2 ← get RO1.queries_loc ;; - a ← sample uniform RO1.i_random ;; - #put RO1.queries_loc := setm x2 - (Sigma1.Sigma.prod_assoc (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)))) a ;; - v ← get Sigma1.MyAlg.commit_loc ;; - x3 ← sample uniform i_secret ;; - #assert Sigma1.MyParam.R (otf (fto (expgn_rec (T:=gT) g (otf x3)))) (otf x3) ;; - x5 ← sample uniform Sigma1.MyAlg.i_witness ;; - #put Sigma1.MyAlg.commit_loc := x5 ;; - v0 ← get RO1.queries_loc ;; - a0 ← sample uniform RO1.i_random ;; - #put RO1.queries_loc := setm v0 - (Sigma1.Sigma.prod_assoc (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)))) a0 ;; - x6 ← get Sigma1.MyAlg.commit_loc ;; - let x4 := (fto (expgn_rec (T:=gT) g (otf x3)), fto (expgn_rec (T:=gT) g (otf x5)), a0, fto (Zp_add (otf x6) (Zp_mul (otf a0) (otf x3)))) in - #assert eqn - (size - (domm (T:=[ordType of 'I_#|'I_n|]) (S:='I_#|gT| * ('I_#|gT| * 'I_#|gT| * 'I_#|'Z_Sigma1.q| * 'I_#|'Z_Sigma1.q|)) - (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i - (fto (expgn_rec (T:=gT) g (otf x)), - (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))))) n ;; - #put ckey_loc i := fto - (compute_key - (setm (T:=[ordType of 'I_#|'I_n|]) (setm (T:=[ordType of 'I_#|'I_n|]) m j (fto (expgn_rec (T:=gT) g (otf x3)), x4)) i - (fto (expgn_rec (T:=gT) g (otf x)), - (fto (expgn_rec (T:=gT) g (otf x)), fto (expgn_rec (T:=gT) g (otf x1)), a, - fto (Zp_add (otf v) (Zp_mul (otf a) (otf x)))))) i) ;; - v0 ← get skey_loc i ;; - v1 ← get ckey_loc i ;; - @ret 'public (fto (expgn_rec (T:=gT) (otf v1) v0 * expgn_rec (T:=gT) g vote)%g) - }. - Next Obligation. - intros. - ssprove_valid ; auto with loc_db. - Qed. - - Lemma code_pkg_equiv m i j (vote : 'bool): - ⊢ - ⦃ λ '(h₀, h₁), h₀ = h₁ ⦄ - get_op_default (Exec_i_realised true m i j) ((Exec i), ('bool, 'public)) vote - ≈ - Exec_i_realised_code m i j vote - ⦃ eq ⦄. - Proof. - unfold Exec_i_realised. - rewrite get_op_default_link. - erewrite get_op_default_spec. - 2: { - cbn. - rewrite eqnE eq_refl. - done. - } - ssprove_code_simpl. - simpl. - repeat choice_type_eqP_handle. - rewrite !cast_fun_K. - ssprove_code_simpl. - simpl. - ssprove_code_simpl. - ssprove_code_simpl_more. - simpl. - ssprove_sync_eq=>x. - simpl. - ssprove_code_simpl_more. - ssprove_sync_eq. - ssprove_sync_eq=>rel1. - ssprove_sync_eq=>r1. - ssprove_sync_eq. - ssprove_code_simpl. - - (* ssprove_sync_eq. *) - (* ssprove_sync_eq. *) - (* intros. *) - - match goal with - | |- context [⊢ ⦃ _ ⦄ #put _ := _ ;; getr _ ?x ≈ #put _ := _ ;; getr _ ?y ⦃ _ ⦄] => - set (x) ; set (y) - end. - - apply (r_transL (#put RO1.queries_loc := emptym ;; r emptym)). - 1: apply r_put_get. - - apply (r_transL (#put RO1.queries_loc := emptym ;; r0 emptym)). - 2: apply r_put_get. - - ssprove_sync_eq. - subst r r0. hnf. - - simpl. - - ssprove_code_simpl. - ssprove_sync_eq=>a. - ssprove_sync_eq. - ssprove_sync_eq=>v. - - match goal with - | |- context [⊢ ⦃ _ ⦄ @pkg_core_definition.sampler _ _ ?x ≈ @pkg_core_definition.sampler _ _ ?y ⦃ _ ⦄] => - set (temp1 := x) ; set (temp2 := y) - end. - - apply r_uniform_bij with (f := (fun (x : Arit (@uniform i_secret Secret_pos)) => (x : Arit (@uniform i_secret Sigma1.MyParam.Witness_pos)))). - 1: exact (inv_bij (fun x => erefl)). - intros. - subst temp1 temp2. hnf. - ssprove_code_simpl. - simpl. - - match goal with - | |- context [⊢ ⦃ _ ⦄ ?x ≈ bind (assertD ?v ?z) ?y ⦃ _ ⦄] => - set (temp1 := x) ; set (temp2 := y) ; set (temp3 := z) ; set (temp4 := v) in * - end. - - change (prod_choiceType _ _) with ( (chElement ((( chFin (mkpos #|gT|) × chFin (mkpos #|gT|)) × chFin (mkpos #|'Z_Sigma1.q|)) × chFin (mkpos #|'Z_Sigma1.q|)))) in *. - - apply (r_transR _ (@assertD _ temp4 (fun z => x ← temp3 z ;; temp2 x))). - 1:{ - eapply r_transL. - 2:{ - apply r_bind_assertD_sym. - } - apply rreflexivity_rule. - } - subst temp1 temp2 temp3 temp4. hnf. - - match goal with - | |- context [⊢ ⦃ _ ⦄ assertD _ ?x ≈ assertD _ ?y ⦃ _ ⦄] => - set (temp1 := x) ; set (temp2 := y) - end. - - change (Sigma1.MyParam.Witness) with (Secret) in *. - change (raw_code _) with (raw_code (chElement (chFin (mkpos #|gT|)))) in temp1. - (* Unset Printing Notations. *) - apply (@r_assertD_same (chFin (mkpos #|gT|)) (Sigma1.MyParam.R (otf (fto (expgn_rec (T:=gT) g (otf x0)))) (otf x0))). - intros. - - subst temp1 temp2. hnf. - simpl. - ssprove_code_simpl. - ssprove_code_simpl_more. - simpl. - ssprove_sync_eq=>a0. - ssprove_sync_eq. - - match goal with - | |- context [⊢ ⦃ _ ⦄ #put _ := _ ;; getr _ ?x ≈ #put _ := _ ;; getr _ ?y ⦃ _ ⦄] => - set (x) ; set (y) - end. - - apply (r_transL (#put RO1.queries_loc := emptym ;; r emptym)). - 1: apply r_put_get. - - apply (r_transL (#put RO1.queries_loc := emptym ;; r0 emptym)). - 2: apply r_put_get. - - ssprove_sync_eq. - subst r r0. hnf. - - simpl. - - ssprove_sync_eq=>a1. - ssprove_sync_eq. - ssprove_sync_eq=>a2. - - match goal with - | |- context [⊢ ⦃ _ ⦄ bind (assertD ?v ?z) ?y ≈ ?x ⦃ _ ⦄] => - set (temp1 := x) ; set (temp2 := y) ; set (temp3 := z) ; set (temp4 := v) in * - end. - - change (prod_choiceType _ _) with ( (chElement ((( chFin (mkpos #|gT|) × chFin (mkpos #|gT|)) × chFin (mkpos #|'Z_Sigma1.q|)) × chFin (mkpos #|'Z_Sigma1.q|)))) in *. - - apply (r_transL (@assertD _ temp4 (fun z => x ← temp3 z ;; temp2 x))). - 1:{ - eapply r_transR. - 1:{ - apply r_bind_assertD_sym. - } - apply rreflexivity_rule. - } - subst temp1 temp2 temp3 temp4. hnf. - - match goal with - | |- context [⊢ ⦃ _ ⦄ assertD _ ?x ≈ assertD _ ?y ⦃ _ ⦄] => - set (temp1 := x) ; set (temp2 := y) - end. - - change (Sigma1.MyParam.Witness) with (Secret) in *. - (* Unset Printing Notations. *) - apply (@r_assertD_same (chFin (mkpos _)) (eq_op _ n)). - - intros. - subst temp1 temp2. hnf. - - ssprove_sync_eq. - ssprove_sync_eq=>a3. - ssprove_sync_eq=>a4. - apply r_ret. - intros. subst. - reflexivity. - - (* ssprove_sync_eq=>queries. - destruct (queries (Sigma1.Sigma.prod_assoc (fto (g ^+ otf x), fto (g ^+ otf r1)))) eqn:e. - all: rewrite e. - - simpl. - ssprove_code_simpl. - ssprove_sync_eq=>?. *) - (* Admitted. *) - Qed. - - #[tactic=notac] Equations? Aux_realised (b : bool) (i j : pid) m f' : - package (DDH.DDH_locs :|: P_i_locs i :|: combined_locations) Game_import [interface #val #[ Exec i ] : 'bool → 'public] := - Aux_realised b i j m f' := {package Aux b i j m f' ∘ (par DDH.DDH_real (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) }. - Proof. - ssprove_valid. - 4:{ rewrite fsetUid. rewrite -fset0E. apply fsub0set. } - 6: apply fsubsetxx. - 3:{ rewrite -fsetUA. apply fsubsetxx. } - 4:{ rewrite -fsetUA. apply fsubsetUl. } - all: unfold combined_locations. - - eapply fsubset_trans. 2: apply fsubsetUr. - apply fsubsetUl. - - eapply fsubset_trans. 2: apply fsubsetUr. - apply fsubsetUr. - - unfold DDH.DDH_E. - apply fsetUS. - rewrite !fset_cons. - apply fsubsetUr. - Qed. - - #[tactic=notac] Equations? Aux_ideal_realised (b : bool) (i j : pid) m f' : - package (DDH.DDH_locs :|: P_i_locs i :|: combined_locations) Game_import [interface #val #[ Exec i ] : 'bool → 'public] := - Aux_ideal_realised b i j m f' := {package Aux b i j m f' ∘ (par DDH.DDH_ideal (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) }. - Proof. - ssprove_valid. - 4:{ rewrite fsetUid. rewrite -fset0E. apply fsub0set. } - 6: apply fsubsetxx. - 3:{ rewrite -fsetUA. apply fsubsetxx. } - 4:{ rewrite -fsetUA. apply fsubsetUl. } - all: unfold combined_locations. - - eapply fsubset_trans. 2: apply fsubsetUr. - apply fsubsetUl. - - eapply fsubset_trans. 2: apply fsubsetUr. - apply fsubsetUr. - - unfold DDH.DDH_E. - apply fsetUS. - rewrite !fset_cons. - apply fsubsetUr. - Qed. - - Notation inv i := (heap_ignore (P_i_locs i :|: DDH.DDH_locs)). - - #[local] Hint Extern 50 (_ = code_link _ _) => - rewrite code_link_scheme - : ssprove_code_simpl. - - (** We extend swapping to schemes. - This means that the ssprove_swap tactic will be able to swap any command - with a scheme without asking a proof from the user. - *) - #[local] Hint Extern 40 (⊢ ⦃ _ ⦄ x ← ?s ;; y ← cmd _ ;; _ ≈ _ ⦃ _ ⦄) => - eapply r_swap_scheme_cmd ; ssprove_valid - : ssprove_swap. - - Lemma P_i_aux_equiv (i j : pid) m: - fdisjoint Sigma1.MyAlg.Sigma_locs DDH.DDH_locs → - i != j → - (∃ f, - bijective f ∧ - (∀ b, (Exec_i_realised b m i j) ≈₀ Aux_realised b i j m f)). - Proof. - intros Hdisj ij_neq. - have [f' Hf] := test_bij' i j m ij_neq. - simpl in Hf. - exists f'. - split. - { - assert ('I_#|'Z_#[g]|) as x. - { rewrite card_ord. - eapply Ordinal. - rewrite ltnS. - apply ltnSn. - } - specialize (Hf x). - destruct Hf. - assumption. - } - intro b. - eapply eq_rel_perf_ind with (inv := inv i). - { - ssprove_invariant. - rewrite -!fsetUA. - apply fsetUS. - do 2 (apply fsubsetU ; apply /orP ; right). - apply fsubsetUl. - } - simplify_eq_rel v. - rewrite !setmE. - rewrite !eq_refl. - ssprove_code_simpl. - repeat simplify_linking. - ssprove_sync => x_i. - - rewrite !cast_fun_K. - ssprove_code_simpl. - ssprove_code_simpl_more. - - ssprove_swap_seq_rhs [:: 4 ; 5 ; 6 ; 7]%N. - ssprove_swap_seq_rhs [:: 2 ; 3 ; 4 ; 5 ; 6]%N. - ssprove_swap_seq_rhs [:: 0 ; 1 ; 2 ; 3 ; 4 ; 5]%N. - ssprove_contract_put_get_rhs. - apply r_put_rhs. - ssprove_swap_seq_lhs [:: 0 ; 1 ; 2 ; 3]%N. - unfold Sigma1.MyParam.R. - have Hord : ∀ x, (nat_of_ord x) = (nat_of_ord (otf x)). - { - unfold otf. - intros n x. - rewrite enum_val_ord. - done. - } - rewrite -Hord otf_fto eq_refl. - simpl. - ssprove_sync => r_i. - apply r_put_vs_put. - ssprove_restore_pre. - { ssprove_invariant. - apply preserve_update_r_ignored_heap_ignore. - - unfold DDH.DDH_locs. - rewrite in_fsetU. - apply /orP ; right. - rewrite fset_cons. - rewrite in_fsetU. - apply /orP ; left. - by apply /fset1P. - - apply preserve_update_mem_nil. - } - lazymatch goal with - | |- ⊢ ⦃ _ ⦄ _ ≈ ?c ⦃ _ ⦄ => - lazymatch c with - | x ← sample ?op ;; _ => - (* Maybe make it one lemma, safer and probably less time consuming *) - eapply (rsame_head_cmd_alt (cmd_sample op)) ; [ - eapply cmd_sample_preserve_pre - | idtac - ] - | #put ?ℓ := ?v ;; _ => - eapply (@rsame_head_cmd_alt _ _ (λ z, _) (λ z, _) (cmd_put ℓ v)) ; [ - eapply cmd_put_preserve_pre ; ssprove_invariant - | intros - ] - | x ← get ?ℓ ;; _ => - eapply (rsame_head_cmd_alt (cmd_get ℓ)) ; [ - eapply cmd_get_preserve_pre ; ssprove_invariant - | idtac - ] - | x ← cmd ?c ;; _ => - eapply (rsame_head_cmd_alt c) - | @assertD ?A ?b _ => - eapply (r_assertD_same A b) - | _ => fail "No head found" - end - | |- _ => fail "The goal should be a syntactic judgment" - end. - (* ssprove_sync. *) - ssprove_swap_seq_lhs [:: 0 ]%N. - ssprove_swap_seq_rhs [:: 2 ; 1 ; 0]%N. - ssprove_sync => queries. - destruct (queries (Sigma1.Sigma.prod_assoc (fto (g ^+ x_i), fto (g ^+ otf r_i)))) eqn:e. - all: rewrite e; simpl. - all: ssprove_code_simpl_more. - - ssprove_swap_seq_lhs [:: 0 ; 1 ; 2 ; 3 ; 4 ; 5]%N. - ssprove_swap_seq_lhs [:: 0 ; 1 ]%N. - eapply r_uniform_bij. - { apply Hf. - + rewrite card_ord. - rewrite Zp_cast. - 2: apply (prime_gt1 prime_order). - eapply Ordinal. - apply (prime_gt1 prime_order). - } - intro x. - specialize (Hf x). - destruct Hf as [bij_f Hf]. - apply bij_inj in bij_f. - apply finv_f in bij_f. - ssprove_contract_put_get_rhs. - rewrite bij_f. - rewrite -Hord !otf_fto !eq_refl. - simpl. - apply r_put_rhs. - ssprove_restore_pre. - { - apply preserve_update_r_ignored_heap_ignore. - - unfold DDH.DDH_locs. - rewrite !fset_cons. - rewrite !in_fsetU. - apply /orP ; right. - apply /orP ; right. - apply /orP ; left. - by apply /fset1P. - - apply preserve_update_mem_nil. - } - apply r_get_remember_lhs. - intros ?. - apply r_get_remember_rhs. - intros ?. - ssprove_forget_all. - ssprove_sync=>r_j. - apply r_put_vs_put. - ssprove_restore_pre. - 1: ssprove_invariant. - clear e queries. - ssprove_sync. - ssprove_swap_seq_lhs [:: 0]%N. - ssprove_sync=>queries. - destruct (queries (Sigma1.Sigma.prod_assoc (fto (g ^+ x), fto (g ^+ otf r_j)))) eqn:e. - all: rewrite e. - all: ssprove_code_simpl. - all: ssprove_code_simpl_more. - + ssprove_swap_seq_lhs [:: 0 ; 1]%N. - simpl. - apply r_get_remember_lhs. - intros ?. - apply r_get_remember_rhs. - intros ?. - ssprove_forget_all. - apply r_assertD. - { - intros ??. - rewrite !domm_set. - done. - } - intros _ _. - ssprove_swap_lhs 1%N. - { - move: H0 => /eqP. - erewrite eqn_add2r. - intros contra. - discriminate. - } - ssprove_contract_put_get_lhs. - apply r_put_lhs. - ssprove_contract_put_get_lhs. - apply r_put_lhs. - ssprove_restore_pre. - { - repeat apply preserve_update_l_ignored_heap_ignore. - 1,2: unfold P_i_locs ; rewrite in_fsetU. - 1,2: apply /orP ; left ; rewrite !fset_cons ; - rewrite -fset0E fsetU0 ; rewrite in_fsetU. - - apply /orP ; right. - by apply /fset1P. - - apply /orP ; left. - by apply /fset1P. - - apply preserve_update_mem_nil. - } - rewrite otf_fto. - rewrite compute_key_set_i. - set zk := (fto (g ^+ x), fto (g ^+ otf r_j), s1, fto (otf x2 + otf s1 * otf x)%R). - clearbody zk. - specialize (Hf zk). - rewrite !Hord. - rewrite Hf. - rewrite -!Hord. - rewrite -expgM. - rewrite mulnC. - case b; apply r_ret ; done. - + ssprove_swap_seq_lhs [:: 0 ; 1 ; 2 ; 3]%N. - simpl. - ssprove_sync=>e_j. - apply r_put_vs_put. - apply r_get_remember_lhs. - intros ?. - apply r_get_remember_rhs. - intros ?. - ssprove_forget_all. - apply r_assertD. - { - intros ??. - rewrite !domm_set. - done. - } - intros _ _. - ssprove_swap_lhs 1%N. - { - move: H0 => /eqP. - erewrite eqn_add2r. - intros contra. - discriminate. - } - ssprove_contract_put_get_lhs. - apply r_put_lhs. - ssprove_contract_put_get_lhs. - apply r_put_lhs. - ssprove_restore_pre. - { - repeat apply preserve_update_l_ignored_heap_ignore. - 1,2: unfold P_i_locs ; rewrite in_fsetU. - 1,2: apply /orP ; left ; rewrite !fset_cons ; - rewrite -fset0E fsetU0 ; rewrite in_fsetU. - - apply /orP ; right. - by apply /fset1P. - - apply /orP ; left. - by apply /fset1P. - - ssprove_invariant. - } - rewrite otf_fto. - rewrite compute_key_set_i. - set zk := (fto (g ^+ x), fto (g ^+ otf r_j), e_j, fto (otf x2 + otf e_j * otf x)%R). - clearbody zk. - specialize (Hf zk). - rewrite !Hord. - rewrite Hf. - rewrite -!Hord. - rewrite -expgM. - rewrite mulnC. - case b; apply r_ret ; done. - - ssprove_swap_seq_lhs [:: 0 ; 1 ; 2 ; 3 ; 4 ; 5 ; 6 ; 7]%N. - ssprove_swap_seq_lhs [:: 2 ; 1 ; 0 ]%N. - eapply r_uniform_bij. - { apply Hf. - + rewrite card_ord. - rewrite Zp_cast. - 2: apply (prime_gt1 prime_order). - eapply Ordinal. - apply (prime_gt1 prime_order). - } - intro x. - specialize (Hf x). - destruct Hf as [bij_f Hf]. - apply bij_inj in bij_f. - apply finv_f in bij_f. - ssprove_contract_put_get_rhs. - rewrite bij_f. - rewrite -Hord !otf_fto !eq_refl. - simpl. - apply r_put_rhs. - ssprove_restore_pre. - { - apply preserve_update_r_ignored_heap_ignore. - - unfold DDH.DDH_locs. - rewrite !fset_cons. - rewrite !in_fsetU. - apply /orP ; right. - apply /orP ; right. - apply /orP ; left. - by apply /fset1P. - - apply preserve_update_mem_nil. - } - ssprove_sync=>e_i. - apply r_put_vs_put. - apply r_get_remember_lhs. - intros ?. - apply r_get_remember_rhs. - intros ?. - ssprove_forget_all. - rewrite -Hord eq_refl. - simpl. - ssprove_sync=>r_j. - apply r_put_vs_put. - ssprove_restore_pre. - 1: ssprove_invariant. - clear e queries. - ssprove_sync. - ssprove_swap_seq_lhs [:: 0]%N. - ssprove_sync=>queries. - destruct (queries (Sigma1.Sigma.prod_assoc (fto (g ^+ x), fto (g ^+ otf r_j)))) eqn:e. - all: rewrite e. - all: ssprove_code_simpl. - all: ssprove_code_simpl_more. - + ssprove_swap_seq_lhs [:: 0 ; 1]%N. - simpl. - apply r_get_remember_lhs. - intros ?. - apply r_get_remember_rhs. - intros ?. - ssprove_forget_all. - apply r_assertD. - { - intros ??. - rewrite !domm_set. - done. - } - intros _ _. - ssprove_swap_lhs 1%N. - { - move: H0 => /eqP. - erewrite eqn_add2r. - intros contra. - discriminate. - } - ssprove_contract_put_get_lhs. - apply r_put_lhs. - ssprove_contract_put_get_lhs. - apply r_put_lhs. - ssprove_restore_pre. - { - repeat apply preserve_update_l_ignored_heap_ignore. - 1,2: unfold P_i_locs ; rewrite in_fsetU. - 1,2: apply /orP ; left ; rewrite !fset_cons ; - rewrite -fset0E fsetU0 ; rewrite in_fsetU. - - apply /orP ; right. - by apply /fset1P. - - apply /orP ; left. - by apply /fset1P. - - apply preserve_update_mem_nil. - } - rewrite otf_fto. - rewrite compute_key_set_i. - set zk := (fto (g ^+ x), fto (g ^+ otf r_j), s, fto (otf x2 + otf s * otf x)%R). - clearbody zk. - specialize (Hf zk). - rewrite !Hord. - rewrite Hf. - rewrite -!Hord. - rewrite -expgM. - rewrite mulnC. - case b; apply r_ret ; done. - + ssprove_swap_seq_lhs [:: 0 ; 1 ; 2 ; 3]%N. - simpl. - ssprove_sync=>e_j. - apply r_put_vs_put. - apply r_get_remember_lhs. - intros ?. - apply r_get_remember_rhs. - intros ?. - ssprove_forget_all. - apply r_assertD. - { - intros ??. - rewrite !domm_set. - done. - } - intros _ _. - ssprove_swap_lhs 1%N. - { - move: H0 => /eqP. - erewrite eqn_add2r. - intros contra. - discriminate. - } - ssprove_contract_put_get_lhs. - apply r_put_lhs. - ssprove_contract_put_get_lhs. - apply r_put_lhs. - ssprove_restore_pre. - { - repeat apply preserve_update_l_ignored_heap_ignore. - 1,2: unfold P_i_locs ; rewrite in_fsetU. - 1,2: apply /orP ; left ; rewrite !fset_cons ; - rewrite -fset0E fsetU0 ; rewrite in_fsetU. - - apply /orP ; right. - by apply /fset1P. - - apply /orP ; left. - by apply /fset1P. - - ssprove_invariant. - } - rewrite otf_fto. - rewrite compute_key_set_i. - set zk := (fto (g ^+ x), fto (g ^+ otf r_j), e_j, fto (otf x2 + otf e_j * otf x)%R). - clearbody zk. - specialize (Hf zk). - rewrite !Hord. - rewrite Hf. - rewrite -!Hord. - rewrite -expgM. - rewrite mulnC. - case b; apply r_ret ; done. - Qed. - - Check secret. - Lemma Hord (x : secret): (nat_of_ord x) = (nat_of_ord (otf x)). - Proof. - unfold otf. - rewrite enum_val_ord. - done. - Qed. - - Lemma vote_hiding_bij (c : secret) (v : bool): - fto (otf (fto (g ^+ c)) * g ^+ v) = - fto - (otf (fto (g ^+ (if v then fto (Zp_add (otf c) Zp1) else fto (Zp_add (otf c) (Zp_opp Zp1))))) * - g ^+ (~~ v)). - Proof. - f_equal. - rewrite !otf_fto. - rewrite -!expgD. - have h' : ∀ (x : Secret), nat_of_ord x = (nat_of_ord (fto x)). - { - unfold fto. - intros k. - rewrite enum_rank_ord. - done. - } - case v. - ++ apply /eqP. - rewrite eq_expg_mod_order. - rewrite addn0. - have h : ∀ (x : secret), (((nat_of_ord x) + 1) %% q'.+2)%N = (nat_of_ord (Zp_add (otf x) Zp1)). - { - intro k. - unfold Zp_add. - simpl. - rewrite -Hord. - apply /eqP. - rewrite eq_sym. - apply /eqP. - rewrite -> Zp_cast at 2. - 2: apply (prime_gt1 prime_order). - rewrite -> Zp_cast at 1. - 2: apply (prime_gt1 prime_order). - rewrite modnDmr. - rewrite Fp_cast. - 2: apply prime_order. - reflexivity. - } - rewrite -h'. - rewrite -h. - rewrite -modn_mod. - rewrite Fp_cast. - 2: apply prime_order. - 1: apply eq_refl. - ++ apply /eqP. - rewrite eq_expg_mod_order. - rewrite addn0. - unfold Zp_add, Zp_opp, Zp1. - simpl. - repeat rewrite -> Zp_cast at 12. - 2-4: apply (prime_gt1 prime_order). - rewrite -!Hord. - have -> : (#[g] - 1 %% #[g])%N = #[g].-1. - { rewrite modn_small. - 2: apply (prime_gt1 prime_order). - by rewrite -subn1. - } - rewrite modn_small. - 2:{ - destruct c as [c Hc]. - move: Hc. - simpl. - unfold DDH.i_space, DDHParams.Space, Secret. - rewrite card_ord. - rewrite Zp_cast. - 2: apply (prime_gt1 prime_order). - done. - } - have -> : (#[g].-1 %% #[g])%N = #[g].-1. - { - rewrite modn_small. - 1: reflexivity. - apply ltnSE. - rewrite -subn1 -2!addn1. - rewrite subnK. - 2: apply (prime_gt0 prime_order). - rewrite addn1. - apply ltnSn. - } - rewrite -h'. - simpl. - rewrite -> Zp_cast at 9. - 2: apply (prime_gt1 prime_order). - rewrite modnDml. - rewrite -subn1. - rewrite -addnA. - rewrite subnK. - 2: apply (prime_gt0 prime_order). - rewrite -modnDmr. - rewrite modnn. - rewrite addn0. - rewrite modn_small. - 1: apply eq_refl. - destruct c as [h Hc]. - move: Hc. - unfold DDH.i_space, DDHParams.Space, Secret. - simpl. - rewrite card_ord. - rewrite Zp_cast. - 2: apply (prime_gt1 prime_order). - done. - Qed. - - Lemma vote_hiding (i j : pid) m: - i != j → - ∀ LA A ϵ_DDH, - ValidPackage LA [interface #val #[ Exec i ] : 'bool → 'public] A_export A → - fdisjoint Sigma1.MyAlg.Sigma_locs DDH.DDH_locs → - fdisjoint LA DDH.DDH_locs → - fdisjoint LA (P_i_locs i) → - fdisjoint LA combined_locations → - (∀ D, DDH.ϵ_DDH D <= ϵ_DDH) → - AdvantageE (Exec_i_realised true m i j) (Exec_i_realised false m i j) A <= ϵ_DDH + ϵ_DDH. - Proof. - intros ij_neq LA A ϵ_DDH Va Hdisj Hdisj2 Hdisj3 Hdisj4 Dadv. - have [f' [bij_f Hf]] := P_i_aux_equiv i j m Hdisj ij_neq. - ssprove triangle (Exec_i_realised true m i j) [:: - (Aux_realised true i j m f').(pack) ; - (Aux true i j m f') ∘ (par DDH.DDH_ideal (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) ; - (Aux false i j m f') ∘ (par DDH.DDH_ideal (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) ; - (Aux_realised false i j m f').(pack) - ] (Exec_i_realised false m i j) A as ineq. - eapply le_trans. - 2: { - instantiate (1 := 0 + ϵ_DDH + 0 + ϵ_DDH + 0). - by rewrite ?GRing.addr0 ?GRing.add0r. - } - eapply le_trans. 1: exact ineq. - clear ineq. - repeat eapply ler_add. - { - apply eq_ler. - specialize (Hf true LA A Va). - apply Hf. - - rewrite fdisjointUr. - apply /andP ; split ; assumption. - - rewrite fdisjointUr. - apply /andP ; split. - 2: assumption. - rewrite fdisjointUr. - apply /andP ; split ; assumption. - } - { - unfold Aux_realised. - rewrite -Advantage_link. - rewrite par_commut. - have -> : (par DDH.DDH_ideal (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) = - (par (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO) DDH.DDH_ideal). - { apply par_commut. ssprove_valid. } - Locate Advantage_par. - erewrite Advantage_par. - 3: apply DDH.DDH_real. - 3: apply DDH.DDH_ideal. - 2: { - ssprove_valid. - - eapply fsubsetUr. - - apply fsubsetUl. - } - 1: rewrite Advantage_sym ; apply Dadv. - - ssprove_valid. - - unfold trimmed. - rewrite -link_trim_commut. - f_equal. - unfold trim. - rewrite !fset_cons -fset0E fsetU0. - rewrite !filterm_set. - simpl. - rewrite !in_fsetU !in_fset1 !eq_refl. - rewrite filterm0. - done. - - unfold trimmed. - unfold trim. - rewrite !fset_cons -fset0E fsetU0. - rewrite !filterm_set. - simpl. - rewrite !in_fset1 !eq_refl. - rewrite filterm0. - done. - - unfold trimmed. - unfold trim. - rewrite !fset_cons -fset0E fsetU0. - rewrite !filterm_set. - simpl. - rewrite !in_fset1 !eq_refl. - rewrite filterm0. - done. - } - 2:{ - unfold Aux_realised. - rewrite -Advantage_link. - rewrite par_commut. - have -> : (par DDH.DDH_real (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) = - (par (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO) DDH.DDH_real). - { apply par_commut. ssprove_valid. } - erewrite Advantage_par. - 3: apply DDH.DDH_ideal. - 3: apply DDH.DDH_real. - 2: { - ssprove_valid. - - eapply fsubsetUr. - - apply fsubsetUl. - } - 1: apply Dadv. - - ssprove_valid. - - unfold trimmed. - rewrite -link_trim_commut. - f_equal. - unfold trim. - rewrite !fset_cons -fset0E fsetU0. - rewrite !filterm_set. - simpl. - rewrite !in_fsetU !in_fset1 !eq_refl. - rewrite filterm0. - done. - - unfold trimmed. - unfold trim. - unfold DDH.DDH_E. - rewrite !fset_cons -fset0E fsetU0. - rewrite !filterm_set. - simpl. - rewrite !in_fset1 !eq_refl. - rewrite filterm0. - done. - - unfold trimmed. - unfold trim. - unfold DDH.DDH_E. - rewrite !fset_cons -fset0E fsetU0. - rewrite !filterm_set. - simpl. - rewrite !in_fset1 !eq_refl. - rewrite filterm0. - done. - } - 2: { - apply eq_ler. - specialize (Hf false LA A Va). - rewrite Advantage_sym. - apply Hf. - - rewrite fdisjointUr. - apply /andP ; split ; assumption. - - rewrite fdisjointUr. - apply /andP ; split. - 2: assumption. - rewrite fdisjointUr. - apply /andP ; split ; assumption. - } - apply eq_ler. - eapply eq_rel_perf_ind with (inv := inv i). - 5: apply Va. - 1,2: apply Aux_ideal_realised. - 3: { - rewrite fdisjointUr. - apply /andP ; split. - 2: assumption. - rewrite fdisjointUr. - apply /andP ; split ; assumption. - } - 3: { - rewrite fdisjointUr. - apply /andP ; split. - 2: assumption. - rewrite fdisjointUr. - apply /andP ; split ; assumption. - } - { - ssprove_invariant. - rewrite fsetUC. - rewrite -!fsetUA. - apply fsetUS. - apply fsubsetUl. - } - simplify_eq_rel v. - rewrite !setmE. - rewrite !eq_refl. - simpl. - repeat simplify_linking. - rewrite !cast_fun_K. - ssprove_code_simpl. - ssprove_code_simpl_more. - ssprove_sync=>x_i. - ssprove_sync=>x_j. - pose f_v := (fun (x : secret) => - if v then - fto (Zp_add (otf x) Zp1) - else - fto (Zp_add (otf x) (Zp_opp Zp1)) - ). - assert (bijective f_v) as bij_fv. - { - exists (fun x => - if v then - fto (Zp_add (otf x) (Zp_opp Zp1)) - else - fto (Zp_add (otf x) Zp1) - ). - - intro x. - unfold f_v. - case v. - + rewrite otf_fto. - rewrite -Zp_addA. - rewrite Zp_addC. - have -> : (Zp_add Zp1 (Zp_opp Zp1)) = (Zp_add (Zp_opp Zp1) Zp1). - { intro n. by rewrite Zp_addC. } - rewrite Zp_addNz. - rewrite Zp_add0z. - by rewrite fto_otf. - + rewrite otf_fto. - rewrite -Zp_addA. - rewrite Zp_addC. - rewrite Zp_addNz. - rewrite Zp_add0z. - by rewrite fto_otf. - - intro x. - unfold f_v. - case v. - + rewrite otf_fto. - rewrite -Zp_addA. - rewrite Zp_addNz. - rewrite Zp_addC. - rewrite Zp_add0z. - by rewrite fto_otf. - + rewrite otf_fto. - rewrite -Zp_addA. - rewrite Zp_addC. - have -> : (Zp_add Zp1 (Zp_opp Zp1)) = (Zp_add (Zp_opp Zp1) Zp1). - { intro n. by rewrite Zp_addC. } - rewrite Zp_addNz. - rewrite Zp_add0z. - by rewrite fto_otf. - } - eapply r_uniform_bij. - 1: apply bij_fv. - intro c. - ssprove_swap_seq_rhs [:: 1 ; 2]%N. - ssprove_swap_seq_rhs [:: 0 ]%N. - ssprove_swap_seq_lhs [:: 1 ; 2]%N. - ssprove_swap_seq_lhs [:: 0 ]%N. - apply r_put_vs_put. - ssprove_contract_put_get_lhs. - ssprove_contract_put_get_rhs. - apply r_put_vs_put. - ssprove_contract_put_get_lhs. - ssprove_contract_put_get_rhs. - apply r_put_vs_put. - unfold Sigma1.MyParam.R. - rewrite -Hord otf_fto eq_refl. - simpl. - ssprove_sync=>r_i. - apply r_put_vs_put. - ssprove_restore_pre. - { - ssprove_invariant. - apply preserve_update_r_ignored_heap_ignore. - { - rewrite in_fsetU. - apply /orP ; right. - unfold DDH.DDH_locs. - rewrite !fset_cons -fset0E fsetU0. - rewrite in_fsetU. - apply /orP ; right. - rewrite in_fsetU. - apply /orP ; right. - by apply /fset1P. - } - apply preserve_update_l_ignored_heap_ignore. - 2: apply preserve_update_mem_nil. - rewrite in_fsetU. - apply /orP ; right. - unfold DDH.DDH_locs. - rewrite !fset_cons -fset0E fsetU0. - rewrite in_fsetU. - apply /orP ; right. - rewrite in_fsetU. - apply /orP ; right. - by apply /fset1P. - } - ssprove_sync. - ssprove_sync=>queries. - case (queries (Sigma1.Sigma.prod_assoc (fto (g ^+ x_i), fto (g ^+ otf r_i)))) eqn:e. - all: rewrite e. - all: ssprove_code_simpl ; simpl. - all: ssprove_code_simpl_more ; simpl. - - apply r_get_remember_lhs. - intros ?. - apply r_get_remember_rhs. - intros ?. - ssprove_forget_all. - rewrite -Hord otf_fto eq_refl. - simpl. - ssprove_sync=>e_j. - apply r_put_lhs. - apply r_put_rhs. - clear e queries. - ssprove_restore_pre. - 1: ssprove_invariant. - ssprove_sync. - ssprove_sync=>queries. - case (queries (Sigma1.Sigma.prod_assoc (fto (g ^+ finv f' x_j), fto (g ^+ otf e_j)))) eqn:e. - all: rewrite e. - all: simpl; ssprove_code_simpl. - all: ssprove_code_simpl_more. - + apply r_get_remember_lhs. - intros ?. - apply r_get_remember_rhs. - intros ?. - ssprove_forget_all. - apply r_assertD. - { - intros ??. - rewrite !domm_set. - done. - } - intros _ _. - apply r_ret. - intros ???. - split. - 2: assumption. - unfold f_v. - apply vote_hiding_bij. - + ssprove_sync=>e_i. - apply r_put_vs_put. - apply r_get_remember_lhs. - intros ?. - apply r_get_remember_rhs. - intros ?. - ssprove_forget_all. - apply r_assertD. - { - intros ??. - rewrite !domm_set. - done. - } - intros _ _. - ssprove_restore_pre. - 1: ssprove_invariant. - apply r_ret. - intros ???. - split. - 2: assumption. - unfold f_v. - apply vote_hiding_bij. - - ssprove_sync=>e_i. - apply r_put_vs_put. - apply r_get_remember_lhs. - intros ?. - apply r_get_remember_rhs. - intros ?. - ssprove_forget_all. - rewrite -Hord otf_fto. - rewrite -Hord eq_refl. - simpl. - ssprove_sync=>r_j. - apply r_put_lhs. - apply r_put_rhs. - ssprove_restore_pre. - 1: ssprove_invariant. - ssprove_sync. - ssprove_sync=>queries'. - case (queries' (Sigma1.Sigma.prod_assoc (fto (g ^+ finv f' x_j), fto (g ^+ otf r_j)))) eqn:e'. - all: rewrite e'. - all: simpl; ssprove_code_simpl. - all: ssprove_code_simpl_more. - + apply r_get_remember_lhs. - intros ?. - apply r_get_remember_rhs. - intros ?. - ssprove_forget_all. - apply r_assertD. - { - intros ??. - rewrite !domm_set. - done. - } - intros _ _. - apply r_ret. - intros ???. - split. - 2: assumption. - unfold f_v. - apply vote_hiding_bij. - + ssprove_sync=>e_j. - apply r_put_vs_put. - apply r_get_remember_lhs. - intros ?. - apply r_get_remember_rhs. - intros ?. - ssprove_forget_all. - apply r_assertD. - { - intros ??. - rewrite !domm_set. - done. - } - intros _ _. - ssprove_restore_pre. - 1: ssprove_invariant. - apply r_ret. - intros ???. - split. - 2: assumption. - unfold f_v. - apply vote_hiding_bij. - Qed. - -End OVN. -End OVN. diff --git a/ovn/proofs/ssprove/extraction/Schnorr.v b/ovn/proofs/ssprove/extraction/Schnorr.v deleted file mode 100644 index 19bf9e6..0000000 --- a/ovn/proofs/ssprove/extraction/Schnorr.v +++ /dev/null @@ -1,687 +0,0 @@ - -From Relational Require Import OrderEnrichedCategory GenericRulesSimple. - -Set Warnings "-notation-overridden,-ambiguous-paths". -From mathcomp Require Import all_ssreflect all_algebra reals distr realsum - fingroup.fingroup solvable.cyclic prime ssrnat ssreflect ssrfun ssrbool ssrnum - eqtype choice seq. -Set Warnings "notation-overridden,ambiguous-paths". - -From Mon Require Import SPropBase. - -From Crypt Require Import Axioms ChoiceAsOrd SubDistr Couplings - UniformDistrLemmas FreeProbProg Theta_dens RulesStateProb UniformStateProb - pkg_core_definition choice_type pkg_composition pkg_rhl Package Prelude. - -Require Import SigmaProtocol. - -From Coq Require Import Utf8. -From extructures Require Import ord fset fmap. - -From Equations Require Import Equations. -Require Equations.Prop.DepElim. - -Set Equations With UIP. - -Set Bullet Behavior "Strict Subproofs". -Set Default Goal Selector "!". -Set Primitive Projections. - -Local Open Scope ring_scope. -Import GroupScope GRing.Theory. - -Import Num.Def. -Import Num.Theory. -Import Order.POrderTheory. - -Import PackageNotation. - -Module Type GroupParam. - - Parameter gT : finGroupType. - Definition ζ : {set gT} := [set : gT]. - Parameter g : gT. - Parameter g_gen : ζ = <[g]>. - Parameter prime_order : prime #[g]. - -End GroupParam. - -Module Schnorr (GP : GroupParam). - -Import GP. - -(* order of g *) -Definition q : nat := #[g]. - -Module MyParam <: SigmaProtocolParams. - - Definition Witness : finType := [finType of 'Z_q]. - Definition Statement : finType := FinGroup.arg_finType gT. - Definition Message : finType := FinGroup.arg_finType gT. - Definition Challenge : finType := [finType of 'Z_q]. - Definition Response : finType := [finType of 'Z_q]. - Definition Transcript := - prod_finType (prod_finType Message Challenge) Response. - - Definition w0 : Witness := 0. - Definition e0 : Challenge := 0. - Definition z0 : Response := 0. - - Definition R : Statement -> Witness -> bool := - (λ (h : Statement) (w : Witness), h == (g ^+ w)). - - #[export] Instance positive_gT : Positive #|gT|. - Proof. - apply /card_gt0P. exists g. auto. - Qed. - - #[export] Instance Witness_pos : Positive #|Witness|. - Proof. - apply /card_gt0P. exists w0. auto. - Qed. - - Definition Statement_pos : Positive #|Statement| := _. - Definition Message_pos : Positive #|Message| := _. - Definition Challenge_pos : Positive #|Challenge| := _. - Definition Response_pos : Positive #|Response| := _. - Definition Bool_pos : Positive #|bool_choiceType|. - Proof. - rewrite card_bool. done. - Defined. - -End MyParam. - -Module MyAlg <: SigmaProtocolAlgorithms MyParam. - - Import MyParam. - - #[local] Existing Instance Bool_pos. - - Definition choiceWitness : choice_type := 'fin #|Witness|. - Definition choiceStatement : choice_type := 'fin #|Statement|. - Definition choiceMessage : choice_type := 'fin #|Message|. - Definition choiceChallenge : choice_type := 'fin #|Challenge|. - Definition choiceResponse : choice_type := 'fin #|Response|. - Definition choiceTranscript : choice_type := - chProd - (chProd (chProd choiceStatement choiceMessage) choiceChallenge) - choiceResponse. - Definition choiceBool := 'fin #|bool_choiceType|. - - Definition i_witness := #|Witness|. - - Definition commit_loc : Location := (choiceWitness; 2%N). - - Definition Sigma_locs : {fset Location} := fset [:: commit_loc]. - Definition Simulator_locs : {fset Location} := fset0. - - Definition Commit (h : choiceStatement) (w : choiceWitness): - code Sigma_locs [interface] choiceMessage := - {code - r ← sample uniform i_witness ;; - #put commit_loc := r ;; - ret (fto (g ^+ (otf r))) - }. - - Definition Response (h : choiceStatement) (w : choiceWitness) (a : choiceMessage) (e : choiceChallenge) : - code Sigma_locs [interface] choiceResponse := - {code - r ← get commit_loc ;; - ret (fto (otf r + otf e * otf w)) - }. - - Definition Simulate (h : choiceStatement) (e : choiceChallenge) : - code Simulator_locs [interface] choiceTranscript := - {code - z ← sample uniform i_witness ;; - ret (h, fto (g ^+ (otf z) * (otf h ^- (otf e))), e, z) - }. - - Definition Verify (h : choiceStatement) (a : choiceMessage) - (e : choiceChallenge) (z : choiceResponse) : choiceBool := - fto (g ^+ (otf z) == (otf a) * (otf h) ^+ (otf e)). - - Definition Extractor (h : choiceStatement) (a : choiceMessage) - (e : choiceChallenge) (e' : choiceChallenge) - (z : choiceResponse) (z' : choiceResponse) : 'option choiceWitness := - Some (fto ((otf z - otf z') / (otf e - otf e'))). - - Definition KeyGen (w : choiceWitness) := fto (g ^+ w). - -End MyAlg. - - -#[local] Open Scope package_scope. - -Module Sigma := SigmaProtocol MyParam MyAlg. - -Import MyParam MyAlg Sigma. - -Lemma cyclic_zeta: cyclic ζ. -Proof. - apply /cyclicP. exists g. exact: g_gen. -Qed. - -Lemma group_prodC : - ∀ (x y : gT), x * y = y * x. -Proof. - move => x y. - have Hx: exists ix, x = g^+ix. - { apply /cycleP. rewrite -g_gen. - apply: in_setT. - } - have Hy: exists iy, y = g^+iy. - { apply /cycleP. rewrite -g_gen. - apply: in_setT. - } - destruct Hx as [ix Hx]. - destruct Hy as [iy Hy]. - subst. - repeat rewrite -expgD addnC. reflexivity. -Qed. - -Lemma group_prodA : - ∀ (x y z : gT), x * (y * z) = (x * y) * z. -Proof. - move => x y z. - have Hx: exists ix, x = g^+ix. - { apply /cycleP. rewrite -g_gen. - apply: in_setT. - } - have Hy: exists iy, y = g^+iy. - { apply /cycleP. rewrite -g_gen. - apply: in_setT. - } - have Hz: exists iz, z = g^+iz. - { apply /cycleP. rewrite -g_gen. - apply: in_setT. - } - destruct Hx as [ix Hx]. - destruct Hy as [iy Hy]. - - subst. - repeat rewrite -expgD addnC addnA. - rewrite mulgA. - reflexivity. -Qed. - -#[local] Definition f (e w : Witness) : - Arit (uniform i_witness) → Arit (uniform i_witness) := - λ z, fto (otf z + e * w). - -Lemma order_ge1 : succn (succn (Zp_trunc q)) = q. -Proof. - apply Zp_cast, prime_gt1, prime_order. -Qed. - -Lemma bij_f w e : bijective (f w e). -Proof. - unfold f. - exists (λ x, fto (otf x - w * e)). - all: intro x ; unfold fto, otf ; rewrite !enum_rankK. - - by rewrite addrK enum_valK. - - by rewrite subrK enum_valK. -Qed. - - -(* Main theorem. *) -(* Proves that Schnorr is a ∑-protocol with perfect special honest-verifier - zero-knowledge *) -Theorem schnorr_SHVZK : - ∀ LA A, - ValidPackage LA [interface - #val #[ TRANSCRIPT ] : chInput → chTranscript - ] A_export A → - fdisjoint LA Sigma_locs → - ɛ_SHVZK A = 0. -Proof. - intros LA A Va Hdisj. - apply: eq_rel_perf_ind. - all: ssprove_valid. - 3: apply fdisjoints0. - 1:{ instantiate (1 := heap_ignore Sigma_locs). - ssprove_invariant. - apply fsubsetUl. } - simplify_eq_rel hwe. - (* Programming logic part *) - destruct hwe as [[h w] e]. - (* We can only simulate if the relation is valid *) - ssprove_sync_eq. intros rel. - (* When relation holds we can reconstruct the first message from the response *) - unfold R in rel. apply reflection_nonsense in rel. - eapply r_uniform_bij with (1 := bij_f (otf w) (otf e)). intros z_val. - ssprove_contract_put_get_lhs. - apply r_put_lhs. - ssprove_restore_pre. - 1: ssprove_invariant. - apply r_ret. - (* Ambient logic proof of post condition *) - intros s₀ s₁ Hs. - unfold f. - rewrite rel. - split. - 2: apply Hs. - simpl. - rewrite otf_fto expg_mod. - 2: rewrite order_ge1 ; apply expg_order. - rewrite expgD - !expgVn. - rewrite group_prodC group_prodA group_prodC group_prodA /=. - rewrite expg_mod. - 2: rewrite order_ge1 ; apply expg_order. - rewrite -expgM -expgMn. - 2: apply group_prodC. - rewrite mulgV expg1n mul1g. - cbn. rewrite Zp_mulC. - reflexivity. -Qed. - -Lemma otf_neq : - ∀ (a b : choiceChallenge), - a != b → otf a != otf b. -Proof. - intros a b. - apply: contra => H. - rewrite bij_eq in H. - - assumption. - - apply enum_val_bij. -Qed. - -Lemma neq_pos : - ∀ (q : nat) (a b : Zp_finZmodType q), - a != b → - a - b != 0. -Proof. - intros q a b. - apply contraPneq => H_eq. - assert (H : (a - b == 0)). - { by rewrite H_eq. } - rewrite subr_eq0 in H. - apply reflection_nonsense in H. - rewrite H. - unfold not => contra. - rewrite eq_refl in contra. - discriminate. -Qed. - -(* Lemma proving that the output of the extractor defined for Schnorr's - protocol is perfectly indistinguishable from real protocol execution. - *) -Lemma extractor_success: - ∀ LA A, - ValidPackage LA [interface - #val #[ SOUNDNESS ] : chSoundness → 'bool - ] A_export A → - ɛ_soundness A = 0. -Proof. - intros LA A VA. - apply: eq_rel_perf_ind_eq. - 2,3: apply fdisjoints0. - simplify_eq_rel h. - destruct h as [? [? [? [? [? ?]]]]]. - destruct s1. - case [&& _ & _] eqn:e. - all: apply r_ret; auto. - intros h1 h2 ->. - (* Algebraic proof that the produced witness satisfies the relation. *) - unfold R. - unfold "&&" in e. - inversion e. - repeat match goal with - | |- context [ if ?b then _ else _ ] => case b eqn:? - end. - 2,3: discriminate. - rewrite otf_fto in Heqs4. - rewrite otf_fto in e. - apply reflection_nonsense in e. - apply reflection_nonsense in Heqs4. - rewrite H0. - rewrite otf_fto expg_mod. - 2: rewrite order_ge1 ; apply expg_order. - rewrite expgM expg_mod. - 2: rewrite order_ge1 ; apply expg_order. - rewrite expgD -FinRing.zmodVgE expg_zneg. - 2: apply cycle_id. - rewrite Heqs4 e !expgMn. - 2-3: apply group_prodC. - rewrite invMg !expgMn. - 2: apply group_prodC. - rewrite !group_prodA. - rewrite group_prodC 2!group_prodA -expgMn. - 2: apply group_prodC. - rewrite mulVg expg1n mul1g -expg_zneg. - 2:{ - have Hx : exists ix, otf s = g ^+ ix. - { apply /cycleP. rewrite -g_gen. apply: in_setT. } - destruct Hx as [ix ->]. - apply mem_cycle. - } - rewrite expgAC. - rewrite [otf s ^+ (- otf s2) ^+ _] expgAC. - rewrite -expgD -expgM. - have <- := @expg_mod _ q. - 2:{ - have Hx : exists ix, otf s = g ^+ ix. - { apply /cycleP. rewrite -g_gen. apply: in_setT. } - destruct Hx as [ix ->]. - rewrite expgAC /q. - rewrite expg_order. - apply expg1n. - } - rewrite -modnMmr. - have -> : - (modn - (addn (@nat_of_ord (S (S (Zp_trunc q))) (@otf Challenge s1)) - (@nat_of_ord (S (S (Zp_trunc q))) - (@GRing.opp (FinRing.Zmodule.zmodType (Zp_finZmodType (S (Zp_trunc q)))) - (@otf Challenge s2)))) q) = - (@nat_of_ord (S (S (Zp_trunc q))) - (@Zp_add (S (Zp_trunc q)) (@otf Challenge s1) (@Zp_opp (S (Zp_trunc q)) (@otf Challenge s2)))). - { simpl. - rewrite modnDmr. - destruct (otf s2) as [a Ha]. - destruct a as [| Pa]. - - simpl. - rewrite subn0 modnn addn0 modnDr. - rewrite -> order_ge1 at 3. - rewrite modn_small. - + reflexivity. - + rewrite <- order_ge1 at 2. apply ltn_ord. - - simpl. - rewrite <- order_ge1 at 4. - rewrite modnDmr. - reflexivity. - } - have -> : - (modn - (muln (@nat_of_ord (S (S (Zp_trunc q))) - (@GRing.inv (FinRing.UnitRing.unitRingType (Zp_finUnitRingType (Zp_trunc q))) - (@GRing.add (FinRing.Zmodule.zmodType (Zp_finZmodType (S (Zp_trunc q)))) - (@otf Challenge s1) - (@GRing.opp (FinRing.Zmodule.zmodType (Zp_finZmodType (S (Zp_trunc q)))) - (@otf Challenge s2))))) - (@nat_of_ord (S (S (Zp_trunc q))) - (@Zp_add (S (Zp_trunc q)) (@otf Challenge s1) (@Zp_opp (S (Zp_trunc q)) (@otf Challenge s2))))) q) = - (Zp_mul - (@GRing.inv (FinRing.UnitRing.unitRingType (Zp_finUnitRingType (Zp_trunc q))) - (@GRing.add (FinRing.Zmodule.zmodType (Zp_finZmodType (S (Zp_trunc q)))) - (@otf Challenge s1) - (@GRing.opp (FinRing.Zmodule.zmodType (Zp_finZmodType (S (Zp_trunc q)))) - (@otf Challenge s2)))) - (@Zp_add (S (Zp_trunc q)) (@otf Challenge s1) (@Zp_opp (S (Zp_trunc q)) (@otf Challenge s2)))). - { simpl. - rewrite modnDmr. - rewrite <- order_ge1 at 9. - rewrite modnMmr. - reflexivity. - } - rewrite Zp_mulVz. - 1: cbn ; by rewrite eq_refl. - rewrite -> order_ge1 at 1. - apply otf_neq in Heqb. - rewrite prime_coprime. - 2: apply prime_order. - rewrite gtnNdvd. - - done. - - rewrite lt0n. - apply neq_pos. - assumption. - - destruct (otf s1 - otf s2) as [k Hk]. - simpl. - rewrite order_ge1 in Hk. - apply Hk. -Qed. - -(* Main theorem proving that the Schnorr protocol has perfect hiding. *) -Theorem schnorr_com_hiding : - ∀ LA A, - ValidPackage LA [interface - #val #[HIDING] : (chChallenge) × (chChallenge) → chMessage - ] A_export (A ∘ par KEY (ID Hiding_E)) -> - fdisjoint LA KEY_locs -> - fdisjoint LA Sigma_to_Com_locs -> - fdisjoint LA (fset [:: setup_loc]) -> - fdisjoint LA Sigma_locs -> - fdisjoint LA Simulator_locs -> - ɛ_hiding A <= 0. -Proof. - intros LA A VA Hd1 Hd2 Hd3 Hd4 Hd5. - eapply le_trans. - 1: eapply commitment_hiding with (LA := LA). - all: try assumption. - 1: apply fdisjoint0s. - { - unfold Sigma_locs. - unfold commit_loc. - unfold statement_loc. - unfold witness_loc. - rewrite !fset_cons. - rewrite -fset0E. - rewrite fdisjointUr ; apply /andP ; split. - - rewrite fdisjoints1. - rewrite fset1E. - rewrite fsetU0. - rewrite -fset1E. - unfold "\notin". - rewrite in_fset1. - case (_ == _) eqn:e. - 2: done. - move: e => /eqP. - done. - - rewrite fdisjointUr ; apply /andP ; split. - + rewrite fdisjoints1. - rewrite fset1E. - rewrite fsetU0. - rewrite -fset1E. - unfold "\notin". - rewrite in_fset1. - case (_ == _) eqn:e. - 2: done. - move: e => /eqP. - done. - + apply fdisjoints0. - } - rewrite addr0. - rewrite add0r. - erewrite schnorr_SHVZK. - 2: { - ssprove_valid. - 1: instantiate (1 := (LA :|: (setup_loc |: Sigma_to_Com_locs))). - 3: apply fsubsetxx. - 2: apply fsub0set. - - apply fsubsetUl. - - apply fsubsetU ; apply /orP ; right. - apply fsubsetxx. - } - 2: { - (* unfold Sigma_locs. *) - unfold Sigma_to_Com_locs. - unfold Simulator_locs. - rewrite fsetU0. - rewrite fdisjointUl ; apply /andP ; split. - - assumption. - - unfold Sigma_locs. - rewrite fdisjointUl ; apply /andP ; split. - + rewrite fdisjoint1s. - unfold "\notin". - rewrite -fset1E. - rewrite in_fset1. - done. - + unfold Com_locs. - rewrite fset_cons. - rewrite fdisjointUl ; apply /andP ; split. - ++ rewrite fdisjoint1s. - rewrite -fset1E. - unfold "\notin". - rewrite in_fset1. - done. - ++ - rewrite -!fset1E. - rewrite fdisjoint1s. - unfold "\notin". - rewrite in_fset1. - done. - } - rewrite Advantage_sym. - erewrite schnorr_SHVZK. - 2: { - ssprove_valid. - 1: instantiate (1 := (LA :|: (setup_loc |: Sigma_to_Com_locs))). - 3: apply fsubsetxx. - 2: apply fsub0set. - - apply fsubsetUl. - - apply fsubsetU ; apply /orP ; right. - apply fsubsetxx. - } - 2: { - (* unfold Sigma_locs. *) - unfold Sigma_to_Com_locs. - unfold Simulator_locs. - rewrite fsetU0. - rewrite fdisjointUl ; apply /andP ; split. - - assumption. - - unfold Sigma_locs. - rewrite fdisjointUl ; apply /andP ; split. - + rewrite fdisjoint1s. - unfold "\notin". - rewrite -fset1E. - rewrite in_fset1. - done. - + unfold Com_locs. - rewrite fset_cons. - rewrite fdisjointUl ; apply /andP ; split. - ++ rewrite fdisjoint1s. - rewrite -fset1E. - unfold "\notin". - rewrite in_fset1. - done. - ++ - rewrite -!fset1E. - rewrite fdisjoint1s. - unfold "\notin". - rewrite in_fset1. - done. - } - rewrite addr0 add0r. - apply eq_ler. - eapply eq_rel_perf_ind. - 1,2: exact _. - 1:{ - instantiate (1 := (heap_ignore Com_locs)). - ssprove_invariant. - unfold Sigma_to_Com_locs. - rewrite !fset0U. - apply fsubsetU; apply /orP; left. - apply fsubsetU; apply /orP; left. - apply fsubsetU; apply /orP; right. - apply fsubsetU; apply /orP; left. - apply fsubsetxx. - } - 2: apply VA. - 3: { - rewrite fset0U. - rewrite fdisjointUr ; apply /andP ; split. - 2: assumption. - rewrite fdisjointUr ; apply /andP ; split. - 2: assumption. - rewrite fset1E. assumption. - } - 2: { - rewrite fset0U. - rewrite fdisjointUr ; apply /andP ; split. - 2: assumption. - rewrite fdisjointUr ; apply /andP ; split. - 2: assumption. - rewrite fset1E. assumption. - } - rewrite Sigma_to_Com_Aux_equation_1. - simplify_eq_rel hwe. - ssprove_code_simpl. - simplify_linking. - destruct hwe as [e e']. - apply r_const_sample_R. - 1: apply LosslessOp_uniform. - intros e_rand. - rewrite !cast_fun_K. - ssprove_code_simpl. - ssprove_code_simpl_more. - apply r_const_sample_L. - 1: apply LosslessOp_uniform. - intros b. - simpl. - case (Nat.even b) eqn:hb. - - rewrite hb ; clear hb. - ssprove_code_simpl. - ssprove_code_simpl_more. - ssprove_code_simpl. - ssprove_code_simpl_more. - ssprove_sync=>setup. - apply r_assertD. - 1: done. - intros _ _. - ssprove_sync=> w. - apply r_assertD. - 1: done. - intros _ _. - ssprove_sync. - apply r_assertD. - 1: done. - intros _ rel. - ssprove_sync=>x. - ssprove_contract_put_get_lhs. - ssprove_contract_put_get_rhs. - eapply r_put_vs_put. - eapply r_put_vs_put. - eapply r_put_vs_put. - ssprove_restore_pre. 1: ssprove_invariant. - apply r_ret. intuition auto. - - rewrite hb ; clear hb. - ssprove_code_simpl. - ssprove_code_simpl_more. - ssprove_code_simpl. - ssprove_code_simpl_more. - ssprove_sync=>setup. - apply r_assertD. - 1: done. - intros _ _. - ssprove_sync=> w. - apply r_assertD. - 1: done. - intros _ _. - ssprove_sync. - apply r_assertD. - 1: done. - intros _ rel. - ssprove_sync=>x. - ssprove_contract_put_get_lhs. - ssprove_contract_put_get_rhs. - eapply r_put_vs_put. - eapply r_put_vs_put. - eapply r_put_vs_put. - ssprove_restore_pre. 1: ssprove_invariant. - apply r_ret. intuition auto. -Qed. - - -End Schnorr. - -Module GP_Z3 <: GroupParam. - - Definition gT : finGroupType := Zp_finGroupType 2. - Definition ζ : {set gT} := [set : gT]. - Definition g : gT := Zp1. - - Lemma g_gen : ζ = <[g]>. - Proof. - unfold ζ, g. apply Zp_cycle. - Qed. - - Lemma prime_order : prime #[g]. - Proof. - unfold g. - rewrite order_Zp1. - reflexivity. - Qed. - -End GP_Z3. - -Module Schnorr_Z3 := Schnorr GP_Z3. diff --git a/ovn/proofs/ssprove/extraction/SigmaProtocol.v b/ovn/proofs/ssprove/extraction/SigmaProtocol.v deleted file mode 100644 index f0a117a..0000000 --- a/ovn/proofs/ssprove/extraction/SigmaProtocol.v +++ /dev/null @@ -1,1064 +0,0 @@ - -From Relational Require Import OrderEnrichedCategory GenericRulesSimple. - -Set Warnings "-notation-overridden,-ambiguous-paths". -From mathcomp Require Import all_ssreflect all_algebra reals distr realsum - fingroup.fingroup solvable.cyclic prime ssrnat ssreflect ssrfun ssrbool ssrnum - eqtype choice seq. -Set Warnings "notation-overridden,ambiguous-paths". - -From Crypt Require Import Axioms ChoiceAsOrd SubDistr Couplings - UniformDistrLemmas FreeProbProg Theta_dens RulesStateProb UniformStateProb - pkg_core_definition choice_type pkg_composition pkg_rhl - Package Prelude RandomOracle. - -From Coq Require Import Utf8. -From extructures Require Import ord fset fmap. - -From Equations Require Import Equations. -Require Equations.Prop.DepElim. - -Set Equations With UIP. - -Set Bullet Behavior "Strict Subproofs". -Set Default Goal Selector "!". -Set Primitive Projections. - -Import Num.Def. -Import Num.Theory. -Import Order.POrderTheory. - -Import PackageNotation. - -#[local] Open Scope ring_scope. - -Module Type SigmaProtocolParams. - - Parameter Witness Statement Message Challenge Response : finType. - Parameter w0 : Witness. - Parameter e0 : Challenge. - Parameter z0 : Response. - Parameter R : Statement → Witness → bool. - - Parameter Statement_pos : Positive #|Statement|. - Parameter Witness_pos : Positive #|Witness|. - Parameter Message_pos : Positive #|Message|. - Parameter Challenge_pos : Positive #|Challenge|. - Parameter Response_pos : Positive #|Response|. - Parameter Bool_pos : Positive #|bool_choiceType|. - -End SigmaProtocolParams. - -Module Type SigmaProtocolAlgorithms (π : SigmaProtocolParams). - - Import π. - - #[local] Open Scope package_scope. - - #[local] Existing Instance Bool_pos. - #[local] Existing Instance Statement_pos. - #[local] Existing Instance Witness_pos. - #[local] Existing Instance Message_pos. - #[local] Existing Instance Challenge_pos. - #[local] Existing Instance Response_pos. - - Definition choiceWitness := 'fin #|Witness|. - Definition choiceStatement := 'fin #|Statement|. - Definition choiceMessage := 'fin #|Message|. - Definition choiceChallenge := 'fin #|Challenge|. - Definition choiceResponse := 'fin #|Response|. - Definition choiceTranscript := - chProd (chProd (chProd choiceStatement choiceMessage) choiceChallenge) choiceResponse. - Definition choiceBool := 'fin #|bool_choiceType|. - - Parameter Sigma_locs : {fset Location}. - - Parameter Simulator_locs : {fset Location}. - - Parameter Commit : - ∀ (h : choiceStatement) (w : choiceWitness), - code Sigma_locs [interface] choiceMessage. - - Parameter Response : - ∀ (h : choiceStatement) (w : choiceWitness) - (a : choiceMessage) (e : choiceChallenge), - code Sigma_locs [interface] choiceResponse. - - Parameter Verify : - ∀ (h : choiceStatement) (a : choiceMessage) (e : choiceChallenge) - (z : choiceResponse), - choiceBool. - - Parameter Simulate : - ∀ (h : choiceStatement) (e : choiceChallenge), - code Simulator_locs [interface] choiceTranscript. - - Parameter Extractor : - ∀ (h : choiceStatement) (a : choiceMessage) - (e : choiceChallenge) (e' : choiceChallenge) - (z : choiceResponse) (z' : choiceResponse), - 'option choiceWitness. - - Parameter KeyGen : ∀ (w : choiceWitness), choiceStatement. - -End SigmaProtocolAlgorithms. - -Module SigmaProtocol (π : SigmaProtocolParams) - (Alg : SigmaProtocolAlgorithms π). - - Import π. - Import Alg. - - Notation " 'chStatement' " := - choiceStatement (in custom pack_type at level 2). - Notation " 'chWitness' " := - choiceWitness (in custom pack_type at level 2). - Notation " 'chChallenge' " := - choiceChallenge (in custom pack_type at level 2). - Notation " 'chRelation' " := - (chProd choiceStatement choiceWitness) (in custom pack_type at level 2). - Definition choiceInput := (chProd (chProd choiceStatement choiceWitness) choiceChallenge). - Notation " 'chInput' " := - choiceInput - (in custom pack_type at level 2). - Notation " 'chMessage' " := choiceMessage (in custom pack_type at level 2). - Notation " 'chTranscript' " := - choiceTranscript (in custom pack_type at level 2). - Definition Opening := chProd choiceChallenge choiceResponse. - Notation " 'chSoundness' " := - (chProd choiceStatement (chProd choiceMessage (chProd Opening Opening))) - (in custom pack_type at level 2). - - Definition i_challenge := #|Challenge|. - Definition i_witness := #|Witness|. - - Definition TRANSCRIPT : nat := 0. - Definition COM : nat := 1. - Definition VER : nat := 2. - Definition ADV : nat := 3. - Definition SOUNDNESS : nat := 4. - - Definition i_challenge_pos : Positive i_challenge. - Proof. - unfold i_challenge. - apply Challenge_pos. - Qed. - - Definition i_witness_pos : Positive i_witness. - Proof. - unfold i_witness. - apply Witness_pos. - Qed. - - #[local] Existing Instance i_challenge_pos. - #[local] Existing Instance i_witness_pos. - - #[local] Open Scope package_scope. - - Definition SHVZK_real: - package Sigma_locs - [interface] - [interface #val #[ TRANSCRIPT ] : chInput → chTranscript] - := - [package - #def #[ TRANSCRIPT ] (hwe : chInput) : chTranscript - { - let '(h,w,e) := hwe in - #assert (R (otf h) (otf w)) ;; - a ← Commit h w ;; - z ← Response h w a e ;; - @ret choiceTranscript (h,a,e,z) - } - ]. - - Definition SHVZK_ideal: - package Simulator_locs - [interface] - [interface #val #[ TRANSCRIPT ] : chInput → chTranscript] - := - [package - #def #[ TRANSCRIPT ] (hwe : chInput) : chTranscript - { - let '(h, w, e) := hwe in - #assert (R (otf h) (otf w)) ;; - t ← Simulate h e ;; - ret t - } - ]. - - (* Main security statement for Special Honest-Verifier Zero-Knowledge. *) - Definition ɛ_SHVZK A := AdvantageE SHVZK_real SHVZK_ideal A. - - Definition Special_Soundness_f : - package fset0 - [interface] - [interface #val #[ SOUNDNESS ] : chSoundness → 'bool ] - := - [package - #def #[ SOUNDNESS ] (t : chSoundness) : 'bool - { - let '(h, (a, ((e, z), (e', z')))) := t in - let v1 := Verify h a e z in - let v2 := Verify h a e' z' in - if [&& (e != e') , (otf v1) & (otf v2) ] then - match Extractor h a e e' z z' with - | Some w => ret (R (otf h) (otf w)) - | None => ret false - end - else ret false - } - ]. - - Definition Special_Soundness_t : - package fset0 - [interface] - [interface #val #[ SOUNDNESS ] : chSoundness → 'bool ] - := - [package - #def #[ SOUNDNESS ] (t : chSoundness) : 'bool - { - let '(h, (a, ((e, z), (e', z')))) := t in - let v1 := Verify h a e z in - let v2 := Verify h a e' z' in - ret [&& (e != e') , (otf v1) & (otf v2) ] - } - ]. - - (* Main security statement for 2-special soundness. *) - Definition ɛ_soundness A := - AdvantageE Special_Soundness_t Special_Soundness_f A. - - (**************************************) - (* Start of Commitment Scheme Section *) - (**************************************) - Section Commitments. - - Definition HIDING : nat := 5. - Definition OPEN : nat := 6. - Definition INIT : nat := 7. - Definition GET : nat := 8. - - Definition challenge_loc : Location := ('option choiceChallenge; 7%N). - Definition response_loc : Location := ('option choiceResponse; 8%N). - - Definition Com_locs : {fset Location} := - fset [:: challenge_loc ; response_loc ]. - - - Definition setup_loc : Location := ('bool; 10%N). - Definition statement_loc : Location := (choiceStatement; 11%N). - Definition witness_loc : Location := (choiceWitness; 12%N). - Definition KEY_locs : {fset Location} := fset [:: setup_loc; witness_loc ; statement_loc]. - - Definition choiceOpen := (chProd choiceChallenge choiceResponse). - Notation " 'chOpen' " := choiceOpen (in custom pack_type at level 2). - Notation " 'chKeys' " := (chProd choiceStatement choiceWitness) (in custom pack_type at level 2). - - Lemma in_fset_left l (L1 L2 : {fset Location}) : - is_true (l \in L1) → - is_true (l \in (L1 :|: L2)). - Proof. - intros H. - apply /fsetUP. - left. assumption. - Qed. - - Hint Extern 20 (is_true (_ \in (_ :|: _))) => - apply in_fset_left; solve [auto_in_fset] - : typeclass_instances ssprove_valid_db. - - Definition KEY: - package KEY_locs - [interface] - [interface - #val #[ INIT ] : 'unit → 'unit ; - #val #[ GET ] : 'unit → chStatement - ] - := - [package - #def #[ INIT ] (_ : 'unit) : 'unit - { - b ← get setup_loc ;; - #assert (negb b) ;; - w ← sample uniform i_witness ;; - let h := KeyGen w in - #assert (R (otf h) (otf w)) ;; - #put setup_loc := true ;; - #put statement_loc := h ;; - #put witness_loc := w ;; - @ret 'unit Datatypes.tt - } - ; - #def #[ GET ] (_ : 'unit) : chStatement - { - b ← get setup_loc ;; - if b then - h ← get statement_loc ;; - w ← get witness_loc ;; - ret h - else - fail - } - ]. - - Definition Sigma_to_Com_locs := (Com_locs :|: Simulator_locs). - - #[tactic=notac] Equations? Sigma_to_Com: - package Sigma_to_Com_locs - [interface - #val #[ INIT ] : 'unit → 'unit ; - #val #[ GET ] : 'unit → chStatement - ] - [interface - #val #[ COM ] : chChallenge → chMessage ; - #val #[ OPEN ] : 'unit → chOpen ; - #val #[ VER ] : chTranscript → 'bool - ] - := Sigma_to_Com := - [package - #def #[ COM ] (e : chChallenge) : chMessage - { - #import {sig #[ INIT ] : 'unit → 'unit } as key_gen_init ;; - #import {sig #[ GET ] : 'unit → chStatement } as key_gen_get ;; - _ ← key_gen_init Datatypes.tt ;; - h ← key_gen_get Datatypes.tt ;; - '(h,a,e,z) ← Simulate h e ;; - #put challenge_loc := Some e ;; - #put response_loc := Some z ;; - ret a - } - ; - #def #[ OPEN ] (_ : 'unit) : chOpen - { - o_e ← get challenge_loc ;; - o_z ← get response_loc ;; - match (o_e, o_z) with - | (Some e, Some z) => @ret choiceOpen (e, z) - | _ => fail - end - } - ; - #def #[ VER ] (t : chTranscript) : 'bool - { - let '(h,a,e,z) := t in - ret (otf (Verify h a e z)) - } - ]. - Proof. - unfold Sigma_to_Com_locs. - ssprove_valid. - eapply valid_injectLocations. - 1: apply fsubsetUr. - eapply valid_injectMap. - 2: apply (Simulate x1 x). - rewrite -fset0E. - apply fsub0set. - Qed. - - #[tactic=notac] Equations? Sigma_to_Com_Aux: - package (setup_loc |: Sigma_to_Com_locs) - [interface - #val #[ TRANSCRIPT ] : chInput → chTranscript - ] - [interface - #val #[ COM ] : chChallenge → chMessage ; - #val #[ OPEN ] : 'unit → chOpen ; - #val #[ VER ] : chTranscript → 'bool - ] - := Sigma_to_Com_Aux := - [package - #def #[ COM ] (e : chChallenge) : chMessage - { - #import {sig #[ TRANSCRIPT ] : chInput → chTranscript } as RUN ;; - b ← get setup_loc ;; - #assert (negb b) ;; - w ← sample uniform i_witness ;; - let h := KeyGen w in - #assert (R (otf h) (otf w)) ;; - #put setup_loc := true ;; - '(h, a, e, z) ← RUN (h, w, e) ;; - #put challenge_loc := Some e ;; - #put response_loc := Some z ;; - @ret choiceMessage a - } - ; - #def #[ OPEN ] (_ : 'unit) : chOpen - { - o_e ← get challenge_loc ;; - o_z ← get response_loc ;; - match (o_e, o_z) with - | (Some e, Some z) => @ret choiceOpen (e, z) - | _ => fail - end - } - ; - #def #[ VER ] (t : chTranscript) : 'bool - { - let '(h,a,e,z) := t in - ret (otf (Verify h a e z)) - } - ]. - Proof. - unfold Sigma_to_Com_locs, Com_locs. - ssprove_valid. - all: rewrite in_fsetU ; apply /orP ; right. - all: rewrite in_fsetU ; apply /orP ; left. - all: rewrite !fset_cons. - 1,3 : rewrite in_fsetU ; apply /orP ; left ; rewrite in_fset1 ; done. - 1,2 : rewrite in_fsetU ; apply /orP ; right ; - rewrite in_fsetU ; apply /orP ; left ; - rewrite in_fset1 ; done. - Qed. - - Notation " 'chHiding' " := (chProd choiceChallenge choiceChallenge) (in custom pack_type at level 2). - - Definition Hiding_E := [interface #val #[ HIDING ] : chHiding → chMessage ]. - - (* Commitment to input value*) - Definition Hiding_real: - package fset0 - [interface - #val #[ COM ] : chChallenge → chMessage ; - #val #[ OPEN ] : 'unit → chOpen ; - #val #[ VER ] : chTranscript → 'bool - ] - Hiding_E - := - [package - #def #[ HIDING ] (ms : chHiding) : chMessage - { - #import {sig #[ COM ] : chChallenge → chMessage } as com ;; - let '(m1, m2) := ms in - b ← sample uniform 1 ;; - if Nat.even b then - a ← com m1 ;; - ret a - else - a ← com m2 ;; - ret a - } - ]. - - (* Commitment to random value *) - Definition Hiding_ideal : - package fset0 - [interface - #val #[ COM ] : chChallenge → chMessage ; - #val #[ OPEN ] : 'unit → chOpen ; - #val #[ VER ] : chTranscript → 'bool - ] - Hiding_E - := - [package - #def #[ HIDING ] (_ : chHiding) : chMessage - { - #import {sig #[ COM ] : chChallenge → chMessage } as com ;; - e ← sample uniform i_challenge ;; - t ← com e ;; - ret t - } - ]. - - Definition ɛ_hiding A := - AdvantageE - (Hiding_real ∘ Sigma_to_Com ∘ KEY) - (Hiding_ideal ∘ Sigma_to_Com ∘ KEY) (A ∘ (par KEY (ID Hiding_E))). - - Notation inv := ( - heap_ignore (fset [:: statement_loc ; witness_loc]) - ). - - Instance Invariant_inv : Invariant (Sigma_to_Com_locs :|: KEY_locs) (setup_loc |: Sigma_to_Com_locs) inv. - Proof. - ssprove_invariant. - unfold KEY_locs. - apply fsubsetU ; apply /orP ; left. - apply fsubsetU ; apply /orP ; right. - rewrite !fset_cons. - apply fsubsetU ; apply /orP ; right. - rewrite fsubUset ; apply /andP ; split. - - apply fsubsetU ; apply /orP ; right. - apply fsubsetU ; apply /orP ; left. - apply fsubsetxx. - - apply fsubsetU ; apply /orP ; left. - rewrite fsubUset ; apply /andP ; split. - + apply fsubsetxx. - + rewrite -fset0E. apply fsub0set. - Qed. - - Hint Extern 50 (_ = code_link _ _) => - rewrite code_link_scheme - : ssprove_code_simpl. - - Theorem commitment_hiding : - ∀ LA A, - ValidPackage LA [interface - #val #[ HIDING ] : chHiding → chMessage - ] A_export (A ∘ (par KEY (ID Hiding_E))) → - fdisjoint LA KEY_locs -> - fdisjoint LA Sigma_to_Com_locs -> - fdisjoint LA (fset [:: setup_loc]) -> - fdisjoint LA Sigma_locs -> - fdisjoint LA Simulator_locs -> - fdisjoint Simulator_locs (fset [:: statement_loc ; witness_loc]) -> - fdisjoint Sigma_locs (fset [:: statement_loc ; witness_loc]) -> - (ɛ_hiding A) <= 0 + - AdvantageE SHVZK_ideal SHVZK_real (((A ∘ par KEY (ID Hiding_E)) ∘ Hiding_real) ∘ Sigma_to_Com_Aux) + - AdvantageE (Hiding_real ∘ Sigma_to_Com_Aux ∘ SHVZK_real) - (Hiding_ideal ∘ Sigma_to_Com_Aux ∘ SHVZK_real) (A ∘ par KEY (ID Hiding_E)) + - AdvantageE SHVZK_real SHVZK_ideal (((A ∘ par KEY (ID Hiding_E)) ∘ Hiding_ideal) ∘ Sigma_to_Com_Aux) + - 0. - Proof. - unfold ɛ_hiding, ɛ_SHVZK. - intros LA A VA Hd1 Hd2 Hd3 HdSigma HdSimulator Hd4 Hd5. - ssprove triangle (Hiding_real ∘ Sigma_to_Com ∘ KEY) [:: - (Hiding_real ∘ Sigma_to_Com_Aux ∘ SHVZK_ideal) ; - (Hiding_real ∘ Sigma_to_Com_Aux ∘ SHVZK_real) ; - (Hiding_ideal ∘ Sigma_to_Com_Aux ∘ SHVZK_real) ; - (Hiding_ideal ∘ Sigma_to_Com_Aux ∘ SHVZK_ideal) - ] (Hiding_ideal ∘ Sigma_to_Com ∘ KEY) (A ∘ (par KEY (ID Hiding_E))) - as ineq. - eapply le_trans. 1: exact ineq. - clear ineq. - repeat eapply ler_add. - - apply eq_ler. - eapply eq_rel_perf_ind with (inv := inv). - 5: apply VA. - 1:{ - ssprove_valid. - 3: apply fsub0set. - 3: apply fsubsetxx. - 1: instantiate (1 := (Sigma_to_Com_locs :|: KEY_locs)). - 1: apply fsubsetUl. - 1: apply fsubsetUr. - } - 1:{ - ssprove_valid. - 1: apply fsubsetxx. - 2: apply fsub0set. - 2: apply fsubsetxx. - unfold Sigma_to_Com_locs. - apply fsubsetU ; apply /orP ; right. - apply fsubsetUr. - } - 3,4: rewrite fdisjointUr ; apply /andP ; split. - 3-4,6: assumption. - 3: rewrite fset1E ; assumption. - 1: exact _. - rewrite Sigma_to_Com_equation_1. - rewrite Sigma_to_Com_Aux_equation_1. - simplify_eq_rel h. - ssprove_code_simpl. - destruct h. - ssprove_code_simpl. - ssprove_code_simpl_more. - ssprove_sync=>b. - case (Nat.even b) eqn:Hb ; rewrite Hb. - + ssprove_sync=> setup. - ssprove_code_simpl. - ssprove_code_simpl_more. - apply r_assertD. - 1: done. - intros _ _. - ssprove_sync=> w. - apply r_assertD. - 1: done. - intros _ Rel. - ssprove_swap_seq_lhs [:: 2 ; 1]%N. - ssprove_contract_put_get_lhs. - rewrite !cast_fun_K. - rewrite Rel. - ssprove_code_simpl. - ssprove_code_simpl_more. - ssprove_sync. - ssprove_swap_lhs 1%N. - ssprove_contract_put_get_lhs. - ssprove_swap_seq_lhs [:: 0 ; 1]%N. - ssprove_contract_put_get_lhs. - apply r_put_lhs. - apply r_put_lhs. - ssprove_restore_pre. - 1: ssprove_invariant. - eapply rsame_head_alt. - 1: exact _. - { - unfold inv. - intros l lin h1 s' h2. - apply h2. - move: Hd4 => /fdisjointP Hd4. - apply Hd4. - apply lin. - } - { - unfold inv. - intros l v lin. - apply put_pre_cond_heap_ignore. - } - intros t. - destruct t. - destruct s1. - destruct s1. - ssprove_sync. - ssprove_sync. - apply r_ret. - done. - + ssprove_sync=>setup. - ssprove_code_simpl. - ssprove_code_simpl_more. - apply r_assertD. - 1: done. - intros _ _. - ssprove_sync=>w. - apply r_assertD. - 1: done. - intros _ Rel. - ssprove_swap_seq_lhs [:: 2 ; 1]%N. - ssprove_contract_put_get_lhs. - rewrite !cast_fun_K. - rewrite Rel. - ssprove_code_simpl. - ssprove_code_simpl_more. - ssprove_sync. - ssprove_swap_lhs 1%N. - ssprove_contract_put_get_lhs. - ssprove_swap_seq_lhs [:: 0 ; 1]%N. - ssprove_contract_put_get_lhs. - apply r_put_lhs. - apply r_put_lhs. - ssprove_restore_pre. - 1: ssprove_invariant. - eapply rsame_head_alt. - 1: exact _. - { - unfold inv. - intros l lin h1 s' h2. - apply h2. - move: Hd4 => /fdisjointP Hd4. - apply Hd4. - apply lin. - } - { - unfold inv. - intros l v lin. - apply put_pre_cond_heap_ignore. - } - intros t. - destruct t. - destruct s1. - destruct s1. - ssprove_sync. - ssprove_sync. - apply r_ret. - done. - - rewrite -!Advantage_link. - 1: apply eq_ler ; done. - - done. - - rewrite -!Advantage_link. - 1: apply eq_ler ; done. - - apply eq_ler. - eapply eq_rel_perf_ind with (inv := inv). - 5: apply VA. - 1:{ - ssprove_valid. - 4: apply fsubsetxx. - 3: apply fsub0set. - 2: instantiate (1 := (Simulator_locs :|: (setup_loc |: Sigma_to_Com_locs))). - - apply fsubsetUr. - - apply fsubsetUl. - } - 1:{ - ssprove_valid. - 3: apply fsub0set. - 3: apply fsubsetxx. - 1: instantiate (1 := (Sigma_to_Com_locs :|: KEY_locs)). - - apply fsubsetUl. - - apply fsubsetUr. - } - 3,4: rewrite fdisjointUr ; apply /andP ; split. - 4: rewrite fdisjointUr ; apply /andP ; split. - 3,5-7: assumption. - 3: rewrite fset1E ; assumption. - { - ssprove_invariant. - unfold KEY_locs. - apply fsubsetU ; apply /orP ; right. - apply fsubsetU ; apply /orP ; right. - rewrite !fset_cons. - apply fsubsetU ; apply /orP ; right. - rewrite fsubUset ; apply /andP ; split. - - apply fsubsetU ; apply /orP ; right. - apply fsubsetU ; apply /orP ; left. - apply fsubsetxx. - - apply fsubsetU ; apply /orP ; left. - rewrite fsubUset ; apply /andP ; split. - + apply fsubsetxx. - + rewrite -fset0E. apply fsub0set. - } - rewrite Sigma_to_Com_equation_1. - rewrite Sigma_to_Com_Aux_equation_1. - simplify_eq_rel h. - ssprove_code_simpl. - destruct h. - ssprove_code_simpl. - ssprove_code_simpl_more. - ssprove_sync=>e. - ssprove_sync=> setup. - ssprove_code_simpl. - ssprove_code_simpl_more. - apply r_assertD. - 1: done. - intros _ _. - ssprove_sync=> w. - apply r_assertD. - 1: done. - intros _ Rel. - ssprove_swap_seq_rhs [:: 2 ; 1]%N. - ssprove_contract_put_get_rhs. - rewrite !cast_fun_K. - rewrite Rel. - ssprove_code_simpl. - ssprove_code_simpl_more. - ssprove_sync. - ssprove_swap_rhs 1%N. - ssprove_contract_put_get_rhs. - ssprove_swap_seq_rhs [:: 0 ; 1]%N. - ssprove_contract_put_get_rhs. - apply r_put_rhs. - apply r_put_rhs. - ssprove_restore_pre. - 1: ssprove_invariant. - eapply rsame_head_alt. - 1: exact _. - { - unfold inv. - intros l lin h1 s' h2. - apply h2. - move: Hd4 => /fdisjointP Hd4. - apply Hd4. - apply lin. - } - { - unfold inv. - intros l v lin. - apply put_pre_cond_heap_ignore. - } - intros t. - destruct t. - destruct s1. - destruct s1. - ssprove_sync. - ssprove_sync. - apply r_ret. - done. - Qed. - - Definition Com_Binding: - package fset0 - [interface - #val #[ COM ] : chChallenge → chMessage ; - #val #[ OPEN ] : 'unit → chOpen ; - #val #[ VER ] : chTranscript → 'bool - ] - [interface #val #[ SOUNDNESS ] : chSoundness → 'bool ] - := - [package - #def #[ SOUNDNESS ] (t : chSoundness) : 'bool - { - #import {sig #[ VER ] : chTranscript → 'bool } as Ver ;; - let '(h, (a, ((e, z), (e', z')))) := t in - v1 ← Ver (h, a, e, z) ;; - v2 ← Ver (h, a, e', z') ;; - ret [&& (e != e'), v1 & v2] - } - ]. - - Lemma commitment_binding : - ∀ LA A, - ValidPackage LA [interface - #val #[ SOUNDNESS ] : chSoundness → 'bool - ] A_export A → - fdisjoint LA (Sigma_to_Com_locs :|: KEY_locs) → - AdvantageE (Com_Binding ∘ Sigma_to_Com ∘ KEY) (Special_Soundness_t) A = 0. - Proof. - intros LA A VA Hdisj. - eapply eq_rel_perf_ind_eq. - 4: apply VA. - 1:{ - ssprove_valid. - 3: apply fsub0set. - 1: instantiate (1 := (Sigma_to_Com_locs :|: KEY_locs)). - 2: apply fsubsetUr. - 1: apply fsubsetUl. - apply fsubsetxx. - } - 1: ssprove_valid. - 2: assumption. - 2: apply fdisjoints0. - rewrite Sigma_to_Com_equation_1. - simplify_eq_rel h. - ssprove_code_simpl. - simpl. - destruct h, s0, s1, s1, s2. - apply r_ret. auto. - Qed. - - End Commitments. - - (* This section aim to prove an automatic conversation between the sampling of the random challenge and a random oracle. *) - (* The main difference is that the random oracle is a query parametrized by the context of the execution. *) - - Module OracleParams <: ROParams. - - Definition Query := prod_finType Statement Message. - Definition Random := Challenge. - - Definition Query_pos : Positive #|Query|. - Proof. - unfold Query. rewrite !card_prod. - apply Positive_prod. - - apply Statement_pos. - - apply Message_pos. - Qed. - - Definition Random_pos : Positive #|Random| := Challenge_pos. - - End OracleParams. - - Module Oracle := RO OracleParams. - - Import Oracle OracleParams. - - Section FiatShamir. - - Definition RUN : nat := 7. - Definition VERIFY : nat := 8. - Definition SIM : nat := 9. - - Context (Sim_locs : {fset Location}). - Context (Sim : choiceStatement → code Sim_locs [interface] choiceTranscript). - - Definition prod_assoc : chProd choiceStatement choiceMessage → chQuery. - Proof. - cbn. intros [statement message]. - rewrite !card_prod. - apply mxvec_index. all: assumption. - Qed. - - (* TW: I moved it here because it might induce back-tracking and we want to - avoid it because of time-consumption. - *) - Hint Extern 20 (ValidCode ?L ?I ?c.(prog)) => - eapply valid_injectMap ; [| eapply c.(prog_valid) ] - : typeclass_instances ssprove_valid_db. - - Definition Fiat_Shamir : - package Sigma_locs - [interface - #val #[ INIT ] : 'unit → 'unit ; - #val #[ QUERY ] : 'query → 'random - ] - [interface - #val #[ VERIFY ] : chTranscript → 'bool ; - #val #[ RUN ] : chRelation → chTranscript - ] - := - [package - #def #[ VERIFY ] (t : chTranscript) : 'bool - { - #import {sig #[ QUERY ] : 'query → 'random } as RO_query ;; - let '(h,a,e,z) := t in - e ← RO_query (prod_assoc (h, a)) ;; - ret (otf (Verify h a e z)) - } ; - #def #[ RUN ] (hw : chRelation) : chTranscript - { - #import {sig #[ INIT ] : 'unit → 'unit } as RO_init ;; - #import {sig #[ QUERY ] : 'query → 'random } as RO_query ;; - let '(h,w) := hw in - #assert (R (otf h) (otf w)) ;; - a ← Commit h w ;; - RO_init Datatypes.tt ;; - e ← RO_query (prod_assoc (h, a)) ;; - z ← Response h w a e ;; - @ret choiceTranscript (h,a,e,z) - } - ]. - - Definition Fiat_Shamir_SIM : - package Sim_locs - [interface - #val #[ QUERY ] : 'query → 'random - ] - [interface - #val #[ VERIFY ] : chTranscript → 'bool ; - #val #[ RUN ] : chRelation → chTranscript - ] - := - [package - #def #[ VERIFY ] (t : chTranscript) : 'bool - { - #import {sig #[ QUERY ] : 'query → 'random } as RO_query ;; - let '(h,a,e,z) := t in - e ← RO_query (prod_assoc (h, a)) ;; - ret (otf (Verify h a e z)) - } ; - #def #[ RUN ] (hw : chRelation) : chTranscript - { - let '(h,w) := hw in - #assert (R (otf h) (otf w)) ;; - t ← Sim h ;; - ret t - } - ]. - - Definition RUN_interactive : - package Sigma_locs - [interface] - [interface - #val #[ VERIFY ] : chTranscript → 'bool ; - #val #[ RUN ] : chRelation → chTranscript - ] - := - [package - #def #[ VERIFY ] (t : chTranscript) : 'bool - { - let '(h,a,e,z) := t in - ret (otf (Verify h a e z)) - } ; - #def #[ RUN ] (hw : chRelation) : chTranscript - { - let '(h,w) := hw in - #assert (R (otf h) (otf w)) ;; - a ← Commit h w ;; - e ← sample uniform i_random ;; - z ← Response h w a e ;; - @ret choiceTranscript (h,a,e,z) - } - ]. - - Definition SHVZK_real_aux : - package Sigma_locs - [interface #val #[ TRANSCRIPT ] : chInput → chTranscript ] - [interface #val #[ RUN ] : chRelation → chTranscript ] - := - [package - #def #[ RUN ] (hw : chRelation) : chTranscript - { - #import {sig #[ TRANSCRIPT ] : chInput → chTranscript } as SHVZK ;; - e ← sample uniform i_random ;; - t ← SHVZK (hw, e) ;; - ret t - } - ]. - - Lemma run_interactive_shvzk : - ∀ LA A, - ValidPackage LA [interface - #val #[ RUN ] : chRelation → chTranscript - ] A_export A → - fdisjoint LA Sigma_locs → - AdvantageE RUN_interactive (SHVZK_real_aux ∘ SHVZK_real) A = 0. - Proof. - intros LA A Va Hdisj. - eapply eq_rel_perf_ind_eq. - 5,6: apply Hdisj. - 4: apply Va. - 2:{ - rewrite <- fsetUid. - eapply valid_link. - - apply SHVZK_real_aux. - - apply SHVZK_real. - } - 1:{ - eapply valid_package_inject_export. - 2: apply RUN_interactive. - apply fsubset_ext. intros ? ?. - rewrite fset_cons. apply /fsetUP. right. assumption. - } - simplify_eq_rel hw. - ssprove_code_simpl. - rewrite cast_fun_K. - ssprove_code_simpl. - destruct hw as [h w]. - ssprove_code_simpl_more. ssprove_code_simpl. - ssprove_swap_rhs 0%N. - ssprove_sync_eq. intro rel. - ssprove_swap_rhs 0%N. - apply rsame_head. intros [a st]. - ssprove_sync_eq. intro e. - apply rsame_head. intro z. - apply r_ret. intuition auto. - Qed. - - Hint Extern 50 (_ = code_link _ _) => - rewrite code_link_scheme - : ssprove_code_simpl. - - Theorem fiat_shamir_correct : - ∀ LA A , - ValidPackage LA [interface - #val #[ RUN ] : chRelation → chTranscript - ] A_export A → - fdisjoint LA (Sigma_locs :|: RO_locs) → - fdisjoint Sigma_locs RO_locs → - AdvantageE (Fiat_Shamir ∘ RO) RUN_interactive A = 0. - Proof. - intros LA A Va Hdisj Hdisj_oracle. - eapply eq_rel_perf_ind_ignore. - 6: apply Hdisj. - 6:{ - rewrite fdisjointUr in Hdisj. move: Hdisj => /andP [h _]. - apply h. - } - 5: apply Va. - 1:{ - ssprove_valid. - 2: apply fsubsetUl. - 2: apply fsubsetUr. - eapply valid_package_inject_export. - 2: apply Fiat_Shamir. - apply fsubset_ext. intros. - rewrite fset_cons. apply /fsetUP. right. assumption. - } - 1:{ - eapply valid_package_inject_export. - 2: apply RUN_interactive. - apply fsubset_ext. intros. - rewrite fset_cons. apply /fsetUP. right. assumption. - } - 1:{ apply fsubsetU. erewrite fsubsetUr. auto. } - simplify_eq_rel hw. - ssprove_code_simpl. - destruct hw as [h w]. - ssprove_sync. intros rel. - eapply rsame_head_alt. - 1: exact _. - 1:{ - intros l Il. - apply get_pre_cond_heap_ignore. - revert l Il. - apply /fdisjointP. - assumption. - } - 1:{ intros. apply put_pre_cond_heap_ignore. } - intros [a st]. - ssprove_contract_put_get_lhs. - rewrite emptymE. - apply r_put_lhs. - ssprove_sync. intro e. - apply r_put_lhs. - ssprove_restore_pre. 1: ssprove_invariant. - eapply r_reflexivity_alt. - - exact _. - - intros l Il. - ssprove_invariant. - revert l Il. - apply /fdisjointP. assumption. - - intros. ssprove_invariant. - Qed. - - (* GOAL: reason about ZK property *) - - End FiatShamir. - -End SigmaProtocol. diff --git a/ovn/proofs/ssprove/extraction/_CoqProject b/ovn/proofs/ssprove/extraction/_CoqProject index 2ffe3e1..0b70570 100644 --- a/ovn/proofs/ssprove/extraction/_CoqProject +++ b/ovn/proofs/ssprove/extraction/_CoqProject @@ -1,17 +1,6 @@ --R . Examples +-R . Hacspec_ovn -arg -w -arg all -Hacspec_ovn_Ovn_traits.v -Hacspec_ovn_Ovn_group.v -Hacspec_ovn.v - -# Taken from Crypt (as branches are not merged!) -pkg_advantage.v -SigmaProtocol.v -Schnorr.v -DDH.v -OVN.v - -# Equality proof between the two versions! -ovn_eq_proof.v \ No newline at end of file +./Hacspec_ovn_Ovn_traits.v +# ./Hacspec_ovn_Ovn_group.v \ No newline at end of file diff --git a/ovn/proofs/ssprove/extraction/_expected_trait.v b/ovn/proofs/ssprove/extraction/_expected_trait.v deleted file mode 100644 index 2690ced..0000000 --- a/ovn/proofs/ssprove/extraction/_expected_trait.v +++ /dev/null @@ -1,86 +0,0 @@ -(* File automatically generated by Hacspec *) -Set Warnings "-notation-overridden,-ambiguous-paths". -From Crypt Require Import choice_type Package Prelude. -Import PackageNotation. -From extructures Require Import ord fset. -From mathcomp Require Import word_ssrZ word. -(* From Jasmin Require Import word. *) - -From Coq Require Import ZArith. -From Coq Require Import Strings.String. -Import List.ListNotations. -Open Scope list_scope. -Open Scope Z_scope. -Open Scope bool_scope. - -From Hacspec Require Import ChoiceEquality. -From Hacspec Require Import LocationUtility. -From Hacspec Require Import Hacspec_Lib_Comparable. -From Hacspec Require Import Hacspec_Lib_Pre. -From Hacspec Require Import Hacspec_Lib. - -Open Scope hacspec_scope. -Import choice.Choice.Exports. - -Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. - -Class t_Field (v_Self : choice_type) := { - f_q_loc : {fset Location} ; - f_q : (both 'unit -> both v_Self) ; - f_random_field_elem_loc : {fset Location} ; - f_random_field_elem : (both int32 -> both v_Self) ; - f_field_zero_loc : {fset Location} ; - f_field_zero : (both 'unit -> both v_Self) ; - f_field_one_loc : {fset Location} ; - f_field_one : (both 'unit -> both v_Self) ; - f_add_loc : {fset Location} ; - f_add : (both v_Self -> both v_Self -> both v_Self) ; - f_sub_loc : {fset Location} ; - f_sub : (both v_Self -> both v_Self -> both v_Self) ; - f_mul_loc : {fset Location} ; - f_mul : (both v_Self -> both v_Self -> both v_Self) ; -}. -Hint Unfold f_q_loc. -Hint Unfold f_random_field_elem_loc. -Hint Unfold f_field_zero_loc. -Hint Unfold f_field_one_loc. -Hint Unfold f_add_loc. -Hint Unfold f_sub_loc. -Hint Unfold f_mul_loc. - -Class t_Group (v_Self : choice_type) := { - f_Z : choice_type ; - f_Z_t_Field :> (t_Field f_Z) ; - f_Z_t_Serialize :> (t_Serialize f_Z) ; - f_Z_t_Deserial :> (t_Deserial f_Z) ; - f_Z_t_Serial :> (t_Serial f_Z) ; - f_Z_t_Clone :> (t_Clone f_Z) ; - f_Z_t_Eq :> (t_Eq f_Z) ; - f_Z_t_PartialEq :> (t_PartialEq f_Z) ; - f_Z_t_Copy :> (t_Copy f_Z) ; - f_Z_t_Sized :> (t_Sized f_Z) ; - f_g_loc : {fset Location} ; - f_g : (both 'unit -> both v_Self) ; - f_g_pow_loc : {fset Location} ; - f_g_pow : (both f_Z -> both v_Self) ; - f_pow_loc : {fset Location} ; - f_pow : (both v_Self -> both f_Z -> both v_Self) ; - f_group_one_loc : {fset Location} ; - f_group_one : (both 'unit -> both v_Self) ; - f_prod_loc : {fset Location} ; - f_prod : (both v_Self -> both v_Self -> both v_Self) ; - f_inv_loc : {fset Location} ; - f_inv : (both v_Self -> both v_Self) ; - f_div_loc : {fset Location} ; - f_div : (both v_Self -> both v_Self -> both v_Self) ; - f_hash_loc : {fset Location} ; - f_hash : (both (t_Vec v_Self t_Global) -> both f_Z) ; -}. -Hint Unfold f_g_loc. -Hint Unfold f_g_pow_loc. -Hint Unfold f_pow_loc. -Hint Unfold f_group_one_loc. -Hint Unfold f_prod_loc. -Hint Unfold f_inv_loc. -Hint Unfold f_div_loc. -Hint Unfold f_hash_loc. diff --git a/ovn/proofs/ssprove/extraction/ovn_eq_proof.v b/ovn/proofs/ssprove/extraction/ovn_eq_proof.v deleted file mode 100644 index 10a2594..0000000 --- a/ovn/proofs/ssprove/extraction/ovn_eq_proof.v +++ /dev/null @@ -1,637 +0,0 @@ -Set Warnings "-notation-overridden,-ambiguous-paths". -From mathcomp Require Import all_ssreflect. - -(* From JasminSSProve Require Import jasmin_translate. *) -From Crypt Require Import Prelude Package pkg_composition. -From extructures Require Import ord fset fmap. -Import PackageNotation. -From Coq Require Import ZArith. -(* #[global] Hint Resolve preceq_I preceq_O preceq_refl : preceq. *) - -Definition pdisj (P : precond) (* (s_id : p_id) *) (rhs : {fset Location}) := - (forall h1 h2 l a (* v *) (* s_id' *), (* l = translate_var s_id' v -> (s_id ⪯ s_id') -> *) (P (h1, h2) -> P (set_heap h1 l a, h2))) /\ - (forall h1 h2 l a, l \in rhs -> (P (h1, h2) -> P (h1, set_heap h2 l a))). - -(* From Crypt Require Import choice_type Package Prelude. *) -From Crypt Require Import Axioms. - -(* Require Import Hacspec_ovn_Schnorr_Random_oracle. *) - -Require Import SigmaProtocol. -Require Import DDH. - -(* Require Import Hacspec_ovn_Schnorr. *) -Require Import Schnorr. - -Require Import Hacspec_ovn. -Require Import OVN. - -From Hacspec Require Import ChoiceEquality. -(* From Hacspec Require Import Hacspec_Lib_Pre. *) -From Hacspec Require Import Hacspec_Lib. - -Module Schnorr_eq (GP : GroupParam) (OP : OVNParam). - Import GP. - Module Sigma1 := Schnorr GP. - Module RO1 := Sigma1.Sigma.Oracle. - - Check both_prog. - - (* Check (chProd Sigma1.MyAlg.choiceStatement Sigma1.MyAlg.choiceWitness). *) - Locate choiceTranscript. - - Notation mymod := (4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787)%Z. - Axiom mymod_is_statement : Z.to_nat mymod = #|Sigma1.MyParam.Statement|. - - Notation mymod2 := (9574)%Z. - Axiom mymod2_is_statement : Z.to_nat mymod2 = #|Sigma1.MyParam.Witness|. - - Definition Schnorr_translate_type (x : Sigma1.MyAlg.choiceStatement × Sigma1.MyAlg.choiceWitness) : t_Relation. - Proof. - refine (cast_ord _ (fst x), cast_ord _ (snd x)). - unfold pos. - rewrite mymod_is_statement. - symmetry. - eapply prednK. - apply Sigma1.MyParam.positive_gT. - - rewrite mymod2_is_statement. - symmetry. - eapply prednK. - apply Sigma1.MyParam.Witness_pos. - Defined. - - Ltac destruct_pre := - repeat - match goal with - | [ H : set_lhs _ _ _ _ |- _ ] => - let sn := fresh in - let Hsn := fresh in - destruct H as [sn [Hsn]] - | [ H : set_rhs _ _ _ _ |- _ ] => - let sn := fresh in - let Hsn := fresh in - destruct H as [sn [Hsn]] - | [ H : _ /\ _ |- _ ] => - let H1 := fresh in - let H2 := fresh in - destruct H as [H1 H2] - | [ H : (_ ⋊ _) _ |- _ ] => - let H1 := fresh in - let H2 := fresh in - destruct H as [H1 H2] - | [ H : exists _, _ |- _ ] => - let o := fresh in - destruct H as [o] - end; simpl in *; subst. - - (* Ltac remove_get_in_lhs := *) - (* eapply better_r_get_remind_lhs ; *) - (* unfold Remembers_lhs , rem_lhs ; *) - (* [ intros ? ? ? ; *) - (* destruct_pre ; *) - (* repeat (rewrite get_set_heap_neq ; [ | apply injective_translate_var3 ; reflexivity ]) ; *) - (* rewrite get_set_heap_eq ; *) - (* reflexivity | ]. *) - - Definition uniform_secret (x : Arit (uniform (H := Sigma1.MyParam.Witness_pos) #|Sigma1.MyParam.Witness|)) : t_Secret. - Proof. - simpl in x. - - refine (cast_ord _ x). - rewrite mymod2_is_statement. - simpl. - symmetry. - eapply prednK. - apply Sigma1.MyParam.Witness_pos. - Defined. - (* Hacspec_Lib_Pre.repr _ (word.modulus (nat_of_ord x)). *) - - Theorem random_sample (pre : precond) : - forall i `{Positive i}, - exists (random_val : Arit (uniform i)), - ⊢ ⦃ pre ⦄ - x ← sample uniform i ;; ret x ≈ ret random_val - ⦃ fun '(v0, h0) '(v1, h1) => pre (h0, h1) ⦄. - Proof. - intros. - eexists. - apply (r_const_sample_L _ (fun x => ret x) _). - apply LosslessOp_uniform. - intros. - apply r_ret. - intros. - apply H0. - Unshelve. - refine (Ordinal (n:={| pos := i; cond_pos := H |}) (m := 0) _). - easy. - Qed. - - (* Definition cast_type (x : (chProd (chProd (chProd t_G t_G) t_Q) t_Q)) : (tgt *) - (* (@pair ident (prod choice_type choice_type) Sigma1.Sigma.RUN *) - (* (@pair choice_type choice_type *) - (* (chProd Sigma1.MyAlg.choiceStatement *) - (* Sigma1.MyAlg.choiceWitness) *) - (* Sigma1.MyAlg.choiceTranscript))). *) - (* Proof. *) - (* destruct x as [[[]]]. *) - (* repeat split. *) - (* refine (Ordinal (m := Z.to_nat (Hacspec_Lib_Pre.unsigned s)) _). *) - (* simpl. *) -Theorem better_rsame_head_cmd_alt : - forall {A B C : choiceType} {f₀ : A -> raw_code B} {f₁ : A -> raw_code C} - (m : command A) pre (post : postcond B C), - ⊢ ⦃ pre ⦄ - x ← cmd m ;; ret x ≈ x ← cmd m ;; ret x - ⦃ fun '(a₀, s₀) '(a₁, s₁) => pre (s₀, s₁) /\ a₀ = a₁ ⦄ -> - (forall a, ⊢ ⦃ pre ⦄ f₀ a ≈ f₁ a ⦃ post ⦄) -> - ⊢ ⦃ pre ⦄ x ← cmd m ;; f₀ x ≈ x ← cmd m ;; f₁ x ⦃ post ⦄. -Proof. - intros A B C f₀ f₁ m pre post hm hf. - eapply from_sem_jdg. rewrite !repr_cmd_bind. - eapply (RulesStateProb.bind_rule_pp (repr_cmd m) (repr_cmd m)). - - eapply to_sem_jdg in hm. rewrite !repr_cmd_bind in hm. - rewrite bindrFree_ret in hm. eauto. - - intros a₀ a₁. eapply to_sem_jdg. - eapply rpre_hypothesis_rule. - intros s₀ s₁ [h e]. subst. - eapply rpre_weaken_rule. 1: eapply hf. - simpl. intros ? ? [? ?]. subst. auto. -Qed. - - Lemma better_r_const_sample_R : - forall {A B : choiceType} (op : Op) c₀ c₁ (pre : precond) (post : postcond A B), - LosslessOp op -> - (forall x, ⊢ ⦃ pre ⦄ c₀ ≈ c₁ x ⦃ post ⦄) -> - ⊢ ⦃ pre ⦄ c₀ ≈ x ← sample op ;; c₁ x ⦃ post ⦄. -Proof. - intros A B op c₀ c₁ pre post hop h. - eapply r_transL with (x ← sample op ;; (fun _ => c₀) x). - - apply r_dead_sample_L. 1: auto. - apply rreflexivity_rule. - - apply (better_rsame_head_cmd_alt (cmd_sample op)). - + eapply rpre_weaken_rule. 1: eapply cmd_sample_preserve_pre. - auto. - + apply h. -Qed. - - (* Ltac solve_var_neq := *) - (* ((now apply injective_translate_var3) || *) - (* (apply injective_translate_var2 ; red ; intros ; subst)). *) - (* Ltac eexists_set_heap := *) - (* eexists ; split ; [ | *) - (* match goal with *) - (* | [ |- context [ *) - (* set_heap _ _ ?d *) - (* = set_heap _ _ ?d *) - (* ] ] => *) - (* reflexivity *) - (* end || *) - (* match goal with *) - (* | [ |- context [ *) - (* set_heap ?a ?b ?c *) - (* = set_heap _ _ ?e *) - (* ] ] => *) - (* rewrite [set_heap a b c]set_heap_commut ; [ reflexivity | *) - (* solve_var_neq ] *) - (* end]. *) - - Ltac solve_in := - repeat match goal with - | |- is_true (?v \in fset1 ?v :|: _) => apply/fsetU1P; left; auto - | |- is_true (_ \in fsetU _ _) => apply/fsetU1P; right - end. - - Ltac pdisj_apply h := - lazymatch goal with - | |- ?pre (set_heap _ _ _, set_heap _ _ _) => eapply h; [ solve_in | pdisj_apply h ] - | |- ?pre (set_heap _ _ _, _) => - eapply h ; [ reflexivity | auto with preceq | pdisj_apply h ] - | |- _ => try assumption - end. - - - Ltac solve_in_fset := - rewrite in_fset ; repeat (reflexivity || (rewrite mem_head) || (now rewrite Bool.orb_true_r) || (now rewrite Bool.orb_true_l) || rewrite in_cons ; simpl). - - Theorem unfold_prod0 : - forall L I A (x : both L I A), prod_to_prod_n 0 x = x. - Proof. destruct A ; reflexivity. Qed. - - Lemma bind_solve_lift_ret_both : forall {A B : choice_type} {L1 L2 I1 I2} `{fsubset_loc : is_true (fsubset (fset [::]) L1)} `{fsubset_opsig : is_true (fsubset (fset [::]) I1)} `{fsubset_loc2 : is_true (fsubset L1 L2)} `{fsubset_opsig2 : is_true (fsubset I1 I2)} (f : A -> both L2 I2 B) (x : A), - (bind_both (L1 := L1) (I1 := I1) (fsubset_loc := fsubset_loc2) (fsubset_opsig := fsubset_opsig2) (lift_both (fsubset_loc := fsubset_loc) (fsubset_opsig := fsubset_opsig) (ret_both x)) f) = f x. - Proof. - intros. - apply both_eq. - simpl. - unfold bind_raw_both. - simpl. - destruct (f x). simpl. - destruct both_prog. simpl. - reflexivity. - Qed. - - Lemma bind_solve_both_assoc : - forall {A B : choice_type} {L1 L2 I1 I2} (f : A -> both L2 I2 B) (x : A) `{fsubset_loc : is_true (fsubset (fset [::]) L1)} `{fsubset_opsig : is_true (fsubset (fset [::]) I1)} `{fsubset_loc2 : is_true (fsubset L1 L2)} `{fsubset_opsig2 : is_true (fsubset I1 I2)}, - (bind_both (fsubset_loc := fsubset_loc2) (fsubset_opsig := fsubset_opsig2) (lift_both (L2 := L1) (I2 := I1) (fsubset_loc := fsubset_loc) (fsubset_opsig := fsubset_opsig) (ret_both x)) f) = - (bind_both (fsubset_loc := fsubset_trans fsubset_loc fsubset_loc2) (fsubset_opsig := fsubset_trans fsubset_opsig fsubset_opsig2) (ret_both x) f). - Proof. - intros. - apply both_eq. - simpl. - unfold bind_raw_both. - simpl. - destruct (f x). simpl. - destruct both_prog. simpl. - reflexivity. - Qed. - - Theorem unfold_letb'2 : - forall L1 L2 I1 I2 A B C, - forall (z : both L1 I1 (A × B)) (f : _ -> both L2 I2 C), - forall `{fsubset_loc1 : is_true (fsubset (fset [::]) L1)} `{fsubset_opsig1 : is_true (fsubset (fset [::]) I1)}, - forall `{fsubset_loc2 : is_true (fsubset L1 L2)} `{fsubset_opsig2 : is_true (fsubset I1 I2)}, - is_state (lift_n (fsubset_loc := fsubset_loc2) (fsubset_opsig := fsubset_opsig2) 1 z f) = - ('(x, y) ← is_state z ;; is_state (f (lift_both (fsubset_loc := fsubset_loc1) (fsubset_opsig := fsubset_opsig1) (ret_both x) : both _ _ A, lift_both (fsubset_loc := fsubset_loc1) (fsubset_opsig := fsubset_opsig1) (ret_both y) : both _ _ B))). - Proof. - intros. - unfold lift_n at 1. - simpl. - - f_equal. - apply functional_extensionality. - intros []. - - rewrite unfold_prod0. - - rewrite <- surjective_pairing. - set (prod_to_prod _). - set (solve_lift _, solve_lift _). - replace p with p0 ; [ reflexivity | subst p p0 ]. - - unfold prod_to_prod at 1. - - rewrite bind_solve_both_assoc. - rewrite bind_solve_both_assoc. - - rewrite bind_ret_both. - rewrite bind_ret_both. - - simpl. - - f_equal. - f_equal. - apply proof_irrelevance. - apply proof_irrelevance. - f_equal. - f_equal. - apply proof_irrelevance. - apply proof_irrelevance. - Qed. - - Theorem Schnorr_eq_proof (* id0 *) (pre : precond) : - forall (hw : (Sigma1.MyAlg.choiceStatement × Sigma1.MyAlg.choiceWitness)), - forall (H_pdisj : pdisj pre (* id0 *) (fset [ :: RO1.queries_loc ; Sigma1.MyAlg.commit_loc ])), - forall (* exists *) (random_sample1 : Arit (uniform (H := Sigma1.MyParam.Witness_pos) Sigma1.MyAlg.i_witness)) random_sample2, - ⊢ ⦃ pre ⦄ - is_state (both_prog (fiat_shamir_run (ret_both (Schnorr_translate_type hw)) (ret_both (uniform_secret random_sample1)) (ret_both random_sample2))) - ≈ - get_op_default (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO) (Sigma1.Sigma.RUN, ((chProd Sigma1.MyAlg.choiceStatement Sigma1.MyAlg.choiceWitness), Sigma1.MyAlg.choiceTranscript)) hw - ⦃ fun '(v0, h0) '(v1, h1) => pre (h0, h1) ⦄. - Proof. - intros. - (* eexists. *) - (* eexists. *) - - (* Unfolding and simplifying to raw code! *) - (* TODO: Work on higher level than raw code? *) - - rewrite get_op_default_link. - erewrite get_op_default_spec. - 2: {cbn. done.} - ssprove_code_simpl. - destruct hw. - hnf. - rewrite fiat_shamir_run_equation_1. - - ssprove_code_simpl. - ssprove_code_simpl_more. - - (* Ltac get_next_statement := _. *) - unfold let_both at 1. - rewrite unfold_letb'2. - rewrite bind_rewrite. - destruct Schnorr_translate_type eqn:So. - unfold let_both at 1. - unfold let_both at 1. - unfold let_both at 1. - unfold let_both at 1. - unfold let_both at 1. - rewrite unfold_letb'2. - - match goal with - | [ |- context [ ⊢ ⦃ ?P ⦄ ?x ≈ assertD ?b ?f ⦃ ?Q ⦄ ] ] => - change x with (assertD true (fun _ => x)) ; - apply (r_assertD true b pre _ (fun _ => x)) - end. - { - clear -So. - intros. - apply pair_equal_spec in So. - destruct So. - - eapply (@f_equal _ _ (cast_ord (esym _)) _ _) in H0. - erewrite cast_ordK in H0. - unfold fst in H0. - rewrite H0 ; clear H0. - - eapply (@f_equal _ _ (cast_ord (esym _)) _ _) in H1. - erewrite cast_ordK in H1. - unfold snd in H1. - rewrite H1 ; clear H1. - clear. - - destruct s1 , s2. - cbn. - unfold cast_ord. - - - unfold Sigma1.MyParam.R. - cbn. - pose nth_ord_enum. - unfold enum. - cbn. - simpl. - setoid_rewrite nth_ord_enum. - admit. - } - intros _ ?. - apply (better_r_const_sample_R) ; [ apply LosslessOp_uniform | intros ]. - - unfold random_oracle_query at 1. - - rewrite bind_assoc. - rewrite bind_assoc. - rewrite bind_rewrite. - - apply better_r_put_rhs. - apply better_r_put_get_rhs. - apply better_r_put_rhs. - - rewrite emptymE. - - rewrite bind_assoc. - rewrite bind_assoc. - rewrite bind_assoc. - rewrite bind_rewrite. - rewrite bind_assoc. - rewrite bind_assoc. - - (* Sample *) - apply (better_r_const_sample_R) ; [ apply LosslessOp_uniform | intros ]. - rewrite bind_rewrite. - - unfold is_state at 1, both_prog at 1. - unfold bind ; fold @bind. - apply better_r_put_get_lhs. - apply better_r_put_lhs. - - rewrite bind_rewrite. - rewrite bind_rewrite. - - unfold prod_to_prod_n at 1 ; fold @prod_to_prod_n. - rewrite bind_rewrite. - rewrite bind_rewrite. - - rewrite emptymE. - rewrite bind_assoc. - rewrite bind_assoc. - rewrite bind_rewrite. - apply better_r_put_rhs. - - apply better_r. - apply r_get_remind_rhs with (v := x). - { - unfold Remembers_rhs , rem_rhs. - intros ? ? ?. - clear -H. - destruct_pre. - rewrite get_set_heap_neq ; [ | easy ]. - rewrite get_set_heap_neq ; [ | easy ]. - rewrite get_set_heap_eq. reflexivity. - } - apply better_r. - - repeat (rewrite !bind_assoc ; rewrite bind_rewrite). - unfold is_state at 1, both_prog at 1. - unfold bind ; fold @bind. - - apply better_r_put_get_lhs. - apply better_r_put_lhs. - - rewrite bind_rewrite. - rewrite bind_rewrite. - - unfold prod_to_prod_n at 1 ; fold @prod_to_prod_n. - - rewrite bind_rewrite. - rewrite bind_assoc. - rewrite bind_rewrite. - rewrite bind_rewrite. - unfold prod_to_prod_n at 1 ; fold @prod_to_prod_n. - rewrite !unfold_prod0. - rewrite bind_assoc. - rewrite bind_assoc. - rewrite bind_rewrite. - rewrite bind_rewrite. - rewrite bind_assoc. - rewrite bind_rewrite. - rewrite bind_rewrite. - - unfold prod_both at 1. - unfold prod_both at 1. - unfold prod_both at 1. - unfold is_state. - setoid_rewrite bind_assoc. - setoid_rewrite bind_assoc. - setoid_rewrite bind_assoc. - setoid_rewrite bind_assoc. - rewrite bind_rewrite. - unfold both_prog at 1 , is_state at 1. - unfold bind ; fold @bind. - - apply better_r_put_get_lhs. - apply better_r_put_lhs. - - rewrite bind_rewrite. - rewrite bind_rewrite. - - - rewrite bind_assoc. - rewrite bind_rewrite. - rewrite bind_rewrite. - apply r_ret. - - intros. - - clear -H H_pdisj. - destruct_pre. - - repeat apply H_pdisj. - - solve_in_fset. - - solve_in_fset. - - solve_in_fset. - - assumption. - - Unshelve. - all: intros ? ? ? ? ; apply proof_irrelevance. - Admitted. - - Definition Schnorr_translate_type2 (x : Sigma1.MyAlg.choiceTranscript) : t_Transcript. - Proof. - destruct x as [[[]]]. - refine (cast_ord _ s, cast_ord _ s0, cast_ord _ s1, cast_ord _ s2). - unfold pos. - rewrite mymod_is_statement. - symmetry. - eapply prednK. - apply Sigma1.MyParam.positive_gT. - - unfold pos. - rewrite mymod_is_statement. - symmetry. - eapply prednK. - apply Sigma1.MyParam.positive_gT. - - rewrite mymod2_is_statement. - symmetry. - eapply prednK. - apply Sigma1.MyParam.Witness_pos. - - rewrite mymod2_is_statement. - symmetry. - eapply prednK. - apply Sigma1.MyParam.Witness_pos. - Defined. - - Module OVN_mod := OVN GP OP. - Import OVN_mod. - Module OVN_proof (π2 : CDSParams) (Alg2 : SigmaProtocolAlgorithms π2). - Module OVN_OVN_mod := OVN π2 Alg2. - Import OVN_OVN_mod. - - Theorem Schnorr__eq_proof (* id0 *) (pre : precond) : - forall (hw : Sigma1.MyAlg.choiceTranscript), - forall (H_pdisj : pdisj pre (* id0 *) (fset [ :: RO1.queries_loc ; Sigma1.MyAlg.commit_loc ])), - (* forall i b, *) - forall (* exists *) (random_sample1 : Arit (uniform _)), - ⊢ ⦃ pre ⦄ - is_state (both_prog (fiat_shamir_verify (ret_both (Schnorr_translate_type2 hw)) (ret_both (uniform_secret random_sample1)))) - ≈ - get_op_default ((Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) (Sigma1.Sigma.VERIFY, ((Sigma1.MyAlg.choiceTranscript, 'bool))) hw - ⦃ fun '(v0, h0) '(v1, h1) => pre (h0, h1) ⦄. - Proof. - intros. - (* eexists. *) - (* eexists. *) - - (* Unfolding and simplifying to raw code! *) - (* TODO: Work on higher level than raw code? *) - - rewrite get_op_default_link. - erewrite get_op_default_spec. - 2: {cbn. done.} - ssprove_code_simpl. - destruct hw as [[[]]]. - hnf. - rewrite fiat_shamir_verify_equation_1. - - ssprove_code_simpl. - ssprove_code_simpl_more. - - (* setoid_rewrite bind_rewrite. *) - - unfold prod_to_prod_n at 1 ; fold @prod_to_prod_n ; rewrite !unfold_prod0. - autorewrite with let_both. - autorewrite with prod_to_prod. - rewrite prod_assoc_equation_1. - - rewrite !bind_ret_both. - - rewrite !bind_solve_both_assoc. - rewrite !bind_ret_both. - rewrite !bind_solve_both_assoc. - rewrite !bind_ret_both. - - unfold fst, snd. - - unfold Schnorr_translate_type2. - - unfold prod_to_prod_n at 2 ; fold @prod_to_prod_n. - - (* Unset Printing Notations. *) - (* Set Printing Coercions. *) - match goal with - | |- context [let 'pair _ _ := prod_to_prod_n 1 ?b in ?x] => - pose (is_state (both_prog (let 'pair _ _ := prod_to_prod_n 1 b in x))); - pose ('(_, _) ← is_state (both_prog b) ;; is_state (both_prog x)) - ; set (b) ; set (x) - end. - - epose (is_state (both_prog b) ;; _). - - epose (_ ← (is_state b) ;; _). - - assert (forall L1 I1 A B L2 I2 C (b : both L1 I1 (A × B)) (x : both L2 I2 C), - is_state (letb '(_, _) := b in x) = - '(_, _) ← is_state b ;; is_state x). - { - clear. - intros. - destruct b. - destruct both_prog_valid. - simpl. - inversion is_valid_code. - - simpl. - destruct x0. - reflexivity. - - simpl. - - - - - replace (is_state (both_prog (let 'pair _ _ := prod_to_prod_n 1 b in b0))) - with - ('(_, _) ← (is_state b) ;; is_state b0). - 2:{ - clear. - destruct b. - destruct both_prog. - unfold both_prog. - unfold ChoiceEquality.is_state. - destruct is_state. - - - change (is_state b0) with - ('(_, _) ← (is_state b) ;; is_state b0). - - unfold prod_to_prod_n at 1 ; fold @prod_to_prod_n. - - (* TODO, Sub proofs: *) - rewrite random_oracle_query_equation_1. - (* TODO, verify proofs: *) - rewrite verify_equation_1. - - rewrite prod_both_equation_1. - - - setoid_rewrite bind_rewrite. - - - - - - -(* Exec_i_realised *) -(* {package (Exec_i i j m) ∘ (par ((P_i i b) ∘ (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO)) *) -(* (Sigma1.Sigma.Fiat_Shamir ∘ RO1.RO))} *) diff --git a/ovn/proofs/ssprove/extraction/pkg_advantage.v b/ovn/proofs/ssprove/extraction/pkg_advantage.v deleted file mode 100644 index e17f21f..0000000 --- a/ovn/proofs/ssprove/extraction/pkg_advantage.v +++ /dev/null @@ -1,469 +0,0 @@ -(** Notion of adversary and advantage *) - - -From Coq Require Import Utf8. -From Relational Require Import OrderEnrichedCategory - OrderEnrichedRelativeMonadExamples. -Set Warnings "-ambiguous-paths,-notation-overridden,-notation-incompatible-format". -From mathcomp Require Import ssrnat ssreflect ssrfun ssrbool ssrnum eqtype - choice reals distr seq all_algebra fintype realsum. -Set Warnings "ambiguous-paths,notation-overridden,notation-incompatible-format". -From extructures Require Import ord fset fmap. -From Mon Require Import SPropBase. -From Crypt Require Import Prelude Axioms ChoiceAsOrd SubDistr Couplings - RulesStateProb UniformStateProb UniformDistrLemmas StateTransfThetaDens - StateTransformingLaxMorph choice_type pkg_core_definition pkg_notation - pkg_tactics pkg_composition pkg_heap pkg_semantics pkg_lookup. -Require Import Equations.Prop.DepElim. -From Equations Require Import Equations. - -(* Must come after importing Equations.Equations, who knows why. *) -From Crypt Require Import FreeProbProg. - -Import Num.Theory. - -Set Equations With UIP. -Set Equations Transparent. - -Import SPropNotations. -Import PackageNotation. -Import RSemanticNotation. - -Set Bullet Behavior "Strict Subproofs". -Set Default Goal Selector "!". -Set Primitive Projections. - -#[local] Open Scope rsemantic_scope. - -#[local] Open Scope fset. -#[local] Open Scope fset_scope. -#[local] Open Scope type_scope. -#[local] Open Scope package_scope. -#[local] Open Scope ring_scope. -#[local] Open Scope real_scope. - -Definition Game_import : Interface := [interface]. - -Definition Game_Type (Game_export : Interface) : Type := - loc_package Game_import Game_export. - -Definition RUN := (0%N, ('unit, 'bool)). - -Definition A_export : Interface := fset1 RUN. - -Lemma RUN_in_A_export : RUN \in A_export. -Proof. - apply in_fset1. -Qed. - -Definition Adversary4Game (Game_export : Interface) : Type := - loc_package Game_export A_export. - -Definition Adversary4Game_weak (Game_export : Interface) : Type := - package fset0 Game_export A_export. - -Definition Game_op_import_S : Type := {_ : ident & void}. - -Definition Game_import_P : Game_op_import_S → choiceType := - λ v, let 'existT a b := v in match b with end. - -Definition Pr_code {A} (p : raw_code A) : - heap_choiceType → SDistr (F_choice_prod_obj ⟨ A , heap_choiceType ⟩) := - λ s, thetaFstd A (repr p) s. - -(* TODO REMOVE? *) -Definition Pr_raw_func_code {A B} (p : A → raw_code B) : - A → heap_choiceType → SDistr (F_choice_prod_obj ⟨ B , heap_choiceType ⟩) := - λ a s, Pr_code (p a) s. - -Definition Pr_op (p : raw_package) (o : opsig) (x : src o) : - heap_choiceType → SDistr (F_choice_prod_obj ⟨ tgt o , heap_choiceType ⟩) := - Pr_code (get_op_default p o x). - -Arguments SDistr_bind {_ _}. - -Definition Pr (p : raw_package) : - SDistr (bool_choiceType) := - SDistr_bind - (λ '(b, _), SDistr_unit _ b) - (Pr_op p RUN Datatypes.tt empty_heap). - -Definition loc_GamePair (Game_export : Interface) := - bool → Game_Type Game_export. - -(* TODO Again, why not an actual pair? *) -Definition GamePair := - bool → raw_package. - -Definition Advantage (G : GamePair) (A : raw_package) : R := - `| Pr (A ∘ (G false)) true - Pr (A ∘ (G true)) true |. - -Definition AdvantageE (G₀ G₁ : raw_package) (A : raw_package) : R := - `| Pr (A ∘ G₀) true - Pr (A ∘ G₁) true |. - -(* TODO We could have the following - Not clear it would be an improvement. It would be shorter but maybe not - as easy to work with. -*) - -(* Record AdversaryFor {I} (G : loc_GamePair I) := mkAdversary { - adv_pack : loc_package I A_export ; - adv_disj_false : fdisjoint adv_pack.(locs) (G false).(locs) ; - adv_disj_true : fdisjoint adv_pack.(locs) (G true).(locs) -}. - -Coercion adv_pack : AdversaryFor >-> loc_package. *) - -(* TODO Update to the new setting *) -(* Lemma pr_weak {Game_export : Interface} - (A : Adversary4Game Game_export) (G : loc_package _ _) : - Pr {locpackage link (turn_adversary_weak A) G } true = - Pr {locpackage link A G } true. -Proof. -Admitted. *) - -(* TODO UPDATE, first figure out what its role is *) -(* Definition perf_ind {Game_export : Interface} - (G0 : Game_Type Game_export) (G1 : Game_Type Game_export) := - ∀ A, - fdisjoint A.(locs) G0.(locs) → - fdisjoint A.(locs) G1.(locs) → - AdvantageE G0 G1 A = 0. *) - -(* TODO UPDATE *) -(* Definition perf_ind_weak {Game_export : Interface} - (G0 : Game_Type Game_export) (G1 : Game_Type Game_export) := - ∀ A, AdvantageE_weak G0 G1 A = 0. *) - -(* Definition perf_ind_weak_implies_perf_ind {Game_export : Interface} - (G0 : Game_Type Game_export) (G1 : Game_Type Game_export) - (h : perf_ind_weak G0 G1) : perf_ind G0 G1. -Proof. - unfold perf_ind, perf_ind_weak, AdvantageE, AdvantageE_weak in *. - intros A H1 H2. - rewrite -(pr_weak A G0). - rewrite -(pr_weak A G1). - apply h. -Qed. *) - -(* Notation "ε( GP )" := - (AdvantageE (GP false) (GP true)) - (at level 90) - : package_scope. *) - -Definition state_pass_ {A} (p : raw_code A) : - heap_choiceType → raw_code (prod_choiceType A heap_choiceType). -Proof. - induction p; intros h. - - constructor. - exact (x, h). - - apply (opr o). - + exact x. - + intros v. exact (X v h). - - apply X. - + exact (get_heap h l). - + exact h. - - apply IHp. - apply (set_heap h l v). - - apply (sampler op). - intros v. exact (X v h). -Defined. - -Definition state_pass__valid {A} {L} {I} (p : raw_code A) - (h : ValidCode L I p) : - ∀ hp, ValidCode fset0 I (state_pass_ p hp). -Proof. - intro hp. - unfold ValidCode in *. - induction h in hp |- *. - - cbn. constructor. - - simpl. constructor. - + assumption. - + intros t. eauto. - - simpl. eauto. - - simpl. eauto. - - simpl. constructor. - intros v. eauto. -Qed. - -Definition state_pass {A} (p : raw_code A) : raw_code A := - bind (state_pass_ p empty_heap) (λ '(r, _), ret r). - -Definition state_pass_valid {A} {L} {I} (p : raw_code A) - (h : ValidCode L I p) : - ValidCode fset0 I (state_pass p). -Proof. - apply valid_bind. - - apply (state_pass__valid p h empty_heap). - - intros x. destruct x. constructor. -Qed. - -(* TODO Will have to be updated *) -(* Probably by having first an operation on raw_packages - and then a validity proof. -*) -Definition turn_adversary_weak {Game_export : Interface} - (A : Adversary4Game Game_export) : Adversary4Game_weak Game_export. -Proof. - unfold Adversary4Game_weak. - pose (get_op A RUN RUN_in_A_export Datatypes.tt) as run. - destruct run as [run valid_run]. - cbn in *. - pose (state_pass run) as raw_run_st. - pose (state_pass_valid run valid_run) as raw_run_st_valid. - apply funmkpack. - - unfold flat, A_export. - intros n u1 u2. - move /fset1P => h1. - move /fset1P => h2. - inversion h1. inversion h2. - reflexivity. - - intros o. - move /fset1P => hin. - subst. intros _. - exists raw_run_st. - assumption. -Defined. - -Definition adv_equiv {L₀ L₁ E} (G₀ G₁ : raw_package) - `{ValidPackage L₀ Game_import E G₀} `{ValidPackage L₁ Game_import E G₁} ε := - ∀ LA A, - ValidPackage LA E A_export A → - fdisjoint LA L₀ → - fdisjoint LA L₁ → - AdvantageE G₀ G₁ A = ε A. - -Notation " G0 ≈[ R ] G1 " := - (adv_equiv G0 G1 R) - (at level 50, format " G0 ≈[ R ] G1") - : package_scope. - -Notation " G0 ≈₀ G1 " := - (G0 ≈[ λ (_ : raw_package), 0 ] G1) - (at level 50, format " G0 ≈₀ G1") - : package_scope. - -Lemma Advantage_equiv : - ∀ I (G : loc_GamePair I), - (G false) ≈[ Advantage G ] (G true). -Proof. - intros I G. intros LA A vA hd₀ hd₁. reflexivity. -Qed. - -Lemma AdvantageE_equiv : - ∀ I (G₀ G₁ : Game_Type I), - G₀ ≈[ AdvantageE G₀ G₁ ] G₁. -Proof. - intros I G₀ G₁. intros LA A vA hd₀ hd₁. reflexivity. -Qed. - -Lemma Advantage_E : - ∀ (G : GamePair) A, - Advantage G A = AdvantageE (G false) (G true) A. -Proof. - intros G A. - reflexivity. -Qed. - -Lemma Advantage_link : - ∀ G₀ G₁ A P, - AdvantageE G₀ G₁ (A ∘ P) = - AdvantageE (P ∘ G₀) (P ∘ G₁) A. -Proof. - intros G₀ G₁ A P. - unfold AdvantageE. rewrite !link_assoc. reflexivity. -Qed. - -Lemma Advantage_par_empty : - ∀ G₀ G₁ A, - AdvantageE (par emptym G₀) (par emptym G₁) A = AdvantageE G₀ G₁ A. -Proof. - intros G₀ G₁ A. - unfold AdvantageE. - rewrite distrC. - reflexivity. -Qed. - -Lemma Advantage_par : - ∀ G₀ G₁ G₁' A L₀ L₁ L₁' E₀ E₁, - ValidPackage L₀ Game_import E₀ G₀ → - ValidPackage L₁ Game_import E₁ G₁ → - ValidPackage L₁' Game_import E₁ G₁' → - flat E₁ → - trimmed E₀ G₀ → - trimmed E₁ G₁ → - trimmed E₁ G₁' → - AdvantageE (par G₀ G₁) (par G₀ G₁') A = - AdvantageE G₁ G₁' (A ∘ par G₀ (ID E₁)). -Proof. - intros G₀ G₁ G₁' A L₀ L₁ L₁' E₀ E₁. - intros Va0 Va1 Va1' Fe0 Te0 Te1 Te1'. - replace (par G₀ G₁) with ((par G₀ (ID E₁)) ∘ (par (ID Game_import) G₁)). - 2:{ - erewrite <- interchange. - all: ssprove_valid. - 4:{ - ssprove_valid. - rewrite domm_ID_fset. - rewrite -fset0E. - apply fdisjoint0s. - } - 2:{ unfold Game_import. rewrite -fset0E. discriminate. } - 2: apply trimmed_ID. - rewrite link_id. - 2:{ unfold Game_import. rewrite -fset0E. discriminate. } - 2: assumption. - rewrite id_link. - 2: assumption. - reflexivity. - } - replace (par G₀ G₁') with ((par G₀ (ID E₁)) ∘ (par (ID Game_import) G₁')). - 2:{ - erewrite <- interchange. - all: ssprove_valid. - 4:{ - ssprove_valid. - rewrite domm_ID_fset. - rewrite -fset0E. - apply fdisjoint0s. - } - 2:{ unfold Game_import. rewrite -fset0E. discriminate. } - 2: apply trimmed_ID. - rewrite link_id. - 2:{ unfold Game_import. rewrite -fset0E. discriminate. } - 2: assumption. - rewrite id_link. - 2: assumption. - reflexivity. - } - rewrite -Advantage_link. - unfold Game_import. rewrite -fset0E. - rewrite Advantage_par_empty. - reflexivity. - Unshelve. all: auto. -Qed. - -Lemma Advantage_sym : - ∀ P Q A, - AdvantageE P Q A = AdvantageE Q P A. -Proof. - intros P Q A. - unfold AdvantageE. - rewrite distrC. reflexivity. -Qed. - -Lemma adv_equiv_sym : - ∀ L₀ L₁ E G₀ G₁ h₀ h₁ ε, - @adv_equiv L₀ L₁ E G₀ G₁ h₀ h₁ ε → - adv_equiv G₁ G₀ ε. -Proof. - intros L₀ L₁ E G₀ G₁ h₀ h₁ ε h. - intros LA A hA hd₁ hd₀. - rewrite Advantage_sym. - eapply h. all: eauto. -Qed. - -Lemma Advantage_triangle : - ∀ P Q R A, - AdvantageE P Q A <= AdvantageE P R A + AdvantageE R Q A. -Proof. - intros P Q R A. - unfold AdvantageE. - apply ler_dist_add. -Qed. - -Fixpoint advantage_sum P l Q A := - match l with - | [::] => AdvantageE P Q A - | R :: l => AdvantageE P R A + advantage_sum R l Q A - end. - -Lemma Advantage_triangle_chain : - ∀ P (l : seq raw_package) Q A, - AdvantageE P Q A <= advantage_sum P l Q A. -Proof. - intros P l Q A. - induction l as [| R l ih] in P, Q |- *. - - simpl. auto. - - simpl. eapply order.Order.POrderTheory.le_trans. - + eapply Advantage_triangle. - + eapply ler_add. - * auto. - * eapply ih. -Qed. - -Lemma AdvantageE_le_0 : - ∀ G₀ G₁ A, - AdvantageE G₀ G₁ A <= 0 → - AdvantageE G₀ G₁ A = 0. -Proof. - intros G₀ G₁ A h. - unfold AdvantageE in *. - rewrite normr_le0 in h. - apply/normr0P. auto. -Qed. - -Lemma Advantage_le_0 : - ∀ G A, - Advantage G A <= 0 → - Advantage G A = 0. -Proof. - intros G A h. - rewrite -> Advantage_E in *. apply AdvantageE_le_0. auto. -Qed. - -Lemma TriangleInequality : - ∀ {Game_export : Interface} - {F G H : Game_Type Game_export} - {ϵ1 ϵ2 ϵ3}, - F ≈[ ϵ1 ] G → - G ≈[ ϵ2 ] H → - F ≈[ ϵ3 ] H → - ∀ LA A, - ValidPackage LA Game_export A_export A → - fdisjoint LA F.(locs) → - fdisjoint LA G.(locs) → - fdisjoint LA H.(locs) → - ϵ3 A <= ϵ1 A + ϵ2 A. -Proof. - intros Game_export F G H ε₁ ε₂ ε₃ h1 h2 h3 LA A vA hF hG hH. - unfold adv_equiv in *. - erewrite <- h1, <- h2, <- h3 by eassumption. - apply ler_dist_add. -Qed. - -Lemma Reduction : - ∀ (M : raw_package) (G : GamePair) A b, - `| Pr (A ∘ (M ∘ (G b))) true | = - `| Pr ((A ∘ M) ∘ (G b)) true |. -Proof. - intros M G A b. - rewrite link_assoc. reflexivity. -Qed. - -Lemma ReductionLem : - ∀ L₀ L₁ E M (G : GamePair) - `{ValidPackage L₀ Game_import E (M ∘ G false)} - `{ValidPackage L₁ Game_import E (M ∘ G true)}, - (M ∘ (G false)) ≈[ λ A, Advantage G (A ∘ M) ] (M ∘ (G true)). -Proof. - intros L₀ L₁ E M G v₀ v₁. - unfold adv_equiv. intros LA A vA hd₀ hd₁. rewrite Advantage_E. - unfold AdvantageE. rewrite !link_assoc. reflexivity. -Qed. - -Ltac advantage_sum_simpl_in h := - repeat - change (advantage_sum ?P (?R :: ?l) ?Q ?A) - with (AdvantageE P R A + advantage_sum R l Q A) in h ; - change (advantage_sum ?P [::] ?Q ?A) with (AdvantageE P Q A) in h. - -Ltac ssprove_triangle_as p₀ l p₁ A ineq := - pose proof (Advantage_triangle_chain p₀ l p₁ A) as ineq ; - advantage_sum_simpl_in ineq ; - rewrite ?ssralg.GRing.addrA in ineq. - -Tactic Notation - "ssprove" "triangle" constr(p₀) constr(l) constr(p₁) constr(A) - "as" ident(ineq) := - ssprove_triangle_as p₀ l p₁ A ineq. diff --git a/ovn/src/ovn_group.rs b/ovn/src/ovn_group.rs index 3d69932..fc664cb 100644 --- a/ovn/src/ovn_group.rs +++ b/ovn/src/ovn_group.rs @@ -1,3 +1,4 @@ +use hax_lib::{implies, lemma}; #[hax_lib_macros::exclude] use hax_lib_macros::*; @@ -20,6 +21,10 @@ fn div(x: G, y: G) -> G { x * G::group_inv(y) } +// #[hax_lib::lemma] +// #[hax_lib::requires(true)] +// fn addC(x: Z, y: Z) -> Proof<{ implies(x != Z::field_zero(), || x + y == y + x) }> {} + //////////////////// // Implementation // //////////////////// @@ -50,8 +55,7 @@ pub fn schnorr_zkp(random: G::Z, h: G, x: G::Z) -> SchnorrZKPCommit // https://crypto.stanford.edu/cs355/19sp/lec5.pdf pub fn schnorr_zkp_validate(h: G, pi: SchnorrZKPCommit) -> bool { pi.schnorr_zkp_c == G::hash(vec![G::g(), h, pi.schnorr_zkp_u]) - && G::g_pow(pi.schnorr_zkp_z) - == pi.schnorr_zkp_u * G::pow(h, pi.schnorr_zkp_c) + && G::g_pow(pi.schnorr_zkp_z) == pi.schnorr_zkp_u * G::pow(h, pi.schnorr_zkp_c) } #[derive(Serialize, SchemaType, Clone, Copy)] @@ -160,13 +164,9 @@ pub fn zkp_one_out_of_two_validate(h: G, zkp: OrZKPCommit) -> bool ]); // TODO: add i (c == zkp.or_zkp_d1 + zkp.or_zkp_d2 - && zkp.or_zkp_a1 - == G::g_pow(zkp.or_zkp_r1) * G::pow(zkp.or_zkp_x, zkp.or_zkp_d1) - && zkp.or_zkp_b1 - == G::pow(h, zkp.or_zkp_r1) * - G::pow(zkp.or_zkp_y, zkp.or_zkp_d1) - && zkp.or_zkp_a2 - == G::g_pow(zkp.or_zkp_r2) * G::pow(zkp.or_zkp_x, zkp.or_zkp_d2) + && zkp.or_zkp_a1 == G::g_pow(zkp.or_zkp_r1) * G::pow(zkp.or_zkp_x, zkp.or_zkp_d1) + && zkp.or_zkp_b1 == G::pow(h, zkp.or_zkp_r1) * G::pow(zkp.or_zkp_y, zkp.or_zkp_d1) + && zkp.or_zkp_a2 == G::g_pow(zkp.or_zkp_r2) * G::pow(zkp.or_zkp_x, zkp.or_zkp_d2) && zkp.or_zkp_b2 == G::pow(h, zkp.or_zkp_r2) * G::pow(div::(zkp.or_zkp_y, G::g()), zkp.or_zkp_d2)) } @@ -288,8 +288,8 @@ pub fn compute_g_pow_yi(i: usize, xis: [G; n]) -> G { } pub fn compute_group_element_for_vote(xi: G::Z, vote: bool, g_pow_yi: G) -> G { - G::pow(g_pow_yi, xi) * - G::g_pow(if vote { + G::pow(g_pow_yi, xi) + * G::g_pow(if vote { G::Z::field_one() } else { G::Z::field_zero() diff --git a/ovn/src/ovn_traits.rs b/ovn/src/ovn_traits.rs index 0a1f8cb..c3f596d 100644 --- a/ovn/src/ovn_traits.rs +++ b/ovn/src/ovn_traits.rs @@ -13,6 +13,7 @@ use hacspec_concordium::*; // use hax_lib::lemma; +#[exclude] use core::iter::Product; #[exclude] use core::marker::Copy; @@ -25,7 +26,16 @@ use core::ops::{Add, Mul, Neg}; /** Interface for field implementation */ pub trait Field: - Copy + PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize + Mul + Product + Add + Neg + Copy + + PartialEq + + Eq + + Clone + + Copy + + hacspec_concordium::Serialize + + Mul + + Product + + Add + + Neg { fn q() -> Self; @@ -37,15 +47,9 @@ pub trait Field: fn inv(x: Self) -> Self; } -// #[hax_lib::lemma] -// #[hax_lib::requires(true)] -// fn addC(x: G, y: G) -> Proof<{ x + y == y + x }> -// { -// } - /** Interface for group implementation */ pub trait Group: - Copy + PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize + Mul + Product + Copy + PartialEq + Eq + Clone + Copy + hacspec_concordium::Serialize + Mul + Product { type Z: Field; diff --git a/ovn/tests/ovn_example.rs b/ovn/tests/ovn_example.rs index f45b336..b01362c 100644 --- a/ovn/tests/ovn_example.rs +++ b/ovn/tests/ovn_example.rs @@ -39,6 +39,7 @@ pub fn schnorr_zkp_correctness(random_x: u32, random_r: u32) -> bool { valid } +#[test] pub fn schnorr_zkp_z_89_correctness() { QuickCheck::new() .tests(10000) diff --git a/p256/proofs/ssprove/extraction/Hacspec_p256.v b/p256/proofs/ssprove/extraction/Hacspec_p256.v new file mode 100644 index 0000000..b950f50 --- /dev/null +++ b/p256/proofs/ssprove/extraction/Hacspec_p256.v @@ -0,0 +1,377 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +(* From Jasmin Require Import word. *) + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_lib. +Export Hacspec_lib. + +Notation "'t_Element'" := (nseq int8 32). +Definition Element : both t_Element -> both t_Element := + id. + +Definition t_Error : choice_type := + ('unit). +Notation "'Error_InvalidAddition_case'" := tt (at level 100). +Equations Error_InvalidAddition : both t_Error := + Error_InvalidAddition := + solve_lift (ret_both (tt : 'unit : t_Error)) : both t_Error. +Fail Next Obligation. + +Notation "'t_P256FieldElement'" := (nat_mod 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff). +Definition P256FieldElement : both t_P256FieldElement -> both t_P256FieldElement := + id. + +Notation "'t_Affine'" := (t_P256FieldElement × t_P256FieldElement). + +Notation "'t_AffineResult'" := (t_Result (t_P256FieldElement × t_P256FieldElement) t_Error). + +Notation "'t_JacobianResult'" := (t_Result (t_P256FieldElement × t_P256FieldElement × t_P256FieldElement) t_Error). + +Notation "'t_P256Jacobian'" := (t_P256FieldElement × t_P256FieldElement × t_P256FieldElement). + +Notation "'t_P256Scalar'" := (nat_mod 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551). +Definition P256Scalar : both t_P256Scalar -> both t_P256Scalar := + id. + +(*Not implemented yet? todo(item)*) + +Equations v_BITS : both uint_size := + v_BITS := + solve_lift (ret_both (256 : uint_size)) : both uint_size. +Fail Next Obligation. + +Equations affine_to_jacobian (p : both (t_P256FieldElement × t_P256FieldElement)) : both (t_P256FieldElement × t_P256FieldElement × t_P256FieldElement) := + affine_to_jacobian p := + letb '(x,y) := p in + solve_lift (prod_b (x,y,impl__P256FieldElement__from_literal (ret_both (1 : int128)))) : both (t_P256FieldElement × t_P256FieldElement × t_P256FieldElement). +Fail Next Obligation. + +Equations is_point_at_infinity (p : both (t_P256FieldElement × t_P256FieldElement × t_P256FieldElement)) : both 'bool := + is_point_at_infinity p := + letb '(v__x,v__y,z) := p in + solve_lift (f_equal z (impl__P256FieldElement__from_literal (ret_both (0 : int128)))) : both 'bool. +Fail Next Obligation. + +Equations jacobian_to_affine (p : both (t_P256FieldElement × t_P256FieldElement × t_P256FieldElement)) : both (t_P256FieldElement × t_P256FieldElement) := + jacobian_to_affine p := + letb '(x,y,z) := p in + letb z2 := f_exp z (ret_both (2 : int32)) in + letb z2i := impl__P256FieldElement__inv z2 in + letb z3 := z .* z2 in + letb z3i := impl__P256FieldElement__inv z3 in + letb x := x .* z2i in + letb y := y .* z3i in + solve_lift (prod_b (x,y)) : both (t_P256FieldElement × t_P256FieldElement). +Fail Next Obligation. + +Equations point_double (p : both (t_P256FieldElement × t_P256FieldElement × t_P256FieldElement)) : both (t_P256FieldElement × t_P256FieldElement × t_P256FieldElement) := + point_double p := + letb '(x1,y1,z1) := p in + letb delta := f_exp z1 (ret_both (2 : int32)) in + letb gamma := f_exp y1 (ret_both (2 : int32)) in + letb beta := x1 .* gamma in + letb alpha_1_ := x1 .- delta in + letb alpha_2_ := x1 .+ delta in + letb alpha := (impl__P256FieldElement__from_literal (ret_both (3 : int128))) .* (alpha_1_ .* alpha_2_) in + letb x3 := (f_exp alpha (ret_both (2 : int32))) .- ((impl__P256FieldElement__from_literal (ret_both (8 : int128))) .* beta) in + letb z3___ := f_exp (y1 .+ z1) (ret_both (2 : int32)) in + letb z3 := z3___ .- (gamma .+ delta) in + letb y3_1_ := ((impl__P256FieldElement__from_literal (ret_both (4 : int128))) .* beta) .- x3 in + letb y3_2_ := (impl__P256FieldElement__from_literal (ret_both (8 : int128))) .* (gamma .* gamma) in + letb y3 := (alpha .* y3_1_) .- y3_2_ in + solve_lift (prod_b (x3,y3,z3)) : both (t_P256FieldElement × t_P256FieldElement × t_P256FieldElement). +Fail Next Obligation. + +Equations s1_equal_s2 (s1 : both t_P256FieldElement) (s2 : both t_P256FieldElement) : both (t_Result (t_P256FieldElement × t_P256FieldElement × t_P256FieldElement) t_Error) := + s1_equal_s2 s1 s2 := + solve_lift (ifb f_equal s1 s2 + then v_Err Error_InvalidAddition + else v_Ok (prod_b (impl__P256FieldElement__from_literal (ret_both (0 : int128)),impl__P256FieldElement__from_literal (ret_both (1 : int128)),impl__P256FieldElement__from_literal (ret_both (0 : int128))))) : both (t_Result (t_P256FieldElement × t_P256FieldElement × t_P256FieldElement) t_Error). +Fail Next Obligation. + +Equations point_add_jacob (p : both (t_P256FieldElement × t_P256FieldElement × t_P256FieldElement)) (q : both (t_P256FieldElement × t_P256FieldElement × t_P256FieldElement)) : both (t_Result (t_P256FieldElement × t_P256FieldElement × t_P256FieldElement) t_Error) := + point_add_jacob p q := + letb result := v_Ok q in + letb result := ifb not (is_point_at_infinity p) + then ifb is_point_at_infinity q + then letb result := v_Ok p in + result + else letb '(x1,y1,z1) := p in + letb '(x2,y2,z2) := q in + letb z1z1 := f_exp z1 (ret_both (2 : int32)) in + letb z2z2 := f_exp z2 (ret_both (2 : int32)) in + letb u1 := x1 .* z2z2 in + letb u2 := x2 .* z1z1 in + letb s1 := (y1 .* z2) .* z2z2 in + letb s2 := (y2 .* z1) .* z1z1 in + ifb f_equal u1 u2 + then letb result := s1_equal_s2 s1 s2 in + result + else letb h := u2 .- u1 in + letb i := f_exp ((impl__P256FieldElement__from_literal (ret_both (2 : int128))) .* h) (ret_both (2 : int32)) in + letb j := h .* i in + letb r := (impl__P256FieldElement__from_literal (ret_both (2 : int128))) .* (s2 .- s1) in + letb v := u1 .* i in + letb x3_1_ := (impl__P256FieldElement__from_literal (ret_both (2 : int128))) .* v in + letb x3_2_ := (f_exp r (ret_both (2 : int32))) .- j in + letb x3 := x3_2_ .- x3_1_ in + letb y3_1_ := ((impl__P256FieldElement__from_literal (ret_both (2 : int128))) .* s1) .* j in + letb y3_2_ := r .* (v .- x3) in + letb y3 := y3_2_ .- y3_1_ in + letb z3___ := f_exp (z1 .+ z2) (ret_both (2 : int32)) in + letb z3 := (z3___ .- (z1z1 .+ z2z2)) .* h in + letb result := v_Ok (prod_b (x3,y3,z3)) in + result + else result in + solve_lift result : both (t_Result (t_P256FieldElement × t_P256FieldElement × t_P256FieldElement) t_Error). +Fail Next Obligation. + +Equations ltr_mul (k : both t_P256Scalar) (p : both (t_P256FieldElement × t_P256FieldElement × t_P256FieldElement)) : both (t_Result (t_P256FieldElement × t_P256FieldElement × t_P256FieldElement) t_Error) := + ltr_mul k p := + letb q := prod_b (impl__P256FieldElement__from_literal (ret_both (0 : int128)),impl__P256FieldElement__from_literal (ret_both (1 : int128)),impl__P256FieldElement__from_literal (ret_both (0 : int128))) in + letb q := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := v_BITS))) q (fun q => fun i => + letb q := point_double q in + ifb f_equal (f_get_bit k ((v_BITS .- (ret_both (1 : uint_size))) .- i)) (f_ONE (ret_both (tt : 'unit))) + then letm[choice_typeMonad.result_bind_code t_Error] hoist1 := impl__map_err (point_add_jacob q p) f_from in + Result_Ok (letb q := hoist1 in + q) + else Result_Ok q) in + solve_lift (v_Ok q) : both (t_Result (t_P256FieldElement × t_P256FieldElement × t_P256FieldElement) t_Error). +Fail Next Obligation. + +Equations p256_point_mul (k : both t_P256Scalar) (p : both (t_P256FieldElement × t_P256FieldElement)) : both (t_Result (t_P256FieldElement × t_P256FieldElement) t_Error) := + p256_point_mul k p := + solve_lift (run (letm[choice_typeMonad.result_bind_code t_Error] jac := impl__map_err (ltr_mul k (affine_to_jacobian p)) f_from in + Result_Ok (v_Ok (jacobian_to_affine jac)))) : both (t_Result (t_P256FieldElement × t_P256FieldElement) t_Error). +Fail Next Obligation. + +Equations point_add_distinct (p : both (t_P256FieldElement × t_P256FieldElement)) (q : both (t_P256FieldElement × t_P256FieldElement)) : both (t_Result (t_P256FieldElement × t_P256FieldElement) t_Error) := + point_add_distinct p q := + solve_lift (run (letm[choice_typeMonad.result_bind_code t_Error] r := impl__map_err (point_add_jacob (affine_to_jacobian p) (affine_to_jacobian q)) f_from in + Result_Ok (v_Ok (jacobian_to_affine r)))) : both (t_Result (t_P256FieldElement × t_P256FieldElement) t_Error). +Fail Next Obligation. + +Equations point_add (p : both (t_P256FieldElement × t_P256FieldElement)) (q : both (t_P256FieldElement × t_P256FieldElement)) : both (t_Result (t_P256FieldElement × t_P256FieldElement) t_Error) := + point_add p q := + solve_lift (ifb p <> q + then point_add_distinct p q + else v_Ok (jacobian_to_affine (point_double (affine_to_jacobian p)))) : both (t_Result (t_P256FieldElement × t_P256FieldElement) t_Error). +Fail Next Obligation. + +Equations p256_calculate_w (x : both t_P256FieldElement) : both t_P256FieldElement := + p256_calculate_w x := + letb b := impl__P256FieldElement__from_byte_seq_be (impl_52__from_vec (impl__into_vec (unsize (box_new (array_from_list [U8 (ret_both (90 : int8)); + U8 (ret_both (198 : int8)); + U8 (ret_both (53 : int8)); + U8 (ret_both (216 : int8)); + U8 (ret_both (170 : int8)); + U8 (ret_both (58 : int8)); + U8 (ret_both (147 : int8)); + U8 (ret_both (231 : int8)); + U8 (ret_both (179 : int8)); + U8 (ret_both (235 : int8)); + U8 (ret_both (189 : int8)); + U8 (ret_both (85 : int8)); + U8 (ret_both (118 : int8)); + U8 (ret_both (152 : int8)); + U8 (ret_both (134 : int8)); + U8 (ret_both (188 : int8)); + U8 (ret_both (101 : int8)); + U8 (ret_both (29 : int8)); + U8 (ret_both (6 : int8)); + U8 (ret_both (176 : int8)); + U8 (ret_both (204 : int8)); + U8 (ret_both (83 : int8)); + U8 (ret_both (176 : int8)); + U8 (ret_both (246 : int8)); + U8 (ret_both (59 : int8)); + U8 (ret_both (206 : int8)); + U8 (ret_both (60 : int8)); + U8 (ret_both (62 : int8)); + U8 (ret_both (39 : int8)); + U8 (ret_both (210 : int8)); + U8 (ret_both (96 : int8)); + U8 (ret_both (75 : int8))]))))) in + letb exp := impl__P256FieldElement__from_byte_seq_be (impl_52__from_vec (impl__into_vec (unsize (box_new (array_from_list [U8 (ret_both (63 : int8)); + U8 (ret_both (255 : int8)); + U8 (ret_both (255 : int8)); + U8 (ret_both (255 : int8)); + U8 (ret_both (192 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (64 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (64 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8)); + U8 (ret_both (0 : int8))]))))) in + letb z := (((x .* x) .* x) .- ((impl__P256FieldElement__from_literal (ret_both (3 : int128))) .* x)) .+ b in + solve_lift (impl__P256FieldElement__pow_felem z exp) : both t_P256FieldElement. +Fail Next Obligation. + +Equations p256_point_mul_base (k : both t_P256Scalar) : both (t_Result (t_P256FieldElement × t_P256FieldElement) t_Error) := + p256_point_mul_base k := + letb base_point := prod_b (impl__P256FieldElement__from_byte_seq_be (Element (array_from_list [U8 (ret_both (107 : int8)); + U8 (ret_both (23 : int8)); + U8 (ret_both (209 : int8)); + U8 (ret_both (242 : int8)); + U8 (ret_both (225 : int8)); + U8 (ret_both (44 : int8)); + U8 (ret_both (66 : int8)); + U8 (ret_both (71 : int8)); + U8 (ret_both (248 : int8)); + U8 (ret_both (188 : int8)); + U8 (ret_both (230 : int8)); + U8 (ret_both (229 : int8)); + U8 (ret_both (99 : int8)); + U8 (ret_both (164 : int8)); + U8 (ret_both (64 : int8)); + U8 (ret_both (242 : int8)); + U8 (ret_both (119 : int8)); + U8 (ret_both (3 : int8)); + U8 (ret_both (125 : int8)); + U8 (ret_both (129 : int8)); + U8 (ret_both (45 : int8)); + U8 (ret_both (235 : int8)); + U8 (ret_both (51 : int8)); + U8 (ret_both (160 : int8)); + U8 (ret_both (244 : int8)); + U8 (ret_both (161 : int8)); + U8 (ret_both (57 : int8)); + U8 (ret_both (69 : int8)); + U8 (ret_both (216 : int8)); + U8 (ret_both (152 : int8)); + U8 (ret_both (194 : int8)); + U8 (ret_both (150 : int8))])),impl__P256FieldElement__from_byte_seq_be (Element (array_from_list [U8 (ret_both (79 : int8)); + U8 (ret_both (227 : int8)); + U8 (ret_both (66 : int8)); + U8 (ret_both (226 : int8)); + U8 (ret_both (254 : int8)); + U8 (ret_both (26 : int8)); + U8 (ret_both (127 : int8)); + U8 (ret_both (155 : int8)); + U8 (ret_both (142 : int8)); + U8 (ret_both (231 : int8)); + U8 (ret_both (235 : int8)); + U8 (ret_both (74 : int8)); + U8 (ret_both (124 : int8)); + U8 (ret_both (15 : int8)); + U8 (ret_both (158 : int8)); + U8 (ret_both (22 : int8)); + U8 (ret_both (43 : int8)); + U8 (ret_both (206 : int8)); + U8 (ret_both (51 : int8)); + U8 (ret_both (87 : int8)); + U8 (ret_both (107 : int8)); + U8 (ret_both (49 : int8)); + U8 (ret_both (94 : int8)); + U8 (ret_both (206 : int8)); + U8 (ret_both (203 : int8)); + U8 (ret_both (182 : int8)); + U8 (ret_both (64 : int8)); + U8 (ret_both (104 : int8)); + U8 (ret_both (55 : int8)); + U8 (ret_both (191 : int8)); + U8 (ret_both (81 : int8)); + U8 (ret_both (245 : int8))]))) in + solve_lift (p256_point_mul k base_point) : both (t_Result (t_P256FieldElement × t_P256FieldElement) t_Error). +Fail Next Obligation. + +Equations p256_validate_private_key (k : both (t_Seq t_U8)) : both 'bool := + p256_validate_private_key k := + letb valid := ret_both (true : 'bool) in + letb k_element := impl__P256Scalar__from_byte_seq_be k in + letb k_element_bytes := impl__P256Scalar__to_byte_seq_be k_element in + letb all_zero := ret_both (true : 'bool) in + letb '(all_zero,valid) := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__len k))) (prod_b (all_zero,valid)) (fun '(all_zero,valid) => fun i => + letb all_zero := ifb not (f_equal (k.a[i]) (U8 (ret_both (0 : int8)))) + then letb all_zero := ret_both (false : 'bool) in + all_zero + else all_zero in + ifb not (f_equal (k_element_bytes.a[i]) (k.a[i])) + then letb valid := ret_both (false : 'bool) in + prod_b (all_zero,valid) + else prod_b (all_zero,valid)) in + solve_lift (andb valid (not all_zero)) : both 'bool. +Fail Next Obligation. + +Equations p256_validate_public_key (p : both (t_P256FieldElement × t_P256FieldElement)) : both 'bool := + p256_validate_public_key p := + letb b := impl__P256FieldElement__from_byte_seq_be (impl_52__from_vec (impl__into_vec (unsize (box_new (array_from_list [U8 (ret_both (90 : int8)); + U8 (ret_both (198 : int8)); + U8 (ret_both (53 : int8)); + U8 (ret_both (216 : int8)); + U8 (ret_both (170 : int8)); + U8 (ret_both (58 : int8)); + U8 (ret_both (147 : int8)); + U8 (ret_both (231 : int8)); + U8 (ret_both (179 : int8)); + U8 (ret_both (235 : int8)); + U8 (ret_both (189 : int8)); + U8 (ret_both (85 : int8)); + U8 (ret_both (118 : int8)); + U8 (ret_both (152 : int8)); + U8 (ret_both (134 : int8)); + U8 (ret_both (188 : int8)); + U8 (ret_both (101 : int8)); + U8 (ret_both (29 : int8)); + U8 (ret_both (6 : int8)); + U8 (ret_both (176 : int8)); + U8 (ret_both (204 : int8)); + U8 (ret_both (83 : int8)); + U8 (ret_both (176 : int8)); + U8 (ret_both (246 : int8)); + U8 (ret_both (59 : int8)); + U8 (ret_both (206 : int8)); + U8 (ret_both (60 : int8)); + U8 (ret_both (62 : int8)); + U8 (ret_both (39 : int8)); + U8 (ret_both (210 : int8)); + U8 (ret_both (96 : int8)); + U8 (ret_both (75 : int8))]))))) in + letb point_at_infinity := is_point_at_infinity (affine_to_jacobian p) in + letb '(x,y) := p in + letb on_curve := (y .* y) =.? ((((x .* x) .* x) .- ((impl__P256FieldElement__from_literal (ret_both (3 : int128))) .* x)) .+ b) in + solve_lift (andb (not point_at_infinity) on_curve) : both 'bool. +Fail Next Obligation. diff --git a/pasta/proofs/ssprove/extraction/Hacspec_pasta.v b/pasta/proofs/ssprove/extraction/Hacspec_pasta.v new file mode 100644 index 0000000..b9e0cd4 --- /dev/null +++ b/pasta/proofs/ssprove/extraction/Hacspec_pasta.v @@ -0,0 +1,208 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +(* From Jasmin Require Import word. *) + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_lib. +Export Hacspec_lib. + +Notation "'t_G1_pallas'" := (t_FpPallas × t_FpPallas × 'bool). + +Notation "'t_G1_vesta'" := (t_FpVesta × t_FpVesta × 'bool). + +Notation "'t_FpPallas'" := (nat_mod 0x40000000000000000000000000000000224698FC094CF91B992D30ED00000001). +Definition FpPallas : both t_FpPallas -> both t_FpPallas := + id. + +Notation "'t_FpVesta'" := (nat_mod 0x40000000000000000000000000000000224698FC0994A8DD8C46EB2100000001). +Definition FpVesta : both t_FpVesta -> both t_FpVesta := + id. + +(*Not implemented yet? todo(item)*) + +Equations g1_default_pallas (_ : both 'unit) : both (t_FpPallas × t_FpPallas × 'bool) := + g1_default_pallas _ := + solve_lift (prod_b (f_ZERO (ret_both (tt : 'unit)),f_ZERO (ret_both (tt : 'unit)),ret_both (true : 'bool))) : both (t_FpPallas × t_FpPallas × 'bool). +Fail Next Obligation. + +Equations g1_default_vesta (_ : both 'unit) : both (t_FpVesta × t_FpVesta × 'bool) := + g1_default_vesta _ := + solve_lift (prod_b (f_ZERO (ret_both (tt : 'unit)),f_ZERO (ret_both (tt : 'unit)),ret_both (true : 'bool))) : both (t_FpVesta × t_FpVesta × 'bool). +Fail Next Obligation. + +Equations g1_is_identity_pallas (p : both (t_FpPallas × t_FpPallas × 'bool)) : both 'bool := + g1_is_identity_pallas p := + letb '(_,_,inf) := p in + solve_lift inf : both 'bool. +Fail Next Obligation. + +Equations g1_is_identity_vesta (p : both (t_FpVesta × t_FpVesta × 'bool)) : both 'bool := + g1_is_identity_vesta p := + letb '(_,_,inf) := p in + solve_lift inf : both 'bool. +Fail Next Obligation. + +Equations g1_on_curve_pallas (p : both (t_FpPallas × t_FpPallas × 'bool)) : both 'bool := + g1_on_curve_pallas p := + letb '(x,y,inf) := p in + letb y_squared := y .* y in + letb x_cubed := (x .* x) .* x in + letb fp5 := ((f_TWO (ret_both (tt : 'unit))) .+ (f_TWO (ret_both (tt : 'unit)))) .+ (f_ONE (ret_both (tt : 'unit))) in + solve_lift (orb (y_squared =.? (x_cubed .+ fp5)) inf) : both 'bool. +Fail Next Obligation. + +Equations g1_on_curve_vesta (p : both (t_FpVesta × t_FpVesta × 'bool)) : both 'bool := + g1_on_curve_vesta p := + letb '(x,y,inf) := p in + letb y_squared := y .* y in + letb x_cubed := (x .* x) .* x in + letb fp5 := ((f_TWO (ret_both (tt : 'unit))) .+ (f_TWO (ret_both (tt : 'unit)))) .+ (f_ONE (ret_both (tt : 'unit))) in + solve_lift (orb (y_squared =.? (x_cubed .+ fp5)) inf) : both 'bool. +Fail Next Obligation. + +Equations g1add_a_pallas (p : both (t_FpPallas × t_FpPallas × 'bool)) (q : both (t_FpPallas × t_FpPallas × 'bool)) : both (t_FpPallas × t_FpPallas × 'bool) := + g1add_a_pallas p q := + letb '(x1,y1,_) := p in + letb '(x2,y2,_) := q in + letb x_diff := x2 .- x1 in + letb y_diff := y2 .- y1 in + letb xovery := y_diff .* (impl__FpPallas__inv x_diff) in + letb x3 := ((f_exp xovery (ret_both (2 : int32))) .- x1) .- x2 in + letb y3 := (xovery .* (x1 .- x3)) .- y1 in + solve_lift (prod_b (x3,y3,ret_both (false : 'bool))) : both (t_FpPallas × t_FpPallas × 'bool). +Fail Next Obligation. + +Equations g1add_a_vesta (p : both (t_FpVesta × t_FpVesta × 'bool)) (q : both (t_FpVesta × t_FpVesta × 'bool)) : both (t_FpVesta × t_FpVesta × 'bool) := + g1add_a_vesta p q := + letb '(x1,y1,_) := p in + letb '(x2,y2,_) := q in + letb x_diff := x2 .- x1 in + letb y_diff := y2 .- y1 in + letb xovery := y_diff .* (impl__FpVesta__inv x_diff) in + letb x3 := ((f_exp xovery (ret_both (2 : int32))) .- x1) .- x2 in + letb y3 := (xovery .* (x1 .- x3)) .- y1 in + solve_lift (prod_b (x3,y3,ret_both (false : 'bool))) : both (t_FpVesta × t_FpVesta × 'bool). +Fail Next Obligation. + +Equations g1double_a_pallas (p : both (t_FpPallas × t_FpPallas × 'bool)) : both (t_FpPallas × t_FpPallas × 'bool) := + g1double_a_pallas p := + letb '(x1,y1,_) := p in + letb x12 := f_exp x1 (ret_both (2 : int32)) in + letb xovery := ((impl__FpPallas__from_literal (ret_both (3 : int128))) .* x12) .* (impl__FpPallas__inv ((f_TWO (ret_both (tt : 'unit))) .* y1)) in + letb x3 := (f_exp xovery (ret_both (2 : int32))) .- ((f_TWO (ret_both (tt : 'unit))) .* x1) in + letb y3 := (xovery .* (x1 .- x3)) .- y1 in + solve_lift (prod_b (x3,y3,ret_both (false : 'bool))) : both (t_FpPallas × t_FpPallas × 'bool). +Fail Next Obligation. + +Equations g1double_a_vesta (p : both (t_FpVesta × t_FpVesta × 'bool)) : both (t_FpVesta × t_FpVesta × 'bool) := + g1double_a_vesta p := + letb '(x1,y1,_) := p in + letb x12 := f_exp x1 (ret_both (2 : int32)) in + letb xovery := ((impl__FpVesta__from_literal (ret_both (3 : int128))) .* x12) .* (impl__FpVesta__inv ((f_TWO (ret_both (tt : 'unit))) .* y1)) in + letb x3 := (f_exp xovery (ret_both (2 : int32))) .- ((f_TWO (ret_both (tt : 'unit))) .* x1) in + letb y3 := (xovery .* (x1 .- x3)) .- y1 in + solve_lift (prod_b (x3,y3,ret_both (false : 'bool))) : both (t_FpVesta × t_FpVesta × 'bool). +Fail Next Obligation. + +Equations g1double_pallas (p : both (t_FpPallas × t_FpPallas × 'bool)) : both (t_FpPallas × t_FpPallas × 'bool) := + g1double_pallas p := + letb '(v__x1,y1,inf1) := p in + solve_lift (ifb andb (y1 <> (f_ZERO (ret_both (tt : 'unit)))) (not inf1) + then g1double_a_pallas p + else prod_b (f_ZERO (ret_both (tt : 'unit)),f_ZERO (ret_both (tt : 'unit)),ret_both (true : 'bool))) : both (t_FpPallas × t_FpPallas × 'bool). +Fail Next Obligation. + +Equations g1add_pallas (p : both (t_FpPallas × t_FpPallas × 'bool)) (q : both (t_FpPallas × t_FpPallas × 'bool)) : both (t_FpPallas × t_FpPallas × 'bool) := + g1add_pallas p q := + letb '(x1,y1,inf1) := p in + letb '(x2,y2,inf2) := q in + solve_lift (ifb inf1 + then q + else ifb inf2 + then p + else ifb p =.? q + then g1double_pallas p + else ifb not (andb (x1 =.? x2) (y1 =.? ((f_ZERO (ret_both (tt : 'unit))) .- y2))) + then g1add_a_pallas p q + else prod_b (f_ZERO (ret_both (tt : 'unit)),f_ZERO (ret_both (tt : 'unit)),ret_both (true : 'bool))) : both (t_FpPallas × t_FpPallas × 'bool). +Fail Next Obligation. + +Equations g1double_vesta (p : both (t_FpVesta × t_FpVesta × 'bool)) : both (t_FpVesta × t_FpVesta × 'bool) := + g1double_vesta p := + letb '(v__x1,y1,inf1) := p in + solve_lift (ifb andb (y1 <> (f_ZERO (ret_both (tt : 'unit)))) (not inf1) + then g1double_a_vesta p + else prod_b (f_ZERO (ret_both (tt : 'unit)),f_ZERO (ret_both (tt : 'unit)),ret_both (true : 'bool))) : both (t_FpVesta × t_FpVesta × 'bool). +Fail Next Obligation. + +Equations g1add_vesta (p : both (t_FpVesta × t_FpVesta × 'bool)) (q : both (t_FpVesta × t_FpVesta × 'bool)) : both (t_FpVesta × t_FpVesta × 'bool) := + g1add_vesta p q := + letb '(x1,y1,inf1) := p in + letb '(x2,y2,inf2) := q in + solve_lift (ifb inf1 + then q + else ifb inf2 + then p + else ifb p =.? q + then g1double_vesta p + else ifb not (andb (x1 =.? x2) (y1 =.? ((f_ZERO (ret_both (tt : 'unit))) .- y2))) + then g1add_a_vesta p q + else prod_b (f_ZERO (ret_both (tt : 'unit)),f_ZERO (ret_both (tt : 'unit)),ret_both (true : 'bool))) : both (t_FpVesta × t_FpVesta × 'bool). +Fail Next Obligation. + +Equations g1neg_pallas (p : both (t_FpPallas × t_FpPallas × 'bool)) : both (t_FpPallas × t_FpPallas × 'bool) := + g1neg_pallas p := + letb '(x,y,inf) := p in + solve_lift (prod_b (x,(f_ZERO (ret_both (tt : 'unit))) .- y,inf)) : both (t_FpPallas × t_FpPallas × 'bool). +Fail Next Obligation. + +Equations g1neg_vesta (p : both (t_FpVesta × t_FpVesta × 'bool)) : both (t_FpVesta × t_FpVesta × 'bool) := + g1neg_vesta p := + letb '(x,y,inf) := p in + solve_lift (prod_b (x,(f_ZERO (ret_both (tt : 'unit))) .- y,inf)) : both (t_FpVesta × t_FpVesta × 'bool). +Fail Next Obligation. + +Equations g1mul_pallas (m : both t_FpVesta) (p : both (t_FpPallas × t_FpPallas × 'bool)) : both (t_FpPallas × t_FpPallas × 'bool) := + g1mul_pallas m p := + letb t := prod_b (f_ZERO (ret_both (tt : 'unit)),f_ZERO (ret_both (tt : 'unit)),ret_both (true : 'bool)) in + letb t := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := ret_both (255 : uint_size)))) t (fun t => fun i => + letb t := g1double_pallas t in + ifb impl__FpVesta__bit m ((ret_both (254 : uint_size)) .- i) + then letb t := g1add_pallas t p in + t + else t) in + solve_lift t : both (t_FpPallas × t_FpPallas × 'bool). +Fail Next Obligation. + +Equations g1mul_vesta (m : both t_FpPallas) (p : both (t_FpVesta × t_FpVesta × 'bool)) : both (t_FpVesta × t_FpVesta × 'bool) := + g1mul_vesta m p := + letb t := prod_b (f_ZERO (ret_both (tt : 'unit)),f_ZERO (ret_both (tt : 'unit)),ret_both (true : 'bool)) in + letb t := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := ret_both (255 : uint_size)))) t (fun t => fun i => + letb t := g1double_vesta t in + ifb impl__FpPallas__bit m ((ret_both (254 : uint_size)) .- i) + then letb t := g1add_vesta t p in + t + else t) in + solve_lift t : both (t_FpVesta × t_FpVesta × 'bool). +Fail Next Obligation. diff --git a/pat_trash.v b/pat_trash.v new file mode 100644 index 0000000..ad557c0 --- /dev/null +++ b/pat_trash.v @@ -0,0 +1,307 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Crypt Require Import jasmin_word. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +(* Require Import Group. *) +(* Export Group. *) + +(* Require Import Group_Ff. *) +(* Export Group_Ff. *) + +(* Require Import Field. *) +(* Export Field. *) + +(* Require Import Group. *) +(* Export Group. *) + +(* Require Import Gt. *) +(* Export Gt. *) + +(* Require Import Add. *) +(* Export Add. *) + +(* Notation "'t_G'" := t_Gt. *) + +(* Notation "'t_Z'" := f_Scalar. *) + +(* (*Not implemented yet? todo(item)*) *) + +(* (*Not implemented yet? todo(item)*) *) + +(* Equations hash {L1 : {fset Location}} {I1 : Interface} (v__inp : both L1 I1 (t_Vec t_Gt t_Global)) : both L1 I1 t_Scalar := *) +(* hash v__inp := *) +(* solve_lift (impl__Scalar__one (ret_both (tt : 'unit))) : both L1 I1 t_Scalar. *) +(* Fail Next Obligation. *) + +Definition t_my_test : choice_type := + (int32 × 'bool). +Record t_my_test_rec : Type := + { f_temp : int32 ; + f_other : 'bool ; }. +Definition to_rec : t_my_test -> t_my_test_rec := fun x => {| f_temp := fst x ; f_other := snd x |}. +Definition from_rec (x : t_my_test_rec) : t_my_test := (f_temp x, f_other x). + +Record t_my_test_rec_both L I : Type := + { f_temp_both : both L I int32 ; + f_other_both : both L I 'bool ; }. +Arguments f_temp_both {_} {_}. +Arguments f_other_both {_} {_}. + +Equations lift_rec {L I} (x : t_my_test_rec) : @t_my_test_rec_both L I := + lift_rec x := + {| + f_temp_both := solve_lift ret_both (f_temp x) ; + f_other_both := solve_lift ret_both (f_other x) ; |}. +Fail Next Obligation. +Equations to_rec_both {L I} (x : both L I t_my_test) : t_my_test_rec_both L I := + to_rec_both x := + {| + f_temp_both := bind_both x (fun x => solve_lift ret_both (fst x)); + f_other_both := bind_both x (fun x => solve_lift ret_both (snd x : 'bool)); + |}. +Fail Next Obligation. +Coercion to_rec_both : both >-> t_my_test_rec_both. + +Equations from_rec_both {L I} (x : t_my_test_rec_both L I) : both L I t_my_test := + from_rec_both x := + solve_lift prod_b(f_temp_both x, f_other_both x). +Fail Next Obligation. +Coercion from_rec_both : t_my_test_rec_both >-> both. + +Notation "'matchb' x 'with' '|' a '=>' b 'end'" := + (bind_both x (fun y => match y with + | a => b end)) (at level 100, a pattern). +Check fun x : both fset0 fset0 t_my_test => matchb x with | (c, _) => ret_both c end. + +Equations f_temp {L : {fset Location}} {I : Interface} (s : both L I t_my_test) : both L I int32 := + f_temp s := + bind_both s (fun x => + solve_lift (ret_both (fst x : int32))) : both L I int32. +Fail Next Obligation. +Equations f_other {L : {fset Location}} {I : Interface} (s : both L I t_my_test) : both L I 'bool := + f_other s := + bind_both s (fun x => + solve_lift (ret_both (snd x : 'bool))) : both L I 'bool. +Fail Next Obligation. +Inductive t_my_test_ind : forall {L I} (s : both L I t_my_test), Type := +| Build_t_my_test : forall {L1 L2 I1 I2} {f_temp : both L1 I1 int32} {f_other : both L2 I2 'bool}, t_my_test_ind (prod_b(f_temp, f_other) : both (L1 :|: L2) (I1 :|: I2) t_my_test). +Fail Next Obligation. +Notation "'Build_t_my_test' '[' x ']' '(' 'f_temp' ':=' y ')'" := (Build_t_my_test (f_temp := y) (f_other := f_other x)). + +Theorem equality_by_weak_equivalence : + forall {A : choice_type} (is_pure : A) (is_state : raw_code A) (k : raw_code A -> Prop), + deterministic is_state -> + ⊢ ⦃ true_precond ⦄ is_state ≈ ret is_pure ⦃ pre_to_post_ret true_precond is_pure ⦄ -> + is_state = (ret is_pure). +Proof. + intros. + apply (sem_to_det _ _ _ _ X (deterministic_ret is_pure)) in H. + specialize (H empty_heap empty_heap (ltac:(reflexivity))). + induction X. + - now destruct H as [[] ?]. + - admit. + - rewrite IHX. +Admitted. + (* intros. *) + (* apply rf_preserves_eq. *) + (* Set Printing All. *) + + (* inversion H. *) + (* unfold ssreflect.lock in H0. *) + (* unfold rel_jdg in H. *) + (* inversion H. *) + +Set Bullet Behavior "Strict Subproofs". +Set Default Goal Selector "!". + +Lemma Location_eq_dec : forall x y : Location, {x = y} + {x <> y}. +Proof. + clear ; intros. + destruct x as [x0 x1], y as [y0 y1]. + destruct (choice_type_eqP x0 y0). + - subst. + destruct (Nat.eq_dec x1 y1). + + now left. + + now right. + - now right. +Qed. + +Definition cast_from_one_to_other {L I} {s : _ } (x : @t_my_test_ind L I s) : both L I t_my_test := s. + +Program Definition cast_from_one_to_other {L I} (s : both L I t_my_test) : @t_my_test_ind (L :|: L) (I :|: I) (solve_lift s). +Proof. + pose (split_both s). + destruct s0 eqn:so. + assert (forall {L I} {A : choice_type} (s : both L I A), unsplit_both (split_both s) = s). + { + clear ; intros. + apply both_eq. + induction A ; simpl ; try reflexivity. + - destruct s as [[] [] ?] ; simpl in is_valid_code, is_valid_both, p_eq. + rewrite prod_to_prod_equation_1 ; simpl. + unfold prod_both0, eq_rect ; destruct ChoiceEquality.prod_both0_obligation_1, ChoiceEquality.prod_both0_obligation_2. + rewrite prod_both_equation_1. + simpl; rewrite IHA1, IHA2. + unfold bind_raw_both ; simpl. + rewrite <- surjective_pairing. + f_equal. + specialize (valid_both_is_deterministic L (A1 × A2) is_pure is_state is_valid_both). + apply (sem_to_det _ _ _ _ X (deterministic_ret is_pure)) in p_eq. + specialize (p_eq empty_heap empty_heap Logic.I). + inversion is_valid_both ; subst. + + now destruct is_pure. + + simpl in *. + (* unfold det_jdg in p_eq. *) + (* unfold det_run in p_eq. *) + inversion X ; subst. + inversion X0 ; subst. + apply Eqdep_dec.inj_pair2_eq_dec in H3. + 2: apply Location_eq_dec. + apply Eqdep_dec.inj_pair2_eq_dec in H4. + 2: apply Location_eq_dec. + f_equal. + f_equal. + Require Import FunctionalExtensionality. + apply functional_extensionality. + intros x. + specialize (X1 x). + inversion X1. + * subst. + rewrite <- H0. + simpl. + + + inversion X1. + * + + unfold Location in x. + apply Nat.eq_dec. + apply Int.Z_as_Int.eq_dec. + easy. + + inversion X1 ; subst. + + * simpl. + + assert (deterministic is_state). + { + subst. + apply deterministic_put. + apply deterministic_get. + intros. + apply deterministic_ret. + } + + + destruct both_prog_valid. + + destruct is_state. + apply (sem_to_det _ _ _ _ X (deterministic_ret is_pure)) in p_eq. + simpl in p_eq. + + equality_by_weak_equivalence. + } + + refine (let '(a, b) := split_both s in _). + epose (Build_t_my_test (f_temp := a) (f_other := b)). +Proof. + replace (solve_lift s) with (prod_b (f_temp s, f_other s)). + apply (Build_t_my_test (f_temp := f_temp s) (f_other := f_other s)). + apply both_eq. + simpl. + destruct s as [[] ? ?]. + rewrite prod_both_equation_1, f_temp_equation_1, f_other_equation_1. + simpl ; unfold bind_raw_both ; simpl in p_eq |- *. + f_equal. + - now destruct is_pure. + - pattern is_state ; rewrite (equality_by_weak_equivalence is_pure is_state) ; [ | apply p_eq ]. + simpl. + + + replace is_state with (x ← is_state ;; ret ((fst x, snd x) : chProd int32 'bool)) at -1 by now setoid_rewrite <- surjective_pairing ; rewrite bind_ret. + setoid_rewrite bind_assoc. + setoid_rewrite bind_assoc. + setoid_rewrite bind_rewrite. + rewrite <- (bind_ret _ is_state) at -1. + rewrite bind_assoc. + apply f_equal. + Require Import FunctionalExtensionality. + apply functional_extensionality. + intros. + apply f_equal. + + intros x. + rewrite <- bind_ret. + apply rf_preserves_eq. + + replace (x ← is_state ;; _ (fst x)) with ('(a, b) ← is_state ;; ret a). + inversion both_prog_valid. + pose bind_cong. + rewrite bind_assoc. + rewrite bind_assoc. + setoid_rewrite bind_assoc. + destruct is_state. + + destruct x. + + reflexivity. + + simpl. + . + + rewrite <- bind_ret. + destruct is_state. + now destruct x. + simpl. + now destruct x0. + cbn. + reflexivity. + cbn in t. + unfold bind_both in t. + cbn in t. + unfold bind_both in t. + apply t. + unfold prod_both in t. + epose (bind_both s (fun '(x, y) => Build_t_my_test x)). + apply Build_t_my_test. +Check fun x : both fset0 fset0 t_my_test => + matchb x with +| Build_t_my_test => _ +end. + + +Print Table Printing Records. +Add Printing Record f_temp. + +Class t_Add A B := { + f_Output : choice_type ; + f_add_loc : {fset Location} ; + f_add : forall {L1 L2 I1 I2}, both L1 I1 A -> both L2 I2 B -> both (L1 :|: L2 :|: f_add_loc) (I1 :|: I2) f_Output + }. + +#[global] Program Instance t_my_test_t_Add : t_Add t_my_test t_my_test := + let f_Output := t_my_test : choice_type in + let f_add := fun {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (self : both L1 I1 t_my_test) (rhs : both L2 I2 t_my_test) => solve_lift (Build_t_my_test (f_temp := (f_temp self) .+ (f_temp rhs))) : both (L1 :|: L2 :|: fset []) (I1 :|: I2) t_my_test in + {| f_Output := (@f_Output); + f_add_loc := (fset [] : {fset Location}); + f_add := (@f_add)|}. +Fail Next Obligation. +Hint Unfold t_my_test_t_Add. diff --git a/poly1305/proofs/ssprove/extraction/Hacspec_poly1305.v b/poly1305/proofs/ssprove/extraction/Hacspec_poly1305.v new file mode 100644 index 0000000..5a361af --- /dev/null +++ b/poly1305/proofs/ssprove/extraction/Hacspec_poly1305.v @@ -0,0 +1,135 @@ +(* File automatically generated by Hacspec *) +Set Warnings "-notation-overridden,-ambiguous-paths". +From Crypt Require Import choice_type Package Prelude. +Import PackageNotation. +From extructures Require Import ord fset. +From mathcomp Require Import word_ssrZ word. +(* From Jasmin Require Import word. *) + +From Coq Require Import ZArith. +From Coq Require Import Strings.String. +Import List.ListNotations. +Open Scope list_scope. +Open Scope Z_scope. +Open Scope bool_scope. + +From Hacspec Require Import ChoiceEquality. +From Hacspec Require Import LocationUtility. +From Hacspec Require Import Hacspec_Lib_Comparable. +From Hacspec Require Import Hacspec_Lib_Pre. +From Hacspec Require Import Hacspec_Lib. + +Open Scope hacspec_scope. +Import choice.Choice.Exports. + +Obligation Tactic := (* try timeout 8 *) solve_ssprove_obligations. + +Require Import Hacspec_lib. +Export Hacspec_lib. + +Notation "'t_BlockIndex'" := uint_size. + +Notation "'t_FieldElement'" := (nat_mod 0x03fffffffffffffffffffffffffffffffb). +Definition FieldElement : both t_FieldElement -> both t_FieldElement := + id. + +Notation "'t_Poly1305Tag'" := (nseq int8 16). +Definition Poly1305Tag : both t_Poly1305Tag -> both t_Poly1305Tag := + id. + +Notation "'t_PolyBlock'" := (nseq int8 16). +Definition PolyBlock : both t_PolyBlock -> both t_PolyBlock := + id. + +Notation "'t_PolyKey'" := (nseq int8 32). +Definition PolyKey : both t_PolyKey -> both t_PolyKey := + id. + +Notation "'t_PolyState'" := (t_FieldElement × t_FieldElement × t_PolyKey). + +(*Not implemented yet? todo(item)*) + +Equations v_BLOCKSIZE : both uint_size := + v_BLOCKSIZE := + solve_lift (ret_both (16 : uint_size)) : both uint_size. +Fail Next Obligation. + +Equations poly1305_encode_block (b : both t_PolyBlock) : both t_FieldElement := + poly1305_encode_block b := + letb n := v_U128_from_le_bytes (impl__U128Word__from_seq b) in + letb f := impl__FieldElement__from_secret_literal n in + solve_lift (f .+ (impl__FieldElement__pow2 (ret_both (128 : uint_size)))) : both t_FieldElement. +Fail Next Obligation. + +Equations poly1305_update_block (b : both t_PolyBlock) (st : both (t_FieldElement × t_FieldElement × t_PolyKey)) : both (t_FieldElement × t_FieldElement × t_PolyKey) := + poly1305_update_block b st := + letb '(acc,r,k) := st in + solve_lift (prod_b (((poly1305_encode_block b) .+ acc) .* r,r,k)) : both (t_FieldElement × t_FieldElement × t_PolyKey). +Fail Next Obligation. + +Equations poly1305_encode_r (b : both t_PolyBlock) : both t_FieldElement := + poly1305_encode_r b := + letb n := v_U128_from_le_bytes (impl__U128Word__from_seq b) in + letb n := n .& (U128 (ret_both (21267647620597763993911028882763415551 : int128))) in + solve_lift (impl__FieldElement__from_secret_literal n) : both t_FieldElement. +Fail Next Obligation. + +Equations poly1305_init (k : both t_PolyKey) : both (t_FieldElement × t_FieldElement × t_PolyKey) := + poly1305_init k := + letb r := poly1305_encode_r (impl__PolyBlock__from_slice k (ret_both (0 : uint_size)) (ret_both (16 : uint_size))) in + solve_lift (prod_b (f_ZERO (ret_both (tt : 'unit)),r,k)) : both (t_FieldElement × t_FieldElement × t_PolyKey). +Fail Next Obligation. + +Notation "'t_SubBlock'" := (t_Seq t_U8). + +Equations poly1305_encode_last (pad_len : both uint_size) (b : both (t_Seq t_U8)) : both t_FieldElement := + poly1305_encode_last pad_len b := + letb n := v_U128_from_le_bytes (impl__U128Word__from_slice b (ret_both (0 : uint_size)) (impl_41__len b)) in + letb f := impl__FieldElement__from_secret_literal n in + solve_lift (f .+ (impl__FieldElement__pow2 ((ret_both (8 : uint_size)) .* pad_len))) : both t_FieldElement. +Fail Next Obligation. + +Equations poly1305_finish (st : both (t_FieldElement × t_FieldElement × t_PolyKey)) : both t_Poly1305Tag := + poly1305_finish st := + letb '(acc,_,k) := st in + letb n := v_U128_from_le_bytes (impl__U128Word__from_slice k (ret_both (16 : uint_size)) (ret_both (16 : uint_size))) in + letb aby := impl__FieldElement__to_byte_seq_le acc in + letb a := v_U128_from_le_bytes (impl__U128Word__from_slice aby (ret_both (0 : uint_size)) (ret_both (16 : uint_size))) in + solve_lift (impl__Poly1305Tag__from_seq (v_U128_to_le_bytes (a .+ n))) : both t_Poly1305Tag. +Fail Next Obligation. + +Equations poly1305_update_blocks (m : both (t_Seq t_U8)) (st : both (t_FieldElement × t_FieldElement × t_PolyKey)) : both (t_FieldElement × t_FieldElement × t_PolyKey) := + poly1305_update_blocks m st := + letb st := st in + letb n_blocks := (impl_41__len m) ./ v_BLOCKSIZE in + letb st := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := n_blocks))) st (fun st => fun i => + letb block := impl__PolyBlock__from_seq (impl_41__get_exact_chunk m v_BLOCKSIZE i) in + letb st := poly1305_update_block block st in + st) in + solve_lift st : both (t_FieldElement × t_FieldElement × t_PolyKey). +Fail Next Obligation. + +Equations poly1305_update_last (pad_len : both uint_size) (b : both (t_Seq t_U8)) (st : both (t_FieldElement × t_FieldElement × t_PolyKey)) : both (t_FieldElement × t_FieldElement × t_PolyKey) := + poly1305_update_last pad_len b st := + letb st := st in + letb st := ifb (impl_41__len b) <> (ret_both (0 : uint_size)) + then letb '(acc,r,k) := st in + letb st := prod_b (((poly1305_encode_last pad_len b) .+ acc) .* r,r,k) in + st + else st in + solve_lift st : both (t_FieldElement × t_FieldElement × t_PolyKey). +Fail Next Obligation. + +Equations poly1305_update (m : both (t_Seq t_U8)) (st : both (t_FieldElement × t_FieldElement × t_PolyKey)) : both (t_FieldElement × t_FieldElement × t_PolyKey) := + poly1305_update m st := + letb st := poly1305_update_blocks m st in + letb last := impl_41__get_remainder_chunk m v_BLOCKSIZE in + solve_lift (poly1305_update_last (impl_41__len last) last st) : both (t_FieldElement × t_FieldElement × t_PolyKey). +Fail Next Obligation. + +Equations poly1305 (m : both (t_Seq t_U8)) (key : both t_PolyKey) : both t_Poly1305Tag := + poly1305 m key := + letb st := poly1305_init key in + letb st := poly1305_update m st in + solve_lift (poly1305_finish st) : both t_Poly1305Tag. +Fail Next Obligation. diff --git a/sha256/proofs/ssprove/extraction/Hacspec_sha256.v b/sha256/proofs/ssprove/extraction/Hacspec_sha256.v index 5fa6612..41ad6a3 100644 --- a/sha256/proofs/ssprove/extraction/Hacspec_sha256.v +++ b/sha256/proofs/ssprove/extraction/Hacspec_sha256.v @@ -4,7 +4,7 @@ From Crypt Require Import choice_type Package Prelude. Import PackageNotation. From extructures Require Import ord fset. From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. +(* From Jasmin Require Import word. *) From Coq Require Import ZArith. From Coq Require Import Strings.String. @@ -28,48 +28,48 @@ Require Import Hacspec_lib. Export Hacspec_lib. Notation "'t_Block'" := (nseq int8 BLOCK_SIZE). -Definition Block {L : {fset Location}} {I : Interface} : both L I (t_Block) -> both L I (t_Block) := +Definition Block : both t_Block -> both t_Block := id. Notation "'t_Hash'" := (nseq int32 8). -Definition Hash {L : {fset Location}} {I : Interface} : both L I (t_Hash) -> both L I (t_Hash) := +Definition Hash : both t_Hash -> both t_Hash := id. Notation "'t_OpTableType'" := (nseq int32 12). -Definition OpTableType {L : {fset Location}} {I : Interface} : both L I (t_OpTableType) -> both L I (t_OpTableType) := +Definition OpTableType : both t_OpTableType -> both t_OpTableType := id. Notation "'t_RoundConstantsTable'" := (nseq int32 K_SIZE). -Definition RoundConstantsTable {L : {fset Location}} {I : Interface} : both L I (t_RoundConstantsTable) -> both L I (t_RoundConstantsTable) := +Definition RoundConstantsTable : both t_RoundConstantsTable -> both t_RoundConstantsTable := id. Notation "'t_Sha256Digest'" := (nseq int8 HASH_SIZE). -Definition Sha256Digest {L : {fset Location}} {I : Interface} : both L I (t_Sha256Digest) -> both L I (t_Sha256Digest) := +Definition Sha256Digest : both t_Sha256Digest -> both t_Sha256Digest := id. (*Not implemented yet? todo(item)*) -Equations v_BLOCK_SIZE {L : {fset Location}} {I : Interface} : both L I (uint_size) := +Equations v_BLOCK_SIZE : both uint_size := v_BLOCK_SIZE := - solve_lift (ret_both (64 : uint_size)) : both L I (uint_size). + solve_lift (ret_both (64 : uint_size)) : both uint_size. Fail Next Obligation. -Equations v_HASH_SIZE {L : {fset Location}} {I : Interface} : both L I (uint_size) := +Equations v_HASH_SIZE : both uint_size := v_HASH_SIZE := - solve_lift ((ret_both (256 : uint_size)) ./ (ret_both (8 : uint_size))) : both L I (uint_size). + solve_lift ((ret_both (256 : uint_size)) ./ (ret_both (8 : uint_size))) : both uint_size. Fail Next Obligation. -Equations v_K_SIZE {L : {fset Location}} {I : Interface} : both L I (uint_size) := +Equations v_K_SIZE : both uint_size := v_K_SIZE := - solve_lift (ret_both (64 : uint_size)) : both L I (uint_size). + solve_lift (ret_both (64 : uint_size)) : both uint_size. Fail Next Obligation. -Equations v_LEN_SIZE {L : {fset Location}} {I : Interface} : both L I (uint_size) := +Equations v_LEN_SIZE : both uint_size := v_LEN_SIZE := - solve_lift (ret_both (8 : uint_size)) : both L I (uint_size). + solve_lift (ret_both (8 : uint_size)) : both uint_size. Fail Next Obligation. -Equations v_OP_TABLE {L : {fset Location}} {I : Interface} : both L I (t_OpTableType) := +Equations v_OP_TABLE : both t_OpTableType := v_OP_TABLE := OpTableType (array_from_list [solve_lift (ret_both (2 : uint_size)); solve_lift (ret_both (13 : uint_size)); @@ -82,53 +82,48 @@ Equations v_OP_TABLE {L : {fset Location}} {I : Interface} : both L I (t_OpTable solve_lift (ret_both (3 : uint_size)); solve_lift (ret_both (17 : uint_size)); solve_lift (ret_both (19 : uint_size)); - solve_lift (ret_both (10 : uint_size))]) : both L I (t_OpTableType). + solve_lift (ret_both (10 : uint_size))]) : both t_OpTableType. Fail Next Obligation. -Equations ch {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (x : both L1 I1 (t_U32)) (y : both L2 I2 (t_U32)) (z : both L3 I3 (t_U32)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_U32) := +Equations ch (x : both t_U32) (y : both t_U32) (z : both t_U32) : both t_U32 := ch x y z := - solve_lift ((x .& y) .^ ((f_not x) .& z)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_U32). + solve_lift ((x .& y) .^ ((f_not x) .& z)) : both t_U32. Fail Next Obligation. -Equations maj {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (x : both L1 I1 (t_U32)) (y : both L2 I2 (t_U32)) (z : both L3 I3 (t_U32)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_U32) := +Equations maj (x : both t_U32) (y : both t_U32) (z : both t_U32) : both t_U32 := maj x y z := - solve_lift ((x .& y) .^ ((x .& z) .^ (y .& z))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_U32). + solve_lift ((x .& y) .^ ((x .& z) .^ (y .& z))) : both t_U32. Fail Next Obligation. -Definition tmp_loc : Location := - (t_U32;0%nat). -Equations sigma {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (x : both L1 I1 (t_U32)) (i : both L2 I2 (uint_size)) (op : both L3 I3 (uint_size)) : both (L1 :|: L2 :|: L3 :|: fset [tmp_loc]) (I1 :|: I2 :|: I3) (t_U32) := +Equations sigma (x : both t_U32) (i : both uint_size) (op : both uint_size) : both t_U32 := sigma x i op := - letb (tmp : t_U32) loc(tmp_loc) := impl__U32__rotate_right x (v_OP_TABLE.a[(((ret_both (3 : uint_size)) .* i) .+ (ret_both (2 : uint_size)))]) in - letb _ := ifb op =.? (ret_both (0 : uint_size)) - then assign todo(term) - else () in - solve_lift (((impl__U32__rotate_right x (v_OP_TABLE.a[((ret_both (3 : uint_size)) .* i)])) .^ (impl__U32__rotate_right x (v_OP_TABLE.a[(((ret_both (3 : uint_size)) .* i) .+ (ret_both (1 : uint_size)))]))) .^ tmp) : both (L1 :|: L2 :|: L3 :|: fset [tmp_loc]) (I1 :|: I2 :|: I3) (t_U32). + letb (tmp : t_U32) := impl__U32__rotate_right x (v_OP_TABLE.a[(((ret_both (3 : uint_size)) .* i) .+ (ret_both (2 : uint_size)))]) in + letb tmp := ifb op =.? (ret_both (0 : uint_size)) + then x shift_right (v_OP_TABLE.a[(((ret_both (3 : uint_size)) .* i) .+ (ret_both (2 : uint_size)))]) + else tmp in + solve_lift (((impl__U32__rotate_right x (v_OP_TABLE.a[((ret_both (3 : uint_size)) .* i)])) .^ (impl__U32__rotate_right x (v_OP_TABLE.a[(((ret_both (3 : uint_size)) .* i) .+ (ret_both (1 : uint_size)))]))) .^ tmp) : both t_U32. Fail Next Obligation. -Definition s_loc : Location := - (t_RoundConstantsTable;1%nat). -Equations schedule {L1 : {fset Location}} {I1 : Interface} (block : both L1 I1 (t_Block)) : both (L1 :|: fset [s_loc;tmp_loc]) I1 (t_RoundConstantsTable) := +Equations schedule (block : both t_Block) : both t_RoundConstantsTable := schedule block := letb b := impl__Block__to_be_U32s block in - letb s loc(s_loc) := impl__RoundConstantsTable__new (ret_both (tt : 'unit)) in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := v_K_SIZE))) (fun i => - ssp (fun _ => - solve_lift (ifb i <.? (ret_both (16 : uint_size)) - then letb _ := assign todo(term) in - ret_both (tt : 'unit) - else letb t16 := s.a[(i .- (ret_both (16 : uint_size)))] in - letb t15 := s.a[(i .- (ret_both (15 : uint_size)))] in - letb t7 := s.a[(i .- (ret_both (7 : uint_size)))] in - letb t2 := s.a[(i .- (ret_both (2 : uint_size)))] in - letb s1 := sigma t2 (ret_both (3 : uint_size)) (ret_both (0 : uint_size)) in - letb s0 := sigma t15 (ret_both (2 : uint_size)) (ret_both (0 : uint_size)) in - letb _ := assign todo(term) in - ret_both (tt : 'unit)) : both (*2*)(L1:|:fset [s_loc;tmp_loc]) (I1) ('unit))) (ret_both (tt : 'unit)) in - solve_lift s : both (L1 :|: fset [s_loc;tmp_loc]) I1 (t_RoundConstantsTable). + letb s := impl__RoundConstantsTable__new (ret_both (tt : 'unit)) in + letb s := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := v_K_SIZE))) s (fun s => fun i => + ifb i <.? (ret_both (16 : uint_size)) + then letb s := update_at_usize s i (b.a[i]) in + s + else letb t16 := s.a[(i .- (ret_both (16 : uint_size)))] in + letb t15 := s.a[(i .- (ret_both (15 : uint_size)))] in + letb t7 := s.a[(i .- (ret_both (7 : uint_size)))] in + letb t2 := s.a[(i .- (ret_both (2 : uint_size)))] in + letb s1 := sigma t2 (ret_both (3 : uint_size)) (ret_both (0 : uint_size)) in + letb s0 := sigma t15 (ret_both (2 : uint_size)) (ret_both (0 : uint_size)) in + letb s := update_at_usize s i (((s1 .+ t7) .+ s0) .+ t16) in + s) in + solve_lift s : both t_RoundConstantsTable. Fail Next Obligation. -Equations v_HASH_INIT {L : {fset Location}} {I : Interface} : both L I (t_Hash) := +Equations v_HASH_INIT : both t_Hash := v_HASH_INIT := Hash (array_from_list [U32 (solve_lift (ret_both (1779033703 : int32))); U32 (solve_lift (ret_both (3144134277 : int32))); @@ -137,10 +132,10 @@ Equations v_HASH_INIT {L : {fset Location}} {I : Interface} : both L I (t_Hash) U32 (solve_lift (ret_both (1359893119 : int32))); U32 (solve_lift (ret_both (2600822924 : int32))); U32 (solve_lift (ret_both (528734635 : int32))); - U32 (solve_lift (ret_both (1541459225 : int32)))]) : both L I (t_Hash). + U32 (solve_lift (ret_both (1541459225 : int32)))]) : both t_Hash. Fail Next Obligation. -Equations v_K_TABLE {L : {fset Location}} {I : Interface} : both L I (t_RoundConstantsTable) := +Equations v_K_TABLE : both t_RoundConstantsTable := v_K_TABLE := RoundConstantsTable (array_from_list [U32 (solve_lift (ret_both (1116352408 : int32))); U32 (solve_lift (ret_both (1899447441 : int32))); @@ -205,88 +200,73 @@ Equations v_K_TABLE {L : {fset Location}} {I : Interface} : both L I (t_RoundCon U32 (solve_lift (ret_both (2428436474 : int32))); U32 (solve_lift (ret_both (2756734187 : int32))); U32 (solve_lift (ret_both (3204031479 : int32))); - U32 (solve_lift (ret_both (3329325298 : int32)))]) : both L I (t_RoundConstantsTable). + U32 (solve_lift (ret_both (3329325298 : int32)))]) : both t_RoundConstantsTable. Fail Next Obligation. -Definition h_loc : Location := - (t_Hash;2%nat). -Equations shuffle {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (ws : both L1 I1 (t_RoundConstantsTable)) (hashi : both L2 I2 (t_Hash)) : both (L1 :|: L2 :|: fset [h_loc;tmp_loc]) (I1 :|: I2) (t_Hash) := +Equations shuffle (ws : both t_RoundConstantsTable) (hashi : both t_Hash) : both t_Hash := shuffle ws hashi := - letb h loc(h_loc) := hashi in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := v_K_SIZE))) (fun i => - ssp (fun _ => - letb a0 := h.a[(ret_both (0 : int32))] in - letb b0 := h.a[(ret_both (1 : int32))] in - letb c0 := h.a[(ret_both (2 : int32))] in - letb d0 := h.a[(ret_both (3 : int32))] in - letb e0 := h.a[(ret_both (4 : int32))] in - letb f0 := h.a[(ret_both (5 : int32))] in - letb g0 := h.a[(ret_both (6 : int32))] in - letb (h0 : t_U32) := h.a[(ret_both (7 : int32))] in - letb t1 := (((h0 .+ (sigma e0 (ret_both (1 : uint_size)) (ret_both (1 : uint_size)))) .+ (ch e0 f0 g0)) .+ (v_K_TABLE.a[i])) .+ (ws.a[i]) in - letb t2 := (sigma a0 (ret_both (0 : uint_size)) (ret_both (1 : uint_size))) .+ (maj a0 b0 c0) in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - solve_lift (ret_both (tt : 'unit)) : both (*2*)(L1:|:L2:|:fset [h_loc;tmp_loc]) (I1:|:I2) ('unit))) (ret_both (tt : 'unit)) in - solve_lift h : both (L1 :|: L2 :|: fset [h_loc;tmp_loc]) (I1 :|: I2) (t_Hash). + letb h := hashi in + letb h := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := v_K_SIZE))) h (fun h => fun i => + letb a0 := h.a[(ret_both (0 : int32))] in + letb b0 := h.a[(ret_both (1 : int32))] in + letb c0 := h.a[(ret_both (2 : int32))] in + letb d0 := h.a[(ret_both (3 : int32))] in + letb e0 := h.a[(ret_both (4 : int32))] in + letb f0 := h.a[(ret_both (5 : int32))] in + letb g0 := h.a[(ret_both (6 : int32))] in + letb (h0 : t_U32) := h.a[(ret_both (7 : int32))] in + letb t1 := (((h0 .+ (sigma e0 (ret_both (1 : uint_size)) (ret_both (1 : uint_size)))) .+ (ch e0 f0 g0)) .+ (v_K_TABLE.a[i])) .+ (ws.a[i]) in + letb t2 := (sigma a0 (ret_both (0 : uint_size)) (ret_both (1 : uint_size))) .+ (maj a0 b0 c0) in + letb h := update_at h (ret_both (0 : int32)) (t1 .+ t2) in + letb h := update_at h (ret_both (1 : int32)) a0 in + letb h := update_at h (ret_both (2 : int32)) b0 in + letb h := update_at h (ret_both (3 : int32)) c0 in + letb h := update_at h (ret_both (4 : int32)) (d0 .+ t1) in + letb h := update_at h (ret_both (5 : int32)) e0 in + letb h := update_at h (ret_both (6 : int32)) f0 in + letb h := update_at h (ret_both (7 : int32)) g0 in + h) in + solve_lift h : both t_Hash. Fail Next Obligation. -Definition h_loc : Location := - (t_Hash;3%nat). -Equations compress {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (block : both L1 I1 (t_Block)) (h_in : both L2 I2 (t_Hash)) : both (L1 :|: L2 :|: fset [h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) (I1 :|: I2) (t_Hash) := +Equations compress (block : both t_Block) (h_in : both t_Hash) : both t_Hash := compress block h_in := letb s := schedule block in - letb h loc(h_loc) := shuffle s h_in in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := ret_both (8 : int32)))) (fun i => - ssp (fun _ => - assign todo(term) : both (*4*)(L1:|:L2:|:fset [h_loc;h_loc;s_loc;tmp_loc]) (I1:|:I2) ('unit))) (ret_both (tt : 'unit)) in - solve_lift h : both (L1 :|: L2 :|: fset [h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) (I1 :|: I2) (t_Hash). + letb h := shuffle s h_in in + letb h := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := ret_both (8 : int32)))) h (fun h => fun i => + update_at h i ((h.a[i]) .+ (h_in.a[i]))) in + solve_lift h : both t_Hash. Fail Next Obligation. -Definition h_loc : Location := - (t_Hash;4%nat). -Definition last_block_loc : Location := - (t_Block;5%nat). -Definition last_block_len_loc : Location := - (uint_size;6%nat). -Definition pad_block_loc : Location := - (t_Block;7%nat). -Equations hash {L1 : {fset Location}} {I1 : Interface} (msg : both L1 I1 (t_Seq (t_U8))) : both (L1 :|: fset [h_loc;last_block_loc;last_block_len_loc;pad_block_loc;h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) I1 (t_Sha256Digest) := +Equations hash (msg : both (t_Seq t_U8)) : both t_Sha256Digest := hash msg := - letb h loc(h_loc) := v_HASH_INIT in - letb last_block loc(last_block_loc) := impl__Block__new (ret_both (tt : 'unit)) in - letb last_block_len loc(last_block_len_loc) := ret_both (0 : uint_size) in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__num_chunks msg v_BLOCK_SIZE))) (fun i => - ssp (fun _ => - letb '(block_len,block) := impl_41__get_chunk msg v_BLOCK_SIZE i in - solve_lift (ifb block_len <.? v_BLOCK_SIZE - then letb _ := assign todo(term) in - letb _ := assign todo(term) in - ret_both (tt : 'unit) - else letb compress_input := impl__Block__from_seq block in - letb _ := assign todo(term) in - ret_both (tt : 'unit)) : both (*5*)(L1:|:L1:|:fset [h_loc;h_loc;h_loc;s_loc;tmp_loc]) (I1:|:I1) ('unit))) (ret_both (tt : 'unit)) in - letb _ := assign todo(term) in + letb h := v_HASH_INIT in + letb last_block := impl__Block__new (ret_both (tt : 'unit)) in + letb last_block_len := ret_both (0 : uint_size) in + letb '(h,last_block,last_block_len) := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__num_chunks msg v_BLOCK_SIZE))) (prod_b (h,last_block,last_block_len)) (fun '(h,last_block,last_block_len) => fun i => + letb '(block_len,block) := impl_41__get_chunk msg v_BLOCK_SIZE i in + ifb block_len <.? v_BLOCK_SIZE + then letb last_block := f_update_start (impl__Block__new (ret_both (tt : 'unit))) block in + letb last_block_len := block_len in + prod_b (h,last_block,last_block_len) + else letb compress_input := impl__Block__from_seq block in + letb h := compress compress_input h in + prod_b (h,last_block,last_block_len)) in + letb last_block := update_at_usize last_block last_block_len (U8 (ret_both (128 : int8))) in letb len_bist := U64 (cast_int (WS2 := _) ((impl_41__len msg) .* (ret_both (8 : uint_size)))) in - letb _ := ifb last_block_len <.? (v_BLOCK_SIZE .- v_LEN_SIZE) - then letb _ := assign todo(term) in - letb _ := assign todo(term) in - ret_both (tt : 'unit) - else letb pad_block loc(pad_block_loc) := impl__Block__new (ret_both (tt : 'unit)) in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - ret_both (tt : 'unit) in - solve_lift (impl__Sha256Digest__from_seq (impl__Hash__to_be_bytes h)) : both (L1 :|: fset [h_loc;last_block_loc;last_block_len_loc;pad_block_loc;h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) I1 (t_Sha256Digest). + letb '(h,last_block) := ifb last_block_len <.? (v_BLOCK_SIZE .- v_LEN_SIZE) + then letb last_block := f_update last_block (v_BLOCK_SIZE .- v_LEN_SIZE) (v_U64_to_be_bytes len_bist) in + letb h := compress last_block h in + prod_b (h,last_block) + else letb pad_block := impl__Block__new (ret_both (tt : 'unit)) in + letb pad_block := f_update pad_block (v_BLOCK_SIZE .- v_LEN_SIZE) (v_U64_to_be_bytes len_bist) in + letb h := compress last_block h in + letb h := compress pad_block h in + prod_b (h,last_block) in + solve_lift (impl__Sha256Digest__from_seq (impl__Hash__to_be_bytes h)) : both t_Sha256Digest. Fail Next Obligation. -Equations sha256 {L1 : {fset Location}} {I1 : Interface} (msg : both L1 I1 (t_Seq (t_U8))) : both (L1 :|: fset [h_loc;last_block_loc;last_block_len_loc;pad_block_loc;h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) I1 (t_Sha256Digest) := +Equations sha256 (msg : both (t_Seq t_U8)) : both t_Sha256Digest := sha256 msg := - solve_lift (hash msg) : both (L1 :|: fset [h_loc;last_block_loc;last_block_len_loc;pad_block_loc;h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) I1 (t_Sha256Digest). + solve_lift (hash msg) : both t_Sha256Digest. Fail Next Obligation. diff --git a/sha512/proofs/ssprove/extraction/Hacspec_sha512.v b/sha512/proofs/ssprove/extraction/Hacspec_sha512.v index 96d7947..ea50f46 100644 --- a/sha512/proofs/ssprove/extraction/Hacspec_sha512.v +++ b/sha512/proofs/ssprove/extraction/Hacspec_sha512.v @@ -4,7 +4,7 @@ From Crypt Require Import choice_type Package Prelude. Import PackageNotation. From extructures Require Import ord fset. From mathcomp Require Import word_ssrZ word. -From Jasmin Require Import word. +(* From Jasmin Require Import word. *) From Coq Require Import ZArith. From Coq Require Import Strings.String. @@ -28,48 +28,48 @@ Require Import Hacspec_lib. Export Hacspec_lib. Notation "'t_Block'" := (nseq int8 BLOCK_SIZE). -Definition Block {L : {fset Location}} {I : Interface} : both L I (t_Block) -> both L I (t_Block) := +Definition Block : both t_Block -> both t_Block := id. Notation "'t_Hash'" := (nseq int64 8). -Definition Hash {L : {fset Location}} {I : Interface} : both L I (t_Hash) -> both L I (t_Hash) := +Definition Hash : both t_Hash -> both t_Hash := id. Notation "'t_OpTableType'" := (nseq int32 12). -Definition OpTableType {L : {fset Location}} {I : Interface} : both L I (t_OpTableType) -> both L I (t_OpTableType) := +Definition OpTableType : both t_OpTableType -> both t_OpTableType := id. Notation "'t_RoundConstantsTable'" := (nseq int64 K_SIZE). -Definition RoundConstantsTable {L : {fset Location}} {I : Interface} : both L I (t_RoundConstantsTable) -> both L I (t_RoundConstantsTable) := +Definition RoundConstantsTable : both t_RoundConstantsTable -> both t_RoundConstantsTable := id. Notation "'t_Sha512Digest'" := (nseq int8 HASH_SIZE). -Definition Sha512Digest {L : {fset Location}} {I : Interface} : both L I (t_Sha512Digest) -> both L I (t_Sha512Digest) := +Definition Sha512Digest : both t_Sha512Digest -> both t_Sha512Digest := id. (*Not implemented yet? todo(item)*) -Equations v_BLOCK_SIZE {L : {fset Location}} {I : Interface} : both L I (uint_size) := +Equations v_BLOCK_SIZE : both uint_size := v_BLOCK_SIZE := - solve_lift (ret_both (128 : uint_size)) : both L I (uint_size). + solve_lift (ret_both (128 : uint_size)) : both uint_size. Fail Next Obligation. -Equations v_HASH_SIZE {L : {fset Location}} {I : Interface} : both L I (uint_size) := +Equations v_HASH_SIZE : both uint_size := v_HASH_SIZE := - solve_lift ((ret_both (512 : uint_size)) ./ (ret_both (8 : uint_size))) : both L I (uint_size). + solve_lift ((ret_both (512 : uint_size)) ./ (ret_both (8 : uint_size))) : both uint_size. Fail Next Obligation. -Equations v_K_SIZE {L : {fset Location}} {I : Interface} : both L I (uint_size) := +Equations v_K_SIZE : both uint_size := v_K_SIZE := - solve_lift (ret_both (80 : uint_size)) : both L I (uint_size). + solve_lift (ret_both (80 : uint_size)) : both uint_size. Fail Next Obligation. -Equations v_LEN_SIZE {L : {fset Location}} {I : Interface} : both L I (uint_size) := +Equations v_LEN_SIZE : both uint_size := v_LEN_SIZE := - solve_lift (ret_both (16 : uint_size)) : both L I (uint_size). + solve_lift (ret_both (16 : uint_size)) : both uint_size. Fail Next Obligation. -Equations v_OP_TABLE {L : {fset Location}} {I : Interface} : both L I (t_OpTableType) := +Equations v_OP_TABLE : both t_OpTableType := v_OP_TABLE := OpTableType (array_from_list [solve_lift (ret_both (28 : uint_size)); solve_lift (ret_both (34 : uint_size)); @@ -82,53 +82,48 @@ Equations v_OP_TABLE {L : {fset Location}} {I : Interface} : both L I (t_OpTable solve_lift (ret_both (7 : uint_size)); solve_lift (ret_both (19 : uint_size)); solve_lift (ret_both (61 : uint_size)); - solve_lift (ret_both (6 : uint_size))]) : both L I (t_OpTableType). + solve_lift (ret_both (6 : uint_size))]) : both t_OpTableType. Fail Next Obligation. -Equations ch {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (x : both L1 I1 (t_U64)) (y : both L2 I2 (t_U64)) (z : both L3 I3 (t_U64)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_U64) := +Equations ch (x : both t_U64) (y : both t_U64) (z : both t_U64) : both t_U64 := ch x y z := - solve_lift ((x .& y) .^ ((f_not x) .& z)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_U64). + solve_lift ((x .& y) .^ ((f_not x) .& z)) : both t_U64. Fail Next Obligation. -Equations maj {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (x : both L1 I1 (t_U64)) (y : both L2 I2 (t_U64)) (z : both L3 I3 (t_U64)) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_U64) := +Equations maj (x : both t_U64) (y : both t_U64) (z : both t_U64) : both t_U64 := maj x y z := - solve_lift ((x .& y) .^ ((x .& z) .^ (y .& z))) : both (L1 :|: L2 :|: L3) (I1 :|: I2 :|: I3) (t_U64). + solve_lift ((x .& y) .^ ((x .& z) .^ (y .& z))) : both t_U64. Fail Next Obligation. -Definition tmp_loc : Location := - (t_U64;0%nat). -Equations sigma {L1 : {fset Location}} {L2 : {fset Location}} {L3 : {fset Location}} {I1 : Interface} {I2 : Interface} {I3 : Interface} (x : both L1 I1 (t_U64)) (i : both L2 I2 (uint_size)) (op : both L3 I3 (uint_size)) : both (L1 :|: L2 :|: L3 :|: fset [tmp_loc]) (I1 :|: I2 :|: I3) (t_U64) := +Equations sigma (x : both t_U64) (i : both uint_size) (op : both uint_size) : both t_U64 := sigma x i op := - letb (tmp : t_U64) loc(tmp_loc) := impl__U64__rotate_right x (v_OP_TABLE.a[(((ret_both (3 : uint_size)) .* i) .+ (ret_both (2 : uint_size)))]) in - letb _ := ifb op =.? (ret_both (0 : uint_size)) - then assign todo(term) - else () in - solve_lift (((impl__U64__rotate_right x (v_OP_TABLE.a[((ret_both (3 : uint_size)) .* i)])) .^ (impl__U64__rotate_right x (v_OP_TABLE.a[(((ret_both (3 : uint_size)) .* i) .+ (ret_both (1 : uint_size)))]))) .^ tmp) : both (L1 :|: L2 :|: L3 :|: fset [tmp_loc]) (I1 :|: I2 :|: I3) (t_U64). + letb (tmp : t_U64) := impl__U64__rotate_right x (v_OP_TABLE.a[(((ret_both (3 : uint_size)) .* i) .+ (ret_both (2 : uint_size)))]) in + letb tmp := ifb op =.? (ret_both (0 : uint_size)) + then x shift_right (v_OP_TABLE.a[(((ret_both (3 : uint_size)) .* i) .+ (ret_both (2 : uint_size)))]) + else tmp in + solve_lift (((impl__U64__rotate_right x (v_OP_TABLE.a[((ret_both (3 : uint_size)) .* i)])) .^ (impl__U64__rotate_right x (v_OP_TABLE.a[(((ret_both (3 : uint_size)) .* i) .+ (ret_both (1 : uint_size)))]))) .^ tmp) : both t_U64. Fail Next Obligation. -Definition s_loc : Location := - (t_RoundConstantsTable;1%nat). -Equations schedule {L1 : {fset Location}} {I1 : Interface} (block : both L1 I1 (t_Block)) : both (L1 :|: fset [s_loc;tmp_loc]) I1 (t_RoundConstantsTable) := +Equations schedule (block : both t_Block) : both t_RoundConstantsTable := schedule block := letb b := impl__Block__to_be_U64s block in - letb s loc(s_loc) := impl__RoundConstantsTable__new (ret_both (tt : 'unit)) in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := v_K_SIZE))) (fun i => - ssp (fun _ => - solve_lift (ifb i <.? (ret_both (16 : uint_size)) - then letb _ := assign todo(term) in - ret_both (tt : 'unit) - else letb t16 := s.a[(i .- (ret_both (16 : uint_size)))] in - letb t15 := s.a[(i .- (ret_both (15 : uint_size)))] in - letb t7 := s.a[(i .- (ret_both (7 : uint_size)))] in - letb t2 := s.a[(i .- (ret_both (2 : uint_size)))] in - letb s1 := sigma t2 (ret_both (3 : uint_size)) (ret_both (0 : uint_size)) in - letb s0 := sigma t15 (ret_both (2 : uint_size)) (ret_both (0 : uint_size)) in - letb _ := assign todo(term) in - ret_both (tt : 'unit)) : both (*2*)(L1:|:fset [s_loc;tmp_loc]) (I1) ('unit))) (ret_both (tt : 'unit)) in - solve_lift s : both (L1 :|: fset [s_loc;tmp_loc]) I1 (t_RoundConstantsTable). + letb s := impl__RoundConstantsTable__new (ret_both (tt : 'unit)) in + letb s := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := v_K_SIZE))) s (fun s => fun i => + ifb i <.? (ret_both (16 : uint_size)) + then letb s := update_at_usize s i (b.a[i]) in + s + else letb t16 := s.a[(i .- (ret_both (16 : uint_size)))] in + letb t15 := s.a[(i .- (ret_both (15 : uint_size)))] in + letb t7 := s.a[(i .- (ret_both (7 : uint_size)))] in + letb t2 := s.a[(i .- (ret_both (2 : uint_size)))] in + letb s1 := sigma t2 (ret_both (3 : uint_size)) (ret_both (0 : uint_size)) in + letb s0 := sigma t15 (ret_both (2 : uint_size)) (ret_both (0 : uint_size)) in + letb s := update_at_usize s i (((s1 .+ t7) .+ s0) .+ t16) in + s) in + solve_lift s : both t_RoundConstantsTable. Fail Next Obligation. -Equations v_HASH_INIT {L : {fset Location}} {I : Interface} : both L I (t_Hash) := +Equations v_HASH_INIT : both t_Hash := v_HASH_INIT := Hash (array_from_list [U64 (solve_lift (ret_both (7640891576956012808 : int64))); U64 (solve_lift (ret_both (13503953896175478587 : int64))); @@ -137,10 +132,10 @@ Equations v_HASH_INIT {L : {fset Location}} {I : Interface} : both L I (t_Hash) U64 (solve_lift (ret_both (5840696475078001361 : int64))); U64 (solve_lift (ret_both (11170449401992604703 : int64))); U64 (solve_lift (ret_both (2270897969802886507 : int64))); - U64 (solve_lift (ret_both (6620516959819538809 : int64)))]) : both L I (t_Hash). + U64 (solve_lift (ret_both (6620516959819538809 : int64)))]) : both t_Hash. Fail Next Obligation. -Equations v_K_TABLE {L : {fset Location}} {I : Interface} : both L I (t_RoundConstantsTable) := +Equations v_K_TABLE : both t_RoundConstantsTable := v_K_TABLE := RoundConstantsTable (array_from_list [U64 (solve_lift (ret_both (4794697086780616226 : int64))); U64 (solve_lift (ret_both (8158064640168781261 : int64))); @@ -221,88 +216,73 @@ Equations v_K_TABLE {L : {fset Location}} {I : Interface} : both L I (t_RoundCon U64 (solve_lift (ret_both (5532061633213252278 : int64))); U64 (solve_lift (ret_both (6448918945643986474 : int64))); U64 (solve_lift (ret_both (6902733635092675308 : int64))); - U64 (solve_lift (ret_both (7801388544844847127 : int64)))]) : both L I (t_RoundConstantsTable). + U64 (solve_lift (ret_both (7801388544844847127 : int64)))]) : both t_RoundConstantsTable. Fail Next Obligation. -Definition h_loc : Location := - (t_Hash;2%nat). -Equations shuffle {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (ws : both L1 I1 (t_RoundConstantsTable)) (hashi : both L2 I2 (t_Hash)) : both (L1 :|: L2 :|: fset [h_loc;tmp_loc]) (I1 :|: I2) (t_Hash) := +Equations shuffle (ws : both t_RoundConstantsTable) (hashi : both t_Hash) : both t_Hash := shuffle ws hashi := - letb h loc(h_loc) := hashi in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := v_K_SIZE))) (fun i => - ssp (fun _ => - letb a0 := h.a[(ret_both (0 : int32))] in - letb b0 := h.a[(ret_both (1 : int32))] in - letb c0 := h.a[(ret_both (2 : int32))] in - letb d0 := h.a[(ret_both (3 : int32))] in - letb e0 := h.a[(ret_both (4 : int32))] in - letb f0 := h.a[(ret_both (5 : int32))] in - letb g0 := h.a[(ret_both (6 : int32))] in - letb (h0 : t_U64) := h.a[(ret_both (7 : int32))] in - letb t1 := (((h0 .+ (sigma e0 (ret_both (1 : uint_size)) (ret_both (1 : uint_size)))) .+ (ch e0 f0 g0)) .+ (v_K_TABLE.a[i])) .+ (ws.a[i]) in - letb t2 := (sigma a0 (ret_both (0 : uint_size)) (ret_both (1 : uint_size))) .+ (maj a0 b0 c0) in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - solve_lift (ret_both (tt : 'unit)) : both (*2*)(L1:|:L2:|:fset [h_loc;tmp_loc]) (I1:|:I2) ('unit))) (ret_both (tt : 'unit)) in - solve_lift h : both (L1 :|: L2 :|: fset [h_loc;tmp_loc]) (I1 :|: I2) (t_Hash). + letb h := hashi in + letb h := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := v_K_SIZE))) h (fun h => fun i => + letb a0 := h.a[(ret_both (0 : int32))] in + letb b0 := h.a[(ret_both (1 : int32))] in + letb c0 := h.a[(ret_both (2 : int32))] in + letb d0 := h.a[(ret_both (3 : int32))] in + letb e0 := h.a[(ret_both (4 : int32))] in + letb f0 := h.a[(ret_both (5 : int32))] in + letb g0 := h.a[(ret_both (6 : int32))] in + letb (h0 : t_U64) := h.a[(ret_both (7 : int32))] in + letb t1 := (((h0 .+ (sigma e0 (ret_both (1 : uint_size)) (ret_both (1 : uint_size)))) .+ (ch e0 f0 g0)) .+ (v_K_TABLE.a[i])) .+ (ws.a[i]) in + letb t2 := (sigma a0 (ret_both (0 : uint_size)) (ret_both (1 : uint_size))) .+ (maj a0 b0 c0) in + letb h := update_at h (ret_both (0 : int32)) (t1 .+ t2) in + letb h := update_at h (ret_both (1 : int32)) a0 in + letb h := update_at h (ret_both (2 : int32)) b0 in + letb h := update_at h (ret_both (3 : int32)) c0 in + letb h := update_at h (ret_both (4 : int32)) (d0 .+ t1) in + letb h := update_at h (ret_both (5 : int32)) e0 in + letb h := update_at h (ret_both (6 : int32)) f0 in + letb h := update_at h (ret_both (7 : int32)) g0 in + h) in + solve_lift h : both t_Hash. Fail Next Obligation. -Definition h_loc : Location := - (t_Hash;3%nat). -Equations compress {L1 : {fset Location}} {L2 : {fset Location}} {I1 : Interface} {I2 : Interface} (block : both L1 I1 (t_Block)) (h_in : both L2 I2 (t_Hash)) : both (L1 :|: L2 :|: fset [h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) (I1 :|: I2) (t_Hash) := +Equations compress (block : both t_Block) (h_in : both t_Hash) : both t_Hash := compress block h_in := letb s := schedule block in - letb h loc(h_loc) := shuffle s h_in in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := ret_both (8 : int32)))) (fun i => - ssp (fun _ => - assign todo(term) : both (*4*)(L1:|:L2:|:fset [h_loc;h_loc;s_loc;tmp_loc]) (I1:|:I2) ('unit))) (ret_both (tt : 'unit)) in - solve_lift h : both (L1 :|: L2 :|: fset [h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) (I1 :|: I2) (t_Hash). + letb h := shuffle s h_in in + letb h := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : int32)) (f_end := ret_both (8 : int32)))) h (fun h => fun i => + update_at h i ((h.a[i]) .+ (h_in.a[i]))) in + solve_lift h : both t_Hash. Fail Next Obligation. -Definition h_loc : Location := - (t_Hash;4%nat). -Definition last_block_loc : Location := - (t_Block;5%nat). -Definition last_block_len_loc : Location := - (uint_size;6%nat). -Definition pad_block_loc : Location := - (t_Block;7%nat). -Equations hash {L1 : {fset Location}} {I1 : Interface} (msg : both L1 I1 (t_Seq (t_U8))) : both (L1 :|: fset [h_loc;last_block_loc;last_block_len_loc;pad_block_loc;h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) I1 (t_Sha512Digest) := +Equations hash (msg : both (t_Seq t_U8)) : both t_Sha512Digest := hash msg := - letb h loc(h_loc) := v_HASH_INIT in - letb last_block loc(last_block_loc) := impl__Block__new (ret_both (tt : 'unit)) in - letb last_block_len loc(last_block_len_loc) := ret_both (0 : uint_size) in - letb _ := foldi_both_list (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__num_chunks msg v_BLOCK_SIZE))) (fun i => - ssp (fun _ => - letb '(block_len,block) := impl_41__get_chunk msg v_BLOCK_SIZE i in - solve_lift (ifb block_len <.? v_BLOCK_SIZE - then letb _ := assign todo(term) in - letb _ := assign todo(term) in - ret_both (tt : 'unit) - else letb compress_input := impl__Block__from_seq block in - letb _ := assign todo(term) in - ret_both (tt : 'unit)) : both (*5*)(L1:|:L1:|:fset [h_loc;h_loc;h_loc;s_loc;tmp_loc]) (I1:|:I1) ('unit))) (ret_both (tt : 'unit)) in - letb _ := assign todo(term) in + letb h := v_HASH_INIT in + letb last_block := impl__Block__new (ret_both (tt : 'unit)) in + letb last_block_len := ret_both (0 : uint_size) in + letb '(h,last_block,last_block_len) := f_fold (f_into_iter (Build_t_Range (f_start := ret_both (0 : uint_size)) (f_end := impl_41__num_chunks msg v_BLOCK_SIZE))) (prod_b (h,last_block,last_block_len)) (fun '(h,last_block,last_block_len) => fun i => + letb '(block_len,block) := impl_41__get_chunk msg v_BLOCK_SIZE i in + ifb block_len <.? v_BLOCK_SIZE + then letb last_block := f_update_start (impl__Block__new (ret_both (tt : 'unit))) block in + letb last_block_len := block_len in + prod_b (h,last_block,last_block_len) + else letb compress_input := impl__Block__from_seq block in + letb h := compress compress_input h in + prod_b (h,last_block,last_block_len)) in + letb last_block := update_at_usize last_block last_block_len (U8 (ret_both (128 : int8))) in letb len_bist := U128 (cast_int (WS2 := _) ((impl_41__len msg) .* (ret_both (8 : uint_size)))) in - letb _ := ifb last_block_len <.? (v_BLOCK_SIZE .- v_LEN_SIZE) - then letb _ := assign todo(term) in - letb _ := assign todo(term) in - ret_both (tt : 'unit) - else letb pad_block loc(pad_block_loc) := impl__Block__new (ret_both (tt : 'unit)) in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - letb _ := assign todo(term) in - ret_both (tt : 'unit) in - solve_lift (impl__Sha512Digest__from_seq (impl__Hash__to_be_bytes h)) : both (L1 :|: fset [h_loc;last_block_loc;last_block_len_loc;pad_block_loc;h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) I1 (t_Sha512Digest). + letb '(h,last_block) := ifb last_block_len <.? (v_BLOCK_SIZE .- v_LEN_SIZE) + then letb last_block := f_update last_block (v_BLOCK_SIZE .- v_LEN_SIZE) (v_U128_to_be_bytes len_bist) in + letb h := compress last_block h in + prod_b (h,last_block) + else letb pad_block := impl__Block__new (ret_both (tt : 'unit)) in + letb pad_block := f_update pad_block (v_BLOCK_SIZE .- v_LEN_SIZE) (v_U128_to_be_bytes len_bist) in + letb h := compress last_block h in + letb h := compress pad_block h in + prod_b (h,last_block) in + solve_lift (impl__Sha512Digest__from_seq (impl__Hash__to_be_bytes h)) : both t_Sha512Digest. Fail Next Obligation. -Equations sha512 {L1 : {fset Location}} {I1 : Interface} (msg : both L1 I1 (t_Seq (t_U8))) : both (L1 :|: fset [h_loc;last_block_loc;last_block_len_loc;pad_block_loc;h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) I1 (t_Sha512Digest) := +Equations sha512 (msg : both (t_Seq t_U8)) : both t_Sha512Digest := sha512 msg := - solve_lift (hash msg) : both (L1 :|: fset [h_loc;last_block_loc;last_block_len_loc;pad_block_loc;h_loc;s_loc;tmp_loc;h_loc;tmp_loc]) I1 (t_Sha512Digest). + solve_lift (hash msg) : both t_Sha512Digest. Fail Next Obligation.